if_ipw.c (148843) | if_ipw.c (148887) |
---|---|
1/* $FreeBSD: head/sys/dev/ipw/if_ipw.c 148843 2005-08-08 03:30:57Z sam $ */ | 1/* $FreeBSD: head/sys/dev/ipw/if_ipw.c 148887 2005-08-09 10:20:02Z rwatson $ */ |
2 3/*- 4 * Copyright (c) 2004, 2005 5 * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: --- 13 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> | 2 3/*- 4 * Copyright (c) 2004, 2005 5 * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: --- 13 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/ipw/if_ipw.c 148843 2005-08-08 03:30:57Z sam $"); | 31__FBSDID("$FreeBSD: head/sys/dev/ipw/if_ipw.c 148887 2005-08-09 10:20:02Z rwatson $"); |
32 33/*- 34 * Intel(R) PRO/Wireless 2100 MiniPCI driver 35 * http://www.intel.com/network/connectivity/products/wireless/prowireless_mobile.htm 36 */ 37 38#include <sys/param.h> 39#include <sys/sysctl.h> --- 688 unchanged lines hidden (view full) --- 728 struct ifnet *ifp = sc->sc_ic.ic_ifp; 729 730 IPW_LOCK(sc); 731 732 pci_write_config(dev, 0x41, 0, 1); 733 734 if (ifp->if_flags & IFF_UP) { 735 ifp->if_init(ifp->if_softc); | 32 33/*- 34 * Intel(R) PRO/Wireless 2100 MiniPCI driver 35 * http://www.intel.com/network/connectivity/products/wireless/prowireless_mobile.htm 36 */ 37 38#include <sys/param.h> 39#include <sys/sysctl.h> --- 688 unchanged lines hidden (view full) --- 728 struct ifnet *ifp = sc->sc_ic.ic_ifp; 729 730 IPW_LOCK(sc); 731 732 pci_write_config(dev, 0x41, 0, 1); 733 734 if (ifp->if_flags & IFF_UP) { 735 ifp->if_init(ifp->if_softc); |
736 if (ifp->if_flags & IFF_RUNNING) | 736 if (ifp->if_drv_flags & IFF_DRV_RUNNING) |
737 ifp->if_start(ifp); 738 } 739 740 IPW_UNLOCK(sc); 741 742 return 0; 743} 744 --- 6 unchanged lines hidden (view full) --- 751 IPW_LOCK(sc); 752 753 error = ieee80211_media_change(ifp); 754 if (error != ENETRESET) { 755 IPW_UNLOCK(sc); 756 return error; 757 } 758 | 737 ifp->if_start(ifp); 738 } 739 740 IPW_UNLOCK(sc); 741 742 return 0; 743} 744 --- 6 unchanged lines hidden (view full) --- 751 IPW_LOCK(sc); 752 753 error = ieee80211_media_change(ifp); 754 if (error != ENETRESET) { 755 IPW_UNLOCK(sc); 756 return error; 757 } 758 |
759 if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) == (IFF_UP | IFF_RUNNING)) | 759 if ((ifp->if_flags & IFF_UP) && (ifp->if_drv_flags & IFF_DRV_RUNNING)) |
760 ipw_init(sc); 761 762 IPW_UNLOCK(sc); 763 764 return 0; 765} 766 767/* --- 426 unchanged lines hidden (view full) --- 1194 1195 ipw_release_sbd(sc, sbd); 1196 sc->txfree++; 1197 } 1198 1199 /* remember what the firmware has processed */ 1200 sc->txold = (r == 0) ? IPW_NTBD - 1 : r - 1; 1201 | 760 ipw_init(sc); 761 762 IPW_UNLOCK(sc); 763 764 return 0; 765} 766 767/* --- 426 unchanged lines hidden (view full) --- 1194 1195 ipw_release_sbd(sc, sbd); 1196 sc->txfree++; 1197 } 1198 1199 /* remember what the firmware has processed */ 1200 sc->txold = (r == 0) ? IPW_NTBD - 1 : r - 1; 1201 |
1202 ifp->if_flags &= ~IFF_OACTIVE; | 1202 ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; |
1203 ipw_start(ifp); 1204} 1205 1206static void 1207ipw_intr(void *arg) 1208{ 1209 struct ipw_softc *sc = arg; 1210 uint32_t r; --- 259 unchanged lines hidden (view full) --- 1470 1471 for (;;) { 1472 IFQ_DRV_DEQUEUE(&ifp->if_snd, m0); 1473 if (m0 == NULL) 1474 break; 1475 1476 if (sc->txfree < 1 + IPW_MAX_NSEG) { 1477 IFQ_DRV_PREPEND(&ifp->if_snd, m0); | 1203 ipw_start(ifp); 1204} 1205 1206static void 1207ipw_intr(void *arg) 1208{ 1209 struct ipw_softc *sc = arg; 1210 uint32_t r; --- 259 unchanged lines hidden (view full) --- 1470 1471 for (;;) { 1472 IFQ_DRV_DEQUEUE(&ifp->if_snd, m0); 1473 if (m0 == NULL) 1474 break; 1475 1476 if (sc->txfree < 1 + IPW_MAX_NSEG) { 1477 IFQ_DRV_PREPEND(&ifp->if_snd, m0); |
1478 ifp->if_flags |= IFF_OACTIVE; | 1478 ifp->if_drv_flags |= IFF_DRV_OACTIVE; |
1479 break; 1480 } 1481 1482 if (m0->m_len < sizeof (struct ether_header) && 1483 (m0 = m_pullup(m0, sizeof (struct ether_header))) == NULL) 1484 continue; 1485 1486 eh = mtod(m0, struct ether_header *); --- 57 unchanged lines hidden (view full) --- 1544 struct ifreq *ifr; 1545 int error = 0; 1546 1547 IPW_LOCK(sc); 1548 1549 switch (cmd) { 1550 case SIOCSIFFLAGS: 1551 if (ifp->if_flags & IFF_UP) { | 1479 break; 1480 } 1481 1482 if (m0->m_len < sizeof (struct ether_header) && 1483 (m0 = m_pullup(m0, sizeof (struct ether_header))) == NULL) 1484 continue; 1485 1486 eh = mtod(m0, struct ether_header *); --- 57 unchanged lines hidden (view full) --- 1544 struct ifreq *ifr; 1545 int error = 0; 1546 1547 IPW_LOCK(sc); 1548 1549 switch (cmd) { 1550 case SIOCSIFFLAGS: 1551 if (ifp->if_flags & IFF_UP) { |
1552 if (!(ifp->if_flags & IFF_RUNNING)) | 1552 if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) |
1553 ipw_init(sc); 1554 } else { | 1553 ipw_init(sc); 1554 } else { |
1555 if (ifp->if_flags & IFF_RUNNING) | 1555 if (ifp->if_drv_flags & IFF_DRV_RUNNING) |
1556 ipw_stop(sc); 1557 } 1558 break; 1559 1560 case SIOCSLOADFW: 1561 /* only super-user can do that! */ 1562 if ((error = suser(curthread)) != 0) 1563 break; --- 12 unchanged lines hidden (view full) --- 1576 ipw_free_firmware(sc); 1577 break; 1578 1579 default: 1580 error = ieee80211_ioctl(ic, cmd, data); 1581 } 1582 1583 if (error == ENETRESET) { | 1556 ipw_stop(sc); 1557 } 1558 break; 1559 1560 case SIOCSLOADFW: 1561 /* only super-user can do that! */ 1562 if ((error = suser(curthread)) != 0) 1563 break; --- 12 unchanged lines hidden (view full) --- 1576 ipw_free_firmware(sc); 1577 break; 1578 1579 default: 1580 error = ieee80211_ioctl(ic, cmd, data); 1581 } 1582 1583 if (error == ENETRESET) { |
1584 if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) == 1585 (IFF_UP | IFF_RUNNING)) | 1584 if ((ifp->if_flags & IFF_UP) && 1585 (ifp->if_drv_flags & IFF_DRV_RUNNING)) |
1586 ipw_init(sc); 1587 error = 0; 1588 } 1589 1590 IPW_UNLOCK(sc); 1591 1592 return error; 1593} --- 491 unchanged lines hidden (view full) --- 2085 2086 ipw_write_table1(sc, IPW_INFO_LOCK, 0); 2087 2088 if (ipw_config(sc) != 0) { 2089 device_printf(sc->sc_dev, "device configuration failed\n"); 2090 goto fail; 2091 } 2092 | 1586 ipw_init(sc); 1587 error = 0; 1588 } 1589 1590 IPW_UNLOCK(sc); 1591 1592 return error; 1593} --- 491 unchanged lines hidden (view full) --- 2085 2086 ipw_write_table1(sc, IPW_INFO_LOCK, 0); 2087 2088 if (ipw_config(sc) != 0) { 2089 device_printf(sc->sc_dev, "device configuration failed\n"); 2090 goto fail; 2091 } 2092 |
2093 ifp->if_flags &= ~IFF_OACTIVE; 2094 ifp->if_flags |= IFF_RUNNING; | 2093 ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; 2094 ifp->if_drv_flags |= IFF_DRV_RUNNING; |
2095 2096 return; 2097 2098fail: ifp->if_flags &= ~IFF_UP; 2099 ipw_stop(sc); 2100} 2101 2102static void --- 11 unchanged lines hidden (view full) --- 2114 /* 2115 * Release tx buffers. 2116 */ 2117 for (i = 0; i < IPW_NTBD; i++) 2118 ipw_release_sbd(sc, &sc->stbd_list[i]); 2119 2120 sc->sc_tx_timer = 0; 2121 ifp->if_timer = 0; | 2095 2096 return; 2097 2098fail: ifp->if_flags &= ~IFF_UP; 2099 ipw_stop(sc); 2100} 2101 2102static void --- 11 unchanged lines hidden (view full) --- 2114 /* 2115 * Release tx buffers. 2116 */ 2117 for (i = 0; i < IPW_NTBD; i++) 2118 ipw_release_sbd(sc, &sc->stbd_list[i]); 2119 2120 sc->sc_tx_timer = 0; 2121 ifp->if_timer = 0; |
2122 ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); | 2122 ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); |
2123 2124 ieee80211_new_state(ic, IEEE80211_S_INIT, -1); 2125} 2126 2127#ifdef IPW_DEBUG 2128static int 2129ipw_sysctl_stats(SYSCTL_HANDLER_ARGS) 2130{ --- 87 unchanged lines hidden --- | 2123 2124 ieee80211_new_state(ic, IEEE80211_S_INIT, -1); 2125} 2126 2127#ifdef IPW_DEBUG 2128static int 2129ipw_sysctl_stats(SYSCTL_HANDLER_ARGS) 2130{ --- 87 unchanged lines hidden --- |