@@ -1766,6 +1766,13 @@ static int ib_spec_to_kern_spec(struct ibv_flow_spec *ib_spec,
memcpy(&kern_spec->tcp_udp.mask, &ib_spec->tcp_udp.mask,
sizeof(struct ibv_flow_tcp_udp_filter));
break;
+ case IBV_FLOW_SPEC_GRE:
+ kern_spec->gre.size = sizeof(struct ib_uverbs_flow_spec_gre);
+ memcpy(&kern_spec->gre.val, &ib_spec->gre.val,
+ sizeof(struct ibv_flow_gre_filter));
+ memcpy(&kern_spec->gre.mask, &ib_spec->gre.mask,
+ sizeof(struct ibv_flow_gre_filter));
+ break;
case IBV_FLOW_SPEC_VXLAN_TUNNEL:
ret = get_filters_size(ib_spec, kern_spec,
&ib_filter_size, &kern_filter_size,
@@ -267,6 +267,7 @@ struct ibv_kern_spec {
struct ib_uverbs_flow_spec_esp esp;
struct ib_uverbs_flow_spec_tcp_udp tcp_udp;
struct ib_uverbs_flow_spec_ipv6 ipv6;
+ struct ib_uverbs_flow_spec_gre gre;
struct ib_uverbs_flow_spec_tunnel tunnel;
struct ib_uverbs_flow_spec_action_tag flow_tag;
struct ib_uverbs_flow_spec_action_drop drop;
@@ -69,6 +69,7 @@ IBV_FLOW_SPEC_ESP = 0x34, /* Flow specification of ESP (
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 */
@@ -1400,6 +1400,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,
@@ -1491,6 +1492,28 @@ struct ibv_flow_spec_tcp_udp {
struct ibv_flow_tcp_udp_filter mask;
};
+struct ibv_flow_gre_filter {
+ /* c_ks_res0_ver field is bits 0-15 in offset 0 of a standard GRE header:
+ * bit 0 - checksum present bit.
+ * bit 1 - reserved. set to 0.
+ * bit 2 - key present bit.
+ * bit 3 - sequence number present bit.
+ * bits 4:12 - reserved. set to 0.
+ * bits 13:15 - GRE version.
+ */
+ 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;
};
@@ -1532,6 +1555,7 @@ struct ibv_flow_spec {
struct ibv_flow_spec_ipv6 ipv6;
struct ibv_flow_spec_esp esp;
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;
struct ibv_flow_spec_action_handle handle;