All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH rdma-core 0/5] Flow steering improvements
@ 2017-04-05 15:19 Yishai Hadas
       [not found] ` <1491405564-19735-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Yishai Hadas @ 2017-04-05 15:19 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	artemyko-VPRAkNaXOzVWk0Htik3J/w, yishaih-VPRAkNaXOzVWk0Htik3J/w,
	maorg-VPRAkNaXOzVWk0Htik3J/w, majd-VPRAkNaXOzVWk0Htik3J/w

This patch set from Artemy introduces to user applications some extra flow
steering specifications, the matching kernel part was already accepted in
kernel 4.10.

Specifically, below specifications are added:
IBV_FLOW_SPEC_VXLAN_TUNNEL, IBV_FLOW_SPEC_INNER, IBV_FLOW_SPEC_ACTION_TAG.

Virtual eXtensible LAN (VXLAN) is a proposed encapsulation protocol for running
an overlay network on existing Layer 3 infrastructure. An overlay network is a
virtual network that is built on top of existing network Layer 2 and Layer 3
technologies to support elastic COMPUTE architectures. VXLAN will make it
easier for network engineers to scale out a cloud computing environment while
logically isolating cloud apps and tenants.

This patch set introduces support of VXLAN protocol for ibv_create_flow API.
The application will be able to send a packet with VXLAN tunneling, and
configure a steering rule to receive this stream based on its tunnel_id using
the IBV_FLOW_SPEC_VXLAN_TUNNEL specification.

In addition, an inner flow specification (i.e. IBV_FLOW_SPEC_VXLAN_TUNNEL)
was added letting the application to set a rule on the inner protocol.
 
When one of the L2/L3/L4 flow specification types is or-combined with
IBV_FLOW_SPEC_INNER, then the filter is applied on the inner packet header.
The flow specifications can contain inner and outer parts for the inner and
outer protocol headers respectively.  The match is done based on the inner and
outer flow specifications and can include the VXLAN_TUNNEL specification as
well.

Flow tag specification (i.e. IBV_FLOW_SPEC_ACTION_TAG) allows an application
to request an action to tag the matching packets with a given tag id.

The matching is done based on the L2/L3/L4 flow specifications, where the
application builds several spec's, each spec defined field on the header it
applied for. The number of specifications to add is one for each layer and one
more for the flow tag action which contains the tag_id number.

Application can read the flow tag by using the extended ibv_cq_ex
with the new read method:
uint32_t ibv_wc_read_flow_tag(struct ibv_cq_ex *cq)

Pull request was sent:
https://github.com/linux-rdma/rdma-core/pull/114

Artemy Kovalyov (5):
  ibverbs: Add tunnel VXLAN flow specification
  ibverbs: Add inner flow specification support
  ibverbs: Add flow tag specification
  ibverbs: Add support for reading flow tag from a CQ
  mlx5: Add read_flow_tag implementation

 libibverbs/cmd.c                  | 38 +++++++++++++++++++++++++++++++--
 libibverbs/kern-abi.h             | 21 +++++++++++++++++++
 libibverbs/man/ibv_create_cq_ex.3 |  4 ++++
 libibverbs/man/ibv_create_flow.3  |  3 +++
 libibverbs/verbs.h                | 44 ++++++++++++++++++++++++++++++++-------
 providers/mlx5/cq.c               |  9 ++++++++
 providers/mlx5/mlx5.h             |  4 ++++
 providers/mlx5/verbs.c            |  3 ++-
 8 files changed, 116 insertions(+), 10 deletions(-)

-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH rdma-core 1/5] ibverbs: Add tunnel VXLAN flow specification
       [not found] ` <1491405564-19735-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2017-04-05 15:19   ` Yishai Hadas
  2017-04-05 15:19   ` [PATCH rdma-core 2/5] ibverbs: Add inner flow specification support Yishai Hadas
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Yishai Hadas @ 2017-04-05 15:19 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	artemyko-VPRAkNaXOzVWk0Htik3J/w, yishaih-VPRAkNaXOzVWk0Htik3J/w,
	maorg-VPRAkNaXOzVWk0Htik3J/w, majd-VPRAkNaXOzVWk0Htik3J/w,
	Moses Reuben

