]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
net/mlx5: Move CQ completion and event forwarding logic to eq.c
authorSaeed Mahameed <saeedm@mellanox.com>
Thu, 1 Feb 2018 12:37:07 +0000 (04:37 -0800)
committerSaeed Mahameed <saeedm@mellanox.com>
Thu, 15 Feb 2018 08:30:02 +0000 (00:30 -0800)
Since CQ tree is now per EQ, CQ completion and event forwarding became
specific implementation of EQ logic, this patch moves that logic to eq.c
and makes those functions static.

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reviewed-by: Gal Pressman <galp@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/cq.c
drivers/net/ethernet/mellanox/mlx5/core/eq.c
include/linux/mlx5/driver.h

index 06dc7bd302ed81af838efda852736390f79a4bbc..669ed16938b3437675de6116e4557584e96aafd1 100644 (file)
@@ -85,51 +85,6 @@ static void mlx5_add_cq_to_tasklet(struct mlx5_core_cq *cq)
        spin_unlock_irqrestore(&tasklet_ctx->lock, flags);
 }
 
-/* caller must eventually call mlx5_cq_put on the returned cq */
-static struct mlx5_core_cq *mlx5_eq_cq_get(struct mlx5_eq *eq, u32 cqn)
-{
-       struct mlx5_cq_table *table = &eq->cq_table;
-       struct mlx5_core_cq *cq = NULL;
-
-       spin_lock(&table->lock);
-       cq = radix_tree_lookup(&table->tree, cqn);
-       if (likely(cq))
-               mlx5_cq_hold(cq);
-       spin_unlock(&table->lock);
-
-       return cq;
-}
-
-void mlx5_cq_completion(struct mlx5_eq *eq, u32 cqn)
-{
-       struct mlx5_core_cq *cq = mlx5_eq_cq_get(eq, cqn);
-
-       if (unlikely(!cq)) {
-               mlx5_core_warn(eq->dev, "Completion event for bogus CQ 0x%x\n", cqn);
-               return;
-       }
-
-       ++cq->arm_sn;
-
-       cq->comp(cq);
-
-       mlx5_cq_put(cq);
-}
-
-void mlx5_cq_event(struct mlx5_eq *eq, u32 cqn, int event_type)
-{
-       struct mlx5_core_cq *cq = mlx5_eq_cq_get(eq, cqn);
-
-       if (unlikely(!cq)) {
-               mlx5_core_warn(eq->dev, "Async event for bogus CQ 0x%x\n", cqn);
-               return;
-       }
-
-       cq->event(cq, event_type);
-
-       mlx5_cq_put(cq);
-}
-
 int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
                        u32 *in, int inlen)
 {
index c1f0468e95bde750d82e71c7b1305b09438dd755..7e442b38a8caaeaa364037b167ebe4037bc8b14d 100644 (file)
@@ -393,6 +393,51 @@ static void general_event_handler(struct mlx5_core_dev *dev,
        }
 }
 
+/* caller must eventually call mlx5_cq_put on the returned cq */
+static struct mlx5_core_cq *mlx5_eq_cq_get(struct mlx5_eq *eq, u32 cqn)
+{
+       struct mlx5_cq_table *table = &eq->cq_table;
+       struct mlx5_core_cq *cq = NULL;
+
+       spin_lock(&table->lock);
+       cq = radix_tree_lookup(&table->tree, cqn);
+       if (likely(cq))
+               mlx5_cq_hold(cq);
+       spin_unlock(&table->lock);
+
+       return cq;
+}
+
+static void mlx5_eq_cq_completion(struct mlx5_eq *eq, u32 cqn)
+{
+       struct mlx5_core_cq *cq = mlx5_eq_cq_get(eq, cqn);
+
+       if (unlikely(!cq)) {
+               mlx5_core_warn(eq->dev, "Completion event for bogus CQ 0x%x\n", cqn);
+               return;
+       }
+
+       ++cq->arm_sn;
+
+       cq->comp(cq);
+
+       mlx5_cq_put(cq);
+}
+
+static void mlx5_eq_cq_event(struct mlx5_eq *eq, u32 cqn, int event_type)
+{
+       struct mlx5_core_cq *cq = mlx5_eq_cq_get(eq, cqn);
+
+       if (unlikely(!cq)) {
+               mlx5_core_warn(eq->dev, "Async event for bogus CQ 0x%x\n", cqn);
+               return;
+       }
+
+       cq->event(cq, event_type);
+
+       mlx5_cq_put(cq);
+}
+
 static irqreturn_t mlx5_eq_int(int irq, void *eq_ptr)
 {
        struct mlx5_eq *eq = eq_ptr;
@@ -415,7 +460,7 @@ static irqreturn_t mlx5_eq_int(int irq, void *eq_ptr)
                switch (eqe->type) {
                case MLX5_EVENT_TYPE_COMP:
                        cqn = be32_to_cpu(eqe->data.comp.cqn) & 0xffffff;
-                       mlx5_cq_completion(eq, cqn);
+                       mlx5_eq_cq_completion(eq, cqn);
                        break;
                case MLX5_EVENT_TYPE_DCT_DRAINED:
                        rsn = be32_to_cpu(eqe->data.dct.dctn) & 0xffffff;
@@ -472,7 +517,7 @@ static irqreturn_t mlx5_eq_int(int irq, void *eq_ptr)
                        cqn = be32_to_cpu(eqe->data.cq_err.cqn) & 0xffffff;
                        mlx5_core_warn(dev, "CQ error on CQN 0x%x, syndrome 0x%x\n",
                                       cqn, eqe->data.cq_err.syndrome);
-                       mlx5_cq_event(eq, cqn, eqe->type);
+                       mlx5_eq_cq_event(eq, cqn, eqe->type);
                        break;
 
                case MLX5_EVENT_TYPE_PAGE_REQUEST:
index 96e003db2bcd75ad683e78c902ca809897d06a7f..09e2f3e8753c0015d7dc7df73255bace6633bfd6 100644 (file)
@@ -1049,12 +1049,10 @@ int mlx5_eq_init(struct mlx5_core_dev *dev);
 void mlx5_eq_cleanup(struct mlx5_core_dev *dev);
 void mlx5_fill_page_array(struct mlx5_buf *buf, __be64 *pas);
 void mlx5_fill_page_frag_array(struct mlx5_frag_buf *frag_buf, __be64 *pas);
-void mlx5_cq_completion(struct mlx5_eq *eq, u32 cqn);
 void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type);
 void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type);
 struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn);
 void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec, bool forced);
-void mlx5_cq_event(struct mlx5_eq *eq, u32 cqn, int event_type);
 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);