/*FUNCTION*------------------------------------------------------------- * * Function Name : _usb_dev_driver_install * Returned Value : None * Comments : * Installs the device *END*-----------------------------------------------------------------*/ uint_8 _usb_dev_driver_install ( /* [IN] device number */ uint_32 device_number, /* [IN] address if the callback functions structure */ pointer callback_struct_ptr ) { /* Body */ pointer callback_struct_table_ptr; callback_struct_table_ptr = _mqx_get_io_component_handle(IO_USB_COMPONENT); if (!callback_struct_table_ptr) { callback_struct_table_ptr = USB_mem_alloc_zero((BSP_MAX_USB_DRIVERS * sizeof(USB_DEV_CALLBACK_FUNCTIONS_STRUCT))); if (!callback_struct_table_ptr) { #if _DEBUG printf("memalloc failed in _usb_driver_install\n"); #endif return USBERR_DRIVER_INSTALL_FAILED; } /* Endif */ USB_mem_zero((uint_8_ptr)callback_struct_table_ptr, sizeof(callback_struct_table_ptr)); _mqx_set_io_component_handle(IO_USB_COMPONENT, callback_struct_table_ptr); } /* Endif */ *((USB_DEV_CALLBACK_FUNCTIONS_STRUCT_PTR)\ (((USB_DEV_CALLBACK_FUNCTIONS_STRUCT_PTR)callback_struct_table_ptr) + device_number)) = *((USB_DEV_CALLBACK_FUNCTIONS_STRUCT_PTR)callback_struct_ptr); return USB_OK; } /* EndBody */
USB_STATUS _usb_host_init ( /* [IN] address if the callback functions structure */ struct usb_host_if_struct *usb_if, /* [OUT] the USB host handle */ _usb_host_handle _PTR_ handle ) { /* Body */ USB_STATUS error; USB_HOST_IF_STRUCT_PTR usb_c; USB_HOST_CALLBACK_FUNCTIONS_STRUCT_PTR host_if; USB_HOST_STATE_STRUCT_PTR usb_host_ptr = NULL; _mqx_int i; #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_init"); #endif /* Check usb_if structure */ if (usb_if == NULL) { #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_init no interface given"); #endif return USB_log_error(__FILE__,__LINE__,USBERR_DEVICE_NOT_FOUND); } if (usb_if->HOST_IF == NULL) { /* The interface does not support host functionality */ #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_init interface not supporting host"); #endif return USB_log_error(__FILE__,__LINE__,USBERR_DEVICE_NOT_FOUND); } USB_lock(); usb_c = _mqx_get_io_component_handle(IO_USB_COMPONENT); /* Check if the interface is registered */ if (!usb_c) { /* No interface was registered yet */ USB_unlock(); #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_init no interface registered"); #endif return USB_log_error(__FILE__,__LINE__,USBERR_DEVICE_NOT_FOUND); } else { /* Find out if the interface has been installed */ for (i = 0; i < USBCFG_MAX_DRIVERS; i++) { if (usb_c[i].HOST_INIT_PARAM == usb_if->HOST_INIT_PARAM) { /* Found installed device */ break; } } } if (i == USBCFG_MAX_DRIVERS) { /* The interface has not been registered, so it cannot be initialized */ USB_unlock(); #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_init not installed"); #endif return USB_log_error(__FILE__,__LINE__,USBERR_DEVICE_NOT_FOUND); } else { /* check if the registered interface was already initialized */ if (usb_c[i].HOST_HANDLE != NULL) { /* The interface was already installed- return handle and USBERR_DEVICE_BUSY value */ *handle = (_usb_host_handle) usb_c[i].HOST_HANDLE; USB_unlock(); #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_init already initialized - returning handle"); #endif return USBERR_DEVICE_BUSY; } } host_if = (USB_HOST_CALLBACK_FUNCTIONS_STRUCT_PTR) usb_c[i].HOST_IF; /* Initialize the USB interface. */ if (host_if->HOST_PREINIT != NULL) { error = host_if->HOST_PREINIT((_usb_host_handle _PTR_) &usb_host_ptr); } if (error || usb_host_ptr == NULL || usb_host_ptr->PIPE_DESCRIPTOR_BASE_PTR == NULL) { #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_init preinit failure"); #endif return USB_log_error(__FILE__,__LINE__,USBERR_ALLOC); } /* Endif */ usb_host_ptr->CALLBACK_STRUCT_PTR = usb_c[i].HOST_IF; usb_host_ptr->INIT_PARAM = usb_c[i].HOST_INIT_PARAM; _mem_set_type(usb_host_ptr, MEM_TYPE_USB_HOST_STATE_STRUCT); _mem_set_type(usb_host_ptr->PIPE_DESCRIPTOR_BASE_PTR, MEM_TYPE_USB_HOST_PIPE_DESCRIPTORS); /* No devices attached yet */ /* ** We should maintain device lists per controller handle */ usb_host_ptr->DEVICE_LIST_PTR = NULL; usb_host_ptr->FRAME_LIST_SIZE = 1024; #if (USBCFG_HOST_NUM_ISO_PACKET_DESCRIPTORS != 0) error = _usb_host_iso_packet_desc_pool_create(USBCFG_HOST_NUM_ISO_PACKET_DESCRIPTORS); if (error != USB_OK) { USB_mem_free(usb_host_ptr->PIPE_DESCRIPTOR_BASE_PTR); USB_mem_free(usb_host_ptr); USB_unlock(); #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_init: isochronous packet descriptor pool allocation failure"); #endif return USB_log_error(__FILE__,__LINE__,USBERR_ALLOC); } #endif error = _bsp_usb_host_init(&usb_c[i]); if (error != MQX_OK) { #if (USBCFG_HOST_NUM_ISO_PACKET_DESCRIPTORS != 0) _usb_host_iso_packet_desc_pool_destroy (); #endif USB_mem_free(usb_host_ptr->PIPE_DESCRIPTOR_BASE_PTR); USB_mem_free(usb_host_ptr); USB_unlock(); #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_init: BSP-specific USB initialization failure"); #endif return USB_log_error(__FILE__,__LINE__,USBERR_UNKNOWN_ERROR); } error = _usb_host_init_call_interface(usb_host_ptr); USB_unlock(); if (error != USB_OK) { #if (USBCFG_HOST_NUM_ISO_PACKET_DESCRIPTORS != 0) _usb_host_iso_packet_desc_pool_destroy (); #endif USB_mem_free(usb_host_ptr->PIPE_DESCRIPTOR_BASE_PTR); USB_mem_free(usb_host_ptr); #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_init returning error status"); #endif return USB_log_error(__FILE__,__LINE__,error); } /* Endif */ usb_c[i].HOST_HANDLE = *handle = (pointer)usb_host_ptr; #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("_usb_host_init SUCCESSFULL"); #endif return USB_OK; } /* Endbody */
/*FUNCTION*------------------------------------------------------------- * * Function Name : _usb_device_init * Returned Value : USB_OK or error code * Comments : * Initializes the USB device specific data structures and calls * the low-level device controller chip initialization routine. * *END*-----------------------------------------------------------------*/ USB_STATUS _usb_device_init ( /* [IN] the USB device controller to initialize */ struct usb_dev_if_struct *usb_if, /* [OUT] the USB_USB_dev_initialize state structure */ _usb_device_handle _PTR_ handle, /* [IN] number of endpoints to initialize */ _mqx_uint endpoints ) { /* Body */ USB_DEV_IF_STRUCT_PTR usb_c; USB_DEV_STATE_STRUCT_PTR usb_dev_ptr; _mqx_uint temp, i, j; SCRATCH_STRUCT_PTR temp_scratch_ptr; USB_DEV_CALLBACK_FUNCTIONS_STRUCT_PTR call_back_table_ptr; USB_STATUS error; USB_DEV_CALLBACK_FUNCTIONS_STRUCT_PTR dev_if; /* Check usb_if structure */ if (usb_if == NULL) { return USBERR_DEVICE_NOT_FOUND; } if (usb_if->DEV_IF == NULL) { /* The interface does not support device functionality */ return USBERR_DEVICE_NOT_FOUND; } USB_lock(); usb_c = _mqx_get_io_component_handle(IO_USB_COMPONENT); /* Check if the interface is registered */ if (!usb_c) { /* No interface was registered yet */ USB_unlock(); return USBERR_DEVICE_NOT_FOUND; } else { /* Find out if the interface has been installed */ for (i = 0; i < USBCFG_MAX_DRIVERS; i++) { if (usb_c[i].DEV_INIT_PARAM == usb_if->DEV_INIT_PARAM) { /* Found installed device */ break; } } } if (i == USBCFG_MAX_DRIVERS) { /* The interface has not been registered, so it cannot be initialized */ USB_unlock(); return USBERR_DEVICE_NOT_FOUND; } else { /* check if the registered interface was already initialized */ if (usb_c[i].DEV_HANDLE != NULL) { /* The interface was already installed- return handle and USBERR_DEVICE_BUSY value */ *handle = (_usb_device_handle) usb_c[i].DEV_HANDLE; USB_unlock(); return USBERR_DEVICE_BUSY; } } dev_if = (USB_DEV_CALLBACK_FUNCTIONS_STRUCT_PTR) usb_c[i].DEV_IF; /* Initialize the USB interface. */ if (dev_if->DEV_PREINIT != NULL) { error = dev_if->DEV_PREINIT((_usb_device_handle _PTR_) &usb_dev_ptr); } if (usb_dev_ptr == NULL) { #ifdef _DEV_DEBUG printf("1 memalloc failed in _usb_device_init\n"); #endif USB_unlock(); return USBERR_ALLOC_STATE; } /* Endif */ usb_dev_ptr->CALLBACK_STRUCT_PTR = (pointer) usb_c[i].DEV_IF; usb_dev_ptr->INIT_PARAM = usb_c[i].DEV_INIT_PARAM; error = _bsp_usb_dev_init(&usb_c[i]); if (error != MQX_OK) { USB_unlock(); _mem_free(usb_dev_ptr->TEMP_XD_PTR); _mem_free(usb_dev_ptr->XD_SCRATCH_STRUCT_BASE); _mem_free(usb_dev_ptr->XD_BASE); _mem_free(usb_dev_ptr); return USBERR_UNKNOWN_ERROR; } /* Initialize the USB controller chip */ if (((USB_DEV_CALLBACK_FUNCTIONS_STRUCT_PTR) usb_dev_ptr->CALLBACK_STRUCT_PTR)->DEV_INIT != NULL) { error = ((USB_DEV_CALLBACK_FUNCTIONS_STRUCT_PTR) usb_dev_ptr->CALLBACK_STRUCT_PTR)->DEV_INIT(usb_dev_ptr); } else { #ifdef _DEV_DEBUG printf("_usb_device_init: DEV_INIT is NULL\n"); #endif return USBERR_ERROR; } if (error) { USB_unlock(); _mem_free(usb_dev_ptr->TEMP_XD_PTR); _mem_free(usb_dev_ptr->XD_SCRATCH_STRUCT_BASE); _mem_free(usb_dev_ptr->XD_BASE); _mem_free(usb_dev_ptr); return USBERR_INIT_FAILED; } /* Endif */ usb_c[i].DEV_HANDLE = *handle = usb_dev_ptr; USB_unlock(); return error; } /* EndBody */
uint32_t ENET_initialize_ex ( /* [IN] optional parameters */ const ENET_PARAM_STRUCT * param_ptr, /* [IN] the local Ethernet address */ _enet_address address, /* [OUT] the Ethernet state structure */ _enet_handle *handle ) { ENET_CONTEXT_STRUCT_PTR enet_ptr = NULL;//, other_enet_ptr; uint32_t result; bool vlan; if (param_ptr == NULL) return ENETERR_INVALID_DEVICE; if (param_ptr->NUM_RX_BUFFERS < param_ptr->NUM_RX_ENTRIES) return ENETERR_INVALID_INIT_PARAM; enet_ptr = _mqx_get_io_component_handle(IO_ENET_COMPONENT); while (enet_ptr) { if (enet_ptr->PARAM_PTR->ENET_IF->MAC_NUMBER == param_ptr->ENET_IF->MAC_NUMBER) break; enet_ptr = enet_ptr->NEXT; } if (enet_ptr) { *handle = enet_ptr; return ENETERR_INITIALIZED_DEVICE; } else *handle = NULL; /* Allocate the Enet context structure.*/ enet_ptr = _mem_alloc_system_zero(sizeof(ENET_CONTEXT_STRUCT)); if (NULL==enet_ptr) return ENETERR_ALLOC_CFG; _mem_set_type((void *)enet_ptr, MEM_TYPE_IO_ENET_CONTEXT_STRUCT); /* Initialize the Enet context structure.*/ eaddrcpy(enet_ptr->ADDRESS, address); enet_ptr->PARAM_PTR = param_ptr; vlan = (enet_ptr->PARAM_PTR->OPTIONS & ENET_OPTION_VLAN) == ENET_OPTION_VLAN; enet_ptr->MaxTxFrameSize = ENET_max_framesize(enet_ptr->PARAM_PTR->TX_BUFFER_SIZE,0,vlan); enet_ptr->MaxRxFrameSize = ENET_max_framesize(enet_ptr->PARAM_PTR->RX_BUFFER_SIZE,enet_ptr->PARAM_PTR->NUM_LARGE_BUFFERS,vlan); _lwsem_create(&enet_ptr->CONTEXT_LOCK, 1); /* Initialize the MAC.*/ result = (*param_ptr->ENET_IF->MAC_IF->INIT)(enet_ptr); if (ENET_OK == result) { // Link the driver into the kernel component list _mqx_link_io_component_handle(IO_ENET_COMPONENT,enet_ptr, (void **)&enet_ptr->NEXT); *handle = enet_ptr; } else { _lwsem_destroy(&enet_ptr->CONTEXT_LOCK); _mem_free(enet_ptr); *handle = NULL; } return result; }
int_32 Shell_netstat(int_32 argc, char_ptr argv[] ) { /* Body */ boolean print_usage, shorthelp = FALSE; #if RTCSCFG_ENABLE_IP_STATS IP_STATS_PTR ip = IP_stats(); #endif #if RTCSCFG_ENABLE_ICMP_STATS ICMP_STATS_PTR icmp = ICMP_stats(); #endif #if RTCSCFG_ENABLE_UDP_STATS UDP_STATS_PTR udp = UDP_stats(); #endif #if RTCSCFG_ENABLE_TCP_STATS TCP_STATS_PTR tcp = TCP_stats(); #endif #if BSPCFG_ENABLE_ENET_STATS _enet_handle handle; ENET_STATS_PTR enet = NULL; #endif print_usage = Shell_check_help_request(argc, argv, &shorthelp ); if (!print_usage) { #if BSPCFG_ENABLE_ENET_STATS handle = _mqx_get_io_component_handle(IO_ENET_COMPONENT); while (handle) { enet = ENET_get_stats(handle); printf("\nENET %x:\n",handle ); printf("\t%ld packets received\n", enet->COMMON.ST_RX_TOTAL); printf("\t%ld rx packets missed\n", enet->COMMON.ST_RX_MISSED); printf("\t%ld rx packets discarded\n", enet->COMMON.ST_RX_DISCARDED); printf("\t%ld rx packets with error\n", enet->COMMON.ST_RX_ERRORS); printf("\t%ld packets received\n", enet->COMMON.ST_TX_TOTAL); printf("\t%ld tx packets missed\n", enet->COMMON.ST_TX_MISSED); printf("\t%ld tx packets discarded\n", enet->COMMON.ST_TX_DISCARDED); printf("\t%ld tx packets received with error\n", enet->COMMON.ST_TX_ERRORS); /* Following stats are physical errors/conditions */ printf("\t%ld rx align error\n", enet->ST_RX_ALIGN); printf("\t%ld rx fcs error\n", enet->ST_RX_FCS); printf("\t%ld rx runt error\n", enet->ST_RX_RUNT); printf("\t%ld rx giant error\n", enet->ST_RX_GIANT); printf("\t%ld rx latecoll error\n", enet->ST_RX_LATECOLL); printf("\t%ld rx overrun error\n", enet->ST_RX_OVERRUN); printf("\t%ld tx SQE\n", enet->ST_TX_SQE); printf("\t%ld tx deferred\n", enet->ST_TX_DEFERRED); printf("\t%ld tx late collision\n", enet->ST_TX_LATECOLL); printf("\t%ld tx excessive collision\n",enet->ST_TX_EXCESSCOLL); printf("\t%ld tx carrier\n", enet->ST_TX_CARRIER); printf("\t%ld tx unerrun error\n", enet->ST_TX_UNDERRUN); handle = ENET_get_next_device_handle(handle); } #endif #if RTCSCFG_ENABLE_IP_STATS printf("\nIP:\n"); printf("\t%ld packets received\n", ip->COMMON.ST_RX_TOTAL); printf("\t%ld packets delivered\n", ip->ST_RX_DELIVERED); printf("\t%ld packets forwarded\n", ip->ST_RX_FORWARDED); printf("\t%ld discarded for lack of resources\n", ip->COMMON.ST_RX_MISSED); printf("\t%ld discarded due to internal errors\n", ip->COMMON.ST_RX_ERRORS); printf("\t%ld discarded for other reasons:\n", ip->COMMON.ST_RX_DISCARDED); printf("\t\t%ld with header errors\n", ip->ST_RX_HDR_ERRORS); printf("\t\t%ld with an illegal destination\n", ip->ST_RX_ADDR_ERRORS); printf("\t\t%ld with unknown protocols\n", ip->ST_RX_NO_PROTO); printf("\t%ld fragments received\n", ip->ST_RX_FRAG_RECVD); printf("\t%ld fragments reassembled\n", ip->ST_RX_FRAG_REASMD); printf("\t%ld fragments discarded\n", ip->ST_RX_FRAG_DISCARDED); printf("\t%ld packets sent\n", ip->COMMON.ST_TX_TOTAL); printf("\t%ld unsent for lack of resources\n", ip->COMMON.ST_TX_MISSED); printf("\t%ld unsent due to internal errors\n", ip->COMMON.ST_TX_ERRORS); printf("\t%ld destinations found unreachable\n", ip->COMMON.ST_TX_DISCARDED); printf("\t%ld packets fragmented\n", ip->ST_TX_FRAG_FRAGD); printf("\t%ld fragments sent\n", ip->ST_TX_FRAG_SENT); printf("\t%ld fragmentation failures\n", ip->ST_TX_FRAG_DISCARDED); printf("-- More --"); getchar(); #endif #if RTCSCFG_ENABLE_ICMP_STATS printf("\nICMP:\n"); printf("\t%ld packets received\n", icmp->COMMON.ST_RX_TOTAL); printf("\t%ld discarded for lack of resources\n", icmp->COMMON.ST_RX_MISSED); printf("\t%ld discarded due to internal errors\n", icmp->COMMON.ST_RX_ERRORS); printf("\t%ld discarded for other reasons:\n", icmp->COMMON.ST_RX_DISCARDED); printf("\t\t%ld with header errors\n", icmp->ST_RX_BAD_CHECKSUM + icmp->ST_RX_SMALL_DGRAM); printf("\t\t%ld unrecognized codes\n", icmp->ST_RX_BAD_CODE); printf("\t\t%ld redirects from non-gateways\n", icmp->ST_RX_RD_NOTGATE); printf("\t%ld packets sent\n", icmp->COMMON.ST_TX_TOTAL); printf("\t%ld discarded for lack of resources\n", icmp->COMMON.ST_TX_MISSED); printf("\t%ld discarded due to internal errors\n", icmp->COMMON.ST_TX_ERRORS); printf("\t%ld with illegal type or code\n", icmp->COMMON.ST_TX_DISCARDED); printf("\tInput histogram:\n"); if (icmp->ST_RX_DESTUNREACH) printf("\t\t%ld Destination Unreachables\n", icmp->ST_RX_DESTUNREACH); if (icmp->ST_RX_TIMEEXCEED) printf("\t\t%ld Time Exceededs\n", icmp->ST_RX_TIMEEXCEED); if (icmp->ST_RX_PARMPROB) printf("\t\t%ld Parameter Problems\n", icmp->ST_RX_PARMPROB); if (icmp->ST_RX_SRCQUENCH) printf("\t\t%ld Source Quenches\n", icmp->ST_RX_SRCQUENCH); if (icmp->ST_RX_REDIRECT) printf("\t\t%ld Redirects\n", icmp->ST_RX_REDIRECT); if (icmp->ST_RX_ECHO_REQ) printf("\t\t%ld Echo Requests\n", icmp->ST_RX_ECHO_REQ); if (icmp->ST_RX_ECHO_REPLY) printf("\t\t%ld Echo Replies\n", icmp->ST_RX_ECHO_REPLY); if (icmp->ST_RX_TIME_REQ) printf("\t\t%ld Timestamp Requests\n", icmp->ST_RX_TIME_REQ); if (icmp->ST_RX_TIME_REPLY) printf("\t\t%ld Timestamp Replies\n", icmp->ST_RX_TIME_REPLY); if (icmp->ST_RX_INFO_REQ) printf("\t\t%ld Information Requests\n", icmp->ST_RX_INFO_REQ); if (icmp->ST_RX_INFO_REPLY) printf("\t\t%ld Information Replies\n", icmp->ST_RX_INFO_REPLY); if (icmp->ST_RX_OTHER) printf("\t\t%ld Unknown\n", icmp->ST_RX_OTHER); printf("\tOutput histogram:\n"); if (icmp->ST_TX_DESTUNREACH) printf("\t\t%ld Destination Unreachables\n", icmp->ST_TX_DESTUNREACH); if (icmp->ST_TX_TIMEEXCEED) printf("\t\t%ld Time Exceededs\n", icmp->ST_TX_TIMEEXCEED); if (icmp->ST_TX_PARMPROB) printf("\t\t%ld Parameter Problems\n", icmp->ST_TX_PARMPROB); if (icmp->ST_TX_SRCQUENCH) printf("\t\t%ld Source Quenches\n", icmp->ST_TX_SRCQUENCH); if (icmp->ST_TX_REDIRECT) printf("\t\t%ld Redirects\n", icmp->ST_TX_REDIRECT); if (icmp->ST_TX_ECHO_REQ) printf("\t\t%ld Echo Requests\n", icmp->ST_TX_ECHO_REQ); if (icmp->ST_TX_ECHO_REPLY) printf("\t\t%ld Echo Replies\n", icmp->ST_TX_ECHO_REPLY); if (icmp->ST_TX_TIME_REQ) printf("\t\t%ld Timestamp Requests\n", icmp->ST_TX_TIME_REQ); if (icmp->ST_TX_TIME_REPLY) printf("\t\t%ld Timestamp Replies\n", icmp->ST_TX_TIME_REPLY); if (icmp->ST_TX_INFO_REQ) printf("\t\t%ld Information Requests\n", icmp->ST_TX_INFO_REQ); if (icmp->ST_TX_INFO_REPLY) printf("\t\t%ld Information Replies\n", icmp->ST_TX_INFO_REPLY); if (icmp->ST_TX_OTHER) printf("\t\t%ld Unknown\n", icmp->ST_TX_OTHER); printf("-- More --"); getchar(); #endif #if RTCSCFG_ENABLE_UDP_STATS printf("\nUDP:\n"); printf("\t%ld packets received\n", udp->COMMON.ST_RX_TOTAL); printf("\t%ld discarded for lack of resources\n", udp->COMMON.ST_RX_MISSED); printf("\t%ld discarded due to internal errors\n", udp->COMMON.ST_RX_ERRORS); printf("\t%ld discarded for other reasons:\n", udp->COMMON.ST_RX_DISCARDED); printf("\t\t%ld with header errors\n", udp->ST_RX_BAD_PORT + udp->ST_RX_BAD_CHECKSUM + udp->ST_RX_SMALL_DGRAM + udp->ST_RX_SMALL_PKT); printf("\t\t%ld with unknown ports\n", udp->ST_RX_NO_PORT); printf("\t%ld packets sent\n", udp->COMMON.ST_TX_TOTAL); printf("\t%ld unsent for lack of resources\n", udp->COMMON.ST_TX_MISSED); printf("\t%ld unsent due to internal errors\n", udp->COMMON.ST_TX_ERRORS); printf("\t%ld with illegal destination port\n", udp->COMMON.ST_TX_DISCARDED); printf("-- More --"); getchar(); #endif #if RTCSCFG_ENABLE_TCP_STATS printf("\nTCP:\n"); printf("\t%ld packets received\n", tcp->COMMON.ST_RX_TOTAL); printf("\t%ld discarded for lack of resources\n", tcp->COMMON.ST_RX_MISSED); printf("\t%ld discarded due to internal errors\n", tcp->COMMON.ST_RX_ERRORS); printf("\t%ld discarded for other reasons:\n", tcp->COMMON.ST_RX_DISCARDED); printf("\t\t%ld with header errors\n", tcp->ST_RX_BAD_PORT + tcp->ST_RX_BAD_CHECKSUM + tcp->ST_RX_SMALL_HDR + tcp->ST_RX_SMALL_DGRAM + tcp->ST_RX_SMALL_PKT); printf("\t\t%ld acks for unsent data\n", tcp->ST_RX_BAD_ACK); printf("\t\t%ld with data outside window\n", tcp->ST_RX_BAD_DATA); printf("\t\t%ld with data after close\n", tcp->ST_RX_LATE_DATA); printf("\t%ld segments with data\n", tcp->ST_RX_DATA); printf("\t%ld segments with duplicate data\n", tcp->ST_RX_DATA_DUP); printf("\t%ld segments with only an ACK\n", tcp->ST_RX_ACK); printf("\t%ld segments with a duplicate ACK\n", tcp->ST_RX_ACK_DUP); printf("\t%ld segments with a RST\n", tcp->ST_RX_RESET); printf("\t%ld window probes\n", tcp->ST_RX_PROBE); printf("\t%ld window updates\n", tcp->ST_RX_WINDOW); printf("-- More --"); getchar(); printf("\t%ld packets sent\n", tcp->COMMON.ST_TX_TOTAL); printf("\t%ld discarded for lack of resources\n", tcp->COMMON.ST_TX_MISSED); printf("\t%ld discarded due to internal errors\n", tcp->COMMON.ST_TX_ERRORS); printf("\t%ld with illegal destination port\n", tcp->COMMON.ST_TX_DISCARDED); printf("\t%ld segments with data\n", tcp->ST_TX_DATA); printf("\t%ld segments with retransmitted data\n", tcp->ST_TX_DATA_DUP); printf("\t%ld segments with only an ACK\n", tcp->ST_TX_ACK); printf("\t%ld segments with a delayed ACK\n", tcp->ST_TX_ACK_DELAYED); printf("\t%ld segments with a RST\n", tcp->ST_TX_RESET); printf("\t%ld window probes\n", tcp->ST_TX_PROBE); printf("\t%ld window updates\n", tcp->ST_TX_WINDOW); printf("\t%ld active opens\n", tcp->ST_CONN_ACTIVE); printf("\t%ld passive opens\n", tcp->ST_CONN_PASSIVE); printf("\t%ld connections currently established\n", tcp->ST_CONN_OPEN); printf("\t%ld connections gracefully closed\n", tcp->ST_CONN_CLOSED); printf("\t%ld connections aborted\n", tcp->ST_CONN_RESET); printf("\t%ld failed connection attempts\n", tcp->ST_CONN_FAILED); #endif } if (print_usage) { if (shorthelp) { printf("%s\n", argv[0]); } else { printf("Usage: %s\n", argv[0]); } } return SHELL_EXIT_SUCCESS; } /* Endbody */