IP frag/reassembly

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

IP frag/reassembly

Jonathan Larmour
Is there any reason why it wouldn't be possible to eliminate the MTU sized
buffer used by ip_frag.c? It seems to me that it would not be hard to
create a chain of pbufs of type PBUF_REF which have the payload pointing
directly into the payloads of the pbuf chain being sent. If no-one sees any
reason why this wouldn't work, I'll put this on my todo list, and I might
be able to do it in the context of my current project.

Secondly the configurability of ip_frag.c isn't great. I think both MAX_MTU
and IP_REASS_BUFSIZE are important values which should be settable options
from lwipopts.h - ip_frag.c takes 7374 bytes of RAM in total, ouch. While
we're there, there's also less important options such as IP_REASS_MAXAGE
and IP_REASS_TMO.

It's a simple enough patch for the latter. Do I just send patches here? I
should have more patches to come in due course.

Jifl
--
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
------["The best things in life aren't things."]------      Opinions==mine



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: IP frag/reassembly

Christiaan Simons
Hi Jonathan,

> Secondly the configurability of ip_frag.c isn't great. I think both
MAX_MTU
> and IP_REASS_BUFSIZE are important values which should be settable
options
> from lwipopts.h - ip_frag.c takes 7374 bytes of RAM in total, ouch.

ip_frag.c isn't great, espc I would like to see multiple datagram
reassembly,
maybe with a user configurable limit. I suspect some latent bugs as well:
http://savannah.nongnu.org/bugs/?15659

>While
> we're there, there's also less important options such as IP_REASS_MAXAGE
> and IP_REASS_TMO.

Hmm, not sure they're not important. Depends on your error rates
and tx/rx delays which might need some tuning. Maybe these can be merged
into just 1 define.

> It's a simple enough patch for the latter. Do I just send patches here? I

> should have more patches to come in due course.

Please send it to the lwIP savannah patch manager.
http://savannah.nongnu.org/patch/?group=lwip

They may be lost in the noise on this list.

Tnx,
Christiaan Simons

Hardware Designer
Axon Digital Design

http://www.axon.tv



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: IP frag/reassembly

Kieran Mansley
On Thu, 2006-10-26 at 15:01 +0200, Christiaan Simons wrote:

> Please send it to the lwIP savannah patch manager.
> http://savannah.nongnu.org/patch/?group=lwip
>
> They may be lost in the noise on this list.

Worth CC'ing the list too as there will be a much wider audience here
that might have opinions on the patch.

Kieran



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: IP frag/reassembly

Jonathan Larmour
Kieran Mansley wrote:
> On Thu, 2006-10-26 at 15:01 +0200, Christiaan Simons wrote:
>
>> Please send it to the lwIP savannah patch manager.
>> http://savannah.nongnu.org/patch/?group=lwip
>>
>> They may be lost in the noise on this list.

Of course, yes. Done.

> Worth CC'ing the list too as there will be a much wider audience here
> that might have opinions on the patch.

OK, attached. It turns out that nothing uses IP_REASS_TMO (which was
renamed at some point to IP_REASS_INTERVAL).

Jifl
--
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
------["The best things in life aren't things."]------      Opinions==mine


Index: CHANGELOG
===================================================================
RCS file: /sources/lwip/lwip/CHANGELOG,v
retrieving revision 1.49
diff -u -5 -p -r1.49 CHANGELOG
--- CHANGELOG 11 Oct 2006 12:04:04 -0000 1.49
+++ CHANGELOG 26 Oct 2006 13:23:21 -0000
@@ -25,10 +25,17 @@ HISTORY
 
   * [Enter new changes just after this line - do not remove this line]
 
   ++ New features:
 
+  2006-10-26 Jonathan Larmour
+  * src/core/ipv4/ip_frag.c: rename MAX_MTU to IP_FRAG_MAX_MTU and move define
+    to include/lwip/opt.h.
+  * include/ipv4/lwip/ip_frag.h: Remove unused IP_REASS_INTERVAL.
+    Move IP_REASS_MAXAGE and IP_REASS_BUFSIZE to include/lwip/opt.h.
+  * include/lwip/opt.h: Add above new options.
+  
   2006-08-18 Christiaan Simons
   * tcp_{in,out}.c: added SNMP counters.
   * ipv4/ip.c: added SNMP counters.
   * ipv4/ip_frag.c: added SNMP counters.
 
