diff options
author | Daniel Drake <dsd@gentoo.org> | 2006-05-01 17:45:50 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2006-05-05 17:10:41 -0400 |
commit | 8462fe3cd9ec8951871a20a4dfe36321ab075964 (patch) | |
tree | 8b3c6db6091ee99b4791a911734229181ef6f473 /include/net | |
parent | 461c078c9cdfc1d24a436a87daed90f18c3b0d0d (diff) |
[PATCH] softmac: suggest per-frame-type TX rate
This patch is the first step towards rate control inside softmac.
The txrates substructure has been extended to provide
different fields for different types of packets (management/data,
unicast/multicast). These fields are updated on association to values
compatible with the access point we are associating to.
Drivers can then use the new ieee80211softmac_suggest_txrate() function
call when deciding which rate to transmit each frame at. This is
immensely useful for ZD1211, and bcm can use it too.
The user can still specify a rate through iwconfig, which is matched
for all transmissions (assuming the rate they have specified is in
the rate set required by the AP).
At a later date, we can incorporate automatic rate management into
the ieee80211softmac_recalc_txrates() function.
This patch also removes the mcast_fallback field. Sam Leffler pointed
out that this field is meaningless, because no driver will ever be
retransmitting mcast frames (they are not acked).
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/ieee80211softmac.h | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/include/net/ieee80211softmac.h b/include/net/ieee80211softmac.h index 052ed596a4e4..703463a8828b 100644 --- a/include/net/ieee80211softmac.h +++ b/include/net/ieee80211softmac.h | |||
@@ -86,6 +86,9 @@ struct ieee80211softmac_assoc_info { | |||
86 | 86 | ||
87 | /* BSSID we're trying to associate to */ | 87 | /* BSSID we're trying to associate to */ |
88 | char bssid[ETH_ALEN]; | 88 | char bssid[ETH_ALEN]; |
89 | |||
90 | /* Rates supported by the network */ | ||
91 | struct ieee80211softmac_ratesinfo supported_rates; | ||
89 | 92 | ||
90 | /* some flags. | 93 | /* some flags. |
91 | * static_essid is valid if the essid is constant, | 94 | * static_essid is valid if the essid is constant, |
@@ -132,23 +135,26 @@ enum { | |||
132 | struct ieee80211softmac_txrates { | 135 | struct ieee80211softmac_txrates { |
133 | /* The Bit-Rate to be used for multicast frames. */ | 136 | /* The Bit-Rate to be used for multicast frames. */ |
134 | u8 mcast_rate; | 137 | u8 mcast_rate; |
135 | /* The Bit-Rate to be used for multicast fallback | 138 | |
136 | * (If the device supports fallback and hardware-retry) | 139 | /* The Bit-Rate to be used for multicast management frames. */ |
137 | */ | 140 | u8 mgt_mcast_rate; |
138 | u8 mcast_fallback; | 141 | |
139 | /* The Bit-Rate to be used for any other (normal) data packet. */ | 142 | /* The Bit-Rate to be used for any other (normal) data packet. */ |
140 | u8 default_rate; | 143 | u8 default_rate; |
141 | /* The Bit-Rate to be used for default fallback | 144 | /* The Bit-Rate to be used for default fallback |
142 | * (If the device supports fallback and hardware-retry) | 145 | * (If the device supports fallback and hardware-retry) |
143 | */ | 146 | */ |
144 | u8 default_fallback; | 147 | u8 default_fallback; |
148 | |||
149 | /* This is the rate that the user asked for */ | ||
150 | u8 user_rate; | ||
145 | }; | 151 | }; |
146 | 152 | ||
147 | /* Bits for txrates_change callback. */ | 153 | /* Bits for txrates_change callback. */ |
148 | #define IEEE80211SOFTMAC_TXRATECHG_DEFAULT (1 << 0) /* default_rate */ | 154 | #define IEEE80211SOFTMAC_TXRATECHG_DEFAULT (1 << 0) /* default_rate */ |
149 | #define IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK (1 << 1) /* default_fallback */ | 155 | #define IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK (1 << 1) /* default_fallback */ |
150 | #define IEEE80211SOFTMAC_TXRATECHG_MCAST (1 << 2) /* mcast_rate */ | 156 | #define IEEE80211SOFTMAC_TXRATECHG_MCAST (1 << 2) /* mcast_rate */ |
151 | #define IEEE80211SOFTMAC_TXRATECHG_MCAST_FBACK (1 << 3) /* mcast_fallback */ | 157 | #define IEEE80211SOFTMAC_TXRATECHG_MGT_MCAST (1 << 3) /* mgt_mcast_rate */ |
152 | 158 | ||
153 | struct ieee80211softmac_device { | 159 | struct ieee80211softmac_device { |
154 | /* 802.11 structure for data stuff */ | 160 | /* 802.11 structure for data stuff */ |
@@ -250,6 +256,28 @@ extern void ieee80211softmac_fragment_lost(struct net_device *dev, | |||
250 | * Note that the rates need to be sorted. */ | 256 | * Note that the rates need to be sorted. */ |
251 | extern void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates); | 257 | extern void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates); |
252 | 258 | ||
259 | /* Helper function which advises you the rate at which a frame should be | ||
260 | * transmitted at. */ | ||
261 | static inline u8 ieee80211softmac_suggest_txrate(struct ieee80211softmac_device *mac, | ||
262 | int is_multicast, | ||
263 | int is_mgt) | ||
264 | { | ||
265 | struct ieee80211softmac_txrates *txrates = &mac->txrates; | ||
266 | |||
267 | if (!mac->associated) | ||
268 | return txrates->mgt_mcast_rate; | ||
269 | |||
270 | /* We are associated, sending unicast frame */ | ||
271 | if (!is_multicast) | ||
272 | return txrates->default_rate; | ||
273 | |||
274 | /* We are associated, sending multicast frame */ | ||
275 | if (is_mgt) | ||
276 | return txrates->mgt_mcast_rate; | ||
277 | else | ||
278 | return txrates->mcast_rate; | ||
279 | } | ||
280 | |||
253 | /* Start the SoftMAC. Call this after you initialized the device | 281 | /* Start the SoftMAC. Call this after you initialized the device |
254 | * and it is ready to run. | 282 | * and it is ready to run. |
255 | */ | 283 | */ |