From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9F21BA00C5; Wed, 3 Aug 2022 13:14:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CDB7F42B80; Wed, 3 Aug 2022 13:14:31 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 4B25B40141 for ; Wed, 3 Aug 2022 13:14:29 +0200 (CEST) Received: by shelob.oktetlabs.ru (Postfix, from userid 115) id E16E1D5; Wed, 3 Aug 2022 14:14:28 +0300 (MSK) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mail1.oktetlabs.ru X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=ALL_TRUSTED, DKIM_ADSP_DISCARD autolearn=no autolearn_force=no version=3.4.6 Received: from aros.oktetlabs.ru (aros.oktetlabs.ru [192.168.38.17]) by shelob.oktetlabs.ru (Postfix) with ESMTP id D1980C3; Wed, 3 Aug 2022 14:14:26 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru D1980C3 Authentication-Results: shelob.oktetlabs.ru/D1980C3; dkim=none; dkim-atps=neutral From: Andrew Rybchenko To: Jiawen Wu , Jian Wang 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 Message-Id: <20220803111358.375544-3-andrew.rybchenko@oktetlabs.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220803111358.375544-1-andrew.rybchenko@oktetlabs.ru> References: <20220803111358.375544-1-andrew.rybchenko@oktetlabs.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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