lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] RE: [Virtex II Pro] pbuf / DHCP / lwIP upgrade to EDK / upg


From: Arden Llewellyn
Subject: [lwip-users] RE: [Virtex II Pro] pbuf / DHCP / lwIP upgrade to EDK / upgrade to EDK 9.1i (Louis Filasky)
Date: Fri, 15 Jun 2007 10:13:35 -0700 (PDT)

I am trying to port LWIP 1.2.0 (CVS Head from a day ago) to a Xilinx V2Pro FPGA (with PPC405).  EDK 9.1 is my IDE.  I am using the Xilinx Micro Kernel for the OS and am running in SOCKET_API mode attempting to do TCP/IP.  So far, I have been able to get things to build and run, but as soon as any messages come into my server (ICMP ping, or connection requests) the system crashes.  It seems to have something to do with my pbufs, but I don't understand what the problem is.  I turned on LWIP debug, below are some snippets from a run... 

********************(Initialization snippet)*********************

Calling tcpip_init
sysys_timeout: xemacif_pkts_timeout: 00x270394 msec_process_thrx270394 mses=1000
 h=0x1fead created cs=1000 h=077c arg=0x0

x1f73c arg=sys_timeout: 0x0
0x270384 msecs=5000 h=0x1f73c arg=0x0
D- NO_SYS == 0
netif_set_ipaddr: netif address being changed
netif: IP address of interface  set to 151.190.95.120
netif: netmask of interface  set to 255.255.255.0
netif: GW address of interface  set to 0.0.0.0
netif: added interface e0 IP addr 151.190.95.120 netmask 255.255.255.0 gw 0.0.0.
0
netif: setting default interface e0
tcpip_thread: API message 0x2f4a84
lwip_socket(PF_INET, SOCK_STREAM, 0) = 0
lwip_bind(0, addr=151.190.95.120 port=10001)
tcpip_thread: API message 0x2f4a7c
tcp_bind: bind to port 10001
lwip_bind(0) succeeded
lwip_listen(0, backlog=5)
tcpip_thread: API message 0x2f4a9c
I- SOCKET: Accepting a new connection...
lwip_accept(0)...
smf calling h=0x1f77c(0x0)
tcpip: ip_reass_tmr()
sys_timeout: 0x270394 msecs=1000 h=0x1f77c arg=0x0
smf calling h=0x1f77c(0x0)
tcpip: ip_reass_tmr()
sys_timeout: 0x270394 msecs=1000 h=0x1f77c arg=0x0
smf calling h=0x1f77c(0x0)
tcpip: ip_reass_tm
sys_timeout: 0x270394 msecs=1000 h=0x1f77c arg=0x0

**********************(incoming ip_input, then the code just stops running snippet)*******************************

sys_timeout: 0x270394 msecs=1000 h=0x1f77c arg=0x0
pbuf_alloc(length=78)
pbuf_alloc: allocated pbuf 0x270154
pbuf_alloc(length=78) == 0x270154
pbuf_header: old 0x270164 new 0x270172 (-14)
tcpip_thread: IP packet 0x1aa264
ip_input: iphdr->dest 0x97be5f78 netif->ip_addr 0x97be5f78 (0x97be5f00, 0x97be5f
00, 0x78)
ip_input: packet accepted on interface e0
ip_input:
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |        60     | (v, hl, tos, len)
+-------------------------------+
|    27719      |000|       0   | (id, flags, offset)
+-------------------------------+
|  128  |    1  |    0xe079     | (ttl, proto, chksum)
+-------------------------------+
|  151  |  190  |   95  |   11  | (src)
+-------------------------------+
|  151  |  190  |   95  |  120  | (dest)
+-------------------------------+
ip_input: p->len 60 p->tot_len 60
pbuf_header: old 0x270172 new 0x270186 (-20)
icmp_input: ping
pbuf_header: failed as 0x270162 < 0x270164 (not enough space for new header size
)
pbuf_header: old 0x270186 new 0x270172 (20)
pbuf_alloc(length=60)
pbuf_alloc(length=60) == 0x19dacc
pbuf_copy(0x19dacc, 0x270154)
pbuf_copy: end of chain reached.
pbuf_header: old 0x19daec new 0x19db00 (-20)
pbuf_free(0x270154)
pbuf_free: deallocating 0x270154
pbuf_header: old 0x19db00 new 0x19daec (20)
ip_output_if: e00
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |        60     | (v, hl, tos, len)
+-------------------------------+
|    27719      |000|       0   | (id, flags, offset)
+-------------------------------+
|  128  |    1  |    0xe079     | (ttl, proto, chksum)
+-------------------------------+
|  151  |  190  |   95  |  120  | (src)
+-------------------------------+
|  151  |  190  |   95  |   11  | (dest)
+-------------------------------+

