Skip to contentSkip to conversation

rt2x00: Put link tuning on workqueue

PATCH In review Ivo van Doorn 1 participant 1 message Dec 3, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 11/26 rt2x00: Put link tuning on workqueue

Put the link tuning in a workqueue, this prevents the interrupthandlers from being busy for a too long period and blocking new inetrrupt handling.
To do this correctly we add a link structure containing all information regarding the link status.

Signed-off-by Ivo van Doorn <[email protected]>

---

drivers/net/wireless/d80211/rt2x00/rt2400pci.c +24 -12
diff -rU3 wireless-dev-ringindex/drivers/net/wireless/d80211/rt2x00/rt2400pci.c wireless-dev-linktuning/drivers/net/wireless/d80211/rt2x00/rt2400pci.c
@@ -624,12 +624,20 @@
 /*
  * Link tuning
  */
-static void rt2400pci_link_tuner(struct rt2x00_dev *rt2x00dev)
+static void rt2400pci_link_tuner(void *data)
 {
+	struct rt2x00_dev *rt2x00dev = data;
 	u8 reg;
 	char false_cca_delta;
 
 	/*
+	 * Don't perform any tuning when it is disabled
+	 * in the EEPROM.
+	 */
+	if (GET_FLAG(rt2x00dev, CONFIG_DISABLE_LINK_TUNING))
+		return;
+
+	/*
 	 * Read false CCA counter.
 	 */
 	rt2x00_bbp_read(rt2x00dev, 39, &reg);
@@ -653,6 +661,9 @@
 		if (reg < 0x20)
 			rt2x00_bbp_write(rt2x00dev, 13, reg);
 	}
+
+	queue_delayed_work(rt2x00dev->workqueue, &rt2x00dev->link.work,
+		LINK_TUNE_INTERVAL);
 }
 
 /*
@@ -1568,16 +1579,6 @@
 		rt2x00_desc_write(rxd, 0, word0);
 		rt2x00_ring_index_inc(ring);
 	}
-
-	/*
-	 * Tune link for optimal performance.
-	 */
-	rt2400pci_link_tuner(rt2x00dev);
-
-	/*
-	 * Update LED.
-	 */
-	rt2400pci_activity_led(rt2x00dev, 0);
 }
 
 static void rt2400pci_txdone(void *data)
@@ -1885,8 +1886,11 @@
 	 * Enable radio when this is the first
 	 * interface that is brought up.
 	 */
-	if (!GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO))
+	if (!GET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO)) {
+		queue_delayed_work(rt2x00dev->workqueue,
+			&rt2x00dev->link.work, LINK_TUNE_INTERVAL);
 		return rt2400pci_enable_radio(rt2x00dev);
+	}
 
 	return 0;
 }
@@ -1908,6 +1912,9 @@
 	 */
 	rt2x00_remove_interface(&rt2x00dev->interface, conf);
 
+	cancel_rearming_delayed_workqueue(rt2x00dev->workqueue,
+			&rt2x00dev->link.work);
+
 	/*
 	 * When this is a non-monitor mode,
 	 * clear the INTERFACE_INITIALIZED FLAG to allow
@@ -2694,6 +2701,11 @@
 		goto exit;
 
 	/*
+	 * Initialize configuration work.
+	 */
+	INIT_WORK(&rt2x00dev->link.work, rt2400pci_link_tuner, rt2x00dev);
+
+	/*
 	 * Reset current working type.
 	 */
 	rt2x00dev->interface.type = -EINVAL;
drivers/net/wireless/d80211/rt2x00/rt2500pci.c +41 -27

137 lines not on this page · raw message

drivers/net/wireless/d80211/rt2x00/rt2500usb.c +38 -28

139 lines not on this page · raw message

drivers/net/wireless/d80211/rt2x00/rt2x00.h +64 -0

76 lines not on this page · raw message

drivers/net/wireless/d80211/rt2x00/rt61pci.c +48 -28

149 lines not on this page · raw message

drivers/net/wireless/d80211/rt2x00/rt73usb.c +43 -28

149 lines not on this page · raw message