summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkn <kn@cvs.openbsd.org>2021-01-04 21:21:42 +0000
committerkn <kn@cvs.openbsd.org>2021-01-04 21:21:42 +0000
commit6832771ed932bac0793efedab45b311744e490f5 (patch)
tree6f947ff4a5bca24df7c49a0d66cf4a303cfba79e
parent338781c95edbc06af9e20fc7d9ef0af913c2c70b (diff)
Process pppoe(4) packets directly, do not queue through netis
Less scheduling, lock contention and queues. Previously, if_netisr() handled the net lock around those calls, now if_input_process() does it before calling ether_input(), so no need to add or remove NET_*LOCK() anywhere. OK mvs claudio
-rw-r--r--sys/net/if.c8
-rw-r--r--sys/net/if_ethersubr.c6
-rw-r--r--sys/net/if_pppoe.c27
-rw-r--r--sys/net/if_pppoe.h8
-rw-r--r--sys/net/netisr.h3
5 files changed, 11 insertions, 41 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index ce8eed20c8e..e96e4994564 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.622 2021/01/04 13:56:45 kn Exp $ */
+/* $OpenBSD: if.c,v 1.623 2021/01/04 21:21:41 kn Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -68,7 +68,6 @@
#include "pf.h"
#include "pfsync.h"
#include "ppp.h"
-#include "pppoe.h"
#include "switch.h"
#include "if_wg.h"
@@ -905,11 +904,6 @@ if_netisr(void *unused)
KERNEL_UNLOCK();
}
#endif
-#if NPPPOE > 0
- if (n & (1 << NETISR_PPPOE)) {
- pppoeintr();
- }
-#endif
t |= n;
}
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 36935b16db5..ef3bb748960 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ethersubr.c,v 1.267 2020/10/01 05:14:10 jsg Exp $ */
+/* $OpenBSD: if_ethersubr.c,v 1.268 2021/01/04 21:21:41 kn Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */
/*
@@ -532,9 +532,9 @@ ether_input(struct ifnet *ifp, struct mbuf *m)
}
#endif
if (etype == ETHERTYPE_PPPOEDISC)
- niq_enqueue(&pppoediscinq, m);
+ pppoe_disc_input(m);
else
- niq_enqueue(&pppoeinq, m);
+ pppoe_data_input(m);
return;
#endif
#ifdef MPLS
diff --git a/sys/net/if_pppoe.c b/sys/net/if_pppoe.c
index 2b8a4545eb1..b6ece4239b2 100644
--- a/sys/net/if_pppoe.c
+++ b/sys/net/if_pppoe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pppoe.c,v 1.75 2020/12/30 13:18:07 mvs Exp $ */
+/* $OpenBSD: if_pppoe.c,v 1.76 2021/01/04 21:21:41 kn Exp $ */
/* $NetBSD: if_pppoe.c,v 1.51 2003/11/28 08:56:48 keihan Exp $ */
/*
@@ -143,14 +143,8 @@ struct pppoe_softc {
struct timeval sc_session_time; /* [N] time the session was established */
};
-/* incoming traffic will be queued here */
-struct niqueue pppoediscinq = NIQUEUE_INITIALIZER(IFQ_MAXLEN, NETISR_PPPOE);
-struct niqueue pppoeinq = NIQUEUE_INITIALIZER(IFQ_MAXLEN, NETISR_PPPOE);
-
/* input routines */
-static void pppoe_disc_input(struct mbuf *);
static void pppoe_dispatch_disc_pkt(struct mbuf *);
-static void pppoe_data_input(struct mbuf *);
/* management routines */
void pppoeattach(int);
@@ -341,21 +335,6 @@ pppoe_find_softc_by_hunique(u_int8_t *token, size_t len, u_int ifidx)
return (sc);
}
-/* Interface interrupt handler routine. */
-void
-pppoeintr(void)
-{
- struct mbuf *m;
-
- NET_ASSERT_LOCKED();
-
- while ((m = niq_dequeue(&pppoediscinq)) != NULL)
- pppoe_disc_input(m);
-
- while ((m = niq_dequeue(&pppoeinq)) != NULL)
- pppoe_data_input(m);
-}
-
/* Analyze and handle a single received packet while not in session state. */
static void
pppoe_dispatch_disc_pkt(struct mbuf *m)
@@ -649,7 +628,7 @@ done:
}
/* Input function for discovery packets. */
-static void
+void
pppoe_disc_input(struct mbuf *m)
{
/* avoid error messages if there is not a single pppoe instance */
@@ -661,7 +640,7 @@ pppoe_disc_input(struct mbuf *m)
}
/* Input function for data packets */
-static void
+void
pppoe_data_input(struct mbuf *m)
{
struct pppoe_softc *sc;
diff --git a/sys/net/if_pppoe.h b/sys/net/if_pppoe.h
index 4aa6ad2aae7..eabb404b78b 100644
--- a/sys/net/if_pppoe.h
+++ b/sys/net/if_pppoe.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pppoe.h,v 1.6 2015/04/10 13:58:20 dlg Exp $ */
+/* $OpenBSD: if_pppoe.h,v 1.7 2021/01/04 21:21:41 kn Exp $ */
/* $NetBSD: if_pppoe.h,v 1.5 2003/11/28 08:56:48 keihan Exp $ */
/*
@@ -66,10 +66,8 @@ struct pppoeconnectionstate {
#ifdef _KERNEL
-extern struct niqueue pppoediscinq;
-extern struct niqueue pppoeinq;
-
-void pppoeintr(void);
+void pppoe_disc_input(struct mbuf *);
+void pppoe_data_input(struct mbuf *);
#endif /* _KERNEL */
#endif /* _NET_IF_PPPOE_H_ */
diff --git a/sys/net/netisr.h b/sys/net/netisr.h
index efdff82be07..4be438beb5f 100644
--- a/sys/net/netisr.h
+++ b/sys/net/netisr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: netisr.h,v 1.53 2020/08/06 12:00:46 mvs Exp $ */
+/* $OpenBSD: netisr.h,v 1.54 2021/01/04 21:21:41 kn Exp $ */
/* $NetBSD: netisr.h,v 1.12 1995/08/12 23:59:24 mycroft Exp $ */
/*
@@ -45,7 +45,6 @@
#define NETISR_ARP 18 /* same as AF_LINK */
#define NETISR_PPP 28 /* for PPP processing */
#define NETISR_BRIDGE 29 /* for bridge processing */
-#define NETISR_PPPOE 30 /* for pppoe processing */
#define NETISR_SWITCH 31 /* for switch dataplane */
#ifndef _LOCORE