From patchwork Mon Feb 12 15:20:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Rosenbaum X-Patchwork-Id: 10213293 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 5401760236 for ; Mon, 12 Feb 2018 15:20:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46C4E28CFA for ; Mon, 12 Feb 2018 15:20:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4507F28D36; Mon, 12 Feb 2018 15:20:37 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 7268128CFA for ; Mon, 12 Feb 2018 15:20:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752741AbeBLPUS (ORCPT ); Mon, 12 Feb 2018 10:20:18 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:53728 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752667AbeBLPUQ (ORCPT ); Mon, 12 Feb 2018 10:20:16 -0500 Received: by mail-it0-f67.google.com with SMTP id i144so7055734ita.3 for ; Mon, 12 Feb 2018 07:20:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=PksJiH/liexn4aBO77MhPrSpIpHKdpqIL344mt8UC3k=; b=eDtk7k93e8UUeak/89/hqdlcx6QhqTZ/QpfPjH1L096ucdVdU/G81cJ9or3SrDeAYv hegKAqMsbJLQRqi0tcPm4KbVDmPpKfPiyOzVOkincatM95HEHJhzBqred6a24iuBay0U iJGZzxvHbYpnyKvC6zhG4a689szKM54VLStwro+vZHIZ6DKKhn/SwHbapCm/HvjaeN8N x3pruBhEuChdJeAEk+G9tyMhuHrDeSyP05kOmkRsL+InvnjRJcrXYla0UKcZNa+VB7Ml wJ5+7f22WiEThMhNxK8SsSQEkKEQtG+vWigPxFn4DlQ2X5SghkCj2l2WD8/NEeKa/J9+ NO3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=PksJiH/liexn4aBO77MhPrSpIpHKdpqIL344mt8UC3k=; b=qyPgivfNGkhf3hIm3TOgw6BLcmaA9pbQHBmkSvghOHFyLHiY2XFBGaIni8ynkbMsUP 3AUaAzC/y5dMDSJYuTY4UjuKfJw7XidvnYVgR/EE0BWT0EnhzLa6eXwUGcHZUu8xjO6V CVJPJRapz4nfAM8u9nsJJldY/gTw7jIAinLPhau8OyM7ZE6wjE+PDUZMQALH0xt74wK+ xZ6AyQIS9RlApvRJBhNaL7P78uJae1Bu3sfMAjsaW+bonw4DgF1eWvwRXechU34Tm2Us DCAn+5fzTlvue0MrH/25xwD4mJq5w/oCpkVfzH2rizkjL5FGmz+4WeQn6ZKsZAwNQYZu dq9w== X-Gm-Message-State: APf1xPBWpoJdRlUcp+D1WvfMeMbCsbqgt6MvDC3bLwDItNb9Xiksp25f fyXwoA3vlrEmP2k5EYSo36qGplfR62nUHLUeuQ1Cq49f X-Google-Smtp-Source: AH8x2259z12EFOre3Qb6iA4kd7NQbh5Zmrnya11Y+Y7HYg7o1fIPnjvyrbbrfKyuql4b0rcvPgYSqqJ4arAz0kLN/qA= X-Received: by 10.36.43.20 with SMTP id h20mr6123144ita.42.1518448815534; Mon, 12 Feb 2018 07:20:15 -0800 (PST) MIME-Version: 1.0 Received: by 10.2.23.202 with HTTP; Mon, 12 Feb 2018 07:20:14 -0800 (PST) From: Alex Rosenbaum Date: Mon, 12 Feb 2018 17:20:14 +0200 Message-ID: Subject: [PATCH RFC 2/3] Allow Verbs ordered flow spec definitions To: linux-rdma@vger.kernel.org, Yishai Hadas , Leon Romanovsky , Ariel Levkovich , "Alex @ Mellanox" 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 Applications can use IBV_FLOW_ATTR_FLAGS_ORDERED_SPEC_LIST to declare that the ibv_flow_spec_xxx rules should be created in order and should be matched as a strict pattern of headers. This flag allows applications to define a very precise network header structure, which is very useful to represent many of the encapsulation tunnel protocols. Signed-off-by: Alex Rosenbaum --- libibverbs/man/ibv_create_flow.3 | 10 +++++++++- libibverbs/verbs.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libibverbs/man/ibv_create_flow.3 b/libibverbs/man/ibv_create_flow.3 index a59cbe5..ee801fc 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_ORDERED_SPEC_LIST = 1 << 2, /* Apply the rules occording to the stacked order the user provided */ .in -8 }; .fi @@ -104,7 +105,14 @@ In addition to the domain, there is priority within each of the domains. A lower priority numeric value (higher priority) takes precedence over matching rules with higher numeric priority value (lower priority). It is important to note that the priority value of a flow spec is used not only to establish the precedence of conflicting flow matches but also as a way to abstract the order on which flow specs are tested for matches. Flows with higher priorities will be tested before flows with lower priorities. -.PP + +.SS Rules definition ordering +An application can provide the ibv_flow_spec_xxx rules in an un-ordered scheme. In which case, each spec should be well defined and match a specific network header layer. +Alternatively, if an ibv_flow is created with flag +.BR IBV_FLOW_ATTR_FLAGS_ORDERED_SPEC_LIST\fR, +then the ibv_flow_spec_xxx rules order will be matched as a stricted pattern. +This mode allows the application to define a very precise network header structure. This is very useful to represent many of the encapsulation tunnel protocols. + .SS ibv_destroy_flow() destroys the flow .I flow_id\fR. diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index ec0504f..4f03bc9 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -1348,6 +1348,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_ORDERED_SPEC_LIST = 1 << 2, }; enum ibv_flow_attr_type {