Re: [PATCH v2] IB/rxe: vary the source udp port for receive scaling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 06/22/2018 04:45 AM, Vijay Immanuel wrote:
Select the source udp port number for a QP based on a hash
of the source and destination QPNs. This provides a better
spread of traffic across NIC RX queues.

Signed-off-by: Vijay Immanuel <vijayi@xxxxxxxxxxxxxxxxx>
---
Changes in v2:
   - Moved setting the src_port to where the QP state is set to RTR.

  drivers/infiniband/sw/rxe/rxe_net.c   | 6 ++----
  drivers/infiniband/sw/rxe/rxe_qp.c    | 4 ++++
  drivers/infiniband/sw/rxe/rxe_verbs.h | 1 +
  3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
index 9da6e37..04e5097 100644
--- a/drivers/infiniband/sw/rxe/rxe_net.c
+++ b/drivers/infiniband/sw/rxe/rxe_net.c
@@ -409,8 +409,7 @@ static int prepare4(struct rxe_dev *rxe, struct rxe_pkt_info *pkt,
  	if (!memcmp(saddr, daddr, sizeof(*daddr)))
  		pkt->mask |= RXE_LOOPBACK_MASK;
- prepare_udp_hdr(skb, htons(RXE_ROCE_V2_SPORT),
-			htons(ROCE_V2_UDP_DPORT));
+	prepare_udp_hdr(skb, htons(qp->src_port), htons(ROCE_V2_UDP_DPORT));

Better to use cpu_to_be16 instead htons.

Hi Vijay,

>   		case IB_QPS_RTR:
>   			pr_debug("qp#%d state -> RTR\n", qp_num(qp));
> +			qp->src_port = RXE_ROCE_V2_SPORT +
> +				(hash_64_generic
> +				 (((u64)qp->attr.dest_qp_num << 24) +
> +				  (u64)qp_num(qp), 14) & 0x3fff);
maybe make it a little helper with some documentation for the motivation?

Also,

prepare_ipv4_hdr(dst, skb, saddr->s_addr, daddr->s_addr, IPPROTO_UDP,
  			 av->grh.traffic_class, av->grh.hop_limit, df, xnet);
@@ -440,8 +439,7 @@ static int prepare6(struct rxe_dev *rxe, struct rxe_pkt_info *pkt,
  	if (!memcmp(saddr, daddr, sizeof(*daddr)))
  		pkt->mask |= RXE_LOOPBACK_MASK;
- prepare_udp_hdr(skb, htons(RXE_ROCE_V2_SPORT),
-			htons(ROCE_V2_UDP_DPORT));
+	prepare_udp_hdr(skb, htons(qp->src_port), htons(ROCE_V2_UDP_DPORT));
prepare_ipv6_hdr(dst, skb, saddr, daddr, IPPROTO_UDP,
  			 av->grh.traffic_class,
diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c
index b9f7aa1..174c811 100644
--- a/drivers/infiniband/sw/rxe/rxe_qp.c
+++ b/drivers/infiniband/sw/rxe/rxe_qp.c
@@ -726,6 +726,10 @@ int rxe_qp_from_attr(struct rxe_qp *qp, struct ib_qp_attr *attr, int mask,
case IB_QPS_RTR:
  			pr_debug("qp#%d state -> RTR\n", qp_num(qp));
+			qp->src_port = RXE_ROCE_V2_SPORT +
+				(hash_64_generic
+				 (((u64)qp->attr.dest_qp_num << 24) +
+				  (u64)qp_num(qp), 14) & 0x3fff);

Is 64bit hash really needed if you are taking only 14 bits? (why not
16 btw?)

maybe make it a little helper with some documentation for the motivation?
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux