Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/sys/dev Pull up following revision(s) (requested by mrg i...
details: https://anonhg.NetBSD.org/src/rev/2f27ab506b08
branches: netbsd-9
changeset: 937395:2f27ab506b08
user: martin <martin%NetBSD.org@localhost>
date: Mon Aug 17 11:22:45 2020 +0000
description:
Pull up following revision(s) (requested by mrg in ticket #1052):
sys/dev/ic/bwfm.c: revision 1.28
sys/dev/ic/bwfm.c: revision 1.29
sys/dev/sdmmc/if_bwfm_sdio.c: revision 1.22
sys/dev/ic/bwfmreg.h: revision 1.7
sys/dev/ic/bwfmvar.h: revision 1.11
sys/dev/ic/bwfmvar.h: revision 1.12
(all via patch)
Add include guards and appropriate includes to bwfmreg.h, bwfmvar.h.
No functional change intended.
Need <sys/kmem.h> for kmem_*.
Currently accidentally side-loaded by <sys/pcq.h>.
bwfm: Switch from pcq to pool_cache.
pcq_get is required to be serialized, but it's far from clear that it
is serialized here.
diffstat:
sys/dev/ic/bwfm.c | 33 +++++++++++++++++----------------
sys/dev/ic/bwfmreg.h | 17 ++++++++++++++++-
sys/dev/ic/bwfmvar.h | 27 +++++++++++++++++++++++----
sys/dev/sdmmc/if_bwfm_sdio.c | 3 ++-
4 files changed, 58 insertions(+), 22 deletions(-)
diffs (235 lines):
diff -r 83034031e6f8 -r 2f27ab506b08 sys/dev/ic/bwfm.c
--- a/sys/dev/ic/bwfm.c Mon Aug 17 11:10:20 2020 +0000
+++ b/sys/dev/ic/bwfm.c Mon Aug 17 11:22:45 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfm.c,v 1.14.6.2 2020/08/09 14:03:08 martin Exp $ */
+/* $NetBSD: bwfm.c,v 1.14.6.3 2020/08/17 11:22:45 martin Exp $ */
/* $OpenBSD: bwfm.c,v 1.5 2017/10/16 22:27:16 patrick Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
@@ -24,7 +24,7 @@
#include <sys/device.h>
#include <sys/kernel.h>
#include <sys/kmem.h>
-#include <sys/pcq.h>
+#include <sys/pool.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/systm.h>
@@ -139,7 +139,6 @@
{
struct ieee80211com *ic = &sc->sc_ic;
struct ifnet *ifp = &sc->sc_if;
- struct bwfm_task *t;
char fw_version[BWFM_DCMD_SMLEN];
uint32_t bandlist[3];
uint32_t tmp;
@@ -151,12 +150,10 @@
printf("%s: could not create workqueue\n", DEVNAME(sc));
return;
}
- sc->sc_freetask = pcq_create(BWFM_TASK_COUNT, KM_SLEEP);
- for (i = 0; i < BWFM_TASK_COUNT; i++) {
- t = &sc->sc_task[i];
- t->t_sc = sc;
- pcq_put(sc->sc_freetask, t);
- }
+ sc->sc_freetask = pool_cache_init(sizeof(struct bwfm_task), 0, 0, 0,
+ "bwfmtask", NULL, IPL_NET /* XXX IPL_SOFTNET? */,
+ NULL, NULL, NULL);
+ pool_prime(&sc->sc_freetask->pc_pool, BWFM_TASK_COUNT);
/* Stop the device in case it was previously initialized */
bwfm_fwvar_cmd_set_int(sc, BWFM_C_DOWN, 1);
@@ -249,7 +246,7 @@
error = if_initialize(ifp);
if (error != 0) {
printf("%s: if_initialize failed(%d)\n", DEVNAME(sc), error);
- pcq_destroy(sc->sc_freetask);
+ pool_cache_destroy(sc->sc_freetask);
workqueue_destroy(sc->sc_taskq);
return; /* Error */
@@ -289,7 +286,7 @@
if (sc->sc_taskq)
workqueue_destroy(sc->sc_taskq);
if (sc->sc_freetask)
- pcq_destroy(sc->sc_freetask);
+ pool_cache_destroy(sc->sc_freetask);
return 0;
}
@@ -600,12 +597,13 @@
struct bwfm_softc *sc = ic->ic_ifp->if_softc;
struct bwfm_task *t;
- t = pcq_get(sc->sc_freetask);
+ t = pool_cache_get(sc->sc_freetask, PR_NOWAIT);
if (t == NULL) {
printf("%s: no free tasks\n", DEVNAME(sc));
return 0;
}
+ t->t_sc = sc;
t->t_cmd = BWFM_TASK_KEY_SET;
t->t_key.key = wk;
memcpy(t->t_key.mac, mac, sizeof(t->t_key.mac));
@@ -691,12 +689,13 @@
struct bwfm_softc *sc = ic->ic_ifp->if_softc;
struct bwfm_task *t;
- t = pcq_get(sc->sc_freetask);
+ t = pool_cache_get(sc->sc_freetask, PR_NOWAIT);
if (t == NULL) {
printf("%s: no free tasks\n", DEVNAME(sc));
return 0;
}
+ t->t_sc = sc;
t->t_cmd = BWFM_TASK_KEY_DELETE;
t->t_key.key = wk;
memset(t->t_key.mac, 0, sizeof(t->t_key.mac));
@@ -725,12 +724,13 @@
struct bwfm_softc *sc = ic->ic_ifp->if_softc;
struct bwfm_task *t;
- t = pcq_get(sc->sc_freetask);
+ t = pool_cache_get(sc->sc_freetask, PR_NOWAIT);
if (t == NULL) {
printf("%s: no free tasks\n", DEVNAME(sc));
return EIO;
}
+ t->t_sc = sc;
t->t_cmd = BWFM_TASK_NEWSTATE;
t->t_newstate.state = nstate;
t->t_newstate.arg = arg;
@@ -808,7 +808,7 @@
panic("bwfm: unknown task command %d", t->t_cmd);
}
- pcq_put(sc->sc_freetask, t);
+ pool_cache_put(sc->sc_freetask, t);
}
int
@@ -1906,13 +1906,14 @@
{
struct bwfm_task *t;
- t = pcq_get(sc->sc_freetask);
+ t = pool_cache_get(sc->sc_freetask, PR_NOWAIT);
if (t == NULL) {
m_freem(m);
printf("%s: no free tasks\n", DEVNAME(sc));
return;
}
+ t->t_sc = sc;
t->t_cmd = BWFM_TASK_RX_EVENT;
t->t_mbuf = m;
workqueue_enqueue(sc->sc_taskq, (struct work*)t, NULL);
diff -r 83034031e6f8 -r 2f27ab506b08 sys/dev/ic/bwfmreg.h
--- a/sys/dev/ic/bwfmreg.h Mon Aug 17 11:10:20 2020 +0000
+++ b/sys/dev/ic/bwfmreg.h Mon Aug 17 11:22:45 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfmreg.h,v 1.3.10.1 2020/02/25 18:40:43 martin Exp $ */
+/* $NetBSD: bwfmreg.h,v 1.3.10.2 2020/08/17 11:22:45 martin Exp $ */
/* $OpenBSD: bwfmreg.h,v 1.16 2018/02/07 21:44:09 patrick Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
@@ -17,6 +17,19 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#ifndef _DEV_IC_BWFMREG_H
+#define _DEV_IC_BWFMREG_H
+
+#include <sys/param.h>
+#include <sys/types.h>
+
+#include <sys/cdefs.h>
+
+#include <net/if.h>
+#include <net/if_ether.h>
+
+#include <net80211/ieee80211.h>
+
/* SDIO registers */
#define BWFM_SDIO_FUNC1_SBADDRLOW 0x1000A
#define BWFM_SDIO_FUNC1_SBADDRMID 0x1000B
@@ -785,3 +798,5 @@
struct bwfm_ethhdr hdr;
struct bwfm_event_msg msg;
} __packed;
+
+#endif /* _DEV_IC_BWFMREG_H */
diff -r 83034031e6f8 -r 2f27ab506b08 sys/dev/ic/bwfmvar.h
--- a/sys/dev/ic/bwfmvar.h Mon Aug 17 11:10:20 2020 +0000
+++ b/sys/dev/ic/bwfmvar.h Mon Aug 17 11:22:45 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfmvar.h,v 1.3.6.1 2020/02/25 18:40:43 martin Exp $ */
+/* $NetBSD: bwfmvar.h,v 1.3.6.2 2020/08/17 11:22:45 martin Exp $ */
/* $OpenBSD: bwfmvar.h,v 1.1 2017/10/11 17:19:50 patrick Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
@@ -17,7 +17,25 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/pcq.h>
+#ifndef _DEV_IC_BWFMVAR_H
+#define _DEV_IC_BWFMVAR_H
+
+#include <sys/types.h>
+
+#include <sys/cdefs.h>
+#include <sys/device_if.h>
+#include <sys/queue.h>
+#include <sys/workqueue.h>
+
+#include <net/if_ether.h>
+
+#include <net80211/ieee80211.h>
+#include <net80211/ieee80211_proto.h>
+#include <net80211/ieee80211_var.h>
+
+struct ieee80211_key;
+struct mbuf;
+struct pool_cache;
/* Chipcommon Core Chip IDs */
#define BRCM_CC_43143_CHIP_ID 43143
@@ -163,8 +181,7 @@
int sc_tx_timer;
bool sc_if_attached;
- struct bwfm_task sc_task[BWFM_TASK_COUNT];
- pcq_t *sc_freetask;
+ struct pool_cache *sc_freetask;
struct workqueue *sc_taskq;
int (*sc_newstate)(struct ieee80211com *,
@@ -187,3 +204,5 @@
struct bwfm_core *bwfm_chip_get_core(struct bwfm_softc *, int);
struct bwfm_core *bwfm_chip_get_pmu(struct bwfm_softc *);
void bwfm_rx(struct bwfm_softc *, struct mbuf *m);
+
+#endif /* _DEV_IC_BWFMVAR_H */
diff -r 83034031e6f8 -r 2f27ab506b08 sys/dev/sdmmc/if_bwfm_sdio.c
--- a/sys/dev/sdmmc/if_bwfm_sdio.c Mon Aug 17 11:10:20 2020 +0000
+++ b/sys/dev/sdmmc/if_bwfm_sdio.c Mon Aug 17 11:22:45 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bwfm_sdio.c,v 1.3.8.3 2020/08/09 14:03:07 martin Exp $ */
+/* $NetBSD: if_bwfm_sdio.c,v 1.3.8.4 2020/08/17 11:22:45 martin Exp $ */
/* $OpenBSD: if_bwfm_sdio.c,v 1.1 2017/10/11 17:19:50 patrick Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
@@ -27,6 +27,7 @@
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/mutex.h>
+#include <sys/kmem.h>
#include <net/bpf.h>
#include <net/if.h>
Home |
Main Index |
Thread Index |
Old Index