DPDK patches and discussions
 help / color / mirror / Atom feed
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v3 3/5] mlx5: make flow steering rule generator more generic
Date: Thu,  3 Mar 2016 15:26:42 +0100	[thread overview]
Message-ID: <1457015204-2941-4-git-send-email-adrien.mazarguil@6wind.com> (raw)
In-Reply-To: <1457015204-2941-1-git-send-email-adrien.mazarguil@6wind.com>

From: Yaacov Hazan <yaacovh@mellanox.com>

Upcoming flow director support will reuse this function to generate filter
rules.

Signed-off-by: Yaacov Hazan <yaacovh@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 drivers/net/mlx5/mlx5_mac.c    |  4 ++--
 drivers/net/mlx5/mlx5_rxmode.c |  5 +++--
 drivers/net/mlx5/mlx5_rxq.c    | 16 ++++++++--------
 drivers/net/mlx5/mlx5_rxtx.h   |  4 ++--
 4 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c
index a1a7ff5..edb05ad 100644
--- a/drivers/net/mlx5/mlx5_mac.c
+++ b/drivers/net/mlx5/mlx5_mac.c
@@ -241,7 +241,7 @@ hash_rxq_add_mac_flow(struct hash_rxq *hash_rxq, unsigned int mac_index,
 	const uint8_t (*mac)[ETHER_ADDR_LEN] =
 			(const uint8_t (*)[ETHER_ADDR_LEN])
 			priv->mac[mac_index].addr_bytes;
-	FLOW_ATTR_SPEC_ETH(data, hash_rxq_flow_attr(hash_rxq, NULL, 0));
+	FLOW_ATTR_SPEC_ETH(data, priv_flow_attr(priv, NULL, 0, hash_rxq->type));
 	struct ibv_exp_flow_attr *attr = &data->attr;
 	struct ibv_exp_flow_spec_eth *spec = &data->spec;
 	unsigned int vlan_enabled = !!priv->vlan_filter_n;
@@ -256,7 +256,7 @@ hash_rxq_add_mac_flow(struct hash_rxq *hash_rxq, unsigned int mac_index,
 	 * This layout is expected by libibverbs.
 	 */
 	assert(((uint8_t *)attr + sizeof(*attr)) == (uint8_t *)spec);
-	hash_rxq_flow_attr(hash_rxq, attr, sizeof(data));
+	priv_flow_attr(priv, attr, sizeof(data), hash_rxq->type);
 	/* The first specification must be Ethernet. */
 	assert(spec->type == IBV_EXP_FLOW_SPEC_ETH);
 	assert(spec->size == sizeof(*spec));
diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index 6ee7ce3..9ac7a41 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -129,8 +129,9 @@ static int
 hash_rxq_special_flow_enable(struct hash_rxq *hash_rxq,
 			     enum hash_rxq_flow_type flow_type)
 {
+	struct priv *priv = hash_rxq->priv;
 	struct ibv_exp_flow *flow;
-	FLOW_ATTR_SPEC_ETH(data, hash_rxq_flow_attr(hash_rxq, NULL, 0));
+	FLOW_ATTR_SPEC_ETH(data, priv_flow_attr(priv, NULL, 0, hash_rxq->type));
 	struct ibv_exp_flow_attr *attr = &data->attr;
 	struct ibv_exp_flow_spec_eth *spec = &data->spec;
 	const uint8_t *mac;
@@ -148,7 +149,7 @@ hash_rxq_special_flow_enable(struct hash_rxq *hash_rxq,
 	 * This layout is expected by libibverbs.
 	 */
 	assert(((uint8_t *)attr + sizeof(*attr)) == (uint8_t *)spec);
-	hash_rxq_flow_attr(hash_rxq, attr, sizeof(data));
+	priv_flow_attr(priv, attr, sizeof(data), hash_rxq->type);
 	/* The first specification must be Ethernet. */
 	assert(spec->type == IBV_EXP_FLOW_SPEC_ETH);
 	assert(spec->size == sizeof(*spec));
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index fcf192a..36910b2 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -210,27 +210,27 @@ const size_t rss_hash_default_key_len = sizeof(rss_hash_default_key);
  * information from hash_rxq_init[]. Nothing is written to flow_attr when
  * flow_attr_size is not large enough, but the required size is still returned.
  *
- * @param[in] hash_rxq
- *   Pointer to hash RX queue.
+ * @param priv
+ *   Pointer to private structure.
  * @param[out] flow_attr
  *   Pointer to flow attribute structure to fill. Note that the allocated
  *   area must be larger and large enough to hold all flow specifications.
  * @param flow_attr_size
  *   Entire size of flow_attr and trailing room for flow specifications.
+ * @param type
+ *   Hash RX queue type to use for flow steering rule.
  *
  * @return
  *   Total size of the flow attribute buffer. No errors are defined.
  */
 size_t
-hash_rxq_flow_attr(const struct hash_rxq *hash_rxq,
-		   struct ibv_exp_flow_attr *flow_attr,
-		   size_t flow_attr_size)
+priv_flow_attr(struct priv *priv, struct ibv_exp_flow_attr *flow_attr,
+	       size_t flow_attr_size, enum hash_rxq_type type)
 {
 	size_t offset = sizeof(*flow_attr);
-	enum hash_rxq_type type = hash_rxq->type;
 	const struct hash_rxq_init *init = &hash_rxq_init[type];
 
-	assert(hash_rxq->priv != NULL);
+	assert(priv != NULL);
 	assert((size_t)type < RTE_DIM(hash_rxq_init));
 	do {
 		offset += init->flow_spec.hdr.size;
@@ -244,7 +244,7 @@ hash_rxq_flow_attr(const struct hash_rxq *hash_rxq,
 		.type = IBV_EXP_FLOW_ATTR_NORMAL,
 		.priority = init->flow_priority,
 		.num_of_specs = 0,
-		.port = hash_rxq->priv->port,
+		.port = priv->port,
 		.flags = 0,
 	};
 	do {
diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index d5a5019..c42bb8d 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -270,8 +270,8 @@ extern const unsigned int hash_rxq_init_n;
 extern uint8_t rss_hash_default_key[];
 extern const size_t rss_hash_default_key_len;
 
-size_t hash_rxq_flow_attr(const struct hash_rxq *, struct ibv_exp_flow_attr *,
-			  size_t);
+size_t priv_flow_attr(struct priv *, struct ibv_exp_flow_attr *,
+		      size_t, enum hash_rxq_type);
 int priv_create_hash_rxqs(struct priv *);
 void priv_destroy_hash_rxqs(struct priv *);
 int priv_allow_flow_type(struct priv *, enum hash_rxq_flow_type);
-- 
2.1.4

  parent reply	other threads:[~2016-03-03 14:27 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-29 10:31 [dpdk-dev] [PATCH 0/5] Add flow director and RX VLAN stripping support Adrien Mazarguil
2016-01-29 10:31 ` [dpdk-dev] [PATCH 1/5] mlx5: refactor special flows handling Adrien Mazarguil
2016-01-29 10:31 ` [dpdk-dev] [PATCH 2/5] mlx5: add special flows (broadcast and IPv6 multicast) Adrien Mazarguil
2016-01-29 10:32 ` [dpdk-dev] [PATCH 3/5] mlx5: make flow steering rule generator more generic Adrien Mazarguil
2016-01-29 10:32 ` [dpdk-dev] [PATCH 4/5] mlx5: add support for flow director Adrien Mazarguil
2016-02-17 17:13   ` Bruce Richardson
2016-02-18 16:10     ` Adrien Mazarguil
2016-02-23 15:13       ` Bruce Richardson
2016-02-23 17:14         ` Thomas Monjalon
2016-02-23 17:38           ` Adrien Mazarguil
2016-01-29 10:32 ` [dpdk-dev] [PATCH 5/5] mlx5: add support for RX VLAN stripping Adrien Mazarguil
2016-02-17 17:14 ` [dpdk-dev] [PATCH 0/5] Add flow director and RX VLAN stripping support Bruce Richardson
2016-02-18 16:27   ` Adrien Mazarguil
2016-02-22 18:02 ` [dpdk-dev] [PATCH v2 " Adrien Mazarguil
2016-02-22 18:02   ` [dpdk-dev] [PATCH v2 1/5] mlx5: refactor special flows handling Adrien Mazarguil
2016-02-22 18:02   ` [dpdk-dev] [PATCH v2 2/5] mlx5: add special flows (broadcast and IPv6 multicast) Adrien Mazarguil
2016-02-22 18:02   ` [dpdk-dev] [PATCH v2 3/5] mlx5: make flow steering rule generator more generic Adrien Mazarguil
2016-02-22 18:02   ` [dpdk-dev] [PATCH v2 4/5] mlx5: add support for flow director Adrien Mazarguil
2016-02-22 18:02   ` [dpdk-dev] [PATCH v2 5/5] mlx5: add support for RX VLAN stripping Adrien Mazarguil
2016-03-03 14:26   ` [dpdk-dev] [PATCH v3 0/5] Add flow director and RX VLAN stripping support Adrien Mazarguil
2016-03-03 14:26     ` [dpdk-dev] [PATCH v3 1/5] mlx5: refactor special flows handling Adrien Mazarguil
2016-03-03 14:26     ` [dpdk-dev] [PATCH v3 2/5] mlx5: add special flows (broadcast and IPv6 multicast) Adrien Mazarguil
2016-03-03 14:26     ` Adrien Mazarguil [this message]
2016-03-03 14:26     ` [dpdk-dev] [PATCH v3 4/5] mlx5: add support for flow director Adrien Mazarguil
2016-03-03 14:26     ` [dpdk-dev] [PATCH v3 5/5] mlx5: add support for RX VLAN stripping Adrien Mazarguil
2016-03-09 16:11     ` [dpdk-dev] [PATCH v3 0/5] Add flow director and RX VLAN stripping support Bruce Richardson

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=1457015204-2941-4-git-send-email-adrien.mazarguil@6wind.com \
    --to=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).