Skip to contentSkip to conversation

Assorted fixes and cleanups for rt2x00 and mac80211.

PATCH In review Gertjan van Wingerde 7 participants 32 messages Nov 23, 2009 – Dec 22, 2009

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

v2 cover Assorted fixes and cleanups for rt2x00 and mac80211.

The following patch series contains a list of fixes and cleanups for rt2x00. Also included is a fix for mac80211 that fixes the insufficient headroom bug reported by David Ellingsworth.

v2:
Handle review comments from Julian, Johannes and Ivo. Split up patch 5 of first version in 3 different parts.

[PATCH v2 1/8] rt2x00: Only initialize HT on rt2800 devices that support it. [PATCH v2 2/8] rt2x00: Remove unused variable frame_control from rt2x00mac_tx. [PATCH v2 3/8] rt2x00: Clean up use of rt2x00_intf_is_pci.
[PATCH v2 4/8] rt2x00: Fix typo (lengt --> length) in rt2x00queue.c [PATCH v2 5/8] rt2x00: Whitespace cleanup.
[PATCH v2 6/8] rt2x00: Centralize setting of extra TX headroom requested by rt2x00. [PATCH v2 7/8] mac80211: Add define for TX headroom reserved by mac80211 itself. [PATCH v2 8/8] rt2x00: Properly request tx headroom for alignment operations.

---
Gertjan.

#1 lore raw

PATCH v2 1/8 rt2x00: Only initialize HT on rt2800 devices that support it.

Some RT28xx/RT30xx devices don't support 802.11n, when they are combined with the RF2020 chipset. Ensure that HT is disabled for these devices.

---
 drivers/net/wireless/rt2x00/rt2800lib.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2800lib.c +5 -1
index e94f1e1..fcd0c88 100644
@@ -2072,7 +2072,11 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 	/*
 	 * Initialize HT information.
 	 */
-	spec->ht.ht_supported = true;
+	if (!rt2x00_rf(chip, RF2020))
+		spec->ht.ht_supported = true;
+	else
+		spec->ht.ht_supported = false;
+
 	spec->ht.cap =
 	    IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
 	    IEEE80211_HT_CAP_GRN_FLD |
Signature · 1 line
1.6.5.3
#2 lore raw

PATCH v2 2/8 rt2x00: Remove unused variable frame_control from rt2x00mac_tx.

As additional fallout also remove the also unused variable ieee80211hdr.

---
 drivers/net/wireless/rt2x00/rt2x00mac.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/net/wireless/rt2x00/rt2x00mac.c +0 -3
index 9c90ceb..de549c2 100644
@@ -103,10 +103,8 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
 {
 	struct rt2x00_dev *rt2x00dev = hw->priv;
 	struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
-	struct ieee80211_hdr *ieee80211hdr = (struct ieee80211_hdr *)skb->data;
 	enum data_queue_qid qid = skb_get_queue_mapping(skb);
 	struct data_queue *queue;
-	u16 frame_control;
 
 	/*
 	 * Mac80211 might be calling this function while we are trying
@@ -141,7 +139,6 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
 	 * either RTS or CTS-to-self frame and handles everything
 	 * inside the hardware.
 	 */
-	frame_control = le16_to_cpu(ieee80211hdr->frame_control);
 	if ((tx_info->control.rates[0].flags & (IEEE80211_TX_RC_USE_RTS_CTS |
 						IEEE80211_TX_RC_USE_CTS_PROTECT)) &&
 	    !rt2x00dev->ops->hw->set_rts_threshold) {
Signature · 1 line
1.6.5.3
#3 lore raw

PATCH v2 3/8 rt2x00: Clean up use of rt2x00_intf_is_pci.

RT chipsets are unique across both PCI and USB busses, and don't overlap. Therefore there is no need to test for bus type when only checking for chipset type. Remove the redundant checks.

---
 drivers/net/wireless/rt2x00/rt2800lib.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)
drivers/net/wireless/rt2x00/rt2800lib.c +7 -10
index fcd0c88..02ffcf5 100644
@@ -217,14 +217,12 @@ void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev,
 {
 	u32 reg;
 
-	if (rt2x00_intf_is_pci(rt2x00dev)) {
-		/*
-		* RT2880 and RT3052 don't support MCU requests.
-		*/
-		if (rt2x00_rt(&rt2x00dev->chip, RT2880) ||
-		    rt2x00_rt(&rt2x00dev->chip, RT3052))
-			return;
-	}
+	/*
+	 * RT2880 and RT3052 don't support MCU requests.
+	 */
+	if (rt2x00_rt(&rt2x00dev->chip, RT2880) ||
+	    rt2x00_rt(&rt2x00dev->chip, RT3052))
+		return;
 
 	mutex_lock(&rt2x00dev->csr_mutex);
 
@@ -1482,8 +1480,7 @@ int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)
 		rt2800_bbp_write(rt2x00dev, 105, 0x05);
 	}
 
