From patchwork Mon Feb 12 15:20:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Rosenbaum X-Patchwork-Id: 10213291 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 4FFFA60236 for ; Mon, 12 Feb 2018 15:20:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 437B328CF8 for ; Mon, 12 Feb 2018 15:20:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 401EC28CE3; Mon, 12 Feb 2018 15:20: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.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 9CAB428D33 for ; Mon, 12 Feb 2018 15:20:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752745AbeBLPUU (ORCPT ); Mon, 12 Feb 2018 10:20:20 -0500 Received: from mail-it0-f66.google.com ([209.85.214.66]:39081 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752667AbeBLPUU (ORCPT ); Mon, 12 Feb 2018 10:20:20 -0500 Received: by mail-it0-f66.google.com with SMTP id c80so6874895itb.4 for ; Mon, 12 Feb 2018 07:20:19 -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=LmZl9zeNS+7y8/tgO3VITAUJZ9+3Itkf1/8iuD98lxo=; b=jsy8Gonv+PLwg1RQlLDqVZ0023I/cTEcAe1iUAQUIJz50zdRRK5W7ig3CuWUr1tVPS rFhslSkOmC6uUIunvMjEhu3OpC5zBuGRGl+oIHOONDJOARvy1znC8WTkfeHFLNjYE1O/ o//Sy8IkJqPb0IF0tsVQYBZ9FUm1avQH7eblLX5Y8K8yVVpZ+mpR+4jgHbdFQBzXKdEA 5kPSma/LejVnXLDncR09FGdindbTei302gWNOsA09or62Ue0uq97TD8S2Ureb97HcP/j yOV/WBxWV8jTLY/nf0mXjY6Kb+6JujgSxakFjAians5s5YZnosjFL5w0sIokbK58rCpx 3Kqw== 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=LmZl9zeNS+7y8/tgO3VITAUJZ9+3Itkf1/8iuD98lxo=; b=Q5nWYTrzY9IdqnjzSf90GVANzchyHQvp2Y+eFLr2d7YoM1LI28Wn9IXM2eJpRDtvUY 9Vni0ANDK/qNi3E5BbaEyja8gXdf/FkofUEB2FSDUuz2JuMp6meQLmM/oxbyvW8gz61B RTScYZLVvIKBxquAWuaSnf0Kinxf5R9anm6+/Fa6DI1Na65kATWJu2aIsJGhUk+92cmw 7lospaDUsa43MEBib1/gclq1Gg1jpyvTo6PGpvJz5sD8yLH6E5oHWcuMFLhH7z1H1R6h rk8SFdEAP4yGB2/hLkg1c6gKTo7HIevCxbq0LXnSpLObK3/EHNAF3w6Dygv8Qf96w1G3 TA2Q== X-Gm-Message-State: APf1xPCYPwgcDK4ljJZaq9h3injUSJOCVL5nZuKQpmetbIqRHdZwXyOb zl+vDby8+87MatRgjJg4xWEsZV/Ok8DJR/YSe6GjQHL/ X-Google-Smtp-Source: AH8x224MEmDouL+VN/E36byEusnzg+Pgm3u40s6KlUCsONcxR9FqKWGdTg0zUOJ7fa46c9v+pUm8XAx4FpRX/zzP7JA= X-Received: by 10.36.73.77 with SMTP id z74mr6228469ita.72.1518448819097; Mon, 12 Feb 2018 07:20:19 -0800 (PST) MIME-Version: 1.0 Received: by 10.2.23.202 with HTTP; Mon, 12 Feb 2018 07:20:18 -0800 (PST) From: Alex Rosenbaum Date: Mon, 12 Feb 2018 17:20:18 +0200 Message-ID: Subject: [PATCH RFC 3/3] Add Verbs MPLS flow specification filter 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 Add MPLS flow specification based on RFC 3032. MPLS spec defined with tag field. A MPLS allows stacking multiple labels in sequance. In addition, the MPLS header can be encapsulted on top of different layers, e.g.: ETH, IP (rfc4023), UDP (rfc7510), GRE (rfc4023). Application should use the IBV_FLOW_ATTR_FLAGS_ORDERED_SPEC_LIST to define the order in which the MPLS headers are encapsulated, as well as stacking multiple such spec in sequance. Signed-off-by: Alex Rosenbaum --- libibverbs/man/ibv_create_flow.3 | 5 ++++- libibverbs/verbs.h | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/libibverbs/man/ibv_create_flow.3 b/libibverbs/man/ibv_create_flow.3 index ee801fc..1519715 100644 --- a/libibverbs/man/ibv_create_flow.3 +++ b/libibverbs/man/ibv_create_flow.3 @@ -69,6 +69,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_GRE = 0x51, /* Flow specification of GRE header */ +IBV_FLOW_SPEC_MPLS = 0x60, /* Flow specification of MPLS 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 */ @@ -112,7 +113,9 @@ 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. - +.br +.B NOTE: +IBV_FLOW_SPEC_MPLS flow spec type should be used with the IBV_FLOW_ATTR_FLAGS_ORDERED_SPEC_LIST flag in order to strictly define it's location in the protocol stack. .SS ibv_destroy_flow() destroys the flow .I flow_id\fR. diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index 4f03bc9..04de6ea 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -1375,6 +1375,7 @@ enum ibv_flow_spec_type { IBV_FLOW_SPEC_UDP = 0x41, IBV_FLOW_SPEC_VXLAN_TUNNEL = 0x50, IBV_FLOW_SPEC_GRE = 0x51, + IBV_FLOW_SPEC_MPLS = 0x60, IBV_FLOW_SPEC_INNER = 0x100, IBV_FLOW_SPEC_ACTION_TAG = 0x1000, IBV_FLOW_SPEC_ACTION_DROP = 0x1001, @@ -1466,6 +1467,16 @@ struct ibv_flow_spec_gre { struct ibv_flow_gre_filter mask; }; +struct ibv_mpls_filter { + uint32_t tag; +}; + +struct ibv_flow_spec_mpls { + enum ibv_flow_spec_type type; + uint16_t size; + struct ibv_mpls_filter val; + struct ibv_mpls_filter mask; +}; struct ibv_flow_tunnel_filter { uint32_t tunnel_id;