]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mlxsw: pci: Remove mlxsw_pci_cq_count()
authorAmit Cohen <amcohen@nvidia.com>
Tue, 2 Apr 2024 13:54:27 +0000 (15:54 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 4 Apr 2024 02:50:41 +0000 (19:50 -0700)
Currently, for each interrupt we call mlxsw_pci_cq_count() to determine the
number of CQs. This call makes additional two function's calls. This can
be removed by storing this value as part of structure 'mlxsw_pci', as we
already do for number of SDQs. Remove the function and
__mlxsw_pci_queue_count() which is now not used and store the value
instead.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/f08ad113e8160678f3c8d401382a696c6c7f44c7.1712062203.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlxsw/pci.c

index 592e93a530d059aa7f0597c4ff47be8a7b8cf7d9..094b9d752a02ee207d8672ed69ba6a8437832235 100644 (file)
@@ -123,6 +123,7 @@ struct mlxsw_pci {
        struct mlxsw_bus_info bus_info;
        const struct pci_device_id *id;
        enum mlxsw_pci_cqe_v max_cqe_ver; /* Maximal supported CQE version */
+       u8 num_cqs; /* Number of CQs */
        u8 num_sdqs; /* Number of SDQs */
        bool skip_reset;
 };
@@ -179,20 +180,6 @@ mlxsw_pci_queue_type_group_get(struct mlxsw_pci *mlxsw_pci,
        return &mlxsw_pci->queues[q_type];
 }
 
-static u8 __mlxsw_pci_queue_count(struct mlxsw_pci *mlxsw_pci,
-                                 enum mlxsw_pci_queue_type q_type)
-{
-       struct mlxsw_pci_queue_type_group *queue_group;
-
-       queue_group = mlxsw_pci_queue_type_group_get(mlxsw_pci, q_type);
-       return queue_group->count;
-}
-
-static u8 mlxsw_pci_cq_count(struct mlxsw_pci *mlxsw_pci)
-{
-       return __mlxsw_pci_queue_count(mlxsw_pci, MLXSW_PCI_QUEUE_TYPE_CQ);
-}
-
 static struct mlxsw_pci_queue *
 __mlxsw_pci_queue_get(struct mlxsw_pci *mlxsw_pci,
                      enum mlxsw_pci_queue_type q_type, u8 q_num)
@@ -850,7 +837,7 @@ static void mlxsw_pci_eq_tasklet(struct tasklet_struct *t)
        mlxsw_pci_queue_doorbell_consumer_ring(mlxsw_pci, q);
        mlxsw_pci_queue_doorbell_arm_consumer_ring(mlxsw_pci, q);
 
-       cq_count = mlxsw_pci_cq_count(mlxsw_pci);
+       cq_count = mlxsw_pci->num_cqs;
        for_each_set_bit(cqn, active_cqns, cq_count) {
                q = mlxsw_pci_cq_get(mlxsw_pci, cqn);
                mlxsw_pci_queue_tasklet_schedule(q);
@@ -1107,6 +1094,7 @@ static int mlxsw_pci_aqs_init(struct mlxsw_pci *mlxsw_pci, char *mbox)
                return -EINVAL;
        }
 
+       mlxsw_pci->num_cqs = num_cqs;
        mlxsw_pci->num_sdqs = num_sdqs;
 
        err = mlxsw_pci_queue_group_init(mlxsw_pci, mbox, &mlxsw_pci_eq_ops,