-	if (rt2x00_intf_is_pci(rt2x00dev) &&
-	    rt2x00_rt(&rt2x00dev->chip, RT3052)) {
+	if (rt2x00_rt(&rt2x00dev->chip, RT3052)) {
 		rt2800_bbp_write(rt2x00dev, 31, 0x08);
 		rt2800_bbp_write(rt2x00dev, 78, 0x0e);
 		rt2800_bbp_write(rt2x00dev, 80, 0x08);
Signature · 1 line
1.6.5.3
#4 lore raw

PATCH v2 4/8 rt2x00: Fix typo (lengt --> length) in rt2x00queue.c

---
 drivers/net/wireless/rt2x00/rt2x00queue.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/rt2x00/rt2x00queue.c +2 -2
index eaedee8..32d4aea 100644
@@ -162,10 +162,10 @@ void rt2x00queue_align_frame(struct sk_buff *skb)
 	skb_trim(skb, frame_length);
 }
 
-void rt2x00queue_align_payload(struct sk_buff *skb, unsigned int header_lengt)
+void rt2x00queue_align_payload(struct sk_buff *skb, unsigned int header_length)
 {
 	unsigned int frame_length = skb->len;
-	unsigned int align = ALIGN_SIZE(skb, header_lengt);
+	unsigned int align = ALIGN_SIZE(skb, header_length);
 
 	if (!align)
 		return;
Signature · 1 line
1.6.5.3
#5 lore raw

PATCH v2 5/8 rt2x00: Whitespace cleanup.

Clean up the use of whitespace in the initialization of the rt2x00_ops structures. This is preparatory for a later patch that adds members to that structure, which require different whitespace alignment.

---
 drivers/net/wireless/rt2x00/rt2400pci.c |   26 +++++++++++++-------------
 drivers/net/wireless/rt2x00/rt2500pci.c |   26 +++++++++++++-------------
 drivers/net/wireless/rt2x00/rt2500usb.c |   26 +++++++++++++-------------
 drivers/net/wireless/rt2x00/rt2800pci.c |   24 ++++++++++++------------
 drivers/net/wireless/rt2x00/rt2800usb.c |   24 ++++++++++++------------
 drivers/net/wireless/rt2x00/rt61pci.c   |   24 ++++++++++++------------
 drivers/net/wireless/rt2x00/rt73usb.c   |   24 ++++++++++++------------
 7 files changed, 87 insertions(+), 87 deletions(-)
drivers/net/wireless/rt2x00/rt2400pci.c +13 -13
index 6e68bc7..7f900be 100644
@@ -1623,20 +1623,20 @@ static const struct data_queue_desc rt2400pci_queue_atim = {
 };
 
 static const struct rt2x00_ops rt2400pci_ops = {
-	.name		= KBUILD_MODNAME,
-	.max_sta_intf	= 1,
-	.max_ap_intf	= 1,
-	.eeprom_size	= EEPROM_SIZE,
-	.rf_size	= RF_SIZE,
-	.tx_queues	= NUM_TX_QUEUES,
-	.rx		= &rt2400pci_queue_rx,
-	.tx		= &rt2400pci_queue_tx,
-	.bcn		= &rt2400pci_queue_bcn,
-	.atim		= &rt2400pci_queue_atim,
-	.lib		= &rt2400pci_rt2x00_ops,
-	.hw		= &rt2400pci_mac80211_ops,
+	.name			= KBUILD_MODNAME,
+	.max_sta_intf		= 1,
+	.max_ap_intf		= 1,
+	.eeprom_size		= EEPROM_SIZE,
+	.rf_size		= RF_SIZE,
+	.tx_queues		= NUM_TX_QUEUES,
+	.rx			= &rt2400pci_queue_rx,
+	.tx			= &rt2400pci_queue_tx,
+	.bcn			= &rt2400pci_queue_bcn,
+	.atim			= &rt2400pci_queue_atim,
+	.lib			= &rt2400pci_rt2x00_ops,
+	.hw			= &rt2400pci_mac80211_ops,
 #ifdef CONFIG_RT2X00_LIB_DEBUGFS
-	.debugfs	= &rt2400pci_rt2x00debug,
+	.debugfs		= &rt2400pci_rt2x00debug,
 #endif /* CONFIG_RT2X00_LIB_DEBUGFS */
 };
 
drivers/net/wireless/rt2x00/rt2500pci.c +13 -13
index 9a31e5e..30960fd 100644
@@ -1922,20 +1922,20 @@ static const struct data_queue_desc rt2500pci_queue_atim = {
 };
 
 static const struct rt2x00_ops rt2500pci_ops = {
-	.name		= KBUILD_MODNAME,
-	.max_sta_intf	= 1,
-	.max_ap_intf	= 1,
-	.eeprom_size	= EEPROM_SIZE,
-	.rf_size	= RF_SIZE,
-	.tx_queues	= NUM_TX_QUEUES,
-	.rx		= &rt2500pci_queue_rx,
-	.tx		= &rt2500pci_queue_tx,
-	.bcn		= &rt2500pci_queue_bcn,
-	.atim		= &rt2500pci_queue_atim,
-	.lib		= &rt2500pci_rt2x00_ops,
-	.hw		= &rt2500pci_mac80211_ops,
+	.name			= KBUILD_MODNAME,
+	.max_sta_intf		= 1,
+	.max_ap_intf		= 1,
+	.eeprom_size		= EEPROM_SIZE,
+	.rf_size		= RF_SIZE,
+	.tx_queues		= NUM_TX_QUEUES,
+	.rx			= &rt2500pci_queue_rx,
+	.tx			= &rt2500pci_queue_tx,
+	.bcn			= &rt2500pci_queue_bcn,
+	.atim			= &rt2500pci_queue_atim,
+	.lib			= &rt2500pci_rt2x00_ops,
+	.hw			= &rt2500pci_mac80211_ops,
 #ifdef CONFIG_RT2X00_LIB_DEBUGFS
-	.debugfs	= &rt2500pci_rt2x00debug,
+	.debugfs		= &rt2500pci_rt2x00debug,
 #endif /* CONFIG_RT2X00_LIB_DEBUGFS */
 };
 
drivers/net/wireless/rt2x00/rt2500usb.c +13 -13
index b2de43e..02290f6 100644
@@ -1823,20 +1823,20 @@ static const struct data_queue_desc rt2500usb_queue_atim = {
 };
 
 static const struct rt2x00_ops rt2500usb_ops = {
-	.name		= KBUILD_MODNAME,
-	.max_sta_intf	= 1,
-	.max_ap_intf	= 1,
-	.eeprom_size	= EEPROM_SIZE,
-	.rf_size	= RF_SIZE,
-	.tx_queues	= NUM_TX_QUEUES,
-	.rx		= &rt2500usb_queue_rx,
-	.tx		= &rt2500usb_queue_tx,
-	.bcn		= &rt2500usb_queue_bcn,
-	.atim		= &rt2500usb_queue_atim,
-	.lib		= &rt2500usb_rt2x00_ops,
-	.hw		= &rt2500usb_mac80211_ops,
+	.name			= KBUILD_MODNAME,
+	.max_sta_intf		= 1,
+	.max_ap_intf		= 1,
+	.eeprom_size		= EEPROM_SIZE,
+	.rf_size		= RF_SIZE,
+	.tx_queues		= NUM_TX_QUEUES,
+	.rx			= &rt2500usb_queue_rx,
+	.tx			= &rt2500usb_queue_tx,
+	.bcn			= &rt2500usb_queue_bcn,
+	.atim			= &rt2500usb_queue_atim,
+	.lib			= &rt2500usb_rt2x00_ops,
+	.hw			= &rt2500usb_mac80211_ops,
 #ifdef CONFIG_RT2X00_LIB_DEBUGFS
-	.debugfs	= &rt2500usb_rt2x00debug,
+	.debugfs		= &rt2500usb_rt2x00debug,
 #endif /* CONFIG_RT2X00_LIB_DEBUGFS */
 };
 
drivers/net/wireless/rt2x00/rt2800pci.c +12 -12
index 87a5094..029a45f 100644
@@ -1201,19 +1201,19 @@ static const struct data_queue_desc rt2800pci_queue_bcn = {
 };
 
 static const struct rt2x00_ops rt2800pci_ops = {
-	.name		= KBUILD_MODNAME,
-	.max_sta_intf	= 1,
-	.max_ap_intf	= 8,
-	.eeprom_size	= EEPROM_SIZE,
-	.rf_size	= RF_SIZE,
-	.tx_queues	= NUM_TX_QUEUES,
-	.rx		= &rt2800pci_queue_rx,
-	.tx		= &rt2800pci_queue_tx,
-	.bcn		= &rt2800pci_queue_bcn,
-	.lib		= &rt2800pci_rt2x00_ops,
-	.hw		= &rt2800_mac80211_ops,
+	.name			= KBUILD_MODNAME,
+	.max_sta_intf		= 1,
+	.max_ap_intf		= 8,
+	.eeprom_size		= EEPROM_SIZE,
+	.rf_size		= RF_SIZE,
+	.tx_queues		= NUM_TX_QUEUES,
+	.rx			= &rt2800pci_queue_rx,
+	.tx			= &rt2800pci_queue_tx,
+	.bcn			= &rt2800pci_queue_bcn,
+	.lib			= &rt2800pci_rt2x00_ops,
+	.hw			= &rt2800_mac80211_ops,
 #ifdef CONFIG_RT2X00_LIB_DEBUGFS
-	.debugfs	= &rt2800_rt2x00debug,
+	.debugfs		= &rt2800_rt2x00debug,
 #endif /* CONFIG_RT2X00_LIB_DEBUGFS */
 };
 
drivers/net/wireless/rt2x00/rt2800usb.c +12 -12
index 9ab15c4..208316a 100644
@@ -790,19 +790,19 @@ static const struct data_queue_desc rt2800usb_queue_bcn = {
 };
 
 static const struct rt2x00_ops rt2800usb_ops = {
-	.name		= KBUILD_MODNAME,
-	.max_sta_intf	= 1,
-	.max_ap_intf	= 8,
-	.eeprom_size	= EEPROM_SIZE,
-	.rf_size	= RF_SIZE,
-	.tx_queues	= NUM_TX_QUEUES,
-	.rx		= &rt2800usb_queue_rx,
-	.tx		= &rt2800usb_queue_tx,
-	.bcn		= &rt2800usb_queue_bcn,
-	.lib		= &rt2800usb_rt2x00_ops,
-	.hw		= &rt2800_mac80211_ops,
+	.name			= KBUILD_MODNAME,
+	.max_sta_intf		= 1,
+	.max_ap_intf		= 8,
+	.eeprom_size		= EEPROM_SIZE,
+	.rf_size		= RF_SIZE,
+	.tx_queues		= NUM_TX_QUEUES,
+	.rx			= &rt2800usb_queue_rx,
+	.tx			= &rt2800usb_queue_tx,
+	.bcn			= &rt2800usb_queue_bcn,
+	.lib			= &rt2800usb_rt2x00_ops,
+	.hw			= &rt2800_mac80211_ops,
 #ifdef CONFIG_RT2X00_LIB_DEBUGFS
-	.debugfs	= &rt2800_rt2x00debug,
+	.debugfs		= &rt2800_rt2x00debug,
 #endif /* CONFIG_RT2X00_LIB_DEBUGFS */
 };
 
drivers/net/wireless/rt2x00/rt61pci.c +12 -12
index bf04605..4cb9afe 100644
@@ -2788,19 +2788,19 @@ static const struct data_queue_desc rt61pci_queue_bcn = {
 };
 
 static const struct rt2x00_ops rt61pci_ops = {
-	.name		= KBUILD_MODNAME,
-	.max_sta_intf	= 1,
-	.max_ap_intf	= 4,
-	.eeprom_size	= EEPROM_SIZE,
-	.rf_size	= RF_SIZE,
-	.tx_queues	= NUM_TX_QUEUES,
-	.rx		= &rt61pci_queue_rx,
-	.tx		= &rt61pci_queue_tx,
-	.bcn		= &rt61pci_queue_bcn,
-	.lib		= &rt61pci_rt2x00_ops,
-	.hw		= &rt61pci_mac80211_ops,
+	.name			= KBUILD_MODNAME,
+	.max_sta_intf		= 1,
+	.max_ap_intf		= 4,
+	.eeprom_size		= EEPROM_SIZE,
+	.rf_size		= RF_SIZE,
+	.tx_queues		= NUM_TX_QUEUES,
+	.rx			= &rt61pci_queue_rx,
+	.tx			= &rt61pci_queue_tx,
+	.bcn			= &rt61pci_queue_bcn,
+	.lib			= &rt61pci_rt2x00_ops,
+	.hw			= &rt61pci_mac80211_ops,
 #ifdef CONFIG_RT2X00_LIB_DEBUGFS
-	.debugfs	= &rt61pci_rt2x00debug,
+	.debugfs		= &rt61pci_rt2x00debug,
 #endif /* CONFIG_RT2X00_LIB_DEBUGFS */
 };
 
drivers/net/wireless/rt2x00/rt73usb.c +12 -12
index 5bbcf66..d13a051 100644
@@ -2306,19 +2306,19 @@ static const struct data_queue_desc rt73usb_queue_bcn = {
 };
 
 static const struct rt2x00_ops rt73usb_ops = {
-	.name		= KBUILD_MODNAME,
-	.max_sta_intf	= 1,
-	.max_ap_intf	= 4,
-	.eeprom_size	= EEPROM_SIZE,
-	.rf_size	= RF_SIZE,
-	.tx_queues	= NUM_TX_QUEUES,
-	.rx		= &rt73usb_queue_rx,
-	.tx		= &rt73usb_queue_tx,
-	.bcn		= &rt73usb_queue_bcn,
-	.lib		= &rt73usb_rt2x00_ops,
-	.hw		= &rt73usb_mac80211_ops,
+	.name			= KBUILD_MODNAME,
+	.max_sta_intf		= 1,
+	.max_ap_intf		= 4,
+	.eeprom_size		= EEPROM_SIZE,
+	.rf_size		= RF_SIZE,
+	.tx_queues		= NUM_TX_QUEUES,
+	.rx			= &rt73usb_queue_rx,
+	.tx			= &rt73usb_queue_tx,
+	.bcn			= &rt73usb_queue_bcn,
+	.lib			= &rt73usb_rt2x00_ops,
+	.hw			= &rt73usb_mac80211_ops,
 #ifdef CONFIG_RT2X00_LIB_DEBUGFS
-	.debugfs	= &rt73usb_rt2x00debug,
+	.debugfs		= &rt73usb_rt2x00debug,
 #endif /* CONFIG_RT2X00_LIB_DEBUGFS */
 };
 
Signature · 1 line
1.6.5.3
#6 lore raw

PATCH v2 6/8 rt2x00: Centralize setting of extra TX headroom requested by rt2x00.

Set the value of extra_tx_headroom in a central place, rather than in each of the drivers. This is preparatory for taking alignment space into account in the TX headroom requested by rt2x00.

---
 drivers/net/wireless/rt2x00/rt2400pci.c |    2 +-
 drivers/net/wireless/rt2x00/rt2500pci.c |    3 +--
 drivers/net/wireless/rt2x00/rt2500usb.c |    3 +--
 drivers/net/wireless/rt2x00/rt2800lib.c |    6 ------
 drivers/net/wireless/rt2x00/rt2800pci.c |    7 ++++---
 drivers/net/wireless/rt2x00/rt2800usb.c |    1 +
 drivers/net/wireless/rt2x00/rt2x00.h    |    1 +
 drivers/net/wireless/rt2x00/rt2x00dev.c |    5 +++++
 drivers/net/wireless/rt2x00/rt61pci.c   |    2 +-
 drivers/net/wireless/rt2x00/rt73usb.c   |    2 +-
 10 files changed, 16 insertions(+), 16 deletions(-)
drivers/net/wireless/rt2x00/rt2400pci.c +1 -1
index 7f900be..e7f4640 100644
@@ -1432,7 +1432,6 @@ static int rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 			       IEEE80211_HW_SIGNAL_DBM |
 			       IEEE80211_HW_SUPPORTS_PS |
 			       IEEE80211_HW_PS_NULLFUNC_STACK;
-	rt2x00dev->hw->extra_tx_headroom = 0;
 
 	SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
 	SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
@@ -1629,6 +1628,7 @@ static const struct rt2x00_ops rt2400pci_ops = {
 	.eeprom_size		= EEPROM_SIZE,
 	.rf_size		= RF_SIZE,
 	.tx_queues		= NUM_TX_QUEUES,
+	.extra_tx_headroom	= 0,
 	.rx			= &rt2400pci_queue_rx,
 	.tx			= &rt2400pci_queue_tx,
 	.bcn			= &rt2400pci_queue_bcn,
drivers/net/wireless/rt2x00/rt2500pci.c +1 -2
index 30960fd..408fcfc 100644
@@ -1733,8 +1733,6 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 			       IEEE80211_HW_SUPPORTS_PS |
 			       IEEE80211_HW_PS_NULLFUNC_STACK;
 
-	rt2x00dev->hw->extra_tx_headroom = 0;
-
 	SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
 	SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
 				rt2x00_eeprom_addr(rt2x00dev,
@@ -1928,6 +1926,7 @@ static const struct rt2x00_ops rt2500pci_ops = {
 	.eeprom_size		= EEPROM_SIZE,
 	.rf_size		= RF_SIZE,
 	.tx_queues		= NUM_TX_QUEUES,
+	.extra_tx_headroom	= 0,
 	.rx			= &rt2500pci_queue_rx,
 	.tx			= &rt2500pci_queue_tx,
 	.bcn			= &rt2500pci_queue_bcn,
drivers/net/wireless/rt2x00/rt2500usb.c +1 -2
index 02290f6..83f2592 100644
@@ -1656,8 +1656,6 @@ static int rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 	    IEEE80211_HW_SUPPORTS_PS |
 	    IEEE80211_HW_PS_NULLFUNC_STACK;
 
-	rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE;
-
 	SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
 	SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
 				rt2x00_eeprom_addr(rt2x00dev,
@@ -1829,6 +1827,7 @@ static const struct rt2x00_ops rt2500usb_ops = {
 	.eeprom_size		= EEPROM_SIZE,
 	.rf_size		= RF_SIZE,
 	.tx_queues		= NUM_TX_QUEUES,
+	.extra_tx_headroom	= TXD_DESC_SIZE,
 	.rx			= &rt2500usb_queue_rx,
 	.tx			= &rt2500usb_queue_tx,
 	.bcn			= &rt2500usb_queue_bcn,
drivers/net/wireless/rt2x00/rt2800lib.c +0 -6
index 02ffcf5..eb1e1d0 100644
@@ -2030,12 +2030,6 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 	    IEEE80211_HW_SUPPORTS_PS |
 	    IEEE80211_HW_PS_NULLFUNC_STACK;
 
-	if (rt2x00_intf_is_usb(rt2x00dev))
-		rt2x00dev->hw->extra_tx_headroom =
-			TXINFO_DESC_SIZE + TXWI_DESC_SIZE;
-	else if (rt2x00_intf_is_pci(rt2x00dev))
-		rt2x00dev->hw->extra_tx_headroom = TXWI_DESC_SIZE;
-
 	SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
 	SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
 				rt2x00_eeprom_addr(rt2x00dev,
drivers/net/wireless/rt2x00/rt2800pci.c +4 -3
index 029a45f..dfc886f 100644
@@ -652,7 +652,7 @@ static void rt2800pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
 {
 	struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb);
 	__le32 *txd = skbdesc->desc;
-	__le32 *txwi = (__le32 *)(skb->data - rt2x00dev->hw->extra_tx_headroom);
+	__le32 *txwi = (__le32 *)(skb->data - rt2x00dev->ops->extra_tx_headroom);
 	u32 word;
 
 	/*
@@ -725,14 +725,14 @@ static void rt2800pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
 	rt2x00_set_field32(&word, TXD_W1_BURST,
 			   test_bit(ENTRY_TXD_BURST, &txdesc->flags));
 	rt2x00_set_field32(&word, TXD_W1_SD_LEN0,
-			   rt2x00dev->hw->extra_tx_headroom);
+			   rt2x00dev->ops->extra_tx_headroom);
 	rt2x00_set_field32(&word, TXD_W1_LAST_SEC0, 0);
 	rt2x00_set_field32(&word, TXD_W1_DMA_DONE, 0);
 	rt2x00_desc_write(txd, 1, word);
 
 	rt2x00_desc_read(txd, 2, &word);
 	rt2x00_set_field32(&word, TXD_W2_SD_PTR1,
-			   skbdesc->skb_dma + rt2x00dev->hw->extra_tx_headroom);
+			   skbdesc->skb_dma + rt2x00dev->ops->extra_tx_headroom);
 	rt2x00_desc_write(txd, 2, word);
 
 	rt2x00_desc_read(txd, 3, &word);
@@ -1207,6 +1207,7 @@ static const struct rt2x00_ops rt2800pci_ops = {
 	.eeprom_size		= EEPROM_SIZE,
 	.rf_size		= RF_SIZE,
 	.tx_queues		= NUM_TX_QUEUES,
+	.extra_tx_headroom	= TXWI_DESC_SIZE,
 	.rx			= &rt2800pci_queue_rx,
 	.tx			= &rt2800pci_queue_tx,
 	.bcn			= &rt2800pci_queue_bcn,
drivers/net/wireless/rt2x00/rt2800usb.c +1 -0
index 208316a..af85d18 100644
@@ -796,6 +796,7 @@ static const struct rt2x00_ops rt2800usb_ops = {
 	.eeprom_size		= EEPROM_SIZE,
 	.rf_size		= RF_SIZE,
 	.tx_queues		= NUM_TX_QUEUES,
+	.extra_tx_headroom	= TXINFO_DESC_SIZE + TXWI_DESC_SIZE,
 	.rx			= &rt2800usb_queue_rx,
 	.tx			= &rt2800usb_queue_tx,
 	.bcn			= &rt2800usb_queue_bcn,
drivers/net/wireless/rt2x00/rt2x00.h +1 -0
index 1cbb7ac..4d841c0 100644
@@ -588,6 +588,7 @@ struct rt2x00_ops {
 	const unsigned int eeprom_size;
 	const unsigned int rf_size;
 	const unsigned int tx_queues;
+	const unsigned int extra_tx_headroom;
 	const struct data_queue_desc *rx;
 	const struct data_queue_desc *tx;
 	const struct data_queue_desc *bcn;
drivers/net/wireless/rt2x00/rt2x00dev.c +5 -0
index 4a4b7e4..06c43ca 100644
@@ -684,6 +684,11 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev)
 	rt2x00dev->hw->queues = rt2x00dev->ops->tx_queues;
 
 	/*
+	 * Initialize extra TX headroom required.
+	 */
+	rt2x00dev->hw->extra_tx_headroom = rt2x00dev->ops->extra_tx_headroom;
+
+	/*
 	 * Register HW.
 	 */
 	status = ieee80211_register_hw(rt2x00dev->hw);
drivers/net/wireless/rt2x00/rt61pci.c +1 -1
index 4cb9afe..687e17d 100644
@@ -2546,7 +2546,6 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 	    IEEE80211_HW_SIGNAL_DBM |
 	    IEEE80211_HW_SUPPORTS_PS |
 	    IEEE80211_HW_PS_NULLFUNC_STACK;
-	rt2x00dev->hw->extra_tx_headroom = 0;
 
 	SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
 	SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
@@ -2794,6 +2793,7 @@ static const struct rt2x00_ops rt61pci_ops = {
 	.eeprom_size		= EEPROM_SIZE,
 	.rf_size		= RF_SIZE,
 	.tx_queues		= NUM_TX_QUEUES,
+	.extra_tx_headroom	= 0,
 	.rx			= &rt61pci_queue_rx,
 	.tx			= &rt61pci_queue_tx,
 	.bcn			= &rt61pci_queue_bcn,
drivers/net/wireless/rt2x00/rt73usb.c +1 -1
index d13a051..ced3b6a 100644
@@ -2069,7 +2069,6 @@ static int rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 	    IEEE80211_HW_SIGNAL_DBM |
 	    IEEE80211_HW_SUPPORTS_PS |
 	    IEEE80211_HW_PS_NULLFUNC_STACK;
-	rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE;
 
 	SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
 	SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
@@ -2312,6 +2311,7 @@ static const struct rt2x00_ops rt73usb_ops = {
 	.eeprom_size		= EEPROM_SIZE,
 	.rf_size		= RF_SIZE,
 	.tx_queues		= NUM_TX_QUEUES,
+	.extra_tx_headroom	= TXD_DESC_SIZE,
 	.rx			= &rt73usb_queue_rx,
 	.tx			= &rt73usb_queue_tx,
 	.bcn			= &rt73usb_queue_bcn,
Signature · 1 line
1.6.5.3
#7 lore raw

PATCH v2 7/8 mac80211: Add define for TX headroom reserved by mac80211 itself.

Add a definition of the amount of TX headroom reserved by mac80211 itself for its own purposes. Also add BUILD_BUG_ON to validate the value. This define can then be used by drivers to request additional TX headroom in the most efficient manner.

---
 include/net/mac80211.h |    6 ++++++
 net/mac80211/main.c    |    2 ++
 2 files changed, 8 insertions(+), 0 deletions(-)
include/net/mac80211.h +6 -0
index 3754ea4..a113458 100644
@@ -1727,6 +1727,12 @@ static inline void ieee80211_rx_ni(struct ieee80211_hw *hw,
 	local_bh_enable();
 }
 
+/*
+ * The TX headroom reserved by mac80211 for its own tx_status functions.
+ * This is enough for the radiotap header.
+ */
+#define IEEE80211_TX_STATUS_HEADROOM	13
+
 /**
  * ieee80211_tx_status - transmit status callback
  *
net/mac80211/main.c +2 -0
index dd8ec8d..f35d4aa 100644
@@ -515,6 +515,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
 	 * and we need some headroom for passing the frame to monitor
 	 * interfaces, but never both at the same time.
 	 */
+	BUILD_BUG_ON(IEEE80211_TX_STATUS_HEADROOM !=
+			sizeof(struct ieee80211_tx_status_rtap_hdr));
 	local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom,
 				   sizeof(struct ieee80211_tx_status_rtap_hdr));
 
Signature · 1 line
1.6.5.3
#8 lore raw

PATCH v2 8/8 rt2x00: Properly request tx headroom for alignment operations.

Current rt2x00 drivers may result in a "ieee80211_tx_status: headroom too small" error message when a frame needs to be properly aligned before transmitting it.
This is because the space needed to ensure proper alignment isn't requested from mac80211.
Fix this by adding sufficient amount of alignment space to the amount of headroom requested for TX frames.

---
 drivers/net/wireless/rt2x00/rt2x00.h    |    6 ++++++
 drivers/net/wireless/rt2x00/rt2x00dev.c |   12 +++++++++++-
 2 files changed, 17 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2x00.h +6 -0
index 4d841c0..dcfc8c2 100644
@@ -113,6 +113,12 @@
 	(  ((unsigned long)((__skb)->data + (__header))) & 3 )
 
 /*
+ * Constants for extra TX headroom for alignment purposes.
+ */
+#define RT2X00_ALIGN_SIZE	4 /* Only whole frame needs alignment */
+#define RT2X00_L2PAD_SIZE	8 /* Both header & payload need alignment */
+
+/*
  * Standard timing and size defines.
  * These values should follow the ieee80211 specifications.
  */
drivers/net/wireless/rt2x00/rt2x00dev.c +11 -1
index 06c43ca..265e66d 100644
@@ -686,7 +686,17 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev)
 	/*
 	 * Initialize extra TX headroom required.
 	 */
-	rt2x00dev->hw->extra_tx_headroom = rt2x00dev->ops->extra_tx_headroom;
+	rt2x00dev->hw->extra_tx_headroom =
+		max_t(unsigned int, IEEE80211_TX_STATUS_HEADROOM,
+		      rt2x00dev->ops->extra_tx_headroom);
+
+	/*
+	 * Take TX headroom required for alignment into account.
+	 */
+	if (test_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags))
+		rt2x00dev->hw->extra_tx_headroom += RT2X00_L2PAD_SIZE;
+	else if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags))
+		rt2x00dev->hw->extra_tx_headroom += RT2X00_ALIGN_SIZE;
 
 	/*
 	 * Register HW.
Signature · 1 line
1.6.5.3
#9 lore raw

Re: [PATCH v2 8/8] rt2x00: Properly request tx headroom for alignment operations.

Quoted 20 lines · Gertjan van Wingerde

Current rt2x00 drivers may result in a "ieee80211_tx_status: headroom too small" error message when a frame needs to be properly aligned before transmitting it.
This is because the space needed to ensure proper alignment isn't requested from mac80211.
Fix this by adding sufficient amount of alignment space to the amount of headroom requested for TX frames.

---
 drivers/net/wireless/rt2x00/rt2x00.h    |    6 ++++++
 drivers/net/wireless/rt2x00/rt2x00dev.c |   12 +++++++++++-
 2 files changed, 17 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2x00.h +0 -0
index 4d841c0..dcfc8c2 100644

drivers/net/wireless/rt2x00/rt2x00.h line 119

Quoted 7 lines
drivers/net/wireless/rt2x00/rt2x00.h +4 -0
@@ -113,6 +113,12 @@
 	(  ((unsigned long)((__skb)->data + (__header))) & 3 )
 
 /*
+ * Constants for extra TX headroom for alignment purposes.
+ */
+#define RT2X00_ALIGN_SIZE	4 /* Only whole frame needs alignment */
+#define RT2X00_L2PAD_SIZE	8 /* Both header & payload need alignment */

Now that I think of it, why do we need 8 byte for L2 padding? Shouldn't we need the same size for regular alignment, L2 padding only indicates the padding occurs between header and payload rather then before the header only. So unless I am mistaken about how I coded the header & payload moving in rt2x00lib, you always need at most 4 bytes.

Quoted 27 lines
drivers/net/wireless/rt2x00/rt2x00.h +1 -0
+/*
  * Standard timing and size defines.
  * These values should follow the ieee80211 specifications.
  */
drivers/net/wireless/rt2x00/rt2x00dev.c +11 -1
index 06c43ca..265e66d 100644
@@ -686,7 +686,17 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev)
 	/*
 	 * Initialize extra TX headroom required.
 	 */
-	rt2x00dev->hw->extra_tx_headroom = rt2x00dev->ops->extra_tx_headroom;
+	rt2x00dev->hw->extra_tx_headroom =
+		max_t(unsigned int, IEEE80211_TX_STATUS_HEADROOM,
+		      rt2x00dev->ops->extra_tx_headroom);
+
+	/*
+	 * Take TX headroom required for alignment into account.
+	 */
+	if (test_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags))
+		rt2x00dev->hw->extra_tx_headroom += RT2X00_L2PAD_SIZE;
+	else if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags))
+		rt2x00dev->hw->extra_tx_headroom += RT2X00_ALIGN_SIZE;
 
 	/*
 	 * Register HW.
#10 lore raw

Re: [PATCH v2 8/8] rt2x00: Properly request tx headroom for alignment operations.

Quoted 23 lines · Ivo van Doorn
Quoted 22 lines · Gertjan van Wingerde

Current rt2x00 drivers may result in a "ieee80211_tx_status: headroom too small" error message when a frame needs to be properly aligned before transmitting it.
This is because the space needed to ensure proper alignment isn't requested from mac80211.
Fix this by adding sufficient amount of alignment space to the amount of headroom requested for TX frames.

---
 drivers/net/wireless/rt2x00/rt2x00.h    |    6 ++++++
 drivers/net/wireless/rt2x00/rt2x00dev.c |   12 +++++++++++-
 2 files changed, 17 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2x00.h +0 -0
index 4d841c0..dcfc8c2 100644
@@ -113,6 +113,12 @@
 	(  ((unsigned long)((__skb)->data + (__header))) & 3 )
 
Quoted 12 lines

drivers/net/wireless/rt2x00/rt2x00.h line 119

Quoted 5 lines
drivers/net/wireless/rt2x00/rt2x00.h +4 -0
 /*
+ * Constants for extra TX headroom for alignment purposes.
+ */
+#define RT2X00_ALIGN_SIZE	4 /* Only whole frame needs alignment */
+#define RT2X00_L2PAD_SIZE	8 /* Both header & payload need alignment */

Now that I think of it, why do we need 8 byte for L2 padding? Shouldn't we need the same size for regular alignment, L2 padding only indicates the padding occurs between header and payload rather then before the header only. So unless I am mistaken about how I coded the header & payload moving in rt2x00lib, you always need at most 4 bytes.

Nope. If I read the code right then the header can be moved by more than 4 bytes, namely when the payload needs to be shifted more than the header. In that case the header is shifted an extra 4 bytes to make room for the payload. However, 8 is the obvious maximum.

---
Gertjan.

Acked-by
#11 lore raw

Re: [PATCH v2 8/8] rt2x00: Properly request tx headroom for alignment operations.

Quoted 37 lines · Gertjan van Wingerde
Quoted 23 lines · Ivo van Doorn
Quoted 22 lines · Gertjan van Wingerde

Current rt2x00 drivers may result in a "ieee80211_tx_status: headroom too small" error message when a frame needs to be properly aligned before transmitting it.
This is because the space needed to ensure proper alignment isn't requested from mac80211.
Fix this by adding sufficient amount of alignment space to the amount of headroom requested for TX frames.

---
 drivers/net/wireless/rt2x00/rt2x00.h    |    6 ++++++
 drivers/net/wireless/rt2x00/rt2x00dev.c |   12 +++++++++++-
 2 files changed, 17 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2x00.h +0 -0
index 4d841c0..dcfc8c2 100644
@@ -113,6 +113,12 @@
 	(  ((unsigned long)((__skb)->data + (__header))) & 3 )
 
Quoted 12 lines

drivers/net/wireless/rt2x00/rt2x00.h line 119

Quoted 5 lines
drivers/net/wireless/rt2x00/rt2x00.h +4 -0
 /*
+ * Constants for extra TX headroom for alignment purposes.
+ */
+#define RT2X00_ALIGN_SIZE	4 /* Only whole frame needs alignment */
+#define RT2X00_L2PAD_SIZE	8 /* Both header & payload need alignment */

Now that I think of it, why do we need 8 byte for L2 padding? Shouldn't we need the same size for regular alignment, L2 padding only indicates the padding occurs between header and payload rather then before the header only. So unless I am mistaken about how I coded the header & payload moving in rt2x00lib, you always need at most 4 bytes.

Quoted 3 lines

Nope. If I read the code right then the header can be moved by more than 4 bytes, namely when the payload needs to be shifted more than the header. In that case the header is shifted an extra 4 bytes to make room for the payload. However, 8 is the obvious maximum.

Ah right, well 8bytes is ok then. :)

