projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ARM: dts: rk3399-evb: usb3.0 host support
[oweals/u-boot.git]
/
net
/
net.c
diff --git
a/net/net.c
b/net/net.c
index ded86e7456715ebfc39ce1f52cdd5fd954870963..37932919d049a7a834bb999e83f593f9b5d47a29 100644
(file)
--- a/
net/net.c
+++ b/
net/net.c
@@
-88,11
+88,14
@@
#include <common.h>
#include <common.h>
+#include <bootstage.h>
#include <command.h>
#include <console.h>
#include <env.h>
#include <env_internal.h>
#include <errno.h>
#include <command.h>
#include <console.h>
#include <env.h>
#include <env_internal.h>
#include <errno.h>
+#include <image.h>
+#include <log.h>
#include <net.h>
#include <net/fastboot.h>
#include <net/tftp.h>
#include <net.h>
#include <net/fastboot.h>
#include <net/tftp.h>
@@
-308,7
+311,7
@@
U_BOOT_ENV_CALLBACK(dnsip, on_dnsip);
*/
void net_auto_load(void)
{
*/
void net_auto_load(void)
{
-#if defined(CONFIG_CMD_NFS)
+#if defined(CONFIG_CMD_NFS)
&& !defined(CONFIG_SPL_BUILD)
const char *s = env_get("autoload");
if (s != NULL && strcmp(s, "NFS") == 0) {
const char *s = env_get("autoload");
if (s != NULL && strcmp(s, "NFS") == 0) {
@@
-496,7
+499,7
@@
restart:
ping_start();
break;
#endif
ping_start();
break;
#endif
-#if defined(CONFIG_CMD_NFS)
+#if defined(CONFIG_CMD_NFS)
&& !defined(CONFIG_SPL_BUILD)
case NFS:
nfs_start();
break;
case NFS:
nfs_start();
break;
@@
-561,9
+564,6
@@
restart:
*/
for (;;) {
WATCHDOG_RESET();
*/
for (;;) {
WATCHDOG_RESET();
-#ifdef CONFIG_SHOW_ACTIVITY
- show_activity(1);
-#endif
if (arp_timeout_check() > 0)
time_start = get_timer(0);
if (arp_timeout_check() > 0)
time_start = get_timer(0);
@@
-639,7
+639,7
@@
restart:
printf("Bytes transferred = %d (%x hex)\n",
net_boot_file_size, net_boot_file_size);
env_set_hex("filesize", net_boot_file_size);
printf("Bytes transferred = %d (%x hex)\n",
net_boot_file_size, net_boot_file_size);
env_set_hex("filesize", net_boot_file_size);
- env_set_hex("fileaddr", load_addr);
+ env_set_hex("fileaddr",
image_
load_addr);
}
if (protocol != NETCONS)
eth_halt();
}
if (protocol != NETCONS)
eth_halt();
@@
-885,9
+885,6
@@
int net_send_ip_packet(uchar *ether, struct in_addr dest, int dport, int sport,
* to the algorithm in RFC815. It returns NULL or the pointer to
* a complete packet, in static storage
*/
* to the algorithm in RFC815. It returns NULL or the pointer to
* a complete packet, in static storage
*/
-#ifndef CONFIG_NET_MAXDEFRAG
-#define CONFIG_NET_MAXDEFRAG 16384
-#endif
#define IP_PKTSIZE (CONFIG_NET_MAXDEFRAG)
#define IP_MAXUDP (IP_PKTSIZE - IP_HDR_SIZE)
#define IP_PKTSIZE (CONFIG_NET_MAXDEFRAG)
#define IP_MAXUDP (IP_PKTSIZE - IP_HDR_SIZE)
@@
-1274,7
+1271,7
@@
void net_process_received_packet(uchar *in_packet, int len)
#ifdef CONFIG_UDP_CHECKSUM
if (ip->udp_xsum != 0) {
ulong xsum;
#ifdef CONFIG_UDP_CHECKSUM
if (ip->udp_xsum != 0) {
ulong xsum;
- u
short
*sumptr;
+ u
8
*sumptr;
ushort sumlen;
xsum = ip->ip_p;
ushort sumlen;
xsum = ip->ip_p;
@@
-1285,22
+1282,16
@@
void net_process_received_packet(uchar *in_packet, int len)
xsum += (ntohl(ip->ip_dst.s_addr) >> 0) & 0x0000ffff;
sumlen = ntohs(ip->udp_len);
xsum += (ntohl(ip->ip_dst.s_addr) >> 0) & 0x0000ffff;
sumlen = ntohs(ip->udp_len);
- sumptr = (u
short *)&(ip->udp_src)
;
+ sumptr = (u
8 *)&ip->udp_src
;
while (sumlen > 1) {
while (sumlen > 1) {
- ushort sumdata;
-
- sumdata = *sumptr++;
- xsum += ntohs(sumdata);
+ /* inlined ntohs() to avoid alignment errors */
+ xsum += (sumptr[0] << 8) + sumptr[1];
+ sumptr += 2;
sumlen -= 2;
}
sumlen -= 2;
}
- if (sumlen > 0) {
- ushort sumdata;
-
- sumdata = *(unsigned char *)sumptr;
- sumdata = (sumdata << 8) & 0xff00;
- xsum += sumdata;
- }
+ if (sumlen > 0)
+ xsum += (sumptr[0] << 8) + sumptr[0];
while ((xsum >> 16) != 0) {
xsum = (xsum & 0x0000ffff) +
((xsum >> 16) & 0x0000ffff);
while ((xsum >> 16) != 0) {
xsum = (xsum & 0x0000ffff) +
((xsum >> 16) & 0x0000ffff);
@@
-1628,15
+1619,3
@@
ushort env_get_vlan(char *var)
{
return string_to_vlan(env_get(var));
}
{
return string_to_vlan(env_get(var));
}
-
-void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr)
-{
- char *end;
- int i;
-
- for (i = 0; i < 6; ++i) {
- enetaddr[i] = addr ? simple_strtoul(addr, &end, 16) : 0;
- if (addr)
- addr = (*end) ? end + 1 : end;
- }
-}