From patchwork Sun Sep 30 09:51:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lijun Ou X-Patchwork-Id: 10621373 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 533F716B1 for ; Sun, 30 Sep 2018 09:14:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43EA62991C for ; Sun, 30 Sep 2018 09:14:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3879629922; Sun, 30 Sep 2018 09:14:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA3CE2991C for ; Sun, 30 Sep 2018 09:14:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727861AbeI3Pqf (ORCPT ); Sun, 30 Sep 2018 11:46:35 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:13588 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727818AbeI3Pqf (ORCPT ); Sun, 30 Sep 2018 11:46:35 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 54EAF677AFAE0; Sun, 30 Sep 2018 17:14:21 +0800 (CST) Received: from linux-ioko.site (10.71.200.31) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.399.0; Sun, 30 Sep 2018 17:14:18 +0800 From: Lijun Ou To: , CC: , Subject: [PATCH rdma-core 1/2] libhns: Add local invalidate MR support for hip08 Date: Sun, 30 Sep 2018 17:51:36 +0800 Message-ID: <1538301097-95641-2-git-send-email-oulijun@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1538301097-95641-1-git-send-email-oulijun@huawei.com> References: <1538301097-95641-1-git-send-email-oulijun@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.71.200.31] X-CFilter-Loop: Reflected Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds local invalidate memory region (MR) support in the user space driver. Signed-off-by: Yangyang Li Signed-off-by: Lijun Ou --- providers/hns/hns_roce_u_hw_v2.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c index 04e7417..b155c3d 100644 --- a/providers/hns/hns_roce_u_hw_v2.c +++ b/providers/hns/hns_roce_u_hw_v2.c @@ -668,6 +668,16 @@ static int hns_roce_u_v2_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr, HNS_ROCE_WQE_OP_SEND_WITH_IMM); break; + case IBV_WR_LOCAL_INV: + roce_set_field(rc_sq_wqe->byte_4, + RC_SQ_WQE_BYTE_4_OPCODE_M, + RC_SQ_WQE_BYTE_4_OPCODE_S, + HNS_ROCE_WQE_OP_LOCAL_INV); + roce_set_bit(rc_sq_wqe->byte_4, + RC_SQ_WQE_BYTE_4_SO_S, 1); + rc_sq_wqe->inv_key = + htole32(wr->invalidate_rkey); + break; case IBV_WR_ATOMIC_CMP_AND_SWP: roce_set_field(rc_sq_wqe->byte_4, RC_SQ_WQE_BYTE_4_OPCODE_M, From patchwork Sun Sep 30 09:51:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lijun Ou X-Patchwork-Id: 10621371 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9155D16B1 for ; Sun, 30 Sep 2018 09:14:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82A202991D for ; Sun, 30 Sep 2018 09:14:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 773B929927; Sun, 30 Sep 2018 09:14:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A8F929922 for ; Sun, 30 Sep 2018 09:14:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727829AbeI3Pqg (ORCPT ); Sun, 30 Sep 2018 11:46:36 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:13590 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727852AbeI3Pqf (ORCPT ); Sun, 30 Sep 2018 11:46:35 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 58F3DEFD57069; Sun, 30 Sep 2018 17:14:21 +0800 (CST) Received: from linux-ioko.site (10.71.200.31) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.399.0; Sun, 30 Sep 2018 17:14:18 +0800 From: Lijun Ou To: , CC: , Subject: [PATCH rdma-core 2/2] libhns: Bugfix for atomic operation in user mode Date: Sun, 30 Sep 2018 17:51:37 +0800 Message-ID: <1538301097-95641-3-git-send-email-oulijun@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1538301097-95641-1-git-send-email-oulijun@huawei.com> References: <1538301097-95641-1-git-send-email-oulijun@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.71.200.31] X-CFilter-Loop: Reflected Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The atomic operation not support to inline. Besides, the standard atomic operation only support a sge and the sge place in wqe. This patch mainly ajdust the code. Fix: d92b0f5("libhns: Add atomic support for hip08 user mode") Signed-off-by: Lijun Ou --- providers/hns/hns_roce_u_hw_v2.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c index b155c3d..449b6cb 100644 --- a/providers/hns/hns_roce_u_hw_v2.c +++ b/providers/hns/hns_roce_u_hw_v2.c @@ -686,8 +686,6 @@ static int hns_roce_u_v2_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr, rc_sq_wqe->rkey = htole32(wr->wr.atomic.rkey); rc_sq_wqe->va = htole64(wr->wr.atomic.remote_addr); - wqe += sizeof(struct hns_roce_v2_wqe_data_seg); - set_atomic_seg(wqe, wr); break; case IBV_WR_ATOMIC_FETCH_AND_ADD: @@ -698,8 +696,6 @@ static int hns_roce_u_v2_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr, rc_sq_wqe->rkey = htole32(wr->wr.atomic.rkey); rc_sq_wqe->va = htole64(wr->wr.atomic.remote_addr); - wqe += sizeof(struct hns_roce_v2_wqe_data_seg); - set_atomic_seg(wqe, wr); break; default: roce_set_field(rc_sq_wqe->byte_4, @@ -718,14 +714,13 @@ static int hns_roce_u_v2_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr, break; } + dseg = wqe; if (wr->opcode == IBV_WR_ATOMIC_FETCH_AND_ADD || - wr->opcode == IBV_WR_ATOMIC_CMP_AND_SWP) - dseg = wqe - sizeof(struct hns_roce_v2_wqe_data_seg); - else - dseg = wqe; - - /* Inline */ - if (wr->send_flags & IBV_SEND_INLINE && wr->num_sge) { + wr->opcode == IBV_WR_ATOMIC_CMP_AND_SWP) { + set_data_seg_v2(dseg, wr->sg_list); + wqe += sizeof(struct hns_roce_v2_wqe_data_seg); + set_atomic_seg(wqe, wr); + } else if (wr->send_flags & IBV_SEND_INLINE && wr->num_sge) { if (le32toh(rc_sq_wqe->msg_len) > qp->max_inline_data) { ret = EINVAL; *bad_wr = wr;