#12 lore raw

Re: [PATCH v2 8/8] rt2x00: Properly request tx headroom for alignment operations.

In reply to Gertjan van Wingerde
Quoted 10 lines · Gertjan van Wingerde

Current rt2x00 drivers may result in a "ieee80211_tx_status: headroom too small" error message when a frame needs to be properly aligned before transmitting it.
This is because the space needed to ensure proper alignment isn't requested from mac80211.
Fix this by adding sufficient amount of alignment space to the amount of headroom requested for TX frames.

CC [M] drivers/net/wireless/rt2x00/rt2x00dev.o
drivers/net/wireless/rt2x00/rt2x00dev.c: In function ‘rt2x00lib_probe_hw’:
drivers/net/wireless/rt2x00/rt2x00dev.c:690: error: ‘IEEE80211_TX_STATUS_HEADROOM’ undeclared (first use in this function) drivers/net/wireless/rt2x00/rt2x00dev.c:690: error: (Each undeclared identifier is reported only once drivers/net/wireless/rt2x00/rt2x00dev.c:690: error: for each function it appears in.)

Did I miss a patch?

John

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
#13 lore raw

Re: [PATCH v2 8/8] rt2x00: Properly request tx headroom for alignment operations.

Quoted 12 lines · John W. Linville
Quoted 10 lines · Gertjan van Wingerde

