From owner-svn-src-head@FreeBSD.ORG Fri Apr 13 16:42:55 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B2CC21065670; Fri, 13 Apr 2012 16:42:55 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 81F478FC16; Fri, 13 Apr 2012 16:42:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q3DGgtPk088692; Fri, 13 Apr 2012 16:42:55 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q3DGgtnC088689; Fri, 13 Apr 2012 16:42:55 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201204131642.q3DGgtnC088689@svn.freebsd.org> From: Luigi Rizzo Date: Fri, 13 Apr 2012 16:42:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r234229 - in head/sys/dev: ixgbe netmap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Apr 2012 16:42:55 -0000 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;