ref: ca34634e07d6e7959cba7fb3678a654f15355908
parent: c725122a471acff0f24b9bb337a9e80e662a4b8b
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Mar 15 15:16:59 EDT 2026
devether: don't drop packets when bypassing As we'r already using qsetbypass() on the output queue to flush it, we could as well just pass the queued pacekts to the bypass Netfile. This also gets rid of the qpass() in etheroq().
--- a/sys/src/9/port/devether.c
+++ b/sys/src/9/port/devether.c
@@ -30,6 +30,21 @@
freeb(b);
}
+static void
+bypass(void *arg, Block *b)
+{+ Ether *ether;
+ Netfile *f;
+
+ ether = (Ether*)arg;
+ if((f = ether->bypass) == nil){+ freeb(b);
+ return;
+ }
+ if(qpass(f->in, b) < 0)
+ ether->soverflows++;
+}
+
Chan*
etherattach(char* spec)
{@@ -276,8 +291,6 @@
static void
etheroq(Ether* ether, Block* bp, Netfile **from)
{- Netfile *x;
-
if((*from)->bridge == 0)
memmove(((Etherpkt*)bp->rp)->s, ether->ea, Eaddrlen);
@@ -292,11 +305,6 @@
return;
if(ether->dmat != nil)
dmatproxy(bp, 1, ether->ea, ether->dmat);
- if((x = ether->bypass) != nil){- if(qpass(x->in, bp) < 0)
- ether->soverflows++;
- return;
- }
ether->outpackets++;
qbwrite(ether->oq, bp);
}
@@ -314,10 +322,10 @@
if(nn >= 0){/* got bypassed? */
if(ether->f[NETID(chan->qid.path)]->bypass){- /* flush and bypass output queue */
- qsetbypass(ether->oq, drop);
/* ignore mbps and use large input queue size */
netifsetlimit(ether, MB);
+ /* bypass output queue */
+ qsetbypass(ether->oq, bypass);
}
return nn;
}
--
⑨