Tuesday, December 03, 2024

Re: PPPoE passthrough with "GigaHub" is very slow

I received an error for if_ethersubr.c and if_pppoe.c. The rest of the patches were successful.

router$ patch < pppoe_rx.patch
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: if_ethersubr.c
|===================================================================
|RCS file: /cvs/src/sys/net/if_ethersubr.c,v
|diff -u -p -r1.293 if_ethersubr.c
|--- if_ethersubr.c      14 Feb 2024 22:41:48 -0000      1.293
|+++ if_ethersubr.c      30 Nov 2024 06:29:47 -0000
--------------------------
File to patch: ./sys/net/if_ethersubr.c
Patching file ./sys/net/if_ethersubr.c using Plan A...
Hunk #1 failed at 561.
1 out of 1 hunks failed--saving rejects to ./sys/net/if_ethersubr.c.rej
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: if_pppoe.c
|===================================================================
|RCS file: /cvs/src/sys/net/if_pppoe.c,v
|diff -u -p -r1.84 if_pppoe.c
|--- if_pppoe.c  26 Jun 2024 01:40:49 -0000      1.84
|+++ if_pppoe.c  30 Nov 2024 06:29:47 -0000
--------------------------
File to patch: ./sys/net/if_pppoe.c
Patching file ./sys/net/if_pppoe.c using Plan A...
Hunk #1 succeeded at 42.
Hunk #2 failed at 126.
Hunk #3 succeeded at 179 with fuzz 1.
Hunk #4 failed at 214.
Hunk #5 failed at 245.
Hunk #6 failed at 260.
Hunk #7 failed at 294.
Hunk #8 failed at 310.
Hunk #9 succeeded at 341 with fuzz 1.
Hunk #10 failed at 648.
Hunk #11 failed at 661.
Hunk #12 failed at 684.
Hunk #13 succeeded at 726 with fuzz 1.
Hunk #14 failed at 882.
Hunk #15 failed at 1078.
Hunk #16 failed at 1116.
Hunk #17 failed at 1288.
Hunk #18 failed at 1331.
Hunk #19 failed at 1363.
Hunk #20 failed at 1391.
Hunk #21 failed at 1537.
Hunk #22 failed at 1569.
18 out of 22 hunks failed--saving rejects to ./sys/net/if_pppoe.c.rej
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: if_pppoe.h
|===================================================================
|RCS file: /cvs/src/sys/net/if_pppoe.h,v
|diff -u -p -r1.8 if_pppoe.h
|--- if_pppoe.h  29 Jun 2022 09:08:07 -0000      1.8
|+++ if_pppoe.h  30 Nov 2024 06:29:47 -0000
--------------------------
File to patch: ./sys/net/if_pppoe.h
Patching file ./sys/net/if_pppoe.h using Plan A...
Hunk #1 succeeded at 69.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: if_sppp.h
|===================================================================
|RCS file: /cvs/src/sys/net/if_sppp.h,v
|diff -u -p -r1.30 if_sppp.h
|--- if_sppp.h   17 Nov 2021 18:00:24 -0000      1.30
|+++ if_sppp.h   30 Nov 2024 06:29:47 -0000
--------------------------
File to patch: ./sys/net/if_sppp.h
Patching file ./sys/net/if_sppp.h using Plan A...
Hunk #1 succeeded at 232.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: if_spppsubr.c
|===================================================================
|RCS file: /cvs/src/sys/net/if_spppsubr.c,v
|diff -u -p -r1.194 if_spppsubr.c
|--- if_spppsubr.c       22 Jun 2024 10:22:29 -0000      1.194
|+++ if_spppsubr.c       30 Nov 2024 06:29:47 -0000
--------------------------
File to patch: ./sys/net/if_spppsubr.c
Patching file ./sys/net/if_spppsubr.c using Plan A...
Hunk #1 succeeded at 415.
done

On Mon, 2 Dec 2024 at 11:24, Brodey Dover <doverosx@gmail.com> wrote:
Thank you very much.

I'll look at applying the diff but it's been a while since I've done it.

Brodey

On Sun, 1 Dec 2024 at 17:48, David Gwynne <david@gwynne.id.au> wrote:
On Wed, Nov 27, 2024 at 09:14:19AM -0500, Brodey Dover wrote:
> Thanks. The MTU is auto negotiated to 1492. max-mss is 1440 in pf.
>
> I don't think OpenBSD has netisr or an equivalent since I don't see
> anything in the sysctl list, but it was implemented in FreeBSD and has
> allowed a number of people to fully saturate the mutli-gig symmetrical
> connections offered by newer ISPs using PPPoE. I should add *ON
> mutli-core/slower speed CPUs".

the diff below might improve pppoe rx performance.

> On Wed, 27 Nov 2024 at 03:03, Christer Solskogen <
> christer.solskogen@gmail.com> wrote:
>
> > On Tue, Nov 26, 2024 at 10:59???PM Brodey Dover <doverosx@gmail.com> wrote:
> > >
> > > So my modem is too buggy to do any DMZ work, thank you ISP.
> > >
> > > But the modem does pull 2375/2375. That???s down/up, which is why I was
> > thinking there was a serious bottleneck on the OBSD side.
> > >
> >
> > It's at least 20 years since I used PPPoE, but I seem to remember that
> > I had to lower the MTU to get the full speed. 1492 if I remember
> > correctly.
> >
> > --
> > chs

