summaryrefslogtreecommitdiff
path: root/sys/src/9/ip/ip.h
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2021-10-09 18:26:16 +0000
committercinap_lenrek <cinap_lenrek@felloff.net>2021-10-09 18:26:16 +0000
commit1a6324970d4cb0f0508caa3a685355d500709f1a (patch)
tree4c67be2a637f667f3c603feedf3b2b722a3a5306 /sys/src/9/ip/ip.h
parentd280f411f68cebc5aac71ce8b7cbcfb5b22f1a7c (diff)
devip: cache arp entry in Routehint
Instead of having to do an arp hash table lookup for each outgoing ip packet, forward the Routehint pointer to the medium's bwrite() function and let it cache the arp entry pointer. This avoids route and arp hash table lookups for tcp, il and connection oriented udp. It also allows us to avoid multiple route and arp table lookups for the retransmits once an arp/neighbour solicitation response arrives.
Diffstat (limited to 'sys/src/9/ip/ip.h')
-rw-r--r--sys/src/9/ip/ip.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/src/9/ip/ip.h b/sys/src/9/ip/ip.h
index c3be02f6b..e9f6fcf18 100644
--- a/sys/src/9/ip/ip.h
+++ b/sys/src/9/ip/ip.h
@@ -168,6 +168,7 @@ struct Routehint
{
Route *r; /* last route used */
ulong rgen; /* routetable generation for *r */
+ Arpent *a; /* last arp entry used */
};
/*
@@ -232,7 +233,7 @@ struct Medium
int maclen; /* mac address length */
void (*bind)(Ipifc*, int, char**);
void (*unbind)(Ipifc*);
- void (*bwrite)(Ipifc *ifc, Block *b, int version, uchar *ip);
+ void (*bwrite)(Ipifc *ifc, Block *b, int version, uchar *ip, Routehint *rh);
/* for arming interfaces to receive multicast */
void (*addmulti)(Ipifc *ifc, uchar *a, uchar *ia);
@@ -565,8 +566,8 @@ struct Route
extern void addroute(Fs *f, uchar *a, uchar *mask, uchar *s, uchar *smask, uchar *gate, int type, Ipifc *ifc, char *tag);
extern void remroute(Fs *f, uchar *a, uchar *mask, uchar *s, uchar *smask, uchar *gate, int type, Ipifc *ifc, char *tag);
-extern Route* v4lookup(Fs *f, uchar *a, uchar *s, Routehint *h);
-extern Route* v6lookup(Fs *f, uchar *a, uchar *s, Routehint *h);
+extern Route* v4lookup(Fs *f, uchar *a, uchar *s, Routehint *rh);
+extern Route* v6lookup(Fs *f, uchar *a, uchar *s, Routehint *rh);
extern Route* v4source(Fs *f, uchar *a, uchar *s);
extern Route* v6source(Fs *f, uchar *a, uchar *s);
extern long routeread(Fs *f, char*, ulong, int);
@@ -611,12 +612,12 @@ struct Arpent
extern void arpinit(Fs*);
extern int arpread(Arp*, char*, ulong, int);
extern int arpwrite(Fs*, char*, int);
-extern Arpent* arpget(Arp*, Block *bp, int version, Ipifc *ifc, uchar *ip, uchar *h);
+extern Arpent* arpget(Arp*, Block *bp, int version, Ipifc *ifc, uchar *ip, uchar *mac, Routehint *rh);
extern void arprelease(Arp*, Arpent *a);
extern void arpcontinue(Arp*, Arpent *a);
-extern Block* arpresolve(Arp*, Arpent *a, Medium *type, uchar *mac);
+extern Block* arpresolve(Arp*, Arpent *a, uchar *mac, Routehint *rh);
extern int arpenter(Fs*, int version, uchar *ip, uchar *mac, int n, uchar *ia, Ipifc *ifc, int refresh);
-extern void ndpsendsol(Fs*, Ipifc*, Arpent*);
+extern void ndpsendsol(Fs*, Arpent*);
/*
* ipaux.c
@@ -661,7 +662,7 @@ extern Medium pktmedium;
*/
extern Medium* ipfindmedium(char *name);
extern void addipmedium(Medium *med);
-extern void ipifcoput(Ipifc *ifc, Block *bp, int version, uchar *ip);
+extern void ipifcoput(Ipifc *ifc, Block *bp, int version, uchar *ip, Routehint *rh);
extern int ipforme(Fs*, uchar *addr);
extern int ipismulticast(uchar *ip);
extern Ipifc* findipifc(Fs*, uchar *local, uchar *remote, int type);