Skip to content

Commit 5abc21f

Browse files
authored
Merge pull request #1613 from hginjgerx/mw
libhns: Remove MW support
2 parents a97ea53 + 2e412b9 commit 5abc21f

File tree

5 files changed

+0
-110
lines changed

5 files changed

+0
-110
lines changed

providers/hns/hns_roce_u.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,12 @@ static const struct verbs_match_ent hca_table[] = {
5858
};
5959

6060
static const struct verbs_context_ops hns_common_ops = {
61-
.alloc_mw = hns_roce_u_alloc_mw,
6261
.alloc_pd = hns_roce_u_alloc_pd,
63-
.bind_mw = hns_roce_u_bind_mw,
6462
.cq_event = hns_roce_u_cq_event,
6563
.create_cq = hns_roce_u_create_cq,
6664
.create_cq_ex = hns_roce_u_create_cq_ex,
6765
.create_qp = hns_roce_u_create_qp,
6866
.create_qp_ex = hns_roce_u_create_qp_ex,
69-
.dealloc_mw = hns_roce_u_dealloc_mw,
7067
.dealloc_pd = hns_roce_u_dealloc_pd,
7168
.dereg_mr = hns_roce_u_dereg_mr,
7269
.destroy_cq = hns_roce_u_destroy_cq,

providers/hns/hns_roce_u.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -508,11 +508,6 @@ int hns_roce_u_rereg_mr(struct verbs_mr *vmr, int flags, struct ibv_pd *pd,
508508
void *addr, size_t length, int access);
509509
int hns_roce_u_dereg_mr(struct verbs_mr *vmr);
510510

511-
struct ibv_mw *hns_roce_u_alloc_mw(struct ibv_pd *pd, enum ibv_mw_type type);
512-
int hns_roce_u_dealloc_mw(struct ibv_mw *mw);
513-
int hns_roce_u_bind_mw(struct ibv_qp *qp, struct ibv_mw *mw,
514-
struct ibv_mw_bind *mw_bind);
515-
516511
struct ibv_cq *hns_roce_u_create_cq(struct ibv_context *context, int cqe,
517512
struct ibv_comp_channel *channel,
518513
int comp_vector);

providers/hns/hns_roce_u_hw_v2.c

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ static const uint32_t hns_roce_opcode[] = {
5151
HR_IBV_OPC_MAP(RDMA_READ, RDMA_READ),
5252
HR_IBV_OPC_MAP(ATOMIC_CMP_AND_SWP, ATOMIC_COM_AND_SWAP),
5353
HR_IBV_OPC_MAP(ATOMIC_FETCH_AND_ADD, ATOMIC_FETCH_AND_ADD),
54-
HR_IBV_OPC_MAP(BIND_MW, BIND_MW_TYPE),
5554
HR_IBV_OPC_MAP(SEND_WITH_INV, SEND_WITH_INV),
5655
};
5756

@@ -386,7 +385,6 @@ static const unsigned int wc_send_op_map[] = {
386385
[HNS_ROCE_SQ_OP_RDMA_READ] = IBV_WC_RDMA_READ,
387386
[HNS_ROCE_SQ_OP_ATOMIC_COMP_AND_SWAP] = IBV_WC_COMP_SWAP,
388387
[HNS_ROCE_SQ_OP_ATOMIC_FETCH_AND_ADD] = IBV_WC_FETCH_ADD,
389-
[HNS_ROCE_SQ_OP_BIND_MW] = IBV_WC_BIND_MW,
390388
};
391389

392390
static const unsigned int wc_rcv_op_map[] = {
@@ -568,7 +566,6 @@ static void parse_cqe_for_req(struct hns_roce_v2_cqe *cqe, struct ibv_wc *wc,
568566
case HNS_ROCE_SQ_OP_SEND:
569567
case HNS_ROCE_SQ_OP_SEND_WITH_INV:
570568
case HNS_ROCE_SQ_OP_RDMA_WRITE:
571-
case HNS_ROCE_SQ_OP_BIND_MW:
572569
wc->wc_flags = 0;
573570
break;
574571
case HNS_ROCE_SQ_OP_SEND_WITH_IMM:
@@ -1251,28 +1248,6 @@ static int set_rc_inl(struct hns_roce_qp *qp, const struct ibv_send_wr *wr,
12511248
return 0;
12521249
}
12531250

1254-
static void set_bind_mw_seg(struct hns_roce_rc_sq_wqe *wqe,
1255-
const struct ibv_send_wr *wr)
1256-
{
1257-
unsigned int access = wr->bind_mw.bind_info.mw_access_flags;
1258-
1259-
hr_reg_write_bool(wqe, RCWQE_MW_TYPE, wr->bind_mw.mw->type - 1);
1260-
hr_reg_write_bool(wqe, RCWQE_MW_RA_EN,
1261-
!!(access & IBV_ACCESS_REMOTE_ATOMIC));
1262-
hr_reg_write_bool(wqe, RCWQE_MW_RR_EN,
1263-
!!(access & IBV_ACCESS_REMOTE_READ));
1264-
hr_reg_write_bool(wqe, RCWQE_MW_RW_EN,
1265-
!!(access & IBV_ACCESS_REMOTE_WRITE));
1266-
1267-
wqe->new_rkey = htole32(wr->bind_mw.rkey);
1268-
wqe->byte_16 = htole32(wr->bind_mw.bind_info.length &
1269-
HNS_ROCE_ADDRESS_MASK);
1270-
wqe->byte_20 = htole32(wr->bind_mw.bind_info.length >>
1271-
HNS_ROCE_ADDRESS_SHIFT);
1272-
wqe->rkey = htole32(wr->bind_mw.bind_info.mr->rkey);
1273-
wqe->va = htole64(wr->bind_mw.bind_info.addr);
1274-
}
1275-
12761251
static int check_rc_opcode(struct hns_roce_rc_sq_wqe *wqe,
12771252
const struct ibv_send_wr *wr)
12781253
{
@@ -1298,9 +1273,6 @@ static int check_rc_opcode(struct hns_roce_rc_sq_wqe *wqe,
12981273
case IBV_WR_SEND_WITH_INV:
12991274
wqe->inv_key = htole32(wr->invalidate_rkey);
13001275
break;
1301-
case IBV_WR_BIND_MW:
1302-
set_bind_mw_seg(wqe, wr);
1303-
break;
13041276
default:
13051277
ret = EINVAL;
13061278
break;
@@ -1334,9 +1306,6 @@ static int set_rc_wqe(void *wqe, struct hns_roce_qp *qp, struct ibv_send_wr *wr,
13341306
hr_reg_write(rc_sq_wqe, RCWQE_MSG_START_SGE_IDX,
13351307
sge_info->start_idx & (qp->ex_sge.sge_cnt - 1));
13361308

1337-
if (wr->opcode == IBV_WR_BIND_MW)
1338-
goto wqe_valid;
1339-
13401309
wqe += sizeof(struct hns_roce_rc_sq_wqe);
13411310
dseg = wqe;
13421311

@@ -1357,7 +1326,6 @@ static int set_rc_wqe(void *wqe, struct hns_roce_qp *qp, struct ibv_send_wr *wr,
13571326
if (ret)
13581327
return ret;
13591328

1360-
wqe_valid:
13611329
enable_wqe(qp, rc_sq_wqe, qp->sq.head + nreq);
13621330

13631331
return 0;

providers/hns/hns_roce_u_hw_v2.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ enum {
6060
HNS_ROCE_WQE_OP_ATOMIC_MASK_COMP_AND_SWAP = 0x8,
6161
HNS_ROCE_WQE_OP_ATOMIC_MASK_FETCH_AND_ADD = 0x9,
6262
HNS_ROCE_WQE_OP_FAST_REG_PMR = 0xa,
63-
HNS_ROCE_WQE_OP_BIND_MW_TYPE = 0xc,
6463
HNS_ROCE_WQE_OP_MASK = 0x1f
6564
};
6665

@@ -84,7 +83,6 @@ enum {
8483
HNS_ROCE_SQ_OP_ATOMIC_MASK_COMP_AND_SWAP = 0x8,
8584
HNS_ROCE_SQ_OP_ATOMIC_MASK_FETCH_AND_ADD = 0x9,
8685
HNS_ROCE_SQ_OP_FAST_REG_PMR = 0xa,
87-
HNS_ROCE_SQ_OP_BIND_MW = 0xc,
8886
};
8987

9088
enum {
@@ -232,11 +230,6 @@ struct hns_roce_rc_sq_wqe {
232230
#define RCWQE_VA1_L RCWQE_FIELD_LOC(479, 448)
233231
#define RCWQE_VA1_H RCWQE_FIELD_LOC(511, 480)
234232

235-
#define RCWQE_MW_TYPE RCWQE_FIELD_LOC(256, 256)
236-
#define RCWQE_MW_RA_EN RCWQE_FIELD_LOC(258, 258)
237-
#define RCWQE_MW_RR_EN RCWQE_FIELD_LOC(259, 259)
238-
#define RCWQE_MW_RW_EN RCWQE_FIELD_LOC(260, 260)
239-
240233
struct hns_roce_v2_wqe_data_seg {
241234
__le32 len;
242235
__le32 lkey;

providers/hns/hns_roce_u_verbs.c

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -346,69 +346,6 @@ int hns_roce_u_dereg_mr(struct verbs_mr *vmr)
346346
return ret;
347347
}
348348

349-
int hns_roce_u_bind_mw(struct ibv_qp *qp, struct ibv_mw *mw,
350-
struct ibv_mw_bind *mw_bind)
351-
{
352-
struct ibv_mw_bind_info *bind_info = &mw_bind->bind_info;
353-
struct ibv_send_wr *bad_wr = NULL;
354-
struct ibv_send_wr wr = {};
355-
int ret;
356-
357-
if (bind_info->mw_access_flags & ~(IBV_ACCESS_REMOTE_WRITE |
358-
IBV_ACCESS_REMOTE_READ | IBV_ACCESS_REMOTE_ATOMIC))
359-
return EINVAL;
360-
361-
wr.opcode = IBV_WR_BIND_MW;
362-
wr.next = NULL;
363-
364-
wr.wr_id = mw_bind->wr_id;
365-
wr.send_flags = mw_bind->send_flags;
366-
367-
wr.bind_mw.mw = mw;
368-
wr.bind_mw.rkey = ibv_inc_rkey(mw->rkey);
369-
wr.bind_mw.bind_info = mw_bind->bind_info;
370-
371-
ret = hns_roce_u_v2_post_send(qp, &wr, &bad_wr);
372-
if (ret)
373-
return ret;
374-
375-
mw->rkey = wr.bind_mw.rkey;
376-
377-
return 0;
378-
}
379-
380-
struct ibv_mw *hns_roce_u_alloc_mw(struct ibv_pd *pd, enum ibv_mw_type type)
381-
{
382-
struct ibv_mw *mw;
383-
struct ibv_alloc_mw cmd = {};
384-
struct ib_uverbs_alloc_mw_resp resp = {};
385-
386-
mw = malloc(sizeof(*mw));
387-
if (!mw)
388-
return NULL;
389-
390-
if (ibv_cmd_alloc_mw(pd, type, mw, &cmd, sizeof(cmd),
391-
&resp, sizeof(resp))) {
392-
free(mw);
393-
return NULL;
394-
}
395-
396-
return mw;
397-
}
398-
399-
int hns_roce_u_dealloc_mw(struct ibv_mw *mw)
400-
{
401-
int ret;
402-
403-
ret = ibv_cmd_dealloc_mw(mw);
404-
if (ret)
405-
return ret;
406-
407-
free(mw);
408-
409-
return 0;
410-
}
411-
412349
enum {
413350
CREATE_CQ_SUPPORTED_COMP_MASK = IBV_CQ_INIT_ATTR_MASK_FLAGS |
414351
IBV_CQ_INIT_ATTR_MASK_PD,

0 commit comments

Comments
 (0)