diff --git a/TODO b/TODO index 1e1905e806..9a28904173 100644 --- a/TODO +++ b/TODO @@ -44,7 +44,22 @@ o File system - Add chmod(), truncate(). - FAT32: long file names -o Console Output +o Network +- Did not implement send() and sendto() timeouts. Option is setable via setsockopt, + but is not implemented. +- netutils/webserver netutils/telnetd (and maybe others) are seriously broken. +- Should implement SOCK_RAW +- Performance Improvements (uIP is not very fast): + + Add simple buffer management. CONFIG_NET_BUFFERS + (1) On write, queue buffer for output get a new buffer for the socket (waiting if + nececcesary + (2) Copy buffer structure into uip_driver_structure when driver requests write + data + + Add a txail callback into driver to eliminate send delays. Since we want to + support multiple network devices, this means we will have to add some infrastructure + to map to device. o Documentation - Document fs/ & driver/ logic @@ -61,6 +76,9 @@ o Applications & Tests o C5471 o DM320 +- It seems that when a lot of debug statements are added, the system no + longer boots. There could be some issue with the bootloader or with + the programming of the SDRAM MMU regions. o LPC214x - Finish bringup diff --git a/arch/arm/src/common/up_initialize.c b/arch/arm/src/common/up_initialize.c index b9622d0d0e..b8ed24f08a 100644 --- a/arch/arm/src/common/up_initialize.c +++ b/arch/arm/src/common/up_initialize.c @@ -1,4 +1,4 @@ -/************************************************************ +/**************************************************************************** * common/up_initialize.c * * Copyright (C) 2007 Gregory Nutt. All rights reserved. @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include #include @@ -45,37 +45,67 @@ #include "up_arch.h" #include "up_internal.h" -/************************************************************ +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Define to enable timing loop calibration */ + +#undef CONFIG_ARM_CALIBRATION + +/**************************************************************************** * Private Types - ************************************************************/ + ****************************************************************************/ -/************************************************************ - * Private Function Prototypes - ************************************************************/ +/**************************************************************************** + * Private Functions + ****************************************************************************/ -/************************************************************ - * Global Functions - ************************************************************/ +/**************************************************************************** + * Name: up_calibratedelay + * + * Description: + * Delay loops are provided for short timing loops. This function, if + * enabled, will just wait for 100 seconds. Using a stopwatch, you can + * can then determine if the timing loops are properly calibrated. + * + ****************************************************************************/ -/************************************************************ +#if defined(CONFIG_ARM_CALIBRATION) & defined(CONFIG_DEBUG) +static void up_calibratedelay(void) +{ + int i; + lldbg("Beginning 100s delay\n"); + for (i = 0; i < 100; i++) + { + up_mdelay(1000); + } + lldbg("End 100s delay\n"); +} +#else +# define up_calibratedelay() +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** * Name: up_initialize * * Description: - * up_initialize will be called once during OS - * initialization after the basic OS services have been - * initialized. The architecture specific details of - * initializing the OS will be handled here. Such things as - * setting up interrupt service routines, starting the - * clock, and registering device drivers are some of the - * things that are different for each processor and hardware - * platform. + * up_initialize will be called once during OS initialization after the + * basic OS services have been initialized. The architecture specific + * details of initializing the OS will be handled here. Such things as + * setting up interrupt service routines, starting the clock, and + * registering device drivers are some of the things that are different + * for each processor and hardware platform. * - * up_initialize is called after the OS initialized but - * before the init process has been started and before the - * libraries have been initialized. OS services and driver - * services are available. + * up_initialize is called after the OS initialized but before the user + * initialization logic has been started and before the libraries have + * been initialized. OS services and driver services are available. * - ************************************************************/ + ****************************************************************************/ void up_initialize(void) { @@ -83,6 +113,10 @@ void up_initialize(void) current_regs = NULL; + /* Calibrate the timing loop */ + + up_calibratedelay(); + /* Initialize the interrupt subsystem */ up_irqinitialize(); diff --git a/configs/ntosd-dm320/Make.defs b/configs/ntosd-dm320/Make.defs index 95df8b31de..6a776f10e3 100644 --- a/configs/ntosd-dm320/Make.defs +++ b/configs/ntosd-dm320/Make.defs @@ -70,6 +70,6 @@ endif HOSTCC = gcc HOSTINCLUDES = -I. -HOSTCFLAGS = -Wall -wstrict-prototypes -Wshadow -g -pipe +HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe HOSTLDFLAGS = diff --git a/configs/ntosd-dm320/defconfig b/configs/ntosd-dm320/defconfig index e9366c3ecc..23dd476929 100644 --- a/configs/ntosd-dm320/defconfig +++ b/configs/ntosd-dm320/defconfig @@ -58,7 +58,7 @@ CONFIG_ARCH_CHIP=dm320 CONFIG_ARCH_CHIP_DM320=y CONFIG_ARCH_BOARD=ntosd-dm320 CONFIG_ARCH_BOARD_NTOSD_DM320=y -CONFIG_BOARD_LOOPSPERMSEC=1250 +CONFIG_BOARD_LOOPSPERMSEC=16945 CONFIG_DRAM_SIZE=0x01000000 CONFIG_DRAM_START=0x01000000 CONFIG_DRAM_VSTART=0x00000000 diff --git a/drivers/net/dm90x0.c b/drivers/net/dm90x0.c index 63bde9c988..9a36ed51b4 100644 --- a/drivers/net/dm90x0.c +++ b/drivers/net/dm90x0.c @@ -270,7 +270,7 @@ /* This is a helper pointer for accessing the contents of the Ethernet header */ -#define BUF ((struct uip_eth_hdr *)dm9x->dev.d_buf) +#define BUF ((struct uip_eth_hdr *)dm9x->dm_dev.d_buf) /**************************************************************************** * Private Types @@ -278,12 +278,12 @@ union rx_desc_u { - uint8 buf[4]; + uint8 rx_buf[4]; struct { - uint8 rxbyte; - uint8 status; - uint16 length; + uint8 rx_byte; + uint8 rx_status; + uint16 rx_len; } desc; }; @@ -293,35 +293,35 @@ union rx_desc_u struct dm9x_driver_s { - boolean b100M; /* TRUE:speed == 100M; FALSE:speed == 10M */ - WDOG_ID txpoll; /* TX poll timer */ - WDOG_ID txtimeout; /* TX timeout timer */ - uint8 ntxpending; /* Count of packets pending transmission */ + boolean dm_b100M; /* TRUE:speed == 100M; FALSE:speed == 10M */ + WDOG_ID dm_txpoll; /* TX poll timer */ + WDOG_ID dm_txtimeout; /* TX timeout timer */ + uint8 dm_ntxpending; /* Count of packets pending transmission */ uint8 ncrxpackets; /* Number of continuous rx packets */ /* Mode-dependent function to move data in 8/16/32 I/O modes */ - void (*read)(uint8 *ptr, int len); - void (*write)(const uint8 *ptr, int len); - void (*discard)(int len); + void (*dm_read)(uint8 *ptr, int len); + void (*dm_write)(const uint8 *ptr, int len); + void (*dm_discard)(int len); -#if defined(CONFIG_DM9X_STATS) || defined(CONFIG_DEBUG) - uint32 ntxpackets; /* Count of packets sent */ - uint32 ntxbytes; /* Count of bytes sent */ - uint32 ntxerrors; /* Count of TX errors */ - uint32 nrxpackets; /* Count of packets received */ - uint32 nrxbytes; /* Count of bytes received */ - uint32 nrxfifoerrors; /* Count of RX FIFO overflow errors */ - uint32 nrxcrcerrors; /* Count of RX CRC errors */ - uint32 nrxlengtherrors; /* Count of RX length errors */ - uint32 nphyserrors; /* Count of physical layer errors */ - uint32 nresets; /* Counts number of resets */ - uint32 ntxtimeouts; /* Counts resets caused by TX timeouts */ +#if defined(CONFIG_DM9X_STATS) + uint32 dm_ntxpackets; /* Count of packets sent */ + uint32 dm_ntxbytes; /* Count of bytes sent */ + uint32 dm_ntxerrors; /* Count of TX errors */ + uint32 dm_nrxpackets; /* Count of packets received */ + uint32 dm_nrxbytes; /* Count of bytes received */ + uint32 dm_nrxfifoerrors; /* Count of RX FIFO overflow errors */ + uint32 dm_nrxcrcerrors; /* Count of RX CRC errors */ + uint32 dm_nrxlengtherrors; /* Count of RX length errors */ + uint32 dm_nphyserrors; /* Count of physical layer errors */ + uint32 dm_nresets; /* Counts number of resets */ + uint32 dm_ntxtimeouts; /* Counts resets caused by TX timeouts */ #endif /* This holds the information visible to uIP/NuttX */ - struct uip_driver_s dev; + struct uip_driver_s dm_dev; }; /**************************************************************************** @@ -354,7 +354,7 @@ static void write32(const uint8 *ptr, int len); static uint16 dm9x_phyread(struct dm9x_driver_s *dm9x, int reg); static void dm9x_phywrite(struct dm9x_driver_s *dm9x, int reg, uint16 value); -#if defined(CONFIG_DM9X_STATS) || defined(CONFIG_DEBUG) +#if defined(CONFIG_DM9X_STATS) static void dm9x_resetstatistics(struct dm9x_driver_s *dm9x); #else # define dm9x_resetstatistics(dm9x) @@ -665,20 +665,20 @@ static void dm9x_phywrite(struct dm9x_driver_s *dm9x, int reg, uint16 value) * ****************************************************************************/ -#if defined(CONFIG_DM9X_STATS) || defined(CONFIG_DEBUG) +#if defined(CONFIG_DM9X_STATS) static void dm9x_resetstatistics(struct dm9x_driver_s *dm9x) { - dm9x->ntxpackets = 0; /* Count of packets sent */ - dm9x->ntxbytes = 0; /* Count of bytes sent */ - dm9x->ntxerrors = 0; /* Count of TX errors */ - dm9x->nrxpackets = 0; /* Count of packets received */ - dm9x->nrxbytes = 0; /* Count of bytes received */ - dm9x->nrxfifoerrors = 0; /* Count of RX FIFO overflow errors */ - dm9x->nrxcrcerrors = 0; /* Count of RX CRC errors */ - dm9x->nrxlengtherrors = 0; /* Count of RX length errors */ - dm9x->nphyserrors = 0; /* Count of physical layer errors */ - dm9x->nresets = 0; /* Counts number of resets */ - dm9x->ntxtimeouts = 0; /* Counts resets caused by TX timeouts */ + dm9x->dm_ntxpackets = 0; /* Count of packets sent */ + dm9x->dm_ntxbytes = 0; /* Count of bytes sent */ + dm9x->dm_ntxerrors = 0; /* Count of TX errors */ + dm9x->dm_nrxpackets = 0; /* Count of packets received */ + dm9x->dm_nrxbytes = 0; /* Count of bytes received */ + dm9x->dm_nrxfifoerrors = 0; /* Count of RX FIFO overflow errors */ + dm9x->dm_nrxcrcerrors = 0; /* Count of RX CRC errors */ + dm9x->dm_nrxlengtherrors = 0; /* Count of RX length errors */ + dm9x->dm_nphyserrors = 0; /* Count of physical layer errors */ + dm9x->dm_nresets = 0; /* Counts number of resets */ + dm9x->dm_ntxtimeouts = 0; /* Counts resets caused by TX timeouts */ } #endif @@ -701,17 +701,17 @@ static void dm9x_resetstatistics(struct dm9x_driver_s *dm9x) #if defined(CONFIG_DM9X_STATS) && defined(CONFIG_DEBUG) static void dm9x_dumpstatistics(struct dm9x_driver_s *dm9x) { - dbg("TX packets: %d\n", dm9x->ntxpackets); - dbg(" bytes: %d\n", dm9x->ntxbytes); - dbg(" errors: %d\n", dm9x->ntxerrors); - dbg("RX packets: %d\n", dm9x->nrxpackets); - dbg(" bytes: %d\n", dm9x->nrxbytes); - dbg(" FIFO overflows: %d\n", dm9x->nrxfifoerrors); - dbg(" CRC errors: %d\n", dm9x->nrxcrcerrors); - dbg(" length errors: %d\n", dm9x->nrxlengtherrors); - dbg("Physical layer errors: %d\n", dm9x->nphyserrors); - dbg("Resets: %d\n", dm9x->nresets); - dbg("TX timeout resets: %d\n", dm9x->ntxtimeouts); + dbg("TX packets: %d\n", dm9x->dm_ntxpackets); + dbg(" bytes: %d\n", dm9x->dm_ntxbytes); + dbg(" errors: %d\n", dm9x->dm_ntxerrors); + dbg("RX packets: %d\n", dm9x->dm_nrxpackets); + dbg(" bytes: %d\n", dm9x->dm_nrxbytes); + dbg(" FIFO overflows: %d\n", dm9x->dm_nrxfifoerrors); + dbg(" CRC errors: %d\n", dm9x->dm_nrxcrcerrors); + dbg(" length errors: %d\n", dm9x->dm_nrxlengtherrors); + dbg("Physical layer errors: %d\n", dm9x->dm_nphyserrors); + dbg("Resets: %d\n", dm9x->dm_nresets); + dbg("TX timeout resets: %d\n", dm9x->dm_ntxtimeouts); } #endif @@ -764,10 +764,10 @@ static int dm9x_transmit(struct dm9x_driver_s *dm9x) { /* Increment count of packets transmitted */ - dm9x->ntxpending++; -#if defined(CONFIG_DM9X_STATS) || defined(CONFIG_DEBUG) - dm9x->ntxpackets++; - dm9x->ntxbytes += dm9x->dev.d_len; + dm9x->dm_ntxpending++; +#if defined(CONFIG_DM9X_STATS) + dm9x->dm_ntxpackets++; + dm9x->dm_ntxbytes += dm9x->dm_dev.d_len; #endif /* Disable all DM90x0 interrupts */ @@ -776,13 +776,13 @@ static int dm9x_transmit(struct dm9x_driver_s *dm9x) /* Set the TX length */ - putreg(DM9X_TXPLL, (dm9x->dev.d_len & 0xff)); - putreg(DM9X_TXPLH, (dm9x->dev.d_len >> 8) & 0xff); + putreg(DM9X_TXPLL, (dm9x->dm_dev.d_len & 0xff)); + putreg(DM9X_TXPLH, (dm9x->dm_dev.d_len >> 8) & 0xff); /* Move the data to be sent into TX SRAM */ DM9X_INDEX = DM9X_MWCMD; - dm9x->write(dm9x->dev.d_buf, dm9x->dev.d_len); + dm9x->dm_write(dm9x->dm_dev.d_buf, dm9x->dm_dev.d_len); #if !defined(CONFIG_DM9X_ETRANS) /* Issue TX polling command */ @@ -800,7 +800,7 @@ static int dm9x_transmit(struct dm9x_driver_s *dm9x) /* Setup the TX timeout watchdog (perhaps restarting the timer) */ - (void)wd_start(dm9x->txtimeout, DM6X_TXTIMEOUT, dm9x_txtimeout, 1, (uint32)dm9x); + (void)wd_start(dm9x->dm_txtimeout, DM6X_TXTIMEOUT, dm9x_txtimeout, 1, (uint32)dm9x); return OK; } @@ -833,16 +833,16 @@ static int dm9x_uiptxpoll(struct uip_driver_s *dev) * the field d_len is set to a value > 0. */ - if (dm9x->dev.d_len > 0) + if (dm9x->dm_dev.d_len > 0) { - uip_arp_out(&dm9x->dev); + uip_arp_out(&dm9x->dm_dev); dm9x_transmit(dm9x); /* Check if there is room in the DM90x0 to hold another packet. In 100M mode, * that can be 2 packets, otherwise it is a single packet. */ - if (dm9x->ntxpending > 1 || !dm9x->b100M) + if (dm9x->dm_ntxpending > 1 || !dm9x->dm_b100M) { /* Returning a non-zero value will terminate the poll operation */ @@ -881,7 +881,7 @@ static void dm9x_receive(struct dm9x_driver_s *dm9x) uint8 mdral; uint8 rxbyte; - dbg("Packet received\n"); + vdbg("Packet received\n"); do { @@ -907,62 +907,64 @@ static void dm9x_receive(struct dm9x_driver_s *dm9x) /* Read packet status & length */ - dm9x->read((uint8*)&rx, 4); + dm9x->dm_read((uint8*)&rx, 4); /* Check if any errors were reported by the hardware */ - if (rx.desc.status & 0xbf) + if (rx.desc.rx_status & 0xbf) { /* Bad RX packet... update statistics */ -#if defined(CONFIG_DM9X_STATS) || defined(CONFIG_DEBUG) - if (rx.desc.status & 0x01) +#if defined(CONFIG_DM9X_STATS) + if (rx.desc.rx_status & 0x01) { - dm9x->nrxfifoerrors++; - dbg("RX FIFO error: %d\n", dm9x->nrxfifoerrors); + dm9x->dm_nrxfifoerrors++; + dbg("RX FIFO error: %d\n", dm9x->dm_nrxfifoerrors); } - if (rx.desc.status & 0x02) + if (rx.desc.rx_status & 0x02) { - dm9x->nrxcrcerrors++; - dbg("RX CRC error: %d\n", dm9x->nrxcrcerrors); + dm9x->dm_nrxcrcerrors++; + dbg("RX CRC error: %d\n", dm9x->dm_nrxcrcerrors); } - if (rx.desc.status & 0x80) + if (rx.desc.rx_status & 0x80) { - dm9x->nrxlengtherrors++; - dbg("RX length error: %d\n", dm9x->nrxlengtherrors); + dm9x->dm_nrxlengtherrors++; + dbg("RX length error: %d\n", dm9x->dm_nrxlengtherrors); } - if (rx.desc.status & 0x08) + if (rx.desc.rx_status & 0x08) { - dm9x->nphyserrors++; - dbg("Physical Layer error: %d\n", dm9x->nphyserrors); + dm9x->dm_nphyserrors++; + dbg("Physical Layer error: %d\n", dm9x->dm_nphyserrors); } +#else + dbg("Received packet with errors: %02x\n", rx.desc.rx_status); #endif /* Drop this packet and continue to check the next packet */ - dm9x->discard(rx.desc.length); + dm9x->dm_discard(rx.desc.rx_len); } /* Also check if the packet is a valid size for the uIP configuration */ - else if (rx.desc.length < UIP_LLH_LEN || rx.desc.length > (UIP_BUFSIZE + 2)) + else if (rx.desc.rx_len < UIP_LLH_LEN || rx.desc.rx_len > (UIP_BUFSIZE + 2)) { -#if defined(CONFIG_DM9X_STATS) || defined(CONFIG_DEBUG) - dm9x->nrxlengtherrors++; - dbg("RX length error: %d\n", dm9x->nrxlengtherrors); +#if defined(CONFIG_DM9X_STATS) + dm9x->dm_nrxlengtherrors++; + dbg("RX length error: %d\n", dm9x->dm_nrxlengtherrors); #endif /* Drop this packet and continue to check the next packet */ - dm9x->discard(rx.desc.length); + dm9x->dm_discard(rx.desc.rx_len); } else { /* Good packet... Copy the packet data out of SRAM and pass it one to uIP */ - dm9x->dev.d_len = rx.desc.length; - dm9x->read(dm9x->dev.d_buf, rx.desc.length); + dm9x->dm_dev.d_len = rx.desc.rx_len; + dm9x->dm_read(dm9x->dm_dev.d_buf, rx.desc.rx_len); /* We only accept IP packets of the configured type and ARP packets */ @@ -973,43 +975,43 @@ static void dm9x_receive(struct dm9x_driver_s *dm9x) #endif { uip_arp_ipin(); - uip_input(&dm9x->dev); + uip_input(&dm9x->dm_dev); /* If the above function invocation resulted in data that * should be sent out on the network, the global variable * d_len is set to a value > 0. */ - if (dm9x->dev.d_len > 0) + if (dm9x->dm_dev.d_len > 0) { - uip_arp_out(&dm9x->dev); + uip_arp_out(&dm9x->dm_dev); dm9x_transmit(dm9x); } } else if (BUF->type == htons(UIP_ETHTYPE_ARP)) { - uip_arp_arpin(&dm9x->dev); + uip_arp_arpin(&dm9x->dm_dev); /* If the above function invocation resulted in data that * should be sent out on the network, the global variable * d_len is set to a value > 0. */ - if (dm9x->dev.d_len > 0) + if (dm9x->dm_dev.d_len > 0) { dm9x_transmit(dm9x); } } } -#if defined(CONFIG_DM9X_STATS) || defined(CONFIG_DEBUG) - dm9x->nrxpackets++; - dm9x->nrxbytes += rx.desc.length; +#if defined(CONFIG_DM9X_STATS) + dm9x->dm_nrxpackets++; + dm9x->dm_nrxbytes += rx.desc.rx_len; #endif dm9x->ncrxpackets++; } while ((rxbyte & 0x01) == DM9X_PKTRDY && dm9x->ncrxpackets < DM9X_CRXTHRES); - dbg("All RX packets processed\n"); + vdbg("All RX packets processed\n"); } /**************************************************************************** @@ -1032,7 +1034,7 @@ static void dm9x_txdone(struct dm9x_driver_s *dm9x) { int nsr; - dbg("TX done\n"); + vdbg("TX done\n"); /* Another packet has completed transmission. Decrement the count of * of pending TX transmissions. @@ -1041,38 +1043,38 @@ static void dm9x_txdone(struct dm9x_driver_s *dm9x) nsr = getreg(DM9X_NETS); if (nsr & DM9X_NETS_TX1END) { - if (dm9x->ntxpending) + if (dm9x->dm_ntxpending) { - dm9x->ntxpending--; + dm9x->dm_ntxpending--; } else { - dbg("ntxpending ERROR on TX1END\n"); + dbg("Bad TX count (TX1END)\n"); } } if (nsr & DM9X_NETS_TX2END) { - if (dm9x->ntxpending) + if (dm9x->dm_ntxpending) { - dm9x->ntxpending--; + dm9x->dm_ntxpending--; } else { - dbg("ntxpending ERROR on TX2END\n"); + dbg("Bad TX count (TX2END)\n"); } } /* Cancel the TX timeout */ - if (dm9x->ntxpending == 0) + if (dm9x->dm_ntxpending == 0) { - wd_cancel(dm9x->txtimeout); + wd_cancel(dm9x->dm_txtimeout); } /* Then poll uIP for new XMIT data */ - (void)uip_poll(&dm9x->dev, dm9x_uiptxpoll, UIP_POLL); + (void)uip_poll(&dm9x->dm_dev, dm9x_uiptxpoll, UIP_POLL); } /**************************************************************************** @@ -1111,7 +1113,7 @@ static int dm9x_interrupt(int irq, FAR void *context) isr = getreg(DM9X_ISR); putreg(DM9X_ISR, isr); - vdbg("Interrupt: ISR=%02x\n", isr); + vdbg("Interrupt status: %02x\n", isr); /* Check for link status change */ @@ -1135,17 +1137,17 @@ static int dm9x_interrupt(int irq, FAR void *context) if (dm9x_phyread(dm9x, 0) & 0x2000) { - dm9x->b100M = TRUE; + dm9x->dm_b100M = TRUE; } else { - dm9x->b100M = FALSE; + dm9x->dm_b100M = FALSE; } break; } up_mdelay(1); } - dbg("delay: %d mS speed: %s\n", i, dm9x->b100M ? "100M" : "10M"); + dbg("delay: %dmS speed: %s\n", i, dm9x->dm_b100M ? "100M" : "10M"); } /* Check if we received an incoming packet */ @@ -1211,13 +1213,13 @@ static void dm9x_txtimeout(int argc, uint32 arg, ...) /* Increment statistics and dump debug info */ -#if defined(CONFIG_DM9X_STATS) || defined(CONFIG_DEBUG) - dm9x->ntxtimeouts++; - dm9x->ntxerrors++; +#if defined(CONFIG_DM9X_STATS) + dm9x->dm_ntxtimeouts++; + dm9x->dm_ntxerrors++; #endif - dbg(" TX packet count: %d\n", dm9x->ntxpending); - dbg(" TX timeouts: %d\n", dm9x->ntxtimeouts); + dbg(" TX packet count: %d\n", dm9x->dm_ntxpending); + dbg(" TX timeouts: %d\n", dm9x->dm_ntxtimeouts); dbg(" TX read pointer address: 0x%02x:%02x\n", getreg(DM9X_TRPAH), getreg(DM9X_TRPAL)); dbg(" Memory data write address: 0x%02x:%02x (DM9010)\n", @@ -1229,7 +1231,7 @@ static void dm9x_txtimeout(int argc, uint32 arg, ...) /* Then poll uIP for new XMIT data */ - (void)uip_poll(&dm9x->dev, dm9x_uiptxpoll, UIP_POLL); + (void)uip_poll(&dm9x->dm_dev, dm9x_uiptxpoll, UIP_POLL); } /**************************************************************************** @@ -1269,16 +1271,16 @@ static void dm9x_polltimer(int argc, uint32 arg, ...) * that can be 2 packets, otherwise it is a single packet. */ - if (dm9x->ntxpending < 1 || (dm9x->b100M && dm9x->ntxpending < 2)) + if (dm9x->dm_ntxpending < 1 || (dm9x->dm_b100M && dm9x->dm_ntxpending < 2)) { /* If so, poll uIP for new XMIT data */ - (void)uip_poll(&dm9x->dev, dm9x_uiptxpoll, UIP_TIMER); + (void)uip_poll(&dm9x->dm_dev, dm9x_uiptxpoll, UIP_TIMER); } /* Setup the watchdog poll timer again */ - (void)wd_start(dm9x->txpoll, DM6X_WDDELAY, dm9x_polltimer, 1, arg); + (void)wd_start(dm9x->dm_txpoll, DM6X_WDDELAY, dm9x_polltimer, 1, arg); } /**************************************************************************** @@ -1356,7 +1358,7 @@ static int dm9x_ifup(struct uip_driver_s *dev) /* Check link state and media speed (waiting up to 3s for link OK) */ - dm9x->b100M = FALSE; + dm9x->dm_b100M = FALSE; for (i = 0; i < 3000; i++) { netstatus = getreg(DM9X_NETS); @@ -1368,7 +1370,7 @@ static int dm9x_ifup(struct uip_driver_s *dev) netstatus = getreg(DM9X_NETS); if ((netstatus & DM9X_NETS_SPEED) == 0) { - dm9x->b100M = TRUE; + dm9x->dm_b100M = TRUE; } break; } @@ -1376,11 +1378,11 @@ static int dm9x_ifup(struct uip_driver_s *dev) up_mdelay(1); } - dbg("i=%d mS speed=%s\n", i, dm9x->b100M ? "100M" : "10M"); + dbg("delay: %dmS speed: %s\n", i, dm9x->dm_b100M ? "100M" : "10M"); /* Set and activate a timer process */ - (void)wd_start(dm9x->txpoll, DM6X_WDDELAY, dm9x_polltimer, 1, (uint32)dm9x); + (void)wd_start(dm9x->dm_txpoll, DM6X_WDDELAY, dm9x_polltimer, 1, (uint32)dm9x); /* Enable the DM9X interrupt */ @@ -1418,12 +1420,12 @@ static int dm9x_ifdown(struct uip_driver_s *dev) /* Cancel the TX poll timer and TX timeout timers */ - wd_cancel(dm9x->txpoll); - wd_cancel(dm9x->txtimeout); + wd_cancel(dm9x->dm_txpoll); + wd_cancel(dm9x->dm_txtimeout); /* Reset the device */ - dm9x_phywrite(dm9x, 0x00, 0x8000); /* PHY RESET */ + dm9x_phywrite(dm9x, 0x00, 0x8000); /* PHY reset */ putreg(DM9X_GPD, 0x01); /* Power-down PHY (GEPIO0=1) */ putreg(DM9X_IMR, DM9X_IMRDISABLE); /* Disable all interrupts */ putreg(DM9X_RXC, 0x00); /* Disable RX */ @@ -1461,7 +1463,7 @@ static void dm9x_bringup(struct dm9x_driver_s *dm9x) putreg(DM9X_GPD, 0x01); /* Power-down the PHY (GEPIO0=1) */ up_udelay(500); putreg(DM9X_GPD, 0x00); /* Preactivate PHY (GPIO0=0 */ - up_udelay(20); /* Wait 2ms for PHY power-on ready */ + up_udelay(20); /* Wait 20us for PHY power-on ready */ /* Do a software reset and wait 20us (twice). The reset autoclears * in 10us; 20us guarantees completion of the reset @@ -1477,43 +1479,43 @@ static void dm9x_bringup(struct dm9x_driver_s *dm9x) switch (getreg(DM9X_ISR) & DM9X_ISR_IOMODEM) { case DM9X_ISR_IOMODE8: - dm9x->read = read8; - dm9x->write = write8; - dm9x->discard = discard8; + dm9x->dm_read = read8; + dm9x->dm_write = write8; + dm9x->dm_discard = discard8; break; case DM9X_ISR_IOMODE16: - dm9x->read = read16; - dm9x->write = write16; - dm9x->discard = discard16; + dm9x->dm_read = read16; + dm9x->dm_write = write16; + dm9x->dm_discard = discard16; break; case DM9X_ISR_IOMODE32: - dm9x->read = read32; - dm9x->write = write32; - dm9x->discard = discard32; + dm9x->dm_read = read32; + dm9x->dm_write = write32; + dm9x->dm_discard = discard32; break; default: break; } - /* Set PHY operating mode */ + /* Program PHY operating mode */ dm9x_phymode(dm9x); - /* Program operating register */ + /* Program operating mode */ - putreg(DM9X_NETC, 0x00); /* Network control */ - putreg(DM9X_TXC, 0x00); /* TX Polling clear */ - putreg(DM9X_BPTHRES, 0x3f); /* Less 3kb, 600us */ - putreg(DM9X_SMODEC, 0x00); /* Special mode */ + putreg(DM9X_NETC, 0x00); /* Network control */ + putreg(DM9X_TXC, 0x00); /* Clear TX Polling */ + putreg(DM9X_BPTHRES, 0x3f); /* Less 3kb, 600us */ + putreg(DM9X_SMODEC, 0x00); /* Special mode */ putreg(DM9X_NETS, (DM9X_NETS_WAKEST|DM9X_NETS_TX1END|DM9X_NETS_TX2END)); /* Clear TX status */ putreg(DM9X_ISR, DM9X_INT_ALL); /* Clear interrupt status */ #if defined(CONFIG_DM9X_CHECKSUM) - putreg(DM9X_TCCR, 0x07); /* TX UDP/TCP/IP checksum enable */ - putreg(DM9X_RCSR, 0x02); /* Receive checksum enable */ + putreg(DM9X_TCCR, 0x07); /* TX UDP/TCP/IP checksum enable */ + putreg(DM9X_RCSR, 0x02); /* Receive checksum enable */ #endif #if defined(CONFIG_DM9X_ETRANS) @@ -1523,7 +1525,7 @@ static void dm9x_bringup(struct dm9x_driver_s *dm9x) /* Initialize statistics */ dm9x->ncrxpackets = 0; /* Number of continuous RX packets */ - dm9x->ntxpending = 0; /* Number of pending TX packets */ + dm9x->dm_ntxpending = 0; /* Number of pending TX packets */ dm9x_resetstatistics(dm9x); /* Activate DM9000A/DM9010 */ @@ -1556,26 +1558,26 @@ static void dm9x_reset(struct dm9x_driver_s *dm9x) /* Cancel the TX poll timer and TX timeout timers */ - wd_cancel(dm9x->txpoll); - wd_cancel(dm9x->txtimeout); + wd_cancel(dm9x->dm_txpoll); + wd_cancel(dm9x->dm_txtimeout); /* Save previous register address */ save = (uint8)DM9X_INDEX; - dm9x->nresets++; + dm9x->dm_nresets++; dm9x_bringup(dm9x); /* Wait up to 1 second for the link to be OK */ - dm9x->b100M = FALSE; + dm9x->dm_b100M = FALSE; for (i = 0; i < 1000; i++) { - if (dm9x_phyread(dm9x,0x1) & 0x4) /*Link OK*/ + if (dm9x_phyread(dm9x,0x1) & 0x4) { if (dm9x_phyread(dm9x, 0) &0x2000) { - dm9x->b100M = TRUE; + dm9x->dm_b100M = TRUE; } break; } @@ -1627,7 +1629,7 @@ int dm9x_initialize(void) if (vid != DM9X_DAVICOMVID || (pid != DM9X_DM9000PID && pid != DM9X_DM9010PID)) { - dbg("DM90x0 vender/product ID not found at this base address\n"); + lldbg("DM90x0 vender/product ID not found at this base address\n"); return -ENODEV; } @@ -1636,6 +1638,7 @@ int dm9x_initialize(void) if (irq_attach(CONFIG_DM9X_IRQ, dm9x_interrupt)) { /* We could not attach the ISR to the ISR */ + lldbg("irq_attach() failed\n"); return -EAGAIN; } @@ -1643,18 +1646,18 @@ int dm9x_initialize(void) /* Initialize the driver structure */ memset(g_dm9x, 0, CONFIG_DM9X_NINTERFACES*sizeof(struct dm9x_driver_s)); - g_dm9x[0].dev.ifup = dm9x_ifup; /* I/F down callback */ - g_dm9x[0].dev.ifdown = dm9x_ifdown; /* I/F up (new IP address) callback */ - g_dm9x[0].dev.d_private = (void*)g_dm9x; /* Used to recover private state from dev */ + g_dm9x[0].dm_dev.d_ifup = dm9x_ifup; /* I/F down callback */ + g_dm9x[0].dm_dev.d_ifdown = dm9x_ifdown; /* I/F up (new IP address) callback */ + g_dm9x[0].dm_dev.d_private = (void*)g_dm9x; /* Used to recover private state from dev */ /* Create a watchdog for timing polling for and timing of transmisstions */ - g_dm9x[0].txpoll = wd_create(); /* Create periodic poll timer */ - g_dm9x[0].txtimeout = wd_create(); /* Create TX timeout timer */ + g_dm9x[0].dm_txpoll = wd_create(); /* Create periodic poll timer */ + g_dm9x[0].dm_txtimeout = wd_create(); /* Create TX timeout timer */ /* Read the MAC address */ - mptr = g_dm9x[0].dev.d_mac.addr; + mptr = g_dm9x[0].dm_dev.d_mac.addr; for (i = 0, j = DM9X_PAB0; i < 6; i++, j++) { mptr[i] = getreg(j); @@ -1665,7 +1668,7 @@ int dm9x_initialize(void) /* Register the device with the OS so that socket IOCTLs can be performed */ - (void)netdev_register(&g_dm9x[0].dev); + (void)netdev_register(&g_dm9x[0].dm_dev); return OK; } diff --git a/examples/nettest/nettest-client.c b/examples/nettest/nettest-client.c index f352e3a856..ea8a4312c0 100644 --- a/examples/nettest/nettest-client.c +++ b/examples/nettest/nettest-client.c @@ -73,7 +73,7 @@ void send_client(void) sockfd = socket(PF_INET, SOCK_STREAM, 0); if (sockfd < 0) { - printf("client socket failure %d\n", errno); + message("client socket failure %d\n", errno); exit(1); } @@ -87,13 +87,13 @@ void send_client(void) myaddr.sin_addr.s_addr = HTONL(CONFIG_EXAMPLE_NETTEST_CLIENTIP); #endif - printf("client: Connecting...\n"); + message("client: Connecting...\n"); if (connect( sockfd, (struct sockaddr*)&myaddr, sizeof(struct sockaddr_in)) < 0) { - printf("client: connect failure: %d\n", errno); + message("client: connect failure: %d\n", errno); exit(1); } - printf("client: Connected\n"); + message("client: Connected\n"); /* Initialize the buffer */ @@ -115,13 +115,13 @@ void send_client(void) nbytessent = send(sockfd, outbuf, 512, 0); if (nbytessent < 0) { - printf("client: send failed: %d\n", errno); + message("client: send failed: %d\n", errno); close(sockfd); exit(-1); } else if (nbytessent != 512) { - printf("client: Bad send length=%d: %d\n", nbytessent); + message("client: Bad send length=%d: %d\n", nbytessent); close(sockfd); exit(-1); } @@ -129,42 +129,42 @@ void send_client(void) #else /* Then send and receive one message */ - printf("client: Sending %d bytes\n", SENDSIZE); + message("client: Sending %d bytes\n", SENDSIZE); nbytessent = send(sockfd, outbuf, SENDSIZE, 0); - printf("client: Sent %d bytes\n", nbytessent); + message("client: Sent %d bytes\n", nbytessent); if (nbytessent < 0) { - printf("client: send failed: %d\n", errno); + message("client: send failed: %d\n", errno); close(sockfd); exit(-1); } else if (nbytessent != SENDSIZE) { - printf("client: Bad send length=%d: %d\n", nbytessent); + message("client: Bad send length=%d: %d\n", nbytessent); close(sockfd); exit(-1); } - printf("client: Receiving...\n"); + message("client: Receiving...\n"); nbytesrecvd = recv(sockfd, inbuf, SENDSIZE, 0); - printf("client: Received %d bytes\n", nbytesrecvd); + message("client: Received %d bytes\n", nbytesrecvd); if (nbytesrecvd < 0) { - printf("client: recv failed: %d\n", errno); + message("client: recv failed: %d\n", errno); close(sockfd); exit(-1); } else if (nbytesrecvd != SENDSIZE) { - printf("client: Bad recv length=%d: %d\n", nbytessent); + message("client: Bad recv length=%d: %d\n", nbytessent); close(sockfd); exit(-1); } else if (memcmp(inbuf, outbuf, SENDSIZE) != 0) { - printf("client: Received buffer does not match sent buffer\n"); + message("client: Received buffer does not match sent buffer\n"); close(sockfd); exit(-1); } diff --git a/examples/nettest/nettest-server.c b/examples/nettest/nettest-server.c index a557b5a7d2..2f398583a6 100644 --- a/examples/nettest/nettest-server.c +++ b/examples/nettest/nettest-server.c @@ -73,7 +73,7 @@ void recv_server(void) listensd = socket(PF_INET, SOCK_STREAM, 0); if (listensd < 0) { - printf("server: socket failure: %d\n", errno); + message("server: socket failure: %d\n", errno); exit(1); } @@ -82,7 +82,7 @@ void recv_server(void) optval = 1; if (setsockopt(listensd, SOL_SOCKET, SO_REUSEADDR, (void*)&optval, sizeof(int)) < 0) { - printf("server: setsockopt failure: %d\n", errno); + message("server: setsockopt failure: %d\n", errno); exit(1); } @@ -94,7 +94,7 @@ void recv_server(void) if (bind(listensd, (struct sockaddr*)&myaddr, sizeof(struct sockaddr_in)) < 0) { - printf("server: bind failure: %d\n", errno); + message("server: bind failure: %d\n", errno); exit(1); } @@ -102,21 +102,21 @@ void recv_server(void) if (listen(listensd, 5) < 0) { - printf("server: listen failure %d\n", errno); + message("server: listen failure %d\n", errno); exit(1); } /* Accept only one connection */ - printf("server: Accepting connections on port %d\n", PORTNO); + message("server: Accepting connections on port %d\n", PORTNO); addrlen = sizeof(struct sockaddr_in); acceptsd = accept(listensd, (struct sockaddr*)&myaddr, &addrlen); if (acceptsd < 0) { - printf("server: accept failure: %d\n", errno); + message("server: accept failure: %d\n", errno); exit(1); } - printf("server: Connection accepted -- receiving\n"); + message("server: Connection accepted -- receiving\n"); #ifdef CONFIG_NETTEST_PERFORMANCE /* Then receive data forever */ @@ -126,7 +126,7 @@ void recv_server(void) nbytesread = recv(acceptsd, buffer, 1024, 0); if (nbytesread <= 0) { - printf("server: recv failed: %d\n", errno); + message("server: recv failed: %d\n", errno); close(listensd); close(acceptsd); exit(-1); @@ -138,25 +138,25 @@ void recv_server(void) totalbytesread = 0; while (totalbytesread < SENDSIZE) { - printf("server: Reading...\n"); + message("server: Reading...\n"); nbytesread = recv(acceptsd, &buffer[totalbytesread], 1024 - totalbytesread, 0); if (nbytesread <= 0) { - printf("server: recv failed: %d\n", errno); + message("server: recv failed: %d\n", errno); close(listensd); close(acceptsd); exit(-1); } totalbytesread += nbytesread; - printf("server: Received %d of %d bytes\n", totalbytesread, SENDSIZE); + message("server: Received %d of %d bytes\n", totalbytesread, SENDSIZE); } /* Verify the message */ if (totalbytesread != SENDSIZE) { - printf("server: Received %d / Expected %d bytes\n", totalbytesread, SENDSIZE); + message("server: Received %d / Expected %d bytes\n", totalbytesread, SENDSIZE); close(listensd); close(acceptsd); exit(-1); @@ -167,7 +167,7 @@ void recv_server(void) { if (buffer[i] != ch) { - printf("server: Byte %d is %02x / Expected %02x\n", i, buffer[i], ch); + message("server: Byte %d is %02x / Expected %02x\n", i, buffer[i], ch); close(listensd); close(acceptsd); exit(-1); @@ -184,12 +184,12 @@ void recv_server(void) nbytessent = send(acceptsd, buffer, totalbytesread, 0); if (nbytessent <= 0) { - printf("server: send failed: %d\n", errno); + message("server: send failed: %d\n", errno); close(listensd); close(acceptsd); exit(-1); } - printf("server: Sent %d bytes\n", nbytessent); + message("server: Sent %d bytes\n", nbytessent); close(listensd); close(acceptsd); diff --git a/examples/nettest/nettest.h b/examples/nettest/nettest.h index 0079a83a23..b868ec90dc 100644 --- a/examples/nettest/nettest.h +++ b/examples/nettest/nettest.h @@ -40,15 +40,28 @@ * Included Files ****************************************************************************/ +#ifdef CONFIG_NETTEST_HOST +#else +# include +#endif + /**************************************************************************** * Definitions ****************************************************************************/ #ifdef CONFIG_NETTEST_HOST -# define HTONS(a) htons(a) -# define HTONL(a) htonl(a) + /* HTONS/L macros are unique to uIP */ + +# define HTONS(a) htons(a) +# define HTONL(a) htonl(a) +# define message(...) printf(__VA_ARGS__) #else -# define errno *get_errno_ptr() +# define errno *get_errno_ptr() +# ifdef CONFIG_DEBUG +# define message(...) lib_lowprintf(__VA_ARGS__) +# else +# define message(...) printf(__VA_ARGS__) +# endif #endif #define PORTNO 5471 diff --git a/include/net/uip/uip-arch.h b/include/net/uip/uip-arch.h index dd98925fcd..91b80f5212 100644 --- a/include/net/uip/uip-arch.h +++ b/include/net/uip/uip-arch.h @@ -169,8 +169,8 @@ struct uip_driver_s /* Driver callbacks */ - int (*ifup)(struct uip_driver_s *dev); - int (*ifdown)(struct uip_driver_s *dev); + int (*d_ifup)(struct uip_driver_s *dev); + int (*d_ifdown)(struct uip_driver_s *dev); /* Drivers may attached device-specific, private information */ diff --git a/net/connect.c b/net/connect.c index 7f3d176091..47047b3cf3 100644 --- a/net/connect.c +++ b/net/connect.c @@ -100,8 +100,11 @@ static inline int tcp_connect(FAR struct socket *psock, const struct sockaddr_in static void connection_event(void *private) { FAR struct socket *psock = (FAR struct socket *)private; + if (psock) { + vdbg("uip_flags: %02x s_flags: %02x\n", uip_flags, psock->s_flags); + /* UIP_CLOSE: The remote host has closed the connection * UIP_ABORT: The remote host has aborted the connection * UIP_TIMEDOUT: Connection aborted due to too many retransmissions. @@ -189,7 +192,7 @@ static void tcp_connect_interrupt(struct uip_driver_s *dev, void *private) { struct tcp_connect_s *pstate = (struct tcp_connect_s *)private; - vdbg("Interrupt uip_flags=%02x\n", uip_flags); + vdbg("uip_flags: %02x\n", uip_flags); /* 'private' might be null in some race conditions (?) */ @@ -214,7 +217,6 @@ static void tcp_connect_interrupt(struct uip_driver_s *dev, void *private) { /* Indicate that remote host refused the connection */ - vdbg("ECONNREFUSED\n"); pstate->tc_result = -ECONNREFUSED; } @@ -224,7 +226,6 @@ static void tcp_connect_interrupt(struct uip_driver_s *dev, void *private) { /* Indicate that the remote host is unreachable (or should this be timedout?) */ - vdbg("ETIMEDOUT\n"); pstate->tc_result = -ETIMEDOUT; } @@ -234,7 +235,6 @@ static void tcp_connect_interrupt(struct uip_driver_s *dev, void *private) { /* Indicate that the socket is no longer connected */ - vdbg("Connected\n"); pstate->tc_result = OK; } @@ -245,6 +245,8 @@ static void tcp_connect_interrupt(struct uip_driver_s *dev, void *private) return; } + vdbg("Resuming: %d\n", pstate->tc_result); + /* Stop further callbacks */ tcp_teardown_callbacks(pstate->tc_conn, pstate->tc_result); @@ -469,8 +471,6 @@ int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) { case SOCK_STREAM: { - dbg("TCP\n"); - /* Verify that the socket is not already connected */ if (_SS_ISCONNECTED(psock->s_flags)) @@ -493,8 +493,6 @@ int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) #ifdef CONFIG_NET_UDP case SOCK_DGRAM: { - dbg("UDP\n"); - ret = uip_udpconnect(psock->s_conn, inaddr); if (ret < 0) { diff --git a/net/netdev-ioctl.c b/net/netdev-ioctl.c index f093e6133d..3825a5f7bb 100644 --- a/net/netdev-ioctl.c +++ b/net/netdev-ioctl.c @@ -106,17 +106,17 @@ static void ioctl_setipaddr(uip_ipaddr_t *outaddr, struct sockaddr *inaddr) static void ioctl_ifup(FAR struct uip_driver_s *dev) { - if (dev->ifup) + if (dev->d_ifup) { - dev->ifup(dev); + dev->d_ifup(dev); } } static void ioctl_ifdown(FAR struct uip_driver_s *dev) { - if (dev->ifdown) + if (dev->d_ifdown) { - dev->ifdown(dev); + dev->d_ifdown(dev); } } @@ -190,95 +190,56 @@ int netdev_ioctl(int sockfd, int cmd, struct ifreq *req) { case SIOCGIFADDR: /* Get IP address */ ioctl_getipaddr(&req->ifr_addr, &dev->d_ipaddr); - dbg("Dev: %s IP: %d.%d.%d.%d\n", - dev->d_ifname, - (dev->d_ipaddr >> 24) & 0xff, (dev->d_ipaddr >> 16) & 0xff, - (dev->d_ipaddr >> 8) & 0xff, dev->d_ipaddr & 0xff); break; case SIOCSIFADDR: /* Set IP address */ ioctl_ifdown(dev); ioctl_setipaddr(&dev->d_ipaddr, &req->ifr_addr); - dbg("Dev: %s IP: %d.%d.%d.%d\n", - dev->d_ifname, - (dev->d_ipaddr >> 24) & 0xff, (dev->d_ipaddr >> 16) & 0xff, - (dev->d_ipaddr >> 8) & 0xff, dev->d_ipaddr & 0xff); ioctl_ifup(dev); break; case SIOCGIFDSTADDR: /* Get P-to-P address */ ioctl_getipaddr(&req->ifr_dstaddr, &dev->d_draddr); - dbg("Dev: %s Default router: %d.%d.%d.%d\n", - dev->d_ifname, - (dev->d_draddr >> 24) & 0xff, (dev->d_draddr >> 16) & 0xff, - (dev->d_draddr >> 8) & 0xff, dev->d_draddr & 0xff); break; case SIOCSIFDSTADDR: /* Set P-to-P address */ ioctl_setipaddr(&dev->d_draddr, &req->ifr_dstaddr); - dbg("Dev: %s Default router: %d.%d.%d.%d\n", - dev->d_ifname, - (dev->d_draddr >> 24) & 0xff, (dev->d_draddr >> 16) & 0xff, - (dev->d_draddr >> 8) & 0xff, dev->d_draddr & 0xff); break; case SIOCGIFNETMASK: /* Get network mask */ ioctl_getipaddr(&req->ifr_addr, &dev->d_netmask); - dbg("Dev: %s Netmask: %d.%d.%d.%d\n", - dev->d_ifname, - (dev->d_netmask >> 24) & 0xff, (dev->d_netmask >> 16) & 0xff, - (dev->d_netmask >> 8) & 0xff, dev->d_netmask & 0xff); break; case SIOCSIFNETMASK: /* Set network mask */ ioctl_setipaddr(&dev->d_netmask, &req->ifr_addr); - dbg("Dev: %s Netmask: %d.%d.%d.%d\n", - dev->d_ifname, - (dev->d_netmask >> 24) & 0xff, (dev->d_netmask >> 16) & 0xff, - (dev->d_netmask >> 8) & 0xff, dev->d_netmask & 0xff); break; case SIOCGIFMTU: /* Get MTU size */ req->ifr_mtu = UIP_BUFSIZE; - dbg("Dev: %s MTU: %d\n", dev->d_ifname, UIP_BUFSIZE); break; case SIOCGIFHWADDR: /* Get hardware address */ req->ifr_hwaddr.sa_family = AF_INETX; memcpy(req->ifr_hwaddr.sa_data, dev->d_mac.addr, IFHWADDRLEN); - dbg("Dev: %s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", - dev->d_ifname, - dev->d_mac.addr[0], dev->d_mac.addr[1], dev->d_mac.addr[2], - dev->d_mac.addr[3], dev->d_mac.addr[4], dev->d_mac.addr[5]); break; case SIOCSIFHWADDR: /* Set hardware address */ req->ifr_hwaddr.sa_family = AF_INETX; memcpy(dev->d_mac.addr, req->ifr_hwaddr.sa_data, IFHWADDRLEN); - dbg("Dev: %s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", - dev->d_ifname, - dev->d_mac.addr[0], dev->d_mac.addr[1], dev->d_mac.addr[2], - dev->d_mac.addr[3], dev->d_mac.addr[4], dev->d_mac.addr[5]); break; case SIOCDIFADDR: /* Delete IP address */ ioctl_ifdown(dev); memset(&dev->d_ipaddr, 0, sizeof(uip_ipaddr_t)); - dbg("Dev: %s IP: %d.%d.%d.%d\n", - dev->d_ifname, - (dev->d_ipaddr >> 24) & 0xff, (dev->d_ipaddr >> 16) & 0xff, - (dev->d_ipaddr >> 8) & 0xff, dev->d_ipaddr & 0xff); break; case SIOCGIFCOUNT: /* Get number of devices */ req->ifr_count = netdev_count(); - dbg("Dev: %s I/F count: %d\n", netdev_count()); err = ENOSYS; break; case SIOCGIFBRDADDR: /* Get broadcast IP address */ case SIOCSIFBRDADDR: /* Set broadcast IP address */ - dbg("Dev: %s Broadcast: 255.255.255.255d\n", dev->d_ifname); err = ENOSYS; goto errout; diff --git a/net/recvfrom.c b/net/recvfrom.c index 1ea76981f3..149abc10b6 100644 --- a/net/recvfrom.c +++ b/net/recvfrom.c @@ -107,7 +107,7 @@ static void recvfrom_interrupt(struct uip_driver_s *dev, void *private) #endif size_t recvlen; - vdbg("Interrupt uip_flags: %02x\n", uip_flags); + vdbg("uip_flags: %02x\n", uip_flags); /* 'private' might be null in some race conditions (?) */ @@ -154,7 +154,7 @@ static void recvfrom_interrupt(struct uip_driver_s *dev, void *private) { struct uip_udp_conn *udp_conn; - vdbg("UDP complete\n"); + vdbg("UDP resume\n"); /* Don't allow any further UDP call backs. */ @@ -174,7 +174,7 @@ static void recvfrom_interrupt(struct uip_driver_s *dev, void *private) { struct uip_conn *conn; - vdbg("TCP complete\n"); + vdbg("TCP resume\n"); /* The TCP receive buffer is full. Return now, perhaps truncating * the received data (need to fix that). @@ -206,7 +206,7 @@ static void recvfrom_interrupt(struct uip_driver_s *dev, void *private) else if ((uip_flags & (UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT)) != 0) { - vdbg("Receive error\n"); + vdbg("error\n"); /* Stop further callbacks */ @@ -480,9 +480,7 @@ static ssize_t udp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, * and automatically re-enabled when the task restarts. */ - vdbg("Receiving UDP ...\n"); ret = sem_wait(&state. rf_sem); - vdbg("Received\n"); /* Make sure that no further interrupts are processed */ @@ -531,7 +529,7 @@ static ssize_t tcp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, /* Verify that the SOCK_STREAM has been connected */ - if (_SS_ISCONNECTED(psock->s_flags)) + if (!_SS_ISCONNECTED(psock->s_flags)) { /* The SOCK_STREAM must be connected in order to receive */ @@ -559,9 +557,7 @@ static ssize_t tcp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, * and automatically re-enabled when the task restarts. */ - vdbg("Receiving UDP ...\n"); ret = sem_wait(&state.rf_sem); - vdbg("Received\n"); /* Make sure that no further interrupts are processed */ diff --git a/net/send.c b/net/send.c index 07a3a0a72c..1827a86e56 100644 --- a/net/send.c +++ b/net/send.c @@ -104,7 +104,7 @@ static void send_interrupt(struct uip_driver_s *dev, void *private) struct send_s *pstate = (struct send_s *)private; struct uip_conn *conn; - vdbg("Interrupt uip_flags: %02x state: %d\n", uip_flags, pstate->snd_state); + vdbg("uip_flags: %02x state: %d\n", uip_flags, pstate->snd_state); /* If the data has not been sent OR if it needs to be retransmitted, * then send it now. @@ -122,7 +122,6 @@ static void send_interrupt(struct uip_driver_s *dev, void *private) } pstate->snd_state = STATE_DATA_SENT; - vdbg("state: STATE_DATA_SENT(%d)\n", STATE_DATA_SENT); } /* Check if all data has been sent and acknowledged */ @@ -142,12 +141,9 @@ static void send_interrupt(struct uip_driver_s *dev, void *private) /* Send again on the next poll */ pstate->snd_state = STATE_POLLWAIT; - vdbg("state: STATE_POLLWAIT(%d)\n", STATE_POLLWAIT); } else { - vdbg("state: Data sent\n"); - /* All data has been sent */ pstate->snd_sent += pstate->snd_buflen; @@ -172,8 +168,6 @@ static void send_interrupt(struct uip_driver_s *dev, void *private) else if ((uip_flags & (UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT)) != 0) { - vdbg("state: TCP failure\n"); - /* Stop further callbacks */ conn = (struct uip_conn *)pstate->snd_sock->s_conn; @@ -316,14 +310,12 @@ ssize_t send(int sockfd, const void *buf, size_t len, int flags) * automatically re-enabled when the task restarts. */ - vdbg("Sending %d bytes...\n", len); ret = sem_wait(&state. snd_sem); /* Make sure that no further interrupts are processed */ conn->data_private = NULL; conn->data_event = NULL; - vdbg("Sent\n"); } sem_destroy(&state. snd_sem); diff --git a/net/uip/uip-arp.c b/net/uip/uip-arp.c index fa64f98766..13dd1ba03b 100644 --- a/net/uip/uip-arp.c +++ b/net/uip/uip-arp.c @@ -137,23 +137,23 @@ static uint8 g_arptime; * Private Functions ****************************************************************************/ -#ifdef CONFIG_DEBUG_VERBOSE +#if defined(CONFIG_NET_DUMPARP) && defined(CONFIG_DEBUG) static void uip_arp_dump(struct arp_hdr *arp) { - vdbg(" HW type: %04x Protocol: %04x\n", - arp->ah_hwtype, arp->ah_protocol);\ - vdbg(" HW len: %02x Proto len: %02x Operation: %04x\n", - arp->ah_hwlen, arp->ah_protolen, arp->ah_opcode); - vdbg(" Sender MAC: %02x:%02x:%02x:%02x:%02x:%02x IP: %d.%d.%d.%d\n", - arp->ah_shwaddr[0], arp->ah_shwaddr[1], arp->ah_shwaddr[2], - arp->ah_shwaddr[3], arp->ah_shwaddr[4], arp->ah_shwaddr[5], - arp->ah_sipaddr[0] & 0xff, arp->ah_sipaddr[0] >> 8, - arp->ah_sipaddr[1] & 0xff, arp->ah_sipaddr[1] >> 8); - vdbg(" Dest MAC: %02x:%02x:%02x:%02x:%02x:%02x IP: %d.%d.%d.%d\n", - arp->ah_dhwaddr[0], arp->ah_dhwaddr[1], arp->ah_dhwaddr[2], - arp->ah_dhwaddr[3], arp->ah_dhwaddr[4], arp->ah_dhwaddr[5], - arp->ah_dipaddr[0] & 0xff, arp->ah_dipaddr[0] >> 8, - arp->ah_dipaddr[1] & 0xff, arp->ah_dipaddr[1] >> 8); + dbg(" HW type: %04x Protocol: %04x\n", + arp->ah_hwtype, arp->ah_protocol);\ + dbg(" HW len: %02x Proto len: %02x Operation: %04x\n", + arp->ah_hwlen, arp->ah_protolen, arp->ah_opcode); + dbg(" Sender MAC: %02x:%02x:%02x:%02x:%02x:%02x IP: %d.%d.%d.%d\n", + arp->ah_shwaddr[0], arp->ah_shwaddr[1], arp->ah_shwaddr[2], + arp->ah_shwaddr[3], arp->ah_shwaddr[4], arp->ah_shwaddr[5], + arp->ah_sipaddr[0] & 0xff, arp->ah_sipaddr[0] >> 8, + arp->ah_sipaddr[1] & 0xff, arp->ah_sipaddr[1] >> 8); + dbg(" Dest MAC: %02x:%02x:%02x:%02x:%02x:%02x IP: %d.%d.%d.%d\n", + arp->ah_dhwaddr[0], arp->ah_dhwaddr[1], arp->ah_dhwaddr[2], + arp->ah_dhwaddr[3], arp->ah_dhwaddr[4], arp->ah_dhwaddr[5], + arp->ah_dipaddr[0] & 0xff, arp->ah_dipaddr[0] >> 8, + arp->ah_dipaddr[1] & 0xff, arp->ah_dipaddr[1] >> 8); } #else # define uip_arp_dump(arp) @@ -449,12 +449,6 @@ void uip_arp_out(struct uip_driver_s *dev) uip_ipaddr_copy(ipaddr, destipaddr); } - vdbg("Dest IP addr: %d.%d.%d.%d -> ARP IP addr: %d.%d.%d.%d\n", - (destipaddr >> 24) & 0xff, (destipaddr >> 16) & 0xff, - (destipaddr >> 8) & 0xff, destipaddr & 0xff, - (ipaddr >> 24) & 0xff, (ipaddr >> 16) & 0xff, - (ipaddr >> 8) & 0xff, ipaddr & 0xff); - /* Check if we already have this destination address in the ARP table */ for (i = 0; i < UIP_ARPTAB_SIZE; ++i) @@ -462,7 +456,6 @@ void uip_arp_out(struct uip_driver_s *dev) tabptr = &arp_table[i]; if (uip_ipaddr_cmp(ipaddr, tabptr->at_ipaddr)) { - vdbg("Dest IP found in ARP table\n"); break; } } diff --git a/net/uip/uip-fw.c b/net/uip/uip-fw.c index b529c6e067..187fb6c39c 100644 --- a/net/uip/uip-fw.c +++ b/net/uip/uip-fw.c @@ -323,7 +323,7 @@ uint8 uip_fw_output(struct uip_driver_s *dev) #endif /* UIP_BROADCAST */ netif = find_netif (dev); - dbg("uip_fw_output: netif %p ->output %p len %d\n", netif, netif->output, dev->d_len); + dbg("netif: %p output: %p len: %d\n", netif, netif->output, dev->d_len); if (netif == NULL) { return UIP_FW_NOROUTE; diff --git a/net/uip/uip-neighbor.c b/net/uip/uip-neighbor.c index d2fb743041..0e849bac1a 100644 --- a/net/uip/uip-neighbor.c +++ b/net/uip/uip-neighbor.c @@ -81,9 +81,9 @@ void uip_neighbor_add(uip_ipaddr_t ipaddr, struct uip_neighbor_addr *addr) int i, oldest; uint8 oldest_time; - dbg("Adding neighbor with link address %02x:%02x:%02x:%02x:%02x:%02x\n", - addr->addr.addr[0], addr->addr.addr[1], addr->addr.addr[2], addr->addr.addr[3], - addr->addr.addr[4], addr->addr.addr[5]); + dbg("Add neighbor: %02x:%02x:%02x:%02x:%02x:%02x\n", + addr->addr.addr[0], addr->addr.addr[1], addr->addr.addr[2], + addr->addr.addr[3], addr->addr.addr[4], addr->addr.addr[5]); /* Find the first unused entry or the oldest used entry. */ @@ -149,9 +149,9 @@ struct uip_neighbor_addr *uip_neighbor_lookup(uip_ipaddr_t ipaddr) e = find_entry(ipaddr); if (e != NULL) { - dbg("Lookup neighbor with link address %02x:%02x:%02x:%02x:%02x:%02x\n", - e->addr.addr.addr[0], e->addr.addr.addr[1], e->addr.addr.addr[2], e->addr.addr.addr[3], - e->addr.addr.addr[4], e->addr.addr.addr[5]); + dbg("Lookup neighbor: %02x:%02x:%02x:%02x:%02x:%02x\n", + e->addr.addr.addr[0], e->addr.addr.addr[1], e->addr.addr.addr[2], + e->addr.addr.addr[3], e->addr.addr.addr[4], e->addr.addr.addr[5]); return &e->addr; } diff --git a/net/uip/uip-poll.c b/net/uip/uip-poll.c index e6470dfe73..b61eb32aaf 100644 --- a/net/uip/uip-poll.c +++ b/net/uip/uip-poll.c @@ -125,7 +125,7 @@ int uip_poll(struct uip_driver_s *dev, uip_poll_callback_t callback, int event) /* Traverse all of the active TCP connections and perform the poll action */ conn = NULL; - while ((conn = uip_nexttcpconn(uip_conn))) + while ((conn = uip_nexttcpconn(conn))) { uip_conn = conn; uip_interrupt(dev, event); @@ -141,7 +141,7 @@ int uip_poll(struct uip_driver_s *dev, uip_poll_callback_t callback, int event) /* Traverse all of the allocated UDP connections and perform a poll action */ udp_conn = NULL; - while ((udp_conn = uip_nextudpconn(uip_udp_conn))) + while ((udp_conn = uip_nextudpconn(udp_conn))) { uip_udp_conn = udp_conn; uip_interrupt(dev, UIP_UDP_POLL); diff --git a/net/uip/uip-tcpconn.c b/net/uip/uip-tcpconn.c index 2a341019e7..0dc9f9f253 100644 --- a/net/uip/uip-tcpconn.c +++ b/net/uip/uip-tcpconn.c @@ -321,20 +321,10 @@ struct uip_conn *uip_tcpactive(struct uip_tcpip_hdr *buf) struct uip_conn *conn = (struct uip_conn *)g_active_tcp_connections.head; in_addr_t srcipaddr = uip_ip4addr_conv(buf->srcipaddr); - vdbg("BUF: destport: %04x srcport: %04x IP: %d.%d.%d.%d\n", - buf->destport, buf->srcport, - (srcipaddr >> 24) & 0xff, (srcipaddr >> 16) & 0xff, - (srcipaddr >> 8) & 0xff, srcipaddr & 0xff); - while (conn) { /* Find an open connection matching the tcp input */ - vdbg("conn: lport: %04x rport: %04x IP: %d.%d.%d.%d\n", - conn->lport, conn->rport, - (conn->ripaddr >> 24) & 0xff, (conn->ripaddr >> 16) & 0xff, - (conn->ripaddr >> 8) & 0xff, conn->ripaddr & 0xff); - if (conn->tcpstateflags != UIP_CLOSED && buf->destport == conn->lport && buf->srcport == conn->rport && uip_ipaddr_cmp(srcipaddr, conn->ripaddr)) diff --git a/net/uip/uip.c b/net/uip/uip.c index cc5c93e8a7..3a8e4fb8e3 100644 --- a/net/uip/uip.c +++ b/net/uip/uip.c @@ -333,7 +333,6 @@ uint16 uip_ipchksum(struct uip_driver_s *dev) uint16 sum; sum = chksum(0, &dev->d_buf[UIP_LLH_LEN], UIP_IPH_LEN); - vdbg("Checksum 0x%04x\n", sum); return (sum == 0) ? 0xffff : htons(sum); } #endif @@ -537,7 +536,7 @@ static void uip_add_rcv_nxt(uint16 n) #ifdef CONFIG_NET_UDP static void uip_udp_callback(struct uip_driver_s *dev) { - vdbg("UDP callback uip_flags: %02x\n", uip_flags); + vdbg("uip_flags: %02x\n", uip_flags); /* Some sanity checking */ @@ -552,7 +551,7 @@ static void uip_udp_callback(struct uip_driver_s *dev) static void uip_tcp_callback(struct uip_driver_s *dev) { - vdbg("TCP callback uip_flags: %02x\n", uip_flags); + vdbg("uip_flags: %02x\n", uip_flags); /* Some sanity checking */ @@ -588,6 +587,8 @@ void uip_interrupt(struct uip_driver_s *dev, uint8 event) int len; int i; + vdbg("event: %d\n", event); + dev->d_snddata = dev->d_appdata = &dev->d_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN]; /* Check if we were invoked because of a poll request for a @@ -596,7 +597,6 @@ void uip_interrupt(struct uip_driver_s *dev, uint8 event) if (event == UIP_POLL_REQUEST) { - vdbg("event: UIP_POLL_REQUEST\n"); if ((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_ESTABLISHED && !uip_outstanding(uip_connr)) { @@ -650,92 +650,92 @@ void uip_interrupt(struct uip_driver_s *dev, uint8 event) * in which case we retransmit. */ - if (uip_outstanding(uip_connr)) - { - if (uip_connr->timer-- == 0) - { - if (uip_connr->nrtx == UIP_MAXRTX || - ((uip_connr->tcpstateflags == UIP_SYN_SENT || - uip_connr->tcpstateflags == UIP_SYN_RCVD) && - uip_connr->nrtx == UIP_MAXSYNRTX)) - { - uip_connr->tcpstateflags = UIP_CLOSED; - vdbg("TCP state: UIP_CLOSED\n"); + if (uip_outstanding(uip_connr)) + { + if (uip_connr->timer-- == 0) + { + if (uip_connr->nrtx == UIP_MAXRTX || + ((uip_connr->tcpstateflags == UIP_SYN_SENT || + uip_connr->tcpstateflags == UIP_SYN_RCVD) && + uip_connr->nrtx == UIP_MAXSYNRTX)) + { + uip_connr->tcpstateflags = UIP_CLOSED; + vdbg("TCP state: UIP_CLOSED\n"); - /* We call uip_tcp_callback() with uip_flags set to - * UIP_TIMEDOUT to inform the application that the - * connection has timed out. - */ - - uip_flags = UIP_TIMEDOUT; - uip_tcp_callback(dev); - - /* We also send a reset packet to the remote host. */ - - BUF->flags = TCP_RST | TCP_ACK; - goto tcp_send_nodata; - } - - /* Exponential backoff. */ - - uip_connr->timer = UIP_RTO << (uip_connr->nrtx > 4 ? 4: uip_connr->nrtx); - ++(uip_connr->nrtx); - - /* Ok, so we need to retransmit. We do this differently - * depending on which state we are in. In ESTABLISHED, we - * call upon the application so that it may prepare the - * data for the retransmit. In SYN_RCVD, we resend the - * SYNACK that we sent earlier and in LAST_ACK we have to - * retransmit our FINACK. - */ - - UIP_STAT(++uip_stat.tcp.rexmit); - switch(uip_connr->tcpstateflags & UIP_TS_MASK) - { - case UIP_SYN_RCVD: - /* In the SYN_RCVD state, we should retransmit our - * SYNACK. + /* We call uip_tcp_callback() with uip_flags set to + * UIP_TIMEDOUT to inform the application that the + * connection has timed out. */ - goto tcp_send_synack; - - case UIP_SYN_SENT: - /* In the SYN_SENT state, we retransmit out SYN. */ - - BUF->flags = 0; - goto tcp_send_syn; - - case UIP_ESTABLISHED: - /* In the ESTABLISHED state, we call upon the application - * to do the actual retransmit after which we jump into - * the code for sending out the packet (the apprexmit - * label). - */ - - uip_flags = UIP_REXMIT; + uip_flags = UIP_TIMEDOUT; uip_tcp_callback(dev); - goto apprexmit; - case UIP_FIN_WAIT_1: - case UIP_CLOSING: - case UIP_LAST_ACK: - /* In all these states we should retransmit a FINACK. */ + /* We also send a reset packet to the remote host. */ - goto tcp_send_finack; - } - } - } - else if ((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_ESTABLISHED) - { - /* If there was no need for a retransmission, we poll the - * application for new data. - */ + BUF->flags = TCP_RST | TCP_ACK; + goto tcp_send_nodata; + } - uip_flags = UIP_POLL; - uip_tcp_callback(dev); - goto appsend; - } - } + /* Exponential backoff. */ + + uip_connr->timer = UIP_RTO << (uip_connr->nrtx > 4 ? 4: uip_connr->nrtx); + ++(uip_connr->nrtx); + + /* Ok, so we need to retransmit. We do this differently + * depending on which state we are in. In ESTABLISHED, we + * call upon the application so that it may prepare the + * data for the retransmit. In SYN_RCVD, we resend the + * SYNACK that we sent earlier and in LAST_ACK we have to + * retransmit our FINACK. + */ + + UIP_STAT(++uip_stat.tcp.rexmit); + switch(uip_connr->tcpstateflags & UIP_TS_MASK) + { + case UIP_SYN_RCVD: + /* In the SYN_RCVD state, we should retransmit our + * SYNACK. + */ + + goto tcp_send_synack; + + case UIP_SYN_SENT: + /* In the SYN_SENT state, we retransmit out SYN. */ + + BUF->flags = 0; + goto tcp_send_syn; + + case UIP_ESTABLISHED: + /* In the ESTABLISHED state, we call upon the application + * to do the actual retransmit after which we jump into + * the code for sending out the packet (the apprexmit + * label). + */ + + uip_flags = UIP_REXMIT; + uip_tcp_callback(dev); + goto apprexmit; + + case UIP_FIN_WAIT_1: + case UIP_CLOSING: + case UIP_LAST_ACK: + /* In all these states we should retransmit a FINACK. */ + + goto tcp_send_finack; + } + } + } + else if ((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_ESTABLISHED) + { + /* If there was no need for a retransmission, we poll the + * application for new data. + */ + + uip_flags = UIP_POLL; + uip_tcp_callback(dev); + goto appsend; + } + } goto drop; } @@ -761,7 +761,6 @@ void uip_interrupt(struct uip_driver_s *dev, uint8 event) /* This is where the input processing starts. */ - vdbg("event: %d\n", event); UIP_STAT(++uip_stat.ip.recv); /* Start of IP input header processing code. */ @@ -867,10 +866,7 @@ void uip_interrupt(struct uip_driver_s *dev, uint8 event) */ #if UIP_BROADCAST - vdbg("UDP IP checksum 0x%04x\n", uip_ipchksum(dev)); - if (BUF->proto == UIP_PROTO_UDP && - uip_ipaddr_cmp(BUF->destipaddr, all_ones_addr) - /*&& uip_ipchksum(dev) == 0xffff*/) + if (BUF->proto == UIP_PROTO_UDP && uip_ipaddr_cmp(BUF->destipaddr, all_ones_addr) { goto udp_input; } @@ -941,7 +937,6 @@ void uip_interrupt(struct uip_driver_s *dev, uint8 event) #if UIP_PINGADDRCONF icmp_input: - vdbg("icmp_input\n"); #endif /* UIP_PINGADDRCONF */ UIP_STAT(++uip_stat.icmp.recv); @@ -992,8 +987,6 @@ icmp_input: /* This is IPv6 ICMPv6 processing code. */ - vdbg("ICMP6 input length %d\n", dev->d_len); - if (BUF->proto != UIP_PROTO_ICMP6) { /* We only allow ICMPv6 packets from here. */ @@ -1060,7 +1053,6 @@ icmp_input: } else { - vdbg("Unknown ICMP6 message: %d\n", ICMPBUF->type); UIP_STAT(++uip_stat.icmp.drop); UIP_STAT(++uip_stat.icmp.typeerr); UIP_LOG("icmp: unknown ICMP message."); @@ -1072,7 +1064,6 @@ icmp_input: /* UDP input processing. */ udp_input: - vdbg("udp_input\n"); /* UDP processing is really just a hack. We don't do anything to the * UDP/IP headers, but let the UDP application do all the hard @@ -1106,7 +1097,6 @@ udp_input: goto drop; udp_found: - vdbg("udp_found\n"); uip_conn = NULL; uip_flags = UIP_NEWDATA; @@ -1115,7 +1105,7 @@ udp_found: uip_udp_callback(dev); udp_send: - vdbg("udp_send\n"); + if (dev->d_sndlen == 0) { goto drop; @@ -1164,7 +1154,6 @@ udp_send: /* TCP input processing. */ tcp_input: - vdbg("tcp_input\n"); UIP_STAT(++uip_stat.tcp.recv); @@ -1213,7 +1202,6 @@ tcp_input: UIP_STAT(++uip_stat.tcp.synrst); reset: - vdbg("reset\n"); /* We do not send resets in response to resets. */ @@ -1283,7 +1271,6 @@ reset: */ found_listen: - vdbg("found_listen\n"); /* First allocate a new connection structure and see if there is any * user application to accept it. @@ -1377,11 +1364,9 @@ found_listen: /* Our response will be a SYNACK. */ tcp_send_synack: - vdbg("tcp_send_synack\n"); BUF->flags = TCP_ACK; tcp_send_syn: - vdbg("tcp_send_syn\n"); BUF->flags |= TCP_SYN; /* We send out the TCP Maximum Segment Size option with our SYNACK. */ @@ -1397,7 +1382,6 @@ tcp_send_syn: /* This label will be jumped to if we found an active connection. */ found: - vdbg("found\n"); uip_conn = uip_connr; uip_flags = 0; @@ -1671,7 +1655,6 @@ found: vdbg("TCP state: UIP_LAST_ACK\n"); tcp_send_finack: - vdbg("tcp_send_finack\n"); BUF->flags = TCP_FIN | TCP_ACK; goto tcp_send_nodata; @@ -1763,7 +1746,6 @@ tcp_send_finack: uip_tcp_callback(dev); appsend: - vdbg("appsend\n"); if (uip_flags & UIP_ABORT) { @@ -1836,7 +1818,6 @@ appsend: } uip_connr->nrtx = 0; apprexmit: - vdbg("apprexmit\n"); dev->d_appdata = dev->d_snddata; /* If the application has data to be sent, or if the incoming @@ -1972,19 +1953,16 @@ apprexmit: */ tcp_send_ack: - vdbg("tcp_send_ack\n"); BUF->flags = TCP_ACK; tcp_send_nodata: - vdbg("tcp_send_nodata\n"); dev->d_len = UIP_IPTCPH_LEN; tcp_send_noopts: BUF->tcpoffset = (UIP_TCPH_LEN / 4) << 4; tcp_send: - vdbg("tcp_send\n"); /* We're done with the input processing. We are now ready to send a * reply. Our job is to fill in all the fields of the TCP and IP @@ -2025,7 +2003,6 @@ tcp_send: } tcp_send_noconn: - vdbg("tcp_send_noconn\n"); BUF->ttl = UIP_TTL; #ifdef CONFIG_NET_IPv6 @@ -2049,7 +2026,6 @@ tcp_send_noconn: #ifdef CONFIG_NET_UDP ip_send_nolen: - vdbg("ip_send_nolen\n"); #endif /* CONFIG_NET_UDP */ #ifdef CONFIG_NET_IPv6 @@ -2069,13 +2045,12 @@ ip_send_nolen: BUF->ipchksum = 0; BUF->ipchksum = ~(uip_ipchksum(dev)); - vdbg("checksum: 0x%04x\n", uip_ipchksum(dev)); #endif /* CONFIG_NET_IPv6 */ UIP_STAT(++uip_stat.tcp.sent); send: - vdbg("send: packet length %d (%d)\n", + vdbg("Sending packet length %d (%d)\n", dev->d_len, (BUF->len[0] << 8) | BUF->len[1]); UIP_STAT(++uip_stat.ip.sent);