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.z...@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

Reply via email to