From: Artemy Kovalyov <artemyko-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Add flow specification for receiving a specific VXLAN packet. The
specification defines a filter on the VNI field in the packet. There is an
option to mask a range of tunnel IDs to be steered by using the filter
mask.

VNI: 24-bit value that provides a unique identifier for the
individual VXLAN segment.

Signed-off-by: Moses Reuben <mosesr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Artemy Kovalyov <artemyko-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Maor Gottlieb <maorg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 libibverbs/cmd.c                 | 22 ++++++++++++++++++++++
 libibverbs/kern-abi.h            | 13 +++++++++++++
 libibverbs/man/ibv_create_flow.3 |  1 +
 libibverbs/verbs.h               | 25 +++++++++++++++++++------
 4 files changed, 55 insertions(+), 6 deletions(-)

diff --git a/libibverbs/cmd.c b/libibverbs/cmd.c
index 06ec671..8814142 100644
--- a/libibverbs/cmd.c
+++ b/libibverbs/cmd.c
@@ -1712,6 +1712,15 @@ static int get_filters_size(struct ibv_flow_spec *ib_spec,
 		ib_spec_filter_mask = (void *)&ib_spec->ipv6.val +
 			*ib_filter_size;
 		break;
+	case IBV_FLOW_SPEC_VXLAN_TUNNEL:
+		min_filter_size =
+			offsetof(struct ibv_kern_tunnel_filter,
+				 tunnel_id) +
+			sizeof(kern_spec->tunnel.mask.tunnel_id);
+		curr_kern_filter_size = min_filter_size;
+		ib_spec_filter_mask = (void *)&ib_spec->tunnel.val +
+			*ib_filter_size;
+		break;
 	default:
 		return EINVAL;
 	}
@@ -1789,6 +1798,19 @@ 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_VXLAN_TUNNEL:
+		ret = get_filters_size(ib_spec, kern_spec,
+				       &ib_filter_size, &kern_filter_size,
+				       IBV_FLOW_SPEC_VXLAN_TUNNEL);
+		if (ret)
+			return ret;
+
+		kern_spec->tunnel.size = sizeof(struct ibv_kern_spec_tunnel);
+		memcpy(&kern_spec->tunnel.val, &ib_spec->tunnel.val,
+		       kern_filter_size);
+		memcpy(&kern_spec->tunnel.mask, (void *)&ib_spec->tunnel.val
+		       + ib_filter_size, kern_filter_size);
+		break;
 	default:
 		return EINVAL;
 	}
diff --git a/libibverbs/kern-abi.h b/libibverbs/kern-abi.h
index cb229f8..f8bdc9d 100644
--- a/libibverbs/kern-abi.h
+++ b/libibverbs/kern-abi.h
@@ -919,6 +919,18 @@ struct ibv_kern_spec_tcp_udp {
 };
 
 
