From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
To: Qiming Yang <qiming.yang@intel.com>, Wenjun Wu <wenjun1.wu@intel.com>
Cc: dev@dpdk.org
Subject: [PATCH 1/3] net/ixgbe: add helper to get Flow Director configuration
Date: Wed, 3 Aug 2022 14:13:56 +0300 [thread overview]
Message-ID: <20220803111358.375544-2-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/ixgbe/ixgbe_ethdev.c | 2 +-
drivers/net/ixgbe/ixgbe_ethdev.h | 3 +++
drivers/net/ixgbe/ixgbe_fdir.c | 32 +++++++++++------------
drivers/net/ixgbe/ixgbe_flow.c | 2 +-
drivers/net/ixgbe/ixgbe_rxtx_vec_common.h | 2 +-
5 files changed, 22 insertions(+), 19 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index f31bbb7895..1dfad0e63d 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -2690,7 +2690,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
/* Configure DCB hw */
ixgbe_configure_dcb(dev);
- if (dev->data->dev_conf.fdir_conf.mode != RTE_FDIR_MODE_NONE) {
+ if (IXGBE_DEV_FDIR_CONF(dev)->mode != RTE_FDIR_MODE_NONE) {
err = ixgbe_fdir_configure(dev);
if (err)
goto error;
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index cc6049a66a..eabefd6343 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -522,6 +522,9 @@ struct ixgbe_vf_representor {
int ixgbe_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params);
int ixgbe_vf_representor_uninit(struct rte_eth_dev *ethdev);
+#define IXGBE_DEV_FDIR_CONF(dev) \
+ (&(dev)->data->dev_conf.fdir_conf)
+
#define IXGBE_DEV_PRIVATE_TO_HW(adapter)\
(&((struct ixgbe_adapter *)adapter)->hw)
diff --git a/drivers/net/ixgbe/ixgbe_fdir.c b/drivers/net/ixgbe/ixgbe_fdir.c
index 834c1b3f51..06d6e2126d 100644
--- a/drivers/net/ixgbe/ixgbe_fdir.c
+++ b/drivers/net/ixgbe/ixgbe_fdir.c
@@ -317,7 +317,7 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev)
reg = IXGBE_PCI_REG_ADDR(hw, IXGBE_FDIRDIP4M);
*reg = ~(info->mask.dst_ipv4_mask);
- if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_SIGNATURE) {
+ if (IXGBE_DEV_FDIR_CONF(dev)->mode == RTE_FDIR_MODE_SIGNATURE) {
/*
* Store source and destination IPv6 masks (bit reversed)
*/
@@ -346,7 +346,7 @@ fdir_set_input_mask_x550(struct rte_eth_dev *dev)
uint32_t fdirm = IXGBE_FDIRM_POOL | IXGBE_FDIRM_DIPv6 |
IXGBE_FDIRM_FLEX;
uint32_t fdiripv6m;
- enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
+ enum rte_fdir_mode mode = IXGBE_DEV_FDIR_CONF(dev)->mode;
uint16_t mac_mask;
PMD_INIT_FUNC_TRACE();
@@ -469,7 +469,7 @@ static int
ixgbe_fdir_store_input_mask(struct rte_eth_dev *dev,
const struct rte_eth_fdir_masks *input_mask)
{
- enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
+ enum rte_fdir_mode mode = IXGBE_DEV_FDIR_CONF(dev)->mode;
if (mode >= RTE_FDIR_MODE_SIGNATURE &&
mode <= RTE_FDIR_MODE_PERFECT)
@@ -485,7 +485,7 @@ ixgbe_fdir_store_input_mask(struct rte_eth_dev *dev,
int
ixgbe_fdir_set_input_mask(struct rte_eth_dev *dev)
{
- enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
+ enum rte_fdir_mode mode = IXGBE_DEV_FDIR_CONF(dev)->mode;
if (mode >= RTE_FDIR_MODE_SIGNATURE &&
mode <= RTE_FDIR_MODE_PERFECT)
@@ -639,7 +639,7 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
int err;
uint32_t fdirctrl, pbsize;
int i;
- enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
+ enum rte_fdir_mode mode = IXGBE_DEV_FDIR_CONF(dev)->mode;
PMD_INIT_FUNC_TRACE();
@@ -658,7 +658,7 @@ ixgbe_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);
+ err = configure_fdir_flags(IXGBE_DEV_FDIR_CONF(dev), &fdirctrl);
if (err)
return err;
@@ -680,13 +680,13 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
for (i = 1; i < 8; i++)
IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), 0);
- err = fdir_set_input_mask(dev, &dev->data->dev_conf.fdir_conf.mask);
+ err = fdir_set_input_mask(dev, &IXGBE_DEV_FDIR_CONF(dev)->mask);
if (err < 0) {
PMD_INIT_LOG(ERR, " Error on setting FD mask");
return err;
}
- err = ixgbe_set_fdir_flex_conf(dev,
- &dev->data->dev_conf.fdir_conf.flex_conf, &fdirctrl);
+ err = ixgbe_set_fdir_flex_conf(dev, &IXGBE_DEV_FDIR_CONF(dev)->flex_conf,
+ &fdirctrl);
if (err < 0) {
PMD_INIT_LOG(ERR, " Error on setting FD flexible arguments.");
return err;
@@ -1121,7 +1121,7 @@ ixgbe_fdir_filter_program(struct rte_eth_dev *dev,
int err;
struct ixgbe_hw_fdir_info *info =
IXGBE_DEV_PRIVATE_TO_FDIR_INFO(dev->data->dev_private);
- enum rte_fdir_mode fdir_mode = dev->data->dev_conf.fdir_conf.mode;
+ enum rte_fdir_mode fdir_mode = IXGBE_DEV_FDIR_CONF(dev)->mode;
struct ixgbe_fdir_filter *node;
bool add_node = FALSE;
@@ -1165,12 +1165,12 @@ ixgbe_fdir_filter_program(struct rte_eth_dev *dev,
return -ENOTSUP;
}
fdirhash = atr_compute_perfect_hash_82599(&rule->ixgbe_fdir,
- dev->data->dev_conf.fdir_conf.pballoc);
+ IXGBE_DEV_FDIR_CONF(dev)->pballoc);
fdirhash |= rule->soft_id <<
IXGBE_FDIRHASH_SIG_SW_INDEX_SHIFT;
} else
fdirhash = atr_compute_sig_hash_82599(&rule->ixgbe_fdir,
- dev->data->dev_conf.fdir_conf.pballoc);
+ IXGBE_DEV_FDIR_CONF(dev)->pballoc);
if (del) {
err = ixgbe_remove_fdir_filter(info, &rule->ixgbe_fdir);
@@ -1188,7 +1188,7 @@ ixgbe_fdir_filter_program(struct rte_eth_dev *dev,
fdircmd_flags = (update) ? IXGBE_FDIRCMD_FILTER_UPDATE : 0;
if (rule->fdirflags & IXGBE_FDIRCMD_DROP) {
if (is_perfect) {
- queue = dev->data->dev_conf.fdir_conf.drop_queue;
+ queue = IXGBE_DEV_FDIR_CONF(dev)->drop_queue;
fdircmd_flags |= IXGBE_FDIRCMD_DROP;
} else {
PMD_DRV_LOG(ERR, "Drop option is not supported in"
@@ -1288,7 +1288,7 @@ ixgbe_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info *fdir_info
offset = ((fdirctrl & IXGBE_FDIRCTRL_FLEX_MASK) >>
IXGBE_FDIRCTRL_FLEX_SHIFT) * sizeof(uint16_t);
- fdir_info->mode = dev->data->dev_conf.fdir_conf.mode;
+ fdir_info->mode = IXGBE_DEV_FDIR_CONF(dev)->mode;
max_num = (1 << (FDIRENTRIES_NUM_SHIFT +
(fdirctrl & FDIRCTRL_PBALLOC_MASK)));
if (fdir_info->mode >= RTE_FDIR_MODE_PERFECT &&
@@ -1341,7 +1341,7 @@ ixgbe_fdir_stats_get(struct rte_eth_dev *dev, struct rte_eth_fdir_stats *fdir_st
struct ixgbe_hw_fdir_info *info =
IXGBE_DEV_PRIVATE_TO_FDIR_INFO(dev->data->dev_private);
uint32_t reg, max_num;
- enum rte_fdir_mode fdir_mode = dev->data->dev_conf.fdir_conf.mode;
+ enum rte_fdir_mode fdir_mode = IXGBE_DEV_FDIR_CONF(dev)->mode;
/* Get the information from registers */
reg = IXGBE_READ_REG(hw, IXGBE_FDIRFREE);
@@ -1398,7 +1398,7 @@ ixgbe_fdir_filter_restore(struct rte_eth_dev *dev)
IXGBE_DEV_PRIVATE_TO_FDIR_INFO(dev->data->dev_private);
struct ixgbe_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 = IXGBE_DEV_FDIR_CONF(dev)->mode;
if (fdir_mode >= RTE_FDIR_MODE_PERFECT &&
fdir_mode <= RTE_FDIR_MODE_PERFECT_TUNNEL)
diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index 368342872a..c018bbc0f1 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -2758,7 +2758,7 @@ ixgbe_parse_fdir_filter(struct rte_eth_dev *dev,
{
int ret;
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- enum rte_fdir_mode fdir_mode = dev->data->dev_conf.fdir_conf.mode;
+ enum rte_fdir_mode fdir_mode = IXGBE_DEV_FDIR_CONF(dev)->mode;
if (hw->mac.type != ixgbe_mac_82599EB &&
hw->mac.type != ixgbe_mac_X540 &&
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h b/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
index cd34d40987..a4d9ec9b08 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
@@ -277,7 +277,7 @@ static inline int
ixgbe_rx_vec_dev_conf_condition_check_default(struct rte_eth_dev *dev)
{
#ifndef RTE_LIBRTE_IEEE1588
- struct rte_eth_fdir_conf *fconf = &dev->data->dev_conf.fdir_conf;
+ struct rte_eth_fdir_conf *fconf = IXGBE_DEV_FDIR_CONF(dev);
/* no fdir support */
if (fconf->mode != RTE_FDIR_MODE_NONE)
--
2.30.2
next prev 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 ` Andrew Rybchenko [this message]
2022-08-03 11:13 ` [PATCH 2/3] net/txgbe: add helper to get " Andrew Rybchenko
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-2-andrew.rybchenko@oktetlabs.ru \
--to=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=qiming.yang@intel.com \
--cc=wenjun1.wu@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).