summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Strobl <marius@FreeBSD.org>2017-09-20 22:14:50 +0000
committerMarius Strobl <marius@FreeBSD.org>2017-09-20 22:14:50 +0000
commit55f826f99096541fea087d77dd3a76b0cda9e35f (patch)
treed924ea027cec2934f4a99e2cfa274f8073191c5a
parent211396c70a3db60439e4b09dfe942610f4168e17 (diff)
Notes
-rw-r--r--sys/dev/ixgbe/if_ix.c2
-rw-r--r--sys/dev/ixgbe/ixgbe_netmap.c7
-rw-r--r--sys/dev/ixgbe/ixv_netmap.c61
-rw-r--r--sys/dev/ixgbe/ixv_netmap.h6
4 files changed, 18 insertions, 58 deletions
diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c
index 90f4cfd9cdfe..d10b5b33e49a 100644
--- a/sys/dev/ixgbe/if_ix.c
+++ b/sys/dev/ixgbe/if_ix.c
@@ -338,7 +338,7 @@ SYSCTL_INT(_hw_ix, OID_AUTO, rxd, CTLFLAG_RDTUN, &ixgbe_rxd, 0,
*/
static int allow_unsupported_sfp = FALSE;
TUNABLE_INT("hw.ix.unsupported_sfp", &allow_unsupported_sfp);
-SYSCTL_INT(_hw_ix, OID_AUTO, allow_unsupported_sfp, CTLFLAG_RDTUN,
+SYSCTL_INT(_hw_ix, OID_AUTO, unsupported_sfp, CTLFLAG_RDTUN,
&allow_unsupported_sfp, 0,
"Allow unsupported SFP modules...use at your own risk");
diff --git a/sys/dev/ixgbe/ixgbe_netmap.c b/sys/dev/ixgbe/ixgbe_netmap.c
index f1cdb418c20b..36e64a68c89e 100644
--- a/sys/dev/ixgbe/ixgbe_netmap.c
+++ b/sys/dev/ixgbe/ixgbe_netmap.c
@@ -316,6 +316,8 @@ ixgbe_netmap_txsync(struct netmap_kring *kring, int flags)
}
}
+ nm_txsync_finalize(kring);
+
return 0;
}
@@ -343,7 +345,7 @@ ixgbe_netmap_rxsync(struct netmap_kring *kring, int flags)
u_int nic_i; /* index into the NIC ring */
u_int n;
u_int const lim = kring->nkr_num_slots - 1;
- u_int const head = kring->rhead;
+ u_int const head = nm_rxsync_prologue(kring);
int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR;
/* device-specific */
@@ -450,6 +452,9 @@ ixgbe_netmap_rxsync(struct netmap_kring *kring, int flags)
IXGBE_WRITE_REG(&adapter->hw, rxr->tail, nic_i);
}
+ /* tell userspace that there might be new packets */
+ nm_rxsync_finalize(kring);
+
return 0;
ring_reset:
diff --git a/sys/dev/ixgbe/ixv_netmap.c b/sys/dev/ixgbe/ixv_netmap.c
index 84ba85b9f86d..8f45dcaa0b89 100644
--- a/sys/dev/ixgbe/ixv_netmap.c
+++ b/sys/dev/ixgbe/ixv_netmap.c
@@ -60,7 +60,7 @@
/*
* $FreeBSD$
*
- * netmap support for: ixgbe
+ * netmap support for: ixv
*
* This file is meant to be a reference on how to implement
* netmap support for a network driver.
@@ -83,63 +83,17 @@
/*
* device-specific sysctl variables:
*
- * ixv_crcstrip: 0: keep CRC in rx frames (default), 1: strip it.
- * During regular operations the CRC is stripped, but on some
- * hardware reception of frames not multiple of 64 is slower,
- * so using crcstrip=0 helps in benchmarks.
- *
* ixv_rx_miss, ixv_rx_miss_bufs:
* count packets that might be missed due to lost interrupts.
*/
SYSCTL_DECL(_dev_netmap);
static int ixv_rx_miss, ixv_rx_miss_bufs;
-int ixv_crcstrip;
-SYSCTL_INT(_dev_netmap, OID_AUTO, ixv_crcstrip,
- CTLFLAG_RW, &ixv_crcstrip, 0, "strip CRC on rx frames");
SYSCTL_INT(_dev_netmap, OID_AUTO, ixv_rx_miss,
CTLFLAG_RW, &ixv_rx_miss, 0, "potentially missed rx intr");
SYSCTL_INT(_dev_netmap, OID_AUTO, ixv_rx_miss_bufs,
CTLFLAG_RW, &ixv_rx_miss_bufs, 0, "potentially missed rx intr bufs");
-static void
-set_crcstrip(struct ixgbe_hw *hw, int onoff)
-{
- /* crc stripping is set in two places:
- * IXGBE_HLREG0 (modified on init_locked and hw reset)
- * IXGBE_RDRXCTL (set by the original driver in
- * ixgbe_setup_hw_rsc() called in init_locked.
- * We disable the setting when netmap is compiled in).
- * We update the values here, but also in ixgbe.c because
- * init_locked sometimes is called outside our control.
- */
- uint32_t hl, rxc;
-
- hl = IXGBE_READ_REG(hw, IXGBE_HLREG0);
- rxc = IXGBE_READ_REG(hw, IXGBE_RDRXCTL);
- if (netmap_verbose)
- D("%s read HLREG 0x%x rxc 0x%x",
- onoff ? "enter" : "exit", hl, rxc);
- /* hw requirements ... */
- rxc &= ~IXGBE_RDRXCTL_RSCFRSTSIZE;
- rxc |= IXGBE_RDRXCTL_RSCACKC;
- if (onoff && !ixv_crcstrip) {
- /* keep the crc. Fast rx */
- hl &= ~IXGBE_HLREG0_RXCRCSTRP;
- rxc &= ~IXGBE_RDRXCTL_CRCSTRIP;
- } else {
- /* reset default mode */
- hl |= IXGBE_HLREG0_RXCRCSTRP;
- rxc |= IXGBE_RDRXCTL_CRCSTRIP;
- }
- if (netmap_verbose)
- D("%s write HLREG 0x%x rxc 0x%x",
- onoff ? "enter" : "exit", hl, rxc);
- IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hl);
- IXGBE_WRITE_REG(hw, IXGBE_RDRXCTL, rxc);
-}
-
-
/*
* Register/unregister. We are already under netmap lock.
* Only called on the first register or the last unregister.
@@ -153,7 +107,6 @@ ixv_netmap_reg(struct netmap_adapter *na, int onoff)
IXGBE_CORE_LOCK(adapter);
adapter->stop_locked(adapter);
- set_crcstrip(&adapter->hw, onoff);
/* enable or disable flags and callbacks in na and ifp */
if (onoff) {
nm_set_native_flags(na);
@@ -161,7 +114,6 @@ ixv_netmap_reg(struct netmap_adapter *na, int onoff)
nm_clear_native_flags(na);
}
adapter->init_locked(adapter); /* also enables intr */
- set_crcstrip(&adapter->hw, onoff); // XXX why twice ?
IXGBE_CORE_UNLOCK(adapter);
return (ifp->if_drv_flags & IFF_DRV_RUNNING ? 0 : 1);
}
@@ -338,7 +290,7 @@ ixv_netmap_txsync(struct netmap_kring *kring, int flags)
* REPORT_STATUS in a few slots so TDH is the only
* good way.
*/
- nic_i = IXGBE_READ_REG(&adapter->hw, IXGBE_TDH(kring->ring_id));
+ nic_i = IXGBE_READ_REG(&adapter->hw, IXGBE_VFTDH(kring->ring_id));
if (nic_i >= kring->nkr_num_slots) { /* XXX can it happen ? */
D("TDH wrap %d", nic_i);
nic_i -= kring->nkr_num_slots;
@@ -350,6 +302,8 @@ ixv_netmap_txsync(struct netmap_kring *kring, int flags)
}
}
+ nm_txsync_finalize(kring);
+
return 0;
}
@@ -377,7 +331,7 @@ ixv_netmap_rxsync(struct netmap_kring *kring, int flags)
u_int nic_i; /* index into the NIC ring */
u_int n;
u_int const lim = kring->nkr_num_slots - 1;
- u_int const head = kring->rhead;
+ u_int const head = nm_rxsync_prologue(kring);
int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR;
/* device-specific */
@@ -407,7 +361,7 @@ ixv_netmap_rxsync(struct netmap_kring *kring, int flags)
* rxr->next_to_check is set to 0 on a ring reinit
*/
if (netmap_no_pendintr || force_update) {
- int crclen = (ixv_crcstrip) ? 0 : 4;
+ int crclen = 0;
uint16_t slot_flags = kring->nkr_slot_flags;
nic_i = rxr->next_to_check; // or also k2n(kring->nr_hwtail)
@@ -484,6 +438,9 @@ ixv_netmap_rxsync(struct netmap_kring *kring, int flags)
IXGBE_WRITE_REG(&adapter->hw, rxr->tail, nic_i);
}
+ /* tell userspace that there might be new packets */
+ nm_rxsync_finalize(kring);
+
return 0;
ring_reset:
diff --git a/sys/dev/ixgbe/ixv_netmap.h b/sys/dev/ixgbe/ixv_netmap.h
index addae348e7c0..a1a24b316672 100644
--- a/sys/dev/ixgbe/ixv_netmap.h
+++ b/sys/dev/ixgbe/ixv_netmap.h
@@ -42,12 +42,10 @@
#include <sys/selinfo.h>
#include <dev/netmap/netmap_kern.h>
-extern int ixv_crcstrip;
-
/*
- * ixgbe_netmap.c contains functions for netmap
+ * ixv_netmap.c contains functions for netmap
* support that extend the standard driver. See additional
- * comments in ixgbe_netmap.c.
+ * comments in ixv_netmap.c.
*/
void ixv_netmap_attach(struct adapter *adapter);