aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath9k')
-rw-r--r--drivers/net/wireless/ath9k/core.c2
-rw-r--r--drivers/net/wireless/ath9k/rc.c143
-rw-r--r--drivers/net/wireless/ath9k/rc.h2
3 files changed, 20 insertions, 127 deletions
diff --git a/drivers/net/wireless/ath9k/core.c b/drivers/net/wireless/ath9k/core.c
index 3e94dab6c9d9..bab9eaa18da4 100644
--- a/drivers/net/wireless/ath9k/core.c
+++ b/drivers/net/wireless/ath9k/core.c
@@ -1075,7 +1075,7 @@ int ath_init(u16 devid, struct ath_softc *sc)
1075 sc->sc_ani.sc_noise_floor = ATH_DEFAULT_NOISE_FLOOR; 1075 sc->sc_ani.sc_noise_floor = ATH_DEFAULT_NOISE_FLOOR;
1076 setup_timer(&sc->sc_ani.timer, ath_ani_calibrate, (unsigned long)sc); 1076 setup_timer(&sc->sc_ani.timer, ath_ani_calibrate, (unsigned long)sc);
1077 1077
1078 sc->sc_rc = ath_rate_attach(ah); 1078 sc->sc_rc = ath_rate_attach(sc);
1079 if (sc->sc_rc == NULL) { 1079 if (sc->sc_rc == NULL) {
1080 error = -EIO; 1080 error = -EIO;
1081 goto bad2; 1081 goto bad2;
diff --git a/drivers/net/wireless/ath9k/rc.c b/drivers/net/wireless/ath9k/rc.c
index 1ec5861d34da..aafd10df9279 100644
--- a/drivers/net/wireless/ath9k/rc.c
+++ b/drivers/net/wireless/ath9k/rc.c
@@ -348,72 +348,6 @@ static struct ath_rate_table ar5416_11a_ratetable = {
348 0, /* Phy rates allowed initially */ 348 0, /* Phy rates allowed initially */
349}; 349};
350 350
351static struct ath_rate_table ar5416_11a_ratetable_Half = {
352 8,
353 {
354 { TRUE, TRUE, WLAN_PHY_OFDM, 3000, /* 6 Mb */
355 2700, 0x0b, 0x00, (0x80|6),
356 0, 2, 1, 0, 0},
357 { TRUE, TRUE, WLAN_PHY_OFDM, 4500, /* 9 Mb */
358 3900, 0x0f, 0x00, 9,
359 0, 3, 1, 1, 0 },
360 { TRUE, TRUE, WLAN_PHY_OFDM, 6000, /* 12 Mb */
361 5000, 0x0a, 0x00, (0x80|12),
362 2, 4, 2, 2, 0 },
363 { TRUE, TRUE, WLAN_PHY_OFDM, 9000, /* 18 Mb */
364 6950, 0x0e, 0x00, 18,
365 2, 6, 2, 3, 0 },
366 { TRUE, TRUE, WLAN_PHY_OFDM, 12000, /* 24 Mb */
367 8650, 0x09, 0x00, (0x80|24),
368 4, 10, 3, 4, 0 },
369 { TRUE, TRUE, WLAN_PHY_OFDM, 18000, /* 36 Mb */
370 11500, 0x0d, 0x00, 36,
371 4, 14, 3, 5, 0 },
372 { TRUE, TRUE, WLAN_PHY_OFDM, 24000, /* 48 Mb */
373 13700, 0x08, 0x00, 48,
374 4, 19, 3, 6, 0 },
375 { TRUE, TRUE, WLAN_PHY_OFDM, 27000, /* 54 Mb */
376 14650, 0x0c, 0x00, 54,
377 4, 23, 3, 7, 0 },
378 },
379 50, /* probe interval */
380 50, /* rssi reduce interval */
381 0, /* Phy rates allowed initially */
382};
383
384static struct ath_rate_table ar5416_11a_ratetable_Quarter = {
385 8,
386 {
387 { TRUE, TRUE, WLAN_PHY_OFDM, 1500, /* 6 Mb */
388 1350, 0x0b, 0x00, (0x80|3),
389 0, 2, 1, 0, 0 },
390 { TRUE, TRUE, WLAN_PHY_OFDM, 2250, /* 9 Mb */
391 1950, 0x0f, 0x00, 4,
392 0, 3, 1, 1, 0 },
393 { TRUE, TRUE, WLAN_PHY_OFDM, 3000, /* 12 Mb */
394 2500, 0x0a, 0x00, (0x80|6),
395 2, 4, 2, 2, 0 },
396 { TRUE, TRUE, WLAN_PHY_OFDM, 4500, /* 18 Mb */
397 3475, 0x0e, 0x00, 9,
398 2, 6, 2, 3, 0 },
399 { TRUE, TRUE, WLAN_PHY_OFDM, 6000, /* 25 Mb */
400 4325, 0x09, 0x00, (0x80|12),
401 4, 10, 3, 4, 0 },
402 { TRUE, TRUE, WLAN_PHY_OFDM, 9000, /* 36 Mb */
403 5750, 0x0d, 0x00, 18,
404 4, 14, 3, 5, 0 },
405 { TRUE, TRUE, WLAN_PHY_OFDM, 12000, /* 48 Mb */
406 6850, 0x08, 0x00, 24,
407 4, 19, 3, 6, 0 },
408 { TRUE, TRUE, WLAN_PHY_OFDM, 13500, /* 54 Mb */
409 7325, 0x0c, 0x00, 27,
410 4, 23, 3, 7, 0 },
411 },
412 50, /* probe interval */
413 50, /* rssi reduce interval */
414 0, /* Phy rates allowed initially */
415};
416
417static struct ath_rate_table ar5416_11g_ratetable = { 351static struct ath_rate_table ar5416_11g_ratetable = {
418 12, 352 12,
419 { 353 {
@@ -480,45 +414,6 @@ static struct ath_rate_table ar5416_11b_ratetable = {
480 0, /* Phy rates allowed initially */ 414 0, /* Phy rates allowed initially */
481}; 415};
482 416
483static void ar5416_attach_ratetables(struct ath_rate_softc *sc)
484{
485 /*
486 * Attach rate tables.
487 */
488 sc->hw_rate_table[ATH9K_MODE_11B] = &ar5416_11b_ratetable;
489 sc->hw_rate_table[ATH9K_MODE_11A] = &ar5416_11a_ratetable;
490 sc->hw_rate_table[ATH9K_MODE_11G] = &ar5416_11g_ratetable;
491
492 sc->hw_rate_table[ATH9K_MODE_11NA_HT20] = &ar5416_11na_ratetable;
493 sc->hw_rate_table[ATH9K_MODE_11NG_HT20] = &ar5416_11ng_ratetable;
494 sc->hw_rate_table[ATH9K_MODE_11NA_HT40PLUS] =
495 &ar5416_11na_ratetable;
496 sc->hw_rate_table[ATH9K_MODE_11NA_HT40MINUS] =
497 &ar5416_11na_ratetable;
498 sc->hw_rate_table[ATH9K_MODE_11NG_HT40PLUS] =
499 &ar5416_11ng_ratetable;
500 sc->hw_rate_table[ATH9K_MODE_11NG_HT40MINUS] =
501 &ar5416_11ng_ratetable;
502}
503
504static void ar5416_setquarter_ratetable(struct ath_rate_softc *sc)
505{
506 sc->hw_rate_table[ATH9K_MODE_11A] = &ar5416_11a_ratetable_Quarter;
507 return;
508}
509
510static void ar5416_sethalf_ratetable(struct ath_rate_softc *sc)
511{
512 sc->hw_rate_table[ATH9K_MODE_11A] = &ar5416_11a_ratetable_Half;
513 return;
514}
515
516static void ar5416_setfull_ratetable(struct ath_rate_softc *sc)
517{
518 sc->hw_rate_table[ATH9K_MODE_11A] = &ar5416_11a_ratetable;
519 return;
520}
521
522/* 417/*
523 * Return the median of three numbers 418 * Return the median of three numbers
524 */ 419 */
@@ -758,25 +653,33 @@ ath_rc_sib_setvalid_htrates(struct ath_rate_node *ath_rc_priv,
758 return hi; 653 return hi;
759} 654}
760 655
761/* 656struct ath_rate_softc *ath_rate_attach(struct ath_softc *sc)
762 * Attach to a device instance. Setup the public definition
763 * of how much per-node space we need and setup the private
764 * phy tables that have rate control parameters.
765 */
766struct ath_rate_softc *ath_rate_attach(struct ath_hal *ah)
767{ 657{
768 struct ath_rate_softc *asc; 658 struct ath_rate_softc *asc;
769 659
770 /* we are only in user context so we can sleep for memory */
771 asc = kzalloc(sizeof(struct ath_rate_softc), GFP_KERNEL); 660 asc = kzalloc(sizeof(struct ath_rate_softc), GFP_KERNEL);
772 if (asc == NULL) 661 if (asc == NULL)
773 return NULL; 662 return NULL;
774 663
775 ar5416_attach_ratetables(asc); 664 asc->hw_rate_table[ATH9K_MODE_11B] = &ar5416_11b_ratetable;
665 asc->hw_rate_table[ATH9K_MODE_11A] = &ar5416_11a_ratetable;
666 asc->hw_rate_table[ATH9K_MODE_11G] = &ar5416_11g_ratetable;
667
668 asc->hw_rate_table[ATH9K_MODE_11NA_HT20] = &ar5416_11na_ratetable;
669 asc->hw_rate_table[ATH9K_MODE_11NG_HT20] = &ar5416_11ng_ratetable;
670
671 asc->hw_rate_table[ATH9K_MODE_11NA_HT40PLUS] =
672 &ar5416_11na_ratetable;
673 asc->hw_rate_table[ATH9K_MODE_11NA_HT40MINUS] =
674 &ar5416_11na_ratetable;
675 asc->hw_rate_table[ATH9K_MODE_11NG_HT40PLUS] =
676 &ar5416_11ng_ratetable;
677 asc->hw_rate_table[ATH9K_MODE_11NG_HT40MINUS] =
678 &ar5416_11ng_ratetable;
776 679
777 /* Save Maximum TX Trigger Level (used for 11n) */ 680 /* Save Maximum TX Trigger Level (used for 11n) */
778 tx_triglevel_max = ah->ah_caps.tx_triglevel_max; 681 tx_triglevel_max = sc->sc_ah->ah_caps.tx_triglevel_max;
779 /* return alias for ath_rate_softc * */ 682
780 return asc; 683 return asc;
781} 684}
782 685
@@ -816,16 +719,6 @@ void ath_rate_newstate(struct ath_softc *sc, struct ath_vap *avp)
816{ 719{
817 struct ath_rate_softc *asc = sc->sc_rc; 720 struct ath_rate_softc *asc = sc->sc_rc;
818 721
819 /* For half and quarter rate channles use different
820 * rate tables
821 */
822 if (sc->sc_ah->ah_curchan->channelFlags & CHANNEL_HALF)
823 ar5416_sethalf_ratetable(asc);
824 else if (sc->sc_ah->ah_curchan->channelFlags & CHANNEL_QUARTER)
825 ar5416_setquarter_ratetable(asc);
826 else /* full rate */
827 ar5416_setfull_ratetable(asc);
828
829 if (avp->av_config.av_fixed_rateset != IEEE80211_FIXED_RATE_NONE) { 722 if (avp->av_config.av_fixed_rateset != IEEE80211_FIXED_RATE_NONE) {
830 asc->fixedrix = 723 asc->fixedrix =
831 sc->sc_rixmap[avp->av_config.av_fixed_rateset & 0xff]; 724 sc->sc_rixmap[avp->av_config.av_fixed_rateset & 0xff];
diff --git a/drivers/net/wireless/ath9k/rc.h b/drivers/net/wireless/ath9k/rc.h
index 2166243045de..2d8df836d533 100644
--- a/drivers/net/wireless/ath9k/rc.h
+++ b/drivers/net/wireless/ath9k/rc.h
@@ -290,7 +290,7 @@ struct ath_tx_info_priv {
290/* 290/*
291 * Attach/detach a rate control module. 291 * Attach/detach a rate control module.
292 */ 292 */
293struct ath_rate_softc *ath_rate_attach(struct ath_hal *ah); 293struct ath_rate_softc *ath_rate_attach(struct ath_softc *sch);
294void ath_rate_detach(struct ath_rate_softc *asc); 294void ath_rate_detach(struct ath_rate_softc *asc);
295 295
296/* 296/*