From owner-svn-src-all@FreeBSD.ORG Mon Feb 9 03:32:24 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 459BD1065676; Mon, 9 Feb 2009 03:32:24 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 327EE8FC1B; Mon, 9 Feb 2009 03:32:24 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n193WOK9043707; Mon, 9 Feb 2009 03:32:24 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n193WOPc043706; Mon, 9 Feb 2009 03:32:24 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200902090332.n193WOPc043706@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 9 Feb 2009 03:32:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188368 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/fxp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Feb 2009 03:32:25 -0000 Author: yongari Date: Mon Feb 9 03:32:23 2009 New Revision: 188368 URL: http://svn.freebsd.org/changeset/base/188368 Log: MFC r185273 Fix Tx/Rx checksum offload ioctl handling and make Rx handler honor checksum offload configuration. Now checksum offload can be controlled by ifconfig(8). While I'm here add an additional check for interface capabilities before applying user's request. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/fxp/if_fxp.c Modified: stable/7/sys/dev/fxp/if_fxp.c ============================================================================== --- stable/7/sys/dev/fxp/if_fxp.c Mon Feb 9 03:31:53 2009 (r188367) +++ stable/7/sys/dev/fxp/if_fxp.c Mon Feb 9 03:32:23 2009 (r188368) @@ -1558,6 +1558,7 @@ fxp_intr_body(struct fxp_softc *sc, stru struct fxp_rfa *rfa; int rnr = (statack & FXP_SCB_STATACK_RNR) ? 1 : 0; int fxp_rc = 0; + uint16_t status; FXP_LOCK_ASSERT(sc, MA_OWNED); if (rnr) @@ -1635,7 +1636,8 @@ fxp_intr_body(struct fxp_softc *sc, stru } #endif /* DEVICE_POLLING */ - if ((le16toh(rfa->rfa_status) & FXP_RFA_STATUS_C) == 0) + status = le16toh(rfa->rfa_status); + if ((status & FXP_RFA_STATUS_C) == 0) break; /* @@ -1661,14 +1663,14 @@ fxp_intr_body(struct fxp_softc *sc, stru total_len = le16toh(rfa->actual_size) & 0x3fff; if (total_len < sizeof(struct ether_header) || total_len > MCLBYTES - RFA_ALIGNMENT_FUDGE - - sc->rfa_size || - le16toh(rfa->rfa_status) & FXP_RFA_STATUS_CRC) { + sc->rfa_size || status & FXP_RFA_STATUS_CRC) { m_freem(m); continue; } /* Do IP checksum checking. */ - if (le16toh(rfa->rfa_status) & FXP_RFA_STATUS_PARSE) { + if ((ifp->if_capenable & IFCAP_RXCSUM) != 0 && + (status & FXP_RFA_STATUS_PARSE)) { if (rfa->rfax_csum_sts & FXP_RFDX_CS_IP_CSUM_BIT_VALID) m->m_pkthdr.csum_flags |= @@ -2372,7 +2374,7 @@ fxp_ioctl(struct ifnet *ifp, u_long comm struct fxp_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; struct mii_data *mii; - int flag, mask, error = 0; + int flag, mask, error = 0, reinit; switch (command) { case SIOCSIFFLAGS: @@ -2432,6 +2434,7 @@ fxp_ioctl(struct ifnet *ifp, u_long comm break; case SIOCSIFCAP: + reinit = 0; mask = ifp->if_capenable ^ ifr->ifr_reqcap; #ifdef DEVICE_POLLING if (mask & IFCAP_POLLING) { @@ -2454,8 +2457,20 @@ fxp_ioctl(struct ifnet *ifp, u_long comm } } #endif - if (mask & IFCAP_VLAN_MTU) { - FXP_LOCK(sc); + FXP_LOCK(sc); + if ((mask & IFCAP_TXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_TXCSUM) != 0) { + ifp->if_capenable ^= IFCAP_TXCSUM; + if ((ifp->if_capenable & IFCAP_TXCSUM) != 0) + ifp->if_hwassist |= FXP_CSUM_FEATURES; + else + ifp->if_hwassist &= ~FXP_CSUM_FEATURES; + } + if ((mask & IFCAP_RXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_RXCSUM) != 0) + ifp->if_capenable ^= IFCAP_RXCSUM; + if ((mask & IFCAP_VLAN_MTU) != 0 && + (ifp->if_capabilities & IFCAP_VLAN_MTU) != 0) { ifp->if_capenable ^= IFCAP_VLAN_MTU; if (sc->revision != FXP_REV_82557) flag = FXP_FLAG_LONG_PKT_EN; @@ -2463,9 +2478,11 @@ fxp_ioctl(struct ifnet *ifp, u_long comm flag = FXP_FLAG_SAVE_BAD; sc->flags ^= flag; if (ifp->if_flags & IFF_UP) - fxp_init_body(sc); - FXP_UNLOCK(sc); + reinit++; } + if (reinit > 0) + fxp_init_body(sc); + FXP_UNLOCK(sc); break; default: