[v2,2/3] examples/ip_fragmentation: Enabling IP checksum offload in mbuf

Message ID 1558006933-32247-3-git-send-email-skori@marvell.com (mailing list archive)
State Superseded, archived
Headers
Series Removing PKT_TX_IP_CKSUM from fragmentation/reassembly lib |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Sunil Kumar Kori May 16, 2019, 11:42 a.m. UTC
  As per the documentation to use any IP offload features, application
must set required offload flags into mbuf->ol_flags.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
---
 examples/ip_fragmentation/main.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
  

Comments

Ananyev, Konstantin May 18, 2019, 3:21 p.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Sunil Kumar Kori
> Sent: Thursday, May 16, 2019 12:42 PM
> To: dev@dpdk.org
> Cc: skori@marvell.com
> Subject: [dpdk-dev] [PATCH v2 2/3] examples/ip_fragmentation: Enabling IP checksum offload in mbuf
> 
> As per the documentation to use any IP offload features, application
> must set required offload flags into mbuf->ol_flags.
> 
> Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
> ---
>  examples/ip_fragmentation/main.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
> index e90a61e..d821967 100644
> --- a/examples/ip_fragmentation/main.c
> +++ b/examples/ip_fragmentation/main.c
> @@ -354,10 +354,13 @@ struct rte_lpm6_config lpm6_config = {
> 
>  		/* src addr */
>  		ether_addr_copy(&ports_eth_addr[port_out], &eth_hdr->s_addr);
> -		if (ipv6)
> +		if (ipv6) {
>  			eth_hdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv6);
> -		else
> +			m->ol_flags |= PKT_TX_IPV6;

Is there is any point to do that?
This sample app, as I remember doesn't request any extra HW offloads.
Same comment for patch #3.
Konstantin


> +		} else {
>  			eth_hdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv4);
> +			m->ol_flags |= (PKT_TX_IPV4 | PKT_TX_IP_CKSUM);
> +		}
>  	}
> 
>  	len += len2;
> --
> 1.8.3.1
  
Sunil Kumar Kori May 20, 2019, 8:09 a.m. UTC | #2
Hi,

Regards
Sunil Kumar Kori

>-----Original Message-----
>From: Ananyev, Konstantin <konstantin.ananyev@intel.com>
>Sent: Saturday, May 18, 2019 8:51 PM
>To: Sunil Kumar Kori <skori@marvell.com>; dev@dpdk.org
>Subject: [EXT] RE: [dpdk-dev] [PATCH v2 2/3] examples/ip_fragmentation:
>Enabling IP checksum offload in mbuf
>
>External Email
>
>----------------------------------------------------------------------
>
>
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Sunil Kumar Kori
>> Sent: Thursday, May 16, 2019 12:42 PM
>> To: dev@dpdk.org
>> Cc: skori@marvell.com
>> Subject: [dpdk-dev] [PATCH v2 2/3] examples/ip_fragmentation: Enabling IP
>checksum offload in mbuf
>>
>> As per the documentation to use any IP offload features, application
>> must set required offload flags into mbuf->ol_flags.
>>
>> Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
>> ---
>>  examples/ip_fragmentation/main.c | 7 +++++--
>>  1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/examples/ip_fragmentation/main.c
>b/examples/ip_fragmentation/main.c
>> index e90a61e..d821967 100644
>> --- a/examples/ip_fragmentation/main.c
>> +++ b/examples/ip_fragmentation/main.c
>> @@ -354,10 +354,13 @@ struct rte_lpm6_config lpm6_config = {
>>
>>  		/* src addr */
>>  		ether_addr_copy(&ports_eth_addr[port_out], &eth_hdr-
>>s_addr);
>> -		if (ipv6)
>> +		if (ipv6) {
>>  			eth_hdr->ether_type =
>rte_be_to_cpu_16(ETHER_TYPE_IPv6);
>> -		else
>> +			m->ol_flags |= PKT_TX_IPV6;
>
>Is there is any point to do that?
>This sample app, as I remember doesn't request any extra HW offloads.
>Same comment for patch #3.
>Konstantin
>
>
Is this comment valid for IPv6 only ?
Otherwise for IPv4, it is required as IP checksum is neither being updated by library nor
by the application.
>> +		} else {
>>  			eth_hdr->ether_type =
>rte_be_to_cpu_16(ETHER_TYPE_IPv4);
>> +			m->ol_flags |= (PKT_TX_IPV4 | PKT_TX_IP_CKSUM);
>> +		}
>>  	}
>>
>>  	len += len2;
>> --
>> 1.8.3.1
  
