Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Supports ETHERCAP_VLAN_MTU. Tested on sbus hme on...



details:   https://anonhg.NetBSD.org/src/rev/627f537bc58c
branches:  trunk
changeset: 499342:627f537bc58c
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Fri Nov 17 19:08:00 2000 +0000

description:
Supports ETHERCAP_VLAN_MTU. Tested on sbus hme on Ultra/1.
Thanks to Andrei Petrov for the hint !

diffstat:

 sys/dev/ic/hme.c    |  17 +++++++++++++++--
 sys/dev/ic/hmereg.h |  15 ++++++++++++++-
 2 files changed, 29 insertions(+), 3 deletions(-)

diffs (95 lines):

diff -r 06e826b9d24f -r 627f537bc58c sys/dev/ic/hme.c
--- a/sys/dev/ic/hme.c  Fri Nov 17 18:01:41 2000 +0000
+++ b/sys/dev/ic/hme.c  Fri Nov 17 19:08:00 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hme.c,v 1.18 2000/11/15 01:02:16 thorpej Exp $ */
+/*     $NetBSD: hme.c,v 1.19 2000/11/17 19:08:00 bouyer Exp $  */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -302,6 +302,9 @@
                ifmedia_set(&sc->sc_media, IFM_ETHER|IFM_AUTO);
        }
 
+       /* claim 802.1q capability */
+       sc->sc_ethercom.ec_capabilities |= ETHERCAP_VLAN_MTU;
+
        /* Attach the interface. */
        if_attach(ifp);
        ether_ifattach(ifp, sc->sc_enaddr);
@@ -502,6 +505,10 @@
        bus_space_write_4(t, mac, HME_MACI_FCCNT, 0);
        bus_space_write_4(t, mac, HME_MACI_EXCNT, 0);
        bus_space_write_4(t, mac, HME_MACI_LTCNT, 0);
+       bus_space_write_4(t, mac, HME_MACI_TXSIZE,
+           (sc->sc_ethercom.ec_capenable & ETHERCAP_VLAN_MTU) ?
+           ETHER_VLAN_ENCAP_LEN + ETHER_MAX_LEN :
+            ETHER_MAX_LEN);
 
        /* Load station MAC address */
        ea = sc->sc_enaddr;
@@ -528,6 +535,10 @@
        bus_space_write_4(t, etx, HME_ETXI_RSIZE, sc->sc_rb.rb_ntbuf);
 
        bus_space_write_4(t, erx, HME_ERXI_RING, sc->sc_rb.rb_rxddma);
+       bus_space_write_4(t, mac, HME_MACI_RXSIZE,
+           (sc->sc_ethercom.ec_capenable & ETHERCAP_VLAN_MTU) ?
+           ETHER_VLAN_ENCAP_LEN + ETHER_MAX_LEN :
+            ETHER_MAX_LEN);
 
 
        /* step 8. Global Configuration & Interrupt Mask */
@@ -749,7 +760,9 @@
        struct mbuf *m;
 
        if (len <= sizeof(struct ether_header) ||
-           len > ETHERMTU + sizeof(struct ether_header)) {
+           len > ((sc->sc_ethercom.ec_capenable & ETHERCAP_VLAN_MTU) ?
+           ETHER_VLAN_ENCAP_LEN + ETHERMTU + sizeof(struct ether_header) :
+           ETHERMTU + sizeof(struct ether_header))) {
 #ifdef HMEDEBUG
                printf("%s: invalid packet size %d; dropping\n",
                    sc->sc_dev.dv_xname, len);
diff -r 06e826b9d24f -r 627f537bc58c sys/dev/ic/hmereg.h
--- a/sys/dev/ic/hmereg.h       Fri Nov 17 18:01:41 2000 +0000
+++ b/sys/dev/ic/hmereg.h       Fri Nov 17 19:08:00 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hmereg.h,v 1.5 2000/06/25 01:05:17 eeh Exp $   */
+/*     $NetBSD: hmereg.h,v 1.6 2000/11/17 19:08:00 bouyer Exp $        */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -111,6 +111,17 @@
         HME_SEB_STAT_RFIFOVF  | HME_SEB_STAT_LCNTEXP | HME_SEB_STAT_CCNTEXP  |\
         HME_SEB_STAT_ACNTEXP)
 
+#define HME_SEB_STAT_VLAN_ERRORS       \
+       (HME_SEB_STAT_SLVPERR  | HME_SEB_STAT_SLVERR  | HME_SEB_STAT_TXTERR   |\
+        HME_SEB_STAT_TXPERR   | HME_SEB_STAT_TXLERR  | HME_SEB_STAT_TXEACK   |\
+        HME_SEB_STAT_EOPERR   | HME_SEB_STAT_RXTERR  | HME_SEB_STAT_RXPERR   |\
+        HME_SEB_STAT_RXLATERR | HME_SEB_STAT_RXERR   | HME_SEB_STAT_NORXD    |\
+        HME_SEB_STAT_DTIMEXP  | HME_SEB_STAT_FCNTEXP | HME_SEB_STAT_LCCNTEXP |\
+        HME_SEB_STAT_ECNTEXP  | HME_SEB_STAT_NCNTEXP |                        \
+        HME_SEB_STAT_TFIFO_UND| HME_SEB_STAT_STSTERR | HME_SEB_STAT_CVCNTEXP |\
+        HME_SEB_STAT_RFIFOVF  | HME_SEB_STAT_LCNTEXP | HME_SEB_STAT_CCNTEXP  |\
+        HME_SEB_STAT_ACNTEXP)
+
 /*
  * HME Transmitter register offsets
  */
@@ -167,6 +178,7 @@
 #define HME_MACI_TXSWRST       (130*4)         /* TX reset */
 #define HME_MACI_TXCFG         (131*4)         /* TX config */
 #define HME_MACI_JSIZE         (139*4)         /* TX jam size */
+#define HME_MACI_TXSIZE                (140*4)         /* TX max size */
 #define HME_MACI_NCCNT         (144*4)         /* TX normal collision cnt */
 #define HME_MACI_FCCNT         (145*4)         /* TX first collision cnt */
 #define HME_MACI_EXCNT         (146*4)         /* TX excess collision cnt */
@@ -174,6 +186,7 @@
 #define HME_MACI_RANDSEED      (148*4)         /*  */
 #define HME_MACI_RXSWRST       (194*4)         /* RX reset */
 #define HME_MACI_RXCFG         (195*4)         /* RX config */
+#define HME_MACI_RXSIZE                (196*4)         /* RX max size */
 #define HME_MACI_MACADDR2      (198*4)         /* MAC address */
 #define HME_MACI_MACADDR1      (199*4)
 #define HME_MACI_MACADDR0      (200*4)



Home | Main Index | Thread Index | Old Index