[v3,1/2] examples/ip_fragmentation: Enabling IP checksum offload in mbuf

Message ID 1558349992-12237-1-git-send-email-skori@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v3,1/2] examples/ip_fragmentation: Enabling IP checksum offload in mbuf |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Sunil Kumar Kori May 20, 2019, 10:59 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 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Ananyev, Konstantin May 20, 2019, 11:28 a.m. UTC | #1
> 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 | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
> index e90a61e..719d6f4 100644
> --- a/examples/ip_fragmentation/main.c
> +++ b/examples/ip_fragmentation/main.c
> @@ -354,10 +354,12 @@ 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
> +		} 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;
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 1.8.3.1
  

Patch

diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index e90a61e..719d6f4 100644
--- a/examples/ip_fragmentation/main.c
+++ b/examples/ip_fragmentation/main.c
@@ -354,10 +354,12 @@  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
+		} 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;