[PATCH master 14/23] net: macb: use DMA-capable memory for receive buffer
Ahmad Fatoum
a.fatoum at pengutronix.de
Tue Apr 23 23:40:49 PDT 2024
The driver supports older MACB-compatible NICs as well as the newer
GEM-compatible NICs. Both use DMA, but the older MACB support failed to
allocate the single receive buffer with suitable alignment.
Use net_alloc_packet() to fix that.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
drivers/net/macb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index f5b2fa74dc23..bcad88f60e7a 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -910,7 +910,7 @@ static int macb_probe(struct device *dev)
macb->gem_q1_descs = dma_alloc_coherent(GEM_Q1_DESC_BYTES,
DMA_ADDRESS_BROKEN);
- macb->rx_packet_buf = xmalloc(PKTSIZE);
+ macb->rx_packet_buf = net_alloc_packet();
macb_reset_hw(macb);
ncfgr = macb_mdc_clk_div(macb);
@@ -938,7 +938,7 @@ static void macb_remove(struct device *dev)
macb_halt(&macb->netdev);
- free(macb->rx_packet_buf);
+ net_free_packet(macb->rx_packet_buf);
}
static const struct macb_config fu540_c000_config = {
--
2.39.2
More information about the barebox
mailing list