diff mbox series

[for-next,v3,7/8] RDMA/rxe: Combine setting pkt info

Message ID 20230727192831.65495-8-rpearsonhpe@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Jason Gunthorpe
Headers show
Series RDMA/rxe: Misc cleanups | expand

Commit Message

Bob Pearson July 27, 2023, 7:28 p.m. UTC
Move setting some rxe_pkt_info fields in rxe_init_packet() together
with the rest of the fields in rxe_init_req_packet() and
prepare_ack_packet().

Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
---
 drivers/infiniband/sw/rxe/rxe_net.c  |  6 ------
 drivers/infiniband/sw/rxe/rxe_req.c  |  4 +++-
 drivers/infiniband/sw/rxe/rxe_resp.c | 12 ++++++++----
 3 files changed, 11 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
index 006c2d60f04d..94e347a7f386 100644
--- a/drivers/infiniband/sw/rxe/rxe_net.c
+++ b/drivers/infiniband/sw/rxe/rxe_net.c
@@ -516,7 +516,6 @@  struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
 	unsigned int hdr_len;
 	struct sk_buff *skb = NULL;
 	struct net_device *ndev = rxe->ndev;
-	const int port_num = 1;
 
 	if (av->network_type == RXE_NETWORK_TYPE_IPV4)
 		hdr_len = ETH_HLEN + sizeof(struct udphdr) +
@@ -540,11 +539,6 @@  struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
 	else
 		skb->protocol = htons(ETH_P_IPV6);
 
-	pkt->rxe	= rxe;
-	pkt->port_num	= port_num;
-	pkt->hdr	= skb_put(skb, pkt->paylen);
-	pkt->mask	|= RXE_GRH_MASK;
-
 out:
 	return skb;
 }
diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
index 8423d259f26a..4db1bacdfdb8 100644
--- a/drivers/infiniband/sw/rxe/rxe_req.c
+++ b/drivers/infiniband/sw/rxe/rxe_req.c
@@ -512,7 +512,7 @@  static struct sk_buff *rxe_init_req_packet(struct rxe_qp *qp,
 	pkt->opcode = opcode;
 	pkt->qp = qp;
 	pkt->psn = qp->req.psn;
-	pkt->mask = rxe_opcode[opcode].mask;
+	pkt->mask = rxe_opcode[opcode].mask | RXE_GRH_MASK;
 	pkt->wqe = wqe;
 	pkt->port_num = 1;
 
@@ -535,6 +535,8 @@  static struct sk_buff *rxe_init_req_packet(struct rxe_qp *qp,
 		goto err_out;
 	}
 
+	pkt->hdr = skb_put(skb, pkt->paylen);
+
 	/* init roce headers */
 	rxe_init_roce_hdrs(qp, wqe, pkt);
 
diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
index 7e79d3e4d64e..8a25c56dfd86 100644
--- a/drivers/infiniband/sw/rxe/rxe_resp.c
+++ b/drivers/infiniband/sw/rxe/rxe_resp.c
@@ -768,6 +768,13 @@  static struct sk_buff *prepare_ack_packet(struct rxe_qp *qp,
 	struct sk_buff *skb;
 	int err;
 
+	ack->rxe = rxe;
+	ack->qp = qp;
+	ack->opcode = opcode;
+	ack->mask = rxe_opcode[opcode].mask | RXE_GRH_MASK;
+	ack->psn = psn;
+	ack->port_num = 1;
+
 	/*
 	 * allocate packet
 	 */
@@ -779,10 +786,7 @@  static struct sk_buff *prepare_ack_packet(struct rxe_qp *qp,
 	if (!skb)
 		return NULL;
 
-	ack->qp = qp;
-	ack->opcode = opcode;
-	ack->mask = rxe_opcode[opcode].mask;
-	ack->psn = psn;
+	ack->hdr = skb_put(skb, ack->paylen);
 
 	bth_init(ack, opcode, 0, 0, ack->pad, IB_DEFAULT_PKEY_FULL,
 		 qp->attr.dest_qp_num, 0, psn);