aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/netmap/if_igb_netmap.h
diff options
context:
space:
mode:
authorLuigi Rizzo <luigi@FreeBSD.org>2012-02-15 23:13:29 +0000
committerLuigi Rizzo <luigi@FreeBSD.org>2012-02-15 23:13:29 +0000
commit5644ccec612ab2b8c38f1752bb75919f86970a27 (patch)
treeff5d6ba38e3c75e6316b850d0cfb7877385f0bdc /sys/dev/netmap/if_igb_netmap.h
parenta7d022e777918b571b508b3391108a7d874b921c (diff)
Notes
Diffstat (limited to 'sys/dev/netmap/if_igb_netmap.h')
-rw-r--r--sys/dev/netmap/if_igb_netmap.h12
1 files changed, 3 insertions, 9 deletions
diff --git a/sys/dev/netmap/if_igb_netmap.h b/sys/dev/netmap/if_igb_netmap.h
index 86dd331455b6..7bea4b146a79 100644
--- a/sys/dev/netmap/if_igb_netmap.h
+++ b/sys/dev/netmap/if_igb_netmap.h
@@ -169,9 +169,7 @@ igb_netmap_txsync(struct ifnet *ifp, u_int ring_nr, int do_lock)
u32 olinfo_status =
(adapter->hw.mac.type == e1000_82575) ? (txr->me << 4) : 0;
- l = j - kring->nkr_hwofs;
- if (l < 0)
- l += lim + 1;
+ l = netmap_tidx_k2n(na, ring_nr, j);
while (j != k) {
struct netmap_slot *slot = &ring->slot[j];
union e1000_adv_tx_desc *curr =
@@ -287,9 +285,7 @@ igb_netmap_rxsync(struct ifnet *ifp, u_int ring_nr, int do_lock)
* j == (l + kring->nkr_hwofs) % ring_size
*/
l = rxr->next_to_check;
- j = l + kring->nkr_hwofs;
- if (j > lim)
- j -= lim + 1;
+ j = netmap_ridx_n2k(na, ring_nr, l);
for (n = 0; ; n++) {
union e1000_adv_rx_desc *curr = &rxr->rx_base[l];
uint32_t staterr = le32toh(curr->wb.upper.status_error);
@@ -311,9 +307,7 @@ igb_netmap_rxsync(struct ifnet *ifp, u_int ring_nr, int do_lock)
j = kring->nr_hwcur;
if (j != k) { /* userspace has read some packets. */
n = 0;
- l = j - kring->nkr_hwofs;
- if (l < 0)
- l += lim + 1;
+ l = netmap_ridx_k2n(na, ring_nr, j);
while (j != k) {
struct netmap_slot *slot = ring->slot + j;
union e1000_adv_rx_desc *curr = &rxr->rx_base[l];