[1/4] net: calculate correct UDP pseudo header for UFO

Message ID 20230413053401.4190743-1-zhichaox.zeng@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series support UDP fragmentation offload |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Zhichao Zeng April 13, 2023, 5:34 a.m. UTC
This commit calculates the correct pseudo header for the
UDP fragmentation offload by adding UDP_SEG flag.

Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>
---
 lib/net/rte_ip.h  | 4 ++--
 lib/net/rte_net.h | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)
  

Comments

Zhichao Zeng June 6, 2023, 7 a.m. UTC | #1
Hi Olivier,

Could you please help to review this patch? Many thanks.

Best Regards
Zhichao
> -----Original Message-----
> From: Zeng, ZhichaoX <zhichaox.zeng@intel.com>
> Sent: Thursday, April 13, 2023 1:34 PM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Xu, Ke1 <ke1.xu@intel.com>; Zeng,
> ZhichaoX <zhichaox.zeng@intel.com>; Matz, Olivier
> <olivier.matz@6wind.com>
> Subject: [PATCH 1/4] net: calculate correct UDP pseudo header for UFO
> 
> This commit calculates the correct pseudo header for the UDP fragmentation
> offload by adding UDP_SEG flag.
> 
> Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>
> ---
>  lib/net/rte_ip.h  | 4 ++--
>  lib/net/rte_net.h | 5 +++--
>  2 files changed, 5 insertions(+), 4 deletions(-)
>
  
Olivier Matz June 6, 2023, 3:19 p.m. UTC | #2
Hi Zeng,

On Thu, Apr 13, 2023 at 01:34:00PM +0800, Zhichao Zeng wrote:
> This commit calculates the correct pseudo header for the
> UDP fragmentation offload by adding UDP_SEG flag.
> 
> Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>

Sorry for the late feedback.
The patch looks good to me, thanks!

I don't think we need to Cc stable or add a "Fixes:" tag, as this
feature was not supported by any driver before your series.

Acked-by: Olivier Matz <olivier.matz@6wind.com>


> ---
>  lib/net/rte_ip.h  | 4 ++--
>  lib/net/rte_net.h | 5 +++--
>  2 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h
> index a310e9d498..8073c8e889 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);
> @@ -596,7 +596,7 @@ rte_ipv6_phdr_cksum(const struct rte_ipv6_hdr *ipv6_hdr, uint64_t ol_flags)
>  	} psd_hdr;
>  
>  	psd_hdr.proto = (uint32_t)(ipv6_hdr->proto << 24);
> -	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 {
>  		psd_hdr.len = ipv6_hdr->payload_len;
> diff --git a/lib/net/rte_net.h b/lib/net/rte_net.h
> index 56611fc8f9..ef3ff4c6fd 100644
> --- a/lib/net/rte_net.h
> +++ b/lib/net/rte_net.h
> @@ -121,7 +121,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags)
>  	 * no offloads are requested.
>  	 */
>  	if (!(ol_flags & (RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_L4_MASK | RTE_MBUF_F_TX_TCP_SEG |
> -			  RTE_MBUF_F_TX_OUTER_IP_CKSUM)))
> +					RTE_MBUF_F_TX_UDP_SEG | RTE_MBUF_F_TX_OUTER_IP_CKSUM)))
>  		return 0;
>  
>  	if (ol_flags & (RTE_MBUF_F_TX_OUTER_IPV4 | RTE_MBUF_F_TX_OUTER_IPV6)) {
> @@ -154,7 +154,8 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags)
>  			ipv4_hdr->hdr_checksum = 0;
>  	}
>  
> -	if ((ol_flags & RTE_MBUF_F_TX_L4_MASK) == RTE_MBUF_F_TX_UDP_CKSUM) {
> +	if ((ol_flags & RTE_MBUF_F_TX_L4_MASK) == RTE_MBUF_F_TX_UDP_CKSUM ||
> +			(ol_flags & RTE_MBUF_F_TX_UDP_SEG)) {
>  		if (ol_flags & RTE_MBUF_F_TX_IPV4) {
>  			udp_hdr = (struct rte_udp_hdr *)((char *)ipv4_hdr +
>  					m->l3_len);
> -- 
> 2.25.1
>
  
Ferruh Yigit June 6, 2023, 6:01 p.m. UTC | #3
On 6/6/2023 4:19 PM, Olivier Matz wrote:
> Hi Zeng,
> 
> On Thu, Apr 13, 2023 at 01:34:00PM +0800, Zhichao Zeng wrote:
>> This commit calculates the correct pseudo header for the
>> UDP fragmentation offload by adding UDP_SEG flag.
>>
>> Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>
> 
> Sorry for the late feedback.
> The patch looks good to me, thanks!
> 
> I don't think we need to Cc stable or add a "Fixes:" tag, as this
> feature was not supported by any driver before your series.
> 
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
> 
> 

Except 3/4 & 4/4,
Series applied to dpdk-next-net/main, thanks.


Driver patches (3/4 & 4/4) are not merged because they are not ack'ed by
their maintainers.

Assigning them to Qi (next-net-intel) but because of dependency if you
prefer to get those directly to next-net, please review them and let me
know.
  

Patch

diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h
index a310e9d498..8073c8e889 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);
@@ -596,7 +596,7 @@  rte_ipv6_phdr_cksum(const struct rte_ipv6_hdr *ipv6_hdr, uint64_t ol_flags)
 	} psd_hdr;
 
 	psd_hdr.proto = (uint32_t)(ipv6_hdr->proto << 24);
-	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 {
 		psd_hdr.len = ipv6_hdr->payload_len;
diff --git a/lib/net/rte_net.h b/lib/net/rte_net.h
index 56611fc8f9..ef3ff4c6fd 100644
--- a/lib/net/rte_net.h
+++ b/lib/net/rte_net.h
@@ -121,7 +121,7 @@  rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags)
 	 * no offloads are requested.
 	 */
 	if (!(ol_flags & (RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_L4_MASK | RTE_MBUF_F_TX_TCP_SEG |
-			  RTE_MBUF_F_TX_OUTER_IP_CKSUM)))
+					RTE_MBUF_F_TX_UDP_SEG | RTE_MBUF_F_TX_OUTER_IP_CKSUM)))
 		return 0;
 
 	if (ol_flags & (RTE_MBUF_F_TX_OUTER_IPV4 | RTE_MBUF_F_TX_OUTER_IPV6)) {
@@ -154,7 +154,8 @@  rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags)
 			ipv4_hdr->hdr_checksum = 0;
 	}
 
-	if ((ol_flags & RTE_MBUF_F_TX_L4_MASK) == RTE_MBUF_F_TX_UDP_CKSUM) {
+	if ((ol_flags & RTE_MBUF_F_TX_L4_MASK) == RTE_MBUF_F_TX_UDP_CKSUM ||
+			(ol_flags & RTE_MBUF_F_TX_UDP_SEG)) {
 		if (ol_flags & RTE_MBUF_F_TX_IPV4) {
 			udp_hdr = (struct rte_udp_hdr *)((char *)ipv4_hdr +
 					m->l3_len);