Hi All, I'm using LWIP in mainloop mode (NO OS) with an RX callback as follows below. This is for a Microchip WINC1500 wifi interface module.
My issue is my client (10.0.0.163) issues 2 SYN requests and the LWIP server (10.0.0.122) ACKs only 1. The client then does an HTTP GET, transfers go ok for a bit, and then sequencing goes bad. Any insight as to why this is would be greatly appreciated. Mike Spenard <http://lwip.100.n7.nabble.com/file/t2211/capture-issues.png> [Main loop]------------------------------------- uint8_t ppsys_bsp_network_processor(void) { static bool oldENet_link = 0; uint8_t ret; // WiFi ////////////////////////////////////////////////////////////////// // ATWINC1500 command events if(wifiInteruptEvent == 1) // IRQ signaled { PRINTF(";"); wifiInteruptEvent = 0; ret = m2m_wifi_handle_events(NULL); if(ret != M2M_SUCCESS) PRINTF("[System Event: m2m_wifi_handle_events() ERROR\n\r"); } // TX event if(gotTX) { PRINTF("gotTX=%i\n\r", gotTX); ret = m2m_wifi_send_ethernet_pkt(winc_tx_buf, gotTX); if(ret != M2M_SUCCESS) PRINTF("m2m_wifi_send_ethernet_pkt() error\n\r"); gotTX = 0; } // Handle all system timeouts for all core LWIP protocols sys_check_timeouts(); // HTTPd ////////////////////////////////////////////////////////////// int n; n = mg_mgr_poll(&mgr, 100); // Mongoose poll return 1; } [RX callback]----------------------------------- void winc_netif_rx_callback(uint8 msg_type, void * msg, void *ctrl_buf) { uint16_t sz; uint16_t rem; struct pbuf *p; uint8_t *b; tstrM2mIpCtrlBuf *ctrl = (tstrM2mIpCtrlBuf *)ctrl_buf; if (msg_type == M2M_WIFI_RESP_ETHERNET_RX_PACKET) { sz = ctrl->u16DataSize; rem = ctrl->u16RemainigDataSize; // Friend added this block? if (sz > sizeof(winc_rx_buf)) { PRINTF("WIFI data received, length=%i \n\r", sz); // Reload memory buffer for further incoming packets m2m_wifi_set_receive_buffer(winc_rx_buf, sizeof(winc_rx_buf)); return; } else { PRINTF("WIFI data received2, length=%i \n\r", sz); } if (!winc_rx_first) { winc_rx_first = winc_rx_last = pbuf_alloc(PBUF_RAW, PBUF_POOL_BUFSIZE, PBUF_POOL); if (winc_rx_first == NULL) { LINK_STATS_INC(link.memerr); LINK_STATS_INC(link.drop); m2m_wifi_set_receive_buffer(winc_rx_buf, sizeof(winc_rx_buf)); return; } memcpy(((uint8_t *)winc_rx_first->payload) + ETH_PAD_SIZE, winc_rx_buf, sz); } p = pbuf_alloc(PBUF_RAW, PBUF_POOL_BUFSIZE, PBUF_POOL); if (winc_rx_first == winc_rx_last) { #if ETH_PAD_SIZE sz += ETH_PAD_SIZE; #endif // #if ETH_PAD_SIZE winc_rx_last->tot_len = sz + rem; } winc_rx_last->len = sz; // When packet is complete, send it to the right lwIP interface if (!rem) { if (ERR_OK != winc_netif_sta.input(winc_rx_first, &winc_netif_sta)) { PRINTF("RXcb IN ERR\n\r"); pbuf_free(winc_rx_first); } LINK_STATS_INC(link.recv); winc_rx_first = p; } else { if (!p) { if (winc_rx_first) pbuf_free(winc_rx_first); winc_rx_first = 0; LINK_STATS_INC(link.memerr); LINK_STATS_INC(link.drop); // Reload memory buffer for further incoming packets m2m_wifi_set_receive_buffer(winc_rx_buf, sizeof(winc_rx_buf)); return; } else { p->tot_len = rem; winc_rx_last->next = p; } } winc_rx_last = p; if (winc_rx_first == winc_rx_last) { sz = PBUF_POOL_BUFSIZE - ETH_PAD_SIZE; if (winc_rx_first) { b = ((uint8_t *)p->payload) + ETH_PAD_SIZE; } else { b = winc_rx_buf; } } else { b = p->payload; sz = PBUF_POOL_BUFSIZE; } /* Reload memory buffer for further incoming packets. */ m2m_wifi_set_receive_buffer(b, sz); } } [TX routine] static err_t winc_netif_tx(struct netif *netif, struct pbuf *p) { struct pbuf *q = 0; uint8_t *bufptr = winc_tx_buf; // check for overflow? if(p->tot_len > WINC_TX_BUF_SIZE) { PRINTF("winc_netif_tx() buff overflow\n\r"); return ERR_BUF; } for (q=p;q!=NULL; q=q->next) { memcpy(bufptr,q->payload, q->len); // copy payload into local TX buffer bufptr += q->len; } gotTX=p->tot_len-ETH_PAD_SIZE; return ERR_OK; } -- Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html _______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
