diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00queue.h')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00queue.h | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h index 5db6a99fce7..167d45873dc 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.h +++ b/drivers/net/wireless/rt2x00/rt2x00queue.h | |||
@@ -364,6 +364,7 @@ enum queue_entry_flags { | |||
364 | * struct queue_entry: Entry inside the &struct data_queue | 364 | * struct queue_entry: Entry inside the &struct data_queue |
365 | * | 365 | * |
366 | * @flags: Entry flags, see &enum queue_entry_flags. | 366 | * @flags: Entry flags, see &enum queue_entry_flags. |
367 | * @last_action: Timestamp of last change. | ||
367 | * @queue: The data queue (&struct data_queue) to which this entry belongs. | 368 | * @queue: The data queue (&struct data_queue) to which this entry belongs. |
368 | * @skb: The buffer which is currently being transmitted (for TX queue), | 369 | * @skb: The buffer which is currently being transmitted (for TX queue), |
369 | * or used to directly receive data in (for RX queue). | 370 | * or used to directly receive data in (for RX queue). |
@@ -373,6 +374,7 @@ enum queue_entry_flags { | |||
373 | */ | 374 | */ |
374 | struct queue_entry { | 375 | struct queue_entry { |
375 | unsigned long flags; | 376 | unsigned long flags; |
377 | unsigned long last_action; | ||
376 | 378 | ||
377 | struct data_queue *queue; | 379 | struct data_queue *queue; |
378 | 380 | ||
@@ -463,7 +465,6 @@ struct data_queue { | |||
463 | unsigned short threshold; | 465 | unsigned short threshold; |
464 | unsigned short length; | 466 | unsigned short length; |
465 | unsigned short index[Q_INDEX_MAX]; | 467 | unsigned short index[Q_INDEX_MAX]; |
466 | unsigned long last_action[Q_INDEX_MAX]; | ||
467 | 468 | ||
468 | unsigned short txop; | 469 | unsigned short txop; |
469 | unsigned short aifs; | 470 | unsigned short aifs; |
@@ -580,16 +581,22 @@ struct data_queue_desc { | |||
580 | * @queue: Pointer to @data_queue | 581 | * @queue: Pointer to @data_queue |
581 | * @start: &enum queue_index Pointer to start index | 582 | * @start: &enum queue_index Pointer to start index |
582 | * @end: &enum queue_index Pointer to end index | 583 | * @end: &enum queue_index Pointer to end index |
584 | * @data: Data to pass to the callback function | ||
583 | * @fn: The function to call for each &struct queue_entry | 585 | * @fn: The function to call for each &struct queue_entry |
584 | * | 586 | * |
585 | * This will walk through all entries in the queue, in chronological | 587 | * This will walk through all entries in the queue, in chronological |
586 | * order. This means it will start at the current @start pointer | 588 | * order. This means it will start at the current @start pointer |
587 | * and will walk through the queue until it reaches the @end pointer. | 589 | * and will walk through the queue until it reaches the @end pointer. |
590 | * | ||
591 | * If fn returns true for an entry rt2x00queue_for_each_entry will stop | ||
592 | * processing and return true as well. | ||
588 | */ | 593 | */ |
589 | void rt2x00queue_for_each_entry(struct data_queue *queue, | 594 | bool rt2x00queue_for_each_entry(struct data_queue *queue, |
590 | enum queue_index start, | 595 | enum queue_index start, |
591 | enum queue_index end, | 596 | enum queue_index end, |
592 | void (*fn)(struct queue_entry *entry)); | 597 | void *data, |
598 | bool (*fn)(struct queue_entry *entry, | ||
599 | void *data)); | ||
593 | 600 | ||
594 | /** | 601 | /** |
595 | * rt2x00queue_empty - Check if the queue is empty. | 602 | * rt2x00queue_empty - Check if the queue is empty. |
@@ -629,22 +636,24 @@ static inline int rt2x00queue_threshold(struct data_queue *queue) | |||
629 | 636 | ||
630 | /** | 637 | /** |
631 | * rt2x00queue_status_timeout - Check if a timeout occurred for STATUS reports | 638 | * rt2x00queue_status_timeout - Check if a timeout occurred for STATUS reports |
632 | * @queue: Queue to check. | 639 | * @entry: Queue entry to check. |
633 | */ | 640 | */ |
634 | static inline int rt2x00queue_status_timeout(struct data_queue *queue) | 641 | static inline int rt2x00queue_status_timeout(struct queue_entry *entry) |
635 | { | 642 | { |
636 | return time_after(queue->last_action[Q_INDEX_DMA_DONE], | 643 | if (!test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) |
637 | queue->last_action[Q_INDEX_DONE] + (HZ / 10)); | 644 | return false; |
645 | return time_after(jiffies, entry->last_action + msecs_to_jiffies(100)); | ||
638 | } | 646 | } |
639 | 647 | ||
640 | /** | 648 | /** |
641 | * rt2x00queue_timeout - Check if a timeout occurred for DMA transfers | 649 | * rt2x00queue_dma_timeout - Check if a timeout occurred for DMA transfers |
642 | * @queue: Queue to check. | 650 | * @entry: Queue entry to check. |
643 | */ | 651 | */ |
644 | static inline int rt2x00queue_dma_timeout(struct data_queue *queue) | 652 | static inline int rt2x00queue_dma_timeout(struct queue_entry *entry) |
645 | { | 653 | { |
646 | return time_after(queue->last_action[Q_INDEX], | 654 | if (!test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) |
647 | queue->last_action[Q_INDEX_DMA_DONE] + (HZ / 10)); | 655 | return false; |
656 | return time_after(jiffies, entry->last_action + msecs_to_jiffies(100)); | ||
648 | } | 657 | } |
649 | 658 | ||
650 | /** | 659 | /** |