Skip to contentSkip to conversation

rt2x00: Minor optimizazion in txdone path

PATCH New Ivo van Doorn 1 participant 5 messages Sep 7, 2011 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 rt2x00: Minor optimizazion in txdone path

From: Helmut Schaa <[email protected]>

We can save an indirect function call + some instructions for fetching the actual function pointer by passing the driver specific txwi pointer directly from rt2800pci/rt2800usb to rt2800lib instead of using the rt2800_drv_get_txwi callback.

---

 drivers/net/wireless/rt2x00/rt2800lib.c |    4 +---
 drivers/net/wireless/rt2x00/rt2800lib.h |    2 +-
 drivers/net/wireless/rt2x00/rt2800pci.c |    2 +-
 drivers/net/wireless/rt2x00/rt2800usb.c |    3 ++-
 4 files changed, 5 insertions(+), 6 deletions(-)
drivers/net/wireless/rt2x00/rt2800lib.c +1 -3
index 775e996..ba626a9 100644
@@ -601,7 +601,7 @@ void rt2800_process_rxwi(struct queue_entry *entry,
 }
 EXPORT_SYMBOL_GPL(rt2800_process_rxwi);
 
-void rt2800_txdone_entry(struct queue_entry *entry, u32 status)
+void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi)
 {
 	struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
 	struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
@@ -609,13 +609,11 @@ void rt2800_txdone_entry(struct queue_entry *entry, u32 status)
 	u32 word;
 	u16 mcs, real_mcs;
 	int aggr, ampdu;
-	__le32 *txwi;
 
 	/*
 	 * Obtain the status about this packet.
 	 */
 	txdesc.flags = 0;
-	txwi = rt2800_drv_get_txwi(entry);
 	rt2x00_desc_read(txwi, 0, &word);
 
 	mcs = rt2x00_get_field32(word, TXWI_W0_MCS);
drivers/net/wireless/rt2x00/rt2800lib.h +1 -1
index b851847..7a2511f 100644
@@ -152,7 +152,7 @@ void rt2800_write_tx_data(struct queue_entry *entry,
 			  struct txentry_desc *txdesc);
 void rt2800_process_rxwi(struct queue_entry *entry, struct rxdone_entry_desc *txdesc);
 
-void rt2800_txdone_entry(struct queue_entry *entry, u32 status);
+void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32* txwi);
 
 void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc);
 void rt2800_clear_beacon(struct queue_entry *entry);
drivers/net/wireless/rt2x00/rt2800pci.c +1 -1
index 4fd6649..2633628 100644
@@ -760,7 +760,7 @@ static bool rt2800pci_txdone(struct rt2x00_dev *rt2x00dev)
 		}
 
 		entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
-		rt2800_txdone_entry(entry, status);
+		rt2800_txdone_entry(entry, status, rt2800pci_get_txwi(entry));
 
 		if (--max_tx_done == 0)
 			break;
drivers/net/wireless/rt2x00/rt2800usb.c +2 -1
index 42f511b..0015526 100644
@@ -542,7 +542,8 @@ static void rt2800usb_txdone(struct rt2x00_dev *rt2x00dev)
 		}
 
 		if (entry)
-			rt2800_txdone_entry(entry, reg);
+			rt2800_txdone_entry(entry, reg,
+				            rt2800usb_get_txwi(entry));
 	}
 }
 
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH 2/5 rt2x00: Add LED_CFG register description

From: Helmut Schaa <[email protected]>

---
 drivers/net/wireless/rt2x00/rt2800.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/net/wireless/rt2x00/rt2800.h +3 -0
