diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2018-02-07 22:01:05 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2018-02-07 22:01:05 +0000 |
commit | 9890183b900bc8e6fbc45993e49c56ddd5a8e812 (patch) | |
tree | 4a3e182655db6596ec60509616274ee32363f129 /sys/dev/ic/bwfm.c | |
parent | 98e4a566238dac963559c324f3835ed48dc1400a (diff) |
Move parsing the BCDC header on RX into a protocol specific RX
function so it can be shared with the SDIO attachment driver.
Diffstat (limited to 'sys/dev/ic/bwfm.c')
-rw-r--r-- | sys/dev/ic/bwfm.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/sys/dev/ic/bwfm.c b/sys/dev/ic/bwfm.c index 8a52b3aa90d..eaf1aece02e 100644 --- a/sys/dev/ic/bwfm.c +++ b/sys/dev/ic/bwfm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwfm.c,v 1.37 2018/02/07 21:36:34 patrick Exp $ */ +/* $OpenBSD: bwfm.c,v 1.38 2018/02/07 22:01:04 patrick Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation * Copyright (c) 2016,2017 Patrick Wildt <patrick@blueri.se> @@ -89,6 +89,7 @@ int bwfm_proto_bcdc_query_dcmd(struct bwfm_softc *, int, int, char *, size_t *); int bwfm_proto_bcdc_set_dcmd(struct bwfm_softc *, int, int, char *, size_t); +void bwfm_proto_bcdc_rx(struct bwfm_softc *, struct mbuf *); int bwfm_fwvar_cmd_get_data(struct bwfm_softc *, int, void *, size_t); int bwfm_fwvar_cmd_set_data(struct bwfm_softc *, int, void *, size_t); @@ -153,6 +154,7 @@ uint8_t bwfm_5ghz_channels[] = { struct bwfm_proto_ops bwfm_proto_bcdc_ops = { .proto_query_dcmd = bwfm_proto_bcdc_query_dcmd, .proto_set_dcmd = bwfm_proto_bcdc_set_dcmd, + .proto_rx = bwfm_proto_bcdc_rx, }; struct cfdriver bwfm_cd = { @@ -1331,6 +1333,24 @@ err: return ret; } +void +bwfm_proto_bcdc_rx(struct bwfm_softc *sc, struct mbuf *m) +{ + struct bwfm_proto_bcdc_hdr *hdr; + + hdr = mtod(m, struct bwfm_proto_bcdc_hdr *); + if (m->m_len < sizeof(*hdr)) { + m_freem(m); + return; + } + if (m->m_len < sizeof(*hdr) + (hdr->data_offset << 2)) { + m_freem(m); + return; + } + m_adj(m, sizeof(*hdr) + (hdr->data_offset << 2)); + bwfm_rx(sc, m); +} + /* FW Variable code */ int bwfm_fwvar_cmd_get_data(struct bwfm_softc *sc, int cmd, void *data, size_t len) |