提交 f2b1ef7e 编写于 作者: Z Zhu Yanjun 提交者: Zheng Zengkai

RDMA/core: Calculate UDP source port based on flow label or lqpn/rqpn

mainline inclusion
from mainline-v5.16-rc6
commit 18451db8
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4QOTS
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/commit/?id=18451db82ef7f943c60a7fce685f16172bda5106

---------------------------------------------------------------------

Calculate and set UDP source port based on the flow label. If flow label
is not defined in GRH then calculate it based on lqpn/rqpn.

Link: https://lore.kernel.org/r/20220106180359.2915060-2-yanjun.zhu@linux.devSigned-off-by: NZhu Yanjun <yanjun.zhu@linux.dev>
Reviewed-by: NLeon Romanovsky <leonro@nvidia.com>
Signed-off-by: NJason Gunthorpe <jgg@nvidia.com>
sigend-off-by: NGuofeng Yue <yueguofeng@hisilicon.com>
Reviewed-by: NYangyang Li <liyangyang20@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 17394cb7
...@@ -4722,4 +4722,22 @@ static inline u32 rdma_calc_flow_label(u32 lqpn, u32 rqpn) ...@@ -4722,4 +4722,22 @@ static inline u32 rdma_calc_flow_label(u32 lqpn, u32 rqpn)
return (u32)(v & IB_GRH_FLOWLABEL_MASK); return (u32)(v & IB_GRH_FLOWLABEL_MASK);
} }
/**
* rdma_get_udp_sport - Calculate and set UDP source port based on the flow
* label. If flow label is not defined in GRH then
* calculate it based on lqpn/rqpn.
*
* @fl: flow label from GRH
* @lqpn: local qp number
* @rqpn: remote qp number
*/
static inline u16 rdma_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);
}
#endif /* IB_VERBS_H */ #endif /* IB_VERBS_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册