From owner-svn-src-head@freebsd.org Mon Jul 18 14:40:15 2016 Return-Path: Delivered-To: svn-src-head@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 6563DB9DF0B; Mon, 18 Jul 2016 14:40:15 +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 3CAFA1CE9; Mon, 18 Jul 2016 14:40:14 +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 u6IEeDBb078315; Mon, 18 Jul 2016 14:40:13 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6IEeDD3078314; Mon, 18 Jul 2016 14:40:13 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201607181440.u6IEeDD3078314@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 18 Jul 2016 14:40:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303000 - head/sys/dev/vmware/vmxnet3 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 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: Mon, 18 Jul 2016 14:40:15 -0000 Author: mav Date: Mon Jul 18 14:40:13 2016 New Revision: 303000 URL: https://svnweb.freebsd.org/changeset/base/303000 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. MFC after: 3 days Sponsored by: iXsystems, Inc. Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c ============================================================================== --- head/sys/dev/vmware/vmxnet3/if_vmx.c Mon Jul 18 10:53:47 2016 (r302999) +++ head/sys/dev/vmware/vmxnet3/if_vmx.c Mon Jul 18 14:40:13 2016 (r303000) @@ -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);