[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [virtio] [PATCH] used ring: define the meaning and requirements of the len field.
On Tue, Apr 07, 2015 at 10:54:49AM +0930, Rusty Russell wrote: > "Michael S. Tsirkin" <mst@redhat.com> writes: > > On Fri, Mar 20, 2015 at 11:48:55AM +1030, Rusty Russell wrote: > >> +\devicenormative{\subsubsection}{Virtqueue Notification Suppression}{Basic Facilities of a Virtio Device / Virtqueues / The Virtqueue Used Ring} > >> + > >> +The device MUST set \field{len} prior to updating the used \field{idx}. > >> + > >> +The device MUST write at least \field{len} bytes to descriptor, > >> +beginning at the first device-writable buffer, > >> +prior to updating the used \field{idx}. > >> + > >> +The device MAY write more than \field{len} bytes to descriptor. > >> + > >> +\begin{note} > >> +There are potential error cases where a device might not know what > >> +parts of the buffers have been written. This is why \field{len} is > >> +permitted to be an underestimate: that's preferable to the driver believing > >> +that uninitialized memory has been overwritten when it has not. > >> +\end{note} > >> + > >> +\drivernormative{\subsubsection}{Virtqueue Notification Suppression}{Basic Facilities of a Virtio Device / Virtqueues / The Virtqueue Used Ring} > >> + > >> +The driver MUST NOT make assumptions about data in device-writable buffers > >> +beyond the first \field{len} bytes, and SHOULD ignore this data. > >> + > >> \subsection{Virtqueue Notification Suppression}\label{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Notification Suppression} > >> > >> The device can suppress notifications in a manner analogous to the way > > > > We know legacy devices don't follow this, so we also need some text in > > the legacy sections to document the differences. > > Indeed, but it was specific to block devices. > > It may be worth noting that older block devices would set erroneously > set a length corresponding to the entire buffer length, and thus legacy > drivers SHOULD rely on the status byte and ignore used.len? > > Cheers, > Rusty. QEMU before 1.3 also set used len in tx descriptor to packet length. -- MST
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]