Re: [U-Boot] [PATCH v2 2/2] net: ping, arp: Fix cache alignment issues

2018-06-08 Thread Joe Hershberger
On Wed, May 30, 2018 at 12:52 AM, Baruch Siach  wrote:
> From: Jon Nettleton 
>
> Both ping_receive and arp_receive would transmit a received packet
> back out using its original point.  This causes problems with
> certain network cards that add a custom header to the packet.
> Specifically the mvneta driver for the Armada series boards has
> a 2 byte Marvell header that is bypassed and passed along to
> the system, but that 2 byte offset now causes a misalignment if
> it is attempted to be sent back out.
>
> Rather than changing the driver to memcpy all the received packets
> to cache aligned buffers we instead change the two offending
> network commands to copy the packet into a cache aligned net_tx_packet
> before sending it back out.

It seems reasonable to make these match the rest of the network commands.

> This fixes occasional messages like:
>
>   CACHE: Misaligned operation at range [3fc01082, 3fc010c2]
>
> Reviewed-by: Stefan Roese 
> Signed-off-by: Jon Nettleton 
> Signed-off-by: Baruch Siach 
> ---

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 2/2] net: ping,arp: Fix cache alignment issues

2018-05-29 Thread Baruch Siach
From: Jon Nettleton 

Both ping_receive and arp_receive would transmit a received packet
back out using its original point.  This causes problems with
certain network cards that add a custom header to the packet.
Specifically the mvneta driver for the Armada series boards has
a 2 byte Marvell header that is bypassed and passed along to
the system, but that 2 byte offset now causes a misalignment if
it is attempted to be sent back out.

Rather than changing the driver to memcpy all the received packets
to cache aligned buffers we instead change the two offending
network commands to copy the packet into a cache aligned net_tx_packet
before sending it back out.

This fixes occasional messages like:

  CACHE: Misaligned operation at range [3fc01082, 3fc010c2]

Reviewed-by: Stefan Roese 
Signed-off-by: Jon Nettleton 
Signed-off-by: Baruch Siach 
---
v2: Add Stefan's review tag
---
 net/arp.c  | 3 ++-
 net/ping.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/arp.c b/net/arp.c
index 990b771c9211..b8a71684cd76 100644
--- a/net/arp.c
+++ b/net/arp.c
@@ -182,7 +182,8 @@ void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr 
*ip, int len)
(net_read_ip(>ar_spa).s_addr & net_netmask.s_addr))
udelay(5000);
 #endif
-   net_send_packet((uchar *)et, eth_hdr_size + ARP_HDR_SIZE);
+   memcpy(net_tx_packet, et, eth_hdr_size + ARP_HDR_SIZE);
+   net_send_packet(net_tx_packet, eth_hdr_size + ARP_HDR_SIZE);
return;
 
case ARPOP_REPLY:   /* arp reply */
diff --git a/net/ping.c b/net/ping.c
index 5464f2f785fe..3e5461a36a02 100644
--- a/net/ping.c
+++ b/net/ping.c
@@ -107,7 +107,8 @@ void ping_receive(struct ethernet_hdr *et, struct 
ip_udp_hdr *ip, int len)
icmph->type = ICMP_ECHO_REPLY;
icmph->checksum = 0;
icmph->checksum = compute_ip_checksum(icmph, len - IP_HDR_SIZE);
-   net_send_packet((uchar *)et, eth_hdr_size + len);
+   memcpy(net_tx_packet, et, eth_hdr_size + len);
+   net_send_packet(net_tx_packet, eth_hdr_size + len);
return;
 /* default:
return;*/
-- 
2.17.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot