From: Lorenzo Bianconi <lorenzo@kernel.org> Date: 2021-05-28 17:44:03
Enable xdp rx checksum offload support for CHECKSUM_UNNECESSARY use-case.
Introduce flag field in xdp_buff/xdp_frame in order to save the checksum
result from the NIC and have a fast access to it performing XDP_REDIRECT.
CHECKSUM_COMPLETE is not supported yet since it will require adding the
csum result to the xdp_metadata area.
Moreover flag field will be reused for xdp multi-buff support.
This series has been tested generating UDP traffic with pktgen and performing
a xdp_redirect from an ixgbe device to a remote CPUMAP entry. PPS results show
a negligible penalty respect to the baseline where the UDP checksum has been
disabled. More info about the test can be found here [0].
[0] https://github.com/xdp-project/xdp-project/blob/master/areas/core/xdp_frame01_checksum.org
Lorenzo Bianconi (4):
net: xdp: introduce flags field in xdp_buff and xdp_frame
mvneta: return csum computation result from mvneta_rx_csum
net: mvneta: report csum result in xdp_buff
net: xdp: update csum building the skb
drivers/net/ethernet/marvell/mvneta.c | 27 ++++++++------------
include/net/xdp.h | 36 +++++++++++++++++++++++++++
net/core/xdp.c | 2 +-
3 files changed, 48 insertions(+), 17 deletions(-)
--
2.31.1
From: Lorenzo Bianconi <lorenzo@kernel.org> Date: 2021-05-28 17:44:10
Introduce flag field in xdp_buff and xdp_frame data structure in order
to report xdp_buffer metadata. For the moment just hw checksum hints
are defined but flags field will be reused for xdp multi-buffer
For the moment just CHECKSUM_UNNECESSARY is supported.
CHECKSUM_COMPLETE will need to set csum value in metada space.
Co-developed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
include/net/xdp.h | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
From: Lorenzo Bianconi <lorenzo@kernel.org> Date: 2021-05-28 17:44:18
This is a preliminary patch to add hw csum hint support to mvneta xdp
implementation
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
drivers/net/ethernet/marvell/mvneta.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
@@ -1805,18 +1805,14 @@ static void mvneta_rx_error(struct mvneta_port *pp,}/* Handle RX checksum offload based on the descriptor's status */-staticvoidmvneta_rx_csum(structmvneta_port*pp,u32status,-structsk_buff*skb)+staticintmvneta_rx_csum(structmvneta_port*pp,u32status){if((pp->dev->features&NETIF_F_RXCSUM)&&(status&MVNETA_RXD_L3_IP4)&&-(status&MVNETA_RXD_L4_CSUM_OK)){-skb->csum=0;-skb->ip_summed=CHECKSUM_UNNECESSARY;-return;-}+(status&MVNETA_RXD_L4_CSUM_OK))+returnCHECKSUM_UNNECESSARY;-skb->ip_summed=CHECKSUM_NONE;+returnCHECKSUM_NONE;}/* Return tx queue pointer (find last set bit) according to <cause> returned
From: Lorenzo Bianconi <lorenzo@kernel.org> Date: 2021-05-28 17:44:25
update skb->ip_summed and skb->csum filed building the skb in
__xdp_build_skb_from_frame routine
Co-developed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
net/core/xdp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: David Ahern <hidden> Date: 2021-05-28 18:01:24
On 5/28/21 11:43 AM, Lorenzo Bianconi wrote:
Enable xdp rx checksum offload support for CHECKSUM_UNNECESSARY use-case.
Introduce flag field in xdp_buff/xdp_frame in order to save the checksum
result from the NIC and have a fast access to it performing XDP_REDIRECT.
CHECKSUM_COMPLETE is not supported yet since it will require adding the
csum result to the xdp_metadata area.
Moreover flag field will be reused for xdp multi-buff support.
This series has been tested generating UDP traffic with pktgen and performing
a xdp_redirect from an ixgbe device to a remote CPUMAP entry. PPS results show
a negligible penalty respect to the baseline where the UDP checksum has been
disabled. More info about the test can be found here [0].
[0] https://github.com/xdp-project/xdp-project/blob/master/areas/core/xdp_frame01_checksum.org
For the wider audience, another example of the performance benefit of
this rather simple change is XDP_REDIRECT to VMs (and containers) for
TCP traffic which requires checksum.
The VM piece requires the change to the tun driver from my original
patch which passes the VIRTIO_NET_HDR_F_DATA_VALID flag for
CHECKSUM_UNNECESSARY:
https://github.com/dsahern/linux/commit/b6b4d4ef9562383d8b407a873d30082afdc1b89c
(I can send that followup after this set lands.)
Using ConnectX-5 and the mlx5 change in the above commit I was seeing at
least a 300k pps improvement depending on the test. e.g., from 2M pps to
2.3M for 1500 MTU packets or 1.3M to 1.6M for 3400 MTU.
Similar results for containers.
Right now the checksum validation done by H/W is lost on the redirect.
This change propagates the validation and avoids the csum_partial
overhead as the skb is processed.
From: Tom Herbert <hidden> Date: 2021-05-28 21:18:48
On Fri, May 28, 2021 at 10:44 AM Lorenzo Bianconi [off-list ref] wrote:
Introduce flag field in xdp_buff and xdp_frame data structure in order
to report xdp_buffer metadata. For the moment just hw checksum hints
are defined but flags field will be reused for xdp multi-buffer
For the moment just CHECKSUM_UNNECESSARY is supported.
CHECKSUM_COMPLETE will need to set csum value in metada space.
Lorenzo,
This isn't sufficient for the checksum-unnecessary interface, we'd
also need ability to set csum_level for cases the device validated
more than one checksum.
IMO, we shouldn't support CHECKSUM_UNNECESSARY for new uses like this.
For years now, the Linux community has been pleading with vendors to
provide CHECKSUM_COMPLETE which is far more useful and robust than
CHECSUM_UNNECESSARY, and yet some still haven't got with the program
even though we see more and more instances where CHECKSUM_UNNECESSARY
doesn't even work at all (e.g. cases with SRv6, new encaps device
doesn't understand). I believe it's time to take a stand! :-)
Tom
quoted hunk
Signed-off-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
include/net/xdp.h | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
From: David Ahern <hidden> Date: 2021-05-29 01:33:25
On 5/28/21 3:18 PM, Tom Herbert wrote:
On Fri, May 28, 2021 at 10:44 AM Lorenzo Bianconi [off-list ref] wrote:
quoted
Introduce flag field in xdp_buff and xdp_frame data structure in order
to report xdp_buffer metadata. For the moment just hw checksum hints
are defined but flags field will be reused for xdp multi-buffer
For the moment just CHECKSUM_UNNECESSARY is supported.
CHECKSUM_COMPLETE will need to set csum value in metada space.
Lorenzo,
This isn't sufficient for the checksum-unnecessary interface, we'd
also need ability to set csum_level for cases the device validated
more than one checksum.
That's on me. The original patch was for XDP_REDIRECT to VMs and the
VIRTIO_NET_HDR_ API does not support csum_level.
VIRTIO_NET_HDR_F_DATA_VALID means CHECKSUM_UNNECESSARY, an API
implemented 10 years ago.
IMO, we shouldn't support CHECKSUM_UNNECESSARY for new uses like this.
For years now, the Linux community has been pleading with vendors to
provide CHECKSUM_COMPLETE which is far more useful and robust than
CHECSUM_UNNECESSARY, and yet some still haven't got with the program
even though we see more and more instances where CHECKSUM_UNNECESSARY
doesn't even work at all (e.g. cases with SRv6, new encaps device
doesn't understand). I believe it's time to take a stand! :-)
There is no new hardware or new feature at play here. This about XDP
frames getting the checksum validation setting that an skb enjoys today.
You are taking a stand against S/W equivalency with the existing NICs?
That basically penalizes XDP, continuing to limit its usefulness with
very well established use cases that could benefit from it.
From: Jakub Kicinski <kuba@kernel.org> Date: 2021-05-29 04:56:58
On Fri, 28 May 2021 14:18:33 -0700 Tom Herbert wrote:
On Fri, May 28, 2021 at 10:44 AM Lorenzo Bianconi [off-list ref] wrote:
quoted
Introduce flag field in xdp_buff and xdp_frame data structure in order
to report xdp_buffer metadata. For the moment just hw checksum hints
are defined but flags field will be reused for xdp multi-buffer
For the moment just CHECKSUM_UNNECESSARY is supported.
CHECKSUM_COMPLETE will need to set csum value in metada space.
Lorenzo,
This isn't sufficient for the checksum-unnecessary interface, we'd
also need ability to set csum_level for cases the device validated
more than one checksum.
IMO, we shouldn't support CHECKSUM_UNNECESSARY for new uses like this.
For years now, the Linux community has been pleading with vendors to
provide CHECKSUM_COMPLETE which is far more useful and robust than
CHECSUM_UNNECESSARY, and yet some still haven't got with the program
even though we see more and more instances where CHECKSUM_UNNECESSARY
doesn't even work at all (e.g. cases with SRv6, new encaps device
doesn't understand). I believe it's time to take a stand! :-)
I must agree. Not supporting CHECKSUM_COMPLETE seems like a step back.
From: Lorenzo Bianconi <lorenzo@kernel.org> Date: 2021-05-29 13:34:26
On Fri, May 28, 2021 at 10:44 AM Lorenzo Bianconi [off-list ref] wrote:
quoted
Introduce flag field in xdp_buff and xdp_frame data structure in order
to report xdp_buffer metadata. For the moment just hw checksum hints
are defined but flags field will be reused for xdp multi-buffer
For the moment just CHECKSUM_UNNECESSARY is supported.
CHECKSUM_COMPLETE will need to set csum value in metada space.
Lorenzo,
Hi Tom,
This isn't sufficient for the checksum-unnecessary interface, we'd
also need ability to set csum_level for cases the device validated
more than one checksum.
ack, right. I guess we can put this info in xdp metadata or do you think we can
add it in xdp_buff/xdp_frame as well?
IMO, we shouldn't support CHECKSUM_UNNECESSARY for new uses like this.
For years now, the Linux community has been pleading with vendors to
provide CHECKSUM_COMPLETE which is far more useful and robust than
CHECSUM_UNNECESSARY, and yet some still haven't got with the program
even though we see more and more instances where CHECKSUM_UNNECESSARY
doesn't even work at all (e.g. cases with SRv6, new encaps device
doesn't understand). I believe it's time to take a stand! :-)
I completely agree CHECKSUM_COMPLETE is more useful and robust than
CHECSUM_UNNECESSARY and I want to add support for it as soon as we
agree on the best way to do it. At the same time there are plenty of
XDP NICs where this feature is quite useful since they support just
CHECSUM_UNNECESSARY.
Regards,
Lorenzo
Tom
quoted
Signed-off-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
include/net/xdp.h | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
From: Lorenzo Bianconi <lorenzo@kernel.org> Date: 2021-05-29 13:37:35
On Fri, 28 May 2021 14:18:33 -0700 Tom Herbert wrote:
quoted
On Fri, May 28, 2021 at 10:44 AM Lorenzo Bianconi [off-list ref] wrote:
quoted
Introduce flag field in xdp_buff and xdp_frame data structure in order
to report xdp_buffer metadata. For the moment just hw checksum hints
are defined but flags field will be reused for xdp multi-buffer
For the moment just CHECKSUM_UNNECESSARY is supported.
CHECKSUM_COMPLETE will need to set csum value in metada space.
Lorenzo,
This isn't sufficient for the checksum-unnecessary interface, we'd
also need ability to set csum_level for cases the device validated
more than one checksum.
IMO, we shouldn't support CHECKSUM_UNNECESSARY for new uses like this.
For years now, the Linux community has been pleading with vendors to
provide CHECKSUM_COMPLETE which is far more useful and robust than
CHECSUM_UNNECESSARY, and yet some still haven't got with the program
even though we see more and more instances where CHECKSUM_UNNECESSARY
doesn't even work at all (e.g. cases with SRv6, new encaps device
doesn't understand). I believe it's time to take a stand! :-)
I must agree. Not supporting CHECKSUM_COMPLETE seems like a step back.
I completely agree on it and I want add support for CHECKSUM_COMPLETE as soon
as we decide what is the best way to store csum value (xdp_metadata?). At the
same time this preliminary series wants to add support just for
CHECSUM_UNNECESSARY. Moreover the flags field in xdp_buff/xdp_frame will be
reused for xdp multi-buff work.
Regards,
Lorenzo
On Sat, 29 May 2021 15:34:18 +0200
Lorenzo Bianconi [off-list ref] wrote:
quoted
On Fri, May 28, 2021 at 10:44 AM Lorenzo Bianconi [off-list ref] wrote:
quoted
Introduce flag field in xdp_buff and xdp_frame data structure in order
to report xdp_buffer metadata. For the moment just hw checksum hints
are defined but flags field will be reused for xdp multi-buffer
For the moment just CHECKSUM_UNNECESSARY is supported.
CHECKSUM_COMPLETE will need to set csum value in metada space.
Lorenzo,
Hi Tom,
quoted
This isn't sufficient for the checksum-unnecessary interface, we'd
also need ability to set csum_level for cases the device validated
more than one checksum.
ack, right. I guess we can put this info in xdp metadata or do you
think we can add it in xdp_buff/xdp_frame as well?
This is an interesting question as where do we draw the line. I
definitely only don't want to add the same information in two places.
As is clear by the XDP-hints discussion: Today we are lacking *kernel*
infrastructure to interpret the XDP-metadata area when we create the
SKB from xdp_frame. I want to add this capability...
(See XDP-hints discussion, as wisely pointed out by John, the BPF-prog
infrastructure to interpret XDP-metadata via BTF-info is already
available to userspace loading BPF-progs, but AFAIK the kernel is
lacking this capability. Maybe we will end-up loading BPF-progs that
populate SKB fields based on xdp_frame + XDP-metadata area... I'm
keeping an open mind for the solutions in this space.).
The question is really, should we wait for this infra (that can use
csum value from metadata) or should be go ahead and expand
xdp_buff/xdp_frame with an csum value (+ ip_summed) for the
CHECKSUM_COMPLETE use-case?
quoted
IMO, we shouldn't support CHECKSUM_UNNECESSARY for new uses like this.
For years now, the Linux community has been pleading with vendors to
provide CHECKSUM_COMPLETE which is far more useful and robust than
CHECSUM_UNNECESSARY, and yet some still haven't got with the program
even though we see more and more instances where CHECKSUM_UNNECESSARY
doesn't even work at all (e.g. cases with SRv6, new encaps device
doesn't understand). I believe it's time to take a stand! :-)
I completely agree CHECKSUM_COMPLETE is more useful and robust than
CHECSUM_UNNECESSARY and I want to add support for it as soon as we
agree on the best way to do it. At the same time there are plenty of
XDP NICs where this feature is quite useful since they support just
CHECSUM_UNNECESSARY.
Regards,
Lorenzo
quoted
Tom
quoted
Signed-off-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
include/net/xdp.h | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)