Deleted Added
full compact
if_re.c (248078) if_re.c (250458)
1/*-
2 * Copyright (c) 1997, 1998-2003
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) 1997, 1998-2003
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: stable/9/sys/dev/re/if_re.c 248078 2013-03-09 00:39:54Z marius $");
34__FBSDID("$FreeBSD: stable/9/sys/dev/re/if_re.c 250458 2013-05-10 16:16:33Z luigi $");
35
36/*
37 * RealTek 8139C+/8169/8169S/8110S/8168/8111/8101E PCI NIC driver
38 *
39 * Written by Bill Paul <wpaul@windriver.com>
40 * Senior Networking Software Engineer
41 * Wind River Systems
42 */

--- 1705 unchanged lines hidden (view full) ---

1748 * The rest is resource deallocation, so we should already be
1749 * stopped here.
1750 */
1751
1752 if (sc->rl_intrhand[0] != NULL) {
1753 bus_teardown_intr(dev, sc->rl_irq[0], sc->rl_intrhand[0]);
1754 sc->rl_intrhand[0] = NULL;
1755 }
35
36/*
37 * RealTek 8139C+/8169/8169S/8110S/8168/8111/8101E PCI NIC driver
38 *
39 * Written by Bill Paul <wpaul@windriver.com>
40 * Senior Networking Software Engineer
41 * Wind River Systems
42 */

--- 1705 unchanged lines hidden (view full) ---

1748 * The rest is resource deallocation, so we should already be
1749 * stopped here.
1750 */
1751
1752 if (sc->rl_intrhand[0] != NULL) {
1753 bus_teardown_intr(dev, sc->rl_irq[0], sc->rl_intrhand[0]);
1754 sc->rl_intrhand[0] = NULL;
1755 }
1756 if (ifp != NULL)
1756 if (ifp != NULL) {
1757#ifdef DEV_NETMAP
1758 netmap_detach(ifp);
1759#endif /* DEV_NETMAP */
1757 if_free(ifp);
1760 if_free(ifp);
1761 }
1758 if ((sc->rl_flags & (RL_FLAG_MSI | RL_FLAG_MSIX)) == 0)
1759 rid = 0;
1760 else
1761 rid = 1;
1762 if (sc->rl_irq[0] != NULL) {
1763 bus_release_resource(dev, SYS_RES_IRQ, rid, sc->rl_irq[0]);
1764 sc->rl_irq[0] = NULL;
1765 }

--- 72 unchanged lines hidden (view full) ---

1838 bus_dmamap_unload(sc->rl_ldata.rl_stag,
1839 sc->rl_ldata.rl_smap);
1840 if (sc->rl_ldata.rl_smap && sc->rl_ldata.rl_stats)
1841 bus_dmamem_free(sc->rl_ldata.rl_stag,
1842 sc->rl_ldata.rl_stats, sc->rl_ldata.rl_smap);
1843 bus_dma_tag_destroy(sc->rl_ldata.rl_stag);
1844 }
1845
1762 if ((sc->rl_flags & (RL_FLAG_MSI | RL_FLAG_MSIX)) == 0)
1763 rid = 0;
1764 else
1765 rid = 1;
1766 if (sc->rl_irq[0] != NULL) {
1767 bus_release_resource(dev, SYS_RES_IRQ, rid, sc->rl_irq[0]);
1768 sc->rl_irq[0] = NULL;
1769 }

--- 72 unchanged lines hidden (view full) ---

1842 bus_dmamap_unload(sc->rl_ldata.rl_stag,
1843 sc->rl_ldata.rl_smap);
1844 if (sc->rl_ldata.rl_smap && sc->rl_ldata.rl_stats)
1845 bus_dmamem_free(sc->rl_ldata.rl_stag,
1846 sc->rl_ldata.rl_stats, sc->rl_ldata.rl_smap);
1847 bus_dma_tag_destroy(sc->rl_ldata.rl_stag);
1848 }
1849
1846#ifdef DEV_NETMAP
1847 netmap_detach(ifp);
1848#endif /* DEV_NETMAP */
1849 if (sc->rl_parent_tag)
1850 bus_dma_tag_destroy(sc->rl_parent_tag);
1851
1852 mtx_destroy(&sc->rl_mtx);
1853
1854 return (0);
1855}
1856

