Source-Changes-HG archive

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

[src/trunk]: src/sys/net net: introduce IFQ_ENQUEUE_ISR to assemble packet qu...



details:   https://anonhg.NetBSD.org/src/rev/7814e2d4ffd2
branches:  trunk
changeset: 937851:7814e2d4ffd2
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Fri Aug 28 06:23:42 2020 +0000

description:
net: introduce IFQ_ENQUEUE_ISR to assemble packet queuing routines (NFCI)

diffstat:

 sys/net/if.h              |  16 +++++++++++++++-
 sys/net/if_arcsubr.c      |  15 +++------------
 sys/net/if_ethersubr.c    |  15 +++------------
 sys/net/if_ieee1394subr.c |  15 +++------------
 4 files changed, 24 insertions(+), 37 deletions(-)

diffs (138 lines):

diff -r 0a4284121a66 -r 7814e2d4ffd2 sys/net/if.h
--- a/sys/net/if.h      Fri Aug 28 06:22:25 2020 +0000
+++ b/sys/net/if.h      Fri Aug 28 06:23:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.h,v 1.283 2020/05/05 08:05:03 jdolecek Exp $        */
+/*     $NetBSD: if.h,v 1.284 2020/08/28 06:23:42 ozaki-r Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -1069,6 +1069,20 @@
 #define        IFQ_INC_DROPS(ifq)              ((ifq)->ifq_drops++)
 #define        IFQ_SET_MAXLEN(ifq, len)        ((ifq)->ifq_maxlen = (len))
 
+#define        IFQ_ENQUEUE_ISR(ifq, m, isr)                                    \
+do {                                                                   \
+       IFQ_LOCK(inq);                                                  \
+       if (IF_QFULL(inq)) {                                            \
+               IF_DROP(inq);                                           \
+               IFQ_UNLOCK(inq);                                        \
+               m_freem(m);                                             \
+       } else {                                                        \
+               IF_ENQUEUE(inq, m);                                     \
+               IFQ_UNLOCK(inq);                                        \
+               schednetisr(isr);                                       \
+       }                                                               \
+} while (/*CONSTCOND*/ 0)
+
 #include <sys/mallocvar.h>
 MALLOC_DECLARE(M_IFADDR);
 MALLOC_DECLARE(M_IFMADDR);
diff -r 0a4284121a66 -r 7814e2d4ffd2 sys/net/if_arcsubr.c
--- a/sys/net/if_arcsubr.c      Fri Aug 28 06:22:25 2020 +0000
+++ b/sys/net/if_arcsubr.c      Fri Aug 28 06:23:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_arcsubr.c,v 1.81 2020/01/29 04:11:35 thorpej Exp $  */
+/*     $NetBSD: if_arcsubr.c,v 1.82 2020/08/28 06:23:42 ozaki-r Exp $  */
 
 /*
  * Copyright (c) 1994, 1995 Ignatios Souvatzis
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_arcsubr.c,v 1.81 2020/01/29 04:11:35 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arcsubr.c,v 1.82 2020/08/28 06:23:42 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -580,16 +580,7 @@
                return;
        }
 
-       IFQ_LOCK(inq);
-       if (IF_QFULL(inq)) {
-               IF_DROP(inq);
-               IFQ_UNLOCK(inq);
-               m_freem(m);
-       } else {
-               IF_ENQUEUE(inq, m);
-               IFQ_UNLOCK(inq);
-               schednetisr(isr);
-       }
+       IFQ_ENQUEUE_ISR(inq, m, isr);
 }
 
 /*
diff -r 0a4284121a66 -r 7814e2d4ffd2 sys/net/if_ethersubr.c
--- a/sys/net/if_ethersubr.c    Fri Aug 28 06:22:25 2020 +0000
+++ b/sys/net/if_ethersubr.c    Fri Aug 28 06:23:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ethersubr.c,v 1.284 2020/04/30 03:29:55 riastradh Exp $     */
+/*     $NetBSD: if_ethersubr.c,v 1.285 2020/08/28 06:23:42 ozaki-r Exp $       */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.284 2020/04/30 03:29:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.285 2020/08/28 06:23:42 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -944,16 +944,7 @@
                return;
        }
 
-       IFQ_LOCK(inq);
-       if (IF_QFULL(inq)) {
-               IF_DROP(inq);
-               IFQ_UNLOCK(inq);
-               m_freem(m);
-       } else {
-               IF_ENQUEUE(inq, m);
-               IFQ_UNLOCK(inq);
-               schednetisr(isr);
-       }
+       IFQ_ENQUEUE_ISR(inq, m, isr);
 }
 
 /*
diff -r 0a4284121a66 -r 7814e2d4ffd2 sys/net/if_ieee1394subr.c
--- a/sys/net/if_ieee1394subr.c Fri Aug 28 06:22:25 2020 +0000
+++ b/sys/net/if_ieee1394subr.c Fri Aug 28 06:23:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ieee1394subr.c,v 1.65 2018/12/22 14:28:56 maxv Exp $        */
+/*     $NetBSD: if_ieee1394subr.c,v 1.66 2020/08/28 06:23:42 ozaki-r Exp $     */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.65 2018/12/22 14:28:56 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.66 2020/08/28 06:23:42 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -404,16 +404,7 @@
                return;
        }
 
-       IFQ_LOCK(inq);
-       if (IF_QFULL(inq)) {
-               IF_DROP(inq);
-               IFQ_UNLOCK(inq);
-               m_freem(m);
-       } else {
-               IF_ENQUEUE(inq, m);
-               IFQ_UNLOCK(inq);
-               schednetisr(isr);
-       }
+       IFQ_ENQUEUE_ISR(inq, m, isr);
 }
 
 static struct mbuf *



Home | Main Index | Thread Index | Old Index