summaryrefslogtreecommitdiffstats
path: root/sys/dev/netmap/if_em_netmap.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/netmap/if_em_netmap.h')
-rw-r--r--sys/dev/netmap/if_em_netmap.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/sys/dev/netmap/if_em_netmap.h b/sys/dev/netmap/if_em_netmap.h
index 8b0c7e8..2009f87 100644
--- a/sys/dev/netmap/if_em_netmap.h
+++ b/sys/dev/netmap/if_em_netmap.h
@@ -27,7 +27,7 @@
* $FreeBSD$
* $Id: if_em_netmap.h 9802 2011-12-02 18:42:37Z luigi $
*
- * netmap changes for if_em.
+ * netmap support for if_em.
*
* For structure and details on the individual functions please see
* ixgbe_netmap.h
@@ -46,6 +46,7 @@ static int em_netmap_txsync(struct ifnet *, u_int, int);
static int em_netmap_rxsync(struct ifnet *, u_int, int);
static void em_netmap_lock_wrapper(struct ifnet *, int, u_int);
+
static void
em_netmap_attach(struct adapter *adapter)
{
@@ -137,6 +138,7 @@ em_netmap_unblock_tasks(struct adapter *adapter)
}
}
+
/*
* register-unregister routine
*/
@@ -170,7 +172,7 @@ em_netmap_reg(struct ifnet *ifp, int onoff)
}
} else {
fail:
- /* restore if_transmit */
+ /* return to non-netmap mode */
ifp->if_transmit = na->if_transmit;
ifp->if_capenable &= ~IFCAP_NETMAP;
em_init_locked(adapter); /* also enable intr */
@@ -179,6 +181,7 @@ fail:
return (error);
}
+
/*
* Reconcile hardware and user view of the transmit ring.
*/
@@ -224,6 +227,7 @@ em_netmap_txsync(struct ifnet *ifp, u_int ring_nr, int do_lock)
uint64_t paddr;
void *addr = PNMB(slot, &paddr);
int len = slot->len;
+
if (addr == netmap_buffer_base || len > NETMAP_BUF_SIZE) {
if (do_lock)
EM_TX_UNLOCK(txr);
@@ -262,9 +266,9 @@ em_netmap_txsync(struct ifnet *ifp, u_int ring_nr, int do_lock)
if (n == 0 || kring->nr_hwavail < 1) {
int delta;
- /* record completed transmissions using THD. */
+ /* record completed transmissions using TDH */
l = E1000_READ_REG(&adapter->hw, E1000_TDH(ring_nr));
- if (l >= kring->nkr_num_slots) { /* XXX can happen */
+ if (l >= kring->nkr_num_slots) { /* XXX can it happen ? */
D("TDH wrap %d", l);
l -= kring->nkr_num_slots;
}
@@ -285,6 +289,7 @@ em_netmap_txsync(struct ifnet *ifp, u_int ring_nr, int do_lock)
return 0;
}
+
/*
* Reconcile kernel and user view of the receive ring.
*/
@@ -304,6 +309,7 @@ em_netmap_rxsync(struct ifnet *ifp, u_int ring_nr, int do_lock)
if (do_lock)
EM_RX_LOCK(rxr);
+
/* XXX check sync modes */
bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map,
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
@@ -317,7 +323,7 @@ em_netmap_rxsync(struct ifnet *ifp, u_int ring_nr, int do_lock)
*/
l = rxr->next_to_check;
j = l + kring->nkr_hwofs;
- /* here nkr_hwofs can be negative so must check for j < 0 */
+ /* XXX here nkr_hwofs can be negative so must check for j < 0 */
if (j < 0)
j += lim + 1;
else if (j > lim)
@@ -395,3 +401,4 @@ em_netmap_rxsync(struct ifnet *ifp, u_int ring_nr, int do_lock)
EM_RX_UNLOCK(rxr);
return 0;
}
+/* end of file */
OpenPOWER on IntegriCloud