--- 248 unchanged lines hidden (view full) ---

2105 struct rl_desc *cur_rx;
2106 u_int32_t rxstat, rxvlan;
2107 int jumbo, maxpkt = 16, rx_npkts = 0;
2108
2109 RL_LOCK_ASSERT(sc);
2110
2111 ifp = sc->rl_ifp;
2112#ifdef DEV_NETMAP
1850 if (sc->rl_parent_tag)
1851 bus_dma_tag_destroy(sc->rl_parent_tag);
1852
1853 mtx_destroy(&sc->rl_mtx);
1854
1855 return (0);
1856}
1857

--- 248 unchanged lines hidden (view full) ---

2106 struct rl_desc *cur_rx;
2107 u_int32_t rxstat, rxvlan;
2108 int jumbo, maxpkt = 16, rx_npkts = 0;
2109
2110 RL_LOCK_ASSERT(sc);
2111
2112 ifp = sc->rl_ifp;
2113#ifdef DEV_NETMAP
2113 if (ifp->if_capenable & IFCAP_NETMAP) {
2114 NA(ifp)->rx_rings[0].nr_kflags |= NKR_PENDINTR;
2115 selwakeuppri(&NA(ifp)->rx_rings[0].si, PI_NET);
2114 if (netmap_rx_irq(ifp, 0 | (NETMAP_LOCKED_ENTER|NETMAP_LOCKED_EXIT),
2115 &rx_npkts))
2116 return 0;
2116 return 0;
2117 }
2118#endif /* DEV_NETMAP */
2119 if (ifp->if_mtu > RL_MTU && (sc->rl_flags & RL_FLAG_JUMBOV2) != 0)
2120 jumbo = 1;
2121 else
2122 jumbo = 0;
2123
2124 /* Invalidate the descriptor memory */
2125

--- 227 unchanged lines hidden (view full) ---

2353 int cons;
2354
2355 cons = sc->rl_ldata.rl_tx_considx;
2356 if (cons == sc->rl_ldata.rl_tx_prodidx)
2357 return;
2358
2359 ifp = sc->rl_ifp;
2360#ifdef DEV_NETMAP
2117#endif /* DEV_NETMAP */
2118 if (ifp->if_mtu > RL_MTU && (sc->rl_flags & RL_FLAG_JUMBOV2) != 0)
2119 jumbo = 1;
2120 else
2121 jumbo = 0;
2122
2123 /* Invalidate the descriptor memory */
2124

--- 227 unchanged lines hidden (view full) ---

2352 int cons;
2353
2354 cons = sc->rl_ldata.rl_tx_considx;
2355 if (cons == sc->rl_ldata.rl_tx_prodidx)
2356 return;
2357
2358 ifp = sc->rl_ifp;
2359#ifdef DEV_NETMAP
2361 if (ifp->if_capenable & IFCAP_NETMAP) {
2362 selwakeuppri(&NA(ifp)->tx_rings[0].si, PI_NET);
2360 if (netmap_tx_irq(ifp, 0 | (NETMAP_LOCKED_ENTER|NETMAP_LOCKED_EXIT)))
2363 return;
2361 return;
2364 }
2365#endif /* DEV_NETMAP */
2366 /* Invalidate the TX descriptor list */
2367 bus_dmamap_sync(sc->rl_ldata.rl_tx_list_tag,
2368 sc->rl_ldata.rl_tx_list_map,
2369 BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
2370
2371 for (; cons != sc->rl_ldata.rl_tx_prodidx;
2372 cons = RL_TX_DESC_NXT(sc, cons)) {

--- 1641 unchanged lines hidden ---
2362#endif /* DEV_NETMAP */
2363 /* Invalidate the TX descriptor list */
2364 bus_dmamap_sync(sc->rl_ldata.rl_tx_list_tag,
2365 sc->rl_ldata.rl_tx_list_map,
2366 BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
2367
2368 for (; cons != sc->rl_ldata.rl_tx_prodidx;
2369 cons = RL_TX_DESC_NXT(sc, cons)) {

--- 1641 unchanged lines hidden ---