]> git.sur5r.net Git - u-boot/commitdiff
net: Always align tx packets
authorMario Six <mario.six@gdsys.cc>
Wed, 28 Mar 2018 12:38:49 +0000 (14:38 +0200)
committerJoe Hershberger <joe.hershberger@ni.com>
Wed, 13 Jun 2018 18:54:15 +0000 (13:54 -0500)
Make sure that TX packets are always cache-aligned.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
net/arp.c
net/ping.c

index 990b771c92118c330fc3f544464bfef96aa482e9..b8a71684cd768c36b30d38393482d9ebd4aca536 100644 (file)
--- 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(&arp->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 */
index 5464f2f785fed0c195f81c11a320cd7abad38d77..3e5461a36a02b2d1f41c857dc8d39aaabf440823 100644 (file)
@@ -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;*/