]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net/mlx5: EQ, No need to store eq index as a field
authorSaeed Mahameed <saeedm@mellanox.com>
Mon, 19 Nov 2018 18:52:33 +0000 (10:52 -0800)
committerLeon Romanovsky <leonro@mellanox.com>
Tue, 20 Nov 2018 18:06:18 +0000 (20:06 +0200)
eq->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.

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/main.c
include/linux/mlx5/driver.h

index d5cea0a36e6a83d5a984a6d3e2c9381368966621..f5e6d375a8cc57376a5f3525d3bf8df31d3ab8e2 100644 (file)
@@ -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);
index 15cf6727a62ddde90393499ad3d194426e4da787..4b62d71825c1dbbabf56e7786f40d4f1a44a798a 100644 (file)
@@ -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 {