if_rt.c (270856) | if_rt.c (271849) |
---|---|
1/*- 2 * Copyright (c) 2011, Aleksandr Rybalko 3 * based on hard work 4 * by Alexander Egorenkov <egorenar@gmail.com> 5 * and by Damien Bergamini <damien.bergamini@free.fr> 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 15 unchanged lines hidden (view full) --- 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 */ 30 31#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2011, Aleksandr Rybalko 3 * based on hard work 4 * by Alexander Egorenkov <egorenar@gmail.com> 5 * and by Damien Bergamini <damien.bergamini@free.fr> 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 15 unchanged lines hidden (view full) --- 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 */ 30 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: head/sys/dev/rt/if_rt.c 270856 2014-08-30 19:55:54Z glebius $"); | 32__FBSDID("$FreeBSD: head/sys/dev/rt/if_rt.c 271849 2014-09-19 03:51:26Z glebius $"); |
33 34#include "if_rtvar.h" 35#include "if_rtreg.h" 36 37#include <net/if.h> 38#include <net/if_var.h> 39#include <net/if_arp.h> 40#include <net/ethernet.h> --- 979 unchanged lines hidden (view full) --- 1020 RT_SOFTC_TX_RING_UNLOCK(&sc->tx_ring[qid]); 1021 1022 RT_DPRINTF(sc, RT_DEBUG_TX, 1023 "if_start: Tx ring with qid=%d is full\n", qid); 1024 1025 m_freem(m); 1026 1027 ifp->if_drv_flags |= IFF_DRV_OACTIVE; | 33 34#include "if_rtvar.h" 35#include "if_rtreg.h" 36 37#include <net/if.h> 38#include <net/if_var.h> 39#include <net/if_arp.h> 40#include <net/ethernet.h> --- 979 unchanged lines hidden (view full) --- 1020 RT_SOFTC_TX_RING_UNLOCK(&sc->tx_ring[qid]); 1021 1022 RT_DPRINTF(sc, RT_DEBUG_TX, 1023 "if_start: Tx ring with qid=%d is full\n", qid); 1024 1025 m_freem(m); 1026 1027 ifp->if_drv_flags |= IFF_DRV_OACTIVE; |
1028 ifp->if_oerrors++; | 1028 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); |
1029 1030 sc->tx_data_queue_full[qid]++; 1031 1032 break; 1033 } 1034 1035 if (rt_tx_data(sc, m, qid) != 0) { 1036 RT_SOFTC_TX_RING_UNLOCK(&sc->tx_ring[qid]); 1037 | 1029 1030 sc->tx_data_queue_full[qid]++; 1031 1032 break; 1033 } 1034 1035 if (rt_tx_data(sc, m, qid) != 0) { 1036 RT_SOFTC_TX_RING_UNLOCK(&sc->tx_ring[qid]); 1037 |
1038 ifp->if_oerrors++; | 1038 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); |
1039 1040 break; 1041 } 1042 1043 RT_SOFTC_TX_RING_UNLOCK(&sc->tx_ring[qid]); 1044 sc->tx_timer = RT_TX_WATCHDOG_TIMEOUT; 1045 callout_reset(&sc->tx_watchdog_ch, hz, rt_tx_watchdog, sc); 1046 } --- 100 unchanged lines hidden (view full) --- 1147 device_printf(sc->dev, "Tx watchdog timeout: resetting\n"); 1148#ifdef notyet 1149 /* 1150 * XXX: Commented out, because reset break input. 1151 */ 1152 rt_stop_locked(sc); 1153 rt_init_locked(sc); 1154#endif | 1039 1040 break; 1041 } 1042 1043 RT_SOFTC_TX_RING_UNLOCK(&sc->tx_ring[qid]); 1044 sc->tx_timer = RT_TX_WATCHDOG_TIMEOUT; 1045 callout_reset(&sc->tx_watchdog_ch, hz, rt_tx_watchdog, sc); 1046 } --- 100 unchanged lines hidden (view full) --- 1147 device_printf(sc->dev, "Tx watchdog timeout: resetting\n"); 1148#ifdef notyet 1149 /* 1150 * XXX: Commented out, because reset break input. 1151 */ 1152 rt_stop_locked(sc); 1153 rt_init_locked(sc); 1154#endif |
1155 ifp->if_oerrors++; | 1155 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); |
1156 sc->tx_watchdog_timeouts++; 1157 } 1158 callout_reset(&sc->tx_watchdog_ch, hz, rt_tx_watchdog, sc); 1159} 1160 1161/* 1162 * rt_cnt_ppe_af - Handler of PPE Counter Table Almost Full interrupt 1163 */ --- 468 unchanged lines hidden (view full) --- 1632 RT_DPRINTF(sc, RT_DEBUG_RX, "new frame len=%d\n", len); 1633 1634 nframes++; 1635 1636 mnew = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, 1637 MJUMPAGESIZE); 1638 if (mnew == NULL) { 1639 sc->rx_mbuf_alloc_errors++; | 1156 sc->tx_watchdog_timeouts++; 1157 } 1158 callout_reset(&sc->tx_watchdog_ch, hz, rt_tx_watchdog, sc); 1159} 1160 1161/* 1162 * rt_cnt_ppe_af - Handler of PPE Counter Table Almost Full interrupt 1163 */ --- 468 unchanged lines hidden (view full) --- 1632 RT_DPRINTF(sc, RT_DEBUG_RX, "new frame len=%d\n", len); 1633 1634 nframes++; 1635 1636 mnew = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, 1637 MJUMPAGESIZE); 1638 if (mnew == NULL) { 1639 sc->rx_mbuf_alloc_errors++; |
1640 ifp->if_ierrors++; | 1640 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); |
1641 goto skip; 1642 } 1643 1644 mnew->m_len = mnew->m_pkthdr.len = MJUMPAGESIZE; 1645 1646 error = bus_dmamap_load_mbuf_sg(ring->data_dma_tag, 1647 ring->spare_dma_map, mnew, segs, &nsegs, BUS_DMA_NOWAIT); 1648 if (error != 0) { 1649 RT_DPRINTF(sc, RT_DEBUG_RX, 1650 "could not load Rx mbuf DMA map: " 1651 "error=%d, nsegs=%d\n", 1652 error, nsegs); 1653 1654 m_freem(mnew); 1655 1656 sc->rx_mbuf_dmamap_errors++; | 1641 goto skip; 1642 } 1643 1644 mnew->m_len = mnew->m_pkthdr.len = MJUMPAGESIZE; 1645 1646 error = bus_dmamap_load_mbuf_sg(ring->data_dma_tag, 1647 ring->spare_dma_map, mnew, segs, &nsegs, BUS_DMA_NOWAIT); 1648 if (error != 0) { 1649 RT_DPRINTF(sc, RT_DEBUG_RX, 1650 "could not load Rx mbuf DMA map: " 1651 "error=%d, nsegs=%d\n", 1652 error, nsegs); 1653 1654 m_freem(mnew); 1655 1656 sc->rx_mbuf_dmamap_errors++; |
1657 ifp->if_ierrors++; | 1657 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); |
1658 1659 goto skip; 1660 } 1661 1662 KASSERT(nsegs == 1, ("%s: too many DMA segments", 1663 device_get_nameunit(sc->dev))); 1664 1665 bus_dmamap_sync(ring->data_dma_tag, data->dma_map, --- 29 unchanged lines hidden (view full) --- 1695 /* check for crc errors */ 1696 if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) { 1697 /*check for valid checksum*/ 1698 if (desc_flags & (RXDSXR_SRC_IP_CSUM_FAIL| 1699 RXDSXR_SRC_L4_CSUM_FAIL)) { 1700 RT_DPRINTF(sc, RT_DEBUG_RX, 1701 "rxdesc: crc error\n"); 1702 | 1658 1659 goto skip; 1660 } 1661 1662 KASSERT(nsegs == 1, ("%s: too many DMA segments", 1663 device_get_nameunit(sc->dev))); 1664 1665 bus_dmamap_sync(ring->data_dma_tag, data->dma_map, --- 29 unchanged lines hidden (view full) --- 1695 /* check for crc errors */ 1696 if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) { 1697 /*check for valid checksum*/ 1698 if (desc_flags & (RXDSXR_SRC_IP_CSUM_FAIL| 1699 RXDSXR_SRC_L4_CSUM_FAIL)) { 1700 RT_DPRINTF(sc, RT_DEBUG_RX, 1701 "rxdesc: crc error\n"); 1702 |
1703 ifp->if_ierrors++; | 1703 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); |
1704 1705 if (!(ifp->if_flags & IFF_PROMISC)) { 1706 m_freem(m); 1707 goto skip; 1708 } 1709 } 1710 if ((desc_flags & RXDSXR_SRC_IP_CSUM_FAIL) != 0) { 1711 m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; --- 68 unchanged lines hidden (view full) --- 1780 bus_dmamap_sync(ring->data_dma_tag, data->dma_map, 1781 BUS_DMASYNC_POSTWRITE); 1782 bus_dmamap_unload(ring->data_dma_tag, data->dma_map); 1783 1784 m_freem(data->m); 1785 1786 data->m = NULL; 1787 | 1704 1705 if (!(ifp->if_flags & IFF_PROMISC)) { 1706 m_freem(m); 1707 goto skip; 1708 } 1709 } 1710 if ((desc_flags & RXDSXR_SRC_IP_CSUM_FAIL) != 0) { 1711 m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; --- 68 unchanged lines hidden (view full) --- 1780 bus_dmamap_sync(ring->data_dma_tag, data->dma_map, 1781 BUS_DMASYNC_POSTWRITE); 1782 bus_dmamap_unload(ring->data_dma_tag, data->dma_map); 1783 1784 m_freem(data->m); 1785 1786 data->m = NULL; 1787 |
1788 ifp->if_opackets++; | 1788 if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); |
1789 1790 RT_SOFTC_TX_RING_LOCK(ring); 1791 ring->data_queued--; 1792 ring->data_next = (ring->data_next + 1) % 1793 RT_SOFTC_TX_RING_DATA_COUNT; 1794 RT_SOFTC_TX_RING_UNLOCK(ring); 1795 } 1796 --- 812 unchanged lines hidden --- | 1789 1790 RT_SOFTC_TX_RING_LOCK(ring); 1791 ring->data_queued--; 1792 ring->data_next = (ring->data_next + 1) % 1793 RT_SOFTC_TX_RING_DATA_COUNT; 1794 RT_SOFTC_TX_RING_UNLOCK(ring); 1795 } 1796 --- 812 unchanged lines hidden --- |