index c69a7d7..4778620 100644
@@ -664,6 +664,9 @@
 
 /*
  * LED_CFG: LED control
+ * ON_PERIOD: LED active time (ms) during TX (only used for LED mode 1)
+ * OFF_PERIOD: LED inactive time (ms) during TX (only used for LED mode 1)
+ * SLOW_BLINK_PERIOD: LED blink interval in seconds (only used for LED mode 2)
  * color LED's:
  *   0: off
  *   1: blinking upon TX2
Signature · 1 line
1.7.3.4
#2 lore raw

PATCH 3/5 rt2x00: Remove incorrect led blink

From: Helmut Schaa <[email protected]>

rt2800 devices are not capable of configuring arbitrary LED on/off periods. The LED_CFG register fields ON_PERIOD and OFF_PERIOD are only used by the hw when the LED mode is set to "blink upon TX".

Hence, remove the blink callback. This will result in software emulation for LED blinking.

---
 drivers/net/wireless/rt2x00/rt2800lib.c |   16 ----------------
 1 files changed, 0 insertions(+), 16 deletions(-)
drivers/net/wireless/rt2x00/rt2800lib.c +0 -16
index ba626a9..877b1e7 100644
@@ -897,28 +897,12 @@ static void rt2800_brightness_set(struct led_classdev *led_cdev,
 	}
 }
 
-static int rt2800_blink_set(struct led_classdev *led_cdev,
-			    unsigned long *delay_on, unsigned long *delay_off)
-{
-	struct rt2x00_led *led =
-	    container_of(led_cdev, struct rt2x00_led, led_dev);
-	u32 reg;
-
-	rt2800_register_read(led->rt2x00dev, LED_CFG, &reg);
-	rt2x00_set_field32(&reg, LED_CFG_ON_PERIOD, *delay_on);
-	rt2x00_set_field32(&reg, LED_CFG_OFF_PERIOD, *delay_off);
-	rt2800_register_write(led->rt2x00dev, LED_CFG, reg);
-
-	return 0;
-}
-
 static void rt2800_init_led(struct rt2x00_dev *rt2x00dev,
 		     struct rt2x00_led *led, enum led_type type)
 {
 	led->rt2x00dev = rt2x00dev;
 	led->type = type;
 	led->led_dev.brightness_set = rt2800_brightness_set;
-	led->led_dev.blink_set = rt2800_blink_set;
 	led->flags = LED_INITIALIZED;
 }
 #endif /* CONFIG_RT2X00_LIB_LEDS */
Signature · 1 line
1.7.3.4
#3 lore raw

PATCH 4/5 rt2x00: Update some TX descriptor

From: Helmut Schaa <[email protected]>

---
 drivers/net/wireless/rt2x00/rt2x00queue.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/rt2x00/rt2x00queue.h +2 -2
index d448f5c..349008d 100644
@@ -288,8 +288,8 @@ enum txentry_desc_flags {
  * @signal: PLCP signal.
  * @service: PLCP service.
  * @msc: MCS.
- * @stbc: STBC.
- * @ba_size: BA size.
+ * @stbc: Use Space Time Block Coding (only available for MCS rates < 8).
+ * @ba_size: Size of the recepients RX reorder buffer - 1.
  * @rate_mode: Rate mode (See @enum rate_modulation).
  * @mpdu_density: MDPU density.
  * @retry_limit: Max number of retries.
Signature · 1 line
1.7.3.4
#4 lore raw

PATCH 5/5 rt2x00: Avoid unnecessary uncached

From: Helmut Schaa <[email protected]>

Reading the TX desciptor words from coherent memory is always uncached and potentially slow. Hence, don't read the TX descriptor prior to writing it since we update all fields anyway.

---

 drivers/net/wireless/rt2x00/rt2800pci.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/rt2x00/rt2800pci.c +4 -4
index 2633628..e0493fb 100644
@@ -619,11 +619,11 @@ static void rt2800pci_write_tx_desc(struct queue_entry *entry,
 	/*
 	 * Initialize TX descriptor
 	 */
-	rt2x00_desc_read(txd, 0, &word);
+	word = 0;
 	rt2x00_set_field32(&word, TXD_W0_SD_PTR0, skbdesc->skb_dma);
 	rt2x00_desc_write(txd, 0, word);
 
-	rt2x00_desc_read(txd, 1, &word);
+	word = 0;
 	rt2x00_set_field32(&word, TXD_W1_SD_LEN1, entry->skb->len);
 	rt2x00_set_field32(&word, TXD_W1_LAST_SEC1,
 			   !test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags));
@@ -634,12 +634,12 @@ static void rt2800pci_write_tx_desc(struct queue_entry *entry,
 	rt2x00_set_field32(&word, TXD_W1_DMA_DONE, 0);
 	rt2x00_desc_write(txd, 1, word);
 
-	rt2x00_desc_read(txd, 2, &word);
+	word = 0;
 	rt2x00_set_field32(&word, TXD_W2_SD_PTR1,
 			   skbdesc->skb_dma + TXWI_DESC_SIZE);
 	rt2x00_desc_write(txd, 2, word);
 
-	rt2x00_desc_read(txd, 3, &word);
+	word = 0;
 	rt2x00_set_field32(&word, TXD_W3_WIV,
 			   !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags));
 	rt2x00_set_field32(&word, TXD_W3_QSEL, 2);
Signature · 1 line
1.7.3.4