[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: [PATCH v3] virtio-net: Add support for correct hdr_len field.
Fixes: https://github.com/oasis-tcs/virtio-spec/issues/57 >-----Original Message----- >From: virtio-comment@lists.oasis-open.org <virtio-comment@lists.oasis- >open.org> On Behalf Of Vitaly Mireyno >Sent: Tuesday, 5 November, 2019 17:26 >To: virtio-comment@lists.oasis-open.org >Cc: Michael S. Tsirkin <mst@redhat.com>; Jason Wang ><jasowang@redhat.com> >Subject: [EXT] [virtio-comment] [PATCH v3] virtio-net: Add support for correct >hdr_len field. > >Incorporated more v1 comments > >Changes from v2: > * Added device implementation note for using hdr_len > >Signed-off-by: Vitaly Mireyno <vmireyno@marvell.com> >--- > content.tex | 56 +++++++++++++++++++++++++++++++++++++++++++----- >----- > 1 file changed, 46 insertions(+), 10 deletions(-) > >diff --git a/content.tex b/content.tex >index b1ea9b9..5d3f865 100644 >--- a/content.tex >+++ b/content.tex >@@ -2811,6 +2811,9 @@ \subsection{Feature bits}\label{sec:Device Types / >Network Device / Feature bits \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] >Set MAC address through control > channel. > >+\item[VIRTIO_NET_F_GUEST_HDRLEN(59)] Driver can provide the exact >\field{hdr_len} >+ value. Device benefits from knowing the exact header length. >+ > \item[VIRTIO_NET_F_RSC_EXT(61)] Device can process duplicated ACKs > and report number of coalesced segments and duplicated ACKs > >@@ -3095,12 +3098,21 @@ \subsubsection{Packet >Transmission}\label{sec:Device Types / Network Device / De > into smaller packets. The other gso fields are set: > > \begin{itemize} >- \item \field{hdr_len} is a hint to the device as to how much of the header >+ \item If the VIRTIO_NET_F_GUEST_HDRLEN feature has been negotiated, >+ \field{hdr_len} indicates the header length that needs to be replicated >+ for each packet. It's a number of bytes from beginning of the packet >+ to beginning of the transport payload. >+ Otherwise, if the VIRTIO_NET_F_GUEST_HDRLEN feature has not been >negotiated, >+ \field{hdr_len} is a hint to the device as to how much of the >+ header > needs to be kept to copy into each packet, usually set to the > length of the headers, including the transport header\footnote{Due to >various bugs in implementations, this field is not useful as a guarantee of the >transport header size. > }. > >+ \begin{note} >+ Some devices benefit from knowledge of the exact header length. >+ \end{note} >+ > \item \field{gso_size} is the maximum size of each packet beyond that > header (ie. MSS). > >@@ -3173,9 +3185,20 @@ \subsubsection{Packet >Transmission}\label{sec:Device Types / Network Device / De desired MSS. > > If one of the VIRTIO_NET_F_HOST_TSO4, TSO6 or UFO options have -been >negotiated, the driver SHOULD set \field{hdr_len} to a value -not less than the >length of the headers, including the transport -header. >+been negotiated: >+\begin{itemize} >+\item If the VIRTIO_NET_F_GUEST_HDRLEN feature has been negotiated, >+ the driver MUST set \field{hdr_len} to a value equal to the length >+ of the headers, including the transport header. >+ >+\item If the VIRTIO_NET_F_GUEST_HDRLEN feature has not been >negotiated, >+ the driver SHOULD set \field{hdr_len} to a value >+ not less than the length of the headers, including the transport >+ header. >+\end{itemize} >+ >+The driver SHOULD accept the VIRTIO_NET_F_GUEST_HDRLEN feature if it >+has been offered, and if it's able to provide the exact header length. > > The driver MUST NOT set the VIRTIO_NET_HDR_F_DATA_VALID and >VIRTIO_NET_HDR_F_RSC_INFO bits in \field{flags}. >@@ -3187,12 +3210,25 @@ \subsubsection{Packet >Transmission}\label{sec:Device Types / Network Device / De device MUST >NOT use the \field{csum_start} and \field{csum_offset}. > > If one of the VIRTIO_NET_F_HOST_TSO4, TSO6 or UFO options have -been >negotiated, the device MAY use \field{hdr_len} only as a hint about the - >transport header size. >-The device MUST NOT rely on \field{hdr_len} to be correct. >-\begin{note} >-This is due to various bugs in implementations. >-\end{note} >+been negotiated: >+\begin{itemize} >+\item If the VIRTIO_NET_F_GUEST_HDRLEN feature has been negotiated, >+ the device MAY use \field{hdr_len} as the transport header size. >+ >+ \begin{note} >+ Caution should be taken by the implementation so as to prevent >+ malicious driver from attacking the device by setting incorrect hdr_len. >+ \end{note} >+ >+\item If the VIRTIO_NET_F_GUEST_HDRLEN feature has not been >negotiated, >+ the device MAY use \field{hdr_len} only as a hint about the >+ transport header size. >+ The device MUST NOT rely on \field{hdr_len} to be correct. >+ >+ \begin{note} >+ This is due to various bugs in implementations. >+ \end{note} >+\end{itemize} > > If VIRTIO_NET_HDR_F_NEEDS_CSUM is not set, the device MUST NOT rely >on the packet checksum being correct. >-- > >This publicly archived list offers a means to provide input to theOASIS Virtual >I/O Device (VIRTIO) TC.In order to verify user consent to the Feedback License >terms andto minimize spam in the list archive, subscription is requiredbefore >posting.Subscribe: virtio-comment-subscribe@lists.oasis- >open.orgUnsubscribe: virtio-comment-unsubscribe@lists.oasis-open.orgList >help: virtio-comment-help@lists.oasis-open.orgList archive: >https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.oasis- >2Dopen.org_archives_virtio- >2Dcomment_&d=DwIFAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=lDHJ2FW52oJ3lq >qsArgFRdcevq01tbLQAw4A_NO7xgI&m=lWqsPbOUMgzkEVyF16L3g079hplmK >1phL1e6LJfAuy4&s=DSMXwXJqsTFsEujJH_jBRVoynoKrcp44osbLODkEc_I&e= >Feedback License: https://urldefense.proofpoint.com/v2/url?u=https- >3A__www.oasis-2Dopen.org_who_ipr_feedback- >5Flicense.pdf&d=DwIFAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=lDHJ2FW52oJ3lqq >sArgFRdcevq01tbLQAw4A_NO7xgI&m=lWqsPbOUMgzkEVyF16L3g079hplmK1 >phL1e6LJfAuy4&s=3slcwaEeqEevZXayoGcRCvapa4lifnZRMDbgpjb9PYI&e= List >Guidelines: https://urldefense.proofpoint.com/v2/url?u=https- >3A__www.oasis-2Dopen.org_policies-2Dguidelines_mailing- >2Dlists&d=DwIFAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=lDHJ2FW52oJ3lqqsArgFR >dcevq01tbLQAw4A_NO7xgI&m=lWqsPbOUMgzkEVyF16L3g079hplmK1phL1e6 >LJfAuy4&s=AVsGR-ggaGUy0qsBz5HWmNguI4IVOHfF2y3TDaIZbXw&e= >Committee: https://urldefense.proofpoint.com/v2/url?u=https- >3A__www.oasis- >2Dopen.org_committees_virtio_&d=DwIFAg&c=nKjWec2b6R0mOyPaz7xtfQ& >r=lDHJ2FW52oJ3lqqsArgFRdcevq01tbLQAw4A_NO7xgI&m=lWqsPbOUMgzkEV >yF16L3g079hplmK1phL1e6LJfAuy4&s=KbIcN3spGyCBBx1CR4KU94G4XMWnL7 >Cc1t_iZu12VeQ&e= Join OASIS: >https://urldefense.proofpoint.com/v2/url?u=https-3A__www.oasis- >2Dopen.org_join_&d=DwIFAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=lDHJ2FW52o >J3lqqsArgFRdcevq01tbLQAw4A_NO7xgI&m=lWqsPbOUMgzkEVyF16L3g079hpl >mK1phL1e6LJfAuy4&s=IEdPsXzJLvjJuJJ3KfKVQBZvyIOsBC6qKuJQp9evAwM&e >=
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]