Deleted Added
full compact
if_ixl_netmap.h (279232) if_ixl_netmap.h (285349)
1/*
2 * Copyright (C) 2015, Luigi Rizzo. 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) 2015, Luigi Rizzo. 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_ixl_netmap.h 279232 2015-02-24 06:20:50Z luigi $
27 * $FreeBSD: head/sys/dev/netmap/if_ixl_netmap.h 285349 2015-07-10 05:51:36Z luigi $
28 *
29 * netmap support for: ixl
30 *
31 * derived from ixgbe
32 * netmap support for a network driver.
33 * This file contains code but only static or inline functions used
34 * by a single driver. To avoid replication of code we just #include
35 * it near the beginning of the standard driver.

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

63 * During regular operations the CRC is stripped, but on some
64 * hardware reception of frames not multiple of 64 is slower,
65 * so using crcstrip=0 helps in benchmarks.
66 *
67 * ixl_rx_miss, ixl_rx_miss_bufs:
68 * count packets that might be missed due to lost interrupts.
69 */
70SYSCTL_DECL(_dev_netmap);
28 *
29 * netmap support for: ixl
30 *
31 * derived from ixgbe
32 * netmap support for a network driver.
33 * This file contains code but only static or inline functions used
34 * by a single driver. To avoid replication of code we just #include
35 * it near the beginning of the standard driver.

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

63 * During regular operations the CRC is stripped, but on some
64 * hardware reception of frames not multiple of 64 is slower,
65 * so using crcstrip=0 helps in benchmarks.
66 *
67 * ixl_rx_miss, ixl_rx_miss_bufs:
68 * count packets that might be missed due to lost interrupts.
69 */
70SYSCTL_DECL(_dev_netmap);
71int ixl_rx_miss, ixl_rx_miss_bufs, ixl_crcstrip;
71/*
72 * The xl driver by default strips CRCs and we do not override it.
73 */
74int ixl_rx_miss, ixl_rx_miss_bufs, ixl_crcstrip = 1;
75#if 0
72SYSCTL_INT(_dev_netmap, OID_AUTO, ixl_crcstrip,
76SYSCTL_INT(_dev_netmap, OID_AUTO, ixl_crcstrip,
73 CTLFLAG_RW, &ixl_crcstrip, 0, "strip CRC on rx frames");
77 CTLFLAG_RW, &ixl_crcstrip, 1, "strip CRC on rx frames");
78#endif
74SYSCTL_INT(_dev_netmap, OID_AUTO, ixl_rx_miss,
75 CTLFLAG_RW, &ixl_rx_miss, 0, "potentially missed rx intr");
76SYSCTL_INT(_dev_netmap, OID_AUTO, ixl_rx_miss_bufs,
77 CTLFLAG_RW, &ixl_rx_miss_bufs, 0, "potentially missed rx intr bufs");
78
79
80/*
81 * Register/unregister. We are already under netmap lock.

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

263 */
264 nic_i = LE32_TO_CPU(*(volatile __le32 *)&txr->base[que->num_desc]);
265 if (nic_i != txr->next_to_clean) {
266 /* some tx completed, increment avail */
267 txr->next_to_clean = nic_i;
268 kring->nr_hwtail = nm_prev(netmap_idx_n2k(kring, nic_i), lim);
269 }
270
79SYSCTL_INT(_dev_netmap, OID_AUTO, ixl_rx_miss,
80 CTLFLAG_RW, &ixl_rx_miss, 0, "potentially missed rx intr");
81SYSCTL_INT(_dev_netmap, OID_AUTO, ixl_rx_miss_bufs,
82 CTLFLAG_RW, &ixl_rx_miss_bufs, 0, "potentially missed rx intr bufs");
83
84
85/*
86 * Register/unregister. We are already under netmap lock.

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

268 */
269 nic_i = LE32_TO_CPU(*(volatile __le32 *)&txr->base[que->num_desc]);
270 if (nic_i != txr->next_to_clean) {
271 /* some tx completed, increment avail */
272 txr->next_to_clean = nic_i;
273 kring->nr_hwtail = nm_prev(netmap_idx_n2k(kring, nic_i), lim);
274 }
275
271 nm_txsync_finalize(kring);
272
273 return 0;
274}
275
276
277/*
278 * Reconcile kernel and user view of the receive ring.
279 * Same as for the txsync, this routine must be efficient.
280 * The caller guarantees a single invocations, but races against

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

292{
293 struct netmap_adapter *na = kring->na;
294 struct ifnet *ifp = na->ifp;
295 struct netmap_ring *ring = kring->ring;
296 u_int nm_i; /* index into the netmap ring */
297 u_int nic_i; /* index into the NIC ring */
298 u_int n;
299 u_int const lim = kring->nkr_num_slots - 1;
276 return 0;
277}
278
279
280/*
281 * Reconcile kernel and user view of the receive ring.
282 * Same as for the txsync, this routine must be efficient.
283 * The caller guarantees a single invocations, but races against

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

295{
296 struct netmap_adapter *na = kring->na;
297 struct ifnet *ifp = na->ifp;
298 struct netmap_ring *ring = kring->ring;
299 u_int nm_i; /* index into the netmap ring */
300 u_int nic_i; /* index into the NIC ring */
301 u_int n;
302 u_int const lim = kring->nkr_num_slots - 1;
300 u_int const head = nm_rxsync_prologue(kring);
303 u_int const head = kring->rhead;
301 int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR;
302
303 /* device-specific */
304 struct ixl_vsi *vsi = ifp->if_softc;
305 struct ixl_queue *que = &vsi->queues[kring->ring_id];
306 struct rx_ring *rxr = &que->rxr;
307
308 if (head > lim)

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

403 /*
404 * IMPORTANT: we must leave one free slot in the ring,
405 * so move nic_i back by one unit
406 */
407 nic_i = nm_prev(nic_i, lim);
408 wr32(vsi->hw, rxr->tail, nic_i);
409 }
410
304 int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR;
305
306 /* device-specific */
307 struct ixl_vsi *vsi = ifp->if_softc;
308 struct ixl_queue *que = &vsi->queues[kring->ring_id];
309 struct rx_ring *rxr = &que->rxr;
310
311 if (head > lim)

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

406 /*
407 * IMPORTANT: we must leave one free slot in the ring,
408 * so move nic_i back by one unit
409 */
410 nic_i = nm_prev(nic_i, lim);
411 wr32(vsi->hw, rxr->tail, nic_i);
412 }
413
411 /* tell userspace that there might be new packets */
412 nm_rxsync_finalize(kring);
413
414 return 0;
415
416ring_reset:
417 return netmap_ring_reinit(kring);
418}
419
420#endif /* !NETMAP_IXL_MAIN */
421
422/* end of file */
414 return 0;
415
416ring_reset:
417 return netmap_ring_reinit(kring);
418}
419
420#endif /* !NETMAP_IXL_MAIN */
421
422/* end of file */