Index: if_ethersubr.c
===================================================================
RCS file: /cvs/src/sys/net/if_ethersubr.c,v
diff -u -p -r1.293 if_ethersubr.c
--- if_ethersubr.c      14 Feb 2024 22:41:48 -0000      1.293
+++ if_ethersubr.c      30 Nov 2024 06:29:47 -0000
@@ -561,7 +561,8 @@ ether_input(struct ifnet *ifp, struct mb
                        if (mq_enqueue(&pppoediscinq, m) == 0)
                                schednetisr(NETISR_PPPOE);
                } else {
-                       if (mq_enqueue(&pppoeinq, m) == 0)
+                       m = pppoe_vinput(ifp, m);
+                       if (m != NULL && mq_enqueue(&pppoeinq, m) == 0)
                                schednetisr(NETISR_PPPOE);
                }
                return;
Index: if_pppoe.c
===================================================================
RCS file: /cvs/src/sys/net/if_pppoe.c,v
diff -u -p -r1.84 if_pppoe.c
--- if_pppoe.c  26 Jun 2024 01:40:49 -0000      1.84
+++ if_pppoe.c  30 Nov 2024 06:29:47 -0000
@@ -42,6 +42,8 @@
 #include <sys/socket.h>
 #include <sys/syslog.h>
 #include <sys/ioctl.h>
+#include <sys/smr.h>
+#include <sys/percpu.h>
 #include <net/if.h>
 #include <net/if_var.h>
 #include <net/if_types.h>
@@ -124,7 +126,9 @@ struct pppoe_softc {
        struct sppp sc_sppp;            /* contains a struct ifnet as first element */
        LIST_ENTRY(pppoe_softc) sc_list;/* [K] */
        unsigned int sc_eth_ifidx;      /* [K] */
+       caddr_t sc_bpf;

+       SMR_LIST_ENTRY(pppoe_softc) sc_session_entry; /* [K] */
        int sc_state;                   /* [K] discovery phase or session connected */
        struct ether_addr sc_dest;      /* [K] hardware address of concentrator */
        u_int16_t sc_session;           /* [K] PPPoE session id */
@@ -175,6 +179,7 @@ static struct pppoe_softc *pppoe_find_so
 static struct mbuf       *pppoe_get_mbuf(size_t len);

 LIST_HEAD(pppoe_softc_head, pppoe_softc) pppoe_softc_list;
+SMR_LIST_HEAD(pppoe_softc_sessions, pppoe_softc) pppoe_sessions; /* [K] */

 /* interface cloning */
 int pppoe_clone_create(struct if_clone *, int);
@@ -209,9 +214,19 @@ void
 pppoeattach(int count)
 {
        LIST_INIT(&pppoe_softc_list);
+       SMR_LIST_INIT(&pppoe_sessions);
        if_clone_attach(&pppoe_cloner);
 }

+static void
+pppoe_set_state(struct pppoe_softc *sc, int state)
+{
+       KERNEL_ASSERT_LOCKED();
+       if (sc->sc_state == PPPOE_STATE_SESSION)
+               SMR_LIST_REMOVE_LOCKED(sc, sc_session_entry);
+       sc->sc_state = state;
+}
+
 /* Create a new interface. */
 int
 pppoe_clone_create(struct if_clone *ifc, int unit)
@@ -230,6 +245,8 @@ pppoe_clone_create(struct if_clone *ifc,
        sc->sc_sppp.pp_if.if_hdrlen = sizeof(struct ether_header) + PPPOE_HEADERLEN;
        sc->sc_sppp.pp_flags |= PP_KEEPALIVE;           /* use LCP keepalive */
        sc->sc_sppp.pp_framebytes = PPPOE_HEADERLEN;    /* framing added to ppp packets */
+       sc->sc_sppp.pp_if.if_input = p2p_input;
+       sc->sc_sppp.pp_if.if_bpf_mtap = p2p_bpf_mtap;
        sc->sc_sppp.pp_if.if_ioctl = pppoe_ioctl;
        sc->sc_sppp.pp_if.if_start = pppoe_start;
        sc->sc_sppp.pp_if.if_rtrequest = p2p_rtrequest;
@@ -243,11 +260,14 @@ pppoe_clone_create(struct if_clone *ifc,
        /* init timer for interface watchdog */
        timeout_set_proc(&sc->sc_timeout, pppoe_timeout, sc);

+       if_counters_alloc(&sc->sc_sppp.pp_if);
        if_attach(&sc->sc_sppp.pp_if);
        if_alloc_sadl(&sc->sc_sppp.pp_if);
        sppp_attach(&sc->sc_sppp.pp_if);
 #if NBPFILTER > 0
-       bpfattach(&sc->sc_sppp.pp_if.if_bpf, &sc->sc_sppp.pp_if, DLT_PPP_ETHER, 0);
+       bpfattach(&sc->sc_bpf, &sc->sc_sppp.pp_if, DLT_PPP_ETHER, 0);
+       bpfattach(&sc->sc_sppp.pp_if.if_bpf, &sc->sc_sppp.pp_if,
+           DLT_LOOP, sizeof(uint32_t));
 

No comments:

Post a Comment