avoid mailbox overflow by sending a polling request to the tcpip thread
This commit is contained in:
parent
a7e57811ac
commit
ccd13db67e
1 changed files with 20 additions and 9 deletions
|
@ -347,15 +347,18 @@ static void rckemacif_input(struct netif* netif, struct pbuf* p)
|
|||
case ETHTYPE_PPPOEDISC:
|
||||
case ETHTYPE_PPPOE:
|
||||
#endif /* PPPOE_SUPPORT */
|
||||
/* full packet send to tcpip_thread to process */
|
||||
if ((err = mynetif->input(p, mynetif)) != ERR_OK) {
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("rckemacif_input: IP input error %d\n", (int32_t) err));
|
||||
pbuf_free_callback(p);
|
||||
/*
|
||||
* This function is called in the context of the tcpip thread.
|
||||
* Therefore, we are able to call directly the oinput functions
|
||||
*/
|
||||
err = ethernet_input(p, netif);
|
||||
if (err != ERR_OK) {
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("rckemacif_input: ethernet_input failed %d\n", err));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("rckemacif_input: invalid ethernet header: 0x%x\n", htons(ethhdr->type)));
|
||||
pbuf_free_callback(p);
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("rckemacif_input: invalid ethernet header 0x%x\n", htons(ethhdr->type)));
|
||||
pbuf_free(p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -500,6 +503,14 @@ rxDone:
|
|||
goto again;
|
||||
}
|
||||
|
||||
/* this function is called in the context of the tcpip thread */
|
||||
static void rckemacif_poll(void* ctx)
|
||||
{
|
||||
unsigned int write_offset = (unsigned int) ctx;
|
||||
|
||||
rckemacif_rx_handler(mynetif, write_offset);
|
||||
}
|
||||
|
||||
static void rckemacif_handler(struct state* s)
|
||||
{
|
||||
unsigned int status, tmp;
|
||||
|
@ -514,13 +525,13 @@ static void rckemacif_handler(struct state* s)
|
|||
return;
|
||||
}
|
||||
|
||||
nexttry:
|
||||
/* check for updated write offset */
|
||||
write_offset = *((volatile unsigned int*) (rckemacif->rx_buffer)) & 0xFFFF;
|
||||
//write_offset = read_emac(rckemacif->num_emac, EMAC_RX_CONTROL + EMAC_RX_BUFFER_WRITE_OFFSET, rckemacif->core);
|
||||
if ((write_offset != 0) && (rckemacif->rx_read_offset != write_offset)) {
|
||||
rckemacif_rx_handler(mynetif, write_offset);
|
||||
goto nexttry;
|
||||
if (tcpip_callback_with_block(rckemacif_poll, (void*) write_offset, 0) != ERR_OK) {
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("rckemacif_handler: unable to send a poll request to the tcpip thread\n"));
|
||||
}
|
||||
}
|
||||
|
||||
/* Set interrupt bit */
|
||||
|
|
Loading…
Add table
Reference in a new issue