lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Fw: (no subject)


From: Anirudha Sarangi
Subject: Re: [lwip-users] Fw: (no subject)
Date: Fri, 28 Oct 2011 16:12:27 +0800 (SGT)

Hi Kieran and Simon,
I was on a long vacation and so was not working on lwip for a long time.
Before I go into the performance number discussions on Txperf (my board sending iperf packets to the PC host on which I am running iperf server), I would like to discuss something else.
 
Lately I have found out that my Txperf is not very stable. This is for both lwip 130 and lwip140.
Problem is seen for raw API mode. My txperf implementation is very simple and is attached at the bottom of this email..
 
I keep calling the function txperf_sent_callback from a while(1) loop to send packets continuously.
 
What happens is after a while my application stops sending packets. I debugged and found out that packets are not being sent because tcp_sndbuf(tpcb) falls below 1400 bytes (my set limit) permanently and never increases further. Hence my application never sends packets.
 
My TCP related hashdefines in lwipopts.h are:
 
#define LWIP_TCP 1
#define TCP_MSS 1460
#define TCP_SND_BUF 8192
#define TCP_WND 8192
#define TCP_TTL 255
#define TCP_MAXRTX 12
#define TCP_SYNMAXRTX 4
#define TCP_QUEUE_OOSEQ 1
#define TCP_SND_QUEUELEN   16 * TCP_SND_BUF/TCP_MSS
 
My tcp_tmr is called every 250 msec. So timers are not an issue.
I ran ethereal and below is a small snapshot of ethereal log (for last few packets). As you see, the problem occurs when my board does a retransmission. This happens everytime. The board does a retransmission and after that it just stops sending any more packets. My board is not dead, it is just that tcp_sndbuf(tpcb) never again goes above 1400.
 
My board IP is 192.168.1.10 and host Windows XP PC IP is 192.168.1.100.
 
The ethreal log is:
343550  32.836451 192.168.1.100    192.168.1.10  TCP  5001 > 49153 [ACK]  Seq = 1 Ack=481840413 win=32850 Len=0
343551  32.836475  192.168.1.10     192.168.1.100 TCP 49153 > 5001 [PSH, ACK] Seq=481840413 Ack=1 win=8192 Len=1446
343552  32.836639  192.168.1.10     192.168.1.100 TCP 49153 > 5001 [PSH, ACK] Seq=481841859 Ack=1 win=8192 Len=1446
343553  32.836668  192.168.1.100   192.168.1.10  TCP 5001 > 49153 [ACK] Seq = 1 Ack=481843305 win=32850 Len=0
343554  32.836691  192.168.1.10    192.168.1.100 TCP 49153 > 5001 [PSH, ACK] Seq = 481843305 Ack=1 win = 8192 Len = 1446
343555  32.836711  192.168.1.10    192.168.1.100 TCP [TCP Retransmission] 49153 > 5001 [PSH, ACK] Seq = 481843305 Ack=1 win=8182 Len = 1446
343556  32.836722  192.168.1.100  192.168.1.10 TCP 5001 > 49153 [ACK] Seq = 1 Ack = 481844751 win=32488 Len = 0
343557  45.209061  192.168.1.100 192.168.1.10 TCP 5001 > 49153 [RST, ACK] Seq = 1 Ack=481844751 win=0 Len=0  
 
Similar log is seen everytime I try it. There is TCP Retransmission from my board and that is the last packet it sends. After this tcp_sndbuf(tpcb) permanently falls below 1400.
 
I am not sure what I am missing. Hence below is the code that implements the iperf client on my board.
Do I need to do anything in the callback that I register with tcp_sent.Currently I do nothing. Is that the issue?
 
regards
Anirudha
 
static struct tcp_pcb *connected_pcb = NULL;
#define SEND_BUFSIZE (1400)
static char send_buf[SEND_BUFSIZE];
static unsigned txperf_client_connected = 0;
 
