aboutsummaryrefslogtreecommitdiff
path: root/include/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-05-15 12:55:27 +0200
committerJohn W. Linville <linville@tuxdriver.com>2008-05-21 21:48:09 -0400
commit2e92e6f2c50b4baf85cca968f0e6f1b5c0df7d39 (patch)
treee845c2f3af6d29c807c540366b97b1d886b92c91 /include/net
parent36d6825b91bc492b65b6333c369cd96a2fc8c903 (diff)
mac80211: use rate index in TX control
This patch modifies struct ieee80211_tx_control to give band info and the rate index (instead of rate pointers) to drivers. This mostly serves to reduce the TX control structure size to make it fit into skb->cb so that the fragmentation code can put it there and we can think about passing it to drivers that way in the future. The rt2x00 driver update was done by Ivo, thanks. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-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/mac80211.h51
1 files changed, 39 insertions, 12 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index f00fc76a734..0df91bea6c1 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -266,27 +266,26 @@ enum mac80211_tx_control_flags {
* ieee80211_ops->remove_interface() callback funtion.
* The hw_key pointer is valid until it has been removed with the
* ieee80211_ops->set_key() callback function.
- * The tx_rate and alt_retry_rate pointers are valid until the phy is
- * deregistered.
*/
struct ieee80211_tx_control {
- struct ieee80211_vif *vif;
- struct ieee80211_rate *tx_rate;
+ u32 flags; /* tx control flags defined above */
+
+ s8 tx_rate_idx, /* Transmit rate (indexes registered rates) */
+ rts_cts_rate_idx, /* Transmit rate for RTS/CTS frame */
+ alt_retry_rate_idx; /* retry rate for the last retries */
- /* Transmit rate for RTS/CTS frame */
- struct ieee80211_rate *rts_cts_rate;
+ s8 retry_limit; /* 1 = only first attempt, 2 = one retry, ..
+ * This could be used when set_retry_limit
+ * is not implemented by the driver */
- /* retry rate for the last retries */
- struct ieee80211_rate *alt_retry_rate;
+ struct ieee80211_vif *vif;
/* Key used for hardware encryption
* NULL if IEEE80211_TXCTL_DO_NOT_ENCRYPT is set */
struct ieee80211_key_conf *hw_key;
- u32 flags; /* tx control flags defined above */
- u8 retry_limit; /* 1 = only first attempt, 2 = one retry, ..
- * This could be used when set_retry_limit
- * is not implemented by the driver */
+ enum ieee80211_band band;
+
u8 antenna_sel_tx; /* 0 = default/diversity, otherwise bit
* position represents antenna number used */
u8 icv_len; /* length of the ICV/MIC field in octets */
@@ -298,6 +297,7 @@ struct ieee80211_tx_control {
};
+
/**
* enum mac80211_rx_flags - receive flags
*
@@ -823,6 +823,33 @@ static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr)
memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN);
}
+static inline struct ieee80211_rate *
+ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
+ const struct ieee80211_tx_control *c)
+{
+ if (WARN_ON(c->tx_rate_idx < 0))
+ return NULL;
+ return &hw->wiphy->bands[c->band]->bitrates[c->tx_rate_idx];
+}
+
+static inline struct ieee80211_rate *
+ieee80211_get_rts_cts_rate(const struct ieee80211_hw *hw,
+ const struct ieee80211_tx_control *c)
+{
+ if (c->rts_cts_rate_idx < 0)
+ return NULL;
+ return &hw->wiphy->bands[c->band]->bitrates[c->rts_cts_rate_idx];
+}
+
+static inline struct ieee80211_rate *
+ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
+ const struct ieee80211_tx_control *c)
+{
+ if (c->alt_retry_rate_idx < 0)
+ return NULL;
+ return &hw->wiphy->bands[c->band]->bitrates[c->alt_retry_rate_idx];
+}
+
/**
* DOC: Hardware crypto acceleration
*