From patchwork Wed Mar 21 18:10:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 10299989 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 8D13460385 for ; Wed, 21 Mar 2018 18:10:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7DEFD298CA for ; Wed, 21 Mar 2018 18:10:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 72C24298DA; Wed, 21 Mar 2018 18:10:35 +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 F411D298DA for ; Wed, 21 Mar 2018 18:10:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752522AbeCUSKc (ORCPT ); Wed, 21 Mar 2018 14:10:32 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:57477 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752544AbeCUSK1 (ORCPT ); Wed, 21 Mar 2018 14:10:27 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 21 Mar 2018 20:11:08 +0200 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 w2LIAKJJ014362; Wed, 21 Mar 2018 20:10:20 +0200 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 w2LIAKTY007802; Wed, 21 Mar 2018 20:10:20 +0200 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id w2LIAKo7007800; Wed, 21 Mar 2018 20:10:20 +0200 From: Yishai Hadas To: linux-rdma@vger.kernel.org Cc: yishaih@mellanox.com, matanb@mellanox.com, jgg@mellanox.com, majd@mellanox.com Subject: [PATCH rdma-core 11/11] verbs: Add ibv_flow_spec_action_handle support Date: Wed, 21 Mar 2018 20:10:00 +0200 Message-Id: <1521655800-7287-12-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1521655800-7287-1-git-send-email-yishaih@mellanox.com> References: <1521655800-7287-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: Matan Barak When we want to link a flow steering rule with an action, we need to state the action in a flow steering specification. Hence, we add a new flow steering specification that fits actions. Signed-off-by: Matan Barak Signed-off-by: Yishai Hadas --- kernel-headers/rdma/ib_user_verbs.h | 13 +++++++++++++ libibverbs/cmd.c | 8 ++++++++ libibverbs/kern-abi.h | 1 + libibverbs/man/ibv_create_flow.3 | 1 + libibverbs/verbs.h | 8 ++++++++ 5 files changed, 31 insertions(+) diff --git a/kernel-headers/rdma/ib_user_verbs.h b/kernel-headers/rdma/ib_user_verbs.h index 48be0c7..365c605 100644 --- a/kernel-headers/rdma/ib_user_verbs.h +++ b/kernel-headers/rdma/ib_user_verbs.h @@ -984,6 +984,19 @@ struct ib_uverbs_flow_spec_action_drop { }; }; +struct ib_uverbs_flow_spec_action_handle { + union { + struct ib_uverbs_flow_spec_hdr hdr; + struct { + __u32 type; + __u16 size; + __u16 reserved; + }; + }; + __u32 handle; + __u32 reserved1; +}; + struct ib_uverbs_flow_tunnel_filter { __be32 tunnel_id; }; diff --git a/libibverbs/cmd.c b/libibverbs/cmd.c index 77c91b9..cdebec5 100644 --- a/libibverbs/cmd.c +++ b/libibverbs/cmd.c @@ -1778,6 +1778,14 @@ static int ib_spec_to_kern_spec(struct ibv_flow_spec *ib_spec, case IBV_FLOW_SPEC_ACTION_DROP: kern_spec->drop.size = sizeof(struct ib_uverbs_flow_spec_action_drop); break; + case IBV_FLOW_SPEC_ACTION_HANDLE: { + const struct verbs_flow_action *vaction = + container_of((const struct ibv_flow_action *)ib_spec->handle.action, + const struct verbs_flow_action, action); + kern_spec->handle.size = sizeof(struct ib_uverbs_flow_spec_action_handle); + kern_spec->handle.handle = vaction->handle; + break; + } default: return EINVAL; } diff --git a/libibverbs/kern-abi.h b/libibverbs/kern-abi.h index 8e8064a..d9b1a82 100644 --- a/libibverbs/kern-abi.h +++ b/libibverbs/kern-abi.h @@ -262,6 +262,7 @@ struct ibv_kern_spec { struct ib_uverbs_flow_spec_tunnel tunnel; struct ib_uverbs_flow_spec_action_tag flow_tag; struct ib_uverbs_flow_spec_action_drop drop; + struct ib_uverbs_flow_spec_action_handle handle; }; }; diff --git a/libibverbs/man/ibv_create_flow.3 b/libibverbs/man/ibv_create_flow.3 index 43c0b9c..65de08b 100644 --- a/libibverbs/man/ibv_create_flow.3 +++ b/libibverbs/man/ibv_create_flow.3 @@ -72,6 +72,7 @@ IBV_FLOW_SPEC_VXLAN_TUNNEL = 0x50, /* Flow specification of VXLAN 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 */ +IBV_FLOW_SPEC_ACTION_HANDLE = 0x1002, /* Carry out an action created by ibv_create_flow_action_xxxx verb */ .in -8 }; .br diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index a595db8..bcbd427 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -1387,6 +1387,7 @@ enum ibv_flow_spec_type { IBV_FLOW_SPEC_INNER = 0x100, IBV_FLOW_SPEC_ACTION_TAG = 0x1000, IBV_FLOW_SPEC_ACTION_DROP = 0x1001, + IBV_FLOW_SPEC_ACTION_HANDLE = 0x1002, }; struct ibv_flow_eth_filter { @@ -1496,6 +1497,12 @@ struct ibv_flow_spec_action_drop { uint16_t size; }; +struct ibv_flow_spec_action_handle { + enum ibv_flow_spec_type type; + uint16_t size; + const struct ibv_flow_action *action; +}; + struct ibv_flow_spec { union { struct { @@ -1511,6 +1518,7 @@ struct ibv_flow_spec { struct ibv_flow_spec_tunnel tunnel; struct ibv_flow_spec_action_tag flow_tag; struct ibv_flow_spec_action_drop drop; + struct ibv_flow_spec_action_handle handle; }; };