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 A64F5A00C5; Wed, 3 Aug 2022 13:14:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 155B242B98; Wed, 3 Aug 2022 13:14:33 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 514A540A7E for ; Wed, 3 Aug 2022 13:14:29 +0200 (CEST) Received: by shelob.oktetlabs.ru (Postfix, from userid 115) id EE945CD; 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 AC172C1; Wed, 3 Aug 2022 14:14:26 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru AC172C1 Authentication-Results: shelob.oktetlabs.ru/AC172C1; dkim=none; dkim-atps=neutral From: Andrew Rybchenko To: Qiming Yang , Wenjun Wu 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 Message-Id: <20220803111358.375544-2-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/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