aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/e1000/if_lem.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/e1000/if_lem.c')
-rw-r--r--sys/dev/e1000/if_lem.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/dev/e1000/if_lem.c b/sys/dev/e1000/if_lem.c
index 0774cb99f5cb..be4626054a53 100644
--- a/sys/dev/e1000/if_lem.c
+++ b/sys/dev/e1000/if_lem.c
@@ -2668,13 +2668,11 @@ lem_setup_transmit_structures(struct adapter *adapter)
tx_buffer->m_head = NULL;
#ifdef DEV_NETMAP
if (slot) {
- /* slot si is mapped to the i-th NIC-ring entry */
- int si = i + na->tx_rings[0].nkr_hwofs;
+ /* the i-th NIC entry goes to slot si */
+ int si = netmap_tidx_n2k(na, 0, i);
uint64_t paddr;
void *addr;
- if (si > na->num_tx_desc)
- si -= na->num_tx_desc;
addr = PNMB(slot + si, &paddr);
adapter->tx_desc_base[si].buffer_addr = htole64(paddr);
/* reload the map for netmap mode */
@@ -3244,13 +3242,11 @@ lem_setup_receive_structures(struct adapter *adapter)
for (i = 0; i < adapter->num_rx_desc; i++) {
#ifdef DEV_NETMAP
if (slot) {
- /* slot si is mapped to the i-th NIC-ring entry */
- int si = i + na->rx_rings[0].nkr_hwofs;
+ /* the i-th NIC entry goes to slot si */
+ int si = netmap_ridx_n2k(na, 0, i);
uint64_t paddr;
void *addr;
- if (si > na->num_rx_desc)
- si -= na->num_rx_desc;
addr = PNMB(slot + si, &paddr);
netmap_load_map(adapter->rxtag, rx_buffer->map, addr);
/* Update descriptor */