int transfer_txperf_data()
{
 int copy = 0;
 err_t err;
 struct tcp_pcb *tpcb = connected_pcb;
 if (!connected_pcb)
  return ERR_OK;
 while (tcp_sndbuf(tpcb) > SEND_BUFSIZE) {
  err = tcp_write(tpcb, send_buf, SEND_BUFSIZE, copy);
  if (err != ERR_OK) {
   xil_printf("txperf: Error on tcp_write: %d\r\n", err);
                        connected_pcb = NULL;
   return -1;
  }
  err = tcp_output(tpcb);
  if (err != ERR_OK) {
   xil_printf("txperf: Error on tcp_output: %d\r\n",err);
  }
 }
 return 0;
}
static err_t
txperf_sent_callback(void *arg, struct tcp_pcb *tpcb, u16_t len)
{
 return ERR_OK;
}
static err_t
txperf_connected_callback(void *arg, struct tcp_pcb *tpcb, err_t err)
{
 xil_printf("txperf: Connected to iperf server\r\n");
        txperf_client_connected = 1;
 /* store state */
 connected_pcb = tpcb;
 /* set callback values & functions */
 tcp_arg(tpcb, NULL);
 tcp_sent(tpcb, txperf_sent_callback);
 /* initiate data transfer */
 return ERR_OK;
}
int
start_txperf_application()
{
 struct tcp_pcb *pcb;
 struct ip_addr ipaddr;
 err_t err;
 u16_t port;
 int i;
 /* create new TCP PCB structure */
 pcb = tcp_new();
 if (!pcb) {
  xil_printf("txperf: Error creating PCB. Out of Memory\r\n");
  return -1;
 }
 /* connect to iperf server */
 IP4_ADDR(&ipaddr,  192, 168,   1, 100);  /* iperf server address */
 port = 5001;     /* iperf default port */
 err = tcp_connect(pcb, &ipaddr, port, txperf_connected_callback);
        txperf_client_connected = 0;
 if (err != ERR_OK) {
  xil_printf("txperf: tcp_connect returned error: %d\r\n", err);
  return err;
 }
 /* initialize data buffer being sent */
 for (i = 0; i < SEND_BUFSIZE; i++)
  send_buf[i] = (i % 10) + '0';
 return 0;
}
 
I keep calling the function
From: "address@hidden" <address@hidden>
To: Mailing list for lwIP users <address@hidden>
Sent: Friday, 30 September 2011 12:37 AM
Subject: Re: [lwip-users] Fw: (no subject)

FreeRTOS Info wrote:
> Could you please provide details of what you changed.
Good idea, could you please provide your lwipopts.h for both versions?
Maybe we can see anything from that. I'd like to measure performance on
my hardware using these 2 versions + configs.

Also, which API are you using? Sockets, netconn or raw API?

Simon

>
>
> Regards,
> Richard.
>
> + http://www.FreeRTOS.org
> Designed for Microcontrollers.
> More than 7000 downloads per month.
>
>
>
>
> On 29/09/2011 07:29, Anirudha Sarangi wrote:
>> Hi Kieran,
>> I was playing with some of the new parameters that are added in lwip140.
>> I got good improvement in numbers.
>> The numbers improved from around 66 MB to 82 MB.
>>
>> With the same hardware and same application files (compiler options are
>> also same), lwip130 gives me a number of 92-93 MB for txperf and lwip140
>> gives me a number of 82 MB. There is still a difference of 10 MB.
>>
>> I want to send you the pcap files for both. Old as well as new lwip. But
>> not sure how. The pcap files are quite large.
>>
>> Is there anyway I could send them to you? Alternate mail id or something?
>>
>> regards
>> Anirudha
>>
>> *From:* Kieran Mansley<address@hidden>
>> *To:* Mailing list for lwIP users<address@hidden>
>> *Sent:* Wednesday, 28 September 2011 5:04 PM
>> *Subject:* Re: [lwip-users] Fw: (no subject)
>>
>>
>> On 28 Sep 2011, at 12:15, Anirudha Sarangi wrote:
>>
>>> Hi Kieren,
>>> Do you mean capturing the packets in wireshark and sending you the log?
>> Exactly.  Please send the pcap file, not just the textual log.
>>
>> Kieran
>>
>> _______________________________________________
>> lwip-users mailing list
>> address@hidden<mailto:address@hidden>
>> https://lists.nongnu.org/mailman/listinfo/lwip-users
>>
>>
>>
>>
>> _______________________________________________
>> lwip-users mailing list
>> address@hidden
>> https://lists.nongnu.org/mailman/listinfo/lwip-users
> _______________________________________________
> lwip-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>


_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users



reply via email to

[Prev in Thread] Current Thread [Next in Thread]