diff options
author | Mattias Nissler <mattias.nissler@gmx.de> | 2007-12-20 07:50:07 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:59:17 -0500 |
commit | 1abbe498e4b5e4f2000dfc30a0fa25be9553530e (patch) | |
tree | 8f899d2f623b2316f874fd8ae4b84838ad4e8b40 /drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |
parent | 98f0b0a3a412eade153c7cf00c6b863600980d89 (diff) |
mac80211: clean up rate selection
Move some code out of rc80211_simple since it's probably needed for all rate
selection algorithms, and fix iwlwifi accordingly. While at it, clean up the
rate_control_get_rate() interface.
Signed-off-by: Stefano Brivio <stefano.brivio@polimi.it>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-3945-rs.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 44 |
1 files changed, 7 insertions, 37 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index c48b1b537d2b..ea7f459e961b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |||
@@ -562,22 +562,6 @@ static void rs_tx_status(void *priv_rate, | |||
562 | return; | 562 | return; |
563 | } | 563 | } |
564 | 564 | ||
565 | static struct ieee80211_rate *iwl_get_lowest_rate(struct ieee80211_local | ||
566 | *local) | ||
567 | { | ||
568 | struct ieee80211_hw_mode *mode = local->oper_hw_mode; | ||
569 | int i; | ||
570 | |||
571 | for (i = 0; i < mode->num_rates; i++) { | ||
572 | struct ieee80211_rate *rate = &mode->rates[i]; | ||
573 | |||
574 | if (rate->flags & IEEE80211_RATE_SUPPORTED) | ||
575 | return rate; | ||
576 | } | ||
577 | |||
578 | return &mode->rates[0]; | ||
579 | } | ||
580 | |||
581 | static u16 iwl_get_adjacent_rate(struct iwl_rate_scale_priv *rs_priv, | 565 | static u16 iwl_get_adjacent_rate(struct iwl_rate_scale_priv *rs_priv, |
582 | u8 index, u16 rate_mask, int phymode) | 566 | u8 index, u16 rate_mask, int phymode) |
583 | { | 567 | { |
@@ -656,10 +640,9 @@ static u16 iwl_get_adjacent_rate(struct iwl_rate_scale_priv *rs_priv, | |||
656 | * rate table and must reference the driver allocated rate table | 640 | * rate table and must reference the driver allocated rate table |
657 | * | 641 | * |
658 | */ | 642 | */ |
659 | static struct ieee80211_rate *rs_get_rate(void *priv_rate, | 643 | static void rs_get_rate(void *priv_rate, struct net_device *dev, |
660 | struct net_device *dev, | 644 | struct ieee80211_hw_mode *mode, struct sk_buff *skb, |
661 | struct sk_buff *skb, | 645 | struct rate_selection *sel) |
662 | struct rate_control_extra *extra) | ||
663 | { | 646 | { |
664 | u8 low = IWL_RATE_INVALID; | 647 | u8 low = IWL_RATE_INVALID; |
665 | u8 high = IWL_RATE_INVALID; | 648 | u8 high = IWL_RATE_INVALID; |
@@ -676,32 +659,19 @@ static struct ieee80211_rate *rs_get_rate(void *priv_rate, | |||
676 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 659 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
677 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 660 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
678 | struct sta_info *sta; | 661 | struct sta_info *sta; |
679 | u16 fc, rate_mask; | 662 | u16 rate_mask; |
680 | struct iwl_priv *priv = (struct iwl_priv *)priv_rate; | 663 | struct iwl_priv *priv = (struct iwl_priv *)priv_rate; |
681 | DECLARE_MAC_BUF(mac); | 664 | DECLARE_MAC_BUF(mac); |
682 | 665 | ||
683 | IWL_DEBUG_RATE("enter\n"); | 666 | IWL_DEBUG_RATE("enter\n"); |
684 | 667 | ||
685 | memset(extra, 0, sizeof(*extra)); | ||
686 | |||
687 | fc = le16_to_cpu(hdr->frame_control); | ||
688 | if (((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) || | ||
689 | (is_multicast_ether_addr(hdr->addr1))) { | ||
690 | /* Send management frames and broadcast/multicast data using | ||
691 | * lowest rate. */ | ||
692 | /* TODO: this could probably be improved.. */ | ||
693 | IWL_DEBUG_RATE("leave: lowest rate (not data or is " | ||
694 | "multicast)\n"); | ||
695 | |||
696 | return iwl_get_lowest_rate(local); | ||
697 | } | ||
698 | |||
699 | sta = sta_info_get(local, hdr->addr1); | 668 | sta = sta_info_get(local, hdr->addr1); |
700 | if (!sta || !sta->rate_ctrl_priv) { | 669 | if (!sta || !sta->rate_ctrl_priv) { |
701 | IWL_DEBUG_RATE("leave: No STA priv data to update!\n"); | 670 | IWL_DEBUG_RATE("leave: No STA priv data to update!\n"); |
671 | sel->rate = rate_lowest(local, local->oper_hw_mode, sta); | ||
702 | if (sta) | 672 | if (sta) |
703 | sta_info_put(sta); | 673 | sta_info_put(sta); |
704 | return NULL; | 674 | return; |
705 | } | 675 | } |
706 | 676 | ||
707 | rate_mask = sta->supp_rates; | 677 | rate_mask = sta->supp_rates; |
@@ -846,7 +816,7 @@ static struct ieee80211_rate *rs_get_rate(void *priv_rate, | |||
846 | 816 | ||
847 | IWL_DEBUG_RATE("leave: %d\n", index); | 817 | IWL_DEBUG_RATE("leave: %d\n", index); |
848 | 818 | ||
849 | return &priv->ieee_rates[index]; | 819 | sel->rate = &priv->ieee_rates[index]; |
850 | } | 820 | } |
851 | 821 | ||
852 | static struct rate_control_ops rs_ops = { | 822 | static struct rate_control_ops rs_ops = { |