aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/p54
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-10-21 06:40:02 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-10-31 19:00:23 -0400
commite6a9854b05c1a6af1308fe2b8c68f35abf28a3ee (patch)
tree241f611f8194586ccabf61bacb060508773b9d05 /drivers/net/wireless/p54
parentcb121bad67a32cde37adc2729b7e18aa4fd3063e (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/p54')
-rw-r--r--drivers/net/wireless/p54/p54common.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index 81a9756254f..65be5eca234 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -548,7 +548,7 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
548 spin_lock_irqsave(&priv->tx_queue.lock, flags); 548 spin_lock_irqsave(&priv->tx_queue.lock, flags);
549 while (entry != (struct sk_buff *)&priv->tx_queue) { 549 while (entry != (struct sk_buff *)&priv->tx_queue) {
550 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry); 550 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry);
551 range = (void *)info->driver_data; 551 range = (void *)info->rate_driver_data;
552 if (range->start_addr == addr) { 552 if (range->start_addr == addr) {
553 struct p54_control_hdr *entry_hdr; 553 struct p54_control_hdr *entry_hdr;
554 struct p54_tx_control_allocdata *entry_data; 554 struct p54_tx_control_allocdata *entry_data;
@@ -559,7 +559,7 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
559 struct memrecord *mr; 559 struct memrecord *mr;
560 560
561 ni = IEEE80211_SKB_CB(entry->next); 561 ni = IEEE80211_SKB_CB(entry->next);
562 mr = (struct memrecord *)ni->driver_data; 562 mr = (struct memrecord *)ni->rate_driver_data;
563 freed = mr->start_addr - last_addr; 563 freed = mr->start_addr - last_addr;
564 } else 564 } else
565 freed = priv->rx_end - last_addr; 565 freed = priv->rx_end - last_addr;
@@ -568,7 +568,7 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
568 __skb_unlink(entry, &priv->tx_queue); 568 __skb_unlink(entry, &priv->tx_queue);
569 spin_unlock_irqrestore(&priv->tx_queue.lock, flags); 569 spin_unlock_irqrestore(&priv->tx_queue.lock, flags);
570 570
571 memset(&info->status, 0, sizeof(info->status)); 571 ieee80211_tx_info_clear_status(info);
572 entry_hdr = (struct p54_control_hdr *) entry->data; 572 entry_hdr = (struct p54_control_hdr *) entry->data;
573 entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data; 573 entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data;
574 if ((entry_hdr->magic1 & cpu_to_le16(0x4000)) != 0) 574 if ((entry_hdr->magic1 & cpu_to_le16(0x4000)) != 0)
@@ -578,10 +578,8 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
578 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) { 578 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) {
579 if (!(payload->status & 0x01)) 579 if (!(payload->status & 0x01))
580 info->flags |= IEEE80211_TX_STAT_ACK; 580 info->flags |= IEEE80211_TX_STAT_ACK;
581 else
582 info->status.excessive_retries = 1;
583 } 581 }
584 info->status.retry_count = payload->retries - 1; 582 info->status.rates[0].count = payload->retries;
585 info->status.ack_signal = p54_rssi_to_dbm(dev, 583 info->status.ack_signal = p54_rssi_to_dbm(dev,
586 le16_to_cpu(payload->ack_rssi)); 584 le16_to_cpu(payload->ack_rssi));
587 skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data)); 585 skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data));
@@ -699,7 +697,7 @@ static void p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb,
699 while (left--) { 697 while (left--) {
700 u32 hole_size; 698 u32 hole_size;
701 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry); 699 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry);
702 struct memrecord *range = (void *)info->driver_data; 700 struct memrecord *range = (void *)info->rate_driver_data;
703 hole_size = range->start_addr - last_addr; 701 hole_size = range->start_addr - last_addr;
704 if (!target_skb && hole_size >= len) { 702 if (!target_skb && hole_size >= len) {
705 target_skb = entry->prev; 703 target_skb = entry->prev;
@@ -715,7 +713,7 @@ static void p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb,
715 largest_hole = max(largest_hole, priv->rx_end - last_addr - len); 713 largest_hole = max(largest_hole, priv->rx_end - last_addr - len);
716 if (!skb_queue_empty(&priv->tx_queue)) { 714 if (!skb_queue_empty(&priv->tx_queue)) {
717 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(target_skb); 715 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(target_skb);
718 struct memrecord *range = (void *)info->driver_data; 716 struct memrecord *range = (void *)info->rate_driver_data;
719 target_addr = range->end_addr; 717 target_addr = range->end_addr;
720 } 718 }
721 } else 719 } else
@@ -723,7 +721,7 @@ static void p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb,
723 721
724 if (skb) { 722 if (skb) {
725 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 723 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
726 struct memrecord *range = (void *)info->driver_data; 724 struct memrecord *range = (void *)info->rate_driver_data;
727 range->start_addr = target_addr; 725 range->start_addr = target_addr;
728 range->end_addr = target_addr + len; 726 range->end_addr = target_addr + len;
729 __skb_queue_after(&priv->tx_queue, target_skb, skb); 727 __skb_queue_after(&priv->tx_queue, target_skb, skb);
@@ -806,6 +804,7 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
806 size_t padding, len; 804 size_t padding, len;
807 u8 rate; 805 u8 rate;
808 u8 cts_rate = 0x20; 806 u8 cts_rate = 0x20;
807 u8 rc_flags;
809 808
810 current_queue = &priv->tx_stats[skb_get_queue_mapping(skb) + 4]; 809 current_queue = &priv->tx_stats[skb_get_queue_mapping(skb) + 4];
811 if (unlikely(current_queue->len > current_queue->limit)) 810 if (unlikely(current_queue->len > current_queue->limit))
@@ -828,18 +827,19 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
828 hdr->magic1 = cpu_to_le16(0x0010); 827 hdr->magic1 = cpu_to_le16(0x0010);
829 hdr->len = cpu_to_le16(len); 828 hdr->len = cpu_to_le16(len);
830 hdr->type = (info->flags & IEEE80211_TX_CTL_NO_ACK) ? 0 : cpu_to_le16(1); 829 hdr->type = (info->flags & IEEE80211_TX_CTL_NO_ACK) ? 0 : cpu_to_le16(1);
831 hdr->retry1 = hdr->retry2 = info->control.retry_limit; 830 hdr->retry1 = hdr->retry2 = info->control.rates[0].count;
832 831
833 /* TODO: add support for alternate retry TX rates */ 832 /* TODO: add support for alternate retry TX rates */
834 rate = ieee80211_get_tx_rate(dev, info)->hw_value; 833 rate = ieee80211_get_tx_rate(dev, info)->hw_value;
835 if (info->flags & IEEE80211_TX_CTL_SHORT_PREAMBLE) { 834 rc_flags = info->control.rates[0].flags;
835 if (rc_flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) {
836 rate |= 0x10; 836 rate |= 0x10;
837 cts_rate |= 0x10; 837 cts_rate |= 0x10;
838 } 838 }
839 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) { 839 if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) {
840 rate |= 0x40; 840 rate |= 0x40;
841 cts_rate |= ieee80211_get_rts_cts_rate(dev, info)->hw_value; 841 cts_rate |= ieee80211_get_rts_cts_rate(dev, info)->hw_value;
842 } else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) { 842 } else if (rc_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
843 rate |= 0x20; 843 rate |= 0x20;
844 cts_rate |= ieee80211_get_rts_cts_rate(dev, info)->hw_value; 844 cts_rate |= ieee80211_get_rts_cts_rate(dev, info)->hw_value;
845 } 845 }