Module Name: src Committed By: ozaki-r Date: Fri Aug 28 06:23:42 UTC 2020
Modified Files: src/sys/net: if.h if_arcsubr.c if_ethersubr.c if_ieee1394subr.c Log Message: net: introduce IFQ_ENQUEUE_ISR to assemble packet queuing routines (NFCI) To generate a diff of this commit: cvs rdiff -u -r1.283 -r1.284 src/sys/net/if.h cvs rdiff -u -r1.81 -r1.82 src/sys/net/if_arcsubr.c cvs rdiff -u -r1.284 -r1.285 src/sys/net/if_ethersubr.c cvs rdiff -u -r1.65 -r1.66 src/sys/net/if_ieee1394subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/net/if.h diff -u src/sys/net/if.h:1.283 src/sys/net/if.h:1.284 --- src/sys/net/if.h:1.283 Tue May 5 08:05:03 2020 +++ src/sys/net/if.h Fri Aug 28 06:23:42 2020 @@ -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 @@ do { \ #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); Index: src/sys/net/if_arcsubr.c diff -u src/sys/net/if_arcsubr.c:1.81 src/sys/net/if_arcsubr.c:1.82 --- src/sys/net/if_arcsubr.c:1.81 Wed Jan 29 04:11:35 2020 +++ src/sys/net/if_arcsubr.c Fri Aug 28 06:23:42 2020 @@ -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 @@ arc_input(struct ifnet *ifp, struct mbuf 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); } /* Index: src/sys/net/if_ethersubr.c diff -u src/sys/net/if_ethersubr.c:1.284 src/sys/net/if_ethersubr.c:1.285 --- src/sys/net/if_ethersubr.c:1.284 Thu Apr 30 03:29:55 2020 +++ src/sys/net/if_ethersubr.c Fri Aug 28 06:23:42 2020 @@ -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 @@ ether_input(struct ifnet *ifp, struct mb 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); } /* Index: src/sys/net/if_ieee1394subr.c diff -u src/sys/net/if_ieee1394subr.c:1.65 src/sys/net/if_ieee1394subr.c:1.66 --- src/sys/net/if_ieee1394subr.c:1.65 Sat Dec 22 14:28:56 2018 +++ src/sys/net/if_ieee1394subr.c Fri Aug 28 06:23:42 2020 @@ -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 @@ ieee1394_input(struct ifnet *ifp, struct 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 *