if_sge.c (4e27d36d38f4c3b12bcc1855c5d41527d08d1ce0) if_sge.c (c8dfaf382fa6df9dc6fd1e1c3356e0c8bf607e6a)
1/*-
2 * Copyright (c) 2008-2010 Nikolay Denev <ndenev@gmail.com>
3 * Copyright (c) 2007-2008 Alexander Pohoyda <alexander.pohoyda@gmx.net>
4 * Copyright (c) 1997, 1998, 1999
5 * Bill Paul <wpaul@ctr.columbia.edu>. 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

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

1166 if ((rxstat & RDS_CRCOK) == 0 || SGE_RX_ERROR(rxstat) != 0 ||
1167 SGE_RX_NSEGS(rxstat) != 1) {
1168 /* XXX We don't support multi-segment frames yet. */
1169#ifdef SGE_SHOW_ERRORS
1170 device_printf(sc->sge_dev, "Rx error : 0x%b\n", rxstat,
1171 RX_ERR_BITS);
1172#endif
1173 sge_discard_rxbuf(sc, cons);
1/*-
2 * Copyright (c) 2008-2010 Nikolay Denev <ndenev@gmail.com>
3 * Copyright (c) 2007-2008 Alexander Pohoyda <alexander.pohoyda@gmx.net>
4 * Copyright (c) 1997, 1998, 1999
5 * Bill Paul <wpaul@ctr.columbia.edu>. 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

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

1166 if ((rxstat & RDS_CRCOK) == 0 || SGE_RX_ERROR(rxstat) != 0 ||
1167 SGE_RX_NSEGS(rxstat) != 1) {
1168 /* XXX We don't support multi-segment frames yet. */
1169#ifdef SGE_SHOW_ERRORS
1170 device_printf(sc->sge_dev, "Rx error : 0x%b\n", rxstat,
1171 RX_ERR_BITS);
1172#endif
1173 sge_discard_rxbuf(sc, cons);
1174 ifp->if_ierrors++;
1174 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
1175 continue;
1176 }
1177 m = cd->sge_rxdesc[cons].rx_m;
1178 if (sge_newbuf(sc, cons) != 0) {
1179 sge_discard_rxbuf(sc, cons);
1175 continue;
1176 }
1177 m = cd->sge_rxdesc[cons].rx_m;
1178 if (sge_newbuf(sc, cons) != 0) {
1179 sge_discard_rxbuf(sc, cons);
1180 ifp->if_iqdrops++;
1180 if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
1181 continue;
1182 }
1183 if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) {
1184 if ((rxinfo & RDC_IP_CSUM) != 0 &&
1185 (rxinfo & RDC_IP_CSUM_OK) != 0)
1186 m->m_pkthdr.csum_flags |=
1187 CSUM_IP_CHECKED | CSUM_IP_VALID;
1188 if (((rxinfo & RDC_TCP_CSUM) != 0 &&

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

1205 * to align IP header on 32bit boundary. Also note,
1206 * CRC bytes is automatically removed by the
1207 * hardware.
1208 */
1209 m->m_data += SGE_RX_PAD_BYTES;
1210 m->m_pkthdr.len = m->m_len = SGE_RX_BYTES(rxstat) -
1211 SGE_RX_PAD_BYTES;
1212 m->m_pkthdr.rcvif = ifp;
1181 continue;
1182 }
1183 if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) {
1184 if ((rxinfo & RDC_IP_CSUM) != 0 &&
1185 (rxinfo & RDC_IP_CSUM_OK) != 0)
1186 m->m_pkthdr.csum_flags |=
1187 CSUM_IP_CHECKED | CSUM_IP_VALID;
1188 if (((rxinfo & RDC_TCP_CSUM) != 0 &&

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

1205 * to align IP header on 32bit boundary. Also note,
1206 * CRC bytes is automatically removed by the
1207 * hardware.
1208 */
1209 m->m_data += SGE_RX_PAD_BYTES;
1210 m->m_pkthdr.len = m->m_len = SGE_RX_BYTES(rxstat) -
1211 SGE_RX_PAD_BYTES;
1212 m->m_pkthdr.rcvif = ifp;
1213 ifp->if_ipackets++;
1213 if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
1214 SGE_UNLOCK(sc);
1215 (*ifp->if_input)(ifp, m);
1216 SGE_LOCK(sc);
1217 }
1218
1219 if (prog > 0) {
1220 bus_dmamap_sync(cd->sge_rx_tag, cd->sge_rx_dmamap,
1221 BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);

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

1260 * TDC_OWN bit is valid only at the first descriptor of a
1261 * multi-descriptor transmission.
1262 */
1263 if (SGE_TX_ERROR(txstat) != 0) {
1264#ifdef SGE_SHOW_ERRORS
1265 device_printf(sc->sge_dev, "Tx error : 0x%b\n",
1266 txstat, TX_ERR_BITS);
1267#endif
1214 SGE_UNLOCK(sc);
1215 (*ifp->if_input)(ifp, m);
1216 SGE_LOCK(sc);
1217 }
1218
1219 if (prog > 0) {
1220 bus_dmamap_sync(cd->sge_rx_tag, cd->sge_rx_dmamap,
1221 BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);

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

1260 * TDC_OWN bit is valid only at the first descriptor of a
1261 * multi-descriptor transmission.
1262 */
1263 if (SGE_TX_ERROR(txstat) != 0) {
1264#ifdef SGE_SHOW_ERRORS
1265 device_printf(sc->sge_dev, "Tx error : 0x%b\n",
1266 txstat, TX_ERR_BITS);
1267#endif
1268 ifp->if_oerrors++;
1268 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
1269 } else {
1270#ifdef notyet
1269 } else {
1270#ifdef notyet
1271 ifp->if_collisions += (txstat & 0xFFFF) - 1;
1271 if_inc_counter(ifp, IFCOUNTER_COLLISIONS, (txstat & 0xFFFF) - 1);
1272#endif
1272#endif
1273 ifp->if_opackets++;
1273 if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
1274 }
1275 txd = &cd->sge_txdesc[cons];
1276 for (nsegs = 0; nsegs < txd->tx_ndesc; nsegs++) {
1277 ld->sge_tx_ring[cons].sge_cmdsts = 0;
1278 SGE_INC(cons, SGE_TX_RING_CNT);
1279 }
1280 /* Reclaim transmitted mbuf. */
1281 KASSERT(txd->tx_m != NULL,

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

1851 if (sc->sge_timer == 0 || --sc->sge_timer > 0)
1852 return;
1853
1854 ifp = sc->sge_ifp;
1855 if ((sc->sge_flags & SGE_FLAG_LINK) == 0) {
1856 if (1 || bootverbose)
1857 device_printf(sc->sge_dev,
1858 "watchdog timeout (lost link)\n");
1274 }
1275 txd = &cd->sge_txdesc[cons];
1276 for (nsegs = 0; nsegs < txd->tx_ndesc; nsegs++) {
1277 ld->sge_tx_ring[cons].sge_cmdsts = 0;
1278 SGE_INC(cons, SGE_TX_RING_CNT);
1279 }
1280 /* Reclaim transmitted mbuf. */
1281 KASSERT(txd->tx_m != NULL,

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

1851 if (sc->sge_timer == 0 || --sc->sge_timer > 0)
1852 return;
1853
1854 ifp = sc->sge_ifp;
1855 if ((sc->sge_flags & SGE_FLAG_LINK) == 0) {
1856 if (1 || bootverbose)
1857 device_printf(sc->sge_dev,
1858 "watchdog timeout (lost link)\n");
1859 ifp->if_oerrors++;
1859 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
1860 ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
1861 sge_init_locked(sc);
1862 return;
1863 }
1864 device_printf(sc->sge_dev, "watchdog timeout\n");
1860 ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
1861 sge_init_locked(sc);
1862 return;
1863 }
1864 device_printf(sc->sge_dev, "watchdog timeout\n");
1865 ifp->if_oerrors++;
1865 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
1866
1867 ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
1868 sge_init_locked(sc);
1869 if (!IFQ_DRV_IS_EMPTY(&sc->sge_ifp->if_snd))
1870 sge_start_locked(ifp);
1871}
1872
1873/*

--- 31 unchanged lines hidden ---
1866
1867 ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
1868 sge_init_locked(sc);
1869 if (!IFQ_DRV_IS_EMPTY(&sc->sge_ifp->if_snd))
1870 sge_start_locked(ifp);
1871}
1872
1873/*

--- 31 unchanged lines hidden ---