Index: src/core/ipv4/ip_frag.c
===================================================================
RCS file: /sources/lwip/lwip/src/core/ipv4/ip_frag.c,v
retrieving revision 1.23
diff -u -5 -p -r1.23 ip_frag.c
--- src/core/ipv4/ip_frag.c 11 Aug 2006 14:12:05 -0000 1.23
+++ src/core/ipv4/ip_frag.c 26 Oct 2006 13:23:21 -0000
@@ -296,12 +296,11 @@ nullreturn:
   IPFRAG_STATS_INC(ip_frag.drop);
   pbuf_free(p);
   return NULL;
 }
 
-#define MAX_MTU 1500
-static u8_t buf[MEM_ALIGN_SIZE(MAX_MTU)];
+static u8_t buf[MEM_ALIGN_SIZE(IP_FRAG_MAX_MTU)];
 
 /**
  * Fragment an IP datagram if too large for the netif.
  *
  * Chop the datagram in MTU sized chunks and send them in order
Index: src/include/ipv4/lwip/ip_frag.h
===================================================================
RCS file: /sources/lwip/lwip/src/include/ipv4/lwip/ip_frag.h,v
retrieving revision 1.6
diff -u -5 -p -r1.6 ip_frag.h
--- src/include/ipv4/lwip/ip_frag.h 11 Aug 2006 14:12:05 -0000 1.6
+++ src/include/ipv4/lwip/ip_frag.h 26 Oct 2006 13:23:21 -0000
@@ -37,23 +37,10 @@
 #include "lwip/err.h"
 #include "lwip/pbuf.h"
 #include "lwip/netif.h"
 #include "lwip/ip_addr.h"
 
-/* IP reassemly timer interval in milliseconds */
-#define IP_REASS_INTERVAL 1000
-
-/* IP reassemly default age in seconds */
-#ifndef IP_REASS_MAXAGE
-#define IP_REASS_MAXAGE 3
-#endif
-
-/* IP reassembly buffer size (minus IP header) */
-#ifndef IP_REASS_BUFSIZE
-#define IP_REASS_BUFSIZE 5760
-#endif
-
 void ip_frag_init(void);
 void ip_reass_tmr(void);
 struct pbuf * ip_reass(struct pbuf *p);
 err_t ip_frag(struct pbuf *p, struct netif *netif, struct ip_addr *dest);
 
Index: src/include/lwip/opt.h
===================================================================
RCS file: /sources/lwip/lwip/src/include/lwip/opt.h,v
retrieving revision 1.37
diff -u -5 -p -r1.37 opt.h
--- src/include/lwip/opt.h 20 Sep 2006 13:33:51 -0000 1.37
+++ src/include/lwip/opt.h 26 Oct 2006 13:23:21 -0000
@@ -209,15 +209,30 @@ a lot of data that needs to be copied, t
 /** Reassemble incoming fragmented IP packets */
 #ifndef IP_REASSEMBLY
 #define IP_REASSEMBLY                   1
 #endif
 
+/* IP reassembly default age in seconds */
+#ifndef IP_REASS_MAXAGE
+#define IP_REASS_MAXAGE 3
+#endif
+
+/* IP reassembly buffer size (minus IP header) */
+#ifndef IP_REASS_BUFSIZE
+#define IP_REASS_BUFSIZE 5760
+#endif
+
 /** Fragment outgoing IP packets if their size exceeds MTU */
 #ifndef IP_FRAG
 #define IP_FRAG                         1
 #endif
 
+/* Assumed max MTU on any interface for IP frag buffer */
+#ifndef IP_FRAG_MAX_MTU
+#define IP_FRAG_MAX_MTU 1500
+#endif
+
 /** Global default value for Time To Live used by transport layers. */
 #ifndef IP_DEFAULT_TTL
 #define IP_DEFAULT_TTL                  255
 #endif
 

_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users