changeset 1484:af696e5657f1

Only handle error free [incoming] packets
author gthomas
date Wed, 04 Feb 2004 15:03:31 +0000
parents dc0016c597aa
children 0e10930859c3
files packages/devs/eth/powerpc/fcc/current/ChangeLog packages/devs/eth/powerpc/fcc/current/src/fcc.h packages/devs/eth/powerpc/fcc/current/src/if_fcc.c
diffstat 3 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/packages/devs/eth/powerpc/fcc/current/ChangeLog
+++ b/packages/devs/eth/powerpc/fcc/current/ChangeLog
@@ -1,3 +1,9 @@
+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
--- a/packages/devs/eth/powerpc/fcc/current/src/fcc.h
+++ b/packages/devs/eth/powerpc/fcc/current/src/fcc.h
@@ -9,7 +9,7 @@
 // -------------------------------------------
 // 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
@@ -123,6 +123,7 @@
 #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
--- a/packages/devs/eth/powerpc/fcc/current/src/if_fcc.c
+++ b/packages/devs/eth/powerpc/fcc/current/src/if_fcc.c
@@ -9,7 +9,7 @@
 // -------------------------------------------
 // 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
@@ -519,16 +519,20 @@ fcc_eth_RxEvent(struct eth_drv_sc *sc)
     //    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
     }
-#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++;
     }
   }