Eliminate use of IFF_OACTIVE.

This commit is contained in:
thorpej 2022-09-18 13:31:08 +00:00
parent df20bd80df
commit 9bcc22422a
2 changed files with 5 additions and 26 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: vnet.c,v 1.6 2022/02/11 23:49:28 riastradh Exp $ */
/* $NetBSD: vnet.c,v 1.7 2022/09/18 13:31:08 thorpej Exp $ */
/* $OpenBSD: vnet.c,v 1.62 2020/07/10 13:26:36 patrick Exp $ */
/*
* Copyright (c) 2009, 2015 Mark Kettenis
@ -695,7 +695,6 @@ vnet_rx_vio_rdx(struct vnet_softc *sc, struct vio_msg_tag *tag)
vnet_setmulti(sc, 1);
KERNEL_LOCK(1, curlwp);
ifp->if_flags &= ~IFF_OACTIVE;
vnet_start(ifp);
KERNEL_UNLOCK_ONE(curlwp);
}
@ -951,8 +950,6 @@ vnet_rx_vio_dring_data(struct vnet_softc *sc, struct vio_msg_tag *tag)
vnet_send_dring_data(sc, cons);
KERNEL_LOCK(1, curlwp);
if (count < (sc->sc_vd->vd_nentries - 1))
ifp->if_flags &= ~IFF_OACTIVE;
if (count == 0)
ifp->if_timer = 0;
@ -1138,11 +1135,6 @@ vnet_start(struct ifnet *ifp)
DPRINTF(("%s: not in RUNNING state\n", __func__));
return;
}
if (ifp->if_flags & IFF_OACTIVE)
{
DPRINTF(("%s: already active\n", __func__));
return;
}
if (IFQ_IS_EMPTY(&ifp->if_snd))
{
@ -1175,7 +1167,6 @@ vnet_start(struct ifnet *ifp)
tx_tail += sizeof(struct ldc_pkt);
tx_tail &= ((lc->lc_txq->lq_nentries * sizeof(struct ldc_pkt)) - 1);
if (tx_tail == tx_head) {
ifp->if_flags |= IFF_OACTIVE;
{
DPRINTF(("%s: tail equals head\n", __func__));
return;
@ -1194,14 +1185,12 @@ vnet_start(struct ifnet *ifp)
if (count >= (sc->sc_vd->vd_nentries - 1) ||
map->lm_count >= map->lm_nentries) {
DPRINTF(("%s: count issue\n", __func__));
ifp->if_flags |= IFF_OACTIVE;
break;
}
buf = pool_get(&sc->sc_pool, PR_NOWAIT|PR_ZERO);
if (buf == NULL) {
DPRINTF(("%s: buff is NULL\n", __func__));
ifp->if_flags |= IFF_OACTIVE;
break;
}
IFQ_DEQUEUE(&ifp->if_snd, m);
@ -1275,13 +1264,11 @@ vnet_start_desc(struct ifnet *ifp)
count = sc->sc_tx_prod - sc->sc_tx_cons;
if (count >= (sc->sc_vd->vd_nentries - 1) ||
map->lm_count >= map->lm_nentries) {
ifp->if_flags |= IFF_OACTIVE;
return;
}
buf = pool_get(&sc->sc_pool, PR_NOWAIT|PR_ZERO);
if (buf == NULL) {
ifp->if_flags |= IFF_OACTIVE;
return;
}
@ -1548,7 +1535,6 @@ vnet_stop(struct ifnet *ifp, int disable)
struct ldc_conn *lc = &sc->sc_lc;
ifp->if_flags &= ~IFF_RUNNING;
ifp->if_flags &= ~IFF_OACTIVE;
ifp->if_timer = 0;
cbus_intr_setenabled(sc->sc_bustag, sc->sc_tx_ino, INTR_DISABLED);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_veth.c,v 1.15 2021/06/16 00:21:18 riastradh Exp $ */
/* $NetBSD: if_veth.c,v 1.16 2022/09/18 13:36:53 thorpej Exp $ */
/*-
* Copyright (c) 2011 Jared D. McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_veth.c,v 1.15 2021/06/16 00:21:18 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_veth.c,v 1.16 2022/09/18 13:36:53 thorpej Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@ -181,7 +181,6 @@ veth_init(struct ifnet *ifp)
veth_stop(ifp, 0);
ifp->if_flags |= IFF_RUNNING;
ifp->if_flags &= ~IFF_OACTIVE;
return 0;
}
@ -247,11 +246,6 @@ veth_softtx(void *priv)
struct ifnet *ifp = &sc->sc_ec.ec_if;
int s;
if (ifp->if_flags & IFF_OACTIVE) {
if (thunk_pollout_tap(sc->sc_tapfd, 0) == 1)
ifp->if_flags &= ~IFF_OACTIVE;
}
s = splnet();
veth_start(ifp);
splx(s);
@ -266,7 +260,7 @@ veth_start(struct ifnet *ifp)
vethprintf("%s: %s flags=%x\n", __func__, ifp->if_xname, ifp->if_flags);
if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
if ((ifp->if_flags & IFF_RUNNING) == 0)
return;
for (;;) {
@ -276,7 +270,6 @@ veth_start(struct ifnet *ifp)
if (thunk_pollout_tap(sc->sc_tapfd, 0) != 1) {
printf("queue full\n");
ifp->if_flags |= IFF_OACTIVE;
break;
}
@ -302,7 +295,7 @@ veth_stop(struct ifnet *ifp, int disable)
{
vethprintf("%s: %s flags=%x\n", __func__, ifp->if_xname, ifp->if_flags);
ifp->if_timer = 0;
ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
ifp->if_flags &= ~IFF_RUNNING;
}
static void