| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: pktqueue.c,v 1.21 2022/09/04 17:34:43 thorpej Exp $ */ | | 1 | /* $NetBSD: pktqueue.c,v 1.22 2023/05/28 08:09:34 andvar Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2014 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2014 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Mindaugas Rasiukevicius. | | 8 | * by Mindaugas Rasiukevicius. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -26,27 +26,27 @@ | | | @@ -26,27 +26,27 @@ |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | /* | | 32 | /* |
33 | * The packet queue (pktqueue) interface is a lockless IP input queue | | 33 | * The packet queue (pktqueue) interface is a lockless IP input queue |
34 | * which also abstracts and handles network ISR scheduling. It provides | | 34 | * which also abstracts and handles network ISR scheduling. It provides |
35 | * a mechanism to enable receiver-side packet steering (RPS). | | 35 | * a mechanism to enable receiver-side packet steering (RPS). |
36 | */ | | 36 | */ |
37 | | | 37 | |
38 | #include <sys/cdefs.h> | | 38 | #include <sys/cdefs.h> |
39 | __KERNEL_RCSID(0, "$NetBSD: pktqueue.c,v 1.21 2022/09/04 17:34:43 thorpej Exp $"); | | 39 | __KERNEL_RCSID(0, "$NetBSD: pktqueue.c,v 1.22 2023/05/28 08:09:34 andvar Exp $"); |
40 | | | 40 | |
41 | #ifdef _KERNEL_OPT | | 41 | #ifdef _KERNEL_OPT |
42 | #include "opt_net_mpsafe.h" | | 42 | #include "opt_net_mpsafe.h" |
43 | #endif | | 43 | #endif |
44 | | | 44 | |
45 | #include <sys/param.h> | | 45 | #include <sys/param.h> |
46 | #include <sys/types.h> | | 46 | #include <sys/types.h> |
47 | | | 47 | |
48 | #include <sys/atomic.h> | | 48 | #include <sys/atomic.h> |
49 | #include <sys/cpu.h> | | 49 | #include <sys/cpu.h> |
50 | #include <sys/pcq.h> | | 50 | #include <sys/pcq.h> |
51 | #include <sys/intr.h> | | 51 | #include <sys/intr.h> |
52 | #include <sys/mbuf.h> | | 52 | #include <sys/mbuf.h> |
| @@ -542,27 +542,27 @@ pktq_flush(pktqueue_t *pq) | | | @@ -542,27 +542,27 @@ pktq_flush(pktqueue_t *pq) |
542 | struct cpu_info *ci; | | 542 | struct cpu_info *ci; |
543 | struct mbuf *m, *m0 = NULL; | | 543 | struct mbuf *m, *m0 = NULL; |
544 | | | 544 | |
545 | ASSERT_SLEEPABLE(); | | 545 | ASSERT_SLEEPABLE(); |
546 | | | 546 | |
547 | /* | | 547 | /* |
548 | * Run a dummy softint at IPL_SOFTNET on all CPUs to ensure that any | | 548 | * Run a dummy softint at IPL_SOFTNET on all CPUs to ensure that any |
549 | * already running handler for this pktqueue is no longer running. | | 549 | * already running handler for this pktqueue is no longer running. |
550 | */ | | 550 | */ |
551 | xc_barrier(XC_HIGHPRI_IPL(IPL_SOFTNET)); | | 551 | xc_barrier(XC_HIGHPRI_IPL(IPL_SOFTNET)); |
552 | | | 552 | |
553 | /* | | 553 | /* |
554 | * Acquire the barrier lock. While the caller ensures that | | 554 | * Acquire the barrier lock. While the caller ensures that |
555 | * no explcit pktq_barrier() calls will be issued, this holds | | 555 | * no explicit pktq_barrier() calls will be issued, this holds |
556 | * off any implicit pktq_barrier() calls that would happen | | 556 | * off any implicit pktq_barrier() calls that would happen |
557 | * as the result of pktq_ifdetach(). | | 557 | * as the result of pktq_ifdetach(). |
558 | */ | | 558 | */ |
559 | mutex_enter(&pq->pq_lock); | | 559 | mutex_enter(&pq->pq_lock); |
560 | | | 560 | |
561 | for (CPU_INFO_FOREACH(cii, ci)) { | | 561 | for (CPU_INFO_FOREACH(cii, ci)) { |
562 | struct pcq *q; | | 562 | struct pcq *q; |
563 | | | 563 | |
564 | kpreempt_disable(); | | 564 | kpreempt_disable(); |
565 | q = pktq_pcq(pq, ci); | | 565 | q = pktq_pcq(pq, ci); |
566 | kpreempt_enable(); | | 566 | kpreempt_enable(); |
567 | | | 567 | |
568 | /* | | 568 | /* |