Current rt2x00 drivers may result in a "ieee80211_tx_status: headroom too small" error message when a frame needs to be properly aligned before transmitting it.
This is because the space needed to ensure proper alignment isn't requested from mac80211.
Fix this by adding sufficient amount of alignment space to the amount of headroom requested for TX frames.

Quoted 7 lines

CC [M] drivers/net/wireless/rt2x00/rt2x00dev.o
drivers/net/wireless/rt2x00/rt2x00dev.c: In function ‘rt2x00lib_probe_hw’:
drivers/net/wireless/rt2x00/rt2x00dev.c:690: error: ‘IEEE80211_TX_STATUS_HEADROOM’ undeclared (first use in this function) drivers/net/wireless/rt2x00/rt2x00dev.c:690: error: (Each undeclared identifier is reported only once drivers/net/wireless/rt2x00/rt2x00dev.c:690: error: for each function it appears in.)

Did I miss a patch?

Patch 7 of the series creates that define within mac80211. It is a prerequisite for this patch.

---
Gertjan.

#14 lore raw

Re: [PATCH v2 8/8] rt2x00: Properly request tx headroom for alignment operations.

Quoted 19 lines · Gertjan van Wingerde
Quoted 18 lines · John W. Linville
Quoted 10 lines · Gertjan van Wingerde

