diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 44 | ||||
| -rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965-rs.c | 46 |
2 files changed, 17 insertions, 73 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 = { |
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) |
