* [RFC 1/4] ethdev: rework config restore
2024-09-18 9:21 [RFC 0/4] ethdev: rework config restore Dariusz Sosnowski
@ 2024-09-18 9:21 ` Dariusz Sosnowski
2024-09-18 9:21 ` [RFC 2/4] ethdev: omit promiscuous config restore if not required Dariusz Sosnowski
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Dariusz Sosnowski @ 2024-09-18 9:21 UTC (permalink / raw)
To: Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko; +Cc: dev
Extract promiscuous and all multicast configuration restore
to separate functions.
This change will allow easier integration of disabling
these procedures for supporting PMDs in follow up commits.
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
lib/ethdev/rte_ethdev.c | 34 +++++++++++++++++++++++++++++-----
1 file changed, 29 insertions(+), 5 deletions(-)
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index f1c658f49e..362a1883f0 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -1648,14 +1648,10 @@ eth_dev_mac_restore(struct rte_eth_dev *dev,
}
static int
-eth_dev_config_restore(struct rte_eth_dev *dev,
- struct rte_eth_dev_info *dev_info, uint16_t port_id)
+eth_dev_promiscuous_restore(struct rte_eth_dev *dev, uint16_t port_id)
{
int ret;
- if (!(*dev_info->dev_flags & RTE_ETH_DEV_NOLIVE_MAC_ADDR))
- eth_dev_mac_restore(dev, dev_info);
-
/* replay promiscuous configuration */
/*
* use callbacks directly since we don't need port_id check and
@@ -1683,6 +1679,14 @@ eth_dev_config_restore(struct rte_eth_dev *dev,
}
}
+ return 0;
+}
+
+static int
+eth_dev_allmulticast_restore(struct rte_eth_dev *dev, uint16_t port_id)
+{
+ int ret;
+
/* replay all multicast configuration */
/*
* use callbacks directly since we don't need port_id check and
@@ -1713,6 +1717,26 @@ eth_dev_config_restore(struct rte_eth_dev *dev,
return 0;
}
+static int
+eth_dev_config_restore(struct rte_eth_dev *dev,
+ struct rte_eth_dev_info *dev_info, uint16_t port_id)
+{
+ int ret;
+
+ if (!(*dev_info->dev_flags & RTE_ETH_DEV_NOLIVE_MAC_ADDR))
+ eth_dev_mac_restore(dev, dev_info);
+
+ 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;
+
+ return 0;
+}
+
int
rte_eth_dev_start(uint16_t port_id)
{
--
2.39.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [RFC 2/4] ethdev: omit promiscuous config restore if not required
2024-09-18 9:21 [RFC 0/4] ethdev: rework config restore Dariusz Sosnowski
2024-09-18 9:21 ` [RFC 1/4] " Dariusz Sosnowski
@ 2024-09-18 9:21 ` Dariusz Sosnowski
2024-09-18 9:22 ` [RFC 3/4] ethdev: omit all multicast " Dariusz Sosnowski
2024-09-18 9:22 ` [RFC 4/4] ethdev: omit MAC address " Dariusz Sosnowski
3 siblings, 0 replies; 5+ messages in thread
From: Dariusz Sosnowski @ 2024-09-18 9:21 UTC (permalink / raw)
To: Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko; +Cc: dev
This patch adds a new device flag - RTE_ETH_DEV_PROMISC_FORCE_RESTORE.
If device driver sets this flag, then it requires that ethdev library
forcefully reapplies promiscuous mode configuration,
after the port is started.
As a result, unnecessary work can be removed from rte_eth_dev_start()
for drivers which apply all available configuration in dev_start()
(such drivers do not set the flag).
If RFC is approved, then the next version of this patch
should set the new flag for all drivers to maintain the same behavior,
until drivers adjust and it can be safely cleared.
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
lib/ethdev/rte_ethdev.c | 8 +++++---
lib/ethdev/rte_ethdev.h | 6 ++++++
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 362a1883f0..ff08abd566 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -1726,9 +1726,11 @@ eth_dev_config_restore(struct rte_eth_dev *dev,
if (!(*dev_info->dev_flags & RTE_ETH_DEV_NOLIVE_MAC_ADDR))
eth_dev_mac_restore(dev, dev_info);
- ret = eth_dev_promiscuous_restore(dev, port_id);
- if (ret != 0)
- return ret;
+ if (*dev_info->dev_flags & RTE_ETH_DEV_PROMISC_FORCE_RESTORE) {
+ ret = eth_dev_promiscuous_restore(dev, port_id);
+ if (ret != 0)
+ return ret;
+ }
ret = eth_dev_allmulticast_restore(dev, port_id);
if (ret != 0)
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index 548fada1c7..0fc23fb924 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -2120,6 +2120,12 @@ struct rte_eth_dev_owner {
* PMDs filling the queue xstats themselves should not set this flag
*/
#define RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS RTE_BIT32(6)
+/**
+ * If this flag is set, then device driver requires that
+ * ethdev library forcefully reapplies promiscuous mode configuration,
+ * after driver's dev_start() callback is called.
+ */
+#define RTE_ETH_DEV_PROMISC_FORCE_RESTORE RTE_BIT32(7)
/**@}*/
/**
--
2.39.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [RFC 3/4] ethdev: omit all multicast config restore if not required
2024-09-18 9:21 [RFC 0/4] ethdev: rework config restore Dariusz Sosnowski
2024-09-18 9:21 ` [RFC 1/4] " Dariusz Sosnowski
2024-09-18 9:21 ` [RFC 2/4] ethdev: omit promiscuous config restore if not required Dariusz Sosnowski
@ 2024-09-18 9:22 ` Dariusz Sosnowski
2024-09-18 9:22 ` [RFC 4/4] ethdev: omit MAC address " Dariusz Sosnowski
3 siblings, 0 replies; 5+ messages in thread
From: Dariusz Sosnowski @ 2024-09-18 9:22 UTC (permalink / raw)
To: Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko; +Cc: dev
This patch adds a new device flag - RTE_ETH_DEV_ALLMULTI_FORCE_RESTORE.
If device driver sets this flag, then it requires that ethdev library
forcefully reapplies allmulticast configration,
after the port is started.
As a result, unnecessary work can be removed from rte_eth_dev_start()
for drivers which apply all available configuration in dev_start()
(such drivers do not set the flag).
If RFC is approved, then the next version of this patch
should set the new flag for all drivers to maintain the same behavior,
until drivers adjust and it can be safely cleared.
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
lib/ethdev/rte_ethdev.c | 8 +++++---
lib/ethdev/rte_ethdev.h | 6 ++++++
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index ff08abd566..a08922a78a 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -1732,9 +1732,11 @@ eth_dev_config_restore(struct rte_eth_dev *dev,
return ret;
}
- ret = eth_dev_allmulticast_restore(dev, port_id);
- if (ret != 0)
- return ret;
+ if (*dev_info->dev_flags & RTE_ETH_DEV_ALLMULTI_FORCE_RESTORE) {
+ ret = eth_dev_allmulticast_restore(dev, port_id);
+ if (ret != 0)
+ return ret;
+ }
return 0;
}
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index 0fc23fb924..73405dd17d 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -2126,6 +2126,12 @@ struct rte_eth_dev_owner {
* after driver's dev_start() callback is called.
*/
#define RTE_ETH_DEV_PROMISC_FORCE_RESTORE RTE_BIT32(7)
+/**
+ * If this flag is set, then device driver requires that
+ * ethdev library forcefully reapplies allmulticast configuration,
+ * after driver's dev_start() callback is called.
+ */
+#define RTE_ETH_DEV_ALLMULTI_FORCE_RESTORE RTE_BIT32(8)
/**@}*/
/**
--
2.39.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [RFC 4/4] ethdev: omit MAC address restore if not required
2024-09-18 9:21 [RFC 0/4] ethdev: rework config restore Dariusz Sosnowski
` (2 preceding siblings ...)
2024-09-18 9:22 ` [RFC 3/4] ethdev: omit all multicast " Dariusz Sosnowski
@ 2024-09-18 9:22 ` Dariusz Sosnowski
3 siblings, 0 replies; 5+ messages in thread
From: Dariusz Sosnowski @ 2024-09-18 9:22 UTC (permalink / raw)
To: Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko; +Cc: dev
This patch adds a new device flag - RTE_ETH_DEV_MAC_ADDR_FORCE_RESTORE.
If device driver sets this flag, then it requires that ethdev library
forcefully reapplies configured MAC addresses,
after the port is started.
As a result, unnecessary work can be removed from rte_eth_dev_start()
for drivers which apply all available configuration in dev_start()
(such drivers do not the set the flag).
If RFC is approved, then the next version of this patch
should set the new flag for all drivers to maintain the same behavior,
until drivers adjust and it can be safely cleared.
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
lib/ethdev/rte_ethdev.c | 3 ++-
lib/ethdev/rte_ethdev.h | 6 ++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index a08922a78a..e4bb40cad8 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -1723,7 +1723,8 @@ eth_dev_config_restore(struct rte_eth_dev *dev,
{
int ret;
- if (!(*dev_info->dev_flags & RTE_ETH_DEV_NOLIVE_MAC_ADDR))
+ if ((*dev_info->dev_flags & RTE_ETH_DEV_MAC_ADDR_FORCE_RESTORE) &&
+ !(*dev_info->dev_flags & RTE_ETH_DEV_NOLIVE_MAC_ADDR))
eth_dev_mac_restore(dev, dev_info);
if (*dev_info->dev_flags & RTE_ETH_DEV_PROMISC_FORCE_RESTORE) {
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index 73405dd17d..deab07fbc0 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -2132,6 +2132,12 @@ struct rte_eth_dev_owner {
* after driver's dev_start() callback is called.
*/
#define RTE_ETH_DEV_ALLMULTI_FORCE_RESTORE RTE_BIT32(8)
+/**
+ * If this flag is set, then device driver requires that
+ * ethdev library forcefully reapplies active MAC addresses,
+ * after driver's dev_start() callback is called.
+ */
+#define RTE_ETH_DEV_MAC_ADDR_FORCE_RESTORE RTE_BIT32(9)
/**@}*/
/**
--
2.39.5
^ permalink raw reply [flat|nested] 5+ messages in thread