Current rt2x00 drivers may result in a "ieee80211_tx_status: headroom too small" error message when a frame needs to be properly aligned before transmitting it.
This is because the space needed to ensure proper alignment isn't requested from mac80211.
Fix this by adding sufficient amount of alignment space to the amount of headroom requested for TX frames.

CC [M] drivers/net/wireless/rt2x00/rt2x00dev.o
drivers/net/wireless/rt2x00/rt2x00dev.c: In function ‘rt2x00lib_probe_hw’:
drivers/net/wireless/rt2x00/rt2x00dev.c:690: error: ‘IEEE80211_TX_STATUS_HEADROOM’ undeclared (first use in this function) drivers/net/wireless/rt2x00/rt2x00dev.c:690: error: (Each undeclared identifier is reported only once drivers/net/wireless/rt2x00/rt2x00dev.c:690: error: for each function it appears in.)

Quoted 3 lines
Quoted 1 line

Did I miss a patch?

Patch 7 of the series creates that define within mac80211. It is a prerequisite for this patch.

OK, thanks -- somehow it didn't make it out of my mailbox in into the mbox file I fed to git...

John

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
#15 lore raw

PATCH v2 8/8 rt2x00: Properly request tx headroom for alignment operations.

In reply to Gertjan van Wingerde

After my latest git pull to the kernel version 2.6.33-rc1-wl no client was able to connect to my hostapd (v0.6.9) AP. I found a lot of the following entries in the syslog:

wlan0: STA xx:xx:xx:xx:xx:xx
IEEE 802.11: did not acknowledge authentication response

I bisected the problem to the commit e77f5ff92f5ef43c842e97136edcb68c61afe588 above.

After I removed the lines below in rt2x00dev.c:
rt2x00dev->hw->extra_tx_headroom =
max_t(unsigned int, IEEE80211_TX_STATUS_HEADROOM,
rt2x00dev->ops->extra_tx_headroom);

/*
* Take TX headroom required for alignment into account. */
if (test_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags))

        rt2x00dev->hw->extra_tx_headroom += RT2X00_L2PAD_SIZE;
else if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags))
        rt2x00dev->hw->extra_tx_headroom += RT2X00_ALIGN_SIZE;

added the line:
rt2x00dev->hw->extra_tx_headroom = rt2x00dev->ops->extra_tx_headroom;

and compiled the kernel 2.6.33-rc2 again, all worked fine.

#16 lore raw

Re: [BISECTED] [PATCH v2 8/8] rt2x00: Properly request tx headroom for alignment operations.

Quoted 19 lines · Markus Baier

After my latest git pull to the kernel version 2.6.33-rc1-wl no client was able to connect to my hostapd (v0.6.9) AP. I found a lot of the following entries in the syslog:

wlan0: STA xx:xx:xx:xx:xx:xx
IEEE 802.11: did not acknowledge authentication response

I bisected the problem to the commit e77f5ff92f5ef43c842e97136edcb68c61afe588 above.

After I removed the lines below in rt2x00dev.c:
rt2x00dev->hw->extra_tx_headroom =
max_t(unsigned int, IEEE80211_TX_STATUS_HEADROOM,
rt2x00dev->ops->extra_tx_headroom);

/*
* Take TX headroom required for alignment into account. */
if (test_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags))

Quoted 9 lines
        rt2x00dev->hw->extra_tx_headroom += RT2X00_L2PAD_SIZE;
else if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags))
        rt2x00dev->hw->extra_tx_headroom += RT2X00_ALIGN_SIZE;

added the line:
rt2x00dev->hw->extra_tx_headroom = rt2x00dev->ops->extra_tx_headroom;

and compiled the kernel 2.6.33-rc2 again, all worked fine.

That is very strange as this patch was meant to send TX statuses of frames towards monitor interfaces (which is what hostapd is using).

What kind of rt2x00 device are you using (and which of the rt2x00 drivers)?

Are there any messages in dmesg when this happens?
Can you check whether there are any messages in dmesg in the working situation?

