| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: qat.c,v 1.4 2020/02/01 13:48:18 riastradh Exp $ */ | | 1 | /* $NetBSD: qat.c,v 1.5 2020/03/05 15:33:13 msaitoh Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2019 Internet Initiative Japan, Inc. | | 4 | * Copyright (c) 2019 Internet Initiative Japan, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -47,27 +47,27 @@ | | | @@ -47,27 +47,27 @@ |
47 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | | 47 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
48 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | | 48 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
49 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | | 49 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
50 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | | 50 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
51 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | | 51 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
52 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 52 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
53 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | 53 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
54 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 54 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
55 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | | 55 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
56 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 56 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
57 | */ | | 57 | */ |
58 | | | 58 | |
59 | #include <sys/cdefs.h> | | 59 | #include <sys/cdefs.h> |
60 | __KERNEL_RCSID(0, "$NetBSD: qat.c,v 1.4 2020/02/01 13:48:18 riastradh Exp $"); | | 60 | __KERNEL_RCSID(0, "$NetBSD: qat.c,v 1.5 2020/03/05 15:33:13 msaitoh Exp $"); |
61 | | | 61 | |
62 | #include <sys/param.h> | | 62 | #include <sys/param.h> |
63 | #include <sys/systm.h> | | 63 | #include <sys/systm.h> |
64 | #include <sys/kernel.h> | | 64 | #include <sys/kernel.h> |
65 | #include <sys/device.h> | | 65 | #include <sys/device.h> |
66 | #include <sys/module.h> | | 66 | #include <sys/module.h> |
67 | #include <sys/kmem.h> | | 67 | #include <sys/kmem.h> |
68 | #include <sys/mutex.h> | | 68 | #include <sys/mutex.h> |
69 | #include <sys/bitops.h> | | 69 | #include <sys/bitops.h> |
70 | #include <sys/atomic.h> | | 70 | #include <sys/atomic.h> |
71 | #include <sys/mbuf.h> | | 71 | #include <sys/mbuf.h> |
72 | #include <sys/cprng.h> | | 72 | #include <sys/cprng.h> |
73 | #include <sys/cpu.h> | | 73 | #include <sys/cpu.h> |
| @@ -1017,27 +1017,27 @@ qat_etr_setup_ring(struct qat_softc *sc, | | | @@ -1017,27 +1017,27 @@ qat_etr_setup_ring(struct qat_softc *sc, |
1017 | | | 1017 | |
1018 | KASSERT(bank < sc->sc_hw.qhw_num_banks); | | 1018 | KASSERT(bank < sc->sc_hw.qhw_num_banks); |
1019 | | | 1019 | |
1020 | /* Allocate a ring from specified bank */ | | 1020 | /* Allocate a ring from specified bank */ |
1021 | qb = &sc->sc_etr_banks[bank]; | | 1021 | qb = &sc->sc_etr_banks[bank]; |
1022 | | | 1022 | |
1023 | if (ring >= sc->sc_hw.qhw_num_rings_per_bank) | | 1023 | if (ring >= sc->sc_hw.qhw_num_rings_per_bank) |
1024 | return EINVAL; | | 1024 | return EINVAL; |
1025 | if (qb->qb_allocated_rings & (1 << ring)) | | 1025 | if (qb->qb_allocated_rings & (1 << ring)) |
1026 | return ENOENT; | | 1026 | return ENOENT; |
1027 | qr = &qb->qb_et_rings[ring]; | | 1027 | qr = &qb->qb_et_rings[ring]; |
1028 | qb->qb_allocated_rings |= 1 << ring; | | 1028 | qb->qb_allocated_rings |= 1 << ring; |
1029 | | | 1029 | |
1030 | /* Intialize allocated ring */ | | 1030 | /* Initialize allocated ring */ |
1031 | qr->qr_ring = ring; | | 1031 | qr->qr_ring = ring; |
1032 | qr->qr_bank = bank; | | 1032 | qr->qr_bank = bank; |
1033 | qr->qr_name = name; | | 1033 | qr->qr_name = name; |
1034 | qr->qr_ring_id = qr->qr_bank * sc->sc_hw.qhw_num_rings_per_bank + ring; | | 1034 | qr->qr_ring_id = qr->qr_bank * sc->sc_hw.qhw_num_rings_per_bank + ring; |
1035 | qr->qr_ring_mask = (1 << ring); | | 1035 | qr->qr_ring_mask = (1 << ring); |
1036 | qr->qr_cb = cb; | | 1036 | qr->qr_cb = cb; |
1037 | qr->qr_cb_arg = cb_arg; | | 1037 | qr->qr_cb_arg = cb_arg; |
1038 | QAT_EVCNT_ATTACH(sc, &qr->qr_ev_rxintr, EVCNT_TYPE_INTR, | | 1038 | QAT_EVCNT_ATTACH(sc, &qr->qr_ev_rxintr, EVCNT_TYPE_INTR, |
1039 | qr->qr_ev_rxintr_name, "bank%d ring%d rxintr", bank, ring); | | 1039 | qr->qr_ev_rxintr_name, "bank%d ring%d rxintr", bank, ring); |
1040 | QAT_EVCNT_ATTACH(sc, &qr->qr_ev_rxmsg, EVCNT_TYPE_MISC, | | 1040 | QAT_EVCNT_ATTACH(sc, &qr->qr_ev_rxmsg, EVCNT_TYPE_MISC, |
1041 | qr->qr_ev_rxmsg_name, "bank%d ring%d rxmsg", bank, ring); | | 1041 | qr->qr_ev_rxmsg_name, "bank%d ring%d rxmsg", bank, ring); |
1042 | QAT_EVCNT_ATTACH(sc, &qr->qr_ev_txmsg, EVCNT_TYPE_MISC, | | 1042 | QAT_EVCNT_ATTACH(sc, &qr->qr_ev_txmsg, EVCNT_TYPE_MISC, |
1043 | qr->qr_ev_txmsg_name, "bank%d ring%d txmsg", bank, ring); | | 1043 | qr->qr_ev_txmsg_name, "bank%d ring%d txmsg", bank, ring); |