Author: yongari
Date: Mon Mar 22 19:04:02 2010
New Revision: 205458
URL: http://svn.freebsd.org/changeset/base/205458

Log:
  MFC r204149:
    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.

Modified:
  stable/7/sys/net/if.h
  stable/7/sys/net/if_vlan.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/net/if.h
==============================================================================
--- stable/7/sys/net/if.h       Mon Mar 22 18:51:56 2010        (r205457)
+++ stable/7/sys/net/if.h       Mon Mar 22 19:04:02 2010        (r205458)
@@ -217,6 +217,7 @@ struct if_data {
 #define        IFCAP_TOE4              0x04000 /* interface can offload TCP */
 #define        IFCAP_TOE6              0x08000 /* interface can offload TCP6 */
 #define        IFCAP_VLAN_HWFILTER     0x10000 /* interface hw can filter vlan 
tag */
+#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: stable/7/sys/net/if_vlan.c
==============================================================================
--- stable/7/sys/net/if_vlan.c  Mon Mar 22 18:51:56 2010        (r205457)
+++ stable/7/sys/net/if_vlan.c  Mon Mar 22 19:04:02 2010        (r205458)
@@ -1271,11 +1271,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
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to