From patchwork Thu Jun 1 15:47:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 9759951 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 C331A602BF for ; Thu, 1 Jun 2017 15:48:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7CB526256 for ; Thu, 1 Jun 2017 15:48:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AADC4284FC; Thu, 1 Jun 2017 15:48:19 +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 268BF26256 for ; Thu, 1 Jun 2017 15:48:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751651AbdFAPsD (ORCPT ); Thu, 1 Jun 2017 11:48:03 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:54354 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752483AbdFAPsB (ORCPT ); Thu, 1 Jun 2017 11:48:01 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 1 Jun 2017 18:47:43 +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 v51FlhPB001277; Thu, 1 Jun 2017 18:47:43 +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 v51FlhdM014998; Thu, 1 Jun 2017 18:47:43 +0300 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id v51FlggP014997; Thu, 1 Jun 2017 18:47:42 +0300 From: Yishai Hadas To: dledford@redhat.com Cc: linux-rdma@vger.kernel.org, yishaih@mellanox.com, slavash@mellanox.com, majd@mellanox.com Subject: [PATCH rdma-core] verbs: Introduce flow steering drop action Date: Thu, 1 Jun 2017 18:47:14 +0300 Message-Id: <1496332034-14758-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: Slava Shwartsman This flow steering specification identifies a drop flow to the hardware. If user creates a flow only with the drop specification, then all the packets that hit this flow will be dropped, otherwise the hardware will drop only the packets that match the other L2/L3/L4 specifications. Signed-off-by: Slava Shwartsman Reviewed-by: Maor Gottlieb Reviewed-by: Yishai Hadas --- This is the complementary user space part of the kernel code that was merged into 4.12. libibverbs/cmd.c | 3 +++ libibverbs/kern-abi.h | 7 +++++++ libibverbs/man/ibv_create_flow.3 | 1 + libibverbs/verbs.h | 9 ++++++++- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/libibverbs/cmd.c b/libibverbs/cmd.c index 3a5aa4e..7a266ee 100644 --- a/libibverbs/cmd.c +++ b/libibverbs/cmd.c @@ -1823,6 +1823,9 @@ static int ib_spec_to_kern_spec(struct ibv_flow_spec *ib_spec, sizeof(struct ibv_kern_spec_action_tag); kern_spec->flow_tag.tag_id = ib_spec->flow_tag.tag_id; break; + case IBV_FLOW_SPEC_ACTION_DROP: + kern_spec->drop.size = sizeof(struct ibv_kern_spec_action_drop); + break; default: return EINVAL; } diff --git a/libibverbs/kern-abi.h b/libibverbs/kern-abi.h index 448b2e8..8d42faf 100644 --- a/libibverbs/kern-abi.h +++ b/libibverbs/kern-abi.h @@ -938,6 +938,12 @@ struct ibv_kern_spec_tunnel { struct ibv_kern_tunnel_filter mask; }; +struct ibv_kern_spec_action_drop { + __u32 type; + __u16 size; + __u16 reserved; +}; + struct ibv_kern_spec { union { struct { @@ -952,6 +958,7 @@ struct ibv_kern_spec { struct ibv_kern_spec_ipv6 ipv6; struct ibv_kern_spec_tunnel tunnel; struct ibv_kern_spec_action_tag flow_tag; + struct ibv_kern_spec_action_drop drop; }; }; diff --git a/libibverbs/man/ibv_create_flow.3 b/libibverbs/man/ibv_create_flow.3 index 32d47ad..48bbb14 100644 --- a/libibverbs/man/ibv_create_flow.3 +++ b/libibverbs/man/ibv_create_flow.3 @@ -69,6 +69,7 @@ IBV_FLOW_SPEC_UDP = 0x41, /* Flow specification of UDP h IBV_FLOW_SPEC_VXLAN_TUNNEL = 0x50, /* Flow specification of VXLAN header */ IBV_FLOW_SPEC_INNER = 0x100, /* Flag making L2/L3/L4 specifications to be applied on the inner header */ IBV_FLOW_SPEC_ACTION_TAG = 0x1000, /* Action tagging matched packet */ +IBV_FLOW_SPEC_ACTION_DROP = 0x1001, /* Action dropping matched packet */ .in -8 }; .br diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index b27dfd1..4f0765e 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -1233,7 +1233,8 @@ enum ibv_flow_spec_type { IBV_FLOW_SPEC_UDP = 0x41, IBV_FLOW_SPEC_VXLAN_TUNNEL = 0x50, IBV_FLOW_SPEC_INNER = 0x100, - IBV_FLOW_SPEC_ACTION_TAG = 0x1000 + IBV_FLOW_SPEC_ACTION_TAG = 0x1000, + IBV_FLOW_SPEC_ACTION_DROP = 0x1001, }; struct ibv_flow_eth_filter { @@ -1326,6 +1327,11 @@ struct ibv_flow_spec_action_tag { uint32_t tag_id; }; +struct ibv_flow_spec_action_drop { + enum ibv_flow_spec_type type; + uint16_t size; +}; + struct ibv_flow_spec { union { struct { @@ -1339,6 +1345,7 @@ struct ibv_flow_spec { struct ibv_flow_spec_ipv6 ipv6; struct ibv_flow_spec_tunnel tunnel; struct ibv_flow_spec_action_tag flow_tag; + struct ibv_flow_spec_action_drop drop; }; };