diff options
author | Daniel Drake <dsd@gentoo.org> | 2007-07-27 09:43:24 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:47:38 -0400 |
commit | 7e9ed18874f0df84b6651f0636e1cfdac43bc610 (patch) | |
tree | 7bac6083031a48e488c0de5bf71e7f9398e0e011 /net/mac80211/tx.c | |
parent | d5d08def9216c445339c5a24a2cdc9cc2c8c13f7 (diff) |
[MAC80211]: improved short preamble handling
Similarly to CTS protection, whether short preambles are used for 802.11b
transmissions should be a per-subif setting, not device global.
For STAs, this patch makes short preamble handling automatic based on the ERP
IE. For APs, hostapd still uses the prism ioctls, but the write ioctl has been
restricted to AP-only subifs.
ieee80211_txrx_data.short_preamble (an unused field) was removed.
Unfortunately, some API changes were required for the following functions:
- ieee80211_generic_frame_duration
- ieee80211_rts_duration
- ieee80211_ctstoself_duration
- ieee80211_rts_get
- ieee80211_ctstoself_get
Affected drivers were updated accordingly.
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: Jiri Benc <jbenc@suse.cz>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r-- | net/mac80211/tx.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 532cf5127b70..36761c7139bc 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -173,7 +173,7 @@ static u16 ieee80211_duration(struct ieee80211_txrx_data *tx, int group_addr, | |||
173 | * to closest integer */ | 173 | * to closest integer */ |
174 | 174 | ||
175 | dur = ieee80211_frame_duration(local, 10, rate, erp, | 175 | dur = ieee80211_frame_duration(local, 10, rate, erp, |
176 | local->short_preamble); | 176 | tx->sdata->short_preamble); |
177 | 177 | ||
178 | if (next_frag_len) { | 178 | if (next_frag_len) { |
179 | /* Frame is fragmented: duration increases with time needed to | 179 | /* Frame is fragmented: duration increases with time needed to |
@@ -182,7 +182,7 @@ static u16 ieee80211_duration(struct ieee80211_txrx_data *tx, int group_addr, | |||
182 | /* next fragment */ | 182 | /* next fragment */ |
183 | dur += ieee80211_frame_duration(local, next_frag_len, | 183 | dur += ieee80211_frame_duration(local, next_frag_len, |
184 | txrate->rate, erp, | 184 | txrate->rate, erp, |
185 | local->short_preamble); | 185 | tx->sdata->short_preamble); |
186 | } | 186 | } |
187 | 187 | ||
188 | return dur; | 188 | return dur; |
@@ -627,12 +627,6 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx) | |||
627 | tx->u.tx.control->rate = tx->u.tx.rate; | 627 | tx->u.tx.control->rate = tx->u.tx.rate; |
628 | } | 628 | } |
629 | tx->u.tx.control->tx_rate = tx->u.tx.rate->val; | 629 | tx->u.tx.control->tx_rate = tx->u.tx.rate->val; |
630 | if ((tx->u.tx.rate->flags & IEEE80211_RATE_PREAMBLE2) && | ||
631 | tx->local->short_preamble && | ||
632 | (!tx->sta || (tx->sta->flags & WLAN_STA_SHORT_PREAMBLE))) { | ||
633 | tx->u.tx.short_preamble = 1; | ||
634 | tx->u.tx.control->tx_rate = tx->u.tx.rate->val2; | ||
635 | } | ||
636 | 630 | ||
637 | return TXRX_CONTINUE; | 631 | return TXRX_CONTINUE; |
638 | } | 632 | } |
@@ -641,6 +635,7 @@ static ieee80211_txrx_result | |||
641 | ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx) | 635 | ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx) |
642 | { | 636 | { |
643 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data; | 637 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data; |
638 | u16 fc = le16_to_cpu(hdr->frame_control); | ||
644 | u16 dur; | 639 | u16 dur; |
645 | struct ieee80211_tx_control *control = tx->u.tx.control; | 640 | struct ieee80211_tx_control *control = tx->u.tx.control; |
646 | struct ieee80211_hw_mode *mode = tx->u.tx.mode; | 641 | struct ieee80211_hw_mode *mode = tx->u.tx.mode; |
@@ -677,6 +672,16 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx) | |||
677 | !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS)) | 672 | !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS)) |
678 | control->flags |= IEEE80211_TXCTL_USE_CTS_PROTECT; | 673 | control->flags |= IEEE80211_TXCTL_USE_CTS_PROTECT; |
679 | 674 | ||
675 | /* Transmit data frames using short preambles if the driver supports | ||
676 | * short preambles at the selected rate and short preambles are | ||
677 | * available on the network at the current point in time. */ | ||
678 | if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) && | ||
679 | (tx->u.tx.rate->flags & IEEE80211_RATE_PREAMBLE2) && | ||
680 | tx->sdata->short_preamble && | ||
681 | (!tx->sta || (tx->sta->flags & WLAN_STA_SHORT_PREAMBLE))) { | ||
682 | tx->u.tx.control->tx_rate = tx->u.tx.rate->val2; | ||
683 | } | ||
684 | |||
680 | /* Setup duration field for the first fragment of the frame. Duration | 685 | /* Setup duration field for the first fragment of the frame. Duration |
681 | * for remaining fragments will be updated when they are being sent | 686 | * for remaining fragments will be updated when they are being sent |
682 | * to low-level driver in ieee80211_tx(). */ | 687 | * to low-level driver in ieee80211_tx(). */ |
@@ -1750,7 +1755,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, int if_id, | |||
1750 | return NULL; | 1755 | return NULL; |
1751 | } | 1756 | } |
1752 | 1757 | ||
1753 | control->tx_rate = (local->short_preamble && | 1758 | control->tx_rate = (sdata->short_preamble && |
1754 | (rate->flags & IEEE80211_RATE_PREAMBLE2)) ? | 1759 | (rate->flags & IEEE80211_RATE_PREAMBLE2)) ? |
1755 | rate->val2 : rate->val; | 1760 | rate->val2 : rate->val; |
1756 | control->antenna_sel_tx = local->hw.conf.antenna_sel_tx; | 1761 | control->antenna_sel_tx = local->hw.conf.antenna_sel_tx; |
@@ -1765,7 +1770,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, int if_id, | |||
1765 | } | 1770 | } |
1766 | EXPORT_SYMBOL(ieee80211_beacon_get); | 1771 | EXPORT_SYMBOL(ieee80211_beacon_get); |
1767 | 1772 | ||
1768 | void ieee80211_rts_get(struct ieee80211_hw *hw, | 1773 | void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, |
1769 | const void *frame, size_t frame_len, | 1774 | const void *frame, size_t frame_len, |
1770 | const struct ieee80211_tx_control *frame_txctl, | 1775 | const struct ieee80211_tx_control *frame_txctl, |
1771 | struct ieee80211_rts *rts) | 1776 | struct ieee80211_rts *rts) |
@@ -1775,13 +1780,13 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, | |||
1775 | 1780 | ||
1776 | fctl = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS; | 1781 | fctl = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS; |
1777 | rts->frame_control = cpu_to_le16(fctl); | 1782 | rts->frame_control = cpu_to_le16(fctl); |
1778 | rts->duration = ieee80211_rts_duration(hw, frame_len, frame_txctl); | 1783 | rts->duration = ieee80211_rts_duration(hw, if_id, frame_len, frame_txctl); |
1779 | memcpy(rts->ra, hdr->addr1, sizeof(rts->ra)); | 1784 | memcpy(rts->ra, hdr->addr1, sizeof(rts->ra)); |
1780 | memcpy(rts->ta, hdr->addr2, sizeof(rts->ta)); | 1785 | memcpy(rts->ta, hdr->addr2, sizeof(rts->ta)); |
1781 | } | 1786 | } |
1782 | EXPORT_SYMBOL(ieee80211_rts_get); | 1787 | EXPORT_SYMBOL(ieee80211_rts_get); |
1783 | 1788 | ||
1784 | void ieee80211_ctstoself_get(struct ieee80211_hw *hw, | 1789 | void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, |
1785 | const void *frame, size_t frame_len, | 1790 | const void *frame, size_t frame_len, |
1786 | const struct ieee80211_tx_control *frame_txctl, | 1791 | const struct ieee80211_tx_control *frame_txctl, |
1787 | struct ieee80211_cts *cts) | 1792 | struct ieee80211_cts *cts) |
@@ -1791,7 +1796,7 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw, | |||
1791 | 1796 | ||
1792 | fctl = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS; | 1797 | fctl = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS; |
1793 | cts->frame_control = cpu_to_le16(fctl); | 1798 | cts->frame_control = cpu_to_le16(fctl); |
1794 | cts->duration = ieee80211_ctstoself_duration(hw, frame_len, frame_txctl); | 1799 | cts->duration = ieee80211_ctstoself_duration(hw, if_id, frame_len, frame_txctl); |
1795 | memcpy(cts->ra, hdr->addr1, sizeof(cts->ra)); | 1800 | memcpy(cts->ra, hdr->addr1, sizeof(cts->ra)); |
1796 | } | 1801 | } |
1797 | EXPORT_SYMBOL(ieee80211_ctstoself_get); | 1802 | EXPORT_SYMBOL(ieee80211_ctstoself_get); |