Commit a854b1e8 authored by Zhu Yanjun's avatar Zhu Yanjun Committed by Jason Gunthorpe

IB/rxe: move the variable into the function that uses it

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: default avatarZhu Yanjun <yanjun.zhu@oracle.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 6e5559b2
...@@ -250,11 +250,12 @@ static inline unsigned int wr_opcode_mask(int opcode, struct rxe_qp *qp) ...@@ -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]; 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, static inline int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
struct rxe_pkt_info *pkt, struct sk_buff *skb) struct sk_buff *skb)
{ {
int err; int err;
int is_request = pkt->mask & RXE_REQ_MASK; 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)) || if ((is_request && (qp->req.state != QP_STATE_READY)) ||
(!is_request && (qp->resp.state != QP_STATE_READY))) { (!is_request && (qp->resp.state != QP_STATE_READY))) {
......
...@@ -728,7 +728,7 @@ int rxe_requester(void *arg) ...@@ -728,7 +728,7 @@ int rxe_requester(void *arg)
save_state(wqe, qp, &rollback_wqe, &rollback_psn); save_state(wqe, qp, &rollback_wqe, &rollback_psn);
update_wqe_state(qp, wqe, &pkt); update_wqe_state(qp, wqe, &pkt);
update_wqe_psn(qp, wqe, &pkt, payload); 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) { if (ret) {
qp->need_req_skb = 1; qp->need_req_skb = 1;
......
...@@ -657,7 +657,6 @@ static struct sk_buff *prepare_ack_packet(struct rxe_qp *qp, ...@@ -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, static enum resp_states read_reply(struct rxe_qp *qp,
struct rxe_pkt_info *req_pkt) struct rxe_pkt_info *req_pkt)
{ {
struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
struct rxe_pkt_info ack_pkt; struct rxe_pkt_info ack_pkt;
struct sk_buff *skb; struct sk_buff *skb;
int mtu = qp->mtu; int mtu = qp->mtu;
...@@ -736,7 +735,7 @@ static enum resp_states read_reply(struct rxe_qp *qp, ...@@ -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 = payload_addr(&ack_pkt) + payload + bth_pad(&ack_pkt);
*p = ~icrc; *p = ~icrc;
err = rxe_xmit_packet(rxe, qp, &ack_pkt, skb); err = rxe_xmit_packet(qp, &ack_pkt, skb);
if (err) { if (err) {
pr_err("Failed sending RDMA reply.\n"); pr_err("Failed sending RDMA reply.\n");
return RESPST_ERR_RNR; return RESPST_ERR_RNR;
...@@ -953,7 +952,6 @@ static int send_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt, ...@@ -953,7 +952,6 @@ static int send_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
int err = 0; int err = 0;
struct rxe_pkt_info ack_pkt; struct rxe_pkt_info ack_pkt;
struct sk_buff *skb; 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, skb = prepare_ack_packet(qp, pkt, &ack_pkt, IB_OPCODE_RC_ACKNOWLEDGE,
0, psn, syndrome, NULL); 0, psn, syndrome, NULL);
...@@ -962,7 +960,7 @@ static int send_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt, ...@@ -962,7 +960,7 @@ static int send_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
goto err1; goto err1;
} }
err = rxe_xmit_packet(rxe, qp, &ack_pkt, skb); err = rxe_xmit_packet(qp, &ack_pkt, skb);
if (err) if (err)
pr_err_ratelimited("Failed sending ack\n"); 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, ...@@ -976,7 +974,6 @@ static int send_atomic_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
int rc = 0; int rc = 0;
struct rxe_pkt_info ack_pkt; struct rxe_pkt_info ack_pkt;
struct sk_buff *skb; struct sk_buff *skb;
struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
struct resp_res *res; struct resp_res *res;
skb = prepare_ack_packet(qp, pkt, &ack_pkt, 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, ...@@ -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->last_psn = ack_pkt.psn;
res->cur_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) { if (rc) {
pr_err_ratelimited("Failed sending ack\n"); pr_err_ratelimited("Failed sending ack\n");
rxe_drop_ref(qp); rxe_drop_ref(qp);
...@@ -1134,8 +1131,7 @@ static enum resp_states duplicate_request(struct rxe_qp *qp, ...@@ -1134,8 +1131,7 @@ static enum resp_states duplicate_request(struct rxe_qp *qp,
if (res) { if (res) {
skb_get(res->atomic.skb); skb_get(res->atomic.skb);
/* Resend the result. */ /* Resend the result. */
rc = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp, rc = rxe_xmit_packet(qp, pkt, res->atomic.skb);
pkt, res->atomic.skb);
if (rc) { if (rc) {
pr_err("Failed resending result. This flow is not handled - skb ignored\n"); pr_err("Failed resending result. This flow is not handled - skb ignored\n");
rc = RESPST_CLEANUP; rc = RESPST_CLEANUP;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment