From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] net: Use dma_alloc to allocate net packet
Date: Fri, 16 Sep 2022 14:06:20 +0200 [thread overview]
Message-ID: <20220916120620.2708538-1-s.hauer@pengutronix.de> (raw)
network packets are often DMAed by the network drivers, so allocate
them with dma_alloc() rather than assuming that an arbitrarily chosen
alignment is sufficient
This fixes network transfers on a Rockchip RK3568 board which
occasionally sent out packets with corrupt data.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
include/net.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/net.h b/include/net.h
index b50b6e76c8..310bf5169d 100644
--- a/include/net.h
+++ b/include/net.h
@@ -19,6 +19,7 @@
#include <stdlib.h>
#include <clock.h>
#include <led.h>
+#include <dma.h>
#include <slice.h>
#include <xfuncs.h>
#include <linux/phy.h>
@@ -470,7 +471,7 @@ struct net_connection {
static inline char *net_alloc_packet(void)
{
- return xmemalign(32, PKTSIZE);
+ return dma_alloc(PKTSIZE);
}
struct net_connection *net_udp_new(IPaddr_t dest, uint16_t dport,
--
2.30.2
reply other threads:[~2022-09-16 12:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220916120620.2708538-1-s.hauer@pengutronix.de \
--to=s.hauer@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