| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: bwi.c,v 1.18 2011/10/10 11:15:24 njoly Exp $ */ | | 1 | /* $NetBSD: bwi.c,v 1.18.12.1 2017/08/19 03:15:53 snj Exp $ */ |
2 | /* $OpenBSD: bwi.c,v 1.74 2008/02/25 21:13:30 mglocker Exp $ */ | | 2 | /* $OpenBSD: bwi.c,v 1.74 2008/02/25 21:13:30 mglocker Exp $ */ |
3 | | | 3 | |
4 | /* | | 4 | /* |
5 | * Copyright (c) 2007 The DragonFly Project. All rights reserved. | | 5 | * Copyright (c) 2007 The DragonFly Project. All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The DragonFly Project | | 7 | * This code is derived from software contributed to The DragonFly Project |
8 | * by Sepherosa Ziehau <sepherosa@gmail.com> | | 8 | * by Sepherosa Ziehau <sepherosa@gmail.com> |
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 | * | | 13 | * |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -38,27 +38,27 @@ | | | @@ -38,27 +38,27 @@ |
38 | */ | | 38 | */ |
39 | | | 39 | |
40 | /* | | 40 | /* |
41 | * Broadcom AirForce BCM43xx IEEE 802.11b/g wireless network driver | | 41 | * Broadcom AirForce BCM43xx IEEE 802.11b/g wireless network driver |
42 | * Generic back end | | 42 | * Generic back end |
43 | */ | | 43 | */ |
44 | | | 44 | |
45 | /* [TRC: XXX Names beginning with `bwi_ieee80211_*' are those that I | | 45 | /* [TRC: XXX Names beginning with `bwi_ieee80211_*' are those that I |
46 | think should be in NetBSD's generic 802.11 code, not in this | | 46 | think should be in NetBSD's generic 802.11 code, not in this |
47 | driver.] */ | | 47 | driver.] */ |
48 | | | 48 | |
49 | | | 49 | |
50 | #include <sys/cdefs.h> | | 50 | #include <sys/cdefs.h> |
51 | __KERNEL_RCSID(0, "$NetBSD: bwi.c,v 1.18 2011/10/10 11:15:24 njoly Exp $"); | | 51 | __KERNEL_RCSID(0, "$NetBSD: bwi.c,v 1.18.12.1 2017/08/19 03:15:53 snj Exp $"); |
52 | | | 52 | |
53 | #include <sys/param.h> | | 53 | #include <sys/param.h> |
54 | #include <sys/callout.h> | | 54 | #include <sys/callout.h> |
55 | #include <sys/device.h> | | 55 | #include <sys/device.h> |
56 | #include <sys/kernel.h> | | 56 | #include <sys/kernel.h> |
57 | #include <sys/malloc.h> | | 57 | #include <sys/malloc.h> |
58 | #include <sys/mbuf.h> | | 58 | #include <sys/mbuf.h> |
59 | #include <sys/socket.h> | | 59 | #include <sys/socket.h> |
60 | #include <sys/sockio.h> | | 60 | #include <sys/sockio.h> |
61 | #include <sys/sysctl.h> | | 61 | #include <sys/sysctl.h> |
62 | #include <sys/systm.h> | | 62 | #include <sys/systm.h> |
63 | #include <sys/bus.h> | | 63 | #include <sys/bus.h> |
64 | | | 64 | |
| @@ -8305,27 +8305,27 @@ bwi_newbuf(struct bwi_softc *sc, int buf | | | @@ -8305,27 +8305,27 @@ bwi_newbuf(struct bwi_softc *sc, int buf |
8305 | struct bwi_rxbuf *rxbuf = &rbd->rbd_buf[buf_idx]; | | 8305 | struct bwi_rxbuf *rxbuf = &rbd->rbd_buf[buf_idx]; |
8306 | struct bwi_rxbuf_hdr *hdr; | | 8306 | struct bwi_rxbuf_hdr *hdr; |
8307 | bus_dmamap_t map; | | 8307 | bus_dmamap_t map; |
8308 | bus_addr_t paddr; | | 8308 | bus_addr_t paddr; |
8309 | struct mbuf *m; | | 8309 | struct mbuf *m; |
8310 | int error; | | 8310 | int error; |
8311 | | | 8311 | |
8312 | KASSERT(buf_idx < BWI_RX_NDESC); | | 8312 | KASSERT(buf_idx < BWI_RX_NDESC); |
8313 | | | 8313 | |
8314 | MGETHDR(m, init ? M_WAITOK : M_DONTWAIT, MT_DATA); | | 8314 | MGETHDR(m, init ? M_WAITOK : M_DONTWAIT, MT_DATA); |
8315 | if (m == NULL) | | 8315 | if (m == NULL) |
8316 | return (ENOBUFS); | | 8316 | return (ENOBUFS); |
8317 | MCLGET(m, init ? M_WAITOK : M_DONTWAIT); | | 8317 | MCLGET(m, init ? M_WAITOK : M_DONTWAIT); |
8318 | if (m == NULL) { | | 8318 | if ((m->m_flags & M_EXT) == 0) { |
8319 | error = ENOBUFS; | | 8319 | error = ENOBUFS; |
8320 | | | 8320 | |
8321 | /* | | 8321 | /* |
8322 | * If the NIC is up and running, we need to: | | 8322 | * If the NIC is up and running, we need to: |
8323 | * - Clear RX buffer's header. | | 8323 | * - Clear RX buffer's header. |
8324 | * - Restore RX descriptor settings. | | 8324 | * - Restore RX descriptor settings. |
8325 | */ | | 8325 | */ |
8326 | if (init) | | 8326 | if (init) |
8327 | return error; | | 8327 | return error; |
8328 | else | | 8328 | else |
8329 | goto back; | | 8329 | goto back; |
8330 | } | | 8330 | } |
8331 | m->m_len = m->m_pkthdr.len = MCLBYTES; | | 8331 | m->m_len = m->m_pkthdr.len = MCLBYTES; |