| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: dwc_eqos.c,v 1.4 2022/02/13 18:29:00 riastradh Exp $ */ | | 1 | /* $NetBSD: dwc_eqos.c,v 1.5 2022/02/13 18:29:15 riastradh Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2022 Jared McNeill <jmcneill@invisible.ca> | | 4 | * Copyright (c) 2022 Jared McNeill <jmcneill@invisible.ca> |
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. |
| @@ -23,27 +23,27 @@ | | | @@ -23,27 +23,27 @@ |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
26 | * SUCH DAMAGE. | | 26 | * SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | /* | | 29 | /* |
30 | * DesignWare Ethernet Quality-of-Service controller | | 30 | * DesignWare Ethernet Quality-of-Service controller |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | #include "opt_net_mpsafe.h" | | 33 | #include "opt_net_mpsafe.h" |
34 | | | 34 | |
35 | #include <sys/cdefs.h> | | 35 | #include <sys/cdefs.h> |
36 | __KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.4 2022/02/13 18:29:00 riastradh Exp $"); | | 36 | __KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.5 2022/02/13 18:29:15 riastradh Exp $"); |
37 | | | 37 | |
38 | #include <sys/param.h> | | 38 | #include <sys/param.h> |
39 | #include <sys/bus.h> | | 39 | #include <sys/bus.h> |
40 | #include <sys/device.h> | | 40 | #include <sys/device.h> |
41 | #include <sys/intr.h> | | 41 | #include <sys/intr.h> |
42 | #include <sys/systm.h> | | 42 | #include <sys/systm.h> |
43 | #include <sys/kernel.h> | | 43 | #include <sys/kernel.h> |
44 | #include <sys/mutex.h> | | 44 | #include <sys/mutex.h> |
45 | #include <sys/callout.h> | | 45 | #include <sys/callout.h> |
46 | #include <sys/cprng.h> | | 46 | #include <sys/cprng.h> |
47 | #include <sys/evcnt.h> | | 47 | #include <sys/evcnt.h> |
48 | | | 48 | |
49 | #include <sys/rndsource.h> | | 49 | #include <sys/rndsource.h> |
| @@ -291,27 +291,27 @@ eqos_setup_txbuf(struct eqos_softc *sc, | | | @@ -291,27 +291,27 @@ eqos_setup_txbuf(struct eqos_softc *sc, |
291 | | | 291 | |
292 | segs = sc->sc_tx.buf_map[index].map->dm_segs; | | 292 | segs = sc->sc_tx.buf_map[index].map->dm_segs; |
293 | nsegs = sc->sc_tx.buf_map[index].map->dm_nsegs; | | 293 | nsegs = sc->sc_tx.buf_map[index].map->dm_nsegs; |
294 | | | 294 | |
295 | nospace = sc->sc_tx.queued >= TX_DESC_COUNT - nsegs; | | 295 | nospace = sc->sc_tx.queued >= TX_DESC_COUNT - nsegs; |
296 | if (nospace) { | | 296 | if (nospace) { |
297 | bus_dmamap_unload(sc->sc_dmat, | | 297 | bus_dmamap_unload(sc->sc_dmat, |
298 | sc->sc_tx.buf_map[index].map); | | 298 | sc->sc_tx.buf_map[index].map); |
299 | /* XXX coalesce and retry ? */ | | 299 | /* XXX coalesce and retry ? */ |
300 | return -1; | | 300 | return -1; |
301 | } | | 301 | } |
302 | | | 302 | |
303 | bus_dmamap_sync(sc->sc_dmat, sc->sc_tx.buf_map[index].map, | | 303 | bus_dmamap_sync(sc->sc_dmat, sc->sc_tx.buf_map[index].map, |
304 | 0, sc->sc_tx.buf_map[index].map->dm_mapsize, BUS_DMASYNC_PREWRITE); | | 304 | 0, sc->sc_tx.buf_map[index].map->dm_mapsize, BUS_DMASYNC_PREWRITE); |
305 | | | 305 | |
306 | /* stored in same index as loaded map */ | | 306 | /* stored in same index as loaded map */ |
307 | sc->sc_tx.buf_map[index].mbuf = m; | | 307 | sc->sc_tx.buf_map[index].mbuf = m; |
308 | | | 308 | |
309 | flags = EQOS_TDES3_FD; | | 309 | flags = EQOS_TDES3_FD; |
310 | | | 310 | |
311 | for (cur = index, i = 0; i < nsegs; i++) { | | 311 | for (cur = index, i = 0; i < nsegs; i++) { |
312 | if (i == nsegs - 1) | | 312 | if (i == nsegs - 1) |
313 | flags |= EQOS_TDES3_LD; | | 313 | flags |= EQOS_TDES3_LD; |
314 | | | 314 | |
315 | eqos_setup_txdesc(sc, cur, flags, segs[i].ds_addr, | | 315 | eqos_setup_txdesc(sc, cur, flags, segs[i].ds_addr, |
316 | segs[i].ds_len, m->m_pkthdr.len); | | 316 | segs[i].ds_len, m->m_pkthdr.len); |
317 | flags &= ~EQOS_TDES3_FD; | | 317 | flags &= ~EQOS_TDES3_FD; |