Assorted fixes and clean-ups.
PATCH 6/7 rt2x00: RT3593 is also applicable to USB.
In reply to Gertjan van Wingerde--- drivers/net/wireless/rt2x00/rt2x00.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2x00.h +1 -1
@@ -189,7 +189,7 @@ struct rt2x00_chip {#define RT3090 0x3090/* 2.4GHz PCIe */ #define RT3390 0x3390#define RT3572 0x3572 -#define RT3593 0x3593/* PCIe */ +#define RT3593 0x3593#define RT3883 0x3883/* WSOC */ #define RT5390 0x5390/* 2.4GHz */
Signature · 1 line
1.7.7.4
PATCH 1/7 rt2x00: Identify rt2800usb chipsets.
In reply to Gertjan van WingerdeAccording to the latest USB ID database these are all RT2770 / RT2870 / RT307x devices.
--- drivers/net/wireless/rt2x00/rt2800usb.c | 26 ++++++++++++-------------- 1 files changed, 12 insertions(+), 14 deletions(-)
drivers/net/wireless/rt2x00/rt2800usb.c +12 -14
@@ -914,12 +914,14 @@ static struct usb_device_id rt2800usb_device_table[] = { { USB_DEVICE(0x050d, 0x8053) }, { USB_DEVICE(0x050d, 0x805c) }, { USB_DEVICE(0x050d, 0x815c) }, + { USB_DEVICE(0x050d, 0x825a) }, { USB_DEVICE(0x050d, 0x825b) }, { USB_DEVICE(0x050d, 0x935a) }, { USB_DEVICE(0x050d, 0x935b) },/* Buffalo */ { USB_DEVICE(0x0411, 0x00e8) }, { USB_DEVICE(0x0411, 0x0158) }, + { USB_DEVICE(0x0411, 0x015d) }, { USB_DEVICE(0x0411, 0x016f) }, { USB_DEVICE(0x0411, 0x01a2) }, /* Corega */
@@ -934,6 +936,8 @@ static struct usb_device_id rt2800usb_device_table[] = { { USB_DEVICE(0x07d1, 0x3c0e) }, { USB_DEVICE(0x07d1, 0x3c0f) }, { USB_DEVICE(0x07d1, 0x3c11) }, + { USB_DEVICE(0x07d1, 0x3c13) }, + { USB_DEVICE(0x07d1, 0x3c15) }, { USB_DEVICE(0x07d1, 0x3c16) },/* Draytek */ { USB_DEVICE(0x07fa, 0x7712) },
@@ -943,6 +947,7 @@ static struct usb_device_id rt2800usb_device_table[] = { { USB_DEVICE(0x7392, 0x7711) }, { USB_DEVICE(0x7392, 0x7717) }, { USB_DEVICE(0x7392, 0x7718) }, + { USB_DEVICE(0x7392, 0x7722) },/* Encore */ { USB_DEVICE(0x203d, 0x1480) }, { USB_DEVICE(0x203d, 0x14a9) },
@@ -977,6 +982,7 @@ static struct usb_device_id rt2800usb_device_table[] = { { USB_DEVICE(0x1737, 0x0070) }, { USB_DEVICE(0x1737, 0x0071) }, { USB_DEVICE(0x1737, 0x0077) }, + { USB_DEVICE(0x1737, 0x0078) },/* Logitec */ { USB_DEVICE(0x0789, 0x0162) }, { USB_DEVICE(0x0789, 0x0163) },
@@ -1000,9 +1006,13 @@ static struct usb_device_id rt2800usb_device_table[] = { { USB_DEVICE(0x0db0, 0x871b) }, { USB_DEVICE(0x0db0, 0x871c) }, { USB_DEVICE(0x0db0, 0x899a) }, +/* Ovislink */ + { USB_DEVICE(0x1b75, 0x3071) }, + { USB_DEVICE(0x1b75, 0x3072) },/* Para */ { USB_DEVICE(0x20b8, 0x8888) },/* Pegatron */ + { USB_DEVICE(0x1d4d, 0x0002) }, { USB_DEVICE(0x1d4d, 0x000c) }, { USB_DEVICE(0x1d4d, 0x000e) }, { USB_DEVICE(0x1d4d, 0x0011) },
@@ -1055,7 +1065,9 @@ static struct usb_device_id rt2800usb_device_table[] = {/* Sparklan */ { USB_DEVICE(0x15a9, 0x0006) },/* Sweex */ + { USB_DEVICE(0x177f, 0x0153) }, { USB_DEVICE(0x177f, 0x0302) }, + { USB_DEVICE(0x177f, 0x0313) },/* U-Media */ { USB_DEVICE(0x157e, 0x300e) }, { USB_DEVICE(0x157e, 0x3013) },
@@ -1139,25 +1151,20 @@ static struct usb_device_id rt2800usb_device_table[] = { { USB_DEVICE(0x13d3, 0x3322) },/* Belkin */ { USB_DEVICE(0x050d, 0x1003) }, - { USB_DEVICE(0x050d, 0x825a) },/* Buffalo */ { USB_DEVICE(0x0411, 0x012e) }, { USB_DEVICE(0x0411, 0x0148) }, { USB_DEVICE(0x0411, 0x0150) }, - { USB_DEVICE(0x0411, 0x015d) },/* Corega */ { USB_DEVICE(0x07aa, 0x0041) }, { USB_DEVICE(0x07aa, 0x0042) }, { USB_DEVICE(0x18c5, 0x0008) },/* D-Link */ { USB_DEVICE(0x07d1, 0x3c0b) }, - { USB_DEVICE(0x07d1, 0x3c13) }, - { USB_DEVICE(0x07d1, 0x3c15) }, { USB_DEVICE(0x07d1, 0x3c17) }, { USB_DEVICE(0x2001, 0x3c17) },/* Edimax */ { USB_DEVICE(0x7392, 0x4085) }, - { USB_DEVICE(0x7392, 0x7722) },/* Encore */ { USB_DEVICE(0x203d, 0x14a1) }, /* Gemtek */
@@ -1171,19 +1178,13 @@ static struct usb_device_id rt2800usb_device_table[] = {/* LevelOne */ { USB_DEVICE(0x1740, 0x0605) }, { USB_DEVICE(0x1740, 0x0615) }, -/* Linksys */ - { USB_DEVICE(0x1737, 0x0078) },/* Logitec */ { USB_DEVICE(0x0789, 0x0168) }, { USB_DEVICE(0x0789, 0x0169) },/* Motorola */ { USB_DEVICE(0x100d, 0x9032) }, -/* Ovislink */ - { USB_DEVICE(0x1b75, 0x3071) }, - { USB_DEVICE(0x1b75, 0x3072) },/* Pegatron */ { USB_DEVICE(0x05a6, 0x0101) }, - { USB_DEVICE(0x1d4d, 0x0002) }, { USB_DEVICE(0x1d4d, 0x0010) },/* Planex */ { USB_DEVICE(0x2019, 0x5201) },
@@ -1202,9 +1203,6 @@ static struct usb_device_id rt2800usb_device_table[] = { { USB_DEVICE(0x083a, 0xc522) }, { USB_DEVICE(0x083a, 0xd522) }, { USB_DEVICE(0x083a, 0xf511) }, - /* Sweex */ - { USB_DEVICE(0x177f, 0x0153) }, - { USB_DEVICE(0x177f, 0x0313) }, /* Zyxel */ { USB_DEVICE(0x0586, 0x341a) }, #endif
Signature · 1 line
1.7.7.4
PATCH 2/7 rt2x00: Whitespace cleanup.
--- drivers/net/wireless/rt2x00/rt2x00.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2x00.h +1 -1
@@ -191,7 +191,7 @@ struct rt2x00_chip {#define RT3572 0x3572#define RT3593 0x3593/* PCIe */ #define RT3883 0x3883/* WSOC */ -#define RT5390 0x5390/* 2.4GHz */ +#define RT5390 0x5390/* 2.4GHz */ u16 rf;u16 rev;
Signature · 1 line
1.7.7.4
PATCH 3/7 rt2x00: Convert big if-statements to switch-statements.
--- drivers/net/wireless/rt2x00/rt2800lib.c | 44 ++++++++++++++++++------------ 1 files changed, 26 insertions(+), 18 deletions(-)
drivers/net/wireless/rt2x00/rt2800lib.c +26 -18
@@ -1944,19 +1944,24 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, info->default_power2 =TXPOWER_A_TO_DEV (info->default_power2); } -if (rt2x00_rf (rt2x00dev,RF2020 ) || -rt2x00_rf (rt2x00dev,RF3020 ) || -rt2x00_rf (rt2x00dev,RF3021 ) || -rt2x00_rf (rt2x00dev,RF3022 ) || -rt2x00_rf (rt2x00dev,RF3320 )) +switch (rt2x00dev->chip.rf) { +case RF2020 : +case RF3020 : +case RF3021 : +case RF3022 : +case RF3320 :rt2800_config_channel_rf3xxx (rt2x00dev, conf, rf, info); -else if (rt2x00_rf (rt2x00dev,RF3052 )) +break ; +case RF3052 :rt2800_config_channel_rf3052 (rt2x00dev, conf, rf, info); -else if (rt2x00_rf (rt2x00dev,RF5370 ) || -rt2x00_rf (rt2x00dev,RF5390 )) +break ; +case RF5370 : +case RF5390 :rt2800_config_channel_rf53xx (rt2x00dev, conf, rf, info); -else +break ; +default :rt2800_config_channel_rf2xxx (rt2x00dev, conf, rf, info); + }/* * Change BBP settings
@@ -3932,15 +3937,18 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)rt2x00_set_chip (rt2x00dev,rt2x00_get_field32 (reg,MAC_CSR0_CHIPSET ), value,rt2x00_get_field32 (reg,MAC_CSR0_REVISION )); -if (!rt2x00_rt (rt2x00dev,RT2860 ) && - !rt2x00_rt (rt2x00dev,RT2872 ) && - !rt2x00_rt (rt2x00dev,RT2883 ) && - !rt2x00_rt (rt2x00dev,RT3070 ) && - !rt2x00_rt (rt2x00dev,RT3071 ) && - !rt2x00_rt (rt2x00dev,RT3090 ) && - !rt2x00_rt (rt2x00dev,RT3390 ) && - !rt2x00_rt (rt2x00dev,RT3572 ) && - !rt2x00_rt (rt2x00dev,RT5390 )) { +switch (rt2x00dev->chip.rt) { +case RT2860 : +case RT2872 : +case RT2883 : +case RT3070 : +case RT3071 : +case RT3090 : +case RT3390 : +case RT3572 : +case RT5390 : +break ; +default :ERROR (rt2x00dev,"Invalid RT chipset detected.\n" );return -ENODEV ; }
Signature · 1 line
1.7.7.4
PATCH 5/7 rt2x00usb: Zero USB padding before sending URB
In reply to Gertjan van WingerdeFrom: Jakub Kiciński <[email protected]>
When USB driver requires padding at the end of frame or URB it will report this need by increasing return value of get_tx_data_len callback. Common USB code uses that return value as desired URB length.
Ensure that appropriate part of skb's tailroom exists and is zeroed.
--
drivers/net/wireless/rt2x00/rt2x00usb.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-)
--- drivers/net/wireless/rt2x00/rt2x00usb.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-)
drivers/net/wireless/rt2x00/rt2x00usb.c +13 -3
@@ -298,12 +298,22 @@ static bool rt2x00usb_kick_tx_entry(struct queue_entry *entry, void* data)return false;/* -* USB devices cannot blindly pass the skb->len as the -* length of the data to usb_fill_bulk_urb. Pass the skb -* to the driver to determine what the length should be. +* USB devices require certain padding at the end of each frame +* and urb. Those paddings are not included in skbs. Pass entry +* to the driver to determine what the overall length should be. */ length = rt2x00dev->ops->lib->get_tx_data_len (entry); + status =skb_padto (entry->skb, length); +if (unlikely (status)) { +/* TODO: report something more appropriate than IO_FAILED. */ +WARNING (rt2x00dev,"TX SKB padding error, out of memory\n" ); +set_bit (ENTRY_DATA_IO_FAILED , &entry->flags); +rt2x00lib_dmadone (entry); + +return false; + } + usb_fill_bulk_urb(entry_priv->urb, usb_dev, usb_sndbulkpipe(usb_dev, entry->queue->usb_endpoint), entry->skb->data, length,
Signature · 1 line
1.7.7.4
PATCH 7/7 rt2x00: Change RF3853 to RF3053.
In reply to Gertjan van WingerdeAccording to the latest Ralink vendor drivers, this seems to be the real RF chipset type.
--- drivers/net/wireless/rt2x00/rt2800.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/rt2x00/rt2800.h +2 -2
@@ -50,7 +50,7 @@* RF2853 2.4G/5G 3T3R * RF3320 2.4G 1T1R(RT3350/RT3370/RT3390) * RF3322 2.4G 2T2R(RT3352/RT3371/RT3372/RT3391/RT3392) -* RF3853 2.4G/5G 3T3R(RT3883/RT3563/RT3573/RT3593/RT3662) +* RF3053 2.4G/5G 3T3R(RT3883/RT3563/RT3573/RT3593/RT3662) * RF5370 2.4G 1T1R * RF5390 2.4G 1T1R */
@@ -66,7 +66,7 @@#define RF2853 0x000a#define RF3320 0x000b#define RF3322 0x000c -#define RF3853 0x000d +#define RF3053 0x000d#define RF5370 0x5370#define RF5390 0x5390
Signature · 1 line
1.7.7.4
cover Assorted fixes and clean-ups.
Assorted fixes and clean-ups for rt2x00.
Note these patches are on top of Larry Finger's uncommitted patch in
http://marc.info/?l=linux-wireless&m=132501461624898&w=2
Gertjan van Wingerde (6):
rt2x00: Identify rt2800usb chipsets.
rt2x00: Whitespace cleanup.
rt2x00: Convert big if-statements to switch-statements.
rt2x00: RT3593 is also applicable to USB.
rt2x00: Change RF3853 to RF3053.
Jakub Kiciński (2):
rt2800usb: Let rt2x00usb handle USB padding
rt2x00usb: Zero USB padding before sending URB
drivers/net/wireless/rt2x00/rt2800.h | 4 +- drivers/net/wireless/rt2x00/rt2800lib.c | 55 ++++++++++++++++---------- drivers/net/wireless/rt2x00/rt2800usb.c | 65 +++++++++++-------------------- drivers/net/wireless/rt2x00/rt2x00.h | 4 +- drivers/net/wireless/rt2x00/rt2x00usb.c | 16 ++++++- 5 files changed, 74 insertions(+), 70 deletions(-)
Signature · 1 line
1.7.7.4
PATCH 4/7 rt2800usb: Let rt2x00usb handle USB padding
In reply to Gertjan van WingerdeFrom: Jakub Kiciński <[email protected]>
Older USB drivers does not append end padding to skb but instead report it in size of data to be transmitted to HW. rt2800usb should follow that behaviour. Custom write_tx_data callback which was adding pad to skb is not be needed any more.
Thanks to this patch frames handed back from rt2800usb to mac80211 will no longer contain end padding.
--- drivers/net/wireless/rt2x00/rt2800usb.c | 37 ++++++++---------------------- 1 files changed, 10 insertions(+), 27 deletions(-)
drivers/net/wireless/rt2x00/rt2800usb.c +10 -27
@@ -400,10 +400,10 @@ static void rt2800usb_write_tx_desc(struct queue_entry *entry,/* * The size of TXINFO_W0_USB_DMA_TX_PKT_LEN is * TXWI + 802.11 header + L2 pad + payload + pad, -* so need to decrease size of TXINFO and USB end pad. +* so need to decrease size of TXINFO. */ rt2x00_set_field32 (&word,TXINFO_W0_USB_DMA_TX_PKT_LEN , - entry->skb->len -TXINFO_DESC_SIZE -4 ); +roundup (entry->skb->len,4 ) -TXINFO_DESC_SIZE );rt2x00_set_field32 (&word,TXINFO_W0_WIV , !test_bit (ENTRY_TXD_ENCRYPT_IV , &txdesc->flags));rt2x00_set_field32 (&word,TXINFO_W0_QSEL ,2 );
@@ -421,37 +421,20 @@ static void rt2800usb_write_tx_desc(struct queue_entry *entry, skbdesc->desc_len =TXINFO_DESC_SIZE +TXWI_DESC_SIZE ; } -static void rt2800usb_write_tx_data (struct queue_entry *entry, -struct txentry_desc *txdesc) +/* +* TX data initialization +*/ +static int rt2800usb_get_tx_data_len (struct queue_entry *entry) { -unsigned int len; -int err; - -rt2800_write_tx_data (entry, txdesc); -/* -* pad(1~3 bytes) is added after each 802.11 payload. -* USB end pad(4 bytes) is added at each USB bulk out packet end. +* pad(1~3 bytes) is needed after each 802.11 payload. +* USB end pad(4 bytes) is needed at each USB bulk out packet end. * TX frame format is : * | TXINFO | TXWI | 802.11 header | L2 pad | payload | pad | USB end pad | * |<------------- tx_pkt_len ------------->| */ - len =roundup (entry->skb->len,4 ) +4 ; - err =skb_padto (entry->skb, len); -if (unlikely (err)) { -WARNING (entry->queue->rt2x00dev,"TX SKB padding error, out of memory\n" ); -return ; - } - entry->skb->len = len; -} - -/* -* TX data initialization -*/ -static int rt2800usb_get_tx_data_len (struct queue_entry *entry) -{ -return entry->skb->len; +return roundup (entry->skb->len,4 ) +4 ; }/*
@@ -807,7 +790,7 @@ static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = { .flush_queue = rt2x00usb_flush_queue, .tx_dma_done = rt2800usb_tx_dma_done, .write_tx_desc = rt2800usb_write_tx_desc, - .write_tx_data = rt2800usb_write_tx_data, + .write_tx_data = rt2800_write_tx_data, .write_beacon = rt2800_write_beacon, .clear_beacon = rt2800_clear_beacon, .get_tx_data_len = rt2800usb_get_tx_data_len,
Signature · 1 line
1.7.7.4
Re: [PATCH 1/7] rt2x00: Identify rt2800usb chipsets.
In reply to Gertjan van WingerdeQuoted 4 lines · Gertjan van Wingerde
According to the latest USB ID database these are all RT2770 / RT2870 / RT307x devices.
Signed-off-by Gertjan van Wingerde <[email protected]>
Quoted 131 lines
---
drivers/net/wireless/rt2x00/rt2800usb.c | 26 ++++++++++++--------------1 files changed, 12 insertions(+), 14 deletions(-)drivers/net/wireless/rt2x00/rt2800usb.c +12
-15@@ -914,12 +914,14 @@ static struct usb_device_id rt2800usb_device_table[] = { { USB_DEVICE(0x050d, 0x8053) }, { USB_DEVICE(0x050d, 0x805c) }, { USB_DEVICE(0x050d, 0x815c) }, + { USB_DEVICE(0x050d, 0x825a) }, { USB_DEVICE(0x050d, 0x825b) }, { USB_DEVICE(0x050d, 0x935a) }, { USB_DEVICE(0x050d, 0x935b) }, /* Buffalo */ { USB_DEVICE(0x0411, 0x00e8) }, { USB_DEVICE(0x0411, 0x0158) }, + { USB_DEVICE(0x0411, 0x015d) }, { USB_DEVICE(0x0411, 0x016f) }, { USB_DEVICE(0x0411, 0x01a2) }, /* Corega */@@ -934,6 +936,8 @@ static struct usb_device_id rt2800usb_device_table[] = { { USB_DEVICE(0x07d1, 0x3c0e) }, { USB_DEVICE(0x07d1, 0x3c0f) }, { USB_DEVICE(0x07d1, 0x3c11) }, + { USB_DEVICE(0x07d1, 0x3c13) }, + { USB_DEVICE(0x07d1, 0x3c15) }, { USB_DEVICE(0x07d1, 0x3c16) }, /* Draytek */ { USB_DEVICE(0x07fa, 0x7712) },@@ -943,6 +947,7 @@ static struct usb_device_id rt2800usb_device_table[] = { { USB_DEVICE(0x7392, 0x7711) }, { USB_DEVICE(0x7392, 0x7717) }, { USB_DEVICE(0x7392, 0x7718) }, + { USB_DEVICE(0x7392, 0x7722) }, /* Encore */ { USB_DEVICE(0x203d, 0x1480) }, { USB_DEVICE(0x203d, 0x14a9) },@@ -977,6 +982,7 @@ static struct usb_device_id rt2800usb_device_table[] = { { USB_DEVICE(0x1737, 0x0070) }, { USB_DEVICE(0x1737, 0x0071) }, { USB_DEVICE(0x1737, 0x0077) }, + { USB_DEVICE(0x1737, 0x0078) }, /* Logitec */ { USB_DEVICE(0x0789, 0x0162) }, { USB_DEVICE(0x0789, 0x0163) },@@ -1000,9 +1006,13 @@ static struct usb_device_id rt2800usb_device_table[] = { { USB_DEVICE(0x0db0, 0x871b) }, { USB_DEVICE(0x0db0, 0x871c) }, { USB_DEVICE(0x0db0, 0x899a) }, + /* Ovislink */ + { USB_DEVICE(0x1b75, 0x3071) }, + { USB_DEVICE(0x1b75, 0x3072) }, /* Para */ { USB_DEVICE(0x20b8, 0x8888) }, /* Pegatron */ + { USB_DEVICE(0x1d4d, 0x0002) }, { USB_DEVICE(0x1d4d, 0x000c) }, { USB_DEVICE(0x1d4d, 0x000e) }, { USB_DEVICE(0x1d4d, 0x0011) },@@ -1055,7 +1065,9 @@ static struct usb_device_id rt2800usb_device_table[] = { /* Sparklan */ { USB_DEVICE(0x15a9, 0x0006) }, /* Sweex */ + { USB_DEVICE(0x177f, 0x0153) }, { USB_DEVICE(0x177f, 0x0302) }, + { USB_DEVICE(0x177f, 0x0313) }, /* U-Media */ { USB_DEVICE(0x157e, 0x300e) }, { USB_DEVICE(0x157e, 0x3013) },@@ -1139,25 +1151,20 @@ static struct usb_device_id rt2800usb_device_table[] = { { USB_DEVICE(0x13d3, 0x3322) }, /* Belkin */ { USB_DEVICE(0x050d, 0x1003) }, - { USB_DEVICE(0x050d, 0x825a) }, /* Buffalo */ { USB_DEVICE(0x0411, 0x012e) }, { USB_DEVICE(0x0411, 0x0148) }, { USB_DEVICE(0x0411, 0x0150) }, - { USB_DEVICE(0x0411, 0x015d) }, /* Corega */ { USB_DEVICE(0x07aa, 0x0041) }, { USB_DEVICE(0x07aa, 0x0042) }, { USB_DEVICE(0x18c5, 0x0008) }, /* D-Link */ { USB_DEVICE(0x07d1, 0x3c0b) }, - { USB_DEVICE(0x07d1, 0x3c13) }, - { USB_DEVICE(0x07d1, 0x3c15) }, { USB_DEVICE(0x07d1, 0x3c17) }, { USB_DEVICE(0x2001, 0x3c17) }, /* Edimax */ { USB_DEVICE(0x7392, 0x4085) }, - { USB_DEVICE(0x7392, 0x7722) }, /* Encore */ { USB_DEVICE(0x203d, 0x14a1) }, /* Gemtek */@@ -1171,19 +1178,13 @@ static struct usb_device_id rt2800usb_device_table[] = { /* LevelOne */ { USB_DEVICE(0x1740, 0x0605) }, { USB_DEVICE(0x1740, 0x0615) }, - /* Linksys */ - { USB_DEVICE(0x1737, 0x0078) }, /* Logitec */ { USB_DEVICE(0x0789, 0x0168) }, { USB_DEVICE(0x0789, 0x0169) }, /* Motorola */ { USB_DEVICE(0x100d, 0x9032) }, - /* Ovislink */ - { USB_DEVICE(0x1b75, 0x3071) }, - { USB_DEVICE(0x1b75, 0x3072) }, /* Pegatron */ { USB_DEVICE(0x05a6, 0x0101) }, - { USB_DEVICE(0x1d4d, 0x0002) }, { USB_DEVICE(0x1d4d, 0x0010) }, /* Planex */ { USB_DEVICE(0x2019, 0x5201) },@@ -1202,9 +1203,6 @@ static struct usb_device_id rt2800usb_device_table[] = { { USB_DEVICE(0x083a, 0xc522) }, { USB_DEVICE(0x083a, 0xd522) }, { USB_DEVICE(0x083a, 0xf511) }, - /* Sweex */ - { USB_DEVICE(0x177f, 0x0153) }, - { USB_DEVICE(0x177f, 0x0313) }, /* Zyxel */ { USB_DEVICE(0x0586, 0x341a) }, #endif --1.7.7.4
Re: [PATCH 2/7] rt2x00: Whitespace cleanup.
In reply to Gertjan van WingerdeQuoted 1 line · Gertjan van Wingerde
Signed-off-by Gertjan van Wingerde <[email protected]>
Quoted 20 lines
---
drivers/net/wireless/rt2x00/rt2x00.h | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)drivers/net/wireless/rt2x00/rt2x00.h +1
-2@@ -191,7 +191,7 @@ struct rt2x00_chip { #define RT3572 0x3572 #define RT3593 0x3593 /* PCIe */ #define RT3883 0x3883 /* WSOC */ -#define RT5390 0x5390/* 2.4GHz */ +#define RT5390 0x5390/* 2.4GHz */ u16 rf; u16 rev; --1.7.7.4
Re: [PATCH 3/7] rt2x00: Convert big if-statements to switch-statements.
In reply to Gertjan van WingerdeQuoted 1 line · Gertjan van Wingerde
Signed-off-by Gertjan van Wingerde <[email protected]>
PS. Is this something that can be done for the other drivers as well?
Quoted 73 lines
---
drivers/net/wireless/rt2x00/rt2800lib.c | 44 ++++++++++++++++++------------1 files changed, 26 insertions(+), 18 deletions(-)drivers/net/wireless/rt2x00/rt2800lib.c +26
-19@@ -1944,19 +1944,24 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, info->default_power2 = TXPOWER_A_TO_DEV(info->default_power2); } - if (rt2x00_rf(rt2x00dev, RF2020) || - rt2x00_rf(rt2x00dev, RF3020) || - rt2x00_rf(rt2x00dev, RF3021) || - rt2x00_rf(rt2x00dev, RF3022) || - rt2x00_rf(rt2x00dev, RF3320)) + switch (rt2x00dev->chip.rf) { + case RF2020: + case RF3020: + case RF3021: + case RF3022: + case RF3320: rt2800_config_channel_rf3xxx(rt2x00dev, conf, rf, info); - else if (rt2x00_rf(rt2x00dev, RF3052)) + break; + case RF3052: rt2800_config_channel_rf3052(rt2x00dev, conf, rf, info); - else if (rt2x00_rf(rt2x00dev, RF5370) || - rt2x00_rf(rt2x00dev, RF5390)) + break; + case RF5370: + case RF5390: rt2800_config_channel_rf53xx(rt2x00dev, conf, rf, info); - else + break; + default: rt2800_config_channel_rf2xxx(rt2x00dev, conf, rf, info); + } /** Change BBP settings @@ -3932,15 +3937,18 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) rt2x00_set_chip(rt2x00dev, rt2x00_get_field32(reg, MAC_CSR0_CHIPSET), value, rt2x00_get_field32(reg, MAC_CSR0_REVISION)); - if (!rt2x00_rt(rt2x00dev, RT2860) && - !rt2x00_rt(rt2x00dev, RT2872) && - !rt2x00_rt(rt2x00dev, RT2883) && - !rt2x00_rt(rt2x00dev, RT3070) && - !rt2x00_rt(rt2x00dev, RT3071) && - !rt2x00_rt(rt2x00dev, RT3090) && - !rt2x00_rt(rt2x00dev, RT3390) && - !rt2x00_rt(rt2x00dev, RT3572) && - !rt2x00_rt(rt2x00dev, RT5390)) { + switch (rt2x00dev->chip.rt) { + case RT2860: + case RT2872: + case RT2883: + case RT3070: + case RT3071: + case RT3090: + case RT3390: + case RT3572: + case RT5390: + break; + default: ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); return -ENODEV; } --1.7.7.4
Re: [PATCH 4/7] rt2800usb: Let rt2x00usb handle USB padding
In reply to Gertjan van WingerdeQuoted 9 lines · Gertjan van Wingerde
From: Jakub Kiciński <[email protected]>
Older USB drivers does not append end padding to skb but instead report it in size of data to be transmitted to HW. rt2800usb should follow that behaviour. Custom
write_tx_datacallback which was adding pad to skb is not be needed any more.Thanks to this patch frames handed back from rt2800usb to mac80211 will no longer contain end padding.
What happened to the reports that after this (and the next) patch, the non-2800 USB
drivers are failing?
Quoted 81 lines
Signed-off-by Jakub Kicinski <[email protected]>Signed-off-by Gertjan van Wingerde <[email protected]>---
drivers/net/wireless/rt2x00/rt2800usb.c | 37 ++++++++----------------------1 files changed, 10 insertions(+), 27 deletions(-)drivers/net/wireless/rt2x00/rt2800usb.c +10
-28@@ -400,10 +400,10 @@ static void rt2800usb_write_tx_desc(struct queue_entry *entry, /* * The size of TXINFO_W0_USB_DMA_TX_PKT_LEN is * TXWI + 802.11 header + L2 pad + payload + pad, - * so need to decrease size of TXINFO and USB end pad. + * so need to decrease size of TXINFO. */ rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN, - entry->skb->len - TXINFO_DESC_SIZE - 4); + roundup(entry->skb->len, 4) - TXINFO_DESC_SIZE); rt2x00_set_field32(&word, TXINFO_W0_WIV, !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags)); rt2x00_set_field32(&word, TXINFO_W0_QSEL, 2);@@ -421,37 +421,20 @@ static void rt2800usb_write_tx_desc(struct queue_entry *entry, skbdesc->desc_len = TXINFO_DESC_SIZE + TXWI_DESC_SIZE; } -static void rt2800usb_write_tx_data (struct queue_entry *entry, - struct txentry_desc *txdesc) +/* +* TX data initialization +*/ +static int rt2800usb_get_tx_data_len (struct queue_entry *entry) { - unsigned int len; - int err; - - rt2800_write_tx_data(entry, txdesc); - /* - * pad(1~3 bytes) is added after each 802.11 payload. - * USB end pad(4 bytes) is added at each USB bulk out packet end. + * pad(1~3 bytes) is needed after each 802.11 payload. + * USB end pad(4 bytes) is needed at each USB bulk out packet end. * TX frame format is : * | TXINFO | TXWI | 802.11 header | L2 pad | payload | pad | USB end pad | * |<------------- tx_pkt_len ------------->| */ - len = roundup(entry->skb->len, 4) + 4; - err = skb_padto(entry->skb, len); - if (unlikely(err)) { - WARNING(entry->queue->rt2x00dev, "TX SKB padding error, out of memory\n"); - return; - } - entry->skb->len = len; -} - -/* -* TX data initialization -*/ -static int rt2800usb_get_tx_data_len (struct queue_entry *entry) -{ - return entry->skb->len; + return roundup(entry->skb->len, 4) + 4; } /*@@ -807,7 +790,7 @@ static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = { .flush_queue = rt2x00usb_flush_queue, .tx_dma_done = rt2800usb_tx_dma_done, .write_tx_desc = rt2800usb_write_tx_desc, - .write_tx_data = rt2800usb_write_tx_data, + .write_tx_data = rt2800_write_tx_data, .write_beacon = rt2800_write_beacon, .clear_beacon = rt2800_clear_beacon, .get_tx_data_len = rt2800usb_get_tx_data_len, --1.7.7.4
Re: [PATCH 6/7] rt2x00: RT3593 is also applicable to USB.
In reply to Gertjan van WingerdeQuoted 1 line · Gertjan van Wingerde
Signed-off-by Gertjan van Wingerde <[email protected]>
Quoted 20 lines
---
drivers/net/wireless/rt2x00/rt2x00.h | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)drivers/net/wireless/rt2x00/rt2x00.h +1
-2@@ -189,7 +189,7 @@ struct rt2x00_chip { #define RT3090 0x3090 /* 2.4GHz PCIe */ #define RT3390 0x3390 #define RT3572 0x3572 -#define RT3593 0x3593/* PCIe */ +#define RT3593 0x3593 #define RT3883 0x3883 /* WSOC */ #define RT5390 0x5390 /* 2.4GHz */ --1.7.7.4
Re: [PATCH 7/7] rt2x00: Change RF3853 to RF3053.
In reply to Gertjan van WingerdeQuoted 4 lines · Gertjan van Wingerde
According to the latest Ralink vendor drivers, this seems to be the real RF chipset type.
Signed-off-by Gertjan van Wingerde <[email protected]>
Quoted 29 lines
---
drivers/net/wireless/rt2x00/rt2800.h | 4 ++--1 files changed, 2 insertions(+), 2 deletions(-)drivers/net/wireless/rt2x00/rt2800.h +2
-3@@ -50,7 +50,7 @@* RF2853 2.4G/5G 3T3R * RF3320 2.4G 1T1R(RT3350/RT3370/RT3390) * RF3322 2.4G 2T2R(RT3352/RT3371/RT3372/RT3391/RT3392) -* RF3853 2.4G/5G 3T3R(RT3883/RT3563/RT3573/RT3593/RT3662) +* RF3053 2.4G/5G 3T3R(RT3883/RT3563/RT3573/RT3593/RT3662) * RF5370 2.4G 1T1R * RF5390 2.4G 1T1R */ @@ -66,7 +66,7 @@ #define RF2853 0x000a #define RF3320 0x000b #define RF3322 0x000c -#define RF3853 0x000d +#define RF3053 0x000d #define RF5370 0x5370 #define RF5390 0x5390 --1.7.7.4
Re: [PATCH 4/7] rt2800usb: Let rt2x00usb handle USB padding
In reply to Ivo Van DoornQuoted 9 lines · Ivo Van Doorn
Quoted 7 lines · Gertjan van Wingerde
From: Jakub Kiciński <[email protected]>
Older USB drivers does not append end padding to skb but instead report it in size of data to be transmitted to HW. rt2800usb should follow that behaviour. Custom
write_tx_datacallback which was adding pad to skb is not be needed any more.
Quoted 6 lines
Quoted 2 lines
Thanks to this patch frames handed back from rt2800usb to mac80211 will no longer contain end padding.
What happened to the reports that after this (and the next) patch, the non-2800 USB
drivers are failing?
I have seen only 1 failure report (from Andreas Hartmann), which seemed to have been caused by not applying both patches. ISTR that Andreas did not see any regression when both patches were applied.
I have not seen any other reports of failures.
Also, my own testing did not reveal any issues, therefore I included them in this batch.
<snip>
---
Gertjan.
Re: [PATCH 4/7] rt2800usb: Let rt2x00usb handle USB padding
Quoted 13 lines · Gertjan van Wingerde
Quoted 12 lines · Ivo Van Doorn
Quoted 9 lines · Gertjan van Wingerde
From: Jakub Kiciński <[email protected]>
Older USB drivers does not append end padding to skb but instead report it in size of data to be transmitted to HW. rt2800usb should follow that behaviour. Custom
write_tx_datacallback which was adding pad to skb is not be needed any more.Thanks to this patch frames handed back from rt2800usb to mac80211 will no longer contain end padding.
Quoted 7 lines
Quoted 3 lines
What happened to the reports that after this (and the next) patch, the non-2800 USB
drivers are failing?I have seen only 1 failure report (from Andreas Hartmann), which seemed to have been caused by not applying both patches. ISTR that Andreas did not see any regression when both patches were applied.
Yes, that's true. The behavior of a rt3572 dongle in my test with both patches applied was the same as without these both patches.
Please note that the test I did was very short, because the rt2800usb driver works really bad with this device anyway.
Kind regards,
Andreas Hartmann
Re: [PATCH 4/7] rt2800usb: Let rt2x00usb handle USB padding
2011/12/28 Andreas Hartmann <[email protected]>:
Quoted 22 lines
Quoted 13 lines · Gertjan van Wingerde
Quoted 12 lines · Ivo Van Doorn
Quoted 9 lines · Gertjan van Wingerde
From: Jakub Kiciński <[email protected]>
Older USB drivers does not append end padding to skb but instead report it in size of data to be transmitted to HW. rt2800usb should follow that behaviour. Custom
write_tx_datacallback which was adding pad to skb is not be needed any more.Thanks to this patch frames handed back from rt2800usb to mac80211 will no longer contain end padding.
Quoted 7 lines
Quoted 3 lines
What happened to the reports that after this (and the next) patch, the non-2800 USB
drivers are failing?I have seen only 1 failure report (from Andreas Hartmann), which seemed to have been caused by not applying both patches. ISTR that Andreas did not see any regression when both patches were applied.
Quoted 5 lines
Yes, that's true. The behavior of a rt3572 dongle in my test with both patches applied was the same as without these both patches.
Please note that the test I did was very short, because the rt2800usb driver works really bad with this device anyway.
Ok, thanks for the update.
Ivo
Re: [PATCH 4/7] rt2800usb: Let rt2x00usb handle USB padding
In reply to Gertjan van WingerdeQuoted 7 lines · Gertjan van Wingerde
From: Jakub Kiciński <[email protected]>
Older USB drivers does not append end padding to skb but instead report it in size of data to be transmitted to HW. rt2800usb should follow that behaviour. Custom
write_tx_datacallback which was adding pad to skb is not be needed any more.
Quoted 5 lines
Thanks to this patch frames handed back from rt2800usb to mac80211 will no longer contain end padding.
Signed-off-by Jakub Kicinski <[email protected]>Signed-off-by Gertjan van Wingerde <[email protected]>
Quoted 78 lines
---
drivers/net/wireless/rt2x00/rt2800usb.c | 37 ++++++++----------------------1 files changed, 10 insertions(+), 27 deletions(-)drivers/net/wireless/rt2x00/rt2800usb.c +10
-28@@ -400,10 +400,10 @@ static void rt2800usb_write_tx_desc(struct queue_entry *entry, /* * The size of TXINFO_W0_USB_DMA_TX_PKT_LEN is * TXWI + 802.11 header + L2 pad + payload + pad, - * so need to decrease size of TXINFO and USB end pad. + * so need to decrease size of TXINFO. */ rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN, - entry->skb->len - TXINFO_DESC_SIZE - 4); + roundup(entry->skb->len, 4) - TXINFO_DESC_SIZE); rt2x00_set_field32(&word, TXINFO_W0_WIV, !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags)); rt2x00_set_field32(&word, TXINFO_W0_QSEL, 2);@@ -421,37 +421,20 @@ static void rt2800usb_write_tx_desc(struct queue_entry *entry, skbdesc->desc_len = TXINFO_DESC_SIZE + TXWI_DESC_SIZE; } -static void rt2800usb_write_tx_data (struct queue_entry *entry, - struct txentry_desc *txdesc) +/* +* TX data initialization +*/ +static int rt2800usb_get_tx_data_len (struct queue_entry *entry) { - unsigned int len; - int err; - - rt2800_write_tx_data(entry, txdesc); - /* - * pad(1~3 bytes) is added after each 802.11 payload. - * USB end pad(4 bytes) is added at each USB bulk out packet end. + * pad(1~3 bytes) is needed after each 802.11 payload. + * USB end pad(4 bytes) is needed at each USB bulk out packet end. * TX frame format is : * | TXINFO | TXWI | 802.11 header | L2 pad | payload | pad | USB end pad | * |<------------- tx_pkt_len ------------->| */ - len = roundup(entry->skb->len, 4) + 4; - err = skb_padto(entry->skb, len); - if (unlikely(err)) { - WARNING(entry->queue->rt2x00dev, "TX SKB padding error, out of memory\n"); - return; - } - entry->skb->len = len; -} - -/* -* TX data initialization -*/ -static int rt2800usb_get_tx_data_len (struct queue_entry *entry) -{ - return entry->skb->len; + return roundup(entry->skb->len, 4) + 4; } /*@@ -807,7 +790,7 @@ static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = { .flush_queue = rt2x00usb_flush_queue, .tx_dma_done = rt2800usb_tx_dma_done, .write_tx_desc = rt2800usb_write_tx_desc, - .write_tx_data = rt2800usb_write_tx_data, + .write_tx_data = rt2800_write_tx_data, .write_beacon = rt2800_write_beacon, .clear_beacon = rt2800_clear_beacon, .get_tx_data_len = rt2800usb_get_tx_data_len, --1.7.7.4
Re: [PATCH 5/7] rt2x00usb: Zero USB padding before sending URB
In reply to Gertjan van WingerdeQuoted 9 lines · Gertjan van Wingerde
From: Jakub Kiciński <[email protected]>
When USB driver requires padding at the end of frame or URB it will report this need by increasing return value of
get_tx_data_lencallback. Common USB code uses that return value as desired URB length.Ensure that appropriate part of skb's tailroom exists and is zeroed.
Signed-off-by Jakub Kicinski <[email protected]>
Quoted 41 lines
--
drivers/net/wireless/rt2x00/rt2x00usb.c | 16 +++++++++++++---1 files changed, 13 insertions(+), 3 deletions(-)Signed-off-by Gertjan van Wingerde <[email protected]>---
drivers/net/wireless/rt2x00/rt2x00usb.c | 16 +++++++++++++---1 files changed, 13 insertions(+), 3 deletions(-)drivers/net/wireless/rt2x00/rt2x00usb.c +13
-4@@ -298,12 +298,22 @@ static bool rt2x00usb_kick_tx_entry(struct queue_entry *entry, void* data) return false; /* - * USB devices cannot blindly pass the skb->len as the - * length of the data to usb_fill_bulk_urb. Pass the skb - * to the driver to determine what the length should be. + * USB devices require certain padding at the end of each frame + * and urb. Those paddings are not included in skbs. Pass entry + * to the driver to determine what the overall length should be. */ length = rt2x00dev->ops->lib->get_tx_data_len(entry); + status = skb_padto(entry->skb, length); + if (unlikely(status)) { + /* TODO: report something more appropriate than IO_FAILED. */ + WARNING(rt2x00dev, "TX SKB padding error, out of memory\n"); + set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); + rt2x00lib_dmadone(entry); + + return false; + } + usb_fill_bulk_urb(entry_priv->urb, usb_dev, usb_sndbulkpipe(usb_dev, entry->queue->usb_endpoint), entry->skb->data, length, --1.7.7.4