Deleted Added
full compact
18c18
< __FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_urtw.c 243857 2012-12-04 09:32:43Z glebius $");
---
> __FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_urtw.c 244503 2012-12-20 18:38:02Z hselasky $");
535c535
< .bufsize = MCLBYTES,
---
> .bufsize = sizeof(uint64_t),
537d536
< .ext_buffer = 1,
547c546
< .bufsize = URTW_TX_MAXSIZE,
---
> .bufsize = URTW_TX_MAXSIZE * URTW_TX_DATA_LIST_COUNT,
549d547
< .ext_buffer = 1,
627c625
< .bufsize = URTW_TX_MAXSIZE,
---
> .bufsize = URTW_TX_MAXSIZE * URTW_TX_DATA_LIST_COUNT,
629d626
< .ext_buffer = 1,
829a827,836
> if (sc->sc_flags & URTW_RTL8187B) {
> sc->sc_tx_dma_buf =
> usbd_xfer_get_frame_buffer(sc->sc_xfer[
> URTW_8187B_BULK_TX_BE], 0);
> } else {
> sc->sc_tx_dma_buf =
> usbd_xfer_get_frame_buffer(sc->sc_xfer[
> URTW_8187L_BULK_TX_LOW], 0);
> }
>
939a947,948
> ieee80211_ifdetach(ic);
>
942d950
< ieee80211_ifdetach(ic);
983,986c991
< if (dp->buf != NULL) {
< free(dp->buf, M_USBDEV);
< dp->buf = NULL;
< }
---
> dp->buf = NULL;
1452c1457
< int ndata, int maxsz, int fillmbuf)
---
> int ndata, int maxsz, void *dma_buf)
1460c1465
< if (fillmbuf) {
---
> if (dma_buf == NULL) {
1471,1480c1476,1477
< 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;
< }
< if (((unsigned long)dp->buf) % 4)
< device_printf(sc->sc_dev,
< "warn: unaligned buffer %p\n", dp->buf);
---
> dp->buf = ((uint8_t *)dma_buf) +
> (i * maxsz);
1483a1481
> return (0);
1485,1488c1483,1484
< return 0;
<
< fail: urtw_free_data_list(sc, data, ndata, fillmbuf);
< return error;
---
> fail: urtw_free_data_list(sc, data, ndata, 1);
> return (error);
1497c1493,1494
< sc->sc_rx, URTW_RX_DATA_LIST_COUNT, MCLBYTES, 1 /* mbufs */);
---
> sc->sc_rx, URTW_RX_DATA_LIST_COUNT,
> MCLBYTES, NULL /* mbufs */);
1517c1514
< 0 /* no mbufs */);
---
> sc->sc_tx_dma_buf /* no mbufs */);
2712d2708
< /* XXX why we should allocalte memory buffer instead of using memory stack? */
2717c2713
< uint8_t *buf;
---
> uint8_t buf[2];
2719c2715
< struct usb_device_request *req;
---
> struct usb_device_request req;
2723,2733d2718
< req = (usb_device_request_t *)malloc(sizeof(usb_device_request_t),
< M_80211_VAP, M_NOWAIT | M_ZERO);
< if (req == NULL) {
< device_printf(sc->sc_dev, "could not allocate a memory\n");
< goto fail0;
< }
< buf = (uint8_t *)malloc(2, M_80211_VAP, M_NOWAIT | M_ZERO);
< if (req == NULL) {
< device_printf(sc->sc_dev, "could not allocate a memory\n");
< goto fail1;
< }
2735,2739c2720,2724
< req->bmRequestType = UT_WRITE_VENDOR_DEVICE;
< req->bRequest = URTW_8187_SETREGS_REQ;
< USETW(req->wValue, addr);
< USETW(req->wIndex, index);
< USETW(req->wLength, sizeof(uint16_t));
---
> req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
> req.bRequest = URTW_8187_SETREGS_REQ;
> USETW(req.wValue, addr);
> USETW(req.wIndex, index);
> USETW(req.wLength, sizeof(uint16_t));
2743c2728
< error = urtw_do_request(sc, req, buf);
---
> error = urtw_do_request(sc, &req, buf);
2745,2747c2730
< free(buf, M_80211_VAP);
< fail1: free(req, M_80211_VAP);
< fail0: return (error);
---
> return (error);
4135a4119
> void *dma_buf = usbd_xfer_get_frame_buffer(xfer, 0);
4145,4146c4129
< usbd_xfer_set_frame_data(xfer, 0, &sc->sc_txstatus,
< sizeof(int64_t));
---
> memcpy(dma_buf, &sc->sc_txstatus, sizeof(uint64_t));
4434c4417
< { 0, 0 }
---
> DEVMETHOD_END