Deleted Added
full compact
52c52
< __FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_uath.c 243857 2012-12-04 09:32:43Z glebius $");
---
> __FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_uath.c 244503 2012-12-20 18:38:02Z hselasky $");
220c220
< .bufsize = UATH_MAX_CMDSZ,
---
> .bufsize = UATH_MAX_CMDSZ * UATH_CMD_LIST_COUNT,
222d221
< .ext_buffer = 1,
245c244
< .bufsize = UATH_MAX_TXBUFSZ,
---
> .bufsize = UATH_MAX_TXBUFSZ * UATH_TX_DATA_LIST_COUNT,
247d245
< .ext_buffer = 1,
261,264c259,260
< static int uath_alloc_cmd_list(struct uath_softc *, struct uath_cmd [],
< int, int);
< static void uath_free_cmd_list(struct uath_softc *, struct uath_cmd [],
< int);
---
> static int uath_alloc_cmd_list(struct uath_softc *, struct uath_cmd []);
> static void uath_free_cmd_list(struct uath_softc *, struct uath_cmd []);
368,369c364
< error = uath_alloc_cmd_list(sc, sc->sc_cmd, UATH_CMD_LIST_COUNT,
< UATH_MAX_CMDSZ);
---
> error = uath_alloc_cmd_list(sc, sc->sc_cmd);
383a379,383
> sc->sc_cmd_dma_buf =
> usbd_xfer_get_frame_buffer(sc->sc_xfer[UATH_INTR_TX], 0);
> sc->sc_tx_dma_buf =
> usbd_xfer_get_frame_buffer(sc->sc_xfer[UATH_BULK_TX], 0);
>
496c496
< fail1: uath_free_cmd_list(sc, sc->sc_cmd, UATH_CMD_LIST_COUNT);
---
> fail1: uath_free_cmd_list(sc, sc->sc_cmd);
527c527
< uath_free_cmd_list(sc, sc->sc_cmd, UATH_CMD_LIST_COUNT);
---
> uath_free_cmd_list(sc, sc->sc_cmd);
536c536
< uath_free_cmd_list(struct uath_softc *sc, struct uath_cmd cmds[], int ncmd)
---
> uath_free_cmd_list(struct uath_softc *sc, struct uath_cmd cmds[])
540,542c540,541
< for (i = 0; i < ncmd; i++)
< if (cmds[i].buf != NULL)
< free(cmds[i].buf, M_USBDEV);
---
> for (i = 0; i != UATH_CMD_LIST_COUNT; i++)
> cmds[i].buf = NULL;
546,547c545
< uath_alloc_cmd_list(struct uath_softc *sc, struct uath_cmd cmds[],
< int ncmd, int maxsz)
---
> uath_alloc_cmd_list(struct uath_softc *sc, struct uath_cmd cmds[])
549c547
< int i, error;
---
> int i;
556c554
< for (i = 0; i < ncmd; i++) {
---
> for (i = 0; i != UATH_CMD_LIST_COUNT; i++) {
561,567c559,560
< cmd->buf = malloc(maxsz, M_USBDEV, M_NOWAIT);
< if (cmd->buf == NULL) {
< device_printf(sc->sc_dev,
< "could not allocate xfer buffer\n");
< error = ENOMEM;
< goto fail;
< }
---
> cmd->buf = ((uint8_t *)sc->sc_cmd_dma_buf) +
> (i * UATH_MAX_CMDSZ);
572,574d564
<
< fail: uath_free_cmd_list(sc, cmds, ncmd);
< return (error);
945,948c935
< if (dp->buf != NULL) {
< free(dp->buf, M_USBDEV);
< dp->buf = NULL;
< }
---
> dp->buf = NULL;
959c946
< int ndata, int maxsz, int fillmbuf)
---
> int ndata, int maxsz, void *dma_buf)
967c954
< if (fillmbuf) {
---
> if (dma_buf == NULL) {
979,985c966
< dp->buf = malloc(maxsz, M_USBDEV, M_NOWAIT);
< if (dp->buf == NULL) {
< device_printf(sc->sc_dev,
< "could not allocate buffer\n");
< error = ENOMEM;
< goto fail;
< }
---
> dp->buf = ((uint8_t *)dma_buf) + (i * maxsz);
992c973
< fail: uath_free_data_list(sc, data, ndata, fillmbuf);
---
> fail: uath_free_data_list(sc, data, ndata, 1 /* free mbufs */);
1004c985
< 1 /* setup mbufs */);
---
> NULL /* setup mbufs */);
1027c1008
< 0 /* no mbufs */);
---
> sc->sc_tx_dma_buf);
2744,2745c2725
< usbd_xfer_set_frame_data(xfer, 0, data->buf,
< usbd_xfer_max_len(xfer));
---
> usbd_xfer_set_frame_data(xfer, 0, data->buf, MCLBYTES);
2893c2873
< { 0, 0 }
---
> DEVMETHOD_END