]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net: stmmac: simplify DMA descriptor allocation/init/freeing
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Wed, 18 Mar 2026 18:26:44 +0000 (18:26 +0000)
committerJakub Kicinski <kuba@kernel.org>
Fri, 20 Mar 2026 00:18:52 +0000 (17:18 -0700)
commite73b19baa3b1c8eb909d0990e32c8d596b52be53
tree7bd3431562e15b9086babd23b5ad456d889fb1e8
parent33be7846e4bebb44fb0c09ee92e99cdd111558fd
net: stmmac: simplify DMA descriptor allocation/init/freeing

Rather than having separate branches to handle the different types of
descriptors, use the helper functions to calculate the total size of
the DMA descriptors.

Use this to allocate or free the descriptor array, and use a local
variable to hold the address of the descriptor array, so we only need
one dma_alloc_coherent() or dma_free_coherent() call in these paths.

Also do the same for the receive ring initialisation. The transmit
ring can't be converted as there is a case where stmmac_mode_init()
is not called.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1w2vbQ-0000000DbWc-0ty5@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c