+struct ibv_kern_tunnel_filter {
+	__u32 tunnel_id;
+};
+
+struct ibv_kern_spec_tunnel {
+	__u32  type;
+	__u16  size;
+	__u16 reserved;
+	struct ibv_kern_tunnel_filter val;
+	struct ibv_kern_tunnel_filter mask;
+};
+
 struct ibv_kern_spec {
 	union {
 		struct {
@@ -931,6 +943,7 @@ struct ibv_kern_spec {
 		struct ibv_kern_spec_ipv4_ext ipv4_ext;
 		struct ibv_kern_spec_tcp_udp tcp_udp;
 		struct ibv_kern_spec_ipv6 ipv6;
+		struct ibv_kern_spec_tunnel tunnel;
 	};
 };
 
diff --git a/libibverbs/man/ibv_create_flow.3 b/libibverbs/man/ibv_create_flow.3
index 656bbf1..3056972 100644
--- a/libibverbs/man/ibv_create_flow.3
+++ b/libibverbs/man/ibv_create_flow.3
@@ -66,6 +66,7 @@ IBV_FLOW_SPEC_IPV6                      = 0x31,   /* Flow specification of IPv6
 IBV_FLOW_SPEC_IPV4_EXT                  = 0x32,   /* Extended flow specification of IPv4 */
 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 */
 .in -8
 };
 .br
diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
index 4dbdb02..b41a116 100644
--- a/libibverbs/verbs.h
+++ b/libibverbs/verbs.h
@@ -1217,12 +1217,13 @@ enum ibv_flow_attr_type {
 };
 
 enum ibv_flow_spec_type {
-	IBV_FLOW_SPEC_ETH	= 0x20,
-	IBV_FLOW_SPEC_IPV4	= 0x30,
-	IBV_FLOW_SPEC_IPV6	= 0x31,
-	IBV_FLOW_SPEC_IPV4_EXT	= 0x32,
-	IBV_FLOW_SPEC_TCP	= 0x40,
-	IBV_FLOW_SPEC_UDP	= 0x41,
+	IBV_FLOW_SPEC_ETH		= 0x20,
+	IBV_FLOW_SPEC_IPV4		= 0x30,
+	IBV_FLOW_SPEC_IPV6		= 0x31,
+	IBV_FLOW_SPEC_IPV4_EXT		= 0x32,
+	IBV_FLOW_SPEC_TCP		= 0x40,
+	IBV_FLOW_SPEC_UDP		= 0x41,
+	IBV_FLOW_SPEC_VXLAN_TUNNEL	= 0x50
 };
 
 struct ibv_flow_eth_filter {
@@ -1298,6 +1299,17 @@ struct ibv_flow_spec_tcp_udp {
 	struct ibv_flow_tcp_udp_filter mask;
 };
 
+struct ibv_flow_tunnel_filter {
+	uint32_t tunnel_id;
+};
+
+struct ibv_flow_spec_tunnel {
+	enum ibv_flow_spec_type  type;
+	uint16_t  size;
+	struct ibv_flow_tunnel_filter val;
+	struct ibv_flow_tunnel_filter mask;
+};
+
 struct ibv_flow_spec {
 	union {
 		struct {
@@ -1309,6 +1321,7 @@ struct ibv_flow_spec {
 		struct ibv_flow_spec_tcp_udp tcp_udp;
 		struct ibv_flow_spec_ipv4_ext ipv4_ext;
 		struct ibv_flow_spec_ipv6 ipv6;
+		struct ibv_flow_spec_tunnel tunnel;
 	};
 };
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH rdma-core 2/5] ibverbs: Add inner flow specification support
       [not found] ` <1491405564-19735-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  2017-04-05 15:19   ` [PATCH rdma-core 1/5] ibverbs: Add tunnel VXLAN flow specification Yishai Hadas
@ 2017-04-05 15:19   ` Yishai Hadas
  2017-04-05 15:19   ` [PATCH rdma-core 3/5] ibverbs: Add flow tag specification Yishai Hadas
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Yishai Hadas @ 2017-04-05 15:19 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	artemyko-VPRAkNaXOzVWk0Htik3J/w, yishaih-VPRAkNaXOzVWk0Htik3J/w,
	maorg-VPRAkNaXOzVWk0Htik3J/w, majd-VPRAkNaXOzVWk0Htik3J/w,
	Moses Reuben

From: Artemy Kovalyov <artemyko-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

When one of the L2/L3/L4 flow specification types is or-combined
with IBV_FLOW_SPEC_INNER, then the filter is applied on the inner
packet header. The flow specifications can contain inner and outer
parts for the inner and outer protocol header respectively.

Signed-off-by: Moses Reuben <mosesr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Artemy Kovalyov <artemyko-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Maor Gottlieb <maorg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 libibverbs/cmd.c                 | 11 +++++++++--
 libibverbs/man/ibv_create_flow.3 |  1 +
 libibverbs/verbs.h               |  3 ++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/libibverbs/cmd.c b/libibverbs/cmd.c
index 8814142..6bdd1c4 100644
--- a/libibverbs/cmd.c
+++ b/libibverbs/cmd.c
@@ -1747,8 +1747,9 @@ static int ib_spec_to_kern_spec(struct ibv_flow_spec *ib_spec,
 
 	kern_spec->hdr.type = ib_spec->hdr.type;
 
-	switch (ib_spec->hdr.type) {
+	switch (kern_spec->hdr.type) {
 	case IBV_FLOW_SPEC_ETH:
+	case IBV_FLOW_SPEC_ETH | IBV_FLOW_SPEC_INNER:
 		kern_spec->eth.size = sizeof(struct ibv_kern_spec_eth);
 		memcpy(&kern_spec->eth.val, &ib_spec->eth.val,
 		       sizeof(struct ibv_flow_eth_filter));
@@ -1756,6 +1757,7 @@ static int ib_spec_to_kern_spec(struct ibv_flow_spec *ib_spec,
 		       sizeof(struct ibv_flow_eth_filter));
 		break;
 	case IBV_FLOW_SPEC_IPV4:
+	case IBV_FLOW_SPEC_IPV4 | IBV_FLOW_SPEC_INNER:
 		kern_spec->ipv4.size = sizeof(struct ibv_kern_spec_ipv4);
 		memcpy(&kern_spec->ipv4.val, &ib_spec->ipv4.val,
 		       sizeof(struct ibv_flow_ipv4_filter));
@@ -1763,13 +1765,15 @@ static int ib_spec_to_kern_spec(struct ibv_flow_spec *ib_spec,
 		       sizeof(struct ibv_flow_ipv4_filter));
 		break;
 	case IBV_FLOW_SPEC_IPV4_EXT:
+	case IBV_FLOW_SPEC_IPV4_EXT | IBV_FLOW_SPEC_INNER:
 		ret = get_filters_size(ib_spec, kern_spec,
 				       &ib_filter_size, &kern_filter_size,
 				       IBV_FLOW_SPEC_IPV4_EXT);
 		if (ret)
 			return ret;
 
-		kern_spec->hdr.type = IBV_FLOW_SPEC_IPV4;
+		kern_spec->hdr.type = IBV_FLOW_SPEC_IPV4 |
+				     (IBV_FLOW_SPEC_INNER & ib_spec->hdr.type);
 		kern_spec->ipv4_ext.size = sizeof(struct
 						  ibv_kern_spec_ipv4_ext);
 		memcpy(&kern_spec->ipv4_ext.val, &ib_spec->ipv4_ext.val,
@@ -1778,6 +1782,7 @@ static int ib_spec_to_kern_spec(struct ibv_flow_spec *ib_spec,
 		       + ib_filter_size, kern_filter_size);
 		break;
 	case IBV_FLOW_SPEC_IPV6:
+	case IBV_FLOW_SPEC_IPV6 | IBV_FLOW_SPEC_INNER:
 		ret = get_filters_size(ib_spec, kern_spec,
 				       &ib_filter_size, &kern_filter_size,
 				       IBV_FLOW_SPEC_IPV6);
@@ -1792,6 +1797,8 @@ static int ib_spec_to_kern_spec(struct ibv_flow_spec *ib_spec,
 		break;
 	case IBV_FLOW_SPEC_TCP:
 	case IBV_FLOW_SPEC_UDP:
+	case IBV_FLOW_SPEC_TCP | IBV_FLOW_SPEC_INNER:
+	case IBV_FLOW_SPEC_UDP | IBV_FLOW_SPEC_INNER:
 		kern_spec->tcp_udp.size = sizeof(struct ibv_kern_spec_tcp_udp);
 		memcpy(&kern_spec->tcp_udp.val, &ib_spec->tcp_udp.val,
 		       sizeof(struct ibv_flow_ipv4_filter));
diff --git a/libibverbs/man/ibv_create_flow.3 b/libibverbs/man/ibv_create_flow.3
index 3056972..32a7572 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_INNER                    	= 0x100,  /* Flag making L2/L3/L4 specifications to be applied on the inner header */
 .in -8
 };
 .br
diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
index b41a116..225ab81 100644
--- a/libibverbs/verbs.h
+++ b/libibverbs/verbs.h
@@ -1223,7 +1223,8 @@ enum ibv_flow_spec_type {
 	IBV_FLOW_SPEC_IPV4_EXT		= 0x32,
 	IBV_FLOW_SPEC_TCP		= 0x40,
 	IBV_FLOW_SPEC_UDP		= 0x41,
-	IBV_FLOW_SPEC_VXLAN_TUNNEL	= 0x50
+	IBV_FLOW_SPEC_VXLAN_TUNNEL	= 0x50,
+	IBV_FLOW_SPEC_INNER		= 0x100
 };
 
 struct ibv_flow_eth_filter {
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH rdma-core 3/5] ibverbs: Add flow tag specification
       [not found] ` <1491405564-19735-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  2017-04-05 15:19   ` [PATCH rdma-core 1/5] ibverbs: Add tunnel VXLAN flow specification Yishai Hadas
  2017-04-05 15:19   ` [PATCH rdma-core 2/5] ibverbs: Add inner flow specification support Yishai Hadas
@ 2017-04-05 15:19   ` Yishai Hadas
  2017-04-05 15:19   ` [PATCH rdma-core 4/5] ibverbs: Add support for reading flow tag from a CQ Yishai Hadas
  2017-04-05 15:19   ` [PATCH rdma-core 5/5] mlx5: Add read_flow_tag implementation Yishai Hadas
  4 siblings, 0 replies; 6+ messages in thread
From: Yishai Hadas @ 2017-04-05 15:19 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	artemyko-VPRAkNaXOzVWk0Htik3J/w, yishaih-VPRAkNaXOzVWk0Htik3J/w,
	maorg-VPRAkNaXOzVWk0Htik3J/w, majd-VPRAkNaXOzVWk0Htik3J/w,
	Moses Reuben

From: Artemy Kovalyov <artemyko-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

The flow tag specification is used to identify flow with
specific tag-id.
This feature allows an application to request to add an action to tag
all the packets that matches this rule.
This tag-id will be later reported in the CQE.

Signed-off-by: Moses Reuben <mosesr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Artemy Kovalyov <artemyko-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Maor Gottlieb <maorg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 libibverbs/cmd.c                 |  5 +++++
 libibverbs/kern-abi.h            |  8 ++++++++
 libibverbs/man/ibv_create_flow.3 |  1 +
 libibverbs/verbs.h               | 10 +++++++++-
 4 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/libibverbs/cmd.c b/libibverbs/cmd.c
index 6bdd1c4..3a5aa4e 100644
--- a/libibverbs/cmd.c
+++ b/libibverbs/cmd.c
@@ -1818,6 +1818,11 @@ static int ib_spec_to_kern_spec(struct ibv_flow_spec *ib_spec,
 		memcpy(&kern_spec->tunnel.mask, (void *)&ib_spec->tunnel.val
 		       + ib_filter_size, kern_filter_size);
 		break;
+	case IBV_FLOW_SPEC_ACTION_TAG:
+		kern_spec->flow_tag.size =
+			sizeof(struct ibv_kern_spec_action_tag);
+		kern_spec->flow_tag.tag_id = ib_spec->flow_tag.tag_id;
+		break;
 	default:
 		return EINVAL;
 	}
diff --git a/libibverbs/kern-abi.h b/libibverbs/kern-abi.h
index f8bdc9d..448b2e8 100644
--- a/libibverbs/kern-abi.h
+++ b/libibverbs/kern-abi.h
@@ -918,6 +918,13 @@ struct ibv_kern_spec_tcp_udp {
 	struct ibv_kern_tcp_udp_filter mask;
 };
 
+struct ibv_kern_spec_action_tag {
+	__u32  type;
+	__u16  size;
+	__u16 reserved;
+	__u32 tag_id;
+	__u32 reserved1;
+};
 
 struct ibv_kern_tunnel_filter {
 	__u32 tunnel_id;
@@ -944,6 +951,7 @@ struct ibv_kern_spec {
 		struct ibv_kern_spec_tcp_udp tcp_udp;
 		struct ibv_kern_spec_ipv6 ipv6;
 		struct ibv_kern_spec_tunnel tunnel;
+		struct ibv_kern_spec_action_tag flow_tag;
 	};
 };
 
diff --git a/libibverbs/man/ibv_create_flow.3 b/libibverbs/man/ibv_create_flow.3
index 32a7572..32d47ad 100644
--- a/libibverbs/man/ibv_create_flow.3
+++ b/libibverbs/man/ibv_create_flow.3
@@ -68,6 +68,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_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 */
 .in -8
 };
 .br
diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
index 225ab81..5a4dcbc 100644
--- a/libibverbs/verbs.h
+++ b/libibverbs/verbs.h
@@ -1224,7 +1224,8 @@ enum ibv_flow_spec_type {
 	IBV_FLOW_SPEC_TCP		= 0x40,
 	IBV_FLOW_SPEC_UDP		= 0x41,
 	IBV_FLOW_SPEC_VXLAN_TUNNEL	= 0x50,
-	IBV_FLOW_SPEC_INNER		= 0x100
+	IBV_FLOW_SPEC_INNER		= 0x100,
+	IBV_FLOW_SPEC_ACTION_TAG	= 0x1000
 };
 
 struct ibv_flow_eth_filter {
@@ -1311,6 +1312,12 @@ struct ibv_flow_spec_tunnel {
 	struct ibv_flow_tunnel_filter mask;
 };
 
+struct ibv_flow_spec_action_tag {
+	enum ibv_flow_spec_type  type;
+	uint16_t  size;
+	uint32_t  tag_id;
+};
+
 struct ibv_flow_spec {
 	union {
 		struct {
@@ -1323,6 +1330,7 @@ struct ibv_flow_spec {
 		struct ibv_flow_spec_ipv4_ext ipv4_ext;
 		struct ibv_flow_spec_ipv6 ipv6;
 		struct ibv_flow_spec_tunnel tunnel;
+		struct ibv_flow_spec_action_tag flow_tag;
 	};
 };
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH rdma-core 4/5] ibverbs: Add support for reading flow tag from a CQ
       [not found] ` <1491405564-19735-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
                     ` (2 preceding siblings ...)
  2017-04-05 15:19   ` [PATCH rdma-core 3/5] ibverbs: Add flow tag specification Yishai Hadas
@ 2017-04-05 15:19   ` Yishai Hadas
  2017-04-05 15:19   ` [PATCH rdma-core 5/5] mlx5: Add read_flow_tag implementation Yishai Hadas
  4 siblings, 0 replies; 6+ messages in thread
From: Yishai Hadas @ 2017-04-05 15:19 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	artemyko-VPRAkNaXOzVWk0Htik3J/w, yishaih-VPRAkNaXOzVWk0Htik3J/w,
	maorg-VPRAkNaXOzVWk0Htik3J/w, majd-VPRAkNaXOzVWk0Htik3J/w,
	Moses Reuben

From: Artemy Kovalyov <artemyko-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Each steering flow may be marked with a tag which exposed in the
completion. Extend the poll_cq_ex mechanism with read_flow_tag callback
which reads the flow tag from the work completion.

Signed-off-by: Moses Reuben <mosesr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Artemy Kovalyov <artemyko-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Maor Gottlieb <maorg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 libibverbs/man/ibv_create_cq_ex.3 |  4 ++++
 libibverbs/verbs.h                | 10 +++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/libibverbs/man/ibv_create_cq_ex.3 b/libibverbs/man/ibv_create_cq_ex.3
index 020bbb4..7dfbef2 100644
--- a/libibverbs/man/ibv_create_cq_ex.3
+++ b/libibverbs/man/ibv_create_cq_ex.3
@@ -42,6 +42,7 @@ enum ibv_wc_flags_ex {
         IBV_WC_EX_WITH_DLID_PATH_BITS        = 1 << 6,  /* Require dlid path bits in WC */
         IBV_WC_EX_WITH_COMPLETION_TIMESTAMP  = 1 << 7,  /* Require completion timestamp in WC /*
         IBV_WC_EX_WITH_CVLAN                 = 1 << 8,  /* Require VLAN info in WC */
+        IBV_WC_EX_WITH_FLOW_TAG		     = 1 << 9,  /* Require flow tag in WC */
 };
 
 enum ibv_cq_init_attr_mask {
@@ -133,6 +134,9 @@ Below members and functions are used in order to poll the current completion. Th
 .BI "uint16_t ibv_wc_read_cvlan(struct ibv_cq_ex " "*cq"); \c
  Get the CVLAN field from the current completion.
 
+.BI "uint32_t ibv_wc_read_flow_tag(struct ibv_cq_ex " "*cq"); \c
+ Get flow tag from the current completion.
+
 .SH "RETURN VALUE"
 .B ibv_create_cq_ex()
 returns a pointer to the CQ, or NULL if the request fails.
diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
index 5a4dcbc..b27dfd1 100644
--- a/libibverbs/verbs.h
+++ b/libibverbs/verbs.h
@@ -437,6 +437,7 @@ enum ibv_create_cq_wc_flags {
 	IBV_WC_EX_WITH_DLID_PATH_BITS	= 1 << 6,
 	IBV_WC_EX_WITH_COMPLETION_TIMESTAMP	= 1 << 7,
 	IBV_WC_EX_WITH_CVLAN		= 1 << 8,
+	IBV_WC_EX_WITH_FLOW_TAG		= 1 << 9,
 };
 
 enum {
@@ -452,7 +453,8 @@ enum {
 enum {
 	IBV_CREATE_CQ_SUP_WC_FLAGS = IBV_WC_STANDARD_FLAGS |
 				IBV_WC_EX_WITH_COMPLETION_TIMESTAMP |
-				IBV_WC_EX_WITH_CVLAN
+				IBV_WC_EX_WITH_CVLAN |
+				IBV_WC_EX_WITH_FLOW_TAG
 };
 
 enum ibv_wc_flags {
@@ -1100,6 +1102,7 @@ struct ibv_cq_ex {
 	uint8_t (*read_dlid_path_bits)(struct ibv_cq_ex *current);
 	uint64_t (*read_completion_ts)(struct ibv_cq_ex *current);
 	uint16_t (*read_cvlan)(struct ibv_cq_ex *current);
+	uint32_t (*read_flow_tag)(struct ibv_cq_ex *current);
 };
 
 static inline struct ibv_cq *ibv_cq_ex_to_cq(struct ibv_cq_ex *cq)
@@ -1183,6 +1186,11 @@ static inline uint16_t ibv_wc_read_cvlan(struct ibv_cq_ex *cq)
 	return cq->read_cvlan(cq);
 }
 
+static inline uint32_t ibv_wc_read_flow_tag(struct ibv_cq_ex *cq)
+{
+	return cq->read_flow_tag(cq);
+}
+
 static inline int ibv_post_wq_recv(struct ibv_wq *wq,
 				   struct ibv_recv_wr *recv_wr,
 				   struct ibv_recv_wr **bad_recv_wr)
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH rdma-core 5/5] mlx5: Add read_flow_tag implementation
       [not found] ` <1491405564-19735-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
                     ` (3 preceding siblings ...)
  2017-04-05 15:19   ` [PATCH rdma-core 4/5] ibverbs: Add support for reading flow tag from a CQ Yishai Hadas
@ 2017-04-05 15:19   ` Yishai Hadas
  4 siblings, 0 replies; 6+ messages in thread
From: Yishai Hadas @ 2017-04-05 15:19 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	artemyko-VPRAkNaXOzVWk0Htik3J/w, yishaih-VPRAkNaXOzVWk0Htik3J/w,
	maorg-VPRAkNaXOzVWk0Htik3J/w, majd-VPRAkNaXOzVWk0Htik3J/w,
	Moses Reuben

From: Artemy Kovalyov <artemyko-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Each steering flow may be marked with a tag which exposed in the
completion. Implement read_flow_tag which allows reading the flow tag
from the work completion.

Signed-off-by: Moses Reuben <mosesr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Artemy Kovalyov <artemyko-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Maor Gottlieb <maorg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 providers/mlx5/cq.c    | 9 +++++++++
 providers/mlx5/mlx5.h  | 4 ++++
 providers/mlx5/verbs.c | 3 ++-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/providers/mlx5/cq.c b/providers/mlx5/cq.c
index 85d0c33..2e8b584 100644
--- a/providers/mlx5/cq.c
+++ b/providers/mlx5/cq.c
@@ -1196,6 +1196,13 @@ static inline uint16_t mlx5_cq_read_wc_cvlan(struct ibv_cq_ex *ibcq)
 	return be16toh(cq->cqe64->vlan_info);
 }
 
+static inline uint32_t mlx5_cq_read_flow_tag(struct ibv_cq_ex *ibcq)
+{
+	struct mlx5_cq *cq = to_mcq(ibv_cq_ex_to_cq(ibcq));
+
+	return be32toh(cq->cqe64->sop_drop_qpn) & MLX5_FLOW_TAG_MASK;
+}
+
 #define BIT(i) (1UL << (i))
 
 #define SINGLE_THREADED BIT(0)
@@ -1270,6 +1277,8 @@ void mlx5_cq_fill_pfns(struct mlx5_cq *cq, const struct ibv_cq_init_attr_ex *cq_
 		cq->ibv_cq.read_completion_ts = mlx5_cq_read_wc_completion_ts;
 	if (cq_attr->wc_flags & IBV_WC_EX_WITH_CVLAN)
 		cq->ibv_cq.read_cvlan = mlx5_cq_read_wc_cvlan;
+	if (cq_attr->wc_flags & IBV_WC_EX_WITH_FLOW_TAG)
+		cq->ibv_cq.read_flow_tag = mlx5_cq_read_flow_tag;
 }
 
 int mlx5_arm_cq(struct ibv_cq *ibvcq, int solicited)
diff --git a/providers/mlx5/mlx5.h b/providers/mlx5/mlx5.h
index bb383d4..0de40a8 100644
--- a/providers/mlx5/mlx5.h
+++ b/providers/mlx5/mlx5.h
@@ -184,6 +184,10 @@ enum mlx5_vendor_cap_flags {
 	MLX5_VENDOR_CAP_FLAGS_MPW		= 1 << 0,
 };
 
+enum {
+	MLX5_FLOW_TAG_MASK	= 0x000fffff,
+};
+
 struct mlx5_resource {
 	enum mlx5_rsc_type	type;
 	uint32_t		rsn;
diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c
index b7a8502..f0e4aab 100644
--- a/providers/mlx5/verbs.c
+++ b/providers/mlx5/verbs.c
@@ -328,7 +328,8 @@ static int qp_sig_enabled(void)
 enum {
 	CREATE_CQ_SUPPORTED_WC_FLAGS = IBV_WC_STANDARD_FLAGS	|
 				       IBV_WC_EX_WITH_COMPLETION_TIMESTAMP |
-				       IBV_WC_EX_WITH_CVLAN
+				       IBV_WC_EX_WITH_CVLAN |
+				       IBV_WC_EX_WITH_FLOW_TAG
 };
 
 enum {
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-04-05 15:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-05 15:19 [PATCH rdma-core 0/5] Flow steering improvements Yishai Hadas
     [not found] ` <1491405564-19735-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-04-05 15:19   ` [PATCH rdma-core 1/5] ibverbs: Add tunnel VXLAN flow specification Yishai Hadas
2017-04-05 15:19   ` [PATCH rdma-core 2/5] ibverbs: Add inner flow specification support Yishai Hadas
2017-04-05 15:19   ` [PATCH rdma-core 3/5] ibverbs: Add flow tag specification Yishai Hadas
2017-04-05 15:19   ` [PATCH rdma-core 4/5] ibverbs: Add support for reading flow tag from a CQ Yishai Hadas
2017-04-05 15:19   ` [PATCH rdma-core 5/5] mlx5: Add read_flow_tag implementation Yishai Hadas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.