]> www.infradead.org Git - nvme.git/commitdiff
mlxsw: pci: Do not setup tasklet from operation
authorAmit Cohen <amcohen@nvidia.com>
Tue, 2 Apr 2024 13:54:16 +0000 (15:54 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 4 Apr 2024 02:50:39 +0000 (19:50 -0700)
Currently, the structure 'mlxsw_pci_queue_ops' holds a pointer to the
callback function of tasklet. This is used only for EQ and CQ. mlxsw
driver will use NAPI in a following patch set, so CQ will not use tasklet
anymore. As preparation, remove this pointer from the shared operation
structure and setup the tasklet as part of queue initialization.
For now, setup tasklet for EQ and CQ. Later, CQ code will be changed.

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/a326cae5fc1ad085a1a063c004983de6fe389414.1712062203.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlxsw/pci.c

index 3fec3909d3c7efe17194dd74f1439b19b9469008..cd871dbfeb02846290b6afb7da135281aaf67d00 100644 (file)
@@ -742,6 +742,7 @@ static int mlxsw_pci_cq_init(struct mlxsw_pci *mlxsw_pci, char *mbox,
        err = mlxsw_cmd_sw2hw_cq(mlxsw_pci->core, mbox, q->num);
        if (err)
                return err;
+       tasklet_setup(&q->tasklet, mlxsw_pci_cq_tasklet);
        mlxsw_pci_queue_doorbell_consumer_ring(mlxsw_pci, q);
        mlxsw_pci_queue_doorbell_arm_consumer_ring(mlxsw_pci, q);
        return 0;
@@ -866,6 +867,7 @@ static int mlxsw_pci_eq_init(struct mlxsw_pci *mlxsw_pci, char *mbox,
        err = mlxsw_cmd_sw2hw_eq(mlxsw_pci->core, mbox, q->num);
        if (err)
                return err;
+       tasklet_setup(&q->tasklet, mlxsw_pci_eq_tasklet);
        mlxsw_pci_queue_doorbell_consumer_ring(mlxsw_pci, q);
        mlxsw_pci_queue_doorbell_arm_consumer_ring(mlxsw_pci, q);
        return 0;
@@ -886,7 +888,6 @@ struct mlxsw_pci_queue_ops {
                    struct mlxsw_pci_queue *q);
        void (*fini)(struct mlxsw_pci *mlxsw_pci,
                     struct mlxsw_pci_queue *q);
-       void (*tasklet)(struct tasklet_struct *t);
        u16 (*elem_count_f)(const struct mlxsw_pci_queue *q);
        u8 (*elem_size_f)(const struct mlxsw_pci_queue *q);
        u16 elem_count;
@@ -914,7 +915,6 @@ static const struct mlxsw_pci_queue_ops mlxsw_pci_cq_ops = {
        .pre_init       = mlxsw_pci_cq_pre_init,
        .init           = mlxsw_pci_cq_init,
        .fini           = mlxsw_pci_cq_fini,
-       .tasklet        = mlxsw_pci_cq_tasklet,
        .elem_count_f   = mlxsw_pci_cq_elem_count,
        .elem_size_f    = mlxsw_pci_cq_elem_size
 };
@@ -923,7 +923,6 @@ static const struct mlxsw_pci_queue_ops mlxsw_pci_eq_ops = {
        .type           = MLXSW_PCI_QUEUE_TYPE_EQ,
        .init           = mlxsw_pci_eq_init,
        .fini           = mlxsw_pci_eq_fini,
-       .tasklet        = mlxsw_pci_eq_tasklet,
        .elem_count     = MLXSW_PCI_EQE_COUNT,
        .elem_size      = MLXSW_PCI_EQE_SIZE
 };
@@ -948,9 +947,6 @@ static int mlxsw_pci_queue_init(struct mlxsw_pci *mlxsw_pci, char *mbox,
        q->type = q_ops->type;
        q->pci = mlxsw_pci;
 
-       if (q_ops->tasklet)
-               tasklet_setup(&q->tasklet, q_ops->tasklet);
-
        mem_item->size = MLXSW_PCI_AQ_SIZE;
        mem_item->buf = dma_alloc_coherent(&mlxsw_pci->pdev->dev,
                                           mem_item->size, &mem_item->mapaddr,