virtio-net: Clarify virtio_net_hdr size and rx buffer size
cover virtio-net: Clarify virtio_net_hdr size and rx buffer size
There are few small issues around size of receive buffer and size of the struct virtio_net_hdr as following.
1. VIRTIO_NET_F_HASH_REPORT is only applicable on the rx side processing. However it changes the size of the struct virtio_net_hdr for the tx side as well. This was not clarified when VIRTIO_NET_F_HASH_REPORT feature was introduced.
2. Receive buffer size calculation description and requirements did not reflect negotiation of VIRTIO_NET_F_HASH_REPORT.
3. Receive buffer size calculation was incorrect for ipv6 guest gso feature.
Above issue 2 was reported in [1].
Since issue 2 and 3 both touches the same set of requirements and description, they are updated under a new issue along with tx side fix as well touching the clarification needed for VIRTIO_NET_F_HASH_REPORT.
Hence above three issues are fixed under issue of [2].
Patch summary:
patch-1 fixes receive side description and requirement patch-2 adds transmit side clarification for VIRTIO_NET_F_HASH_REPORT
changelog:v0->v1:
- addressed comments from Xuan to rewrite tx normative
Parav Pandit (2):
virtio-net: Fix receive buffer size calculation text
virtio-net: Clarify the size of the struct virtio_net_hdr for tx
device-types/net/description.tex | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-)
Signature · 18 lines
2.34.1 This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC. In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting. Subscribe: [email protected] Unsubscribe: [email protected] List help: [email protected] List archive: https://lists.oasis-open.org/archives/virtio-comment/ Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists Committee: https://www.oasis-open.org/committees/virtio/ Join OASIS: https://www.oasis-open.org/join/
PATCH 1/2 virtio-net: Fix receive buffer size calculation text
Receive buffer size calculation is based on the following negotiated features.
The text has wrong calculation for IPv6 and also it has missed VIRTIO_NET_F_HASH_REPORT.
The problem of igorance of VIRTIO_NET_F_HASH_REPORT is reported in [1], however fix for ipv6 payload length must also be considered.
Since for the both the fixes touching same requirements, a new issue is created as [2].
This patch brings following fixes.
1. Fix annotating struct virtio_net_hdr as field
2. Fix receive buffer calculation for guest GSO cases to consider ipv6 payload length
3. small grammar corrections for article
4. reword the requirement to consider the virtio_ndr_hdr which is depends on the negotiated feature, hence first clarify the struct virtio_net_hdr size
[1] https://github.com/oasis-tcs/virtio-spec/issues/170
[2] https://github.com/oasis-tcs/virtio-spec/issues/183
--- device-types/net/description.tex | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-)
device-types/net/description.tex +18 -7
@@ -657,24 +657,35 @@ \subsubsection{Setting Up Receive Buffers}\label{sec:Device Types / Network Devi If the VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, VIRTIO_NET_F_GUEST_UFO, VIRTIO_NET_F_GUEST_USO4 or VIRTIO_NET_F_GUEST_USO6 features are used, the maximum incoming packet -will be to 65550 bytes long (the maximum size of a -TCP or UDP packet, plus the 14 byte ethernet header), otherwise -1514 bytes. The 12-byte struct virtio_net_hdr is prepended to this, -making for 65562 or 1526 bytes. +will of size 65589 bytes long (14 bytes of Ethernet header, plus 40 bytes of +the IPv6 header, plus 65535 bytes of maximum IPv6 payload including any +extension header) otherwise 1514 bytes. +When VIRTIO_NET_F_HASH_REPORT is not negotiated, the required receive buffer +size is either 65601 or 1526 bytes. +When VIRTIO_NET_F_HASH_REPORT is negotiated, the required receive buffer +size is either 65609 or 1534 bytes. \drivernormative{\paragraph}{Setting Up Receive Buffers}{Device Types / Network Device / Device Operation / Setting Up Receive Buffers} +If VIRTIO_NET_F_HASH_REPORT is not negotiated, the size of the field +\field{struct virtio_net_hdr} is 12 bytes. + +If VIRTIO_NET_F_HASH_REPORT is negotiated, the size of the field +\field{struct virtio_net_hdr} is 20 bytes. + \begin{itemize} \item If VIRTIO_NET_F_MRG_RXBUF is not negotiated: \begin{itemize} \item If VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, VIRTIO_NET_F_GUEST_UFO, VIRTIO_NET_F_GUEST_USO4 or VIRTIO_NET_F_GUEST_USO6 are negotiated, the driver SHOULD populate - the receive queue(s) with buffers of at least 65562 bytes. + the receive queue(s) with buffers of at least 65589 bytes plus the size + of the \field{struct virtio_net_hdr}. \item Otherwise, the driver SHOULD populate the receive queue(s) - with buffers of at least 1526 bytes. + with buffers of at least 1514 bytes plus the size of the + \field{struct virtio_net_hdr}. \end{itemize} \item If VIRTIO_NET_F_MRG_RXBUF is negotiated, each buffer MUST be at -least the size of the struct virtio_net_hdr. +least the size of the \field{struct virtio_net_hdr}. \end{itemize} \begin{note}
Signature · 18 lines
2.34.1 This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC. In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting. Subscribe: [email protected] Unsubscribe: [email protected] List help: [email protected] List archive: https://lists.oasis-open.org/archives/virtio-comment/ Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists Committee: https://www.oasis-open.org/committees/virtio/ Join OASIS: https://www.oasis-open.org/join/
[virtio-comment] Re: [PATCH v1 1/2] virtio-net: Fix receive buffer size calculation text
Quoted 38 lines · Parav Pandit
Receive buffer size calculation is based on the following negotiated features.
The text has wrong calculation for IPv6 and also it has missed
VIRTIO_NET_F_HASH_REPORT.The problem of igorance of
VIRTIO_NET_F_HASH_REPORTis reported in [1], however fix for ipv6 payload length must also be considered.Since for the both the fixes touching same requirements, a new issue is created as [2].
This patch brings following fixes.
1. Fix annotating struct
virtio_net_hdras field
2. Fix receive buffer calculation for guest GSO cases to consider ipv6 payload length
3. small grammar corrections for article
4. reword the requirement to consider thevirtio_ndr_hdrwhich is depends on the negotiated feature, hence first clarify the structvirtio_net_hdrsize[1] https://github.com/oasis-tcs/virtio-spec/issues/170
[2] https://github.com/oasis-tcs/virtio-spec/issues/183Signed-off-by Parav Pandit <[email protected]>--- device-types/net/description.tex | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-)device-types/net/description.tex +0
-0
device-types/net/description.tex \subsubsection{Setting Up Receive Buffers}\label{sec:Device Types / Network Devi · line 660
Quoted 8 lines
device-types/net/description.tex +1
-4@@ -657,24 +657,35 @@ \subsubsection{Setting Up Receive Buffers}\label{sec:Device Types / Network Devi If the VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, VIRTIO_NET_F_GUEST_UFO, VIRTIO_NET_F_GUEST_USO4 or VIRTIO_NET_F_GUEST_USO6 features are used, the maximum incoming packet -will be to 65550 bytes long (the maximum size of a -TCP or UDP packet, plus the 14 byte ethernet header), otherwise -1514 bytes. The 12-byte struct virtio_net_hdr is prepended to this, -making for 65562 or 1526 bytes. +will of size 65589 bytes long (14 bytes of Ethernet header, plus 40 bytes of
Either "will be 65589 bytes long" or "will be of 65589 bytes size" (I'd prefer the former.)
device-types/net/description.tex \subsubsection{Setting Up Receive Buffers}\label{sec:Device Types / Network Devi · line 662
Quoted 2 lines
device-types/net/description.tex +2
-0+the IPv6 header, plus 65535 bytes of maximum IPv6 payload including any +extension header) otherwise 1514 bytes.
s/ otherwise/, otherwise/
device-types/net/description.tex \subsubsection{Setting Up Receive Buffers}\label{sec:Device Types / Network Devi · line 674
Quoted 12 lines
device-types/net/description.tex +9
-0+When VIRTIO_NET_F_HASH_REPORT is not negotiated, the required receive buffer +size is either 65601 or 1526 bytes. +When VIRTIO_NET_F_HASH_REPORT is negotiated, the required receive buffer +size is either 65609 or 1534 bytes. \drivernormative{\paragraph}{Setting Up Receive Buffers}{Device Types / Network Device / Device Operation / Setting Up Receive Buffers} +If VIRTIO_NET_F_HASH_REPORT is not negotiated, the size of the field +\field{struct virtio_net_hdr} is 12 bytes. + +If VIRTIO_NET_F_HASH_REPORT is negotiated, the size of the field +\field{struct virtio_net_hdr} is 20 bytes.
This reads a bit odd because these two are not normative statements. I'd rather include this information into the actual statements.
device-types/net/description.tex \subsubsection{Setting Up Receive Buffers}\label{sec:Device Types / Network Devi · line 682
Quoted 9 lines
device-types/net/description.tex +3
-1+ \begin{itemize} \item If VIRTIO_NET_F_MRG_RXBUF is not negotiated: \begin{itemize} \item If VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, VIRTIO_NET_F_GUEST_UFO, VIRTIO_NET_F_GUEST_USO4 or VIRTIO_NET_F_GUEST_USO6 are negotiated, the driver SHOULD populate - the receive queue(s) with buffers of at least 65562 bytes. + the receive queue(s) with buffers of at least 65589 bytes plus the size + of the \field{struct virtio_net_hdr}.
"with buffers of at least 65609 bytes if VIRTIO_NET_F_HASH_REPORT is negotiated, and of at least 65601 bytes if not."
device-types/net/description.tex \subsubsection{Setting Up Receive Buffers}\label{sec:Device Types / Network Devi · line 685
Quoted 4 lines
device-types/net/description.tex +2
-1\item Otherwise, the driver SHOULD populate the receive queue(s) - with buffers of at least 1526 bytes. + with buffers of at least 1514 bytes plus the size of the + \field{struct virtio_net_hdr}.
"with buffers of at least 1534 bytes if VIRTIO_NET_F_HASH_REPORT is negotiated, and of at least 1526 bytes if not."
device-types/net/description.tex \subsubsection{Setting Up Receive Buffers}\label{sec:Device Types / Network Devi · line 688
Quoted 4 lines
device-types/net/description.tex +1
-1\end{itemize} \item If VIRTIO_NET_F_MRG_RXBUF is negotiated, each buffer MUST be at -least the size of the struct virtio_net_hdr. +least the size of the \field{struct virtio_net_hdr}.
If you reformat it like that, I'd drop the "the", and also state the lenght explictly:
"each buffer MUST be at least the size of \field{struct virtio_net_hdr}, i.e. 20 bytes if VIRTIO_NET_F_HASH_REPORT is negotiated, and 12 bytes if not."
This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.
In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.
Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
PATCH 2/2 virtio-net: Clarify the size of the struct virtio_net_hdr for tx
In reply to Parav PanditThe feature VIRTIO_NET_F_HASH_REPORT only applies to the receive side. However, when VIRTIO_NET_F_HASH_REPORT feature was introduced, it was not clarified that the size of the struct virtio_net_hdr on the packet transmission also uses higher size when VIRTIO_NET_F_HASH_REPORT is negotiated.
Explicitly clarify this.
---
changelog:v0->v1:
- addressed comments from Xuan to rewrite tx normative
--- device-types/net/description.tex | 3 +++ 1 file changed, 3 insertions(+)
device-types/net/description.tex +3 -0
@@ -528,6 +528,9 @@ \subsubsection{Packet Transmission}\label{sec:Device Types / Network Device / De \drivernormative{\paragraph}{Packet Transmission}{Device Types / Network Device / Device Operation / Packet Transmission} +The driver MUST use the same size of the field \field{struct virtio_net_hdr} +for transmit and receive packet buffers. + The driver MUST set \field{num_buffers} to zero. If VIRTIO_NET_F_CSUM is not negotiated, the driver MUST set
Signature · 18 lines
2.34.1 This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC. In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting. Subscribe: [email protected] Unsubscribe: [email protected] List help: [email protected] List archive: https://lists.oasis-open.org/archives/virtio-comment/ Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists Committee: https://www.oasis-open.org/committees/virtio/ Join OASIS: https://www.oasis-open.org/join/
Hi Cornelia,
Quoted 29 lines
From: Parav Pandit <[email protected]>
Sent: Friday, January 5, 2024 1:31 PM
To: [email protected]; [email protected]; [email protected]
Cc: Shahaf Shuler <[email protected]>; [email protected]; [email protected]; Parav Pandit <[email protected]>
Subject: [PATCH v1 0/2] virtio-net: Clarifyvirtio_net_hdrsize and rx buffer sizeThere are few small issues around size of receive buffer and size of the struct
virtio_net_hdras following.1.
VIRTIO_NET_F_HASH_REPORTis only applicable on the rx side processing. However it changes the size of the structvirtio_net_hdrfor the tx side as well. This was not clarified whenVIRTIO_NET_F_HASH_REPORTfeature
was
introduced.2. Receive buffer size calculation description and requirements did not reflect negotiation of
VIRTIO_NET_F_HASH_REPORT.3. Receive buffer size calculation was incorrect for ipv6 guest gso feature.
Above issue 2 was reported in [1].
Since issue 2 and 3 both touches the same set of requirements and description, they are updated under a new issue along with tx side fix as well touching the clarification needed forVIRTIO_NET_F_HASH_REPORT.Hence above three issues are fixed under issue of [2].
Quoted 8 lines
Patch summary:
patch-1 fixes receive side description and requirement patch-2 adds transmit side clarification forVIRTIO_NET_F_HASH_REPORTchangelog:
v0->v1:
- addressed comments from Xuan to rewrite tx normative
Can you please raise the voting request for these two small description changes?
Quoted 9 lines
Parav Pandit (2):
virtio-net: Fix receive buffer size calculation text
virtio-net: Clarify the size of the structvirtio_net_hdrfor txdevice-types/net/description.tex | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-)--
2.34.1
This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.
In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.
Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
Hi Cornelia,
Quoted 46 lines
From: [email protected] <[email protected] open.org> On Behalf Of Parav Pandit
Sent: Monday, January 15, 2024 11:30 AM
To: [email protected]; [email protected]; [email protected]
Cc: Shahaf Shuler <[email protected]>; [email protected]; [email protected]
Subject: [virtio-comment] RE: [PATCH v1 0/2] virtio-net: Clarifyvirtio_net_hdrsize and rx buffer sizeHi Cornelia,
Quoted 34 lines
From: Parav Pandit <[email protected]>
Sent: Friday, January 5, 2024 1:31 PM
To: [email protected]; [email protected]; [email protected]
Cc: Shahaf Shuler <[email protected]>; [email protected]; [email protected]; Parav Pandit <[email protected]>
Subject: [PATCH v1 0/2] virtio-net: Clarifyvirtio_net_hdrsize and rx buffer sizeThere are few small issues around size of receive buffer and size of the struct
virtio_net_hdras following.1.
VIRTIO_NET_F_HASH_REPORTis only applicable on the rx side processing. However it changes the size of the structvirtio_net_hdrfor the tx side as well. This was not clarified whenVIRTIO_NET_F_HASH_REPORT
feature was
introduced.2. Receive buffer size calculation description and requirements did not reflect negotiation of
VIRTIO_NET_F_HASH_REPORT.3. Receive buffer size calculation was incorrect for ipv6 guest gso feature.
Above issue 2 was reported in [1].
Since issue 2 and 3 both touches the same set of requirements and description, they are updated under a new issue along with tx side fix as well touching the clarification needed forVIRTIO_NET_F_HASH_REPORT.Hence above three issues are fixed under issue of [2].
Patch summary:
patch-1 fixes receive side description and requirement patch-2 adds transmit side clarification forVIRTIO_NET_F_HASH_REPORT
Quoted 7 lines
Quoted 4 lines
changelog:
v0->v1:
- addressed comments from Xuan to rewrite tx normativeCan you please raise the voting request for these two small description changes?
I missed your response to patch_1. Fixing it in v2. Please ignore my above request for vote. Will ask after posting v2.
Thanks.
This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.
In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.
Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/