rt2x00: Simplify arguments to rt2x00 driver callback functions
PATCH 1/8 rt2x00: Simplify arguments to rt2x00 driver callback functions
write_tx_desc shouldn't pass a rt2x00dev and skb pointer, instead it should use the same format as other TX frame callback functions, which is passing the data_entry pointer which contains all the information which is needed to work on a TX frame.
Most callers of the kick_tx_queue and kill_tx_queue already have the data_queue pointer, so rather then sending the QID with the given function, when the driver requests a new pointer to the data_queue, it is more efficient to just send the data_queue pointer directly.
--- drivers/net/wireless/rt2x00/rt2400pci.c | 25 ++++++++--------- drivers/net/wireless/rt2x00/rt2500pci.c | 25 ++++++++--------- drivers/net/wireless/rt2x00/rt2500usb.c | 9 +++--- drivers/net/wireless/rt2x00/rt2800pci.c | 41 ++++++++++++----------------- drivers/net/wireless/rt2x00/rt2800usb.c | 9 +++--- drivers/net/wireless/rt2x00/rt2x00.h | 9 ++---- drivers/net/wireless/rt2x00/rt2x00queue.c | 11 +++---- drivers/net/wireless/rt2x00/rt2x00usb.c | 14 +++------ drivers/net/wireless/rt2x00/rt2x00usb.h | 12 +++----- drivers/net/wireless/rt2x00/rt61pci.c | 39 +++++++++++++-------------- drivers/net/wireless/rt2x00/rt73usb.c | 11 +++---- 11 files changed, 90 insertions(+), 115 deletions(-)
drivers/net/wireless/rt2x00/rt2400pci.c +12 -13
@@ -1007,12 +1007,11 @@ static int rt2400pci_set_device_state(struct rt2x00_dev *rt2x00dev,/* * TX descriptor initialization */ -static void rt2400pci_write_tx_desc (struct rt2x00_dev *rt2x00dev, -struct sk_buff *skb, +static void rt2400pci_write_tx_desc (struct queue_entry *entry,struct txentry_desc *txdesc) { -struct skb_frame_desc *skbdesc =get_skb_frame_desc (skb); -struct queue_entry_priv_pci *entry_priv = skbdesc->entry->priv_data; +struct skb_frame_desc *skbdesc =get_skb_frame_desc (entry->skb); +struct queue_entry_priv_pci *entry_priv = entry->priv_data;__le32 *txd = entry_priv->desc;u32 word;
@@ -1096,7 +1095,7 @@ static void rt2400pci_write_beacon(struct queue_entry *entry,/* * Write the TX descriptor for the beacon. */ -rt2400pci_write_tx_desc (rt2x00dev, entry->skb, txdesc); +rt2400pci_write_tx_desc (entry, txdesc);/* * Dump beacon to userspace through debugfs.
@@ -1112,24 +1111,24 @@ static void rt2400pci_write_beacon(struct queue_entry *entry,rt2x00pci_register_write (rt2x00dev,CSR14 , reg); } -static void rt2400pci_kick_tx_queue (struct rt2x00_dev *rt2x00dev, -const enum data_queue_qid queue) +static void rt2400pci_kick_tx_queue (struct data_queue *queue) { +struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;u32 reg;rt2x00pci_register_read (rt2x00dev,TXCSR0 , ®); -rt2x00_set_field32 (®,TXCSR0_KICK_PRIO , (queue ==QID_AC_BE )); -rt2x00_set_field32 (®,TXCSR0_KICK_TX , (queue ==QID_AC_BK )); -rt2x00_set_field32 (®,TXCSR0_KICK_ATIM , (queue ==QID_ATIM )); +rt2x00_set_field32 (®,TXCSR0_KICK_PRIO , (queue->qid ==QID_AC_BE )); +rt2x00_set_field32 (®,TXCSR0_KICK_TX , (queue->qid ==QID_AC_BK )); +rt2x00_set_field32 (®,TXCSR0_KICK_ATIM , (queue->qid ==QID_ATIM ));rt2x00pci_register_write (rt2x00dev,TXCSR0 , reg); } -static void rt2400pci_kill_tx_queue (struct rt2x00_dev *rt2x00dev, -const enum data_queue_qid qid) +static void rt2400pci_kill_tx_queue (struct data_queue *queue) { +struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;u32 reg; -if (qid ==QID_BEACON ) { +if (queue->qid ==QID_BEACON ) {rt2x00pci_register_write (rt2x00dev,CSR14 ,0 ); }else {rt2x00pci_register_read (rt2x00dev,TXCSR0 , ®);
drivers/net/wireless/rt2x00/rt2500pci.c +12 -13
@@ -1161,12 +1161,11 @@ static int rt2500pci_set_device_state(struct rt2x00_dev *rt2x00dev,/* * TX descriptor initialization */ -static void rt2500pci_write_tx_desc (struct rt2x00_dev *rt2x00dev, -struct sk_buff *skb, +static void rt2500pci_write_tx_desc (struct queue_entry *entry,struct txentry_desc *txdesc) { -struct skb_frame_desc *skbdesc =get_skb_frame_desc (skb); -struct queue_entry_priv_pci *entry_priv = skbdesc->entry->priv_data; +struct skb_frame_desc *skbdesc =get_skb_frame_desc (entry->skb); +struct queue_entry_priv_pci *entry_priv = entry->priv_data;__le32 *txd = entry_priv->desc;u32 word;
@@ -1249,7 +1248,7 @@ static void rt2500pci_write_beacon(struct queue_entry *entry,/* * Write the TX descriptor for the beacon. */ -rt2500pci_write_tx_desc (rt2x00dev, entry->skb, txdesc); +rt2500pci_write_tx_desc (entry, txdesc);/* * Dump beacon to userspace through debugfs.
@@ -1265,24 +1264,24 @@ static void rt2500pci_write_beacon(struct queue_entry *entry,rt2x00pci_register_write (rt2x00dev,CSR14 , reg); } -static void rt2500pci_kick_tx_queue (struct rt2x00_dev *rt2x00dev, -const enum data_queue_qid queue) +static void rt2500pci_kick_tx_queue (struct data_queue *queue) { +struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;u32 reg;rt2x00pci_register_read (rt2x00dev,TXCSR0 , ®); -rt2x00_set_field32 (®,TXCSR0_KICK_PRIO , (queue ==QID_AC_BE )); -rt2x00_set_field32 (®,TXCSR0_KICK_TX , (queue ==QID_AC_BK )); -rt2x00_set_field32 (®,TXCSR0_KICK_ATIM , (queue ==QID_ATIM )); +rt2x00_set_field32 (®,TXCSR0_KICK_PRIO , (queue->qid ==QID_AC_BE )); +rt2x00_set_field32 (®,TXCSR0_KICK_TX , (queue->qid ==QID_AC_BK )); +rt2x00_set_field32 (®,TXCSR0_KICK_ATIM , (queue->qid ==QID_ATIM ));rt2x00pci_register_write (rt2x00dev,TXCSR0 , reg); } -static void rt2500pci_kill_tx_queue (struct rt2x00_dev *rt2x00dev, -const enum data_queue_qid qid) +static void rt2500pci_kill_tx_queue (struct data_queue *queue) { +struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;u32 reg; -if (qid ==QID_BEACON ) { +if (queue->qid ==QID_BEACON ) {rt2x00pci_register_write (rt2x00dev,CSR14 ,0 ); }else {rt2x00pci_register_read (rt2x00dev,TXCSR0 , ®);
drivers/net/wireless/rt2x00/rt2500usb.c +4 -5
@@ -1041,12 +1041,11 @@ static int rt2500usb_set_device_state(struct rt2x00_dev *rt2x00dev,/* * TX descriptor initialization */ -static void rt2500usb_write_tx_desc (struct rt2x00_dev *rt2x00dev, -struct sk_buff *skb, +static void rt2500usb_write_tx_desc (struct queue_entry *entry,struct txentry_desc *txdesc) { -struct skb_frame_desc *skbdesc =get_skb_frame_desc (skb); -__le32 *txd = (__le32 *) skb->data; +struct skb_frame_desc *skbdesc =get_skb_frame_desc (entry->skb); +__le32 *txd = (__le32 *) entry->skb->data;u32 word;/*
@@ -1129,7 +1128,7 @@ static void rt2500usb_write_beacon(struct queue_entry *entry,/* * Write the TX descriptor for the beacon. */ -rt2500usb_write_tx_desc (rt2x00dev, entry->skb, txdesc); +rt2500usb_write_tx_desc (entry, txdesc);/* * Dump beacon to userspace through debugfs.
drivers/net/wireless/rt2x00/rt2800pci.c +17 -24
77 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt2800usb.c +4 -5
@@ -329,12 +329,11 @@ static __le32 *rt2800usb_get_txwi(struct queue_entry *entry)return (__le32 *) (entry->skb->data +TXINFO_DESC_SIZE ); } -static void rt2800usb_write_tx_desc (struct rt2x00_dev *rt2x00dev, -struct sk_buff *skb, +static void rt2800usb_write_tx_desc (struct queue_entry *entry,struct txentry_desc *txdesc) { -struct skb_frame_desc *skbdesc =get_skb_frame_desc (skb); -__le32 *txi = (__le32 *) skb->data; +struct skb_frame_desc *skbdesc =get_skb_frame_desc (entry->skb); +__le32 *txi = (__le32 *) entry->skb->data;u32 word;/*
@@ -342,7 +341,7 @@ static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,*/ rt2x00_desc_read (txi,0 , &word);rt2x00_set_field32 (&word,TXINFO_W0_USB_DMA_TX_PKT_LEN , - skb->len -TXINFO_DESC_SIZE ); + entry->skb->len -TXINFO_DESC_SIZE );rt2x00_set_field32 (&word,TXINFO_W0_WIV , !test_bit (ENTRY_TXD_ENCRYPT_IV , &txdesc->flags));rt2x00_set_field32 (&word,TXINFO_W0_QSEL ,2 );
drivers/net/wireless/rt2x00/rt2x00.h +3 -6
@@ -559,18 +559,15 @@ struct rt2x00lib_ops {/* * TX control handlers */ -void (*write_tx_desc) (struct rt2x00_dev *rt2x00dev, -struct sk_buff *skb, +void (*write_tx_desc) (struct queue_entry *entry,struct txentry_desc *txdesc);void (*write_tx_data) (struct queue_entry *entry,struct txentry_desc *txdesc);void (*write_beacon) (struct queue_entry *entry,struct txentry_desc *txdesc);int (*get_tx_data_len) (struct queue_entry *entry); -void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev, -const enum data_queue_qid queue); -void (*kill_tx_queue) (struct rt2x00_dev *rt2x00dev, -const enum data_queue_qid queue); +void (*kick_tx_queue) (struct data_queue *queue); +void (*kill_tx_queue) (struct data_queue *queue);/* * RX control handlers
drivers/net/wireless/rt2x00/rt2x00queue.c +5 -6
@@ -449,15 +449,14 @@ static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry, struct txentry_desc *txdesc) {struct data_queue *queue = entry->queue; -struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; - rt2x00dev->ops->lib->write_tx_desc (rt2x00dev, entry->skb, txdesc); + queue->rt2x00dev->ops->lib->write_tx_desc (entry, txdesc);/* * All processing on the frame has been completed, this means * it is now ready to be dumped to userspace through debugfs. */ -rt2x00debug_dump_frame (rt2x00dev,DUMP_FRAME_TX , entry->skb); +rt2x00debug_dump_frame (queue->rt2x00dev,DUMP_FRAME_TX , entry->skb); } static void rt2x00queue_kick_tx_queue(struct queue_entry *entry,
@@ -477,7 +476,7 @@ static void rt2x00queue_kick_tx_queue(struct queue_entry *entry,*/ if (rt2x00queue_threshold (queue) || !test_bit (ENTRY_TXD_BURST , &txdesc->flags)) - rt2x00dev->ops->lib->kick_tx_queue (rt2x00dev, queue->qid); + rt2x00dev->ops->lib->kick_tx_queue (queue); } int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
@@ -591,7 +590,7 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev, intf->beacon->skb =NULL ;if (!enable_beacon) { - rt2x00dev->ops->lib->kill_tx_queue (rt2x00dev,QID_BEACON ); + rt2x00dev->ops->lib->kill_tx_queue (intf->beacon->queue);mutex_unlock (&intf->beacon_skb_mutex);return 0 ; }
@@ -719,7 +718,7 @@ void rt2x00queue_stop_queues(struct rt2x00_dev *rt2x00dev)struct data_queue *queue;txall_queue_for_each (rt2x00dev, queue) - rt2x00dev->ops->lib->kill_tx_queue (rt2x00dev, queue->qid); + rt2x00dev->ops->lib->kill_tx_queue (queue); }void rt2x00queue_init_queues (struct rt2x00_dev *rt2x00dev)
drivers/net/wireless/rt2x00/rt2x00usb.c +5 -9
@@ -249,10 +249,8 @@ static inline void rt2x00usb_kick_tx_entry(struct queue_entry *entry) } } -void rt2x00usb_kick_tx_queue (struct rt2x00_dev *rt2x00dev, -const enum data_queue_qid qid) +void rt2x00usb_kick_tx_queue (struct data_queue *queue) { -struct data_queue *queue =rt2x00queue_get_queue (rt2x00dev, qid);unsigned long irqflags;unsigned int index;unsigned int index_done;
@@ -286,10 +284,8 @@ void rt2x00usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev, }EXPORT_SYMBOL_GPL (rt2x00usb_kick_tx_queue); -void rt2x00usb_kill_tx_queue (struct rt2x00_dev *rt2x00dev, -const enum data_queue_qid qid) +void rt2x00usb_kill_tx_queue (struct data_queue *queue) { -struct data_queue *queue =rt2x00queue_get_queue (rt2x00dev, qid);struct queue_entry_priv_usb *entry_priv;struct queue_entry_priv_usb_bcn *bcn_priv;unsigned int i;
@@ -300,8 +296,8 @@ void rt2x00usb_kill_tx_queue(struct rt2x00_dev *rt2x00dev,* the beacon guard byte. */ kill_guard = - (qid ==QID_BEACON ) && - (test_bit (DRIVER_REQUIRE_BEACON_GUARD , &rt2x00dev->flags)); + (queue->qid ==QID_BEACON ) && + (test_bit (DRIVER_REQUIRE_BEACON_GUARD , &queue->rt2x00dev->flags));/* * Cancel all entries.
@@ -447,7 +443,7 @@ void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev)* The USB version of kill_tx_queue also works * on the RX queue. */ - rt2x00dev->ops->lib->kill_tx_queue (rt2x00dev,QID_RX ); + rt2x00dev->ops->lib->kill_tx_queue (rt2x00dev->rx); }EXPORT_SYMBOL_GPL (rt2x00usb_disable_radio);
drivers/net/wireless/rt2x00/rt2x00usb.h +4 -8
@@ -379,25 +379,21 @@ struct queue_entry_priv_usb_bcn {/** * rt2x00usb_kick_tx_queue - Kick data queue -* @rt2x00dev: Pointer to &struct rt2x00_dev -* @qid: Data queue to kick +* @queue: Data queue to kick * * This will walk through all entries of the queue and push all pending * frames to the hardware as a single burst. */ -void rt2x00usb_kick_tx_queue (struct rt2x00_dev *rt2x00dev, -const enum data_queue_qid qid); +void rt2x00usb_kick_tx_queue (struct data_queue *queue);/** * rt2x00usb_kill_tx_queue - Kill data queue -* @rt2x00dev: Pointer to &struct rt2x00_dev -* @qid: Data queue to kill +* @queue: Data queue to kill * * This will walk through all entries of the queue and kill all * previously kicked frames before they can be send. */ -void rt2x00usb_kill_tx_queue (struct rt2x00_dev *rt2x00dev, -const enum data_queue_qid qid); +void rt2x00usb_kill_tx_queue (struct data_queue *queue);/** * rt2x00usb_watchdog - Watchdog for USB communication
drivers/net/wireless/rt2x00/rt61pci.c +19 -20
@@ -1766,12 +1766,11 @@ static int rt61pci_set_device_state(struct rt2x00_dev *rt2x00dev,/* * TX descriptor initialization */ -static void rt61pci_write_tx_desc (struct rt2x00_dev *rt2x00dev, -struct sk_buff *skb, +static void rt61pci_write_tx_desc (struct queue_entry *entry,struct txentry_desc *txdesc) { -struct skb_frame_desc *skbdesc =get_skb_frame_desc (skb); -struct queue_entry_priv_pci *entry_priv = skbdesc->entry->priv_data; +struct skb_frame_desc *skbdesc =get_skb_frame_desc (entry->skb); +struct queue_entry_priv_pci *entry_priv = entry->priv_data;__le32 *txd = entry_priv->desc;u32 word;
@@ -1802,11 +1801,11 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, }rt2x00_desc_read (txd,5 , &word); -rt2x00_set_field32 (&word,TXD_W5_PID_TYPE , skbdesc->entry->queue->qid); +rt2x00_set_field32 (&word,TXD_W5_PID_TYPE , entry->queue->qid);rt2x00_set_field32 (&word,TXD_W5_PID_SUBTYPE , skbdesc->entry->entry_idx);rt2x00_set_field32 (&word,TXD_W5_TX_POWER , -TXPOWER_TO_DEV (rt2x00dev->tx_power)); +TXPOWER_TO_DEV (entry->queue->rt2x00dev->tx_power));rt2x00_set_field32 (&word,TXD_W5_WAITING_DMA_DONE_INT ,1 );rt2x00_desc_write (txd,5 , word);
@@ -1882,7 +1881,7 @@ static void rt61pci_write_beacon(struct queue_entry *entry,/* * Write the TX descriptor for the beacon. */ -rt61pci_write_tx_desc (rt2x00dev, entry->skb, txdesc); +rt61pci_write_tx_desc (entry, txdesc);/* * Dump beacon to userspace through debugfs.
@@ -1918,34 +1917,34 @@ static void rt61pci_write_beacon(struct queue_entry *entry, entry->skb =NULL ; } -static void rt61pci_kick_tx_queue (struct rt2x00_dev *rt2x00dev, -const enum data_queue_qid queue) +static void rt61pci_kick_tx_queue (struct data_queue *queue) { +struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;u32 reg;rt2x00pci_register_read (rt2x00dev,TX_CNTL_CSR , ®); -rt2x00_set_field32 (®,TX_CNTL_CSR_KICK_TX_AC0 , (queue ==QID_AC_BE )); -rt2x00_set_field32 (®,TX_CNTL_CSR_KICK_TX_AC1 , (queue ==QID_AC_BK )); -rt2x00_set_field32 (®,TX_CNTL_CSR_KICK_TX_AC2 , (queue ==QID_AC_VI )); -rt2x00_set_field32 (®,TX_CNTL_CSR_KICK_TX_AC3 , (queue ==QID_AC_VO )); +rt2x00_set_field32 (®,TX_CNTL_CSR_KICK_TX_AC0 , (queue->qid ==QID_AC_BE )); +rt2x00_set_field32 (®,TX_CNTL_CSR_KICK_TX_AC1 , (queue->qid ==QID_AC_BK )); +rt2x00_set_field32 (®,TX_CNTL_CSR_KICK_TX_AC2 , (queue->qid ==QID_AC_VI )); +rt2x00_set_field32 (®,TX_CNTL_CSR_KICK_TX_AC3 , (queue->qid ==QID_AC_VO ));rt2x00pci_register_write (rt2x00dev,TX_CNTL_CSR , reg); } -static void rt61pci_kill_tx_queue (struct rt2x00_dev *rt2x00dev, -const enum data_queue_qid qid) +static void rt61pci_kill_tx_queue (struct data_queue *queue) { +struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;u32 reg; -if (qid ==QID_BEACON ) { +if (queue->qid ==QID_BEACON ) {rt2x00pci_register_write (rt2x00dev,TXRX_CSR9 ,0 );return ; }rt2x00pci_register_read (rt2x00dev,TX_CNTL_CSR , ®); -rt2x00_set_field32 (®,TX_CNTL_CSR_ABORT_TX_AC0 , (qid ==QID_AC_BE )); -rt2x00_set_field32 (®,TX_CNTL_CSR_ABORT_TX_AC1 , (qid ==QID_AC_BK )); -rt2x00_set_field32 (®,TX_CNTL_CSR_ABORT_TX_AC2 , (qid ==QID_AC_VI )); -rt2x00_set_field32 (®,TX_CNTL_CSR_ABORT_TX_AC3 , (qid ==QID_AC_VO )); +rt2x00_set_field32 (®,TX_CNTL_CSR_ABORT_TX_AC0 , (queue->qid ==QID_AC_BE )); +rt2x00_set_field32 (®,TX_CNTL_CSR_ABORT_TX_AC1 , (queue->qid ==QID_AC_BK )); +rt2x00_set_field32 (®,TX_CNTL_CSR_ABORT_TX_AC2 , (queue->qid ==QID_AC_VI )); +rt2x00_set_field32 (®,TX_CNTL_CSR_ABORT_TX_AC3 , (queue->qid ==QID_AC_VO ));rt2x00pci_register_write (rt2x00dev,TX_CNTL_CSR , reg); }
drivers/net/wireless/rt2x00/rt73usb.c +5 -6
@@ -1426,12 +1426,11 @@ static int rt73usb_set_device_state(struct rt2x00_dev *rt2x00dev,/* * TX descriptor initialization */ -static void rt73usb_write_tx_desc (struct rt2x00_dev *rt2x00dev, -struct sk_buff *skb, +static void rt73usb_write_tx_desc (struct queue_entry *entry,struct txentry_desc *txdesc) { -struct skb_frame_desc *skbdesc =get_skb_frame_desc (skb); -__le32 *txd = (__le32 *) skb->data; +struct skb_frame_desc *skbdesc =get_skb_frame_desc (entry->skb); +__le32 *txd = (__le32 *) entry->skb->data;u32 word;/*
@@ -1487,7 +1486,7 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,rt2x00_desc_read (txd,5 , &word);rt2x00_set_field32 (&word,TXD_W5_TX_POWER , -TXPOWER_TO_DEV (rt2x00dev->tx_power)); +TXPOWER_TO_DEV (entry->queue->rt2x00dev->tx_power));rt2x00_set_field32 (&word,TXD_W5_WAITING_DMA_DONE_INT ,1 );rt2x00_desc_write (txd,5 , word);
@@ -1526,7 +1525,7 @@ static void rt73usb_write_beacon(struct queue_entry *entry,/* * Write the TX descriptor for the beacon. */ -rt73usb_write_tx_desc (rt2x00dev, entry->skb, txdesc); +rt73usb_write_tx_desc (entry, txdesc);/* * Dump beacon to userspace through debugfs.
Signature · 1 line
1.7.2.1
PATCH 2/8 rt2x00: Reduce indenting
Cosmetic change, reduce indenting.
--- drivers/net/wireless/rt2x00/rt2x00usb.c | 27 ++++++++++++++------------- 1 files changed, 14 insertions(+), 13 deletions(-)
drivers/net/wireless/rt2x00/rt2x00usb.c +14 -13
@@ -232,21 +232,22 @@ static inline void rt2x00usb_kick_tx_entry(struct queue_entry *entry)struct queue_entry_priv_usb *entry_priv = entry->priv_data;u32 length; -if (test_and_clear_bit (ENTRY_DATA_PENDING , &entry->flags)) { -/* -* USB devices cannot blindly pass the skb->len as the -* length of the data to usb_fill_bulk_urb. Pass the skb -* to the driver to determine what the length should be. -*/ - length = rt2x00dev->ops->lib->get_tx_data_len (entry); +if (!test_and_clear_bit (ENTRY_DATA_PENDING , &entry->flags)) +return ; + +/* +* USB devices cannot blindly pass the skb->len as the +* length of the data to usb_fill_bulk_urb. Pass the skb +* to the driver to determine what the length should be. +*/ + length = rt2x00dev->ops->lib->get_tx_data_len (entry); -usb_fill_bulk_urb (entry_priv->urb, usb_dev, -usb_sndbulkpipe (usb_dev, entry->queue->usb_endpoint), - entry->skb->data, length, - rt2x00usb_interrupt_txdone, entry); +usb_fill_bulk_urb (entry_priv->urb, usb_dev, +usb_sndbulkpipe (usb_dev, entry->queue->usb_endpoint), + entry->skb->data, length, + rt2x00usb_interrupt_txdone, entry); -usb_submit_urb (entry_priv->urb,GFP_ATOMIC ); - } +usb_submit_urb (entry_priv->urb,GFP_ATOMIC ); }void rt2x00usb_kick_tx_queue (struct data_queue *queue)
Signature · 1 line
1.7.2.1
PATCH 3/8 rt2x00: Move direct access to queue->entries to rt2x00queue.c
All access to queue->entries through the Q_INDEX/Q_INDEX_DONE variables must be done using spinlock protection. It is best to manage this completely from rt2x00queue.c.
For safely looping through all entries in the queue, the function rt2x00queue_for_each_entry is added which will walk from from a index range in a safe manner.
This also fixes rt2x00usb which walked the entries list from 0 to length to kill each entry (killing entries must be done from Q_INDEX_DONE to Q_INDEX to enforce TX status reporting to occur in the correct order.
--- drivers/net/wireless/rt2x00/rt2800pci.c | 4 +- drivers/net/wireless/rt2x00/rt2x00queue.c | 45 +++++++++++++++++ drivers/net/wireless/rt2x00/rt2x00queue.h | 16 ++++++ drivers/net/wireless/rt2x00/rt2x00usb.c | 75 ++++++++--------------------- 4 files changed, 83 insertions(+), 57 deletions(-)
drivers/net/wireless/rt2x00/rt2800pci.c +2 -2
@@ -629,7 +629,7 @@ static void rt2800pci_write_tx_desc(struct queue_entry *entry,static void rt2800pci_kick_tx_queue (struct data_queue *queue) {struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; -unsigned int idx = queue->index[Q_INDEX ]; +struct queue_entry *entry =rt2x00queue_get_entry (queue,Q_INDEX );unsigned int qidx =0 ;if (queue->qid ==QID_MGMT )
@@ -637,7 +637,7 @@ static void rt2800pci_kick_tx_queue(struct data_queue *queue)else qidx = queue->qid; -rt2800_register_write (rt2x00dev,TX_CTX_IDX (qidx), idx); +rt2800_register_write (rt2x00dev,TX_CTX_IDX (qidx), entry->entry_idx); }static void rt2800pci_kill_tx_queue (struct data_queue *queue)
drivers/net/wireless/rt2x00/rt2x00queue.c +45 -0
51 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt2x00queue.h +16 -0
@@ -571,6 +571,22 @@ struct data_queue_desc {queue_loop (__entry, (__dev)->tx,queue_end (__dev))/** +* rt2x00queue_for_each_entry - Loop through all entries in the queue +* @queue: Pointer to @data_queue +* @start: &enum queue_index Pointer to start index +* @end: &enum queue_index Pointer to end index +* @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. + */ +void rt2x00queue_for_each_entry (struct data_queue *queue, +enum queue_index start, +enum queue_index end, +void (*fn)(struct queue_entry *entry)); + +/** * rt2x00queue_empty - Check if the queue is empty. * @queue: Queue to check if empty. */
drivers/net/wireless/rt2x00/rt2x00usb.c +20 -55
96 lines not on this page · raw message
Signature · 1 line
1.7.2.1
PATCH 4/8 rt2x00: Remove Q_INDEX_CRYPTO and ENTRY_OWNER_DEVICE_CRYPTO
Q_INDEX_CRYPTO and ENTRY_OWNER_DEVICE_CRYPTO where initially added with the plan to implement hardware encryption for rt2500pci. However there are no plans to do so anymore as the crypto mechanism in rt2500pci is very different then any other Ralink device.
So we can now safely remove the definitions, and don't think about this feature anymore. :)
--- drivers/net/wireless/rt2x00/rt2x00debug.c | 7 +++---- drivers/net/wireless/rt2x00/rt2x00queue.h | 7 ------- 2 files changed, 3 insertions(+), 11 deletions(-)
drivers/net/wireless/rt2x00/rt2x00debug.c +3 -4
@@ -338,16 +338,15 @@ static ssize_t rt2x00debug_read_queue_stats(struct file *file,return -ENOMEM ; temp = data + -sprintf (data,"qid\tcount\tlimit\tlength\tindex\tdone\tcrypto\n" ); +sprintf (data,"qid\tcount\tlimit\tlength\tindex\tdone\n" );queue_for_each (intf->rt2x00dev, queue) {spin_lock_irqsave (&queue->lock, irqflags); - temp +=sprintf (temp,"%d\t%d\t%d\t%d\t%d\t%d\t%d\n" , queue->qid, + temp +=sprintf (temp,"%d\t%d\t%d\t%d\t%d\t%d\n" , queue->qid, queue->count, queue->limit, queue->length, queue->index[Q_INDEX ], - queue->index[Q_INDEX_DONE ], - queue->index[Q_INDEX_CRYPTO ]); + queue->index[Q_INDEX_DONE ]);spin_unlock_irqrestore (&queue->lock, irqflags); }
drivers/net/wireless/rt2x00/rt2x00queue.h +0 -7
@@ -360,9 +360,6 @@ struct txentry_desc {* @ENTRY_OWNER_DEVICE_DATA: This entry is owned by the device for data * transfer (either TX or RX depending on the queue). The entry should * only be touched after the device has signaled it is done with it. -* @ENTRY_OWNER_DEVICE_CRYPTO: This entry is owned by the device for data -* encryption or decryption. The entry should only be touched after -* the device has signaled it is done with it. * @ENTRY_DATA_PENDING: This entry contains a valid frame and is waiting * for the signal to start sending. * @ENTRY_DATA_IO_FAILED: Hardware indicated that an IO error occured
@@ -372,7 +369,6 @@ struct txentry_desc {enum queue_entry_flags {ENTRY_BCN_ASSIGNED ,ENTRY_OWNER_DEVICE_DATA , -ENTRY_OWNER_DEVICE_CRYPTO ,ENTRY_DATA_PENDING ,ENTRY_DATA_IO_FAILED };
@@ -408,15 +404,12 @@ struct queue_entry {* @Q_INDEX_DONE: Index pointer to the next entry which will be completed by * the hardware and for which we need to run the txdone handler. If this * entry is not owned by the hardware the queue is considered to be empty. -* @Q_INDEX_CRYPTO: Index pointer to the next entry which encryption/decription -* will be completed by the hardware next. * @Q_INDEX_MAX: Keep last, used in &struct data_queue to determine the size * of the index array. */ enum queue_index {Q_INDEX ,Q_INDEX_DONE , -Q_INDEX_CRYPTO ,Q_INDEX_MAX , };
Signature · 1 line
1.7.2.1
PATCH 5/8 rt2x00: Fix rt2800 retry calculation
The retry count for a frame is calculated by the realized MCS rate subtracting of the requested MCS rate. However during TX done reporting we accidently override the requested MCS rate with the realized MCS rate. This causes the retry count to be reset to 0 always, and feeding invalid rate information into minstrel_ht.
--- drivers/net/wireless/rt2x00/rt2800lib.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2800lib.c +0 -1
@@ -650,7 +650,6 @@ void rt2800_txdone(struct rt2x00_dev *rt2x00dev) txdesc.flags =0 ;rt2x00_desc_read (txwi,0 , &word); mcs =rt2x00_get_field32 (word,TXWI_W0_MCS ); - mcs =rt2x00_get_field32 (reg,TX_STA_FIFO_MCS ); real_mcs =rt2x00_get_field32 (reg,TX_STA_FIFO_MCS );/*
Signature · 1 line
1.7.2.1
PATCH 6/8 rt2x00: Merge rt2800{pci/usb} radio enabling/disabling code to rt2800lib
The functions rt2800pci_enable_radio and rt2800usb_disable_radio are almost equal and can be merged into rt2800lib. This reduces the number of functions which must be exported from rt2800lib to the drivers at the same time.
Also rt2800pci_disable_radio and rt2800usb_disable_radio are almost equal and can be merged into rt2800lib in a similar fashion.
--- drivers/net/wireless/rt2x00/rt2800lib.c | 103 +++++++++++++++++++++++++++++-- drivers/net/wireless/rt2x00/rt2800lib.h | 8 +- drivers/net/wireless/rt2x00/rt2800pci.c | 69 +-------------------- drivers/net/wireless/rt2x00/rt2800usb.c | 72 +--------------------- 4 files changed, 107 insertions(+), 145 deletions(-)
drivers/net/wireless/rt2x00/rt2800lib.c +97 -6
@@ -1655,7 +1655,7 @@ EXPORT_SYMBOL_GPL(rt2800_link_tuner);/* * Initialization functions. */ -int rt2800_init_registers (struct rt2x00_dev *rt2x00dev) +static int rt2800_init_registers (struct rt2x00_dev *rt2x00dev) {u32 reg;u16 eeprom;
@@ -2025,7 +2025,6 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)return 0 ; } -EXPORT_SYMBOL_GPL (rt2800_init_registers);static int rt2800_wait_bbp_rf_ready (struct rt2x00_dev *rt2x00dev) {
@@ -2068,7 +2067,7 @@ static int rt2800_wait_bbp_ready(struct rt2x00_dev *rt2x00dev)return -EACCES ; } -int rt2800_init_bbp (struct rt2x00_dev *rt2x00dev) +static int rt2800_init_bbp (struct rt2x00_dev *rt2x00dev) {unsigned int i;u16 eeprom;
@@ -2163,7 +2162,6 @@ int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)return 0 ; } -EXPORT_SYMBOL_GPL (rt2800_init_bbp);static u8 rt2800_init_rx_filter (struct rt2x00_dev *rt2x00dev,bool bw40,u8 rfcsr24,u8 filter_target)
@@ -2225,7 +2223,7 @@ static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev,return rfcsr24; } -int rt2800_init_rfcsr (struct rt2x00_dev *rt2x00dev) +static int rt2800_init_rfcsr (struct rt2x00_dev *rt2x00dev) {u8 rfcsr;u8 bbp;
@@ -2479,7 +2477,100 @@ int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)return 0 ; } -EXPORT_SYMBOL_GPL (rt2800_init_rfcsr); + +int rt2800_enable_radio (struct rt2x00_dev *rt2x00dev) +{ +u32 reg; +u16 word; + +/* +* Initialize all registers. +*/ +if (unlikely (rt2800_wait_wpdma_ready (rt2x00dev) || +rt2800_init_registers (rt2x00dev) || +rt2800_init_bbp (rt2x00dev) || +rt2800_init_rfcsr (rt2x00dev))) +return -EIO ; + +/* +* Send signal to firmware during boot time. +*/ +rt2800_mcu_request (rt2x00dev,MCU_BOOT_SIGNAL ,0 ,0 ,0 ); + +if (rt2x00_is_usb (rt2x00dev) && + (rt2x00_rt (rt2x00dev,RT3070 ) || +rt2x00_rt (rt2x00dev,RT3071 ) || +rt2x00_rt (rt2x00dev,RT3572 ))) { +udelay (200 ); +rt2800_mcu_request (rt2x00dev,MCU_CURRENT ,0 ,0 ,0 ); +udelay (10 ); + } + +/* +* Enable RX. +*/ +rt2800_register_read (rt2x00dev,MAC_SYS_CTRL , ®); +rt2x00_set_field32 (®,MAC_SYS_CTRL_ENABLE_TX ,1 ); +rt2x00_set_field32 (®,MAC_SYS_CTRL_ENABLE_RX ,0 ); +rt2800_register_write (rt2x00dev,MAC_SYS_CTRL , reg); + +udelay (50 ); + +rt2800_register_read (rt2x00dev,WPDMA_GLO_CFG , ®); +rt2x00_set_field32 (®,WPDMA_GLO_CFG_ENABLE_TX_DMA ,1 ); +rt2x00_set_field32 (®,WPDMA_GLO_CFG_ENABLE_RX_DMA ,1 ); +rt2x00_set_field32 (®,WPDMA_GLO_CFG_WP_DMA_BURST_SIZE ,2 ); +rt2x00_set_field32 (®,WPDMA_GLO_CFG_TX_WRITEBACK_DONE ,1 ); +rt2800_register_write (rt2x00dev,WPDMA_GLO_CFG , reg); + +rt2800_register_read (rt2x00dev,MAC_SYS_CTRL , ®); +rt2x00_set_field32 (®,MAC_SYS_CTRL_ENABLE_TX ,1 ); +rt2x00_set_field32 (®,MAC_SYS_CTRL_ENABLE_RX ,1 ); +rt2800_register_write (rt2x00dev,MAC_SYS_CTRL , reg); + +/* +* Initialize LED control +*/ +rt2x00_eeprom_read (rt2x00dev,EEPROM_LED1 , &word); +rt2800_mcu_request (rt2x00dev,MCU_LED_1 ,0xff , + word &0xff , (word >>8 ) &0xff ); + +rt2x00_eeprom_read (rt2x00dev,EEPROM_LED2 , &word); +rt2800_mcu_request (rt2x00dev,MCU_LED_2 ,0xff , + word &0xff , (word >>8 ) &0xff ); + +rt2x00_eeprom_read (rt2x00dev,EEPROM_LED3 , &word); +rt2800_mcu_request (rt2x00dev,MCU_LED_3 ,0xff , + word &0xff , (word >>8 ) &0xff ); + +return 0 ; +} +EXPORT_SYMBOL_GPL (rt2800_enable_radio); + +void rt2800_disable_radio (struct rt2x00_dev *rt2x00dev) +{ +u32 reg; + +rt2800_register_read (rt2x00dev,WPDMA_GLO_CFG , ®); +rt2x00_set_field32 (®,WPDMA_GLO_CFG_ENABLE_TX_DMA ,0 ); +rt2x00_set_field32 (®,WPDMA_GLO_CFG_TX_DMA_BUSY ,0 ); +rt2x00_set_field32 (®,WPDMA_GLO_CFG_ENABLE_RX_DMA ,0 ); +rt2x00_set_field32 (®,WPDMA_GLO_CFG_RX_DMA_BUSY ,0 ); +rt2x00_set_field32 (®,WPDMA_GLO_CFG_TX_WRITEBACK_DONE ,1 ); +rt2800_register_write (rt2x00dev,WPDMA_GLO_CFG , reg); + +/* Wait for DMA, ignore error */ +rt2800_wait_wpdma_ready (rt2x00dev); + +rt2800_register_read (rt2x00dev,MAC_SYS_CTRL , ®); +rt2x00_set_field32 (®,MAC_SYS_CTRL_ENABLE_TX ,0 ); +rt2x00_set_field32 (®,MAC_SYS_CTRL_ENABLE_RX ,0 ); +rt2800_register_write (rt2x00dev,MAC_SYS_CTRL , reg); + +rt2800_register_write (rt2x00dev,PWR_PIN_CFG ,0 ); +rt2800_register_write (rt2x00dev,TX_PIN_CFG ,0 ); +} +EXPORT_SYMBOL_GPL (rt2800_disable_radio);int rt2800_efuse_detect (struct rt2x00_dev *rt2x00dev) {
drivers/net/wireless/rt2x00/rt2800lib.h +4 -4
@@ -140,6 +140,8 @@ void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev, const u8 command, const u8 token, const u8 arg0, const u8 arg1); +int rt2800_wait_wpdma_ready (struct rt2x00_dev *rt2x00dev); +int rt2800_check_firmware (struct rt2x00_dev *rt2x00dev,const u8 *data,const size_t len); int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev,
@@ -176,10 +178,8 @@ void rt2800_reset_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual);void rt2800_link_tuner (struct rt2x00_dev *rt2x00dev,struct link_qual *qual,const u32 count); -int rt2800_init_registers (struct rt2x00_dev *rt2x00dev); -int rt2800_init_bbp (struct rt2x00_dev *rt2x00dev); -int rt2800_init_rfcsr (struct rt2x00_dev *rt2x00dev); -int rt2800_wait_wpdma_ready (struct rt2x00_dev *rt2x00dev); +int rt2800_enable_radio (struct rt2x00_dev *rt2x00dev); +void rt2800_disable_radio (struct rt2x00_dev *rt2x00dev);int rt2800_efuse_detect (struct rt2x00_dev *rt2x00dev);void rt2800_read_eeprom_efuse (struct rt2x00_dev *rt2x00dev);
drivers/net/wireless/rt2x00/rt2800pci.c +3 -66
90 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt2800usb.c +3 -69
97 lines not on this page · raw message
Signature · 1 line
1.7.2.1
PATCH 7/8 rt2x00: Fix channel configuration for RF3052
We missed a check for RF3052 in the config_channel configuration function. As a result the channel is not properly configured for RF3052 devices. This also requires rt2800_config_channel_rf3xxx to support 5GHz channels, so we must apply the TXPOWER_A_TO_DEV and TXPOWER_G_TO_DEV conversions during rt2800_config_channel()
--- drivers/net/wireless/rt2x00/rt2800lib.c | 29 ++++++++++++++++------------- 1 files changed, 16 insertions(+), 13 deletions(-)
drivers/net/wireless/rt2x00/rt2800lib.c +16 -13
@@ -1244,8 +1244,7 @@ static void rt2800_config_channel_rf2xxx(struct rt2x00_dev *rt2x00dev,if (info->tx_power1 <0 ) info->tx_power1 +=7 ; -rt2x00_set_field32 (&rf->rf3,RF3_TXPOWER_A , -TXPOWER_A_TO_DEV (info->tx_power1)); +rt2x00_set_field32 (&rf->rf3,RF3_TXPOWER_A , info->tx_power1);rt2x00_set_field32 (&rf->rf4,RF4_TXPOWER_A_7DBM_BOOST , (info->tx_power2 >=0 ));
@@ -1253,13 +1252,10 @@ static void rt2800_config_channel_rf2xxx(struct rt2x00_dev *rt2x00dev,if (info->tx_power2 <0 ) info->tx_power2 +=7 ; -rt2x00_set_field32 (&rf->rf4,RF4_TXPOWER_A , -TXPOWER_A_TO_DEV (info->tx_power2)); +rt2x00_set_field32 (&rf->rf4,RF4_TXPOWER_A , info->tx_power2); }else { -rt2x00_set_field32 (&rf->rf3,RF3_TXPOWER_G , -TXPOWER_G_TO_DEV (info->tx_power1)); -rt2x00_set_field32 (&rf->rf4,RF4_TXPOWER_G , -TXPOWER_G_TO_DEV (info->tx_power2)); +rt2x00_set_field32 (&rf->rf3,RF3_TXPOWER_G , info->tx_power1); +rt2x00_set_field32 (&rf->rf4,RF4_TXPOWER_G , info->tx_power2); }rt2x00_set_field32 (&rf->rf4,RF4_HT40 ,conf_is_ht40 (conf));
@@ -1299,13 +1295,11 @@ static void rt2800_config_channel_rf3xxx(struct rt2x00_dev *rt2x00dev,rt2800_rfcsr_write (rt2x00dev,6 , rfcsr);rt2800_rfcsr_read (rt2x00dev,12 , &rfcsr); -rt2x00_set_field8 (&rfcsr,RFCSR12_TX_POWER , -TXPOWER_G_TO_DEV (info->tx_power1)); +rt2x00_set_field8 (&rfcsr,RFCSR12_TX_POWER , info->tx_power1);rt2800_rfcsr_write (rt2x00dev,12 , rfcsr);rt2800_rfcsr_read (rt2x00dev,13 , &rfcsr); -rt2x00_set_field8 (&rfcsr,RFCSR13_TX_POWER , -TXPOWER_G_TO_DEV (info->tx_power2)); +rt2x00_set_field8 (&rfcsr,RFCSR13_TX_POWER , info->tx_power2);rt2800_rfcsr_write (rt2x00dev,13 , rfcsr);rt2800_rfcsr_read (rt2x00dev,23 , &rfcsr);
@@ -1329,10 +1323,19 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,unsigned int tx_pin;u8 bbp; +if (rf->channel <=14 ) { + info->tx_power1 =TXPOWER_G_TO_DEV (info->tx_power1); + info->tx_power2 =TXPOWER_G_TO_DEV (info->tx_power2); + }else { + info->tx_power1 =TXPOWER_A_TO_DEV (info->tx_power1); + info->tx_power2 =TXPOWER_A_TO_DEV (info->tx_power2); + } +if (rt2x00_rf (rt2x00dev,RF2020 ) ||rt2x00_rf (rt2x00dev,RF3020 ) ||rt2x00_rf (rt2x00dev,RF3021 ) || -rt2x00_rf (rt2x00dev,RF3022 )) +rt2x00_rf (rt2x00dev,RF3022 ) || +rt2x00_rf (rt2x00dev,RF3052 ))rt2800_config_channel_rf3xxx (rt2x00dev, conf, rf, info);else rt2800_config_channel_rf2xxx (rt2x00dev, conf, rf, info);
Signature · 1 line
1.7.2.1
PATCH 8/8 rt2x00: Fix max TX power settings
During initialization each driver reads the default TX power for each individual channel. However mac80211 only accepts the maximum value (which is also handled as default value).
As a result, the TX power of the device was being limited to the default value, which is often quite low compared to the real maximum acceptable value.
This patch allows each driver to set the maximum value on a per-channel basis which is forwarded to mac80211. The default value will be preserved for now, in case we want to update mac80211 to differentiate between the maximum and default txpower.
This fixes bug complaining about limited TX power values like:
https://bugzilla.kernel.org/show_bug.cgi?id=16358
--- drivers/net/wireless/rt2x00/rt2400pci.c | 6 ++- drivers/net/wireless/rt2x00/rt2500pci.c | 12 ++++-- drivers/net/wireless/rt2x00/rt2500usb.c | 12 ++++-- drivers/net/wireless/rt2x00/rt2800.h | 7 +++ drivers/net/wireless/rt2x00/rt2800lib.c | 65 ++++++++++++++++++------------ drivers/net/wireless/rt2x00/rt2x00.h | 5 +- drivers/net/wireless/rt2x00/rt2x00dev.c | 2 +- drivers/net/wireless/rt2x00/rt61pci.c | 12 ++++-- drivers/net/wireless/rt2x00/rt73usb.c | 12 ++++-- 9 files changed, 86 insertions(+), 47 deletions(-)
drivers/net/wireless/rt2x00/rt2400pci.c +4 -2
@@ -1487,8 +1487,10 @@ static int rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) spec->channels_info = info; tx_power =rt2x00_eeprom_addr (rt2x00dev,EEPROM_TXPOWER_START ); -for (i =0 ; i <14 ; i++) - info[i].tx_power1 =TXPOWER_FROM_DEV (tx_power[i]); +for (i =0 ; i <14 ; i++) { + info[i].max_power =TXPOWER_FROM_DEV (MAX_TXPOWER ); + info[i].default_power1 =TXPOWER_FROM_DEV (tx_power[i]); + }return 0 ; }
drivers/net/wireless/rt2x00/rt2500pci.c +8 -4
@@ -1801,12 +1801,16 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) spec->channels_info = info; tx_power =rt2x00_eeprom_addr (rt2x00dev,EEPROM_TXPOWER_START ); -for (i =0 ; i <14 ; i++) - info[i].tx_power1 =TXPOWER_FROM_DEV (tx_power[i]); +for (i =0 ; i <14 ; i++) { + info[i].max_power =MAX_TXPOWER ; + info[i].default_power1 =TXPOWER_FROM_DEV (tx_power[i]); + }if (spec->num_channels >14 ) { -for (i =14 ; i < spec->num_channels; i++) - info[i].tx_power1 =DEFAULT_TXPOWER ; +for (i =14 ; i < spec->num_channels; i++) { + info[i].max_power =MAX_TXPOWER ; + info[i].default_power1 =DEFAULT_TXPOWER ; + } }return 0 ;
drivers/net/wireless/rt2x00/rt2500usb.c +8 -4
@@ -1706,12 +1706,16 @@ static int rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev) spec->channels_info = info; tx_power =rt2x00_eeprom_addr (rt2x00dev,EEPROM_TXPOWER_START ); -for (i =0 ; i <14 ; i++) - info[i].tx_power1 =TXPOWER_FROM_DEV (tx_power[i]); +for (i =0 ; i <14 ; i++) { + info[i].max_power =MAX_TXPOWER ; + info[i].default_power1 =TXPOWER_FROM_DEV (tx_power[i]); + }if (spec->num_channels >14 ) { -for (i =14 ; i < spec->num_channels; i++) - info[i].tx_power1 =DEFAULT_TXPOWER ; +for (i =14 ; i < spec->num_channels; i++) { + info[i].max_power =MAX_TXPOWER ; + info[i].default_power1 =DEFAULT_TXPOWER ; + } }return 0 ;
drivers/net/wireless/rt2x00/rt2800.h +7 -0
@@ -1859,6 +1859,13 @@ struct mac_iveiv_entry {#define EEPROM_RSSI_A2_LNA_A2 FIELD16(0xff00)/* +* EEPROM Maximum TX power values +*/ +#define EEPROM_MAX_TX_POWER 0x0027 +#define EEPROM_MAX_TX_POWER_24GHZ FIELD16(0x00ff) +#define EEPROM_MAX_TX_POWER_5GHZ FIELD16(0xff00) + +/* * EEPROM TXpower delta: 20MHZ AND 40 MHZ use different power. * This is delta in 40MHZ. * VALUE: Tx Power dalta value (MAX=4)
drivers/net/wireless/rt2x00/rt2800lib.c +39 -26
120 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt2x00.h +3 -2
@@ -213,8 +213,9 @@ struct channel_info {unsigned int flags;#define GEOGRAPHY_ALLOWED 0x00000001 -short tx_power1; -short tx_power2; +short max_power; +short default_power1; +short default_power2; };/*
drivers/net/wireless/rt2x00/rt2x00dev.c +1 -1
@@ -711,7 +711,7 @@ static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev,for (i =0 ; i < spec->num_channels; i++) {rt2x00lib_channel (&channels[i], spec->channels[i].channel, - spec->channels_info[i].tx_power1, i); + spec->channels_info[i].max_power, i); }/*
drivers/net/wireless/rt2x00/rt61pci.c +8 -4
@@ -2656,13 +2656,17 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) spec->channels_info = info; tx_power =rt2x00_eeprom_addr (rt2x00dev,EEPROM_TXPOWER_G_START ); -for (i =0 ; i <14 ; i++) - info[i].tx_power1 =TXPOWER_FROM_DEV (tx_power[i]); +for (i =0 ; i <14 ; i++) { + info[i].max_power =MAX_TXPOWER ; + info[i].default_power1 =TXPOWER_FROM_DEV (tx_power[i]); + }if (spec->num_channels >14 ) { tx_power =rt2x00_eeprom_addr (rt2x00dev,EEPROM_TXPOWER_A_START ); -for (i =14 ; i < spec->num_channels; i++) - info[i].tx_power1 =TXPOWER_FROM_DEV (tx_power[i]); +for (i =14 ; i < spec->num_channels; i++) { + info[i].max_power =MAX_TXPOWER ; + info[i].default_power1 =TXPOWER_FROM_DEV (tx_power[i]); + } }return 0 ;
drivers/net/wireless/rt2x00/rt73usb.c +8 -4
@@ -2090,13 +2090,17 @@ static int rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev) spec->channels_info = info; tx_power =rt2x00_eeprom_addr (rt2x00dev,EEPROM_TXPOWER_G_START ); -for (i =0 ; i <14 ; i++) - info[i].tx_power1 =TXPOWER_FROM_DEV (tx_power[i]); +for (i =0 ; i <14 ; i++) { + info[i].max_power =MAX_TXPOWER ; + info[i].default_power1 =TXPOWER_FROM_DEV (tx_power[i]); + }if (spec->num_channels >14 ) { tx_power =rt2x00_eeprom_addr (rt2x00dev,EEPROM_TXPOWER_A_START ); -for (i =14 ; i < spec->num_channels; i++) - info[i].tx_power1 =TXPOWER_FROM_DEV (tx_power[i]); +for (i =14 ; i < spec->num_channels; i++) { + info[i].max_power =MAX_TXPOWER ; + info[i].default_power1 =TXPOWER_FROM_DEV (tx_power[i]); + } }return 0 ;
Signature · 1 line
1.7.2.1