aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c10
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c10
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h31
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00config.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c4
6 files changed, 27 insertions, 34 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 861577ece713..9bda3889539c 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -322,7 +322,7 @@ static void rt2400pci_config_intf(struct rt2x00_dev *rt2x00dev,
322 /* 322 /*
323 * Enable beacon config 323 * Enable beacon config
324 */ 324 */
325 bcn_preload = PREAMBLE + get_duration(IEEE80211_HEADER, 20); 325 bcn_preload = PREAMBLE + GET_DURATION(IEEE80211_HEADER, 20);
326 rt2x00pci_register_read(rt2x00dev, BCNCSR1, &reg); 326 rt2x00pci_register_read(rt2x00dev, BCNCSR1, &reg);
327 rt2x00_set_field32(&reg, BCNCSR1_PRELOAD, bcn_preload); 327 rt2x00_set_field32(&reg, BCNCSR1_PRELOAD, bcn_preload);
328 rt2x00pci_register_write(rt2x00dev, BCNCSR1, reg); 328 rt2x00pci_register_write(rt2x00dev, BCNCSR1, reg);
@@ -367,25 +367,25 @@ static void rt2400pci_config_erp(struct rt2x00_dev *rt2x00dev,
367 rt2x00pci_register_read(rt2x00dev, ARCSR2, &reg); 367 rt2x00pci_register_read(rt2x00dev, ARCSR2, &reg);
368 rt2x00_set_field32(&reg, ARCSR2_SIGNAL, 0x00); 368 rt2x00_set_field32(&reg, ARCSR2_SIGNAL, 0x00);
369 rt2x00_set_field32(&reg, ARCSR2_SERVICE, 0x04); 369 rt2x00_set_field32(&reg, ARCSR2_SERVICE, 0x04);
370 rt2x00_set_field32(&reg, ARCSR2_LENGTH, get_duration(ACK_SIZE, 10)); 370 rt2x00_set_field32(&reg, ARCSR2_LENGTH, GET_DURATION(ACK_SIZE, 10));
371 rt2x00pci_register_write(rt2x00dev, ARCSR2, reg); 371 rt2x00pci_register_write(rt2x00dev, ARCSR2, reg);
372 372
373 rt2x00pci_register_read(rt2x00dev, ARCSR3, &reg); 373 rt2x00pci_register_read(rt2x00dev, ARCSR3, &reg);
374 rt2x00_set_field32(&reg, ARCSR3_SIGNAL, 0x01 | preamble_mask); 374 rt2x00_set_field32(&reg, ARCSR3_SIGNAL, 0x01 | preamble_mask);
375 rt2x00_set_field32(&reg, ARCSR3_SERVICE, 0x04); 375 rt2x00_set_field32(&reg, ARCSR3_SERVICE, 0x04);
376 rt2x00_set_field32(&reg, ARCSR2_LENGTH, get_duration(ACK_SIZE, 20)); 376 rt2x00_set_field32(&reg, ARCSR2_LENGTH, GET_DURATION(ACK_SIZE, 20));
377 rt2x00pci_register_write(rt2x00dev, ARCSR3, reg); 377 rt2x00pci_register_write(rt2x00dev, ARCSR3, reg);
378 378
379 rt2x00pci_register_read(rt2x00dev, ARCSR4, &reg); 379 rt2x00pci_register_read(rt2x00dev, ARCSR4, &reg);
380 rt2x00_set_field32(&reg, ARCSR4_SIGNAL, 0x02 | preamble_mask); 380 rt2x00_set_field32(&reg, ARCSR4_SIGNAL, 0x02 | preamble_mask);
381 rt2x00_set_field32(&reg, ARCSR4_SERVICE, 0x04); 381 rt2x00_set_field32(&reg, ARCSR4_SERVICE, 0x04);
382 rt2x00_set_field32(&reg, ARCSR2_LENGTH, get_duration(ACK_SIZE, 55)); 382 rt2x00_set_field32(&reg, ARCSR2_LENGTH, GET_DURATION(ACK_SIZE, 55));
383 rt2x00pci_register_write(rt2x00dev, ARCSR4, reg); 383 rt2x00pci_register_write(rt2x00dev, ARCSR4, reg);
384 384
385 rt2x00pci_register_read(rt2x00dev, ARCSR5, &reg); 385 rt2x00pci_register_read(rt2x00dev, ARCSR5, &reg);
386 rt2x00_set_field32(&reg, ARCSR5_SIGNAL, 0x03 | preamble_mask); 386 rt2x00_set_field32(&reg, ARCSR5_SIGNAL, 0x03 | preamble_mask);
387 rt2x00_set_field32(&reg, ARCSR5_SERVICE, 0x84); 387 rt2x00_set_field32(&reg, ARCSR5_SERVICE, 0x84);
388 rt2x00_set_field32(&reg, ARCSR2_LENGTH, get_duration(ACK_SIZE, 110)); 388 rt2x00_set_field32(&reg, ARCSR2_LENGTH, GET_DURATION(ACK_SIZE, 110));
389 rt2x00pci_register_write(rt2x00dev, ARCSR5, reg); 389 rt2x00pci_register_write(rt2x00dev, ARCSR5, reg);
390 390
391 rt2x00pci_register_write(rt2x00dev, ARCSR1, erp->basic_rates); 391 rt2x00pci_register_write(rt2x00dev, ARCSR1, erp->basic_rates);
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index e43ff9c79063..885844c1a3c3 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -327,7 +327,7 @@ static void rt2500pci_config_intf(struct rt2x00_dev *rt2x00dev,
327 /* 327 /*
328 * Enable beacon config 328 * Enable beacon config
329 */ 329 */
330 bcn_preload = PREAMBLE + get_duration(IEEE80211_HEADER, 20); 330 bcn_preload = PREAMBLE + GET_DURATION(IEEE80211_HEADER, 20);
331 rt2x00pci_register_read(rt2x00dev, BCNCSR1, &reg); 331 rt2x00pci_register_read(rt2x00dev, BCNCSR1, &reg);
332 rt2x00_set_field32(&reg, BCNCSR1_PRELOAD, bcn_preload); 332 rt2x00_set_field32(&reg, BCNCSR1_PRELOAD, bcn_preload);
333 rt2x00_set_field32(&reg, BCNCSR1_BEACON_CWMIN, queue->cw_min); 333 rt2x00_set_field32(&reg, BCNCSR1_BEACON_CWMIN, queue->cw_min);
@@ -373,25 +373,25 @@ static void rt2500pci_config_erp(struct rt2x00_dev *rt2x00dev,
373 rt2x00pci_register_read(rt2x00dev, ARCSR2, &reg); 373 rt2x00pci_register_read(rt2x00dev, ARCSR2, &reg);
374 rt2x00_set_field32(&reg, ARCSR2_SIGNAL, 0x00); 374 rt2x00_set_field32(&reg, ARCSR2_SIGNAL, 0x00);
375 rt2x00_set_field32(&reg, ARCSR2_SERVICE, 0x04); 375 rt2x00_set_field32(&reg, ARCSR2_SERVICE, 0x04);
376 rt2x00_set_field32(&reg, ARCSR2_LENGTH, get_duration(ACK_SIZE, 10)); 376 rt2x00_set_field32(&reg, ARCSR2_LENGTH, GET_DURATION(ACK_SIZE, 10));
377 rt2x00pci_register_write(rt2x00dev, ARCSR2, reg); 377 rt2x00pci_register_write(rt2x00dev, ARCSR2, reg);
378 378
379 rt2x00pci_register_read(rt2x00dev, ARCSR3, &reg); 379 rt2x00pci_register_read(rt2x00dev, ARCSR3, &reg);
380 rt2x00_set_field32(&reg, ARCSR3_SIGNAL, 0x01 | preamble_mask); 380 rt2x00_set_field32(&reg, ARCSR3_SIGNAL, 0x01 | preamble_mask);
381 rt2x00_set_field32(&reg, ARCSR3_SERVICE, 0x04); 381 rt2x00_set_field32(&reg, ARCSR3_SERVICE, 0x04);
382 rt2x00_set_field32(&reg, ARCSR2_LENGTH, get_duration(ACK_SIZE, 20)); 382 rt2x00_set_field32(&reg, ARCSR2_LENGTH, GET_DURATION(ACK_SIZE, 20));
383 rt2x00pci_register_write(rt2x00dev, ARCSR3, reg); 383 rt2x00pci_register_write(rt2x00dev, ARCSR3, reg);
384 384
385 rt2x00pci_register_read(rt2x00dev, ARCSR4, &reg); 385 rt2x00pci_register_read(rt2x00dev, ARCSR4, &reg);
386 rt2x00_set_field32(&reg, ARCSR4_SIGNAL, 0x02 | preamble_mask); 386 rt2x00_set_field32(&reg, ARCSR4_SIGNAL, 0x02 | preamble_mask);
387 rt2x00_set_field32(&reg, ARCSR4_SERVICE, 0x04); 387 rt2x00_set_field32(&reg, ARCSR4_SERVICE, 0x04);
388 rt2x00_set_field32(&reg, ARCSR2_LENGTH, get_duration(ACK_SIZE, 55)); 388 rt2x00_set_field32(&reg, ARCSR2_LENGTH, GET_DURATION(ACK_SIZE, 55));
389 rt2x00pci_register_write(rt2x00dev, ARCSR4, reg); 389 rt2x00pci_register_write(rt2x00dev, ARCSR4, reg);
390 390
391 rt2x00pci_register_read(rt2x00dev, ARCSR5, &reg); 391 rt2x00pci_register_read(rt2x00dev, ARCSR5, &reg);
392 rt2x00_set_field32(&reg, ARCSR5_SIGNAL, 0x03 | preamble_mask); 392 rt2x00_set_field32(&reg, ARCSR5_SIGNAL, 0x03 | preamble_mask);
393 rt2x00_set_field32(&reg, ARCSR5_SERVICE, 0x84); 393 rt2x00_set_field32(&reg, ARCSR5_SERVICE, 0x84);
394 rt2x00_set_field32(&reg, ARCSR2_LENGTH, get_duration(ACK_SIZE, 110)); 394 rt2x00_set_field32(&reg, ARCSR2_LENGTH, GET_DURATION(ACK_SIZE, 110));
395 rt2x00pci_register_write(rt2x00dev, ARCSR5, reg); 395 rt2x00pci_register_write(rt2x00dev, ARCSR5, reg);
396 396
397 rt2x00pci_register_write(rt2x00dev, ARCSR1, erp->basic_rates); 397 rt2x00pci_register_write(rt2x00dev, ARCSR1, erp->basic_rates);
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 3868e987438d..c40c9e706e98 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -385,7 +385,7 @@ static void rt2500usb_config_intf(struct rt2x00_dev *rt2x00dev,
385 /* 385 /*
386 * Enable beacon config 386 * Enable beacon config
387 */ 387 */
388 bcn_preload = PREAMBLE + get_duration(IEEE80211_HEADER, 20); 388 bcn_preload = PREAMBLE + GET_DURATION(IEEE80211_HEADER, 20);
389 rt2500usb_register_read(rt2x00dev, TXRX_CSR20, &reg); 389 rt2500usb_register_read(rt2x00dev, TXRX_CSR20, &reg);
390 rt2x00_set_field16(&reg, TXRX_CSR20_OFFSET, bcn_preload >> 6); 390 rt2x00_set_field16(&reg, TXRX_CSR20_OFFSET, bcn_preload >> 6);
391 rt2x00_set_field16(&reg, TXRX_CSR20_BCN_EXPECT_WINDOW, 391 rt2x00_set_field16(&reg, TXRX_CSR20_BCN_EXPECT_WINDOW,
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 4506f6cfc0c3..baccea7184b5 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -92,6 +92,16 @@
92 DEBUG_PRINTK(__dev, KERN_DEBUG, "EEPROM recovery", __msg, ##__args) 92 DEBUG_PRINTK(__dev, KERN_DEBUG, "EEPROM recovery", __msg, ##__args)
93 93
94/* 94/*
95 * Duration calculations
96 * The rate variable passed is: 100kbs.
97 * To convert from bytes to bits we multiply size with 8,
98 * then the size is multiplied with 10 to make the
99 * real rate -> rate argument correction.
100 */
101#define GET_DURATION(__size, __rate) (((__size) * 8 * 10) / (__rate))
102#define GET_DURATION_RES(__size, __rate)(((__size) * 8 * 10) % (__rate))
103
104/*
95 * Standard timing and size defines. 105 * Standard timing and size defines.
96 * These values should follow the ieee80211 specifications. 106 * These values should follow the ieee80211 specifications.
97 */ 107 */
@@ -109,9 +119,9 @@
109#define DIFS ( PIFS + SLOT_TIME ) 119#define DIFS ( PIFS + SLOT_TIME )
110#define SHORT_DIFS ( SHORT_PIFS + SHORT_SLOT_TIME ) 120#define SHORT_DIFS ( SHORT_PIFS + SHORT_SLOT_TIME )
111#define EIFS ( SIFS + DIFS + \ 121#define EIFS ( SIFS + DIFS + \
112 (8 * (IEEE80211_HEADER + ACK_SIZE)) ) 122 GET_DURATION(IEEE80211_HEADER + ACK_SIZE, 10) )
113#define SHORT_EIFS ( SIFS + SHORT_DIFS + \ 123#define SHORT_EIFS ( SIFS + SHORT_DIFS + \
114 (8 * (IEEE80211_HEADER + ACK_SIZE)) ) 124 GET_DURATION(IEEE80211_HEADER + ACK_SIZE, 10) )
115 125
116/* 126/*
117 * Chipset identification 127 * Chipset identification
@@ -920,23 +930,6 @@ static inline u16 rt2x00_check_rev(const struct rt2x00_chip *chipset,
920 !!(chipset->rev & 0x0000f)); 930 !!(chipset->rev & 0x0000f));
921} 931}
922 932
923/*
924 * Duration calculations
925 * The rate variable passed is: 100kbs.
926 * To convert from bytes to bits we multiply size with 8,
927 * then the size is multiplied with 10 to make the
928 * real rate -> rate argument correction.
929 */
930static inline u16 get_duration(const unsigned int size, const u8 rate)
931{
932 return ((size * 8 * 10) / rate);
933}
934
935static inline u16 get_duration_res(const unsigned int size, const u8 rate)
936{
937 return ((size * 8 * 10) % rate);
938}
939
940/** 933/**
941 * rt2x00queue_map_txskb - Map a skb into DMA for TX purposes. 934 * rt2x00queue_map_txskb - Map a skb into DMA for TX purposes.
942 * @rt2x00dev: Pointer to &struct rt2x00_dev. 935 * @rt2x00dev: Pointer to &struct rt2x00_dev.
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c
index 1059b4d1868f..7c62ce125b94 100644
--- a/drivers/net/wireless/rt2x00/rt2x00config.c
+++ b/drivers/net/wireless/rt2x00/rt2x00config.c
@@ -92,8 +92,8 @@ void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev,
92 erp.difs = bss_conf->use_short_slot ? SHORT_DIFS : DIFS; 92 erp.difs = bss_conf->use_short_slot ? SHORT_DIFS : DIFS;
93 erp.eifs = bss_conf->use_short_slot ? SHORT_EIFS : EIFS; 93 erp.eifs = bss_conf->use_short_slot ? SHORT_EIFS : EIFS;
94 94
95 erp.ack_timeout = PLCP + erp.difs + get_duration(ACK_SIZE, 10); 95 erp.ack_timeout = PLCP + erp.difs + GET_DURATION(ACK_SIZE, 10);
96 erp.ack_consume_time = SIFS + PLCP + get_duration(ACK_SIZE, 10); 96 erp.ack_consume_time = SIFS + PLCP + GET_DURATION(ACK_SIZE, 10);
97 97
98 if (bss_conf->use_short_preamble) { 98 if (bss_conf->use_short_preamble) {
99 erp.ack_timeout += SHORT_PREAMBLE; 99 erp.ack_timeout += SHORT_PREAMBLE;
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index 7fc9c6eff98b..d7752dbd2023 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -319,8 +319,8 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
319 /* 319 /*
320 * Convert length to microseconds. 320 * Convert length to microseconds.
321 */ 321 */
322 residual = get_duration_res(data_length, hwrate->bitrate); 322 residual = GET_DURATION_RES(data_length, hwrate->bitrate);
323 duration = get_duration(data_length, hwrate->bitrate); 323 duration = GET_DURATION(data_length, hwrate->bitrate);
324 324
325 if (residual != 0) { 325 if (residual != 0) {
326 duration++; 326 duration++;