All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] RDMA/irdma: Make the source udp port vary
@ 2021-12-14  5:42 yanjun.zhu
  2021-12-14 17:27 ` Tom Talpey
  2021-12-17  2:02 ` Saleem, Shiraz
  0 siblings, 2 replies; 7+ messages in thread
From: yanjun.zhu @ 2021-12-14  5:42 UTC (permalink / raw)
  To: mustafa.ismail, shiraz.saleem, dledford, jgg, linux-rdma, yanjun.zhu

From: Zhu Yanjun <yanjun.zhu@linux.dev>

Based on the link https://www.spinics.net/lists/linux-rdma/msg73735.html,
get the source udp port number for a QP based on the local QPN. This
provides a better spread of traffic across NIC RX queues.  The method in
the commit d3c04a3a6870 ("IB/rxe: vary the source udp port for receive
scaling") is stable. So it is also adopted in this commit.

Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
---
 drivers/infiniband/hw/irdma/verbs.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
index 102dc9342f2a..2697b40a539e 100644
--- a/drivers/infiniband/hw/irdma/verbs.c
+++ b/drivers/infiniband/hw/irdma/verbs.c
@@ -690,6 +690,11 @@ static int irdma_cqp_create_qp_cmd(struct irdma_qp *iwqp)
 	return status ? -ENOMEM : 0;
 }
 
+static inline u16 irdma_get_src_port(struct irdma_qp *iwqp)
+{
+	return 0xc000 + (hash_32_generic(iwqp->ibqp.qp_num, 14) & 0x3fff);
+}
+
 static void irdma_roce_fill_and_set_qpctx_info(struct irdma_qp *iwqp,
 					       struct irdma_qp_host_ctx_info *ctx_info)
 {
@@ -703,7 +708,7 @@ static void irdma_roce_fill_and_set_qpctx_info(struct irdma_qp *iwqp,
 	udp_info->cwnd = iwdev->roce_cwnd;
 	udp_info->rexmit_thresh = 2;
 	udp_info->rnr_nak_thresh = 2;
-	udp_info->src_port = 0xc000;
+	udp_info->src_port = irdma_get_src_port(iwqp);
 	udp_info->dst_port = ROCE_V2_UDP_DPORT;
 	roce_info = &iwqp->roce_info;
 	ether_addr_copy(roce_info->mac_addr, iwdev->netdev->dev_addr);
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-12-18  2:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-14  5:42 [PATCH 1/1] RDMA/irdma: Make the source udp port vary yanjun.zhu
2021-12-14 17:27 ` Tom Talpey
2021-12-14 17:29   ` Jason Gunthorpe
2021-12-14 18:09     ` Tom Talpey
2021-12-14 18:50       ` Jason Gunthorpe
2021-12-17  2:02 ` Saleem, Shiraz
2021-12-18  2:29   ` Yanjun Zhu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.