diff mbox

[RFC,1/3] Add Verbs GRE flow specification filter

Message ID CAFgAxU_DrTydoiuQvQ+7mvBdcntUg=Jmq4sC0mupdh-W-YQs6A@mail.gmail.com (mailing list archive)
State RFC
Headers show

Commit Message

Alex Rosenbaum Feb. 12, 2018, 3:20 p.m. UTC
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 <alexr@mellanox.com>
Signed-off-by: Matan Barak <matanb@mellanox.com>
---
 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 mbox

Patch

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 {