Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

RDMA/core: Consider flow label when building skb

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

Link: https://lore.kernel.org/r/20200504051935.269708-3-leon@kernel.org
Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>

authored by

Maor Gottlieb and committed by
Jason Gunthorpe
9611d53a d5665a21

+4 -2
+4 -2
drivers/infiniband/core/lag.c
··· 34 34 skb_push(skb, sizeof(struct udphdr)); 35 35 skb_reset_transport_header(skb); 36 36 uh = udp_hdr(skb); 37 - uh->source = htons(0xC000); 37 + uh->source = 38 + htons(rdma_flow_label_to_udp_sport(ah_attr->grh.flow_label)); 38 39 uh->dest = htons(ROCE_V2_UDP_DPORT); 39 40 uh->len = htons(sizeof(struct udphdr)); 40 41 ··· 115 114 struct net_device *master; 116 115 117 116 if (!(ah_attr->type == RDMA_AH_ATTR_TYPE_ROCE && 118 - ah_attr->grh.sgid_attr->gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP)) 117 + ah_attr->grh.sgid_attr->gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP && 118 + ah_attr->grh.flow_label)) 119 119 return NULL; 120 120 121 121 rcu_read_lock();