Skip to content

Updates to network code to improve performance/robustness #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 15, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions libraries/net/eth/lwip-eth/arch/lpc17_emac.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,20 +424,38 @@ static struct pbuf *lpc_low_level_input(struct netif *netif)
p = lpc_enetif->rxb[idx];
p->len = (u16_t) length;

/* Free pbuf from desriptor */
/* Free pbuf from descriptor */
lpc_enetif->rxb[idx] = NULL;
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,
("lpc_low_level_input: Packet received: %p, size %d (index=%d)\n",
p, length, idx));

/* Save size */
p->tot_len = (u16_t) length;
LINK_STATS_INC(link.recv);

/* Queue new buffer(s) */
lpc_rx_queue(lpc_enetif->netif);
}
}

Expand Down
2 changes: 1 addition & 1 deletion libraries/net/lwip/lwip-sys/arch/sys_arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ typedef struct {
osMessageQId id;
osMessageQDef_t def;
#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
} sys_mbox_t;

Expand Down
12 changes: 6 additions & 6 deletions libraries/net/lwip/lwip/lwipopts.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@

#define LWIP_RAW 0

#define TCPIP_MBOX_SIZE 6
#define DEFAULT_TCP_RECVMBOX_SIZE 6
#define DEFAULT_UDP_RECVMBOX_SIZE 6
#define DEFAULT_RAW_RECVMBOX_SIZE 6
#define DEFAULT_ACCEPTMBOX_SIZE 6
#define TCPIP_MBOX_SIZE 8
#define DEFAULT_TCP_RECVMBOX_SIZE 8
#define DEFAULT_UDP_RECVMBOX_SIZE 8
#define DEFAULT_RAW_RECVMBOX_SIZE 8
#define DEFAULT_ACCEPTMBOX_SIZE 8

#define TCPIP_THREAD_STACKSIZE 1024
#define TCPIP_THREAD_PRIO 1
#define TCPIP_THREAD_PRIO (osPriorityNormal)

#define DEFAULT_THREAD_STACKSIZE 512

Expand Down