DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
To: dev@dpdk.org
Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Subject: [dpdk-dev] [PATCH v4 6/6] net/mlx5: extend IPv4 flow item
Date: Wed, 28 Dec 2016 11:37:19 +0100	[thread overview]
Message-ID: <1f97806aaedd239cd4a949abf2ccd1dedd95d3b8.1482920437.git.nelio.laranjeiro@6wind.com> (raw)
In-Reply-To: <cover.1482920437.git.nelio.laranjeiro@6wind.com>
In-Reply-To: <cover.1482920437.git.nelio.laranjeiro@6wind.com>

This commits adds:
- Type of service
- Next protocol ID

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 drivers/net/mlx5/mlx5_flow.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 01f7a77..77021b5 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -172,11 +172,13 @@ static const struct mlx5_flow_items mlx5_flow_items[] = {
 			.hdr = {
 				.src_addr = -1,
 				.dst_addr = -1,
+				.type_of_service = -1,
+				.next_proto_id = -1,
 			},
 		},
 		.mask_sz = sizeof(struct rte_flow_item_ipv4),
 		.convert = mlx5_flow_create_ipv4,
-		.dst_sz = sizeof(struct ibv_exp_flow_spec_ipv4),
+		.dst_sz = sizeof(struct ibv_exp_flow_spec_ipv4_ext),
 	},
 	[RTE_FLOW_ITEM_TYPE_IPV6] = {
 		.items = ITEMS(RTE_FLOW_ITEM_TYPE_UDP,
@@ -574,29 +576,35 @@ mlx5_flow_create_ipv4(const struct rte_flow_item *item, void *data)
 	const struct rte_flow_item_ipv4 *spec = item->spec;
 	const struct rte_flow_item_ipv4 *mask = item->mask;
 	struct mlx5_flow *flow = (struct mlx5_flow *)data;
-	struct ibv_exp_flow_spec_ipv4 *ipv4;
-	unsigned int ipv4_size = sizeof(struct ibv_exp_flow_spec_ipv4);
+	struct ibv_exp_flow_spec_ipv4_ext *ipv4;
+	unsigned int ipv4_size = sizeof(struct ibv_exp_flow_spec_ipv4_ext);
 
 	ipv4 = (void *)((uintptr_t)flow->ibv_attr + flow->offset);
-	*ipv4 = (struct ibv_exp_flow_spec_ipv4) {
-		.type = flow->inner | IBV_EXP_FLOW_SPEC_IPV4,
+	*ipv4 = (struct ibv_exp_flow_spec_ipv4_ext) {
+		.type = flow->inner | IBV_EXP_FLOW_SPEC_IPV4_EXT,
 		.size = ipv4_size,
 	};
 	if (spec) {
-		ipv4->val = (struct ibv_exp_flow_ipv4_filter){
+		ipv4->val = (struct ibv_exp_flow_ipv4_ext_filter){
 			.src_ip = spec->hdr.src_addr,
 			.dst_ip = spec->hdr.dst_addr,
+			.proto = spec->hdr.next_proto_id,
+			.tos = spec->hdr.type_of_service,
 		};
 	}
 	if (mask) {
-		ipv4->mask = (struct ibv_exp_flow_ipv4_filter){
+		ipv4->mask = (struct ibv_exp_flow_ipv4_ext_filter){
 			.src_ip = mask->hdr.src_addr,
 			.dst_ip = mask->hdr.dst_addr,
+			.proto = mask->hdr.next_proto_id,
+			.tos = mask->hdr.type_of_service,
 		};
 	}
 	/* Remove unwanted bits from values. */
 	ipv4->val.src_ip &= ipv4->mask.src_ip;
 	ipv4->val.dst_ip &= ipv4->mask.dst_ip;
+	ipv4->val.proto &= ipv4->mask.proto;
+	ipv4->val.tos &= ipv4->mask.tos;
 	++flow->ibv_attr->num_of_specs;
 	flow->ibv_attr->priority = 1;
 	return 0;
-- 
2.1.4

  parent reply	other threads:[~2016-12-28 10:37 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-25 18:14 [dpdk-dev] [PATCH 0/3] net/mlx5: support flow_rte Nelio Laranjeiro
2016-11-25 18:14 ` [dpdk-dev] [PATCH 1/3] net/mlx5: add preliminary support for rte_flow Nelio Laranjeiro
2016-11-25 18:14 ` [dpdk-dev] [PATCH 2/3] net/mlx5: add software " Nelio Laranjeiro
2016-11-25 18:14 ` [dpdk-dev] [PATCH 3/3] net/mlx5: add rte_flow rule creation Nelio Laranjeiro
2016-12-21 10:01 ` [dpdk-dev] [PATCH v2 0/4] net/mlx5: support flow_rte Nelio Laranjeiro
2016-12-21 15:19   ` [dpdk-dev] [PATCH v3 " Nelio Laranjeiro
2016-12-28 10:37     ` [dpdk-dev] [PATCH v4 0/6] net/mlx5: support flow API Nelio Laranjeiro
2016-12-29 15:15       ` [dpdk-dev] [PATCH v5 " Nelio Laranjeiro
2017-01-03 16:19         ` Ferruh Yigit
2017-01-04 14:48         ` Ferruh Yigit
2016-12-29 15:15       ` [dpdk-dev] [PATCH v5 1/6] net/mlx5: add preliminary flow API support Nelio Laranjeiro
2016-12-29 15:15       ` [dpdk-dev] [PATCH v5 2/6] net/mlx5: support basic flow items and actions Nelio Laranjeiro
2017-01-04 17:49         ` Ferruh Yigit
2017-01-04 18:42           ` Adrien Mazarguil
2017-01-06 13:52             ` Ferruh Yigit
2017-01-09 15:29               ` Adrien Mazarguil
2016-12-29 15:15       ` [dpdk-dev] [PATCH v5 3/6] net/mlx5: support VLAN flow item Nelio Laranjeiro
2016-12-29 15:15       ` [dpdk-dev] [PATCH v5 4/6] net/mlx5: support VXLAN " Nelio Laranjeiro
2016-12-29 15:15       ` [dpdk-dev] [PATCH v5 5/6] net/mlx5: support mark flow action Nelio Laranjeiro
2016-12-29 15:15       ` [dpdk-dev] [PATCH v5 6/6] net/mlx5: extend IPv4 flow item Nelio Laranjeiro
2016-12-28 10:37     ` [dpdk-dev] [PATCH v4 1/6] net/mlx5: add preliminary flow API support Nelio Laranjeiro
2016-12-28 10:37     ` [dpdk-dev] [PATCH v4 2/6] net/mlx5: support basic flow items and actions Nelio Laranjeiro
2016-12-28 10:37     ` [dpdk-dev] [PATCH v4 3/6] net/mlx5: support VLAN flow item Nelio Laranjeiro
2016-12-28 10:37     ` [dpdk-dev] [PATCH v4 4/6] net/mlx5: support VXLAN " Nelio Laranjeiro
2016-12-28 10:37     ` [dpdk-dev] [PATCH v4 5/6] net/mlx5: support mark flow action Nelio Laranjeiro
2016-12-28 10:37     ` Nelio Laranjeiro [this message]
2016-12-21 15:19   ` [dpdk-dev] [PATCH v3 1/4] net/mlx5: add preliminary support for rte_flow Nelio Laranjeiro
2016-12-21 15:19   ` [dpdk-dev] [PATCH v3 2/4] net/mlx5: add software " Nelio Laranjeiro
2016-12-23 12:19     ` Ferruh Yigit
2016-12-23 13:24       ` Adrien Mazarguil
2016-12-21 15:19   ` [dpdk-dev] [PATCH v3 3/4] net/mlx5: add rte_flow rule creation Nelio Laranjeiro
2016-12-23 12:21     ` Ferruh Yigit
2016-12-26 12:20       ` Nélio Laranjeiro
2016-12-21 15:19   ` [dpdk-dev] [PATCH v3 4/4] net/mlx5: add VLAN filter support in rte_flow Nelio Laranjeiro
2016-12-21 10:01 ` [dpdk-dev] [PATCH v2 1/4] net/mlx5: add preliminary support for rte_flow Nelio Laranjeiro
2016-12-21 10:01 ` [dpdk-dev] [PATCH v2 2/4] net/mlx5: add software " Nelio Laranjeiro
2016-12-21 10:01 ` [dpdk-dev] [PATCH v2 3/4] net/mlx5: add rte_flow rule creation Nelio Laranjeiro
2016-12-21 10:01 ` [dpdk-dev] [PATCH v2 4/4] net/mlx5: add VLAN filter support in rte_flow Nelio Laranjeiro

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=1f97806aaedd239cd4a949abf2ccd1dedd95d3b8.1482920437.git.nelio.laranjeiro@6wind.com \
    --to=nelio.laranjeiro@6wind.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).