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-4965-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-4965-rs.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965-rs.c | 46 |
1 files changed, 10 insertions, 36 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c index 8dc78c0bf1ff..62a3b52b3270 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c | |||
@@ -1693,55 +1693,27 @@ static void rs_initialize_lq(struct iwl_priv *priv, | |||
1693 | return; | 1693 | return; |
1694 | } | 1694 | } |
1695 | 1695 | ||
1696 | static struct ieee80211_rate *rs_get_lowest_rate(struct ieee80211_local | 1696 | static void rs_get_rate(void *priv_rate, struct net_device *dev, |
1697 | *local) | 1697 | struct ieee80211_hw_mode *mode, struct sk_buff *skb, |
1698 | { | 1698 | struct rate_selection *sel) |
1699 | struct ieee80211_hw_mode *mode = local->oper_hw_mode; | ||
1700 | int i; | ||
1701 | |||
1702 | for (i = 0; i < mode->num_rates; i++) { | ||
1703 | struct ieee80211_rate *rate = &mode->rates[i]; | ||
1704 | |||
1705 | if (rate->flags & IEEE80211_RATE_SUPPORTED) | ||
1706 | return rate; | ||
1707 | } | ||
1708 | |||
1709 | return &mode->rates[0]; | ||
1710 | } | ||
1711 | |||
1712 | static struct ieee80211_rate *rs_get_rate(void *priv_rate, | ||
1713 | struct net_device *dev, | ||
1714 | struct sk_buff *skb, | ||
1715 | struct rate_control_extra | ||
1716 | *extra) | ||
1717 | { | 1699 | { |
1718 | 1700 | ||
1719 | int i; | 1701 | int i; |
1720 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1702 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
1721 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 1703 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
1722 | struct sta_info *sta; | 1704 | struct sta_info *sta; |
1723 | u16 fc; | ||
1724 | struct iwl_priv *priv = (struct iwl_priv *)priv_rate; | 1705 | struct iwl_priv *priv = (struct iwl_priv *)priv_rate; |
1725 | struct iwl_rate_scale_priv *lq; | 1706 | struct iwl_rate_scale_priv *lq; |
1726 | 1707 | ||
1727 | IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n"); | 1708 | IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n"); |
1728 | 1709 | ||
1729 | memset(extra, 0, sizeof(*extra)); | ||
1730 | |||
1731 | fc = le16_to_cpu(hdr->frame_control); | ||
1732 | if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1)) { | ||
1733 | /* Send management frames and broadcast/multicast data using | ||
1734 | * lowest rate. */ | ||
1735 | /* TODO: this could probably be improved.. */ | ||
1736 | return rs_get_lowest_rate(local); | ||
1737 | } | ||
1738 | |||
1739 | sta = sta_info_get(local, hdr->addr1); | 1710 | sta = sta_info_get(local, hdr->addr1); |
1740 | 1711 | ||
1741 | if (!sta || !sta->rate_ctrl_priv) { | 1712 | if (!sta || !sta->rate_ctrl_priv) { |
1713 | sel->rate = rate_lowest(local, local->oper_hw_mode, sta); | ||
1742 | if (sta) | 1714 | if (sta) |
1743 | sta_info_put(sta); | 1715 | sta_info_put(sta); |
1744 | return rs_get_lowest_rate(local); | 1716 | return; |
1745 | } | 1717 | } |
1746 | 1718 | ||
1747 | lq = (struct iwl_rate_scale_priv *)sta->rate_ctrl_priv; | 1719 | lq = (struct iwl_rate_scale_priv *)sta->rate_ctrl_priv; |
@@ -1768,11 +1740,13 @@ static struct ieee80211_rate *rs_get_rate(void *priv_rate, | |||
1768 | } | 1740 | } |
1769 | 1741 | ||
1770 | done: | 1742 | done: |
1743 | if ((i < 0) || (i > IWL_RATE_COUNT)) { | ||
1744 | sel->rate = rate_lowest(local, local->oper_hw_mode, sta); | ||
1745 | return; | ||
1746 | } | ||
1771 | sta_info_put(sta); | 1747 | sta_info_put(sta); |
1772 | if ((i < 0) || (i > IWL_RATE_COUNT)) | ||
1773 | return rs_get_lowest_rate(local); | ||
1774 | 1748 | ||
1775 | return &priv->ieee_rates[i]; | 1749 | sel->rate = &priv->ieee_rates[i]; |
1776 | } | 1750 | } |
1777 | 1751 | ||
1778 | static void *rs_alloc_sta(void *priv, gfp_t gfp) | 1752 | static void *rs_alloc_sta(void *priv, gfp_t gfp) |