Please pull 'upstream' branch of rt2x00
Hi John,
Here is the latest update for rt2x00
I think all patches qualify for 2.6.27,
with the exception for first 2 patches:
rt2x00: Remove duplicate declaration
rt2x00: Fix EIFS timing value
but those are one-liners and have little impact.
The 3 patches from Iwo are the most important ones, since that fixes a major bug in the beacon handling for the USB drivers. The 3 patches are a bit big, but without them beaconing simply won't work.
Ivo
---
The following changes since commit a520bdbe7d344296482f9355e29b0018ea58760f:
John W. Linville (1):
iwl-scan.c: fixup merge damage in wireless-testing#master
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/ivd/rt2x00.git/ ..BRANCH.NOT.VERIFIED..
Ivo van Doorn (3):
rt2x00: Remove duplicate declaration
rt2x00: Fix EIFS timing value
rt2x00: Fix GCC warning because aifs is now unsigned
Iwo Mergler (3):
rt2x00: Support for large vendor requests
rt2x00: Large vendor requests for rt73usb firmware upload and beacons
rt2x00: Fix the beacon length bug
drivers/net/wireless/rt2x00/rt2500usb.c | 12 +++++++ drivers/net/wireless/rt2x00/rt2x00.h | 2 +- drivers/net/wireless/rt2x00/rt2x00lib.h | 7 ---- drivers/net/wireless/rt2x00/rt2x00mac.c | 5 +-- drivers/net/wireless/rt2x00/rt2x00usb.c | 33 ++++++++++++++++++++ drivers/net/wireless/rt2x00/rt2x00usb.h | 22 ++++++++++++- drivers/net/wireless/rt2x00/rt73usb.c | 50 ++++++++++++------------------ 7 files changed, 87 insertions(+), 44 deletions(-)
PATCH 1/6 rt2x00: Remove duplicate declaration
rt2x00queue_free_skb() was declared twice.
--- drivers/net/wireless/rt2x00/rt2x00lib.h | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-)
drivers/net/wireless/rt2x00/rt2x00lib.h +0 -7
@@ -125,13 +125,6 @@ void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb);void rt2x00queue_free_skb (struct rt2x00_dev *rt2x00dev,struct sk_buff *skb);/** -* rt2x00queue_free_skb - free a skb -* @rt2x00dev: Pointer to &struct rt2x00_dev. -* @skb: The skb to free. -*/ -void rt2x00queue_free_skb (struct rt2x00_dev *rt2x00dev,struct sk_buff *skb); - -/** * rt2x00queue_write_tx_frame - Write TX frame to hardware * @queue: Queue over which the frame should be send * @skb: The skb to send
Signature · 1 line
1.5.6.1
PATCH 2/6 rt2x00: Fix EIFS timing value
Olivier reported a difference between the EIFS
values used in the legacy driver and the one in
the rt2x00 drivers.
In rt2x00 the value was
( SIFS + (8 * (IEEE80211_HEADER + ACK_SIZE)) ) which comes down to 314us
while the legacy driver uses the value 364us
This patch will hardcode the EIFS to the correct value.
--- drivers/net/wireless/rt2x00/rt2x00.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2x00.h +1 -1
@@ -108,7 +108,7 @@#define SHORT_PIFS ( SIFS + SHORT_SLOT_TIME )#define DIFS ( PIFS + SLOT_TIME )#define SHORT_DIFS ( SHORT_PIFS + SHORT_SLOT_TIME ) -#define EIFS ( SIFS + (8 * (IEEE80211_HEADER + ACK_SIZE)) ) +#define EIFS 364/* * Chipset identification
Signature · 1 line
1.5.6.1
PATCH 3/6 rt2x00: Support for large vendor requests
From: Iwo Mergler <[email protected]>
Adds an extra rt2x00 vendor request function to support register transfers beyond the CSR_CACHE_SIZE / USB packet size limit. This is useful for firmware uploads, beacon templates and keys, all of which are to large to do with a single USB request.
--- drivers/net/wireless/rt2x00/rt2x00usb.c | 33 +++++++++++++++++++++++++++++++ drivers/net/wireless/rt2x00/rt2x00usb.h | 21 ++++++++++++++++++- 2 files changed, 53 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2x00usb.c +33 -0
@@ -122,6 +122,39 @@ int rt2x00usb_vendor_request_buff(struct rt2x00_dev *rt2x00dev, }EXPORT_SYMBOL_GPL (rt2x00usb_vendor_request_buff); + +int rt2x00usb_vendor_request_larg_buff (struct rt2x00_dev *rt2x00dev, +const u8 request,const u8 requesttype, +const u16 offset,void *buffer, +const u16 buffer_length,const int timeout) +{ +int status =0 ; +unsigned char *tb; +u16 off, len, bsize; + +mutex_lock (&rt2x00dev->usb_cache_mutex); + + tb = buffer; + off = offset; + len = buffer_length; +while (len && !status) { + bsize =min_t (u16,CSR_CACHE_SIZE , len); + status =rt2x00usb_vendor_req_buff_lock (rt2x00dev, request, + requesttype, off, tb, + bsize, timeout); + + tb += bsize; + len -= bsize; + off += bsize; + } + +mutex_unlock (&rt2x00dev->usb_cache_mutex); + +return status; +} +EXPORT_SYMBOL_GPL (rt2x00usb_vendor_request_larg_buff); + +/* * TX data handlers. */
drivers/net/wireless/rt2x00/rt2x00usb.h +20 -1
@@ -70,7 +70,7 @@/* * Cache size */ -#define CSR_CACHE_SIZE 8 +#define CSR_CACHE_SIZE 64#define CSR_CACHE_SIZE_FIRMWARE 64/*
@@ -172,6 +172,25 @@ int rt2x00usb_vendor_req_buff_lock(struct rt2x00_dev *rt2x00dev, const u16 buffer_length, const int timeout);/** +* rt2x00usb_vendor_request_larg_buff - Send register command to device (buffered) +* @rt2x00dev: Pointer to &struct rt2x00_dev +* @request: USB vendor command (See &enum rt2x00usb_vendor_request) +* @requesttype: Request type &USB_VENDOR_REQUEST_* +* @offset: Register start offset to perform action on +* @buffer: Buffer where information will be read/written to by device +* @buffer_length: Size of &buffer +* @timeout: Operation timeout +* +* This function is used to transfer register data in blocks larger +* then CSR_CACHE_SIZE. Use for firmware upload, keys and beacons. +*/ +int rt2x00usb_vendor_request_larg_buff (struct rt2x00_dev *rt2x00dev, +const u8 request,const u8 requesttype, +const u16 offset,void *buffer, +const u16 buffer_length,const int timeout); + + +/** * rt2x00usb_vendor_request_sw - Send single register command to device * @rt2x00dev: Pointer to &struct rt2x00_dev * @request: USB vendor command (See &enum rt2x00usb_vendor_request)
Signature · 1 line
1.5.6.1
PATCH 4/6 rt2x00: Large vendor requests for rt73usb firmware upload and
From: Iwo Mergler <[email protected]>
Switches rt73usb to use large vendor requests for firmware and beacons. This also fixes the garbled beacon bug.
--- drivers/net/wireless/rt2x00/rt2x00usb.h | 1 - drivers/net/wireless/rt2x00/rt73usb.c | 36 ++++++------------------------- 2 files changed, 7 insertions(+), 30 deletions(-)
drivers/net/wireless/rt2x00/rt2x00usb.h +0 -1
@@ -71,7 +71,6 @@* Cache size */ #define CSR_CACHE_SIZE 64 -#define CSR_CACHE_SIZE_FIRMWARE 64/* * USB request types.
drivers/net/wireless/rt2x00/rt73usb.c +7 -29
@@ -890,9 +890,6 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, void *data,unsigned int i;int status;u32 reg; -char *ptr = data; -char *cache; -int buflen;/* * Wait for stable hardware.
@@ -911,31 +908,12 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, void *data,/* * Write firmware to device. -* We setup a seperate cache for this action, -* since we are going to write larger chunks of data -* then normally used cache size. */ - cache =kmalloc (CSR_CACHE_SIZE_FIRMWARE ,GFP_KERNEL ); -if (!cache) { -ERROR (rt2x00dev,"Failed to allocate firmware cache.\n" ); -return -ENOMEM ; - } - -for (i =0 ; i < len; i +=CSR_CACHE_SIZE_FIRMWARE ) { - buflen =min_t (int, len - i,CSR_CACHE_SIZE_FIRMWARE ); - -memcpy (cache, ptr, buflen); - -rt2x00usb_vendor_request (rt2x00dev,USB_MULTI_WRITE , -USB_VENDOR_REQUEST_OUT , -FIRMWARE_IMAGE_BASE + i,0 , - cache, buflen, -REGISTER_TIMEOUT32 (buflen)); - - ptr += buflen; - } - -kfree (cache); +rt2x00usb_vendor_request_larg_buff (rt2x00dev,USB_MULTI_WRITE , +USB_VENDOR_REQUEST_OUT , +FIRMWARE_IMAGE_BASE , + data, len, +REGISTER_TIMEOUT32 (len));/* * Send firmware request to device to load firmware,
@@ -1374,8 +1352,8 @@ static void rt73usb_write_beacon(struct queue_entry *entry)* Write entire beacon with descriptor to register. */ beacon_base =HW_BEACON_OFFSET (entry->entry_idx); -rt2x00usb_vendor_request (rt2x00dev,USB_MULTI_WRITE , -USB_VENDOR_REQUEST_OUT , beacon_base,0 , +rt2x00usb_vendor_request_larg_buff (rt2x00dev,USB_MULTI_WRITE , +USB_VENDOR_REQUEST_OUT , beacon_base, entry->skb->data, entry->skb->len,REGISTER_TIMEOUT32 (entry->skb->len));
Signature · 1 line
1.5.6.1
PATCH 5/6 rt2x00: Fix the beacon length bug
From: Iwo Mergler <[email protected]>
When setting up a beacon template, the length of the beacon is calculated with the assumption that the SKB already contains the Tx descriptor. In the case of beacons it doesn't.
This patch undoes the damage by adding the Tx descriptor length to the beacon length. This is safe, because the shortest possible beacon is longer than the Tx header.
--- drivers/net/wireless/rt2x00/rt2500usb.c | 12 ++++++++++++ drivers/net/wireless/rt2x00/rt73usb.c | 14 +++++++++++++- 2 files changed, 25 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2500usb.c +12 -0
@@ -1121,6 +1121,7 @@ static void rt2500usb_write_beacon(struct queue_entry *entry)int pipe =usb_sndbulkpipe (usb_dev,1 );int length;u16 reg; +u32 word, len;/* * Add the descriptor in front of the skb.
@@ -1130,6 +1131,17 @@ static void rt2500usb_write_beacon(struct queue_entry *entry) skbdesc->desc = entry->skb->data;/* +* Adjust the beacon databyte count. The current number is +* calculated before this function gets called, but falsely +* assumes that the descriptor was already present in the SKB. +*/ +rt2x00_desc_read (skbdesc->desc,0 , &word); + len =rt2x00_get_field32 (word,TXD_W0_DATABYTE_COUNT ); + len += skbdesc->desc_len; +rt2x00_set_field32 (&word,TXD_W0_DATABYTE_COUNT , len); +rt2x00_desc_write (skbdesc->desc,0 , word); + +/* * Disable beaconing while we are reloading the beacon data, * otherwise we might be sending out invalid data. */
drivers/net/wireless/rt2x00/rt73usb.c +13 -1
@@ -1322,7 +1322,7 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, }/* -* TX data initialization +* Send beacon template to hardware */ static void rt73usb_write_beacon (struct queue_entry *entry) {
@@ -1330,6 +1330,7 @@ static void rt73usb_write_beacon(struct queue_entry *entry)struct skb_frame_desc *skbdesc =get_skb_frame_desc (entry->skb);unsigned int beacon_base;u32 reg; +u32 word, len;/* * Add the descriptor in front of the skb.
@@ -1339,6 +1340,17 @@ static void rt73usb_write_beacon(struct queue_entry *entry) skbdesc->desc = entry->skb->data;/* +* Adjust the beacon databyte count. The current number is +* calculated before this function gets called, but falsely +* assumes that the descriptor was already present in the SKB. +*/ +rt2x00_desc_read (skbdesc->desc,0 , &word); + len =rt2x00_get_field32 (word,TXD_W0_DATABYTE_COUNT ); + len += skbdesc->desc_len; +rt2x00_set_field32 (&word,TXD_W0_DATABYTE_COUNT , len); +rt2x00_desc_write (skbdesc->desc,0 , word); + +/* * Disable beaconing while we are reloading the beacon data, * otherwise we might be sending out invalid data. */
Signature · 1 line
1.5.6.1
PATCH 6/6 rt2x00: Fix GCC warning because aifs is now unsigned
The aifs type has recently been changed to unsigned, this triggered the following gcc warning:
CC [M] drivers/net/wireless/rt2x00/rt2x00mac.o
drivers/net/wireless/rt2x00/rt2x00mac.c: In function 'rt2x00mac_conf_tx':
drivers/net/wireless/rt2x00/rt2x00mac.c:557: warning: comparison is always true due to limited range of data type
--- drivers/net/wireless/rt2x00/rt2x00mac.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/net/wireless/rt2x00/rt2x00mac.c +1 -4
@@ -554,10 +554,7 @@ int rt2x00mac_conf_tx(struct ieee80211_hw *hw, u16 queue_idx,else queue->cw_max =10 ;/* cw_min: 2^10 = 1024. */ -if (params->aifs >=0 ) - queue->aifs = params->aifs; -else - queue->aifs =2 ; + queue->aifs = params->aifs; INFO(rt2x00dev, "Configured TX queue %d - CWmin: %d, CWmax: %d, Aifs: %d.\n",
Signature · 1 line
1.5.6.1
Johannes Berg
maintainerRe: [PATCH 6/6] rt2x00: Fix GCC warning because aifs is now unsigned
Quoted 17 lines · Ivo van Doorn
The aifs type has recently been changed to unsigned, this triggered the following gcc warning:
CC [M]
drivers/net/wireless/rt2x00/rt2x00mac.o
drivers/net/wireless/rt2x00/rt2x00mac.c: In function 'rt2x00mac_conf_tx':
drivers/net/wireless/rt2x00/rt2x00mac.c:557: warning: comparison is always true due to limited range of data typeSigned-off-by Ivo van Doorn <[email protected]>--- drivers/net/wireless/rt2x00/rt2x00mac.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)drivers/net/wireless/rt2x00/rt2x00mac.c +0
-0
drivers/net/wireless/rt2x00/rt2x00mac.c int rt2x00mac_conf_tx(struct ieee80211_hw *hw, u16 queue_idx, · line 557
Quoted 8 lines
drivers/net/wireless/rt2x00/rt2x00mac.c +1
-4@@ -554,10 +554,7 @@ int rt2x00mac_conf_tx(struct ieee80211_hw *hw, u16 queue_idx,else queue->cw_max =10 ;/* cw_min: 2^10 = 1024. */ -if (params->aifs >=0 ) - queue->aifs = params->aifs; -else - queue->aifs =2 ; + queue->aifs = params->aifs;
davem already took my patch doing exactly that into his tree, it just hasn't arrived back yet.
johannes
Re: [PATCH 6/6] rt2x00: Fix GCC warning because aifs is now unsigned
Quoted 21 lines · Johannes Berg
Quoted 20 lines · Ivo van Doorn
The aifs type has recently been changed to unsigned, this triggered the following gcc warning:
CC [M]
drivers/net/wireless/rt2x00/rt2x00mac.o
drivers/net/wireless/rt2x00/rt2x00mac.c: In function 'rt2x00mac_conf_tx':
drivers/net/wireless/rt2x00/rt2x00mac.c:557: warning: comparison is always true due to limited range of data typeSigned-off-by Ivo van Doorn <[email protected]>--- drivers/net/wireless/rt2x00/rt2x00mac.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)drivers/net/wireless/rt2x00/rt2x00mac.c +0
-0@@ -554,10 +554,7 @@ int rt2x00mac_conf_tx(struct ieee80211_hw *hw, u16 queue_idx,else queue->cw_max =10 ;/* cw_min: 2^10 = 1024. */
Quoted 8 lines
drivers/net/wireless/rt2x00/rt2x00mac.c int rt2x00mac_conf_tx(struct ieee80211_hw *hw, u16 queue_idx, · line 557
Quoted 5 lines
drivers/net/wireless/rt2x00/rt2x00mac.c +1
-4-if (params->aifs >=0 ) - queue->aifs = params->aifs; -else - queue->aifs =2 ; + queue->aifs = params->aifs;davem already took my patch doing exactly that into his tree, it just hasn't arrived back yet.
Oh, I must have missed that patch then. :) I've found it in your patch directory as well now,
John, please skip this patch
Ivo
Johannes Berg
maintainerRe: [PATCH 2/6] rt2x00: Fix EIFS timing value
In reply to Ivo van Doorndrivers/net/wireless/rt2x00/rt2x00.h line 111
Quoted 5 lines · Ivo van Doorn
#define
SHORT_PIFS( SIFS +SHORT_SLOT_TIME)
#define DIFS ( PIFS +SLOT_TIME)
#defineSHORT_DIFS(SHORT_PIFS+SHORT_SLOT_TIME)drivers/net/wireless/rt2x00/rt2x00.h +1
-1-#define EIFS ( SIFS + (8 * (IEEE80211_HEADER + ACK_SIZE)) ) +#define EIFS 364
Haven't checked what it comes out to be, but it should be SIFS + DIFS + AckTxTime.
johannes
Re: [PATCH 2/6] rt2x00: Fix EIFS timing value
Quoted 10 lines · Johannes Berg
drivers/net/wireless/rt2x00/rt2x00.h line 111
Quoted 5 lines · Ivo van Doorn
#define
SHORT_PIFS( SIFS +SHORT_SLOT_TIME)
#define DIFS ( PIFS +SLOT_TIME)
#defineSHORT_DIFS(SHORT_PIFS+SHORT_SLOT_TIME)drivers/net/wireless/rt2x00/rt2x00.h +1
-1-#define EIFS ( SIFS + (8 * (IEEE80211_HEADER + ACK_SIZE)) ) +#define EIFS 364Haven't checked what it comes out to be, but it should be SIFS + DIFS + AckTxTime.
For normal slot time: 364
For short slot time: 342
So for normal slot time this would be correct, but it wouldn't for short slot time, legacy driver seems to have hardcoded the value to 364. So for now I think it is best to keep it hardcoded like that, and experiment a bit later to see what the impact will for short slot time.
(Note that rt61/rt73 will use 364 as EIFS and always uses a short slot time)
Ivo
Hi John,
Please wait with pulling from rt2x00.git, updated patches are coming in a few moments,
I just noticed some cleanups which should be made in several patches, and I'll incorporate the suggestion from Johannes regarding the EIFS.
Sorry for the noise. ;)
Ivo
Quoted 43 lines
Here is the latest update for rt2x00
I think all patches qualify for 2.6.27,
with the exception for first 2 patches:
rt2x00: Remove duplicate declaration
rt2x00: Fix EIFS timing value
but those are one-liners and have little impact.The 3 patches from Iwo are the most important ones, since that fixes a major bug in the beacon handling for the USB drivers. The 3 patches are a bit big, but without them beaconing simply won't work.
Ivo
---
The following changes since commita520bdbe7d344296482f9355e29b0018ea58760f:
John W. Linville (1):
iwl-scan.c: fixup merge damage in wireless-testing#masterare available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/ivd/rt2x00.git/..BRANCH.NOT.VERIFIED..Ivo van Doorn (3):
rt2x00: Remove duplicate declaration
rt2x00: Fix EIFS timing value
rt2x00: Fix GCC warning because aifs is now unsignedIwo Mergler (3):
rt2x00: Support for large vendor requests
rt2x00: Large vendor requests for rt73usb firmware upload and beacons
rt2x00: Fix the beacon length bugdrivers/net/wireless/rt2x00/rt2500usb.c | 12 +++++++ drivers/net/wireless/rt2x00/rt2x00.h | 2 +- drivers/net/wireless/rt2x00/rt2x00lib.h | 7 ---- drivers/net/wireless/rt2x00/rt2x00mac.c | 5 +-- drivers/net/wireless/rt2x00/rt2x00usb.c | 33 ++++++++++++++++++++ drivers/net/wireless/rt2x00/rt2x00usb.h | 22 ++++++++++++- drivers/net/wireless/rt2x00/rt73usb.c | 50 ++++++++++++------------------ 7 files changed, 87 insertions(+), 44 deletions(-)