IB/rxe: move the variable into the function that uses it
authorZhu Yanjun <yanjun.zhu@oracle.com>
Sat, 3 Nov 2018 12:13:18 +0000 (08:13 -0400)
committerJason Gunthorpe <jgg@mellanox.com>
Thu, 8 Nov 2018 21:22:54 +0000 (14:22 -0700)
The variable rxe is only used in the function rxe_xmit_packet, and the
caller functions do not use it. So move this variable into the function
rxe_xmit_packet.

Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/sw/rxe/rxe_loc.h
drivers/infiniband/sw/rxe/rxe_req.c
drivers/infiniband/sw/rxe/rxe_resp.c

index afd53f57a62be0aef0e1694bb4a0031802c54a71..a675c9f2b427832e9e146f58329d1e248a0dbee0 100644 (file)
@@ -250,11 +250,12 @@ static inline unsigned int wr_opcode_mask(int opcode, struct rxe_qp *qp)
        return rxe_wr_opcode_info[opcode].mask[qp->ibqp.qp_type];
 }
 
-static inline int rxe_xmit_packet(struct rxe_dev *rxe, struct rxe_qp *qp,
-                                 struct rxe_pkt_info *pkt, struct sk_buff *skb)
+static inline int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
+                                 struct sk_buff *skb)
 {
        int err;
        int is_request = pkt->mask & RXE_REQ_MASK;
+       struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
 
        if ((is_request && (qp->req.state != QP_STATE_READY)) ||
            (!is_request && (qp->resp.state != QP_STATE_READY))) {
index 6c361d70d7cdd8b5fd7bfe88b6ac7df9ab354374..b546721efbfeb80a74ffb3bfa656e2a79ee0b2df 100644 (file)
@@ -728,7 +728,7 @@ next_wqe:
        save_state(wqe, qp, &rollback_wqe, &rollback_psn);
        update_wqe_state(qp, wqe, &pkt);
        update_wqe_psn(qp, wqe, &pkt, payload);
-       ret = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp, &pkt, skb);
+       ret = rxe_xmit_packet(qp, &pkt, skb);
        if (ret) {
                qp->need_req_skb = 1;
 
index 59e5c1888a38b6f406fbcbe1ba1444227ad994a0..2315281882506a1c6f563c219655ad97be5010dc 100644 (file)
@@ -657,7 +657,6 @@ static struct sk_buff *prepare_ack_packet(struct rxe_qp *qp,
 static enum resp_states read_reply(struct rxe_qp *qp,
                                   struct rxe_pkt_info *req_pkt)
 {
-       struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
        struct rxe_pkt_info ack_pkt;
        struct sk_buff *skb;
        int mtu = qp->mtu;
@@ -736,7 +735,7 @@ static enum resp_states read_reply(struct rxe_qp *qp,
        p = payload_addr(&ack_pkt) + payload + bth_pad(&ack_pkt);
        *p = ~icrc;
 
-       err = rxe_xmit_packet(rxe, qp, &ack_pkt, skb);
+       err = rxe_xmit_packet(qp, &ack_pkt, skb);
        if (err) {
                pr_err("Failed sending RDMA reply.\n");
                return RESPST_ERR_RNR;
@@ -953,7 +952,6 @@ static int send_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
        int err = 0;
        struct rxe_pkt_info ack_pkt;
        struct sk_buff *skb;
-       struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
 
        skb = prepare_ack_packet(qp, pkt, &ack_pkt, IB_OPCODE_RC_ACKNOWLEDGE,
                                 0, psn, syndrome, NULL);
@@ -962,7 +960,7 @@ static int send_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
                goto err1;
        }
 
-       err = rxe_xmit_packet(rxe, qp, &ack_pkt, skb);
+       err = rxe_xmit_packet(qp, &ack_pkt, skb);
        if (err)
                pr_err_ratelimited("Failed sending ack\n");
 
@@ -976,7 +974,6 @@ static int send_atomic_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
        int rc = 0;
        struct rxe_pkt_info ack_pkt;
        struct sk_buff *skb;
-       struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
        struct resp_res *res;
 
        skb = prepare_ack_packet(qp, pkt, &ack_pkt,
@@ -1004,7 +1001,7 @@ static int send_atomic_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
        res->last_psn  = ack_pkt.psn;
        res->cur_psn   = ack_pkt.psn;
 
-       rc = rxe_xmit_packet(rxe, qp, &ack_pkt, skb);
+       rc = rxe_xmit_packet(qp, &ack_pkt, skb);
        if (rc) {
                pr_err_ratelimited("Failed sending ack\n");
                rxe_drop_ref(qp);
@@ -1134,8 +1131,7 @@ static enum resp_states duplicate_request(struct rxe_qp *qp,
                if (res) {
                        skb_get(res->atomic.skb);
                        /* Resend the result. */
-                       rc = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp,
-                                            pkt, res->atomic.skb);
+                       rc = rxe_xmit_packet(qp, pkt, res->atomic.skb);
                        if (rc) {
                                pr_err("Failed resending result. This flow is not handled - skb ignored\n");
                                rc = RESPST_CLEANUP;