From patchwork Tue Jul 1 05:54:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devesh Sharma X-Patchwork-Id: 4456701 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DDA8FBEEAA for ; Tue, 1 Jul 2014 06:30:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2AACC20412 for ; Tue, 1 Jul 2014 06:30:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 592AE20411 for ; Tue, 1 Jul 2014 06:30:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751074AbaGAGab (ORCPT ); Tue, 1 Jul 2014 02:30:31 -0400 Received: from cmexedge1.ext.emulex.com ([138.239.224.99]:57916 "EHLO CMEXEDGE1.ext.emulex.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752003AbaGAGab (ORCPT ); Tue, 1 Jul 2014 02:30:31 -0400 Received: from CMEXHTCAS1.ad.emulex.com (138.239.115.217) by CMEXEDGE1.ext.emulex.com (138.239.224.99) with Microsoft SMTP Server (TLS) id 14.3.174.1; Mon, 30 Jun 2014 23:31:03 -0700 Received: from neo01-el64.lab.bg.emulex.com (10.192.204.8) by smtp.emulex.com (138.239.115.207) with Microsoft SMTP Server id 14.3.174.1; Mon, 30 Jun 2014 23:30:27 -0700 From: Devesh Sharma To: CC: Devesh Sharma , Mitesh Ahuja Subject: [for-next 2/4] RDMA/libocrdma: do not allow RDMA on UD QP Date: Tue, 1 Jul 2014 11:24:03 +0530 X-Mailer: git-send-email 1.7.1 In-Reply-To: <1404194045-26900-1-git-send-email-devesh.sharma@emulex.com> References: <1404194045-26900-1-git-send-email-devesh.sharma@emulex.com> MIME-Version: 1.0 Message-ID: <0de644e0-1c42-4f35-a32b-507c11df810e@CMEXHTCAS1.ad.emulex.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 As per IB compilance it is not allowed to post RDMA operations on a UD QP. This patch is adding a compilance check and if any violation is detected -EINVAL is returned. Signed-off-by: Devesh Sharma Signed-off-by: Mitesh Ahuja --- src/ocrdma_verbs.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/ocrdma_verbs.c b/src/ocrdma_verbs.c index 0f138cf..a5b7252 100644 --- a/src/ocrdma_verbs.c +++ b/src/ocrdma_verbs.c @@ -1395,6 +1395,14 @@ int ocrdma_post_send(struct ibv_qp *ib_qp, struct ibv_send_wr *wr, } while (wr) { + + if (qp->qp_type == IBV_QPT_UD && (wr->opcode != IBV_WR_SEND && + wr->opcode != IBV_WR_SEND_WITH_IMM)) { + *bad_wr = wr; + status = -EINVAL; + break; + } + if (ocrdma_hwq_free_cnt(&qp->sq) == 0 || wr->num_sge > qp->sq.max_sges) { *bad_wr = wr;