DPDK patches and discussions
 help / color / mirror / Atom feed
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org, Declan Doherty <declan.doherty@intel.com>,
	Chas Williams <chas3@att.com>
Subject: [dpdk-dev] [PATCH v2 5/7] net/bonding: switch to flow API object conversion function
Date: Fri, 3 Aug 2018 15:36:41 +0200	[thread overview]
Message-ID: <20180803132032.29038-6-adrien.mazarguil@6wind.com> (raw)
In-Reply-To: <20180803132032.29038-1-adrien.mazarguil@6wind.com>

This patch replaces rte_flow_copy() with rte_flow_conv().

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Cc: Declan Doherty <declan.doherty@intel.com>
Cc: Chas Williams <chas3@att.com>
--
v2 changes:

- Patch was not present in original series.
---
 drivers/net/bonding/rte_eth_bond_api.c     |  6 ++---
 drivers/net/bonding/rte_eth_bond_flow.c    | 31 +++++++++++++++++++------
 drivers/net/bonding/rte_eth_bond_private.h |  5 +++-
 3 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 49fa2d78d..045c907cf 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -245,9 +245,9 @@ slave_rte_flow_prepare(uint16_t slave_id, struct bond_dev_private *internals)
 	}
 	TAILQ_FOREACH(flow, &internals->flow_list, next) {
 		flow->flows[slave_id] = rte_flow_create(slave_port_id,
-							&flow->fd->attr,
-							flow->fd->items,
-							flow->fd->actions,
+							flow->rule.attr,
+							flow->rule.pattern,
+							flow->rule.actions,
 							&ferror);
 		if (flow->flows[slave_id] == NULL) {
 			RTE_BOND_LOG(ERR, "Cannot create flow for slave"
diff --git a/drivers/net/bonding/rte_eth_bond_flow.c b/drivers/net/bonding/rte_eth_bond_flow.c
index 31e4bcaeb..f94d46ca4 100644
--- a/drivers/net/bonding/rte_eth_bond_flow.c
+++ b/drivers/net/bonding/rte_eth_bond_flow.c
@@ -2,8 +2,11 @@
  * Copyright 2018 Mellanox Technologies, Ltd
  */
 
+#include <stddef.h>
+#include <string.h>
 #include <sys/queue.h>
 
+#include <rte_errno.h>
 #include <rte_malloc.h>
 #include <rte_tailq.h>
 #include <rte_flow.h>
@@ -16,19 +19,33 @@ bond_flow_alloc(int numa_node, const struct rte_flow_attr *attr,
 		   const struct rte_flow_action *actions)
 {
 	struct rte_flow *flow;
-	size_t fdsz;
+	const struct rte_flow_conv_rule rule = {
+		.attr_ro = attr,
+		.pattern_ro = items,
+		.actions_ro = actions,
+	};
+	struct rte_flow_error error;
+	int ret;
 
-	fdsz = rte_flow_copy(NULL, 0, attr, items, actions);
-	flow = rte_zmalloc_socket(NULL, sizeof(struct rte_flow) + fdsz,
+	ret = rte_flow_conv(RTE_FLOW_CONV_OP_RULE, NULL, 0, &rule, &error);
+	if (ret < 0) {
+		RTE_BOND_LOG(ERR, "Unable to process flow rule (%s): %s",
+			     error.message ? error.message : "unspecified",
+			     strerror(rte_errno));
+		return NULL;
+	}
+	flow = rte_zmalloc_socket(NULL, offsetof(struct rte_flow, rule) + ret,
 				  RTE_CACHE_LINE_SIZE, numa_node);
 	if (unlikely(flow == NULL)) {
 		RTE_BOND_LOG(ERR, "Could not allocate new flow");
 		return NULL;
 	}
-	flow->fd = (void *)((uintptr_t)flow + sizeof(*flow));
-	if (unlikely(rte_flow_copy(flow->fd, fdsz, attr, items, actions) !=
-		     fdsz)) {
-		RTE_BOND_LOG(ERR, "Failed to copy flow description");
+	ret = rte_flow_conv(RTE_FLOW_CONV_OP_RULE, &flow->rule, ret, &rule,
+			    &error);
+	if (ret < 0) {
+		RTE_BOND_LOG(ERR, "Failed to copy flow rule (%s): %s",
+			     error.message ? error.message : "unspecified",
+			     strerror(rte_errno));
 		rte_free(flow);
 		return NULL;
 	}
diff --git a/drivers/net/bonding/rte_eth_bond_private.h b/drivers/net/bonding/rte_eth_bond_private.h
index 43e0e448d..61202845e 100644
--- a/drivers/net/bonding/rte_eth_bond_private.h
+++ b/drivers/net/bonding/rte_eth_bond_private.h
@@ -5,9 +5,11 @@
 #ifndef _RTE_ETH_BOND_PRIVATE_H_
 #define _RTE_ETH_BOND_PRIVATE_H_
 
+#include <stdint.h>
 #include <sys/queue.h>
 
 #include <rte_ethdev_driver.h>
+#include <rte_flow.h>
 #include <rte_spinlock.h>
 #include <rte_bitmap.h>
 #include <rte_flow_driver.h>
@@ -93,7 +95,8 @@ struct rte_flow {
 	/* Slaves flows */
 	struct rte_flow *flows[RTE_MAX_ETHPORTS];
 	/* Flow description for synchronization */
-	struct rte_flow_desc *fd;
+	struct rte_flow_conv_rule rule;
+	uint8_t rule_data[];
 };
 
 typedef void (*burst_xmit_hash_t)(struct rte_mbuf **buf, uint16_t nb_pkts,
-- 
2.11.0

  parent reply	other threads:[~2018-08-03 13:36 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-05  9:49 [dpdk-dev] [PATCH v1 0/7] Flow API helpers enhancements Adrien Mazarguil
2017-10-05  9:49 ` [dpdk-dev] [PATCH v1 1/7] ethdev: expose flow API error helper Adrien Mazarguil
2017-10-11  9:23   ` Thomas Monjalon
2017-10-11 11:56     ` Adrien Mazarguil
2017-10-11 19:05       ` Aaron Conole
2017-10-12 13:37         ` Neil Horman
2017-10-12 14:02         ` Adrien Mazarguil
2017-10-05  9:49 ` [dpdk-dev] [PATCH v1 2/7] ethdev: replace flow API object copy function Adrien Mazarguil
2017-10-05  9:49 ` [dpdk-dev] [PATCH v1 3/7] ethdev: add flow API item/action name conversion Adrien Mazarguil
2017-10-05  9:49 ` [dpdk-dev] [PATCH v1 4/7] app/testpmd: rely on flow API conversion function Adrien Mazarguil
2017-10-05  9:49 ` [dpdk-dev] [PATCH v1 5/7] ethdev: enhance flow API item/action descriptions Adrien Mazarguil
2017-10-05  9:49 ` [dpdk-dev] [PATCH v1 6/7] ethdev: generate flow API conversion header Adrien Mazarguil
2017-10-05  9:49 ` [dpdk-dev] [PATCH v1 7/7] ethdev: update " Adrien Mazarguil
2017-10-06  1:13 ` [dpdk-dev] [PATCH v1 0/7] Flow API helpers enhancements Ferruh Yigit
2017-10-06  8:05   ` Adrien Mazarguil
2017-10-10 18:05     ` Ferruh Yigit
2017-10-11  9:57       ` Adrien Mazarguil
2017-10-11 18:07         ` Ferruh Yigit
2017-10-12 12:53           ` Adrien Mazarguil
2017-10-12 16:37             ` Ferruh Yigit
2017-10-13 10:42               ` Adrien Mazarguil
2018-08-03 13:36 ` [dpdk-dev] [PATCH v2 0/7] ethdev: add flow API object converter Adrien Mazarguil
2018-08-03 13:36   ` [dpdk-dev] [PATCH v2 1/7] " Adrien Mazarguil
2018-08-03 13:36   ` [dpdk-dev] [PATCH v2 2/7] ethdev: add flow API item/action name conversion Adrien Mazarguil
2018-08-03 13:36   ` [dpdk-dev] [PATCH v2 3/7] app/testpmd: rely on flow API conversion function Adrien Mazarguil
2018-08-03 13:36   ` [dpdk-dev] [PATCH v2 4/7] net/failsafe: switch to flow API object " Adrien Mazarguil
2018-08-03 13:36   ` Adrien Mazarguil [this message]
2018-08-03 13:36   ` [dpdk-dev] [PATCH v2 6/7] ethdev: deprecate rte_flow_copy function Adrien Mazarguil
2018-08-03 13:36   ` [dpdk-dev] [PATCH v2 7/7] ethdev: add missing item/actions to flow object converter Adrien Mazarguil
2018-08-03 14:06   ` [dpdk-dev] [PATCH v2 0/7] ethdev: add flow API " Thomas Monjalon
2018-08-23 13:48   ` Ferruh Yigit
2018-08-27 15:14     ` Adrien Mazarguil
2018-08-24 10:58   ` Ferruh Yigit
2018-08-27 14:12     ` Adrien Mazarguil
2018-08-31  9:00   ` [dpdk-dev] [PATCH v3 " Adrien Mazarguil
2018-08-31  9:01     ` [dpdk-dev] [PATCH v3 1/7] " Adrien Mazarguil
2018-08-31  9:01     ` [dpdk-dev] [PATCH v3 2/7] ethdev: add flow API item/action name conversion Adrien Mazarguil
2018-08-31  9:01     ` [dpdk-dev] [PATCH v3 3/7] app/testpmd: rely on flow API conversion function Adrien Mazarguil
2018-08-31  9:01     ` [dpdk-dev] [PATCH v3 4/7] net/failsafe: switch to flow API object " Adrien Mazarguil
2018-08-31  9:01     ` [dpdk-dev] [PATCH v3 5/7] net/bonding: " Adrien Mazarguil
2018-08-31  9:01     ` [dpdk-dev] [PATCH v3 6/7] ethdev: add missing items/actions to flow object converter Adrien Mazarguil
2018-08-31  9:01     ` [dpdk-dev] [PATCH v3 7/7] ethdev: deprecate rte_flow_copy function Adrien Mazarguil
2018-10-04 14:21       ` Ferruh Yigit
2018-08-31 11:32     ` [dpdk-dev] [PATCH v3 0/7] ethdev: add flow API object converter Nélio Laranjeiro
2018-10-03 20:31       ` Thomas Monjalon
2018-10-04 14:25         ` Ferruh Yigit

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=20180803132032.29038-6-adrien.mazarguil@6wind.com \
    --to=adrien.mazarguil@6wind.com \
    --cc=chas3@att.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /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).