UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor darren
Visitor
246 Views
Registered: ‎12-03-2018

how to extend tcp_write() maximum length in lwip echo server(in sdk)??

hi, I am newbie lwip.

I want to send data of size 0xA000, so I modify lwip echo server example(echo.c ).

as follows

/********************************************************************************************/

err_t recv_callback(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err)
    {
    /* do not read the packet if we are not in ESTABLISHED state */
    if (!p) {
        tcp_close(tpcb);
        tcp_recv(tpcb, NULL);
        return ERR_OK;
    }
   
    /* indicate that the packet has been received */
    tcp_recved(tpcb, p->len);
   
    /* echo back the payload */
    /* in this case, we assume that the payload is < TCP_SND_BUF */
    if (tcp_sndbuf(tpcb) > p->len) {
        //err = tcp_write(tpcb, p->payload, p->len, 1);
        err = tcp_write(tpcb, mem_ptr, 0xA000, 1);
    } else
        xil_printf("no space in tcp_sndbuf\n\r");
   
    /* free the received pbuf */
    pbuf_free(p);
   
    return ERR_OK;
}

/********************************************************************************************/

under 0x500 size, it is well done.

but over the size, called interrupt handler(synchronous abort). lwip don't send anytings.

when I using tcp_debug option, I can see that it stopped in p_buf allocation message.

I think the size of P_buf memory is a problem, how can I fix it?

I was trying to change lwip parameter(tcp_wnd, tcp_snd_buf, tcp_mss, etc), But it was not working.

thank you.

 

0 Kudos