From owner-svn-src-stable-11@freebsd.org Thu Jul 21 11:39:44 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64098BA0BBB; Thu, 21 Jul 2016 11:39:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 17385167B; Thu, 21 Jul 2016 11:39:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6LBdhtV026930; Thu, 21 Jul 2016 11:39:43 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6LBdhFK026929; Thu, 21 Jul 2016 11:39:43 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201607211139.u6LBdhFK026929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 21 Jul 2016 11:39:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r303136 - stable/11/sys/dev/vmware/vmxnet3 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jul 2016 11:39:44 -0000 Author: mav Date: Thu Jul 21 11:39:43 2016 New Revision: 303136 URL: https://svnweb.freebsd.org/changeset/base/303136 Log: Update if_hwassist when interface options are changed. In particular for me this fixes checksum problem when if_bridge attached to the interface requests TXCSUM to be disabled, but effectively ignored. Approved by: re (kib) Modified: stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/vmware/vmxnet3/if_vmx.c ============================================================================== --- stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Thu Jul 21 10:44:26 2016 (r303135) +++ stable/11/sys/dev/vmware/vmxnet3/if_vmx.c Thu Jul 21 11:39:43 2016 (r303136) @@ -130,6 +130,7 @@ static int vmxnet3_alloc_queue_data(stru static void vmxnet3_free_queue_data(struct vmxnet3_softc *); static int vmxnet3_alloc_mcast_table(struct vmxnet3_softc *); static void vmxnet3_init_shared_data(struct vmxnet3_softc *); +static void vmxnet3_init_hwassist(struct vmxnet3_softc *); static void vmxnet3_reinit_interface(struct vmxnet3_softc *); static void vmxnet3_reinit_rss_shared_data(struct vmxnet3_softc *); static void vmxnet3_reinit_shared_data(struct vmxnet3_softc *); @@ -1583,6 +1584,24 @@ vmxnet3_init_shared_data(struct vmxnet3_ } static void +vmxnet3_init_hwassist(struct vmxnet3_softc *sc) +{ + struct ifnet *ifp = sc->vmx_ifp; + uint64_t hwassist; + + hwassist = 0; + if (ifp->if_capenable & IFCAP_TXCSUM) + hwassist |= VMXNET3_CSUM_OFFLOAD; + if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) + hwassist |= VMXNET3_CSUM_OFFLOAD_IPV6; + if (ifp->if_capenable & IFCAP_TSO4) + hwassist |= CSUM_IP_TSO; + if (ifp->if_capenable & IFCAP_TSO6) + hwassist |= CSUM_IP6_TSO; + ifp->if_hwassist = hwassist; +} + +static void vmxnet3_reinit_interface(struct vmxnet3_softc *sc) { struct ifnet *ifp; @@ -1593,15 +1612,7 @@ vmxnet3_reinit_interface(struct vmxnet3_ bcopy(IF_LLADDR(sc->vmx_ifp), sc->vmx_lladdr, ETHER_ADDR_LEN); vmxnet3_set_lladdr(sc); - ifp->if_hwassist = 0; - if (ifp->if_capenable & IFCAP_TXCSUM) - ifp->if_hwassist |= VMXNET3_CSUM_OFFLOAD; - if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) - ifp->if_hwassist |= VMXNET3_CSUM_OFFLOAD_IPV6; - if (ifp->if_capenable & IFCAP_TSO4) - ifp->if_hwassist |= CSUM_IP_TSO; - if (ifp->if_capenable & IFCAP_TSO6) - ifp->if_hwassist |= CSUM_IP6_TSO; + vmxnet3_init_hwassist(sc); } static void @@ -3284,6 +3295,8 @@ vmxnet3_ioctl(struct ifnet *ifp, u_long if (reinit && (ifp->if_drv_flags & IFF_DRV_RUNNING)) { ifp->if_drv_flags &= ~IFF_DRV_RUNNING; vmxnet3_init_locked(sc); + } else { + vmxnet3_init_hwassist(sc); } VMXNET3_CORE_UNLOCK(sc);