From patchwork Wed Mar 21 18:09:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 10299991 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 EF53E60385 for ; Wed, 21 Mar 2018 18:10:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF11E298E6 for ; Wed, 21 Mar 2018 18:10:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DDBBC298E8; Wed, 21 Mar 2018 18:10: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 6AF3E298E8 for ; Wed, 21 Mar 2018 18:10:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752544AbeCUSKd (ORCPT ); Wed, 21 Mar 2018 14:10:33 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:57458 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752527AbeCUSK0 (ORCPT ); Wed, 21 Mar 2018 14:10:26 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 21 Mar 2018 20:11:07 +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 w2LIAK9g014353; 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 w2LIAK1O007789; 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 w2LIAKkJ007788; 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 08/11] verbs: Add flow steering egress support Date: Wed, 21 Mar 2018 20:09:57 +0200 Message-Id: <1521655800-7287-9-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 Sometimes we want to carry actions when packets are sent out to the port. In that case, we need an EGRESS based flow steering rule. The semantics of this new EGRESS flag is port-wide, meaning - any packet that is sent to the port is matched, regardless of the QP that this packet originated from. The flow steering QP parameter is used only in order to represent the device and is ignored in the matching process. Signed-off-by: Matan Barak Signed-off-by: Yishai Hadas --- libibverbs/man/ibv_create_flow.3 | 7 +++++++ libibverbs/verbs.h | 1 + 2 files changed, 8 insertions(+) diff --git a/libibverbs/man/ibv_create_flow.3 b/libibverbs/man/ibv_create_flow.3 index 48bbb14..1762503 100644 --- a/libibverbs/man/ibv_create_flow.3 +++ b/libibverbs/man/ibv_create_flow.3 @@ -52,6 +52,7 @@ enum ibv_flow_flags { .in +8 IBV_FLOW_ATTR_FLAGS_ALLOW_LOOP_BACK = 1 << 0, /* Apply the rules on packets that were sent from the attached QP through loopback */ IBV_FLOW_ATTR_FLAGS_DONT_TRAP = 1 << 1, /* Rule doesn't trap received packets, allowing them to match lower prioritized rules */ +IBV_FLOW_ATTR_FLAGS_EGRESS = 1 << 2, /* Match sent packets against EGRESS rules and carry associated actions if required */ .in -8 }; .fi @@ -87,6 +88,10 @@ struct ibv_flow_xxx_filter mask; /* Defines which bits from the filter value are .PP Each spec struct holds the relevant network layer parameters for matching. To enforce the match, the user sets a mask for each parameter. .br +Packets coming from the wire are matched against the flow specification. If a match is found, the associated flow actions are executed on the packet. +.br +In ingress flows, the QP parameter is treated as another action of scattering the packet to the respected QP. +.br If the bit is set in the mask, the corresponding bit in the value should be matched. .br Note that most vendors support either full mask (all "1"s) or zero mask (all "0"s). @@ -142,6 +147,8 @@ or .br 5. No specifications are needed for IBV_FLOW_ATTR_SNIFFER rule type. .br +6. When IBV_FLOW_ATTR_FLAGS_EGRESS flag is set, the qp parameter is used only as a mean to get the device. +.br .PP .SH EXAMPLE .br diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index 5bbc963..8dbfcf1 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -1357,6 +1357,7 @@ struct ibv_ah { enum ibv_flow_flags { IBV_FLOW_ATTR_FLAGS_ALLOW_LOOP_BACK = 1 << 0, IBV_FLOW_ATTR_FLAGS_DONT_TRAP = 1 << 1, + IBV_FLOW_ATTR_FLAGS_EGRESS = 1 << 2, }; enum ibv_flow_attr_type {