From patchwork Thu Feb 25 07:50:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devesh Sharma X-Patchwork-Id: 8420201 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 107E0C0553 for ; Thu, 25 Feb 2016 07:50:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4C6CD20265 for ; Thu, 25 Feb 2016 07:50:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5FB352034A for ; Thu, 25 Feb 2016 07:50:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758272AbcBYHux (ORCPT ); Thu, 25 Feb 2016 02:50:53 -0500 Received: from cmrelayp1.emulex.com ([138.239.112.140]:52335 "EHLO CMRELAYP1.ad.emulex.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1758002AbcBYHux (ORCPT ); Thu, 25 Feb 2016 02:50:53 -0500 Received: from neo01-el71.iig.avagotech.net ([10.192.204.61]) by CMRELAYP1.ad.emulex.com with Microsoft SMTPSVC(7.5.7601.17514); Wed, 24 Feb 2016 23:51:02 -0800 From: Devesh Sharma To: linux-rdma@vger.kernel.org Cc: Devesh Sharma Subject: [PATCH 1/4] RDMA/libocrdma: Add user space support for RoCE-v2 Date: Thu, 25 Feb 2016 02:50:44 -0500 Message-Id: <1456386647-22315-2-git-send-email-devesh.sharma@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1456386647-22315-1-git-send-email-devesh.sharma@broadcom.com> References: <1456386647-22315-1-git-send-email-devesh.sharma@broadcom.com> X-OriginalArrivalTime: 25 Feb 2016 07:51:02.0348 (UTC) FILETIME=[45E490C0:01D16FA1] Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP RoCE-v2 is a recently added extension to original RoCE protocol it uses UDP encapsulation to achieve routability of RoCE packets. This patch avails RoCE-v2 for userland applications. Signed-off-by: Devesh Sharma --- src/ocrdma_abi.h | 2 +- src/ocrdma_main.h | 5 ++++- src/ocrdma_verbs.c | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ocrdma_abi.h b/src/ocrdma_abi.h index 8102c1c..8670a1d 100644 --- a/src/ocrdma_abi.h +++ b/src/ocrdma_abi.h @@ -350,7 +350,7 @@ struct ocrdma_ewqe_ud_hdr { uint32_t rsvd_dest_qpn; uint32_t qkey; uint32_t rsvd_ahid; - uint32_t rsvd; + uint32_t hdr_type; } __attribute__ ((packed)); #endif /* __OCRDMA_ABI_H__ */ diff --git a/src/ocrdma_main.h b/src/ocrdma_main.h index 4e7be75..c81188b 100644 --- a/src/ocrdma_main.h +++ b/src/ocrdma_main.h @@ -214,7 +214,9 @@ struct ocrdma_qp { enum { OCRDMA_AH_ID_MASK = 0x3FF, OCRDMA_AH_VLAN_VALID_MASK = 0x01, - OCRDMA_AH_VLAN_VALID_SHIFT = 0x1F + OCRDMA_AH_VLAN_VALID_SHIFT = 0x1F, + OCRDMA_AH_L3_TYPE_MASK = 0x03, + OCRDMA_AH_L3_TYPE_SHIFT = 0x1D }; struct ocrdma_ah { @@ -222,6 +224,7 @@ struct ocrdma_ah { struct ocrdma_pd *pd; uint16_t id; uint8_t isvlan; + uint8_t hdr_type; }; #define get_ocrdma_xxx(xxx, type) \ diff --git a/src/ocrdma_verbs.c b/src/ocrdma_verbs.c index cf6f72c..c62ced0 100644 --- a/src/ocrdma_verbs.c +++ b/src/ocrdma_verbs.c @@ -1199,6 +1199,7 @@ static void ocrdma_build_ud_hdr(struct ocrdma_qp *qp, if (ah->isvlan) hdr->cw |= (OCRDMA_FLAG_AH_VLAN_PR << OCRDMA_WQE_FLAGS_SHIFT); + ud_hdr->hdr_type = ah->hdr_type; } static void ocrdma_build_sges(struct ocrdma_hdr_wqe *hdr, @@ -2159,6 +2160,9 @@ struct ibv_ah *ocrdma_create_ah(struct ibv_pd *ibpd, struct ibv_ah_attr *attr) ah->id = pd->uctx->ah_tbl[ahtbl_idx] & OCRDMA_AH_ID_MASK; ah->isvlan = (pd->uctx->ah_tbl[ahtbl_idx] >> OCRDMA_AH_VLAN_VALID_SHIFT); + ah->hdr_type = ((pd->uctx->ah_tbl[ahtbl_idx] >> OCRDMA_AH_L3_TYPE_SHIFT) + & OCRDMA_AH_L3_TYPE_MASK); + return &ah->ibv_ah; cmd_err: ocrdma_free_ah_tbl_id(pd->uctx, ahtbl_idx);