* [PATCH 0/2] net/sfc: fix and extend secondary process support
@ 2026-08-20 13:03 Ivan Malov
2026-08-20 13:03 ` [PATCH 1/2] net/sfc: fix shared adapter pointer set in secondary process Ivan Malov
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Ivan Malov @ 2026-08-20 13:03 UTC (permalink / raw)
To: dev
Cc: Viacheslav Galaktionov, Roman Zhukov, Pieter Jansen van Vuuren,
Stephen Hemminger, Andrew Rybchenko
The series addresses two secondary process deficiencies.
Patch 1 adds a missing shared adapter pointer assignment to
the secondary process init path, preventing a NULL pointer
dereference at device close time.
Patch 2 pre-populates a primary-process device info cache
to satisfy the 'dev_infos_get' requirement now imposed by
the 'test-pmd' application on secondary processes.
Ivan Malov (2):
net/sfc: fix shared adapter pointer set in secondary process
net/sfc: provide cached dev info to use in secondary process
drivers/net/sfc/sfc.h | 7 +++++++
drivers/net/sfc/sfc_ethdev.c | 30 ++++++++++++++++++++++++++++++
2 files changed, 37 insertions(+)
--
2.47.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/2] net/sfc: fix shared adapter pointer set in secondary process
2026-08-20 13:03 [PATCH 0/2] net/sfc: fix and extend secondary process support Ivan Malov
@ 2026-08-20 13:03 ` Ivan Malov
2026-08-21 19:09 ` Stephen Hemminger
2026-08-20 13:03 ` [PATCH 2/2] net/sfc: provide cached dev info to use " Ivan Malov
` (2 subsequent siblings)
3 siblings, 1 reply; 11+ messages in thread
From: Ivan Malov @ 2026-08-20 13:03 UTC (permalink / raw)
To: dev
Cc: Viacheslav Galaktionov, Roman Zhukov, Pieter Jansen van Vuuren,
Stephen Hemminger, Andrew Rybchenko, stable
Add the missing assignment to preclude NULL pointer dereference that has
happened in the context of the secondary process at the dev close stage.
Fixes: 5313b441d8ae ("net/sfc: separate adapter primary process and shared data")
Cc: stable@dpdk.org
Signed-off-by: Ivan Malov <ivan.malov@arknetworks.am>
Reviewed-by: Viacheslav Galaktionov <viacheslav.galaktionov@arknetworks.am>
---
drivers/net/sfc/sfc_ethdev.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 6be91789cf..13619b4b9a 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -3224,6 +3224,7 @@ sfc_eth_dev_secondary_init(struct rte_eth_dev *dev, uint32_t logtype_main)
sap->dp_rx = dp_rx;
sap->dp_tx = dp_tx;
+ sap->shared = sas;
dev->process_private = sap;
dev->rx_pkt_burst = dp_rx->pkt_burst;
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/2] net/sfc: provide cached dev info to use in secondary process
2026-08-20 13:03 [PATCH 0/2] net/sfc: fix and extend secondary process support Ivan Malov
2026-08-20 13:03 ` [PATCH 1/2] net/sfc: fix shared adapter pointer set in secondary process Ivan Malov
@ 2026-08-20 13:03 ` Ivan Malov
2026-08-21 19:10 ` Stephen Hemminger
2026-08-21 23:45 ` [PATCH v2 0/2] net/sfc: fix and extend secondary process support Ivan Malov
2026-08-22 0:06 ` [PATCH v3 0/2] net/sfc: fix and extend secondary process support Ivan Malov
3 siblings, 1 reply; 11+ messages in thread
From: Ivan Malov @ 2026-08-20 13:03 UTC (permalink / raw)
To: dev
Cc: Viacheslav Galaktionov, Roman Zhukov, Pieter Jansen van Vuuren,
Stephen Hemminger, Andrew Rybchenko
Secondary process support in the 'test-pmd' application now requires that
the driver expose the 'dev_infos_get' method within that context. Use the
cached dev info from the primary process in order to meet the requirement.
Signed-off-by: Ivan Malov <ivan.malov@arknetworks.am>
Reviewed-by: Viacheslav Galaktionov <viacheslav.galaktionov@arknetworks.am>
---
drivers/net/sfc/sfc.h | 7 +++++++
drivers/net/sfc/sfc_ethdev.c | 29 +++++++++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h
index 629578549f..9fcc8c9044 100644
--- a/drivers/net/sfc/sfc.h
+++ b/drivers/net/sfc/sfc.h
@@ -156,6 +156,13 @@ struct sfc_adapter_shared {
unsigned int nb_repr_txq;
struct sfc_nic_dma_info nic_dma_info;
+
+ /*
+ * Snapshot of the 'sfc_dev_infos_get' output created by the primary
+ * process attach path for the secondary process to use in its own
+ * implementation of the 'dev_infos_get' method.
+ */
+ struct rte_eth_dev_info dev_info_cache;
};
/* Adapter process private data */
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 13619b4b9a..aa0e92b004 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -3163,7 +3163,22 @@ sfc_eth_dev_clear_ops(struct rte_eth_dev *dev)
sa->priv.dp_rx = NULL;
}
+static int
+sfc_dev_infos_get_secondary(struct rte_eth_dev *dev,
+ struct rte_eth_dev_info *dev_info)
+{
+ *dev_info = sfc_adapter_shared_by_eth_dev(dev)->dev_info_cache;
+
+ /*
+ * The cache holds a stale primary-process device pointer;
+ * restore the process-local one passed in by the caller.
+ */
+ dev_info->device = dev->device;
+ return 0;
+}
+
static const struct eth_dev_ops sfc_eth_dev_secondary_ops = {
+ .dev_infos_get = sfc_dev_infos_get_secondary,
.dev_supported_ptypes_get = sfc_dev_supported_ptypes_get,
.reta_query = sfc_dev_rss_reta_query,
.rss_hash_conf_get = sfc_dev_rss_hash_conf_get,
@@ -3443,6 +3458,20 @@ sfc_eth_dev_init(struct rte_eth_dev *dev, void *init_params)
sa->link_ev_need_poll = encp->enc_link_ev_need_poll;
+ /*
+ * Pre-populate the dev info cache for the secondary process.
+ * All prerequisites (probe, attach) are met at this point.
+ * The 'sfc_dev_infos_get' helper always returns 0.
+ *
+ * Care to initialise the switch info and reset the device
+ * pointer as it is going to be stale in the context of
+ * the secondary process and it will have to fix it.
+ */
+ sas->dev_info_cache.switch_info.domain_id =
+ RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID;
+ (void)sfc_dev_infos_get(dev, &sas->dev_info_cache);
+ sas->dev_info_cache.device = NULL;
+
sfc_adapter_unlock(sa);
sfc_log_init(sa, "done");
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] net/sfc: fix shared adapter pointer set in secondary process
2026-08-20 13:03 ` [PATCH 1/2] net/sfc: fix shared adapter pointer set in secondary process Ivan Malov
@ 2026-08-21 19:09 ` Stephen Hemminger
0 siblings, 0 replies; 11+ messages in thread
From: Stephen Hemminger @ 2026-08-21 19:09 UTC (permalink / raw)
To: Ivan Malov
Cc: dev, Viacheslav Galaktionov, Roman Zhukov,
Pieter Jansen van Vuuren, Andrew Rybchenko, stable
On Thu, 20 Aug 2026 17:03:13 +0400
Ivan Malov <ivan.malov@arknetworks.am> wrote:
> Add the missing assignment to preclude NULL pointer dereference that has
> happened in the context of the secondary process at the dev close stage.
>
> Fixes: 5313b441d8ae ("net/sfc: separate adapter primary process and shared data")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ivan Malov <ivan.malov@arknetworks.am>
> Reviewed-by: Viacheslav Galaktionov <viacheslav.galaktionov@arknetworks.am>
> ---
This is correct.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] net/sfc: provide cached dev info to use in secondary process
2026-08-20 13:03 ` [PATCH 2/2] net/sfc: provide cached dev info to use " Ivan Malov
@ 2026-08-21 19:10 ` Stephen Hemminger
0 siblings, 0 replies; 11+ messages in thread
From: Stephen Hemminger @ 2026-08-21 19:10 UTC (permalink / raw)
To: Ivan Malov
Cc: dev, Viacheslav Galaktionov, Roman Zhukov,
Pieter Jansen van Vuuren, Andrew Rybchenko
On Thu, 20 Aug 2026 17:03:14 +0400
Ivan Malov <ivan.malov@arknetworks.am> wrote:
> Secondary process support in the 'test-pmd' application now requires that
> the driver expose the 'dev_infos_get' method within that context. Use the
> cached dev info from the primary process in order to meet the requirement.
>
> Signed-off-by: Ivan Malov <ivan.malov@arknetworks.am>
> Reviewed-by: Viacheslav Galaktionov <viacheslav.galaktionov@arknetworks.am>
> ---
This patch has issues.
Patch 2/2: net/sfc: provide cached dev info to use in secondary process
Error: the cached snapshot is missing the defaults that
rte_eth_dev_info_get() fills in before it calls the driver callback,
so the secondary process reports zero for several fields.
rte_eth_dev_info_get() pre-populates the struct and then calls
.dev_infos_get(), so a PMD callback only has to set the fields it
actually knows about. Besides switch_info.domain_id and device
(both handled by this patch) it pre-sets:
rx_desc_lim.nb_seg_max = UINT16_MAX
rx_desc_lim.nb_mtu_seg_max = UINT16_MAX
tx_desc_lim.nb_seg_max = UINT16_MAX
tx_desc_lim.nb_mtu_seg_max = UINT16_MAX
rss_algo_capa = RTE_ETH_HASH_ALGO_CAPA_MASK(DEFAULT)
max_rx_bufsize = UINT32_MAX
sfc_dev_infos_get() never writes any of these, and neither do the
datapath get_dev_info() helpers (sfc_ef100_rx_get_dev_info() and
sfc_ef100_get_dev_info() only touch nb_min and nb_align). In the
primary process that is fine because the ethdev layer supplied the
values. Here the cache is filled by calling sfc_dev_infos_get()
directly on a zeroed structure, so those fields stay zero, and
sfc_dev_infos_get_secondary() then overwrites the ethdev pre-fill
wholesale with
*dev_info = sfc_adapter_shared_by_eth_dev(dev)->dev_info_cache;
A secondary process therefore sees nb_seg_max = 0,
nb_mtu_seg_max = 0, max_rx_bufsize = 0 and rss_algo_capa = 0, which
differs from what the same call returns in the primary. Applications
that validate multi-segment Tx against tx_desc_lim.nb_seg_max, or
that check the RSS hash algorithm capability mask, will get wrong
answers.
Suggested fix: seed the cache with the same defaults before the
snapshot is taken, e.g.
static const struct rte_eth_desc_lim lim = {
.nb_max = UINT16_MAX,
.nb_min = 0,
.nb_align = 1,
.nb_seg_max = UINT16_MAX,
.nb_mtu_seg_max = UINT16_MAX,
};
sas->dev_info_cache.rx_desc_lim = lim;
sas->dev_info_cache.tx_desc_lim = lim;
sas->dev_info_cache.max_rx_bufsize = UINT32_MAX;
sas->dev_info_cache.rss_algo_capa =
RTE_ETH_HASH_ALGO_CAPA_MASK(DEFAULT);
sas->dev_info_cache.switch_info.domain_id =
RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID;
(void)sfc_dev_infos_get(dev, &sas->dev_info_cache);
This duplicates ethdev knowledge in the driver and will drift when
new pre-filled fields are added. An alternative that avoids the
duplication is to have sfc_dev_infos_get_secondary() copy only the
fields the PMD owns, or to keep the caller's pre-filled struct and
merge the cached values into it.
Info: switch_info.name is left pointing at the primary process copy
of dev->device->driver->name. The comment in
sfc_dev_infos_get_secondary() only mentions the device pointer, but
this is the same class of problem; the string lives in the driver
image rather than in per-process heap, so it happens to work under
the usual multi-process assumptions, but it would be more consistent
to re-derive it next to the device pointer:
if (dev_info->switch_info.name != NULL)
dev_info->switch_info.name = dev->device->driver->name;
Info: the cache is a snapshot taken at the end of sfc_eth_dev_init().
Everything sfc_dev_infos_get() reports is fixed at attach time today
(NIC config, rxq_max/txq_max, offload capabilities, MAE status), so
the snapshot is accurate. Worth a note in the sfc.h comment that any
future dev_info field derived from post-attach state must not be
served from this cache.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 0/2] net/sfc: fix and extend secondary process support
2026-08-20 13:03 [PATCH 0/2] net/sfc: fix and extend secondary process support Ivan Malov
2026-08-20 13:03 ` [PATCH 1/2] net/sfc: fix shared adapter pointer set in secondary process Ivan Malov
2026-08-20 13:03 ` [PATCH 2/2] net/sfc: provide cached dev info to use " Ivan Malov
@ 2026-08-21 23:45 ` Ivan Malov
2026-08-21 23:45 ` [PATCH v2 1/2] net/sfc: fix shared adapter pointer set in secondary process Ivan Malov
2026-08-21 23:45 ` [PATCH v2 2/2] net/sfc: provide cached dev info to use " Ivan Malov
2026-08-22 0:06 ` [PATCH v3 0/2] net/sfc: fix and extend secondary process support Ivan Malov
3 siblings, 2 replies; 11+ messages in thread
From: Ivan Malov @ 2026-08-21 23:45 UTC (permalink / raw)
To: dev
Cc: Viacheslav Galaktionov, Roman Zhukov, Pieter Jansen van Vuuren,
Stephen Hemminger, Andrew Rybchenko
The series addresses two secondary process deficiencies.
Patch 1 adds a missing shared adapter pointer assignment to
the secondary process init path, preventing a NULL pointer
dereference at device close time.
Patch 2 pre-populates a primary-process device info cache
to satisfy the 'dev_infos_get' requirement now imposed by
the 'test-pmd' application on secondary processes.
v2:
- addressed https://mails.dpdk.org/archives/dev/2026-August/343941.html
Ivan Malov (2):
net/sfc: fix shared adapter pointer set in secondary process
net/sfc: provide cached dev info to use in secondary process
drivers/net/sfc/sfc.h | 19 ++++++++++++++
drivers/net/sfc/sfc_ethdev.c | 50 ++++++++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+)
--
2.47.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 1/2] net/sfc: fix shared adapter pointer set in secondary process
2026-08-21 23:45 ` [PATCH v2 0/2] net/sfc: fix and extend secondary process support Ivan Malov
@ 2026-08-21 23:45 ` Ivan Malov
2026-08-21 23:45 ` [PATCH v2 2/2] net/sfc: provide cached dev info to use " Ivan Malov
1 sibling, 0 replies; 11+ messages in thread
From: Ivan Malov @ 2026-08-21 23:45 UTC (permalink / raw)
To: dev
Cc: Viacheslav Galaktionov, Roman Zhukov, Pieter Jansen van Vuuren,
Stephen Hemminger, Andrew Rybchenko, stable
Add the missing assignment to preclude NULL pointer dereference that has
happened in the context of the secondary process at the dev close stage.
Fixes: 5313b441d8ae ("net/sfc: separate adapter primary process and shared data")
Cc: stable@dpdk.org
Signed-off-by: Ivan Malov <ivan.malov@arknetworks.am>
Reviewed-by: Viacheslav Galaktionov <viacheslav.galaktionov@arknetworks.am>
---
drivers/net/sfc/sfc_ethdev.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 6be91789cf..13619b4b9a 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -3224,6 +3224,7 @@ sfc_eth_dev_secondary_init(struct rte_eth_dev *dev, uint32_t logtype_main)
sap->dp_rx = dp_rx;
sap->dp_tx = dp_tx;
+ sap->shared = sas;
dev->process_private = sap;
dev->rx_pkt_burst = dp_rx->pkt_burst;
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 2/2] net/sfc: provide cached dev info to use in secondary process
2026-08-21 23:45 ` [PATCH v2 0/2] net/sfc: fix and extend secondary process support Ivan Malov
2026-08-21 23:45 ` [PATCH v2 1/2] net/sfc: fix shared adapter pointer set in secondary process Ivan Malov
@ 2026-08-21 23:45 ` Ivan Malov
1 sibling, 0 replies; 11+ messages in thread
From: Ivan Malov @ 2026-08-21 23:45 UTC (permalink / raw)
To: dev
Cc: Viacheslav Galaktionov, Roman Zhukov, Pieter Jansen van Vuuren,
Stephen Hemminger, Andrew Rybchenko
Secondary process support in the 'test-pmd' application now requires that
the driver expose the 'dev_infos_get' method within that context. Use the
cached dev info from the primary process in order to meet the requirement.
Signed-off-by: Ivan Malov <ivan.malov@arknetworks.am>
Reviewed-by: Viacheslav Galaktionov <viacheslav.galaktionov@arknetworks.am>
---
drivers/net/sfc/sfc.h | 19 ++++++++++++++
drivers/net/sfc/sfc_ethdev.c | 49 ++++++++++++++++++++++++++++++++++++
2 files changed, 68 insertions(+)
diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h
index 629578549f..809ad59148 100644
--- a/drivers/net/sfc/sfc.h
+++ b/drivers/net/sfc/sfc.h
@@ -156,6 +156,25 @@ struct sfc_adapter_shared {
unsigned int nb_repr_txq;
struct sfc_nic_dma_info nic_dma_info;
+
+ /*
+ * Snapshot of the 'rte_eth_dev_info_get' output created by the primary
+ * process attach path for the secondary process to use in its own
+ * implementation of the 'dev_infos_get' method.
+ *
+ * Some driver-computed fields derived from mutable post-attach state
+ * are knowingly stale, which is acceptable for the secondary process.
+ *
+ * This also contains a handful of stale fields which are normally
+ * set by the ethdev layer upon invocation of the 'dev_infos_get',
+ * so they will be overridden anyway in the secondary process.
+ */
+ struct rte_eth_dev_info dev_info_cache;
+ /*
+ * Set to 'true' by the probe function from the primary process. The
+ * secondary 'dev_infos_get' returns '-EAGAIN' when this is 'false'.
+ */
+ RTE_ATOMIC(bool) dev_info_cache_is_valid;
};
/* Adapter process private data */
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 13619b4b9a..2739985bab 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -16,7 +16,9 @@
#include <bus_pci_driver.h>
#include <rte_errno.h>
#include <rte_string_fns.h>
+#include <rte_stdatomic.h>
#include <rte_bitops.h>
+#include <rte_ethdev.h>
#include <rte_ether.h>
#include "efx.h"
@@ -3163,7 +3165,32 @@ sfc_eth_dev_clear_ops(struct rte_eth_dev *dev)
sa->priv.dp_rx = NULL;
}
+static int
+sfc_dev_infos_get_secondary(struct rte_eth_dev *dev,
+ struct rte_eth_dev_info *dev_info)
+{
+ const struct sfc_adapter_shared *sas =
+ sfc_adapter_shared_by_eth_dev(dev);
+ bool valid = rte_atomic_load_explicit(&sas->dev_info_cache_is_valid,
+ rte_memory_order_acquire);
+
+ if (!valid)
+ return -EAGAIN;
+
+ *dev_info = sas->dev_info_cache;
+
+ /*
+ * The cache holds stale primary-process pointers; restore
+ * the process-local values from the caller-supplied 'dev'.
+ */
+ if (dev_info->switch_info.name != NULL)
+ dev_info->switch_info.name = dev->device->driver->name;
+ dev_info->device = dev->device;
+ return 0;
+}
+
static const struct eth_dev_ops sfc_eth_dev_secondary_ops = {
+ .dev_infos_get = sfc_dev_infos_get_secondary,
.dev_supported_ptypes_get = sfc_dev_supported_ptypes_get,
.reta_query = sfc_dev_rss_reta_query,
.rss_hash_conf_get = sfc_dev_rss_hash_conf_get,
@@ -3749,6 +3776,7 @@ static int sfc_eth_dev_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
struct rte_pci_device *pci_dev)
{
struct sfc_ethdev_init_data init_data;
+ struct sfc_adapter_shared *sas;
struct rte_eth_devargs eth_da;
struct rte_eth_dev *dev;
bool dev_created;
@@ -3787,6 +3815,27 @@ static int sfc_eth_dev_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
if (rc != 0)
return rc;
+ sas = sfc_adapter_shared_by_eth_dev(dev);
+
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+ struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
+
+ /*
+ * Pre-fill the dev info cache for the secondary
+ * process. The port has been registered at this
+ * point, allowing use of the public API.
+ */
+ rc = rte_eth_dev_info_get(dev->data->port_id,
+ &sas->dev_info_cache);
+ if (rc == 0) {
+ sas->dev_info_cache.device = NULL;
+ rte_atomic_store_explicit(&sas->dev_info_cache_is_valid,
+ true, rte_memory_order_release);
+ } else {
+ sfc_warn(sa, "failed to cache dev info for the secondary process");
+ }
+ }
+
rc = sfc_eth_dev_create_representors(dev, ð_da);
if (rc != 0) {
if (dev_created)
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v3 0/2] net/sfc: fix and extend secondary process support
2026-08-20 13:03 [PATCH 0/2] net/sfc: fix and extend secondary process support Ivan Malov
` (2 preceding siblings ...)
2026-08-21 23:45 ` [PATCH v2 0/2] net/sfc: fix and extend secondary process support Ivan Malov
@ 2026-08-22 0:06 ` Ivan Malov
2026-08-22 0:06 ` [PATCH v3 1/2] net/sfc: fix shared adapter pointer set in secondary process Ivan Malov
2026-08-22 0:06 ` [PATCH v3 2/2] net/sfc: provide cached dev info to use " Ivan Malov
3 siblings, 2 replies; 11+ messages in thread
From: Ivan Malov @ 2026-08-22 0:06 UTC (permalink / raw)
To: dev
Cc: Viacheslav Galaktionov, Roman Zhukov, Pieter Jansen van Vuuren,
Stephen Hemminger, Andrew Rybchenko
The series addresses two secondary process deficiencies.
Patch 1 adds a missing shared adapter pointer assignment to
the secondary process init path, preventing a NULL pointer
dereference at device close time.
Patch 2 pre-populates a primary-process device info cache
to satisfy the 'dev_infos_get' requirement now imposed by
the 'test-pmd' application on secondary processes.
v3:
- cosmetic fix
v2:
- addressed https://mails.dpdk.org/archives/dev/2026-August/343941.html
Ivan Malov (2):
net/sfc: fix shared adapter pointer set in secondary process
net/sfc: provide cached dev info to use in secondary process
drivers/net/sfc/sfc.h | 19 ++++++++++++++
drivers/net/sfc/sfc_ethdev.c | 49 ++++++++++++++++++++++++++++++++++++
2 files changed, 68 insertions(+)
--
2.47.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 1/2] net/sfc: fix shared adapter pointer set in secondary process
2026-08-22 0:06 ` [PATCH v3 0/2] net/sfc: fix and extend secondary process support Ivan Malov
@ 2026-08-22 0:06 ` Ivan Malov
2026-08-22 0:06 ` [PATCH v3 2/2] net/sfc: provide cached dev info to use " Ivan Malov
1 sibling, 0 replies; 11+ messages in thread
From: Ivan Malov @ 2026-08-22 0:06 UTC (permalink / raw)
To: dev
Cc: Viacheslav Galaktionov, Roman Zhukov, Pieter Jansen van Vuuren,
Stephen Hemminger, Andrew Rybchenko, stable
Add the missing assignment to preclude NULL pointer dereference that has
happened in the context of the secondary process at the dev close stage.
Fixes: 5313b441d8ae ("net/sfc: separate adapter primary process and shared data")
Cc: stable@dpdk.org
Signed-off-by: Ivan Malov <ivan.malov@arknetworks.am>
Reviewed-by: Viacheslav Galaktionov <viacheslav.galaktionov@arknetworks.am>
---
drivers/net/sfc/sfc_ethdev.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 6be91789cf..13619b4b9a 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -3224,6 +3224,7 @@ sfc_eth_dev_secondary_init(struct rte_eth_dev *dev, uint32_t logtype_main)
sap->dp_rx = dp_rx;
sap->dp_tx = dp_tx;
+ sap->shared = sas;
dev->process_private = sap;
dev->rx_pkt_burst = dp_rx->pkt_burst;
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v3 2/2] net/sfc: provide cached dev info to use in secondary process
2026-08-22 0:06 ` [PATCH v3 0/2] net/sfc: fix and extend secondary process support Ivan Malov
2026-08-22 0:06 ` [PATCH v3 1/2] net/sfc: fix shared adapter pointer set in secondary process Ivan Malov
@ 2026-08-22 0:06 ` Ivan Malov
1 sibling, 0 replies; 11+ messages in thread
From: Ivan Malov @ 2026-08-22 0:06 UTC (permalink / raw)
To: dev
Cc: Viacheslav Galaktionov, Roman Zhukov, Pieter Jansen van Vuuren,
Stephen Hemminger, Andrew Rybchenko
Secondary process support in the 'test-pmd' application now requires that
the driver expose the 'dev_infos_get' method within that context. Use the
cached dev info from the primary process in order to meet the requirement.
Signed-off-by: Ivan Malov <ivan.malov@arknetworks.am>
Reviewed-by: Viacheslav Galaktionov <viacheslav.galaktionov@arknetworks.am>
---
drivers/net/sfc/sfc.h | 19 ++++++++++++++
drivers/net/sfc/sfc_ethdev.c | 48 ++++++++++++++++++++++++++++++++++++
2 files changed, 67 insertions(+)
diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h
index 629578549f..809ad59148 100644
--- a/drivers/net/sfc/sfc.h
+++ b/drivers/net/sfc/sfc.h
@@ -156,6 +156,25 @@ struct sfc_adapter_shared {
unsigned int nb_repr_txq;
struct sfc_nic_dma_info nic_dma_info;
+
+ /*
+ * Snapshot of the 'rte_eth_dev_info_get' output created by the primary
+ * process attach path for the secondary process to use in its own
+ * implementation of the 'dev_infos_get' method.
+ *
+ * Some driver-computed fields derived from mutable post-attach state
+ * are knowingly stale, which is acceptable for the secondary process.
+ *
+ * This also contains a handful of stale fields which are normally
+ * set by the ethdev layer upon invocation of the 'dev_infos_get',
+ * so they will be overridden anyway in the secondary process.
+ */
+ struct rte_eth_dev_info dev_info_cache;
+ /*
+ * Set to 'true' by the probe function from the primary process. The
+ * secondary 'dev_infos_get' returns '-EAGAIN' when this is 'false'.
+ */
+ RTE_ATOMIC(bool) dev_info_cache_is_valid;
};
/* Adapter process private data */
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 13619b4b9a..a02697a7cd 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -16,7 +16,9 @@
#include <bus_pci_driver.h>
#include <rte_errno.h>
#include <rte_string_fns.h>
+#include <rte_stdatomic.h>
#include <rte_bitops.h>
+#include <rte_ethdev.h>
#include <rte_ether.h>
#include "efx.h"
@@ -3163,7 +3165,32 @@ sfc_eth_dev_clear_ops(struct rte_eth_dev *dev)
sa->priv.dp_rx = NULL;
}
+static int
+sfc_dev_infos_get_secondary(struct rte_eth_dev *dev,
+ struct rte_eth_dev_info *dev_info)
+{
+ const struct sfc_adapter_shared *sas =
+ sfc_adapter_shared_by_eth_dev(dev);
+ bool valid = rte_atomic_load_explicit(&sas->dev_info_cache_is_valid,
+ rte_memory_order_acquire);
+
+ if (!valid)
+ return -EAGAIN;
+
+ *dev_info = sas->dev_info_cache;
+
+ /*
+ * The cache holds stale primary-process pointers; restore
+ * the process-local values from the caller-supplied 'dev'.
+ */
+ if (dev_info->switch_info.name != NULL)
+ dev_info->switch_info.name = dev->device->driver->name;
+ dev_info->device = dev->device;
+ return 0;
+}
+
static const struct eth_dev_ops sfc_eth_dev_secondary_ops = {
+ .dev_infos_get = sfc_dev_infos_get_secondary,
.dev_supported_ptypes_get = sfc_dev_supported_ptypes_get,
.reta_query = sfc_dev_rss_reta_query,
.rss_hash_conf_get = sfc_dev_rss_hash_conf_get,
@@ -3787,6 +3814,27 @@ static int sfc_eth_dev_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
if (rc != 0)
return rc;
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+ struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
+ struct sfc_adapter_shared *sas =
+ sfc_adapter_shared_by_eth_dev(dev);
+
+ /*
+ * Pre-fill the dev info cache for the secondary
+ * process. The port has been registered at this
+ * point, allowing use of the public API.
+ */
+ rc = rte_eth_dev_info_get(dev->data->port_id,
+ &sas->dev_info_cache);
+ if (rc == 0) {
+ sas->dev_info_cache.device = NULL;
+ rte_atomic_store_explicit(&sas->dev_info_cache_is_valid,
+ true, rte_memory_order_release);
+ } else {
+ sfc_warn(sa, "failed to cache dev info for the secondary process");
+ }
+ }
+
rc = sfc_eth_dev_create_representors(dev, ð_da);
if (rc != 0) {
if (dev_created)
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-08-22 0:07 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-20 13:03 [PATCH 0/2] net/sfc: fix and extend secondary process support Ivan Malov
2026-08-20 13:03 ` [PATCH 1/2] net/sfc: fix shared adapter pointer set in secondary process Ivan Malov
2026-08-21 19:09 ` Stephen Hemminger
2026-08-20 13:03 ` [PATCH 2/2] net/sfc: provide cached dev info to use " Ivan Malov
2026-08-21 19:10 ` Stephen Hemminger
2026-08-21 23:45 ` [PATCH v2 0/2] net/sfc: fix and extend secondary process support Ivan Malov
2026-08-21 23:45 ` [PATCH v2 1/2] net/sfc: fix shared adapter pointer set in secondary process Ivan Malov
2026-08-21 23:45 ` [PATCH v2 2/2] net/sfc: provide cached dev info to use " Ivan Malov
2026-08-22 0:06 ` [PATCH v3 0/2] net/sfc: fix and extend secondary process support Ivan Malov
2026-08-22 0:06 ` [PATCH v3 1/2] net/sfc: fix shared adapter pointer set in secondary process Ivan Malov
2026-08-22 0:06 ` [PATCH v3 2/2] net/sfc: provide cached dev info to use " Ivan Malov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox