All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Doug Ledford <dledford@redhat.com>, Jason Gunthorpe <jgg@mellanox.com>
Cc: Maor Gottlieb <maorg@mellanox.com>, linux-rdma@vger.kernel.org
Subject: [PATCH rdma-next v3 2/5] RDMA/core: Consider flow label when building skb
Date: Mon,  4 May 2020 08:19:32 +0300	[thread overview]
Message-ID: <20200504051935.269708-3-leon@kernel.org> (raw)
In-Reply-To: <20200504051935.269708-1-leon@kernel.org>

From: Maor Gottlieb <maorg@mellanox.com>

Use rdma_flow_label_to_udp_sport to calculate the UDP source port
of the RoCEV2 packet.

Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/lag.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/lag.c b/drivers/infiniband/core/lag.c
index a29533626a7c..7063e41eaf26 100644
--- a/drivers/infiniband/core/lag.c
+++ b/drivers/infiniband/core/lag.c
@@ -34,7 +34,8 @@ static struct sk_buff *rdma_build_skb(struct ib_device *device,
 	skb_push(skb, sizeof(struct udphdr));
 	skb_reset_transport_header(skb);
 	uh = udp_hdr(skb);
-	uh->source = htons(0xC000);
+	uh->source =
+		htons(rdma_flow_label_to_udp_sport(ah_attr->grh.flow_label));
 	uh->dest = htons(ROCE_V2_UDP_DPORT);
 	uh->len = htons(sizeof(struct udphdr));
 
@@ -114,7 +115,8 @@ struct net_device *rdma_lag_get_ah_roce_slave(struct ib_device *device,
 	struct net_device *master;
 
 	if (!(ah_attr->type == RDMA_AH_ATTR_TYPE_ROCE &&
-	      ah_attr->grh.sgid_attr->gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP))
+	      ah_attr->grh.sgid_attr->gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP &&
+	      ah_attr->grh.flow_label))
 		return NULL;
 
 	rcu_read_lock();
-- 
2.26.2


  parent reply	other threads:[~2020-05-04  5:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-04  5:19 [PATCH rdma-next v3 0/5] Set flow_label and RoCEv2 UDP source port for datagram QP Leon Romanovsky
2020-05-04  5:19 ` [PATCH rdma-next v3 1/5] RDMA/core: Add hash functions to calculate RoCEv2 flowlabel and UDP source port Leon Romanovsky
2020-05-04  5:19 ` Leon Romanovsky [this message]
2020-05-04  5:19 ` [PATCH rdma-next v3 3/5] RDMA/mlx5: Define RoCEv2 udp source port when set path Leon Romanovsky
2020-05-04  5:19 ` [PATCH rdma-next v3 4/5] RDMA/cma: Initialize the flow label of CM's route path record Leon Romanovsky
2020-05-04  5:19 ` [PATCH rdma-next v3 5/5] RDMA/mlx5: Set UDP source port based on the grh.flow_label Leon Romanovsky
2020-05-06 20:23 ` [PATCH rdma-next v3 0/5] Set flow_label and RoCEv2 UDP source port for datagram QP Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200504051935.269708-3-leon@kernel.org \
    --to=leon@kernel.org \
    --cc=dledford@redhat.com \
    --cc=jgg@mellanox.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=maorg@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.