devether: remove qfull prints and fix loopback packet handling of etheroq()
dont spam the console with qfull warnings. this makes things worse. handle loopback packets as stated in the comment. we call etheriq() with fromwire=1 for loopback packets so etheriq() can pass the packet on (without copying) or free it. dont inhibit interrupts while calling etheriq(). etheriq() can safely be called from process and interrupt context. it is unclear what this was supposed to fix and testing didnt seem to have any odd effects.
This commit is contained in:
parent
6946118644
commit
ea6fea596b
7 changed files with 47 additions and 87 deletions
|
@ -414,7 +414,7 @@ etheriq(Ether* ether, Block* bp, int fromwire)
|
|||
static int
|
||||
etheroq(Ether* ether, Block* bp)
|
||||
{
|
||||
int len, loopback, s;
|
||||
int len, loopback;
|
||||
Etherpkt *pkt;
|
||||
|
||||
ether->outpackets++;
|
||||
|
@ -431,18 +431,13 @@ etheroq(Ether* ether, Block* bp)
|
|||
pkt = (Etherpkt*)bp->rp;
|
||||
len = BLEN(bp);
|
||||
loopback = memcmp(pkt->d, ether->ea, sizeof(pkt->d)) == 0;
|
||||
if(loopback || memcmp(pkt->d, ether->bcast, sizeof(pkt->d)) == 0 || ether->prom){
|
||||
s = splhi();
|
||||
etheriq(ether, bp, 0);
|
||||
splx(s);
|
||||
}
|
||||
if(loopback || memcmp(pkt->d, ether->bcast, sizeof(pkt->d)) == 0 || ether->prom)
|
||||
if(etheriq(ether, bp, loopback) == 0)
|
||||
return len;
|
||||
|
||||
if(!loopback){
|
||||
qbwrite(ether->oq, bp);
|
||||
qbwrite(ether->oq, bp);
|
||||
if(ether->transmit != nil)
|
||||
ether->transmit(ether);
|
||||
} else
|
||||
freeb(bp);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ etheriq(Ether* ether, Block* bp, int fromwire)
|
|||
static int
|
||||
etheroq(Ether* ether, Block* bp)
|
||||
{
|
||||
int len, loopback, s;
|
||||
int len, loopback;
|
||||
Etherpkt *pkt;
|
||||
|
||||
ether->outpackets++;
|
||||
|
@ -230,19 +230,13 @@ etheroq(Ether* ether, Block* bp)
|
|||
pkt = (Etherpkt*)bp->rp;
|
||||
len = BLEN(bp);
|
||||
loopback = memcmp(pkt->d, ether->ea, sizeof(pkt->d)) == 0;
|
||||
if(loopback || memcmp(pkt->d, ether->bcast, sizeof(pkt->d)) == 0 || ether->prom){
|
||||
s = splhi();
|
||||
etheriq(ether, bp, 0);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
if(!loopback){
|
||||
qbwrite(ether->oq, bp);
|
||||
if(ether->transmit != nil)
|
||||
ether->transmit(ether);
|
||||
} else
|
||||
freeb(bp);
|
||||
if(loopback || memcmp(pkt->d, ether->bcast, sizeof(pkt->d)) == 0 || ether->prom)
|
||||
if(etheriq(ether, bp, loopback) == 0)
|
||||
return len;
|
||||
|
||||
qbwrite(ether->oq, bp);
|
||||
if(ether->transmit != nil)
|
||||
ether->transmit(ether);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ etheriq(Ether* ether, Block* bp, int fromwire)
|
|||
static int
|
||||
etheroq(Ether* ether, Block* bp)
|
||||
{
|
||||
int len, loopback, s;
|
||||
int len, loopback;
|
||||
Etherpkt *pkt;
|
||||
|
||||
ether->outpackets++;
|
||||
|
@ -221,18 +221,13 @@ etheroq(Ether* ether, Block* bp)
|
|||
pkt = (Etherpkt*)bp->rp;
|
||||
len = BLEN(bp);
|
||||
loopback = memcmp(pkt->d, ether->ea, sizeof(pkt->d)) == 0;
|
||||
if(loopback || memcmp(pkt->d, ether->bcast, sizeof(pkt->d)) == 0 || ether->prom){
|
||||
s = splhi();
|
||||
etheriq(ether, bp, 0);
|
||||
splx(s);
|
||||
}
|
||||
if(loopback || memcmp(pkt->d, ether->bcast, sizeof(pkt->d)) == 0 || ether->prom)
|
||||
if(etheriq(ether, bp, loopback) == 0)
|
||||
return len;
|
||||
|
||||
if(!loopback){
|
||||
qbwrite(ether->oq, bp);
|
||||
qbwrite(ether->oq, bp);
|
||||
if(ether->transmit != nil)
|
||||
ether->transmit(ether);
|
||||
} else
|
||||
freeb(bp);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ etheriq(Ether* ether, Block* bp, int fromwire)
|
|||
static int
|
||||
etheroq(Ether* ether, Block* bp)
|
||||
{
|
||||
int len, loopback, s;
|
||||
int len, loopback;
|
||||
Etherpkt *pkt;
|
||||
|
||||
ether->outpackets++;
|
||||
|
@ -228,19 +228,13 @@ etheroq(Ether* ether, Block* bp)
|
|||
pkt = (Etherpkt*)bp->rp;
|
||||
len = BLEN(bp);
|
||||
loopback = memcmp(pkt->d, ether->ea, sizeof(pkt->d)) == 0;
|
||||
if(loopback || memcmp(pkt->d, ether->bcast, sizeof(pkt->d)) == 0 || ether->prom){
|
||||
s = splhi();
|
||||
etheriq(ether, bp, 0);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
if(!loopback){
|
||||
qbwrite(ether->oq, bp);
|
||||
if(ether->transmit != nil)
|
||||
ether->transmit(ether);
|
||||
} else
|
||||
freeb(bp);
|
||||
if(loopback || memcmp(pkt->d, ether->bcast, sizeof(pkt->d)) == 0 || ether->prom)
|
||||
if(etheriq(ether, bp, loopback) == 0)
|
||||
return len;
|
||||
|
||||
qbwrite(ether->oq, bp);
|
||||
if(ether->transmit != nil)
|
||||
ether->transmit(ether);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ etheriq(Ether* ether, Block* bp, int fromwire)
|
|||
static int
|
||||
etheroq(Ether* ether, Block* bp)
|
||||
{
|
||||
int len, loopback, s;
|
||||
int len, loopback;
|
||||
Etherpkt *pkt;
|
||||
|
||||
ether->outpackets++;
|
||||
|
@ -234,21 +234,13 @@ etheroq(Ether* ether, Block* bp)
|
|||
pkt = (Etherpkt*)bp->rp;
|
||||
len = BLEN(bp);
|
||||
loopback = memcmp(pkt->d, ether->ea, sizeof(pkt->d)) == 0;
|
||||
if(loopback || memcmp(pkt->d, ether->bcast, sizeof(pkt->d)) == 0 || ether->prom){
|
||||
s = splhi();
|
||||
etheriq(ether, bp, 0);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
if(!loopback){
|
||||
if(qfull(ether->oq))
|
||||
print("etheroq: WARNING: ether->oq full!\n");
|
||||
qbwrite(ether->oq, bp);
|
||||
if(ether->transmit != nil)
|
||||
ether->transmit(ether);
|
||||
} else
|
||||
freeb(bp);
|
||||
if(loopback || memcmp(pkt->d, ether->bcast, sizeof(pkt->d)) == 0 || ether->prom)
|
||||
if(etheriq(ether, bp, loopback) == 0)
|
||||
return len;
|
||||
|
||||
qbwrite(ether->oq, bp);
|
||||
if(ether->transmit != nil)
|
||||
ether->transmit(ether);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
|
|
@ -205,10 +205,11 @@ etheriq(Ether* ether, Block* bp, int fromwire)
|
|||
static int
|
||||
etheroq(Ether* ether, Block* bp)
|
||||
{
|
||||
int len, loopback, s;
|
||||
int len, loopback;
|
||||
Etherpkt *pkt;
|
||||
|
||||
ether->outpackets++;
|
||||
|
||||
/*
|
||||
* Check if the packet has to be placed back onto the input queue,
|
||||
* i.e. if it's a loopback or broadcast packet or the interface is
|
||||
|
@ -221,18 +222,13 @@ etheroq(Ether* ether, Block* bp)
|
|||
pkt = (Etherpkt*)bp->rp;
|
||||
len = BLEN(bp);
|
||||
loopback = memcmp(pkt->d, ether->ea, sizeof(pkt->d)) == 0;
|
||||
if(loopback || memcmp(pkt->d, ether->bcast, sizeof(pkt->d)) == 0 || ether->prom){
|
||||
s = splhi();
|
||||
etheriq(ether, bp, 0);
|
||||
splx(s);
|
||||
}
|
||||
if(loopback || memcmp(pkt->d, ether->bcast, sizeof(pkt->d)) == 0 || ether->prom)
|
||||
if(etheriq(ether, bp, loopback) == 0)
|
||||
return len;
|
||||
|
||||
if(!loopback){
|
||||
qbwrite(ether->oq, bp);
|
||||
qbwrite(ether->oq, bp);
|
||||
if(ether->transmit != nil)
|
||||
ether->transmit(ether);
|
||||
} else
|
||||
freeb(bp);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ etheriq(Ether* ether, Block* bp, int fromwire)
|
|||
static int
|
||||
etheroq(Ether* ether, Block* bp)
|
||||
{
|
||||
int len, loopback, s;
|
||||
int len, loopback;
|
||||
Etherpkt *pkt;
|
||||
|
||||
ether->outpackets++;
|
||||
|
@ -226,19 +226,13 @@ etheroq(Ether* ether, Block* bp)
|
|||
pkt = (Etherpkt*)bp->rp;
|
||||
len = BLEN(bp);
|
||||
loopback = memcmp(pkt->d, ether->ea, sizeof(pkt->d)) == 0;
|
||||
if(loopback || memcmp(pkt->d, ether->bcast, sizeof(pkt->d)) == 0 || ether->prom){
|
||||
s = splhi();
|
||||
etheriq(ether, bp, 0);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
if(!loopback){
|
||||
qbwrite(ether->oq, bp);
|
||||
if(ether->transmit != nil)
|
||||
ether->transmit(ether);
|
||||
} else
|
||||
freeb(bp);
|
||||
if(loopback || memcmp(pkt->d, ether->bcast, sizeof(pkt->d)) == 0 || ether->prom)
|
||||
if(etheriq(ether, bp, loopback) == 0)
|
||||
return len;
|
||||
|
||||
qbwrite(ether->oq, bp);
|
||||
if(ether->transmit != nil)
|
||||
ether->transmit(ether);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue