FreeBSD/sys/dev/ixl/if_ixlv.c
/*
 * Configure TXCSUM(IPV6) and TSO(4/6)
 *	- the hardware handles these together so we
 *	  need to tweak them 
 */
Configure TXCSUM(IPV6) and TSO(4/6)
- the hardware handles these together so we
need to tweak them
Configure TXCSUM ( IPV6 ) and TSO ( 4 / 6 ) - the hardware handles these together so we need to tweak them
static void
ixlv_cap_txcsum_tso(struct ixl_vsi *vsi, struct ifnet *ifp, int mask)
{
	if (!(ifp->if_capenable & IFCAP_TXCSUM)
	    && !(ifp->if_capenable & IFCAP_TSO4)) {
		if (mask & IFCAP_TXCSUM) {
			ifp->if_capenable |= IFCAP_TXCSUM;
			if (vsi->flags & IXL_FLAGS_KEEP_TSO4) {
				vsi->flags &= ~IXL_FLAGS_KEEP_TSO4;
				ifp->if_capenable |= IFCAP_TSO4;
			}
		}
		else if (mask & IFCAP_TSO4) {
			ifp->if_capenable |= (IFCAP_TXCSUM | IFCAP_TSO4);
			vsi->flags &= ~IXL_FLAGS_KEEP_TSO4;
			if_printf(ifp,
			    "TSO4 requires txcsum, enabling both...\n");
		}
	} else if((ifp->if_capenable & IFCAP_TXCSUM)
	    && !(ifp->if_capenable & IFCAP_TSO4)) {
		if (mask & IFCAP_TXCSUM)
			ifp->if_capenable &= ~IFCAP_TXCSUM;
		else if (mask & IFCAP_TSO4)
			ifp->if_capenable |= IFCAP_TSO4;
	} else if((ifp->if_capenable & IFCAP_TXCSUM)
	    && (ifp->if_capenable & IFCAP_TSO4)) {
		if (mask & IFCAP_TXCSUM) {
			vsi->flags |= IXL_FLAGS_KEEP_TSO4;
			ifp->if_capenable &= ~(IFCAP_TXCSUM | IFCAP_TSO4);
			if_printf(ifp, 
			    "TSO4 requires txcsum, disabling both...\n");
		} else if (mask & IFCAP_TSO4)
			ifp->if_capenable &= ~IFCAP_TSO4;
	}
	if (!(ifp->if_capenable & IFCAP_TXCSUM_IPV6)
	    && !(ifp->if_capenable & IFCAP_TSO6)) {
		if (mask & IFCAP_TXCSUM_IPV6) {
			ifp->if_capenable |= IFCAP_TXCSUM_IPV6;
			if (vsi->flags & IXL_FLAGS_KEEP_TSO6) {
				vsi->flags &= ~IXL_FLAGS_KEEP_TSO6;
				ifp->if_capenable |= IFCAP_TSO6;
			}
		} else if (mask & IFCAP_TSO6) {
			ifp->if_capenable |= (IFCAP_TXCSUM_IPV6 | IFCAP_TSO6);
			vsi->flags &= ~IXL_FLAGS_KEEP_TSO6;
			if_printf(ifp,
			    "TSO6 requires txcsum6, enabling both...\n");
		}
	} else if((ifp->if_capenable & IFCAP_TXCSUM_IPV6)
	    && !(ifp->if_capenable & IFCAP_TSO6)) {
		if (mask & IFCAP_TXCSUM_IPV6)
			ifp->if_capenable &= ~IFCAP_TXCSUM_IPV6;
		else if (mask & IFCAP_TSO6)
			ifp->if_capenable |= IFCAP_TSO6;
	} else if ((ifp->if_capenable & IFCAP_TXCSUM_IPV6)
	    && (ifp->if_capenable & IFCAP_TSO6)) {
		if (mask & IFCAP_TXCSUM_IPV6) {
			vsi->flags |= IXL_FLAGS_KEEP_TSO6;
			ifp->if_capenable &= ~(IFCAP_TXCSUM_IPV6 | IFCAP_TSO6);
			if_printf(ifp,
			    "TSO6 requires txcsum6, disabling both...\n");
		} else if (mask & IFCAP_TSO6)
			ifp->if_capenable &= ~IFCAP_TSO6;
	}
}
static void ixlv_cap_txcsum_tso ( struct ixl_vsi * vsi , struct ifnet * ifp , int mask ) { if ( ! ( ifp -> if_capenable & IFCAP_TXCSUM ) && ! ( ifp -> if_capenable & IFCAP_TSO4 ) ) { if ( mask & IFCAP_TXCSUM ) { ifp -> if_capenable |= IFCAP_TXCSUM ; if ( vsi -> flags & IXL_FLAGS_KEEP_TSO4 ) { vsi -> flags &= ~ IXL_FLAGS_KEEP_TSO4 ; ifp -> if_capenable |= IFCAP_TSO4 ; } } else if ( mask & IFCAP_TSO4 ) { ifp -> if_capenable |= ( IFCAP_TXCSUM | IFCAP_TSO4 ) ; vsi -> flags &= ~ IXL_FLAGS_KEEP_TSO4 ; if_printf ( ifp , " \n " ) ; } } else if ( ( ifp -> if_capenable & IFCAP_TXCSUM ) && ! ( ifp -> if_capenable & IFCAP_TSO4 ) ) { if ( mask & IFCAP_TXCSUM ) ifp -> if_capenable &= ~ IFCAP_TXCSUM ; else if ( mask & IFCAP_TSO4 ) ifp -> if_capenable |= IFCAP_TSO4 ; } else if ( ( ifp -> if_capenable & IFCAP_TXCSUM ) && ( ifp -> if_capenable & IFCAP_TSO4 ) ) { if ( mask & IFCAP_TXCSUM ) { vsi -> flags |= IXL_FLAGS_KEEP_TSO4 ; ifp -> if_capenable &= ~ ( IFCAP_TXCSUM | IFCAP_TSO4 ) ; if_printf ( ifp , " \n " ) ; } else if ( mask & IFCAP_TSO4 ) ifp -> if_capenable &= ~ IFCAP_TSO4 ; } if ( ! ( ifp -> if_capenable & IFCAP_TXCSUM_IPV6 ) && ! ( ifp -> if_capenable & IFCAP_TSO6 ) ) { if ( mask & IFCAP_TXCSUM_IPV6 ) { ifp -> if_capenable |= IFCAP_TXCSUM_IPV6 ; if ( vsi -> flags & IXL_FLAGS_KEEP_TSO6 ) { vsi -> flags &= ~ IXL_FLAGS_KEEP_TSO6 ; ifp -> if_capenable |= IFCAP_TSO6 ; } } else if ( mask & IFCAP_TSO6 ) { ifp -> if_capenable |= ( IFCAP_TXCSUM_IPV6 | IFCAP_TSO6 ) ; vsi -> flags &= ~ IXL_FLAGS_KEEP_TSO6 ; if_printf ( ifp , " \n " ) ; } } else if ( ( ifp -> if_capenable & IFCAP_TXCSUM_IPV6 ) && ! ( ifp -> if_capenable & IFCAP_TSO6 ) ) { if ( mask & IFCAP_TXCSUM_IPV6 ) ifp -> if_capenable &= ~ IFCAP_TXCSUM_IPV6 ; else if ( mask & IFCAP_TSO6 ) ifp -> if_capenable |= IFCAP_TSO6 ; } else if ( ( ifp -> if_capenable & IFCAP_TXCSUM_IPV6 ) && ( ifp -> if_capenable & IFCAP_TSO6 ) ) { if ( mask & IFCAP_TXCSUM_IPV6 ) { vsi -> flags |= IXL_FLAGS_KEEP_TSO6 ; ifp -> if_capenable &= ~ ( IFCAP_TXCSUM_IPV6 | IFCAP_TSO6 ) ; if_printf ( ifp , " \n " ) ; } else if ( mask & IFCAP_TSO6 ) ifp -> if_capenable &= ~ IFCAP_TSO6 ; } }
Configure TXCSUM(IPV6) and TSO(4/6)
      - the hardware handles these together so we
        need to tweak them
Configure TXCSUM ( IPV6 ) and TSO ( 4 / 6 ) - the hardware handles these together so we need to tweak them
/* Enable/disable TXCSUM/TSO4 */ /* enable TXCSUM, restore TSO if previously enabled */ /* Enable/disable TXCSUM_IPV6/TSO6 */