mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] net: dsa: use dma_alloc in receive path for symmetry
@ 2024-04-23 17:53 Ahmad Fatoum
  2024-04-29 13:48 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2024-04-23 17:53 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: dsa: use dma_alloc in receive path for symmetry
  2024-04-23 17:53 [PATCH] net: dsa: use dma_alloc in receive path for symmetry Ahmad Fatoum
@ 2024-04-29 13:48 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2024-04-29 13:48 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Tue, 23 Apr 2024 19:53:37 +0200, Ahmad Fatoum wrote:
> 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.
> 
> 

Applied, thanks!

[1/1] net: dsa: use dma_alloc in receive path for symmetry
      https://git.pengutronix.de/cgit/barebox/commit/?id=58998f56ee4c (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-29 13:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-23 17:53 [PATCH] net: dsa: use dma_alloc in receive path for symmetry Ahmad Fatoum
2024-04-29 13:48 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox