diff mbox series

net/mlx5e: Check tunnel offload is required before setting SWP

Message ID 20210405133149.24972-2-tim.gardner@canonical.com
State New
Headers show
Series net/mlx5e: Check tunnel offload is required before setting SWP | expand

Commit Message

Tim Gardner April 5, 2021, 1:31 p.m. UTC
From: Moshe Shemesh <moshe@nvidia.com>

BugLink: https://bugs.launchpad.net/bugs/1921769

Check that tunnel offload is required before setting Software Parser
offsets to get Geneve HW offload. In case of Geneve packet we check HW
offload support of SWP in mlx5e_tunnel_features_check() and set features
accordingly, this should be reflected in skb offload requested by the
kernel and we should add the Software Parser offsets only if requested.
Otherwise, in case HW doesn't support SWP for Geneve, data path will
mistakenly try to offload Geneve SKBs with skb->encapsulation set,
regardless of whether offload was requested or not on this specific SKB.

Fixes: e3cfc7e6b7bd ("net/mlx5e: TX, Add geneve tunnel stateless offload support")
Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
(backported from commit e1c3940c6003d820c787473c65711b49c2d1bc42)
[rtg - the affected code did not get moved to
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h until
8e4b53f60f7d33cf6c60f790cf506220b2bcbb0f ("net/mlx5e: Refactor xmit functions") ]
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thadeu Lima de Souza Cascardo April 5, 2021, 4:16 p.m. UTC | #1
On Mon, Apr 05, 2021 at 07:31:49AM -0600, Tim Gardner wrote:
> From: Moshe Shemesh <moshe@nvidia.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1921769
> 
> Check that tunnel offload is required before setting Software Parser
> offsets to get Geneve HW offload. In case of Geneve packet we check HW
> offload support of SWP in mlx5e_tunnel_features_check() and set features
> accordingly, this should be reflected in skb offload requested by the
> kernel and we should add the Software Parser offsets only if requested.
> Otherwise, in case HW doesn't support SWP for Geneve, data path will
> mistakenly try to offload Geneve SKBs with skb->encapsulation set,
> regardless of whether offload was requested or not on this specific SKB.
> 
> Fixes: e3cfc7e6b7bd ("net/mlx5e: TX, Add geneve tunnel stateless offload support")
> Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
> Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
> (backported from commit e1c3940c6003d820c787473c65711b49c2d1bc42)
> [rtg - the affected code did not get moved to
>  drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h until
> 8e4b53f60f7d33cf6c60f790cf506220b2bcbb0f ("net/mlx5e: Refactor xmit functions") ]
> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>

This also affects groovy (5.8). Hirsute (5.11) has the fix, though.

Bug #1921769 does not have the SRU template.

As for the backport, it seems fine.

Acked-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>

> ---
>  drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
> index 2317be1b9956..ca8fae2df80f 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
> @@ -341,7 +341,7 @@ netdev_tx_t mlx5e_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb,
>  	dseg =  wqe->data;
>  
>  #if IS_ENABLED(CONFIG_GENEVE)
> -	if (skb->encapsulation)
> +	if (skb->encapsulation && skb->ip_summed == CHECKSUM_PARTIAL)
>  		mlx5e_tx_tunnel_accel(skb, eseg, ihs);
>  #endif
>  	mlx5e_txwqe_build_eseg_csum(sq, skb, eseg);
> -- 
> 2.17.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Stefan Bader April 8, 2021, 6:49 a.m. UTC | #2
On 05.04.21 15:31, Tim Gardner wrote:
> From: Moshe Shemesh <moshe@nvidia.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1921769
> 
> Check that tunnel offload is required before setting Software Parser
> offsets to get Geneve HW offload. In case of Geneve packet we check HW
> offload support of SWP in mlx5e_tunnel_features_check() and set features
> accordingly, this should be reflected in skb offload requested by the
> kernel and we should add the Software Parser offsets only if requested.
> Otherwise, in case HW doesn't support SWP for Geneve, data path will
> mistakenly try to offload Geneve SKBs with skb->encapsulation set,
> regardless of whether offload was requested or not on this specific SKB.
> 
> Fixes: e3cfc7e6b7bd ("net/mlx5e: TX, Add geneve tunnel stateless offload support")
> Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
> Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
> (backported from commit e1c3940c6003d820c787473c65711b49c2d1bc42)
> [rtg - the affected code did not get moved to
>   drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h until
> 8e4b53f60f7d33cf6c60f790cf506220b2bcbb0f ("net/mlx5e: Refactor xmit functions") ]
> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
> ---

The status of this for B/G/H is still unclear. Likely B is not affected (4.15) 
but is anything done for Groovy and Hirsute?

-Stefan

>   drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
> index 2317be1b9956..ca8fae2df80f 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
> @@ -341,7 +341,7 @@ netdev_tx_t mlx5e_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb,
>   	dseg =  wqe->data;
>   
>   #if IS_ENABLED(CONFIG_GENEVE)
> -	if (skb->encapsulation)
> +	if (skb->encapsulation && skb->ip_summed == CHECKSUM_PARTIAL)
>   		mlx5e_tx_tunnel_accel(skb, eseg, ihs);
>   #endif
>   	mlx5e_txwqe_build_eseg_csum(sq, skb, eseg);
>
Tim Gardner April 9, 2021, 12:32 p.m. UTC | #3
On 4/5/21 10:16 AM, Thadeu Lima de Souza Cascardo wrote:
> On Mon, Apr 05, 2021 at 07:31:49AM -0600, Tim Gardner wrote:
>> From: Moshe Shemesh <moshe@nvidia.com>
>>
>> BugLink: https://bugs.launchpad.net/bugs/1921769
>>
>> Check that tunnel offload is required before setting Software Parser
>> offsets to get Geneve HW offload. In case of Geneve packet we check HW
>> offload support of SWP in mlx5e_tunnel_features_check() and set features
>> accordingly, this should be reflected in skb offload requested by the
>> kernel and we should add the Software Parser offsets only if requested.
>> Otherwise, in case HW doesn't support SWP for Geneve, data path will
>> mistakenly try to offload Geneve SKBs with skb->encapsulation set,
>> regardless of whether offload was requested or not on this specific SKB.
>>
>> Fixes: e3cfc7e6b7bd ("net/mlx5e: TX, Add geneve tunnel stateless offload support")
>> Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
>> Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
>> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
>> (backported from commit e1c3940c6003d820c787473c65711b49c2d1bc42)
>> [rtg - the affected code did not get moved to
>>   drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h until
>> 8e4b53f60f7d33cf6c60f790cf506220b2bcbb0f ("net/mlx5e: Refactor xmit functions") ]
>> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
> 
> This also affects groovy (5.8). Hirsute (5.11) has the fix, though.
> 
Patch for Groovy is on the way.

rtg
-----------
Tim Gardner
Canonical, Inc
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index 2317be1b9956..ca8fae2df80f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -341,7 +341,7 @@  netdev_tx_t mlx5e_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb,
 	dseg =  wqe->data;
 
 #if IS_ENABLED(CONFIG_GENEVE)
-	if (skb->encapsulation)
+	if (skb->encapsulation && skb->ip_summed == CHECKSUM_PARTIAL)
 		mlx5e_tx_tunnel_accel(skb, eseg, ihs);
 #endif
 	mlx5e_txwqe_build_eseg_csum(sq, skb, eseg);