---
Gertjan.

#17 lore raw

Re: [BISECTED] [PATCH v2 8/8] rt2x00: Properly request tx headroom for alignment operations.

Quoted 1 line · Gertjan van Wingerde

What kind of rt2x00 device are you using (and which of the rt2x00 drivers)?

The device is a PCMICA card with the RT2561 chipset. The driver is the rt61pci driver.

Quoted 1 line
Quoted 1 line

lsmod

Module                  Size  Used by
rt61pci                18193  0
crc_itu_t               1017  1 rt61pci
rt2x00pci               4189  1 rt61pci
rt2x00lib              22940  2 rt61pci,rt2x00pci
eeprom_93cx6             960  1 rt61pci
Quoted 1 line

Are there any messages in dmesg when this happens?

No, there are no messages in dmesg

There are no differences in the dmesg output between the working and the broken kernel
Here is the dmesg output:

rt61pci 0000:02:00.0: enabling device (0000 -> 0002)
rt61pci 0000:02:00.0: PCI INT A -> GSI 18 (level, low) -> IRQ 18 rt61pci 0000:02:00.0: setting latency timer to 64
phy0 -> rt61pci_validate_eeprom: EEPROM recovery - NIC: 0xff80 phy0 -> rt61pci_validate_eeprom: EEPROM recovery - Led: 0xe0ff phy0 -> rt2x00_print_chip: Info - Chipset detected - rt: 0302, rf: 0003, rev:
0002561c.
phy0: Selected rate control algorithm 'minstrel'
Registered led device: rt61pci-phy0::radio
Registered led device: rt61pci-phy0::assoc
phy0 -> rt2x00lib_request_firmware: Info - Loading firmware file 'rt2561.bin'. rt61pci 0000:02:00.0: firmware: requesting rt2561.bin
phy0 -> rt2x00lib_request_firmware: Info - Firmware detected - version: 0.8. phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 0 - CWmin: 3, CWmax: 4,
Aifs: 2, TXop: 102.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 1 - CWmin: 4, CWmax: 5,
Aifs: 2, TXop: 188.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 2 - CWmin: 5, CWmax: 10,
Aifs: 3, TXop: 0.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 3 - CWmin: 5, CWmax: 10,
Aifs: 7, TXop: 0.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 0 - CWmin: 3, CWmax: 4,
Aifs: 2, TXop: 102.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 1 - CWmin: 4, CWmax: 5,
Aifs: 2, TXop: 188.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 2 - CWmin: 5, CWmax: 10,
Aifs: 3, TXop: 0.
phy0 -> rt2x00mac_conf_tx: Info - Configured TX queue 3 - CWmin: 5, CWmax: 10,
Aifs: 7, TXop: 0.
cfg80211: Calling CRDA for country: DE
cfg80211: Regulatory domain changed to country: DE

    (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
    (2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A, 2000 mBm)
    (5150000 KHz - 5350000 KHz @ 40000 KHz), (N/A, 2000 mBm)
    (5470000 KHz - 5725000 KHz @ 40000 KHz), (N/A, 2698 mBm)

device wlan0 entered promiscuous mode
br0: port 2(wlan0) entering learning state
br0: port 1(eth0) entering forwarding state
br0: port 2(wlan0) entering forwarding state

------------------------------------------------------------------------
But there are differences in the hostapd log.
Here is the log output from the broken system:

Quoted 1 line
Quoted 1 line

hostapd -tddd /etc/hostapd/wpa2_ap.conf

....
1261351288.111499: MGMT (TX callback) fail
1261351288.111513: mgmt::proberesp cb
1261351290.256576: STA xx:xx:xx:xx:xx:xx sent probe request for our SSID 1261351290.257122: STA xx:xx:xx:xx:xx:xx sent probe request for our SSID 1261351290.257735: STA xx:xx:xx:xx:xx:xx sent probe request for our SSID 1261351290.258351: STA xx:xx:xx:xx:xx:xx sent probe request for our SSID 1261351290.258971: STA xx:xx:xx:xx:xx:xx sent probe request for our SSID 1261351290.268092: MGMT (TX callback) fail
1261351290.268116: mgmt::proberesp cb
1261351290.277054: MGMT (TX callback) fail
1261351290.277074: mgmt::proberesp cb
1261351290.285832: MGMT (TX callback) fail
1261351290.285848: mgmt::proberesp cb
1261351290.294522: MGMT (TX callback) fail
1261351290.294538: mgmt::proberesp cb
1261351290.303364: MGMT (TX callback) fail
1261351290.303379: mgmt::proberesp cb
1261351291.334698: MGMT
1261351291.334719: mgmt::auth
1261351291.334727: authentication: STA=xx:xx:xx:xx:xx:xx auth_alg=0 auth_transaction=1 status_code=0 wep=0
1261351291.334769: wlan0: STA xx:xx:xx:xx:xx:xx IEEE 802.11: authentication OK (open system)
1261351291.334795: wlan0: STA xx:xx:xx:xx:xx:xx MLME:
MLME-AUTHENTICATE.indication(xx:xx:xx:xx:xx:xx, OPEN_SYSTEM) 1261351291.334817: wlan0: STA xx:xx:xx:xx:xx:xx MLME:
MLME-DELETEKEYS.request(xx:xx:xx:xx:xx:xx)
1261351291.334830: authentication reply: STA=xx:xx:xx:xx:xx:xx auth_alg=0 auth_transaction=2 resp=0 (IE len=0)
1261351291.339781: MGMT (TX callback) fail
1261351291.339794: mgmt::auth cb
1261351291.339813: wlan0: STA xx:xx:xx:xx:xx:xx IEEE 802.11: did not acknowledge authentication response
....

------------------------------------------------------------------------
Here the log output from the working system:

Quoted 1 line
Quoted 1 line

hostapd -tddd /etc/hostapd/wpa2_ap.conf

....
1261353953.151469: MGMT (TX callback) ACK
1261353956.790339: STA xx:xx:xx:xx:xx:xx sent probe request for our SSID 1261353956.790871: STA xx:xx:xx:xx:xx:xx sent probe request for our SSID 1261353956.791481: STA xx:xx:xx:xx:xx:xx sent probe request for our SSID 1261353956.792098: STA xx:xx:xx:xx:xx:xx sent probe request for our SSID 1261353956.792717: STA xx:xx:xx:xx:xx:xx sent probe request for our SSID 1261353956.794326: MGMT (TX callback) ACK
1261353956.794339: mgmt::proberesp cb
1261353956.795806: MGMT (TX callback) ACK
1261353956.795827: mgmt::proberesp cb
1261353956.797184: MGMT (TX callback) ACK
1261353956.797195: mgmt::proberesp cb
1261353956.798558: MGMT (TX callback) ACK
1261353956.798569: mgmt::proberesp cb
1261353956.799907: MGMT (TX callback) ACK
1261353956.799918: mgmt::proberesp cb
1261353957.868214: MGMT
1261353957.868236: mgmt::auth
1261353957.868245: authentication: STA=xx:xx:xx:xx:xx:xx auth_alg=0 auth_transaction=1 status_code=0 wep=0
1261353957.868266: New STA
1261353957.868313: wlan0: STA xx:xx:xx:xx:xx:xx IEEE 802.11: authentication OK (open system)
1261353957.868344: wlan0: STA xx:xx:xx:xx:xx:xx MLME:
MLME-AUTHENTICATE.indication(xx:xx:xx:xx:xx:xx, OPEN_SYSTEM) 1261353957.868366: wlan0: STA xx:xx:xx:xx:xx:xx MLME:
MLME-DELETEKEYS.request(xx:xx:xx:xx:xx:xx)
1261353957.868385: authentication reply: STA=xx:xx:xx:xx:xx:xx auth_alg=0 auth_transaction=2 resp=0 (IE len=0)
1261353957.869332: MGMT (TX callback) ACK
1261353957.869347: mgmt::auth cb
1261353957.869368: wlan0: STA xx:xx:xx:xx:xx:xx IEEE 802.11: authenticated
....

Please tell me if some information are missing.

Regards,
Markus

#18 lore raw

Re: [BISECTED] [PATCH v2 8/8] rt2x00: Properly request tx headroom for alignment operations.

In reply to Gertjan van Wingerde

Quoting Gertjan van Wingerde <[email protected]>:

Quoted 7 lines · Markus Baier
Quoted 6 lines

After my latest git pull to the kernel version 2.6.33-rc1-wl no client was able to connect to my hostapd (v0.6.9) AP. I found a lot of the following entries in the syslog:

wlan0: STA xx:xx:xx:xx:xx:xx
IEEE 802.11: did not acknowledge authentication response

I'm also having problems with rt2x00 support the current wireless-testing, but in the station mode. The device is using rt61pci driver. Association to an AP with WEP fails.

[  147.930019] wlan2: direct probe to AP 00:11:6b:28:0b:92 (try 1)
[  148.130010] wlan2: direct probe to AP 00:11:6b:28:0b:92 (try 2)
[  148.330009] wlan2: direct probe to AP 00:11:6b:28:0b:92 (try 3)
[  148.530008] wlan2: direct probe to AP 00:11:6b:28:0b:92 timed out
[  152.942516] wlan2: direct probe to AP 00:11:6b:28:0b:92 (try 1)
[  153.142512] wlan2: direct probe to AP 00:11:6b:28:0b:92 (try 2)
[  153.340011] wlan2: direct probe to AP 00:11:6b:28:0b:92 (try 3)
[  153.540008] wlan2: direct probe to AP 00:11:6b:28:0b:92 timed out

It worked fine with wireless-testing when it was 2.6.32 based.

Quoted 1 line
Quoted 1 line

After I removed the lines below in rt2x00dev.c:

That "patch" is helping me too! The association is working now.

Quoted 2 lines

That is very strange as this patch was meant to send TX statuses of frames towards monitor interfaces (which is what hostapd is using).

I'm not using monitor mode. I only have one vif in the station mode.

My debugging shows that the headroom is 0 with the "patch". Without it, the headroom is 17 (13 from IEEE80211_TX_STATUS_HEADROOM plus 4 from RT2X00_ALIGN_SIZE).

Perhaps non-zero headroom is not handled correctly?

Signature · 2 lines
Regards,
Pavel Roskin
#19 lore raw

Re: [BISECTED] [PATCH v2 8/8] rt2x00: Properly request tx headroom for alignment operations.

Quoted 33 lines · Pavel Roskin

Quoting Gertjan van Wingerde <[email protected]>:

Quoted 7 lines · Markus Baier
Quoted 6 lines

After my latest git pull to the kernel version 2.6.33-rc1-wl no client was able to connect to my hostapd (v0.6.9) AP. I found a lot of the following entries in the syslog:

wlan0: STA xx:xx:xx:xx:xx:xx
IEEE 802.11: did not acknowledge authentication response

I'm also having problems with rt2x00 support the current wireless-testing, but in the station mode. The device is using rt61pci driver. Association to an AP with WEP fails.

[  147.930019] wlan2: direct probe to AP 00:11:6b:28:0b:92 (try 1)
[  148.130010] wlan2: direct probe to AP 00:11:6b:28:0b:92 (try 2)
[  148.330009] wlan2: direct probe to AP 00:11:6b:28:0b:92 (try 3)
[  148.530008] wlan2: direct probe to AP 00:11:6b:28:0b:92 timed out
[  152.942516] wlan2: direct probe to AP 00:11:6b:28:0b:92 (try 1)
[  153.142512] wlan2: direct probe to AP 00:11:6b:28:0b:92 (try 2)
[  153.340011] wlan2: direct probe to AP 00:11:6b:28:0b:92 (try 3)
[  153.540008] wlan2: direct probe to AP 00:11:6b:28:0b:92 timed out

It worked fine with wireless-testing when it was 2.6.32 based.

Quoted 1 line
Quoted 1 line

After I removed the lines below in rt2x00dev.c:

That "patch" is helping me too! The association is working now.

Quoted 3 lines

That is very strange as this patch was meant to send TX statuses of frames
towards monitor interfaces (which is what hostapd is using).

Quoted 8 lines

I'm not using monitor mode. I only have one vif in the station mode.

My debugging shows that the headroom is 0 with the "patch". Without it, the headroom is 17 (13 from IEEE80211_TX_STATUS_HEADROOM plus 4 from RT2X00_ALIGN_SIZE).

Perhaps non-zero headroom is not handled correctly?

Hmmm, perhaps the problem is that the headroom is not a multiple of 4. Can you check what happens when you set the extra_tx_headroom fixed to e.g. 20?

The driver should be able to handle this, but maybe there is something wrong with the alignment.

---
Gertjan.

#20 lore raw

Re: [BISECTED] [PATCH v2 8/8] rt2x00: Properly request tx headroom for alignment operations.

Quoted 6 lines · Gertjan van Wingerde
Quoted 4 lines · Pavel Roskin

My debugging shows that the headroom is 0 with the "patch". Without it, the headroom is 17 (13 from IEEE80211_TX_STATUS_HEADROOM plus 4 from RT2X00_ALIGN_SIZE).

Quoted 8 lines
Quoted 2 lines

Perhaps non-zero headroom is not handled correctly?

Hmmm, perhaps the problem is that the headroom is not a multiple of 4. Can you check what happens when you set the extra_tx_headroom fixed to e.g. 20?

The driver should be able to handle this, but maybe there is something wrong with the alignment.

For the record, I have dropped this patch. Please feel free to resubmit a working version.

John

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
#21 lore raw

Re: [BISECTED] [PATCH v2 8/8] rt2x00: Properly request tx headroom for alignment operations.

Quoted 10 lines · John W. Linville
Quoted 9 lines · Gertjan van Wingerde
Quoted 6 lines · Pavel Roskin

My debugging shows that the headroom is 0 with the "patch". Without it, the headroom is 17 (13 from IEEE80211_TX_STATUS_HEADROOM plus 4 from RT2X00_ALIGN_SIZE).

Perhaps non-zero headroom is not handled correctly?

Quoted 9 lines
Quoted 5 lines

Hmmm, perhaps the problem is that the headroom is not a multiple of 4. Can you check what happens when you set the extra_tx_headroom fixed to e.g. 20?

The driver should be able to handle this, but maybe there is something wrong with the alignment.

For the record, I have dropped this patch. Please feel free to resubmit a working version.

Thanks. I was about to suggest the same.

---
Gertjan.

#22 lore raw

Re: [BISECTED] [PATCH v2 8/8] rt2x00: Properly request tx headroom for alignment operations.

In reply to Gertjan van Wingerde

Quoting Gertjan van Wingerde <[email protected]>:

Quoted 6 lines
Quoted 2 lines

Perhaps non-zero headroom is not handled correctly?

Hmmm, perhaps the problem is that the headroom is not a multiple of 4. Can you check what happens when you set the extra_tx_headroom fixed to e.g. 20?

I tried 64 and 2, and neither worked. rt2x00dev->ops->extra_tx_headroom is 0 for me. When the rt2x00dev->hw->extra_tx_headroom is 2, I observed invalid packets being emitted (using another interface). The packets have two bytes inserted in the beginning of the frame:

0000  00 00 1c 00 6f 48 00 00  fc de ee 13 00 00 00 00   ....oH.. ........
0010  10 02 85 09 a0 00 b1 b7  00 00 00 00 00 00 40 00   ........ ......@.
radiotap, 28 bytes ---------------------->
2 extra bytes                              <--->
correct 802.11 header                            <----
0020  00 00 ff ff ff ff ff ff  00 d0 41 af ad 2c ff ff   ........ ..A..,..
0030  ff ff cf 02 c0 02 00 05  77 62 65 6e 64 01 08 02   ........ wbend...
0040  04 0b 16 0c 12 18 24 32  04 30 48 e7 f8 07 9d      ......$2 .0H.... 

Here's a patch that is working for me, but I would not vouch for its correctness. Signing off just in case it happens to be correct ;-)

rt2x00: use correct headroom for transmission

Use rt2x00dev->ops->extra_tx_headroom, not rt2x00dev->hw->extra_tx_headroom in the tx code, as the later includes headroom only meant for the monitor mode.

---
 drivers/net/wireless/rt2x00/rt2x00queue.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/rt2x00/rt2x00queue.c +3 -3
index 3d8fb68..0b4801a 100644
@@ -104,7 +104,7 @@ void rt2x00queue_map_txskb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)
 	 * is also mapped to the DMA so it can be used for transfering
 	 * additional descriptor information to the hardware.
 	 */
