mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-26 11:45:13 +07:00
RDMA/hns: Change variables representing quantity to unsigned
Number of sge/eqe is always non-negative, they should be defined in type of unsigned. Link: https://lore.kernel.org/r/1589982799-28728-8-git-send-email-liweihang@huawei.com Signed-off-by: Weihang Li <liweihang@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
parent
82d07a4e46
commit
13aa13dddd
@ -408,7 +408,7 @@ struct hns_roce_wq {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct hns_roce_sge {
|
struct hns_roce_sge {
|
||||||
int sge_cnt; /* SGE num */
|
unsigned int sge_cnt; /* SGE num */
|
||||||
int offset;
|
int offset;
|
||||||
int sge_shift; /* SGE size */
|
int sge_shift; /* SGE size */
|
||||||
};
|
};
|
||||||
@ -734,7 +734,7 @@ struct hns_roce_eq {
|
|||||||
int arm_st;
|
int arm_st;
|
||||||
int hop_num;
|
int hop_num;
|
||||||
struct hns_roce_mtr mtr;
|
struct hns_roce_mtr mtr;
|
||||||
int eq_max_cnt;
|
u16 eq_max_cnt;
|
||||||
int eq_period;
|
int eq_period;
|
||||||
int shift;
|
int shift;
|
||||||
int event_type;
|
int event_type;
|
||||||
|
@ -130,7 +130,7 @@ static void set_frmr_seg(struct hns_roce_v2_rc_send_wqe *rc_sq_wqe,
|
|||||||
|
|
||||||
static void set_atomic_seg(const struct ib_send_wr *wr, void *wqe,
|
static void set_atomic_seg(const struct ib_send_wr *wr, void *wqe,
|
||||||
struct hns_roce_v2_rc_send_wqe *rc_sq_wqe,
|
struct hns_roce_v2_rc_send_wqe *rc_sq_wqe,
|
||||||
int valid_num_sge)
|
unsigned int valid_num_sge)
|
||||||
{
|
{
|
||||||
struct hns_roce_wqe_atomic_seg *aseg;
|
struct hns_roce_wqe_atomic_seg *aseg;
|
||||||
|
|
||||||
@ -151,12 +151,12 @@ static void set_atomic_seg(const struct ib_send_wr *wr, void *wqe,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void set_extend_sge(struct hns_roce_qp *qp, const struct ib_send_wr *wr,
|
static void set_extend_sge(struct hns_roce_qp *qp, const struct ib_send_wr *wr,
|
||||||
unsigned int *sge_ind, int valid_num_sge)
|
unsigned int *sge_ind, unsigned int valid_num_sge)
|
||||||
{
|
{
|
||||||
struct hns_roce_v2_wqe_data_seg *dseg;
|
struct hns_roce_v2_wqe_data_seg *dseg;
|
||||||
|
unsigned int cnt = valid_num_sge;
|
||||||
struct ib_sge *sge = wr->sg_list;
|
struct ib_sge *sge = wr->sg_list;
|
||||||
unsigned int idx = *sge_ind;
|
unsigned int idx = *sge_ind;
|
||||||
int cnt = valid_num_sge;
|
|
||||||
|
|
||||||
if (qp->ibqp.qp_type == IB_QPT_RC || qp->ibqp.qp_type == IB_QPT_UC) {
|
if (qp->ibqp.qp_type == IB_QPT_RC || qp->ibqp.qp_type == IB_QPT_UC) {
|
||||||
cnt -= HNS_ROCE_SGE_IN_WQE;
|
cnt -= HNS_ROCE_SGE_IN_WQE;
|
||||||
@ -177,7 +177,7 @@ static void set_extend_sge(struct hns_roce_qp *qp, const struct ib_send_wr *wr,
|
|||||||
static int set_rwqe_data_seg(struct ib_qp *ibqp, const struct ib_send_wr *wr,
|
static int set_rwqe_data_seg(struct ib_qp *ibqp, const struct ib_send_wr *wr,
|
||||||
struct hns_roce_v2_rc_send_wqe *rc_sq_wqe,
|
struct hns_roce_v2_rc_send_wqe *rc_sq_wqe,
|
||||||
void *wqe, unsigned int *sge_ind,
|
void *wqe, unsigned int *sge_ind,
|
||||||
int valid_num_sge)
|
unsigned int valid_num_sge)
|
||||||
{
|
{
|
||||||
struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device);
|
struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device);
|
||||||
struct hns_roce_v2_wqe_data_seg *dseg = wqe;
|
struct hns_roce_v2_wqe_data_seg *dseg = wqe;
|
||||||
@ -269,10 +269,11 @@ static int check_send_valid(struct hns_roce_dev *hr_dev,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int calc_wr_sge_num(const struct ib_send_wr *wr, u32 *sge_len)
|
static unsigned int calc_wr_sge_num(const struct ib_send_wr *wr,
|
||||||
|
unsigned int *sge_len)
|
||||||
{
|
{
|
||||||
int valid_num = 0;
|
unsigned int valid_num = 0;
|
||||||
u32 len = 0;
|
unsigned int len = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < wr->num_sge; i++) {
|
for (i = 0; i < wr->num_sge; i++) {
|
||||||
@ -403,7 +404,7 @@ static inline int set_rc_wqe(struct hns_roce_qp *qp,
|
|||||||
{
|
{
|
||||||
struct hns_roce_v2_rc_send_wqe *rc_sq_wqe = wqe;
|
struct hns_roce_v2_rc_send_wqe *rc_sq_wqe = wqe;
|
||||||
unsigned int curr_idx = *sge_idx;
|
unsigned int curr_idx = *sge_idx;
|
||||||
int valid_num_sge;
|
unsigned int valid_num_sge;
|
||||||
u32 msg_len = 0;
|
u32 msg_len = 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user