svn commit: r234229 - in head/sys/dev: ixgbe netmap
Luigi Rizzo
luigi at FreeBSD.org
Fri Apr 13 16:42:55 UTC 2012
Author: luigi
Date: Fri Apr 13 16:42:54 2012
New Revision: 234229
URL: http://svn.freebsd.org/changeset/base/234229
Log:
Properly disable crc stripping when operating in netmap mode.
Contrarily to what i wrote in my previous commit, the 82599
does include the CRC in the length. The operating mode is
reset in ixgbe_init_locked() and so we need to hook into
the places where the two registers (HLREG0 and RDRXCTL) are
modified.
Modified:
head/sys/dev/ixgbe/ixgbe.c
head/sys/dev/netmap/ixgbe_netmap.h
Modified: head/sys/dev/ixgbe/ixgbe.c
==============================================================================
--- head/sys/dev/ixgbe/ixgbe.c Fri Apr 13 16:32:33 2012 (r234228)
+++ head/sys/dev/ixgbe/ixgbe.c Fri Apr 13 16:42:54 2012 (r234229)
@@ -3812,6 +3812,9 @@ ixgbe_setup_hw_rsc(struct rx_ring *rxr)
rdrxctl = IXGBE_READ_REG(hw, IXGBE_RDRXCTL);
rdrxctl &= ~IXGBE_RDRXCTL_RSCFRSTSIZE;
+#ifdef DEV_NETMAP /* crcstrip is optional in netmap */
+ if (adapter->ifp->if_capenable & IFCAP_NETMAP && !ix_crcstrip)
+#endif /* DEV_NETMAP */
rdrxctl |= IXGBE_RDRXCTL_CRCSTRIP;
rdrxctl |= IXGBE_RDRXCTL_RSCACKC;
IXGBE_WRITE_REG(hw, IXGBE_RDRXCTL, rdrxctl);
@@ -4104,6 +4107,13 @@ ixgbe_initialize_receive_units(struct ad
hlreg |= IXGBE_HLREG0_JUMBOEN;
else
hlreg &= ~IXGBE_HLREG0_JUMBOEN;
+#ifdef DEV_NETMAP
+ /* crcstrip is conditional in netmap (in RDRXCTL too ?) */
+ if (ifp->if_capenable & IFCAP_NETMAP && !ix_crcstrip)
+ hlreg &= ~IXGBE_HLREG0_RXCRCSTRP;
+ else
+ hlreg |= IXGBE_HLREG0_RXCRCSTRP;
+#endif /* DEV_NETMAP */
IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg);
bufsz = (adapter->rx_mbuf_sz +
Modified: head/sys/dev/netmap/ixgbe_netmap.h
==============================================================================
--- head/sys/dev/netmap/ixgbe_netmap.h Fri Apr 13 16:32:33 2012 (r234228)
+++ head/sys/dev/netmap/ixgbe_netmap.h Fri Apr 13 16:42:54 2012 (r234229)
@@ -112,13 +112,12 @@ static void
set_crcstrip(struct ixgbe_hw *hw, int onoff)
{
/* crc stripping is set in two places:
- * IXGBE_HLREG0 (left alone by the original driver)
+ * 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).
- * When netmap is compiled in we disabling IXGBE_RDRXCTL
- * modifications of the IXGBE_RDRXCTL_CRCSTRIP bit, and
- * instead update the state here.
+ * We update the values here, but also in ixgbe.c because
+ * init_locked sometimes is called outside our control.
*/
uint32_t hl, rxc;
More information about the svn-src-head
mailing list