Date: Sun, 17 Feb 2008 02:22:45 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 135544 for review Message-ID: <200802170222.m1H2MjZt097136@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <net/ethernet.h> #include <net/if.h> #include <net/if_media.h> +#include <net/if_dl.h> #include <machine/bus.h> #include <machine/resource.h> @@ -54,6 +55,7 @@ #include <dev/pci/pcireg.h> #include <dev/pci/pcivar.h> + #ifdef CONFIG_DEFINED #include <cxgb_osdep.h> #include <t3cdev.h> @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802170222.m1H2MjZt097136>