rt2800usb: read TX_STA_FIFO asynchronously
Trying to fix the "TX status report missed" warnings by reading the TX_STA_FIFO entries as quickly as possible. The TX_STA_FIFO is too small in hardware, thus reading it only from the workqueue is too slow and entries get lost. Start an asynchronous read of the TX_STA_FIFO directly from the TX URB completion callback (atomic context, thus it cannot use the blocking rt2800_register_read()). If the async read returns a valid FIFO entry, it is pushed into a larger FIFO inside struct rt2x00_dev, until rt2800_txdone() picks it up. A .tx_dma_done callback is added to struct rt2x00lib_ops to trigger the async read from the URB completion callback. Signed-off-by: Johannes Stezenbach <js@sig21.net> Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
committed by
John W. Linville
parent
8da3efbb4a
commit
0e0d39e5f3
@ -165,6 +165,56 @@ int rt2x00usb_regbusy_read(struct rt2x00_dev *rt2x00dev,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rt2x00usb_regbusy_read);
|
||||
|
||||
|
||||
struct rt2x00_async_read_data {
|
||||
__le32 reg;
|
||||
struct usb_ctrlrequest cr;
|
||||
struct rt2x00_dev *rt2x00dev;
|
||||
void (*callback)(struct rt2x00_dev *,int,u32);
|
||||
};
|
||||
|
||||
static void rt2x00usb_register_read_async_cb(struct urb *urb)
|
||||
{
|
||||
struct rt2x00_async_read_data *rd = urb->context;
|
||||
rd->callback(rd->rt2x00dev, urb->status, le32_to_cpu(rd->reg));
|
||||
kfree(urb->context);
|
||||
}
|
||||
|
||||
void rt2x00usb_register_read_async(struct rt2x00_dev *rt2x00dev,
|
||||
const unsigned int offset,
|
||||
void (*callback)(struct rt2x00_dev*,int,u32))
|
||||
{
|
||||
struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev);
|
||||
struct urb *urb;
|
||||
struct rt2x00_async_read_data *rd;
|
||||
|
||||
rd = kmalloc(sizeof(*rd), GFP_ATOMIC);
|
||||
if (!rd)
|
||||
return;
|
||||
|
||||
urb = usb_alloc_urb(0, GFP_ATOMIC);
|
||||
if (!urb) {
|
||||
kfree(rd);
|
||||
return;
|
||||
}
|
||||
|
||||
rd->rt2x00dev = rt2x00dev;
|
||||
rd->callback = callback;
|
||||
rd->cr.bRequestType = USB_VENDOR_REQUEST_IN;
|
||||
rd->cr.bRequest = USB_MULTI_READ;
|
||||
rd->cr.wValue = 0;
|
||||
rd->cr.wIndex = cpu_to_le16(offset);
|
||||
rd->cr.wLength = cpu_to_le16(sizeof(u32));
|
||||
|
||||
usb_fill_control_urb(urb, usb_dev, usb_rcvctrlpipe(usb_dev, 0),
|
||||
(unsigned char *)(&rd->cr), &rd->reg, sizeof(rd->reg),
|
||||
rt2x00usb_register_read_async_cb, rd);
|
||||
if (usb_submit_urb(urb, GFP_ATOMIC) < 0)
|
||||
kfree(rd);
|
||||
usb_free_urb(urb);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rt2x00usb_register_read_async);
|
||||
|
||||
/*
|
||||
* TX data handlers.
|
||||
*/
|
||||
@ -212,6 +262,9 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb)
|
||||
if (!test_and_clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags))
|
||||
return;
|
||||
|
||||
if (rt2x00dev->ops->lib->tx_dma_done)
|
||||
rt2x00dev->ops->lib->tx_dma_done(entry);
|
||||
|
||||
/*
|
||||
* Report the frame as DMA done
|
||||
*/
|
||||
|
Reference in New Issue
Block a user