aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00mac.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00mac.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c52
1 files changed, 16 insertions, 36 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index 929b85f34f38..abbd857ec759 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -1,5 +1,5 @@
1/* 1/*
2 Copyright (C) 2004 - 2009 rt2x00 SourceForge Project 2 Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
3 <http://rt2x00.serialmonkey.com> 3 <http://rt2x00.serialmonkey.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
@@ -66,7 +66,6 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev,
66 rts_info = IEEE80211_SKB_CB(skb); 66 rts_info = IEEE80211_SKB_CB(skb);
67 rts_info->control.rates[0].flags &= ~IEEE80211_TX_RC_USE_RTS_CTS; 67 rts_info->control.rates[0].flags &= ~IEEE80211_TX_RC_USE_RTS_CTS;
68 rts_info->control.rates[0].flags &= ~IEEE80211_TX_RC_USE_CTS_PROTECT; 68 rts_info->control.rates[0].flags &= ~IEEE80211_TX_RC_USE_CTS_PROTECT;
69 rts_info->flags &= ~IEEE80211_TX_CTL_REQ_TX_STATUS;
70 69
71 if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) 70 if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)
72 rts_info->flags |= IEEE80211_TX_CTL_NO_ACK; 71 rts_info->flags |= IEEE80211_TX_CTL_NO_ACK;
@@ -91,7 +90,7 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev,
91 frag_skb->data, data_length, tx_info, 90 frag_skb->data, data_length, tx_info,
92 (struct ieee80211_rts *)(skb->data)); 91 (struct ieee80211_rts *)(skb->data));
93 92
94 retval = rt2x00queue_write_tx_frame(queue, skb); 93 retval = rt2x00queue_write_tx_frame(queue, skb, true);
95 if (retval) { 94 if (retval) {
96 dev_kfree_skb_any(skb); 95 dev_kfree_skb_any(skb);
97 WARNING(rt2x00dev, "Failed to send RTS/CTS frame.\n"); 96 WARNING(rt2x00dev, "Failed to send RTS/CTS frame.\n");
@@ -104,10 +103,8 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
104{ 103{
105 struct rt2x00_dev *rt2x00dev = hw->priv; 104 struct rt2x00_dev *rt2x00dev = hw->priv;
106 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); 105 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
107 struct ieee80211_hdr *ieee80211hdr = (struct ieee80211_hdr *)skb->data;
108 enum data_queue_qid qid = skb_get_queue_mapping(skb); 106 enum data_queue_qid qid = skb_get_queue_mapping(skb);
109 struct data_queue *queue; 107 struct data_queue *queue;
110 u16 frame_control;
111 108
112 /* 109 /*
113 * Mac80211 might be calling this function while we are trying 110 * Mac80211 might be calling this function while we are trying
@@ -142,7 +139,6 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
142 * either RTS or CTS-to-self frame and handles everything 139 * either RTS or CTS-to-self frame and handles everything
143 * inside the hardware. 140 * inside the hardware.
144 */ 141 */
145 frame_control = le16_to_cpu(ieee80211hdr->frame_control);
146 if ((tx_info->control.rates[0].flags & (IEEE80211_TX_RC_USE_RTS_CTS | 142 if ((tx_info->control.rates[0].flags & (IEEE80211_TX_RC_USE_RTS_CTS |
147 IEEE80211_TX_RC_USE_CTS_PROTECT)) && 143 IEEE80211_TX_RC_USE_CTS_PROTECT)) &&
148 !rt2x00dev->ops->hw->set_rts_threshold) { 144 !rt2x00dev->ops->hw->set_rts_threshold) {
@@ -153,7 +149,7 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
153 goto exit_fail; 149 goto exit_fail;
154 } 150 }
155 151
156 if (rt2x00queue_write_tx_frame(queue, skb)) 152 if (rt2x00queue_write_tx_frame(queue, skb, false))
157 goto exit_fail; 153 goto exit_fail;
158 154
159 if (rt2x00queue_threshold(queue)) 155 if (rt2x00queue_threshold(queue))
@@ -191,10 +187,10 @@ void rt2x00mac_stop(struct ieee80211_hw *hw)
191EXPORT_SYMBOL_GPL(rt2x00mac_stop); 187EXPORT_SYMBOL_GPL(rt2x00mac_stop);
192 188
193int rt2x00mac_add_interface(struct ieee80211_hw *hw, 189int rt2x00mac_add_interface(struct ieee80211_hw *hw,
194 struct ieee80211_if_init_conf *conf) 190 struct ieee80211_vif *vif)
195{ 191{
196 struct rt2x00_dev *rt2x00dev = hw->priv; 192 struct rt2x00_dev *rt2x00dev = hw->priv;
197 struct rt2x00_intf *intf = vif_to_intf(conf->vif); 193 struct rt2x00_intf *intf = vif_to_intf(vif);
198 struct data_queue *queue = rt2x00queue_get_queue(rt2x00dev, QID_BEACON); 194 struct data_queue *queue = rt2x00queue_get_queue(rt2x00dev, QID_BEACON);
199 struct queue_entry *entry = NULL; 195 struct queue_entry *entry = NULL;
200 unsigned int i; 196 unsigned int i;
@@ -207,7 +203,7 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw,
207 !test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) 203 !test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags))
208 return -ENODEV; 204 return -ENODEV;
209 205
210 switch (conf->type) { 206 switch (vif->type) {
211 case NL80211_IFTYPE_AP: 207 case NL80211_IFTYPE_AP:
212 /* 208 /*
213 * We don't support mixed combinations of 209 * We don't support mixed combinations of
@@ -267,7 +263,7 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw,
267 * increase interface count and start initialization. 263 * increase interface count and start initialization.
268 */ 264 */
269 265
270 if (conf->type == NL80211_IFTYPE_AP) 266 if (vif->type == NL80211_IFTYPE_AP)
271 rt2x00dev->intf_ap_count++; 267 rt2x00dev->intf_ap_count++;
272 else 268 else
273 rt2x00dev->intf_sta_count++; 269 rt2x00dev->intf_sta_count++;
@@ -277,16 +273,16 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw,
277 mutex_init(&intf->beacon_skb_mutex); 273 mutex_init(&intf->beacon_skb_mutex);
278 intf->beacon = entry; 274 intf->beacon = entry;
279 275
280 if (conf->type == NL80211_IFTYPE_AP) 276 if (vif->type == NL80211_IFTYPE_AP)
281 memcpy(&intf->bssid, conf->mac_addr, ETH_ALEN); 277 memcpy(&intf->bssid, vif->addr, ETH_ALEN);
282 memcpy(&intf->mac, conf->mac_addr, ETH_ALEN); 278 memcpy(&intf->mac, vif->addr, ETH_ALEN);
283 279
284 /* 280 /*
285 * The MAC adddress must be configured after the device 281 * The MAC adddress must be configured after the device
286 * has been initialized. Otherwise the device can reset 282 * has been initialized. Otherwise the device can reset
287 * the MAC registers. 283 * the MAC registers.
288 */ 284 */
289 rt2x00lib_config_intf(rt2x00dev, intf, conf->type, intf->mac, NULL); 285 rt2x00lib_config_intf(rt2x00dev, intf, vif->type, intf->mac, NULL);
290 286
291 /* 287 /*
292 * Some filters depend on the current working mode. We can force 288 * Some filters depend on the current working mode. We can force
@@ -300,10 +296,10 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw,
300EXPORT_SYMBOL_GPL(rt2x00mac_add_interface); 296EXPORT_SYMBOL_GPL(rt2x00mac_add_interface);
301 297
302void rt2x00mac_remove_interface(struct ieee80211_hw *hw, 298void rt2x00mac_remove_interface(struct ieee80211_hw *hw,
303 struct ieee80211_if_init_conf *conf) 299 struct ieee80211_vif *vif)
304{ 300{
305 struct rt2x00_dev *rt2x00dev = hw->priv; 301 struct rt2x00_dev *rt2x00dev = hw->priv;
306 struct rt2x00_intf *intf = vif_to_intf(conf->vif); 302 struct rt2x00_intf *intf = vif_to_intf(vif);
307 303
308 /* 304 /*
309 * Don't allow interfaces to be remove while 305 * Don't allow interfaces to be remove while
@@ -311,11 +307,11 @@ void rt2x00mac_remove_interface(struct ieee80211_hw *hw,
311 * no interface is present. 307 * no interface is present.
312 */ 308 */
313 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) || 309 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) ||
314 (conf->type == NL80211_IFTYPE_AP && !rt2x00dev->intf_ap_count) || 310 (vif->type == NL80211_IFTYPE_AP && !rt2x00dev->intf_ap_count) ||
315 (conf->type != NL80211_IFTYPE_AP && !rt2x00dev->intf_sta_count)) 311 (vif->type != NL80211_IFTYPE_AP && !rt2x00dev->intf_sta_count))
316 return; 312 return;
317 313
318 if (conf->type == NL80211_IFTYPE_AP) 314 if (vif->type == NL80211_IFTYPE_AP)
319 rt2x00dev->intf_ap_count--; 315 rt2x00dev->intf_ap_count--;
320 else 316 else
321 rt2x00dev->intf_sta_count--; 317 rt2x00dev->intf_sta_count--;
@@ -559,22 +555,6 @@ int rt2x00mac_get_stats(struct ieee80211_hw *hw,
559} 555}
560EXPORT_SYMBOL_GPL(rt2x00mac_get_stats); 556EXPORT_SYMBOL_GPL(rt2x00mac_get_stats);
561 557
562int rt2x00mac_get_tx_stats(struct ieee80211_hw *hw,
563 struct ieee80211_tx_queue_stats *stats)
564{
565 struct rt2x00_dev *rt2x00dev = hw->priv;
566 unsigned int i;
567
568 for (i = 0; i < rt2x00dev->ops->tx_queues; i++) {
569 stats[i].len = rt2x00dev->tx[i].length;
570 stats[i].limit = rt2x00dev->tx[i].limit;
571 stats[i].count = rt2x00dev->tx[i].count;
572 }
573
574 return 0;
575}
576EXPORT_SYMBOL_GPL(rt2x00mac_get_tx_stats);
577
578void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, 558void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw,
579 struct ieee80211_vif *vif, 559 struct ieee80211_vif *vif,
580 struct ieee80211_bss_conf *bss_conf, 560 struct ieee80211_bss_conf *bss_conf,