diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2024-03-13 12:07:02 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2024-03-13 12:38:56 +0100 |
commit | 41b8dc7a59d90015e6a8e50bb8f3352a19f23272 (patch) | |
tree | 339fb297c8fbcd0b6abe31044a09b18f419f636f | |
parent | 18e518e7e4d545ac496d99f86b4ee3512eb1b0e5 (diff) | |
download | barebox-41b8dc7a59d90015e6a8e50bb8f3352a19f23272.tar.gz barebox-41b8dc7a59d90015e6a8e50bb8f3352a19f23272.tar.xz |
net: ethoc: replace global NetRxPackets with per-interface allocation
NetRxPackets is a remnant of times, where a board had at most one
Ethernet controller. This is outdated and we should drop NetRxPackets.
Switch over the driver to allocate the receive buffers needed.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20240313110704.1095554-6-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | drivers/net/ethoc.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c index c878f498a4..a31d3bb521 100644 --- a/drivers/net/ethoc.c +++ b/drivers/net/ethoc.c @@ -178,6 +178,8 @@ struct ethoc { u32 cur_rx; struct mii_bus miibus; + + void *rx_buffer[PKTBUFSRX]; }; /** @@ -266,7 +268,7 @@ static int ethoc_init_ring(struct ethoc *dev) if (i == dev->num_rx - 1) bd.stat |= RX_BD_WRAP; - bd.addr = (u32)NetRxPackets[i]; + bd.addr = (u32)dev->rx_buffer[i]; ethoc_write_bd(dev, dev->num_tx + i, &bd); flush_dcache_range(bd.addr, bd.addr + PKTSIZE); @@ -534,12 +536,18 @@ static int ethoc_probe(struct device *dev) struct resource *iores; struct eth_device *edev; struct ethoc *priv; + int ret; edev = xzalloc(sizeof(struct eth_device) + sizeof(struct ethoc)); edev->priv = (struct ethoc *)(edev + 1); priv = edev->priv; + + ret = net_alloc_packets(priv->rx_buffer, ARRAY_SIZE(priv->rx_buffer)); + if (ret) + return ret; + iores = dev_request_mem_resource(dev, 0); if (IS_ERR(iores)) return PTR_ERR(iores); |