Merge pull request #32 from adamgreen/netPerfRobustness

Updates to network code to improve performance/robustness
pull/33/head
Bogdan Marinescu 2013-08-15 03:51:47 -07:00
commit ff55aa3e13
3 changed files with 29 additions and 11 deletions

View File

@ -428,10 +428,31 @@ static struct pbuf *lpc_low_level_input(struct netif *netif)
p = lpc_enetif->rxb[idx]; p = lpc_enetif->rxb[idx];
p->len = (u16_t) length; p->len = (u16_t) length;
/* Free pbuf from desriptor */ /* Free pbuf from descriptor */
lpc_enetif->rxb[idx] = NULL; lpc_enetif->rxb[idx] = NULL;
lpc_enetif->rx_free_descs++; lpc_enetif->rx_free_descs++;
/* Attempt to queue new buffer(s) */
if (lpc_rx_queue(lpc_enetif->netif) == 0) {
/* Drop the frame due to OOM. */
LINK_STATS_INC(link.drop);
/* Re-queue the pbuf for receive */
lpc_rxqueue_pbuf(lpc_enetif, p);
LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE,
("lpc_low_level_input: Packet index %d dropped for OOM\n",
idx));
#ifdef LOCK_RX_THREAD
#if NO_SYS == 0
sys_mutex_unlock(&lpc_enetif->TXLockMutex);
#endif
#endif
return NULL;
}
LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE, LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE,
("lpc_low_level_input: Packet received: %p, size %d (index=%d)\n", ("lpc_low_level_input: Packet received: %p, size %d (index=%d)\n",
p, length, idx)); p, length, idx));
@ -439,9 +460,6 @@ static struct pbuf *lpc_low_level_input(struct netif *netif)
/* Save size */ /* Save size */
p->tot_len = (u16_t) length; p->tot_len = (u16_t) length;
LINK_STATS_INC(link.recv); LINK_STATS_INC(link.recv);
/* Queue new buffer(s) */
lpc_rx_queue(lpc_enetif->netif);
} }
} }

View File

@ -51,7 +51,7 @@ typedef struct {
osMessageQId id; osMessageQId id;
osMessageQDef_t def; osMessageQDef_t def;
#ifdef CMSIS_OS_RTX #ifdef CMSIS_OS_RTX
uint32_t queue[MB_SIZE]; uint32_t queue[4+MB_SIZE]; /* The +4 is required for RTX OS_MCB overhead. */
#endif #endif
} sys_mbox_t; } sys_mbox_t;

View File

@ -29,14 +29,14 @@
#define LWIP_RAW 0 #define LWIP_RAW 0
#define TCPIP_MBOX_SIZE 6 #define TCPIP_MBOX_SIZE 8
#define DEFAULT_TCP_RECVMBOX_SIZE 6 #define DEFAULT_TCP_RECVMBOX_SIZE 8
#define DEFAULT_UDP_RECVMBOX_SIZE 6 #define DEFAULT_UDP_RECVMBOX_SIZE 8
#define DEFAULT_RAW_RECVMBOX_SIZE 6 #define DEFAULT_RAW_RECVMBOX_SIZE 8
#define DEFAULT_ACCEPTMBOX_SIZE 6 #define DEFAULT_ACCEPTMBOX_SIZE 8
#define TCPIP_THREAD_STACKSIZE 1024 #define TCPIP_THREAD_STACKSIZE 1024
#define TCPIP_THREAD_PRIO 1 #define TCPIP_THREAD_PRIO (osPriorityNormal)
#define DEFAULT_THREAD_STACKSIZE 512 #define DEFAULT_THREAD_STACKSIZE 512