[PATCH 4/9] net: liteeth: Do not use NetRxPackets

Sascha Hauer s.hauer at pengutronix.de
Mon Sep 19 01:01:28 PDT 2022


Use a driver private buffer as network receive buffer rather than the
globally allocated ones which will be removed soon.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/net/liteeth.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/liteeth.c b/drivers/net/liteeth.c
index 771f57eead..547f5486ae 100644
--- a/drivers/net/liteeth.c
+++ b/drivers/net/liteeth.c
@@ -73,6 +73,8 @@ struct liteeth {
 	int rx_slot;
 	int num_rx_slots;
 	void __iomem *rx_base;
+
+	void *rx_buf;
 };
 
 static inline void litex_write8(void __iomem *addr, u8 val)
@@ -230,9 +232,9 @@ static int liteeth_eth_rx(struct eth_device *edev)
 
 	rx_slot = litex_read8(priv->base + LITEETH_WRITER_SLOT);
 
-	memcpy(NetRxPackets[0], priv->rx_base + rx_slot * LITEETH_BUFFER_SIZE, len);
+	memcpy(priv->rx_buf, priv->rx_base + rx_slot * LITEETH_BUFFER_SIZE, len);
 
-	net_receive(edev, NetRxPackets[0], len);
+	net_receive(edev, priv->rx_buf, len);
 
 	litex_write8(priv->base + LITEETH_WRITER_EV_PENDING, reg);
 
@@ -323,6 +325,8 @@ static int liteeth_probe(struct device_d *dev)
 	priv->tx_base = buf_base + priv->num_rx_slots * LITEETH_BUFFER_SIZE;
 	priv->tx_slot = 0;
 
+	priv->rx_buf = xmalloc(PKTSIZE);
+
 	edev->init = liteeth_init_dev;
 	edev->open = liteeth_eth_open;
 	edev->send = liteeth_eth_send;
-- 
2.30.2




More information about the barebox mailing list