diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-10-21 06:40:02 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-10-31 19:00:23 -0400 |
commit | e6a9854b05c1a6af1308fe2b8c68f35abf28a3ee (patch) | |
tree | 241f611f8194586ccabf61bacb060508773b9d05 /drivers/net/wireless/zd1211rw | |
parent | cb121bad67a32cde37adc2729b7e18aa4fd3063e (diff) |
mac80211/drivers: rewrite the rate control API
So after the previous changes we were still unhappy with how
convoluted the API is and decided to make things simpler for
everybody. This completely changes the rate control API, now
taking into account 802.11n with MCS rates and more control,
most drivers don't support that though.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/zd1211rw')
-rw-r--r-- | drivers/net/wireless/zd1211rw/zd_mac.c | 32 | ||||
-rw-r--r-- | drivers/net/wireless/zd1211rw/zd_usb.c | 2 |
2 files changed, 17 insertions, 17 deletions
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index 6c3e21887fc8..2f0802b29c4b 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c | |||
@@ -296,15 +296,14 @@ static void zd_op_stop(struct ieee80211_hw *hw) | |||
296 | * If no status information has been requested, the skb is freed. | 296 | * If no status information has been requested, the skb is freed. |
297 | */ | 297 | */ |
298 | static void tx_status(struct ieee80211_hw *hw, struct sk_buff *skb, | 298 | static void tx_status(struct ieee80211_hw *hw, struct sk_buff *skb, |
299 | u32 flags, int ackssi, bool success) | 299 | int ackssi, bool success) |
300 | { | 300 | { |
301 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 301 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
302 | 302 | ||
303 | memset(&info->status, 0, sizeof(info->status)); | 303 | ieee80211_tx_info_clear_status(info); |
304 | 304 | ||
305 | if (!success) | 305 | if (success) |
306 | info->status.excessive_retries = 1; | 306 | info->flags |= IEEE80211_TX_STAT_ACK; |
307 | info->flags |= flags; | ||
308 | info->status.ack_signal = ackssi; | 307 | info->status.ack_signal = ackssi; |
309 | ieee80211_tx_status_irqsafe(hw, skb); | 308 | ieee80211_tx_status_irqsafe(hw, skb); |
310 | } | 309 | } |
@@ -326,7 +325,7 @@ void zd_mac_tx_failed(struct ieee80211_hw *hw) | |||
326 | if (skb == NULL) | 325 | if (skb == NULL) |
327 | return; | 326 | return; |
328 | 327 | ||
329 | tx_status(hw, skb, 0, 0, 0); | 328 | tx_status(hw, skb, 0, 0); |
330 | } | 329 | } |
331 | 330 | ||
332 | /** | 331 | /** |
@@ -342,12 +341,12 @@ void zd_mac_tx_failed(struct ieee80211_hw *hw) | |||
342 | void zd_mac_tx_to_dev(struct sk_buff *skb, int error) | 341 | void zd_mac_tx_to_dev(struct sk_buff *skb, int error) |
343 | { | 342 | { |
344 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 343 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
345 | struct ieee80211_hw *hw = info->driver_data[0]; | 344 | struct ieee80211_hw *hw = info->rate_driver_data[0]; |
346 | 345 | ||
347 | skb_pull(skb, sizeof(struct zd_ctrlset)); | 346 | skb_pull(skb, sizeof(struct zd_ctrlset)); |
348 | if (unlikely(error || | 347 | if (unlikely(error || |
349 | (info->flags & IEEE80211_TX_CTL_NO_ACK))) { | 348 | (info->flags & IEEE80211_TX_CTL_NO_ACK))) { |
350 | tx_status(hw, skb, 0, 0, !error); | 349 | tx_status(hw, skb, 0, !error); |
351 | } else { | 350 | } else { |
352 | struct sk_buff_head *q = | 351 | struct sk_buff_head *q = |
353 | &zd_hw_mac(hw)->ack_wait_queue; | 352 | &zd_hw_mac(hw)->ack_wait_queue; |
@@ -406,7 +405,8 @@ static int zd_calc_tx_length_us(u8 *service, u8 zd_rate, u16 tx_length) | |||
406 | } | 405 | } |
407 | 406 | ||
408 | static void cs_set_control(struct zd_mac *mac, struct zd_ctrlset *cs, | 407 | static void cs_set_control(struct zd_mac *mac, struct zd_ctrlset *cs, |
409 | struct ieee80211_hdr *header, u32 flags) | 408 | struct ieee80211_hdr *header, |
409 | struct ieee80211_tx_info *info) | ||
410 | { | 410 | { |
411 | /* | 411 | /* |
412 | * CONTROL TODO: | 412 | * CONTROL TODO: |
@@ -417,7 +417,7 @@ static void cs_set_control(struct zd_mac *mac, struct zd_ctrlset *cs, | |||
417 | cs->control = 0; | 417 | cs->control = 0; |
418 | 418 | ||
419 | /* First fragment */ | 419 | /* First fragment */ |
420 | if (flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) | 420 | if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) |
421 | cs->control |= ZD_CS_NEED_RANDOM_BACKOFF; | 421 | cs->control |= ZD_CS_NEED_RANDOM_BACKOFF; |
422 | 422 | ||
423 | /* Multicast */ | 423 | /* Multicast */ |
@@ -428,10 +428,10 @@ static void cs_set_control(struct zd_mac *mac, struct zd_ctrlset *cs, | |||
428 | if (ieee80211_is_pspoll(header->frame_control)) | 428 | if (ieee80211_is_pspoll(header->frame_control)) |
429 | cs->control |= ZD_CS_PS_POLL_FRAME; | 429 | cs->control |= ZD_CS_PS_POLL_FRAME; |
430 | 430 | ||
431 | if (flags & IEEE80211_TX_CTL_USE_RTS_CTS) | 431 | if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) |
432 | cs->control |= ZD_CS_RTS; | 432 | cs->control |= ZD_CS_RTS; |
433 | 433 | ||
434 | if (flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) | 434 | if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) |
435 | cs->control |= ZD_CS_SELF_CTS; | 435 | cs->control |= ZD_CS_SELF_CTS; |
436 | 436 | ||
437 | /* FIXME: Management frame? */ | 437 | /* FIXME: Management frame? */ |
@@ -517,12 +517,12 @@ static int fill_ctrlset(struct zd_mac *mac, | |||
517 | txrate = ieee80211_get_tx_rate(mac->hw, info); | 517 | txrate = ieee80211_get_tx_rate(mac->hw, info); |
518 | 518 | ||
519 | cs->modulation = txrate->hw_value; | 519 | cs->modulation = txrate->hw_value; |
520 | if (info->flags & IEEE80211_TX_CTL_SHORT_PREAMBLE) | 520 | if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) |
521 | cs->modulation = txrate->hw_value_short; | 521 | cs->modulation = txrate->hw_value_short; |
522 | 522 | ||
523 | cs->tx_length = cpu_to_le16(frag_len); | 523 | cs->tx_length = cpu_to_le16(frag_len); |
524 | 524 | ||
525 | cs_set_control(mac, cs, hdr, info->flags); | 525 | cs_set_control(mac, cs, hdr, info); |
526 | 526 | ||
527 | packet_length = frag_len + sizeof(struct zd_ctrlset) + 10; | 527 | packet_length = frag_len + sizeof(struct zd_ctrlset) + 10; |
528 | ZD_ASSERT(packet_length <= 0xffff); | 528 | ZD_ASSERT(packet_length <= 0xffff); |
@@ -577,7 +577,7 @@ static int zd_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
577 | if (r) | 577 | if (r) |
578 | return r; | 578 | return r; |
579 | 579 | ||
580 | info->driver_data[0] = hw; | 580 | info->rate_driver_data[0] = hw; |
581 | 581 | ||
582 | r = zd_usb_tx(&mac->chip.usb, skb); | 582 | r = zd_usb_tx(&mac->chip.usb, skb); |
583 | if (r) | 583 | if (r) |
@@ -618,7 +618,7 @@ static int filter_ack(struct ieee80211_hw *hw, struct ieee80211_hdr *rx_hdr, | |||
618 | if (likely(!compare_ether_addr(tx_hdr->addr2, rx_hdr->addr1))) | 618 | if (likely(!compare_ether_addr(tx_hdr->addr2, rx_hdr->addr1))) |
619 | { | 619 | { |
620 | __skb_unlink(skb, q); | 620 | __skb_unlink(skb, q); |
621 | tx_status(hw, skb, IEEE80211_TX_STAT_ACK, stats->signal, 1); | 621 | tx_status(hw, skb, stats->signal, 1); |
622 | goto out; | 622 | goto out; |
623 | } | 623 | } |
624 | } | 624 | } |
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index a60ae86bd5c9..d7a2f52e40cf 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c | |||
@@ -907,7 +907,7 @@ free_urb: | |||
907 | * it might be freed by zd_mac_tx_to_dev or mac80211) | 907 | * it might be freed by zd_mac_tx_to_dev or mac80211) |
908 | */ | 908 | */ |
909 | info = IEEE80211_SKB_CB(skb); | 909 | info = IEEE80211_SKB_CB(skb); |
910 | usb = &zd_hw_mac(info->driver_data[0])->chip.usb; | 910 | usb = &zd_hw_mac(info->rate_driver_data[0])->chip.usb; |
911 | zd_mac_tx_to_dev(skb, urb->status); | 911 | zd_mac_tx_to_dev(skb, urb->status); |
912 | free_tx_urb(usb, urb); | 912 | free_tx_urb(usb, urb); |
913 | tx_dec_submitted_urbs(usb); | 913 | tx_dec_submitted_urbs(usb); |