Deleted Added
full compact
if_igb_netmap.h (231778) if_igb_netmap.h (231796)
1/*
2 * Copyright (C) 2011 Universita` di Pisa. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

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

19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26/*
1/*
2 * Copyright (C) 2011 Universita` di Pisa. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

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

19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26/*
27 * $FreeBSD: head/sys/dev/netmap/if_igb_netmap.h 231778 2012-02-15 18:59:26Z luigi $
27 * $FreeBSD: head/sys/dev/netmap/if_igb_netmap.h 231796 2012-02-15 23:13:29Z luigi $
28 * $Id: if_igb_netmap.h 9802 2011-12-02 18:42:37Z luigi $
29 *
30 * netmap modifications for igb contributed by Ahmed Kooli
31 */
32
33#include <net/netmap.h>
34#include <sys/selinfo.h>
35#include <vm/vm.h>

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

164 * j == (l + kring->nkr_hwofs) % ring_size
165 */
166 j = kring->nr_hwcur;
167 if (j != k) { /* we have packets to send */
168 /* 82575 needs the queue index added */
169 u32 olinfo_status =
170 (adapter->hw.mac.type == e1000_82575) ? (txr->me << 4) : 0;
171
28 * $Id: if_igb_netmap.h 9802 2011-12-02 18:42:37Z luigi $
29 *
30 * netmap modifications for igb contributed by Ahmed Kooli
31 */
32
33#include <net/netmap.h>
34#include <sys/selinfo.h>
35#include <vm/vm.h>

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

164 * j == (l + kring->nkr_hwofs) % ring_size
165 */
166 j = kring->nr_hwcur;
167 if (j != k) { /* we have packets to send */
168 /* 82575 needs the queue index added */
169 u32 olinfo_status =
170 (adapter->hw.mac.type == e1000_82575) ? (txr->me << 4) : 0;
171
172 l = j - kring->nkr_hwofs;
173 if (l < 0)
174 l += lim + 1;
172 l = netmap_tidx_k2n(na, ring_nr, j);
175 while (j != k) {
176 struct netmap_slot *slot = &ring->slot[j];
177 union e1000_adv_tx_desc *curr =
178 (union e1000_adv_tx_desc *)&txr->tx_base[l];
179 struct igb_tx_buffer *txbuf = &txr->tx_buffers[l];
180 int flags = ((slot->flags & NS_REPORT) ||
181 j == 0 || j == report_frequency) ?
182 E1000_ADVTXD_DCMD_RS : 0;

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

282 /* import newly received packets into the netmap ring.
283 * j is an index in the netmap ring, l in the NIC ring, and
284 * j = (kring->nr_hwcur + kring->nr_hwavail) % ring_size
285 * l = rxr->next_to_check;
286 * and
287 * j == (l + kring->nkr_hwofs) % ring_size
288 */
289 l = rxr->next_to_check;
173 while (j != k) {
174 struct netmap_slot *slot = &ring->slot[j];
175 union e1000_adv_tx_desc *curr =
176 (union e1000_adv_tx_desc *)&txr->tx_base[l];
177 struct igb_tx_buffer *txbuf = &txr->tx_buffers[l];
178 int flags = ((slot->flags & NS_REPORT) ||
179 j == 0 || j == report_frequency) ?
180 E1000_ADVTXD_DCMD_RS : 0;

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

280 /* import newly received packets into the netmap ring.
281 * j is an index in the netmap ring, l in the NIC ring, and
282 * j = (kring->nr_hwcur + kring->nr_hwavail) % ring_size
283 * l = rxr->next_to_check;
284 * and
285 * j == (l + kring->nkr_hwofs) % ring_size
286 */
287 l = rxr->next_to_check;
290 j = l + kring->nkr_hwofs;
291 if (j > lim)
292 j -= lim + 1;
288 j = netmap_ridx_n2k(na, ring_nr, l);
293 for (n = 0; ; n++) {
294 union e1000_adv_rx_desc *curr = &rxr->rx_base[l];
295 uint32_t staterr = le32toh(curr->wb.upper.status_error);
296
297 if ((staterr & E1000_RXD_STAT_DD) == 0)
298 break;
299 ring->slot[j].len = le16toh(curr->wb.upper.length);
300 bus_dmamap_sync(rxr->ptag,

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

306 rxr->next_to_check = l;
307 kring->nr_hwavail += n;
308 }
309
310 /* skip past packets that userspace has already processed */
311 j = kring->nr_hwcur;
312 if (j != k) { /* userspace has read some packets. */
313 n = 0;
289 for (n = 0; ; n++) {
290 union e1000_adv_rx_desc *curr = &rxr->rx_base[l];
291 uint32_t staterr = le32toh(curr->wb.upper.status_error);
292
293 if ((staterr & E1000_RXD_STAT_DD) == 0)
294 break;
295 ring->slot[j].len = le16toh(curr->wb.upper.length);
296 bus_dmamap_sync(rxr->ptag,

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

302 rxr->next_to_check = l;
303 kring->nr_hwavail += n;
304 }
305
306 /* skip past packets that userspace has already processed */
307 j = kring->nr_hwcur;
308 if (j != k) { /* userspace has read some packets. */
309 n = 0;
314 l = j - kring->nkr_hwofs;
315 if (l < 0)
316 l += lim + 1;
310 l = netmap_ridx_k2n(na, ring_nr, j);
317 while (j != k) {
318 struct netmap_slot *slot = ring->slot + j;
319 union e1000_adv_rx_desc *curr = &rxr->rx_base[l];
320 struct igb_rx_buf *rxbuf = rxr->rx_buffers + l;
321 uint64_t paddr;
322 void *addr = PNMB(slot, &paddr);
323
324 if (addr == netmap_buffer_base) { /* bad buf */

--- 37 unchanged lines hidden ---
311 while (j != k) {
312 struct netmap_slot *slot = ring->slot + j;
313 union e1000_adv_rx_desc *curr = &rxr->rx_base[l];
314 struct igb_rx_buf *rxbuf = rxr->rx_buffers + l;
315 uint64_t paddr;
316 void *addr = PNMB(slot, &paddr);
317
318 if (addr == netmap_buffer_base) { /* bad buf */

--- 37 unchanged lines hidden ---