Merge branch 'master' of git://git.denx.de/u-boot-net

This commit is contained in:
Wolfgang Denk 2009-08-08 12:08:09 +02:00
commit 81813cb01f
12 changed files with 3597 additions and 718 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -119,10 +119,10 @@ extern struct eth_device *eth_get_dev(void); /* get the current device MAC */
extern struct eth_device *eth_get_dev_by_name(char *devname); /* get device */
extern struct eth_device *eth_get_dev_by_index(int index); /* get dev @ index */
extern int eth_get_dev_index (void); /* get the device index */
extern void eth_set_enetaddr(int num, char* a); /* Set new MAC address */
extern void eth_parse_enetaddr(const char *addr, uchar *enetaddr);
extern int eth_getenv_enetaddr(char *name, uchar *enetaddr);
extern int eth_setenv_enetaddr(char *name, const uchar *enetaddr);
extern int eth_getenv_enetaddr_by_index(int index, uchar *enetaddr);
extern int eth_init(bd_t *bis); /* Initialize the device */
extern int eth_send(volatile void *packet, int length); /* Send a packet */

View file

@ -1834,6 +1834,28 @@
#define PCI_DEVICE_ID_INTEL_82562ET 0x1031
#define PCI_DEVICE_ID_INTEL_82571EB_COPPER 0x105E
#define PCI_DEVICE_ID_INTEL_82571EB_FIBER 0x105F
#define PCI_DEVICE_ID_INTEL_82571EB_SERDES 0x1060
#define PCI_DEVICE_ID_INTEL_82571EB_QUAD_COPPER 0x10A4
#define PCI_DEVICE_ID_INTEL_82571PT_QUAD_COPPER 0x10D5
#define PCI_DEVICE_ID_INTEL_82571EB_QUAD_FIBER 0x10A5
#define PCI_DEVICE_ID_INTEL_82571EB_QUAD_COPPER_LOWPROFILE 0x10BC
#define PCI_DEVICE_ID_INTEL_82571EB_SERDES_DUAL 0x10D9
#define PCI_DEVICE_ID_INTEL_82571EB_SERDES_QUAD 0x10DA
#define PCI_DEVICE_ID_INTEL_82572EI_COPPER 0x107D
#define PCI_DEVICE_ID_INTEL_82572EI_FIBER 0x107E
#define PCI_DEVICE_ID_INTEL_82572EI_SERDES 0x107F
#define PCI_DEVICE_ID_INTEL_82572EI 0x10B9
#define PCI_DEVICE_ID_INTEL_82573E 0x108B
#define PCI_DEVICE_ID_INTEL_82573E_IAMT 0x108C
#define PCI_DEVICE_ID_INTEL_82573L 0x109A
#define PCI_DEVICE_ID_INTEL_82546GB_QUAD_COPPER_KSP3 0x10B5
#define PCI_DEVICE_ID_INTEL_80003ES2LAN_COPPER_DPT 0x1096
#define PCI_DEVICE_ID_INTEL_80003ES2LAN_SERDES_DPT 0x1098
#define PCI_DEVICE_ID_INTEL_80003ES2LAN_COPPER_SPT 0x10BA
#define PCI_DEVICE_ID_INTEL_80003ES2LAN_SERDES_SPT 0x10BB
#define PCI_DEVICE_ID_INTEL_82815_MC 0x1130
#define PCI_DEVICE_ID_INTEL_82559ER 0x1209

View file

@ -23,7 +23,7 @@
include $(TOPDIR)/config.mk
# CFLAGS += -DET_DEBUG -DDEBUG
# CFLAGS += -DDEBUG
LIB = $(obj)libnet.a

View file

