DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
To: Jiawen Wu <jiawenwu@trustnetic.com>, Jian Wang <jianwang@trustnetic.com>
Cc: dev@dpdk.org
Subject: [PATCH 2/3] net/txgbe: add helper to get Flow Director configuration
Date: Wed,  3 Aug 2022 14:13:57 +0300	[thread overview]
Message-ID: <20220803111358.375544-3-andrew.rybchenko@oktetlabs.ru> (raw)
In-Reply-To: <20220803111358.375544-1-andrew.rybchenko@oktetlabs.ru>

Flow Director configuration is deprecated in generic ethdev device
configuration and will be removed. However, it is essential for
the driver flow API support and cannot be removed completely without
loss of flow API support. Prepare to move the configuration into
device private data.

Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
 drivers/net/txgbe/txgbe_ethdev.c |  2 +-
 drivers/net/txgbe/txgbe_ethdev.h |  2 ++
 drivers/net/txgbe/txgbe_fdir.c   | 24 +++++++++++-------------
 drivers/net/txgbe/txgbe_flow.c   |  2 +-
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
index 9dc9948219..0624568bdf 100644
--- a/drivers/net/txgbe/txgbe_ethdev.c
+++ b/drivers/net/txgbe/txgbe_ethdev.c
@@ -1719,7 +1719,7 @@ txgbe_dev_start(struct rte_eth_dev *dev)
 	txgbe_configure_port(dev);
 	txgbe_configure_dcb(dev);
 
