Source-Changes-HG archive

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

[src/trunk]: src/sys Convert NETATALK from a legacy netisr to pktqueue.



details:   https://anonhg.NetBSD.org/src/rev/f84388fc82c6
branches:  trunk
changeset: 369831:f84388fc82c6
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Sep 03 01:48:22 2022 +0000

description:
Convert NETATALK from a legacy netisr to pktqueue.

diffstat:

 sys/net/if_ethersubr.c    |  19 +++++------
 sys/net/if_gre.c          |   7 +--
 sys/net/if_loop.c         |  32 +++++---------------
 sys/net/netisr_dispatch.h |   5 +--
 sys/netatalk/at_extern.h  |   6 +-
 sys/netatalk/at_proto.c   |   5 +-
 sys/netatalk/at_var.h     |   7 +++-
 sys/netatalk/ddp_input.c  |  72 ++++++++++++++++++++++------------------------
 sys/netatalk/ddp_usrreq.c |  18 +++++++----
 9 files changed, 78 insertions(+), 93 deletions(-)

diffs (truncated from 427 to 300 lines):

diff -r f0cdf9ed8791 -r f84388fc82c6 sys/net/if_ethersubr.c
--- a/sys/net/if_ethersubr.c    Sat Sep 03 01:35:03 2022 +0000
+++ b/sys/net/if_ethersubr.c    Sat Sep 03 01:48:22 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ethersubr.c,v 1.317 2022/09/03 01:35:03 thorpej Exp $       */
+/*     $NetBSD: if_ethersubr.c,v 1.318 2022/09/03 01:48:22 thorpej 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.317 2022/09/03 01:35:03 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.318 2022/09/03 01:48:22 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -574,8 +574,7 @@
 static void
 ether_input_llc(struct ifnet *ifp, struct mbuf *m, struct ether_header *eh)
 {
-       struct ifqueue *inq = NULL;
-       int isr = 0;
+       pktqueue_t *pktq = NULL;
        struct llc *l;
 
        if (m->m_len < sizeof(*eh) + sizeof(struct llc))
@@ -594,10 +593,9 @@
                            at_org_code, sizeof(at_org_code)) == 0 &&
                            ntohs(l->llc_snap_ether_type) ==
                            ETHERTYPE_ATALK) {
-                               inq = &atintrq2;
+                               pktq = at_pktq2;
                                m_adj(m, sizeof(struct ether_header)
                                    + sizeof(struct llc));
-                               isr = NETISR_ATALK;
                                break;
                        }
 
@@ -621,8 +619,10 @@
                goto noproto;
        }
 
-       KASSERT(inq != NULL);
-       IFQ_ENQUEUE_ISR(inq, m, isr);
+       KASSERT(pktq != NULL);
+       if (__predict_false(!pktq_enqueue(pktq, m, 0))) {
+               m_freem(m);
+       }
        return;
 
 noproto:
@@ -927,8 +927,7 @@
 
 #ifdef NETATALK
        case ETHERTYPE_ATALK:
-               isr = NETISR_ATALK;
-               inq = &atintrq1;
+               pktq = at_pktq1;
                break;
 
        case ETHERTYPE_AARP:
diff -r f0cdf9ed8791 -r f84388fc82c6 sys/net/if_gre.c
--- a/sys/net/if_gre.c  Sat Sep 03 01:35:03 2022 +0000
+++ b/sys/net/if_gre.c  Sat Sep 03 01:48:22 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_gre.c,v 1.181 2021/09/21 14:59:14 christos Exp $ */
+/*     $NetBSD: if_gre.c,v 1.182 2022/09/03 01:48:22 thorpej Exp $ */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_gre.c,v 1.181 2021/09/21 14:59:14 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gre.c,v 1.182 2022/09/03 01:48:22 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_atalk.h"
@@ -825,8 +825,7 @@
 #endif
 #ifdef NETATALK
        case ETHERTYPE_ATALK:
-               ifq = &atintrq1;
-               isr = NETISR_ATALK;
+               pktq = at_pktq1;
                af = AF_APPLETALK;
                break;
 #endif
