lwip-devel
[Top][All Lists]
Advanced

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

RE: [lwip-devel] byte order, packing, optimizations


From: Stéphane Lesage
Subject: RE: [lwip-devel] byte order, packing, optimizations
Date: Sun, 14 Feb 2010 00:14:01 +0100
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)



> Yeah, that could be improved, but I'm an opponent of adding
> warnings where we only give a hint to optimization: the code
> as it is works perfectly well - on platforms where
> performance isn't the main goal, there's no need to issue a
> warning! Also, not everyone has the possibility to generate a
> LWIP_PLATFORM_BYTESWAP macro that is really faster than the
> default C code we have.

ok

> About set_errno? What?

that the user can provide it or LwIP will provide a default implementation with a global variable that is not thread-safe.
And that LwIP can also provide only error code definitions.

Here is another patch to remove struct packing for dns_query and dns_answer in dns.c, which is not needed since we memcpy them.





Index: dns.c
===================================================================
RCS file: /sources/lwip/lwip/src/core/dns.c,v
retrieving revision 1.37
diff -u -r1.37 dns.c
--- dns.c       13 Feb 2010 14:51:46 -0000      1.37
+++ dns.c       13 Feb 2010 22:54:18 -0000
@@ -141,40 +141,24 @@
 #endif
 #define SIZEOF_DNS_HDR 12
 
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/bpstruct.h"
-#endif
-PACK_STRUCT_BEGIN
 /** DNS query message structure */
 struct dns_query {
   /* DNS query record starts with either a domain name or a pointer
      to a name already present somewhere in the packet. */
-  PACK_STRUCT_FIELD(u16_t type);
-  PACK_STRUCT_FIELD(u16_t cls);
-} PACK_STRUCT_STRUCT;
-PACK_STRUCT_END
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/epstruct.h"
-#endif
+  u16_t type;
+  u16_t cls;
+};
 #define SIZEOF_DNS_QUERY 4
 
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/bpstruct.h"
-#endif
-PACK_STRUCT_BEGIN
 /** DNS answer message structure */
 struct dns_answer {
   /* DNS answer record starts with either a domain name or a pointer
      to a name already present somewhere in the packet. */
-  PACK_STRUCT_FIELD(u16_t type);
-  PACK_STRUCT_FIELD(u16_t cls);
-  PACK_STRUCT_FIELD(u32_t ttl);
-  PACK_STRUCT_FIELD(u16_t len);
-} PACK_STRUCT_STRUCT;
-PACK_STRUCT_END
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/epstruct.h"
-#endif
+  u16_t type;
+  u16_t cls;
+  u32_t ttl;
+  u16_t len;
+};
 #define SIZEOF_DNS_ANSWER 10
 
 /** DNS table entry */

reply via email to

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