Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Put schednetisr() into splnet()/splx() pair.



details:   https://anonhg.NetBSD.org/src/rev/1424210b7372
branches:  trunk
changeset: 329209:1424210b7372
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu May 15 09:04:03 2014 +0000

description:
Put schednetisr() into splnet()/splx() pair.
This might avoids delay of processing a packet.

diffstat:

 sys/net/if_arcsubr.c      |  19 +++++++++++--------
 sys/net/if_atmsubr.c      |  19 +++++++++++--------
 sys/net/if_ecosubr.c      |  13 ++++++++-----
 sys/net/if_fddisubr.c     |  23 +++++++++++++----------
 sys/net/if_ieee1394subr.c |  15 +++++++++------
 5 files changed, 52 insertions(+), 37 deletions(-)

diffs (truncated from 361 to 300 lines):

diff -r 113d5ab33058 -r 1424210b7372 sys/net/if_arcsubr.c
--- a/sys/net/if_arcsubr.c      Thu May 15 08:36:34 2014 +0000
+++ b/sys/net/if_arcsubr.c      Thu May 15 09:04:03 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_arcsubr.c,v 1.64 2012/09/24 03:05:53 msaitoh Exp $  */
+/*     $NetBSD: if_arcsubr.c,v 1.65 2014/05/15 09:04:03 msaitoh Exp $  */
 
 /*
  * Copyright (c) 1994, 1995 Ignatios Souvatzis
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_arcsubr.c,v 1.64 2012/09/24 03:05:53 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arcsubr.c,v 1.65 2014/05/15 09:04:03 msaitoh Exp $");
 
 #include "opt_inet.h"
 
@@ -527,6 +527,7 @@
        struct arc_header *ah;
        struct ifqueue *inq;
        uint8_t atype;
+       int isr = 0;
        int s;
 
        if ((ifp->if_flags & IFF_UP) == 0) {
@@ -553,19 +554,19 @@
 #ifdef INET
        case ARCTYPE_IP:
                m_adj(m, ARC_HDRNEWLEN);
-               schednetisr(NETISR_IP);
+               isr = NETISR_IP;
                inq = &ipintrq;
                break;
 
        case ARCTYPE_IP_OLD:
                m_adj(m, ARC_HDRLEN);
-               schednetisr(NETISR_IP);
+               isr = NETISR_IP;
                inq = &ipintrq;
                break;
 
        case ARCTYPE_ARP:
                m_adj(m, ARC_HDRNEWLEN);
-               schednetisr(NETISR_ARP);
+               isr = NETISR_ARP;
                inq = &arpintrq;
 #ifdef ARCNET_ALLOW_BROKEN_ARP
                mtod(m, struct arphdr *)->ar_pro = htons(ETHERTYPE_IP);
@@ -574,7 +575,7 @@
 
        case ARCTYPE_ARP_OLD:
                m_adj(m, ARC_HDRLEN);
-               schednetisr(NETISR_ARP);
+               isr = NETISR_ARP;
                inq = &arpintrq;
 #ifdef ARCNET_ALLOW_BROKEN_ARP
                mtod(m, struct arphdr *)->ar_pro = htons(ETHERTYPE_IP);
@@ -584,7 +585,7 @@
 #ifdef INET6
        case ARCTYPE_INET6:
                m_adj(m, ARC_HDRNEWLEN);
-               schednetisr(NETISR_IPV6);
+               isr = NETISR_IPV6;
                inq = &ip6intrq;
                break;
 #endif
@@ -597,8 +598,10 @@
        if (IF_QFULL(inq)) {
                IF_DROP(inq);
                m_freem(m);
-       } else
+       } else {
                IF_ENQUEUE(inq, m);
+               schednetisr(isr);
+       }
        splx(s);
 }
 
diff -r 113d5ab33058 -r 1424210b7372 sys/net/if_atmsubr.c
--- a/sys/net/if_atmsubr.c      Thu May 15 08:36:34 2014 +0000
+++ b/sys/net/if_atmsubr.c      Thu May 15 09:04:03 2014 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: if_atmsubr.c,v 1.50 2012/10/11 20:05:50 christos Exp $       */
+/*      $NetBSD: if_atmsubr.c,v 1.51 2014/05/15 09:04:03 msaitoh Exp $       */
 
 /*
  * Copyright (c) 1996 Charles D. Cranor and Washington University.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_atmsubr.c,v 1.50 2012/10/11 20:05:50 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_atmsubr.c,v 1.51 2014/05/15 09:04:03 msaitoh Exp $");
 
 #include "opt_inet.h"
 #include "opt_gateway.h"
@@ -228,6 +228,7 @@
 {
        struct ifqueue *inq;
        uint16_t etype = ETHERTYPE_IP; /* default */
+       int isr = 0;
        int s;
 
        if ((ifp->if_flags & IFF_UP) == 0) {
@@ -242,7 +243,7 @@
          s = splnet();                 /* in case 2 atm cards @ diff lvls */
          npcb->npcb_inq++;                     /* count # in queue */
          splx(s);
-         schednetisr(NETISR_NATM);
+         isr = NETISR_NATM;
          inq = &natmintrq;
          m->m_pkthdr.rcvif = rxhand; /* XXX: overload */
 #else
@@ -281,7 +282,7 @@
                  if (ipflow_fastforward(m))
                        return;
 #endif
-                 schednetisr(NETISR_IP);
+                 isr = NETISR_IP;
                  inq = &ipintrq;
                  break;
 #endif /* INET */
@@ -291,9 +292,9 @@
                if (ip6flow_fastforward(&m))
                        return;
 #endif
-                 schednetisr(NETISR_IPV6);
-                 inq = &ip6intrq;
-                 break;
+               isr = NETISR_IPV6;
+               inq = &ip6intrq;
+               break;
 #endif
          default:
              m_freem(m);
@@ -305,8 +306,10 @@
        if (IF_QFULL(inq)) {
                IF_DROP(inq);
                m_freem(m);
-       } else
+       } else {
                IF_ENQUEUE(inq, m);
+               schednetisr(isr);
+       }
        splx(s);
 }
 
