lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] alignment error of 4 bytes alignment


From: ÕÅÔö²¨£¬Nodinfo Technology
Subject: Re: [lwip-users] alignment error of 4 bytes alignment
Date: Wed, 12 Nov 2003 14:53:28 +0800

Çdzç:

        I have encountered this problem and I walked around it.my solution is 
as below:

1.In the ethernet driver,after get the actual length of input packtet in 
argument len,allocate 2 more bytes of pbuf's length:
    p = pbuf_alloc(PBUF_RAW, len+2, PBUF_POOL);
    pbuf_header(p, -2);
2.After 1,in most cases fields in incoming ip packets are 4 bytes alinged.but 
the field sipaddr in struct etharp_hdr is not aligned.(this is the only case 
that not aligned)so I change etharp.c a little to avoid this problem.btw: 
before the definition of struct etharp_hdr,I use #pragma pack(1).

3.In opt.h,#define PBUF_LINK_HLEN 16
4.In function arp_query,resolve the output packet's alignemnt problem in the 
same way as 1.

I hope this may help you.

======= 2003-11-12 13:21:00 you write£º=======

>Dear Sir:
>       lwip's pbuf address's alignment can be set 4 aligned.But after
>    case ETHTYPE_IP:
>    q=etharp_ip_input(netif, p);
>    pbuf_header(p, -14);
>               ~~~~~~~~~~~~~
>    netif->input(p, netif);
>p->payload is not 4 byte aligned now,which generates ip.c,tcp_in.c many 
>alignment error.
>So I wish lwip suport a 14 bytes pbuf chain to left pbufs.every pbuf is 4 
>bytes aligned.
>After pbuf_header(p, -14);,the p->payload change to p->next->payload,which is 
>aligned.
>Now lwip does not support this.
>
>
>                               qiaochong
>address@hidden
>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2003-11-12
>
>
>
>
>
>_______________________________________________
>lwip-users mailing list
>address@hidden
>http://mail.gnu.org/mailman/listinfo/lwip-users

= = = = = = = = = = = = = = = = = = = =
                        
                           Zhangzb,Nodinfo Technology
address@hidden
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2003-11-12








reply via email to

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