From: Dariusz Sosnowski <dsosnowski@nvidia.com>
To: Thomas Monjalon <thomas@monjalon.net>,
Ferruh Yigit <ferruh.yigit@amd.com>,
Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Cc: <dev@dpdk.org>, Konstantin Ananyev <konstantin.ananyev@huawei.com>
Subject: [PATCH v3 3/4] ethdev: restore config only when requested
Date: Fri, 11 Oct 2024 20:51:36 +0200 [thread overview]
Message-ID: <20241011185137.277874-4-dsosnowski@nvidia.com> (raw)
In-Reply-To: <20241011185137.277874-1-dsosnowski@nvidia.com>
Use get_restore_flags() internal API introduced in previous commits
in rte_eth_dev_start(), to restore only the configuration
requested by the driver.
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
lib/ethdev/rte_ethdev.c | 31 +++++++++++++++++++++----------
1 file changed, 21 insertions(+), 10 deletions(-)
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 362a1883f0..c46107c4de 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -1719,20 +1719,27 @@ eth_dev_allmulticast_restore(struct rte_eth_dev *dev, uint16_t port_id)
static int
eth_dev_config_restore(struct rte_eth_dev *dev,
- struct rte_eth_dev_info *dev_info, uint16_t port_id)
+ struct rte_eth_dev_info *dev_info,
+ uint64_t restore_flags,
+ uint16_t port_id)
{
int ret;
- if (!(*dev_info->dev_flags & RTE_ETH_DEV_NOLIVE_MAC_ADDR))
+ if (!(*dev_info->dev_flags & RTE_ETH_DEV_NOLIVE_MAC_ADDR) &&
+ (restore_flags & RTE_ETH_RESTORE_MAC_ADDR))
eth_dev_mac_restore(dev, dev_info);
- ret = eth_dev_promiscuous_restore(dev, port_id);
- if (ret != 0)
- return ret;
+ if (restore_flags & RTE_ETH_RESTORE_PROMISC) {
+ ret = eth_dev_promiscuous_restore(dev, port_id);
+ if (ret != 0)
+ return ret;
+ }
- ret = eth_dev_allmulticast_restore(dev, port_id);
- if (ret != 0)
- return ret;
+ if (restore_flags & RTE_ETH_RESTORE_ALLMULTI) {
+ ret = eth_dev_allmulticast_restore(dev, port_id);
+ if (ret != 0)
+ return ret;
+ }
return 0;
}
@@ -1742,6 +1749,7 @@ rte_eth_dev_start(uint16_t port_id)
{
struct rte_eth_dev *dev;
struct rte_eth_dev_info dev_info;
+ uint64_t restore_flags;
int diag;
int ret, ret_stop;
@@ -1769,8 +1777,11 @@ rte_eth_dev_start(uint16_t port_id)
if (ret != 0)
return ret;
+ restore_flags = rte_eth_get_restore_flags(dev, RTE_ETH_START);
+
/* Lets restore MAC now if device does not support live change */
- if (*dev_info.dev_flags & RTE_ETH_DEV_NOLIVE_MAC_ADDR)
+ if ((*dev_info.dev_flags & RTE_ETH_DEV_NOLIVE_MAC_ADDR) &&
+ (restore_flags & RTE_ETH_RESTORE_MAC_ADDR))
eth_dev_mac_restore(dev, &dev_info);
diag = (*dev->dev_ops->dev_start)(dev);
@@ -1779,7 +1790,7 @@ rte_eth_dev_start(uint16_t port_id)
else
return eth_err(port_id, diag);
- ret = eth_dev_config_restore(dev, &dev_info, port_id);
+ ret = eth_dev_config_restore(dev, &dev_info, restore_flags, port_id);
if (ret != 0) {
RTE_ETHDEV_LOG_LINE(ERR,
"Error during restoring configuration for device (port %u): %s",
--
2.39.5
next prev parent reply other threads:[~2024-10-11 18:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-11 9:20 [PATCH 0/4] ethdev: rework config restore Dariusz Sosnowski
2024-10-11 9:21 ` [PATCH 1/4] " Dariusz Sosnowski
2024-10-11 9:21 ` [PATCH 2/4] ethdev: add get restore flags driver callback Dariusz Sosnowski
2024-10-11 9:21 ` [PATCH 3/4] ethdev: restore config only when requested Dariusz Sosnowski
2024-10-11 9:21 ` [PATCH 4/4] net/mlx5: disable config restore Dariusz Sosnowski
2024-10-11 9:33 ` [PATCH v2 0/4] ethdev: rework " Dariusz Sosnowski
2024-10-11 9:33 ` [PATCH v2 1/4] " Dariusz Sosnowski
2024-10-11 9:33 ` [PATCH v2 2/4] ethdev: add get restore flags driver callback Dariusz Sosnowski
2024-10-11 12:54 ` Konstantin Ananyev
2024-10-11 15:30 ` Dariusz Sosnowski
2024-10-11 9:33 ` [PATCH v2 3/4] ethdev: restore config only when requested Dariusz Sosnowski
2024-10-11 9:33 ` [PATCH v2 4/4] net/mlx5: disable config restore Dariusz Sosnowski
2024-10-11 18:51 ` [PATCH v3 0/4] ethdev: rework " Dariusz Sosnowski
2024-10-11 18:51 ` [PATCH v3 1/4] " Dariusz Sosnowski
2024-10-11 18:51 ` [PATCH v3 2/4] ethdev: add get restore flags driver callback Dariusz Sosnowski
2024-10-11 18:51 ` Dariusz Sosnowski [this message]
2024-10-11 18:51 ` [PATCH v3 4/4] net/mlx5: disable config restore Dariusz Sosnowski
2024-10-11 21:25 ` [PATCH v3 0/4] ethdev: rework " 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=20241011185137.277874-4-dsosnowski@nvidia.com \
--to=dsosnowski@nvidia.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=konstantin.ananyev@huawei.com \
--cc=thomas@monjalon.net \
/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).