if_lem_netmap.h (271849) | if_lem_netmap.h (285349) |
---|---|
1/* 2 * Copyright (C) 2011-2014 Matteo Landi, 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. --- 11 unchanged lines hidden (view full) --- 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/* | 1/* 2 * Copyright (C) 2011-2014 Matteo Landi, 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. --- 11 unchanged lines hidden (view full) --- 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/* |
28 * $FreeBSD: head/sys/dev/netmap/if_lem_netmap.h 271849 2014-09-19 03:51:26Z glebius $ | 28 * $FreeBSD: head/sys/dev/netmap/if_lem_netmap.h 285349 2015-07-10 05:51:36Z luigi $ |
29 * 30 * netmap support for: lem 31 * 32 * For details on netmap support please see ixgbe_netmap.h 33 */ 34 35 36#include <net/netmap.h> --- 260 unchanged lines hidden (view full) --- 297 if (nic_i >= kring->nkr_num_slots) { /* XXX can it happen ? */ 298 D("TDH wrap %d", nic_i); 299 nic_i -= kring->nkr_num_slots; 300 } 301 adapter->next_tx_to_clean = nic_i; 302 kring->nr_hwtail = nm_prev(netmap_idx_n2k(kring, nic_i), lim); 303 } 304 | 29 * 30 * netmap support for: lem 31 * 32 * For details on netmap support please see ixgbe_netmap.h 33 */ 34 35 36#include <net/netmap.h> --- 260 unchanged lines hidden (view full) --- 297 if (nic_i >= kring->nkr_num_slots) { /* XXX can it happen ? */ 298 D("TDH wrap %d", nic_i); 299 nic_i -= kring->nkr_num_slots; 300 } 301 adapter->next_tx_to_clean = nic_i; 302 kring->nr_hwtail = nm_prev(netmap_idx_n2k(kring, nic_i), lim); 303 } 304 |
305 nm_txsync_finalize(kring); 306 | |
307 return 0; 308} 309 310 311/* 312 * Reconcile kernel and user view of the receive ring. 313 */ 314static int 315lem_netmap_rxsync(struct netmap_kring *kring, int flags) 316{ 317 struct netmap_adapter *na = kring->na; 318 struct ifnet *ifp = na->ifp; 319 struct netmap_ring *ring = kring->ring; 320 u_int nm_i; /* index into the netmap ring */ 321 u_int nic_i; /* index into the NIC ring */ 322 u_int n; 323 u_int const lim = kring->nkr_num_slots - 1; | 305 return 0; 306} 307 308 309/* 310 * Reconcile kernel and user view of the receive ring. 311 */ 312static int 313lem_netmap_rxsync(struct netmap_kring *kring, int flags) 314{ 315 struct netmap_adapter *na = kring->na; 316 struct ifnet *ifp = na->ifp; 317 struct netmap_ring *ring = kring->ring; 318 u_int nm_i; /* index into the netmap ring */ 319 u_int nic_i; /* index into the NIC ring */ 320 u_int n; 321 u_int const lim = kring->nkr_num_slots - 1; |
324 u_int const head = nm_rxsync_prologue(kring); | 322 u_int const head = kring->rhead; |
325 int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR; 326 327 /* device-specific */ 328 struct adapter *adapter = ifp->if_softc; 329#ifdef NIC_PARAVIRT 330 struct paravirt_csb *csb = adapter->csb; 331 uint32_t csb_mode = csb && csb->guest_csb_on; 332 uint32_t do_host_rxkick = 0; --- 128 unchanged lines hidden (view full) --- 461 /* set unconditionally, then also kick if needed */ 462 if (csb) 463 csb->guest_rdt = nic_i; 464 if (!csb_mode || do_host_rxkick) 465#endif /* NIC_PARAVIRT */ 466 E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), nic_i); 467 } 468 | 323 int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR; 324 325 /* device-specific */ 326 struct adapter *adapter = ifp->if_softc; 327#ifdef NIC_PARAVIRT 328 struct paravirt_csb *csb = adapter->csb; 329 uint32_t csb_mode = csb && csb->guest_csb_on; 330 uint32_t do_host_rxkick = 0; --- 128 unchanged lines hidden (view full) --- 459 /* set unconditionally, then also kick if needed */ 460 if (csb) 461 csb->guest_rdt = nic_i; 462 if (!csb_mode || do_host_rxkick) 463#endif /* NIC_PARAVIRT */ 464 E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), nic_i); 465 } 466 |
469 /* tell userspace that there might be new packets */ 470 nm_rxsync_finalize(kring); 471 | |
472 return 0; 473 474ring_reset: 475 return netmap_ring_reinit(kring); 476} 477 478 479static void --- 18 unchanged lines hidden --- | 467 return 0; 468 469ring_reset: 470 return netmap_ring_reinit(kring); 471} 472 473 474static void --- 18 unchanged lines hidden --- |