it is in fact harmful for the stack to block hardware interrupts.

the nettq can run on cpu0, which is where interrupts for nics come in
too. if a busy nic has fed the stack a lot of work, and the stack is on
cpu0, then the stack will stop the driver pulling packets off the nic
again. the hardware will then place more packets on the rx ring
than it would have if the isr had serviced the ring, which messes
up the rx ring moderation we do. it will inflate the ring usage so the
rings will grow, letting it give the stack more work. it basically makes
the whole problem inflate.

rx ring moderation works a lot better with this diff. id argue it's
broken without it actually. without it the current watermark on
rings grows to the max under DoS conditions.

can anyone think of why the current network stack needs any interrupt
protection?

ok?

Index: if.c
===================================================================
RCS file: /cvs/src/sys/net/if.c,v
retrieving revision 1.573
diff -u -p -r1.573 if.c
--- if.c        1 Mar 2019 04:47:32 -0000       1.573
+++ if.c        1 Mar 2019 05:14:29 -0000
@@ -900,7 +900,6 @@ if_input_process(struct ifnet *ifp, stru
        struct mbuf *m;
        struct ifih *ifih;
        struct srp_ref sr;
-       int s;
 
        if (ml_empty(ml))
                return;
@@ -921,7 +920,6 @@ if_input_process(struct ifnet *ifp, stru
         * lists.
         */
        NET_RLOCK();
-       s = splnet();
        while ((m = ml_dequeue(ml)) != NULL) {
                /*
                 * Pass this mbuf to all input handlers of its
@@ -936,7 +934,6 @@ if_input_process(struct ifnet *ifp, stru
                if (ifih == NULL)
                        m_freem(m);
        }
-       splx(s);
        NET_RUNLOCK();
 }
 

Reply via email to