From patchwork Wed Apr 5 15:19:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 9664475 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 97BBA60364 for ; Wed, 5 Apr 2017 15:26:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87F242852E for ; Wed, 5 Apr 2017 15:26:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CDC62856A; Wed, 5 Apr 2017 15:26:31 +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 0046628533 for ; Wed, 5 Apr 2017 15:26:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755627AbdDEP00 (ORCPT ); Wed, 5 Apr 2017 11:26:26 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:52598 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755625AbdDEPYu (ORCPT ); Wed, 5 Apr 2017 11:24:50 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 5 Apr 2017 18:19:53 +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 v35FJrY2006105; Wed, 5 Apr 2017 18:19:53 +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 v35FJr86019828; Wed, 5 Apr 2017 18:19:53 +0300 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id v35FJrQO019827; Wed, 5 Apr 2017 18:19:53 +0300 From: Yishai Hadas To: dledford@redhat.com Cc: linux-rdma@vger.kernel.org, artemyko@mellanox.com, yishaih@mellanox.com, maorg@mellanox.com, majd@mellanox.com, Moses Reuben Subject: [PATCH rdma-core 3/5] ibverbs: Add flow tag specification Date: Wed, 5 Apr 2017 18:19:22 +0300 Message-Id: <1491405564-19735-4-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1491405564-19735-1-git-send-email-yishaih@mellanox.com> References: <1491405564-19735-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 The flow tag specification is used to identify flow with specific tag-id. This feature allows an application to request to add an action to tag all the packets that matches this rule. This tag-id will be later reported in the CQE. Signed-off-by: Moses Reuben Signed-off-by: Artemy Kovalyov Reviewed-by: Maor Gottlieb Reviewed-by: Yishai Hadas --- libibverbs/cmd.c | 5 +++++ libibverbs/kern-abi.h | 8 ++++++++ libibverbs/man/ibv_create_flow.3 | 1 + libibverbs/verbs.h | 10 +++++++++- 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/libibverbs/cmd.c b/libibverbs/cmd.c index 6bdd1c4..3a5aa4e 100644 --- a/libibverbs/cmd.c +++ b/libibverbs/cmd.c @@ -1818,6 +1818,11 @@ static int ib_spec_to_kern_spec(struct ibv_flow_spec *ib_spec, memcpy(&kern_spec->tunnel.mask, (void *)&ib_spec->tunnel.val + ib_filter_size, kern_filter_size); break; + case IBV_FLOW_SPEC_ACTION_TAG: + kern_spec->flow_tag.size = + sizeof(struct ibv_kern_spec_action_tag); + kern_spec->flow_tag.tag_id = ib_spec->flow_tag.tag_id; + break; default: return EINVAL; } diff --git a/libibverbs/kern-abi.h b/libibverbs/kern-abi.h index f8bdc9d..448b2e8 100644 --- a/libibverbs/kern-abi.h +++ b/libibverbs/kern-abi.h @@ -918,6 +918,13 @@ struct ibv_kern_spec_tcp_udp { struct ibv_kern_tcp_udp_filter mask; }; +struct ibv_kern_spec_action_tag { + __u32 type; + __u16 size; + __u16 reserved; + __u32 tag_id; + __u32 reserved1; +}; struct ibv_kern_tunnel_filter { __u32 tunnel_id; @@ -944,6 +951,7 @@ struct ibv_kern_spec { struct ibv_kern_spec_tcp_udp tcp_udp; struct ibv_kern_spec_ipv6 ipv6; struct ibv_kern_spec_tunnel tunnel; + struct ibv_kern_spec_action_tag flow_tag; }; }; diff --git a/libibverbs/man/ibv_create_flow.3 b/libibverbs/man/ibv_create_flow.3 index 32a7572..32d47ad 100644 --- a/libibverbs/man/ibv_create_flow.3 +++ b/libibverbs/man/ibv_create_flow.3 @@ -68,6 +68,7 @@ IBV_FLOW_SPEC_TCP = 0x40, /* Flow specification of TCP h IBV_FLOW_SPEC_UDP = 0x41, /* Flow specification of UDP header */ 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 */ .in -8 }; .br diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index 225ab81..5a4dcbc 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -1224,7 +1224,8 @@ enum ibv_flow_spec_type { IBV_FLOW_SPEC_TCP = 0x40, IBV_FLOW_SPEC_UDP = 0x41, IBV_FLOW_SPEC_VXLAN_TUNNEL = 0x50, - IBV_FLOW_SPEC_INNER = 0x100 + IBV_FLOW_SPEC_INNER = 0x100, + IBV_FLOW_SPEC_ACTION_TAG = 0x1000 }; struct ibv_flow_eth_filter { @@ -1311,6 +1312,12 @@ struct ibv_flow_spec_tunnel { struct ibv_flow_tunnel_filter mask; }; +struct ibv_flow_spec_action_tag { + enum ibv_flow_spec_type type; + uint16_t size; + uint32_t tag_id; +}; + struct ibv_flow_spec { union { struct { @@ -1323,6 +1330,7 @@ struct ibv_flow_spec { struct ibv_flow_spec_ipv4_ext ipv4_ext; struct ibv_flow_spec_ipv6 ipv6; struct ibv_flow_spec_tunnel tunnel; + struct ibv_flow_spec_action_tag flow_tag; }; };