diff -r 113d5ab33058 -r 1424210b7372 sys/net/if_ecosubr.c
--- a/sys/net/if_ecosubr.c      Thu May 15 08:36:34 2014 +0000
+++ b/sys/net/if_ecosubr.c      Thu May 15 09:04:03 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ecosubr.c,v 1.38 2013/08/04 07:05:15 kiyohara Exp $ */
+/*     $NetBSD: if_ecosubr.c,v 1.39 2014/05/15 09:04:03 msaitoh Exp $  */
 
 /*-
  * Copyright (c) 2001 Ben Harris
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ecosubr.c,v 1.38 2013/08/04 07:05:15 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ecosubr.c,v 1.39 2014/05/15 09:04:03 msaitoh Exp $");
 
 #include "opt_inet.h"
 
@@ -355,6 +355,7 @@
 {
        struct ifqueue *inq;
        struct eco_header ehdr, *eh;
+       int isr = 0;
        int s;
 #ifdef INET
        int i;
@@ -380,7 +381,7 @@
        case ECO_PORT_IP:
                switch (eh->eco_control) {
                case ECO_CTL_IP:
-                       schednetisr(NETISR_IP);
+                       isr = NETISR_IP;
                        inq = &ipintrq;
                        break;
                case ECO_CTL_ARP_REQUEST:
@@ -426,7 +427,7 @@
                        memcpy(ar_tpa(ah), ecah->ecar_tpa, ah->ar_pln);
                        m_freem(m);
                        m = m1;
-                       schednetisr(NETISR_ARP);
+                       isr = NETISR_ARP;
                        inq = &arpintrq;
                        break;
                case ECO_CTL_IPBCAST_REQUEST:
@@ -476,8 +477,10 @@
        if (IF_QFULL(inq)) {
                IF_DROP(inq);
                m_freem(m);
-       } else
+       } else {
                IF_ENQUEUE(inq, m);
+               schednetisr(isr);
+       }
        splx(s);
 }
 
diff -r 113d5ab33058 -r 1424210b7372 sys/net/if_fddisubr.c
--- a/sys/net/if_fddisubr.c     Thu May 15 08:36:34 2014 +0000
+++ b/sys/net/if_fddisubr.c     Thu May 15 09:04:03 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_fddisubr.c,v 1.84 2013/03/01 18:25:56 joerg Exp $   */
+/*     $NetBSD: if_fddisubr.c,v 1.85 2014/05/15 09:04:03 msaitoh Exp $ */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -96,7 +96,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_fddisubr.c,v 1.84 2013/03/01 18:25:56 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_fddisubr.c,v 1.85 2014/05/15 09:04:03 msaitoh Exp $");
 
 #include "opt_gateway.h"
 #include "opt_inet.h"
@@ -465,6 +465,7 @@
 #endif
        struct llc *l;
        struct fddi_header *fh;
+       int isr = 0;
 
        MCLAIM(m, &((struct ethercom *)ifp)->ec_rx_mowner);
        if ((ifp->if_flags & IFF_UP) == 0) {
@@ -517,7 +518,7 @@
                        ntohs(l->llc_snap_ether_type) == ETHERTYPE_ATALK) {
                    inq = &atintrq2;
                    m_adj( m, sizeof( struct llc ));
-                   schednetisr(NETISR_ATALK);
+                   isr = NETISR_ATALK;
                    break;
                }
 
@@ -547,13 +548,13 @@
                        if (ipflow_fastforward(m))
                                return;
 #endif
-                       schednetisr(NETISR_IP);
+                       isr = NETISR_IP;
                        inq = &ipintrq;
                        break;
 
                case ETHERTYPE_ARP:
 #if !defined(__bsdi__) || _BSDI_VERSION >= 199401
-                       schednetisr(NETISR_ARP);
+                       isr = NETISR_ARP;
                        inq = &arpintrq;
                        break;
 #else
@@ -563,7 +564,7 @@
 #endif
 #ifdef IPX
                case ETHERTYPE_IPX:
-                       schednetisr(NETISR_IPX);
+                       isr = NETISR_IPX;
                        inq = &ipxintrq;
                        break;
 #endif
@@ -573,20 +574,20 @@
                        if (ip6flow_fastforward(&m))
                                return;
 #endif
-                       schednetisr(NETISR_IPV6);
+                       isr = NETISR_IPV6;
                        inq = &ip6intrq;
                        break;
 
 #endif
 #ifdef DECNET
                case ETHERTYPE_DECNET:
-                       schednetisr(NETISR_DECNET);
+                       isr = NETISR_DECNET;
                        inq = &decnetintrq;
                        break;
 #endif
 #ifdef NETATALK
                case ETHERTYPE_ATALK:
-                       schednetisr(NETISR_ATALK);
+                       isr = NETISR_ATALK;
                        inq = &atintrq1;
                        break;
                case ETHERTYPE_AARP:
@@ -616,8 +617,10 @@
        if (IF_QFULL(inq)) {
                IF_DROP(inq);
                m_freem(m);
-       } else
+       } else {
                IF_ENQUEUE(inq, m);
+               schednetisr(isr);
+       }
        splx(s);
 #endif
 }



Home | Main Index | Thread Index | Old Index