Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sbus Enable VLAN encapsulation.



details:   https://anonhg.NetBSD.org/src/rev/a363fb64a816
branches:  trunk
changeset: 553420:a363fb64a816
user:      pk <pk%NetBSD.org@localhost>
date:      Thu Oct 16 07:20:54 2003 +0000

description:
Enable VLAN encapsulation.

diffstat:

 sys/dev/sbus/be.c    |  21 +++++++++++++++------
 sys/dev/sbus/bereg.h |   6 +++++-
 2 files changed, 20 insertions(+), 7 deletions(-)

diffs (87 lines):

diff -r 71820b3bb0e7 -r a363fb64a816 sys/dev/sbus/be.c
--- a/sys/dev/sbus/be.c Thu Oct 16 06:56:17 2003 +0000
+++ b/sys/dev/sbus/be.c Thu Oct 16 07:20:54 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: be.c,v 1.39 2003/05/03 18:11:38 wiz Exp $      */
+/*     $NetBSD: be.c,v 1.40 2003/10/16 07:20:54 pk Exp $       */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.39 2003/05/03 18:11:38 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.40 2003/10/16 07:20:54 pk Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -479,6 +479,9 @@
                IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST;
        IFQ_SET_READY(&ifp->if_snd);
 
+       /* claim 802.1q capability */
+       sc->sc_ethercom.ec_capabilities |= ETHERCAP_VLAN_MTU;
+
        /* Attach the interface. */
        if_attach(ifp);
        ether_ifattach(ifp, sc->sc_enaddr);
@@ -582,15 +585,14 @@
        struct ifnet *ifp = &sc->sc_ethercom.ec_if;
        struct mbuf *m;
 
-       if (len <= sizeof(struct ether_header) ||
-           len > ETHERMTU + sizeof(struct ether_header)) {
-
+#ifdef DIAGNOSTIC
+       if (len < ETHER_MIN_LEN || len > ETHER_MAX_LEN + ETHERCAP_VLAN_MTU) {
                printf("%s: invalid packet size %d; dropping\n",
                        ifp->if_xname, len);
-
                ifp->if_ierrors++;
                return;
        }
+#endif
 
        /*
         * Pull packet off interface.
@@ -1163,6 +1165,13 @@
        bus_space_write_4(t, cr, BE_CRI_BMASK, 0);
        bus_space_write_4(t, cr, BE_CRI_CCNT, 0);
 
+       /* Set max packet length */
+       v = ETHER_MAX_LEN;
+       if (sc->sc_ethercom.ec_capenable & ETHERCAP_VLAN_MTU)
+               v += ETHER_VLAN_ENCAP_LEN;
+       bus_space_write_4(t, br, BE_BRI_RXMAX, v);
+       bus_space_write_4(t, br, BE_BRI_TXMAX, v);
+
        /* Enable transmitter */
        bus_space_write_4(t, br, BE_BRI_TXCFG,
                          BE_BR_TXCFG_FIFO | BE_BR_TXCFG_ENABLE);
diff -r 71820b3bb0e7 -r a363fb64a816 sys/dev/sbus/bereg.h
--- a/sys/dev/sbus/bereg.h      Thu Oct 16 06:56:17 2003 +0000
+++ b/sys/dev/sbus/bereg.h      Thu Oct 16 07:20:54 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bereg.h,v 1.5 2003/05/03 18:11:38 wiz Exp $    */
+/*     $NetBSD: bereg.h,v 1.6 2003/10/16 07:20:54 pk Exp $     */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -124,12 +124,16 @@
 #define BE_BRI_IMASK   (65*4)
 #define BE_BRI_TXCFG   (131*4)
 #define BE_BRI_JSIZE   (139*4)
+#define BE_BRI_TXMAX   (140*4)
+#define BE_BRI_TXMIN   (141*4)
 #define BE_BRI_NCCNT   (144*4)
 #define BE_BRI_FCCNT   (145*4)
 #define BE_BRI_EXCNT   (146*4)
 #define BE_BRI_LTCNT   (147*4)
 #define BE_BRI_RANDSEED        (148*4)
 #define BE_BRI_RXCFG   (195*4)
+#define BE_BRI_RXMAX   (196*4)
+#define BE_BRI_RXMIN   (197*4)
 #define BE_BRI_MACADDR2        (198*4)
 #define BE_BRI_MACADDR1        (199*4)
 #define BE_BRI_MACADDR0        (200*4)



Home | Main Index | Thread Index | Old Index