@ -8,17 +8,6 @@
* Copyright 2000-2004 Wolfgang Denk, wd@denx.de
*/
#if 0
#define DEBUG 1 /* general debug */
#define DEBUG_BOOTP_EXT 1 /* Debug received vendor fields */
#endif
#ifdef DEBUG_BOOTP_EXT
#define debug_ext(fmt,args...) printf (fmt ,##args)
#else
#define debug_ext(fmt,args...)
#endif
#include <common.h>
#include <command.h>
#include <net.h>
@ -107,7 +96,7 @@ static int BootpCheckPkt(uchar *pkt, unsigned dest, unsigned src, unsigned len)
retval = -6;
}
debug ("Filtering pkt = %d\n", retval);
debug("Filtering pkt = %d\n", retval);
return retval;
}
@ -129,7 +118,7 @@ static void BootpCopyNetParams(Bootp_t *bp)
if (strlen(bp->bp_file) > 0)
copy_filename (BootFile, bp->bp_file, sizeof(BootFile));
debug ("Bootfile: %s\n", BootFile);
debug("Bootfile: %s\n", BootFile);
/* Propagate to environment:
* don't delete exising entry when BOOTP / DHCP reply does
@ -156,7 +145,7 @@ static void BootpVendorFieldProcess (u8 * ext)
{
int size = *(ext + 1);
debug_ext ("[BOOTP] Processing extension %d... (%d bytes)\n", *ext,
debug("[BOOTP] Processing extension %d... (%d bytes)\n", *ext,
*(ext + 1));
NetBootFileSize = 0;
@ -255,7 +244,7 @@ static void BootpVendorProcess (u8 * ext, int size)
{
u8 *end = ext + size;
debug_ext ("[BOOTP] Checking extension (%d bytes)...\n", size);
debug("[BOOTP] Checking extension (%d bytes)...\n", size);
while ((ext < end) && (*ext != 0xff)) {
if (*ext == 0) {
@ -269,34 +258,27 @@ static void BootpVendorProcess (u8 * ext, int size)
}
}
#ifdef DEBUG_BOOTP_EXT
puts ("[BOOTP] Received fields: \n");
debug("[BOOTP] Received fields: \n");
if (NetOurSubnetMask)
printf ("NetOurSubnetMask : %pI4\n", &NetOurSubnetMask);
debug("NetOurSubnetMask : %pI4\n", &NetOurSubnetMask);
if (NetOurGatewayIP)
printf ("NetOurGatewayIP : %pI4", &NetOurGatewayIP);
debug("NetOurGatewayIP : %pI4", &NetOurGatewayIP);
if (NetBootFileSize) {
printf ("NetBootFileSize : %d\n", NetBootFileSize);
}
if (NetBootFileSize)
debug("NetBootFileSize : %d\n", NetBootFileSize);
if (NetOurHostName[0]) {
printf ("NetOurHostName : %s\n", NetOurHostName);
}
if (NetOurHostName[0])
debug("NetOurHostName : %s\n", NetOurHostName);
if (NetOurRootPath[0]) {
printf ("NetOurRootPath : %s\n", NetOurRootPath);
}
if (NetOurRootPath[0])
debug("NetOurRootPath : %s\n", NetOurRootPath);
if (NetOurNISDomain[0]) {
printf ("NetOurNISDomain : %s\n", NetOurNISDomain);
}
if (NetOurNISDomain[0])
debug("NetOurNISDomain : %s\n", NetOurNISDomain);
if (NetBootFileSize) {
printf ("NetBootFileSize: %d\n", NetBootFileSize);
}
#endif /* DEBUG_BOOTP_EXT */
if (NetBootFileSize)
debug("NetBootFileSize: %d\n", NetBootFileSize);
}
/*
* Handle a BOOTP received packet.
@ -307,7 +289,7 @@ BootpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len)
Bootp_t *bp;
char *s;
debug ("got BOOTP packet (src=%d, dst=%d, len=%d want_len=%zu)\n",
debug("got BOOTP packet (src=%d, dst=%d, len=%d want_len=%zu)\n",
src, dest, len, sizeof (Bootp_t));
bp = (Bootp_t *)pkt;
@ -330,7 +312,7 @@ BootpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len)
NetSetTimeout(0, (thand_f *)0);
debug ("Got good BOOTP\n");
debug("Got good BOOTP\n");
if ((s = getenv("autoload")) != NULL) {
if (*s == 'n') {
@ -579,14 +561,9 @@ BootpRequest (void)
/* get our mac */
eth_getenv_enetaddr("ethaddr", bi_enetaddr);
#ifdef DEBUG
puts ("BootpRequest => Our Mac: ");
for (reg=0; reg<6; reg++) {
printf ("%x%c",
bi_enetaddr[reg],
reg==5 ? '\n' : ':');
}
#endif /* DEBUG */
debug("BootpRequest => Our Mac: ");
for (reg=0; reg<6; reg++)
debug("%x%c", bi_enetaddr[reg], reg==5 ? '\n' : ':');
/* Mac-Manipulation 2 get seed1 */
tst1=0;
@ -820,7 +797,7 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer)
int pktlen, iplen, extlen;
IPaddr_t OfferedIP;
debug ("DhcpSendRequestPkt: Sending DHCPREQUEST\n");
debug("DhcpSendRequestPkt: Sending DHCPREQUEST\n");
pkt = NetTxPacket;
memset ((void*)pkt, 0, PKTSIZE);
@ -864,7 +841,7 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer)
iplen = BOOTP_HDR_SIZE - sizeof(bp->bp_vend) + extlen;
NetSetIP(iphdr, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC, iplen);
debug ("Transmitting DHCPREQUEST packet: len = %d\n", pktlen);
debug("Transmitting DHCPREQUEST packet: len = %d\n", pktlen);
#ifdef CONFIG_BOOTP_DHCP_REQUEST_DELAY
udelay(CONFIG_BOOTP_DHCP_REQUEST_DELAY);
#endif /* CONFIG_BOOTP_DHCP_REQUEST_DELAY */
@ -879,13 +856,13 @@ DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len)
{
Bootp_t *bp = (Bootp_t *)pkt;
debug ("DHCPHandler: got packet: (src=%d, dst=%d, len=%d) state: %d\n",
debug("DHCPHandler: got packet: (src=%d, dst=%d, len=%d) state: %d\n",
src, dest, len, dhcp_state);
if (BootpCheckPkt(pkt, dest, src, len)) /* Filter out pkts we don't want */
return;
debug ("DHCPHandler: got DHCP packet: (src=%d, dst=%d, len=%d) state: %d\n",
debug("DHCPHandler: got DHCP packet: (src=%d, dst=%d, len=%d) state: %d\n",
src, dest, len, dhcp_state);
switch (dhcp_state) {
@ -896,14 +873,14 @@ DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len)
* If filename is in format we recognize, assume it is a valid
* OFFER from a server we want.
*/
debug ("DHCP: state=SELECTING bp_file: \"%s\"\n", bp->bp_file);
debug("DHCP: state=SELECTING bp_file: \"%s\"\n", bp->bp_file);
#ifdef CONFIG_SYS_BOOTFILE_PREFIX
if (strncmp(bp->bp_file,
CONFIG_SYS_BOOTFILE_PREFIX,
strlen(CONFIG_SYS_BOOTFILE_PREFIX)) == 0 ) {
#endif /* CONFIG_SYS_BOOTFILE_PREFIX */
debug ("TRANSITIONING TO REQUESTING STATE\n");
debug("TRANSITIONING TO REQUESTING STATE\n");
dhcp_state = REQUESTING;
if (NetReadLong((ulong*)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC))
@ -918,7 +895,7 @@ DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len)
return;
break;
case REQUESTING:
debug ("DHCP State: REQUESTING\n");
debug("DHCP State: REQUESTING\n");
if ( DhcpMessageType((u8 *)bp->bp_vend) == DHCP_ACK ) {
char *s;

View file

@ -53,6 +53,13 @@ int eth_setenv_enetaddr(char *name, const uchar *enetaddr)
return setenv(name, buf);
}
int eth_getenv_enetaddr_by_index(int index, uchar *enetaddr)
{
char enetvar[32];
sprintf(enetvar, index ? "eth%daddr" : "ethaddr", index);
return eth_getenv_enetaddr(enetvar, enetaddr);
}
#endif
#if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI)
@ -180,7 +187,6 @@ int eth_register(struct eth_device* dev)
int eth_initialize(bd_t *bis)
{
char enetvar[32];
unsigned char env_enetaddr[6];
int eth_number = 0;
@ -221,8 +227,7 @@ int eth_initialize(bd_t *bis)
puts (" [PRIME]");
}
sprintf(enetvar, eth_number ? "eth%daddr" : "ethaddr", eth_number);
eth_getenv_enetaddr(enetvar, env_enetaddr);
eth_getenv_enetaddr_by_index(eth_number, env_enetaddr);
if (memcmp(env_enetaddr, "\0\0\0\0\0\0", 6)) {
if (memcmp(dev->enetaddr, "\0\0\0\0\0\0", 6) &&
@ -259,31 +264,6 @@ int eth_initialize(bd_t *bis)
return eth_number;
}
void eth_set_enetaddr(int num, char *addr) {
struct eth_device *dev;
unsigned char enetaddr[6];
debug ("eth_set_enetaddr(num=%d, addr=%s)\n", num, addr);
if (!eth_devices)
return;
eth_parse_enetaddr(addr, enetaddr);
dev = eth_devices;
while(num-- > 0) {
dev = dev->next;
if (dev == eth_devices)
return;
}
debug ( "Setting new HW address on %s\n"
"New Address is %pM\n",
dev->name, enetaddr);
memcpy(dev->enetaddr, enetaddr, 6);
}
#ifdef CONFIG_MCAST_TFTP
/* Multicast.
* mcast_addr: multicast ipaddr from which multicast Mac is made
@ -332,23 +312,37 @@ u32 ether_crc (size_t len, unsigned char const *p)
int eth_init(bd_t *bis)
{
struct eth_device* old_current;
int eth_number;
struct eth_device *old_current, *dev;
if (!eth_current) {
puts ("No ethernet found.\n");
return -1;
}
/* Sync environment with network devices */
eth_number = 0;
dev = eth_devices;
do {
uchar env_enetaddr[6];
if (eth_getenv_enetaddr_by_index(eth_number, env_enetaddr))
memcpy(dev->enetaddr, env_enetaddr, 6);
++eth_number;
dev = dev->next;
} while (dev != eth_devices);
old_current = eth_current;
do {
debug ("Trying %s\n", eth_current->name);
debug("Trying %s\n", eth_current->name);
if (eth_current->init(eth_current,bis) >= 0) {
eth_current->state = ETH_STATE_ACTIVE;
return 0;
}
debug ("FAIL\n");
debug("FAIL\n");
eth_try_another(0);
} while (old_current != eth_current);

View file

@ -113,10 +113,6 @@ DECLARE_GLOBAL_DATA_PTR;
# define ARP_TIMEOUT_COUNT CONFIG_NET_RETRY_COUNT
#endif
#if 0
#define ET_DEBUG
#endif
/** BOOTP EXTENTIONS **/
IPaddr_t NetOurSubnetMask=0; /* Our subnet mask (0=unknown) */
@ -218,9 +214,8 @@ void ArpRequest (void)
volatile uchar *pkt;
ARP_t *arp;
#ifdef ET_DEBUG
printf ("ARP broadcast %d\n", NetArpWaitTry);
#endif
debug("ARP broadcast %d\n", NetArpWaitTry);
pkt = NetTxPacket;
pkt += NetSetEther (pkt, NetBcastAddr, PROT_ARP);
@ -644,9 +639,8 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len)
/* if MAC address was not discovered yet, save the packet and do an ARP request */
if (memcmp(ether, NetEtherNullAddr, 6) == 0) {
#ifdef ET_DEBUG
printf("sending ARP for %08lx\n", dest);
#endif
debug("sending ARP for %08lx\n", dest);
NetArpWaitPacketIP = dest;
NetArpWaitPacketMAC = ether;
@ -666,9 +660,7 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len)
return 1; /* waiting */
}
#ifdef ET_DEBUG
printf("sending UDP to %08lx/%pM\n", dest, ether);
#endif
debug("sending UDP to %08lx/%pM\n", dest, ether);
pkt = (uchar *)NetTxPacket;
pkt += NetSetEther (pkt, ether, PROT_IP);
@ -692,9 +684,7 @@ int PingSend(void)
memcpy(mac, NetEtherNullAddr, 6);
#ifdef ET_DEBUG
printf("sending ARP for %08lx\n", NetPingIP);
#endif
debug("sending ARP for %08lx\n", NetPingIP);
NetArpWaitPacketIP = NetPingIP;
NetArpWaitPacketMAC = mac;
@ -1132,9 +1122,7 @@ NetReceive(volatile uchar * inpkt, int len)
#endif
ushort cti = 0, vlanid = VLAN_NONE, myvlanid, mynvlanid;
#ifdef ET_DEBUG
printf("packet received\n");
#endif
debug("packet received\n");
NetRxPacket = inpkt;
NetRxPacketLen = len;
@ -1165,9 +1153,7 @@ NetReceive(volatile uchar * inpkt, int len)
x = ntohs(et->et_protlen);
#ifdef ET_DEBUG
printf("packet received\n");
#endif
debug("packet received\n");
if (x < 1514) {
/*
@ -1185,9 +1171,8 @@ NetReceive(volatile uchar * inpkt, int len)
} else { /* VLAN packet */
VLAN_Ethernet_t *vet = (VLAN_Ethernet_t *)et;
#ifdef ET_DEBUG
printf("VLAN packet received\n");
#endif
debug("VLAN packet received\n");
/* too small packet? */
if (len < VLAN_ETHER_HDR_SIZE)
return;
@ -1208,9 +1193,7 @@ NetReceive(volatile uchar * inpkt, int len)
len -= VLAN_ETHER_HDR_SIZE;
}
#ifdef ET_DEBUG
printf("Receive from protocol 0x%x\n", x);
#endif
debug("Receive from protocol 0x%x\n", x);
#if defined(CONFIG_CMD_CDP)
if (iscdp) {
@ -1239,9 +1222,8 @@ NetReceive(volatile uchar * inpkt, int len)
* address; so if we receive such a packet, we set
* the server ethernet address
*/
#ifdef ET_DEBUG
puts ("Got ARP\n");
#endif
debug("Got ARP\n");
arp = (ARP_t *)ip;
if (len < ARP_HDR_SIZE) {
printf("bad length %d < %d\n", len, ARP_HDR_SIZE);
@ -1270,9 +1252,7 @@ NetReceive(volatile uchar * inpkt, int len)
switch (ntohs(arp->ar_op)) {
case ARPOP_REQUEST: /* reply with our IP address */
#ifdef ET_DEBUG
puts ("Got ARP REQUEST, return our IP\n");
#endif
debug("Got ARP REQUEST, return our IP\n");
pkt = (uchar *)et;
pkt += NetSetEther(pkt, et->et_src, PROT_ARP);
arp->ar_op = htons(ARPOP_REPLY);
@ -1296,18 +1276,14 @@ NetReceive(volatile uchar * inpkt, int len)
}
#endif
#ifdef ET_DEBUG
printf("Got ARP REPLY, set server/gtwy eth addr (%pM)\n",
debug("Got ARP REPLY, set server/gtwy eth addr (%pM)\n",
arp->ar_data);
#endif
tmp = NetReadIP(&arp->ar_data[6]);
/* matched waiting packet's address */
if (tmp == NetArpWaitReplyIP) {
#ifdef ET_DEBUG
puts ("Got it\n");
#endif
debug("Got it\n");
/* save address for later use */
memcpy(NetArpWaitPacketMAC, &arp->ar_data[0], 6);
@ -1326,17 +1302,13 @@ NetReceive(volatile uchar * inpkt, int len)
}
return;
default:
#ifdef ET_DEBUG
printf("Unexpected ARP opcode 0x%x\n", ntohs(arp->ar_op));
#endif
debug("Unexpected ARP opcode 0x%x\n", ntohs(arp->ar_op));
return;
}
break;
case PROT_RARP:
#ifdef ET_DEBUG
puts ("Got RARP\n");
#endif
debug("Got RARP\n");
arp = (ARP_t *)ip;
if (len < ARP_HDR_SIZE) {
printf("bad length %d < %d\n", len, ARP_HDR_SIZE);
@ -1360,11 +1332,9 @@ NetReceive(volatile uchar * inpkt, int len)
break;
case PROT_IP:
#ifdef ET_DEBUG
puts ("Got IP\n");
#endif
debug("Got IP\n");
if (len < IP_HDR_SIZE) {
debug ("len bad %d < %lu\n", len, (ulong)IP_HDR_SIZE);
debug("len bad %d < %lu\n", len, (ulong)IP_HDR_SIZE);
return;
}
if (len < ntohs(ip->ip_len)) {
@ -1372,9 +1342,8 @@ NetReceive(volatile uchar * inpkt, int len)
return;
}
len = ntohs(ip->ip_len);
#ifdef ET_DEBUG
printf("len=%d, v=%02x\n", len, ip->ip_hl_v & 0xff);
#endif
debug("len=%d, v=%02x\n", len, ip->ip_hl_v & 0xff);
if ((ip->ip_hl_v & 0xf0) != 0x40) {
return;
}
@ -1432,10 +1401,9 @@ NetReceive(volatile uchar * inpkt, int len)
(*packetHandler)((uchar *)ip, 0, 0, 0);
return;
case ICMP_ECHO_REQUEST:
#ifdef ET_DEBUG
printf ("Got ICMP ECHO REQUEST, return %d bytes \n",
debug("Got ICMP ECHO REQUEST, return %d bytes \n",
ETHER_HDR_SIZE + len);
#endif
memcpy (&et->et_dest[0], &et->et_src[0], 6);
memcpy (&et->et_src[ 0], NetOurEther, 6);

View file

@ -29,8 +29,6 @@
#include "nfs.h"
#include "bootp.h"
/*#define NFS_DEBUG*/
#if defined(CONFIG_CMD_NET) && defined(CONFIG_CMD_NFS)
#define HASHES_PER_LINE 65 /* Number of "loading" hashes per line */
@ -357,9 +355,7 @@ RPC request dispatcher
static void
NfsSend (void)
{
#ifdef NFS_DEBUG
printf ("%s\n", __FUNCTION__);
#endif
debug("%s\n", __func__);
switch (NfsState) {
case STATE_PRCLOOKUP_PROG_MOUNT_REQ:
@ -397,9 +393,7 @@ rpc_lookup_reply (int prog, uchar *pkt, unsigned len)
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
#ifdef NFS_DEBUG
printf ("%s\n", __FUNCTION__);
#endif
debug("%s\n", __func__);
if (ntohl(rpc_pkt.u.reply.id) != rpc_id)
return -1;
@ -427,9 +421,7 @@ nfs_mount_reply (uchar *pkt, unsigned len)
{
struct rpc_t rpc_pkt;
#ifdef NFS_DEBUG
printf ("%s\n", __FUNCTION__);
#endif
debug("%s\n", __func__);
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
@ -454,9 +446,7 @@ nfs_umountall_reply (uchar *pkt, unsigned len)
{
struct rpc_t rpc_pkt;
#ifdef NFS_DEBUG
printf ("%s\n", __FUNCTION__);
#endif
debug("%s\n", __func__);
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
@ -480,9 +470,7 @@ nfs_lookup_reply (uchar *pkt, unsigned len)
{
struct rpc_t rpc_pkt;
#ifdef NFS_DEBUG
printf ("%s\n", __FUNCTION__);
#endif
debug("%s\n", __func__);
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
@ -507,9 +495,7 @@ nfs_readlink_reply (uchar *pkt, unsigned len)
struct rpc_t rpc_pkt;
int rlen;
#ifdef NFS_DEBUG
printf ("%s\n", __FUNCTION__);
#endif
debug("%s\n", __func__);
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
@ -544,9 +530,7 @@ nfs_read_reply (uchar *pkt, unsigned len)
struct rpc_t rpc_pkt;
int rlen;
#ifdef NFS_DEBUG_nop
printf ("%s\n", __FUNCTION__);
#endif
debug("%s\n", __func__);
memcpy ((uchar *)&rpc_pkt, pkt, sizeof(rpc_pkt.u.reply));
@ -601,9 +585,7 @@ NfsHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len)
{
int rlen;
#ifdef NFS_DEBUG
printf ("%s\n", __FUNCTION__);
#endif
debug("%s\n", __func__);
if (dest != NfsOurPort) return;
@ -661,9 +643,7 @@ NfsHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len)
NfsState = STATE_UMOUNT_REQ;
NfsSend ();
} else {
#ifdef NFS_DEBUG
printf ("Symlink --> %s\n", nfs_path);
#endif
debug("Symlink --> %s\n", nfs_path);
nfs_filename = basename (nfs_path);
nfs_path = dirname (nfs_path);
@ -696,9 +676,7 @@ NfsHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len)
void
NfsStart (void)
{
#ifdef NFS_DEBUG
printf ("%s\n", __FUNCTION__);
#endif
debug("%s\n", __func__);
NfsDownloadState = NETLOOP_FAIL;
NfsServerIP = NetServerIP;

View file

@ -48,9 +48,7 @@ static void
RarpHandler(uchar * dummi0, unsigned dummi1, unsigned dummi2, unsigned dummi3)
{
char *s;
#ifdef DEBUG
puts ("Got good RARP\n");
#endif
debug("Got good RARP\n");
if ((s = getenv("autoload")) != NULL) {
if (*s == 'n') {
/*

View file

@ -23,7 +23,7 @@ SntpSend (void)
int pktlen = SNTP_PACKET_LEN;
int sport;
debug ("%s\n", __FUNCTION__);
debug("%s\n", __func__);
memset (&pkt, 0, sizeof(pkt));
@ -54,7 +54,7 @@ SntpHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len)
struct rtc_time tm;
ulong seconds;
debug ("%s\n", __FUNCTION__);
debug("%s\n", __func__);
if (dest != SntpOurPort) return;
@ -78,7 +78,7 @@ SntpHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len)
void
SntpStart (void)
{
debug ("%s\n", __FUNCTION__);
debug("%s\n", __func__);
NetSetTimeout (SNTP_TIMEOUT, SntpTimeout);
NetSetHandler(SntpHandler);

View file

@ -10,8 +10,6 @@
#include "tftp.h"
#include "bootp.h"
#undef ET_DEBUG
#if defined(CONFIG_CMD_NET)
#define WELL_KNOWN_PORT 69 /* Well known TFTP port # */
@ -196,9 +194,7 @@ TftpSend (void)
strcpy ((char *)pkt, "timeout");
pkt += 7 /*strlen("timeout")*/ + 1;
sprintf((char *)pkt, "%lu", TIMEOUT / 1000);
#ifdef ET_DEBUG
printf("send option \"timeout %s\"\n", (char *)pkt);
#endif
debug("send option \"timeout %s\"\n", (char *)pkt);
pkt += strlen((char *)pkt) + 1;
/* try for more effic. blk size */
pkt += sprintf((char *)pkt,"blksize%c%d%c",
@ -295,9 +291,7 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len)
break;
case TFTP_OACK:
#ifdef ET_DEBUG
printf("Got OACK: %s %s\n", pkt, pkt+strlen(pkt)+1);
#endif
debug("Got OACK: %s %s\n", pkt, pkt+strlen(pkt)+1);
TftpState = STATE_OACK;
TftpServerPort = src;
/*
@ -309,10 +303,8 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len)
if (strcmp ((char*)pkt+i,"blksize") == 0) {
TftpBlkSize = (unsigned short)
simple_strtoul((char*)pkt+i+8,NULL,10);
#ifdef ET_DEBUG
printf ("Blocksize ack: %s, %d\n",
debug("Blocksize ack: %s, %d\n",
(char*)pkt+i+8,TftpBlkSize);
#endif
break;
}
}
@ -348,11 +340,8 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len)
}
}
#ifdef ET_DEBUG
if (TftpState == STATE_RRQ) {
puts ("Server did not acknowledge timeout option!\n");
}
#endif
if (TftpState == STATE_RRQ)
debug("Server did not acknowledge timeout option!\n");
if (TftpState == STATE_RRQ || TftpState == STATE_OACK) {
/* first block received */