This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ETH - fix problem with scatter-gather list


Index: io/eth/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/io/eth/current/ChangeLog,v
retrieving revision 1.36
diff -u -5 -p -r1.36 ChangeLog
--- io/eth/current/ChangeLog	31 Jul 2002 12:26:53 -0000	1.36
+++ io/eth/current/ChangeLog	13 Aug 2002 15:55:28 -0000
@@ -1,5 +1,15 @@
+2002-08-13  Gary Thomas  <gthomas@ecoscentric.com>
+
+	* src/net/eth_drv.c (eth_drv_send): Print a better message
+	if the scatter-gather list overflows.
+
+	* include/eth_drv.h (MAX_ETH_DRV_SG): 
+	* cdl/eth_drivers.cdl: Add control over size of scatter-gather
+	data lists used to pass requests to physical layer.  Previous
+	value was sometimes too small.
+
 2002-07-31  Gary Thomas  <gary@chez-thomas.org>
 
 	* src/net/eth_drv.c (eth_drv_start): Fix compile error when
 	built with old stack (no multicast) - introduced below.
 
Index: io/eth/current/cdl/eth_drivers.cdl
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/io/eth/current/cdl/eth_drivers.cdl,v
retrieving revision 1.16
diff -u -5 -p -r1.16 eth_drivers.cdl
--- io/eth/current/cdl/eth_drivers.cdl	31 May 2002 01:05:55 -0000	1.16
+++ io/eth/current/cdl/eth_drivers.cdl	13 Aug 2002 15:43:16 -0000
@@ -107,10 +107,21 @@ cdl_package CYGPKG_IO_ETH_DRIVERS {
 	        out is bad for performance but not fatal, not a crash.
                 You might want to turn off the warnings to preserve realtime
                 properties of the system even in extremis."
 	}
 
+    	cdl_option CYGNUM_IO_ETH_DRIVERS_SG_LIST_SIZE {
+	    display	"Size of scatter-gather I/O lists"
+	    flavor	data
+	    default_value 32
+	    description "
+	        A scatter-gather list is used to pass requests to/from
+                the physical device driver.  This list can typically be
+                small, as the data is normally already packed into reasonable
+                chunks."
+	}
+
 	cdl_component CYGPKG_IO_ETH_DRIVERS_SIMULATED_FAILURES {
 	    display		"Simulate network failures for testing"
 	    flavor		bool
 	    default_value	0
 	    description	"
Index: io/eth/current/include/eth_drv.h
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/io/eth/current/include/eth_drv.h,v
retrieving revision 1.7
diff -u -5 -p -r1.7 eth_drv.h
--- io/eth/current/include/eth_drv.h	23 May 2002 23:06:01 -0000	1.7
+++ io/eth/current/include/eth_drv.h	13 Aug 2002 15:43:15 -0000
@@ -55,10 +55,11 @@
 
 #ifndef _ETH_DRV_H_
 #define _ETH_DRV_H_
 
 #include <pkgconf/system.h>
+#include <pkgconf/io_eth_drivers.h>
 
 #ifdef CYGPKG_NET
 #include <sys/param.h>
 #include <sys/socket.h>
 
@@ -84,13 +85,11 @@
 struct eth_drv_sg {
     CYG_ADDRESS  buf;
     CYG_ADDRWORD len;
 };
 
-// This is 16 to ensure that an MTU made of mbufs (not clusters) will fit.
-// 1600 is more that the MTU of 1500; it must be right.
-#define MAX_ETH_DRV_SG 16
+#define MAX_ETH_DRV_SG CYGNUM_IO_ETH_DRIVERS_SG_LIST_SIZE
 
 struct eth_drv_sc;
 
 struct eth_drv_funs {
     // Logical driver - initialization
Index: io/eth/current/src/net/eth_drv.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/io/eth/current/src/net/eth_drv.c,v
retrieving revision 1.24
diff -u -5 -p -r1.24 eth_drv.c
--- io/eth/current/src/net/eth_drv.c	31 Jul 2002 12:26:54 -0000	1.24
+++ io/eth/current/src/net/eth_drv.c	13 Aug 2002 15:53:09 -0000
@@ -617,10 +617,13 @@ eth_drv_ioctl(struct ifnet *ifp, u_long 
 //
 static void 
 eth_drv_send(struct ifnet *ifp)
 {
     struct eth_drv_sc *sc = ifp->if_softc;
+#if MAX_ETH_DRV_SG > 64
+    static  // Avoid large stack requirements
+#endif
     struct eth_drv_sg sg_list[MAX_ETH_DRV_SG];
     int sg_len;
     struct mbuf *m0, *m;
     int len, total_len;
     unsigned char *data;
@@ -690,12 +693,16 @@ eth_drv_send(struct ifnet *ifp)
                 END_CONSOLE();
             }
 #endif
             if ( MAX_ETH_DRV_SG < sg_len ) {
 #ifdef CYGPKG_IO_ETH_DRIVERS_WARN_NO_MBUFS
+                int needed = 0;
+                struct mbuf *m1;
+                for (m1 = m0; m1 ; m1 = m1->m_next) needed++;
                 START_CONSOLE();
-                diag_printf("too many mbufs to tx, %d > %d\n", sg_len, MAX_ETH_DRV_SG );
+                diag_printf("too many mbufs to tx, %d > %d, need %d\n", 
+                            sg_len, MAX_ETH_DRV_SG, needed );
                 END_CONSOLE();
 #endif
                 sg_len = 0;
                 break; // drop it on the floor
             }
@@ -782,10 +789,13 @@ eth_drv_recv(struct eth_drv_sc *sc, int 
     struct ifnet *ifp = &sc->sc_arpcom.ac_if;
     struct ether_header _eh, *eh=&_eh;
     struct mbuf *top, **mp, *m;
     int mlen;
     unsigned char *data;
+#if MAX_ETH_DRV_SG > 64
+    static  // Avoid large stack requirements
+#endif
     struct eth_drv_sg sg_list[MAX_ETH_DRV_SG];
     int sg_len;
 
     if ((ifp->if_flags & IFF_RUNNING) != IFF_RUNNING) {
         return;  // Interface not up, ignore this request


-- 
------------------------------------------------------------
Gary Thomas                  |
eCosCentric, Ltd.            |  
+1 (970) 229-1963            |  eCos & RedBoot experts
gthomas@ecoscentric.com      |
http://www.ecoscentric.com/  |
------------------------------------------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]