Index: head/sys/dev/e1000/if_em.c =================================================================== --- head/sys/dev/e1000/if_em.c +++ head/sys/dev/e1000/if_em.c @@ -2481,10 +2481,10 @@ INIT_DEBUGOUT("em_setup_interface: begin"); /* TSO parameters */ - ifp->if_hw_tsomax = IP_MAXPACKET; + if_sethwtsomax(ifp, IP_MAXPACKET); /* Take m_pullup(9)'s in em_xmit() w/ TSO into acount. */ - ifp->if_hw_tsomaxsegcount = EM_MAX_SCATTER - 5; - ifp->if_hw_tsomaxsegsize = EM_TSO_SEG_SIZE; + if_sethwtsomaxsegcount(ifp, EM_MAX_SCATTER - 5); + if_sethwtsomaxsegsize(ifp, EM_TSO_SEG_SIZE); /* Single Queue */ if (adapter->tx_num_queues == 1) { Index: head/sys/dev/vnic/nicvf_main.c =================================================================== --- head/sys/dev/vnic/nicvf_main.c +++ head/sys/dev/vnic/nicvf_main.c @@ -370,9 +370,9 @@ /* TSO */ if_setcapabilitiesbit(ifp, IFCAP_TSO4, 0); /* TSO parameters */ - ifp->if_hw_tsomax = NICVF_TSO_MAXSIZE; - ifp->if_hw_tsomaxsegcount = NICVF_TSO_NSEGS; - ifp->if_hw_tsomaxsegsize = MCLBYTES; + if_sethwtsomax(ifp, NICVF_TSO_MAXSIZE); + if_sethwtsomaxsegcount(ifp, NICVF_TSO_NSEGS); + if_sethwtsomaxsegsize(ifp, MCLBYTES); } /* IP/TCP/UDP HW checksums */ if_setcapabilitiesbit(ifp, IFCAP_HWCSUM, 0); @@ -453,7 +453,7 @@ #if defined(INET) || defined(INET6) /* Avoid reinitialization unless it's necessary */ if (avoid_reset) { - ifp->if_flags |= IFF_UP; + if_setflagbits(ifp, IFF_UP, 0); if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING)) nicvf_if_init(nic); #ifdef INET @@ -482,8 +482,8 @@ NICVF_CORE_LOCK(nic); if (if_getflags(ifp) & IFF_UP) { if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) { - flags = ifp->if_flags ^ nic->if_flags; - if ((nic->if_flags & ifp->if_flags) & + flags = if_getflags(ifp) ^ nic->if_flags; + if ((nic->if_flags & if_getflags(ifp)) & IFF_PROMISC) { /* Change promiscous mode */ #if 0 @@ -492,7 +492,7 @@ #endif } - if ((nic->if_flags ^ ifp->if_flags) & + if ((nic->if_flags ^ if_getflags(ifp)) & IFF_ALLMULTI) { /* Change multicasting settings */ #if 0 @@ -506,7 +506,7 @@ } else if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) nicvf_stop_locked(nic); - nic->if_flags = ifp->if_flags; + nic->if_flags = if_getflags(ifp); NICVF_CORE_UNLOCK(nic); break; @@ -528,24 +528,24 @@ break; case SIOCSIFCAP: - mask = ifp->if_capenable ^ ifr->ifr_reqcap; + mask = if_getcapenable(ifp) ^ ifr->ifr_reqcap; if (mask & IFCAP_VLAN_MTU) { /* No work to do except acknowledge the change took. */ - ifp->if_capenable ^= IFCAP_VLAN_MTU; + if_togglecapenable(ifp, IFCAP_VLAN_MTU); } if (mask & IFCAP_TXCSUM) - ifp->if_capenable ^= IFCAP_TXCSUM; + if_togglecapenable(ifp, IFCAP_TXCSUM); if (mask & IFCAP_RXCSUM) - ifp->if_capenable ^= IFCAP_RXCSUM; + if_togglecapenable(ifp, IFCAP_RXCSUM); if ((mask & IFCAP_TSO4) && nic->hw_tso) - ifp->if_capenable ^= IFCAP_TSO4; + if_togglecapenable(ifp, IFCAP_TSO4); if (mask & IFCAP_LRO) { /* * Lock the driver for a moment to avoid * mismatch in per-queue settings. */ NICVF_CORE_LOCK(nic); - ifp->if_capenable ^= IFCAP_LRO; + if_togglecapenable(ifp, IFCAP_LRO); if ((if_getdrvflags(nic->ifp) & IFF_DRV_RUNNING) != 0) { /* * Now disable LRO for subsequent packets. Index: head/sys/net/if.c =================================================================== --- head/sys/net/if.c +++ head/sys/net/if.c @@ -4103,6 +4103,51 @@ VLAN_CAPABILITIES(ifp); } +int +if_sethwtsomax(if_t ifp, u_int if_hw_tsomax) +{ + + ((struct ifnet *)ifp)->if_hw_tsomax = if_hw_tsomax; + return (0); +} + +int +if_sethwtsomaxsegcount(if_t ifp, u_int if_hw_tsomaxsegcount) +{ + + ((struct ifnet *)ifp)->if_hw_tsomaxsegcount = if_hw_tsomaxsegcount; + return (0); +} + +int +if_sethwtsomaxsegsize(if_t ifp, u_int if_hw_tsomaxsegsize) +{ + + ((struct ifnet *)ifp)->if_hw_tsomaxsegsize = if_hw_tsomaxsegsize; + return (0); +} + +u_int +if_gethwtsomax(if_t ifp) +{ + + return (((struct ifnet *)ifp)->if_hw_tsomax); +} + +u_int +if_gethwtsomaxsegcount(if_t ifp) +{ + + return (((struct ifnet *)ifp)->if_hw_tsomaxsegcount); +} + +u_int +if_gethwtsomaxsegsize(if_t ifp) +{ + + return (((struct ifnet *)ifp)->if_hw_tsomaxsegsize); +} + void if_setinitfn(if_t ifp, void (*init_fn)(void *)) { Index: head/sys/net/if_var.h =================================================================== --- head/sys/net/if_var.h +++ head/sys/net/if_var.h @@ -658,6 +658,12 @@ int if_sendq_empty(if_t ifp); int if_setsendqready(if_t ifp); int if_setsendqlen(if_t ifp, int tx_desc_count); +int if_sethwtsomax(if_t ifp, u_int if_hw_tsomax); +int if_sethwtsomaxsegcount(if_t ifp, u_int if_hw_tsomaxsegcount); +int if_sethwtsomaxsegsize(if_t ifp, u_int if_hw_tsomaxsegsize); +u_int if_gethwtsomax(if_t ifp); +u_int if_gethwtsomaxsegcount(if_t ifp); +u_int if_gethwtsomaxsegsize(if_t ifp); int if_input(if_t ifp, struct mbuf* sendmp); int if_sendq_prepend(if_t ifp, struct mbuf *m); struct mbuf *if_dequeue(if_t ifp);