From 1950c5c53d6b36753f10b6ff6b161a4f412a5b50 Mon Sep 17 00:00:00 2001 From: patrick Date: Fri, 26 Feb 2021 00:19:41 +0000 Subject: [PATCH] Increase the buffer size for the ioctl response buffers to the same as used in the wifi firmware to ensure responses can be received. --- sys/dev/pci/if_bwfm_pci.c | 12 ++++++------ sys/dev/pci/if_bwfm_pci.h | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sys/dev/pci/if_bwfm_pci.c b/sys/dev/pci/if_bwfm_pci.c index a05ffa9741d..258e0d14f2d 100644 --- a/sys/dev/pci/if_bwfm_pci.c +++ b/sys/dev/pci/if_bwfm_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bwfm_pci.c,v 1.46 2021/02/26 00:14:28 patrick Exp $ */ +/* $OpenBSD: if_bwfm_pci.c,v 1.47 2021/02/26 00:19:41 patrick Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation * Copyright (c) 2017 Patrick Wildt @@ -651,8 +651,8 @@ bwfm_pci_preinit(struct bwfm_softc *bwfm) sc->sc_rx_pkts.pkts = malloc(BWFM_NUM_RX_PKTIDS * sizeof(struct bwfm_pci_buf), M_DEVBUF, M_WAITOK | M_ZERO); for (i = 0; i < BWFM_NUM_RX_PKTIDS; i++) - bus_dmamap_create(sc->sc_dmat, MSGBUF_MAX_PKT_SIZE, - BWFM_NUM_RX_DESCS, MSGBUF_MAX_PKT_SIZE, 0, BUS_DMA_WAITOK, + bus_dmamap_create(sc->sc_dmat, MSGBUF_MAX_CTL_PKT_SIZE, + BWFM_NUM_RX_DESCS, MSGBUF_MAX_CTL_PKT_SIZE, 0, BUS_DMA_WAITOK, &sc->sc_rx_pkts.pkts[i].bb_map); /* Maps TX mbufs to a packet id and back. */ @@ -953,12 +953,12 @@ bwfm_pci_fill_rx_ioctl_ring(struct bwfm_pci_softc *sc, struct if_rxring *rxring, req = bwfm_pci_ring_write_reserve(sc, &sc->sc_ctrl_submit); if (req == NULL) break; - m = MCLGETL(NULL, M_DONTWAIT, MSGBUF_MAX_PKT_SIZE); + m = MCLGETL(NULL, M_DONTWAIT, MSGBUF_MAX_CTL_PKT_SIZE); if (m == NULL) { bwfm_pci_ring_write_cancel(sc, &sc->sc_ctrl_submit, 1); break; } - m->m_len = m->m_pkthdr.len = MSGBUF_MAX_PKT_SIZE; + m->m_len = m->m_pkthdr.len = MSGBUF_MAX_CTL_PKT_SIZE; if (bwfm_pci_pktid_new(sc, &sc->sc_rx_pkts, m, &pktid, &paddr)) { bwfm_pci_ring_write_cancel(sc, &sc->sc_ctrl_submit, 1); m_freem(m); @@ -967,7 +967,7 @@ bwfm_pci_fill_rx_ioctl_ring(struct bwfm_pci_softc *sc, struct if_rxring *rxring, memset(req, 0, sizeof(*req)); req->msg.msgtype = msgtype; req->msg.request_id = htole32(pktid); - req->host_buf_len = htole16(MSGBUF_MAX_PKT_SIZE); + req->host_buf_len = htole16(MSGBUF_MAX_CTL_PKT_SIZE); req->host_buf_addr.high_addr = htole32((uint64_t)paddr >> 32); req->host_buf_addr.low_addr = htole32(paddr & 0xffffffff); bwfm_pci_ring_write_commit(sc, &sc->sc_ctrl_submit); diff --git a/sys/dev/pci/if_bwfm_pci.h b/sys/dev/pci/if_bwfm_pci.h index 92cf426e33d..0e42df6d910 100644 --- a/sys/dev/pci/if_bwfm_pci.h +++ b/sys/dev/pci/if_bwfm_pci.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bwfm_pci.h,v 1.4 2021/02/26 00:14:28 patrick Exp $ */ +/* $OpenBSD: if_bwfm_pci.h,v 1.5 2021/02/26 00:19:41 patrick Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation * Copyright (c) 2017 Patrick Wildt @@ -122,6 +122,7 @@ struct bwfm_pci_ringinfo { #define MSGBUF_IOCTL_RESP_TIMEOUT 2000 /* msecs */ #define MSGBUF_IOCTL_REQ_PKTID 0xFFFE #define MSGBUF_MAX_PKT_SIZE 2048 +#define MSGBUF_MAX_CTL_PKT_SIZE 8192 #define MSGBUF_TYPE_GEN_STATUS 0x1 #define MSGBUF_TYPE_RING_STATUS 0x2 -- 2.20.1