* [PATCH net v2 00/10] net: systemport: Collection of fixes
@ 2026-09-22 23:24 Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 01/10] net: systemport: Fix buffer overflow in bcm_sysport_get_stats() Florian Fainelli
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: Florian Fainelli @ 2026-09-22 23:24 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, Doug Berger,
Broadcom internal kernel review list, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Zak Kemble, Simon Horman, Ryo Takakura, open list,
Nicolai Buchwitz
Changes in v2:
- dropped patch 4 and target it at net-next
- dropped patch 11 which needs more thinking as to what is the
appropriate DMA teardown sequence wrt. topctrl_flush
- addressed Nicolai's feedback
- added Nicolai's Reviewed-by tags where provided
Florian Fainelli (10):
net: systemport: Fix buffer overflow in bcm_sysport_get_stats()
net: systemport: Fix invalid dev_id argument in
bcm_sysport_poll_controller()
net: systemport: Fix NULL pointer dereference in
bcm_sysport_fini_rx_ring()
net: systemport: Fix Wake-on-LAN RXCHK filter enable loop
net: systemport: Fix RUNT MIB counter register offset calculation
net: systemport: Fix potential packet length underflow in
bcm_sysport_desc_rx()
net: systemport: Fix out-of-bounds array accesses in DSA queue mapping
net: systemport: Fix inverted error messages in bcm_sysport_stop()
net: systemport: Fix unbalanced Wake-on-LAN clock disable in resume
net: systemport: Update TDMA queue mapping dynamically on changeupper
drivers/net/ethernet/broadcom/bcmsysport.c | 73 +++++++++++++++-------
1 file changed, 50 insertions(+), 23 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net v2 01/10] net: systemport: Fix buffer overflow in bcm_sysport_get_stats()
2026-09-22 23:24 [PATCH net v2 00/10] net: systemport: Collection of fixes Florian Fainelli
@ 2026-09-22 23:24 ` Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 02/10] net: systemport: Fix invalid dev_id argument in bcm_sysport_poll_controller() Florian Fainelli
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Florian Fainelli @ 2026-09-22 23:24 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, Nicolai Buchwitz, Doug Berger,
Broadcom internal kernel review list, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Zak Kemble, Simon Horman, Ryo Takakura, open list
When running on SYSTEMPORT Lite, certain statistics are unsupported and
skipped during bcm_sysport_get_stats(). The variable 'j' tracks the
compacted index into the destination data buffer, whereas 'i' iterates
over all elements in bcm_sysport_gstrings_stats.
Because the buffer allocated by ethtool is sized only according to
bcm_sysport_get_sset_count(), storing values at data[i] instead of
data[j] writes past the allocated array bounds, leading to memory
corruption.
Fix this by writing to data[j] instead of data[i].
Fixes: 10377ba7673d ("net: systemport: Support 64bit statistics")
Assisted-by: LLM
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 4d06c6ba6641..db627cd15fb7 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -482,10 +482,10 @@ static void bcm_sysport_get_stats(struct net_device *dev,
s->type == BCM_SYSPORT_STAT_NETDEV64) {
do {
start = u64_stats_fetch_begin(syncp);
- data[i] = *(u64 *)p;
+ data[j] = *(u64 *)p;
} while (u64_stats_fetch_retry(syncp, start));
} else
- data[i] = *(u32 *)p;
+ data[j] = *(u32 *)p;
j++;
}
--
2.34.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net v2 02/10] net: systemport: Fix invalid dev_id argument in bcm_sysport_poll_controller()
2026-09-22 23:24 [PATCH net v2 00/10] net: systemport: Collection of fixes Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 01/10] net: systemport: Fix buffer overflow in bcm_sysport_get_stats() Florian Fainelli
@ 2026-09-22 23:24 ` Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 03/10] net: systemport: Fix NULL pointer dereference in bcm_sysport_fini_rx_ring() Florian Fainelli
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Florian Fainelli @ 2026-09-22 23:24 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, Nicolai Buchwitz, Doug Berger,
Broadcom internal kernel review list, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Zak Kemble, Simon Horman, Ryo Takakura, open list
Both bcm_sysport_rx_isr() and bcm_sysport_tx_isr() expect their second
argument (dev_id) to be a 'struct net_device *dev', as they call
netdev_priv(dev) to retrieve the private data structure.
bcm_sysport_poll_controller() was passing 'priv' instead of 'dev',
causing netdev_priv() inside the ISRs to treat 'priv' as a net_device,
leading to out-of-bounds pointer calculations and crashes when netconsole
or netpoll is triggered.
Fix this by passing 'dev' instead of 'priv' to the ISRs.
Fixes: 6cec4f5e00a3 ("net: systemport: Add netconsole support")
Assisted-by: LLM
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index db627cd15fb7..8328fe824d15 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1198,12 +1198,12 @@ static void bcm_sysport_poll_controller(struct net_device *dev)
struct bcm_sysport_priv *priv = netdev_priv(dev);
disable_irq(priv->irq0);
- bcm_sysport_rx_isr(priv->irq0, priv);
+ bcm_sysport_rx_isr(priv->irq0, dev);
enable_irq(priv->irq0);
if (!priv->is_lite) {
disable_irq(priv->irq1);
- bcm_sysport_tx_isr(priv->irq1, priv);
+ bcm_sysport_tx_isr(priv->irq1, dev);
enable_irq(priv->irq1);
}
}
--
2.34.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net v2 03/10] net: systemport: Fix NULL pointer dereference in bcm_sysport_fini_rx_ring()
2026-09-22 23:24 [PATCH net v2 00/10] net: systemport: Collection of fixes Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 01/10] net: systemport: Fix buffer overflow in bcm_sysport_get_stats() Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 02/10] net: systemport: Fix invalid dev_id argument in bcm_sysport_poll_controller() Florian Fainelli
@ 2026-09-22 23:24 ` Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 04/10] net: systemport: Fix Wake-on-LAN RXCHK filter enable loop Florian Fainelli
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Florian Fainelli @ 2026-09-22 23:24 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, Nicolai Buchwitz, Doug Berger,
Broadcom internal kernel review list, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Zak Kemble, Simon Horman, Ryo Takakura, open list
If allocation of priv->rx_cbs fails during bcm_sysport_init_rx_ring(),
error unwinding in bcm_sysport_open() calls bcm_sysport_fini_rx_ring().
Without checking if priv->rx_cbs is non-NULL, bcm_sysport_fini_rx_ring()
dereferences priv->rx_cbs, resulting in a NULL pointer dereference.
Add a check for !priv->rx_cbs at the beginning of
bcm_sysport_fini_rx_ring(), matching bcm_sysport_fini_tx_ring().
Fixes: 80105befdb4b ("net: systemport: add Broadcom SYSTEMPORT Ethernet MAC driver")
Assisted-by: LLM
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 8328fe824d15..b91a57540f55 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1717,6 +1717,9 @@ static void bcm_sysport_fini_rx_ring(struct bcm_sysport_priv *priv)
if (!(reg & RDMA_DISABLED))
netdev_warn(priv->netdev, "RDMA not stopped!\n");
+ if (!priv->rx_cbs)
+ return;
+
for (i = 0; i < priv->num_rx_bds; i++) {
cb = &priv->rx_cbs[i];
if (dma_unmap_addr(cb, dma_addr))
--
2.34.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net v2 04/10] net: systemport: Fix Wake-on-LAN RXCHK filter enable loop
2026-09-22 23:24 [PATCH net v2 00/10] net: systemport: Collection of fixes Florian Fainelli
` (2 preceding siblings ...)
2026-09-22 23:24 ` [PATCH net v2 03/10] net: systemport: Fix NULL pointer dereference in bcm_sysport_fini_rx_ring() Florian Fainelli
@ 2026-09-22 23:24 ` Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 05/10] net: systemport: Fix RUNT MIB counter register offset calculation Florian Fainelli
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Florian Fainelli @ 2026-09-22 23:24 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, Nicolai Buchwitz, Doug Berger,
Broadcom internal kernel review list, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Zak Kemble, Simon Horman, Ryo Takakura, open list
In bcm_sysport_suspend_to_wol(), the loop enabling programmed RXCHK
filters in RXCHK_CONTROL used an auxiliary counter 'i' instead of the
actual set filter index 'index'.
When non-contiguous filters were configured (for example, if filter 0
was deleted and filter 1 remained), the code would enable bit
(RXCHK_BRCM_TAG_MATCH_SHIFT + 0) corresponding to filter 0 rather than
filter 1, causing Wake-on-LAN filter matching to fail.
Fix this by using the filter 'index' to set the appropriate match bit
in RXCHK_CONTROL.
Fixes: bb9051a2b230 ("net: systemport: Add support for WAKE_FILTER")
Assisted-by: LLM
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index b91a57540f55..ec43aab11790 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -2648,7 +2648,7 @@ static int bcm_sysport_suspend_to_wol(struct bcm_sysport_priv *priv)
{
struct net_device *ndev = priv->netdev;
unsigned int timeout = 1000;
- unsigned int index, i = 0;
+ unsigned int index;
u32 reg;
reg = umac_readl(priv, UMAC_MPD_CTRL);
@@ -2678,10 +2678,8 @@ static int bcm_sysport_suspend_to_wol(struct bcm_sysport_priv *priv)
reg = rxchk_readl(priv, RXCHK_CONTROL);
reg &= ~(RXCHK_BRCM_TAG_MATCH_MASK <<
RXCHK_BRCM_TAG_MATCH_SHIFT);
- for_each_set_bit(index, priv->filters, RXCHK_BRCM_TAG_MAX) {
- reg |= BIT(RXCHK_BRCM_TAG_MATCH_SHIFT + i);
- i++;
- }
+ for_each_set_bit(index, priv->filters, RXCHK_BRCM_TAG_MAX)
+ reg |= BIT(RXCHK_BRCM_TAG_MATCH_SHIFT + index);
reg |= RXCHK_EN | RXCHK_BRCM_TAG_EN;
rxchk_writel(priv, reg, RXCHK_CONTROL);
}
--
2.34.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net v2 05/10] net: systemport: Fix RUNT MIB counter register offset calculation
2026-09-22 23:24 [PATCH net v2 00/10] net: systemport: Collection of fixes Florian Fainelli
` (3 preceding siblings ...)
2026-09-22 23:24 ` [PATCH net v2 04/10] net: systemport: Fix Wake-on-LAN RXCHK filter enable loop Florian Fainelli
@ 2026-09-22 23:24 ` Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 06/10] net: systemport: Fix potential packet length underflow in bcm_sysport_desc_rx() Florian Fainelli
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Florian Fainelli @ 2026-09-22 23:24 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, Nicolai Buchwitz, Doug Berger,
Broadcom internal kernel review list, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Zak Kemble, Simon Horman, Ryo Takakura, open list
In UniMAC hardware, there is a 0xC byte gap between the RX MIB counters
and the TX MIB counters, and a second 0xC byte gap between the TX MIB
counters and the RX RUNT MIB counters.
In bcm_sysport_update_mib_counters(), 'offset' was only set to
UMAC_MIB_STAT_OFFSET (0xC) for all non-RX counters, omitting the second
0xC gap for BCM_SYSPORT_STAT_RUNT counters. As a result, all 4 RUNT MIB
counters were read from unmapped gap register space.
Fix this by setting offset to 2 * UMAC_MIB_STAT_OFFSET (0x18) when
reading BCM_SYSPORT_STAT_RUNT counters.
Fixes: 80105befdb4b ("net: systemport: add Broadcom SYSTEMPORT Ethernet MAC driver")
Assisted-by: LLM
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index ec43aab11790..9c1b515dc8cc 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -391,8 +391,10 @@ static void bcm_sysport_update_mib_counters(struct bcm_sysport_priv *priv)
if (priv->is_lite)
continue;
- if (s->type != BCM_SYSPORT_STAT_MIB_RX)
+ if (s->type == BCM_SYSPORT_STAT_MIB_TX)
offset = UMAC_MIB_STAT_OFFSET;
+ else if (s->type == BCM_SYSPORT_STAT_RUNT)
+ offset = 2 * UMAC_MIB_STAT_OFFSET;
val = umac_readl(priv, UMAC_MIB_START + j + offset);
break;
case BCM_SYSPORT_STAT_RXCHK:
--
2.34.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net v2 06/10] net: systemport: Fix potential packet length underflow in bcm_sysport_desc_rx()
2026-09-22 23:24 [PATCH net v2 00/10] net: systemport: Collection of fixes Florian Fainelli
` (4 preceding siblings ...)
2026-09-22 23:24 ` [PATCH net v2 05/10] net: systemport: Fix RUNT MIB counter register offset calculation Florian Fainelli
@ 2026-09-22 23:24 ` Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 07/10] net: systemport: Fix out-of-bounds array accesses in DSA queue mapping Florian Fainelli
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Florian Fainelli @ 2026-09-22 23:24 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, Doug Berger,
Broadcom internal kernel review list, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Zak Kemble, Simon Horman, Ryo Takakura, open list,
Nicolai Buchwitz
In bcm_sysport_desc_rx(), the packet length 'len' extracted from the RSB
is only validated against RX_BUF_LENGTH. If a malformed or corrupted
frame is received with 'len' smaller than the prepended Receive Status
Block (sizeof(*rsb)) plus 2 padding bytes (and optional FCS).
Furthermore, subtracting (sizeof(*rsb) + 2) from 'len' (u16) will
underflow, resulting in corrupted packet stats and potential
out-of-bounds operations.
Fix this by ensuring 'len' is at least sizeof(*rsb) + 2 (plus
ETH_FCS_LEN if CRC forward is enabled) before proceeding.
Fixes: 80105befdb4b ("net: systemport: add Broadcom SYSTEMPORT Ethernet MAC driver")
Assisted-by: LLM
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 9c1b515dc8cc..ed4337af58da 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -781,8 +781,9 @@ static unsigned int bcm_sysport_desc_rx(struct bcm_sysport_priv *priv,
p_index, priv->rx_c_index, priv->rx_read_ptr,
len, status);
- if (unlikely(len > RX_BUF_LENGTH)) {
- netif_err(priv, rx_status, ndev, "oversized packet\n");
+ if (unlikely(len > RX_BUF_LENGTH ||
+ len < sizeof(*rsb) + 2 + (priv->crc_fwd ? ETH_FCS_LEN : 0))) {
+ netif_err(priv, rx_status, ndev, "invalid packet size: %d\n", len);
ndev->stats.rx_length_errors++;
ndev->stats.rx_errors++;
dev_kfree_skb_any(skb);
--
2.34.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net v2 07/10] net: systemport: Fix out-of-bounds array accesses in DSA queue mapping
2026-09-22 23:24 [PATCH net v2 00/10] net: systemport: Collection of fixes Florian Fainelli
` (5 preceding siblings ...)
2026-09-22 23:24 ` [PATCH net v2 06/10] net: systemport: Fix potential packet length underflow in bcm_sysport_desc_rx() Florian Fainelli
@ 2026-09-22 23:24 ` Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 08/10] net: systemport: Fix inverted error messages in bcm_sysport_stop() Florian Fainelli
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Florian Fainelli @ 2026-09-22 23:24 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, Doug Berger,
Broadcom internal kernel review list, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Zak Kemble, Simon Horman, Ryo Takakura, open list,
Nicolai Buchwitz
The priv->ring_map array has a fixed size of (DSA_MAX_PORTS * 8). In
bcm_sysport_select_queue(), bcm_sysport_map_queues(), and
bcm_sysport_unmap_queues(), indices calculated as
(qp + port * num_tx_queues) were accessed without checking against
ARRAY_SIZE(priv->ring_map). If unusual port or queue configurations are
encountered, this could lead to out-of-bounds array accesses.
Additionally, on SYSTEMPORT Lite, netif_set_real_num_tx_queues() was
called with slave_dev->num_tx_queues / 2, which could evaluate to 0 if
slave_dev->num_tx_queues is 1, causing netif_set_real_num_tx_queues() to
fail with -EINVAL.
Fix these by clamping the real number of queues to at least 1 and adding
bounds checks on priv->ring_map.
Fixes: d156576362c0 ("net: systemport: Establish lower/upper queue mapping")
Assisted-by: LLM
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index ed4337af58da..4efcefd33b78 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -2273,7 +2273,7 @@ static u16 bcm_sysport_select_queue(struct net_device *dev, struct sk_buff *skb,
struct bcm_sysport_priv *priv = netdev_priv(dev);
u16 queue = skb_get_queue_mapping(skb);
struct bcm_sysport_tx_ring *tx_ring;
- unsigned int q, port;
+ unsigned int q, port, index;
if (!netdev_uses_dsa(dev))
return netdev_pick_tx(dev, skb, NULL);
@@ -2281,8 +2281,11 @@ static u16 bcm_sysport_select_queue(struct net_device *dev, struct sk_buff *skb,
/* DSA tagging layer will have configured the correct queue */
q = BRCM_TAG_GET_QUEUE(queue);
port = BRCM_TAG_GET_PORT(queue);
- tx_ring = priv->ring_map[q + port * priv->per_port_num_tx_queues];
+ index = q + port * priv->per_port_num_tx_queues;
+ if (unlikely(index >= ARRAY_SIZE(priv->ring_map)))
+ return netdev_pick_tx(dev, skb, NULL);
+ tx_ring = priv->ring_map[index];
if (unlikely(!tx_ring))
return netdev_pick_tx(dev, skb, NULL);
@@ -2329,7 +2332,8 @@ static int bcm_sysport_map_queues(struct net_device *dev,
*/
if (priv->is_lite)
netif_set_real_num_tx_queues(slave_dev,
- slave_dev->num_tx_queues / 2);
+ max_t(unsigned int, 1,
+ slave_dev->num_tx_queues / 2));
num_tx_queues = slave_dev->real_num_tx_queues;
@@ -2352,7 +2356,8 @@ static int bcm_sysport_map_queues(struct net_device *dev,
ring->switch_queue = qp;
ring->switch_port = port;
ring->inspect = true;
- priv->ring_map[qp + port * num_tx_queues] = ring;
+ if (qp + port * num_tx_queues < ARRAY_SIZE(priv->ring_map))
+ priv->ring_map[qp + port * num_tx_queues] = ring;
qp++;
}
@@ -2383,7 +2388,8 @@ static int bcm_sysport_unmap_queues(struct net_device *dev,
ring->inspect = false;
qp = ring->switch_queue;
- priv->ring_map[qp + port * num_tx_queues] = NULL;
+ if (qp + port * num_tx_queues < ARRAY_SIZE(priv->ring_map))
+ priv->ring_map[qp + port * num_tx_queues] = NULL;
}
return 0;
--
2.34.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net v2 08/10] net: systemport: Fix inverted error messages in bcm_sysport_stop()
2026-09-22 23:24 [PATCH net v2 00/10] net: systemport: Collection of fixes Florian Fainelli
` (6 preceding siblings ...)
2026-09-22 23:24 ` [PATCH net v2 07/10] net: systemport: Fix out-of-bounds array accesses in DSA queue mapping Florian Fainelli
@ 2026-09-22 23:24 ` Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 09/10] net: systemport: Fix unbalanced Wake-on-LAN clock disable in resume Florian Fainelli
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Florian Fainelli @ 2026-09-22 23:24 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, Nicolai Buchwitz, Doug Berger,
Broadcom internal kernel review list, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Zak Kemble, Simon Horman, Ryo Takakura, open list
In bcm_sysport_stop(), the error messages printed when tdma_enable_set()
and rdma_enable_set() time out were inverted: the failure of
tdma_enable_set() logged 'timeout disabling RDMA' and the failure of
rdma_enable_set() logged 'timeout disabling TDMA'.
Swap the error messages so they correctly describe the failing engine.
Fixes: 80105befdb4b ("net: systemport: add Broadcom SYSTEMPORT Ethernet MAC driver")
Assisted-by: LLM
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 4efcefd33b78..11b2cb4cc792 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -2089,7 +2089,7 @@ static int bcm_sysport_stop(struct net_device *dev)
ret = tdma_enable_set(priv, 0);
if (ret) {
- netdev_err(dev, "timeout disabling RDMA\n");
+ netdev_err(dev, "timeout disabling TDMA\n");
return ret;
}
@@ -2098,7 +2098,7 @@ static int bcm_sysport_stop(struct net_device *dev)
ret = rdma_enable_set(priv, 0);
if (ret) {
- netdev_err(dev, "timeout disabling TDMA\n");
+ netdev_err(dev, "timeout disabling RDMA\n");
return ret;
}
--
2.34.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net v2 09/10] net: systemport: Fix unbalanced Wake-on-LAN clock disable in resume
2026-09-22 23:24 [PATCH net v2 00/10] net: systemport: Collection of fixes Florian Fainelli
` (7 preceding siblings ...)
2026-09-22 23:24 ` [PATCH net v2 08/10] net: systemport: Fix inverted error messages in bcm_sysport_stop() Florian Fainelli
@ 2026-09-22 23:24 ` Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 10/10] net: systemport: Update TDMA queue mapping dynamically on changeupper Florian Fainelli
2026-09-23 0:11 ` [PATCH net v2 00/10] net: systemport: Collection of fixes Jakub Kicinski
10 siblings, 0 replies; 12+ messages in thread
From: Florian Fainelli @ 2026-09-22 23:24 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, Nicolai Buchwitz, Doug Berger,
Broadcom internal kernel review list, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Zak Kemble, Simon Horman, Ryo Takakura, open list
In bcm_sysport_suspend(), the Wake-on-LAN clock (priv->wol_clk) is only
prepared and enabled if both device_may_wakeup(d) and priv->wolopts are
true.
In bcm_sysport_resume(), however, clk_disable_unprepare(priv->wol_clk)
was called whenever priv->wolopts was non-zero, regardless of
device_may_wakeup(d). If the system entered suspend with Wake-on-LAN
disabled at the device level (e.g., via sysfs wakeup control), this
resulted in an unbalanced clk_disable_unprepare() call on resume.
Fix this by mirroring the suspend check in bcm_sysport_resume().
Fixes: 6328a126896e ("net: systemport: Manage Wake-on-LAN clock")
Assisted-by: LLM
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 11b2cb4cc792..dedd49ad6c4e 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -2799,7 +2799,7 @@ static int __maybe_unused bcm_sysport_resume(struct device *d)
return ret;
}
- if (priv->wolopts)
+ if (device_may_wakeup(d) && priv->wolopts)
clk_disable_unprepare(priv->wol_clk);
umac_reset(priv);
--
2.34.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net v2 10/10] net: systemport: Update TDMA queue mapping dynamically on changeupper
2026-09-22 23:24 [PATCH net v2 00/10] net: systemport: Collection of fixes Florian Fainelli
` (8 preceding siblings ...)
2026-09-22 23:24 ` [PATCH net v2 09/10] net: systemport: Fix unbalanced Wake-on-LAN clock disable in resume Florian Fainelli
@ 2026-09-22 23:24 ` Florian Fainelli
2026-09-23 0:11 ` [PATCH net v2 00/10] net: systemport: Collection of fixes Jakub Kicinski
10 siblings, 0 replies; 12+ messages in thread
From: Florian Fainelli @ 2026-09-22 23:24 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, Doug Berger,
Broadcom internal kernel review list, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Zak Kemble, Simon Horman, Ryo Takakura, open list,
Nicolai Buchwitz
When DSA upper devices are dynamically attached or detached while the
master SYSTEMPORT interface is already up and running (netif_running()),
bcm_sysport_map_queues() and bcm_sysport_unmap_queues() updated the
internal software mappings but did not update the TDMA_DESC_RING_MAPPING
hardware registers, because programming was previously deferred until
bcm_sysport_init_tx_ring().
Update TDMA_DESC_RING_MAPPING registers immediately if netif_running()
is true during map_queues and unmap_queues.
Fixes: 1593cd40d785 ("net: systemport: use standard netdevice notifier to detect DSA presence")
Assisted-by: LLM
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 23 +++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index dedd49ad6c4e..ca1b86953dba 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -2315,6 +2315,7 @@ static int bcm_sysport_map_queues(struct net_device *dev,
struct bcm_sysport_tx_ring *ring;
unsigned int num_tx_queues;
unsigned int q, qp, port;
+ u32 reg;
/* We can't be setting up queue inspection for non directly attached
* switches
@@ -2350,14 +2351,21 @@ static int bcm_sysport_map_queues(struct net_device *dev,
if (ring->inspect)
continue;
- /* Just remember the mapping actual programming done
- * during bcm_sysport_init_tx_ring
- */
ring->switch_queue = qp;
ring->switch_port = port;
ring->inspect = true;
if (qp + port * num_tx_queues < ARRAY_SIZE(priv->ring_map))
priv->ring_map[qp + port * num_tx_queues] = ring;
+
+ if (netif_running(dev)) {
+ reg = tdma_readl(priv, TDMA_DESC_RING_MAPPING(q));
+ reg &= ~(RING_QID_MASK |
+ RING_PORT_ID_MASK << RING_PORT_ID_SHIFT |
+ RING_IGNORE_STATUS);
+ reg |= (qp & RING_QID_MASK);
+ reg |= (port << RING_PORT_ID_SHIFT);
+ tdma_writel(priv, reg, TDMA_DESC_RING_MAPPING(q));
+ }
qp++;
}
@@ -2372,6 +2380,7 @@ static int bcm_sysport_unmap_queues(struct net_device *dev,
struct bcm_sysport_tx_ring *ring;
unsigned int num_tx_queues;
unsigned int q, qp, port;
+ u32 reg;
port = dp->index;
@@ -2390,6 +2399,14 @@ static int bcm_sysport_unmap_queues(struct net_device *dev,
qp = ring->switch_queue;
if (qp + port * num_tx_queues < ARRAY_SIZE(priv->ring_map))
priv->ring_map[qp + port * num_tx_queues] = NULL;
+
+ if (netif_running(dev)) {
+ reg = tdma_readl(priv, TDMA_DESC_RING_MAPPING(q));
+ reg &= ~(RING_QID_MASK |
+ RING_PORT_ID_MASK << RING_PORT_ID_SHIFT);
+ reg |= RING_IGNORE_STATUS;
+ tdma_writel(priv, reg, TDMA_DESC_RING_MAPPING(q));
+ }
}
return 0;
--
2.34.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net v2 00/10] net: systemport: Collection of fixes
2026-09-22 23:24 [PATCH net v2 00/10] net: systemport: Collection of fixes Florian Fainelli
` (9 preceding siblings ...)
2026-09-22 23:24 ` [PATCH net v2 10/10] net: systemport: Update TDMA queue mapping dynamically on changeupper Florian Fainelli
@ 2026-09-23 0:11 ` Jakub Kicinski
10 siblings, 0 replies; 12+ messages in thread
From: Jakub Kicinski @ 2026-09-23 0:11 UTC (permalink / raw)
To: Florian Fainelli
Cc: netdev, Doug Berger, Broadcom internal kernel review list,
Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni,
Zak Kemble, Simon Horman, Ryo Takakura, open list,
Nicolai Buchwitz
On Tue, 22 Sep 2026 16:24:30 -0700 Florian Fainelli wrote:
> - dropped patch 4 and target it at net-next
> - dropped patch 11 which needs more thinking as to what is the
> appropriate DMA teardown sequence wrt. topctrl_flush
> - addressed Nicolai's feedback
> - added Nicolai's Reviewed-by tags where provided
Hi, our patch limit is 15, please don't have more than 15 patches
outstanding against any tree. As you can imagine everyone has LLM
access now. The number of outstanding patches in pw is 640 at the
time of writing. Please.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2026-09-23 0:11 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-22 23:24 [PATCH net v2 00/10] net: systemport: Collection of fixes Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 01/10] net: systemport: Fix buffer overflow in bcm_sysport_get_stats() Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 02/10] net: systemport: Fix invalid dev_id argument in bcm_sysport_poll_controller() Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 03/10] net: systemport: Fix NULL pointer dereference in bcm_sysport_fini_rx_ring() Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 04/10] net: systemport: Fix Wake-on-LAN RXCHK filter enable loop Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 05/10] net: systemport: Fix RUNT MIB counter register offset calculation Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 06/10] net: systemport: Fix potential packet length underflow in bcm_sysport_desc_rx() Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 07/10] net: systemport: Fix out-of-bounds array accesses in DSA queue mapping Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 08/10] net: systemport: Fix inverted error messages in bcm_sysport_stop() Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 09/10] net: systemport: Fix unbalanced Wake-on-LAN clock disable in resume Florian Fainelli
2026-09-22 23:24 ` [PATCH net v2 10/10] net: systemport: Update TDMA queue mapping dynamically on changeupper Florian Fainelli
2026-09-23 0:11 ` [PATCH net v2 00/10] net: systemport: Collection of fixes Jakub Kicinski
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®