-	skb_push(skb, rt2x00dev->hw->extra_tx_headroom);
+	skb_push(skb, rt2x00dev->ops->extra_tx_headroom);
 
 	skbdesc->skb_dma =
 	    dma_map_single(rt2x00dev->dev, skb->data, skb->len, DMA_TO_DEVICE);
@@ -112,7 +112,7 @@ void rt2x00queue_map_txskb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)
 	/*
 	 * Restore data pointer to original location again.
 	 */
-	skb_pull(skb, rt2x00dev->hw->extra_tx_headroom);
+	skb_pull(skb, rt2x00dev->ops->extra_tx_headroom);
 
 	skbdesc->flags |= SKBDESC_DMA_MAPPED_TX;
 }
@@ -134,7 +134,7 @@ void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)
 		 * by the driver, but it was actually mapped to DMA.
 		 */
 		dma_unmap_single(rt2x00dev->dev, skbdesc->skb_dma,
-				 skb->len + rt2x00dev->hw->extra_tx_headroom,
+				 skb->len + rt2x00dev->ops->extra_tx_headroom,
 				 DMA_TO_DEVICE);
 		skbdesc->flags &= ~SKBDESC_DMA_MAPPED_TX;
 	}
Signature · 2 lines
Regards,
Pavel Roskin
author Acked-by
#23 lore raw

Re: [BISECTED] [PATCH v2 8/8] rt2x00: Properly request tx headroom for alignment operations.

Quoted 27 lines · Pavel Roskin

Quoting Gertjan van Wingerde <[email protected]>:

Quoted 6 lines
Quoted 2 lines

Perhaps non-zero headroom is not handled correctly?

Hmmm, perhaps the problem is that the headroom is not a multiple of 4. Can you check what happens when you set the extra_tx_headroom fixed to e.g. 20?

I tried 64 and 2, and neither worked. rt2x00dev->ops->extra_tx_headroom is 0 for me. When the rt2x00dev->hw->extra_tx_headroom is 2, I observed invalid packets being emitted (using another interface). The packets have two bytes inserted in the beginning of the frame:

