From b9625bc6fce089540bed873507539770e0d4e548 Mon Sep 17 00:00:00 2001 From: YASUOKA Masahiko Date: Sun, 19 Jun 2011 02:01:24 +0000 Subject: Clean up ioctl handler a bit and rearrange the receive filter callback to the proper location. this diff from brad@ ok and tested by yasuoka@ --- sys/arch/octeon/dev/if_cnmac.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'sys/arch') diff --git a/sys/arch/octeon/dev/if_cnmac.c b/sys/arch/octeon/dev/if_cnmac.c index d163d2ccb0a..43cd7bba277 100644 --- a/sys/arch/octeon/dev/if_cnmac.c +++ b/sys/arch/octeon/dev/if_cnmac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cnmac.c,v 1.2 2011/06/17 03:36:24 yasuoka Exp $ */ +/* $OpenBSD: if_cnmac.c,v 1.3 2011/06/19 02:01:23 yasuoka Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -844,21 +844,21 @@ static int octeon_eth_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct octeon_eth_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; struct ifaddr *ifa = (struct ifaddr *)data; + struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; s = splnet(); + switch (cmd) { case SIOCSIFADDR: - if (!(ifp->if_flags & IFF_UP)) { - ifp->if_flags |= IFF_UP; + ifp->if_flags |= IFF_UP; + if (!(ifp->if_flags & IFF_RUNNING)) octeon_eth_init(ifp); - } #ifdef INET if (ifa->ifa_addr->sa_family == AF_INET) arp_ifinit(&sc->sc_arpcom, ifa); -#endif /* INET */ +#endif break; case SIOCSIFFLAGS: @@ -872,6 +872,7 @@ octeon_eth_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) octeon_eth_stop(ifp, 0); } break; + case SIOCSIFMEDIA: /* Flow control requires full-duplex mode. */ if (IFM_SUBTYPE(ifr->ifr_media) == IFM_AUTO || @@ -888,25 +889,22 @@ octeon_eth_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } /* FALLTHROUGH */ case SIOCGIFMEDIA: - /* XXX: Flow contorol */ error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd); break; + default: error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if (ISSET(ifp->if_flags, IFF_RUNNING)) - cn30xxgmx_set_filter(sc->sc_gmx_port); - error = 0; - } - break; } + + if (error == ENETRESET) { + if (ISSET(ifp->if_flags, IFF_RUNNING)) + cn30xxgmx_set_filter(sc->sc_gmx_port); + error = 0; + } + octeon_eth_start(ifp); - splx(s); + splx(s); return (error); } -- cgit v1.2.3