[U-Boot] [PATCH 1/4] net: Always align tx packets
Make sure that TX packets are always cache-aligned. Signed-off-by: Mario Six --- 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 4c79e09ccb..191434f5e2 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(&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 */ diff --git a/net/ping.c b/net/ping.c index 9508cf1160..db14209bf6 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.16.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/4] net: Always align tx packets
On Wed, Mar 28, 2018 at 7:38 AM, Mario Six wrote: > Make sure that TX packets are always cache-aligned. > > Signed-off-by: Mario Six Acked-by: Joe Hershberger ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/4] net: Always align tx packets
On Wed, Mar 28, 2018 at 7:38 AM, Mario Six wrote: > Make sure that TX packets are always cache-aligned. > > Signed-off-by: Mario Six > --- > 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 4c79e09ccb..191434f5e2 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(&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); Rather than always incurring a copy here, why not have the device driver that requires this do the copy? > return; > > case ARPOP_REPLY: /* arp reply */ > diff --git a/net/ping.c b/net/ping.c > index 9508cf1160..db14209bf6 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.16.1 > > ___ > U-Boot mailing list > U-Boot@lists.denx.de > https://lists.denx.de/listinfo/u-boot ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot