]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/net/wireless/rt2x00/rt2x00queue.h
Merge tag 'v2.6.38' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[mv-sheeva.git] / drivers / net / wireless / rt2x00 / rt2x00queue.h
index d81d85f3486611cb79b18571694727c9616d7885..fab8e2687f293847ffe82a194fa9986e8a230ac8 100644 (file)
 #define MGMT_FRAME_SIZE                256
 #define AGGREGATION_SIZE       3840
 
-/**
- * DOC: Number of entries per queue
- *
- * Under normal load without fragmentation, 12 entries are sufficient
- * without the queue being filled up to the maximum. When using fragmentation
- * and the queue threshold code, we need to add some additional margins to
- * make sure the queue will never (or only under extreme load) fill up
- * completely.
- * Since we don't use preallocated DMA, having a large number of queue entries
- * will have minimal impact on the memory requirements for the queue.
- */
-#define RX_ENTRIES     24
-#define TX_ENTRIES     24
-#define BEACON_ENTRIES 1
-#define ATIM_ENTRIES   8
-
 /**
  * enum data_queue_qid: Queue identification
  *
+ * @QID_AC_VO: AC VO queue
+ * @QID_AC_VI: AC VI queue
  * @QID_AC_BE: AC BE queue
  * @QID_AC_BK: AC BK queue
- * @QID_AC_VI: AC VI queue
- * @QID_AC_VO: AC VO queue
  * @QID_HCCA: HCCA queue
  * @QID_MGMT: MGMT queue (prio queue)
  * @QID_RX: RX queue
  * @QID_ATIM: Atim queue (value unspeficied, don't send it to device)
  */
 enum data_queue_qid {
-       QID_AC_BE = 0,
-       QID_AC_BK = 1,
-       QID_AC_VI = 2,
-       QID_AC_VO = 3,
+       QID_AC_VO = 0,
+       QID_AC_VI = 1,
+       QID_AC_BE = 2,
+       QID_AC_BK = 3,
        QID_HCCA = 4,
        QID_MGMT = 13,
        QID_RX = 14,
@@ -296,7 +280,6 @@ enum txentry_desc_flags {
  * Summary of information for the frame descriptor before sending a TX frame.
  *
  * @flags: Descriptor flags (See &enum queue_entry_flags).
- * @qid: Queue identification (See &enum data_queue_qid).
  * @length: Length of the entire frame.
  * @header_length: Length of 802.11 header.
  * @length_high: PLCP length high word.
@@ -309,11 +292,8 @@ enum txentry_desc_flags {
  * @rate_mode: Rate mode (See @enum rate_modulation).
  * @mpdu_density: MDPU density.
  * @retry_limit: Max number of retries.
- * @aifs: AIFS value.
  * @ifs: IFS value.
  * @txop: IFS value for 11n capable chips.
- * @cw_min: cwmin value.
- * @cw_max: cwmax value.
  * @cipher: Cipher type used for encryption.
  * @key_idx: Key index used for encryption.
  * @iv_offset: Position where IV should be inserted by hardware.
@@ -322,8 +302,6 @@ enum txentry_desc_flags {
 struct txentry_desc {
        unsigned long flags;
 
-       enum data_queue_qid qid;
-
        u16 length;
        u16 header_length;
 
@@ -339,11 +317,8 @@ struct txentry_desc {
        u16 mpdu_density;
 
        short retry_limit;
-       short aifs;
        short ifs;
        short txop;
-       short cw_min;
-       short cw_max;
 
        enum cipher cipher;
        u16 key_idx;
@@ -365,12 +340,16 @@ struct txentry_desc {
  * @ENTRY_DATA_IO_FAILED: Hardware indicated that an IO error occured
  *     while transfering the data to the hardware. No TX status report will
  *     be expected from the hardware.
+ * @ENTRY_DATA_STATUS_PENDING: The entry has been send to the device and
+ *     returned. It is now waiting for the status reporting before the
+ *     entry can be reused again.
  */
 enum queue_entry_flags {
        ENTRY_BCN_ASSIGNED,
        ENTRY_OWNER_DEVICE_DATA,
        ENTRY_DATA_PENDING,
-       ENTRY_DATA_IO_FAILED
+       ENTRY_DATA_IO_FAILED,
+       ENTRY_DATA_STATUS_PENDING,
 };
 
 /**
@@ -416,6 +395,23 @@ enum queue_index {
        Q_INDEX_MAX,
 };
 
+/**
+ * enum data_queue_flags: Status flags for data queues
+ *
+ * @QUEUE_STARTED: The queue has been started. Fox RX queues this means the
+ *     device might be DMA'ing skbuffers. TX queues will accept skbuffers to
+ *     be transmitted and beacon queues will start beaconing the configured
+ *     beacons.
+ * @QUEUE_PAUSED: The queue has been started but is currently paused.
+ *     When this bit is set, the queue has been stopped in mac80211,
+ *     preventing new frames to be enqueued. However, a few frames
+ *     might still appear shortly after the pausing...
+ */
+enum data_queue_flags {
+       QUEUE_STARTED,
+       QUEUE_PAUSED,
+};
+
 /**
  * struct data_queue: Data queue
  *
@@ -423,7 +419,10 @@ enum queue_index {
  * @entries: Base address of the &struct queue_entry which are
  *     part of this queue.
  * @qid: The queue identification, see &enum data_queue_qid.
- * @lock: Spinlock to protect index handling. Whenever @index, @index_done or
+ * @flags: Entry flags, see &enum queue_entry_flags.
+ * @status_lock: The mutex for protecting the start/stop/flush
+ *     handling on this queue.
+ * @index_lock: Spinlock to protect index handling. Whenever @index, @index_done or
  *     @index_crypt needs to be changed this lock should be grabbed to prevent
  *     index corruption due to concurrency.
  * @count: Number of frames handled in the queue.
@@ -446,8 +445,11 @@ struct data_queue {
        struct queue_entry *entries;
 
        enum data_queue_qid qid;
+       unsigned long flags;
+
+       struct mutex status_lock;
+       spinlock_t index_lock;
 
-       spinlock_t lock;
        unsigned int count;
        unsigned short limit;
        unsigned short threshold;
@@ -618,10 +620,10 @@ static inline int rt2x00queue_threshold(struct data_queue *queue)
 }
 
 /**
- * rt2x00queue_timeout - Check if a timeout occured for STATUS reorts
+ * rt2x00queue_status_timeout - Check if a timeout occured for STATUS reports
  * @queue: Queue to check.
  */
-static inline int rt2x00queue_timeout(struct data_queue *queue)
+static inline int rt2x00queue_status_timeout(struct data_queue *queue)
 {
        return time_after(queue->last_action[Q_INDEX_DMA_DONE],
                          queue->last_action[Q_INDEX_DONE] + (HZ / 10));