aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/p54/p54common.c
diff options
context:
space:
mode:
authorChristian Lamparter <chunkeey@web.de>2008-10-14 22:05:51 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-10-31 19:00:33 -0400
commit9de5776ff33a006b864341a6ec8d31f1a3c628cf (patch)
tree145e28817b498da6d82c9ecf7fc2bb41d7d0c0bc /drivers/net/wireless/p54/p54common.c
parent0f1be978910092bed5d8dac0774e5cf85d4b4e12 (diff)
p54: p54: refactor p54_rx_frame_sent
the long names and the nesting in p54_rx_frame_sent really became a "line longer than 80 characters" problem. Signed-off-by: Christian Lamparter <chunkeey@web.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/p54/p54common.c')
-rw-r--r--drivers/net/wireless/p54/p54common.c118
1 files changed, 61 insertions, 57 deletions
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index fcde424adb05..68ae8c06bbd7 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -549,73 +549,77 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
549 spin_lock_irqsave(&priv->tx_queue.lock, flags); 549 spin_lock_irqsave(&priv->tx_queue.lock, flags);
550 while (entry != (struct sk_buff *)&priv->tx_queue) { 550 while (entry != (struct sk_buff *)&priv->tx_queue) {
551 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry); 551 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry);
552 struct p54_control_hdr *entry_hdr;
553 struct p54_tx_control_allocdata *entry_data;
554 int pad = 0;
555
552 range = (void *)info->rate_driver_data; 556 range = (void *)info->rate_driver_data;
553 if (range->start_addr == addr) { 557 if (range->start_addr != addr) {
554 struct p54_control_hdr *entry_hdr; 558 last_addr = range->end_addr;
555 struct p54_tx_control_allocdata *entry_data; 559 entry = entry->next;
556 int pad = 0; 560 continue;
561 }
557 562
558 if (entry->next != (struct sk_buff *)&priv->tx_queue) { 563 if (entry->next != (struct sk_buff *)&priv->tx_queue) {
559 struct ieee80211_tx_info *ni; 564 struct ieee80211_tx_info *ni;
560 struct memrecord *mr; 565 struct memrecord *mr;
561 566
562 ni = IEEE80211_SKB_CB(entry->next); 567 ni = IEEE80211_SKB_CB(entry->next);
563 mr = (struct memrecord *)ni->rate_driver_data; 568 mr = (struct memrecord *)ni->rate_driver_data;
564 freed = mr->start_addr - last_addr; 569 freed = mr->start_addr - last_addr;
565 } else 570 } else
566 freed = priv->rx_end - last_addr; 571 freed = priv->rx_end - last_addr;
567 572
568 last_addr = range->end_addr; 573 last_addr = range->end_addr;
569 __skb_unlink(entry, &priv->tx_queue); 574 __skb_unlink(entry, &priv->tx_queue);
570 spin_unlock_irqrestore(&priv->tx_queue.lock, flags); 575 spin_unlock_irqrestore(&priv->tx_queue.lock, flags);
571 576
572 /* 577 /*
573 * Clear manually, ieee80211_tx_info_clear_status would 578 * Clear manually, ieee80211_tx_info_clear_status would
574 * clear the counts too and we need them. 579 * clear the counts too and we need them.
575 */ 580 */
576 memset(&info->status.ampdu_ack_len, 0, 581 memset(&info->status.ampdu_ack_len, 0,
577 sizeof(struct ieee80211_tx_info) - 582 sizeof(struct ieee80211_tx_info) -
578 offsetof(struct ieee80211_tx_info, status.ampdu_ack_len)); 583 offsetof(struct ieee80211_tx_info, status.ampdu_ack_len));
579 BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, 584 BUILD_BUG_ON(offsetof(struct ieee80211_tx_info,
580 status.ampdu_ack_len) != 23); 585 status.ampdu_ack_len) != 23);
581 586
582 entry_hdr = (struct p54_control_hdr *) entry->data; 587 entry_hdr = (struct p54_control_hdr *) entry->data;
583 entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data; 588 entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data;
584 if ((entry_hdr->magic1 & cpu_to_le16(0x4000)) != 0) 589 if ((entry_hdr->magic1 & cpu_to_le16(0x4000)) != 0)
585 pad = entry_data->align[0]; 590 pad = entry_data->align[0];
586 591
587 /* walk through the rates array and adjust the counts */ 592 /* walk through the rates array and adjust the counts */
588 count = payload->retries; 593 count = payload->retries;
589 for (idx = 0; idx < 4; idx++) { 594 for (idx = 0; idx < 4; idx++) {
590 if (count >= info->status.rates[idx].count) { 595 if (count >= info->status.rates[idx].count) {
591 count -= info->status.rates[idx].count; 596 count -= info->status.rates[idx].count;
592 } else if (count > 0) { 597 } else if (count > 0) {
593 info->status.rates[idx].count = count; 598 info->status.rates[idx].count = count;
594 count = 0; 599 count = 0;
595 } else { 600 } else {
596 info->status.rates[idx].idx = -1; 601 info->status.rates[idx].idx = -1;
597 info->status.rates[idx].count = 0; 602 info->status.rates[idx].count = 0;
598 }
599 } 603 }
604 }
600 605
601 priv->tx_stats[entry_data->hw_queue].len--; 606 priv->tx_stats[entry_data->hw_queue].len--;
602 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) && 607 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) &&
603 !(payload->status & 0x01)) 608 (!payload->status))
604 info->flags |= IEEE80211_TX_STAT_ACK; 609 info->flags |= IEEE80211_TX_STAT_ACK;
605 info->status.ack_signal = p54_rssi_to_dbm(dev, 610 if (payload->status & 0x02)
606 le16_to_cpu(payload->ack_rssi)); 611 info->flags |= IEEE80211_TX_STAT_TX_FILTERED;
607 skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data)); 612 info->status.ack_signal = p54_rssi_to_dbm(dev,
608 ieee80211_tx_status_irqsafe(dev, entry); 613 le16_to_cpu(payload->ack_rssi));
609 goto out; 614 skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data));
610 } else 615 ieee80211_tx_status_irqsafe(dev, entry);
611 last_addr = range->end_addr; 616 goto out;
612 entry = entry->next;
613 } 617 }
614 spin_unlock_irqrestore(&priv->tx_queue.lock, flags); 618 spin_unlock_irqrestore(&priv->tx_queue.lock, flags);
615 619
616out: 620out:
617 if (freed >= IEEE80211_MAX_RTS_THRESHOLD + 0x170 + 621 if (freed >= priv->headroom + sizeof(struct p54_control_hdr) + 48 +
618 sizeof(struct p54_control_hdr)) 622 IEEE80211_MAX_RTS_THRESHOLD + priv->tailroom)
619 p54_wake_free_queues(dev); 623 p54_wake_free_queues(dev);
620} 624}
621 625