net: fix encapsulation markers for inner L3 offset

Message ID 20190524145714.18903-1-ivan.malov@oktetlabs.ru (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net: fix encapsulation markers for inner L3 offset |

Checks

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

Commit Message

Ivan Malov May 24, 2019, 2:57 p.m. UTC
  The API to prepare checksum offloads employs outer
IP checksum flag to tell regular IPv4 packets from
tunnel packets with outer IPv4 encapsulation. This
flag cannot serve as a marker for the said purpose
because a packet can have outer IPv4 encapsulation
and may not have outer IP checksum offload request.

Fix the API by changing the said criterion to test
outer IPv4 flag rather than outer IP checksum flag.
Use simpler spelling of the conditional expression.

Fixes: 4fb7e803eb1a ("ethdev: add Tx preparation")
Cc: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Cc: stable@dpdk.org

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 lib/librte_net/rte_net.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Ananyev, Konstantin June 24, 2019, 11:35 a.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ivan Malov
> Sent: Friday, May 24, 2019 3:57 PM
> To: Olivier Matz <olivier.matz@6wind.com>
> Cc: dev@dpdk.org; Kulasek, TomaszX <tomaszx.kulasek@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net: fix encapsulation markers for inner L3 offset
> 
> The API to prepare checksum offloads employs outer
> IP checksum flag to tell regular IPv4 packets from
> tunnel packets with outer IPv4 encapsulation. This
> flag cannot serve as a marker for the said purpose
> because a packet can have outer IPv4 encapsulation
> and may not have outer IP checksum offload request.
> 
> Fix the API by changing the said criterion to test
> outer IPv4 flag rather than outer IP checksum flag.
> Use simpler spelling of the conditional expression.
> 
> Fixes: 4fb7e803eb1a ("ethdev: add Tx preparation")
> Cc: Tomasz Kulasek <tomaszx.kulasek@intel.com>
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
> Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
> ---
>  lib/librte_net/rte_net.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h
> index 1697071..c15b518 100644
> --- a/lib/librte_net/rte_net.h
> +++ b/lib/librte_net/rte_net.h
> @@ -128,8 +128,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m,
>  		return 0;
>  #endif
> 
> -	if ((ol_flags & PKT_TX_OUTER_IP_CKSUM) ||
> -		(ol_flags & PKT_TX_OUTER_IPV6))
> +	if (ol_flags & (PKT_TX_OUTER_IPV4 | PKT_TX_OUTER_IPV6))
>  		inner_l3_offset += m->outer_l2_len + m->outer_l3_len;
> 
>  #ifdef RTE_LIBRTE_ETHDEV_DEBUG
> --

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

> 1.8.3.1
  
Ferruh Yigit June 27, 2019, 3:32 p.m. UTC | #2
On 6/24/2019 12:35 PM, Ananyev, Konstantin wrote:
> 
> 
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ivan Malov
>> Sent: Friday, May 24, 2019 3:57 PM
>> To: Olivier Matz <olivier.matz@6wind.com>
>> Cc: dev@dpdk.org; Kulasek, TomaszX <tomaszx.kulasek@intel.com>; stable@dpdk.org
>> Subject: [dpdk-dev] [PATCH] net: fix encapsulation markers for inner L3 offset
>>
>> The API to prepare checksum offloads employs outer
>> IP checksum flag to tell regular IPv4 packets from
>> tunnel packets with outer IPv4 encapsulation. This
>> flag cannot serve as a marker for the said purpose
>> because a packet can have outer IPv4 encapsulation
>> and may not have outer IP checksum offload request.
>>
>> Fix the API by changing the said criterion to test
>> outer IPv4 flag rather than outer IP checksum flag.
>> Use simpler spelling of the conditional expression.
>>
>> Fixes: 4fb7e803eb1a ("ethdev: add Tx preparation")
>> Cc: Tomasz Kulasek <tomaszx.kulasek@intel.com>
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
>> Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>

Applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h
index 1697071..c15b518 100644
--- a/lib/librte_net/rte_net.h
+++ b/lib/librte_net/rte_net.h
@@ -128,8 +128,7 @@  uint32_t rte_net_get_ptype(const struct rte_mbuf *m,
 		return 0;
 #endif
 
-	if ((ol_flags & PKT_TX_OUTER_IP_CKSUM) ||
-		(ol_flags & PKT_TX_OUTER_IPV6))
+	if (ol_flags & (PKT_TX_OUTER_IPV4 | PKT_TX_OUTER_IPV6))
 		inner_l3_offset += m->outer_l2_len + m->outer_l3_len;
 
 #ifdef RTE_LIBRTE_ETHDEV_DEBUG