Skip to content

Commit

Permalink
RDMA/hns: Replace get_udp_sport with rdma_get_udp_sport
Browse files Browse the repository at this point in the history
Several drivers have the same function xxx_get_udp_sport. So this
function is moved to ib_verbs.h.

Link: https://lore.kernel.org/r/20220106180359.2915060-3-yanjun.zhu@linux.dev
Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Acked-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
  • Loading branch information
Zhu Yanjun authored and Jason Gunthorpe committed Jan 7, 2022
1 parent 18451db commit 93f8df5
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions drivers/infiniband/hw/hns/hns_roce_hw_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -4485,14 +4485,6 @@ static int modify_qp_rtr_to_rts(struct ib_qp *ibqp,
return 0;
}

static inline u16 get_udp_sport(u32 fl, u32 lqpn, u32 rqpn)
{
if (!fl)
fl = rdma_calc_flow_label(lqpn, rqpn);

return rdma_flow_label_to_udp_sport(fl);
}

static int get_dip_ctx_idx(struct ib_qp *ibqp, const struct ib_qp_attr *attr,
u32 *dip_idx)
{
Expand Down Expand Up @@ -4709,8 +4701,9 @@ static int hns_roce_v2_set_path(struct ib_qp *ibqp,
}

hr_reg_write(context, QPC_UDPSPN,
is_udp ? get_udp_sport(grh->flow_label, ibqp->qp_num,
attr->dest_qp_num) : 0);
is_udp ? rdma_get_udp_sport(grh->flow_label, ibqp->qp_num,
attr->dest_qp_num) :
0);

hr_reg_clear(qpc_mask, QPC_UDPSPN);

Expand Down

0 comments on commit 93f8df5

Please sign in to comment.