mlx5 core generic EQ API for RDMA ODP
Subsystems (6)
v2 cover mlx5 core generic EQ API for RDMA ODP
Hi,
This patchset is for mlx5-next shared branch, and will be applied there once the review is done.
This patchset introduces mostly refactoring work and EQ related code updates to allow moving the ODP rdma only logic from mlx5_core into mlx5 ib where it belongs, and will allow future updates and optimizations for the rdma ODP (On Demand Paging) feature to go only to rdma tree.
Patch #1: Fixes the offsets of stored irq affinity hints inside mlx5 irq info array.
Patch #2,3,4: Remove unused fields, code and logic
Patch #5: Move all EQ related logic from main.c to eq.c to allow clear and seamless refactoring for creating generic EQ management API.
Patch #6: Create mlx5 core EQs in one place, in order to have one entry point to call from main file.
Patch #7,8: Move EQ related structures into eq_table mlx5 structure and make eq_table fields and logic private to eq.c file.
Patch #9,10: Create one generic EQ struct and use it in different EQ types (usages) e.g. (Async, Command, FW pages, completion and ODP) Introduce generic EQ API to allow creating Generic EQs regardless of their types, will be uesd to create all mlx5 core EQs in mlx5_core and ODP EQ in mlx5_ib.
Patch #11: Move ODP logic out from mlx5_core eq.c into mlx5 rdma driver. odp.c file.
Patch #12: Make the trivial EQE access methods inline.
v1->v2:
- Remove vertical alignment
- Fix spilling "Chip" -> "Cheap"
Thanks,
Saeed.
---
Saeed Mahameed (12):
net/mlx5: EQ, Use the right place to store/read IRQ affinity hint net/mlx5: EQ, Remove unused fields and structures net/mlx5: EQ, No need to store eq index as a field net/mlx5: EQ, Remove redundant completion EQ list lock net/mlx5: EQ, Move all EQ logic to eq.c
net/mlx5: EQ, Create all EQs in one place
net/mlx5: EQ, irq_info and rmap belong to eq_table net/mlx5: EQ, Privatize eq_table and friends
net/mlx5: EQ, Different EQ types
net/mlx5: EQ, Generic EQ
{net,IB}/mlx5: Move Page fault EQ and ODP logic to RDMA net/mlx5: EQ, Make EQE access methods inline
drivers/infiniband/hw/mlx5/main.c | 15 +- drivers/infiniband/hw/mlx5/mlx5_ib.h | 15 +- drivers/infiniband/hw/mlx5/odp.c | 281 ++++- drivers/net/ethernet/mellanox/mlx5/core/cq.c | 15 +- .../net/ethernet/mellanox/mlx5/core/debugfs.c | 11 + drivers/net/ethernet/mellanox/mlx5/core/dev.c | 34 - drivers/net/ethernet/mellanox/mlx5/core/en.h | 3 +- .../net/ethernet/mellanox/mlx5/core/en_main.c | 18 +- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 968 +++++++++++------- .../net/ethernet/mellanox/mlx5/core/eswitch.c | 3 +- .../net/ethernet/mellanox/mlx5/core/health.c | 3 +- .../net/ethernet/mellanox/mlx5/core/lib/eq.h | 93 ++ .../net/ethernet/mellanox/mlx5/core/main.c | 287 +----- .../ethernet/mellanox/mlx5/core/mlx5_core.h | 23 - include/linux/mlx5/cq.h | 2 +- include/linux/mlx5/driver.h | 151 +-- include/linux/mlx5/eq.h | 60 ++ 17 files changed, 1081 insertions(+), 901 deletions(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/lib/eq.h create mode 100644 include/linux/mlx5/eq.h
Signature · 1 line
2.19.1
PATCH v2 1/12 net/mlx5: EQ, Use the right place to store/read IRQ affinity hint
Currently the cpu affinity hint mask for completion EQs is stored and read from the wrong place, since reading and storing is done from the same index, there is no actual issue with that, but internal irq_info for completion EQs stars at MLX5_EQ_VEC_COMP_BASE offset in irq_info array, this patch changes the code to use the correct offset to store and read the IRQ affinity hint.
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/main.c | 14 ++++++++------ include/linux/mlx5/driver.h | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +1 -1
@@ -1760,7 +1760,7 @@ static void mlx5e_close_cq(struct mlx5e_cq *cq)static int mlx5e_get_cpu (struct mlx5e_priv *priv,int ix) { -return cpumask_first (priv->mdev->priv.irq_info[ix].mask); +return cpumask_first (priv->mdev->priv.irq_info[ix +MLX5_EQ_VEC_COMP_BASE ].mask); } static int mlx5e_open_tx_cqs(struct mlx5e_channel *c,
drivers/net/ethernet/mellanox/mlx5/core/main.c +8 -6
@@ -640,18 +640,19 @@ u64 mlx5_read_internal_timer(struct mlx5_core_dev *dev)static int mlx5_irq_set_affinity_hint (struct mlx5_core_dev *mdev,int i) {struct mlx5_priv *priv = &mdev->priv; -int irq =pci_irq_vector (mdev->pdev,MLX5_EQ_VEC_COMP_BASE + i); +int vecidx =MLX5_EQ_VEC_COMP_BASE + i; +int irq =pci_irq_vector (mdev->pdev, vecidx); -if (!zalloc_cpumask_var (&priv->irq_info[i].mask,GFP_KERNEL )) { +if (!zalloc_cpumask_var (&priv->irq_info[vecidx].mask,GFP_KERNEL )) {mlx5_core_warn (mdev,"zalloc_cpumask_var failed" );return -ENOMEM ; }cpumask_set_cpu (cpumask_local_spread (i, priv->numa_node), - priv->irq_info[i].mask); + priv->irq_info[vecidx].mask);if (IS_ENABLED (CONFIG_SMP ) && -irq_set_affinity_hint (irq, priv->irq_info[i].mask)) +irq_set_affinity_hint (irq, priv->irq_info[vecidx].mask))mlx5_core_warn (mdev,"irq_set_affinity_hint failed, irq 0x%.4x" , irq);return 0 ;
@@ -659,11 +660,12 @@ static int mlx5_irq_set_affinity_hint(struct mlx5_core_dev *mdev, int i)static void mlx5_irq_clear_affinity_hint (struct mlx5_core_dev *mdev,int i) { +int vecidx =MLX5_EQ_VEC_COMP_BASE + i;struct mlx5_priv *priv = &mdev->priv; -int irq =pci_irq_vector (mdev->pdev,MLX5_EQ_VEC_COMP_BASE + i); +int irq =pci_irq_vector (mdev->pdev, vecidx);irq_set_affinity_hint (irq,NULL ); -free_cpumask_var (priv->irq_info[i].mask); +free_cpumask_var (priv->irq_info[vecidx].mask); }static int mlx5_irq_set_affinity_hints (struct mlx5_core_dev *mdev)
include/linux/mlx5/driver.h +1 -1
@@ -1309,7 +1309,7 @@ enum {static inline const struct cpumask *mlx5_get_vector_affinity_hint (struct mlx5_core_dev *dev,int vector) { -return dev->priv.irq_info[vector].mask; +return dev->priv.irq_info[vector +MLX5_EQ_VEC_COMP_BASE ].mask; }#endif /* MLX5_DRIVER_H */
Signature · 1 line
2.19.1
PATCH v2 2/12 net/mlx5: EQ, Remove unused fields and structures
In reply to Saeed MahameedSome fields and structures are not referenced nor used by the driver, remove them.
--- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 11 ----------- include/linux/mlx5/driver.h | 3 --- 2 files changed, 14 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eq.c +0 -11
@@ -78,17 +78,6 @@ enum { (1ull << MLX5_EVENT_TYPE_SRQ_LAST_WQE) | \ (1ull << MLX5_EVENT_TYPE_SRQ_RQ_LIMIT)) -struct map_eq_in { -u64 mask; -u32 reserved; -u32 unmap_eqn; -}; - -struct cre_des_eq { -u8 reserved[15 ]; -u8 eqn; -}; -static int mlx5_cmd_destroy_eq (struct mlx5_core_dev *dev,u8 eqn) {u32 out[MLX5_ST_SZ_DW (destroy_eq_out)] = {0 };
include/linux/mlx5/driver.h +0 -3
@@ -398,7 +398,6 @@ struct mlx5_eq {unsigned int irqn;u8 eqn;int nent; -u64 mask;struct list_head list;int index;struct mlx5_rsc_debug *dbg;
@@ -478,8 +477,6 @@ struct mlx5_core_srq { };struct mlx5_eq_table { -void __iomem *update_ci; -void __iomem *update_arm_ci;struct list_head comp_eqs_list;struct mlx5_eq pages_eq;struct mlx5_eq async_eq;
Signature · 1 line
2.19.1
PATCH v2 3/12 net/mlx5: EQ, No need to store eq index as a field
In reply to Saeed Mahameedeq->index is used only for completion EQs and is assigned to be the completion eq index, it is used only when traversing the completion eqs list, and it can be calculated dynamically, thus remove the eq->index field.
--- drivers/net/ethernet/mellanox/mlx5/core/main.c | 4 ++-- include/linux/mlx5/driver.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/main.c +2 -2
@@ -702,10 +702,11 @@ int mlx5_vector2eqn(struct mlx5_core_dev *dev, int vector, int *eqn,struct mlx5_eq_table *table = &dev->priv.eq_table;struct mlx5_eq *eq, *n;int err = -ENOENT ; +int i =0 ;spin_lock (&table->lock);list_for_each_entry_safe (eq, n, &table->comp_eqs_list, list) { -if (eq->index == vector) { +if (i++ == vector) { *eqn = eq->eqn; *irqn = eq->irqn; err =0 ;
@@ -797,7 +798,6 @@ static int alloc_comp_eqs(struct mlx5_core_dev *dev) goto clean; }mlx5_core_dbg (dev,"allocated completion EQN %d\n" , eq->eqn); - eq->index = i;spin_lock (&table->lock);list_add_tail (&eq->list, &table->comp_eqs_list);spin_unlock (&table->lock);
include/linux/mlx5/driver.h +0 -1
@@ -399,7 +399,6 @@ struct mlx5_eq {u8 eqn;int nent;struct list_head list; -int index;struct mlx5_rsc_debug *dbg;enum mlx5_eq_type type;union {
Signature · 1 line
2.19.1
PATCH v2 4/12 net/mlx5: EQ, Remove redundant completion EQ list lock
In reply to Saeed MahameedCompletion EQs list is only modified on driver load/unload, locking is not required, remove it.
--- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 2 -- drivers/net/ethernet/mellanox/mlx5/core/main.c | 17 +++-------------- include/linux/mlx5/driver.h | 3 --- 3 files changed, 3 insertions(+), 19 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eq.c +0 -2
@@ -810,8 +810,6 @@ int mlx5_eq_init(struct mlx5_core_dev *dev) {int err; -spin_lock_init (&dev->priv.eq_table.lock); - err =mlx5_eq_debugfs_init (dev);return err;
drivers/net/ethernet/mellanox/mlx5/core/main.c +3 -14
@@ -704,7 +704,6 @@ int mlx5_vector2eqn(struct mlx5_core_dev *dev, int vector, int *eqn,int err = -ENOENT ;int i =0 ; -spin_lock (&table->lock);list_for_each_entry_safe (eq, n, &table->comp_eqs_list, list) {if (i++ == vector) { *eqn = eq->eqn;
@@ -713,7 +712,6 @@ int mlx5_vector2eqn(struct mlx5_core_dev *dev, int vector, int *eqn,break ; } } -spin_unlock (&table->lock);return err; }
@@ -724,14 +722,11 @@ struct mlx5_eq *mlx5_eqn2eq(struct mlx5_core_dev *dev, int eqn)struct mlx5_eq_table *table = &dev->priv.eq_table;struct mlx5_eq *eq; -spin_lock (&table->lock); -list_for_each_entry (eq, &table->comp_eqs_list, list) -if (eq->eqn == eqn) { -spin_unlock (&table->lock); +list_for_each_entry (eq, &table->comp_eqs_list, list) { +if (eq->eqn == eqn)return eq; - } + } -spin_unlock (&table->lock);return ERR_PTR (-ENOENT ); }
@@ -747,17 +742,13 @@ static void free_comp_eqs(struct mlx5_core_dev *dev) dev->rmap = NULL; }#endif -spin_lock (&table->lock);list_for_each_entry_safe (eq, n, &table->comp_eqs_list, list) {list_del (&eq->list); -spin_unlock (&table->lock);if (mlx5_destroy_unmap_eq (dev, eq))mlx5_core_warn (dev,"failed to destroy EQ 0x%x\n" , eq->eqn);kfree (eq); -spin_lock (&table->lock); } -spin_unlock (&table->lock); }static int alloc_comp_eqs (struct mlx5_core_dev *dev)
@@ -798,9 +789,7 @@ static int alloc_comp_eqs(struct mlx5_core_dev *dev) goto clean; }mlx5_core_dbg (dev,"allocated completion EQN %d\n" , eq->eqn); -spin_lock (&table->lock);list_add_tail (&eq->list, &table->comp_eqs_list); -spin_unlock (&table->lock); }return 0 ;
include/linux/mlx5/driver.h +0 -3
@@ -484,9 +484,6 @@ struct mlx5_eq_table {struct mlx5_eq pfault_eq;#endif int num_comp_vectors; -/* protect EQs list -*/ -spinlock_t lock; };struct mlx5_uars_page {
Signature · 1 line
2.19.1
PATCH v2 5/12 net/mlx5: EQ, Move all EQ logic to eq.c
In reply to Saeed MahameedMove completion EQs flows from main.c to eq.c, reasons:
1) It is where this logic belongs.
2) It will help centralize the EQ logic in one file for downstream refactoring, and future extensions/updates.
--- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 176 +++++++++++++++++ .../net/ethernet/mellanox/mlx5/core/main.c | 179 +----------------- .../ethernet/mellanox/mlx5/core/mlx5_core.h | 2 + 3 files changed, 181 insertions(+), 176 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eq.c +176 -0
@@ -820,6 +820,8 @@ void mlx5_eq_cleanup(struct mlx5_core_dev *dev)mlx5_eq_debugfs_cleanup (dev); } +/* Async EQs */ +int mlx5_start_eqs (struct mlx5_core_dev *dev) {struct mlx5_eq_table *table = &dev->priv.eq_table;
@@ -953,12 +955,186 @@ int mlx5_core_eq_query(struct mlx5_core_dev *dev, struct mlx5_eq *eq,return mlx5_cmd_exec (dev, in,sizeof (in), out, outlen); } +/* Completion EQs */ + +static int mlx5_irq_set_affinity_hint (struct mlx5_core_dev *mdev,int i) +{ +struct mlx5_priv *priv = &mdev->priv; +int vecidx =MLX5_EQ_VEC_COMP_BASE + i; +int irq =pci_irq_vector (mdev->pdev, vecidx); + +if (!zalloc_cpumask_var (&priv->irq_info[vecidx].mask,GFP_KERNEL )) { +mlx5_core_warn (mdev,"zalloc_cpumask_var failed" ); +return -ENOMEM ; + } + +cpumask_set_cpu (cpumask_local_spread (i, priv->numa_node), + priv->irq_info[vecidx].mask); + +if (IS_ENABLED (CONFIG_SMP ) && +irq_set_affinity_hint (irq, priv->irq_info[vecidx].mask)) +mlx5_core_warn (mdev,"irq_set_affinity_hint failed, irq 0x%.4x" , irq); + +return 0 ; +} + +static void mlx5_irq_clear_affinity_hint (struct mlx5_core_dev *mdev,int i) +{ +int vecidx =MLX5_EQ_VEC_COMP_BASE + i; +struct mlx5_priv *priv = &mdev->priv; +int irq =pci_irq_vector (mdev->pdev, vecidx); + +irq_set_affinity_hint (irq,NULL ); +free_cpumask_var (priv->irq_info[vecidx].mask); +} + +static int mlx5_irq_set_affinity_hints (struct mlx5_core_dev *mdev) +{ +int err; +int i; + +for (i =0 ; i < mdev->priv.eq_table.num_comp_vectors; i++) { + err =mlx5_irq_set_affinity_hint (mdev, i); +if (err) + goto err_out; + } + +return 0 ; + +err_out: +for (i--; i >=0 ; i--) +mlx5_irq_clear_affinity_hint (mdev, i); + +return err; +} + +static void mlx5_irq_clear_affinity_hints (struct mlx5_core_dev *mdev) +{ +int i; + +for (i =0 ; i < mdev->priv.eq_table.num_comp_vectors; i++) +mlx5_irq_clear_affinity_hint (mdev, i); +} + +void mlx5_free_comp_eqs (struct mlx5_core_dev *dev) +{ +struct mlx5_eq_table *table = &dev->priv.eq_table; +struct mlx5_eq *eq, *n; + +mlx5_irq_clear_affinity_hints (dev); + +#ifdef CONFIG_RFS_ACCEL +if (dev->rmap) { +free_irq_cpu_rmap (dev->rmap); + dev->rmap =NULL ; + } +#endif +list_for_each_entry_safe (eq, n, &table->comp_eqs_list, list) { +list_del (&eq->list); +if (mlx5_destroy_unmap_eq (dev, eq)) +mlx5_core_warn (dev,"failed to destroy EQ 0x%x\n" , + eq->eqn); +kfree (eq); + } +} + +int mlx5_alloc_comp_eqs (struct mlx5_core_dev *dev) +{ +struct mlx5_eq_table *table = &dev->priv.eq_table; +char name[MLX5_MAX_IRQ_NAME ]; +struct mlx5_eq *eq; +int ncomp_vec; +int nent; +int err; +int i; + +INIT_LIST_HEAD (&table->comp_eqs_list); + ncomp_vec = table->num_comp_vectors; + nent =MLX5_COMP_EQ_SIZE ; +#ifdef CONFIG_RFS_ACCEL + dev->rmap =alloc_irq_cpu_rmap (ncomp_vec); +if (!dev->rmap) +return -ENOMEM ; +#endif +for (i =0 ; i < ncomp_vec; i++) { +int vecidx = i +MLX5_EQ_VEC_COMP_BASE ; + + eq =kzalloc (sizeof (*eq),GFP_KERNEL ); +if (!eq) { + err = -ENOMEM ; + goto clean; + } + +#ifdef CONFIG_RFS_ACCEL +irq_cpu_rmap_add (dev->rmap,pci_irq_vector (dev->pdev, vecidx)); +#endif +snprintf (name,MLX5_MAX_IRQ_NAME ,"mlx5_comp%d" , i); + err =mlx5_create_map_eq (dev, eq, vecidx, nent,0 , + name,MLX5_EQ_TYPE_COMP ); +if (err) { +kfree (eq); + goto clean; + } +mlx5_core_dbg (dev,"allocated completion EQN %d\n" , eq->eqn); +/* add tail, to keep the list ordered, for mlx5_vector2eqn to work */ +list_add_tail (&eq->list, &table->comp_eqs_list); + } + + err =mlx5_irq_set_affinity_hints (dev); +if (err) { +mlx5_core_err (dev,"Failed to alloc affinity hint cpumask\n" ); + goto clean; + } + +return 0 ; + +clean: +mlx5_free_comp_eqs (dev); +return err; +} + +int mlx5_vector2eqn (struct mlx5_core_dev *dev,int vector,int *eqn, +unsigned int *irqn) +{ +struct mlx5_eq_table *table = &dev->priv.eq_table; +struct mlx5_eq *eq, *n; +int err = -ENOENT ; +int i =0 ; + +list_for_each_entry_safe (eq, n, &table->comp_eqs_list, list) { +if (i++ == vector) { + *eqn = eq->eqn; + *irqn = eq->irqn; + err =0 ; +break ; + } + } + +return err; +} +EXPORT_SYMBOL (mlx5_vector2eqn); + +struct mlx5_eq *mlx5_eqn2eq (struct mlx5_core_dev *dev,int eqn) +{ +struct mlx5_eq_table *table = &dev->priv.eq_table; +struct mlx5_eq *eq; + +list_for_each_entry (eq, &table->comp_eqs_list, list) { +if (eq->eqn == eqn) +return eq; + } + +return ERR_PTR (-ENOENT ); +} +/* This function should only be called after mlx5_cmd_force_teardown_hca */ void mlx5_core_eq_free_irqs (struct mlx5_core_dev *dev) {struct mlx5_eq_table *table = &dev->priv.eq_table;struct mlx5_eq *eq; +mlx5_irq_clear_affinity_hints (dev); +#ifdef CONFIG_RFS_ACCEL if (dev->rmap) {free_irq_cpu_rmap (dev->rmap);
drivers/net/ethernet/mellanox/mlx5/core/main.c +3 -176
214 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +2 -0
@@ -136,6 +136,8 @@ int mlx5_core_eq_query(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u32 *out, int outlen);int mlx5_start_eqs (struct mlx5_core_dev *dev);void mlx5_stop_eqs (struct mlx5_core_dev *dev); +int mlx5_alloc_comp_eqs (struct mlx5_core_dev *dev); +void mlx5_free_comp_eqs (struct mlx5_core_dev *dev);/* This function should only be called after mlx5_cmd_force_teardown_hca */ void mlx5_core_eq_free_irqs (struct mlx5_core_dev *dev);struct mlx5_eq *mlx5_eqn2eq (struct mlx5_core_dev *dev,int eqn);
Signature · 1 line
2.19.1
PATCH v2 6/12 net/mlx5: EQ, Create all EQs in one place
In reply to Saeed MahameedInstead of creating the EQ table in three steps at driver load,
- allocate irq vectors
- allocate async EQs
- allocate completion EQs
Gather all of the procedures into one function in eq.c and call it from driver load.
This will help us reduce the EQ and EQ table private structures visibility to eq.c in downstream refactoring.
--- .../net/ethernet/mellanox/mlx5/core/debugfs.c | 10 ++ drivers/net/ethernet/mellanox/mlx5/core/eq.c | 121 ++++++++++++++---- .../net/ethernet/mellanox/mlx5/core/main.c | 81 ++---------- .../ethernet/mellanox/mlx5/core/mlx5_core.h | 8 +- 4 files changed, 116 insertions(+), 104 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/debugfs.c +10 -0
@@ -349,6 +349,16 @@ static u64 qp_read_field(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp,return param; } +static int mlx5_core_eq_query (struct mlx5_core_dev *dev,struct mlx5_eq *eq, +u32 *out,int outlen) +{ +u32 in[MLX5_ST_SZ_DW (query_eq_in)] = {}; + +MLX5_SET (query_eq_in, in, opcode,MLX5_CMD_OP_QUERY_EQ ); +MLX5_SET (query_eq_in, in, eq_number, eq->eqn); +return mlx5_cmd_exec (dev, in,sizeof (in), out, outlen); +} +static u64 eq_read_field (struct mlx5_core_dev *dev,struct mlx5_eq *eq,int index) {
drivers/net/ethernet/mellanox/mlx5/core/eq.c +96 -25
205 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/main.c +8 -73
126 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +2 -6
@@ -132,12 +132,8 @@ int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx,int mlx5_destroy_unmap_eq (struct mlx5_core_dev *dev,struct mlx5_eq *eq);int mlx5_eq_add_cq (struct mlx5_eq *eq,struct mlx5_core_cq *cq);int mlx5_eq_del_cq (struct mlx5_eq *eq,struct mlx5_core_cq *cq); -int mlx5_core_eq_query (struct mlx5_core_dev *dev,struct mlx5_eq *eq, -u32 *out,int outlen); -int mlx5_start_eqs (struct mlx5_core_dev *dev); -void mlx5_stop_eqs (struct mlx5_core_dev *dev); -int mlx5_alloc_comp_eqs (struct mlx5_core_dev *dev); -void mlx5_free_comp_eqs (struct mlx5_core_dev *dev); +int mlx5_eq_table_create (struct mlx5_core_dev *dev); +void mlx5_eq_table_destroy (struct mlx5_core_dev *dev);/* This function should only be called after mlx5_cmd_force_teardown_hca */ void mlx5_core_eq_free_irqs (struct mlx5_core_dev *dev);struct mlx5_eq *mlx5_eqn2eq (struct mlx5_core_dev *dev,int eqn);
Signature · 1 line
2.19.1
PATCH v2 7/12 net/mlx5: EQ, irq_info and rmap belong to eq_table
In reply to Saeed Mahameedirq_info and rmap are EQ properties of the driver, and only needed for EQ objects, move them to the eq_table EQs database structure.
--- .../net/ethernet/mellanox/mlx5/core/en_main.c | 4 +- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 40 ++++++++++--------- include/linux/mlx5/driver.h | 10 ++--- 3 files changed, 28 insertions(+), 26 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +2 -2
@@ -1760,7 +1760,7 @@ static void mlx5e_close_cq(struct mlx5e_cq *cq)static int mlx5e_get_cpu (struct mlx5e_priv *priv,int ix) { -return cpumask_first (priv->mdev->priv.irq_info[ix +MLX5_EQ_VEC_COMP_BASE ].mask); +return cpumask_first (priv->mdev->priv.eq_table.irq_info[ix +MLX5_EQ_VEC_COMP_BASE ].mask); } static int mlx5e_open_tx_cqs(struct mlx5e_channel *c,
@@ -4960,7 +4960,7 @@ int mlx5e_netdev_init(struct net_device *netdev,netif_carrier_off (netdev);#ifdef CONFIG_MLX5_EN_ARFS - netdev->rx_cpu_rmap = mdev->rmap; + netdev->rx_cpu_rmap = mdev->priv.eq_table.rmap;#endif return 0 ;
drivers/net/ethernet/mellanox/mlx5/core/eq.c +21 -19
@@ -694,7 +694,7 @@ int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx,if (err) goto err_in; -snprintf (priv->irq_info[vecidx].name,MLX5_MAX_IRQ_NAME ,"%s@pci:%s" , +snprintf (priv->eq_table.irq_info[vecidx].name,MLX5_MAX_IRQ_NAME ,"%s@pci:%s" , name,pci_name (dev->pdev)); eq->eqn =MLX5_GET (create_eq_out, out, eq_number);
@@ -702,7 +702,7 @@ int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, eq->dev = dev; eq->doorbell = priv->uar->map +MLX5_EQ_DOORBEL_OFFSET ; err =request_irq (eq->irqn, handler,0 , - priv->irq_info[vecidx].name, eq); + priv->eq_table.irq_info[vecidx].name, eq);if (err) goto err_eq;
@@ -952,17 +952,18 @@ static int set_comp_irq_affinity_hint(struct mlx5_core_dev *mdev, int i)struct mlx5_priv *priv = &mdev->priv;int vecidx =MLX5_EQ_VEC_COMP_BASE + i;int irq =pci_irq_vector (mdev->pdev, vecidx); +struct mlx5_irq_info *irq_info = &priv->eq_table.irq_info[vecidx]; -if (!zalloc_cpumask_var (&priv->irq_info[vecidx].mask,GFP_KERNEL )) { +if (!zalloc_cpumask_var (&irq_info->mask,GFP_KERNEL )) {mlx5_core_warn (mdev,"zalloc_cpumask_var failed" );return -ENOMEM ; }cpumask_set_cpu (cpumask_local_spread (i, priv->numa_node), - priv->irq_info[vecidx].mask); + irq_info->mask);if (IS_ENABLED (CONFIG_SMP ) && -irq_set_affinity_hint (irq, priv->irq_info[vecidx].mask)) +irq_set_affinity_hint (irq, irq_info->mask))mlx5_core_warn (mdev,"irq_set_affinity_hint failed, irq 0x%.4x" , irq);return 0 ;
@@ -973,9 +974,10 @@ static void clear_comp_irq_affinity_hint(struct mlx5_core_dev *mdev, int i)int vecidx =MLX5_EQ_VEC_COMP_BASE + i;struct mlx5_priv *priv = &mdev->priv;int irq =pci_irq_vector (mdev->pdev, vecidx); +struct mlx5_irq_info *irq_info = &priv->eq_table.irq_info[vecidx];irq_set_affinity_hint (irq,NULL ); -free_cpumask_var (priv->irq_info[vecidx].mask); +free_cpumask_var (irq_info->mask); }static int set_comp_irq_affinity_hints (struct mlx5_core_dev *mdev)
@@ -1014,9 +1016,9 @@ static void destroy_comp_eqs(struct mlx5_core_dev *dev)clear_comp_irqs_affinity_hints (dev);#ifdef CONFIG_RFS_ACCEL -if (dev->rmap) { -free_irq_cpu_rmap (dev->rmap); - dev->rmap =NULL ; +if (table->rmap) { +free_irq_cpu_rmap (table->rmap); + table->rmap =NULL ; }#endif list_for_each_entry_safe (eq, n, &table->comp_eqs_list, list) {
@@ -1042,8 +1044,8 @@ static int create_comp_eqs(struct mlx5_core_dev *dev) ncomp_vec = table->num_comp_vectors; nent =MLX5_COMP_EQ_SIZE ;#ifdef CONFIG_RFS_ACCEL - dev->rmap =alloc_irq_cpu_rmap (ncomp_vec); -if (!dev->rmap) + table->rmap =alloc_irq_cpu_rmap (ncomp_vec); +if (!table->rmap)return -ENOMEM ;#endif for (i =0 ; i < ncomp_vec; i++) {
@@ -1056,7 +1058,7 @@ static int create_comp_eqs(struct mlx5_core_dev *dev) }#ifdef CONFIG_RFS_ACCEL -irq_cpu_rmap_add (dev->rmap,pci_irq_vector (dev->pdev, vecidx)); +irq_cpu_rmap_add (table->rmap,pci_irq_vector (dev->pdev, vecidx));#endif snprintf (name,MLX5_MAX_IRQ_NAME ,"mlx5_comp%d" , i); err = mlx5_create_map_eq(dev, eq, vecidx, nent, 0,
@@ -1126,9 +1128,9 @@ void mlx5_core_eq_free_irqs(struct mlx5_core_dev *dev)clear_comp_irqs_affinity_hints (dev);#ifdef CONFIG_RFS_ACCEL -if (dev->rmap) { -free_irq_cpu_rmap (dev->rmap); - dev->rmap =NULL ; +if (table->rmap) { +free_irq_cpu_rmap (table->rmap); + table->rmap =NULL ; }#endif list_for_each_entry (eq, &table->comp_eqs_list, list)
@@ -1160,8 +1162,8 @@ static int alloc_irq_vectors(struct mlx5_core_dev *dev)if (nvec <=MLX5_EQ_VEC_COMP_BASE )return -ENOMEM ; - priv->irq_info =kcalloc (nvec,sizeof (*priv->irq_info),GFP_KERNEL ); -if (!priv->irq_info) + table->irq_info =kcalloc (nvec,sizeof (*table->irq_info),GFP_KERNEL ); +if (!table->irq_info)return -ENOMEM ; nvec = pci_alloc_irq_vectors(dev->pdev, MLX5_EQ_VEC_COMP_BASE + 1,
@@ -1176,7 +1178,7 @@ static int alloc_irq_vectors(struct mlx5_core_dev *dev)return 0 ; err_free_irq_info: -kfree (priv->irq_info); +kfree (table->irq_info);return err; }
@@ -1185,7 +1187,7 @@ static void free_irq_vectors(struct mlx5_core_dev *dev)struct mlx5_priv *priv = &dev->priv;pci_free_irq_vectors (dev->pdev); -kfree (priv->irq_info); +kfree (priv->eq_table.irq_info); }int mlx5_eq_table_create (struct mlx5_core_dev *dev)
include/linux/mlx5/driver.h +5 -5
@@ -484,6 +484,10 @@ struct mlx5_eq_table {struct mlx5_eq pfault_eq;#endif int num_comp_vectors; +struct mlx5_irq_info *irq_info; +#ifdef CONFIG_RFS_ACCEL +struct cpu_rmap *rmap; +#endif };struct mlx5_uars_page {
@@ -640,7 +644,6 @@ struct mlx5_port_module_event_stats {struct mlx5_priv {char name[MLX5_MAX_NAME_LEN ];struct mlx5_eq_table eq_table; -struct mlx5_irq_info *irq_info;/* pages stuff */ struct workqueue_struct *pg_wq;
@@ -851,9 +854,6 @@ struct mlx5_core_dev { } roce;#ifdef CONFIG_MLX5_FPGA struct mlx5_fpga_device *fpga; -#endif -#ifdef CONFIG_RFS_ACCEL -struct cpu_rmap *rmap;#endif struct mlx5_clock clock;struct mlx5_ib_clock_info *clock_info;
@@ -1302,7 +1302,7 @@ enum {static inline const struct cpumask *mlx5_get_vector_affinity_hint (struct mlx5_core_dev *dev,int vector) { -return dev->priv.irq_info[vector +MLX5_EQ_VEC_COMP_BASE ].mask; +return dev->priv.eq_table.irq_info[vector +MLX5_EQ_VEC_COMP_BASE ].mask; }#endif /* MLX5_DRIVER_H */
Signature · 1 line
2.19.1
PATCH v2 8/12 net/mlx5: EQ, Privatize eq_table and friends
In reply to Saeed MahameedMove unnecessary EQ table structures and declaration from the public include/linux/mlx5/driver.h into the private area of mlx5_core and into eq.c/eq.h.
Introduce new mlx5 EQ APIs:
mlx5_comp_vectors_count(dev);mlx5_comp_irq_get_affinity_mask(dev, vector);
And use them from mlx5_ib or mlx5e netdevice instead of direct access to mlx5_core internal structures.
--- drivers/infiniband/hw/mlx5/main.c | 5 +- drivers/net/ethernet/mellanox/mlx5/core/cq.c | 5 +- .../net/ethernet/mellanox/mlx5/core/debugfs.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en.h | 3 +- .../net/ethernet/mellanox/mlx5/core/en_main.c | 10 +- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 102 ++++++++++++++---- .../net/ethernet/mellanox/mlx5/core/eswitch.c | 1 + .../net/ethernet/mellanox/mlx5/core/health.c | 1 + .../net/ethernet/mellanox/mlx5/core/lib/eq.h | 77 +++++++++++++ .../net/ethernet/mellanox/mlx5/core/main.c | 7 +- .../ethernet/mellanox/mlx5/core/mlx5_core.h | 15 --- include/linux/mlx5/driver.h | 87 +-------------- 12 files changed, 179 insertions(+), 135 deletions(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/lib/eq.h
drivers/infiniband/hw/mlx5/main.c +2 -3
@@ -5337,7 +5337,7 @@ mlx5_ib_get_vector_affinity(struct ib_device *ibdev, int comp_vector) {struct mlx5_ib_dev *dev =to_mdev (ibdev); -return mlx5_get_vector_affinity_hint (dev->mdev, comp_vector); +return mlx5_comp_irq_get_affinity_mask (dev->mdev, comp_vector); }/* The mlx5_ib_multiport_mutex should be held when calling this function */
@@ -5701,8 +5701,7 @@ int mlx5_ib_stage_init_init(struct mlx5_ib_dev *dev) dev->ib_dev.node_type =RDMA_NODE_IB_CA ; dev->ib_dev.local_dma_lkey =0 /* not supported for now */ ; dev->ib_dev.phys_port_cnt = dev->num_ports; - dev->ib_dev.num_comp_vectors = - dev->mdev->priv.eq_table.num_comp_vectors; + dev->ib_dev.num_comp_vectors =mlx5_comp_vectors_count (mdev); dev->ib_dev.dev.parent = &mdev->pdev->dev;mutex_init (&dev->cap_mask_mutex);
drivers/net/ethernet/mellanox/mlx5/core/cq.c +3 -2
@@ -38,6 +38,7 @@#include <rdma/ib_verbs.h> #include <linux/mlx5/cq.h> #include "mlx5_core.h" +#include "lib/eq.h" #define TASKLET_MAX_TIME 2#define TASKLET_MAX_TIME_JIFFIES msecs_to_jiffies(TASKLET_MAX_TIME)
@@ -124,7 +125,7 @@ int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, goto err_cmd;/* Add to async EQ CQ tree to recv async events */ - err =mlx5_eq_add_cq (&dev->priv.eq_table.async_eq, cq); + err =mlx5_eq_add_cq (mlx5_get_async_eq (dev), cq);if (err) goto err_cq_add;
@@ -157,7 +158,7 @@ int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq)u32 in[MLX5_ST_SZ_DW (destroy_cq_in)] = {0 };int err; - err =mlx5_eq_del_cq (&dev->priv.eq_table.async_eq, cq); + err =mlx5_eq_del_cq (mlx5_get_async_eq (dev), cq);if (err)return err;
drivers/net/ethernet/mellanox/mlx5/core/debugfs.c +1 -0
@@ -36,6 +36,7 @@#include <linux/mlx5/cq.h> #include <linux/mlx5/driver.h> #include "mlx5_core.h" +#include "lib/eq.h" enum {QP_PID ,
drivers/net/ethernet/mellanox/mlx5/core/en.h +1 -2
@@ -178,8 +178,7 @@ static inline int mlx5e_get_max_num_channels(struct mlx5_core_dev *mdev) {return is_kdump_kernel () ?MLX5E_MIN_NUM_CHANNELS : -min_t (int, mdev->priv.eq_table.num_comp_vectors, -MLX5E_MAX_NUM_CHANNELS ); +min_t (int,mlx5_comp_vectors_count (mdev),MLX5E_MAX_NUM_CHANNELS ); }/* Use this function to get max num channels after netdev was created */
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +3 -7
@@ -49,6 +49,7 @@#include "lib/clock.h" #include "en/port.h" #include "en/xdp.h" +#include "lib/eq.h" struct mlx5e_rq_param {u32 rqc[MLX5_ST_SZ_DW (rqc)];
@@ -1758,11 +1759,6 @@ static void mlx5e_close_cq(struct mlx5e_cq *cq)mlx5e_free_cq (cq); } -static int mlx5e_get_cpu (struct mlx5e_priv *priv,int ix) -{ -return cpumask_first (priv->mdev->priv.eq_table.irq_info[ix +MLX5_EQ_VEC_COMP_BASE ].mask); -} -static int mlx5e_open_tx_cqs (struct mlx5e_channel *c,struct mlx5e_params *params,struct mlx5e_channel_param *cparam)
@@ -1913,9 +1909,9 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,struct mlx5e_channel_param *cparam, struct mlx5e_channel **cp) { + int cpu = cpumask_first(mlx5_comp_irq_get_affinity_mask(priv->mdev, ix));struct net_dim_cq_moder icocq_moder = {0 ,0 };struct net_device *netdev = priv->netdev; -int cpu =mlx5e_get_cpu (priv, ix);struct mlx5e_channel *c;unsigned int irq;int err;
@@ -4960,7 +4956,7 @@ int mlx5e_netdev_init(struct net_device *netdev,netif_carrier_off (netdev);#ifdef CONFIG_MLX5_EN_ARFS - netdev->rx_cpu_rmap = mdev->priv.eq_table.rmap; + netdev->rx_cpu_rmap =mlx5_eq_table_get_rmap (mdev);#endif return 0 ;
drivers/net/ethernet/mellanox/mlx5/core/eq.c +81 -21
240 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +1 -0
@@ -38,6 +38,7 @@#include "mlx5_core.h" #include "eswitch.h" #include "fs_core.h" +#include "lib/eq.h" #define UPLINK_VPORT 0xFFFF
drivers/net/ethernet/mellanox/mlx5/core/health.c +1 -0
@@ -38,6 +38,7 @@#include <linux/mlx5/driver.h> #include <linux/mlx5/cmd.h> #include "mlx5_core.h" +#include "lib/eq.h" enum {MLX5_HEALTH_POLL_INTERVAL =2 *HZ ,
drivers/net/ethernet/mellanox/mlx5/core/lib/eq.h new file +77 -0
77 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/main.c +4 -3
@@ -54,6 +54,7 @@#include <net/devlink.h> #include "mlx5_core.h" #include "fs_core.h" +#include "lib/eq.h" #include "lib/mpfs.h" #include "eswitch.h" #include "lib/mlx5.h"
@@ -728,7 +729,7 @@ static int mlx5_init_once(struct mlx5_core_dev *dev, struct mlx5_priv *priv) goto out; } - err =mlx5_eq_init (dev); + err =mlx5_eq_table_init (dev);if (err) {dev_err (&pdev->dev,"failed to initialize eq\n" ); goto out;
@@ -802,7 +803,7 @@ static int mlx5_init_once(struct mlx5_core_dev *dev, struct mlx5_priv *priv)mlx5_cq_debugfs_cleanup (dev); err_eq_cleanup: -mlx5_eq_cleanup (dev); +mlx5_eq_table_cleanup (dev); out:return err;
@@ -823,7 +824,7 @@ static void mlx5_cleanup_once(struct mlx5_core_dev *dev)mlx5_cleanup_srq_table (dev);mlx5_cleanup_qp_table (dev);mlx5_cq_debugfs_cleanup (dev); -mlx5_eq_cleanup (dev); +mlx5_eq_table_cleanup (dev); } static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +0 -15
@@ -124,21 +124,6 @@ int mlx5_destroy_scheduling_element_cmd(struct mlx5_core_dev *dev, u8 hierarchy,int mlx5_wait_for_vf_pages (struct mlx5_core_dev *dev);u64 mlx5_read_internal_timer (struct mlx5_core_dev *dev); -int mlx5_eq_init (struct mlx5_core_dev *dev); -void mlx5_eq_cleanup (struct mlx5_core_dev *dev); -int mlx5_create_map_eq (struct mlx5_core_dev *dev,struct mlx5_eq *eq,u8 vecidx, -int nent,u64 mask,const char *name, -enum mlx5_eq_type type); -int mlx5_destroy_unmap_eq (struct mlx5_core_dev *dev,struct mlx5_eq *eq); -int mlx5_eq_add_cq (struct mlx5_eq *eq,struct mlx5_core_cq *cq); -int mlx5_eq_del_cq (struct mlx5_eq *eq,struct mlx5_core_cq *cq); -int mlx5_eq_table_create (struct mlx5_core_dev *dev); -void mlx5_eq_table_destroy (struct mlx5_core_dev *dev); -/* This function should only be called after mlx5_cmd_force_teardown_hca */ -void mlx5_core_eq_free_irqs (struct mlx5_core_dev *dev); -struct mlx5_eq *mlx5_eqn2eq (struct mlx5_core_dev *dev,int eqn); -u32 mlx5_eq_poll_irq_disabled (struct mlx5_eq *eq); -void mlx5_cq_tasklet_cb (unsigned long data);void mlx5_cmd_comp_handler (struct mlx5_core_dev *dev,u64 vec,bool forced);int mlx5_debug_eq_add (struct mlx5_core_dev *dev,struct mlx5_eq *eq);void mlx5_debug_eq_remove (struct mlx5_core_dev *dev,struct mlx5_eq *eq);
include/linux/mlx5/driver.h +5 -82
133 lines not on this page · raw message
Signature · 1 line
2.19.1
PATCH v2 9/12 net/mlx5: EQ, Different EQ types
In reply to Saeed MahameedIn mlx5 we have three types of usages for EQs,
1. Asynchronous EQs, used internally by mlx5 core for a. FW command completions
b. FW page requests
c. one EQ for all other Asynchronous events
2. Completion EQs, used for CQ completion (we create one per core)
3. *Special type of EQ (page fault) used for RDMA on demand paging (ODP).
*The 3rd type shouldn't be special at least in mlx5 core, it is yet another async events EQ with specific use case, it will be removed in the next two patches, and will completely move its logic to mlx5_ib, as it is rdma specific.
In this patch we remove use case (eq type) specific fields from struct mlx5_eq into a new eq type specific structures.
struct mlx5_eq_async;
truct mlx5_eq_comp;
struct mlx5_eq_pagefault;
Separate between their type specific flows.
In the future we will allow users to create there own generic EQs. for now we will allow only one for ODP in next patches.
We will introduce event listeners registration API for those who want to receive mlx5 async events.
After that mlx5 eq handling will be clean from feature/user specific handling.
--- drivers/net/ethernet/mellanox/mlx5/core/cq.c | 10 +- .../net/ethernet/mellanox/mlx5/core/en_main.c | 8 +- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 376 +++++++++++------- .../net/ethernet/mellanox/mlx5/core/eswitch.c | 2 +- .../net/ethernet/mellanox/mlx5/core/health.c | 2 +- .../net/ethernet/mellanox/mlx5/core/lib/eq.h | 53 ++- .../net/ethernet/mellanox/mlx5/core/main.c | 2 +- .../ethernet/mellanox/mlx5/core/mlx5_core.h | 4 - include/linux/mlx5/cq.h | 2 +- include/linux/mlx5/driver.h | 10 +- 10 files changed, 270 insertions(+), 199 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/cq.c +5 -5
@@ -93,10 +93,10 @@ int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,u32 dout[MLX5_ST_SZ_DW (destroy_cq_out)];u32 out[MLX5_ST_SZ_DW (create_cq_out)];u32 din[MLX5_ST_SZ_DW (destroy_cq_in)]; -struct mlx5_eq *eq; +struct mlx5_eq_comp *eq;int err; - eq =mlx5_eqn2eq (dev, eqn); + eq =mlx5_eqn2comp_eq (dev, eqn);if (IS_ERR (eq))return PTR_ERR (eq);
@@ -120,7 +120,7 @@ int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,INIT_LIST_HEAD (&cq->tasklet_ctx.list);/* Add to comp EQ CQ tree to recv comp events */ - err =mlx5_eq_add_cq (eq, cq); + err =mlx5_eq_add_cq (&eq->core, cq);if (err) goto err_cmd;
@@ -140,7 +140,7 @@ int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,return 0 ; err_cq_add: -mlx5_eq_del_cq (eq, cq); +mlx5_eq_del_cq (&eq->core, cq); err_cmd:memset (din,0 ,sizeof (din));memset (dout,0 ,sizeof (dout));
@@ -162,7 +162,7 @@ int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq)if (err)return err; - err =mlx5_eq_del_cq (cq->eq, cq); + err =mlx5_eq_del_cq (&cq->eq->core, cq);if (err)return err;
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +4 -4
@@ -320,7 +320,7 @@ static void mlx5e_enable_async_events(struct mlx5e_priv *priv)static void mlx5e_disable_async_events (struct mlx5e_priv *priv) {clear_bit (MLX5E_STATE_ASYNC_EVENTS_ENABLED , &priv->state); -synchronize_irq (pci_irq_vector (priv->mdev->pdev,MLX5_EQ_VEC_ASYNC )); +mlx5_eq_synchronize_async_irq (priv->mdev); } static inline void mlx5e_build_umr_wqe(struct mlx5e_rq *rq,
@@ -4117,17 +4117,17 @@ static netdev_features_t mlx5e_features_check(struct sk_buff *skb,static bool mlx5e_tx_timeout_eq_recover (struct net_device *dev,struct mlx5e_txqsq *sq) { -struct mlx5_eq *eq = sq->cq.mcq.eq; +struct mlx5_eq_comp *eq = sq->cq.mcq.eq;u32 eqe_count;netdev_err (dev,"EQ 0x%x: Cons = 0x%x, irqn = 0x%x\n" , - eq->eqn, eq->cons_index, eq->irqn); + eq->core.eqn, eq->core.cons_index, eq->core.irqn); eqe_count =mlx5_eq_poll_irq_disabled (eq);if (!eqe_count)return false; -netdev_err (dev,"Recover %d eqes on EQ 0x%x\n" , eqe_count, eq->eqn); +netdev_err (dev,"Recover %d eqes on EQ 0x%x\n" , eqe_count, eq->core.eqn); sq->channel->stats->eq_rearm++;return true; }
drivers/net/ethernet/mellanox/mlx5/core/eq.c +225 -151
663 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +1 -1
@@ -1568,7 +1568,7 @@ static void esw_disable_vport(struct mlx5_eswitch *esw, int vport_num)/* Mark this vport as disabled to discard new events */ vport->enabled = false; -synchronize_irq (pci_irq_vector (esw->dev->pdev,MLX5_EQ_VEC_ASYNC )); +mlx5_eq_synchronize_async_irq (esw->dev);/* Wait for current already scheduled events to complete */ flush_workqueue (esw->work_queue);/* Disable events from this vport */
drivers/net/ethernet/mellanox/mlx5/core/health.c +1 -1
@@ -85,7 +85,7 @@ static void trigger_cmd_completions(struct mlx5_core_dev *dev)u64 vector;/* wait for pending handlers to complete */ -synchronize_irq (pci_irq_vector (dev->pdev,MLX5_EQ_VEC_CMD )); +mlx5_eq_synchronize_cmd_irq (dev);spin_lock_irqsave (&dev->cmd.alloc_lock, flags); vector = ~dev->cmd.bitmask & ((1ul << (1 << dev->cmd.log_sz)) -1 );if (!vector)
drivers/net/ethernet/mellanox/mlx5/core/lib/eq.h +31 -22
84 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/main.c +1 -1
@@ -53,8 +53,8 @@#endif #include <net/devlink.h> #include "mlx5_core.h" -#include "fs_core.h" #include "lib/eq.h" +#include "fs_core.h" #include "lib/mpfs.h" #include "eswitch.h" #include "lib/mlx5.h"
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +0 -4
@@ -125,10 +125,6 @@ int mlx5_wait_for_vf_pages(struct mlx5_core_dev *dev);u64 mlx5_read_internal_timer (struct mlx5_core_dev *dev);void mlx5_cmd_comp_handler (struct mlx5_core_dev *dev,u64 vec,bool forced); -int mlx5_debug_eq_add (struct mlx5_core_dev *dev,struct mlx5_eq *eq); -void mlx5_debug_eq_remove (struct mlx5_core_dev *dev,struct mlx5_eq *eq); -int mlx5_eq_debugfs_init (struct mlx5_core_dev *dev); -void mlx5_eq_debugfs_cleanup (struct mlx5_core_dev *dev);int mlx5_cq_debugfs_init (struct mlx5_core_dev *dev);void mlx5_cq_debugfs_cleanup (struct mlx5_core_dev *dev);
include/linux/mlx5/cq.h +1 -1
@@ -60,7 +60,7 @@ struct mlx5_core_cq { } tasklet_ctx;int reset_notify_added;struct list_head reset_notify; -struct mlx5_eq *eq; +struct mlx5_eq_comp *eq;u16 uid; };
include/linux/mlx5/driver.h +1 -9
@@ -210,14 +210,6 @@ enum mlx5_port_status { MLX5_PORT_DOWN = 2, }; -enum mlx5_eq_type { -MLX5_EQ_TYPE_COMP , -MLX5_EQ_TYPE_ASYNC , -#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING -MLX5_EQ_TYPE_PF , -#endif -}; -struct mlx5_bfreg_info {u32 *sys_pages;int num_low_latency_bfregs;
@@ -692,7 +684,7 @@ struct mlx5_pagefault { } rdma; }; -struct mlx5_eq *eq; +struct mlx5_eq_pagefault *eq;struct work_struct work; };
Signature · 1 line
2.19.1
PATCH v2 10/12 net/mlx5: EQ, Generic EQ
In reply to Saeed MahameedAdd mlx5_eq_{create/destroy}_generic APIs and EQE access methods, for mlx5 core consumers generic EQs.
This API will be used in downstream patch to move page fault (RDMA ODP) EQ logic into mlx5_ib rdma driver, hence it will use a generic EQ.
Current mlx5 EQ allocation scheme:
On load mlx5 allocates 4 (for async) + #cores (for data completions) MSIX vectors, mlx5 core will assign 3 MSIX vectors for internal async EQs and will use all of the #cores MSIX vectors for completion EQs, (One vector is going to be reserved for a generic EQ).
After this patch an external user (e.g mlx5_ib) of mlx5_core can use this new API to create new generic EQs with the reserved msix vector index for that eq.
--- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 243 +++++++++++++----- .../net/ethernet/mellanox/mlx5/core/lib/eq.h | 12 +- include/linux/mlx5/eq.h | 39 +++ 3 files changed, 221 insertions(+), 73 deletions(-) create mode 100644 include/linux/mlx5/eq.h
drivers/net/ethernet/mellanox/mlx5/core/eq.c +180 -63
@@ -33,6 +33,7 @@#include <linux/interrupt.h> #include <linux/module.h> #include <linux/mlx5/driver.h> +#include <linux/mlx5/eq.h> #include <linux/mlx5/cmd.h> #ifdef CONFIG_RFS_ACCEL #include <linux/cpu_rmap.h>
@@ -69,6 +70,7 @@ enum {struct mlx5_irq_info {cpumask_var_t mask;char name[MLX5_MAX_IRQ_NAME ]; +void *context;/* dev_id provided to request_irq */ };struct mlx5_eq_table {
@@ -81,7 +83,6 @@ struct mlx5_eq_table {struct mlx5_eq_pagefault pfault_eq;#endif struct mutex lock;/* sync async eqs creations */ -u8 num_async_eqs;int num_comp_vectors;struct mlx5_irq_info *irq_info;#ifdef CONFIG_RFS_ACCEL
@@ -229,19 +230,19 @@ static void eqe_pf_action(struct work_struct *work) work);struct mlx5_eq_pagefault *eq = pfault->eq; -mlx5_core_page_fault (eq->core.dev, pfault); +mlx5_core_page_fault (eq->core->dev, pfault);mempool_free (pfault, eq->pool); }static void eq_pf_process (struct mlx5_eq_pagefault *eq) { -struct mlx5_core_dev *dev = eq->core.dev; +struct mlx5_core_dev *dev = eq->core->dev;struct mlx5_eqe_page_fault *pf_eqe;struct mlx5_pagefault *pfault;struct mlx5_eqe *eqe;int set_ci =0 ; -while ((eqe =next_eqe_sw (&eq->core))) { +while ((eqe =next_eqe_sw (eq->core))) { pfault =mempool_alloc (eq->pool,GFP_ATOMIC );if (!pfault) {schedule_work (&eq->work);
@@ -316,16 +317,16 @@ static void eq_pf_process(struct mlx5_eq_pagefault *eq)INIT_WORK (&pfault->work, eqe_pf_action);queue_work (eq->wq, &pfault->work); - ++eq->core.cons_index; + ++eq->core->cons_index; ++set_ci;if (unlikely (set_ci >=MLX5_NUM_SPARE_EQE )) { -eq_update_ci (&eq->core,0 ); +eq_update_ci (eq->core,0 ); set_ci =0 ; } } -eq_update_ci (&eq->core,1 ); +eq_update_ci (eq->core,1 ); }static irqreturn_t mlx5_eq_pf_int (int irq,void *eq_ptr)
@@ -368,6 +369,7 @@ static void eq_pf_action(struct work_struct *work)static int create_pf_eq (struct mlx5_core_dev *dev,struct mlx5_eq_pagefault *eq) { +struct mlx5_eq_param param = {};int err;spin_lock_init (&eq->lock);
@@ -386,11 +388,19 @@ create_pf_eq(struct mlx5_core_dev *dev, struct mlx5_eq_pagefault *eq) goto err_mempool; } - err =mlx5_create_async_eq (dev, &eq->core,MLX5_NUM_ASYNC_EQE , -1 <<MLX5_EVENT_TYPE_PAGE_FAULT , -"mlx5_page_fault_eq" , mlx5_eq_pf_int); -if (err) + param = (struct mlx5_eq_param ) { + .index =MLX5_EQ_PFAULT_IDX , + .mask =1 <<MLX5_EVENT_TYPE_PAGE_FAULT , + .nent =MLX5_NUM_ASYNC_EQE , + .context = eq, + .handler = mlx5_eq_pf_int + }; + + eq->core =mlx5_eq_create_generic (dev,"mlx5_page_fault_eq" , ¶m); +if (IS_ERR (eq->core)) { + err =PTR_ERR (eq->core); goto err_wq; + }return 0 ; err_wq:
@@ -404,7 +414,7 @@ static int destroy_pf_eq(struct mlx5_core_dev *dev, struct mlx5_eq_pagefault *eq {int err; - err =mlx5_destroy_async_eq (dev, &eq->core); + err =mlx5_eq_destroy_generic (dev, eq->core);cancel_work_sync (&eq->work);destroy_workqueue (eq->wq);mempool_destroy (eq->pool);
@@ -710,25 +720,29 @@ static void init_eq_buf(struct mlx5_eq *eq) }static int -mlx5_create_map_eq (struct mlx5_core_dev *dev,struct mlx5_eq *eq,u8 vecidx, -int nent,u64 mask,const char *name,irq_handler_t handler) +create_map_eq (struct mlx5_core_dev *dev,struct mlx5_eq *eq,const char *name, +struct mlx5_eq_param *param) {struct mlx5_eq_table *eq_table = dev->priv.eq_table;struct mlx5_cq_table *cq_table = &eq->cq_table;u32 out[MLX5_ST_SZ_DW (create_eq_out)] = {0 };struct mlx5_priv *priv = &dev->priv; +u8 vecidx = param->index;__be64 *pas;void *eqc;int inlen;u32 *in;int err; +if (eq_table->irq_info[vecidx].context) +return -EEXIST ; +/* Init CQ table */ memset (cq_table,0 ,sizeof (*cq_table));spin_lock_init (&cq_table->lock);INIT_RADIX_TREE (&cq_table->tree,GFP_ATOMIC ); - eq->nent =roundup_pow_of_two (nent +MLX5_NUM_SPARE_EQE ); + eq->nent =roundup_pow_of_two (param->nent +MLX5_NUM_SPARE_EQE ); eq->cons_index =0 ; err =mlx5_buf_alloc (dev, eq->nent *MLX5_EQE_SIZE , &eq->buf);if (err)
@@ -749,7 +763,7 @@ mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx,mlx5_fill_page_array (&eq->buf, pas);MLX5_SET (create_eq_in, in, opcode,MLX5_CMD_OP_CREATE_EQ ); -MLX5_SET64 (create_eq_in, in, event_bitmask, mask); +MLX5_SET64 (create_eq_in, in, event_bitmask, param->mask); eqc =MLX5_ADDR_OF (create_eq_in, in, eq_context_entry);MLX5_SET (eqc, eqc, log_eq_size,ilog2 (eq->nent));
@@ -764,13 +778,15 @@ mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx,snprintf (eq_table->irq_info[vecidx].name,MLX5_MAX_IRQ_NAME ,"%s@pci:%s" , name,pci_name (dev->pdev)); + eq_table->irq_info[vecidx].context = param->context; + eq->vecidx = vecidx; eq->eqn =MLX5_GET (create_eq_out, out, eq_number); eq->irqn =pci_irq_vector (dev->pdev, vecidx); eq->dev = dev; eq->doorbell = priv->uar->map +MLX5_EQ_DOORBEL_OFFSET ; - err =request_irq (eq->irqn, handler,0 , - eq_table->irq_info[vecidx].name, eq); + err =request_irq (eq->irqn, param->handler,0 , + eq_table->irq_info[vecidx].name, param->context);if (err) goto err_eq;
@@ -799,12 +815,19 @@ mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx,return err; } -static int mlx5_destroy_unmap_eq (struct mlx5_core_dev *dev,struct mlx5_eq *eq) +static int destroy_unmap_eq (struct mlx5_core_dev *dev,struct mlx5_eq *eq) { +struct mlx5_eq_table *eq_table = dev->priv.eq_table; +struct mlx5_irq_info *irq_info;int err; + irq_info = &eq_table->irq_info[eq->vecidx]; +mlx5_debug_eq_remove (dev, eq); -free_irq (eq->irqn, eq); + +free_irq (eq->irqn, irq_info->context); + irq_info->context =NULL ; + err =mlx5_cmd_destroy_eq (dev, eq->eqn);if (err) mlx5_core_warn(dev, "failed to destroy a previously created eq: eqn %d\n",
@@ -883,48 +906,38 @@ void mlx5_eq_table_cleanup(struct mlx5_core_dev *dev)/* Async EQs */ -int mlx5_create_async_eq (struct mlx5_core_dev *dev,struct mlx5_eq *eq, -int nent,u64 mask,const char *name,irq_handler_t handler) +static int create_async_eq (struct mlx5_core_dev *dev,const char *name, +struct mlx5_eq *eq,struct mlx5_eq_param *param) {struct mlx5_eq_table *eq_table = dev->priv.eq_table; -u8 vecdix;int err;mutex_lock (&eq_table->lock); -if (eq_table->num_async_eqs >=MLX5_EQ_MAX_ASYNC_EQS ) { +if (param->index >=MLX5_EQ_MAX_ASYNC_EQS ) { err = -ENOSPC ; goto unlock; } - vecdix = eq_table->num_async_eqs +1 ; - - err =mlx5_create_map_eq (dev, eq, vecdix, nent, mask, name, handler); -if (!err) - eq_table->num_async_eqs++; - + err =create_map_eq (dev, eq, name, param); unlock:mutex_unlock (&eq_table->lock);return err; } -int mlx5_destroy_async_eq (struct mlx5_core_dev *dev,struct mlx5_eq *eq) +static int destroy_async_eq (struct mlx5_core_dev *dev,struct mlx5_eq *eq) {struct mlx5_eq_table *eq_table = dev->priv.eq_table;int err;mutex_lock (&eq_table->lock); - err =mlx5_destroy_unmap_eq (dev, eq); -if (!err) - eq_table->num_async_eqs--; + err =destroy_unmap_eq (dev, eq);mutex_unlock (&eq_table->lock);return err; } -static int create_async_eqs (struct mlx5_core_dev *dev) +static u64 gather_async_events_mask (struct mlx5_core_dev *dev) { -struct mlx5_eq_table *table = dev->priv.eq_table;u64 async_event_mask =MLX5_ASYNC_EVENT_MASK ; -int err;if (MLX5_VPORT_MANAGER (dev)) async_event_mask |= (1ull <<MLX5_EVENT_TYPE_NIC_VPORT_CHANGE );
@@ -953,9 +966,23 @@ static int create_async_eqs(struct mlx5_core_dev *dev)if (MLX5_CAP_MCAM_REG (dev, tracer_registers)) async_event_mask |= (1ull <<MLX5_EVENT_TYPE_DEVICE_TRACER ); - err =mlx5_create_async_eq (dev, &table->cmd_eq,MLX5_NUM_CMD_EQE , -1ull <<MLX5_EVENT_TYPE_CMD ,"mlx5_cmd_eq" , - mlx5_eq_async_int); +return async_event_mask; +} + +static int create_async_eqs (struct mlx5_core_dev *dev) +{ +struct mlx5_eq_table *table = dev->priv.eq_table; +struct mlx5_eq_param param = {}; +int err; + + param = (struct mlx5_eq_param ) { + .index =MLX5_EQ_CMD_IDX , + .mask =1ull <<MLX5_EVENT_TYPE_CMD , + .nent =MLX5_NUM_CMD_EQE , + .context = &table->cmd_eq, + .handler = mlx5_eq_async_int, + }; + err =create_async_eq (dev,"mlx5_cmd_eq" , &table->cmd_eq, ¶m);if (err) {mlx5_core_warn (dev,"failed to create cmd EQ %d\n" , err);return err;
@@ -963,15 +990,27 @@ static int create_async_eqs(struct mlx5_core_dev *dev)mlx5_cmd_use_events (dev); - err =mlx5_create_async_eq (dev, &table->async_eq,MLX5_NUM_ASYNC_EQE , - async_event_mask,"mlx5_async_eq" , mlx5_eq_async_int); + param = (struct mlx5_eq_param ) { + .index =MLX5_EQ_ASYNC_IDX , + .mask =gather_async_events_mask (dev), + .nent =MLX5_NUM_ASYNC_EQE , + .context = &table->async_eq, + .handler = mlx5_eq_async_int, + }; + err =create_async_eq (dev,"mlx5_async_eq" , &table->async_eq, ¶m);if (err) {mlx5_core_warn (dev,"failed to create async EQ %d\n" , err); goto err1; } - err =mlx5_create_async_eq (dev, &table->pages_eq,/* TODO: sriov max_vf + */ 1 , -1 <<MLX5_EVENT_TYPE_PAGE_REQUEST ,"mlx5_pages_eq" , mlx5_eq_async_int); + param = (struct mlx5_eq_param ) { + .index =MLX5_EQ_PAGEREQ_IDX , + .mask =1 <<MLX5_EVENT_TYPE_PAGE_REQUEST , + .nent =/* TODO: sriov max_vf + */ 1 , + .context = &table->pages_eq, + .handler = mlx5_eq_async_int, + }; + err =create_async_eq (dev,"mlx5_pages_eq" , &table->pages_eq, ¶m);if (err) {mlx5_core_warn (dev,"failed to create pages EQ %d\n" , err); goto err2;
@@ -989,17 +1028,17 @@ static int create_async_eqs(struct mlx5_core_dev *dev)return err; err3: -mlx5_destroy_async_eq (dev, &table->pages_eq); +destroy_async_eq (dev, &table->pages_eq);#else return err;#endif err2: -mlx5_destroy_async_eq (dev, &table->async_eq); +destroy_async_eq (dev, &table->async_eq); err1:mlx5_cmd_use_polling (dev); -mlx5_destroy_async_eq (dev, &table->cmd_eq); +destroy_async_eq (dev, &table->cmd_eq);return err; }
@@ -1017,18 +1056,18 @@ static void destroy_async_eqs(struct mlx5_core_dev *dev) }#endif - err =mlx5_destroy_async_eq (dev, &table->pages_eq); + err =destroy_async_eq (dev, &table->pages_eq);if (err)mlx5_core_err (dev,"failed to destroy pages eq, err(%d)\n" , err); - err =mlx5_destroy_async_eq (dev, &table->async_eq); + err =destroy_async_eq (dev, &table->async_eq);if (err)mlx5_core_err (dev,"failed to destroy async eq, err(%d)\n" , err);mlx5_cmd_use_polling (dev); - err =mlx5_destroy_async_eq (dev, &table->cmd_eq); + err =destroy_async_eq (dev, &table->cmd_eq);if (err)mlx5_core_err (dev,"failed to destroy command eq, err(%d)\n" , err);
@@ -1049,6 +1088,77 @@ void mlx5_eq_synchronize_cmd_irq(struct mlx5_core_dev *dev)synchronize_irq (dev->priv.eq_table->cmd_eq.irqn); } +/* Generic EQ API for mlx5_core consumers +* Needed For RDMA ODP EQ for now +*/ +struct mlx5_eq * +mlx5_eq_create_generic (struct mlx5_core_dev *dev,const char *name, +struct mlx5_eq_param *param) +{ +struct mlx5_eq *eq =kvzalloc (sizeof (*eq),GFP_KERNEL ); +int err; + +if (!eq) +return ERR_PTR (-ENOMEM ); + + err =create_async_eq (dev, name, eq, param); +if (err) { +kvfree (eq); + eq =ERR_PTR (err); + } + +return eq; +} +EXPORT_SYMBOL (mlx5_eq_create_generic); + +int mlx5_eq_destroy_generic (struct mlx5_core_dev *dev,struct mlx5_eq *eq) +{ +int err; + +if (IS_ERR (eq)) +return -EINVAL ; + + err =destroy_async_eq (dev, eq); +if (err) + goto out; + +kvfree (eq); +out: +return err; +} +EXPORT_SYMBOL (mlx5_eq_destroy_generic); + +struct mlx5_eqe *mlx5_eq_get_eqe (struct mlx5_eq *eq,u32 cc) +{ +u32 ci = eq->cons_index + cc; +struct mlx5_eqe *eqe; + + eqe =get_eqe (eq, ci & (eq->nent -1 )); + eqe = ((eqe->owner &1 ) ^ !!(ci & eq->nent)) ?NULL : eqe; +/* Make sure we read EQ entry contents after we've +* checked the ownership bit. +*/ +if (eqe) +dma_rmb (); + +return eqe; +} +EXPORT_SYMBOL (mlx5_eq_get_eqe); + +void mlx5_eq_update_ci (struct mlx5_eq *eq,u32 cc,bool arm) +{ +__be32 __iomem *addr = eq->doorbell + (arm ?0 :2 ); +u32 val; + + eq->cons_index += cc; + val = (eq->cons_index &0xffffff ) | (eq->eqn <<24 ); + +__raw_writel ((__force u32 )cpu_to_be32 (val), addr); +/* We still want ordering, just not swabbing, so add a barrier */ +mb (); +} +EXPORT_SYMBOL (mlx5_eq_update_ci); +/* Completion EQs */ static int set_comp_irq_affinity_hint (struct mlx5_core_dev *mdev,int i)
@@ -1127,7 +1237,7 @@ static void destroy_comp_eqs(struct mlx5_core_dev *dev)#endif list_for_each_entry_safe (eq, n, &table->comp_eqs_list, list) {list_del (&eq->list); -if (mlx5_destroy_unmap_eq (dev, &eq->core)) +if (destroy_unmap_eq (dev, &eq->core))mlx5_core_warn (dev,"failed to destroy comp EQ 0x%x\n" , eq->core.eqn);tasklet_disable (&eq->tasklet_ctx.task);
@@ -1155,6 +1265,7 @@ static int create_comp_eqs(struct mlx5_core_dev *dev)#endif for (i =0 ; i < ncomp_vec; i++) {int vecidx = i +MLX5_EQ_VEC_COMP_BASE ; +struct mlx5_eq_param param = {}; eq =kzalloc (sizeof (*eq),GFP_KERNEL );if (!eq) {
@@ -1172,8 +1283,14 @@ static int create_comp_eqs(struct mlx5_core_dev *dev)irq_cpu_rmap_add (table->rmap,pci_irq_vector (dev->pdev, vecidx));#endif snprintf (name,MLX5_MAX_IRQ_NAME ,"mlx5_comp%d" , i); - err =mlx5_create_map_eq (dev, &eq->core, vecidx, nent,0 , - name, mlx5_eq_comp_int); + param = (struct mlx5_eq_param ) { + .index = vecidx, + .mask =0 , + .nent = nent, + .context = &eq->core, + .handler = mlx5_eq_comp_int + }; + err =create_map_eq (dev, &eq->core, name, ¶m);if (err) {kfree (eq); goto clean;
@@ -1257,7 +1374,7 @@ struct mlx5_eq_comp *mlx5_eqn2comp_eq(struct mlx5_core_dev *dev, int eqn)void mlx5_core_eq_free_irqs (struct mlx5_core_dev *dev) {struct mlx5_eq_table *table = dev->priv.eq_table; -struct mlx5_eq_comp *eq; +int i, max_eqs;clear_comp_irqs_affinity_hints (dev);
@@ -1267,16 +1384,16 @@ void mlx5_core_eq_free_irqs(struct mlx5_core_dev *dev) table->rmap =NULL ; }#endif -list_for_each_entry (eq, &table->comp_eqs_list, list) -free_irq (eq->core.irqn, eq); -free_irq (table->pages_eq.irqn, &table->pages_eq); -free_irq (table->async_eq.irqn, &table->async_eq); -free_irq (table->cmd_eq.irqn, &table->cmd_eq); -#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING -if (MLX5_CAP_GEN (dev, pg)) -free_irq (table->pfault_eq.core.irqn, &table->pfault_eq.core); -#endif +mutex_lock (&table->lock);/* sync with create/destroy_async_eq */ + max_eqs = table->num_comp_vectors +MLX5_EQ_VEC_COMP_BASE ; +for (i = max_eqs -1 ; i >=0 ; i--) { +if (!table->irq_info[i].context) +continue ; +free_irq (pci_irq_vector (dev->pdev, i), table->irq_info[i].context); + table->irq_info[i].context =NULL ; + } +mutex_unlock (&table->lock);pci_free_irq_vectors (dev->pdev); }
drivers/net/ethernet/mellanox/mlx5/core/lib/eq.h +2 -10
@@ -7,11 +7,6 @@#define MLX5_MAX_IRQ_NAME (32) -enum { -MLX5_EQ_MAX_ASYNC_EQS =4 ,/* mlx5_core needs at least 3 */ -MLX5_EQ_VEC_COMP_BASE =MLX5_EQ_MAX_ASYNC_EQS , -}; -struct mlx5_eq_tasklet {struct list_head list;struct list_head process_list;
@@ -31,6 +26,7 @@ struct mlx5_eq {u32 cons_index;struct mlx5_frag_buf buf;int size; +unsigned int vecidx;unsigned int irqn;u8 eqn;int nent;
@@ -44,7 +40,7 @@ struct mlx5_eq_comp { };struct mlx5_eq_pagefault { -struct mlx5_eq core;/* Must be first */ +struct mlx5_eq *core;struct work_struct work;spinlock_t lock;/* Pagefaults spinlock */ struct workqueue_struct *wq;
@@ -55,10 +51,6 @@ int mlx5_eq_table_init(struct mlx5_core_dev *dev);void mlx5_eq_table_cleanup (struct mlx5_core_dev *dev);int mlx5_eq_table_create (struct mlx5_core_dev *dev);void mlx5_eq_table_destroy (struct mlx5_core_dev *dev); -int mlx5_create_async_eq (struct mlx5_core_dev *dev,struct mlx5_eq *eq, -int nent,u64 mask,const char *name, -irq_handler_t handler); -int mlx5_destroy_async_eq (struct mlx5_core_dev *dev,struct mlx5_eq *eq);int mlx5_eq_add_cq (struct mlx5_eq *eq,struct mlx5_core_cq *cq);int mlx5_eq_del_cq (struct mlx5_eq *eq,struct mlx5_core_cq *cq);
include/linux/mlx5/eq.h new file +39 -0
@@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ +/* Copyright (c) 2018 Mellanox Technologies. */ + +#ifndef MLX5_CORE_EQ_H +#define MLX5_CORE_EQ_H + +#include <linux/mlx5/driver.h> + +enum { +MLX5_EQ_PAGEREQ_IDX =0 , +MLX5_EQ_CMD_IDX =1 , +MLX5_EQ_ASYNC_IDX =2 , +/* reserved to be used by mlx5_core ulps (mlx5e/mlx5_ib) */ +MLX5_EQ_PFAULT_IDX =3 , +MLX5_EQ_MAX_ASYNC_EQS , +/* completion eqs vector indices start here */ +MLX5_EQ_VEC_COMP_BASE =MLX5_EQ_MAX_ASYNC_EQS , +}; + +struct mlx5_eq ; + +struct mlx5_eq_param { +u8 index; +int nent; +u64 mask; +void *context; +irq_handler_t handler; +}; + +struct mlx5_eq * +mlx5_eq_create_generic (struct mlx5_core_dev *dev,const char *name, +struct mlx5_eq_param *param); +int +mlx5_eq_destroy_generic (struct mlx5_core_dev *dev,struct mlx5_eq *eq); + +struct mlx5_eqe *mlx5_eq_get_eqe (struct mlx5_eq *eq,u32 cc); +void mlx5_eq_update_ci (struct mlx5_eq *eq,u32 cc,bool arm); + +#endif /* MLX5_CORE_EQ_H */
Signature · 1 line
2.19.1
PATCH v2 11/12 {net,IB}/mlx5: Move Page fault EQ and ODP logic to RDMA
In reply to Saeed MahameedUse the new generic EQ API to move all ODP RDMA data structures and logic form mlx5 core driver into mlx5_ib driver.
--- drivers/infiniband/hw/mlx5/main.c | 10 +- drivers/infiniband/hw/mlx5/mlx5_ib.h | 15 +- drivers/infiniband/hw/mlx5/odp.c | 281 +++++++++++++++++- drivers/net/ethernet/mellanox/mlx5/core/dev.c | 34 --- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 252 ---------------- .../net/ethernet/mellanox/mlx5/core/lib/eq.h | 8 - .../net/ethernet/mellanox/mlx5/core/main.c | 17 +- .../ethernet/mellanox/mlx5/core/mlx5_core.h | 2 - include/linux/mlx5/driver.h | 49 --- include/linux/mlx5/eq.h | 21 ++ 10 files changed, 308 insertions(+), 381 deletions(-)
drivers/infiniband/hw/mlx5/main.c +6 -4
@@ -6040,6 +6040,11 @@ static int mlx5_ib_stage_odp_init(struct mlx5_ib_dev *dev)return mlx5_ib_odp_init_one (dev); } +void mlx5_ib_stage_odp_cleanup (struct mlx5_ib_dev *dev) +{ +mlx5_ib_odp_cleanup_one (dev); +} +int mlx5_ib_stage_counters_init (struct mlx5_ib_dev *dev) {if (MLX5_CAP_GEN (dev->mdev, max_qp_cnt)) {
@@ -6225,7 +6230,7 @@ static const struct mlx5_ib_profile pf_profile = { mlx5_ib_stage_dev_res_cleanup),STAGE_CREATE (MLX5_IB_STAGE_ODP , mlx5_ib_stage_odp_init, -NULL ), + mlx5_ib_stage_odp_cleanup),STAGE_CREATE (MLX5_IB_STAGE_COUNTERS , mlx5_ib_stage_counters_init, mlx5_ib_stage_counters_cleanup),
@@ -6395,9 +6400,6 @@ static struct mlx5_interface mlx5_ib_interface = { .add = mlx5_ib_add, .remove = mlx5_ib_remove, .event = mlx5_ib_event, -#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING - .pfault = mlx5_ib_pfault, -#endif .protocol = MLX5_INTERFACE_PROTOCOL_IB, };
drivers/infiniband/hw/mlx5/mlx5_ib.h +13 -2
@@ -880,6 +880,15 @@ struct mlx5_ib_lb_state {bool enabled; }; +struct mlx5_ib_pf_eq { +struct mlx5_ib_dev *dev; +struct mlx5_eq *core; +struct work_struct work; +spinlock_t lock;/* Pagefaults spinlock */ +struct workqueue_struct *wq; +mempool_t *pool; +}; +struct mlx5_ib_dev {struct ib_device ib_dev;const struct uverbs_object_tree_def *driver_trees[7 ];
@@ -902,6 +911,8 @@ struct mlx5_ib_dev {#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING struct ib_odp_caps odp_caps;u64 odp_max_size; +struct mlx5_ib_pf_eq odp_pf_eq; +/* * Sleepable RCU that prevents destruction of MRs while they are still * being used by a page fault handler.
@@ -1158,9 +1169,8 @@ struct ib_mr *mlx5_ib_reg_dm_mr(struct ib_pd *pd, struct ib_dm *dm,#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING void mlx5_ib_internal_fill_odp_caps (struct mlx5_ib_dev *dev); -void mlx5_ib_pfault (struct mlx5_core_dev *mdev,void *context, -struct mlx5_pagefault *pfault);int mlx5_ib_odp_init_one (struct mlx5_ib_dev *ibdev); +void mlx5_ib_odp_cleanup_one (struct mlx5_ib_dev *ibdev);int __init mlx5_ib_odp_init (void );void mlx5_ib_odp_cleanup (void ); void mlx5_ib_invalidate_range(struct ib_umem_odp *umem_odp, unsigned long start,
@@ -1175,6 +1185,7 @@ static inline void mlx5_ib_internal_fill_odp_caps(struct mlx5_ib_dev *dev) }static inline int mlx5_ib_odp_init_one (struct mlx5_ib_dev *ibdev) {return 0 ; } +static inline void mlx5_ib_odp_cleanup_one (struct mlx5_ib_dev *ibdev) {}static inline int mlx5_ib_odp_init (void ) {return 0 ; }static inline void mlx5_ib_odp_cleanup (void ) {}static inline void mlx5_odp_init_mr_cache_entry (struct mlx5_cache_ent *ent) {}
drivers/infiniband/hw/mlx5/odp.c +267 -14
321 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/dev.c +0 -34
@@ -139,17 +139,6 @@ void mlx5_add_device(struct mlx5_interface *intf, struct mlx5_priv *priv)spin_lock_irq (&priv->ctx_lock);list_add_tail (&dev_ctx->list, &priv->ctx_list); - -#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING -if (dev_ctx->intf->pfault) { -if (priv->pfault) { -mlx5_core_err (dev,"multiple page fault handlers not supported" ); - }else { - priv->pfault_ctx = dev_ctx->context; - priv->pfault = dev_ctx->intf->pfault; - } - } -#endif spin_unlock_irq (&priv->ctx_lock); }
@@ -179,15 +168,6 @@ void mlx5_remove_device(struct mlx5_interface *intf, struct mlx5_priv *priv)if (!dev_ctx)return ; -#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING -spin_lock_irq (&priv->ctx_lock); -if (priv->pfault == dev_ctx->intf->pfault) - priv->pfault =NULL ; -spin_unlock_irq (&priv->ctx_lock); - -synchronize_srcu (&priv->pfault_srcu); -#endif -spin_lock_irq (&priv->ctx_lock);list_del (&dev_ctx->list);spin_unlock_irq (&priv->ctx_lock);
@@ -447,20 +427,6 @@ void mlx5_core_event(struct mlx5_core_dev *dev, enum mlx5_dev_event event,spin_unlock_irqrestore (&priv->ctx_lock, flags); } -#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING -void mlx5_core_page_fault (struct mlx5_core_dev *dev, -struct mlx5_pagefault *pfault) -{ -struct mlx5_priv *priv = &dev->priv; -int srcu_idx; - - srcu_idx =srcu_read_lock (&priv->pfault_srcu); -if (priv->pfault) - priv->pfault (dev, priv->pfault_ctx, pfault); -srcu_read_unlock (&priv->pfault_srcu, srcu_idx); -} -#endif -void mlx5_dev_list_lock (void ) {mutex_lock (&mlx5_intf_mutex);
drivers/net/ethernet/mellanox/mlx5/core/eq.c +0 -252
283 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/lib/eq.h +0 -8
@@ -39,14 +39,6 @@ struct mlx5_eq_comp {struct list_head list; }; -struct mlx5_eq_pagefault { -struct mlx5_eq *core; -struct work_struct work; -spinlock_t lock;/* Pagefaults spinlock */ -struct workqueue_struct *wq; -mempool_t *pool; -}; -int mlx5_eq_table_init (struct mlx5_core_dev *dev);void mlx5_eq_table_cleanup (struct mlx5_core_dev *dev);int mlx5_eq_table_create (struct mlx5_core_dev *dev);
drivers/net/ethernet/mellanox/mlx5/core/main.c +1 -16
@@ -1169,14 +1169,6 @@ static int init_one(struct pci_dev *pdev,INIT_LIST_HEAD (&priv->waiting_events_list); priv->is_accum_events = false; -#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING - err =init_srcu_struct (&priv->pfault_srcu); -if (err) { -dev_err (&pdev->dev,"init_srcu_struct failed with error code %d\n" , - err); - goto clean_dev; - } -#endif mutex_init (&priv->bfregs.reg_head.lock);mutex_init (&priv->bfregs.wc_head.lock);INIT_LIST_HEAD (&priv->bfregs.reg_head.list);
@@ -1185,7 +1177,7 @@ static int init_one(struct pci_dev *pdev, err =mlx5_pci_init (dev, priv);if (err) {dev_err (&pdev->dev,"mlx5_pci_init failed with error code %d\n" , err); - goto clean_srcu; + goto clean_dev; } err =mlx5_health_init (dev);
@@ -1218,11 +1210,7 @@ static int init_one(struct pci_dev *pdev,mlx5_health_cleanup (dev); close_pci:mlx5_pci_close (dev, priv); -clean_srcu: -#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING -cleanup_srcu_struct (&priv->pfault_srcu); clean_dev: -#endif devlink_free (devlink);return err;
@@ -1246,9 +1234,6 @@ static void remove_one(struct pci_dev *pdev)mlx5_pagealloc_cleanup (dev);mlx5_health_cleanup (dev);mlx5_pci_close (dev, priv); -#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING -cleanup_srcu_struct (&priv->pfault_srcu); -#endif devlink_free (devlink); }
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +0 -2
@@ -100,8 +100,6 @@ int mlx5_cmd_fast_teardown_hca(struct mlx5_core_dev *dev);void mlx5_core_event (struct mlx5_core_dev *dev,enum mlx5_dev_event event,unsigned long param); -void mlx5_core_page_fault (struct mlx5_core_dev *dev, -struct mlx5_pagefault *pfault);void mlx5_port_module_event (struct mlx5_core_dev *dev,struct mlx5_eqe *eqe);void mlx5_enter_error_state (struct mlx5_core_dev *dev,bool force);void mlx5_disable_device (struct mlx5_core_dev *dev);
include/linux/mlx5/driver.h +0 -49
73 lines not on this page · raw message
include/linux/mlx5/eq.h +21 -0
@@ -17,6 +17,10 @@ enum { MLX5_EQ_VEC_COMP_BASE = MLX5_EQ_MAX_ASYNC_EQS, }; +#define MLX5_NUM_CMD_EQE (32) +#define MLX5_NUM_ASYNC_EQE (0x1000) +#define MLX5_NUM_SPARE_EQE (0x80) +struct mlx5_eq ;struct mlx5_eq_param {
@@ -36,4 +40,21 @@ mlx5_eq_destroy_generic(struct mlx5_core_dev *dev, struct mlx5_eq *eq);struct mlx5_eqe *mlx5_eq_get_eqe (struct mlx5_eq *eq,u32 cc);void mlx5_eq_update_ci (struct mlx5_eq *eq,u32 cc,bool arm); +/* The HCA will think the queue has overflowed if we +* don't tell it we've been processing events. We +* create EQs with MLX5_NUM_SPARE_EQE extra entries, +* so we must update our consumer index at +* least that often. +* +* mlx5_eq_update_cc must be called on every EQE @EQ irq handler +*/ +static inline u32 mlx5_eq_update_cc (struct mlx5_eq *eq,u32 cc) +{ +if (unlikely (cc >=MLX5_NUM_SPARE_EQE )) { +mlx5_eq_update_ci (eq, cc,0 ); + cc =0 ; + } +return cc; +} +#endif /* MLX5_CORE_EQ_H */
Signature · 1 line
2.19.1
Re: [PATCH V2 mlx5-next 11/12] {net,IB}/mlx5: Move Page fault EQ and ODP logic to RDMA
Quoted 6 lines · Saeed Mahameed
Use the new generic EQ API to move all ODP RDMA data structures and logic form mlx5 core driver into
mlx5_ibdriver.Signed-off-by Saeed Mahameed <[email protected]>Reviewed-by Leon Romanovsky <[email protected]>Reviewed-by Tariq Toukan <[email protected]>
Quoted 12 lines
--- drivers/infiniband/hw/mlx5/main.c | 10 +- drivers/infiniband/hw/mlx5/mlx5_ib.h | 15 +- drivers/infiniband/hw/mlx5/odp.c | 281 +++++++++++++++++- drivers/net/ethernet/mellanox/mlx5/core/dev.c | 34 --- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 252 ---------------- .../net/ethernet/mellanox/mlx5/core/lib/eq.h | 8 - .../net/ethernet/mellanox/mlx5/core/main.c | 17 +- .../ethernet/mellanox/mlx5/core/mlx5_core.h | 2 - include/linux/mlx5/driver.h | 49 --- include/linux/mlx5/eq.h | 21 ++ 10 files changed, 308 insertions(+), 381 deletions(-)
Can you let me know when these land in the shared branch please?
Thanks,
Jason
PATCH v2 12/12 net/mlx5: EQ, Make EQE access methods inline
In reply to Saeed MahameedThese are one/two liner generic EQ access methods, better have them declared static inline in eq.h.
--- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 23 ----------------- .../net/ethernet/mellanox/mlx5/core/lib/eq.h | 25 ++++++++++++++++++- 2 files changed, 24 insertions(+), 24 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eq.c +0 -23
@@ -46,7 +46,6 @@#include "diag/fw_tracer.h" enum { -MLX5_EQE_SIZE =sizeof (struct mlx5_eqe ),MLX5_EQE_OWNER_INIT_VAL =0x1 , };
@@ -103,18 +102,6 @@ static int mlx5_cmd_destroy_eq(struct mlx5_core_dev *dev, u8 eqn)return mlx5_cmd_exec (dev, in,sizeof (in), out,sizeof (out)); } -static struct mlx5_eqe *get_eqe (struct mlx5_eq *eq,u32 entry) -{ -return mlx5_buf_offset (&eq->buf, entry *MLX5_EQE_SIZE ); -} - -static struct mlx5_eqe *next_eqe_sw (struct mlx5_eq *eq) -{ -struct mlx5_eqe *eqe =get_eqe (eq, eq->cons_index & (eq->nent -1 )); - -return ((eqe->owner &1 ) ^ !!(eq->cons_index & eq->nent)) ?NULL : eqe; -} -static const char *eqe_type_str (u8 type) {switch (type) {
@@ -202,16 +189,6 @@ static enum mlx5_dev_event port_subtype_event(u8 subtype)return -1 ; } -static void eq_update_ci (struct mlx5_eq *eq,int arm) -{ -__be32 __iomem *addr = eq->doorbell + (arm ?0 :2 ); -u32 val = (eq->cons_index &0xffffff ) | (eq->eqn <<24 ); - -__raw_writel ((__force u32 )cpu_to_be32 (val), addr); -/* We still want ordering, just not swabbing, so add a barrier */ -mb (); -} -static void general_event_handler (struct mlx5_core_dev *dev,struct mlx5_eqe *eqe) {
drivers/net/ethernet/mellanox/mlx5/core/lib/eq.h +24 -1
@@ -5,7 +5,8 @@#define __LIB_MLX5_EQ_H__#include <linux/mlx5/driver.h> -#define MLX5_MAX_IRQ_NAME (32) +#define MLX5_MAX_IRQ_NAME (32) +#define MLX5_EQE_SIZE (sizeof(struct mlx5_eqe))struct mlx5_eq_tasklet {struct list_head list;
@@ -39,6 +40,28 @@ struct mlx5_eq_comp {struct list_head list; }; +static inline struct mlx5_eqe *get_eqe (struct mlx5_eq *eq,u32 entry) +{ +return mlx5_buf_offset (&eq->buf, entry *MLX5_EQE_SIZE ); +} + +static inline struct mlx5_eqe *next_eqe_sw (struct mlx5_eq *eq) +{ +struct mlx5_eqe *eqe =get_eqe (eq, eq->cons_index & (eq->nent -1 )); + +return ((eqe->owner &1 ) ^ !!(eq->cons_index & eq->nent)) ?NULL : eqe; +} + +static inline void eq_update_ci (struct mlx5_eq *eq,int arm) +{ +__be32 __iomem *addr = eq->doorbell + (arm ?0 :2 ); +u32 val = (eq->cons_index &0xffffff ) | (eq->eqn <<24 ); + +__raw_writel ((__force u32 )cpu_to_be32 (val), addr); +/* We still want ordering, just not swabbing, so add a barrier */ +mb (); +} +int mlx5_eq_table_init (struct mlx5_core_dev *dev);void mlx5_eq_table_cleanup (struct mlx5_core_dev *dev);int mlx5_eq_table_create (struct mlx5_core_dev *dev);
Signature · 1 line
2.19.1
Leon Romanovsky
AppliedQuoted 44 lines · Saeed Mahameed
Hi,
This patchset is for mlx5-next shared branch, and will be applied there once the review is done.
This patchset introduces mostly refactoring work and EQ related code updates to allow moving the ODP rdma only logic from
mlx5_coreinto mlx5 ib where it belongs, and will allow future updates and optimizations for the rdma ODP (On Demand Paging) feature to go only to rdma tree.Patch #1: Fixes the offsets of stored irq affinity hints inside mlx5 irq info array.
Patch #2,3,4: Remove unused fields, code and logic
Patch #5: Move all EQ related logic from
main.ctoeq.cto allow clear and seamless refactoring for creating generic EQ management API.Patch #6: Create mlx5 core EQs in one place, in order to have one entry point to call from main file.
Patch #7,8: Move EQ related structures into
eq_tablemlx5 structure and makeeq_tablefields and logic private toeq.cfile.Patch #9,10: Create one generic EQ struct and use it in different EQ types (usages) e.g. (Async, Command, FW pages, completion and ODP) Introduce generic EQ API to allow creating Generic EQs regardless of their types, will be uesd to create all mlx5 core EQs in
mlx5_coreand ODP EQ inmlx5_ib.Patch #11: Move ODP logic out from
mlx5_coreeq.cinto mlx5 rdma driver.odp.cfile.Patch #12: Make the trivial EQE access methods inline.
v1->v2:
- Remove vertical alignment
- Fix spilling "Chip" -> "Cheap"Thanks,
Saeed.---
Quoted 14 lines
Saeed Mahameed (12):
net/mlx5: EQ, Use the right place to store/read IRQ affinity hint net/mlx5: EQ, Remove unused fields and structures net/mlx5: EQ, No need to store eq index as a field net/mlx5: EQ, Remove redundant completion EQ list lock net/mlx5: EQ, Move all EQ logic toeq.c
net/mlx5: EQ, Create all EQs in one place
net/mlx5: EQ,irq_infoand rmap belong toeq_tablenet/mlx5: EQ, Privatizeeq_tableand friends
net/mlx5: EQ, Different EQ types
net/mlx5: EQ, Generic EQ
{net,IB}/mlx5: Move Page fault EQ and ODP logic to RDMA net/mlx5: EQ, Make EQE access methods inline
Pushed to shared mlx5-next:
6d2d6fc83a28 net/mlx5: EQ, Make EQE access methods inline d5d284b829a6 {net,IB}/mlx5: Move Page fault EQ and ODP logic to RDMA 7701707cb94e net/mlx5: EQ, Generic EQ16d760839cee net/mlx5: EQ, Different EQ typesf2f3df550139 net/mlx5: EQ, Privatize eq_table and friends d674a9aa4344 net/mlx5: EQ, irq_info and rmap belong to eq_table c8e21b3b576b net/mlx5: EQ, Create all EQs in one place ca828cb4686f net/mlx5: EQ, Move all EQ logic to eq.caaa553a64438 net/mlx5: EQ, Remove redundant completion EQ list lock 2883f352571b net/mlx5: EQ, No need to store eq index as a field 4de45c758636 net/mlx5: EQ, Remove unused fields and structures 1e86ace4c140 net/mlx5: EQ, Use the right place to store/read IRQ affinity hint
Thanks
Quoted 61 lines · Leon Romanovsky
Quoted 43 lines · Saeed Mahameed
Hi,
This patchset is for mlx5-next shared branch, and will be applied there once the review is done.
This patchset introduces mostly refactoring work and EQ related code updates to allow moving the ODP rdma only logic from
mlx5_coreinto mlx5 ib where it belongs, and will allow future updates and optimizations for the rdma ODP (On Demand Paging) feature to go only to rdma tree.Patch #1: Fixes the offsets of stored irq affinity hints inside mlx5 irq info array.
Patch #2,3,4: Remove unused fields, code and logic
Patch #5: Move all EQ related logic from
main.ctoeq.cto allow clear and seamless refactoring for creating generic EQ management API.Patch #6: Create mlx5 core EQs in one place, in order to have one entry point to call from main file.
Patch #7,8: Move EQ related structures into
eq_tablemlx5 structure and makeeq_tablefields and logic private toeq.cfile.Patch #9,10: Create one generic EQ struct and use it in different EQ types (usages) e.g. (Async, Command, FW pages, completion and ODP) Introduce generic EQ API to allow creating Generic EQs regardless of their types, will be uesd to create all mlx5 core EQs in
mlx5_coreand ODP EQ inmlx5_ib.Patch #11: Move ODP logic out from
mlx5_coreeq.cinto mlx5 rdma driver.odp.cfile.Patch #12: Make the trivial EQE access methods inline.
v1->v2:
- Remove vertical alignment
- Fix spilling "Chip" -> "Cheap"Thanks,
Saeed.Quoted 14 lines
Saeed Mahameed (12):
net/mlx5: EQ, Use the right place to store/read IRQ affinity hint net/mlx5: EQ, Remove unused fields and structures net/mlx5: EQ, No need to store eq index as a field net/mlx5: EQ, Remove redundant completion EQ list lock net/mlx5: EQ, Move all EQ logic toeq.c
net/mlx5: EQ, Create all EQs in one place
net/mlx5: EQ,irq_infoand rmap belong toeq_tablenet/mlx5: EQ, Privatizeeq_tableand friends
net/mlx5: EQ, Different EQ types
net/mlx5: EQ, Generic EQ
{net,IB}/mlx5: Move Page fault EQ and ODP logic to RDMA net/mlx5: EQ, Make EQE access methods inlinePushed to shared mlx5-next:
Quoted 12 lines
6d2d6fc83a28net/mlx5: EQ, Make EQE access methods inlined5d284b829a6{net,IB}/mlx5: Move Page fault EQ and ODP logic to RDMA7701707cb94enet/mlx5: EQ, Generic EQ16d760839ceenet/mlx5: EQ, Different EQ typesf2f3df550139net/mlx5: EQ, Privatizeeq_tableand friendsd674a9aa4344net/mlx5: EQ,irq_infoand rmap belong toeq_tablec8e21b3b576bnet/mlx5: EQ, Create all EQs in one placeca828cb4686fnet/mlx5: EQ, Move all EQ logic toeq.caaa553a64438net/mlx5: EQ, Remove redundant completion EQ list lock2883f352571bnet/mlx5: EQ, No need to store eq index as a field4de45c758636net/mlx5: EQ, Remove unused fields and structures1e86ace4c140net/mlx5: EQ, Use the right place to store/read IRQ affinity hint
Okay, merged to rdma-next now
Thanks,
Jason