Re: [PATCH net-next 08/13] net: macb: introduce DMA descriptor helpers (is 64bit? is PTP?)

From
Maxime Chevallier <maxime.chevallier@bootlin.com>
Date
2025-03-24 08:55:33
Also in
linux-devicetree, linux-mips, linux-riscv, lkml
Reply to
Théo Lebrun, 2025-03-21
Hello Théo,

On Fri, 21 Mar 2025 20:09:39 +0100
Théo Lebrun [off-list ref] wrote:
Introduce macb_dma_is_64b() and macb_dma_is_ptp() helper functions.
Many codepaths are made simpler by dropping conditional compilation.

This implies three changes:
 - Always compile related structure definitions inside <macb.h>.
 - Make the field hw_dma_cap in struct macb always present.
 - MACB_EXT_DESC can be dropped as it is useless now.

The common case is:

	#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
		struct macb_dma_desc_64 *desc_64;
		if (bp->hw_dma_cap & HW_DMA_CAP_64B) {
			desc_64 = macb_64b_desc(bp, desc);
			// ...
		}
	#endif

And replaced by:

	struct macb_dma_desc_64 *desc_64;
	if (macb_dma_is_64b(bp)) {
		desc_64 = macb_64b_desc(bp, desc);
		// ...
	}
Just a thought, but this is adding some more branches in the hotpath on
32 bits DMA setups. Did you measure any performance changes on
these platforms (if you have access to one :) )

As the caps can't be changed dynamically, maybe these helpers could be
replaced more efficiently with some static_key ? This would benefit
both 32 and 64 bits systems as the following would be more efficient

	if (bp->hw_dma_cap & HW_DMA_CAP_64B) {
		//  ...
	}

Just a thought of course, maybe this patch doesn't really hurt perfs :)

Maxime
Thread (38 messages) 38 messages, 6 authors, last reply 2025-03-27
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help