]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
RDMA/rxe: Convert tasklet args to queue pairs
authorBob Pearson <rpearsonhpe@gmail.com>
Sat, 4 Mar 2023 17:45:27 +0000 (11:45 -0600)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 7 Jul 2023 10:17:10 +0000 (12:17 +0200)
BugLink: https://bugs.launchpad.net/bugs/2025067
[ Upstream commit 3946fc2a42b18cf0b675121158a2625825ce27b5 ]

Originally is was thought that the tasklet machinery in rxe_task.c would
be used in other applications but that has not happened for years. This
patch replaces the 'void *arg' by struct 'rxe_qp *qp' in the parameters to
the tasklet calls. This change will have no affect on performance but may
make the code a little clearer.

Link: https://lore.kernel.org/r/20230304174533.11296-2-rpearsonhpe@gmail.com
Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Stable-dep-of: b2b1ddc45745 ("RDMA/rxe: Fix the error "trying to register non-static key in rxe_cleanup_task"")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/infiniband/sw/rxe/rxe_comp.c
drivers/infiniband/sw/rxe/rxe_loc.h
drivers/infiniband/sw/rxe/rxe_req.c
drivers/infiniband/sw/rxe/rxe_resp.c
drivers/infiniband/sw/rxe/rxe_task.c
drivers/infiniband/sw/rxe/rxe_task.h

index 20737fec392bf7efae659316c4afbbfaddfab998..9a9d3ec2bf2fddc96acb4e3a2fca29aab707943a 100644 (file)
@@ -571,9 +571,8 @@ static void free_pkt(struct rxe_pkt_info *pkt)
        ib_device_put(dev);
 }
 
-int rxe_completer(void *arg)
+int rxe_completer(struct rxe_qp *qp)
 {
-       struct rxe_qp *qp = (struct rxe_qp *)arg;
        struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
        struct rxe_send_wqe *wqe = NULL;
        struct sk_buff *skb = NULL;
index 1bb0cb479eb12d89c313bd257e01b4e099f3c935..d131aaa94d05944ec7324f38ee2816e7125c8f5f 100644 (file)
@@ -171,9 +171,9 @@ void rxe_srq_cleanup(struct rxe_pool_elem *elem);
 
 void rxe_dealloc(struct ib_device *ib_dev);
 
-int rxe_completer(void *arg);
-int rxe_requester(void *arg);
-int rxe_responder(void *arg);
+int rxe_completer(struct rxe_qp *qp);
+int rxe_requester(struct rxe_qp *qp);
+int rxe_responder(struct rxe_qp *qp);
 
 /* rxe_icrc.c */
 int rxe_icrc_init(struct rxe_dev *rxe);
index 899c8779f8001cd21bb16f8726e8b61cc611d50b..f2dc2d191e16f3ef96b84b4d116bdc9cb34622c7 100644 (file)
@@ -635,9 +635,8 @@ static int rxe_do_local_ops(struct rxe_qp *qp, struct rxe_send_wqe *wqe)
        return 0;
 }
 
-int rxe_requester(void *arg)
+int rxe_requester(struct rxe_qp *qp)
 {
-       struct rxe_qp *qp = (struct rxe_qp *)arg;
        struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
        struct rxe_pkt_info pkt;
        struct sk_buff *skb;
index 0cc1ba91d48cc8ba3938048178b26d9038632126..8c68340502769746b854549e76371574c56e9f4e 100644 (file)
@@ -1439,9 +1439,8 @@ static void rxe_drain_req_pkts(struct rxe_qp *qp, bool notify)
                queue_advance_consumer(q, q->type);
 }
 
-int rxe_responder(void *arg)
+int rxe_responder(struct rxe_qp *qp)
 {
-       struct rxe_qp *qp = (struct rxe_qp *)arg;
        struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
        enum resp_states state;
        struct rxe_pkt_info *pkt = NULL;
index 60b90e33a88496a4bbaf2e97dd0563c862ffd081..959cc6229a34e9011a423ad5fe44d6060a243641 100644 (file)
@@ -11,7 +11,7 @@ int __rxe_do_task(struct rxe_task *task)
 {
        int ret;
 
-       while ((ret = task->func(task->arg)) == 0)
+       while ((ret = task->func(task->qp)) == 0)
                ;
 
        task->ret = ret;
@@ -29,7 +29,7 @@ static void do_task(struct tasklet_struct *t)
        int cont;
        int ret;
        struct rxe_task *task = from_tasklet(task, t, tasklet);
-       struct rxe_qp *qp = (struct rxe_qp *)task->arg;
+       struct rxe_qp *qp = (struct rxe_qp *)task->qp;
        unsigned int iterations = RXE_MAX_ITERATIONS;
 
        spin_lock_bh(&task->lock);
@@ -54,7 +54,7 @@ static void do_task(struct tasklet_struct *t)
 
        do {
                cont = 0;
-               ret = task->func(task->arg);
+               ret = task->func(task->qp);
 
                spin_lock_bh(&task->lock);
                switch (task->state) {
@@ -91,9 +91,10 @@ static void do_task(struct tasklet_struct *t)
        task->ret = ret;
 }
 
-int rxe_init_task(struct rxe_task *task, void *arg, int (*func)(void *))
+int rxe_init_task(struct rxe_task *task, struct rxe_qp *qp,
+                 int (*func)(struct rxe_qp *))
 {
-       task->arg       = arg;
+       task->qp        = qp;
        task->func      = func;
        task->destroyed = false;
 
index 7b88129702ac6dae833368ec3f7c7c8413ebb943..41efd5fd49b03da0211f2c37c6685a47c848c18d 100644 (file)
@@ -22,18 +22,19 @@ struct rxe_task {
        struct tasklet_struct   tasklet;
        int                     state;
        spinlock_t              lock;
-       void                    *arg;
-       int                     (*func)(void *arg);
+       struct rxe_qp           *qp;
+       int                     (*func)(struct rxe_qp *qp);
        int                     ret;
        bool                    destroyed;
 };
 
 /*
  * init rxe_task structure
- *     arg  => parameter to pass to fcn
+ *     qp  => parameter to pass to func
  *     func => function to call until it returns != 0
  */
-int rxe_init_task(struct rxe_task *task, void *arg, int (*func)(void *));
+int rxe_init_task(struct rxe_task *task, struct rxe_qp *qp,
+                 int (*func)(struct rxe_qp *));
 
 /* cleanup task */
 void rxe_cleanup_task(struct rxe_task *task);