Ananyev, Konstantin May 20, 2019, 8:15 a.m. UTC | #3
> -----Original Message-----
> From: Sunil Kumar Kori [mailto:skori@marvell.com]
> Sent: Monday, May 20, 2019 9:09 AM
> To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; dev@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v2 2/3] examples/ip_fragmentation: Enabling IP checksum offload in mbuf
> 
> Hi,
> 
> Regards
> Sunil Kumar Kori
> 
> >-----Original Message-----
> >From: Ananyev, Konstantin <konstantin.ananyev@intel.com>
> >Sent: Saturday, May 18, 2019 8:51 PM
> >To: Sunil Kumar Kori <skori@marvell.com>; dev@dpdk.org
> >Subject: [EXT] RE: [dpdk-dev] [PATCH v2 2/3] examples/ip_fragmentation:
> >Enabling IP checksum offload in mbuf
> >
> >External Email
> >
> >----------------------------------------------------------------------
> >
> >
> >> -----Original Message-----
> >> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Sunil Kumar Kori
> >> Sent: Thursday, May 16, 2019 12:42 PM
> >> To: dev@dpdk.org
> >> Cc: skori@marvell.com
> >> Subject: [dpdk-dev] [PATCH v2 2/3] examples/ip_fragmentation: Enabling IP
> >checksum offload in mbuf
> >>
> >> As per the documentation to use any IP offload features, application
> >> must set required offload flags into mbuf->ol_flags.
> >>
> >> Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
> >> ---
> >>  examples/ip_fragmentation/main.c | 7 +++++--
> >>  1 file changed, 5 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/examples/ip_fragmentation/main.c
> >b/examples/ip_fragmentation/main.c
> >> index e90a61e..d821967 100644
> >> --- a/examples/ip_fragmentation/main.c
> >> +++ b/examples/ip_fragmentation/main.c
> >> @@ -354,10 +354,13 @@ struct rte_lpm6_config lpm6_config = {
> >>
> >>  		/* src addr */
> >>  		ether_addr_copy(&ports_eth_addr[port_out], &eth_hdr-
> >>s_addr);
> >> -		if (ipv6)
> >> +		if (ipv6) {
> >>  			eth_hdr->ether_type =
> >rte_be_to_cpu_16(ETHER_TYPE_IPv6);
> >> -		else
> >> +			m->ol_flags |= PKT_TX_IPV6;
> >
> >Is there is any point to do that?
> >This sample app, as I remember doesn't request any extra HW offloads.
> >Same comment for patch #3.
> >Konstantin
> >
> >
> Is this comment valid for IPv6 only ?

Yes, my comment is about the following line of code:
m->ol_flags |= PKT_TX_IPV6;

> Otherwise for IPv4, it is required as IP checksum is neither being updated by library nor
> by the application.
> >> +		} else {
> >>  			eth_hdr->ether_type =
> >rte_be_to_cpu_16(ETHER_TYPE_IPv4);
> >> +			m->ol_flags |= (PKT_TX_IPV4 | PKT_TX_IP_CKSUM);
> >> +		}
> >>  	}
> >>
> >>  	len += len2;
> >> --
> >> 1.8.3.1
  

Patch

diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index e90a61e..d821967 100644
--- a/examples/ip_fragmentation/main.c
+++ b/examples/ip_fragmentation/main.c
@@ -354,10 +354,13 @@  struct rte_lpm6_config lpm6_config = {
 
 		/* src addr */
 		ether_addr_copy(&ports_eth_addr[port_out], &eth_hdr->s_addr);
-		if (ipv6)
+		if (ipv6) {
 			eth_hdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv6);
-		else
+			m->ol_flags |= PKT_TX_IPV6;
+		} else {
 			eth_hdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv4);
+			m->ol_flags |= (PKT_TX_IPV4 | PKT_TX_IP_CKSUM);
+		}
 	}
 
 	len += len2;