diff -r f0cdf9ed8791 -r f84388fc82c6 sys/net/if_loop.c
--- a/sys/net/if_loop.c Sat Sep 03 01:35:03 2022 +0000
+++ b/sys/net/if_loop.c Sat Sep 03 01:48:22 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_loop.c,v 1.114 2022/07/31 13:14:54 mlelstv Exp $    */
+/*     $NetBSD: if_loop.c,v 1.115 2022/09/03 01:48:22 thorpej Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.114 2022/07/31 13:14:54 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.115 2022/09/03 01:48:22 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -348,8 +348,7 @@
 #endif
 #ifdef NETATALK
        case AF_APPLETALK:
-               ifq = &atintrq2;
-               isr = NETISR_ATALK;
+               pktq = at_pktq2;
                break;
 #endif
        default:
@@ -397,11 +396,10 @@
 {
        for (;;) {
                pktqueue_t *pktq = NULL;
-               struct ifqueue *ifq = NULL;
                struct mbuf *m;
                size_t pktlen;
                uint32_t af;
-               int s, isr = 0;
+               int s;
 
                IFQ_DEQUEUE(&ifp->if_snd, m);
                if (m == NULL)
@@ -424,8 +422,7 @@
 #endif
 #ifdef NETATALK
                case AF_APPLETALK:
-                       ifq = &atintrq2;
-                       isr = NETISR_ATALK;
+                       pktq = at_pktq2;
                        break;
 #endif
                default:
@@ -435,25 +432,14 @@
                }
                pktlen = m->m_pkthdr.len;
 
+               KASSERT(pktq != NULL);
+
                s = splnet();
-               if (__predict_true(pktq)) {
-                       if (__predict_false(pktq_enqueue(pktq, m, 0))) {
-                               m_freem(m);
-                               splx(s);
-                               return;
-                       }
-                       if_statadd2(ifp, if_ipackets, 1, if_ibytes, pktlen);
+               if (__predict_false(pktq_enqueue(pktq, m, 0))) {
+                       m_freem(m);
                        splx(s);
-                       continue;
-               }
-               if (IF_QFULL(ifq)) {
-                       IF_DROP(ifq);
-                       splx(s);
-                       m_freem(m);
                        return;
                }
-               IF_ENQUEUE(ifq, m);
-               schednetisr(isr);
                if_statadd2(ifp, if_ipackets, 1, if_ibytes, pktlen);
                splx(s);
        }
diff -r f0cdf9ed8791 -r f84388fc82c6 sys/net/netisr_dispatch.h
--- a/sys/net/netisr_dispatch.h Sat Sep 03 01:35:03 2022 +0000
+++ b/sys/net/netisr_dispatch.h Sat Sep 03 01:48:22 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netisr_dispatch.h,v 1.21 2022/09/03 01:35:03 thorpej Exp $ */
+/* $NetBSD: netisr_dispatch.h,v 1.22 2022/09/03 01:48:22 thorpej Exp $ */
 
 #ifndef _NET_NETISR_DISPATCH_H_
 #define _NET_NETISR_DISPATCH_H_
@@ -27,9 +27,6 @@
  * their prototypes in <net/netisr.h> (if necessary).
  */
 
-#ifdef NETATALK
-       DONETISR(NETISR_ATALK,atintr);
-#endif
 #ifdef MPLS
        DONETISR(NETISR_MPLS,mplsintr);
 #endif
diff -r f0cdf9ed8791 -r f84388fc82c6 sys/netatalk/at_extern.h
--- a/sys/netatalk/at_extern.h  Sat Sep 03 01:35:03 2022 +0000
+++ b/sys/netatalk/at_extern.h  Sat Sep 03 01:48:22 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: at_extern.h,v 1.20 2018/05/29 16:29:47 maxv Exp $      */
+/*     $NetBSD: at_extern.h,v 1.21 2022/09/03 01:48:22 thorpej Exp $   */
 
 /*
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
@@ -44,7 +44,8 @@
 
 extern const struct pr_usrreqs ddp_usrreqs;
 
-void   atintr(void);
+void   atintr1(void *);
+void   atintr2(void *);
 void   aarpprobe(void *);
 int    aarpresolve(struct ifnet *, struct mbuf *, const struct sockaddr_at *,
     u_char *);
@@ -66,5 +67,4 @@
 int     ddp_route(struct mbuf *, struct route *);
 char * prsockaddr(const void *);
 
-
 #endif /* !_NETATALK_AT_EXTERN_H_ */
