From patchwork Tue Aug 14 15:09:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 10565843 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 740D0157B for ; Tue, 14 Aug 2018 15:26:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63F102A276 for ; Tue, 14 Aug 2018 15:26:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61B732A242; Tue, 14 Aug 2018 15:26:57 +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,UNPARSEABLE_RELAY 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 01C052A242 for ; Tue, 14 Aug 2018 15:26:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730759AbeHNSOd (ORCPT ); Tue, 14 Aug 2018 14:14:33 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:47901 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731478AbeHNSOc (ORCPT ); Tue, 14 Aug 2018 14:14:32 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 14 Aug 2018 18:13:24 +0300 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [10.7.2.17]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w7EF9j3Z022866; Tue, 14 Aug 2018 18:09:45 +0300 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [127.0.0.1]) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8) with ESMTP id w7EF9jOQ029932; Tue, 14 Aug 2018 18:09:45 +0300 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id w7EF9je9029931; Tue, 14 Aug 2018 18:09:45 +0300 From: Yishai Hadas To: linux-rdma@vger.kernel.org Cc: yishaih@mellanox.com, jgg@mellanox.com, artemyko@mellanox.com, majd@mellanox.com Subject: [PATCH rdma-core 1/2] verbs: Add IBV_CREATE_CQ_ATTR_IGNORE_OVERRUN support Date: Tue, 14 Aug 2018 18:09:19 +0300 Message-Id: <1534259360-29819-2-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1534259360-29819-1-git-send-email-yishaih@mellanox.com> References: <1534259360-29819-1-git-send-email-yishaih@mellanox.com> 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 From: Artemy Kovalyov When regular CQ attempts to generate a CQE and the CQ is already full overflow occurs and async error is generated. On CQ created with IBV_CREATE_CQ_ATTR_IGNORE_OVERRUN flag overflow check is disabled, error is never generated and CQE always will be written to next entry. Shortening fast-path message receive treatment allows low-latency application to achieve better performance. Signed-off-by: Artemy Kovalyov Signed-off-by: Yishai Hadas --- libibverbs/cmd_cq.c | 3 +++ libibverbs/man/ibv_create_cq_ex.3 | 1 + libibverbs/verbs.h | 1 + 3 files changed, 5 insertions(+) diff --git a/libibverbs/cmd_cq.c b/libibverbs/cmd_cq.c index 73cd2f2..7669518 100644 --- a/libibverbs/cmd_cq.c +++ b/libibverbs/cmd_cq.c @@ -142,6 +142,9 @@ int ibv_cmd_create_cq_ex(struct ibv_context *context, if (cq_attr->wc_flags & IBV_WC_EX_WITH_COMPLETION_TIMESTAMP) flags |= IB_UVERBS_CQ_FLAGS_TIMESTAMP_COMPLETION; + if (cq_attr->flags & IBV_CREATE_CQ_ATTR_IGNORE_OVERRUN) + flags |= IB_UVERBS_CQ_FLAGS_IGNORE_OVERRUN; + return ibv_icmd_create_cq(context, cq_attr->cqe, cq_attr->channel, cq_attr->comp_vector, flags, ibv_cq_ex_to_cq(cq), cmdb); diff --git a/libibverbs/man/ibv_create_cq_ex.3 b/libibverbs/man/ibv_create_cq_ex.3 index 2abdbe4..5d39457 100644 --- a/libibverbs/man/ibv_create_cq_ex.3 +++ b/libibverbs/man/ibv_create_cq_ex.3 @@ -52,6 +52,7 @@ enum ibv_cq_init_attr_mask { enum ibv_create_cq_attr_flags { IBV_CREATE_CQ_ATTR_SINGLE_THREADED = 1 << 0, /* This CQ is used from a single threaded, thus no locking is required */ + IBV_CREATE_CQ_ATTR_IGNORE_OVERRUN = 1 << 1, /* This CQ will not pass to error state if overrun, CQE always will be written to next entry */ }; .SH "Polling an extended CQ" diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index ad44c7d..80b8414 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -1717,6 +1717,7 @@ enum ibv_cq_init_attr_mask { enum ibv_create_cq_attr_flags { IBV_CREATE_CQ_ATTR_SINGLE_THREADED = 1 << 0, + IBV_CREATE_CQ_ATTR_IGNORE_OVERRUN = 1 << 1, }; struct ibv_cq_init_attr_ex {