-	if (dev->data->dev_conf.fdir_conf.mode != RTE_FDIR_MODE_NONE) {
+	if (TXGBE_DEV_FDIR_CONF(dev)->mode != RTE_FDIR_MODE_NONE) {
 		err = txgbe_fdir_configure(dev);
 		if (err)
 			goto error;
diff --git a/drivers/net/txgbe/txgbe_ethdev.h b/drivers/net/txgbe/txgbe_ethdev.h
index 262dbb5e38..e36a2c3d0d 100644
--- a/drivers/net/txgbe/txgbe_ethdev.h
+++ b/drivers/net/txgbe/txgbe_ethdev.h
@@ -373,6 +373,8 @@ struct txgbe_adapter {
 #define TXGBE_DEV_ADAPTER(dev) \
 	((struct txgbe_adapter *)(dev)->data->dev_private)
 
+#define TXGBE_DEV_FDIR_CONF(dev)	(&(dev)->data->dev_conf.fdir_conf)
+
 #define TXGBE_DEV_HW(dev) \
 	(&((struct txgbe_adapter *)(dev)->data->dev_private)->hw)
 
diff --git a/drivers/net/txgbe/txgbe_fdir.c b/drivers/net/txgbe/txgbe_fdir.c
index e303d87176..a198b6781b 100644
--- a/drivers/net/txgbe/txgbe_fdir.c
+++ b/drivers/net/txgbe/txgbe_fdir.c
@@ -170,7 +170,7 @@ txgbe_fdir_set_input_mask(struct rte_eth_dev *dev)
 {
 	struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
 	struct txgbe_hw_fdir_info *info = TXGBE_DEV_FDIR(dev);
-	enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
+	enum rte_fdir_mode mode = TXGBE_DEV_FDIR_CONF(dev)->mode;
 	/*
 	 * mask VM pool and DIPv6 since there are currently not supported
 	 * mask FLEX byte, it will be set in flex_conf
@@ -232,9 +232,8 @@ txgbe_fdir_set_input_mask(struct rte_eth_dev *dev)
 static int
 txgbe_fdir_store_input_mask(struct rte_eth_dev *dev)
 {
-	struct rte_eth_fdir_masks *input_mask =
-				&dev->data->dev_conf.fdir_conf.mask;
-	enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
+	struct rte_eth_fdir_masks *input_mask = &TXGBE_DEV_FDIR_CONF(dev)->mask;
+	enum rte_fdir_mode mode = TXGBE_DEV_FDIR_CONF(dev)->mode;
 	struct txgbe_hw_fdir_info *info = TXGBE_DEV_FDIR(dev);
 	uint16_t dst_ipv6m = 0;
 	uint16_t src_ipv6m = 0;
@@ -294,7 +293,7 @@ static int
 txgbe_set_fdir_flex_conf(struct rte_eth_dev *dev, uint32_t flex)
 {
 	const struct rte_eth_fdir_flex_conf *conf =
-				&dev->data->dev_conf.fdir_conf.flex_conf;
+				&TXGBE_DEV_FDIR_CONF(dev)->flex_conf;
 	struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
 	struct txgbe_hw_fdir_info *info = TXGBE_DEV_FDIR(dev);
 	const struct rte_eth_flex_payload_cfg *flex_cfg;
@@ -364,7 +363,7 @@ txgbe_fdir_configure(struct rte_eth_dev *dev)
 	int err;
 	uint32_t fdirctrl, flex, pbsize;
 	int i;
-	enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
+	enum rte_fdir_mode mode = TXGBE_DEV_FDIR_CONF(dev)->mode;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -373,8 +372,7 @@ txgbe_fdir_configure(struct rte_eth_dev *dev)
 	    mode != RTE_FDIR_MODE_PERFECT)
 		return -ENOSYS;
 
-	err = configure_fdir_flags(&dev->data->dev_conf.fdir_conf,
-				   &fdirctrl, &flex);
+	err = configure_fdir_flags(TXGBE_DEV_FDIR_CONF(dev), &fdirctrl, &flex);
 	if (err)
 		return err;
 
@@ -792,7 +790,7 @@ txgbe_fdir_filter_program(struct rte_eth_dev *dev,
 	bool is_perfect = FALSE;
 	int err;
 	struct txgbe_hw_fdir_info *info = TXGBE_DEV_FDIR(dev);
-	enum rte_fdir_mode fdir_mode = dev->data->dev_conf.fdir_conf.mode;
+	enum rte_fdir_mode fdir_mode = TXGBE_DEV_FDIR_CONF(dev)->mode;
 	struct txgbe_fdir_filter *node;
 
 	if (fdir_mode == RTE_FDIR_MODE_NONE ||
@@ -809,11 +807,11 @@ txgbe_fdir_filter_program(struct rte_eth_dev *dev,
 			return -ENOTSUP;
 		}
 		fdirhash = atr_compute_perfect_hash(&rule->input,
-				dev->data->dev_conf.fdir_conf.pballoc);
+				TXGBE_DEV_FDIR_CONF(dev)->pballoc);
 		fdirhash |= TXGBE_FDIRPIHASH_IDX(rule->soft_id);
 	} else {
 		fdirhash = atr_compute_signature_hash(&rule->input,
-				dev->data->dev_conf.fdir_conf.pballoc);
+				TXGBE_DEV_FDIR_CONF(dev)->pballoc);
 	}
 
 	if (del) {
@@ -839,7 +837,7 @@ txgbe_fdir_filter_program(struct rte_eth_dev *dev,
 				    " signature mode.");
 			return -EINVAL;
 		}
-		queue = dev->data->dev_conf.fdir_conf.drop_queue;
+		queue = TXGBE_DEV_FDIR_CONF(dev)->drop_queue;
 	} else if (rule->queue < TXGBE_MAX_RX_QUEUE_NUM) {
 		queue = rule->queue;
 	} else {
@@ -920,7 +918,7 @@ txgbe_fdir_filter_restore(struct rte_eth_dev *dev)
 	struct txgbe_hw_fdir_info *fdir_info = TXGBE_DEV_FDIR(dev);
 	struct txgbe_fdir_filter *node;
 	bool is_perfect = FALSE;
-	enum rte_fdir_mode fdir_mode = dev->data->dev_conf.fdir_conf.mode;
+	enum rte_fdir_mode fdir_mode = TXGBE_DEV_FDIR_CONF(dev)->mode;
 
 	if (fdir_mode >= RTE_FDIR_MODE_PERFECT &&
 	    fdir_mode <= RTE_FDIR_MODE_PERFECT_TUNNEL)
diff --git a/drivers/net/txgbe/txgbe_flow.c b/drivers/net/txgbe/txgbe_flow.c
index d0093c0163..26920f43d3 100644
--- a/drivers/net/txgbe/txgbe_flow.c
+++ b/drivers/net/txgbe/txgbe_flow.c
@@ -2439,7 +2439,7 @@ txgbe_parse_fdir_filter(struct rte_eth_dev *dev,
 {
 	int ret;
 	struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
-	enum rte_fdir_mode fdir_mode = dev->data->dev_conf.fdir_conf.mode;
+	enum rte_fdir_mode fdir_mode = TXGBE_DEV_FDIR_CONF(dev)->mode;
 
 	ret = txgbe_parse_fdir_filter_normal(dev, attr, pattern,
 					actions, rule, error);
-- 
2.30.2


  parent reply	other threads:[~2022-08-03 11:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-03 11:13 [PATCH 0/3] ethdev: remove deprecated " Andrew Rybchenko
2022-08-03 11:13 ` [PATCH 1/3] net/ixgbe: add helper to get " Andrew Rybchenko
2022-08-03 11:13 ` Andrew Rybchenko [this message]
2022-08-03 11:13 ` [PATCH 3/3] ethdev: remove deprecated " Andrew Rybchenko
2022-08-04 11:07   ` Dongdong Liu
2022-08-24  9:42 ` [PATCH 0/3] " Ferruh Yigit
2022-08-31 13:27   ` 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=20220803111358.375544-3-andrew.rybchenko@oktetlabs.ru \
    --to=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=jianwang@trustnetic.com \
    --cc=jiawenwu@trustnetic.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).