All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
To: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	artemyko-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
	yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
	maorg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
	majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
	Moses Reuben <mosesr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: [PATCH rdma-core 2/5] ibverbs: Add inner flow specification support
Date: Wed,  5 Apr 2017 18:19:21 +0300	[thread overview]
Message-ID: <1491405564-19735-3-git-send-email-yishaih@mellanox.com> (raw)
In-Reply-To: <1491405564-19735-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

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

  parent reply	other threads:[~2017-04-05 15:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` Yishai Hadas [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1491405564-19735-3-git-send-email-yishaih@mellanox.com \
    --to=yishaih-vpraknaxozvwk0htik3j/w@public.gmane.org \
    --cc=artemyko-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=maorg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=mosesr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.