* [PATCH 0/3] Subject: [PATCH 0/3] staging: octeon: Fix initialization pathways, parsing, and modernize statistics
@ 2026-11-08 11:48 Oscar Alejandro Sánchez Lucero via B4 Relay
2026-11-08 11:49 ` [PATCH 1/3] staging: octeon: disable PKO before device removal in probe error path Oscar Alejandro Sánchez Lucero via B4 Relay
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Oscar Alejandro Sánchez Lucero via B4 Relay @ 2026-11-08 11:48 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-staging, linux-kernel, Oscar Alejandro Sánchez Lucero
This series resolves critical initialization issues, structural edge cases
in string tokenization, and infrastructure modernizations within the core
ethernet interface logic of the Cavium Octeon staging driver (ethernet.c).
1. Fix a missing hardware resource cleanup step in the cvm_oct_probe() error
handling path by ensuring cvmx_pko_disable() is invoked dynamically prior
to device detachment.
2. Replace an unsafe prefix-matching strstr() evaluation within the
pow_send_list check with accurate comma-separated tokenization using
strsep() and strict strcmp() checking.
3. Migrate the legacy 32-bit ndo_get_stats net_device_ops callback to the
modern 64-bit ndo_get_stats64 atomic interface infrastructure to prevent
counter wrap-around bugs on SMP platforms.
Oscar Alejandro Sánchez Lucero (3):
staging: octeon: disable PKO before device removal in probe error path
staging: octeon: match exact interface names in pow_send_list
staging: octeon: convert from ndo_get_stats to ndo_get_stats64
Signed-off-by: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
---
Oscar Alejandro Sánchez Lucero (3):
staging: octeon: disable PKO before device removal in probe error path
staging: octeon: convert from ndo_get_stats to ndo_get_stats64
staging: octeon: match exact interface names in pow_send_list
drivers/staging/octeon/ethernet.c | 55 +++++++++++++++++++++++++--------------
1 file changed, 36 insertions(+), 19 deletions(-)
---
base-commit: ddfe51b0a0f5dc9e415cc2c8ad8db17532dd426b
change-id: 20261108-octeon-init-pipeline-v1-e25ec64f49e3
Best regards,
--
Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] staging: octeon: disable PKO before device removal in probe error path
2026-11-08 11:48 [PATCH 0/3] Subject: [PATCH 0/3] staging: octeon: Fix initialization pathways, parsing, and modernize statistics Oscar Alejandro Sánchez Lucero via B4 Relay
@ 2026-11-08 11:49 ` Oscar Alejandro Sánchez Lucero via B4 Relay
2026-11-08 11:49 ` [PATCH 2/3] staging: octeon: convert from ndo_get_stats to ndo_get_stats64 Oscar Alejandro Sánchez Lucero via B4 Relay
2026-11-08 11:49 ` [PATCH 3/3] staging: octeon: match exact interface names in pow_send_list Oscar Alejandro Sánchez Lucero via B4 Relay
2 siblings, 0 replies; 4+ messages in thread
From: Oscar Alejandro Sánchez Lucero via B4 Relay @ 2026-11-08 11:49 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-staging, linux-kernel, Oscar Alejandro Sánchez Lucero
From: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
cvm_oct_remove() calls cvmx_pko_disable() before removing devices and
shutting down PKO, ensuring packet output is halted while transmit
queues are torn down. However, the err_tx error path in cvm_oct_probe()
omits cvmx_pko_disable().
Add cvmx_pko_disable() to the probe error path to match the teardown
sequence in cvm_oct_remove().
Signed-off-by: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
---
drivers/staging/octeon/ethernet.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
index 42ec4b8324a8..c77678cb351f 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -959,6 +959,8 @@ static int cvm_oct_probe(struct platform_device *pdev)
atomic_inc_return(&cvm_oct_poll_queue_stopping);
+ cvmx_pko_disable();
+
/* Free the ethernet devices */
for (int port = 0; port < TOTAL_NUMBER_OF_PORTS; port++)
cvm_oct_remove_device(port);
--
2.56.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/3] staging: octeon: convert from ndo_get_stats to ndo_get_stats64
2026-11-08 11:48 [PATCH 0/3] Subject: [PATCH 0/3] staging: octeon: Fix initialization pathways, parsing, and modernize statistics Oscar Alejandro Sánchez Lucero via B4 Relay
2026-11-08 11:49 ` [PATCH 1/3] staging: octeon: disable PKO before device removal in probe error path Oscar Alejandro Sánchez Lucero via B4 Relay
@ 2026-11-08 11:49 ` Oscar Alejandro Sánchez Lucero via B4 Relay
2026-11-08 11:49 ` [PATCH 3/3] staging: octeon: match exact interface names in pow_send_list Oscar Alejandro Sánchez Lucero via B4 Relay
2 siblings, 0 replies; 4+ messages in thread
From: Oscar Alejandro Sánchez Lucero via B4 Relay @ 2026-11-08 11:49 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-staging, linux-kernel, Oscar Alejandro Sánchez Lucero
From: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
Migrate the network device operations from the legacy ndo_get_stats
callback to ndo_get_stats64, populating the caller-provided
rtnl_link_stats64 structure via netdev_stats_to_stats64().
Update cvm_oct_periodic_worker() and cvm_oct_common_init() to avoid
calling the removed ndo_get_stats pointer directly.
Signed-off-by: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
---
drivers/staging/octeon/ethernet.c | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
index c77678cb351f..8f9dd87752d7 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -141,12 +141,12 @@ static void cvm_oct_periodic_worker(struct work_struct *work)
struct octeon_ethernet *priv = container_of(work,
struct octeon_ethernet,
port_periodic_work.work);
+ struct rtnl_link_stats64 stats;
if (priv->poll)
priv->poll(cvm_oct_device[priv->port]);
- cvm_oct_device[priv->port]->netdev_ops->ndo_get_stats
- (cvm_oct_device[priv->port]);
+ dev_get_stats(cvm_oct_device[priv->port], &stats);
if (!atomic_read(&cvm_oct_poll_queue_stopping))
schedule_delayed_work(&priv->port_periodic_work, HZ);
@@ -208,12 +208,12 @@ int cvm_oct_free_work(void *work_queue_entry)
EXPORT_SYMBOL(cvm_oct_free_work);
/**
- * cvm_oct_common_get_stats - get the low level ethernet statistics
- * @dev: Device to get the statistics from
- *
- * Returns Pointer to the statistics
+ * cvm_oct_common_get_stats64 - get the low level ethernet statistics
+ * @dev: Device to get the statistics from
+ * @storage: Pointer to stats64 structure to populate
*/
-static struct net_device_stats *cvm_oct_common_get_stats(struct net_device *dev)
+static void cvm_oct_common_get_stats64(struct net_device *dev,
+ struct rtnl_link_stats64 *storage)
{
struct cvmx_pip_port_status rx_status;
struct cvmx_pko_port_status tx_status;
@@ -239,7 +239,7 @@ static struct net_device_stats *cvm_oct_common_get_stats(struct net_device *dev)
dev->stats.rx_dropped += rx_status.dropped_packets;
}
- return &dev->stats;
+ netdev_stats_to_stats64(storage, &dev->stats);
}
/**
@@ -421,6 +421,7 @@ static int cvm_oct_common_set_mac_address(struct net_device *dev, void *addr)
int cvm_oct_common_init(struct net_device *dev)
{
struct octeon_ethernet *priv = netdev_priv(dev);
+ struct rtnl_link_stats64 stats;
int ret;
ret = of_get_ethdev_address(priv->of_node, dev);
@@ -449,8 +450,8 @@ int cvm_oct_common_init(struct net_device *dev)
* Zero out stats for port so we won't mistakenly show
* counters from the bootloader.
*/
- memset(dev->netdev_ops->ndo_get_stats(dev), 0,
- sizeof(struct net_device_stats));
+ cvm_oct_common_get_stats64(dev, &stats);
+ memset(&dev->stats, 0, sizeof(dev->stats));
if (dev->netdev_ops->ndo_stop)
dev->netdev_ops->ndo_stop(dev);
@@ -540,7 +541,7 @@ static const struct net_device_ops cvm_oct_npi_netdev_ops = {
.ndo_set_mac_address = cvm_oct_common_set_mac_address,
.ndo_eth_ioctl = cvm_oct_ioctl,
.ndo_change_mtu = cvm_oct_common_change_mtu,
- .ndo_get_stats = cvm_oct_common_get_stats,
+ .ndo_get_stats64 = cvm_oct_common_get_stats64,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = cvm_oct_poll_controller,
#endif
@@ -556,7 +557,7 @@ static const struct net_device_ops cvm_oct_xaui_netdev_ops = {
.ndo_set_mac_address = cvm_oct_common_set_mac_address,
.ndo_eth_ioctl = cvm_oct_ioctl,
.ndo_change_mtu = cvm_oct_common_change_mtu,
- .ndo_get_stats = cvm_oct_common_get_stats,
+ .ndo_get_stats64 = cvm_oct_common_get_stats64,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = cvm_oct_poll_controller,
#endif
@@ -572,7 +573,7 @@ static const struct net_device_ops cvm_oct_sgmii_netdev_ops = {
.ndo_set_mac_address = cvm_oct_common_set_mac_address,
.ndo_eth_ioctl = cvm_oct_ioctl,
.ndo_change_mtu = cvm_oct_common_change_mtu,
- .ndo_get_stats = cvm_oct_common_get_stats,
+ .ndo_get_stats64 = cvm_oct_common_get_stats64,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = cvm_oct_poll_controller,
#endif
@@ -586,7 +587,7 @@ static const struct net_device_ops cvm_oct_spi_netdev_ops = {
.ndo_set_mac_address = cvm_oct_common_set_mac_address,
.ndo_eth_ioctl = cvm_oct_ioctl,
.ndo_change_mtu = cvm_oct_common_change_mtu,
- .ndo_get_stats = cvm_oct_common_get_stats,
+ .ndo_get_stats64 = cvm_oct_common_get_stats64,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = cvm_oct_poll_controller,
#endif
@@ -602,7 +603,7 @@ static const struct net_device_ops cvm_oct_rgmii_netdev_ops = {
.ndo_set_mac_address = cvm_oct_common_set_mac_address,
.ndo_eth_ioctl = cvm_oct_ioctl,
.ndo_change_mtu = cvm_oct_common_change_mtu,
- .ndo_get_stats = cvm_oct_common_get_stats,
+ .ndo_get_stats64 = cvm_oct_common_get_stats64,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = cvm_oct_poll_controller,
#endif
@@ -615,7 +616,7 @@ static const struct net_device_ops cvm_oct_pow_netdev_ops = {
.ndo_set_mac_address = cvm_oct_common_set_mac_address,
.ndo_eth_ioctl = cvm_oct_ioctl,
.ndo_change_mtu = cvm_oct_common_change_mtu,
- .ndo_get_stats = cvm_oct_common_get_stats,
+ .ndo_get_stats64 = cvm_oct_common_get_stats64,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = cvm_oct_poll_controller,
#endif
--
2.56.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/3] staging: octeon: match exact interface names in pow_send_list
2026-11-08 11:48 [PATCH 0/3] Subject: [PATCH 0/3] staging: octeon: Fix initialization pathways, parsing, and modernize statistics Oscar Alejandro Sánchez Lucero via B4 Relay
2026-11-08 11:49 ` [PATCH 1/3] staging: octeon: disable PKO before device removal in probe error path Oscar Alejandro Sánchez Lucero via B4 Relay
2026-11-08 11:49 ` [PATCH 2/3] staging: octeon: convert from ndo_get_stats to ndo_get_stats64 Oscar Alejandro Sánchez Lucero via B4 Relay
@ 2026-11-08 11:49 ` Oscar Alejandro Sánchez Lucero via B4 Relay
2 siblings, 0 replies; 4+ messages in thread
From: Oscar Alejandro Sánchez Lucero via B4 Relay @ 2026-11-08 11:49 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-staging, linux-kernel, Oscar Alejandro Sánchez Lucero
From: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
cvm_oct_common_init() checks whether dev->name is present in the
comma-separated pow_send_list module parameter using strstr(). This
causes false positives when one interface name is a prefix of another
(for example, matching "eth1" when pow_send_list contains "eth10").
Copy pow_send_list to a temporary buffer, tokenize it with strsep(),
and compare each comma-separated entry with strcmp().
Signed-off-by: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
---
drivers/staging/octeon/ethernet.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
index 8f9dd87752d7..1e3cf56deec4 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -432,9 +432,23 @@ int cvm_oct_common_init(struct net_device *dev)
* Force the interface to use the POW send if always_use_pow
* was specified or it is in the pow send list.
*/
- if ((pow_send_group != -1) &&
- (always_use_pow || strstr(pow_send_list, dev->name)))
- priv->queue = -1;
+ if (pow_send_group != -1) {
+ if (always_use_pow) {
+ priv->queue = -1;
+ } else if (pow_send_list[0]) {
+ char list[sizeof(pow_send_list)];
+ char *p = list;
+ char *token;
+
+ strscpy(list, pow_send_list, sizeof(list));
+ while ((token = strsep(&p, ",")) != NULL) {
+ if (!strcmp(token, dev->name)) {
+ priv->queue = -1;
+ break;
+ }
+ }
+ }
+ }
if (priv->queue != -1)
dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
--
2.56.0
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-08 11:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-08 11:48 [PATCH 0/3] Subject: [PATCH 0/3] staging: octeon: Fix initialization pathways, parsing, and modernize statistics Oscar Alejandro Sánchez Lucero via B4 Relay
2026-11-08 11:49 ` [PATCH 1/3] staging: octeon: disable PKO before device removal in probe error path Oscar Alejandro Sánchez Lucero via B4 Relay
2026-11-08 11:49 ` [PATCH 2/3] staging: octeon: convert from ndo_get_stats to ndo_get_stats64 Oscar Alejandro Sánchez Lucero via B4 Relay
2026-11-08 11:49 ` [PATCH 3/3] staging: octeon: match exact interface names in pow_send_list Oscar Alejandro Sánchez Lucero via B4 Relay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®