diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2022-10-08 10:33:21 +0000 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2022-10-08 10:33:21 +0000 |
commit | 2a29b497f215f91d05b6718a0e852e8a9b6ce6da (patch) | |
tree | f414977721d3015d3c89b7ae60ce8a6ebb73d532 /sys/src/9/ip | |
parent | 6b38e52e4b38370d3097a32550ba9cace6782888 (diff) |
devip: use port/netif.h constants for ethermedium
Diffstat (limited to 'sys/src/9/ip')
-rw-r--r-- | sys/src/9/ip/ethermedium.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/sys/src/9/ip/ethermedium.c b/sys/src/9/ip/ethermedium.c index 3a1c65100..6a7b19bdd 100644 --- a/sys/src/9/ip/ethermedium.c +++ b/sys/src/9/ip/ethermedium.c @@ -9,11 +9,6 @@ #include "ip.h" #include "ipv6.h" -enum { - EHSIZE = 14, - EMINTU = 60, -}; - typedef struct Etherhdr Etherhdr; struct Etherhdr { @@ -40,9 +35,9 @@ static void etherpref2addr(uchar *pref, uchar *ea); Medium ethermedium = { .name= "ether", -.hsize= EHSIZE, -.mintu= EMINTU, -.maxtu= 1514, +.hsize= ETHERHDRSIZE, +.mintu= ETHERMINTU, +.maxtu= ETHERHDRSIZE+1500, .maclen= 6, .bind= etherbind, .unbind= etherunbind, @@ -56,9 +51,9 @@ Medium ethermedium = Medium gbemedium = { .name= "gbe", -.hsize= EHSIZE, -.mintu= EMINTU, -.maxtu= 9014, +.hsize= ETHERHDRSIZE, +.mintu= ETHERMINTU, +.maxtu= ETHERHDRSIZE+9000, .maclen= 6, .bind= etherbind, .unbind= etherunbind, @@ -285,9 +280,9 @@ etherbwrite(Ipifc *ifc, Block *bp, int version, uchar *ip, Routehint *rh) assert(bp->list == nil); /* make it a single block with space for the ether header */ - bp = padblock(bp, EHSIZE); - if(BLEN(bp) < EMINTU) - bp = adjustblock(bp, EMINTU); + bp = padblock(bp, ETHERHDRSIZE); + if(BLEN(bp) < ETHERMINTU) + bp = adjustblock(bp, ETHERMINTU); eh = (Etherhdr*)bp->rp; /* copy in mac addresses and ether type */ @@ -336,10 +331,10 @@ etherread4(void *a) nexterror(); } ifc->in++; - if(ifc->lifc == nil || BLEN(bp) <= EHSIZE) + if(ifc->lifc == nil || BLEN(bp) <= ETHERHDRSIZE) freeb(bp); else { - bp->rp += EHSIZE; + bp->rp += ETHERHDRSIZE; ipiput4(er->f, ifc, bp); } runlock(ifc); @@ -374,10 +369,10 @@ etherread6(void *a) nexterror(); } ifc->in++; - if(ifc->lifc == nil || BLEN(bp) <= EHSIZE) + if(ifc->lifc == nil || BLEN(bp) <= ETHERHDRSIZE) freeb(bp); else { - bp->rp += EHSIZE; + bp->rp += ETHERHDRSIZE; ipiput6(er->f, ifc, bp); } runlock(ifc); @@ -436,9 +431,9 @@ newEARP(void) { Block *bp; - bp = allocb(EMINTU); - bp->wp += EMINTU; - memset(bp->rp, 0, EMINTU); + bp = allocb(ETHERMINTU); + bp->wp += ETHERMINTU; + memset(bp->rp, 0, ETHERMINTU); return bp; } |