Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/dev/ic Pull up revision 1.39 (requested by bouyer):



details:   https://anonhg.NetBSD.org/src/rev/eed8cf452d14
branches:  netbsd-1-5
changeset: 490465:eed8cf452d14
user:      jhawk <jhawk%NetBSD.org@localhost>
date:      Sun Dec 31 20:14:54 2000 +0000

description:
Pull up revision 1.39 (requested by bouyer):
        Add support for 802.1Q virtual LANs.

diffstat:

 sys/dev/ic/i82557.c |  34 +++++++++++++++++++++++++++++++---
 1 files changed, 31 insertions(+), 3 deletions(-)

diffs (83 lines):

diff -r 0ae52a997731 -r eed8cf452d14 sys/dev/ic/i82557.c
--- a/sys/dev/ic/i82557.c       Sun Dec 31 20:14:50 2000 +0000
+++ b/sys/dev/ic/i82557.c       Sun Dec 31 20:14:54 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i82557.c,v 1.34.2.1 2000/06/29 23:59:57 thorpej Exp $  */
+/*     $NetBSD: i82557.c,v 1.34.2.2 2000/12/31 20:14:54 jhawk Exp $    */
 
 /*-
  * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -333,6 +333,11 @@
        ifp->if_watchdog = fxp_watchdog;
 
        /*
+        * We can support 802.1Q VLAN-sized frames.
+        */
+       sc->sc_ethercom.ec_capabilities |= ETHERCAP_VLAN_MTU;
+
+       /*
         * Attach the interface.
         */
        if_attach(ifp);
@@ -868,6 +873,7 @@
        void *arg;
 {
        struct fxp_softc *sc = arg;
+       struct ethercom *ec = &sc->sc_ethercom;
        struct ifnet *ifp = &sc->sc_ethercom.ec_if;
        struct fxp_cb_tx *txd;
        struct fxp_txsoft *txs;
@@ -943,6 +949,21 @@
                        }
 
                        /*
+                        * If support for 802.1Q VLAN sized frames is
+                        * enabled, we need to do some additional error
+                        * checking (as we are saving bad frames, in
+                        * order to receive the larger ones).
+                        */
+                       if ((ec->ec_capenable & ETHERCAP_VLAN_MTU) != 0 &&
+                           (rxstat & (FXP_RFA_STATUS_OVERRUN|
+                                      FXP_RFA_STATUS_RNR|
+                                      FXP_RFA_STATUS_ALIGN|
+                                      FXP_RFA_STATUS_CRC)) != 0) {
+                               FXP_INIT_RFABUF(sc, m);
+                               goto rcvloop;
+                       }
+
+                       /*
                         * If the packet is small enough to fit in a
                         * single header mbuf, allocate one and copy
                         * the data into it.  This greatly reduces
@@ -1282,7 +1303,7 @@
        struct fxp_cb_ias *cb_ias;
        struct fxp_cb_tx *txd;
        bus_dmamap_t rxmap;
-       int i, prm, allm, error = 0;
+       int i, prm, save_bf, allm, error = 0;
 
        /*
         * Cancel any pending I/O
@@ -1320,6 +1341,13 @@
        allm = (ifp->if_flags & IFF_ALLMULTI) ? 1 : 0;
 
        /*
+        * In order to support receiving 802.1Q VLAN frames, we have to
+        * enable "save bad frames", since they are 4 bytes larger than
+        * the normal Ethernet maximum frame length.
+        */
+       save_bf = (sc->sc_ethercom.ec_capenable & ETHERCAP_VLAN_MTU) ? 1 : 0;
+
+       /*
         * Initialize base of dump-stats buffer.
         */
        fxp_scb_wait(sc);
@@ -1354,7 +1382,7 @@
        cbp->late_scb =         0;      /* (don't) defer SCB update */
        cbp->tno_int =          0;      /* (disable) tx not okay interrupt */
        cbp->ci_int =           1;      /* interrupt on CU idle */
-       cbp->save_bf =          prm;    /* save bad frames */
+       cbp->save_bf =          save_bf;/* save bad frames */
        cbp->disc_short_rx =    !prm;   /* discard short packets */
        cbp->underrun_retry =   1;      /* retry mode (1) on DMA underrun */
        cbp->mediatype =        !sc->phy_10Mbps_only; /* interface mode */



Home | Main Index | Thread Index | Old Index