***********************************(end snippets)**************************************************

I am not sure what to do at this point.  I have seen another post similar to this one, but I think it was talking about running on a 16 bit processor and there were problems with memory alignment.  Any help would be appreciated. 


Arden


----- Original Message ----
From: "address@hidden" <address@hidden>
To: address@hidden
Sent: Friday, June 15, 2007 12:00:04 PM
Subject: lwip-users Digest, Vol 46, Issue 20

Send lwip-users mailing list submissions to
    address@hidden

To subscribe or unsubscribe via the World Wide Web, visit
    http://lists.nongnu.org/mailman/listinfo/lwip-users
or, via email, send a message with subject or body 'help' to
    address@hidden

You can reach the person managing the list at
    address@hidden

When replying, please edit your Subject line so it is more specific
than "Re: Contents of lwip-users digest..."


Today's Topics:

   1. Re: tcp_output_segment() "silly window avoidance"    shrinking
      the window is "strongly discouraged" and "SHOULD NOT"?
      (Kieran Mansley)
   2. New in lwIP (Angel Sanchez)
   3. RE: [Virtex II Pro] pbuf / DHCP / lwIP upgrade to    1.2.0 in
      EDK / upgrade to EDK 9.1i (Louis Filasky)


----------------------------------------------------------------------

Message: 1
Date: Fri, 15 Jun 2007 09:41:34 +0100
From: Kieran Mansley <address@hidden>
Subject: Re: [lwip-users] tcp_output_segment() "silly window
    avoidance"    shrinking the window is "strongly discouraged" and "SHOULD
    NOT"?
To: Mailing list for lwIP users <address@hidden>
Message-ID: <address@hidden>
Content-Type: text/plain

On Fri, 2007-06-15 at 18:17 +1000, Tom Evans wrote:
> This may be a bug. I'd be interested in other opinions. If anyone has a
> copy of "TCP Illustrated" it may be worth checking this in there.

> The window should only shrink "naturally" (because of incoming data).
> SWS Avoidance delays the window OPENING until it can be opened EITHER to
> the MSS or to half of the receive buffer size. The lwIP code is only
> performing the former comparison.

Looks like a bug to me.  Could you file a bug report on savannah?

> The second (obvious) problem would happen if someone did the following
> in lwipopts.h while trying to save memory or buffers:
>
>     /* TCP Maximum segment size. */
>     #define TCP_MSS                 512
>     /* TCP receive window. */
>     #define TCP_WND                 500

I'd call that a mis-configuration.  It should probably be documented
however.

Kieran





------------------------------

Message: 2
Date: Fri, 15 Jun 2007 13:21:29 +0200
From: "Angel Sanchez" <address@hidden>
Subject: [lwip-users] New in lwIP
To: <address@hidden>
Message-ID: <address@hidden>
Content-Type: text/plain; charset="iso-8859-1"

I am new in the lwIP. After read the doccumentation, I dont understand the use of threads in lwIP.

As i can see, there are a trhead used by the internal messages dispatcher, so, I assume that openning several sockets i can spect to receive
ans send the messages concurrently (of course I have a thread in my application for the maintenance of each socket)

I thinks that this is corret, so. In what scenario i need open more thread associates to lwIP (with 'sys_thread_create')

Thanks in advance for your help


Best regards

Angel Sanchez Pelegrin

AUMAT SL
Tlf/Fax: 91 359 02 27
Movil: 676 965 960
Colombia 53 Local
28016 MADRID
address@hidden
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.gnu.org/pipermail/lwip-users/attachments/20070615/8e91c74c/attachment.html

------------------------------

