From owner-svn-src-head@FreeBSD.ORG Sat Feb 20 22:47:22 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23494106566C; Sat, 20 Feb 2010 22:47:22 +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 EDE298FC08; Sat, 20 Feb 2010 22:47:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1KMlKea040833; Sat, 20 Feb 2010 22:47:20 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1KMlKPb040830; Sat, 20 Feb 2010 22:47:20 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201002202247.o1KMlKPb040830@svn.freebsd.org> From: Pyun YongHyeon Date: Sat, 20 Feb 2010 22:47:20 +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: r204149 - head/sys/net 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: Sat, 20 Feb 2010 22:47:22 -0000 Author: yongari Date: Sat Feb 20 22:47:20 2010 New Revision: 204149 URL: http://svn.freebsd.org/changeset/base/204149 Log: Add TSO support on VLANs. Intentionally separated IFCAP_VLAN_HWTSO from IFCAP_VLAN_HWTAGGING. I think some hardwares may be able to TSO over VLAN without VLAN hardware tagging. Driver changes and userland support will follow. Reviewed by: thompsa Modified: head/sys/net/if.h head/sys/net/if_vlan.c Modified: head/sys/net/if.h ============================================================================== --- head/sys/net/if.h Sat Feb 20 22:43:12 2010 (r204148) +++ head/sys/net/if.h Sat Feb 20 22:47:20 2010 (r204149) @@ -218,6 +218,7 @@ struct if_data { #define IFCAP_TOE6 0x08000 /* interface can offload TCP6 */ #define IFCAP_VLAN_HWFILTER 0x10000 /* interface hw can filter vlan tag */ #define IFCAP_POLLING_NOCOUNT 0x20000 /* polling ticks cannot be fragmented */ +#define IFCAP_VLAN_HWTSO 0x40000 /* can do IFCAP_TSO on VLANs */ #define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM) #define IFCAP_TSO (IFCAP_TSO4 | IFCAP_TSO6) Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Sat Feb 20 22:43:12 2010 (r204148) +++ head/sys/net/if_vlan.c Sat Feb 20 22:47:20 2010 (r204149) @@ -1322,11 +1322,26 @@ vlan_capabilities(struct ifvlan *ifv) if (p->if_capenable & IFCAP_VLAN_HWCSUM && p->if_capenable & IFCAP_VLAN_HWTAGGING) { ifp->if_capenable = p->if_capenable & IFCAP_HWCSUM; - ifp->if_hwassist = p->if_hwassist; + ifp->if_hwassist = p->if_hwassist & (CSUM_IP | CSUM_TCP | + CSUM_UDP | CSUM_SCTP | CSUM_IP_FRAGS | CSUM_FRAGMENT); } else { ifp->if_capenable = 0; ifp->if_hwassist = 0; } + /* + * If the parent interface can do TSO on VLANs then + * propagate the hardware-assisted flag. TSO on VLANs + * does not necessarily require hardware VLAN tagging. + */ + if (p->if_capabilities & IFCAP_VLAN_HWTSO) + ifp->if_capabilities |= p->if_capabilities & IFCAP_TSO; + if (p->if_capenable & IFCAP_VLAN_HWTSO) { + ifp->if_capenable |= p->if_capenable & IFCAP_TSO; + ifp->if_hwassist |= p->if_hwassist & CSUM_TSO; + } else { + ifp->if_capenable &= ~(p->if_capenable & IFCAP_TSO); + ifp->if_hwassist &= ~(p->if_hwassist & CSUM_TSO); + } } static void