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/usb | |
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/usb')
-rw-r--r-- | sys/dev/usb/if_bwfm_usb.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/sys/dev/usb/if_bwfm_usb.c b/sys/dev/usb/if_bwfm_usb.c index e2986e6a2df..e4e3061151b 100644 --- a/sys/dev/usb/if_bwfm_usb.c +++ b/sys/dev/usb/if_bwfm_usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bwfm_usb.c,v 1.8 2018/01/24 13:10:20 patrick Exp $ */ +/* $OpenBSD: if_bwfm_usb.c,v 1.9 2018/02/07 22:01:04 patrick Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation * Copyright (c) 2016,2017 Patrick Wildt <patrick@blueri.se> @@ -430,10 +430,9 @@ bwfm_usb_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status status) { struct bwfm_usb_rx_data *data = priv; struct bwfm_usb_softc *sc = data->sc; - struct bwfm_proto_bcdc_hdr *hdr; usbd_status error; - uint32_t len, off; struct mbuf *m; + uint32_t len; DPRINTFN(2, ("%s: %s status %s\n", DEVNAME(sc), __func__, usbd_errstr(status))); @@ -449,23 +448,13 @@ bwfm_usb_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status status) } usbd_get_xfer_status(xfer, NULL, NULL, &len, NULL); - hdr = (void *)data->buf; - if (len < sizeof(*hdr)) - goto resubmit; - len -= sizeof(*hdr); - off += sizeof(*hdr); - if (len < hdr->data_offset << 2) - goto resubmit; - len -= hdr->data_offset << 2; - off += hdr->data_offset << 2; - m = bwfm_usb_newbuf(); if (m == NULL) goto resubmit; - memcpy(mtod(m, char *), data->buf + off, len); + memcpy(mtod(m, char *), data->buf, len); m->m_len = m->m_pkthdr.len = len; - bwfm_rx(&sc->sc_sc, m); + sc->sc_sc.sc_proto_ops->proto_rx(&sc->sc_sc, m); resubmit: usbd_setup_xfer(data->xfer, sc->sc_rx_pipeh, data, data->buf, |