Message: 3
Date: Fri, 15 Jun 2007 17:53:17 +0200
From: Louis Filasky <address@hidden>
Subject: RE: [lwip-users] [Virtex II Pro] pbuf / DHCP / lwIP upgrade
    to    1.2.0 in EDK / upgrade to EDK 9.1i
To: <address@hidden>
Message-ID: <address@hidden>
Content-Type: text/plain; charset="iso-8859-1"

>Hi!>>you say > >3/ Our main interrest with LwIP was to use DHCP. By reading the dhcp.cfi>le, it says the following things: >   - change LWIP_DHCP to 1 in lwipopts.h which is in the port>directory. >   - change value of DHCP_COARSE_TMR and another one so that the first>one is called every 60s and the other 500ms.>    - then call the respective functions for these values and call>dhcp_start(struct netif); >>that sounds that somehow your dhcp code isn't built or something>similar. I had the same problem, but in may case it was the LWIP_DHCP>define. Are you sure you "updated" your projekt so that after a change>in your projekt all c files are recompiled with the different define in>the .h files? with GCC you have to do a make clean that such changes are>done..>Or maybe you forgot to add the dhcp.c file to your Makefile or what is>the equivalent in your compiler?> >Dominik

Thank you dominik for your answer. Actually I solved this, I had missed a couple of makefiles, I thought I got them all but it was not the case.
Now, everything is compiliing fine but then the dhcp is not working.

I will copy paste my code where I start the initialization of the dhcp using dhcp_start() if you could tell me if that is correct. Then also, my timer if somehow how you can call these dhcp_finetmr or dhcp_coarse function every 60s or 500ms because I played a lot with the timer and could't figure out
how to do it precisely.

Thank you very much again,

struct ip_addr ipaddr;
struct ip_addr netmask;
struct ip_addr gw;
struct netif *netif = NULL;
//Set the MAC address:
xemacliteif_setmac(0, (u8_t *)mac);
//Set IP address, Network mask and gateway:
IP4_ADDR(&ipaddr, ip[0], ip[1], ip[2], ip[3]);
IP4_ADDR(&netmask, subnet[0], subnet[1], subnet[2], subnet[3]);
IP4_ADDR(&gw, gateway[0], gateway[1], gateway[2], gateway[3]);
//Allocate memory for the netif strycture:
netif = mem_malloc(sizeof(struct netif));
if(NULL == netif) {
print("mem_alloc(): echec.\n\r");
return NULL;
}
//Instanciate the new netif structure with given parameters:
netif = netif_add(netif, &ipaddr, &netmask, &gw, &XEmacLiteIf_ConfigTable[EMAC], xemacliteif_init, ip_input);
if(NULL == netif) {
print("netif_add(): failed.\n\r");
return NULL;
}
//Set the new netif as default netif:
netif_set_default(netif);
dhcp_start(netif);

As for the timer(very rough for now):
I know dhcp_fine_tmr is said to be called every 5ms but in the xilinx doc, they say they call should be called
every 200ms and 500ms and in theyre tmr function of the echo example (which is my basis), they say there are
called every 2ms and 5ms:

void my_tmr(void)
{
++my_timer;
++my_timer2;

if(my_timer == 10) {
my_timer = 0;
}

if(my_timer2 >= 200) {
dhcp_coarse_tmr();
}
if(my_timer & 1) {
/* Call tcp_fasttmr() every 2 ms, i.e.,
* every other timer my_tmr() is called. */
tcp_fasttmr();
}
if(my_timer == 0 || my_timer == 5) {
/* Call tcp_slowtmr() every 5 ms, i.e.,
* every fifth timer my_tmr() is called. */
tcp_slowtmr();
dhcp_fine_tmr();

if (tcp_ticks%2000 == 0)
/* Call etharp_tmr() every 20th call to tcp_slowtmr().
* tcp_ticks is a global var defined in core/tcp.c */
etharp_tmr();
}
}


Antoine.
_________________________________________________________________
Windows Live Messenger vous offre 30 nouvelles émoticônes gratuites, installées directement dans votre Messenger !
http://www.emoticones-messenger.fr/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.gnu.org/pipermail/lwip-users/attachments/20070615/708b0816/attachment.html

------------------------------

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

End of lwip-users Digest, Vol 46, Issue 20
******************************************


reply via email to

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