When udp port 4791 is blocked, the udp port 4891 is used and vice versa. CC: Srinivas Eeda <srinivas.eeda@xxxxxxxxxx> CC: Junxiao Bi <junxiao.bi@xxxxxxxxxx> Reviewed-by: Yuval Shaia <yuval.shaia@xxxxxxxxxx> Signed-off-by: Zhu Yanjun <yanjun.zhu@xxxxxxxxxx> --- drivers/infiniband/sw/rxe/rxe_net.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c index 29f6937..d61f2c5 100644 --- a/drivers/infiniband/sw/rxe/rxe_net.c +++ b/drivers/infiniband/sw/rxe/rxe_net.c @@ -276,6 +276,16 @@ static inline void prepare_udp_ports_spin(__be16 dport, __be16 sport) src_port = sport; spin_unlock(&port_lock); } + +static inline void exchange_udp_port(void) +{ + if (dst_port == htons(ROCE_V2_UDP_DPORT)) + prepare_udp_ports_spin(htons(ROCE_V2_UDP_DUAL_DPORT), + htons(RXE_ROCE_V2_DUAL_SPORT)); + else + prepare_udp_ports_spin(htons(ROCE_V2_UDP_DPORT), + htons(RXE_ROCE_V2_SPORT)); +} #endif static int rxe_udp_encap_recv(struct sock *sk, struct sk_buff *skb) @@ -549,8 +559,7 @@ int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb) #ifdef CONFIG_RDMA_RXE_DUAL_PORT_MODULE if (unlikely(err != NET_XMIT_SUCCESS)) - prepare_udp_ports_spin(htons(ROCE_V2_UDP_DUAL_DPORT), - htons(RXE_ROCE_V2_DUAL_SPORT)); + exchange_udp_port(); #endif if (unlikely(net_xmit_eval(err))) { -- 2.7.4 -- 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