From: Zhu Yanjun <yanjun.zhu@xxxxxxxxx> Use the standard method to produce udp source port. Signed-off-by: Zhu Yanjun <yanjun.zhu@xxxxxxxxx> --- drivers/infiniband/sw/rxe/rxe_verbs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c index 0aa0d7e52773..f30d98ad13cd 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -469,6 +469,16 @@ static int rxe_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, if (err) goto err1; + if (mask & IB_QP_AV) { + if (attr->ah_attr.ah_flags & IB_AH_GRH) { + u32 fl = attr->ah_attr.grh.flow_label; + u32 lqp = qp->ibqp.qp_num; + u32 rqp = qp->attr.dest_qp_num; + + qp->src_port = rdma_get_udp_sport(fl, lqp, rqp); + } + } + return 0; err1: -- 2.27.0