Esempio n. 1
0
static bool rt2x00usb_kick_rx_entry(struct queue_entry *entry, void *data)
{
    struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
    struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev);
    struct queue_entry_priv_usb *entry_priv = entry->priv_data;
    int status;

    if (test_and_set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) ||
            test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags))
        return false;

    rt2x00lib_dmastart(entry);

    usb_fill_bulk_urb(entry_priv->urb, usb_dev,
                      usb_rcvbulkpipe(usb_dev, entry->queue->usb_endpoint),
                      entry->skb->data, entry->skb->len,
                      rt2x00usb_interrupt_rxdone, entry);

    status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC);
    if (status) {
        if (status == -ENODEV)
            clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
        set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);
        rt2x00lib_dmadone(entry);
    }

    return false;
}
Esempio n. 2
0
bool rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
{
	struct data_queue *queue = rt2x00dev->rx;
	struct queue_entry *entry;
	struct queue_entry_priv_pci *entry_priv;
	struct skb_frame_desc *skbdesc;
	int max_rx = 16;

	while (--max_rx) {
		entry = rt2x00queue_get_entry(queue, Q_INDEX);
		entry_priv = entry->priv_data;

		if (rt2x00dev->ops->lib->get_entry_state(entry))
			break;

		/*
		 * Fill in desc fields of the skb descriptor
		 */
		skbdesc = get_skb_frame_desc(entry->skb);
		skbdesc->desc = entry_priv->desc;
		skbdesc->desc_len = entry->queue->desc_size;

		/*
		 * DMA is already done, notify rt2x00lib that
		 * it finished successfully.
		 */
		rt2x00lib_dmastart(entry);
		rt2x00lib_dmadone(entry);

		/*
		 * Send the frame to rt2x00lib for further processing.
		 */
		rt2x00lib_rxdone(entry);
	}

	return !max_rx;
}