if_vge.c (148654) | if_vge.c (148887) |
---|---|
1/*- 2 * Copyright (c) 2004 3 * Bill Paul <wpaul@windriver.com>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 * THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2004 3 * Bill Paul <wpaul@windriver.com>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 * THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/dev/vge/if_vge.c 148654 2005-08-03 00:18:35Z rwatson $"); | 34__FBSDID("$FreeBSD: head/sys/dev/vge/if_vge.c 148887 2005-08-09 10:20:02Z rwatson $"); |
35 36/* 37 * VIA Networking Technologies VT612x PCI gigabit ethernet NIC driver. 38 * 39 * Written by Bill Paul <wpaul@windriver.com> 40 * Senior Networking Software Engineer 41 * Wind River Systems 42 */ --- 1503 unchanged lines hidden (view full) --- 1546 sc->vge_ldata.vge_tx_free++; 1547 VGE_TX_DESC_INC(idx); 1548 } 1549 1550 /* No changes made to the TX ring, so no flush needed */ 1551 1552 if (idx != sc->vge_ldata.vge_tx_considx) { 1553 sc->vge_ldata.vge_tx_considx = idx; | 35 36/* 37 * VIA Networking Technologies VT612x PCI gigabit ethernet NIC driver. 38 * 39 * Written by Bill Paul <wpaul@windriver.com> 40 * Senior Networking Software Engineer 41 * Wind River Systems 42 */ --- 1503 unchanged lines hidden (view full) --- 1546 sc->vge_ldata.vge_tx_free++; 1547 VGE_TX_DESC_INC(idx); 1548 } 1549 1550 /* No changes made to the TX ring, so no flush needed */ 1551 1552 if (idx != sc->vge_ldata.vge_tx_considx) { 1553 sc->vge_ldata.vge_tx_considx = idx; |
1554 ifp->if_flags &= ~IFF_OACTIVE; | 1554 ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; |
1555 ifp->if_timer = 0; 1556 } 1557 1558 /* 1559 * If not all descriptors have been released reaped yet, 1560 * reload the timer so that we will eventually get another 1561 * interrupt that will cause us to re-enter this routine. 1562 * This is done in case the transmitter has gone idle. --- 298 unchanged lines hidden (view full) --- 1861{ 1862 struct vge_softc *sc; 1863 struct mbuf *m_head = NULL; 1864 int idx, pidx = 0; 1865 1866 sc = ifp->if_softc; 1867 VGE_LOCK(sc); 1868 | 1555 ifp->if_timer = 0; 1556 } 1557 1558 /* 1559 * If not all descriptors have been released reaped yet, 1560 * reload the timer so that we will eventually get another 1561 * interrupt that will cause us to re-enter this routine. 1562 * This is done in case the transmitter has gone idle. --- 298 unchanged lines hidden (view full) --- 1861{ 1862 struct vge_softc *sc; 1863 struct mbuf *m_head = NULL; 1864 int idx, pidx = 0; 1865 1866 sc = ifp->if_softc; 1867 VGE_LOCK(sc); 1868 |
1869 if (!sc->vge_link || ifp->if_flags & IFF_OACTIVE) { | 1869 if (!sc->vge_link || ifp->if_drv_flags & IFF_DRV_OACTIVE) { |
1870 VGE_UNLOCK(sc); 1871 return; 1872 } 1873 1874#if __FreeBSD_version < 502114 1875 if (ifp->if_snd.ifq_head == NULL) { 1876#else 1877 if (IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { --- 19 unchanged lines hidden (view full) --- 1897 break; 1898 1899 if (vge_encap(sc, m_head, idx)) { 1900#if __FreeBSD_version >= 502114 1901 IFQ_DRV_PREPEND(&ifp->if_snd, m_head); 1902#else 1903 IF_PREPEND(&ifp->if_snd, m_head); 1904#endif | 1870 VGE_UNLOCK(sc); 1871 return; 1872 } 1873 1874#if __FreeBSD_version < 502114 1875 if (ifp->if_snd.ifq_head == NULL) { 1876#else 1877 if (IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { --- 19 unchanged lines hidden (view full) --- 1897 break; 1898 1899 if (vge_encap(sc, m_head, idx)) { 1900#if __FreeBSD_version >= 502114 1901 IFQ_DRV_PREPEND(&ifp->if_snd, m_head); 1902#else 1903 IF_PREPEND(&ifp->if_snd, m_head); 1904#endif |
1905 ifp->if_flags |= IFF_OACTIVE; | 1905 ifp->if_drv_flags |= IFF_DRV_OACTIVE; |
1906 break; 1907 } 1908 1909 sc->vge_ldata.vge_tx_list[pidx].vge_frag[0].vge_buflen |= 1910 htole16(VGE_TXDESC_Q); 1911 1912 pidx = idx; 1913 VGE_TX_DESC_INC(idx); --- 200 unchanged lines hidden (view full) --- 2114 */ 2115 CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS); 2116 CSR_WRITE_4(sc, VGE_ISR, 0); 2117 CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); 2118 } 2119 2120 mii_mediachg(mii); 2121 | 1906 break; 1907 } 1908 1909 sc->vge_ldata.vge_tx_list[pidx].vge_frag[0].vge_buflen |= 1910 htole16(VGE_TXDESC_Q); 1911 1912 pidx = idx; 1913 VGE_TX_DESC_INC(idx); --- 200 unchanged lines hidden (view full) --- 2114 */ 2115 CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS); 2116 CSR_WRITE_4(sc, VGE_ISR, 0); 2117 CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); 2118 } 2119 2120 mii_mediachg(mii); 2121 |
2122 ifp->if_flags |= IFF_RUNNING; 2123 ifp->if_flags &= ~IFF_OACTIVE; | 2122 ifp->if_drv_flags |= IFF_DRV_RUNNING; 2123 ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; |
2124 2125 sc->vge_if_flags = 0; 2126 sc->vge_link = 0; 2127 2128 VGE_UNLOCK(sc); 2129 2130 return; 2131} --- 100 unchanged lines hidden (view full) --- 2232 switch (command) { 2233 case SIOCSIFMTU: 2234 if (ifr->ifr_mtu > VGE_JUMBO_MTU) 2235 error = EINVAL; 2236 ifp->if_mtu = ifr->ifr_mtu; 2237 break; 2238 case SIOCSIFFLAGS: 2239 if (ifp->if_flags & IFF_UP) { | 2124 2125 sc->vge_if_flags = 0; 2126 sc->vge_link = 0; 2127 2128 VGE_UNLOCK(sc); 2129 2130 return; 2131} --- 100 unchanged lines hidden (view full) --- 2232 switch (command) { 2233 case SIOCSIFMTU: 2234 if (ifr->ifr_mtu > VGE_JUMBO_MTU) 2235 error = EINVAL; 2236 ifp->if_mtu = ifr->ifr_mtu; 2237 break; 2238 case SIOCSIFFLAGS: 2239 if (ifp->if_flags & IFF_UP) { |
2240 if (ifp->if_flags & IFF_RUNNING && | 2240 if (ifp->if_drv_flags & IFF_DRV_RUNNING && |
2241 ifp->if_flags & IFF_PROMISC && 2242 !(sc->vge_if_flags & IFF_PROMISC)) { 2243 CSR_SETBIT_1(sc, VGE_RXCTL, 2244 VGE_RXCTL_RX_PROMISC); 2245 vge_setmulti(sc); | 2241 ifp->if_flags & IFF_PROMISC && 2242 !(sc->vge_if_flags & IFF_PROMISC)) { 2243 CSR_SETBIT_1(sc, VGE_RXCTL, 2244 VGE_RXCTL_RX_PROMISC); 2245 vge_setmulti(sc); |
2246 } else if (ifp->if_flags & IFF_RUNNING && | 2246 } else if (ifp->if_drv_flags & IFF_DRV_RUNNING && |
2247 !(ifp->if_flags & IFF_PROMISC) && 2248 sc->vge_if_flags & IFF_PROMISC) { 2249 CSR_CLRBIT_1(sc, VGE_RXCTL, 2250 VGE_RXCTL_RX_PROMISC); 2251 vge_setmulti(sc); 2252 } else 2253 vge_init(sc); 2254 } else { | 2247 !(ifp->if_flags & IFF_PROMISC) && 2248 sc->vge_if_flags & IFF_PROMISC) { 2249 CSR_CLRBIT_1(sc, VGE_RXCTL, 2250 VGE_RXCTL_RX_PROMISC); 2251 vge_setmulti(sc); 2252 } else 2253 vge_init(sc); 2254 } else { |
2255 if (ifp->if_flags & IFF_RUNNING) | 2255 if (ifp->if_drv_flags & IFF_DRV_RUNNING) |
2256 vge_stop(sc); 2257 } 2258 sc->vge_if_flags = ifp->if_flags; 2259 break; 2260 case SIOCADDMULTI: 2261 case SIOCDELMULTI: 2262 vge_setmulti(sc); 2263 break; --- 13 unchanged lines hidden (view full) --- 2277 ifr->ifr_reqcap & (IFCAP_HWCSUM | IFCAP_POLLING); 2278#else 2279 ifr->ifr_reqcap & (IFCAP_HWCSUM); 2280#endif 2281 if (ifp->if_capenable & IFCAP_TXCSUM) 2282 ifp->if_hwassist = VGE_CSUM_FEATURES; 2283 else 2284 ifp->if_hwassist = 0; | 2256 vge_stop(sc); 2257 } 2258 sc->vge_if_flags = ifp->if_flags; 2259 break; 2260 case SIOCADDMULTI: 2261 case SIOCDELMULTI: 2262 vge_setmulti(sc); 2263 break; --- 13 unchanged lines hidden (view full) --- 2277 ifr->ifr_reqcap & (IFCAP_HWCSUM | IFCAP_POLLING); 2278#else 2279 ifr->ifr_reqcap & (IFCAP_HWCSUM); 2280#endif 2281 if (ifp->if_capenable & IFCAP_TXCSUM) 2282 ifp->if_hwassist = VGE_CSUM_FEATURES; 2283 else 2284 ifp->if_hwassist = 0; |
2285 if (ifp->if_flags & IFF_RUNNING) | 2285 if (ifp->if_drv_flags & IFF_DRV_RUNNING) |
2286 vge_init(sc); 2287 break; 2288 default: 2289 error = ether_ioctl(ifp, command, data); 2290 break; 2291 } 2292 2293 return (error); --- 30 unchanged lines hidden (view full) --- 2324{ 2325 register int i; 2326 struct ifnet *ifp; 2327 2328 VGE_LOCK(sc); 2329 ifp = sc->vge_ifp; 2330 ifp->if_timer = 0; 2331 | 2286 vge_init(sc); 2287 break; 2288 default: 2289 error = ether_ioctl(ifp, command, data); 2290 break; 2291 } 2292 2293 return (error); --- 30 unchanged lines hidden (view full) --- 2324{ 2325 register int i; 2326 struct ifnet *ifp; 2327 2328 VGE_LOCK(sc); 2329 ifp = sc->vge_ifp; 2330 ifp->if_timer = 0; 2331 |
2332 ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); | 2332 ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); |
2333#ifdef DEVICE_POLLING 2334 ether_poll_deregister(ifp); 2335#endif /* DEVICE_POLLING */ 2336 2337 CSR_WRITE_1(sc, VGE_CRC3, VGE_CR3_INT_GMSK); 2338 CSR_WRITE_1(sc, VGE_CRS0, VGE_CR0_STOP); 2339 CSR_WRITE_4(sc, VGE_ISR, 0xFFFFFFFF); 2340 CSR_WRITE_2(sc, VGE_TXQCSRC, 0xFFFF); --- 97 unchanged lines hidden --- | 2333#ifdef DEVICE_POLLING 2334 ether_poll_deregister(ifp); 2335#endif /* DEVICE_POLLING */ 2336 2337 CSR_WRITE_1(sc, VGE_CRC3, VGE_CR3_INT_GMSK); 2338 CSR_WRITE_1(sc, VGE_CRS0, VGE_CR0_STOP); 2339 CSR_WRITE_4(sc, VGE_ISR, 0xFFFFFFFF); 2340 CSR_WRITE_2(sc, VGE_TXQCSRC, 0xFFFF); --- 97 unchanged lines hidden --- |