From owner-p4-projects@FreeBSD.ORG Sun Feb 17 02:22:45 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id CD91116A419; Sun, 17 Feb 2008 02:22:45 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A7F416A418 for ; Sun, 17 Feb 2008 02:22:45 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 5992D13C45B for ; Sun, 17 Feb 2008 02:22:45 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m1H2Mjag097140 for ; Sun, 17 Feb 2008 02:22:45 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m1H2MjZt097136 for perforce@freebsd.org; Sun, 17 Feb 2008 02:22:45 GMT (envelope-from kmacy@freebsd.org) Date: Sun, 17 Feb 2008 02:22:45 GMT Message-Id: <200802170222.m1H2MjZt097136@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 135544 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Feb 2008 02:22:46 -0000 http://perforce.freebsd.org/chv.cgi?CH=135544 Change 135544 by kmacy@kmacy:entropy:iwarp on 2008/02/17 02:22:43 move setting of CXGB_SHUTDOWN to earlier in shutdown process fix multicast address programming Affected files ... .. //depot/projects/iwarp/sys/dev/cxgb/cxgb_adapter.h#14 edit .. //depot/projects/iwarp/sys/dev/cxgb/cxgb_main.c#16 edit Differences ... ==== //depot/projects/iwarp/sys/dev/cxgb/cxgb_adapter.h#14 (text+ko) ==== @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -54,6 +55,7 @@ #include #include + #ifdef CONFIG_DEFINED #include #include @@ -514,10 +516,23 @@ t3_get_next_mcaddr(struct t3_rx_mode *rm) { uint8_t *macaddr = NULL; + struct ifnet *ifp = rm->port->ifp; + struct ifmultiaddr *ifma; + int i = 0; + + IF_ADDR_LOCK(ifp); + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + if (ifma->ifma_addr->sa_family != AF_LINK) + continue; + if (i == rm->idx) { + macaddr = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); + break; + } + i++; + } + IF_ADDR_UNLOCK(ifp); + - if (rm->idx == 0) - macaddr = (uint8_t *)rm->port->hw_addr; - rm->idx++; return (macaddr); } ==== //depot/projects/iwarp/sys/dev/cxgb/cxgb_main.c#16 (text+ko) ==== @@ -672,9 +672,12 @@ { int i; + ADAPTER_LOCK(sc); + sc->flags |= CXGB_SHUTDOWN; + ADAPTER_UNLOCK(sc); cxgb_pcpu_shutdown_threads(sc); ADAPTER_LOCK(sc); - sc->flags |= CXGB_SHUTDOWN; + /* * drops the lock */ @@ -1170,10 +1173,10 @@ t3_mac_enable(mac, MAC_DIRECTION_RX); if_link_state_change(pi->ifp, LINK_STATE_UP); } else { - if_link_state_change(pi->ifp, LINK_STATE_DOWN); pi->phy.ops->power_down(&pi->phy, 1); t3_mac_disable(mac, MAC_DIRECTION_RX); t3_link_start(&pi->phy, mac, &pi->link_config); + if_link_state_change(pi->ifp, LINK_STATE_DOWN); } } @@ -1829,10 +1832,10 @@ struct t3_rx_mode rm; struct cmac *mac = &p->mac; - PORT_LOCK_ASSERT_OWNED(p); - t3_init_rx_mode(&rm, p); + mtx_lock(&p->adapter->mdio_lock); t3_mac_set_rx_mode(mac, &rm); + mtx_unlock(&p->adapter->mdio_lock); } static void @@ -1896,14 +1899,14 @@ error = cxgb_set_mtu(p, ifr->ifr_mtu); break; case SIOCSIFADDR: - case SIOCGIFADDR: if (ifa->ifa_addr->sa_family == AF_INET) { - PORT_LOCK(p); ifp->if_flags |= IFF_UP; - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { + PORT_LOCK(p); cxgb_init_locked(p); + PORT_UNLOCK(p); + } arp_ifinit(ifp, ifa); - PORT_UNLOCK(p); } else error = ether_ioctl(ifp, command, data); break; @@ -1923,14 +1926,14 @@ PORT_UNLOCK(p); break; + case SIOCADDMULTI: + case SIOCDELMULTI: + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + cxgb_set_rxmode(p); + } + break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: - /* - * This is a convenient place to check the link status when - * no interfaces are up and thus the callout is not running - */ - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) - cxgb_tick_handler(p->adapter, 0); error = ifmedia_ioctl(ifp, ifr, &p->media, command); break; case SIOCSIFCAP: @@ -2065,11 +2068,17 @@ { int i; + if(adapter->flags & CXGB_SHUTDOWN) + return; + for_each_port(adapter, i) { struct port_info *p = &adapter->port[i]; struct ifnet *ifp = p->ifp; int status; - + + if(adapter->flags & CXGB_SHUTDOWN) + return; + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) continue; @@ -2113,6 +2122,9 @@ adapter_t *sc = (adapter_t *)arg; const struct adapter_params *p = &sc->params; + if(sc->flags & CXGB_SHUTDOWN) + return; + ADAPTER_LOCK(sc); if (p->linkpoll_period) check_link_status(sc);