projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge with git://git.kernel.org/pub/scm/boot/u-boot/u-boot.git#mpc83xx
[oweals/u-boot.git]
/
net
/
net.c
diff --git
a/net/net.c
b/net/net.c
index 00217be08103f85aef1b7b584a2f65da2aee41c6..506203761f43bb54d4115f3715b50b807a35b423 100644
(file)
--- a/
net/net.c
+++ b/
net/net.c
@@
-222,8
+222,10
@@
void ArpRequest (void)
(NetOurIP & NetOurSubnetMask)) {
if (NetOurGatewayIP == 0) {
puts ("## Warning: gatewayip needed but not set\n");
(NetOurIP & NetOurSubnetMask)) {
if (NetOurGatewayIP == 0) {
puts ("## Warning: gatewayip needed but not set\n");
+ NetArpWaitReplyIP = NetArpWaitPacketIP;
+ } else {
+ NetArpWaitReplyIP = NetOurGatewayIP;
}
}
- NetArpWaitReplyIP = NetOurGatewayIP;
} else {
NetArpWaitReplyIP = NetArpWaitPacketIP;
}
} else {
NetArpWaitReplyIP = NetArpWaitPacketIP;
}
@@
-461,7
+463,7
@@
restart:
/*
* Echo the inverted link state to the fault LED.
*/
/*
* Echo the inverted link state to the fault LED.
*/
- if(miiphy_link(CFG_FAULT_MII_ADDR)) {
+ if(miiphy_link(
eth_get_dev()->name,
CFG_FAULT_MII_ADDR)) {
status_led_set (STATUS_LED_RED, STATUS_LED_OFF);
} else {
status_led_set (STATUS_LED_RED, STATUS_LED_ON);
status_led_set (STATUS_LED_RED, STATUS_LED_OFF);
} else {
status_led_set (STATUS_LED_RED, STATUS_LED_ON);
@@
-512,7
+514,7
@@
restart:
/*
* Echo the inverted link state to the fault LED.
*/
/*
* Echo the inverted link state to the fault LED.
*/
- if(miiphy_link(CFG_FAULT_MII_ADDR)) {
+ if(miiphy_link(
eth_get_dev()->name,
CFG_FAULT_MII_ADDR)) {
status_led_set (STATUS_LED_RED, STATUS_LED_OFF);
} else {
status_led_set (STATUS_LED_RED, STATUS_LED_ON);
status_led_set (STATUS_LED_RED, STATUS_LED_OFF);
} else {
status_led_set (STATUS_LED_RED, STATUS_LED_ON);
@@
-810,6
+812,7
@@
static ushort CDP_compute_csum(const uchar *buff, ushort len)
int odd;
ulong result = 0;
ushort leftover;
int odd;
ulong result = 0;
ushort leftover;
+ ushort *p;
if (len > 0) {
odd = 1 & (ulong)buff;
if (len > 0) {
odd = 1 & (ulong)buff;
@@
-819,14
+822,19
@@
static ushort CDP_compute_csum(const uchar *buff, ushort len)
buff++;
}
while (len > 1) {
buff++;
}
while (len > 1) {
- result += *((const ushort *)buff)++;
+ p = (ushort *)buff;
+ result += *p++;
+ buff = (uchar *)p;
if (result & 0x80000000)
result = (result & 0xFFFF) + (result >> 16);
len -= 2;
}
if (len) {
leftover = (signed short)(*(const signed char *)buff);
if (result & 0x80000000)
result = (result & 0xFFFF) + (result >> 16);
len -= 2;
}
if (len) {
leftover = (signed short)(*(const signed char *)buff);
- /* * XXX CISCO SUCKS big time! (and blows too) */
+ /* CISCO SUCKS big time! (and blows too):
+ * CDP uses the IP checksum algorithm with a twist;
+ * for the last byte it *sign* extends and sums.
+ */
result = (result & 0xffff0000) | ((result + leftover) & 0x0000ffff);
}
while (result >> 16)
result = (result & 0xffff0000) | ((result + leftover) & 0x0000ffff);
}
while (result >> 16)
@@
-1574,10
+1582,11
@@
unsigned
NetCksum(uchar * ptr, int len)
{
ulong xsum;
NetCksum(uchar * ptr, int len)
{
ulong xsum;
+ ushort *p = (ushort *)ptr;
xsum = 0;
while (len-- > 0)
xsum = 0;
while (len-- > 0)
- xsum += *
((ushort *)ptr)
++;
+ xsum += *
p
++;
xsum = (xsum & 0xffff) + (xsum >> 16);
xsum = (xsum & 0xffff) + (xsum >> 16);
return (xsum & 0xffff);
xsum = (xsum & 0xffff) + (xsum >> 16);
xsum = (xsum & 0xffff) + (xsum >> 16);
return (xsum & 0xffff);
@@
-1654,7
+1663,7
@@
NetSetIP(volatile uchar * xip, IPaddr_t dest, int dport, int sport, int len)
ip->ip_sum = ~NetCksum((uchar *)ip, IP_HDR_SIZE_NO_UDP / 2);
}
ip->ip_sum = ~NetCksum((uchar *)ip, IP_HDR_SIZE_NO_UDP / 2);
}
-void copy_filename (
uchar *dst, u
char *src, int size)
+void copy_filename (
char *dst,
char *src, int size)
{
if (*src && (*src == '"')) {
++src;
{
if (*src && (*src == '"')) {
++src;