From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] net: dsa: use dma_alloc in receive path for symmetry
Date: Tue, 23 Apr 2024 19:53:37 +0200 [thread overview]
Message-ID: <20240423175337.2304839-1-a.fatoum@pengutronix.de> (raw)
As explained by the comment, we don't strictly need this at moment, but,
say, if in future, we decide to save a memory copy in the ping reply
code by reusing the receive buffer for transmission, it would work for
all interfaces, except for DSA. Therefore, let's iron out this wrinkle.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/net/dsa.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa.c b/drivers/net/dsa.c
index ccd7d8755035..e0bf079e4dbf 100644
--- a/drivers/net/dsa.c
+++ b/drivers/net/dsa.c
@@ -270,7 +270,14 @@ static int dsa_switch_register_edev(struct dsa_switch *ds,
struct dsa_port *dp;
dp = dsa_port_alloc(ds, dn, port);
- dp->rx_buf = xmalloc(DSA_PKTSIZE);
+
+ /* DMA is done on buffer in receive ring allocated by network
+ * driver. This is then copied into this buffer, so we don't
+ * strictly need to use dma_alloc() here, unlike ds->tx_buf.
+ * We do it anyway as we don't want DSA buffers to be subtly
+ * different to that of a directly used network interface.
+ */
+ dp->rx_buf = dma_alloc(DSA_PKTSIZE);
edev = &dp->edev;
edev->priv = dp;
--
2.39.2
next reply other threads:[~2024-04-23 17:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-23 17:53 Ahmad Fatoum [this message]
2024-04-29 13:48 ` 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=20240423175337.2304839-1-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