diff -r f0cdf9ed8791 -r f84388fc82c6 sys/netatalk/at_proto.c
--- a/sys/netatalk/at_proto.c   Sat Sep 03 01:35:03 2022 +0000
+++ b/sys/netatalk/at_proto.c   Sat Sep 03 01:48:22 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: at_proto.c,v 1.22 2017/09/21 07:15:34 ozaki-r Exp $    */
+/*     $NetBSD: at_proto.c,v 1.23 2022/09/03 01:48:22 thorpej Exp $    */
 
 /*
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: at_proto.c,v 1.22 2017/09/21 07:15:34 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at_proto.c,v 1.23 2022/09/03 01:48:22 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -73,7 +73,6 @@
        .dom_maxrtkey = sizeof(struct sockaddr_at),
        .dom_ifattach = NULL,
        .dom_ifdetach = NULL,
-       .dom_ifqueues = { &atintrq1, &atintrq2 },
        .dom_link = { NULL },
        .dom_mowner = MOWNER_INIT("",""),
        .dom_sa_cmpofs = offsetof(struct sockaddr_at, sat_addr),
diff -r f0cdf9ed8791 -r f84388fc82c6 sys/netatalk/at_var.h
--- a/sys/netatalk/at_var.h     Sat Sep 03 01:35:03 2022 +0000
+++ b/sys/netatalk/at_var.h     Sat Sep 03 01:48:22 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: at_var.h,v 1.9 2019/10/09 14:15:40 maxv Exp $   */
+/*     $NetBSD: at_var.h,v 1.10 2022/09/03 01:48:22 thorpej Exp $       */
 
 /*
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -67,6 +67,9 @@
 #define AFA_PHASE2     0x0004
 
 #ifdef _KERNEL
+
+#include <net/pktqueue.h>
+
 int sockaddr_at_cmp(const struct sockaddr *, const struct sockaddr *);
 
 static __inline void
@@ -104,7 +107,7 @@
 }
 TAILQ_HEAD(at_ifaddrhead, at_ifaddr);
 extern struct at_ifaddrhead at_ifaddr;
-extern struct ifqueue atintrq1, atintrq2;
+extern pktqueue_t *at_pktq1, *at_pktq2;
 #endif
 
 #endif /* !_NETATALK_AT_VAR_H_ */
diff -r f0cdf9ed8791 -r f84388fc82c6 sys/netatalk/ddp_input.c
--- a/sys/netatalk/ddp_input.c  Sat Sep 03 01:35:03 2022 +0000
+++ b/sys/netatalk/ddp_input.c  Sat Sep 03 01:48:22 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ddp_input.c,v 1.31 2018/03/21 14:23:54 roy Exp $        */
+/*     $NetBSD: ddp_input.c,v 1.32 2022/09/03 01:48:22 thorpej Exp $    */
 
 /*
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ddp_input.c,v 1.31 2018/03/21 14:23:54 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ddp_input.c,v 1.32 2022/09/03 01:48:22 thorpej Exp $");
 #include "opt_atalk.h"
 
 #include <sys/param.h>
@@ -53,59 +53,57 @@
 int             ddp_forward = 1;
 int             ddp_firewall = 0;
 extern int      ddp_cksum;
-void            ddp_input(struct mbuf *, struct ifnet *,
-    struct elaphdr *, int);
+void            ddp_input(struct mbuf *, struct ifnet *, struct elaphdr *, int);
 
-/*
- * Could probably merge these two code segments a little better...
- */
-void



Home | Main Index | Thread Index | Old Index