[PATCH] net: dsa: use dma_alloc in receive path for symmetry

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux