1 Star 0 Fork 45

Lostway/rdma-core

forked from src-openEuler/rdma-core 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-libhns-Use-a-constant-instead-of-sizeof-operation.patch 1.52 KB
一键复制 编辑 原始数据 按行查看 历史
From 0de1678211e710c2cd33e3aea98b1271cae9bd98 Mon Sep 17 00:00:00 2001
From: Luoyouming <luoyouming@huawei.com>
Date: Tue, 20 Sep 2022 11:47:45 +0800
Subject: [PATCH v4 01/10] libhns: Use a constant instead of sizeof operation
The sge size is known to be constant, so it's unnecessary to use sizeof to
calculate.
Signed-off-by: Luoyouming <luoyouming@huawei.com>
Reviewed-by: Yangyang Li <liyangyang20@huawei.com>
---
providers/hns/hns_roce_u_hw_v2.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c
index 0169250..d9ea18e 100644
--- a/providers/hns/hns_roce_u_hw_v2.c
+++ b/providers/hns/hns_roce_u_hw_v2.c
@@ -847,13 +847,12 @@ static int fill_ext_sge_inl_data(struct hns_roce_qp *qp,
uint32_t num_buf,
enum hns_roce_wr_buf_type buf_type)
{
- unsigned int sge_sz = sizeof(struct hns_roce_v2_wqe_data_seg);
unsigned int sge_mask = qp->ex_sge.sge_cnt - 1;
void *dst_addr, *src_addr, *tail_bound_addr;
uint32_t src_len, tail_len;
int i;
- if (sge_info->total_len > qp->sq.max_gs * sge_sz)
+ if (sge_info->total_len > qp->sq.max_gs * HNS_ROCE_SGE_SIZE)
return EINVAL;
dst_addr = get_send_sge_ex(qp, sge_info->start_idx & sge_mask);
@@ -880,7 +879,7 @@ static int fill_ext_sge_inl_data(struct hns_roce_qp *qp,
}
}
- sge_info->valid_num = DIV_ROUND_UP(sge_info->total_len, sge_sz);
+ sge_info->valid_num = DIV_ROUND_UP(sge_info->total_len, HNS_ROCE_SGE_SIZE);
sge_info->start_idx += sge_info->valid_num;
return 0;
--
2.30.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Lostwayzxc/rdma-core.git
git@gitee.com:Lostwayzxc/rdma-core.git
Lostwayzxc
rdma-core
rdma-core
master

搜索帮助