aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-06-04 07:40:42 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-06-12 14:59:35 -0400
commit25bf6ce41d2692db2e991447015fb4bfbf3c3982 (patch)
treec21061cbc2df8b0f57ee5b637222ba3e0f0c331c
parent04453e9bda9da510e79c66f56ab463215d042aa8 (diff)
rt2x00: add queue_init callback to rt2x00_ops
The driver uses static data structures for initializing specific fields of a given data queue. These static queue data descriptor structures are containing values which related to a given chipset. Even though the values are chip specific, the actual selection of the used structure is based on device specific vendor/product identifiers. This approach works, but it is not always reliable. Sometimes the vendor and/or device IDs of the PCI and USB devices contains improper values which makes it impossible to select the correct structure for such devices. The patch adds a new callback to tr2x00_ops which is called after the chipset detection is finished. This allows the drivers to do dynamic initialization of the data_queue structure for a given queue based on the actual chipset. After each driver implements the queue_init callback, the data_queue_desc structure will be removed. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Acked-by: Stanislaw Gruszka <sgruszka@redhat.com> Acked-by: Gertjan van Wingerde <gwingerde@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h1
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c22
2 files changed, 14 insertions, 9 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 7510723a8c37..2d2db6472c04 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -653,6 +653,7 @@ struct rt2x00_ops {
653 const struct data_queue_desc *tx; 653 const struct data_queue_desc *tx;
654 const struct data_queue_desc *bcn; 654 const struct data_queue_desc *bcn;
655 const struct data_queue_desc *atim; 655 const struct data_queue_desc *atim;
656 void (*queue_init)(struct data_queue *queue);
656 const struct rt2x00lib_ops *lib; 657 const struct rt2x00lib_ops *lib;
657 const void *drv; 658 const void *drv;
658 const struct ieee80211_ops *hw; 659 const struct ieee80211_ops *hw;
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index 3ae2264fdabc..2a99ff1714ac 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -1306,8 +1306,6 @@ rt2x00queue_get_qdesc_by_qid(struct rt2x00_dev *rt2x00dev,
1306static void rt2x00queue_init(struct rt2x00_dev *rt2x00dev, 1306static void rt2x00queue_init(struct rt2x00_dev *rt2x00dev,
1307 struct data_queue *queue, enum data_queue_qid qid) 1307 struct data_queue *queue, enum data_queue_qid qid)
1308{ 1308{
1309 const struct data_queue_desc *qdesc;
1310
1311 mutex_init(&queue->status_lock); 1309 mutex_init(&queue->status_lock);
1312 spin_lock_init(&queue->tx_lock); 1310 spin_lock_init(&queue->tx_lock);
1313 spin_lock_init(&queue->index_lock); 1311 spin_lock_init(&queue->index_lock);
@@ -1319,14 +1317,20 @@ static void rt2x00queue_init(struct rt2x00_dev *rt2x00dev,
1319 queue->cw_min = 5; 1317 queue->cw_min = 5;
1320 queue->cw_max = 10; 1318 queue->cw_max = 10;
1321 1319
1322 qdesc = rt2x00queue_get_qdesc_by_qid(rt2x00dev, qid); 1320 if (rt2x00dev->ops->queue_init) {
1323 BUG_ON(!qdesc); 1321 rt2x00dev->ops->queue_init(queue);
1322 } else {
1323 const struct data_queue_desc *qdesc;
1324
1325 qdesc = rt2x00queue_get_qdesc_by_qid(rt2x00dev, qid);
1326 BUG_ON(!qdesc);
1324 1327
1325 queue->limit = qdesc->entry_num; 1328 queue->limit = qdesc->entry_num;
1326 queue->data_size = qdesc->data_size; 1329 queue->data_size = qdesc->data_size;
1327 queue->desc_size = qdesc->desc_size; 1330 queue->desc_size = qdesc->desc_size;
1328 queue->winfo_size = qdesc->winfo_size; 1331 queue->winfo_size = qdesc->winfo_size;
1329 queue->priv_size = qdesc->priv_size; 1332 queue->priv_size = qdesc->priv_size;
1333 }
1330 1334
1331 queue->threshold = DIV_ROUND_UP(queue->limit, 10); 1335 queue->threshold = DIV_ROUND_UP(queue->limit, 10);
1332} 1336}