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.
This commit is contained in:
luigi 2012-04-13 16:42:54 +00:00
parent e736e38132
commit 3cef61f727
2 changed files with 13 additions and 4 deletions

View File

@ -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 adapter *adapter)
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 +

View File

@ -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;