mlx5 fixes 2021-08-09
Subsystems (9)
From: Saeed Mahameed <[email protected]>
Hi Dave, Jakub,
This series introduces fixes to mlx5 driver. Please pull and let me know if there is any problem.
Thanks,
Saeed.
---
The following changes since commit d09c548dbf3b31cb07bba562e0f452edfa01efe3:
net: sched: act_mirred: Reset ct info when mirror/redirect skb (2021-08-09 10:58:47 +0100)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-fixes-2021-08-09
for you to fetch changes up to bd37c2888ccaa5ceb9895718f6909b247cc372e0:
net/mlx5: Fix return value from tracer initialization (2021-08-09 20:57:03 -0700)
----------------------------------------------------------------
mlx5-fixes-2021-08-09
----------------------------------------------------------------
Alex Vesker (1):
net/mlx5: DR, Add fail on error check on decap
Aya Levin (2):
net/mlx5: Block switchdev mode while devlink traps are active net/mlx5: Fix return value from tracer initialization
Chris Mi (1):
net/mlx5e: TC, Fix error handling memory leak
Leon Romanovsky (1):
net/mlx5: Don't skip subfunction cleanup in case of error in module init
Maxim Mikityanskiy (1):
net/mlx5e: Destroy page pool after XDP SQ to fix use-after-free
Roi Dayan (1):
net/mlx5e: Avoid creating tunnel headers for local route
Shay Drory (4):
net/mlx5: Fix order of functions in mlx5_irq_detach_nb() net/mlx5: Set all field of mlx5_irq before inserting it to the xarray net/mlx5: Destroy pool->mutex
net/mlx5: Synchronize correct IRQ when destroying CQ
Vlad Buslov (1):
net/mlx5: Bridge, fix ageing time
drivers/infiniband/hw/mlx5/cq.c | 4 +-- drivers/infiniband/hw/mlx5/devx.c | 3 +- drivers/net/ethernet/mellanox/mlx5/core/cq.c | 1 + .../ethernet/mellanox/mlx5/core/diag/fw_tracer.c | 11 ++++++-- .../net/ethernet/mellanox/mlx5/core/en/tc_tun.c | 5 ++++ drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 33 ++++++++-------------- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 20 ++++++++++--- .../net/ethernet/mellanox/mlx5/core/esw/bridge.c | 4 +-- .../net/ethernet/mellanox/mlx5/core/esw/sample.c | 1 + .../ethernet/mellanox/mlx5/core/eswitch_offloads.c | 14 +++++++-- .../net/ethernet/mellanox/mlx5/core/fpga/conn.c | 4 +-- drivers/net/ethernet/mellanox/mlx5/core/lib/eq.h | 2 ++ drivers/net/ethernet/mellanox/mlx5/core/main.c | 12 +++----- .../net/ethernet/mellanox/mlx5/core/mlx5_core.h | 5 ++++ drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c | 10 +++++-- .../ethernet/mellanox/mlx5/core/steering/dr_send.c | 4 +-- .../mellanox/mlx5/core/steering/dr_ste_v0.c | 2 ++ drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 +- include/linux/mlx5/driver.h | 3 +- 19 files changed, 83 insertions(+), 58 deletions(-)
PATCH 1/12 net/mlx5: Don't skip subfunction cleanup in case of error in module init
From: Leon Romanovsky <[email protected]>
Clean SF resources if mlx5 eth failed to initialize.
--- drivers/net/ethernet/mellanox/mlx5/core/main.c | 12 ++++-------- drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h | 5 +++++ 2 files changed, 9 insertions(+), 8 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/main.c +4 -8
@@ -1784,16 +1784,14 @@ static int __init init(void)if (err) goto err_sf; -#ifdef CONFIG_MLX5_CORE_EN err =mlx5e_init (); -if (err) { -pci_unregister_driver (&mlx5_core_driver); - goto err_debug; - } -#endif +if (err) + goto err_en;return 0 ; +err_en: +mlx5_sf_driver_unregister (); err_sf:pci_unregister_driver (&mlx5_core_driver); err_debug:
@@ -1803,9 +1801,7 @@ static int __init init(void) static void __exit cleanup(void) { -#ifdef CONFIG_MLX5_CORE_EN mlx5e_cleanup (); -#endif mlx5_sf_driver_unregister ();pci_unregister_driver (&mlx5_core_driver);mlx5_unregister_debugfs ();
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +5 -0
@@ -206,8 +206,13 @@ int mlx5_firmware_flash(struct mlx5_core_dev *dev, const struct firmware *fw,int mlx5_fw_version_query (struct mlx5_core_dev *dev,u32 *running_ver,u32 *stored_ver); +#ifdef CONFIG_MLX5_CORE_EN int mlx5e_init (void );void mlx5e_cleanup (void ); +#else +static inline int mlx5e_init (void ){return 0 ; } +static inline void mlx5e_cleanup (void ){} +#endif static inline bool mlx5_sriov_is_enabled (struct mlx5_core_dev *dev) {
Signature · 1 line
2.31.1
PATCH 2/12 net/mlx5: DR, Add fail on error check on decap
In reply to Saeed MahameedFrom: Alex Vesker <[email protected]>
While processing encapsulated packet on RX, one of the fields that is checked is the inner packet length. If the length as specified in the header doesn't match the actual inner packet length, the packet is invalid and should be dropped. However, such packet caused the NIC to hang.
This patch turns on a 'fail_on_error' HW bit which allows HW to drop such an invalid packet while processing RX packet and trying to decap it.
--- drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c +2 -0
@@ -352,6 +352,7 @@ static void dr_ste_v0_set_rx_decap(u8 *hw_ste_p) {MLX5_SET (ste_rx_steering_mult, hw_ste_p, tunneling_action,DR_STE_TUNL_ACTION_DECAP ); +MLX5_SET (ste_rx_steering_mult, hw_ste_p, fail_on_error,1 ); }static void dr_ste_v0_set_rx_pop_vlan (u8 *hw_ste_p)
@@ -365,6 +366,7 @@ static void dr_ste_v0_set_rx_decap_l3(u8 *hw_ste_p, bool vlan)MLX5_SET (ste_rx_steering_mult, hw_ste_p, tunneling_action,DR_STE_TUNL_ACTION_L3_DECAP );MLX5_SET (ste_modify_packet, hw_ste_p, action_description, vlan ?1 :0 ); +MLX5_SET (ste_rx_steering_mult, hw_ste_p, fail_on_error,1 ); } static void dr_ste_v0_set_rewrite_actions(u8 *hw_ste_p, u16 num_of_actions,
Signature · 1 line
2.31.1
PATCH 3/12 net/mlx5e: Avoid creating tunnel headers for local route
In reply to Saeed MahameedFrom: Roi Dayan <[email protected]>
It could be local and remote are on the same machine and the route result will be a local route which will result in creating encap id with src/dst mac address of 0.
--- drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c +5 -0
@@ -124,6 +124,11 @@ static int mlx5e_route_lookup_ipv4_get(struct mlx5e_priv *priv,if (IS_ERR (rt))return PTR_ERR (rt); +if (rt->rt_type !=RTN_UNICAST ) { + ret = -ENETUNREACH ; + goto err_rt_release; + } +if (mlx5_lag_is_multipath (mdev) && rt->rt_gw_family !=AF_INET ) { ret = -ENETUNREACH ; goto err_rt_release;
Signature · 1 line
2.31.1
PATCH 4/12 net/mlx5: Bridge, fix ageing time
In reply to Saeed MahameedFrom: Vlad Buslov <[email protected]>
Ageing time is not converted from clock_t to jiffies which results incorrect ageing timeout calculation in workqueue update task. Fix it by applying clock_t_to_jiffies() to provided value.
--- drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c +2 -2
@@ -579,7 +579,7 @@ static struct mlx5_esw_bridge *mlx5_esw_bridge_create(int ifindex,xa_init (&bridge->vports); bridge->ifindex = ifindex; bridge->refcnt =1 ; - bridge->ageing_time =BR_DEFAULT_AGEING_TIME ; + bridge->ageing_time =clock_t_to_jiffies (BR_DEFAULT_AGEING_TIME );list_add (&bridge->list, &br_offloads->bridges);return bridge;
@@ -1006,7 +1006,7 @@ int mlx5_esw_bridge_ageing_time_set(unsigned long ageing_time, struct mlx5_eswitif (!vport->bridge)return -EINVAL ; - vport->bridge->ageing_time = ageing_time; + vport->bridge->ageing_time =clock_t_to_jiffies (ageing_time);return 0 ; }
Signature · 1 line
2.31.1
PATCH 5/12 net/mlx5e: Destroy page pool after XDP SQ to fix use-after-free
In reply to Saeed MahameedFrom: Maxim Mikityanskiy <[email protected]>
mlx5e_close_xdpsq does the cleanup: it calls mlx5e_free_xdpsq_descs to free the outstanding descriptors, which relies on mlx5e_page_release_dynamic and page_pool_release_page. However, page_pool_destroy is already called by this point, because mlx5e_close_rq runs before mlx5e_close_xdpsq.
This commit fixes the use-after-free by swapping mlx5e_close_xdpsq and mlx5e_close_rq.
The commit cited below started calling page_pool_destroy directly from the driver. Previously, the page pool was destroyed under a call_rcu from xdp_rxq_info_unreg_mem_model, which would defer the deallocation until after the XDPSQ is cleaned up.
--- .../net/ethernet/mellanox/mlx5/core/en_main.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +10 -10
@@ -1891,30 +1891,30 @@ static int mlx5e_open_queues(struct mlx5e_channel *c,if (err) goto err_close_icosq; + err =mlx5e_open_rxq_rq (c, params, &cparam->rq); +if (err) + goto err_close_sqs; +if (c->xdp) { err =mlx5e_open_xdpsq (c, params, &cparam->xdp_sq,NULL , &c->rq_xdpsq, false);if (err) - goto err_close_sqs; + goto err_close_rq; } - err =mlx5e_open_rxq_rq (c, params, &cparam->rq); -if (err) - goto err_close_xdp_sq; - err =mlx5e_open_xdpsq (c, params, &cparam->xdp_sq,NULL , &c->xdpsq, true);if (err) - goto err_close_rq; + goto err_close_xdp_sq;return 0 ; -err_close_rq: -mlx5e_close_rq (&c->rq); - err_close_xdp_sq:if (c->xdp)mlx5e_close_xdpsq (&c->rq_xdpsq); +err_close_rq: +mlx5e_close_rq (&c->rq); + err_close_sqs:mlx5e_close_sqs (c);
@@ -1949,9 +1949,9 @@ static int mlx5e_open_queues(struct mlx5e_channel *c,static void mlx5e_close_queues (struct mlx5e_channel *c) {mlx5e_close_xdpsq (&c->xdpsq); -mlx5e_close_rq (&c->rq);if (c->xdp)mlx5e_close_xdpsq (&c->rq_xdpsq); +mlx5e_close_rq (&c->rq);mlx5e_close_sqs (c);mlx5e_close_icosq (&c->icosq);mlx5e_close_icosq (&c->async_icosq);
Signature · 1 line
2.31.1
PATCH 6/12 net/mlx5: Block switchdev mode while devlink traps are active
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Since switchdev mode can't support devlink traps, verify there are no active devlink traps before moving eswitch to switchdev mode. If there are active traps, prevent the switchdev mode configuration.
--- .../ethernet/mellanox/mlx5/core/eswitch_offloads.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +11 -3
@@ -48,6 +48,7 @@#include "lib/fs_chains.h" #include "en_tc.h" #include "en/mapping.h" +#include "devlink.h" #define mlx5_esw_for_each_rep (esw, i, rep) \ xa_for_each(&((esw)->offloads.vport_reps), i, rep)
@@ -3001,12 +3002,19 @@ int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode,if (cur_mlx5_mode == mlx5_mode) goto unlock; -if (mode ==DEVLINK_ESWITCH_MODE_SWITCHDEV ) +if (mode ==DEVLINK_ESWITCH_MODE_SWITCHDEV ) { +if (mlx5_devlink_trap_get_num_active (esw->dev)) { +NL_SET_ERR_MSG_MOD (extack, +"Can't change mode while devlink traps are active" ); + err = -EOPNOTSUPP ; + goto unlock; + } err =esw_offloads_start (esw, extack); -else if (mode ==DEVLINK_ESWITCH_MODE_LEGACY ) + }else if (mode ==DEVLINK_ESWITCH_MODE_LEGACY ) { err =esw_offloads_stop (esw, extack); -else + }else { err = -EINVAL ; + } unlock:mlx5_esw_unlock (esw);
Signature · 1 line
2.31.1
PATCH 7/12 net/mlx5: Fix order of functions in mlx5_irq_detach_nb()
In reply to Saeed MahameedFrom: Shay Drory <[email protected]>
Change order of functions in mlx5_irq_detach_nb() so it will be a mirror of mlx5_irq_attach_nb.
--- drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c +4 -1
@@ -251,8 +251,11 @@ int mlx5_irq_attach_nb(struct mlx5_irq *irq, struct notifier_block *nb)int mlx5_irq_detach_nb (struct mlx5_irq *irq,struct notifier_block *nb) { +int err =0 ; + + err =atomic_notifier_chain_unregister (&irq->nh, nb);irq_put (irq); -return atomic_notifier_chain_unregister (&irq->nh, nb); +return err; }struct cpumask *mlx5_irq_get_affinity_mask (struct mlx5_irq *irq)
Signature · 1 line
2.31.1
PATCH 8/12 net/mlx5: Set all field of mlx5_irq before inserting it to the xarray
In reply to Saeed MahameedFrom: Shay Drory <[email protected]>
Currently irq->pool is set after the irq is insert to the xarray. Set irq->pool before the irq is inserted to the xarray.
--- drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c +1 -1
@@ -214,6 +214,7 @@ static struct mlx5_irq *irq_request(struct mlx5_irq_pool *pool, int i) err = -ENOMEM ; goto err_cpumask; } + irq->pool = pool;kref_init (&irq->kref); irq->index = i; err =xa_err (xa_store (&pool->irqs, irq->index, irq,GFP_KERNEL ));
@@ -222,7 +223,6 @@ static struct mlx5_irq *irq_request(struct mlx5_irq_pool *pool, int i) irq->index, err); goto err_xa; } - irq->pool = pool;return irq; err_xa:free_cpumask_var (irq->mask);
Signature · 1 line
2.31.1
PATCH 9/12 net/mlx5: Destroy pool->mutex
In reply to Saeed MahameedFrom: Shay Drory <[email protected]>
Destroy pool->mutex when we destroy the pool.
--- drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c +2 -1
@@ -440,6 +440,7 @@ irq_pool_alloc(struct mlx5_core_dev *dev, int start, int size, char *name,if (!pool)return ERR_PTR (-ENOMEM ); pool->dev = dev; +mutex_init (&pool->lock);xa_init_flags (&pool->irqs,XA_FLAGS_ALLOC ); pool->xa_num_irqs.min = start; pool->xa_num_irqs.max = start + size -1 ;
@@ -448,7 +449,6 @@ irq_pool_alloc(struct mlx5_core_dev *dev, int start, int size, char *name, name); pool->min_threshold = min_threshold *MLX5_EQ_REFS_PER_IRQ ; pool->max_threshold = max_threshold *MLX5_EQ_REFS_PER_IRQ ; -mutex_init (&pool->lock);mlx5_core_dbg (dev,"pool->name = %s, pool->size = %d, pool->start = %d" , name, size, start);return pool;
@@ -462,6 +462,7 @@ static void irq_pool_free(struct mlx5_irq_pool *pool)xa_for_each (&pool->irqs, index, irq)irq_release (&irq->kref);xa_destroy (&pool->irqs); +mutex_destroy (&pool->lock);kvfree (pool); }
Signature · 1 line
2.31.1
PATCH 10/12 net/mlx5e: TC, Fix error handling memory leak
In reply to Saeed MahameedFrom: Chris Mi <[email protected]>
Free the offload sample action on error.
--- drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c +1 -0
@@ -501,6 +501,7 @@ mlx5_esw_sample_offload(struct mlx5_esw_psample *esw_psample, err_offload_rule:mlx5_esw_vporttbl_put (esw, &per_vport_tbl_attr); err_default_tbl: +kfree (sample_flow);return ERR_PTR (err); }
Signature · 1 line
2.31.1
PATCH 11/12 net/mlx5: Synchronize correct IRQ when destroying CQ
In reply to Saeed MahameedFrom: Shay Drory <[email protected]>
The CQ destroy is performed based on the IRQ number that is stored in cq->irqn. That number wasn't set explicitly during CQ creation and as expected some of the API users of mlx5_core_create_cq() forgot to update it.
This caused to wrong synchronization call of the wrong IRQ with a number 0 instead of the real one.
As a fix, set the IRQ number directly in the mlx5_core_create_cq() and update all users accordingly.
--- drivers/infiniband/hw/mlx5/cq.c | 4 +--- drivers/infiniband/hw/mlx5/devx.c | 3 +-- drivers/net/ethernet/mellanox/mlx5/core/cq.c | 1 + .../net/ethernet/mellanox/mlx5/core/en_main.c | 13 ++---------- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 20 +++++++++++++++---- .../ethernet/mellanox/mlx5/core/fpga/conn.c | 4 +--- .../net/ethernet/mellanox/mlx5/core/lib/eq.h | 2 ++ .../mellanox/mlx5/core/steering/dr_send.c | 4 +--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 +-- include/linux/mlx5/driver.h | 3 +-- 10 files changed, 27 insertions(+), 30 deletions(-)
drivers/infiniband/hw/mlx5/cq.c +1 -3
@@ -945,7 +945,6 @@ int mlx5_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,u32 *cqb =NULL ;void *cqc;int cqe_size; -unsigned int irqn;int eqn;int err;
@@ -984,7 +983,7 @@ int mlx5_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,INIT_WORK (&cq->notify_work, notify_soft_wc_handler); } - err =mlx5_vector2eqn (dev->mdev, vector, &eqn, &irqn); + err =mlx5_vector2eqn (dev->mdev, vector, &eqn);if (err) goto err_cqb;
@@ -1007,7 +1006,6 @@ int mlx5_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, goto err_cqb;mlx5_ib_dbg (dev,"cqn 0x%x\n" , cq->mcq.cqn); - cq->mcq.irqn = irqn;if (udata) cq->mcq.tasklet_ctx.comp = mlx5_ib_cq_comp;else
drivers/infiniband/hw/mlx5/devx.c +1 -2
@@ -975,7 +975,6 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_QUERY_EQN)(struct mlx5_ib_dev *dev;int user_vector;int dev_eqn; -unsigned int irqn;int err; if (uverbs_copy_from(&user_vector, attrs,
@@ -987,7 +986,7 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_QUERY_EQN)(return PTR_ERR (c); dev =to_mdev (c->ibucontext.device); - err =mlx5_vector2eqn (dev->mdev, user_vector, &dev_eqn, &irqn); + err =mlx5_vector2eqn (dev->mdev, user_vector, &dev_eqn);if (err <0 )return err;
drivers/net/ethernet/mellanox/mlx5/core/cq.c +1 -0
@@ -134,6 +134,7 @@ int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, cq->cqn); cq->uar = dev->priv.uar; + cq->irqn = eq->core.irqn;return 0 ;
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +2 -11
@@ -1535,15 +1535,9 @@ static int mlx5e_alloc_cq_common(struct mlx5e_priv *priv, {struct mlx5_core_dev *mdev = priv->mdev;struct mlx5_core_cq *mcq = &cq->mcq; -int eqn_not_used; -unsigned int irqn;int err;u32 i; - err =mlx5_vector2eqn (mdev, param->eq_ix, &eqn_not_used, &irqn); -if (err) -return err; - err =mlx5_cqwq_create (mdev, ¶m->wq, param->cqc, &cq->wq, &cq->wq_ctrl);if (err)
@@ -1557,7 +1551,6 @@ static int mlx5e_alloc_cq_common(struct mlx5e_priv *priv, mcq->vector = param->eq_ix; mcq->comp = mlx5e_completion_event; mcq->event = mlx5e_cq_error_event; - mcq->irqn = irqn;for (i =0 ; i <mlx5_cqwq_get_size (&cq->wq); i++) {struct mlx5_cqe64 *cqe =mlx5_cqwq_get_wqe (&cq->wq, i);
@@ -1605,11 +1598,10 @@ static int mlx5e_create_cq(struct mlx5e_cq *cq, struct mlx5e_cq_param *param)void *in;void *cqc;int inlen; -unsigned int irqn_not_used;int eqn;int err; - err =mlx5_vector2eqn (mdev, param->eq_ix, &eqn, &irqn_not_used); + err =mlx5_vector2eqn (mdev, param->eq_ix, &eqn);if (err)return err;
@@ -1983,9 +1975,8 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,struct mlx5e_channel *c;unsigned int irq;int err; -int eqn; - err =mlx5_vector2eqn (priv->mdev, ix, &eqn, &irq); + err =mlx5_vector2irqn (priv->mdev, ix, &irq);if (err)return err;
drivers/net/ethernet/mellanox/mlx5/core/eq.c +16 -4
@@ -855,8 +855,8 @@ static int create_comp_eqs(struct mlx5_core_dev *dev)return err; } -int mlx5_vector2eqn (struct mlx5_core_dev *dev,int vector,int *eqn, -unsigned int *irqn) +static int vector2eqnirqn (struct mlx5_core_dev *dev,int vector,int *eqn, +unsigned int *irqn) {struct mlx5_eq_table *table = dev->priv.eq_table;struct mlx5_eq_comp *eq, *n;
@@ -865,8 +865,10 @@ int mlx5_vector2eqn(struct mlx5_core_dev *dev, int vector, int *eqn,list_for_each_entry_safe (eq, n, &table->comp_eqs_list, list) {if (i++ == vector) { - *eqn = eq->core.eqn; - *irqn = eq->core.irqn; +if (irqn) + *irqn = eq->core.irqn; +if (eqn) + *eqn = eq->core.eqn; err =0 ;break ; }
@@ -874,8 +876,18 @@ int mlx5_vector2eqn(struct mlx5_core_dev *dev, int vector, int *eqn,return err; } + +int mlx5_vector2eqn (struct mlx5_core_dev *dev,int vector,int *eqn) +{ +return vector2eqnirqn (dev, vector, eqn,NULL ); +}EXPORT_SYMBOL (mlx5_vector2eqn); +int mlx5_vector2irqn (struct mlx5_core_dev *dev,int vector,unsigned int *irqn) +{ +return vector2eqnirqn (dev, vector,NULL , irqn); +} +unsigned int mlx5_comp_vectors_count (struct mlx5_core_dev *dev) {return dev->priv.eq_table->num_comp_eqs;
drivers/net/ethernet/mellanox/mlx5/core/fpga/conn.c +1 -3
@@ -417,7 +417,6 @@ static int mlx5_fpga_conn_create_cq(struct mlx5_fpga_conn *conn, int cq_size)struct mlx5_wq_param wqp;struct mlx5_cqe64 *cqe;int inlen, err, eqn; -unsigned int irqn;void *cqc, *in;__be64 *pas;u32 i;
@@ -446,7 +445,7 @@ static int mlx5_fpga_conn_create_cq(struct mlx5_fpga_conn *conn, int cq_size) goto err_cqwq; } - err =mlx5_vector2eqn (mdev,smp_processor_id (), &eqn, &irqn); + err =mlx5_vector2eqn (mdev,smp_processor_id (), &eqn);if (err) {kvfree (in); goto err_cqwq;
@@ -476,7 +475,6 @@ static int mlx5_fpga_conn_create_cq(struct mlx5_fpga_conn *conn, int cq_size) *conn->cq.mcq.arm_db =0 ; conn->cq.mcq.vector =0 ; conn->cq.mcq.comp = mlx5_fpga_conn_cq_complete; - conn->cq.mcq.irqn = irqn; conn->cq.mcq.uar = fdev->conn_res.uar;tasklet_setup (&conn->cq.tasklet, mlx5_fpga_conn_cq_tasklet);
drivers/net/ethernet/mellanox/mlx5/core/lib/eq.h +2 -0
@@ -104,4 +104,6 @@ void mlx5_core_eq_free_irqs(struct mlx5_core_dev *dev);struct cpu_rmap *mlx5_eq_table_get_rmap (struct mlx5_core_dev *dev);#endif +int mlx5_vector2irqn (struct mlx5_core_dev *dev,int vector,unsigned int *irqn); +#endif
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c +1 -3
@@ -749,7 +749,6 @@ static struct mlx5dr_cq *dr_create_cq(struct mlx5_core_dev *mdev,struct mlx5_cqe64 *cqe;struct mlx5dr_cq *cq;int inlen, err, eqn; -unsigned int irqn;void *cqc, *in;__be64 *pas;int vector;
@@ -782,7 +781,7 @@ static struct mlx5dr_cq *dr_create_cq(struct mlx5_core_dev *mdev, goto err_cqwq; vector =raw_smp_processor_id () %mlx5_comp_vectors_count (mdev); - err =mlx5_vector2eqn (mdev, vector, &eqn, &irqn); + err =mlx5_vector2eqn (mdev, vector, &eqn);if (err) {kvfree (in); goto err_cqwq;
@@ -818,7 +817,6 @@ static struct mlx5dr_cq *dr_create_cq(struct mlx5_core_dev *mdev, *cq->mcq.arm_db =cpu_to_be32 (2 <<28 ); cq->mcq.vector =0 ; - cq->mcq.irqn = irqn; cq->mcq.uar = uar;return cq;
drivers/vdpa/mlx5/net/mlx5_vnet.c +1 -2
@@ -526,7 +526,6 @@ static int cq_create(struct mlx5_vdpa_net *ndev, u16 idx, u32 num_ent)void __iomem *uar_page = ndev->mvdev.res.uar->map;u32 out[MLX5_ST_SZ_DW (create_cq_out)];struct mlx5_vdpa_cq *vcq = &mvq->cq; -unsigned int irqn;__be64 *pas;int inlen;void *cqc;
@@ -566,7 +565,7 @@ static int cq_create(struct mlx5_vdpa_net *ndev, u16 idx, u32 num_ent)/* Use vector 0 by default. Consider adding code to choose least used * vector. */ - err =mlx5_vector2eqn (mdev,0 , &eqn, &irqn); + err =mlx5_vector2eqn (mdev,0 , &eqn);if (err) goto err_vec;
include/linux/mlx5/driver.h +1 -2
@@ -1044,8 +1044,7 @@ void mlx5_unregister_debugfs(void);void mlx5_fill_page_array (struct mlx5_frag_buf *buf,__be64 *pas);void mlx5_fill_page_frag_array_perm (struct mlx5_frag_buf *buf,__be64 *pas,u8 perm);void mlx5_fill_page_frag_array (struct mlx5_frag_buf *frag_buf,__be64 *pas); -int mlx5_vector2eqn (struct mlx5_core_dev *dev,int vector,int *eqn, -unsigned int *irqn); +int mlx5_vector2eqn (struct mlx5_core_dev *dev,int vector,int *eqn);int mlx5_core_attach_mcg (struct mlx5_core_dev *dev,union ib_gid *mgid,u32 qpn);int mlx5_core_detach_mcg (struct mlx5_core_dev *dev,union ib_gid *mgid,u32 qpn);
Signature · 1 line
2.31.1
PATCH 12/12 net/mlx5: Fix return value from tracer initialization
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Check return value of mlx5_fw_tracer_start(), set error path and fix return value of mlx5_fw_tracer_init() accordingly.
--- .../net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c +9 -2
@@ -1019,12 +1019,19 @@ int mlx5_fw_tracer_init(struct mlx5_fw_tracer *tracer)MLX5_NB_INIT (&tracer->nb, fw_tracer_event,DEVICE_TRACER );mlx5_eq_notifier_register (dev, &tracer->nb); -mlx5_fw_tracer_start (tracer); - + err =mlx5_fw_tracer_start (tracer); +if (err) { +mlx5_core_warn (dev,"FWTracer: Failed to start tracer %d\n" , err); + goto err_notifier_unregister; + }return 0 ; +err_notifier_unregister: +mlx5_eq_notifier_unregister (dev, &tracer->nb); +mlx5_core_destroy_mkey (dev, &tracer->buff.mkey); err_dealloc_pd:mlx5_core_dealloc_pd (dev, tracer->buff.pdn); +cancel_work_sync (&tracer->read_fw_strings_work);return err; }
Signature · 1 line
2.31.1
Re: [net 01/12] net/mlx5: Don't skip subfunction cleanup in case of error in module init
In reply to Saeed MahameedThis series was applied to netdev/net.git (refs/heads/master):
Hello:
This series was applied to netdev/net.git (refs/heads/master):
Quoted 10 lines · On Mon, 9 Aug 2021 20:59:12 -0700 you wrote:
From: Leon Romanovsky <[email protected]>
Clean SF resources if mlx5 eth failed to initialize.
Fixes 1958fc2f0712 ("net/mlx5: SF, Add auxiliary device driver")Signed-off-by Leon Romanovsky <[email protected]>Reviewed-by Parav Pandit <[email protected]>Signed-off-by Saeed Mahameed <[email protected]>[...]
Here is the summary with links:
- [net,01/12] net/mlx5: Don't skip subfunction cleanup in case of error in module init
https://git.kernel.org/netdev/net/c/c633e799641c - [net,02/12] net/mlx5: DR, Add fail on error check on decap https://git.kernel.org/netdev/net/c/d3875924dae6 - [net,03/12] net/mlx5e: Avoid creating tunnel headers for local route https://git.kernel.org/netdev/net/c/c623c95afa56 - [net,04/12] net/mlx5: Bridge, fix ageing time https://git.kernel.org/netdev/net/c/6d8680da2e98 - [net,05/12] net/mlx5e: Destroy page pool after XDP SQ to fix use-after-free https://git.kernel.org/netdev/net/c/8ba3e4c85825 - [net,06/12] net/mlx5: Block switchdev mode while devlink traps are active https://git.kernel.org/netdev/net/c/c85a6b8feb16 - [net,07/12] net/mlx5: Fix order of functions in mlx5_irq_detach_nb() https://git.kernel.org/netdev/net/c/3c8946e0e284 - [net,08/12] net/mlx5: Set all field of mlx5_irq before inserting it to the xarray https://git.kernel.org/netdev/net/c/5957cc557dc5 - [net,09/12] net/mlx5: Destroy pool->mutex https://git.kernel.org/netdev/net/c/ba317e832d45 - [net,10/12] net/mlx5e: TC, Fix error handling memory leak https://git.kernel.org/netdev/net/c/88bbd7b2369a - [net,11/12] net/mlx5: Synchronize correct IRQ when destroying CQ https://git.kernel.org/netdev/net/c/563476ae0c5e - [net,12/12] net/mlx5: Fix return value from tracer initialization https://git.kernel.org/netdev/net/c/bd37c2888cca
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html