* [PATCH net v3 00/16] net: macb: various fixes & cleanup
@ 2025-08-08 16:52 Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 01/16] dt-bindings: net: cdns,macb: allow tsu_clk without tx_clk Théo Lebrun
` (16 more replies)
0 siblings, 17 replies; 18+ messages in thread
From: Théo Lebrun @ 2025-08-08 16:52 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Claudiu Beznea, Geert Uytterhoeven, Harini Katakam,
Richard Cochran, Russell King
Cc: netdev, devicetree, linux-kernel, Thomas Petazzoni, Tawfik Bayouk,
Théo Lebrun, Krzysztof Kozlowski, Sean Anderson, Andrew Lunn
This is a split off my previous series on MACB [0]. The main goal is to
add EyeQ5 support, but there was a lot of independent fixes/cleanup.
Overall, it is fixes first so they can be applied swiftly, followed by a
series of cleanup patches. To clarify, nothing critical. It mostly puts
the driver in a better shape and prepares it for EyeQ5 patches.
Thanks,
Have a nice day,
Théo
[0]: https://lore.kernel.org/lkml/20250627-macb-v2-0-ff8207d0bb77@bootlin.com/
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
Changes in v3:
- Cover letter: drop addresses that reject emails:
cyrille.pitchen@atmel.com
hskinnemoen@atmel.com
jeff@garzik.org
rafalo@cadence.com
- dt-bindings: Take 2x Reviewed-by Krzysztof.
- dt-bindings: add Fixes trailer to "allow tsu_clk without tx_clk"
patch, to highlight we are not introducing new behavior.
- Reorder commits; move fixes first followed by cleanup patches.
- Drop all EyeQ5 related commits.
- New commit: "remove gap in MACB_CAPS_* flags".
- New commit: "move ring size computation to functions".
- New commit: "move bp->hw_dma_cap flags to bp->caps".
- Rename introduced helpers macb_dma_is_64b() to macb_dma64() and,
macb_dma_is_ptp() to macb_dma_ptp().
- Rename MACB_CAPS_RSC_CAPABLE -> MACB_CAPS_RSC.
- Fix commit message typos: "maxime" -> "maximise", etc.
- Take 7x Reviewed-by: Sean Anderson.
- Add details to some commit messages.
- Link to v2: https://lore.kernel.org/r/20250627-macb-v2-0-ff8207d0bb77@bootlin.com
---
Théo Lebrun (16):
dt-bindings: net: cdns,macb: allow tsu_clk without tx_clk
dt-bindings: net: cdns,macb: sort compatibles
net: macb: remove illusion about TBQPH/RBQPH being per-queue
net: macb: move ring size computation to functions
net: macb: single dma_alloc_coherent() for DMA descriptors
net: macb: match skb_reserve(skb, NET_IP_ALIGN) with HW alignment
net: macb: avoid double endianness swap in macb_set_hwaddr()
net: macb: use BIT() macro for capability definitions
net: macb: remove gap in MACB_CAPS_* flags
net: macb: Remove local variables clk_init and init in macb_probe()
net: macb: drop macb_config NULL checking
net: macb: simplify macb_dma_desc_get_size()
net: macb: simplify macb_adj_dma_desc_idx()
net: macb: move bp->hw_dma_cap flags to bp->caps
net: macb: introduce DMA descriptor helpers (is 64bit? is PTP?)
net: macb: sort #includes
.../devicetree/bindings/net/cdns,macb.yaml | 10 +-
drivers/net/ethernet/cadence/macb.h | 75 +++---
drivers/net/ethernet/cadence/macb_main.c | 288 +++++++++------------
drivers/net/ethernet/cadence/macb_ptp.c | 16 +-
4 files changed, 174 insertions(+), 215 deletions(-)
---
base-commit: 37816488247ddddbc3de113c78c83572274b1e2e
change-id: 20250808-macb-fixes-e2f570e11241
Best regards,
--
Théo Lebrun <theo.lebrun@bootlin.com>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH net v3 01/16] dt-bindings: net: cdns,macb: allow tsu_clk without tx_clk
2025-08-08 16:52 [PATCH net v3 00/16] net: macb: various fixes & cleanup Théo Lebrun
@ 2025-08-08 16:52 ` Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 02/16] dt-bindings: net: cdns,macb: sort compatibles Théo Lebrun
` (15 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Théo Lebrun @ 2025-08-08 16:52 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Claudiu Beznea, Geert Uytterhoeven, Harini Katakam,
Richard Cochran, Russell King
Cc: netdev, devicetree, linux-kernel, Thomas Petazzoni, Tawfik Bayouk,
Théo Lebrun, Krzysztof Kozlowski
Allow providing tsu_clk without a tx_clk as both are optional.
This is about relaxing unneeded constraints. It so happened that in the
past HW that needed a tsu_clk always needed a tx_clk.
Fixes: 4e5b6de1f46d ("dt-bindings: net: cdns,macb: Convert to json-schema")
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
Documentation/devicetree/bindings/net/cdns,macb.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/net/cdns,macb.yaml b/Documentation/devicetree/bindings/net/cdns,macb.yaml
index 559d0f733e7e7ac2909b87ab759be51d59be51c2..6e20d67e7628cd9dcef6e430b2a49eeedd0991a7 100644
--- a/Documentation/devicetree/bindings/net/cdns,macb.yaml
+++ b/Documentation/devicetree/bindings/net/cdns,macb.yaml
@@ -85,7 +85,7 @@ properties:
items:
- enum: [ ether_clk, hclk, pclk ]
- enum: [ hclk, pclk ]
- - const: tx_clk
+ - enum: [ tx_clk, tsu_clk ]
- enum: [ rx_clk, tsu_clk ]
- const: tsu_clk
--
2.50.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net v3 02/16] dt-bindings: net: cdns,macb: sort compatibles
2025-08-08 16:52 [PATCH net v3 00/16] net: macb: various fixes & cleanup Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 01/16] dt-bindings: net: cdns,macb: allow tsu_clk without tx_clk Théo Lebrun
@ 2025-08-08 16:52 ` Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 03/16] net: macb: remove illusion about TBQPH/RBQPH being per-queue Théo Lebrun
` (14 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Théo Lebrun @ 2025-08-08 16:52 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Claudiu Beznea, Geert Uytterhoeven, Harini Katakam,
Richard Cochran, Russell King
Cc: netdev, devicetree, linux-kernel, Thomas Petazzoni, Tawfik Bayouk,
Théo Lebrun, Krzysztof Kozlowski
Compatibles inside this enum are sorted-ish. Make it sorted.
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
Documentation/devicetree/bindings/net/cdns,macb.yaml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/cdns,macb.yaml b/Documentation/devicetree/bindings/net/cdns,macb.yaml
index 6e20d67e7628cd9dcef6e430b2a49eeedd0991a7..b3bb08a41ef8f867fd4f6813f965bbd12df042dc 100644
--- a/Documentation/devicetree/bindings/net/cdns,macb.yaml
+++ b/Documentation/devicetree/bindings/net/cdns,macb.yaml
@@ -47,17 +47,17 @@ properties:
- const: cdns,macb # Generic
- enum:
- - atmel,sama5d29-gem # GEM XL IP (10/100) on Atmel sama5d29 SoCs
- atmel,sama5d2-gem # GEM IP (10/100) on Atmel sama5d2 SoCs
+ - atmel,sama5d29-gem # GEM XL IP (10/100) on Atmel sama5d29 SoCs
- atmel,sama5d3-gem # Gigabit IP on Atmel sama5d3 SoCs
- atmel,sama5d4-gem # GEM IP (10/100) on Atmel sama5d4 SoCs
+ - cdns,emac # Generic
+ - cdns,gem # Generic
+ - cdns,macb # Generic
- cdns,np4-macb # NP4 SoC devices
- microchip,sama7g5-emac # Microchip SAMA7G5 ethernet interface
- microchip,sama7g5-gem # Microchip SAMA7G5 gigabit ethernet interface
- sifive,fu540-c000-gem # SiFive FU540-C000 SoC
- - cdns,emac # Generic
- - cdns,gem # Generic
- - cdns,macb # Generic
- items:
- enum:
--
2.50.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net v3 03/16] net: macb: remove illusion about TBQPH/RBQPH being per-queue
2025-08-08 16:52 [PATCH net v3 00/16] net: macb: various fixes & cleanup Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 01/16] dt-bindings: net: cdns,macb: allow tsu_clk without tx_clk Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 02/16] dt-bindings: net: cdns,macb: sort compatibles Théo Lebrun
@ 2025-08-08 16:52 ` Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 04/16] net: macb: move ring size computation to functions Théo Lebrun
` (13 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Théo Lebrun @ 2025-08-08 16:52 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Claudiu Beznea, Geert Uytterhoeven, Harini Katakam,
Richard Cochran, Russell King
Cc: netdev, devicetree, linux-kernel, Thomas Petazzoni, Tawfik Bayouk,
Théo Lebrun, Sean Anderson
The MACB driver acts as if TBQPH/RBQPH are configurable on a per queue
basis; this is a lie. A single register configures the upper 32 bits of
each DMA descriptor buffers for all queues.
Concrete actions:
- Drop GEM_TBQPH/GEM_RBQPH macros which have a queue index argument.
Only use MACB_TBQPH/MACB_RBQPH constants.
- Drop struct macb_queue->TBQPH/RBQPH fields.
- In macb_init_buffers(): do a single write to TBQPH and RBQPH for all
queues instead of a write per queue.
- In macb_tx_error_task(): drop the write to TBQPH.
- In macb_alloc_consistent(): if allocations give different upper
32-bits, fail. Previously, it would have lead to silent memory
corruption as queues would have used the upper 32 bits of the alloc
from queue 0 and their own low 32 bits.
- In macb_suspend(): if we use the tie off descriptor for suspend, do
the write once for all queues instead of once per queue.
Fixes: fff8019a08b6 ("net: macb: Add 64 bit addressing support for GEM")
Fixes: ae1f2a56d273 ("net: macb: Added support for many RX queues")
Reviewed-by: Sean Anderson <sean.anderson@linux.dev>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
drivers/net/ethernet/cadence/macb.h | 4 ---
drivers/net/ethernet/cadence/macb_main.c | 48 +++++++++++---------------------
2 files changed, 16 insertions(+), 36 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index c9a5c8beb2fa8166195d1d83f187d2d0c62668a8..a7e845fee4b3a2e3d14abb49abdbaf3e8e6ea02b 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -213,10 +213,8 @@
#define GEM_ISR(hw_q) (0x0400 + ((hw_q) << 2))
#define GEM_TBQP(hw_q) (0x0440 + ((hw_q) << 2))
-#define GEM_TBQPH(hw_q) (0x04C8)
#define GEM_RBQP(hw_q) (0x0480 + ((hw_q) << 2))
#define GEM_RBQS(hw_q) (0x04A0 + ((hw_q) << 2))
-#define GEM_RBQPH(hw_q) (0x04D4)
#define GEM_IER(hw_q) (0x0600 + ((hw_q) << 2))
#define GEM_IDR(hw_q) (0x0620 + ((hw_q) << 2))
#define GEM_IMR(hw_q) (0x0640 + ((hw_q) << 2))
@@ -1214,10 +1212,8 @@ struct macb_queue {
unsigned int IDR;
unsigned int IMR;
unsigned int TBQP;
- unsigned int TBQPH;
unsigned int RBQS;
unsigned int RBQP;
- unsigned int RBQPH;
/* Lock to protect tx_head and tx_tail */
spinlock_t tx_ptr_lock;
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index ce95fad8cedd7331d4818ba9f73fb6970249e85c..aeb5a93108e8c28f1dfe3d91ab98daf99db30699 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -495,19 +495,17 @@ static void macb_init_buffers(struct macb *bp)
struct macb_queue *queue;
unsigned int q;
+#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
+ /* Single register for all queues' high 32 bits. */
+ if (bp->hw_dma_cap & HW_DMA_CAP_64B) {
+ macb_writel(bp, RBQPH, upper_32_bits(bp->queues[0].rx_ring_dma));
+ macb_writel(bp, TBQPH, upper_32_bits(bp->queues[0].tx_ring_dma));
+ }
+#endif
+
for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
queue_writel(queue, RBQP, lower_32_bits(queue->rx_ring_dma));
-#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
- if (bp->hw_dma_cap & HW_DMA_CAP_64B)
- queue_writel(queue, RBQPH,
- upper_32_bits(queue->rx_ring_dma));
-#endif
queue_writel(queue, TBQP, lower_32_bits(queue->tx_ring_dma));
-#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
- if (bp->hw_dma_cap & HW_DMA_CAP_64B)
- queue_writel(queue, TBQPH,
- upper_32_bits(queue->tx_ring_dma));
-#endif
}
}
@@ -1166,10 +1164,6 @@ static void macb_tx_error_task(struct work_struct *work)
/* Reinitialize the TX desc queue */
queue_writel(queue, TBQP, lower_32_bits(queue->tx_ring_dma));
-#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
- if (bp->hw_dma_cap & HW_DMA_CAP_64B)
- queue_writel(queue, TBQPH, upper_32_bits(queue->tx_ring_dma));
-#endif
/* Make TX ring reflect state of hardware */
queue->tx_head = 0;
queue->tx_tail = 0;
@@ -2549,7 +2543,8 @@ static int macb_alloc_consistent(struct macb *bp)
queue->tx_ring = dma_alloc_coherent(&bp->pdev->dev, size,
&queue->tx_ring_dma,
GFP_KERNEL);
- if (!queue->tx_ring)
+ if (!queue->tx_ring ||
+ upper_32_bits(queue->tx_ring_dma) != upper_32_bits(bp->queues[0].tx_ring_dma))
goto out_err;
netdev_dbg(bp->dev,
"Allocated TX ring for queue %u of %d bytes at %08lx (mapped %p)\n",
@@ -2564,7 +2559,8 @@ static int macb_alloc_consistent(struct macb *bp)
size = RX_RING_BYTES(bp) + bp->rx_bd_rd_prefetch;
queue->rx_ring = dma_alloc_coherent(&bp->pdev->dev, size,
&queue->rx_ring_dma, GFP_KERNEL);
- if (!queue->rx_ring)
+ if (!queue->rx_ring ||
+ upper_32_bits(queue->rx_ring_dma) != upper_32_bits(bp->queues[0].rx_ring_dma))
goto out_err;
netdev_dbg(bp->dev,
"Allocated RX ring of %d bytes at %08lx (mapped %p)\n",
@@ -4305,12 +4301,6 @@ static int macb_init(struct platform_device *pdev)
queue->TBQP = GEM_TBQP(hw_q - 1);
queue->RBQP = GEM_RBQP(hw_q - 1);
queue->RBQS = GEM_RBQS(hw_q - 1);
-#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
- if (bp->hw_dma_cap & HW_DMA_CAP_64B) {
- queue->TBQPH = GEM_TBQPH(hw_q - 1);
- queue->RBQPH = GEM_RBQPH(hw_q - 1);
- }
-#endif
} else {
/* queue0 uses legacy registers */
queue->ISR = MACB_ISR;
@@ -4319,12 +4309,6 @@ static int macb_init(struct platform_device *pdev)
queue->IMR = MACB_IMR;
queue->TBQP = MACB_TBQP;
queue->RBQP = MACB_RBQP;
-#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
- if (bp->hw_dma_cap & HW_DMA_CAP_64B) {
- queue->TBQPH = MACB_TBQPH;
- queue->RBQPH = MACB_RBQPH;
- }
-#endif
}
/* get irq: here we use the linux queue index, not the hardware
@@ -5450,6 +5434,10 @@ static int __maybe_unused macb_suspend(struct device *dev)
*/
tmp = macb_readl(bp, NCR);
macb_writel(bp, NCR, tmp & ~(MACB_BIT(TE) | MACB_BIT(RE)));
+#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
+ if (!(bp->caps & MACB_CAPS_QUEUE_DISABLE))
+ macb_writel(bp, RBQPH, upper_32_bits(bp->rx_ring_tieoff_dma));
+#endif
for (q = 0, queue = bp->queues; q < bp->num_queues;
++q, ++queue) {
/* Disable RX queues */
@@ -5459,10 +5447,6 @@ static int __maybe_unused macb_suspend(struct device *dev)
/* Tie off RX queues */
queue_writel(queue, RBQP,
lower_32_bits(bp->rx_ring_tieoff_dma));
-#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
- queue_writel(queue, RBQPH,
- upper_32_bits(bp->rx_ring_tieoff_dma));
-#endif
}
/* Disable all interrupts */
queue_writel(queue, IDR, -1);
--
2.50.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net v3 04/16] net: macb: move ring size computation to functions
2025-08-08 16:52 [PATCH net v3 00/16] net: macb: various fixes & cleanup Théo Lebrun
` (2 preceding siblings ...)
2025-08-08 16:52 ` [PATCH net v3 03/16] net: macb: remove illusion about TBQPH/RBQPH being per-queue Théo Lebrun
@ 2025-08-08 16:52 ` Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 05/16] net: macb: single dma_alloc_coherent() for DMA descriptors Théo Lebrun
` (12 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Théo Lebrun @ 2025-08-08 16:52 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Claudiu Beznea, Geert Uytterhoeven, Harini Katakam,
Richard Cochran, Russell King
Cc: netdev, devicetree, linux-kernel, Thomas Petazzoni, Tawfik Bayouk,
Théo Lebrun
The tx/rx ring size calculation is somewhat complex and partially hidden
behind a macro. Move that out of the {RX,TX}_RING_BYTES() macros and
macb_{alloc,free}_consistent() functions into neat separate functions.
In macb_free_consistent(), we drop the size variable and directly call
the size helpers in the arguments list. In macb_alloc_consistent(), we
keep the size variable that is used by netdev_dbg() calls.
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
drivers/net/ethernet/cadence/macb_main.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index aeb5a93108e8c28f1dfe3d91ab98daf99db30699..1ba26f8ad600936070f57ff0762c03719921dd48 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -51,14 +51,10 @@ struct sifive_fu540_macb_mgmt {
#define DEFAULT_RX_RING_SIZE 512 /* must be power of 2 */
#define MIN_RX_RING_SIZE 64
#define MAX_RX_RING_SIZE 8192
-#define RX_RING_BYTES(bp) (macb_dma_desc_get_size(bp) \
- * (bp)->rx_ring_size)
#define DEFAULT_TX_RING_SIZE 512 /* must be power of 2 */
#define MIN_TX_RING_SIZE 64
#define MAX_TX_RING_SIZE 4096
-#define TX_RING_BYTES(bp) (macb_dma_desc_get_size(bp) \
- * (bp)->tx_ring_size)
/* level of occupied TX descriptors under which we wake up TX process */
#define MACB_TX_WAKEUP_THRESH(bp) (3 * (bp)->tx_ring_size / 4)
@@ -2464,11 +2460,20 @@ static void macb_free_rx_buffers(struct macb *bp)
}
}
+static unsigned int macb_tx_ring_size_per_queue(struct macb *bp)
+{
+ return macb_dma_desc_get_size(bp) * bp->tx_ring_size + bp->tx_bd_rd_prefetch;
+}
+
+static unsigned int macb_rx_ring_size_per_queue(struct macb *bp)
+{
+ return macb_dma_desc_get_size(bp) * bp->rx_ring_size + bp->rx_bd_rd_prefetch;
+}
+
static void macb_free_consistent(struct macb *bp)
{
struct macb_queue *queue;
unsigned int q;
- int size;
if (bp->rx_ring_tieoff) {
dma_free_coherent(&bp->pdev->dev, macb_dma_desc_get_size(bp),
@@ -2482,14 +2487,14 @@ static void macb_free_consistent(struct macb *bp)
kfree(queue->tx_skb);
queue->tx_skb = NULL;
if (queue->tx_ring) {
- size = TX_RING_BYTES(bp) + bp->tx_bd_rd_prefetch;
- dma_free_coherent(&bp->pdev->dev, size,
+ dma_free_coherent(&bp->pdev->dev,
+ macb_tx_ring_size_per_queue(bp),
queue->tx_ring, queue->tx_ring_dma);
queue->tx_ring = NULL;
}
if (queue->rx_ring) {
- size = RX_RING_BYTES(bp) + bp->rx_bd_rd_prefetch;
- dma_free_coherent(&bp->pdev->dev, size,
+ dma_free_coherent(&bp->pdev->dev,
+ macb_rx_ring_size_per_queue(bp),
queue->rx_ring, queue->rx_ring_dma);
queue->rx_ring = NULL;
}
@@ -2539,7 +2544,7 @@ static int macb_alloc_consistent(struct macb *bp)
int size;
for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
- size = TX_RING_BYTES(bp) + bp->tx_bd_rd_prefetch;
+ size = macb_tx_ring_size_per_queue(bp);
queue->tx_ring = dma_alloc_coherent(&bp->pdev->dev, size,
&queue->tx_ring_dma,
GFP_KERNEL);
@@ -2556,9 +2561,9 @@ static int macb_alloc_consistent(struct macb *bp)
if (!queue->tx_skb)
goto out_err;
- size = RX_RING_BYTES(bp) + bp->rx_bd_rd_prefetch;
+ size = macb_rx_ring_size_per_queue(bp);
queue->rx_ring = dma_alloc_coherent(&bp->pdev->dev, size,
- &queue->rx_ring_dma, GFP_KERNEL);
+ &queue->rx_ring_dma, GFP_KERNEL);
if (!queue->rx_ring ||
upper_32_bits(queue->rx_ring_dma) != upper_32_bits(bp->queues[0].rx_ring_dma))
goto out_err;
--
2.50.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net v3 05/16] net: macb: single dma_alloc_coherent() for DMA descriptors
2025-08-08 16:52 [PATCH net v3 00/16] net: macb: various fixes & cleanup Théo Lebrun
` (3 preceding siblings ...)
2025-08-08 16:52 ` [PATCH net v3 04/16] net: macb: move ring size computation to functions Théo Lebrun
@ 2025-08-08 16:52 ` Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 06/16] net: macb: match skb_reserve(skb, NET_IP_ALIGN) with HW alignment Théo Lebrun
` (11 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Théo Lebrun @ 2025-08-08 16:52 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Claudiu Beznea, Geert Uytterhoeven, Harini Katakam,
Richard Cochran, Russell King
Cc: netdev, devicetree, linux-kernel, Thomas Petazzoni, Tawfik Bayouk,
Théo Lebrun, Sean Anderson
Move from 2*NUM_QUEUES dma_alloc_coherent() for DMA descriptor rings to
2 calls overall.
Issue is with how all queues share the same register for configuring the
upper 32-bits of Tx/Rx descriptor rings. Taking Tx, notice how TBQPH
does *not* depend on the queue index:
#define GEM_TBQP(hw_q) (0x0440 + ((hw_q) << 2))
#define GEM_TBQPH(hw_q) (0x04C8)
queue_writel(queue, TBQP, lower_32_bits(queue->tx_ring_dma));
#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
if (bp->hw_dma_cap & HW_DMA_CAP_64B)
queue_writel(queue, TBQPH, upper_32_bits(queue->tx_ring_dma));
#endif
To maximise our chances of getting valid DMA addresses, we do a single
dma_alloc_coherent() across queues. This improves the odds because
alloc_pages() guarantees natural alignment. Other codepaths (IOMMU or
dev/arch dma_map_ops) don't give high enough guarantees
(even page-aligned isn't enough).
Two consideration:
- dma_alloc_coherent() gives us page alignment. Here we remove this
constraint meaning each queue's ring won't be page-aligned anymore.
- This can save some tiny amounts of memory. Fewer allocations means
(1) less overhead (constant cost per alloc) and (2) less wasted bytes
due to alignment constraints.
Example for (2): 4 queues, default ring size (512), 64-bit DMA
descriptors, 16K pages:
- Before: 8 allocs of 8K, each rounded to 16K => 64K wasted.
- After: 2 allocs of 32K => 0K wasted.
Fixes: 02c958dd3446 ("net/macb: add TX multiqueue support for gem")
Reviewed-by: Sean Anderson <sean.anderson@linux.dev>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
drivers/net/ethernet/cadence/macb_main.c | 76 +++++++++++++++++---------------
1 file changed, 41 insertions(+), 35 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 1ba26f8ad600936070f57ff0762c03719921dd48..aa0b5aea48888eb2d1aa3edef45c804ae519f70d 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -2472,32 +2472,30 @@ static unsigned int macb_rx_ring_size_per_queue(struct macb *bp)
static void macb_free_consistent(struct macb *bp)
{
+ struct device *dev = &bp->pdev->dev;
struct macb_queue *queue;
unsigned int q;
+ size_t size;
if (bp->rx_ring_tieoff) {
- dma_free_coherent(&bp->pdev->dev, macb_dma_desc_get_size(bp),
+ dma_free_coherent(dev, macb_dma_desc_get_size(bp),
bp->rx_ring_tieoff, bp->rx_ring_tieoff_dma);
bp->rx_ring_tieoff = NULL;
}
bp->macbgem_ops.mog_free_rx_buffers(bp);
+ size = bp->num_queues * macb_tx_ring_size_per_queue(bp);
+ dma_free_coherent(dev, size, bp->queues[0].tx_ring, bp->queues[0].tx_ring_dma);
+
+ size = bp->num_queues * macb_rx_ring_size_per_queue(bp);
+ dma_free_coherent(dev, size, bp->queues[0].rx_ring, bp->queues[0].rx_ring_dma);
+
for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
kfree(queue->tx_skb);
queue->tx_skb = NULL;
- if (queue->tx_ring) {
- dma_free_coherent(&bp->pdev->dev,
- macb_tx_ring_size_per_queue(bp),
- queue->tx_ring, queue->tx_ring_dma);
- queue->tx_ring = NULL;
- }
- if (queue->rx_ring) {
- dma_free_coherent(&bp->pdev->dev,
- macb_rx_ring_size_per_queue(bp),
- queue->rx_ring, queue->rx_ring_dma);
- queue->rx_ring = NULL;
- }
+ queue->tx_ring = NULL;
+ queue->rx_ring = NULL;
}
}
@@ -2539,37 +2537,45 @@ static int macb_alloc_rx_buffers(struct macb *bp)
static int macb_alloc_consistent(struct macb *bp)
{
+ struct device *dev = &bp->pdev->dev;
+ dma_addr_t tx_dma, rx_dma;
struct macb_queue *queue;
unsigned int q;
- int size;
+ void *tx, *rx;
+ size_t size;
+
+ /*
+ * Upper 32-bits of Tx/Rx DMA descriptor for each queues much match!
+ * We cannot enforce this guarantee, the best we can do is do a single
+ * allocation and hope it will land into alloc_pages() that guarantees
+ * natural alignment of physical addresses.
+ */
+
+ size = bp->num_queues * macb_tx_ring_size_per_queue(bp);
+ tx = dma_alloc_coherent(dev, size, &tx_dma, GFP_KERNEL);
+ if (!tx || upper_32_bits(tx_dma) != upper_32_bits(tx_dma + size - 1))
+ goto out_err;
+ netdev_dbg(bp->dev, "Allocated %zu bytes for %u TX rings at %08lx (mapped %p)\n",
+ size, bp->num_queues, (unsigned long)tx_dma, tx);
+
+ size = bp->num_queues * macb_rx_ring_size_per_queue(bp);
+ rx = dma_alloc_coherent(dev, size, &rx_dma, GFP_KERNEL);
+ if (!rx || upper_32_bits(rx_dma) != upper_32_bits(rx_dma + size - 1))
+ goto out_err;
+ netdev_dbg(bp->dev, "Allocated %zu bytes for %u RX rings at %08lx (mapped %p)\n",
+ size, bp->num_queues, (unsigned long)rx_dma, rx);
for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
- size = macb_tx_ring_size_per_queue(bp);
- queue->tx_ring = dma_alloc_coherent(&bp->pdev->dev, size,
- &queue->tx_ring_dma,
- GFP_KERNEL);
- if (!queue->tx_ring ||
- upper_32_bits(queue->tx_ring_dma) != upper_32_bits(bp->queues[0].tx_ring_dma))
- goto out_err;
- netdev_dbg(bp->dev,
- "Allocated TX ring for queue %u of %d bytes at %08lx (mapped %p)\n",
- q, size, (unsigned long)queue->tx_ring_dma,
- queue->tx_ring);
+ queue->tx_ring = tx + macb_tx_ring_size_per_queue(bp) * q;
+ queue->tx_ring_dma = tx_dma + macb_tx_ring_size_per_queue(bp) * q;
+
+ queue->rx_ring = rx + macb_rx_ring_size_per_queue(bp) * q;
+ queue->rx_ring_dma = rx_dma + macb_rx_ring_size_per_queue(bp) * q;
size = bp->tx_ring_size * sizeof(struct macb_tx_skb);
queue->tx_skb = kmalloc(size, GFP_KERNEL);
if (!queue->tx_skb)
goto out_err;
-
- size = macb_rx_ring_size_per_queue(bp);
- queue->rx_ring = dma_alloc_coherent(&bp->pdev->dev, size,
- &queue->rx_ring_dma, GFP_KERNEL);
- if (!queue->rx_ring ||
- upper_32_bits(queue->rx_ring_dma) != upper_32_bits(bp->queues[0].rx_ring_dma))
- goto out_err;
- netdev_dbg(bp->dev,
- "Allocated RX ring of %d bytes at %08lx (mapped %p)\n",
- size, (unsigned long)queue->rx_ring_dma, queue->rx_ring);
}
if (bp->macbgem_ops.mog_alloc_rx_buffers(bp))
goto out_err;
--
2.50.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net v3 06/16] net: macb: match skb_reserve(skb, NET_IP_ALIGN) with HW alignment
2025-08-08 16:52 [PATCH net v3 00/16] net: macb: various fixes & cleanup Théo Lebrun
` (4 preceding siblings ...)
2025-08-08 16:52 ` [PATCH net v3 05/16] net: macb: single dma_alloc_coherent() for DMA descriptors Théo Lebrun
@ 2025-08-08 16:52 ` Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 07/16] net: macb: avoid double endianness swap in macb_set_hwaddr() Théo Lebrun
` (10 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Théo Lebrun @ 2025-08-08 16:52 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Claudiu Beznea, Geert Uytterhoeven, Harini Katakam,
Richard Cochran, Russell King
Cc: netdev, devicetree, linux-kernel, Thomas Petazzoni, Tawfik Bayouk,
Théo Lebrun
If HW is Receive-Side-Coalescing capable, it cannot add dummy bytes at
the start of IP packets. Alignment (ie number of dummy bytes) is
configured using the RBOF field inside the NCFGR register.
On the software side, the skb_reserve(skb, NET_IP_ALIGN) call must only
be done if those dummy bytes are added by the hardware; notice the
skb_reserve() is done AFTER writing the address to the device.
We cannot do the skb_reserve() call BEFORE writing the address because
the address field ignores the low 2/3 bits. Conclusion: in some cases,
we risk not being able to respect the NET_IP_ALIGN value (which is
picked based on unaligned CPU access performance).
Current hardware (assuming it is working) falls in either category:
- RSC-incapable or,
- RSC-capable and NET_IP_ALIGN=0 (arm64/powerpc/x86).
Fixes: 4df95131ea80 ("net/macb: change RX path for GEM")
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
drivers/net/ethernet/cadence/macb.h | 3 +++
drivers/net/ethernet/cadence/macb_main.c | 20 +++++++++++++++++---
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index a7e845fee4b3a2e3d14abb49abdbaf3e8e6ea02b..a773d640d4738f158649e225ae4257164a6ef809 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -527,6 +527,8 @@
/* Bitfields in DCFG6. */
#define GEM_PBUF_LSO_OFFSET 27
#define GEM_PBUF_LSO_SIZE 1
+#define GEM_PBUF_RSC_OFFSET 26
+#define GEM_PBUF_RSC_SIZE 1
#define GEM_PBUF_CUTTHRU_OFFSET 25
#define GEM_PBUF_CUTTHRU_SIZE 1
#define GEM_DAW64_OFFSET 23
@@ -737,6 +739,7 @@
#define MACB_CAPS_MIIONRGMII 0x00000200
#define MACB_CAPS_NEED_TSUCLK 0x00000400
#define MACB_CAPS_QUEUE_DISABLE 0x00000800
+#define MACB_CAPS_RSC 0x00001000
#define MACB_CAPS_PCS 0x01000000
#define MACB_CAPS_HIGH_SPEED 0x02000000
#define MACB_CAPS_CLK_HW_CHG 0x04000000
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index aa0b5aea48888eb2d1aa3edef45c804ae519f70d..1e19ebcaf3810ca87729bad0ef0e13db49c548e4 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -1332,8 +1332,18 @@ static void gem_rx_refill(struct macb_queue *queue)
dma_wmb();
macb_set_addr(bp, desc, paddr);
- /* properly align Ethernet header */
- skb_reserve(skb, NET_IP_ALIGN);
+ /* Properly align Ethernet header.
+ *
+ * Hardware can add dummy bytes if asked using the RBOF
+ * field inside the NCFGR register. That feature isn't
+ * available if hardware is RSC capable.
+ *
+ * We cannot fallback to doing the 2-byte shift before
+ * DMA mapping because the address field does not allow
+ * setting the low 2 (or 3 if DMA) bits.
+ */
+ if (!(bp->caps & MACB_CAPS_RSC))
+ skb_reserve(skb, NET_IP_ALIGN);
} else {
desc->ctrl = 0;
dma_wmb();
@@ -2814,7 +2824,9 @@ static void macb_init_hw(struct macb *bp)
macb_set_hwaddr(bp);
config = macb_mdc_clk_div(bp);
- config |= MACB_BF(RBOF, NET_IP_ALIGN); /* Make eth data aligned */
+ /* Make eth data aligned. If RSC capable, that offset is ignored by HW. */
+ if (!(bp->caps & MACB_CAPS_RSC))
+ config |= MACB_BF(RBOF, NET_IP_ALIGN);
config |= MACB_BIT(DRFCS); /* Discard Rx FCS */
if (bp->caps & MACB_CAPS_JUMBO)
config |= MACB_BIT(JFRAME); /* Enable jumbo frames */
@@ -4139,6 +4151,8 @@ static void macb_configure_caps(struct macb *bp,
dcfg = gem_readl(bp, DCFG2);
if ((dcfg & (GEM_BIT(RX_PKT_BUFF) | GEM_BIT(TX_PKT_BUFF))) == 0)
bp->caps |= MACB_CAPS_FIFO_MODE;
+ if (GEM_BFEXT(PBUF_RSC, gem_readl(bp, DCFG6)))
+ bp->caps |= MACB_CAPS_RSC;
if (gem_has_ptp(bp)) {
if (!GEM_BFEXT(TSU, gem_readl(bp, DCFG5)))
dev_err(&bp->pdev->dev,
--
2.50.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net v3 07/16] net: macb: avoid double endianness swap in macb_set_hwaddr()
2025-08-08 16:52 [PATCH net v3 00/16] net: macb: various fixes & cleanup Théo Lebrun
` (5 preceding siblings ...)
2025-08-08 16:52 ` [PATCH net v3 06/16] net: macb: match skb_reserve(skb, NET_IP_ALIGN) with HW alignment Théo Lebrun
@ 2025-08-08 16:52 ` Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 08/16] net: macb: use BIT() macro for capability definitions Théo Lebrun
` (9 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Théo Lebrun @ 2025-08-08 16:52 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Claudiu Beznea, Geert Uytterhoeven, Harini Katakam,
Richard Cochran, Russell King
Cc: netdev, devicetree, linux-kernel, Thomas Petazzoni, Tawfik Bayouk,
Théo Lebrun, Sean Anderson
writel() does a CPU->LE conversion. Drop manual cpu_to_le*() calls.
On little-endian system:
- cpu_to_le32() is a no-op (LE->LE),
- writel() is a no-op (LE->LE),
- dev_addr will therefore not be swapped and written as-is.
On big-endian system:
- cpu_to_le32() is a swap (BE->LE),
- writel() is a swap (BE->LE),
- dev_addr will therefore be swapped twice and written as a BE value.
This was found using sparse:
⟩ make C=2 drivers/net/ethernet/cadence/macb_main.o
warning: incorrect type in assignment (different base types)
expected unsigned int [usertype] bottom
got restricted __le32 [usertype]
warning: incorrect type in assignment (different base types)
expected unsigned short [usertype] top
got restricted __le16 [usertype]
...
Fixes: 89e5785fc8a6 ("[PATCH] Atmel MACB ethernet driver")
Reviewed-by: Sean Anderson <sean.anderson@linux.dev>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
drivers/net/ethernet/cadence/macb_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 1e19ebcaf3810ca87729bad0ef0e13db49c548e4..4d8b4b764e0d5768a91f72fb6a5642f755ef3a5b 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -274,9 +274,9 @@ static void macb_set_hwaddr(struct macb *bp)
u32 bottom;
u16 top;
- bottom = cpu_to_le32(*((u32 *)bp->dev->dev_addr));
+ bottom = *((u32 *)bp->dev->dev_addr);
macb_or_gem_writel(bp, SA1B, bottom);
- top = cpu_to_le16(*((u16 *)(bp->dev->dev_addr + 4)));
+ top = *((u16 *)(bp->dev->dev_addr + 4));
macb_or_gem_writel(bp, SA1T, top);
if (gem_has_ptp(bp)) {
--
2.50.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net v3 08/16] net: macb: use BIT() macro for capability definitions
2025-08-08 16:52 [PATCH net v3 00/16] net: macb: various fixes & cleanup Théo Lebrun
` (6 preceding siblings ...)
2025-08-08 16:52 ` [PATCH net v3 07/16] net: macb: avoid double endianness swap in macb_set_hwaddr() Théo Lebrun
@ 2025-08-08 16:52 ` Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 09/16] net: macb: remove gap in MACB_CAPS_* flags Théo Lebrun
` (8 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Théo Lebrun @ 2025-08-08 16:52 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Claudiu Beznea, Geert Uytterhoeven, Harini Katakam,
Richard Cochran, Russell King
Cc: netdev, devicetree, linux-kernel, Thomas Petazzoni, Tawfik Bayouk,
Théo Lebrun, Andrew Lunn, Sean Anderson
Replace all capabilities values by calls to the BIT() macro.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Sean Anderson <sean.anderson@linux.dev>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
drivers/net/ethernet/cadence/macb.h | 42 ++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index a773d640d4738f158649e225ae4257164a6ef809..082b7df54cc1075d89293f390184e77bee65db61 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -727,27 +727,27 @@
#define MACB_MAN_C45_CODE 2
/* Capability mask bits */
-#define MACB_CAPS_ISR_CLEAR_ON_WRITE 0x00000001
-#define MACB_CAPS_USRIO_HAS_CLKEN 0x00000002
-#define MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII 0x00000004
-#define MACB_CAPS_NO_GIGABIT_HALF 0x00000008
-#define MACB_CAPS_USRIO_DISABLED 0x00000010
-#define MACB_CAPS_JUMBO 0x00000020
-#define MACB_CAPS_GEM_HAS_PTP 0x00000040
-#define MACB_CAPS_BD_RD_PREFETCH 0x00000080
-#define MACB_CAPS_NEEDS_RSTONUBR 0x00000100
-#define MACB_CAPS_MIIONRGMII 0x00000200
-#define MACB_CAPS_NEED_TSUCLK 0x00000400
-#define MACB_CAPS_QUEUE_DISABLE 0x00000800
-#define MACB_CAPS_RSC 0x00001000
-#define MACB_CAPS_PCS 0x01000000
-#define MACB_CAPS_HIGH_SPEED 0x02000000
-#define MACB_CAPS_CLK_HW_CHG 0x04000000
-#define MACB_CAPS_MACB_IS_EMAC 0x08000000
-#define MACB_CAPS_FIFO_MODE 0x10000000
-#define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000
-#define MACB_CAPS_SG_DISABLED 0x40000000
-#define MACB_CAPS_MACB_IS_GEM 0x80000000
+#define MACB_CAPS_ISR_CLEAR_ON_WRITE BIT(0)
+#define MACB_CAPS_USRIO_HAS_CLKEN BIT(1)
+#define MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII BIT(2)
+#define MACB_CAPS_NO_GIGABIT_HALF BIT(3)
+#define MACB_CAPS_USRIO_DISABLED BIT(4)
+#define MACB_CAPS_JUMBO BIT(5)
+#define MACB_CAPS_GEM_HAS_PTP BIT(6)
+#define MACB_CAPS_BD_RD_PREFETCH BIT(7)
+#define MACB_CAPS_NEEDS_RSTONUBR BIT(8)
+#define MACB_CAPS_MIIONRGMII BIT(9)
+#define MACB_CAPS_NEED_TSUCLK BIT(10)
+#define MACB_CAPS_QUEUE_DISABLE BIT(11)
+#define MACB_CAPS_RSC BIT(12)
+#define MACB_CAPS_PCS BIT(24)
+#define MACB_CAPS_HIGH_SPEED BIT(25)
+#define MACB_CAPS_CLK_HW_CHG BIT(26)
+#define MACB_CAPS_MACB_IS_EMAC BIT(27)
+#define MACB_CAPS_FIFO_MODE BIT(28)
+#define MACB_CAPS_GIGABIT_MODE_AVAILABLE BIT(29)
+#define MACB_CAPS_SG_DISABLED BIT(30)
+#define MACB_CAPS_MACB_IS_GEM BIT(31)
/* LSO settings */
#define MACB_LSO_UFO_ENABLE 0x01
--
2.50.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net v3 09/16] net: macb: remove gap in MACB_CAPS_* flags
2025-08-08 16:52 [PATCH net v3 00/16] net: macb: various fixes & cleanup Théo Lebrun
` (7 preceding siblings ...)
2025-08-08 16:52 ` [PATCH net v3 08/16] net: macb: use BIT() macro for capability definitions Théo Lebrun
@ 2025-08-08 16:52 ` Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 10/16] net: macb: Remove local variables clk_init and init in macb_probe() Théo Lebrun
` (7 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Théo Lebrun @ 2025-08-08 16:52 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Claudiu Beznea, Geert Uytterhoeven, Harini Katakam,
Richard Cochran, Russell King
Cc: netdev, devicetree, linux-kernel, Thomas Petazzoni, Tawfik Bayouk,
Théo Lebrun
MACB_CAPS_* are bit constants that get used in bp->caps. They occupy
bits 0..12 + 24..31. Remove 13..23 gap by moving bits 24..31 to 13..19.
Occupation bitfields:
31 29 27 25 23 21 19 17 15 13 11 09 07 05 03 01
30 28 26 24 22 20 18 16 14 12 10 08 06 04 02 00
-- Before ------------------------------------------------------
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 0 0
-- After -------------------------------------------------------
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 0 0
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
drivers/net/ethernet/cadence/macb.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index 082b7df54cc1075d89293f390184e77bee65db61..c5ab35f4ab493196b5fa9a8046a6c8edf7c82727 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -740,14 +740,14 @@
#define MACB_CAPS_NEED_TSUCLK BIT(10)
#define MACB_CAPS_QUEUE_DISABLE BIT(11)
#define MACB_CAPS_RSC BIT(12)
-#define MACB_CAPS_PCS BIT(24)
-#define MACB_CAPS_HIGH_SPEED BIT(25)
-#define MACB_CAPS_CLK_HW_CHG BIT(26)
-#define MACB_CAPS_MACB_IS_EMAC BIT(27)
-#define MACB_CAPS_FIFO_MODE BIT(28)
-#define MACB_CAPS_GIGABIT_MODE_AVAILABLE BIT(29)
-#define MACB_CAPS_SG_DISABLED BIT(30)
-#define MACB_CAPS_MACB_IS_GEM BIT(31)
+#define MACB_CAPS_PCS BIT(13)
+#define MACB_CAPS_HIGH_SPEED BIT(14)
+#define MACB_CAPS_CLK_HW_CHG BIT(15)
+#define MACB_CAPS_MACB_IS_EMAC BIT(16)
+#define MACB_CAPS_FIFO_MODE BIT(17)
+#define MACB_CAPS_GIGABIT_MODE_AVAILABLE BIT(18)
+#define MACB_CAPS_SG_DISABLED BIT(19)
+#define MACB_CAPS_MACB_IS_GEM BIT(20)
/* LSO settings */
#define MACB_LSO_UFO_ENABLE 0x01
--
2.50.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net v3 10/16] net: macb: Remove local variables clk_init and init in macb_probe()
2025-08-08 16:52 [PATCH net v3 00/16] net: macb: various fixes & cleanup Théo Lebrun
` (8 preceding siblings ...)
2025-08-08 16:52 ` [PATCH net v3 09/16] net: macb: remove gap in MACB_CAPS_* flags Théo Lebrun
@ 2025-08-08 16:52 ` Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 11/16] net: macb: drop macb_config NULL checking Théo Lebrun
` (6 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Théo Lebrun @ 2025-08-08 16:52 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Claudiu Beznea, Geert Uytterhoeven, Harini Katakam,
Richard Cochran, Russell King
Cc: netdev, devicetree, linux-kernel, Thomas Petazzoni, Tawfik Bayouk,
Théo Lebrun, Sean Anderson
Remove local variables clk_init and init. Those function pointers are
always equivalent to macb_config->clk_init and macb_config->init.
Reviewed-by: Sean Anderson <sean.anderson@linux.dev>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
drivers/net/ethernet/cadence/macb_main.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 4d8b4b764e0d5768a91f72fb6a5642f755ef3a5b..8c190ed201c1095ecb56749a4cf7f28112ae41d7 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -5182,10 +5182,6 @@ static const struct macb_config default_gem_config = {
static int macb_probe(struct platform_device *pdev)
{
const struct macb_config *macb_config = &default_gem_config;
- int (*clk_init)(struct platform_device *, struct clk **,
- struct clk **, struct clk **, struct clk **,
- struct clk **) = macb_config->clk_init;
- int (*init)(struct platform_device *) = macb_config->init;
struct device_node *np = pdev->dev.of_node;
struct clk *pclk, *hclk = NULL, *tx_clk = NULL, *rx_clk = NULL;
struct clk *tsu_clk = NULL;
@@ -5207,14 +5203,11 @@ static int macb_probe(struct platform_device *pdev)
const struct of_device_id *match;
match = of_match_node(macb_dt_ids, np);
- if (match && match->data) {
+ if (match && match->data)
macb_config = match->data;
- clk_init = macb_config->clk_init;
- init = macb_config->init;
- }
}
- err = clk_init(pdev, &pclk, &hclk, &tx_clk, &rx_clk, &tsu_clk);
+ err = macb_config->clk_init(pdev, &pclk, &hclk, &tx_clk, &rx_clk, &tsu_clk);
if (err)
return err;
@@ -5352,7 +5345,7 @@ static int macb_probe(struct platform_device *pdev)
bp->phy_interface = interface;
/* IP specific init */
- err = init(pdev);
+ err = macb_config->init(pdev);
if (err)
goto err_out_free_netdev;
--
2.50.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net v3 11/16] net: macb: drop macb_config NULL checking
2025-08-08 16:52 [PATCH net v3 00/16] net: macb: various fixes & cleanup Théo Lebrun
` (9 preceding siblings ...)
2025-08-08 16:52 ` [PATCH net v3 10/16] net: macb: Remove local variables clk_init and init in macb_probe() Théo Lebrun
@ 2025-08-08 16:52 ` Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 12/16] net: macb: simplify macb_dma_desc_get_size() Théo Lebrun
` (5 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Théo Lebrun @ 2025-08-08 16:52 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Claudiu Beznea, Geert Uytterhoeven, Harini Katakam,
Richard Cochran, Russell King
Cc: netdev, devicetree, linux-kernel, Thomas Petazzoni, Tawfik Bayouk,
Théo Lebrun, Sean Anderson
Remove NULL checks on macb_config as it is always valid:
- either it is its default value &default_gem_config,
- or it got overridden using match data.
Reviewed-by: Sean Anderson <sean.anderson@linux.dev>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
drivers/net/ethernet/cadence/macb_main.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 8c190ed201c1095ecb56749a4cf7f28112ae41d7..52270b20d9a1818c961525ae6de6f7d0557ddc54 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -5243,15 +5243,13 @@ static int macb_probe(struct platform_device *pdev)
}
bp->num_queues = num_queues;
bp->queue_mask = queue_mask;
- if (macb_config)
- bp->dma_burst_length = macb_config->dma_burst_length;
+ bp->dma_burst_length = macb_config->dma_burst_length;
bp->pclk = pclk;
bp->hclk = hclk;
bp->tx_clk = tx_clk;
bp->rx_clk = rx_clk;
bp->tsu_clk = tsu_clk;
- if (macb_config)
- bp->jumbo_max_len = macb_config->jumbo_max_len;
+ bp->jumbo_max_len = macb_config->jumbo_max_len;
if (!hw_is_gem(bp->regs, bp->native_io))
bp->max_tx_length = MACB_MAX_TX_LEN;
--
2.50.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net v3 12/16] net: macb: simplify macb_dma_desc_get_size()
2025-08-08 16:52 [PATCH net v3 00/16] net: macb: various fixes & cleanup Théo Lebrun
` (10 preceding siblings ...)
2025-08-08 16:52 ` [PATCH net v3 11/16] net: macb: drop macb_config NULL checking Théo Lebrun
@ 2025-08-08 16:52 ` Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 13/16] net: macb: simplify macb_adj_dma_desc_idx() Théo Lebrun
` (4 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Théo Lebrun @ 2025-08-08 16:52 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Claudiu Beznea, Geert Uytterhoeven, Harini Katakam,
Richard Cochran, Russell King
Cc: netdev, devicetree, linux-kernel, Thomas Petazzoni, Tawfik Bayouk,
Théo Lebrun
macb_dma_desc_get_size() does a switch on bp->hw_dma_cap and covers all
four cases: 0, 64B, PTP, 64B+PTP. It also covers the #ifndef
MACB_EXT_DESC separately, making it four codepaths.
Instead, notice the descriptor size grows with enabled features and use
plain if-statements on 64B and PTP flags.
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
drivers/net/ethernet/cadence/macb_main.c | 29 ++++++++---------------------
1 file changed, 8 insertions(+), 21 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 52270b20d9a1818c961525ae6de6f7d0557ddc54..dfa6b6d2cfedc8d240f55a04f2ada9fa28c55309 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -120,29 +120,16 @@ struct sifive_fu540_macb_mgmt {
*/
static unsigned int macb_dma_desc_get_size(struct macb *bp)
{
-#ifdef MACB_EXT_DESC
- unsigned int desc_size;
+ unsigned int desc_size = sizeof(struct macb_dma_desc);
- switch (bp->hw_dma_cap) {
- case HW_DMA_CAP_64B:
- desc_size = sizeof(struct macb_dma_desc)
- + sizeof(struct macb_dma_desc_64);
- break;
- case HW_DMA_CAP_PTP:
- desc_size = sizeof(struct macb_dma_desc)
- + sizeof(struct macb_dma_desc_ptp);
- break;
- case HW_DMA_CAP_64B_PTP:
- desc_size = sizeof(struct macb_dma_desc)
- + sizeof(struct macb_dma_desc_64)
- + sizeof(struct macb_dma_desc_ptp);
- break;
- default:
- desc_size = sizeof(struct macb_dma_desc);
- }
- return desc_size;
+#ifdef MACB_EXT_DESC
+ if (bp->hw_dma_cap & HW_DMA_CAP_64B)
+ desc_size += sizeof(struct macb_dma_desc_64);
+ if (bp->hw_dma_cap & HW_DMA_CAP_PTP)
+ desc_size += sizeof(struct macb_dma_desc_ptp);
#endif
- return sizeof(struct macb_dma_desc);
+
+ return desc_size;
}
static unsigned int macb_adj_dma_desc_idx(struct macb *bp, unsigned int desc_idx)
--
2.50.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net v3 13/16] net: macb: simplify macb_adj_dma_desc_idx()
2025-08-08 16:52 [PATCH net v3 00/16] net: macb: various fixes & cleanup Théo Lebrun
` (11 preceding siblings ...)
2025-08-08 16:52 ` [PATCH net v3 12/16] net: macb: simplify macb_dma_desc_get_size() Théo Lebrun
@ 2025-08-08 16:52 ` Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 14/16] net: macb: move bp->hw_dma_cap flags to bp->caps Théo Lebrun
` (3 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Théo Lebrun @ 2025-08-08 16:52 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Claudiu Beznea, Geert Uytterhoeven, Harini Katakam,
Richard Cochran, Russell King
Cc: netdev, devicetree, linux-kernel, Thomas Petazzoni, Tawfik Bayouk,
Théo Lebrun
The function body uses a switch statement on bp->hw_dma_cap and handles
its four possible values: 0, is_64b, is_ptp, is_64b && is_ptp.
Instead, refactor by noticing that the return value is:
desc_size * MULT
with MULT equal to 3 if is_64b && is_ptp,
2 if is_64b || is_ptp,
1 otherwise.
MULT can be expressed as:
1 + is_64b + is_ptp
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
drivers/net/ethernet/cadence/macb_main.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index dfa6b6d2cfedc8d240f55a04f2ada9fa28c55309..e3cf62253bb96ff245e49730dd4c4b232ce89712 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -135,19 +135,13 @@ static unsigned int macb_dma_desc_get_size(struct macb *bp)
static unsigned int macb_adj_dma_desc_idx(struct macb *bp, unsigned int desc_idx)
{
#ifdef MACB_EXT_DESC
- switch (bp->hw_dma_cap) {
- case HW_DMA_CAP_64B:
- case HW_DMA_CAP_PTP:
- desc_idx <<= 1;
- break;
- case HW_DMA_CAP_64B_PTP:
- desc_idx *= 3;
- break;
- default:
- break;
- }
-#endif
+ bool is_ptp = bp->hw_dma_cap & HW_DMA_CAP_PTP;
+ bool is_64b = bp->hw_dma_cap & HW_DMA_CAP_64B;
+
+ return desc_idx * (1 + is_64b + is_ptp);
+#else
return desc_idx;
+#endif
}
#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
--
2.50.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net v3 14/16] net: macb: move bp->hw_dma_cap flags to bp->caps
2025-08-08 16:52 [PATCH net v3 00/16] net: macb: various fixes & cleanup Théo Lebrun
` (12 preceding siblings ...)
2025-08-08 16:52 ` [PATCH net v3 13/16] net: macb: simplify macb_adj_dma_desc_idx() Théo Lebrun
@ 2025-08-08 16:52 ` Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 15/16] net: macb: introduce DMA descriptor helpers (is 64bit? is PTP?) Théo Lebrun
` (2 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Théo Lebrun @ 2025-08-08 16:52 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Claudiu Beznea, Geert Uytterhoeven, Harini Katakam,
Richard Cochran, Russell King
Cc: netdev, devicetree, linux-kernel, Thomas Petazzoni, Tawfik Bayouk,
Théo Lebrun
Drop bp->hw_dma_cap field and put its two flags into bp->caps.
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
drivers/net/ethernet/cadence/macb.h | 10 ++--------
drivers/net/ethernet/cadence/macb_main.c | 28 ++++++++++++++--------------
drivers/net/ethernet/cadence/macb_ptp.c | 16 +++++++++-------
3 files changed, 25 insertions(+), 29 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index c5ab35f4ab493196b5fa9a8046a6c8edf7c82727..ed015c4d4a33746b7ed6e32127bc04318da946c8 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -748,6 +748,8 @@
#define MACB_CAPS_GIGABIT_MODE_AVAILABLE BIT(18)
#define MACB_CAPS_SG_DISABLED BIT(19)
#define MACB_CAPS_MACB_IS_GEM BIT(20)
+#define MACB_CAPS_DMA_64B BIT(21)
+#define MACB_CAPS_DMA_PTP BIT(22)
/* LSO settings */
#define MACB_LSO_UFO_ENABLE 0x01
@@ -825,11 +827,6 @@ struct macb_dma_desc {
};
#ifdef MACB_EXT_DESC
-#define HW_DMA_CAP_32B 0
-#define HW_DMA_CAP_64B (1 << 0)
-#define HW_DMA_CAP_PTP (1 << 1)
-#define HW_DMA_CAP_64B_PTP (HW_DMA_CAP_64B | HW_DMA_CAP_PTP)
-
struct macb_dma_desc_64 {
u32 addrh;
u32 resvd;
@@ -1315,9 +1312,6 @@ struct macb {
struct phy *sgmii_phy; /* for ZynqMP SGMII mode */
-#ifdef MACB_EXT_DESC
- uint8_t hw_dma_cap;
-#endif
spinlock_t tsu_clk_lock; /* gem tsu clock locking */
unsigned int tsu_rate;
struct ptp_clock *ptp_clock;
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index e3cf62253bb96ff245e49730dd4c4b232ce89712..52c3a352519c3f68403d859932d26b536a01affb 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -123,9 +123,9 @@ static unsigned int macb_dma_desc_get_size(struct macb *bp)
unsigned int desc_size = sizeof(struct macb_dma_desc);
#ifdef MACB_EXT_DESC
- if (bp->hw_dma_cap & HW_DMA_CAP_64B)
+ if (bp->caps & MACB_CAPS_DMA_64B)
desc_size += sizeof(struct macb_dma_desc_64);
- if (bp->hw_dma_cap & HW_DMA_CAP_PTP)
+ if (bp->caps & MACB_CAPS_DMA_PTP)
desc_size += sizeof(struct macb_dma_desc_ptp);
#endif
@@ -135,8 +135,8 @@ static unsigned int macb_dma_desc_get_size(struct macb *bp)
static unsigned int macb_adj_dma_desc_idx(struct macb *bp, unsigned int desc_idx)
{
#ifdef MACB_EXT_DESC
- bool is_ptp = bp->hw_dma_cap & HW_DMA_CAP_PTP;
- bool is_64b = bp->hw_dma_cap & HW_DMA_CAP_64B;
+ bool is_ptp = bp->caps & MACB_CAPS_DMA_PTP;
+ bool is_64b = bp->caps & MACB_CAPS_DMA_64B;
return desc_idx * (1 + is_64b + is_ptp);
#else
@@ -474,7 +474,7 @@ static void macb_init_buffers(struct macb *bp)
#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
/* Single register for all queues' high 32 bits. */
- if (bp->hw_dma_cap & HW_DMA_CAP_64B) {
+ if (bp->caps & MACB_CAPS_DMA_64B) {
macb_writel(bp, RBQPH, upper_32_bits(bp->queues[0].rx_ring_dma));
macb_writel(bp, TBQPH, upper_32_bits(bp->queues[0].tx_ring_dma));
}
@@ -1006,7 +1006,7 @@ static void macb_set_addr(struct macb *bp, struct macb_dma_desc *desc, dma_addr_
#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
struct macb_dma_desc_64 *desc_64;
- if (bp->hw_dma_cap & HW_DMA_CAP_64B) {
+ if (bp->caps & MACB_CAPS_DMA_64B) {
desc_64 = macb_64b_desc(bp, desc);
desc_64->addrh = upper_32_bits(addr);
/* The low bits of RX address contain the RX_USED bit, clearing
@@ -1025,14 +1025,14 @@ static dma_addr_t macb_get_addr(struct macb *bp, struct macb_dma_desc *desc)
#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
struct macb_dma_desc_64 *desc_64;
- if (bp->hw_dma_cap & HW_DMA_CAP_64B) {
+ if (bp->caps & MACB_CAPS_DMA_64B) {
desc_64 = macb_64b_desc(bp, desc);
addr = ((u64)(desc_64->addrh) << 32);
}
#endif
addr |= MACB_BF(RX_WADDR, MACB_BFEXT(RX_WADDR, desc->addr));
#ifdef CONFIG_MACB_USE_HWSTAMP
- if (bp->hw_dma_cap & HW_DMA_CAP_PTP)
+ if (bp->caps & MACB_CAPS_DMA_PTP)
addr &= ~GEM_BIT(DMA_RXVALID);
#endif
return addr;
@@ -2304,7 +2304,7 @@ static netdev_tx_t macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
#ifdef CONFIG_MACB_USE_HWSTAMP
if ((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
- (bp->hw_dma_cap & HW_DMA_CAP_PTP))
+ (bp->caps & MACB_CAPS_DMA_PTP))
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
#endif
@@ -2784,11 +2784,11 @@ static void macb_configure_dma(struct macb *bp)
dmacfg &= ~GEM_BIT(ADDR64);
#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
- if (bp->hw_dma_cap & HW_DMA_CAP_64B)
+ if (bp->caps & MACB_CAPS_DMA_64B)
dmacfg |= GEM_BIT(ADDR64);
#endif
#ifdef CONFIG_MACB_USE_HWSTAMP
- if (bp->hw_dma_cap & HW_DMA_CAP_PTP)
+ if (bp->caps & MACB_CAPS_DMA_PTP)
dmacfg |= GEM_BIT(RXEXT) | GEM_BIT(TXEXT);
#endif
netdev_dbg(bp->dev, "Cadence configure DMA with 0x%08x\n",
@@ -3568,7 +3568,7 @@ static int gem_get_ts_info(struct net_device *dev,
{
struct macb *bp = netdev_priv(dev);
- if ((bp->hw_dma_cap & HW_DMA_CAP_PTP) == 0) {
+ if (!(bp->caps & MACB_CAPS_DMA_PTP)) {
ethtool_op_get_ts_info(dev, info);
return 0;
}
@@ -4140,7 +4140,7 @@ static void macb_configure_caps(struct macb *bp,
"GEM doesn't support hardware ptp.\n");
else {
#ifdef CONFIG_MACB_USE_HWSTAMP
- bp->hw_dma_cap |= HW_DMA_CAP_PTP;
+ bp->caps |= MACB_CAPS_DMA_PTP;
bp->ptp_info = &gem_ptp_info;
#endif
}
@@ -5276,7 +5276,7 @@ static int macb_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "failed to set DMA mask\n");
goto err_out_free_netdev;
}
- bp->hw_dma_cap |= HW_DMA_CAP_64B;
+ bp->caps |= MACB_CAPS_DMA_64B;
}
#endif
platform_set_drvdata(pdev, dev);
diff --git a/drivers/net/ethernet/cadence/macb_ptp.c b/drivers/net/ethernet/cadence/macb_ptp.c
index a63bf29c4fa81b95f10aec8b8fe9918022e196d6..f4ab379f28493cffe30275fd335844ae2fefc89a 100644
--- a/drivers/net/ethernet/cadence/macb_ptp.c
+++ b/drivers/net/ethernet/cadence/macb_ptp.c
@@ -28,14 +28,16 @@
static struct macb_dma_desc_ptp *macb_ptp_desc(struct macb *bp,
struct macb_dma_desc *desc)
{
- if (bp->hw_dma_cap == HW_DMA_CAP_PTP)
- return (struct macb_dma_desc_ptp *)
- ((u8 *)desc + sizeof(struct macb_dma_desc));
- if (bp->hw_dma_cap == HW_DMA_CAP_64B_PTP)
+ if (!(bp->caps & MACB_CAPS_DMA_PTP))
+ return NULL;
+
+ if (bp->caps & MACB_CAPS_DMA_64B)
return (struct macb_dma_desc_ptp *)
((u8 *)desc + sizeof(struct macb_dma_desc)
+ sizeof(struct macb_dma_desc_64));
- return NULL;
+ else
+ return (struct macb_dma_desc_ptp *)
+ ((u8 *)desc + sizeof(struct macb_dma_desc));
}
static int gem_tsu_get_time(struct ptp_clock_info *ptp, struct timespec64 *ts,
@@ -380,7 +382,7 @@ int gem_get_hwtst(struct net_device *dev,
struct macb *bp = netdev_priv(dev);
*tstamp_config = bp->tstamp_config;
- if ((bp->hw_dma_cap & HW_DMA_CAP_PTP) == 0)
+ if (!(bp->caps & MACB_CAPS_DMA_PTP))
return -EOPNOTSUPP;
return 0;
@@ -407,7 +409,7 @@ int gem_set_hwtst(struct net_device *dev,
struct macb *bp = netdev_priv(dev);
u32 regval;
- if ((bp->hw_dma_cap & HW_DMA_CAP_PTP) == 0)
+ if (!(bp->caps & MACB_CAPS_DMA_PTP))
return -EOPNOTSUPP;
switch (tstamp_config->tx_type) {
--
2.50.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net v3 15/16] net: macb: introduce DMA descriptor helpers (is 64bit? is PTP?)
2025-08-08 16:52 [PATCH net v3 00/16] net: macb: various fixes & cleanup Théo Lebrun
` (13 preceding siblings ...)
2025-08-08 16:52 ` [PATCH net v3 14/16] net: macb: move bp->hw_dma_cap flags to bp->caps Théo Lebrun
@ 2025-08-08 16:52 ` Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 16/16] net: macb: sort #includes Théo Lebrun
2025-08-08 23:06 ` [PATCH net v3 00/16] net: macb: various fixes & cleanup Jakub Kicinski
16 siblings, 0 replies; 18+ messages in thread
From: Théo Lebrun @ 2025-08-08 16:52 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Claudiu Beznea, Geert Uytterhoeven, Harini Katakam,
Richard Cochran, Russell King
Cc: netdev, devicetree, linux-kernel, Thomas Petazzoni, Tawfik Bayouk,
Théo Lebrun
Introduce macb_dma64() and macb_dma_ptp() helper functions.
Many codepaths are made simpler by dropping conditional compilation.
This implies two additional changes:
- Always compile related structure definitions inside <macb.h>.
- MACB_EXT_DESC can be dropped as it is useless now.
The common case is:
#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
if (bp->hw_dma_cap & HW_DMA_CAP_64B) {
// ...
}
#endif
And replaced by:
if (macb_dma64(bp)) {
// ...
}
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
drivers/net/ethernet/cadence/macb.h | 18 +++++++----
drivers/net/ethernet/cadence/macb_main.c | 53 +++++++++-----------------------
drivers/net/ethernet/cadence/macb_ptp.c | 8 ++---
3 files changed, 31 insertions(+), 48 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index ed015c4d4a33746b7ed6e32127bc04318da946c8..aa29eaac109acb2771e5732b59362dd28fcafa47 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -15,10 +15,6 @@
#include <linux/phy/phy.h>
#include <linux/workqueue.h>
-#if defined(CONFIG_ARCH_DMA_ADDR_T_64BIT) || defined(CONFIG_MACB_USE_HWSTAMP)
-#define MACB_EXT_DESC
-#endif
-
#define MACB_GREGS_NBR 16
#define MACB_GREGS_VERSION 2
#define MACB_MAX_QUEUES 8
@@ -826,7 +822,6 @@ struct macb_dma_desc {
u32 ctrl;
};
-#ifdef MACB_EXT_DESC
struct macb_dma_desc_64 {
u32 addrh;
u32 resvd;
@@ -836,7 +831,6 @@ struct macb_dma_desc_ptp {
u32 ts_1;
u32 ts_2;
};
-#endif
/* DMA descriptor bitfields */
#define MACB_RX_USED_OFFSET 0
@@ -1390,6 +1384,18 @@ static inline bool gem_has_ptp(struct macb *bp)
return IS_ENABLED(CONFIG_MACB_USE_HWSTAMP) && (bp->caps & MACB_CAPS_GEM_HAS_PTP);
}
+static inline bool macb_dma64(struct macb *bp)
+{
+ return IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT) &&
+ bp->caps & MACB_CAPS_DMA_64B;
+}
+
+static inline bool macb_dma_ptp(struct macb *bp)
+{
+ return IS_ENABLED(CONFIG_MACB_USE_HWSTAMP) &&
+ bp->caps & MACB_CAPS_DMA_PTP;
+}
+
/**
* struct macb_platform_data - platform data for MACB Ethernet used for PCI registration
* @pclk: platform clock
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 52c3a352519c3f68403d859932d26b536a01affb..15fd940c684f50c983c32e94a0856d42d9ece161 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -122,35 +122,24 @@ static unsigned int macb_dma_desc_get_size(struct macb *bp)
{
unsigned int desc_size = sizeof(struct macb_dma_desc);
-#ifdef MACB_EXT_DESC
- if (bp->caps & MACB_CAPS_DMA_64B)
+ if (macb_dma64(bp))
desc_size += sizeof(struct macb_dma_desc_64);
- if (bp->caps & MACB_CAPS_DMA_PTP)
+ if (macb_dma_ptp(bp))
desc_size += sizeof(struct macb_dma_desc_ptp);
-#endif
return desc_size;
}
static unsigned int macb_adj_dma_desc_idx(struct macb *bp, unsigned int desc_idx)
{
-#ifdef MACB_EXT_DESC
- bool is_ptp = bp->caps & MACB_CAPS_DMA_PTP;
- bool is_64b = bp->caps & MACB_CAPS_DMA_64B;
-
- return desc_idx * (1 + is_64b + is_ptp);
-#else
- return desc_idx;
-#endif
+ return desc_idx * (1 + macb_dma64(bp) + macb_dma_ptp(bp));
}
-#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
static struct macb_dma_desc_64 *macb_64b_desc(struct macb *bp, struct macb_dma_desc *desc)
{
return (struct macb_dma_desc_64 *)((void *)desc
+ sizeof(struct macb_dma_desc));
}
-#endif
/* Ring buffer accessors */
static unsigned int macb_tx_ring_wrap(struct macb *bp, unsigned int index)
@@ -472,13 +461,11 @@ static void macb_init_buffers(struct macb *bp)
struct macb_queue *queue;
unsigned int q;
-#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
/* Single register for all queues' high 32 bits. */
- if (bp->caps & MACB_CAPS_DMA_64B) {
+ if (macb_dma64(bp)) {
macb_writel(bp, RBQPH, upper_32_bits(bp->queues[0].rx_ring_dma));
macb_writel(bp, TBQPH, upper_32_bits(bp->queues[0].tx_ring_dma));
}
-#endif
for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
queue_writel(queue, RBQP, lower_32_bits(queue->rx_ring_dma));
@@ -1003,10 +990,9 @@ static void macb_tx_unmap(struct macb *bp, struct macb_tx_skb *tx_skb, int budge
static void macb_set_addr(struct macb *bp, struct macb_dma_desc *desc, dma_addr_t addr)
{
-#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
- struct macb_dma_desc_64 *desc_64;
+ if (macb_dma64(bp)) {
+ struct macb_dma_desc_64 *desc_64;
- if (bp->caps & MACB_CAPS_DMA_64B) {
desc_64 = macb_64b_desc(bp, desc);
desc_64->addrh = upper_32_bits(addr);
/* The low bits of RX address contain the RX_USED bit, clearing
@@ -1015,26 +1001,23 @@ static void macb_set_addr(struct macb *bp, struct macb_dma_desc *desc, dma_addr_
*/
dma_wmb();
}
-#endif
+
desc->addr = lower_32_bits(addr);
}
static dma_addr_t macb_get_addr(struct macb *bp, struct macb_dma_desc *desc)
{
dma_addr_t addr = 0;
-#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
- struct macb_dma_desc_64 *desc_64;
+ if (macb_dma64(bp)) {
+ struct macb_dma_desc_64 *desc_64;
- if (bp->caps & MACB_CAPS_DMA_64B) {
desc_64 = macb_64b_desc(bp, desc);
addr = ((u64)(desc_64->addrh) << 32);
}
-#endif
+
addr |= MACB_BF(RX_WADDR, MACB_BFEXT(RX_WADDR, desc->addr));
-#ifdef CONFIG_MACB_USE_HWSTAMP
- if (bp->caps & MACB_CAPS_DMA_PTP)
+ if (macb_dma_ptp(bp))
addr &= ~GEM_BIT(DMA_RXVALID);
-#endif
return addr;
}
@@ -2302,11 +2285,9 @@ static netdev_tx_t macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
return ret;
}
-#ifdef CONFIG_MACB_USE_HWSTAMP
if ((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
- (bp->caps & MACB_CAPS_DMA_PTP))
+ macb_dma_ptp(bp))
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
-#endif
is_lso = (skb_shinfo(skb)->gso_size != 0);
@@ -2783,14 +2764,10 @@ static void macb_configure_dma(struct macb *bp)
dmacfg &= ~GEM_BIT(TXCOEN);
dmacfg &= ~GEM_BIT(ADDR64);
-#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
- if (bp->caps & MACB_CAPS_DMA_64B)
+ if (macb_dma64(bp))
dmacfg |= GEM_BIT(ADDR64);
-#endif
-#ifdef CONFIG_MACB_USE_HWSTAMP
- if (bp->caps & MACB_CAPS_DMA_PTP)
+ if (macb_dma_ptp(bp))
dmacfg |= GEM_BIT(RXEXT) | GEM_BIT(TXEXT);
-#endif
netdev_dbg(bp->dev, "Cadence configure DMA with 0x%08x\n",
dmacfg);
gem_writel(bp, DMACFG, dmacfg);
@@ -3568,7 +3545,7 @@ static int gem_get_ts_info(struct net_device *dev,
{
struct macb *bp = netdev_priv(dev);
- if (!(bp->caps & MACB_CAPS_DMA_PTP)) {
+ if (!macb_dma_ptp(bp)) {
ethtool_op_get_ts_info(dev, info);
return 0;
}
diff --git a/drivers/net/ethernet/cadence/macb_ptp.c b/drivers/net/ethernet/cadence/macb_ptp.c
index f4ab379f28493cffe30275fd335844ae2fefc89a..c9e77819196e17a5b88f6dab77dadabfe087a1bd 100644
--- a/drivers/net/ethernet/cadence/macb_ptp.c
+++ b/drivers/net/ethernet/cadence/macb_ptp.c
@@ -28,10 +28,10 @@
static struct macb_dma_desc_ptp *macb_ptp_desc(struct macb *bp,
struct macb_dma_desc *desc)
{
- if (!(bp->caps & MACB_CAPS_DMA_PTP))
+ if (!macb_dma_ptp(bp))
return NULL;
- if (bp->caps & MACB_CAPS_DMA_64B)
+ if (macb_dma64(bp))
return (struct macb_dma_desc_ptp *)
((u8 *)desc + sizeof(struct macb_dma_desc)
+ sizeof(struct macb_dma_desc_64));
@@ -382,7 +382,7 @@ int gem_get_hwtst(struct net_device *dev,
struct macb *bp = netdev_priv(dev);
*tstamp_config = bp->tstamp_config;
- if (!(bp->caps & MACB_CAPS_DMA_PTP))
+ if (!macb_dma_ptp(bp))
return -EOPNOTSUPP;
return 0;
@@ -409,7 +409,7 @@ int gem_set_hwtst(struct net_device *dev,
struct macb *bp = netdev_priv(dev);
u32 regval;
- if (!(bp->caps & MACB_CAPS_DMA_PTP))
+ if (!macb_dma_ptp(bp))
return -EOPNOTSUPP;
switch (tstamp_config->tx_type) {
--
2.50.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH net v3 16/16] net: macb: sort #includes
2025-08-08 16:52 [PATCH net v3 00/16] net: macb: various fixes & cleanup Théo Lebrun
` (14 preceding siblings ...)
2025-08-08 16:52 ` [PATCH net v3 15/16] net: macb: introduce DMA descriptor helpers (is 64bit? is PTP?) Théo Lebrun
@ 2025-08-08 16:52 ` Théo Lebrun
2025-08-08 23:06 ` [PATCH net v3 00/16] net: macb: various fixes & cleanup Jakub Kicinski
16 siblings, 0 replies; 18+ messages in thread
From: Théo Lebrun @ 2025-08-08 16:52 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Claudiu Beznea, Geert Uytterhoeven, Harini Katakam,
Richard Cochran, Russell King
Cc: netdev, devicetree, linux-kernel, Thomas Petazzoni, Tawfik Bayouk,
Théo Lebrun, Andrew Lunn, Sean Anderson
Sort #include preprocessor directives.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Sean Anderson <sean.anderson@linux.dev>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
drivers/net/ethernet/cadence/macb_main.c | 36 ++++++++++++++++----------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 15fd940c684f50c983c32e94a0856d42d9ece161..bf235bf95a2ce62719d0104eec70690bfc1591f9 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -6,36 +6,36 @@
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-#include <linux/clk.h>
+#include <linux/circ_buf.h>
#include <linux/clk-provider.h>
+#include <linux/clk.h>
#include <linux/crc32.h>
+#include <linux/dma-mapping.h>
+#include <linux/etherdevice.h>
+#include <linux/firmware/xlnx-zynqmp.h>
+#include <linux/inetdevice.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/iopoll.h>
+#include <linux/ip.h>
+#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/circ_buf.h>
-#include <linux/slab.h>
-#include <linux/init.h>
-#include <linux/io.h>
-#include <linux/interrupt.h>
#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/dma-mapping.h>
-#include <linux/platform_device.h>
-#include <linux/phylink.h>
#include <linux/of.h>
#include <linux/of_mdio.h>
#include <linux/of_net.h>
-#include <linux/ip.h>
-#include <linux/udp.h>
-#include <linux/tcp.h>
-#include <linux/iopoll.h>
#include <linux/phy/phy.h>
+#include <linux/phylink.h>
+#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/ptp_classify.h>
#include <linux/reset.h>
-#include <linux/firmware/xlnx-zynqmp.h>
-#include <linux/inetdevice.h>
+#include <linux/slab.h>
+#include <linux/tcp.h>
+#include <linux/types.h>
+#include <linux/udp.h>
#include "macb.h"
/* This structure is only used for MACB on SiFive FU540 devices */
--
2.50.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH net v3 00/16] net: macb: various fixes & cleanup
2025-08-08 16:52 [PATCH net v3 00/16] net: macb: various fixes & cleanup Théo Lebrun
` (15 preceding siblings ...)
2025-08-08 16:52 ` [PATCH net v3 16/16] net: macb: sort #includes Théo Lebrun
@ 2025-08-08 23:06 ` Jakub Kicinski
16 siblings, 0 replies; 18+ messages in thread
From: Jakub Kicinski @ 2025-08-08 23:06 UTC (permalink / raw)
To: Théo Lebrun
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Nicolas Ferre,
Claudiu Beznea, Geert Uytterhoeven, Harini Katakam,
Richard Cochran, Russell King, netdev, devicetree, linux-kernel,
Thomas Petazzoni, Tawfik Bayouk, Krzysztof Kozlowski,
Sean Anderson, Andrew Lunn
On Fri, 08 Aug 2025 18:52:32 +0200 Théo Lebrun wrote:
> This is a split off my previous series on MACB [0]. The main goal is to
> add EyeQ5 support, but there was a lot of independent fixes/cleanup.
>
> Overall, it is fixes first so they can be applied swiftly, followed by a
> series of cleanup patches. To clarify, nothing critical. It mostly puts
> the driver in a better shape and prepares it for EyeQ5 patches.
Nothing past patch 7 is a fix, please separate fixes from other changes
(unless there's a hard to avoid dependency). Please wrap the code at 80
chars.
--
pw-bot: cr
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2025-08-08 23:06 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-08 16:52 [PATCH net v3 00/16] net: macb: various fixes & cleanup Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 01/16] dt-bindings: net: cdns,macb: allow tsu_clk without tx_clk Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 02/16] dt-bindings: net: cdns,macb: sort compatibles Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 03/16] net: macb: remove illusion about TBQPH/RBQPH being per-queue Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 04/16] net: macb: move ring size computation to functions Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 05/16] net: macb: single dma_alloc_coherent() for DMA descriptors Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 06/16] net: macb: match skb_reserve(skb, NET_IP_ALIGN) with HW alignment Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 07/16] net: macb: avoid double endianness swap in macb_set_hwaddr() Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 08/16] net: macb: use BIT() macro for capability definitions Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 09/16] net: macb: remove gap in MACB_CAPS_* flags Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 10/16] net: macb: Remove local variables clk_init and init in macb_probe() Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 11/16] net: macb: drop macb_config NULL checking Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 12/16] net: macb: simplify macb_dma_desc_get_size() Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 13/16] net: macb: simplify macb_adj_dma_desc_idx() Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 14/16] net: macb: move bp->hw_dma_cap flags to bp->caps Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 15/16] net: macb: introduce DMA descriptor helpers (is 64bit? is PTP?) Théo Lebrun
2025-08-08 16:52 ` [PATCH net v3 16/16] net: macb: sort #includes Théo Lebrun
2025-08-08 23:06 ` [PATCH net v3 00/16] net: macb: various fixes & cleanup Jakub Kicinski
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).