You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
RDMA/hns: Repacing 'dseg_len' by macros in fill_ext_sge_inl_data()
[ Upstream commit 3b1f864c90 ]
The sge size is known to be constant, so it's unnecessary to use sizeof to
calculate.
Link: https://lore.kernel.org/r/20220922123315.3732205-11-xuhaoyue1@hisilicon.com
Signed-off-by: Luoyouming <luoyouming@huawei.com>
Signed-off-by: Haoyue Xu <xuhaoyue1@hisilicon.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Stable-dep-of: 8eaa6f7d569b ("RDMA/hns: Fix ext_sge num error when post send")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ed97ade655
commit
cc5e915358
@@ -159,8 +159,7 @@ static int fill_ext_sge_inl_data(struct hns_roce_qp *qp,
|
||||
unsigned int *sge_idx, u32 msg_len)
|
||||
{
|
||||
struct ib_device *ibdev = &(to_hr_dev(qp->ibqp.device))->ib_dev;
|
||||
unsigned int dseg_len = sizeof(struct hns_roce_v2_wqe_data_seg);
|
||||
unsigned int ext_sge_sz = qp->sq.max_gs * dseg_len;
|
||||
unsigned int ext_sge_sz = qp->sq.max_gs * HNS_ROCE_SGE_SIZE;
|
||||
unsigned int left_len_in_pg;
|
||||
unsigned int idx = *sge_idx;
|
||||
unsigned int i = 0;
|
||||
@@ -188,7 +187,7 @@ static int fill_ext_sge_inl_data(struct hns_roce_qp *qp,
|
||||
if (len <= left_len_in_pg) {
|
||||
memcpy(dseg, addr, len);
|
||||
|
||||
idx += len / dseg_len;
|
||||
idx += len / HNS_ROCE_SGE_SIZE;
|
||||
|
||||
i++;
|
||||
if (i >= wr->num_sge)
|
||||
@@ -203,7 +202,7 @@ static int fill_ext_sge_inl_data(struct hns_roce_qp *qp,
|
||||
|
||||
len -= left_len_in_pg;
|
||||
addr += left_len_in_pg;
|
||||
idx += left_len_in_pg / dseg_len;
|
||||
idx += left_len_in_pg / HNS_ROCE_SGE_SIZE;
|
||||
dseg = hns_roce_get_extend_sge(qp,
|
||||
idx & (qp->sge.sge_cnt - 1));
|
||||
left_len_in_pg = 1 << HNS_HW_PAGE_SHIFT;
|
||||
|
||||
Reference in New Issue
Block a user