* [PATCH net 1/8] net/mlx5: Lag, do bond only if slaves agree on roce state
2024-05-22 19:26 [PATCH net 0/8] mlx5 fixes 24-05-22 Tariq Toukan
@ 2024-05-22 19:26 ` Tariq Toukan
2024-05-23 9:45 ` Simon Horman
2024-05-22 19:26 ` [PATCH net 2/8] net/mlx5: Do not query MPIR on embedded CPU function Tariq Toukan
` (7 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Tariq Toukan @ 2024-05-22 19:26 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
Maher Sanalla, Tariq Toukan
From: Maher Sanalla <msanalla@nvidia.com>
Currently, the driver does not enforce that lag bond slaves must have
matching roce capabilities. Yet, in mlx5_do_bond(), the driver attempts
to enable roce on all vports of the bond slaves, causing the following
syndrome when one slave has no roce fw support:
mlx5_cmd_out_err:809:(pid 25427): MODIFY_NIC_VPORT_CONTEXT(0×755) op_mod(0×0)
failed, status bad parameter(0×3), syndrome (0xc1f678), err(-22)
Thus, create HW lag only if bond's slaves agree on roce state,
either all slaves have roce support resulting in a roce lag bond,
or none do, resulting in a raw eth bond.
Fixes: 7907f23adc18 ("net/mlx5: Implement RoCE LAG feature")
Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
index f7f0476a4a58..d0871c46b8c5 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
@@ -719,6 +719,7 @@ bool mlx5_lag_check_prereq(struct mlx5_lag *ldev)
struct mlx5_core_dev *dev;
u8 mode;
#endif
+ bool roce_support;
int i;
for (i = 0; i < ldev->ports; i++)
@@ -743,6 +744,11 @@ bool mlx5_lag_check_prereq(struct mlx5_lag *ldev)
if (mlx5_sriov_is_enabled(ldev->pf[i].dev))
return false;
#endif
+ roce_support = mlx5_get_roce_state(ldev->pf[MLX5_LAG_P1].dev);
+ for (i = 1; i < ldev->ports; i++)
+ if (mlx5_get_roce_state(ldev->pf[i].dev) != roce_support)
+ return false;
+
return true;
}
@@ -910,8 +916,10 @@ static void mlx5_do_bond(struct mlx5_lag *ldev)
} else if (roce_lag) {
dev0->priv.flags &= ~MLX5_PRIV_FLAGS_DISABLE_IB_ADEV;
mlx5_rescan_drivers_locked(dev0);
- for (i = 1; i < ldev->ports; i++)
- mlx5_nic_vport_enable_roce(ldev->pf[i].dev);
+ for (i = 1; i < ldev->ports; i++) {
+ if (mlx5_get_roce_state(ldev->pf[i].dev))
+ mlx5_nic_vport_enable_roce(ldev->pf[i].dev);
+ }
} else if (shared_fdb) {
int i;
--
2.44.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH net 1/8] net/mlx5: Lag, do bond only if slaves agree on roce state
2024-05-22 19:26 ` [PATCH net 1/8] net/mlx5: Lag, do bond only if slaves agree on roce state Tariq Toukan
@ 2024-05-23 9:45 ` Simon Horman
0 siblings, 0 replies; 18+ messages in thread
From: Simon Horman @ 2024-05-23 9:45 UTC (permalink / raw)
To: Tariq Toukan
Cc: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
Maher Sanalla
On Wed, May 22, 2024 at 10:26:52PM +0300, Tariq Toukan wrote:
> From: Maher Sanalla <msanalla@nvidia.com>
>
> Currently, the driver does not enforce that lag bond slaves must have
> matching roce capabilities. Yet, in mlx5_do_bond(), the driver attempts
> to enable roce on all vports of the bond slaves, causing the following
> syndrome when one slave has no roce fw support:
>
> mlx5_cmd_out_err:809:(pid 25427): MODIFY_NIC_VPORT_CONTEXT(0×755) op_mod(0×0)
> failed, status bad parameter(0×3), syndrome (0xc1f678), err(-22)
>
> Thus, create HW lag only if bond's slaves agree on roce state,
> either all slaves have roce support resulting in a roce lag bond,
> or none do, resulting in a raw eth bond.
>
> Fixes: 7907f23adc18 ("net/mlx5: Implement RoCE LAG feature")
> Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH net 2/8] net/mlx5: Do not query MPIR on embedded CPU function
2024-05-22 19:26 [PATCH net 0/8] mlx5 fixes 24-05-22 Tariq Toukan
2024-05-22 19:26 ` [PATCH net 1/8] net/mlx5: Lag, do bond only if slaves agree on roce state Tariq Toukan
@ 2024-05-22 19:26 ` Tariq Toukan
2024-05-23 9:46 ` Simon Horman
2024-05-22 19:26 ` [PATCH net 3/8] net/mlx5: Fix MTMP register capability offset in MCAM register Tariq Toukan
` (6 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Tariq Toukan @ 2024-05-22 19:26 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
Tariq Toukan
A proper query to MPIR needs to set the correct value in the depth field.
On embedded CPU this value is not necessarily zero. As there is no real
use case for multi-PF netdev on the embedded CPU of the smart NIC, block
this option.
This fixes the following failure:
ACCESS_REG(0x805) op_mod(0x1) failed, status bad system state(0x4), syndrome (0x685f19), err(-5)
Fixes: 678eb448055a ("net/mlx5: SD, Implement basic query and instantiation")
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/lib/sd.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/sd.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/sd.c
index dd5d186dc614..f6deb5a3f820 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/sd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/sd.c
@@ -100,10 +100,6 @@ static bool ft_create_alias_supported(struct mlx5_core_dev *dev)
static bool mlx5_sd_is_supported(struct mlx5_core_dev *dev, u8 host_buses)
{
- /* Feature is currently implemented for PFs only */
- if (!mlx5_core_is_pf(dev))
- return false;
-
/* Honor the SW implementation limit */
if (host_buses > MLX5_SD_MAX_GROUP_SZ)
return false;
@@ -162,6 +158,14 @@ static int sd_init(struct mlx5_core_dev *dev)
bool sdm;
int err;
+ /* Feature is currently implemented for PFs only */
+ if (!mlx5_core_is_pf(dev))
+ return 0;
+
+ /* Block on embedded CPU PFs */
+ if (mlx5_core_is_ecpf(dev))
+ return 0;
+
if (!MLX5_CAP_MCAM_REG(dev, mpir))
return 0;
--
2.44.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH net 2/8] net/mlx5: Do not query MPIR on embedded CPU function
2024-05-22 19:26 ` [PATCH net 2/8] net/mlx5: Do not query MPIR on embedded CPU function Tariq Toukan
@ 2024-05-23 9:46 ` Simon Horman
0 siblings, 0 replies; 18+ messages in thread
From: Simon Horman @ 2024-05-23 9:46 UTC (permalink / raw)
To: Tariq Toukan
Cc: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky
On Wed, May 22, 2024 at 10:26:53PM +0300, Tariq Toukan wrote:
> A proper query to MPIR needs to set the correct value in the depth field.
> On embedded CPU this value is not necessarily zero. As there is no real
> use case for multi-PF netdev on the embedded CPU of the smart NIC, block
> this option.
>
> This fixes the following failure:
> ACCESS_REG(0x805) op_mod(0x1) failed, status bad system state(0x4), syndrome (0x685f19), err(-5)
>
> Fixes: 678eb448055a ("net/mlx5: SD, Implement basic query and instantiation")
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH net 3/8] net/mlx5: Fix MTMP register capability offset in MCAM register
2024-05-22 19:26 [PATCH net 0/8] mlx5 fixes 24-05-22 Tariq Toukan
2024-05-22 19:26 ` [PATCH net 1/8] net/mlx5: Lag, do bond only if slaves agree on roce state Tariq Toukan
2024-05-22 19:26 ` [PATCH net 2/8] net/mlx5: Do not query MPIR on embedded CPU function Tariq Toukan
@ 2024-05-22 19:26 ` Tariq Toukan
2024-05-23 9:47 ` Simon Horman
2024-05-22 19:26 ` [PATCH net 4/8] net/mlx5: Use mlx5_ipsec_rx_status_destroy to correctly delete status rules Tariq Toukan
` (5 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Tariq Toukan @ 2024-05-22 19:26 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
Cosmin Ratiu, Tariq Toukan
From: Gal Pressman <gal@nvidia.com>
The MTMP register (0x900a) capability offset is off-by-one, move it to
the right place.
Fixes: 1f507e80c700 ("net/mlx5: Expose NIC temperature via hardware monitoring kernel API")
Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
include/linux/mlx5/mlx5_ifc.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index f468763478ae..5df52e15f7d6 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -10308,9 +10308,9 @@ struct mlx5_ifc_mcam_access_reg_bits {
u8 mfrl[0x1];
u8 regs_39_to_32[0x8];
- u8 regs_31_to_10[0x16];
+ u8 regs_31_to_11[0x15];
u8 mtmp[0x1];
- u8 regs_8_to_0[0x9];
+ u8 regs_9_to_0[0xa];
};
struct mlx5_ifc_mcam_access_reg_bits1 {
--
2.44.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH net 3/8] net/mlx5: Fix MTMP register capability offset in MCAM register
2024-05-22 19:26 ` [PATCH net 3/8] net/mlx5: Fix MTMP register capability offset in MCAM register Tariq Toukan
@ 2024-05-23 9:47 ` Simon Horman
0 siblings, 0 replies; 18+ messages in thread
From: Simon Horman @ 2024-05-23 9:47 UTC (permalink / raw)
To: Tariq Toukan
Cc: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
Cosmin Ratiu
On Wed, May 22, 2024 at 10:26:54PM +0300, Tariq Toukan wrote:
> From: Gal Pressman <gal@nvidia.com>
>
> The MTMP register (0x900a) capability offset is off-by-one, move it to
> the right place.
>
> Fixes: 1f507e80c700 ("net/mlx5: Expose NIC temperature via hardware monitoring kernel API")
> Signed-off-by: Gal Pressman <gal@nvidia.com>
> Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH net 4/8] net/mlx5: Use mlx5_ipsec_rx_status_destroy to correctly delete status rules
2024-05-22 19:26 [PATCH net 0/8] mlx5 fixes 24-05-22 Tariq Toukan
` (2 preceding siblings ...)
2024-05-22 19:26 ` [PATCH net 3/8] net/mlx5: Fix MTMP register capability offset in MCAM register Tariq Toukan
@ 2024-05-22 19:26 ` Tariq Toukan
2024-05-23 9:47 ` Simon Horman
2024-05-22 19:26 ` [PATCH net 5/8] net/mlx5e: Fix IPsec tunnel mode offload feature check Tariq Toukan
` (4 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Tariq Toukan @ 2024-05-22 19:26 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
Rahul Rameshbabu, Tariq Toukan
From: Rahul Rameshbabu <rrameshbabu@nvidia.com>
rx_create no longer allocates a modify_hdr instance that needs to be
cleaned up. The mlx5_modify_header_dealloc call will lead to a NULL pointer
dereference. A leak in the rules also previously occurred since there are
now two rules populated related to status.
BUG: kernel NULL pointer dereference, address: 0000000000000000
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 109907067 P4D 109907067 PUD 116890067 PMD 0
Oops: 0000 [#1] SMP
CPU: 1 PID: 484 Comm: ip Not tainted 6.9.0-rc2-rrameshbabu+ #254
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS Arch Linux 1.16.3-1-1 04/01/2014
RIP: 0010:mlx5_modify_header_dealloc+0xd/0x70
<snip>
Call Trace:
<TASK>
? show_regs+0x60/0x70
? __die+0x24/0x70
? page_fault_oops+0x15f/0x430
? free_to_partial_list.constprop.0+0x79/0x150
? do_user_addr_fault+0x2c9/0x5c0
? exc_page_fault+0x63/0x110
? asm_exc_page_fault+0x27/0x30
? mlx5_modify_header_dealloc+0xd/0x70
rx_create+0x374/0x590
rx_add_rule+0x3ad/0x500
? rx_add_rule+0x3ad/0x500
? mlx5_cmd_exec+0x2c/0x40
? mlx5_create_ipsec_obj+0xd6/0x200
mlx5e_accel_ipsec_fs_add_rule+0x31/0xf0
mlx5e_xfrm_add_state+0x426/0xc00
<snip>
Fixes: 94af50c0a9bb ("net/mlx5e: Unify esw and normal IPsec status table creation/destruction")
Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
index 41a2543a52cd..e51b03d4c717 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
@@ -750,8 +750,7 @@ static int rx_create(struct mlx5_core_dev *mdev, struct mlx5e_ipsec *ipsec,
err_fs_ft:
if (rx->allow_tunnel_mode)
mlx5_eswitch_unblock_encap(mdev);
- mlx5_del_flow_rules(rx->status.rule);
- mlx5_modify_header_dealloc(mdev, rx->status.modify_hdr);
+ mlx5_ipsec_rx_status_destroy(ipsec, rx);
err_add:
mlx5_destroy_flow_table(rx->ft.status);
err_fs_ft_status:
--
2.44.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH net 4/8] net/mlx5: Use mlx5_ipsec_rx_status_destroy to correctly delete status rules
2024-05-22 19:26 ` [PATCH net 4/8] net/mlx5: Use mlx5_ipsec_rx_status_destroy to correctly delete status rules Tariq Toukan
@ 2024-05-23 9:47 ` Simon Horman
0 siblings, 0 replies; 18+ messages in thread
From: Simon Horman @ 2024-05-23 9:47 UTC (permalink / raw)
To: Tariq Toukan
Cc: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
Rahul Rameshbabu
On Wed, May 22, 2024 at 10:26:55PM +0300, Tariq Toukan wrote:
> From: Rahul Rameshbabu <rrameshbabu@nvidia.com>
>
> rx_create no longer allocates a modify_hdr instance that needs to be
> cleaned up. The mlx5_modify_header_dealloc call will lead to a NULL pointer
> dereference. A leak in the rules also previously occurred since there are
> now two rules populated related to status.
>
> BUG: kernel NULL pointer dereference, address: 0000000000000000
> #PF: supervisor read access in kernel mode
> #PF: error_code(0x0000) - not-present page
> PGD 109907067 P4D 109907067 PUD 116890067 PMD 0
> Oops: 0000 [#1] SMP
> CPU: 1 PID: 484 Comm: ip Not tainted 6.9.0-rc2-rrameshbabu+ #254
> Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS Arch Linux 1.16.3-1-1 04/01/2014
> RIP: 0010:mlx5_modify_header_dealloc+0xd/0x70
> <snip>
> Call Trace:
> <TASK>
> ? show_regs+0x60/0x70
> ? __die+0x24/0x70
> ? page_fault_oops+0x15f/0x430
> ? free_to_partial_list.constprop.0+0x79/0x150
> ? do_user_addr_fault+0x2c9/0x5c0
> ? exc_page_fault+0x63/0x110
> ? asm_exc_page_fault+0x27/0x30
> ? mlx5_modify_header_dealloc+0xd/0x70
> rx_create+0x374/0x590
> rx_add_rule+0x3ad/0x500
> ? rx_add_rule+0x3ad/0x500
> ? mlx5_cmd_exec+0x2c/0x40
> ? mlx5_create_ipsec_obj+0xd6/0x200
> mlx5e_accel_ipsec_fs_add_rule+0x31/0xf0
> mlx5e_xfrm_add_state+0x426/0xc00
> <snip>
>
> Fixes: 94af50c0a9bb ("net/mlx5e: Unify esw and normal IPsec status table creation/destruction")
> Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH net 5/8] net/mlx5e: Fix IPsec tunnel mode offload feature check
2024-05-22 19:26 [PATCH net 0/8] mlx5 fixes 24-05-22 Tariq Toukan
` (3 preceding siblings ...)
2024-05-22 19:26 ` [PATCH net 4/8] net/mlx5: Use mlx5_ipsec_rx_status_destroy to correctly delete status rules Tariq Toukan
@ 2024-05-22 19:26 ` Tariq Toukan
2024-05-23 9:48 ` Simon Horman
2024-05-22 19:26 ` [PATCH net 6/8] net/mlx5e: Do not use ptp structure for tx ts stats when not initialized Tariq Toukan
` (3 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Tariq Toukan @ 2024-05-22 19:26 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
Rahul Rameshbabu, Tariq Toukan
From: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Remove faulty check disabling checksum offload and GSO for offload of
simple IPsec tunnel L4 traffic. Comment previously describing the deleted
code incorrectly claimed the check prevented double tunnel (or three layers
of ip headers).
Fixes: f1267798c980 ("net/mlx5: Fix checksum issue of VXLAN and IPsec crypto offload")
Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
.../mellanox/mlx5/core/en_accel/ipsec_rxtx.h | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h
index 82064614846f..359050f0b54d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h
@@ -97,18 +97,11 @@ mlx5e_ipsec_feature_check(struct sk_buff *skb, netdev_features_t features)
if (!x || !x->xso.offload_handle)
goto out_disable;
- if (xo->inner_ipproto) {
- /* Cannot support tunnel packet over IPsec tunnel mode
- * because we cannot offload three IP header csum
- */
- if (x->props.mode == XFRM_MODE_TUNNEL)
- goto out_disable;
-
- /* Only support UDP or TCP L4 checksum */
- if (xo->inner_ipproto != IPPROTO_UDP &&
- xo->inner_ipproto != IPPROTO_TCP)
- goto out_disable;
- }
+ /* Only support UDP or TCP L4 checksum */
+ if (xo->inner_ipproto &&
+ xo->inner_ipproto != IPPROTO_UDP &&
+ xo->inner_ipproto != IPPROTO_TCP)
+ goto out_disable;
return features;
--
2.44.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH net 5/8] net/mlx5e: Fix IPsec tunnel mode offload feature check
2024-05-22 19:26 ` [PATCH net 5/8] net/mlx5e: Fix IPsec tunnel mode offload feature check Tariq Toukan
@ 2024-05-23 9:48 ` Simon Horman
0 siblings, 0 replies; 18+ messages in thread
From: Simon Horman @ 2024-05-23 9:48 UTC (permalink / raw)
To: Tariq Toukan
Cc: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
Rahul Rameshbabu
On Wed, May 22, 2024 at 10:26:56PM +0300, Tariq Toukan wrote:
> From: Rahul Rameshbabu <rrameshbabu@nvidia.com>
>
> Remove faulty check disabling checksum offload and GSO for offload of
> simple IPsec tunnel L4 traffic. Comment previously describing the deleted
> code incorrectly claimed the check prevented double tunnel (or three layers
> of ip headers).
>
> Fixes: f1267798c980 ("net/mlx5: Fix checksum issue of VXLAN and IPsec crypto offload")
> Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH net 6/8] net/mlx5e: Do not use ptp structure for tx ts stats when not initialized
2024-05-22 19:26 [PATCH net 0/8] mlx5 fixes 24-05-22 Tariq Toukan
` (4 preceding siblings ...)
2024-05-22 19:26 ` [PATCH net 5/8] net/mlx5e: Fix IPsec tunnel mode offload feature check Tariq Toukan
@ 2024-05-22 19:26 ` Tariq Toukan
2024-05-23 9:48 ` Simon Horman
2024-05-22 19:26 ` [PATCH net 7/8] net/mlx5e: Use rx_missed_errors instead of rx_dropped for reporting buffer exhaustion Tariq Toukan
` (2 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Tariq Toukan @ 2024-05-22 19:26 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
Rahul Rameshbabu, Tariq Toukan
From: Rahul Rameshbabu <rrameshbabu@nvidia.com>
The ptp channel instance is only initialized when ptp traffic is first
processed by the driver. This means that there is a window in between when
port timestamping is enabled and ptp traffic is sent where the ptp channel
instance is not initialized. Accessing statistics during this window will
lead to an access violation (NULL + member offset). Check the validity of
the instance before attempting to query statistics.
BUG: unable to handle page fault for address: 0000000000003524
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 109dfc067 P4D 109dfc067 PUD 1064ef067 PMD 0
Oops: 0000 [#1] SMP
CPU: 0 PID: 420 Comm: ethtool Not tainted 6.9.0-rc2-rrameshbabu+ #245
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS Arch Linux 1.16.3-1-1 04/01/204
RIP: 0010:mlx5e_stats_ts_get+0x4c/0x130
<snip>
Call Trace:
<TASK>
? show_regs+0x60/0x70
? __die+0x24/0x70
? page_fault_oops+0x15f/0x430
? do_user_addr_fault+0x2c9/0x5c0
? exc_page_fault+0x63/0x110
? asm_exc_page_fault+0x27/0x30
? mlx5e_stats_ts_get+0x4c/0x130
? mlx5e_stats_ts_get+0x20/0x130
mlx5e_get_ts_stats+0x15/0x20
<snip>
Fixes: 3579032c08c1 ("net/mlx5e: Implement ethtool hardware timestamping statistics")
Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
index e211c41cec06..e1ed214e8651 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
@@ -1186,6 +1186,9 @@ void mlx5e_stats_ts_get(struct mlx5e_priv *priv,
ts_stats->err = 0;
ts_stats->lost = 0;
+ if (!ptp)
+ goto out;
+
/* Aggregate stats across all TCs */
for (i = 0; i < ptp->num_tc; i++) {
struct mlx5e_ptp_cq_stats *stats =
@@ -1214,6 +1217,7 @@ void mlx5e_stats_ts_get(struct mlx5e_priv *priv,
}
}
+out:
mutex_unlock(&priv->state_lock);
}
--
2.44.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH net 6/8] net/mlx5e: Do not use ptp structure for tx ts stats when not initialized
2024-05-22 19:26 ` [PATCH net 6/8] net/mlx5e: Do not use ptp structure for tx ts stats when not initialized Tariq Toukan
@ 2024-05-23 9:48 ` Simon Horman
0 siblings, 0 replies; 18+ messages in thread
From: Simon Horman @ 2024-05-23 9:48 UTC (permalink / raw)
To: Tariq Toukan
Cc: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
Rahul Rameshbabu
On Wed, May 22, 2024 at 10:26:57PM +0300, Tariq Toukan wrote:
> From: Rahul Rameshbabu <rrameshbabu@nvidia.com>
>
> The ptp channel instance is only initialized when ptp traffic is first
> processed by the driver. This means that there is a window in between when
> port timestamping is enabled and ptp traffic is sent where the ptp channel
> instance is not initialized. Accessing statistics during this window will
> lead to an access violation (NULL + member offset). Check the validity of
> the instance before attempting to query statistics.
>
> BUG: unable to handle page fault for address: 0000000000003524
> #PF: supervisor read access in kernel mode
> #PF: error_code(0x0000) - not-present page
> PGD 109dfc067 P4D 109dfc067 PUD 1064ef067 PMD 0
> Oops: 0000 [#1] SMP
> CPU: 0 PID: 420 Comm: ethtool Not tainted 6.9.0-rc2-rrameshbabu+ #245
> Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS Arch Linux 1.16.3-1-1 04/01/204
> RIP: 0010:mlx5e_stats_ts_get+0x4c/0x130
> <snip>
> Call Trace:
> <TASK>
> ? show_regs+0x60/0x70
> ? __die+0x24/0x70
> ? page_fault_oops+0x15f/0x430
> ? do_user_addr_fault+0x2c9/0x5c0
> ? exc_page_fault+0x63/0x110
> ? asm_exc_page_fault+0x27/0x30
> ? mlx5e_stats_ts_get+0x4c/0x130
> ? mlx5e_stats_ts_get+0x20/0x130
> mlx5e_get_ts_stats+0x15/0x20
> <snip>
>
> Fixes: 3579032c08c1 ("net/mlx5e: Implement ethtool hardware timestamping statistics")
> Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH net 7/8] net/mlx5e: Use rx_missed_errors instead of rx_dropped for reporting buffer exhaustion
2024-05-22 19:26 [PATCH net 0/8] mlx5 fixes 24-05-22 Tariq Toukan
` (5 preceding siblings ...)
2024-05-22 19:26 ` [PATCH net 6/8] net/mlx5e: Do not use ptp structure for tx ts stats when not initialized Tariq Toukan
@ 2024-05-22 19:26 ` Tariq Toukan
2024-05-23 9:48 ` Simon Horman
2024-05-22 19:26 ` [PATCH net 8/8] net/mlx5e: Fix UDP GSO for encapsulated packets Tariq Toukan
2024-05-24 12:30 ` [PATCH net 0/8] mlx5 fixes 24-05-22 patchwork-bot+netdevbpf
8 siblings, 1 reply; 18+ messages in thread
From: Tariq Toukan @ 2024-05-22 19:26 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
Carolina Jubran, Tariq Toukan
From: Carolina Jubran <cjubran@nvidia.com>
Previously, the driver incorrectly used rx_dropped to report device
buffer exhaustion.
According to the documentation, rx_dropped should not be used to count
packets dropped due to buffer exhaustion, which is the purpose of
rx_missed_errors.
Use rx_missed_errors as intended for counting packets dropped due to
buffer exhaustion.
Fixes: 269e6b3af3bf ("net/mlx5e: Report additional error statistics in get stats ndo")
Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index b758bc72ac36..c53c99dde558 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -3886,7 +3886,7 @@ mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
mlx5e_fold_sw_stats64(priv, stats);
}
- stats->rx_dropped = priv->stats.qcnt.rx_out_of_buffer;
+ stats->rx_missed_errors = priv->stats.qcnt.rx_out_of_buffer;
stats->rx_length_errors =
PPORT_802_3_GET(pstats, a_in_range_length_errors) +
--
2.44.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH net 7/8] net/mlx5e: Use rx_missed_errors instead of rx_dropped for reporting buffer exhaustion
2024-05-22 19:26 ` [PATCH net 7/8] net/mlx5e: Use rx_missed_errors instead of rx_dropped for reporting buffer exhaustion Tariq Toukan
@ 2024-05-23 9:48 ` Simon Horman
0 siblings, 0 replies; 18+ messages in thread
From: Simon Horman @ 2024-05-23 9:48 UTC (permalink / raw)
To: Tariq Toukan
Cc: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
Carolina Jubran
On Wed, May 22, 2024 at 10:26:58PM +0300, Tariq Toukan wrote:
> From: Carolina Jubran <cjubran@nvidia.com>
>
> Previously, the driver incorrectly used rx_dropped to report device
> buffer exhaustion.
>
> According to the documentation, rx_dropped should not be used to count
> packets dropped due to buffer exhaustion, which is the purpose of
> rx_missed_errors.
>
> Use rx_missed_errors as intended for counting packets dropped due to
> buffer exhaustion.
>
> Fixes: 269e6b3af3bf ("net/mlx5e: Report additional error statistics in get stats ndo")
> Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH net 8/8] net/mlx5e: Fix UDP GSO for encapsulated packets
2024-05-22 19:26 [PATCH net 0/8] mlx5 fixes 24-05-22 Tariq Toukan
` (6 preceding siblings ...)
2024-05-22 19:26 ` [PATCH net 7/8] net/mlx5e: Use rx_missed_errors instead of rx_dropped for reporting buffer exhaustion Tariq Toukan
@ 2024-05-22 19:26 ` Tariq Toukan
2024-05-23 9:48 ` Simon Horman
2024-05-24 12:30 ` [PATCH net 0/8] mlx5 fixes 24-05-22 patchwork-bot+netdevbpf
8 siblings, 1 reply; 18+ messages in thread
From: Tariq Toukan @ 2024-05-22 19:26 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
Cc: netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
Jason Baron, Dragos Tatulea, Boris Pismenny, Tariq Toukan
From: Gal Pressman <gal@nvidia.com>
When the skb is encapsulated, adjust the inner UDP header instead of the
outer one, and account for UDP header (instead of TCP) in the inline
header size calculation.
Fixes: 689adf0d4892 ("net/mlx5e: Add UDP GSO support")
Reported-by: Jason Baron <jbaron@akamai.com>
Closes: https://lore.kernel.org/netdev/c42961cb-50b9-4a9a-bd43-87fe48d88d29@akamai.com/
Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Reviewed-by: Boris Pismenny <borisp@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
.../net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h | 8 +++++++-
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 6 +++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
index caa34b9c161e..33e32584b07f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
@@ -102,8 +102,14 @@ static inline void
mlx5e_udp_gso_handle_tx_skb(struct sk_buff *skb)
{
int payload_len = skb_shinfo(skb)->gso_size + sizeof(struct udphdr);
+ struct udphdr *udphdr;
- udp_hdr(skb)->len = htons(payload_len);
+ if (skb->encapsulation)
+ udphdr = (struct udphdr *)skb_inner_transport_header(skb);
+ else
+ udphdr = udp_hdr(skb);
+
+ udphdr->len = htons(payload_len);
}
struct mlx5e_accel_tx_state {
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index 099bf1078889..b09e9abd39f3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -153,7 +153,11 @@ mlx5e_tx_get_gso_ihs(struct mlx5e_txqsq *sq, struct sk_buff *skb, int *hopbyhop)
*hopbyhop = 0;
if (skb->encapsulation) {
- ihs = skb_inner_tcp_all_headers(skb);
+ if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4)
+ ihs = skb_inner_transport_offset(skb) +
+ sizeof(struct udphdr);
+ else
+ ihs = skb_inner_tcp_all_headers(skb);
stats->tso_inner_packets++;
stats->tso_inner_bytes += skb->len - ihs;
} else {
--
2.44.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH net 8/8] net/mlx5e: Fix UDP GSO for encapsulated packets
2024-05-22 19:26 ` [PATCH net 8/8] net/mlx5e: Fix UDP GSO for encapsulated packets Tariq Toukan
@ 2024-05-23 9:48 ` Simon Horman
0 siblings, 0 replies; 18+ messages in thread
From: Simon Horman @ 2024-05-23 9:48 UTC (permalink / raw)
To: Tariq Toukan
Cc: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
netdev, Saeed Mahameed, Gal Pressman, Leon Romanovsky,
Jason Baron, Dragos Tatulea, Boris Pismenny
On Wed, May 22, 2024 at 10:26:59PM +0300, Tariq Toukan wrote:
> From: Gal Pressman <gal@nvidia.com>
>
> When the skb is encapsulated, adjust the inner UDP header instead of the
> outer one, and account for UDP header (instead of TCP) in the inline
> header size calculation.
>
> Fixes: 689adf0d4892 ("net/mlx5e: Add UDP GSO support")
> Reported-by: Jason Baron <jbaron@akamai.com>
> Closes: https://lore.kernel.org/netdev/c42961cb-50b9-4a9a-bd43-87fe48d88d29@akamai.com/
> Signed-off-by: Gal Pressman <gal@nvidia.com>
> Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
> Reviewed-by: Boris Pismenny <borisp@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Thanks,
This patch looks good to me.
Reviewed-by: Simon Horman <horms@kernel.org>
While looking over this patch, I noticed that it seems
that a similar pattern to the mlx5e_tx_get_gso_ihs() code
modified here appears in at least the MANA and NFP drivers.
So perhaps we could consider a helper in future.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH net 0/8] mlx5 fixes 24-05-22
2024-05-22 19:26 [PATCH net 0/8] mlx5 fixes 24-05-22 Tariq Toukan
` (7 preceding siblings ...)
2024-05-22 19:26 ` [PATCH net 8/8] net/mlx5e: Fix UDP GSO for encapsulated packets Tariq Toukan
@ 2024-05-24 12:30 ` patchwork-bot+netdevbpf
8 siblings, 0 replies; 18+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-05-24 12:30 UTC (permalink / raw)
To: Tariq Toukan; +Cc: davem, kuba, pabeni, edumazet, netdev, saeedm, gal, leonro
Hello:
This series was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:
On Wed, 22 May 2024 22:26:51 +0300 you wrote:
> Hi,
>
> This patchset provides bug fixes to mlx5 core and Eth drivers.
>
> Series generated against:
> commit 9c91c7fadb17 ("net: mana: Fix the extra HZ in mana_hwc_send_request")
>
> [...]
Here is the summary with links:
- [net,1/8] net/mlx5: Lag, do bond only if slaves agree on roce state
https://git.kernel.org/netdev/net/c/51ef9305b8f4
- [net,2/8] net/mlx5: Do not query MPIR on embedded CPU function
https://git.kernel.org/netdev/net/c/fca3b4791850
- [net,3/8] net/mlx5: Fix MTMP register capability offset in MCAM register
https://git.kernel.org/netdev/net/c/1b9f86c6d532
- [net,4/8] net/mlx5: Use mlx5_ipsec_rx_status_destroy to correctly delete status rules
https://git.kernel.org/netdev/net/c/16d66a4fa81d
- [net,5/8] net/mlx5e: Fix IPsec tunnel mode offload feature check
https://git.kernel.org/netdev/net/c/9a52f6d44f45
- [net,6/8] net/mlx5e: Do not use ptp structure for tx ts stats when not initialized
https://git.kernel.org/netdev/net/c/f55cd31287e5
- [net,7/8] net/mlx5e: Use rx_missed_errors instead of rx_dropped for reporting buffer exhaustion
https://git.kernel.org/netdev/net/c/5c74195d5dd9
- [net,8/8] net/mlx5e: Fix UDP GSO for encapsulated packets
https://git.kernel.org/netdev/net/c/83fea49f2711
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 18+ messages in thread