* [PATCH v4 0/3] RDMA/rxe: Add RDMA Atomic Write operation @ 2022-04-18 6:12 Xiao Yang 2022-04-18 6:12 ` [PATCH v4 1/3] RDMA/rxe: Rename send_atomic_ack() and atomic member of struct resp_res Xiao Yang ` (5 more replies) 0 siblings, 6 replies; 12+ messages in thread From: Xiao Yang @ 2022-04-18 6:12 UTC (permalink / raw) To: linux-rdma Cc: yanjun.zhu, rpearsonhpe, jgg, y-goto, lizhijian, tomasz.gromadzki, ira.weiny, Xiao Yang The IB SPEC v1.5[1] defined new RDMA Atomic Write operation. This patchset makes SoftRoCE support new RDMA Atomic Write on RC service. I add ibv_wr_rdma_atomic_write() and a rdma_atomic_write example on my rdma-core repository[2]. You can verify the patchset by building and running the rdma_atomic_write example. server: $ ./rdma_atomic_write_server -s [server_address] -p [port_number] client: $ ./rdma_atomic_write_client -s [server_address] -p [port_number] [1]: https://www.infinibandta.org/wp-content/uploads/2021/08/IBTA-Overview-of-IBTA-Volume-1-Release-1.5-and-MPE-2021-08-17-Secure.pptx [2]: https://github.com/yangx-jy/rdma-core/tree/new_api_with_point v3->v4: 1) Rebase on current wip/jgg-for-next 2) Fix a compiler error on 32-bit arch (e.g. parisc) by disabling RDMA Atomic Write 3) Replace 64-bit value with 8-byte array for RDMA Atomic Write V2->V3: 1) Rebase 2) Add RDMA Atomic Write attribute for rxe device V1->V2: 1) Set IB_OPCODE_RDMA_ATOMIC_WRITE to 0x1D 2) Add rdma.atomic_wr in struct rxe_send_wr and use it to pass the atomic write value 3) Use smp_store_release() to ensure that all prior operations have completed Xiao Yang (3): RDMA/rxe: Rename send_atomic_ack() and atomic member of struct resp_res RDMA/rxe: Support RDMA Atomic Write operation RDMA/rxe: Add RDMA Atomic Write attribute for rxe device drivers/infiniband/sw/rxe/rxe_comp.c | 4 ++ drivers/infiniband/sw/rxe/rxe_opcode.c | 19 ++++++++ drivers/infiniband/sw/rxe/rxe_opcode.h | 3 ++ drivers/infiniband/sw/rxe/rxe_param.h | 5 +++ drivers/infiniband/sw/rxe/rxe_qp.c | 4 +- drivers/infiniband/sw/rxe/rxe_req.c | 13 +++++- drivers/infiniband/sw/rxe/rxe_resp.c | 61 ++++++++++++++++++++------ drivers/infiniband/sw/rxe/rxe_verbs.h | 2 +- include/rdma/ib_pack.h | 2 + include/rdma/ib_verbs.h | 3 ++ include/uapi/rdma/ib_user_verbs.h | 4 ++ include/uapi/rdma/rdma_user_rxe.h | 1 + 12 files changed, 103 insertions(+), 18 deletions(-) -- 2.34.1 ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v4 1/3] RDMA/rxe: Rename send_atomic_ack() and atomic member of struct resp_res 2022-04-18 6:12 [PATCH v4 0/3] RDMA/rxe: Add RDMA Atomic Write operation Xiao Yang @ 2022-04-18 6:12 ` Xiao Yang 2022-04-18 6:12 ` [PATCH v4 2/3] RDMA/rxe: Support RDMA Atomic Write operation Xiao Yang ` (4 subsequent siblings) 5 siblings, 0 replies; 12+ messages in thread From: Xiao Yang @ 2022-04-18 6:12 UTC (permalink / raw) To: linux-rdma Cc: yanjun.zhu, rpearsonhpe, jgg, y-goto, lizhijian, tomasz.gromadzki, ira.weiny, Xiao Yang send_atomic_ack() and atomic member of struct resp_res will be common in the future so rename them. Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com> --- drivers/infiniband/sw/rxe/rxe_qp.c | 2 +- drivers/infiniband/sw/rxe/rxe_resp.c | 10 +++++----- drivers/infiniband/sw/rxe/rxe_verbs.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c index ff58f76347c9..c9e382bc4a66 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -130,7 +130,7 @@ static void free_rd_atomic_resources(struct rxe_qp *qp) void free_rd_atomic_resource(struct rxe_qp *qp, struct resp_res *res) { if (res->type == RXE_ATOMIC_MASK) - kfree_skb(res->atomic.skb); + kfree_skb(res->resp.skb); res->type = 0; } diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c index e2653a8721fe..4ee923352056 100644 --- a/drivers/infiniband/sw/rxe/rxe_resp.c +++ b/drivers/infiniband/sw/rxe/rxe_resp.c @@ -1004,7 +1004,7 @@ static int send_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt, return err; } -static int send_atomic_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt, +static int send_resp(struct rxe_qp *qp, struct rxe_pkt_info *pkt, u8 syndrome) { int rc = 0; @@ -1026,7 +1026,7 @@ static int send_atomic_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt, skb_get(skb); res->type = RXE_ATOMIC_MASK; - res->atomic.skb = skb; + res->resp.skb = skb; res->first_psn = ack_pkt.psn; res->last_psn = ack_pkt.psn; res->cur_psn = ack_pkt.psn; @@ -1049,7 +1049,7 @@ static enum resp_states acknowledge(struct rxe_qp *qp, if (qp->resp.aeth_syndrome != AETH_ACK_UNLIMITED) send_ack(qp, pkt, qp->resp.aeth_syndrome, pkt->psn); else if (pkt->mask & RXE_ATOMIC_MASK) - send_atomic_ack(qp, pkt, AETH_ACK_UNLIMITED); + send_resp(qp, pkt, AETH_ACK_UNLIMITED); else if (bth_ack(pkt)) send_ack(qp, pkt, AETH_ACK_UNLIMITED, pkt->psn); @@ -1158,9 +1158,9 @@ static enum resp_states duplicate_request(struct rxe_qp *qp, /* Find the operation in our list of responder resources. */ res = find_resource(qp, pkt->psn); if (res) { - skb_get(res->atomic.skb); + skb_get(res->resp.skb); /* Resend the result. */ - rc = rxe_xmit_packet(qp, pkt, res->atomic.skb); + rc = rxe_xmit_packet(qp, pkt, res->resp.skb); if (rc) { pr_err("Failed resending result. This flow is not handled - skb ignored\n"); rc = RESPST_CLEANUP; diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.h b/drivers/infiniband/sw/rxe/rxe_verbs.h index 86068d70cd95..20be40c42294 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.h +++ b/drivers/infiniband/sw/rxe/rxe_verbs.h @@ -155,7 +155,7 @@ struct resp_res { union { struct { struct sk_buff *skb; - } atomic; + } resp; struct { u64 va_org; u32 rkey; -- 2.34.1 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v4 2/3] RDMA/rxe: Support RDMA Atomic Write operation 2022-04-18 6:12 [PATCH v4 0/3] RDMA/rxe: Add RDMA Atomic Write operation Xiao Yang 2022-04-18 6:12 ` [PATCH v4 1/3] RDMA/rxe: Rename send_atomic_ack() and atomic member of struct resp_res Xiao Yang @ 2022-04-18 6:12 ` Xiao Yang 2022-04-18 6:12 ` [PATCH v4 3/3] RDMA/rxe: Add RDMA Atomic Write attribute for rxe device Xiao Yang ` (3 subsequent siblings) 5 siblings, 0 replies; 12+ messages in thread From: Xiao Yang @ 2022-04-18 6:12 UTC (permalink / raw) To: linux-rdma Cc: yanjun.zhu, rpearsonhpe, jgg, y-goto, lizhijian, tomasz.gromadzki, ira.weiny, Xiao Yang This patch implements RDMA Atomic Write operation for RC service. Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com> --- drivers/infiniband/sw/rxe/rxe_comp.c | 4 ++ drivers/infiniband/sw/rxe/rxe_opcode.c | 19 ++++++++++ drivers/infiniband/sw/rxe/rxe_opcode.h | 3 ++ drivers/infiniband/sw/rxe/rxe_qp.c | 2 +- drivers/infiniband/sw/rxe/rxe_req.c | 13 ++++++- drivers/infiniband/sw/rxe/rxe_resp.c | 51 ++++++++++++++++++++++---- include/rdma/ib_pack.h | 2 + include/rdma/ib_verbs.h | 2 + include/uapi/rdma/ib_user_verbs.h | 2 + include/uapi/rdma/rdma_user_rxe.h | 1 + 10 files changed, 88 insertions(+), 11 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c b/drivers/infiniband/sw/rxe/rxe_comp.c index 138b3e7d3a5f..305e19fe43d2 100644 --- a/drivers/infiniband/sw/rxe/rxe_comp.c +++ b/drivers/infiniband/sw/rxe/rxe_comp.c @@ -104,6 +104,7 @@ static enum ib_wc_opcode wr_to_wc_opcode(enum ib_wr_opcode opcode) case IB_WR_LOCAL_INV: return IB_WC_LOCAL_INV; case IB_WR_REG_MR: return IB_WC_REG_MR; case IB_WR_BIND_MW: return IB_WC_BIND_MW; + case IB_WR_RDMA_ATOMIC_WRITE: return IB_WC_RDMA_ATOMIC_WRITE; default: return 0xff; @@ -256,6 +257,9 @@ static inline enum comp_state check_ack(struct rxe_qp *qp, if ((syn & AETH_TYPE_MASK) != AETH_ACK) return COMPST_ERROR; + if (wqe->wr.opcode == IB_WR_RDMA_ATOMIC_WRITE) + return COMPST_WRITE_SEND; + fallthrough; /* (IB_OPCODE_RC_RDMA_READ_RESPONSE_MIDDLE doesn't have an AETH) */ diff --git a/drivers/infiniband/sw/rxe/rxe_opcode.c b/drivers/infiniband/sw/rxe/rxe_opcode.c index d4ba4d506f17..b194e8ac581f 100644 --- a/drivers/infiniband/sw/rxe/rxe_opcode.c +++ b/drivers/infiniband/sw/rxe/rxe_opcode.c @@ -101,6 +101,12 @@ struct rxe_wr_opcode_info rxe_wr_opcode_info[] = { [IB_QPT_UC] = WR_LOCAL_OP_MASK, }, }, + [IB_WR_RDMA_ATOMIC_WRITE] = { + .name = "IB_WR_RDMA_ATOMIC_WRITE", + .mask = { + [IB_QPT_RC] = WR_ATOMIC_WRITE_MASK, + }, + }, }; struct rxe_opcode_info rxe_opcode[RXE_NUM_OPCODE] = { @@ -378,6 +384,19 @@ struct rxe_opcode_info rxe_opcode[RXE_NUM_OPCODE] = { RXE_IETH_BYTES, } }, + [IB_OPCODE_RC_RDMA_ATOMIC_WRITE] = { + .name = "IB_OPCODE_RC_RDMA_ATOMIC_WRITE", + .mask = RXE_RETH_MASK | RXE_PAYLOAD_MASK | RXE_REQ_MASK | + RXE_ATOMIC_WRITE_MASK | RXE_START_MASK | + RXE_END_MASK, + .length = RXE_BTH_BYTES + RXE_RETH_BYTES, + .offset = { + [RXE_BTH] = 0, + [RXE_RETH] = RXE_BTH_BYTES, + [RXE_PAYLOAD] = RXE_BTH_BYTES + + RXE_RETH_BYTES, + } + }, /* UC */ [IB_OPCODE_UC_SEND_FIRST] = { diff --git a/drivers/infiniband/sw/rxe/rxe_opcode.h b/drivers/infiniband/sw/rxe/rxe_opcode.h index 8f9aaaf260f2..a470e9b0b884 100644 --- a/drivers/infiniband/sw/rxe/rxe_opcode.h +++ b/drivers/infiniband/sw/rxe/rxe_opcode.h @@ -20,6 +20,7 @@ enum rxe_wr_mask { WR_READ_MASK = BIT(3), WR_WRITE_MASK = BIT(4), WR_LOCAL_OP_MASK = BIT(5), + WR_ATOMIC_WRITE_MASK = BIT(7), WR_READ_OR_WRITE_MASK = WR_READ_MASK | WR_WRITE_MASK, WR_WRITE_OR_SEND_MASK = WR_WRITE_MASK | WR_SEND_MASK, @@ -81,6 +82,8 @@ enum rxe_hdr_mask { RXE_LOOPBACK_MASK = BIT(NUM_HDR_TYPES + 12), + RXE_ATOMIC_WRITE_MASK = BIT(NUM_HDR_TYPES + 14), + RXE_READ_OR_ATOMIC_MASK = (RXE_READ_MASK | RXE_ATOMIC_MASK), RXE_WRITE_OR_SEND_MASK = (RXE_WRITE_MASK | RXE_SEND_MASK), RXE_READ_OR_WRITE_MASK = (RXE_READ_MASK | RXE_WRITE_MASK), diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c index c9e382bc4a66..4937724dbfa9 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -129,7 +129,7 @@ static void free_rd_atomic_resources(struct rxe_qp *qp) void free_rd_atomic_resource(struct rxe_qp *qp, struct resp_res *res) { - if (res->type == RXE_ATOMIC_MASK) + if (res->type == RXE_ATOMIC_MASK || res->type == RXE_ATOMIC_WRITE_MASK) kfree_skb(res->resp.skb); res->type = 0; } diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c index e2659663b283..cf5176a3bd97 100644 --- a/drivers/infiniband/sw/rxe/rxe_req.c +++ b/drivers/infiniband/sw/rxe/rxe_req.c @@ -237,6 +237,10 @@ static int next_opcode_rc(struct rxe_qp *qp, u32 opcode, int fits) else return fits ? IB_OPCODE_RC_SEND_ONLY_WITH_INVALIDATE : IB_OPCODE_RC_SEND_FIRST; + + case IB_WR_RDMA_ATOMIC_WRITE: + return IB_OPCODE_RC_RDMA_ATOMIC_WRITE; + case IB_WR_REG_MR: case IB_WR_LOCAL_INV: return opcode; @@ -465,6 +469,11 @@ static int finish_packet(struct rxe_qp *qp, struct rxe_av *av, } } + if (pkt->mask & RXE_ATOMIC_WRITE_MASK) { + memcpy(payload_addr(pkt), wqe->wr.wr.rdma.atomic_wr, paylen); + wqe->dma.resid -= paylen; + } + return 0; } @@ -663,13 +672,13 @@ int rxe_requester(void *arg) } mask = rxe_opcode[opcode].mask; - if (unlikely(mask & RXE_READ_OR_ATOMIC_MASK)) { + if (unlikely(mask & (RXE_READ_OR_ATOMIC_MASK | RXE_ATOMIC_WRITE_MASK))) { if (check_init_depth(qp, wqe)) goto exit; } mtu = get_mtu(qp); - payload = (mask & RXE_WRITE_OR_SEND_MASK) ? wqe->dma.resid : 0; + payload = (mask & (RXE_WRITE_OR_SEND_MASK | RXE_ATOMIC_WRITE_MASK)) ? wqe->dma.resid : 0; if (payload > mtu) { if (qp_type(qp) == IB_QPT_UD) { /* C10-93.1.1: If the total sum of all the buffer lengths specified for a diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c index 4ee923352056..446f93042b5e 100644 --- a/drivers/infiniband/sw/rxe/rxe_resp.c +++ b/drivers/infiniband/sw/rxe/rxe_resp.c @@ -258,7 +258,7 @@ static enum resp_states check_op_valid(struct rxe_qp *qp, case IB_QPT_RC: if (((pkt->mask & RXE_READ_MASK) && !(qp->attr.qp_access_flags & IB_ACCESS_REMOTE_READ)) || - ((pkt->mask & RXE_WRITE_MASK) && + ((pkt->mask & (RXE_WRITE_MASK | RXE_ATOMIC_WRITE_MASK)) && !(qp->attr.qp_access_flags & IB_ACCESS_REMOTE_WRITE)) || ((pkt->mask & RXE_ATOMIC_MASK) && !(qp->attr.qp_access_flags & IB_ACCESS_REMOTE_ATOMIC))) { @@ -362,7 +362,7 @@ static enum resp_states check_resource(struct rxe_qp *qp, } } - if (pkt->mask & RXE_READ_OR_ATOMIC_MASK) { + if (pkt->mask & (RXE_READ_OR_ATOMIC_MASK | RXE_ATOMIC_WRITE_MASK)) { /* it is the requesters job to not send * too many read/atomic ops, we just * recycle the responder resource queue @@ -413,7 +413,7 @@ static enum resp_states check_rkey(struct rxe_qp *qp, enum resp_states state; int access; - if (pkt->mask & RXE_READ_OR_WRITE_MASK) { + if (pkt->mask & (RXE_READ_OR_WRITE_MASK | RXE_ATOMIC_WRITE_MASK)) { if (pkt->mask & RXE_RETH_MASK) { qp->resp.va = reth_va(pkt); qp->resp.offset = 0; @@ -479,7 +479,7 @@ static enum resp_states check_rkey(struct rxe_qp *qp, goto err; } - if (pkt->mask & RXE_WRITE_MASK) { + if (pkt->mask & (RXE_WRITE_MASK | RXE_ATOMIC_WRITE_MASK)) { if (resid > mtu) { if (pktlen != mtu || bth_pad(pkt)) { state = RESPST_ERR_LENGTH; @@ -590,6 +590,34 @@ static enum resp_states process_atomic(struct rxe_qp *qp, return ret; } +static enum resp_states process_atomic_write(struct rxe_qp *qp, + struct rxe_pkt_info *pkt) +{ +#ifdef CONFIG_64BIT + u64 src, *dst; + struct rxe_mr *mr = qp->resp.mr; + int paylen = payload_size(pkt); + + memcpy(&src, payload_addr(pkt), paylen); + + dst = iova_to_vaddr(mr, qp->resp.va + qp->resp.offset, paylen); + /* check vaddr is 8 bytes aligned. */ + if (!dst || (uintptr_t)dst & 7) + return RESPST_ERR_MISALIGNED_ATOMIC; + + /* Do atomic write after all prior operations have completed */ + smp_store_release(dst, src); + + /* decrease resp.resid to zero */ + qp->resp.resid -= sizeof(paylen); + + return RESPST_NONE; +#else + pr_err("32-bit arch doesn't support 8-byte atomic write\n"); + return RESPST_ERR_UNSUPPORTED_OPCODE; +#endif /* CONFIG_64BIT */ +} + static struct sk_buff *prepare_ack_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt, struct rxe_pkt_info *ack, @@ -846,6 +874,10 @@ static enum resp_states execute(struct rxe_qp *qp, struct rxe_pkt_info *pkt) err = process_atomic(qp, pkt); if (err) return err; + } else if (pkt->mask & RXE_ATOMIC_WRITE_MASK) { + err = process_atomic_write(qp, pkt); + if (err) + return err; } else { /* Unreachable */ WARN_ON_ONCE(1); @@ -1012,9 +1044,12 @@ static int send_resp(struct rxe_qp *qp, struct rxe_pkt_info *pkt, struct sk_buff *skb; struct resp_res *res; + int opcode = pkt->mask & RXE_ATOMIC_MASK ? + IB_OPCODE_RC_ATOMIC_ACKNOWLEDGE : + IB_OPCODE_RC_RDMA_READ_RESPONSE_ONLY; + skb = prepare_ack_packet(qp, pkt, &ack_pkt, - IB_OPCODE_RC_ATOMIC_ACKNOWLEDGE, 0, pkt->psn, - syndrome); + opcode, 0, pkt->psn, syndrome); if (!skb) { rc = -ENOMEM; goto out; @@ -1025,7 +1060,7 @@ static int send_resp(struct rxe_qp *qp, struct rxe_pkt_info *pkt, rxe_advance_resp_resource(qp); skb_get(skb); - res->type = RXE_ATOMIC_MASK; + res->type = pkt->mask & (RXE_ATOMIC_MASK | RXE_ATOMIC_WRITE_MASK); res->resp.skb = skb; res->first_psn = ack_pkt.psn; res->last_psn = ack_pkt.psn; @@ -1048,7 +1083,7 @@ static enum resp_states acknowledge(struct rxe_qp *qp, if (qp->resp.aeth_syndrome != AETH_ACK_UNLIMITED) send_ack(qp, pkt, qp->resp.aeth_syndrome, pkt->psn); - else if (pkt->mask & RXE_ATOMIC_MASK) + else if (pkt->mask & (RXE_ATOMIC_MASK | RXE_ATOMIC_WRITE_MASK)) send_resp(qp, pkt, AETH_ACK_UNLIMITED); else if (bth_ack(pkt)) send_ack(qp, pkt, AETH_ACK_UNLIMITED, pkt->psn); diff --git a/include/rdma/ib_pack.h b/include/rdma/ib_pack.h index a9162f25beaf..519ec6b841e7 100644 --- a/include/rdma/ib_pack.h +++ b/include/rdma/ib_pack.h @@ -84,6 +84,7 @@ enum { /* opcode 0x15 is reserved */ IB_OPCODE_SEND_LAST_WITH_INVALIDATE = 0x16, IB_OPCODE_SEND_ONLY_WITH_INVALIDATE = 0x17, + IB_OPCODE_RDMA_ATOMIC_WRITE = 0x1D, /* real constants follow -- see comment about above IB_OPCODE() macro for more details */ @@ -112,6 +113,7 @@ enum { IB_OPCODE(RC, FETCH_ADD), IB_OPCODE(RC, SEND_LAST_WITH_INVALIDATE), IB_OPCODE(RC, SEND_ONLY_WITH_INVALIDATE), + IB_OPCODE(RC, RDMA_ATOMIC_WRITE), /* UC */ IB_OPCODE(UC, SEND_FIRST), diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index b3bb4dd068b6..18d706892e97 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -985,6 +985,7 @@ enum ib_wc_opcode { IB_WC_REG_MR, IB_WC_MASKED_COMP_SWAP, IB_WC_MASKED_FETCH_ADD, + IB_WC_RDMA_ATOMIC_WRITE = IB_UVERBS_WC_RDMA_ATOMIC_WRITE, /* * Set value of IB_WC_RECV so consumers can test if a completion is a * receive by testing (opcode & IB_WC_RECV). @@ -1325,6 +1326,7 @@ enum ib_wr_opcode { IB_UVERBS_WR_MASKED_ATOMIC_CMP_AND_SWP, IB_WR_MASKED_ATOMIC_FETCH_AND_ADD = IB_UVERBS_WR_MASKED_ATOMIC_FETCH_AND_ADD, + IB_WR_RDMA_ATOMIC_WRITE = IB_UVERBS_WR_RDMA_ATOMIC_WRITE, /* These are kernel only and can not be issued by userspace */ IB_WR_REG_MR = 0x20, diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h index 7dd903d932e5..175ade79e358 100644 --- a/include/uapi/rdma/ib_user_verbs.h +++ b/include/uapi/rdma/ib_user_verbs.h @@ -466,6 +466,7 @@ enum ib_uverbs_wc_opcode { IB_UVERBS_WC_BIND_MW = 5, IB_UVERBS_WC_LOCAL_INV = 6, IB_UVERBS_WC_TSO = 7, + IB_UVERBS_WC_RDMA_ATOMIC_WRITE = 9, }; struct ib_uverbs_wc { @@ -784,6 +785,7 @@ enum ib_uverbs_wr_opcode { IB_UVERBS_WR_RDMA_READ_WITH_INV = 11, IB_UVERBS_WR_MASKED_ATOMIC_CMP_AND_SWP = 12, IB_UVERBS_WR_MASKED_ATOMIC_FETCH_AND_ADD = 13, + IB_UVERBS_WR_RDMA_ATOMIC_WRITE = 15, /* Review enum ib_wr_opcode before modifying this */ }; diff --git a/include/uapi/rdma/rdma_user_rxe.h b/include/uapi/rdma/rdma_user_rxe.h index f09c5c9e3dd5..845da9cb04fd 100644 --- a/include/uapi/rdma/rdma_user_rxe.h +++ b/include/uapi/rdma/rdma_user_rxe.h @@ -86,6 +86,7 @@ struct rxe_send_wr { __aligned_u64 remote_addr; __u32 rkey; __u32 reserved; + __u8 atomic_wr[8]; } rdma; struct { __aligned_u64 remote_addr; -- 2.34.1 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v4 3/3] RDMA/rxe: Add RDMA Atomic Write attribute for rxe device 2022-04-18 6:12 [PATCH v4 0/3] RDMA/rxe: Add RDMA Atomic Write operation Xiao Yang 2022-04-18 6:12 ` [PATCH v4 1/3] RDMA/rxe: Rename send_atomic_ack() and atomic member of struct resp_res Xiao Yang 2022-04-18 6:12 ` [PATCH v4 2/3] RDMA/rxe: Support RDMA Atomic Write operation Xiao Yang @ 2022-04-18 6:12 ` Xiao Yang 2022-04-20 6:54 ` [PATCH v4 0/3] RDMA/rxe: Add RDMA Atomic Write operation Leon Romanovsky ` (2 subsequent siblings) 5 siblings, 0 replies; 12+ messages in thread From: Xiao Yang @ 2022-04-18 6:12 UTC (permalink / raw) To: linux-rdma Cc: yanjun.zhu, rpearsonhpe, jgg, y-goto, lizhijian, tomasz.gromadzki, ira.weiny, Xiao Yang The attribute shows that rxe device supports RDMA Atomic Write operation. Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com> --- drivers/infiniband/sw/rxe/rxe_param.h | 5 +++++ include/rdma/ib_verbs.h | 1 + include/uapi/rdma/ib_user_verbs.h | 2 ++ 3 files changed, 8 insertions(+) diff --git a/drivers/infiniband/sw/rxe/rxe_param.h b/drivers/infiniband/sw/rxe/rxe_param.h index 568a7cbd13d4..05796f4007cb 100644 --- a/drivers/infiniband/sw/rxe/rxe_param.h +++ b/drivers/infiniband/sw/rxe/rxe_param.h @@ -51,7 +51,12 @@ enum rxe_device_param { | IB_DEVICE_SRQ_RESIZE | IB_DEVICE_MEM_MGT_EXTENSIONS | IB_DEVICE_MEM_WINDOW +#ifdef CONFIG_64BIT + | IB_DEVICE_MEM_WINDOW_TYPE_2B + | IB_DEVICE_ATOMIC_WRITE, +#else | IB_DEVICE_MEM_WINDOW_TYPE_2B, +#endif /* CONFIG_64BIT */ RXE_MAX_SGE = 32, RXE_MAX_WQE_SIZE = sizeof(struct rxe_send_wqe) + sizeof(struct ib_sge) * RXE_MAX_SGE, diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 18d706892e97..f5f81e5d1179 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -270,6 +270,7 @@ enum ib_device_cap_flags { /* The device supports padding incoming writes to cacheline. */ IB_DEVICE_PCI_WRITE_END_PADDING = IB_UVERBS_DEVICE_PCI_WRITE_END_PADDING, + IB_DEVICE_ATOMIC_WRITE = IB_UVERBS_DEVICE_ATOMIC_WRITE, }; enum ib_kernel_cap_flags { diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h index 175ade79e358..4a7dbabf1792 100644 --- a/include/uapi/rdma/ib_user_verbs.h +++ b/include/uapi/rdma/ib_user_verbs.h @@ -1333,6 +1333,8 @@ enum ib_uverbs_device_cap_flags { /* Deprecated. Please use IB_UVERBS_RAW_PACKET_CAP_SCATTER_FCS. */ IB_UVERBS_DEVICE_RAW_SCATTER_FCS = 1ULL << 34, IB_UVERBS_DEVICE_PCI_WRITE_END_PADDING = 1ULL << 36, + /* Atomic write attributes */ + IB_UVERBS_DEVICE_ATOMIC_WRITE = 1ULL << 40, }; enum ib_uverbs_raw_packet_caps { -- 2.34.1 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v4 0/3] RDMA/rxe: Add RDMA Atomic Write operation 2022-04-18 6:12 [PATCH v4 0/3] RDMA/rxe: Add RDMA Atomic Write operation Xiao Yang ` (2 preceding siblings ...) 2022-04-18 6:12 ` [PATCH v4 3/3] RDMA/rxe: Add RDMA Atomic Write attribute for rxe device Xiao Yang @ 2022-04-20 6:54 ` Leon Romanovsky 2022-04-20 7:08 ` yangx.jy 2022-05-13 3:46 ` yangx.jy 2022-07-04 13:45 ` Jason Gunthorpe 5 siblings, 1 reply; 12+ messages in thread From: Leon Romanovsky @ 2022-04-20 6:54 UTC (permalink / raw) To: Xiao Yang Cc: linux-rdma, yanjun.zhu, rpearsonhpe, jgg, y-goto, lizhijian, tomasz.gromadzki, ira.weiny On Mon, Apr 18, 2022 at 02:12:41PM +0800, Xiao Yang wrote: > The IB SPEC v1.5[1] defined new RDMA Atomic Write operation. This > patchset makes SoftRoCE support new RDMA Atomic Write on RC service. > > I add ibv_wr_rdma_atomic_write() and a rdma_atomic_write example on my > rdma-core repository[2]. You can verify the patchset by building and > running the rdma_atomic_write example. > server: > $ ./rdma_atomic_write_server -s [server_address] -p [port_number] > client: > $ ./rdma_atomic_write_client -s [server_address] -p [port_number] We need PR to official rdma-core repo with pyverbs test to consider this code for merge. Thanks > > [1]: https://www.infinibandta.org/wp-content/uploads/2021/08/IBTA-Overview-of-IBTA-Volume-1-Release-1.5-and-MPE-2021-08-17-Secure.pptx > [2]: https://github.com/yangx-jy/rdma-core/tree/new_api_with_point > > v3->v4: > 1) Rebase on current wip/jgg-for-next > 2) Fix a compiler error on 32-bit arch (e.g. parisc) by disabling RDMA Atomic Write > 3) Replace 64-bit value with 8-byte array for RDMA Atomic Write > > V2->V3: > 1) Rebase > 2) Add RDMA Atomic Write attribute for rxe device > > V1->V2: > 1) Set IB_OPCODE_RDMA_ATOMIC_WRITE to 0x1D > 2) Add rdma.atomic_wr in struct rxe_send_wr and use it to pass the atomic write value > 3) Use smp_store_release() to ensure that all prior operations have completed > > Xiao Yang (3): > RDMA/rxe: Rename send_atomic_ack() and atomic member of struct > resp_res > RDMA/rxe: Support RDMA Atomic Write operation > RDMA/rxe: Add RDMA Atomic Write attribute for rxe device > > drivers/infiniband/sw/rxe/rxe_comp.c | 4 ++ > drivers/infiniband/sw/rxe/rxe_opcode.c | 19 ++++++++ > drivers/infiniband/sw/rxe/rxe_opcode.h | 3 ++ > drivers/infiniband/sw/rxe/rxe_param.h | 5 +++ > drivers/infiniband/sw/rxe/rxe_qp.c | 4 +- > drivers/infiniband/sw/rxe/rxe_req.c | 13 +++++- > drivers/infiniband/sw/rxe/rxe_resp.c | 61 ++++++++++++++++++++------ > drivers/infiniband/sw/rxe/rxe_verbs.h | 2 +- > include/rdma/ib_pack.h | 2 + > include/rdma/ib_verbs.h | 3 ++ > include/uapi/rdma/ib_user_verbs.h | 4 ++ > include/uapi/rdma/rdma_user_rxe.h | 1 + > 12 files changed, 103 insertions(+), 18 deletions(-) > > -- > 2.34.1 > > > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v4 0/3] RDMA/rxe: Add RDMA Atomic Write operation 2022-04-20 6:54 ` [PATCH v4 0/3] RDMA/rxe: Add RDMA Atomic Write operation Leon Romanovsky @ 2022-04-20 7:08 ` yangx.jy 2022-04-27 7:46 ` yangx.jy 0 siblings, 1 reply; 12+ messages in thread From: yangx.jy @ 2022-04-20 7:08 UTC (permalink / raw) To: Leon Romanovsky Cc: linux-rdma, yanjun.zhu, rpearsonhpe, jgg, y-goto, lizhijian, tomasz.gromadzki, ira.weiny On 2022/4/20 14:54, Leon Romanovsky wrote: > We need PR to official rdma-core repo with pyverbs test to consider this > code for merge. Hi Leon, Thanks for your suggestion. I will write the corresponding pyverbs test recently. ^_^ Best Regards, Xiao Yang > > Thanks ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v4 0/3] RDMA/rxe: Add RDMA Atomic Write operation 2022-04-20 7:08 ` yangx.jy @ 2022-04-27 7:46 ` yangx.jy 0 siblings, 0 replies; 12+ messages in thread From: yangx.jy @ 2022-04-27 7:46 UTC (permalink / raw) To: Leon Romanovsky Cc: linux-rdma, yanjun.zhu, rpearsonhpe, jgg, y-goto, lizhijian, tomasz.gromadzki, ira.weiny On 2022/4/20 15:08, yangx.jy@fujitsu.com wrote: > On 2022/4/20 14:54, Leon Romanovsky wrote: >> We need PR to official rdma-core repo with pyverbs test to consider this >> code for merge. > Hi Leon, > > Thanks for your suggestion. > I will write the corresponding pyverbs test recently. ^_^ > > Best Regards, > Xiao Yang Hi Leon, Others I have introduced RDMA Atomic Write API for pyverbs and added a corresponding python test on my rdma-core repo. # bin/run_tests.py --dev rxe_enp0s3 --gid 1 -v tests.test_qpex.QpExTestCase.test_qp_ex_rc_rdma_atomic_write test_qp_ex_rc_rdma_atomic_write (tests.test_qpex.QpExTestCase) ... ok ---------------------------------------------------------------------- Ran 1 test in 0.004s OK I hope you and others can review both kernel patch set and library patch set. Thanks a lot. Best Regards, Xiao Yang >> >> Thanks ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v4 0/3] RDMA/rxe: Add RDMA Atomic Write operation 2022-04-18 6:12 [PATCH v4 0/3] RDMA/rxe: Add RDMA Atomic Write operation Xiao Yang ` (3 preceding siblings ...) 2022-04-20 6:54 ` [PATCH v4 0/3] RDMA/rxe: Add RDMA Atomic Write operation Leon Romanovsky @ 2022-05-13 3:46 ` yangx.jy 2022-05-13 11:46 ` Jason Gunthorpe 2022-07-04 13:45 ` Jason Gunthorpe 5 siblings, 1 reply; 12+ messages in thread From: yangx.jy @ 2022-05-13 3:46 UTC (permalink / raw) To: linux-rdma Cc: yanjun.zhu, rpearsonhpe, jgg, y-goto, lizhijian, tomasz.gromadzki, ira.weiny Hi All, Ping. ^_^ Are there more comments on this patch set? Best Regards, Xiao Yang On 2022/4/18 14:12, Xiao Yang wrote: > The IB SPEC v1.5[1] defined new RDMA Atomic Write operation. This > patchset makes SoftRoCE support new RDMA Atomic Write on RC service. > > I add ibv_wr_rdma_atomic_write() and a rdma_atomic_write example on my > rdma-core repository[2]. You can verify the patchset by building and > running the rdma_atomic_write example. > server: > $ ./rdma_atomic_write_server -s [server_address] -p [port_number] > client: > $ ./rdma_atomic_write_client -s [server_address] -p [port_number] > > [1]: https://www.infinibandta.org/wp-content/uploads/2021/08/IBTA-Overview-of-IBTA-Volume-1-Release-1.5-and-MPE-2021-08-17-Secure.pptx > [2]: https://github.com/yangx-jy/rdma-core/tree/new_api_with_point > > v3->v4: > 1) Rebase on current wip/jgg-for-next > 2) Fix a compiler error on 32-bit arch (e.g. parisc) by disabling RDMA Atomic Write > 3) Replace 64-bit value with 8-byte array for RDMA Atomic Write > > V2->V3: > 1) Rebase > 2) Add RDMA Atomic Write attribute for rxe device > > V1->V2: > 1) Set IB_OPCODE_RDMA_ATOMIC_WRITE to 0x1D > 2) Add rdma.atomic_wr in struct rxe_send_wr and use it to pass the atomic write value > 3) Use smp_store_release() to ensure that all prior operations have completed > > Xiao Yang (3): > RDMA/rxe: Rename send_atomic_ack() and atomic member of struct > resp_res > RDMA/rxe: Support RDMA Atomic Write operation > RDMA/rxe: Add RDMA Atomic Write attribute for rxe device > > drivers/infiniband/sw/rxe/rxe_comp.c | 4 ++ > drivers/infiniband/sw/rxe/rxe_opcode.c | 19 ++++++++ > drivers/infiniband/sw/rxe/rxe_opcode.h | 3 ++ > drivers/infiniband/sw/rxe/rxe_param.h | 5 +++ > drivers/infiniband/sw/rxe/rxe_qp.c | 4 +- > drivers/infiniband/sw/rxe/rxe_req.c | 13 +++++- > drivers/infiniband/sw/rxe/rxe_resp.c | 61 ++++++++++++++++++++------ > drivers/infiniband/sw/rxe/rxe_verbs.h | 2 +- > include/rdma/ib_pack.h | 2 + > include/rdma/ib_verbs.h | 3 ++ > include/uapi/rdma/ib_user_verbs.h | 4 ++ > include/uapi/rdma/rdma_user_rxe.h | 1 + > 12 files changed, 103 insertions(+), 18 deletions(-) > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v4 0/3] RDMA/rxe: Add RDMA Atomic Write operation 2022-05-13 3:46 ` yangx.jy @ 2022-05-13 11:46 ` Jason Gunthorpe 2022-05-13 15:45 ` Bob Pearson 0 siblings, 1 reply; 12+ messages in thread From: Jason Gunthorpe @ 2022-05-13 11:46 UTC (permalink / raw) To: yangx.jy Cc: linux-rdma, yanjun.zhu, rpearsonhpe, y-goto, lizhijian, tomasz.gromadzki, ira.weiny On Fri, May 13, 2022 at 03:46:00AM +0000, yangx.jy@fujitsu.com wrote: > Hi All, > > Ping. ^_^ > Are there more comments on this patch set? I think I said this already, but I'm waiting for all the rxe regressions to be fixed before looking any new rxe patches. Jason ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v4 0/3] RDMA/rxe: Add RDMA Atomic Write operation 2022-05-13 11:46 ` Jason Gunthorpe @ 2022-05-13 15:45 ` Bob Pearson 0 siblings, 0 replies; 12+ messages in thread From: Bob Pearson @ 2022-05-13 15:45 UTC (permalink / raw) To: Jason Gunthorpe, yangx.jy Cc: linux-rdma, yanjun.zhu, y-goto, lizhijian, tomasz.gromadzki, ira.weiny On 5/13/22 06:46, Jason Gunthorpe wrote: > On Fri, May 13, 2022 at 03:46:00AM +0000, yangx.jy@fujitsu.com wrote: >> Hi All, >> >> Ping. ^_^ >> Are there more comments on this patch set? > > I think I said this already, but I'm waiting for all the rxe > regressions to be fixed before looking any new rxe patches. > > Jason I am working on them. I am trying to reproduce Bart's claim that he saw the blktests hangs go away with a merge of head of tree. Bob ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v4 0/3] RDMA/rxe: Add RDMA Atomic Write operation 2022-04-18 6:12 [PATCH v4 0/3] RDMA/rxe: Add RDMA Atomic Write operation Xiao Yang ` (4 preceding siblings ...) 2022-05-13 3:46 ` yangx.jy @ 2022-07-04 13:45 ` Jason Gunthorpe 2022-07-05 1:50 ` yangx.jy 5 siblings, 1 reply; 12+ messages in thread From: Jason Gunthorpe @ 2022-07-04 13:45 UTC (permalink / raw) To: Xiao Yang Cc: linux-rdma, yanjun.zhu, rpearsonhpe, y-goto, lizhijian, tomasz.gromadzki, ira.weiny On Mon, Apr 18, 2022 at 02:12:41PM +0800, Xiao Yang wrote: > The IB SPEC v1.5[1] defined new RDMA Atomic Write operation. This > patchset makes SoftRoCE support new RDMA Atomic Write on RC service. This series doesn't apply cleanly, please rebase it and re-tet it. Did you make pyverbs coverage for this? Jason ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v4 0/3] RDMA/rxe: Add RDMA Atomic Write operation 2022-07-04 13:45 ` Jason Gunthorpe @ 2022-07-05 1:50 ` yangx.jy 0 siblings, 0 replies; 12+ messages in thread From: yangx.jy @ 2022-07-05 1:50 UTC (permalink / raw) To: Jason Gunthorpe Cc: linux-rdma, yanjun.zhu, rpearsonhpe, y-goto, lizhijian, tomasz.gromadzki, ira.weiny On 2022/7/4 21:45, Jason Gunthorpe wrote: > On Mon, Apr 18, 2022 at 02:12:41PM +0800, Xiao Yang wrote: >> The IB SPEC v1.5[1] defined new RDMA Atomic Write operation. This >> patchset makes SoftRoCE support new RDMA Atomic Write on RC service. > > This series doesn't apply cleanly, please rebase it and re-tet it. Hi Jason, Sure, I will rebase and retest it soon. > > Did you make pyverbs coverage for this? Yes, I have added a pyverbs API and test for RDMA Atomic Write. See the following PR: https://github.com/linux-rdma/rdma-core/pull/1179 BTW, I will check if this PR needs to be rebased as well. Best Regards, Xiao Yang > > Jason ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2022-07-05 1:51 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-04-18 6:12 [PATCH v4 0/3] RDMA/rxe: Add RDMA Atomic Write operation Xiao Yang 2022-04-18 6:12 ` [PATCH v4 1/3] RDMA/rxe: Rename send_atomic_ack() and atomic member of struct resp_res Xiao Yang 2022-04-18 6:12 ` [PATCH v4 2/3] RDMA/rxe: Support RDMA Atomic Write operation Xiao Yang 2022-04-18 6:12 ` [PATCH v4 3/3] RDMA/rxe: Add RDMA Atomic Write attribute for rxe device Xiao Yang 2022-04-20 6:54 ` [PATCH v4 0/3] RDMA/rxe: Add RDMA Atomic Write operation Leon Romanovsky 2022-04-20 7:08 ` yangx.jy 2022-04-27 7:46 ` yangx.jy 2022-05-13 3:46 ` yangx.jy 2022-05-13 11:46 ` Jason Gunthorpe 2022-05-13 15:45 ` Bob Pearson 2022-07-04 13:45 ` Jason Gunthorpe 2022-07-05 1:50 ` yangx.jy
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.