if_mge.c (246e7a2b6494cd991b08ac669ed761ecea0cc98c) if_mge.c (c8dfaf382fa6df9dc6fd1e1c3356e0c8bf607e6a)
1/*-
2 * Copyright (C) 2008 MARVELL INTERNATIONAL LTD.
3 * All rights reserved.
4 *
5 * Developed by Semihalf.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

1156 sc->rx_desc_curr = (++sc->rx_desc_curr % MGE_RX_DESC_NUM);
1157 bus_dmamap_sync(sc->mge_desc_dtag, dw->desc_dmap,
1158 BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
1159
1160 if (count > 0)
1161 count -= 1;
1162 }
1163
1/*-
2 * Copyright (C) 2008 MARVELL INTERNATIONAL LTD.
3 * All rights reserved.
4 *
5 * Developed by Semihalf.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

1156 sc->rx_desc_curr = (++sc->rx_desc_curr % MGE_RX_DESC_NUM);
1157 bus_dmamap_sync(sc->mge_desc_dtag, dw->desc_dmap,
1158 BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
1159
1160 if (count > 0)
1161 count -= 1;
1162 }
1163
1164 ifp->if_ipackets += rx_npkts;
1164 if_inc_counter(ifp, IFCOUNTER_IPACKETS, rx_npkts);
1165
1166 return (rx_npkts);
1167}
1168
1169static void
1170mge_intr_sum(void *arg)
1171{
1172 struct mge_softc *sc = arg;

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

1231
1232 sc->tx_desc_used_idx =
1233 (++sc->tx_desc_used_idx) % MGE_TX_DESC_NUM;
1234 sc->tx_desc_used_count--;
1235
1236 /* Update collision statistics */
1237 if (status & MGE_ERR_SUMMARY) {
1238 if ((status & MGE_ERR_MASK) == MGE_TX_ERROR_LC)
1165
1166 return (rx_npkts);
1167}
1168
1169static void
1170mge_intr_sum(void *arg)
1171{
1172 struct mge_softc *sc = arg;

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

1231
1232 sc->tx_desc_used_idx =
1233 (++sc->tx_desc_used_idx) % MGE_TX_DESC_NUM;
1234 sc->tx_desc_used_count--;
1235
1236 /* Update collision statistics */
1237 if (status & MGE_ERR_SUMMARY) {
1238 if ((status & MGE_ERR_MASK) == MGE_TX_ERROR_LC)
1239 ifp->if_collisions++;
1239 if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
1240 if ((status & MGE_ERR_MASK) == MGE_TX_ERROR_RL)
1240 if ((status & MGE_ERR_MASK) == MGE_TX_ERROR_RL)
1241 ifp->if_collisions += 16;
1241 if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 16);
1242 }
1243
1244 bus_dmamap_sync(sc->mge_tx_dtag, dw->buffer_dmap,
1245 BUS_DMASYNC_POSTWRITE);
1246 bus_dmamap_unload(sc->mge_tx_dtag, dw->buffer_dmap);
1247 m_freem(dw->buffer);
1248 dw->buffer = (struct mbuf*)NULL;
1249 send++;
1250
1242 }
1243
1244 bus_dmamap_sync(sc->mge_tx_dtag, dw->buffer_dmap,
1245 BUS_DMASYNC_POSTWRITE);
1246 bus_dmamap_unload(sc->mge_tx_dtag, dw->buffer_dmap);
1247 m_freem(dw->buffer);
1248 dw->buffer = (struct mbuf*)NULL;
1249 send++;
1250
1251 ifp->if_opackets++;
1251 if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
1252 }
1253
1254 if (send) {
1255 /* Now send anything that was pending */
1256 ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
1257 mge_start_locked(ifp);
1258 }
1259}

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

1511
1512 MGE_GLOBAL_LOCK(sc);
1513
1514 if (sc->wd_timer == 0 || --sc->wd_timer) {
1515 MGE_GLOBAL_UNLOCK(sc);
1516 return;
1517 }
1518
1252 }
1253
1254 if (send) {
1255 /* Now send anything that was pending */
1256 ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
1257 mge_start_locked(ifp);
1258 }
1259}

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

1511
1512 MGE_GLOBAL_LOCK(sc);
1513
1514 if (sc->wd_timer == 0 || --sc->wd_timer) {
1515 MGE_GLOBAL_UNLOCK(sc);
1516 return;
1517 }
1518
1519 ifp->if_oerrors++;
1519 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
1520 if_printf(ifp, "watchdog timeout\n");
1521
1522 mge_stop(sc);
1523 mge_init_locked(sc);
1524
1525 MGE_GLOBAL_UNLOCK(sc);
1526}
1527

--- 402 unchanged lines hidden ---
1520 if_printf(ifp, "watchdog timeout\n");
1521
1522 mge_stop(sc);
1523 mge_init_locked(sc);
1524
1525 MGE_GLOBAL_UNLOCK(sc);
1526}
1527

--- 402 unchanged lines hidden ---