Please pull 'upstream' branch of rt2x00
Hi John,
Here is the updated patch series,
I have dropped the compile warning patch because Johannes has already send it before, the EIFS patch has been updated to use the correct definition instead of hardcoding the value, and some coding style fixes went into Iwo's patches.
Patches are still intended for 2.6.27
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/ upstream
Ivo van Doorn (2):
rt2x00: Remove duplicate declaration
rt2x00: Fix EIFS timing value
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 | 5 ++- drivers/net/wireless/rt2x00/rt2x00config.c | 2 +- drivers/net/wireless/rt2x00/rt2x00lib.h | 7 ---- drivers/net/wireless/rt2x00/rt2x00usb.c | 32 +++++++++++++++++ drivers/net/wireless/rt2x00/rt2x00usb.h | 22 +++++++++++- drivers/net/wireless/rt2x00/rt73usb.c | 52 +++++++++++---------------- 7 files changed, 90 insertions(+), 42 deletions(-)
PATCH 1/5 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/5 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 was caused because EIFS is: SIFS + DIFS + AckTime This patch will fix this by adding the DIFS by the above value, and creating a SHORT_EIFS define which uses the SHORT_DIFS.
--- drivers/net/wireless/rt2x00/rt2x00.h | 5 ++++- drivers/net/wireless/rt2x00/rt2x00config.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/rt2x00/rt2x00.h +4 -1
@@ -108,7 +108,10 @@#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 ( SIFS + DIFS + \ + (8 * (IEEE80211_HEADER + ACK_SIZE)) ) +#define SHORT_EIFS ( SIFS + SHORT_DIFS + \ + (8 * (IEEE80211_HEADER + ACK_SIZE)) )/* * Chipset identification
drivers/net/wireless/rt2x00/rt2x00config.c +1 -1
@@ -271,7 +271,7 @@ config: libconf.sifs =SIFS ; libconf.pifs = short_slot_time ?SHORT_PIFS :PIFS ; libconf.difs = short_slot_time ?SHORT_DIFS :DIFS ; - libconf.eifs =EIFS ; + libconf.eifs = short_slot_time ?SHORT_EIFS :EIFS ; } libconf.conf = conf;
Signature · 1 line
1.5.6.1
PATCH 3/5 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 | 32 +++++++++++++++++++++++++++++++ drivers/net/wireless/rt2x00/rt2x00usb.h | 21 +++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2x00usb.c +32 -0
@@ -122,6 +122,38 @@ int rt2x00usb_vendor_request_buff(struct rt2x00_dev *rt2x00dev, }EXPORT_SYMBOL_GPL (rt2x00usb_vendor_request_buff); +int rt2x00usb_vendor_request_large_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_large_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_large_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_large_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/5 rt2x00: Large vendor requests for rt73usb firmware upload and beacons
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 | 40 +++++++------------------------ 2 files changed, 9 insertions(+), 32 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 +9 -31
@@ -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_large_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,10 +1352,10 @@ 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 , - entry->skb->data, entry->skb->len, -REGISTER_TIMEOUT32 (entry->skb->len)); +rt2x00usb_vendor_request_large_buff (rt2x00dev,USB_MULTI_WRITE , +USB_VENDOR_REQUEST_OUT , beacon_base, + entry->skb->data, entry->skb->len, +REGISTER_TIMEOUT32 (entry->skb->len));/* * Clean up the beacon skb.
Signature · 1 line
1.5.6.1
PATCH 5/5 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 | 12 ++++++++++++ 2 files changed, 24 insertions(+), 0 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 +12 -0
@@ -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