Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 246956
b: refs/heads/master
c: 10e1156
h: refs/heads/master
v: v3
  • Loading branch information
Helmut Schaa authored and John W. Linville committed Apr 19, 2011
1 parent ce5d2e4 commit 104f2d2
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7dab73b37f5e8885cb73efd25e73861f9b4f0246
refs/heads/master: 10e11568ca8b8a15f7478f6a4ceebabcbdba1018
28 changes: 19 additions & 9 deletions trunk/drivers/net/wireless/rt2x00/rt2x00queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -650,10 +650,12 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
return ret;
}

void rt2x00queue_for_each_entry(struct data_queue *queue,
bool rt2x00queue_for_each_entry(struct data_queue *queue,
enum queue_index start,
enum queue_index end,
void (*fn)(struct queue_entry *entry))
void *data,
bool (*fn)(struct queue_entry *entry,
void *data))
{
unsigned long irqflags;
unsigned int index_start;
Expand All @@ -664,7 +666,7 @@ void rt2x00queue_for_each_entry(struct data_queue *queue,
ERROR(queue->rt2x00dev,
"Entry requested from invalid index range (%d - %d)\n",
start, end);
return;
return true;
}

/*
Expand All @@ -683,15 +685,23 @@ void rt2x00queue_for_each_entry(struct data_queue *queue,
* send out all frames in the correct order.
*/
if (index_start < index_end) {
for (i = index_start; i < index_end; i++)
fn(&queue->entries[i]);
for (i = index_start; i < index_end; i++) {
if (fn(&queue->entries[i], data))
return true;
}
} else {
for (i = index_start; i < queue->limit; i++)
fn(&queue->entries[i]);
for (i = index_start; i < queue->limit; i++) {
if (fn(&queue->entries[i], data))
return true;
}

for (i = 0; i < index_end; i++)
fn(&queue->entries[i]);
for (i = 0; i < index_end; i++) {
if (fn(&queue->entries[i], data))
return true;
}
}

return false;
}
EXPORT_SYMBOL_GPL(rt2x00queue_for_each_entry);

Expand Down
10 changes: 8 additions & 2 deletions trunk/drivers/net/wireless/rt2x00/rt2x00queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -580,16 +580,22 @@ struct data_queue_desc {
* @queue: Pointer to @data_queue
* @start: &enum queue_index Pointer to start index
* @end: &enum queue_index Pointer to end index
* @data: Data to pass to the callback function
* @fn: The function to call for each &struct queue_entry
*
* This will walk through all entries in the queue, in chronological
* order. This means it will start at the current @start pointer
* and will walk through the queue until it reaches the @end pointer.
*
* If fn returns true for an entry rt2x00queue_for_each_entry will stop
* processing and return true as well.
*/
void rt2x00queue_for_each_entry(struct data_queue *queue,
bool rt2x00queue_for_each_entry(struct data_queue *queue,
enum queue_index start,
enum queue_index end,
void (*fn)(struct queue_entry *entry));
void *data,
bool (*fn)(struct queue_entry *entry,
void *data));

/**
* rt2x00queue_empty - Check if the queue is empty.
Expand Down
32 changes: 22 additions & 10 deletions trunk/drivers/net/wireless/rt2x00/rt2x00usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb)
queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work);
}

static void rt2x00usb_kick_tx_entry(struct queue_entry *entry)
static bool rt2x00usb_kick_tx_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);
Expand All @@ -240,7 +240,7 @@ static void rt2x00usb_kick_tx_entry(struct queue_entry *entry)

if (!test_and_clear_bit(ENTRY_DATA_PENDING, &entry->flags) ||
test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags))
return;
return true;

/*
* USB devices cannot blindly pass the skb->len as the
Expand All @@ -261,6 +261,8 @@ static void rt2x00usb_kick_tx_entry(struct queue_entry *entry)
set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);
rt2x00lib_dmadone(entry);
}

return false;
}

/*
Expand Down Expand Up @@ -323,7 +325,7 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
queue_work(rt2x00dev->workqueue, &rt2x00dev->rxdone_work);
}

static void rt2x00usb_kick_rx_entry(struct queue_entry *entry)
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);
Expand All @@ -332,7 +334,7 @@ static void rt2x00usb_kick_rx_entry(struct queue_entry *entry)

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

rt2x00lib_dmastart(entry);

Expand All @@ -348,6 +350,8 @@ static void rt2x00usb_kick_rx_entry(struct queue_entry *entry)
set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);
rt2x00lib_dmadone(entry);
}

return false;
}

void rt2x00usb_kick_queue(struct data_queue *queue)
Expand All @@ -358,12 +362,18 @@ void rt2x00usb_kick_queue(struct data_queue *queue)
case QID_AC_BE:
case QID_AC_BK:
if (!rt2x00queue_empty(queue))
rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX,
rt2x00queue_for_each_entry(queue,
Q_INDEX_DONE,
Q_INDEX,
NULL,
rt2x00usb_kick_tx_entry);
break;
case QID_RX:
if (!rt2x00queue_full(queue))
rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX,
rt2x00queue_for_each_entry(queue,
Q_INDEX_DONE,
Q_INDEX,
NULL,
rt2x00usb_kick_rx_entry);
break;
default:
Expand All @@ -372,14 +382,14 @@ void rt2x00usb_kick_queue(struct data_queue *queue)
}
EXPORT_SYMBOL_GPL(rt2x00usb_kick_queue);

static void rt2x00usb_flush_entry(struct queue_entry *entry)
static bool rt2x00usb_flush_entry(struct queue_entry *entry, void* data)
{
struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
struct queue_entry_priv_usb *entry_priv = entry->priv_data;
struct queue_entry_priv_usb_bcn *bcn_priv = entry->priv_data;

if (!test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags))
return;
return true;

usb_kill_urb(entry_priv->urb);

Expand All @@ -389,14 +399,16 @@ static void rt2x00usb_flush_entry(struct queue_entry *entry)
if ((entry->queue->qid == QID_BEACON) &&
(test_bit(REQUIRE_BEACON_GUARD, &rt2x00dev->cap_flags)))
usb_kill_urb(bcn_priv->guardian_urb);

return false;
}

void rt2x00usb_flush_queue(struct data_queue *queue)
{
struct work_struct *completion;
unsigned int i;

rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX,
rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX, NULL,
rt2x00usb_flush_entry);

/*
Expand Down Expand Up @@ -489,7 +501,7 @@ void rt2x00usb_clear_entry(struct queue_entry *entry)
entry->flags = 0;

if (entry->queue->qid == QID_RX)
rt2x00usb_kick_rx_entry(entry);
rt2x00usb_kick_rx_entry(entry, NULL);
}
EXPORT_SYMBOL_GPL(rt2x00usb_clear_entry);

Expand Down

0 comments on commit 104f2d2

Please sign in to comment.