For my port to SYS/BIOS, I have NO_SYS=0 and I'm making sure the netif->input is being called from a thread and not in the interrupt. So I think I'm adhering to the rules of the game in my case. Note: I'll make the change to use netif->input.
My understanding of the NO_SYS=1 case was the same as Tim's. So as long as nothing is done in main() or another interrupt, it should be fine since there are no threads. Todd -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Tim Lambrix Sent: Wednesday, March 16, 2011 10:28 AM To: Mailing list for lwIP users Subject: RE: [lwip-users] tcp_write() errors on snd_queuelen The lwIPTimer() function is called from the system tick interrupt timer. This only increments the global variable g_ulLocalTimer. It appears that the rest of the lwIP processing is all done in the Ethernet interrupt. The interrupt function looks like the following: lwIPEthernetIntHandler(void) { // Read and Clear the interrupt. ulStatus = EthernetIntStatus(ETH_BASE, false); EthernetIntClear(ETH_BASE, ulStatus); // The handling of the interrupt is different based on the use of a RTOS. // No RTOS is being used. If a transmit/receive interrupt was active, // run the low-level interrupt handler. if(ulStatus) { stellarisif_interrupt(&g_sNetIF); } // Service the lwIP timers. lwIPServiceTimers(); } It looks like all the work of the lwip processing, transmitting, and receiving occurs in the function stellarisif_interrupt() which I included below: stellarisif_interrupt(struct netif *netif) { struct stellarisif *stellarisif; struct pbuf *p; /* setup pointer to the if state data */ stellarisif = netif->state; /** * Process the transmit and receive queues as long as there is receive * data available * */ p = stellarisif_receive(netif); while(p != NULL) { /* process the packet */ if(ethernet_input(p, netif)!=ERR_OK) { /* drop the packet */ LWIP_DEBUGF(NETIF_DEBUG, ("stellarisif_input: input error\n")); pbuf_free(p); /* Adjust the link statistics */ LINK_STATS_INC(link.memerr); LINK_STATS_INC(link.drop); } /* Check if TX fifo is empty and packet available */ if((HWREG(ETH_BASE + MAC_O_TR) & MAC_TR_NEWTX) == 0) { p = dequeue_packet(&stellarisif->txq); if(p != NULL) { stellarisif_transmit(netif, p); } } /* Read another packet from the RX fifo */ p = stellarisif_receive(netif); } /* One more check of the transmit queue/fifo */ if((HWREG(ETH_BASE + MAC_O_TR) & MAC_TR_NEWTX) == 0) { p = dequeue_packet(&stellarisif->txq); if(p != NULL) { stellarisif_transmit(netif, p); } } } -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Simon Goldschmidt Sent: Wednesday, March 16, 2011 12:16 PM To: Mailing list for lwIP users Subject: RE: [lwip-users] tcp_write() errors on snd_queuelen If you try to protect tcp_write() against the ETH interrupt by disabling interrupts, that would mean you would have to *always* disable the ETH interrupt while calling into lwIP. That's pretty unperformant, I think. As I already said before, the lwIP way is to prevent the driver calling into lwIP from interrupt context. _______________________________________________ lwip-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users _______________________________________________ lwip-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
