Subject: PPPoE performance improvement
To: None <>
From: Aymeric Vincent <>
List: tech-net
Date: 03/02/2003 02:03:40

A friend of mine noticed that the performance of our in-kernel PPPoE
is not very good on a slow machine he has and I could verify that on a

Reading RFC 2516 shows that all the packets which go from the server
to a host are sent unicast.

Reading if_pppoe.c shows that each packet that hits pppoe_input() will
take a very long time to be processed, even if we don't care at all
about it (and I get a lot of unwanted PADI packets from other hosts).

With the appended patch, the PPPoE code will not bother with PPPoE
packets that are multicast anymore.

I added the #ifndef PPPOE_SERVER gratuitously as a reminder that if we
implement in-kernel PPPoE server support, we'll have to adjust which
packets we drop (and probably do that in if_pppoe.c).

The performance improvement is huge for me on a SPARCclassic at 50MHz.

Any objection before I commit the following patch?


Index: if_ethersubr.c
RCS file: /usr/local/cvsroot/src/sys/net/if_ethersubr.c,v
retrieving revision 1.104
diff -u -r1.104 if_ethersubr.c
--- if_ethersubr.c	26 Feb 2003 06:31:12 -0000	1.104
+++ if_ethersubr.c	2 Mar 2003 00:52:33 -0000
@@ -802,6 +802,13 @@
 #if NPPPOE > 0
+		if (m->m_flags & (M_MCAST | M_BCAST)) {
+			m_freem(m);
+			return;
+		}
 		if (etype == ETHERTYPE_PPPOEDISC) 
 			inq = &ppoediscinq;