From patchwork Wed Sep 6 15:11:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 9940985 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B711D60216 for ; Wed, 6 Sep 2017 15:14:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9ED328AC3 for ; Wed, 6 Sep 2017 15:14:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E88320007; Wed, 6 Sep 2017 15:14:36 +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=-6.9 required=2.0 tests=BAYES_00, 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 E656928C15 for ; Wed, 6 Sep 2017 15:14:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932718AbdIFPOe (ORCPT ); Wed, 6 Sep 2017 11:14:34 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:42890 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932657AbdIFPOd (ORCPT ); Wed, 6 Sep 2017 11:14:33 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 6 Sep 2017 18:12:21 +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 v86FCLno005123; Wed, 6 Sep 2017 18:12:21 +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 v86FCLrB022821; Wed, 6 Sep 2017 18:12:21 +0300 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id v86FCKkQ022820; Wed, 6 Sep 2017 18:12:20 +0300 From: Yishai Hadas To: linux-rdma@vger.kernel.org Cc: yishaih@mellanox.com, maorg@mellanox.com, majd@mellanox.com Subject: [PATCH rdma-core] verbs: Add support for delay drop ability in a WQ Date: Wed, 6 Sep 2017 18:11:57 +0300 Message-Id: <1504710717-22707-1-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 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: Maor Gottlieb Work queue which is created with IBV_WQ_FLAGS_DELAY_DROP won't cause packet drops when there aren't receive WQEs, but will wait until posting of receive WQEs or for some period of time that the device was configured with. Signed-off-by: Maor Gottlieb Reviewed-by: Yishai Hadas --- This patch is the supplementary part of the kernel code that was accepted upstream into 4.14. PR was sent: https://github.com/linux-rdma/rdma-core/pull/213 libibverbs/examples/devinfo.c | 2 ++ libibverbs/man/ibv_create_wq.3 | 7 ++++--- libibverbs/verbs.h | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/libibverbs/examples/devinfo.c b/libibverbs/examples/devinfo.c index 2c1e3f1..f03c53e 100644 --- a/libibverbs/examples/devinfo.c +++ b/libibverbs/examples/devinfo.c @@ -410,6 +410,8 @@ static void print_raw_packet_caps(uint32_t raw_packet_caps) printf("\t\t\t\t\tScatter FCS offload\n"); if (raw_packet_caps & IBV_RAW_PACKET_CAP_IP_CSUM) printf("\t\t\t\t\tIP csum offload\n"); + if (raw_packet_caps & IBV_RAW_PACKET_CAP_DELAY_DROP) + printf("\t\t\t\t\tDelay drop\n"); } static int print_hca_cap(struct ibv_device *ib_dev, uint8_t ib_port) diff --git a/libibverbs/man/ibv_create_wq.3 b/libibverbs/man/ibv_create_wq.3 index 4a8b83c..a540130 100644 --- a/libibverbs/man/ibv_create_wq.3 +++ b/libibverbs/man/ibv_create_wq.3 @@ -39,9 +39,10 @@ uint32_t create_flags /* Creation flags for this WQ, use en .nf enum ibv_wq_flags { .in +8 -IBV_WQ_FLAGS_CVLAN_STRIPPING = 1 << 0, /* CVLAN field will be stripped from incoming packets */ -IBV_WQ_FLAGS_SCATTER_FCS = 1 << 1, /* FCS field will be scattered to host memory */ -IBV_WQ_FLAGS_RESERVED = 1 << 2, +IBV_WQ_FLAGS_CVLAN_STRIPPING = 1 << 0, /* CVLAN field will be stripped from incoming packets */ +IBV_WQ_FLAGS_SCATTER_FCS = 1 << 1, /* FCS field will be scattered to host memory */ +IBV_WQ_FLAGS_DELAY_DROP = 1 << 2, /* Packets won't be dropped immediately if no receive WQEs */ +IBV_WQ_FLAGS_RESERVED = 1 << 3, .in -8 }; .nf diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index 922a011..9050e3d 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -257,6 +257,7 @@ enum ibv_raw_packet_caps { IBV_RAW_PACKET_CAP_CVLAN_STRIPPING = 1 << 0, IBV_RAW_PACKET_CAP_SCATTER_FCS = 1 << 1, IBV_RAW_PACKET_CAP_IP_CSUM = 1 << 2, + IBV_RAW_PACKET_CAP_DELAY_DROP = 1 << 3, }; struct ibv_device_attr_ex { @@ -682,7 +683,8 @@ enum ibv_wq_init_attr_mask { enum ibv_wq_flags { IBV_WQ_FLAGS_CVLAN_STRIPPING = 1 << 0, IBV_WQ_FLAGS_SCATTER_FCS = 1 << 1, - IBV_WQ_FLAGS_RESERVED = 1 << 2, + IBV_WQ_FLAGS_DELAY_DROP = 1 << 2, + IBV_WQ_FLAGS_RESERVED = 1 << 3, }; struct ibv_wq_init_attr {