Skip to content

Commit 82238f0

Browse files
Amit Cohenkuba-moo
authored andcommitted
mlxsw: pci: Remove mlxsw_pci_cq_count()
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>
1 parent 0cd1453 commit 82238f0

File tree

1 file changed

+3
-15
lines changed
  • drivers/net/ethernet/mellanox/mlxsw

1 file changed

+3
-15
lines changed

drivers/net/ethernet/mellanox/mlxsw/pci.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ struct mlxsw_pci {
123123
struct mlxsw_bus_info bus_info;
124124
const struct pci_device_id *id;
125125
enum mlxsw_pci_cqe_v max_cqe_ver; /* Maximal supported CQE version */
126+
u8 num_cqs; /* Number of CQs */
126127
u8 num_sdqs; /* Number of SDQs */
127128
bool skip_reset;
128129
};
@@ -179,20 +180,6 @@ mlxsw_pci_queue_type_group_get(struct mlxsw_pci *mlxsw_pci,
179180
return &mlxsw_pci->queues[q_type];
180181
}
181182

182-
static u8 __mlxsw_pci_queue_count(struct mlxsw_pci *mlxsw_pci,
183-
enum mlxsw_pci_queue_type q_type)
184-
{
185-
struct mlxsw_pci_queue_type_group *queue_group;
186-
187-
queue_group = mlxsw_pci_queue_type_group_get(mlxsw_pci, q_type);
188-
return queue_group->count;
189-
}
190-
191-
static u8 mlxsw_pci_cq_count(struct mlxsw_pci *mlxsw_pci)
192-
{
193-
return __mlxsw_pci_queue_count(mlxsw_pci, MLXSW_PCI_QUEUE_TYPE_CQ);
194-
}
195-
196183
static struct mlxsw_pci_queue *
197184
__mlxsw_pci_queue_get(struct mlxsw_pci *mlxsw_pci,
198185
enum mlxsw_pci_queue_type q_type, u8 q_num)
@@ -850,7 +837,7 @@ static void mlxsw_pci_eq_tasklet(struct tasklet_struct *t)
850837
mlxsw_pci_queue_doorbell_consumer_ring(mlxsw_pci, q);
851838
mlxsw_pci_queue_doorbell_arm_consumer_ring(mlxsw_pci, q);
852839

853-
cq_count = mlxsw_pci_cq_count(mlxsw_pci);
840+
cq_count = mlxsw_pci->num_cqs;
854841
for_each_set_bit(cqn, active_cqns, cq_count) {
855842
q = mlxsw_pci_cq_get(mlxsw_pci, cqn);
856843
mlxsw_pci_queue_tasklet_schedule(q);
@@ -1107,6 +1094,7 @@ static int mlxsw_pci_aqs_init(struct mlxsw_pci *mlxsw_pci, char *mbox)
11071094
return -EINVAL;
11081095
}
11091096

1097+
mlxsw_pci->num_cqs = num_cqs;
11101098
mlxsw_pci->num_sdqs = num_sdqs;
11111099

11121100
err = mlxsw_pci_queue_group_init(mlxsw_pci, mbox, &mlxsw_pci_eq_ops,

0 commit comments

Comments
 (0)