aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/tx.c
diff options
context:
space:
mode:
authorMattias Nissler <mattias.nissler@gmx.de>2007-12-20 07:50:07 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:59:17 -0500
commit1abbe498e4b5e4f2000dfc30a0fa25be9553530e (patch)
tree8f899d2f623b2316f874fd8ae4b84838ad4e8b40 /net/mac80211/tx.c
parent98f0b0a3a412eade153c7cf00c6b863600980d89 (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 'net/mac80211/tx.c')
-rw-r--r--net/mac80211/tx.c42
1 files changed, 18 insertions, 24 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 12c15588af68..4655e3038658 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -569,21 +569,17 @@ ieee80211_tx_h_encrypt(struct ieee80211_txrx_data *tx)
569static ieee80211_txrx_result 569static ieee80211_txrx_result
570ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx) 570ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx)
571{ 571{
572 struct rate_control_extra extra; 572 struct rate_selection rsel;
573 573
574 if (likely(!tx->u.tx.rate)) { 574 if (likely(!tx->u.tx.rate)) {
575 memset(&extra, 0, sizeof(extra)); 575 rate_control_get_rate(tx->dev, tx->u.tx.mode, tx->skb, &rsel);
576 extra.mode = tx->u.tx.mode; 576 tx->u.tx.rate = rsel.rate;
577 extra.ethertype = tx->ethertype; 577 if (unlikely(rsel.probe != NULL)) {
578
579 tx->u.tx.rate = rate_control_get_rate(tx->local, tx->dev,
580 tx->skb, &extra);
581 if (unlikely(extra.probe != NULL)) {
582 tx->u.tx.control->flags |= 578 tx->u.tx.control->flags |=
583 IEEE80211_TXCTL_RATE_CTRL_PROBE; 579 IEEE80211_TXCTL_RATE_CTRL_PROBE;
584 tx->flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG; 580 tx->flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG;
585 tx->u.tx.control->alt_retry_rate = tx->u.tx.rate->val; 581 tx->u.tx.control->alt_retry_rate = tx->u.tx.rate->val;
586 tx->u.tx.rate = extra.probe; 582 tx->u.tx.rate = rsel.probe;
587 } else 583 } else
588 tx->u.tx.control->alt_retry_rate = -1; 584 tx->u.tx.control->alt_retry_rate = -1;
589 585
@@ -594,14 +590,14 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx)
594 590
595 if (tx->u.tx.mode->mode == MODE_IEEE80211G && 591 if (tx->u.tx.mode->mode == MODE_IEEE80211G &&
596 (tx->sdata->flags & IEEE80211_SDATA_USE_PROTECTION) && 592 (tx->sdata->flags & IEEE80211_SDATA_USE_PROTECTION) &&
597 (tx->flags & IEEE80211_TXRXD_FRAGMENTED) && extra.nonerp) { 593 (tx->flags & IEEE80211_TXRXD_FRAGMENTED) && rsel.nonerp) {
598 tx->u.tx.last_frag_rate = tx->u.tx.rate; 594 tx->u.tx.last_frag_rate = tx->u.tx.rate;
599 if (extra.probe) 595 if (rsel.probe)
600 tx->flags &= ~IEEE80211_TXRXD_TXPROBE_LAST_FRAG; 596 tx->flags &= ~IEEE80211_TXRXD_TXPROBE_LAST_FRAG;
601 else 597 else
602 tx->flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG; 598 tx->flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG;
603 tx->u.tx.rate = extra.nonerp; 599 tx->u.tx.rate = rsel.nonerp;
604 tx->u.tx.control->rate = extra.nonerp; 600 tx->u.tx.control->rate = rsel.nonerp;
605 tx->u.tx.control->flags &= ~IEEE80211_TXCTL_RATE_CTRL_PROBE; 601 tx->u.tx.control->flags &= ~IEEE80211_TXCTL_RATE_CTRL_PROBE;
606 } else { 602 } else {
607 tx->u.tx.last_frag_rate = tx->u.tx.rate; 603 tx->u.tx.last_frag_rate = tx->u.tx.rate;
@@ -1667,8 +1663,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, int if_id,
1667 struct net_device *bdev; 1663 struct net_device *bdev;
1668 struct ieee80211_sub_if_data *sdata = NULL; 1664 struct ieee80211_sub_if_data *sdata = NULL;
1669 struct ieee80211_if_ap *ap = NULL; 1665 struct ieee80211_if_ap *ap = NULL;
1670 struct ieee80211_rate *rate; 1666 struct rate_selection rsel;
1671 struct rate_control_extra extra;
1672 u8 *b_head, *b_tail; 1667 u8 *b_head, *b_tail;
1673 int bh_len, bt_len; 1668 int bh_len, bt_len;
1674 1669
@@ -1712,14 +1707,13 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, int if_id,
1712 } 1707 }
1713 1708
1714 if (control) { 1709 if (control) {
1715 memset(&extra, 0, sizeof(extra)); 1710 rate_control_get_rate(local->mdev, local->oper_hw_mode, skb,
1716 extra.mode = local->oper_hw_mode; 1711 &rsel);
1717 1712 if (!rsel.rate) {
1718 rate = rate_control_get_rate(local, local->mdev, skb, &extra);
1719 if (!rate) {
1720 if (net_ratelimit()) { 1713 if (net_ratelimit()) {
1721 printk(KERN_DEBUG "%s: ieee80211_beacon_get: no rate " 1714 printk(KERN_DEBUG "%s: ieee80211_beacon_get: "
1722 "found\n", wiphy_name(local->hw.wiphy)); 1715 "no rate found\n",
1716 wiphy_name(local->hw.wiphy));
1723 } 1717 }
1724 dev_kfree_skb(skb); 1718 dev_kfree_skb(skb);
1725 return NULL; 1719 return NULL;
@@ -1727,8 +1721,8 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, int if_id,
1727 1721
1728 control->tx_rate = 1722 control->tx_rate =
1729 ((sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE) && 1723 ((sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE) &&
1730 (rate->flags & IEEE80211_RATE_PREAMBLE2)) ? 1724 (rsel.rate->flags & IEEE80211_RATE_PREAMBLE2)) ?
1731 rate->val2 : rate->val; 1725 rsel.rate->val2 : rsel.rate->val;
1732 control->antenna_sel_tx = local->hw.conf.antenna_sel_tx; 1726 control->antenna_sel_tx = local->hw.conf.antenna_sel_tx;
1733 control->power_level = local->hw.conf.power_level; 1727 control->power_level = local->hw.conf.power_level;
1734 control->flags |= IEEE80211_TXCTL_NO_ACK; 1728 control->flags |= IEEE80211_TXCTL_NO_ACK;