* [pull request][net 00/10] mlx5 fixes 2021-11-19
@ 2021-11-19 19:58 Saeed Mahameed
2021-11-19 19:58 ` [net 01/10] net/mlx5: E-switch, Respect BW share of the new group Saeed Mahameed
` (9 more replies)
0 siblings, 10 replies; 13+ messages in thread
From: Saeed Mahameed @ 2021-11-19 19:58 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski; +Cc: netdev, Saeed Mahameed
From: Saeed Mahameed <saeedm@nvidia.com>
Hi Dave, Hi Jakub,
This series provides fixes to mlx5 driver.
Please pull and let me know if there is any problem.
Thanks,
Saeed.
---
The following changes since commit 0f296e782f21dc1c55475a3c107ac68ab09cc1cf:
stmmac_pci: Fix underflow size in stmmac_rx (2021-11-19 11:54:34 +0000)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-fixes-2021-11-19
for you to fetch changes up to 1534b2c9592a0858eaa20f351560b4764f630204:
net/mlx5e: Do synchronize_net only once when deactivating channels (2021-11-19 11:57:07 -0800)
----------------------------------------------------------------
mlx5-fixes-2021-11-19
----------------------------------------------------------------
Aya Levin (1):
net/mlx5: Fix access to a non-supported register
Ben Ben-Ishay (1):
net/mlx5e: SHAMPO, Fix constant expression result
Dmytro Linkin (1):
net/mlx5: E-switch, Respect BW share of the new group
Gal Pressman (1):
net/mlx5: Fix too early queueing of log timestamp work
Lama Kayal (1):
net/mlx5e: Do synchronize_net only once when deactivating channels
Mark Bloch (1):
net/mlx5: E-Switch, fix single FDB creation on BlueField
Maxim Mikityanskiy (1):
net/mlx5e: Add activate/deactivate stage to XDPSQ
Raed Salem (2):
net/mlx5e: IPsec: Fix Software parser inner l3 type setting in case of encapsulation
net/mlx5e: Fix missing IPsec statistics on uplink representor
Saeed Mahameed (1):
net/mlx5e: Call synchronize_net outside of deactivating a queue
drivers/net/ethernet/mellanox/mlx5/core/en.h | 8 +-
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c | 30 +++++--
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h | 6 +-
drivers/net/ethernet/mellanox/mlx5/core/en/qos.c | 30 ++++---
drivers/net/ethernet/mellanox/mlx5/core/en/qos.h | 2 +-
.../ethernet/mellanox/mlx5/core/en/reporter_rx.c | 3 +
.../ethernet/mellanox/mlx5/core/en/reporter_tx.c | 3 +-
.../net/ethernet/mellanox/mlx5/core/en/xsk/pool.c | 2 +
.../net/ethernet/mellanox/mlx5/core/en/xsk/setup.c | 4 +-
.../mellanox/mlx5/core/en_accel/ipsec_rxtx.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 98 ++++++++++++++++------
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 4 +
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 8 +-
drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c | 2 +-
.../ethernet/mellanox/mlx5/core/eswitch_offloads.c | 1 +
drivers/net/ethernet/mellanox/mlx5/core/health.c | 5 +-
drivers/net/ethernet/mellanox/mlx5/core/main.c | 8 +-
include/linux/mlx5/mlx5_ifc.h | 5 +-
18 files changed, 151 insertions(+), 70 deletions(-)
^ permalink raw reply [flat|nested] 13+ messages in thread
* [net 01/10] net/mlx5: E-switch, Respect BW share of the new group
2021-11-19 19:58 [pull request][net 00/10] mlx5 fixes 2021-11-19 Saeed Mahameed
@ 2021-11-19 19:58 ` Saeed Mahameed
2021-11-19 19:58 ` [net 02/10] net/mlx5e: IPsec: Fix Software parser inner l3 type setting in case of encapsulation Saeed Mahameed
` (8 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2021-11-19 19:58 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski
Cc: netdev, Dmytro Linkin, Mark Bloch, Parav Pandit, Roi Dayan,
Saeed Mahameed
From: Dmytro Linkin <dlinkin@nvidia.com>
To enable transmit schduler on vport FW require non-zero configuration
for vport's TSAR. If vport added to the group which has configured BW
share value and TX rate values of the vport are zero, then scheduler
wouldn't be enabled on this vport.
Fix that by calling BW normalization if BW share of the new group is
configured.
Fixes: 0fe132eac38c ("net/mlx5: E-switch, Allow to add vports to rate groups")
Signed-off-by: Dmytro Linkin <dlinkin@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Reviewed-by: Parav Pandit <parav@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c
index c6cc67cb4f6a..4501e3d737f8 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c
@@ -423,7 +423,7 @@ static int esw_qos_vport_update_group(struct mlx5_eswitch *esw,
return err;
/* Recalculate bw share weights of old and new groups */
- if (vport->qos.bw_share) {
+ if (vport->qos.bw_share || new_group->bw_share) {
esw_qos_normalize_vports_min_rate(esw, curr_group, extack);
esw_qos_normalize_vports_min_rate(esw, new_group, extack);
}
--
2.31.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [net 02/10] net/mlx5e: IPsec: Fix Software parser inner l3 type setting in case of encapsulation
2021-11-19 19:58 [pull request][net 00/10] mlx5 fixes 2021-11-19 Saeed Mahameed
2021-11-19 19:58 ` [net 01/10] net/mlx5: E-switch, Respect BW share of the new group Saeed Mahameed
@ 2021-11-19 19:58 ` Saeed Mahameed
2021-11-19 19:58 ` [net 03/10] net/mlx5: Fix too early queueing of log timestamp work Saeed Mahameed
` (7 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2021-11-19 19:58 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski
Cc: netdev, Raed Salem, Maor Dickman, Saeed Mahameed
From: Raed Salem <raeds@nvidia.com>
Current code wrongly uses the skb->protocol field which reflects the
outer l3 protocol to set the inner l3 type in Software Parser (SWP)
fields settings in the ethernet segment (eseg) in flows where inner
l3 exists like in Vxlan over ESP flow, the above method wrongly use
the outer protocol type instead of the inner one. thus breaking cases
where inner and outer headers have different protocols.
Fix by setting the inner l3 type in SWP according to the inner l3 ip
header version.
Fixes: 2ac9cfe78223 ("net/mlx5e: IPSec, Add Innova IPSec offload TX data path")
Signed-off-by: Raed Salem <raeds@nvidia.com>
Reviewed-by: Maor Dickman <maord@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c
index fb5397324aa4..2db9573a3fe6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c
@@ -191,7 +191,7 @@ static void mlx5e_ipsec_set_swp(struct sk_buff *skb,
eseg->swp_inner_l3_offset = skb_inner_network_offset(skb) / 2;
eseg->swp_inner_l4_offset =
(skb->csum_start + skb->head - skb->data) / 2;
- if (skb->protocol == htons(ETH_P_IPV6))
+ if (inner_ip_hdr(skb)->version == 6)
eseg->swp_flags |= MLX5_ETH_WQE_SWP_INNER_L3_IPV6;
break;
default:
--
2.31.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [net 03/10] net/mlx5: Fix too early queueing of log timestamp work
2021-11-19 19:58 [pull request][net 00/10] mlx5 fixes 2021-11-19 Saeed Mahameed
2021-11-19 19:58 ` [net 01/10] net/mlx5: E-switch, Respect BW share of the new group Saeed Mahameed
2021-11-19 19:58 ` [net 02/10] net/mlx5e: IPsec: Fix Software parser inner l3 type setting in case of encapsulation Saeed Mahameed
@ 2021-11-19 19:58 ` Saeed Mahameed
2021-11-19 19:58 ` [net 04/10] net/mlx5: Fix access to a non-supported register Saeed Mahameed
` (6 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2021-11-19 19:58 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski
Cc: netdev, Gal Pressman, Moshe Shemesh, Saeed Mahameed
From: Gal Pressman <gal@nvidia.com>
The log timestamp work should not be queued before the command interface
is initialized, move it to a later stage in the init flow.
Fixes: 5a1023deeed0 ("net/mlx5: Add periodic update of host time to firmware")
Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/health.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c
index 64f1abc4dc36..380f50d5462d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/health.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c
@@ -835,6 +835,9 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev)
health->timer.expires = jiffies + msecs_to_jiffies(poll_interval_ms);
add_timer(&health->timer);
+
+ if (mlx5_core_is_pf(dev))
+ queue_delayed_work(health->wq, &health->update_fw_log_ts_work, 0);
}
void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health)
@@ -902,8 +905,6 @@ int mlx5_health_init(struct mlx5_core_dev *dev)
INIT_WORK(&health->fatal_report_work, mlx5_fw_fatal_reporter_err_work);
INIT_WORK(&health->report_work, mlx5_fw_reporter_err_work);
INIT_DELAYED_WORK(&health->update_fw_log_ts_work, mlx5_health_log_ts_update);
- if (mlx5_core_is_pf(dev))
- queue_delayed_work(health->wq, &health->update_fw_log_ts_work, 0);
return 0;
--
2.31.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [net 04/10] net/mlx5: Fix access to a non-supported register
2021-11-19 19:58 [pull request][net 00/10] mlx5 fixes 2021-11-19 Saeed Mahameed
` (2 preceding siblings ...)
2021-11-19 19:58 ` [net 03/10] net/mlx5: Fix too early queueing of log timestamp work Saeed Mahameed
@ 2021-11-19 19:58 ` Saeed Mahameed
2021-11-19 19:58 ` [net 05/10] net/mlx5e: SHAMPO, Fix constant expression result Saeed Mahameed
` (5 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2021-11-19 19:58 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski
Cc: netdev, Aya Levin, Gal Pressman, Moshe Shemesh, Saeed Mahameed
From: Aya Levin <ayal@nvidia.com>
Validate MRTC register is supported before triggering a delayed work
which accesses it.
Fixes: 5a1023deeed0 ("net/mlx5: Add periodic update of host time to firmware")
Signed-off-by: Aya Levin <ayal@nvidia.com>
Reviewed-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/health.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/main.c | 8 +++-----
include/linux/mlx5/mlx5_ifc.h | 5 ++++-
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c
index 380f50d5462d..3ca998874c50 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/health.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c
@@ -836,7 +836,7 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev)
health->timer.expires = jiffies + msecs_to_jiffies(poll_interval_ms);
add_timer(&health->timer);
- if (mlx5_core_is_pf(dev))
+ if (mlx5_core_is_pf(dev) && MLX5_CAP_MCAM_REG(dev, mrtc))
queue_delayed_work(health->wq, &health->update_fw_log_ts_work, 0);
}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index a92a92a52346..990a0c2bd51d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -1075,18 +1075,16 @@ static int mlx5_function_setup(struct mlx5_core_dev *dev, bool boot)
mlx5_set_driver_version(dev);
- mlx5_start_health_poll(dev);
-
err = mlx5_query_hca_caps(dev);
if (err) {
mlx5_core_err(dev, "query hca failed\n");
- goto stop_health;
+ goto reclaim_boot_pages;
}
+ mlx5_start_health_poll(dev);
+
return 0;
-stop_health:
- mlx5_stop_health_poll(dev, boot);
reclaim_boot_pages:
mlx5_reclaim_startup_pages(dev);
err_disable_hca:
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 3636df90899a..fbaab440a484 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -9698,7 +9698,10 @@ struct mlx5_ifc_mcam_access_reg_bits {
u8 regs_84_to_68[0x11];
u8 tracer_registers[0x4];
- u8 regs_63_to_32[0x20];
+ u8 regs_63_to_46[0x12];
+ u8 mrtc[0x1];
+ u8 regs_44_to_32[0xd];
+
u8 regs_31_to_0[0x20];
};
--
2.31.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [net 05/10] net/mlx5e: SHAMPO, Fix constant expression result
2021-11-19 19:58 [pull request][net 00/10] mlx5 fixes 2021-11-19 Saeed Mahameed
` (3 preceding siblings ...)
2021-11-19 19:58 ` [net 04/10] net/mlx5: Fix access to a non-supported register Saeed Mahameed
@ 2021-11-19 19:58 ` Saeed Mahameed
2021-11-19 19:58 ` [net 06/10] net/mlx5: E-Switch, fix single FDB creation on BlueField Saeed Mahameed
` (4 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2021-11-19 19:58 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski
Cc: netdev, Ben Ben-Ishay, Tariq Toukan, Saeed Mahameed
From: Ben Ben-Ishay <benishay@nvidia.com>
mlx5e_build_shampo_hd_umr uses counters i and index incorrectly
as unsigned, thus the err state err_unmap could stuck in endless loop.
Change i to int to solve the first issue.
Reduce index check to solve the second issue, the caller function
validates that index could not rotate.
Fixes: 64509b052525 ("net/mlx5e: Add data path for SHAMPO feature")
Signed-off-by: Ben Ben-Ishay <benishay@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index 96967b0a2441..793511d5ee4c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -543,13 +543,13 @@ static int mlx5e_build_shampo_hd_umr(struct mlx5e_rq *rq,
u16 klm_entries, u16 index)
{
struct mlx5e_shampo_hd *shampo = rq->mpwqe.shampo;
- u16 entries, pi, i, header_offset, err, wqe_bbs, new_entries;
+ u16 entries, pi, header_offset, err, wqe_bbs, new_entries;
u32 lkey = rq->mdev->mlx5e_res.hw_objs.mkey;
struct page *page = shampo->last_page;
u64 addr = shampo->last_addr;
struct mlx5e_dma_info *dma_info;
struct mlx5e_umr_wqe *umr_wqe;
- int headroom;
+ int headroom, i;
headroom = rq->buff.headroom;
new_entries = klm_entries - (shampo->pi & (MLX5_UMR_KLM_ALIGNMENT - 1));
@@ -601,9 +601,7 @@ static int mlx5e_build_shampo_hd_umr(struct mlx5e_rq *rq,
err_unmap:
while (--i >= 0) {
- if (--index < 0)
- index = shampo->hd_per_wq - 1;
- dma_info = &shampo->info[index];
+ dma_info = &shampo->info[--index];
if (!(i & (MLX5E_SHAMPO_WQ_HEADER_PER_PAGE - 1))) {
dma_info->addr = ALIGN_DOWN(dma_info->addr, PAGE_SIZE);
mlx5e_page_release(rq, dma_info, true);
--
2.31.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [net 06/10] net/mlx5: E-Switch, fix single FDB creation on BlueField
2021-11-19 19:58 [pull request][net 00/10] mlx5 fixes 2021-11-19 Saeed Mahameed
` (4 preceding siblings ...)
2021-11-19 19:58 ` [net 05/10] net/mlx5e: SHAMPO, Fix constant expression result Saeed Mahameed
@ 2021-11-19 19:58 ` Saeed Mahameed
2021-11-19 19:58 ` [net 07/10] net/mlx5e: Fix missing IPsec statistics on uplink representor Saeed Mahameed
` (3 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2021-11-19 19:58 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski
Cc: netdev, Mark Bloch, Maor Gottlieb, Saeed Mahameed
From: Mark Bloch <mbloch@nvidia.com>
Always use MLX5_FLOW_TABLE_OTHER_VPORT flag when creating egress ACL
table for single FDB. Not doing so on BlueField will make firmware fail
the command. On BlueField the E-Switch manager is the ECPF (vport 0xFFFE)
which is filled in the flow table creation command but as the
other_vport field wasn't set the firmware complains about a bad parameter.
This is different from a regular HCA where the E-Switch manager vport is
the PF (vport 0x0). Passing MLX5_FLOW_TABLE_OTHER_VPORT will make the
firmware happy both on BlueField and on regular HCAs without special
condition for each.
This fixes the bellow firmware syndrome:
mlx5_cmd_check:819:(pid 571): CREATE_FLOW_TABLE(0x930) op_mod(0x0) failed, status bad parameter(0x3), syndrome (0x754a4)
Fixes: db202995f503 ("net/mlx5: E-Switch, add logic to enable shared FDB")
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Reviewed-by: Maor Gottlieb <maorg@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index a46455694f7a..275af1d2b4d3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -2512,6 +2512,7 @@ static int esw_set_master_egress_rule(struct mlx5_core_dev *master,
struct mlx5_eswitch *esw = master->priv.eswitch;
struct mlx5_flow_table_attr ft_attr = {
.max_fte = 1, .prio = 0, .level = 0,
+ .flags = MLX5_FLOW_TABLE_OTHER_VPORT,
};
struct mlx5_flow_namespace *egress_ns;
struct mlx5_flow_table *acl;
--
2.31.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [net 07/10] net/mlx5e: Fix missing IPsec statistics on uplink representor
2021-11-19 19:58 [pull request][net 00/10] mlx5 fixes 2021-11-19 Saeed Mahameed
` (5 preceding siblings ...)
2021-11-19 19:58 ` [net 06/10] net/mlx5: E-Switch, fix single FDB creation on BlueField Saeed Mahameed
@ 2021-11-19 19:58 ` Saeed Mahameed
2021-11-19 19:58 ` [net 08/10] net/mlx5e: Add activate/deactivate stage to XDPSQ Saeed Mahameed
` (2 subsequent siblings)
9 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2021-11-19 19:58 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski
Cc: netdev, Raed Salem, Alaa Hleihel, Saeed Mahameed
From: Raed Salem <raeds@nvidia.com>
The cited patch added the IPsec support to uplink representor, however
as uplink representors have his private statistics where IPsec stats
is not part of it, that effectively makes IPsec stats hidden when uplink
representor stats queried.
Resolve by adding IPsec stats to uplink representor private statistics.
Fixes: 5589b8f1a2c7 ("net/mlx5e: Add IPsec support to uplink representor")
Signed-off-by: Raed Salem <raeds@nvidia.com>
Reviewed-by: Alaa Hleihel <alaa@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index e58a9ec42553..48895d79796a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -1080,6 +1080,10 @@ static mlx5e_stats_grp_t mlx5e_ul_rep_stats_grps[] = {
&MLX5E_STATS_GRP(pme),
&MLX5E_STATS_GRP(channels),
&MLX5E_STATS_GRP(per_port_buff_congest),
+#ifdef CONFIG_MLX5_EN_IPSEC
+ &MLX5E_STATS_GRP(ipsec_sw),
+ &MLX5E_STATS_GRP(ipsec_hw),
+#endif
};
static unsigned int mlx5e_ul_rep_stats_grps_num(struct mlx5e_priv *priv)
--
2.31.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [net 08/10] net/mlx5e: Add activate/deactivate stage to XDPSQ
2021-11-19 19:58 [pull request][net 00/10] mlx5 fixes 2021-11-19 Saeed Mahameed
` (6 preceding siblings ...)
2021-11-19 19:58 ` [net 07/10] net/mlx5e: Fix missing IPsec statistics on uplink representor Saeed Mahameed
@ 2021-11-19 19:58 ` Saeed Mahameed
2021-11-20 4:00 ` Jakub Kicinski
2021-11-19 19:58 ` [net 09/10] net/mlx5e: Call synchronize_net outside of deactivating a queue Saeed Mahameed
2021-11-19 19:58 ` [net 10/10] net/mlx5e: Do synchronize_net only once when deactivating channels Saeed Mahameed
9 siblings, 1 reply; 13+ messages in thread
From: Saeed Mahameed @ 2021-11-19 19:58 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski
Cc: netdev, Maxim Mikityanskiy, Lama Kayal, Tariq Toukan,
Saeed Mahameed
From: Maxim Mikityanskiy <maximmi@nvidia.com>
Normally, the lifecycle of a queue in mlx5e has four transitions: open,
activate, deactivate and close. However, XDPSQs combine open with
activate and close with deactivate. This patch cleans it up by properly
separating these stages in order to make it possible to move
synchronize_net in the following fix.
Fixes: 0a06382fa406 ("net/mlx5e: Encapsulate open/close queues into a function"
Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Signed-off-by: Lama Kayal <lkayal@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 ++
.../mellanox/mlx5/core/en/xsk/setup.c | 4 ++--
.../net/ethernet/mellanox/mlx5/core/en_main.c | 20 +++++++++++++++----
3 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index f0ac6b0d9653..a0a5d6321098 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -1020,6 +1020,8 @@ void mlx5e_close_icosq(struct mlx5e_icosq *sq);
int mlx5e_open_xdpsq(struct mlx5e_channel *c, struct mlx5e_params *params,
struct mlx5e_sq_param *param, struct xsk_buff_pool *xsk_pool,
struct mlx5e_xdpsq *sq, bool is_redirect);
+void mlx5e_activate_xdpsq(struct mlx5e_xdpsq *sq);
+void mlx5e_deactivate_xdpsq(struct mlx5e_xdpsq *sq);
void mlx5e_close_xdpsq(struct mlx5e_xdpsq *sq);
struct mlx5e_create_cq_param {
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c
index 538bc2419bd8..39873e834766 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c
@@ -171,7 +171,7 @@ void mlx5e_close_xsk(struct mlx5e_channel *c)
void mlx5e_activate_xsk(struct mlx5e_channel *c)
{
set_bit(MLX5E_RQ_STATE_ENABLED, &c->xskrq.state);
- /* TX queue is created active. */
+ mlx5e_activate_xdpsq(&c->xsksq);
spin_lock_bh(&c->async_icosq_lock);
mlx5e_trigger_irq(&c->async_icosq);
@@ -180,6 +180,6 @@ void mlx5e_activate_xsk(struct mlx5e_channel *c)
void mlx5e_deactivate_xsk(struct mlx5e_channel *c)
{
+ mlx5e_deactivate_xdpsq(&c->xsksq);
mlx5e_deactivate_rq(&c->xskrq);
- /* TX queue is disabled on close. */
}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 65571593ec5c..6914fc17277a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1647,7 +1647,6 @@ int mlx5e_open_xdpsq(struct mlx5e_channel *c, struct mlx5e_params *params,
csp.cqn = sq->cq.mcq.cqn;
csp.wq_ctrl = &sq->wq_ctrl;
csp.min_inline_mode = sq->min_inline_mode;
- set_bit(MLX5E_SQ_STATE_ENABLED, &sq->state);
err = mlx5e_create_sq_rdy(c->mdev, param, &csp, 0, &sq->sqn);
if (err)
goto err_free_xdpsq;
@@ -1687,18 +1686,25 @@ int mlx5e_open_xdpsq(struct mlx5e_channel *c, struct mlx5e_params *params,
return 0;
err_free_xdpsq:
- clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state);
mlx5e_free_xdpsq(sq);
return err;
}
-void mlx5e_close_xdpsq(struct mlx5e_xdpsq *sq)
+void mlx5e_activate_xdpsq(struct mlx5e_xdpsq *sq)
{
- struct mlx5e_channel *c = sq->channel;
+ set_bit(MLX5E_SQ_STATE_ENABLED, &sq->state);
+}
+void mlx5e_deactivate_xdpsq(struct mlx5e_xdpsq *sq)
+{
clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state);
synchronize_net(); /* Sync with NAPI. */
+}
+
+void mlx5e_close_xdpsq(struct mlx5e_xdpsq *sq)
+{
+ struct mlx5e_channel *c = sq->channel;
mlx5e_destroy_sq(c->mdev, sq->sqn);
mlx5e_free_xdpsq_descs(sq);
@@ -2249,7 +2255,10 @@ static void mlx5e_activate_channel(struct mlx5e_channel *c)
mlx5e_activate_txqsq(&c->sq[tc]);
mlx5e_activate_icosq(&c->icosq);
mlx5e_activate_icosq(&c->async_icosq);
+ if (c->xdp)
+ mlx5e_activate_xdpsq(&c->rq_xdpsq);
mlx5e_activate_rq(&c->rq);
+ mlx5e_activate_xdpsq(&c->xdpsq);
if (test_bit(MLX5E_CHANNEL_STATE_XSK, c->state))
mlx5e_activate_xsk(c);
@@ -2262,7 +2271,10 @@ static void mlx5e_deactivate_channel(struct mlx5e_channel *c)
if (test_bit(MLX5E_CHANNEL_STATE_XSK, c->state))
mlx5e_deactivate_xsk(c);
+ mlx5e_deactivate_xdpsq(&c->xdpsq);
mlx5e_deactivate_rq(&c->rq);
+ if (c->xdp)
+ mlx5e_deactivate_xdpsq(&c->rq_xdpsq);
mlx5e_deactivate_icosq(&c->async_icosq);
mlx5e_deactivate_icosq(&c->icosq);
for (tc = 0; tc < c->num_tc; tc++)
--
2.31.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [net 09/10] net/mlx5e: Call synchronize_net outside of deactivating a queue
2021-11-19 19:58 [pull request][net 00/10] mlx5 fixes 2021-11-19 Saeed Mahameed
` (7 preceding siblings ...)
2021-11-19 19:58 ` [net 08/10] net/mlx5e: Add activate/deactivate stage to XDPSQ Saeed Mahameed
@ 2021-11-19 19:58 ` Saeed Mahameed
2021-11-19 19:58 ` [net 10/10] net/mlx5e: Do synchronize_net only once when deactivating channels Saeed Mahameed
9 siblings, 0 replies; 13+ messages in thread
From: Saeed Mahameed @ 2021-11-19 19:58 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski
Cc: netdev, Saeed Mahameed, Lama Kayal, Maxim Mikityanskiy,
Tariq Toukan
From: Saeed Mahameed <saeedm@nvidia.com>
This patch moves synchronize_net outside of queue deactivate functions.
It prepares the code for the following fix that will convert to calling
synchronize_net only once when deactivating channels.
This patch also reduces the number of synchronize_net calls by squashing
together the calls in mlx5e_deactivate_channel, however, the real
reduction will happen in the next patch.
Also, mlx5e_deactivate_txqsq got separated into two functions, and
mlx5e_qos_deactivate_queues got separated into two sections and
to make it possible to move synchronize_net outside.
Fixes: 9c25a22dfb00 ("net/mlx5e: Use synchronize_rcu to sync with NAPI")
Signed-off-by: Lama Kayal <lkayal@nvidia.com>
Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en.h | 6 ++-
.../net/ethernet/mellanox/mlx5/core/en/ptp.c | 16 ++++---
.../net/ethernet/mellanox/mlx5/core/en/qos.c | 30 ++++++++-----
.../net/ethernet/mellanox/mlx5/core/en/qos.h | 2 +-
.../mellanox/mlx5/core/en/reporter_rx.c | 3 ++
.../mellanox/mlx5/core/en/reporter_tx.c | 3 +-
.../ethernet/mellanox/mlx5/core/en/xsk/pool.c | 2 +
.../net/ethernet/mellanox/mlx5/core/en_main.c | 44 ++++++++++++-------
8 files changed, 71 insertions(+), 35 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index a0a5d6321098..837354118df8 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -1077,8 +1077,10 @@ int mlx5e_open_txqsq(struct mlx5e_channel *c, u32 tisn, int txq_ix,
struct mlx5e_params *params, struct mlx5e_sq_param *param,
struct mlx5e_txqsq *sq, int tc, u16 qos_queue_group_id,
struct mlx5e_sq_stats *sq_stats);
-void mlx5e_activate_txqsq(struct mlx5e_txqsq *sq);
-void mlx5e_deactivate_txqsq(struct mlx5e_txqsq *sq);
+void mlx5e_enable_txqsq(struct mlx5e_txqsq *sq);
+void mlx5e_start_txqsq(struct mlx5e_txqsq *sq);
+void mlx5e_disable_txqsq(struct mlx5e_txqsq *sq);
+void mlx5e_stop_txqsq(struct mlx5e_txqsq *sq);
void mlx5e_free_txqsq(struct mlx5e_txqsq *sq);
void mlx5e_tx_disable_queue(struct netdev_queue *txq);
int mlx5e_alloc_txqsq_db(struct mlx5e_txqsq *sq, int numa);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c
index 18d542b1c5cb..f190c5437294 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c
@@ -731,8 +731,10 @@ void mlx5e_ptp_activate_channel(struct mlx5e_ptp *c)
napi_enable(&c->napi);
if (test_bit(MLX5E_PTP_STATE_TX, c->state)) {
- for (tc = 0; tc < c->num_tc; tc++)
- mlx5e_activate_txqsq(&c->ptpsq[tc].txqsq);
+ for (tc = 0; tc < c->num_tc; tc++) {
+ mlx5e_enable_txqsq(&c->ptpsq[tc].txqsq);
+ mlx5e_start_txqsq(&c->ptpsq[tc].txqsq);
+ }
}
if (test_bit(MLX5E_PTP_STATE_RX, c->state)) {
mlx5e_ptp_rx_set_fs(c->priv);
@@ -748,10 +750,14 @@ void mlx5e_ptp_deactivate_channel(struct mlx5e_ptp *c)
mlx5e_deactivate_rq(&c->rq);
if (test_bit(MLX5E_PTP_STATE_TX, c->state)) {
- for (tc = 0; tc < c->num_tc; tc++)
- mlx5e_deactivate_txqsq(&c->ptpsq[tc].txqsq);
- }
+ for (tc = 0; tc < c->num_tc; tc++) {
+ mlx5e_disable_txqsq(&c->ptpsq[tc].txqsq);
+ /* Sync with NAPI to prevent netif_tx_wake_queue. */
+ synchronize_net();
+ mlx5e_stop_txqsq(&c->ptpsq[tc].txqsq);
+ }
+ }
napi_disable(&c->napi);
}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/en/qos.c
index 50977f01a050..869d5b3a38cc 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/qos.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/qos.c
@@ -284,7 +284,8 @@ static void mlx5e_activate_qos_sq(struct mlx5e_priv *priv, struct mlx5e_qos_node
smp_wmb();
qos_dbg(priv->mdev, "Activate QoS SQ qid %u\n", node->qid);
- mlx5e_activate_txqsq(sq);
+ mlx5e_enable_txqsq(sq);
+ mlx5e_start_txqsq(sq);
}
static void mlx5e_deactivate_qos_sq(struct mlx5e_priv *priv, u16 qid)
@@ -296,8 +297,9 @@ static void mlx5e_deactivate_qos_sq(struct mlx5e_priv *priv, u16 qid)
return;
qos_dbg(priv->mdev, "Deactivate QoS SQ qid %u\n", qid);
- mlx5e_deactivate_txqsq(sq);
-
+ mlx5e_disable_txqsq(sq);
+ synchronize_net();
+ mlx5e_stop_txqsq(sq);
/* The queue is disabled, no synchronization with datapath is needed. */
priv->txq2sq[mlx5e_qid_from_qos(&priv->channels, qid)] = NULL;
}
@@ -431,7 +433,7 @@ void mlx5e_qos_activate_queues(struct mlx5e_priv *priv)
}
}
-void mlx5e_qos_deactivate_queues(struct mlx5e_channel *c)
+void mlx5e_qos_deactivate_queues(struct mlx5e_channel *c, bool finalize)
{
struct mlx5e_params *params = &c->priv->channels.params;
struct mlx5e_txqsq __rcu **qos_sqs;
@@ -448,12 +450,15 @@ void mlx5e_qos_deactivate_queues(struct mlx5e_channel *c)
sq = mlx5e_state_dereference(c->priv, qos_sqs[i]);
if (!sq) /* Handle the case when the SQ failed to open. */
continue;
-
- qos_dbg(c->mdev, "Deactivate QoS SQ qid %u\n", qid);
- mlx5e_deactivate_txqsq(sq);
-
- /* The queue is disabled, no synchronization with datapath is needed. */
- c->priv->txq2sq[mlx5e_qid_from_qos(&c->priv->channels, qid)] = NULL;
+ if (finalize) {
+ qos_dbg(c->mdev, "Finalize QoS SQ qid %u\n", qid);
+ mlx5e_stop_txqsq(sq);
+ /* The queue is disabled, no synchronization with datapath is needed. */
+ c->priv->txq2sq[mlx5e_qid_from_qos(&c->priv->channels, qid)] = NULL;
+ } else {
+ qos_dbg(c->mdev, "Deactivate QoS SQ qid %u\n", qid);
+ mlx5e_disable_txqsq(sq);
+ }
}
}
@@ -462,7 +467,10 @@ static void mlx5e_qos_deactivate_all_queues(struct mlx5e_channels *chs)
int i;
for (i = 0; i < chs->num; i++)
- mlx5e_qos_deactivate_queues(chs->c[i]);
+ mlx5e_qos_deactivate_queues(chs->c[i], false);
+ synchronize_net();
+ for (i = 0; i < chs->num; i++)
+ mlx5e_qos_deactivate_queues(chs->c[i], true);
}
/* HTB API */
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/qos.h b/drivers/net/ethernet/mellanox/mlx5/core/en/qos.h
index b7558907ba20..bf294288c1ea 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/qos.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/qos.h
@@ -23,7 +23,7 @@ struct mlx5e_txqsq *mlx5e_get_sq(struct mlx5e_priv *priv, int qid);
/* SQ lifecycle */
int mlx5e_qos_open_queues(struct mlx5e_priv *priv, struct mlx5e_channels *chs);
void mlx5e_qos_activate_queues(struct mlx5e_priv *priv);
-void mlx5e_qos_deactivate_queues(struct mlx5e_channel *c);
+void mlx5e_qos_deactivate_queues(struct mlx5e_channel *c, bool finalize);
void mlx5e_qos_close_queues(struct mlx5e_channel *c);
/* HTB API */
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c
index 74086eb556ae..98959ffa5efa 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c
@@ -84,11 +84,13 @@ static int mlx5e_rx_reporter_err_icosq_cqe_recover(void *ctx)
goto out;
mlx5e_deactivate_rq(rq);
+ synchronize_net(); /* Sync with NAPI. */
err = mlx5e_wait_for_icosq_flush(icosq);
if (err)
goto out;
mlx5e_deactivate_icosq(icosq);
+ synchronize_net(); /* Sync with NAPI. */
/* At this point, both the rq and the icosq are disabled */
@@ -134,6 +136,7 @@ static int mlx5e_rx_reporter_err_rq_cqe_recover(void *ctx)
int err;
mlx5e_deactivate_rq(rq);
+ synchronize_net(); /* Sync with NAPI. */
mlx5e_free_rx_descs(rq);
err = mlx5e_rq_to_ready(rq, MLX5_RQC_STATE_ERR);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c
index 4f4bc8726ec4..262deeb80e5b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c
@@ -80,7 +80,8 @@ static int mlx5e_tx_reporter_err_cqe_recover(void *ctx)
mlx5e_reset_txqsq_cc_pc(sq);
sq->stats->recover++;
clear_bit(MLX5E_SQ_STATE_RECOVERING, &sq->state);
- mlx5e_activate_txqsq(sq);
+ mlx5e_enable_txqsq(sq);
+ mlx5e_start_txqsq(sq);
return 0;
out:
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/pool.c b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/pool.c
index 7b562d2c8a19..4c7bf4e1bfee 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/pool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/pool.c
@@ -130,6 +130,7 @@ static int mlx5e_xsk_enable_locked(struct mlx5e_priv *priv,
err_deactivate:
mlx5e_deactivate_xsk(c);
+ synchronize_net(); /* Sync with NAPI. */
mlx5e_close_xsk(c);
err_remove_pool:
@@ -171,6 +172,7 @@ static int mlx5e_xsk_disable_locked(struct mlx5e_priv *priv, u16 ix)
c = priv->channels.c[ix];
mlx5e_rx_res_xsk_deactivate(priv->rx_res, ix);
mlx5e_deactivate_xsk(c);
+ synchronize_net(); /* Sync with NAPI. */
mlx5e_close_xsk(c);
remove_pool:
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 6914fc17277a..1fb0d9b70301 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1081,7 +1081,6 @@ void mlx5e_activate_rq(struct mlx5e_rq *rq)
void mlx5e_deactivate_rq(struct mlx5e_rq *rq)
{
clear_bit(MLX5E_RQ_STATE_ENABLED, &rq->state);
- synchronize_net(); /* Sync with NAPI to prevent mlx5e_post_rx_wqes. */
}
void mlx5e_close_rq(struct mlx5e_rq *rq)
@@ -1513,14 +1512,18 @@ int mlx5e_open_txqsq(struct mlx5e_channel *c, u32 tisn, int txq_ix,
return err;
}
-void mlx5e_activate_txqsq(struct mlx5e_txqsq *sq)
+void mlx5e_enable_txqsq(struct mlx5e_txqsq *sq)
{
sq->txq = netdev_get_tx_queue(sq->netdev, sq->txq_ix);
set_bit(MLX5E_SQ_STATE_ENABLED, &sq->state);
+}
+
+void mlx5e_start_txqsq(struct mlx5e_txqsq *sq)
+{
+ sq->txq = netdev_get_tx_queue(sq->netdev, sq->txq_ix);
netdev_tx_reset_queue(sq->txq);
netif_tx_start_queue(sq->txq);
}
-
void mlx5e_tx_disable_queue(struct netdev_queue *txq)
{
__netif_tx_lock_bh(txq);
@@ -1528,13 +1531,18 @@ void mlx5e_tx_disable_queue(struct netdev_queue *txq)
__netif_tx_unlock_bh(txq);
}
-void mlx5e_deactivate_txqsq(struct mlx5e_txqsq *sq)
+void mlx5e_disable_txqsq(struct mlx5e_txqsq *sq)
{
- struct mlx5_wq_cyc *wq = &sq->wq;
-
clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state);
- synchronize_net(); /* Sync with NAPI to prevent netif_tx_wake_queue. */
+}
+
+void mlx5e_stop_txqsq(struct mlx5e_txqsq *sq)
+{
+ struct mlx5_wq_cyc *wq = &sq->wq;
+ /* The SQ must be deactivated, and synchronize_rcu must be called before
+ * this function to prevent netif_tx_wake_queue from reenabling the SQ.
+ */
mlx5e_tx_disable_queue(sq->txq);
/* last doorbell out, godspeed .. */
@@ -1617,7 +1625,6 @@ void mlx5e_activate_icosq(struct mlx5e_icosq *icosq)
void mlx5e_deactivate_icosq(struct mlx5e_icosq *icosq)
{
clear_bit(MLX5E_SQ_STATE_ENABLED, &icosq->state);
- synchronize_net(); /* Sync with NAPI. */
}
void mlx5e_close_icosq(struct mlx5e_icosq *sq)
@@ -1699,7 +1706,6 @@ void mlx5e_activate_xdpsq(struct mlx5e_xdpsq *sq)
void mlx5e_deactivate_xdpsq(struct mlx5e_xdpsq *sq)
{
clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state);
- synchronize_net(); /* Sync with NAPI. */
}
void mlx5e_close_xdpsq(struct mlx5e_xdpsq *sq)
@@ -2251,8 +2257,10 @@ static void mlx5e_activate_channel(struct mlx5e_channel *c)
napi_enable(&c->napi);
- for (tc = 0; tc < c->num_tc; tc++)
- mlx5e_activate_txqsq(&c->sq[tc]);
+ for (tc = 0; tc < c->num_tc; tc++) {
+ mlx5e_enable_txqsq(&c->sq[tc]);
+ mlx5e_start_txqsq(&c->sq[tc]);
+ }
mlx5e_activate_icosq(&c->icosq);
mlx5e_activate_icosq(&c->async_icosq);
if (c->xdp)
@@ -2277,10 +2285,16 @@ static void mlx5e_deactivate_channel(struct mlx5e_channel *c)
mlx5e_deactivate_xdpsq(&c->rq_xdpsq);
mlx5e_deactivate_icosq(&c->async_icosq);
mlx5e_deactivate_icosq(&c->icosq);
- for (tc = 0; tc < c->num_tc; tc++)
- mlx5e_deactivate_txqsq(&c->sq[tc]);
- mlx5e_qos_deactivate_queues(c);
-
+ synchronize_net(); /* Sync with NAPI. */
+ for (tc = 0; tc < c->num_tc; tc++) {
+ mlx5e_disable_txqsq(&c->sq[tc]);
+ /* Sync with NAPI to prevent netif_tx_wake_queue. */
+ synchronize_net();
+ mlx5e_stop_txqsq(&c->sq[tc]);
+ }
+ mlx5e_qos_deactivate_queues(c, false);
+ synchronize_net();
+ mlx5e_qos_deactivate_queues(c, true);
napi_disable(&c->napi);
}
--
2.31.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [net 10/10] net/mlx5e: Do synchronize_net only once when deactivating channels
2021-11-19 19:58 [pull request][net 00/10] mlx5 fixes 2021-11-19 Saeed Mahameed
` (8 preceding siblings ...)
2021-11-19 19:58 ` [net 09/10] net/mlx5e: Call synchronize_net outside of deactivating a queue Saeed Mahameed
@ 2021-11-19 19:58 ` Saeed Mahameed
2021-11-20 4:03 ` Jakub Kicinski
9 siblings, 1 reply; 13+ messages in thread
From: Saeed Mahameed @ 2021-11-19 19:58 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski
Cc: netdev, Lama Kayal, Maxim Mikityanskiy, Tariq Toukan,
Saeed Mahameed
From: Lama Kayal <lkayal@nvidia.com>
Synchronize_net takes time, and given that it's called multiple times
per channel on deactivation, it accumulates to a significant amount,
which causes timeouts in some applications (for example, when using
bonding with NetworkManager).
This commit fixes the timing issue by restructuring the code, so that
synchronize_net is only called once per deactivation of all channels.
It's entirely valid, because we only need one synchronization point with
NAPI between deactivation and closing the channels.
Fixes: 9c25a22dfb00 ("net/mlx5e: Use synchronize_rcu to sync with NAPI")
Signed-off-by: Lama Kayal <lkayal@nvidia.com>
Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
.../net/ethernet/mellanox/mlx5/core/en/ptp.c | 26 ++++++----
.../net/ethernet/mellanox/mlx5/core/en/ptp.h | 6 ++-
.../net/ethernet/mellanox/mlx5/core/en_main.c | 52 +++++++++++++------
3 files changed, 55 insertions(+), 29 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c
index f190c5437294..3314fcadec5c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c
@@ -724,11 +724,14 @@ void mlx5e_ptp_close(struct mlx5e_ptp *c)
kvfree(c);
}
-void mlx5e_ptp_activate_channel(struct mlx5e_ptp *c)
+void mlx5e_ptp_enable_channel(struct mlx5e_ptp *c)
{
- int tc;
-
napi_enable(&c->napi);
+}
+
+void mlx5e_ptp_start_channel(struct mlx5e_ptp *c)
+{
+ int tc;
if (test_bit(MLX5E_PTP_STATE_TX, c->state)) {
for (tc = 0; tc < c->num_tc; tc++) {
@@ -742,22 +745,25 @@ void mlx5e_ptp_activate_channel(struct mlx5e_ptp *c)
}
}
-void mlx5e_ptp_deactivate_channel(struct mlx5e_ptp *c)
+void mlx5e_ptp_disable_channel(struct mlx5e_ptp *c)
{
int tc;
if (test_bit(MLX5E_PTP_STATE_RX, c->state))
mlx5e_deactivate_rq(&c->rq);
- if (test_bit(MLX5E_PTP_STATE_TX, c->state)) {
- for (tc = 0; tc < c->num_tc; tc++) {
+ if (test_bit(MLX5E_PTP_STATE_TX, c->state))
+ for (tc = 0; tc < c->num_tc; tc++)
mlx5e_disable_txqsq(&c->ptpsq[tc].txqsq);
+}
+
+void mlx5e_ptp_stop_channel(struct mlx5e_ptp *c)
+{
+ int tc;
- /* Sync with NAPI to prevent netif_tx_wake_queue. */
- synchronize_net();
+ if (test_bit(MLX5E_PTP_STATE_TX, c->state))
+ for (tc = 0; tc < c->num_tc; tc++)
mlx5e_stop_txqsq(&c->ptpsq[tc].txqsq);
- }
- }
napi_disable(&c->napi);
}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h
index a71a32e00ebb..e96d2af682f9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h
@@ -70,8 +70,10 @@ static inline bool mlx5e_use_ptpsq(struct sk_buff *skb)
int mlx5e_ptp_open(struct mlx5e_priv *priv, struct mlx5e_params *params,
u8 lag_port, struct mlx5e_ptp **cp);
void mlx5e_ptp_close(struct mlx5e_ptp *c);
-void mlx5e_ptp_activate_channel(struct mlx5e_ptp *c);
-void mlx5e_ptp_deactivate_channel(struct mlx5e_ptp *c);
+void mlx5e_ptp_enable_channel(struct mlx5e_ptp *c);
+void mlx5e_ptp_start_channel(struct mlx5e_ptp *c);
+void mlx5e_ptp_disable_channel(struct mlx5e_ptp *c);
+void mlx5e_ptp_stop_channel(struct mlx5e_ptp *c);
int mlx5e_ptp_get_rqn(struct mlx5e_ptp *c, u32 *rqn);
int mlx5e_ptp_alloc_rx_fs(struct mlx5e_priv *priv);
void mlx5e_ptp_free_rx_fs(struct mlx5e_priv *priv);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 1fb0d9b70301..f77d76728b46 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -2251,11 +2251,14 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
return err;
}
-static void mlx5e_activate_channel(struct mlx5e_channel *c)
+static void mlx5e_enable_channel(struct mlx5e_channel *c)
{
- int tc;
-
napi_enable(&c->napi);
+}
+
+static void mlx5e_start_channel(struct mlx5e_channel *c)
+{
+ int tc;
for (tc = 0; tc < c->num_tc; tc++) {
mlx5e_enable_txqsq(&c->sq[tc]);
@@ -2272,7 +2275,7 @@ static void mlx5e_activate_channel(struct mlx5e_channel *c)
mlx5e_activate_xsk(c);
}
-static void mlx5e_deactivate_channel(struct mlx5e_channel *c)
+static void mlx5e_disable_channel(struct mlx5e_channel *c)
{
int tc;
@@ -2285,15 +2288,17 @@ static void mlx5e_deactivate_channel(struct mlx5e_channel *c)
mlx5e_deactivate_xdpsq(&c->rq_xdpsq);
mlx5e_deactivate_icosq(&c->async_icosq);
mlx5e_deactivate_icosq(&c->icosq);
- synchronize_net(); /* Sync with NAPI. */
- for (tc = 0; tc < c->num_tc; tc++) {
+ for (tc = 0; tc < c->num_tc; tc++)
mlx5e_disable_txqsq(&c->sq[tc]);
- /* Sync with NAPI to prevent netif_tx_wake_queue. */
- synchronize_net();
- mlx5e_stop_txqsq(&c->sq[tc]);
- }
mlx5e_qos_deactivate_queues(c, false);
- synchronize_net();
+}
+
+static void mlx5e_stop_channel(struct mlx5e_channel *c)
+{
+ int tc;
+
+ for (tc = 0; tc < c->num_tc; tc++)
+ mlx5e_stop_txqsq(&c->sq[tc]);
mlx5e_qos_deactivate_queues(c, true);
napi_disable(&c->napi);
}
@@ -2371,11 +2376,15 @@ static void mlx5e_activate_channels(struct mlx5e_channels *chs)
{
int i;
- for (i = 0; i < chs->num; i++)
- mlx5e_activate_channel(chs->c[i]);
+ for (i = 0; i < chs->num; i++) {
+ mlx5e_enable_channel(chs->c[i]);
+ mlx5e_start_channel(chs->c[i]);
+ }
- if (chs->ptp)
- mlx5e_ptp_activate_channel(chs->ptp);
+ if (chs->ptp) {
+ mlx5e_ptp_enable_channel(chs->ptp);
+ mlx5e_ptp_start_channel(chs->ptp);
+ }
}
#define MLX5E_RQ_WQES_TIMEOUT 20000 /* msecs */
@@ -2403,10 +2412,19 @@ static void mlx5e_deactivate_channels(struct mlx5e_channels *chs)
int i;
if (chs->ptp)
- mlx5e_ptp_deactivate_channel(chs->ptp);
+ mlx5e_ptp_disable_channel(chs->ptp);
+
+ for (i = 0; i < chs->num; i++)
+ mlx5e_disable_channel(chs->c[i]);
+
+ /* Sync with all NAPIs to wait until they stop using queues. */
+ synchronize_net();
+
+ if (chs->ptp)
+ mlx5e_ptp_stop_channel(chs->ptp);
for (i = 0; i < chs->num; i++)
- mlx5e_deactivate_channel(chs->c[i]);
+ mlx5e_stop_channel(chs->c[i]);
}
void mlx5e_close_channels(struct mlx5e_channels *chs)
--
2.31.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [net 08/10] net/mlx5e: Add activate/deactivate stage to XDPSQ
2021-11-19 19:58 ` [net 08/10] net/mlx5e: Add activate/deactivate stage to XDPSQ Saeed Mahameed
@ 2021-11-20 4:00 ` Jakub Kicinski
0 siblings, 0 replies; 13+ messages in thread
From: Jakub Kicinski @ 2021-11-20 4:00 UTC (permalink / raw)
To: Saeed Mahameed
Cc: David S. Miller, netdev, Maxim Mikityanskiy, Lama Kayal,
Tariq Toukan, Saeed Mahameed
On Fri, 19 Nov 2021 11:58:11 -0800 Saeed Mahameed wrote:
> Fixes: 0a06382fa406 ("net/mlx5e: Encapsulate open/close queues into a function"
missing closing bracket
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [net 10/10] net/mlx5e: Do synchronize_net only once when deactivating channels
2021-11-19 19:58 ` [net 10/10] net/mlx5e: Do synchronize_net only once when deactivating channels Saeed Mahameed
@ 2021-11-20 4:03 ` Jakub Kicinski
0 siblings, 0 replies; 13+ messages in thread
From: Jakub Kicinski @ 2021-11-20 4:03 UTC (permalink / raw)
To: Saeed Mahameed
Cc: David S. Miller, netdev, Lama Kayal, Maxim Mikityanskiy,
Tariq Toukan, Saeed Mahameed
On Fri, 19 Nov 2021 11:58:13 -0800 Saeed Mahameed wrote:
> Synchronize_net takes time, and given that it's called multiple times
> per channel on deactivation, it accumulates to a significant amount,
> which causes timeouts in some applications (for example, when using
> bonding with NetworkManager).
>
> This commit fixes the timing issue by restructuring the code, so that
> synchronize_net is only called once per deactivation of all channels.
> It's entirely valid, because we only need one synchronization point with
> NAPI between deactivation and closing the channels.
Since you're pushing this as a fix can we please see the benchmarks
/ numbers to justify this? The patch in Fixes was in tree for 1.5yrs.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2021-11-20 4:03 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-19 19:58 [pull request][net 00/10] mlx5 fixes 2021-11-19 Saeed Mahameed
2021-11-19 19:58 ` [net 01/10] net/mlx5: E-switch, Respect BW share of the new group Saeed Mahameed
2021-11-19 19:58 ` [net 02/10] net/mlx5e: IPsec: Fix Software parser inner l3 type setting in case of encapsulation Saeed Mahameed
2021-11-19 19:58 ` [net 03/10] net/mlx5: Fix too early queueing of log timestamp work Saeed Mahameed
2021-11-19 19:58 ` [net 04/10] net/mlx5: Fix access to a non-supported register Saeed Mahameed
2021-11-19 19:58 ` [net 05/10] net/mlx5e: SHAMPO, Fix constant expression result Saeed Mahameed
2021-11-19 19:58 ` [net 06/10] net/mlx5: E-Switch, fix single FDB creation on BlueField Saeed Mahameed
2021-11-19 19:58 ` [net 07/10] net/mlx5e: Fix missing IPsec statistics on uplink representor Saeed Mahameed
2021-11-19 19:58 ` [net 08/10] net/mlx5e: Add activate/deactivate stage to XDPSQ Saeed Mahameed
2021-11-20 4:00 ` Jakub Kicinski
2021-11-19 19:58 ` [net 09/10] net/mlx5e: Call synchronize_net outside of deactivating a queue Saeed Mahameed
2021-11-19 19:58 ` [net 10/10] net/mlx5e: Do synchronize_net only once when deactivating channels Saeed Mahameed
2021-11-20 4:03 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).