Skip to content

Instantly share code, notes, and snippets.

@kev009
Last active October 9, 2016 00:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kev009/4e464d396782c677ef5a6e7ff61bfc9b to your computer and use it in GitHub Desktop.
Save kev009/4e464d396782c677ef5a6e7ff61bfc9b to your computer and use it in GitHub Desktop.
diff --git a/sys/dev/ixgbe/iflib_if_ix.c b/sys/dev/ixgbe/iflib_if_ix.c
index b2ad008..3fc1b19 100644
--- a/sys/dev/ixgbe/iflib_if_ix.c
+++ b/sys/dev/ixgbe/iflib_if_ix.c
@@ -46,7 +46,7 @@
#ifdef RSS
#include <net/rss_config.h>
#include <netinet/in_rss.h>
-#endif
+#endif /* RSS */
/*********************************************************************
* Driver version
@@ -258,6 +258,10 @@ MODULE_DEPEND(ix, pci, 1, 1, 1);
MODULE_DEPEND(ix, ether, 1, 1, 1);
MODULE_DEPEND(ix, iflib, 1, 1, 1);
+#ifdef DEV_NETMAP
+MODULE_DEPEND(ix, netmap, 1, 1, 1);
+#endif /* DEV_NETMAP */
+
static device_method_t ixgbe_if_methods[] = {
DEVMETHOD(ifdi_attach_pre, ixgbe_if_attach_pre),
DEVMETHOD(ifdi_attach_post, ixgbe_if_attach_post),
@@ -383,6 +387,7 @@ SYSCTL_INT(_hw_ix, OID_AUTO, rxd, CTLFLAG_RDTUN, &ixgbe_rxd, 0,
"Number of receive descriptors per queue");
+#ifdef DEV_NETMAP
/* ix_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,
@@ -392,6 +397,7 @@ SYSCTL_DECL(_dev_netmap);
int ix_crcstrip;
SYSCTL_INT(_dev_netmap, OID_AUTO, ix_crcstrip,
CTLFLAG_RW, &ix_crcstrip, 0, "strip CRC on rx frames");
+#endif /* DEV_NETMAP */
/*
** Defining this on will allow the use
@@ -2955,6 +2961,7 @@ ixgbe_if_mtu_set(if_ctx_t ctx, uint32_t mtu)
static void
ixgbe_if_crcstrip_set(if_ctx_t ctx, int onoff)
{
+#ifdef DEV_NETMAP
struct adapter *sc = iflib_get_softc(ctx);
struct ixgbe_hw *hw = &sc->hw;
/* crc stripping is set in two places:
@@ -2989,6 +2996,7 @@ ixgbe_if_crcstrip_set(if_ctx_t ctx, int onoff)
onoff ? "enter" : "exit", hl, rxc);
IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hl);
IXGBE_WRITE_REG(hw, IXGBE_RDRXCTL, rxc);
+#endif /* DEV_NETMAP */
}
diff --git a/sys/dev/ixgbe/iflib_if_ixv.c b/sys/dev/ixgbe/iflib_if_ixv.c
index 8796d1c..3d6671f 100644
--- a/sys/dev/ixgbe/iflib_if_ixv.c
+++ b/sys/dev/ixgbe/iflib_if_ixv.c
@@ -119,18 +119,6 @@ static void ixv_set_sysctl_value(struct adapter *, const char *,
static int ixv_msix_que(void *);
static int ixv_msix_mbx(void *);
-#ifdef DEV_NETMAP
-/*
- * This is defined in <dev/netmap/ixgbe_netmap.h>, which is included by
- * if_ix.c.
- */
-extern void ixgbe_netmap_attach(struct adapter *adapter);
-
-#include <net/netmap.h>
-#include <sys/selinfo.h>
-#include <dev/netmap/netmap_kern.h>
-#endif /* DEV_NETMAP */
-
/*********************************************************************
* FreeBSD Device Interface Entry Points
*********************************************************************/
diff --git a/sys/dev/ixgbe/legacy_if_ixv.c b/sys/dev/ixgbe/legacy_if_ixv.c
index 7373e68..bd77141 100644
--- a/sys/dev/ixgbe/legacy_if_ixv.c
+++ b/sys/dev/ixgbe/legacy_if_ixv.c
@@ -40,6 +40,9 @@
#include "ixgbe.h"
+#include <net/netmap.h>
+#include <dev/netmap/netmap_kern.h>
+
/*********************************************************************
* Driver version
*********************************************************************/
@@ -132,10 +135,6 @@ static void ixv_handle_mbx(void *, int);
* if_ix.c.
*/
extern void ixgbe_netmap_attach(struct adapter *adapter);
-
-#include <net/netmap.h>
-#include <sys/selinfo.h>
-#include <dev/netmap/netmap_kern.h>
#endif /* DEV_NETMAP */
/*********************************************************************
diff --git a/sys/dev/ixgbe/legacy_ix_txrx.c b/sys/dev/ixgbe/legacy_ix_txrx.c
index 61c2ef0..f097469 100644
--- a/sys/dev/ixgbe/legacy_ix_txrx.c
+++ b/sys/dev/ixgbe/legacy_ix_txrx.c
@@ -44,15 +44,14 @@
#ifdef RSS
#include <net/rss_config.h>
#include <netinet/in_rss.h>
-#endif
+#endif /* RSS */
-#ifdef DEV_NETMAP
#include <net/netmap.h>
-#include <sys/selinfo.h>
#include <dev/netmap/netmap_kern.h>
+#ifdef DEV_NETMAP
extern int ix_crcstrip;
-#endif
+#endif /* DEV_NETMAP */
/*
** HW RSC control:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment