summaryrefslogtreecommitdiff
path: root/sys/src
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2016-11-07 22:05:29 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2016-11-07 22:05:29 +0100
commit857f2528e0b014b6bd839535daaa6b53853703d9 (patch)
treec81c520a5cf17c79ea31acbf018f36acbc130489 /sys/src
parentea993877a96cd535199d0cd437e49f8d616615d9 (diff)
ip: always pass a single block to Medium.bwrite(), avoid concatblock() calls in Dev.bwrite()
the convention for Dev.bwrite() is that it accepts a *single* block, and not a block chain. so we never have concatblock here. to keep stuff consistent, we also guarantee thet Medium.bwrite() will get a *single* block passed as well, as the callers are few in number.
Diffstat (limited to 'sys/src')
-rw-r--r--sys/src/9/ip/arp.c2
-rw-r--r--sys/src/9/ip/devip.c3
-rw-r--r--sys/src/9/ip/ethermedium.c2
-rw-r--r--sys/src/9/ip/ip.c4
-rw-r--r--sys/src/9/ip/ipv6.c4
-rw-r--r--sys/src/9/ip/netdevmedium.c2
-rw-r--r--sys/src/9/ip/pktmedium.c1
7 files changed, 5 insertions, 13 deletions
diff --git a/sys/src/9/ip/arp.c b/sys/src/9/ip/arp.c
index 43d8de43b..9d650a978 100644
--- a/sys/src/9/ip/arp.c
+++ b/sys/src/9/ip/arp.c
@@ -375,7 +375,7 @@ arpenter(Fs *fs, int version, uchar *ip, uchar *mac, int n, int refresh)
}
rlock(ifc);
if(ifc->m != nil)
- ifc->m->bwrite(ifc, bp, version, ip);
+ ifc->m->bwrite(ifc, concatblock(bp), version, ip);
else
freeblist(bp);
runlock(ifc);
diff --git a/sys/src/9/ip/devip.c b/sys/src/9/ip/devip.c
index c784f73a0..2f39a6535 100644
--- a/sys/src/9/ip/devip.c
+++ b/sys/src/9/ip/devip.c
@@ -1195,9 +1195,6 @@ ipbwrite(Chan* ch, Block* bp, ulong offset)
if(c->wq == nil)
error(Eperm);
- if(bp->next)
- bp = concatblock(bp);
-
return qbwrite(c->wq, bp);
default:
return devbwrite(ch, bp, offset);
diff --git a/sys/src/9/ip/ethermedium.c b/sys/src/9/ip/ethermedium.c
index f5b4e855d..5853ceec0 100644
--- a/sys/src/9/ip/ethermedium.c
+++ b/sys/src/9/ip/ethermedium.c
@@ -298,8 +298,6 @@ etherbwrite(Ipifc *ifc, Block *bp, int version, uchar *ip)
/* make it a single block with space for the ether header */
bp = padblock(bp, ifc->m->hsize);
- if(bp->next)
- bp = concatblock(bp);
if(BLEN(bp) < ifc->mintu)
bp = adjustblock(bp, ifc->mintu);
eh = (Etherhdr*)bp->rp;
diff --git a/sys/src/9/ip/ip.c b/sys/src/9/ip/ip.c
index 0a8863e77..ef8a7e19c 100644
--- a/sys/src/9/ip/ip.c
+++ b/sys/src/9/ip/ip.c
@@ -208,7 +208,7 @@ ipoput4(Fs *f, Block *bp, int gating, int ttl, int tos, Conv *c)
eh->cksum[0] = 0;
eh->cksum[1] = 0;
hnputs(eh->cksum, ipcsum(&eh->vihl));
- ifc->m->bwrite(ifc, bp, V4, gate);
+ ifc->m->bwrite(ifc, concatblock(bp), V4, gate);
runlock(ifc);
poperror();
return 0;
@@ -240,7 +240,7 @@ if((eh->frag[0] & (IP_DF>>8)) && !gating) print("%V: DF set\n", eh->dst);
lid = incref(&ip->id4);
offset = IP4HDR;
- while(xp != nil && offset && offset >= BLEN(xp)) {
+ while(offset && offset >= BLEN(xp)) {
offset -= BLEN(xp);
xp = xp->next;
}
diff --git a/sys/src/9/ip/ipv6.c b/sys/src/9/ip/ipv6.c
index 606f638e9..8b50706f4 100644
--- a/sys/src/9/ip/ipv6.c
+++ b/sys/src/9/ip/ipv6.c
@@ -118,7 +118,7 @@ ipoput6(Fs *f, Block *bp, int gating, int ttl, int tos, Conv *c)
medialen = ifc->maxtu - ifc->m->hsize;
if(len <= medialen) {
hnputs(eh->ploadlen, len - IP6HDR);
- ifc->m->bwrite(ifc, bp, V6, gate);
+ ifc->m->bwrite(ifc, concatblock(bp), V6, gate);
runlock(ifc);
poperror();
return 0;
@@ -161,7 +161,7 @@ ipoput6(Fs *f, Block *bp, int gating, int ttl, int tos, Conv *c)
xp = bp;
offset = uflen;
- while (xp && offset && offset >= BLEN(xp)) {
+ while (offset && offset >= BLEN(xp)) {
offset -= BLEN(xp);
xp = xp->next;
}
diff --git a/sys/src/9/ip/netdevmedium.c b/sys/src/9/ip/netdevmedium.c
index bcbdeeda2..74d47290c 100644
--- a/sys/src/9/ip/netdevmedium.c
+++ b/sys/src/9/ip/netdevmedium.c
@@ -86,8 +86,6 @@ netdevbwrite(Ipifc *ifc, Block *bp, int, uchar*)
{
Netdevrock *er = ifc->arg;
- if(bp->next)
- bp = concatblock(bp);
if(BLEN(bp) < ifc->mintu)
bp = adjustblock(bp, ifc->mintu);
diff --git a/sys/src/9/ip/pktmedium.c b/sys/src/9/ip/pktmedium.c
index 81feb3dfb..d978289c4 100644
--- a/sys/src/9/ip/pktmedium.c
+++ b/sys/src/9/ip/pktmedium.c
@@ -51,7 +51,6 @@ static void
pktbwrite(Ipifc *ifc, Block *bp, int, uchar*)
{
/* enqueue onto the conversation's rq */
- bp = concatblock(bp);
if(ifc->conv->snoopers.ref > 0)
qpass(ifc->conv->sq, copyblock(bp, BLEN(bp)));
qpass(ifc->conv->rq, bp);