From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 6/7] net: cpsw: replace global NetRxPackets with per-interface allocation
Date: Wed, 13 Mar 2024 12:07:03 +0100 [thread overview]
Message-ID: <20240313110704.1095554-7-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20240313110704.1095554-1-a.fatoum@pengutronix.de>
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>
---
drivers/net/cpsw.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index 42fb32bde2f5..3f24c21594c1 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -215,6 +215,8 @@ struct cpsw_priv {
unsigned int slave_size;
unsigned int sliver_ofs;
+ void *rx_buffer[PKTBUFSRX - 2];
+
struct cpdma_desc *descs;
struct cpdma_desc *desc_free;
struct cpdma_chan rx_chan, tx_chan;
@@ -980,7 +982,7 @@ static int cpsw_setup(struct device *dev)
/* submit rx descs */
for (i = 0; i < PKTBUFSRX - 2; i++) {
- ret = cpdma_submit(priv, &priv->rx_chan, NetRxPackets[i],
+ ret = cpdma_submit(priv, &priv->rx_chan, priv->rx_buffer[i],
PKTSIZE, 0);
if (ret < 0) {
dev_err(dev, "error %d submitting rx desc\n", ret);
@@ -1350,6 +1352,10 @@ static int cpsw_probe(struct device *dev)
priv = xzalloc(sizeof(*priv));
priv->dev = dev;
+ ret = net_alloc_packets(priv->rx_buffer, ARRAY_SIZE(priv->rx_buffer));
+ if (ret)
+ goto out;
+
if (dev->of_node) {
ret = cpsw_probe_dt(priv);
if (ret)
--
2.39.2
next prev parent reply other threads:[~2024-03-13 11:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-13 11:06 [PATCH 0/7] net: replace global NetRxPackets arrays " Ahmad Fatoum
2024-03-13 11:06 ` [PATCH 1/7] net: add net_alloc_packets helper Ahmad Fatoum
2024-03-13 11:06 ` [PATCH 2/7] net: ep93xx: replace global NetRxPackets with per-interface allocation Ahmad Fatoum
2024-03-13 11:07 ` [PATCH 3/7] net: enc28j60: " Ahmad Fatoum
2024-03-13 11:07 ` [PATCH 4/7] net: gianfar: " Ahmad Fatoum
2024-03-13 11:07 ` [PATCH 5/7] net: ethoc: " Ahmad Fatoum
2024-03-13 11:07 ` Ahmad Fatoum [this message]
2024-03-13 11:07 ` [PATCH 7/7] net: retire global NetRxPackets arrays Ahmad Fatoum
2024-03-13 11:38 ` [PATCH 0/7] net: replace global NetRxPackets arrays with per-interface allocation Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240313110704.1095554-7-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox