diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-01-08 13:53:25 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-01-08 13:53:25 +0000 |
commit | 4a431b682d21d7490cbf8e4698a169488e4661cd (patch) | |
tree | 69f2a8339b679d9b98d3582da1065cf03f2148a3 /sys | |
parent | ec93a54243f48ca266a213a866557f62eb190ca8 (diff) |
Get rid of the arp and revarp input queues.
Packets of types ARP and REVARP are now processed in the softnet task,
directly from ether_input() and without holding the KERNEL_LOCK.
Tested by many, ok dlg@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if_ethersubr.c | 10 | ||||
-rw-r--r-- | sys/net/netisr.c | 5 | ||||
-rw-r--r-- | sys/net/netisr.h | 4 | ||||
-rw-r--r-- | sys/netinet/if_ether.c | 46 | ||||
-rw-r--r-- | sys/netinet/if_ether.h | 28 |
5 files changed, 35 insertions, 58 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 2a441610b01..3ca7f7d1795 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ethersubr.c,v 1.231 2015/12/02 08:47:00 claudio Exp $ */ +/* $OpenBSD: if_ethersubr.c,v 1.232 2016/01/08 13:53:24 mpi Exp $ */ /* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */ /* @@ -372,14 +372,14 @@ decapsulate: case ETHERTYPE_ARP: if (ifp->if_flags & IFF_NOARP) goto dropanyway; - inq = &arpintrq; - break; + arpinput(m); + return (1); case ETHERTYPE_REVARP: if (ifp->if_flags & IFF_NOARP) goto dropanyway; - inq = &rarpintrq; - break; + revarpinput(m); + return (1); #ifdef INET6 /* diff --git a/sys/net/netisr.c b/sys/net/netisr.c index ecf234174d4..7b6475be1b8 100644 --- a/sys/net/netisr.c +++ b/sys/net/netisr.c @@ -20,7 +20,6 @@ #include <machine/intr.h> -#include "ether.h" #include "ppp.h" #include "bridge.h" #include "pppoe.h" @@ -39,10 +38,6 @@ netintr(void *unused) while ((n = netisr) != 0) { atomic_clearbits_int(&netisr, n); -#if NETHER > 0 - if (n & (1 << NETISR_ARP)) - arpintr(); -#endif if (n & (1 << NETISR_IP)) ipintr(); #ifdef INET6 diff --git a/sys/net/netisr.h b/sys/net/netisr.h index dc8dfed2fbe..482c7c8ce00 100644 --- a/sys/net/netisr.h +++ b/sys/net/netisr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: netisr.h,v 1.43 2015/12/03 12:27:33 dlg Exp $ */ +/* $OpenBSD: netisr.h,v 1.44 2016/01/08 13:53:24 mpi Exp $ */ /* $NetBSD: netisr.h,v 1.12 1995/08/12 23:59:24 mycroft Exp $ */ /* @@ -53,7 +53,6 @@ #define NETISR_IP 2 /* same as AF_INET */ #define NETISR_TX 3 /* for if_snd processing */ #define NETISR_PFSYNC 5 /* for pfsync "immediate" tx */ -#define NETISR_ARP 18 /* same as AF_LINK */ #define NETISR_IPV6 24 /* same as AF_INET6 */ #define NETISR_ISDN 26 /* same as AF_E164 */ #define NETISR_PPP 28 /* for PPP processing */ @@ -64,7 +63,6 @@ #ifdef _KERNEL extern int netisr; /* scheduling bits for network */ -void arpintr(void); void ipintr(void); void ip6intr(void); void pppintr(void); diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 277534f5628..53c97173a1d 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.c,v 1.198 2015/12/17 16:05:30 tedu Exp $ */ +/* $OpenBSD: if_ether.c,v 1.199 2016/01/08 13:53:24 mpi Exp $ */ /* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */ /* @@ -82,14 +82,10 @@ void arptfree(struct rtentry *); void arptimer(void *); struct rtentry *arplookup(u_int32_t, int, int, u_int); void in_arpinput(struct mbuf *); -void revarpinput(struct mbuf *); void in_revarpinput(struct mbuf *); LIST_HEAD(, llinfo_arp) arp_list; struct pool arp_pool; /* pool for llinfo_arp structures */ -/* XXX hate magic numbers */ -struct niqueue arpintrq = NIQUEUE_INITIALIZER(50, NETISR_ARP); -struct niqueue rarpintrq = NIQUEUE_INITIALIZER(50, NETISR_ARP); int arp_inuse, arp_allocated; int arp_maxtries = 5; int arpinit_done; @@ -420,42 +416,32 @@ bad: * then the protocol-specific routine is called. */ void -arpintr(void) +arpinput(struct mbuf *m) { - struct mbuf *m; struct arphdr *ar; int len; - while ((m = niq_dequeue(&arpintrq)) != NULL) { #ifdef DIAGNOSTIC - if ((m->m_flags & M_PKTHDR) == 0) - panic("arpintr"); + if ((m->m_flags & M_PKTHDR) == 0) + panic("arpintr"); #endif - len = sizeof(struct arphdr); - if (m->m_len < len && (m = m_pullup(m, len)) == NULL) - continue; - - ar = mtod(m, struct arphdr *); - if (ntohs(ar->ar_hrd) != ARPHRD_ETHER) { - m_freem(m); - continue; - } - - len += 2 * (ar->ar_hln + ar->ar_pln); - if (m->m_len < len && (m = m_pullup(m, len)) == NULL) - continue; + len = sizeof(struct arphdr); + if (m->m_len < len && (m = m_pullup(m, len)) == NULL) + return; - switch (ntohs(ar->ar_pro)) { - case ETHERTYPE_IP: - in_arpinput(m); - continue; - } + ar = mtod(m, struct arphdr *); + if (ntohs(ar->ar_hrd) != ARPHRD_ETHER || + ntohs(ar->ar_pro) != ETHERTYPE_IP) { m_freem(m); + return; } - while ((m = niq_dequeue(&rarpintrq)) != NULL) - revarpinput(m); + len += 2 * (ar->ar_hln + ar->ar_pln); + if (m->m_len < len && (m = m_pullup(m, len)) == NULL) + return; + + in_arpinput(m); } /* diff --git a/sys/netinet/if_ether.h b/sys/netinet/if_ether.h index 3aee6da1ee6..00a6a632557 100644 --- a/sys/netinet/if_ether.h +++ b/sys/netinet/if_ether.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.h,v 1.65 2015/12/09 15:05:51 mpi Exp $ */ +/* $OpenBSD: if_ether.h,v 1.66 2016/01/08 13:53:24 mpi Exp $ */ /* $NetBSD: if_ether.h,v 1.22 1996/05/11 13:00:00 mycroft Exp $ */ /* @@ -182,11 +182,20 @@ extern u_int8_t etherbroadcastaddr[ETHER_ADDR_LEN]; extern u_int8_t etheranyaddr[ETHER_ADDR_LEN]; extern u_int8_t ether_ipmulticast_min[ETHER_ADDR_LEN]; extern u_int8_t ether_ipmulticast_max[ETHER_ADDR_LEN]; -extern struct niqueue arpintrq; -extern struct niqueue rarpintrq; +#ifdef NFSCLIENT +extern unsigned int revarp_ifidx; +#endif /* NFSCLIENT */ + +void revarpinput(struct mbuf *); +void revarprequest(struct ifnet *); +int revarpwhoarewe(struct ifnet *, struct in_addr *, struct in_addr *); +int revarpwhoami(struct in_addr *, struct ifnet *); + +void arpinput(struct mbuf *); +void arprequest(struct ifnet *, u_int32_t *, u_int32_t *, u_int8_t *); void arpwhohas(struct arpcom *, struct in_addr *); -void arpintr(void); +int arpproxy(struct in_addr, unsigned int); int arpresolve(struct ifnet *, struct rtentry *, struct mbuf *, struct sockaddr *, u_char *); void arp_rtrequest(struct ifnet *, int, struct rtentry *); @@ -271,17 +280,6 @@ do { \ ETHER_NEXT_MULTI((step), (enm)); \ } while (/* CONSTCOND */ 0) -#ifdef NFSCLIENT -extern unsigned int revarp_ifidx; -#endif /* NFSCLIENT */ - -void arprequest(struct ifnet *, u_int32_t *, u_int32_t *, u_int8_t *); -int arpproxy(struct in_addr, unsigned int); -void revarprequest(struct ifnet *); -int revarpwhoarewe(struct ifnet *, struct in_addr *, struct in_addr *); -int revarpwhoami(struct in_addr *, struct ifnet *); -int db_show_arptab(void); - u_int32_t ether_crc32_le_update(u_int32_t crc, const u_int8_t *, size_t); u_int32_t ether_crc32_be_update(u_int32_t crc, const u_int8_t *, size_t); u_int32_t ether_crc32_le(const u_int8_t *, size_t); |