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]

FCC - only handle error free packets


-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates
Index: devs/eth/powerpc/fcc/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/devs/eth/powerpc/fcc/current/ChangeLog,v
retrieving revision 1.7
diff -u -5 -p -r1.7 ChangeLog
--- devs/eth/powerpc/fcc/current/ChangeLog	4 Feb 2004 14:14:55 -0000	1.7
+++ devs/eth/powerpc/fcc/current/ChangeLog	4 Feb 2004 15:02:49 -0000
@@ -1,5 +1,11 @@
+2004-02-04  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/if_fcc.c: 
+	* src/fcc.h: Only process error-free packets.  Inspired by
+	Christoph Csebits.
+
 2004-02-03  Christoph Csebits <christoph.csebits@frequentis.com>
 
         * src/if_fcc.c (fcc_eth_can_send): Fix: check also if
         buffer was freed by the upper layer (txdone was called).
 
Index: devs/eth/powerpc/fcc/current/src/fcc.h
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/devs/eth/powerpc/fcc/current/src/fcc.h,v
retrieving revision 1.1
diff -u -5 -p -r1.1 fcc.h
--- devs/eth/powerpc/fcc/current/src/fcc.h	19 Aug 2003 17:29:43 -0000	1.1
+++ devs/eth/powerpc/fcc/current/src/fcc.h	4 Feb 2004 15:02:36 -0000
@@ -7,11 +7,11 @@
 //==========================================================================
 //####ECOSGPLCOPYRIGHTBEGIN####
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-// Copyright (C) 2002, 2003 Gary Thomas
+// Copyright (C) 2002, 2003, 2004 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
 // Software Foundation; either version 2 or (at your option) any later version.
 //
@@ -121,10 +121,11 @@
 #define FCC_BD_Rx_NO         0x0010  // Non-octet aligned frame
 #define FCC_BD_Rx_SH         0x0008  // Short frame
 #define FCC_BD_Rx_CR         0x0004  // CRC error
 #define FCC_BD_Rx_OV         0x0002  // Overrun
 #define FCC_BD_Rx_TR         0x0001  // Frame truncated. late collision
+#define FCC_BD_Rx_ERRORS     (FCC_BD_Rx_LG|FCC_BD_Rx_NO|FCC_BD_Rx_SH|FCC_BD_Rx_CR|FCC_BD_Rx_OV|FCC_BD_Rx_TR)
 
 #define FCC_BD_Tx_Ready      0x8000  // Frame ready
 #define FCC_BD_Tx_Pad        0x4000  // Pad short frames
 #define FCC_BD_Tx_Wrap       0x2000  // Wrap: Last buffer in ring
 #define FCC_BD_Tx_Int        0x1000  // Interrupt
Index: devs/eth/powerpc/fcc/current/src/if_fcc.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/devs/eth/powerpc/fcc/current/src/if_fcc.c,v
retrieving revision 1.5
diff -u -5 -p -r1.5 if_fcc.c
--- devs/eth/powerpc/fcc/current/src/if_fcc.c	4 Feb 2004 14:14:55 -0000	1.5
+++ devs/eth/powerpc/fcc/current/src/if_fcc.c	4 Feb 2004 15:02:50 -0000
@@ -7,11 +7,11 @@
 //==========================================================================
 //####ECOSGPLCOPYRIGHTBEGIN####
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-// Copyright (C) 2002, 2003 Gary Thomas
+// Copyright (C) 2002, 2003, 2004 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
 // Software Foundation; either version 2 or (at your option) any later version.
 //
@@ -517,20 +517,24 @@ fcc_eth_RxEvent(struct eth_drv_sc *sc)
 
     // This is the right way of doing it, but dcbi has a bug ...
     //    if (cache_state) {
     //      HAL_DCACHE_INVALIDATE(rxbd->buffer, rxbd->length); 
     //    }
-    (sc->funs->eth_drv->recv)(sc, rxbd->length);
+    if ((rxbd->ctrl & FCC_BD_Rx_ERRORS) == 0) {
+        (sc->funs->eth_drv->recv)(sc, rxbd->length);
 #if 1 // Coherent caches?
-    if (cache_state) {
-      HAL_DCACHE_FLUSH(rxbd->buffer, rxbd->length); 
-    }
+        if (cache_state) {
+            HAL_DCACHE_FLUSH(rxbd->buffer, rxbd->length); 
+        }
 #endif
-    rxbd->ctrl |= FCC_BD_Rx_Empty;
+    }
+    // Reset control flags to known [empty] state, clearing error bits
     if (rxbd->ctrl & FCC_BD_Rx_Wrap) {
+      rxbd->ctrl = FCC_BD_Rx_Empty | FCC_BD_Rx_Int | FCC_BD_Rx_Wrap;
       rxbd = qi->rbase;
     } else {
+      rxbd->ctrl = FCC_BD_Rx_Empty | FCC_BD_Rx_Int;
       rxbd++;
     }
   }
   // Remember where we left off
   qi->rnext = (struct fcc_bd *)rxbd;

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