DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] lib/net: support UDP pseudo-header for UFO
@ 2023-01-12  9:26 Zhichao Zeng
  2023-02-08 10:35 ` Zeng, ZhichaoX
  2023-02-10 13:20 ` Olivier Matz
  0 siblings, 2 replies; 4+ messages in thread
From: Zhichao Zeng @ 2023-01-12  9:26 UTC (permalink / raw)
  To: dev; +Cc: yidingx.zhou, Zhichao Zeng, Olivier Matz

Add UDP pseudo-header processing for UDP segmentation offload
by adding the UDP_SEG flag.

Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>
---
 lib/net/rte_ip.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h
index 9c8e8206f0..4761ede747 100644
--- a/lib/net/rte_ip.h
+++ b/lib/net/rte_ip.h
@@ -345,7 +345,7 @@ rte_ipv4_phdr_cksum(const struct rte_ipv4_hdr *ipv4_hdr, uint64_t ol_flags)
 	psd_hdr.dst_addr = ipv4_hdr->dst_addr;
 	psd_hdr.zero = 0;
 	psd_hdr.proto = ipv4_hdr->next_proto_id;
-	if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) {
+	if (ol_flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG)) {
 		psd_hdr.len = 0;
 	} else {
 		l3_len = rte_be_to_cpu_16(ipv4_hdr->total_length);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] lib/net: support UDP pseudo-header for UFO
  2023-01-12  9:26 [PATCH] lib/net: support UDP pseudo-header for UFO Zhichao Zeng
@ 2023-02-08 10:35 ` Zeng, ZhichaoX
  2023-02-10 13:20 ` Olivier Matz
  1 sibling, 0 replies; 4+ messages in thread
From: Zeng, ZhichaoX @ 2023-02-08 10:35 UTC (permalink / raw)
  To: Matz, Olivier; +Cc: Zhou, YidingX, dev, Jiang, YuX, Gu, JianX, Yang, Qiming

Hi Olivier

Could you please help to review this patch? Thanks.

BR
Zhichao
> -----Original Message-----
> From: Zeng, ZhichaoX <zhichaox.zeng@intel.com>
> Sent: Thursday, January 12, 2023 5:26 PM
> To: dev@dpdk.org
> Cc: Zhou, YidingX <yidingx.zhou@intel.com>; Zeng, ZhichaoX
> <zhichaox.zeng@intel.com>; Matz, Olivier <olivier.matz@6wind.com>
> Subject: [PATCH] lib/net: support UDP pseudo-header for UFO
> 
> Add UDP pseudo-header processing for UDP segmentation offload by adding
> the UDP_SEG flag.
> 
> Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] lib/net: support UDP pseudo-header for UFO
  2023-01-12  9:26 [PATCH] lib/net: support UDP pseudo-header for UFO Zhichao Zeng
  2023-02-08 10:35 ` Zeng, ZhichaoX
@ 2023-02-10 13:20 ` Olivier Matz
  2023-02-13 10:22   ` Zeng, ZhichaoX
  1 sibling, 1 reply; 4+ messages in thread
From: Olivier Matz @ 2023-02-10 13:20 UTC (permalink / raw)
  To: Zhichao Zeng; +Cc: dev, yidingx.zhou

Hello Zhichao,

Sorry for the delayed response.

On Thu, Jan 12, 2023 at 05:26:08PM +0800, Zhichao Zeng wrote:
> Add UDP pseudo-header processing for UDP segmentation offload
> by adding the UDP_SEG flag.
> 
> Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>
> ---
>  lib/net/rte_ip.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h
> index 9c8e8206f0..4761ede747 100644
> --- a/lib/net/rte_ip.h
> +++ b/lib/net/rte_ip.h
> @@ -345,7 +345,7 @@ rte_ipv4_phdr_cksum(const struct rte_ipv4_hdr *ipv4_hdr, uint64_t ol_flags)
>  	psd_hdr.dst_addr = ipv4_hdr->dst_addr;
>  	psd_hdr.zero = 0;
>  	psd_hdr.proto = ipv4_hdr->next_proto_id;
> -	if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) {
> +	if (ol_flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG)) {
>  		psd_hdr.len = 0;
>  	} else {
>  		l3_len = rte_be_to_cpu_16(ipv4_hdr->total_length);
> -- 
> 2.25.1
> 

Can you give some more detail about how rte_ipv4_phdr_cksum() is called in your
use-case? (what driver, what libs, what use-case)

Currently, I see that only the iavf driver supports udp-segmented packets. The
lib/vhost is also able to pass the offload information to the virtio ring.

For me, the mbufs that have offload flags and that are being transmitted to a
driver should use the rte_eth_tx_prepare() API. This function will (among other
things) update the required checksums in the packet when Tx offload is set.

Most drivers call rte_net_intel_cksum_flags_prepare() in their tx_pkt_prepare
callback, so I suspect this function has to be updated. Note that updating it
may have an impact on its user that supports UDP_SEG (lib/vhost and
driver/net/iavf).

I'm not saying that the patch is wrong, but I would like to better understand
why you need it.

Regards,
Olivier

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] lib/net: support UDP pseudo-header for UFO
  2023-02-10 13:20 ` Olivier Matz
@ 2023-02-13 10:22   ` Zeng, ZhichaoX
  0 siblings, 0 replies; 4+ messages in thread
From: Zeng, ZhichaoX @ 2023-02-13 10:22 UTC (permalink / raw)
  To: Matz, Olivier; +Cc: dev, Zhou, YidingX, Jiang, YuX

Hi Olivier,

Thanks for your comments. 

Yes, this patch is to support the UDP fragmentation offload feature
in the iavf driver, which is planned to be fully supported in 23.07.

It's my fault for not clarifying the details. In addition, is it acceptable
to add the UDP_SEG flag separately now?

If it's acceptable, I'll resubmit v2 and add more details into the log.
If not, I'll submit it later with the rest code of the UFO feature.

BR
Zhichao

> -----Original Message-----
> From: Olivier Matz <olivier.matz@6wind.com>
> Sent: Friday, February 10, 2023 9:20 PM
> To: Zeng, ZhichaoX <zhichaox.zeng@intel.com>
> Cc: dev@dpdk.org; Zhou, YidingX <yidingx.zhou@intel.com>
> Subject: Re: [PATCH] lib/net: support UDP pseudo-header for UFO
> 
> Hello Zhichao,
> 
> Sorry for the delayed response.
> 
> >
> 
> Can you give some more detail about how rte_ipv4_phdr_cksum() is called in
> your
> use-case? (what driver, what libs, what use-case)
> 
> Currently, I see that only the iavf driver supports udp-segmented packets.
> The
> lib/vhost is also able to pass the offload information to the virtio ring.
> 
> For me, the mbufs that have offload flags and that are being transmitted to a
> driver should use the rte_eth_tx_prepare() API. This function will (among
> other
> things) update the required checksums in the packet when Tx offload is set.
> 
> Most drivers call rte_net_intel_cksum_flags_prepare() in their
> tx_pkt_prepare
> callback, so I suspect this function has to be updated. Note that updating it
> may have an impact on its user that supports UDP_SEG (lib/vhost and
> driver/net/iavf).
> 
> I'm not saying that the patch is wrong, but I would like to better understand
> why you need it.
> 
> Regards,
> Olivier

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-13 10:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-12  9:26 [PATCH] lib/net: support UDP pseudo-header for UFO Zhichao Zeng
2023-02-08 10:35 ` Zeng, ZhichaoX
2023-02-10 13:20 ` Olivier Matz
2023-02-13 10:22   ` Zeng, ZhichaoX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).