Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pcmcia IPv6 support.



details:   https://anonhg.NetBSD.org/src/rev/a7cc83e0ca92
branches:  trunk
changeset: 476227:a7cc83e0ca92
user:      itojun <itojun%NetBSD.org@localhost>
date:      Fri Sep 10 00:30:59 1999 +0000

description:
IPv6 support.
ETHERTYPE_IPV6 packets are encapsulated by RFC1042 encap.
Tested with Japanese card, with WaveLan bridge (wiconfig -p 1).
NOTE: I dunno if encapsulating IPv6 packets by RFC1042 is the correct way,
  as RFC1042 only defines behavior for ETHERTYPE_{IP,ARP,REVARP} packets.
  Since WaveLan bridge encapsulates IPv6 packets with RFC1042, we have no
  choice.

Gather joined multicast addresses via SIOCADDMULTI, and configure multicast
filter properly.  This is also required for IPv6 support
(which heavily depends on multicast).

Fix IFF_RUNNING management
- to prevent IFF_RUNNING from raised on "wiconfig", before "ifconfig up"
- to prevent the driver from occupying extra interrupts on "ifconfig up",
  then "down", then "up".

diffstat:

 sys/dev/pcmcia/if_wi.c |  41 ++++++++++++++++++++++++++---------------
 1 files changed, 26 insertions(+), 15 deletions(-)

diffs (121 lines):

diff -r 1c32443aa93a -r a7cc83e0ca92 sys/dev/pcmcia/if_wi.c
--- a/sys/dev/pcmcia/if_wi.c    Fri Sep 10 00:23:34 1999 +0000
+++ b/sys/dev/pcmcia/if_wi.c    Fri Sep 10 00:30:59 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wi.c,v 1.2 1999/07/14 23:07:29 sommerfeld Exp $     */
+/*     $NetBSD: if_wi.c,v 1.3 1999/09/10 00:30:59 itojun Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999
@@ -31,7 +31,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  *
- *     $Id: if_wi.c,v 1.2 1999/07/14 23:07:29 sommerfeld Exp $
+ *     $Id: if_wi.c,v 1.3 1999/09/10 00:30:59 itojun Exp $
  */
 
 /*
@@ -115,7 +115,7 @@
 
 #if !defined(lint)
 static const char rcsid[] =
-       "$Id: if_wi.c,v 1.2 1999/07/14 23:07:29 sommerfeld Exp $";
+       "$Id: if_wi.c,v 1.3 1999/09/10 00:30:59 itojun Exp $";
 #endif
 
 #ifdef foo
@@ -973,7 +973,7 @@
        if (sc->wi_gone)
                return(ENODEV);
 
-       switch(command) {
+       switch (command) {
        case SIOCSIFADDR:
                if (!(ifp->if_flags & IFF_RUNNING) &&
                    (error = wi_enable(sc)) != 0)
@@ -982,15 +982,15 @@
                switch (ifa->ifa_addr->sa_family) {
 #ifdef INET
                case AF_INET:
+                       wi_init(sc);
                        arp_ifinit(&sc->sc_ethercom.ec_if, ifa);
                        break;
 #endif
+               default:
+                       wi_init(sc);
+                       break;
                }
-               break;
-
-
-
-
+               error = 0;
                break;
 #if 0
        case SIOCSIFMTU:
@@ -1022,8 +1022,15 @@
                break;
        case SIOCADDMULTI:
        case SIOCDELMULTI:
-               wi_setmulti(sc);
-               error = 0;
+               /* Update our multicast list. */
+               error = (command == SIOCADDMULTI) ?
+                   ether_addmulti(ifr, &sc->sc_ethercom) :
+                   ether_delmulti(ifr, &sc->sc_ethercom);
+               if (error == ENETRESET || error == 0) {
+                       /* Configure list onto the chip. */
+                       wi_setmulti(sc);
+                       error = 0;
+               }
                break;
        case SIOCGWAVELAN:
                error = copyin(ifr->ifr_data, &wreq, sizeof(wreq));
@@ -1075,13 +1082,15 @@
        int                     s;
        struct wi_ltv_macaddr   mac;
        int                     id = 0;
+       int                     running;
 
        if (sc->wi_gone)
                return;
 
        s = splimp();
 
-       if (ifp->if_flags & IFF_RUNNING)
+       running = ifp->if_flags & IFF_RUNNING;
+       if (running)
                wi_stop(sc);
 
        wi_reset(sc);
@@ -1156,7 +1165,8 @@
 
        splx(s);
 
-       ifp->if_flags |= IFF_RUNNING;
+       if (running)
+               ifp->if_flags |= IFF_RUNNING;
        ifp->if_flags &= ~IFF_OACTIVE;
 
        timeout(wi_inquire, sc, hz * 60);
@@ -1195,7 +1205,8 @@
         */
        if (ntohs(eh->ether_type) == ETHERTYPE_IP ||
            ntohs(eh->ether_type) == ETHERTYPE_ARP ||
-           ntohs(eh->ether_type) == ETHERTYPE_REVARP) {
+           ntohs(eh->ether_type) == ETHERTYPE_REVARP ||
+           ntohs(eh->ether_type) == ETHERTYPE_IPV6) {
                bcopy((char *)&eh->ether_dhost,
                    (char *)&tx_frame.wi_addr1, ETHER_ADDR_LEN);
                bcopy((char *)&eh->ether_shost,
@@ -1307,7 +1318,7 @@
 
        untimeout(wi_inquire, sc);
 
-       ifp->if_flags &= ~(IFF_RUNNING|IFF_OACTIVE);
+       ifp->if_flags &= ~IFF_OACTIVE;
 
        return;
 }



Home | Main Index | Thread Index | Old Index