0000  00 00 1c 00 6f 48 00 00  fc de ee 13 00 00 00 00   ....oH.. ........
0010  10 02 85 09 a0 00 b1 b7  00 00 00 00 00 00 40 00   ........ ......@.
radiotap, 28 bytes ---------------------->
2 extra bytes                              <--->
correct 802.11 header                            <----
0020  00 00 ff ff ff ff ff ff  00 d0 41 af ad 2c ff ff   ........ ..A..,..
0030  ff ff cf 02 c0 02 00 05  77 62 65 6e 64 01 08 02   ........ wbend...
0040  04 0b 16 0c 12 18 24 32  04 30 48 e7 f8 07 9d      ......$2 .0H.... 

Here's a patch that is working for me, but I would not vouch for its correctness. Signing off just in case it happens to be correct ;-)

Quoted 7 lines

rt2x00: use correct headroom for transmission

Use rt2x00dev->ops->extra_tx_headroom, not rt2x00dev->hw->extra_tx_headroom in the tx code, as the later includes headroom only meant for the monitor mode.

Doh, that's it. Here we should indeed only take the real extra TX headroom required by the driver into account. Seems like I goofed up in a preparatory patch that centralized setting of rt2x00dev->hw->extra_tx_headroom.

Can you confirm that everything works okay with the original code and this patch applied?

In any way:

John, with this you can reinstate the original patch as well. Let me know if you want me to resubmit that one with this one included in it.

Quoted 36 lines
---
 drivers/net/wireless/rt2x00/rt2x00queue.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/rt2x00/rt2x00queue.c +3 -3
index 3d8fb68..0b4801a 100644
@@ -104,7 +104,7 @@ void rt2x00queue_map_txskb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)
 	 * is also mapped to the DMA so it can be used for transfering
 	 * additional descriptor information to the hardware.
 	 */
-	skb_push(skb, rt2x00dev->hw->extra_tx_headroom);
+	skb_push(skb, rt2x00dev->ops->extra_tx_headroom);
 
 	skbdesc->skb_dma =
 	    dma_map_single(rt2x00dev->dev, skb->data, skb->len, DMA_TO_DEVICE);
@@ -112,7 +112,7 @@ void rt2x00queue_map_txskb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)
 	/*
 	 * Restore data pointer to original location again.
 	 */
-	skb_pull(skb, rt2x00dev->hw->extra_tx_headroom);
+	skb_pull(skb, rt2x00dev->ops->extra_tx_headroom);
 
 	skbdesc->flags |= SKBDESC_DMA_MAPPED_TX;
 }
@@ -134,7 +134,7 @@ void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)
 		 * by the driver, but it was actually mapped to DMA.
 		 */
 		dma_unmap_single(rt2x00dev->dev, skbdesc->skb_dma,
-				 skb->len + rt2x00dev->hw->extra_tx_headroom,
+				 skb->len + rt2x00dev->ops->extra_tx_headroom,
 				 DMA_TO_DEVICE);
 		skbdesc->flags &= ~SKBDESC_DMA_MAPPED_TX;
 	}
#24 lore raw

Re: [BISECTED] [PATCH v2 8/8] rt2x00: Properly request tx headroom for alignment operations.

Quoted 2 lines · Gertjan van Wingerde

Can you confirm that everything works okay with the original code and this patch applied?

I restored the original patch from 2.6.33-rc1-wl
and applied the patch from Pavel Roskin.
Now it works. Thanks!

Regards
Markus

#25 lore raw

Re: [BISECTED] [PATCH v2 8/8] rt2x00: Properly request tx headroom for alignment operations.

Quoted 9 lines · Markus Baier
Quoted 2 lines · Gertjan van Wingerde

Can you confirm that everything works okay with the original code and this patch applied?

I restored the original patch from 2.6.33-rc1-wl
and applied the patch from Pavel Roskin.
Now it works. Thanks!

OK. Thanks for verifying.

And many thanks for Pavel to come up this quickly with a patch to fix this.

---
Gertjan.

#26 lore raw

Re: [BISECTED] [PATCH v2 8/8] rt2x00: Properly request tx headroom for alignment operations.

In reply to Gertjan van Wingerde

Quoting Gertjan van Wingerde <[email protected]>:

Quoted 5 lines

Doh, that's it. Here we should indeed only take the real extra TX headroom required by the driver into account. Seems like I goofed up in a preparatory patch that centralized setting of rt2x00dev->hw->extra_tx_headroom.

Can you confirm that everything works okay with the original code and this patch applied?

The managed mode is working fine for me.

I think it would be a good idea to test all modes and make sure that the patch for adding extra headroom does what it should (in addition to not breaking things).

Signature · 2 lines
Regards,
Pavel Roskin
maintainer
#27 lore raw

Re: [PATCH v2 7/8] mac80211: Add define for TX headroom reserved by mac80211 itself.

In reply to Gertjan van Wingerde
Quoted 7 lines · Gertjan van Wingerde

Add a definition of the amount of TX headroom reserved by mac80211 itself for its own purposes. Also add BUILD_BUG_ON to validate the value. This define can then be used by drivers to request additional TX headroom in the most efficient manner.

That makes more sense to me, thanks.

johannes

Quoted 35 lines
---
 include/net/mac80211.h |    6 ++++++
 net/mac80211/main.c    |    2 ++
 2 files changed, 8 insertions(+), 0 deletions(-)
include/net/mac80211.h +6 -0
index 3754ea4..a113458 100644
@@ -1727,6 +1727,12 @@ static inline void ieee80211_rx_ni(struct ieee80211_hw *hw,
 	local_bh_enable();
 }
 
+/*
+ * The TX headroom reserved by mac80211 for its own tx_status functions.
+ * This is enough for the radiotap header.
+ */
+#define IEEE80211_TX_STATUS_HEADROOM	13
+
 /**
  * ieee80211_tx_status - transmit status callback
  *
net/mac80211/main.c +2 -0
index dd8ec8d..f35d4aa 100644
@@ -515,6 +515,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
 	 * and we need some headroom for passing the frame to monitor
 	 * interfaces, but never both at the same time.
 	 */
+	BUILD_BUG_ON(IEEE80211_TX_STATUS_HEADROOM !=
+			sizeof(struct ieee80211_tx_status_rtap_hdr));
 	local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom,
 				   sizeof(struct ieee80211_tx_status_rtap_hdr));
 
Acked-by on v2 6/8
#28 lore raw

Re: [PATCH v2 6/8] rt2x00: Centralize setting of extra TX headroom requested by rt2x00.

In reply to Gertjan van Wingerde
Quoted 5 lines · Gertjan van Wingerde

Set the value of extra_tx_headroom in a central place, rather than in each of the drivers. This is preparatory for taking alignment space into account in the TX headroom requested by rt2x00.

#30 lore raw

Re: [rt2x00-users] [PATCH v2 1/8] rt2x00: Only initialize HT on rt2800 devices that support it.

In reply to Gertjan van Wingerde
Quoted 13 lines · Gertjan van Wingerde

Some RT28xx/RT30xx devices don't support 802.11n, when they are combined with the RF2020 chipset. Ensure that HT is disabled for these devices.

---
 drivers/net/wireless/rt2x00/rt2800lib.c |    6 +++++-

 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2800lib.c +0 -0
index e94f1e1..fcd0c88 100644

drivers/net/wireless/rt2x00/rt2800lib.c int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) · line 2079

Quoted 9 lines
drivers/net/wireless/rt2x00/rt2800lib.c +5 -1
@@ -2072,7 +2072,11 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
        /*
         * Initialize HT information.
         */
-       spec->ht.ht_supported = true;
+       if (!rt2x00_rf(chip, RF2020))
+               spec->ht.ht_supported = true;
+       else
+               spec->ht.ht_supported = false;
+

Maybe I'm the only one, but I hate conditional statements with no meaning. Maybe this instead?

spec->ht.ht_supported = !rt2x00_rf(chip, RF2020);

Quoted 12 lines

       spec->ht.cap =
           IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
           IEEE80211_HT_CAP_GRN_FLD |
--
1.6.5.3

_______________________________________________
users mailing list
[email protected]
http://rt2x00.serialmonkey.com/mailman/listinfo/users_rt2x00.serialmonkey.com

Acked-by
#31 lore raw

Re: [rt2x00-users] [PATCH v2 1/8] rt2x00: Only initialize HT on rt2800 devices that support it.

Quoted 28 lines · David Ellingsworth
Quoted 13 lines · Gertjan van Wingerde

Some RT28xx/RT30xx devices don't support 802.11n, when they are combined with the RF2020 chipset. Ensure that HT is disabled for these devices.

---
 drivers/net/wireless/rt2x00/rt2800lib.c |    6 +++++-

 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2800lib.c +0 -0
index e94f1e1..fcd0c88 100644

drivers/net/wireless/rt2x00/rt2800lib.c int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) · line 2079

Quoted 9 lines
drivers/net/wireless/rt2x00/rt2800lib.c +5 -1
@@ -2072,7 +2072,11 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
        /*
         * Initialize HT information.
         */
-       spec->ht.ht_supported = true;
+       if (!rt2x00_rf(chip, RF2020))
+               spec->ht.ht_supported = true;
+       else
+               spec->ht.ht_supported = false;
+

Maybe I'm the only one, but I hate conditional statements with no meaning. Maybe this instead?

Quoted 1 line

spec->ht.ht_supported = !rt2x00_rf(chip, RF2020);

I think this would look better as well. But either way you can add my: