[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [lwip-users] IP Address Display Functions
From: |
Bill Auerbach |
Subject: |
RE: [lwip-users] IP Address Display Functions |
Date: |
Mon, 24 Aug 2009 14:58:59 -0400 |
>From: address@hidden
>[mailto:address@hidden On
>Behalf Of Chris Strahm
>Sent: Monday, August 24, 2009 5:33 AM
>To: Mailing list for lwIP users
>Subject: [lwip-users] IP Address Display Functions
>
>However the "netadr.ip" value here contains a "struct ip_addr".
>Since they are not the same, all the above type casting is done
>to force it to work. This causes a warning everywhere from GCC
>about alignment etc.
I'd like to add that the packing around struct ip_addr is also unnecessary.
Although it seems benign, it's not. My version of GCC (NIOS) treats this
packed struct as char array and does 4 byte loads, ANDs, shifts, and ORs
everywhere this stuct was used. I simply use:
struct ip_addr {
u32_t addr;
};
If there was a reason for the packing, I don't see it. If it's used within
another struct, the packing of the outer struct defines the behavior. On
the NIOS GCC build, this was one of the 3 non-code-changing optimizations I
made that had a noticeable effect on bandwidth and codesize of both UDP and
TCP. I think this has to be because the ip_addr struct is so heavily used.
I recommend the patch above. If there's an argument that packing is
required for a single member struct, I'm interesting seeing the reason or
proof that it's required.
Bill
- [lwip-users] Possible deadlock in LWIP 1.3.1 RC1, Eran Rundstein, 2009/08/23
- Re: [lwip-users] Possible deadlock in LWIP 1.3.1 RC1, Kieran Mansley, 2009/08/24
- RE: [lwip-users] IP Address Display Functions, Kieran Mansley, 2009/08/25
- RE: [lwip-users] IP Address Display Functions, Kieran Mansley, 2009/08/25
- RE: [lwip-users] IP Address Display Functions, Kieran Mansley, 2009/08/25
- [lwip-users] Re: IP Address Display Functions, Jakob Stoklund Olesen, 2009/08/25
- RE: [lwip-users] Re: IP Address Display Functions, Bill Auerbach, 2009/08/25
- Re: [lwip-users] Re: IP Address Display Functions, address@hidden, 2009/08/25
- Re: [lwip-users] Re: IP Address Display Functions, address@hidden, 2009/08/25