if_tuntap: fix NOIP build

Note: this removes one TUNDEBUG() for the sake of not having one more
ifdefed variable declaration and for the overall code brevity.  The call
from tuntap into LRO can be so easily traced with dtrace(1) that an
80-ish printf(9)-based debugging can be omitted.

Fixes:	99c79cab42
This commit is contained in:
Gleb Smirnoff 2023-12-04 10:18:56 -08:00
parent 641efdd10c
commit 5b0010b467
1 changed files with 8 additions and 9 deletions

View File

@ -1178,13 +1178,13 @@ tundtor(void *data)
if ((tp->tun_flags & TUN_VMNET) != 0 || if ((tp->tun_flags & TUN_VMNET) != 0 ||
(l2tun && (ifp->if_flags & IFF_LINK0) != 0)) (l2tun && (ifp->if_flags & IFF_LINK0) != 0))
goto out; goto out;
#if defined(INET) || defined(INET6)
if (l2tun && tp->tun_lro_ready) { if (l2tun && tp->tun_lro_ready) {
TUNDEBUG (ifp, "LRO disabled\n"); TUNDEBUG (ifp, "LRO disabled\n");
tcp_lro_free(&tp->tun_lro); tcp_lro_free(&tp->tun_lro);
tp->tun_lro_ready = false; tp->tun_lro_ready = false;
} }
#endif
if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_UP) {
TUN_UNLOCK(tp); TUN_UNLOCK(tp);
if_down(ifp); if_down(ifp);
@ -1229,6 +1229,7 @@ tuninit(struct ifnet *ifp)
getmicrotime(&ifp->if_lastchange); getmicrotime(&ifp->if_lastchange);
TUN_UNLOCK(tp); TUN_UNLOCK(tp);
} else { } else {
#if defined(INET) || defined(INET6)
if (tcp_lro_init(&tp->tun_lro) == 0) { if (tcp_lro_init(&tp->tun_lro) == 0) {
TUNDEBUG(ifp, "LRO enabled\n"); TUNDEBUG(ifp, "LRO enabled\n");
tp->tun_lro.ifp = ifp; tp->tun_lro.ifp = ifp;
@ -1237,6 +1238,7 @@ tuninit(struct ifnet *ifp)
TUNDEBUG(ifp, "Could not enable LRO\n"); TUNDEBUG(ifp, "Could not enable LRO\n");
tp->tun_lro_ready = false; tp->tun_lro_ready = false;
} }
#endif
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
TUN_UNLOCK(tp); TUN_UNLOCK(tp);
/* attempt to start output */ /* attempt to start output */
@ -1783,7 +1785,6 @@ tunwrite_l2(struct tuntap_softc *tp, struct mbuf *m,
struct epoch_tracker et; struct epoch_tracker et;
struct ether_header *eh; struct ether_header *eh;
struct ifnet *ifp; struct ifnet *ifp;
int result;
ifp = TUN2IFP(tp); ifp = TUN2IFP(tp);
@ -1839,14 +1840,12 @@ tunwrite_l2(struct tuntap_softc *tp, struct mbuf *m,
/* Pass packet up to parent. */ /* Pass packet up to parent. */
CURVNET_SET(ifp->if_vnet); CURVNET_SET(ifp->if_vnet);
NET_EPOCH_ENTER(et); NET_EPOCH_ENTER(et);
if (tp->tun_lro_ready && ifp->if_capenable & IFCAP_LRO) { #if defined(INET) || defined(INET6)
result = tcp_lro_rx(&tp->tun_lro, m, 0); if (tp->tun_lro_ready && ifp->if_capenable & IFCAP_LRO &&
TUNDEBUG(ifp, "tcp_lro_rx() returned %d\n", result); tcp_lro_rx(&tp->tun_lro, m, 0) == 0)
} else
result = TCP_LRO_CANNOT;
if (result == 0)
tcp_lro_flush_all(&tp->tun_lro); tcp_lro_flush_all(&tp->tun_lro);
else else
#endif
(*ifp->if_input)(ifp, m); (*ifp->if_input)(ifp, m);
NET_EPOCH_EXIT(et); NET_EPOCH_EXIT(et);
CURVNET_RESTORE(); CURVNET_RESTORE();