From patchwork Mon Feb 12 15:20:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Rosenbaum X-Patchwork-Id: 10213289 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 A174860236 for ; Mon, 12 Feb 2018 15:20:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E41328CF2 for ; Mon, 12 Feb 2018 15:20:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 880F228D42; Mon, 12 Feb 2018 15:20: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.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 5231728CF2 for ; Mon, 12 Feb 2018 15:20:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752616AbeBLPUP (ORCPT ); Mon, 12 Feb 2018 10:20:15 -0500 Received: from mail-io0-f195.google.com ([209.85.223.195]:45098 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752667AbeBLPUN (ORCPT ); Mon, 12 Feb 2018 10:20:13 -0500 Received: by mail-io0-f195.google.com with SMTP id p188so17591194ioe.12 for ; Mon, 12 Feb 2018 07:20:13 -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=ClBteIRXXuABV1nHAkOhYuGhjLuwWSNbpon8aOJcpGM=; b=KhKgc+IntPFxpNifgZpv9Y6pilmMZeysQy85Futdj4BbLnKOrK+m8ijxTDYNH1ifvY r36z2Yrpu2Fw1Zh2VH0npCkth/Cson3QSxt9zCQCHgyOFYkEm6Bdge9mYYgqgv7WJwqp DuoyOjKWo/pRKTSN1tkuIn5IQnrmz3aN6f9kP1Kurw02HOVQY5valvD5uY4RxjF7YRJO ysrClmiEuFULeOP5QQ8w60ukP141S8fdIop1/ZRtw/96lpPjyaUbtvGni5KZu0hQx0sW /yqWq80n/Nv99Hx3XYwfhwcmiab7BTANBjjwQlUu3olqeb8g32crl2eTNTkHKEfcgfhz 1lBg== 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=ClBteIRXXuABV1nHAkOhYuGhjLuwWSNbpon8aOJcpGM=; b=Lcnb9KP1WxNKD+3EddPeOW2MPUb8iqHfUBQCprqSRpAXS/wICwbrezwuUfCyxpt9BI k9pfJx8v7Hpur7hUbiulIFOUDqFnVNy0J/UojM/dlP1DrAiL4k8ANM9gMuGHp5hduyZZ rjjqJDnSC/nigbWe1UYkSm+IAIosOlolwYk8crQwCwihtcF5uyLrn0R/tizKR7SdHJ9f zlo8byaepuyH4uRllhYseo0x9Y7070qGubGcsVjaNK531ck7lDprngXJ6Va2LdKqup6u 0EtsKX6kR/sU4vprmIbn+o6iwp1ST67jgUK8eAQcZURwz+pzEZ9dIgghUa4XZcrDXeeb H3UA== X-Gm-Message-State: APf1xPA4P8J2kklg6dCc+hcV3vIt6s59MlyzBjx3FFTwesq0YW/qhT0T MskSLjp19Dko2udc8MoNbEiJb3l0OH3usCqvbCxu8Ov6 X-Google-Smtp-Source: AH8x227jZsuUCw+CfobjdHcYGRLLbnTZZPpc76A3UHk6Iu9aTuPs/lRSAfeTtKICtTGgwmWGHNw0EW8bynFBfA0P2uo= X-Received: by 10.107.200.11 with SMTP id y11mr13602641iof.116.1518448813000; Mon, 12 Feb 2018 07:20:13 -0800 (PST) MIME-Version: 1.0 Received: by 10.2.23.202 with HTTP; Mon, 12 Feb 2018 07:20:12 -0800 (PST) From: Alex Rosenbaum Date: Mon, 12 Feb 2018 17:20:12 +0200 Message-ID: Subject: [PATCH RFC 1/3] Add Verbs GRE 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 Allow verbs applications packet steering of GRE tunneled traffic. Adding GRE flow specification based on RFC 2890. GRE consists of flags, protocol and key fields. IPv4 protocol 47 (IPPROTO_GRE) can be used when GRE packets are encapsulated in IPv4. Signed-off-by: Alex Rosenbaum Signed-off-by: Matan Barak --- libibverbs/man/ibv_create_flow.3 | 1 + libibverbs/verbs.h | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) struct ibv_flow_spec_ipv4_ext ipv4_ext; struct ibv_flow_spec_ipv6 ipv6; struct ibv_flow_spec_tunnel tunnel; + struct ibv_flow_spec_gre gre; struct ibv_flow_spec_action_tag flow_tag; struct ibv_flow_spec_action_drop drop; }; diff --git a/libibverbs/man/ibv_create_flow.3 b/libibverbs/man/ibv_create_flow.3 index 48bbb14..a59cbe5 100644 --- a/libibverbs/man/ibv_create_flow.3 +++ b/libibverbs/man/ibv_create_flow.3 @@ -67,6 +67,7 @@ IBV_FLOW_SPEC_IPV4_EXT = 0x32, /* Extended flow specification IBV_FLOW_SPEC_TCP = 0x40, /* Flow specification of TCP header */ 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_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 */ diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index 5325f8f..ec0504f 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -1373,6 +1373,7 @@ enum ibv_flow_spec_type { IBV_FLOW_SPEC_TCP = 0x40, IBV_FLOW_SPEC_UDP = 0x41, IBV_FLOW_SPEC_VXLAN_TUNNEL = 0x50, + IBV_FLOW_SPEC_GRE = 0x51, IBV_FLOW_SPEC_INNER = 0x100, IBV_FLOW_SPEC_ACTION_TAG = 0x1000, IBV_FLOW_SPEC_ACTION_DROP = 0x1001, @@ -1451,6 +1452,20 @@ struct ibv_flow_spec_tcp_udp { struct ibv_flow_tcp_udp_filter mask; }; +struct ibv_flow_gre_filter { + uint16_t c_ks_res0_ver; + uint16_t protocol; + uint32_t key; +}; + +struct ibv_flow_spec_gre { + enum ibv_flow_spec_type type; + uint16_t size; + struct ibv_flow_gre_filter val; + struct ibv_flow_gre_filter mask; +}; + struct ibv_flow_tunnel_filter { uint32_t tunnel_id; }; @@ -1485,6 +1500,7 @@ struct ibv_flow_spec {