diff options
Diffstat (limited to 'drivers/net/wireless/p54/p54common.c')
-rw-r--r-- | drivers/net/wireless/p54/p54common.c | 142 |
1 files changed, 73 insertions, 69 deletions
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c index 525a684c57be..cf04c721a012 100644 --- a/drivers/net/wireless/p54/p54common.c +++ b/drivers/net/wireless/p54/p54common.c | |||
@@ -5,8 +5,11 @@ | |||
5 | * Copyright (c) 2007, Christian Lamparter <chunkeey@web.de> | 5 | * Copyright (c) 2007, Christian Lamparter <chunkeey@web.de> |
6 | * Copyright 2008, Johannes Berg <johannes@sipsolutions.net> | 6 | * Copyright 2008, Johannes Berg <johannes@sipsolutions.net> |
7 | * | 7 | * |
8 | * Based on the islsm (softmac prism54) driver, which is: | 8 | * Based on: |
9 | * Copyright 2004-2006 Jean-Baptiste Note <jbnote@gmail.com>, et al. | 9 | * - the islsm (softmac prism54) driver, which is: |
10 | * Copyright 2004-2006 Jean-Baptiste Note <jbnote@gmail.com>, et al. | ||
11 | * - stlc45xx driver | ||
12 | * C Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). | ||
10 | * | 13 | * |
11 | * This program is free software; you can redistribute it and/or modify | 14 | * This program is free software; you can redistribute it and/or modify |
12 | * it under the terms of the GNU General Public License version 2 as | 15 | * it under the terms of the GNU General Public License version 2 as |
@@ -481,13 +484,13 @@ static int p54_rssi_to_dbm(struct ieee80211_hw *dev, int rssi) | |||
481 | static int p54_rx_data(struct ieee80211_hw *dev, struct sk_buff *skb) | 484 | static int p54_rx_data(struct ieee80211_hw *dev, struct sk_buff *skb) |
482 | { | 485 | { |
483 | struct p54_common *priv = dev->priv; | 486 | struct p54_common *priv = dev->priv; |
484 | struct p54_rx_hdr *hdr = (struct p54_rx_hdr *) skb->data; | 487 | struct p54_rx_data *hdr = (struct p54_rx_data *) skb->data; |
485 | struct ieee80211_rx_status rx_status = {0}; | 488 | struct ieee80211_rx_status rx_status = {0}; |
486 | u16 freq = le16_to_cpu(hdr->freq); | 489 | u16 freq = le16_to_cpu(hdr->freq); |
487 | size_t header_len = sizeof(*hdr); | 490 | size_t header_len = sizeof(*hdr); |
488 | u32 tsf32; | 491 | u32 tsf32; |
489 | 492 | ||
490 | if (!(hdr->magic & cpu_to_le16(0x0001))) { | 493 | if (!(hdr->flags & cpu_to_le16(P54_HDR_FLAG_DATA_IN_FCS_GOOD))) { |
491 | if (priv->filter_flags & FIF_FCSFAIL) | 494 | if (priv->filter_flags & FIF_FCSFAIL) |
492 | rx_status.flag |= RX_FLAG_FAILED_FCS_CRC; | 495 | rx_status.flag |= RX_FLAG_FAILED_FCS_CRC; |
493 | else | 496 | else |
@@ -512,7 +515,7 @@ static int p54_rx_data(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
512 | 515 | ||
513 | rx_status.flag |= RX_FLAG_TSFT; | 516 | rx_status.flag |= RX_FLAG_TSFT; |
514 | 517 | ||
515 | if (hdr->magic & cpu_to_le16(0x4000)) | 518 | if (hdr->flags & cpu_to_le16(P54_HDR_FLAG_DATA_ALIGN)) |
516 | header_len += hdr->align[0]; | 519 | header_len += hdr->align[0]; |
517 | 520 | ||
518 | skb_pull(skb, header_len); | 521 | skb_pull(skb, header_len); |
@@ -571,7 +574,7 @@ void p54_free_skb(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
571 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); | 574 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); |
572 | kfree_skb(skb); | 575 | kfree_skb(skb); |
573 | 576 | ||
574 | if (freed >= priv->headroom + sizeof(struct p54_control_hdr) + 48 + | 577 | if (freed >= priv->headroom + sizeof(struct p54_hdr) + 48 + |
575 | IEEE80211_MAX_RTS_THRESHOLD + priv->tailroom) | 578 | IEEE80211_MAX_RTS_THRESHOLD + priv->tailroom) |
576 | p54_wake_free_queues(dev); | 579 | p54_wake_free_queues(dev); |
577 | } | 580 | } |
@@ -580,8 +583,8 @@ EXPORT_SYMBOL_GPL(p54_free_skb); | |||
580 | static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb) | 583 | static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb) |
581 | { | 584 | { |
582 | struct p54_common *priv = dev->priv; | 585 | struct p54_common *priv = dev->priv; |
583 | struct p54_control_hdr *hdr = (struct p54_control_hdr *) skb->data; | 586 | struct p54_hdr *hdr = (struct p54_hdr *) skb->data; |
584 | struct p54_frame_sent_hdr *payload = (struct p54_frame_sent_hdr *) hdr->data; | 587 | struct p54_frame_sent *payload = (struct p54_frame_sent *) hdr->data; |
585 | struct sk_buff *entry = (struct sk_buff *) priv->tx_queue.next; | 588 | struct sk_buff *entry = (struct sk_buff *) priv->tx_queue.next; |
586 | u32 addr = le32_to_cpu(hdr->req_id) - priv->headroom; | 589 | u32 addr = le32_to_cpu(hdr->req_id) - priv->headroom; |
587 | struct memrecord *range = NULL; | 590 | struct memrecord *range = NULL; |
@@ -593,8 +596,8 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
593 | spin_lock_irqsave(&priv->tx_queue.lock, flags); | 596 | spin_lock_irqsave(&priv->tx_queue.lock, flags); |
594 | while (entry != (struct sk_buff *)&priv->tx_queue) { | 597 | while (entry != (struct sk_buff *)&priv->tx_queue) { |
595 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry); | 598 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry); |
596 | struct p54_control_hdr *entry_hdr; | 599 | struct p54_hdr *entry_hdr; |
597 | struct p54_tx_control_allocdata *entry_data; | 600 | struct p54_tx_data *entry_data; |
598 | int pad = 0; | 601 | int pad = 0; |
599 | 602 | ||
600 | range = (void *)info->rate_driver_data; | 603 | range = (void *)info->rate_driver_data; |
@@ -628,13 +631,13 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
628 | BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, | 631 | BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, |
629 | status.ampdu_ack_len) != 23); | 632 | status.ampdu_ack_len) != 23); |
630 | 633 | ||
631 | entry_hdr = (struct p54_control_hdr *) entry->data; | 634 | entry_hdr = (struct p54_hdr *) entry->data; |
632 | entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data; | 635 | entry_data = (struct p54_tx_data *) entry_hdr->data; |
633 | if ((entry_hdr->magic1 & cpu_to_le16(0x4000)) != 0) | 636 | if (entry_hdr->flags & cpu_to_le16(P54_HDR_FLAG_DATA_ALIGN)) |
634 | pad = entry_data->align[0]; | 637 | pad = entry_data->align[0]; |
635 | 638 | ||
636 | /* walk through the rates array and adjust the counts */ | 639 | /* walk through the rates array and adjust the counts */ |
637 | count = payload->retries; | 640 | count = payload->tries; |
638 | for (idx = 0; idx < 4; idx++) { | 641 | for (idx = 0; idx < 4; idx++) { |
639 | if (count >= info->status.rates[idx].count) { | 642 | if (count >= info->status.rates[idx].count) { |
640 | count -= info->status.rates[idx].count; | 643 | count -= info->status.rates[idx].count; |
@@ -654,7 +657,7 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
654 | if (payload->status & 0x02) | 657 | if (payload->status & 0x02) |
655 | info->flags |= IEEE80211_TX_STAT_TX_FILTERED; | 658 | info->flags |= IEEE80211_TX_STAT_TX_FILTERED; |
656 | info->status.ack_signal = p54_rssi_to_dbm(dev, | 659 | info->status.ack_signal = p54_rssi_to_dbm(dev, |
657 | le16_to_cpu(payload->ack_rssi)); | 660 | (int)payload->ack_rssi); |
658 | skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data)); | 661 | skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data)); |
659 | ieee80211_tx_status_irqsafe(dev, entry); | 662 | ieee80211_tx_status_irqsafe(dev, entry); |
660 | goto out; | 663 | goto out; |
@@ -662,7 +665,7 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
662 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); | 665 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); |
663 | 666 | ||
664 | out: | 667 | out: |
665 | if (freed >= priv->headroom + sizeof(struct p54_control_hdr) + 48 + | 668 | if (freed >= priv->headroom + sizeof(struct p54_hdr) + 48 + |
666 | IEEE80211_MAX_RTS_THRESHOLD + priv->tailroom) | 669 | IEEE80211_MAX_RTS_THRESHOLD + priv->tailroom) |
667 | p54_wake_free_queues(dev); | 670 | p54_wake_free_queues(dev); |
668 | } | 671 | } |
@@ -670,7 +673,7 @@ out: | |||
670 | static void p54_rx_eeprom_readback(struct ieee80211_hw *dev, | 673 | static void p54_rx_eeprom_readback(struct ieee80211_hw *dev, |
671 | struct sk_buff *skb) | 674 | struct sk_buff *skb) |
672 | { | 675 | { |
673 | struct p54_control_hdr *hdr = (struct p54_control_hdr *) skb->data; | 676 | struct p54_hdr *hdr = (struct p54_hdr *) skb->data; |
674 | struct p54_eeprom_lm86 *eeprom = (struct p54_eeprom_lm86 *) hdr->data; | 677 | struct p54_eeprom_lm86 *eeprom = (struct p54_eeprom_lm86 *) hdr->data; |
675 | struct p54_common *priv = dev->priv; | 678 | struct p54_common *priv = dev->priv; |
676 | 679 | ||
@@ -685,7 +688,7 @@ static void p54_rx_eeprom_readback(struct ieee80211_hw *dev, | |||
685 | static void p54_rx_stats(struct ieee80211_hw *dev, struct sk_buff *skb) | 688 | static void p54_rx_stats(struct ieee80211_hw *dev, struct sk_buff *skb) |
686 | { | 689 | { |
687 | struct p54_common *priv = dev->priv; | 690 | struct p54_common *priv = dev->priv; |
688 | struct p54_control_hdr *hdr = (struct p54_control_hdr *) skb->data; | 691 | struct p54_hdr *hdr = (struct p54_hdr *) skb->data; |
689 | struct p54_statistics *stats = (struct p54_statistics *) hdr->data; | 692 | struct p54_statistics *stats = (struct p54_statistics *) hdr->data; |
690 | u32 tsf32 = le32_to_cpu(stats->tsf32); | 693 | u32 tsf32 = le32_to_cpu(stats->tsf32); |
691 | 694 | ||
@@ -705,7 +708,7 @@ static void p54_rx_stats(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
705 | 708 | ||
706 | static int p54_rx_control(struct ieee80211_hw *dev, struct sk_buff *skb) | 709 | static int p54_rx_control(struct ieee80211_hw *dev, struct sk_buff *skb) |
707 | { | 710 | { |
708 | struct p54_control_hdr *hdr = (struct p54_control_hdr *) skb->data; | 711 | struct p54_hdr *hdr = (struct p54_hdr *) skb->data; |
709 | 712 | ||
710 | switch (le16_to_cpu(hdr->type)) { | 713 | switch (le16_to_cpu(hdr->type)) { |
711 | case P54_CONTROL_TYPE_TXDONE: | 714 | case P54_CONTROL_TYPE_TXDONE: |
@@ -750,7 +753,7 @@ EXPORT_SYMBOL_GPL(p54_rx); | |||
750 | * allocated areas. | 753 | * allocated areas. |
751 | */ | 754 | */ |
752 | static int p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb, | 755 | static int p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb, |
753 | struct p54_control_hdr *data, u32 len) | 756 | struct p54_hdr *data, u32 len) |
754 | { | 757 | { |
755 | struct p54_common *priv = dev->priv; | 758 | struct p54_common *priv = dev->priv; |
756 | struct sk_buff *entry = priv->tx_queue.next; | 759 | struct sk_buff *entry = priv->tx_queue.next; |
@@ -807,7 +810,7 @@ static int p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb, | |||
807 | __skb_queue_after(&priv->tx_queue, target_skb, skb); | 810 | __skb_queue_after(&priv->tx_queue, target_skb, skb); |
808 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); | 811 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); |
809 | 812 | ||
810 | if (largest_hole < priv->headroom + sizeof(struct p54_control_hdr) + | 813 | if (largest_hole < priv->headroom + sizeof(struct p54_hdr) + |
811 | 48 + IEEE80211_MAX_RTS_THRESHOLD + priv->tailroom) | 814 | 48 + IEEE80211_MAX_RTS_THRESHOLD + priv->tailroom) |
812 | ieee80211_stop_queues(dev); | 815 | ieee80211_stop_queues(dev); |
813 | 816 | ||
@@ -819,7 +822,7 @@ static struct sk_buff *p54_alloc_skb(struct ieee80211_hw *dev, | |||
819 | u16 hdr_flags, u16 len, u16 type, gfp_t memflags) | 822 | u16 hdr_flags, u16 len, u16 type, gfp_t memflags) |
820 | { | 823 | { |
821 | struct p54_common *priv = dev->priv; | 824 | struct p54_common *priv = dev->priv; |
822 | struct p54_control_hdr *hdr; | 825 | struct p54_hdr *hdr; |
823 | struct sk_buff *skb; | 826 | struct sk_buff *skb; |
824 | 827 | ||
825 | skb = __dev_alloc_skb(len + priv->tx_hdr_len, memflags); | 828 | skb = __dev_alloc_skb(len + priv->tx_hdr_len, memflags); |
@@ -827,11 +830,11 @@ static struct sk_buff *p54_alloc_skb(struct ieee80211_hw *dev, | |||
827 | return NULL; | 830 | return NULL; |
828 | skb_reserve(skb, priv->tx_hdr_len); | 831 | skb_reserve(skb, priv->tx_hdr_len); |
829 | 832 | ||
830 | hdr = (struct p54_control_hdr *) skb_put(skb, sizeof(*hdr)); | 833 | hdr = (struct p54_hdr *) skb_put(skb, sizeof(*hdr)); |
831 | hdr->magic1 = cpu_to_le16(hdr_flags); | 834 | hdr->flags = cpu_to_le16(hdr_flags); |
832 | hdr->len = cpu_to_le16(len - sizeof(*hdr)); | 835 | hdr->len = cpu_to_le16(len - sizeof(*hdr)); |
833 | hdr->type = cpu_to_le16(type); | 836 | hdr->type = cpu_to_le16(type); |
834 | hdr->retry1 = hdr->retry2 = 0; | 837 | hdr->tries = hdr->rts_tries = 0; |
835 | 838 | ||
836 | if (unlikely(p54_assign_address(dev, skb, hdr, len))) { | 839 | if (unlikely(p54_assign_address(dev, skb, hdr, len))) { |
837 | kfree_skb(skb); | 840 | kfree_skb(skb); |
@@ -843,7 +846,7 @@ static struct sk_buff *p54_alloc_skb(struct ieee80211_hw *dev, | |||
843 | int p54_read_eeprom(struct ieee80211_hw *dev) | 846 | int p54_read_eeprom(struct ieee80211_hw *dev) |
844 | { | 847 | { |
845 | struct p54_common *priv = dev->priv; | 848 | struct p54_common *priv = dev->priv; |
846 | struct p54_control_hdr *hdr = NULL; | 849 | struct p54_hdr *hdr = NULL; |
847 | struct p54_eeprom_lm86 *eeprom_hdr; | 850 | struct p54_eeprom_lm86 *eeprom_hdr; |
848 | struct sk_buff *skb; | 851 | struct sk_buff *skb; |
849 | size_t eeprom_size = 0x2020, offset = 0, blocksize; | 852 | size_t eeprom_size = 0x2020, offset = 0, blocksize; |
@@ -899,8 +902,8 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
899 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 902 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
900 | struct ieee80211_tx_queue_stats *current_queue; | 903 | struct ieee80211_tx_queue_stats *current_queue; |
901 | struct p54_common *priv = dev->priv; | 904 | struct p54_common *priv = dev->priv; |
902 | struct p54_control_hdr *hdr; | 905 | struct p54_hdr *hdr; |
903 | struct p54_tx_control_allocdata *txhdr; | 906 | struct p54_tx_data *txhdr; |
904 | size_t padding, len; | 907 | size_t padding, len; |
905 | int i, j, ridx; | 908 | int i, j, ridx; |
906 | u8 rate; | 909 | u8 rate; |
@@ -920,17 +923,16 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
920 | padding = (unsigned long)(skb->data - (sizeof(*hdr) + sizeof(*txhdr))) & 3; | 923 | padding = (unsigned long)(skb->data - (sizeof(*hdr) + sizeof(*txhdr))) & 3; |
921 | len = skb->len; | 924 | len = skb->len; |
922 | 925 | ||
923 | txhdr = (struct p54_tx_control_allocdata *) | 926 | txhdr = (struct p54_tx_data *) skb_push(skb, sizeof(*txhdr) + padding); |
924 | skb_push(skb, sizeof(*txhdr) + padding); | 927 | hdr = (struct p54_hdr *) skb_push(skb, sizeof(*hdr)); |
925 | hdr = (struct p54_control_hdr *) skb_push(skb, sizeof(*hdr)); | ||
926 | 928 | ||
927 | if (padding) | 929 | if (padding) |
928 | hdr->magic1 = cpu_to_le16(0x4010); | 930 | hdr->flags = cpu_to_le16(P54_HDR_FLAG_DATA_ALIGN); |
929 | else | 931 | else |
930 | hdr->magic1 = cpu_to_le16(0x0010); | 932 | hdr->flags = cpu_to_le16(0); |
931 | hdr->len = cpu_to_le16(len); | 933 | hdr->len = cpu_to_le16(len); |
932 | hdr->type = (info->flags & IEEE80211_TX_CTL_NO_ACK) ? 0 : cpu_to_le16(1); | 934 | hdr->type = (info->flags & IEEE80211_TX_CTL_NO_ACK) ? 0 : cpu_to_le16(1); |
933 | hdr->retry1 = info->control.rates[0].count; | 935 | hdr->rts_tries = info->control.rates[0].count; |
934 | 936 | ||
935 | /* | 937 | /* |
936 | * we register the rates in perfect order, and | 938 | * we register the rates in perfect order, and |
@@ -996,16 +998,18 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
996 | ridx++; | 998 | ridx++; |
997 | } | 999 | } |
998 | } | 1000 | } |
999 | hdr->retry2 = ridx; | 1001 | hdr->tries = ridx; |
1000 | 1002 | txhdr->crypt_offset = 0; | |
1003 | txhdr->rts_rate_idx = 0; | ||
1001 | txhdr->key_type = 0; | 1004 | txhdr->key_type = 0; |
1002 | txhdr->key_len = 0; | 1005 | txhdr->key_len = 0; |
1003 | txhdr->hw_queue = skb_get_queue_mapping(skb) + 4; | 1006 | txhdr->hw_queue = skb_get_queue_mapping(skb) + 4; |
1007 | txhdr->backlog = 32; | ||
1008 | memset(txhdr->durations, 0, sizeof(txhdr->durations)); | ||
1004 | txhdr->tx_antenna = (info->antenna_sel_tx == 0) ? | 1009 | txhdr->tx_antenna = (info->antenna_sel_tx == 0) ? |
1005 | 2 : info->antenna_sel_tx - 1; | 1010 | 2 : info->antenna_sel_tx - 1; |
1006 | txhdr->output_power = priv->output_power; | 1011 | txhdr->output_power = priv->output_power; |
1007 | txhdr->cts_rate = (info->flags & IEEE80211_TX_CTL_NO_ACK) ? | 1012 | txhdr->cts_rate = cts_rate; |
1008 | 0 : cts_rate; | ||
1009 | if (padding) | 1013 | if (padding) |
1010 | txhdr->align[0] = padding; | 1014 | txhdr->align[0] = padding; |
1011 | 1015 | ||
@@ -1024,8 +1028,8 @@ static int p54_setup_mac(struct ieee80211_hw *dev, u16 mode, const u8 *bssid) | |||
1024 | struct sk_buff *skb; | 1028 | struct sk_buff *skb; |
1025 | struct p54_setup_mac *setup; | 1029 | struct p54_setup_mac *setup; |
1026 | 1030 | ||
1027 | skb = p54_alloc_skb(dev, 0x8001, sizeof(struct p54_control_hdr) + | 1031 | skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*setup) + |
1028 | sizeof(*setup), P54_CONTROL_TYPE_SETUP, | 1032 | sizeof(struct p54_hdr), P54_CONTROL_TYPE_SETUP, |
1029 | GFP_ATOMIC); | 1033 | GFP_ATOMIC); |
1030 | if (!skb) | 1034 | if (!skb) |
1031 | return -ENOMEM; | 1035 | return -ENOMEM; |
@@ -1069,19 +1073,19 @@ static int p54_set_freq(struct ieee80211_hw *dev, __le16 freq) | |||
1069 | { | 1073 | { |
1070 | struct p54_common *priv = dev->priv; | 1074 | struct p54_common *priv = dev->priv; |
1071 | struct sk_buff *skb; | 1075 | struct sk_buff *skb; |
1072 | struct p54_tx_control_channel *chan; | 1076 | struct p54_scan *chan; |
1073 | unsigned int i; | 1077 | unsigned int i; |
1074 | size_t data_len = sizeof(struct p54_control_hdr) + sizeof(*chan); | ||
1075 | void *entry; | 1078 | void *entry; |
1076 | 1079 | ||
1077 | skb = p54_alloc_skb(dev, 0x8001, data_len, | 1080 | skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*chan) + |
1078 | P54_CONTROL_TYPE_CHANNEL_CHANGE, GFP_ATOMIC); | 1081 | sizeof(struct p54_hdr), P54_CONTROL_TYPE_SCAN, |
1082 | GFP_ATOMIC); | ||
1079 | if (!skb) | 1083 | if (!skb) |
1080 | return -ENOMEM; | 1084 | return -ENOMEM; |
1081 | 1085 | ||
1082 | chan = (struct p54_tx_control_channel *) skb_put(skb, sizeof(*chan)); | 1086 | chan = (struct p54_scan *) skb_put(skb, sizeof(*chan)); |
1083 | memset(chan->padding1, 0, sizeof(chan->padding1)); | 1087 | memset(chan->padding1, 0, sizeof(chan->padding1)); |
1084 | chan->flags = cpu_to_le16(0x1); | 1088 | chan->mode = cpu_to_le16(P54_SCAN_EXIT); |
1085 | chan->dwell = cpu_to_le16(0x0); | 1089 | chan->dwell = cpu_to_le16(0x0); |
1086 | 1090 | ||
1087 | for (i = 0; i < priv->iq_autocal_len; i++) { | 1091 | for (i = 0; i < priv->iq_autocal_len; i++) { |
@@ -1132,13 +1136,13 @@ static int p54_set_freq(struct ieee80211_hw *dev, __le16 freq) | |||
1132 | } | 1136 | } |
1133 | 1137 | ||
1134 | if (priv->fw_var < 0x500) { | 1138 | if (priv->fw_var < 0x500) { |
1135 | data_len = P54_TX_CONTROL_CHANNEL_V1_LEN; | ||
1136 | chan->v1.rssical_mul = cpu_to_le16(130); | 1139 | chan->v1.rssical_mul = cpu_to_le16(130); |
1137 | chan->v1.rssical_add = cpu_to_le16(0xfe70); | 1140 | chan->v1.rssical_add = cpu_to_le16(0xfe70); |
1138 | } else { | 1141 | } else { |
1139 | chan->v2.rssical_mul = cpu_to_le16(130); | 1142 | chan->v2.rssical_mul = cpu_to_le16(130); |
1140 | chan->v2.rssical_add = cpu_to_le16(0xfe70); | 1143 | chan->v2.rssical_add = cpu_to_le16(0xfe70); |
1141 | chan->v2.basic_rate_mask = cpu_to_le32(0x15f); | 1144 | chan->v2.basic_rate_mask = cpu_to_le32(0x15f); |
1145 | memset(chan->v2.rts_rates, 0, 8); | ||
1142 | } | 1146 | } |
1143 | priv->tx(dev, skb, 1); | 1147 | priv->tx(dev, skb, 1); |
1144 | return 0; | 1148 | return 0; |
@@ -1153,15 +1157,15 @@ static int p54_set_leds(struct ieee80211_hw *dev, int mode, int link, int act) | |||
1153 | { | 1157 | { |
1154 | struct p54_common *priv = dev->priv; | 1158 | struct p54_common *priv = dev->priv; |
1155 | struct sk_buff *skb; | 1159 | struct sk_buff *skb; |
1156 | struct p54_tx_control_led *led; | 1160 | struct p54_led *led; |
1157 | 1161 | ||
1158 | skb = p54_alloc_skb(dev, 0x8001, sizeof(*led) + | 1162 | skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*led) + |
1159 | sizeof(struct p54_control_hdr), | 1163 | sizeof(struct p54_hdr), P54_CONTROL_TYPE_LED, |
1160 | P54_CONTROL_TYPE_LED, GFP_ATOMIC); | 1164 | GFP_ATOMIC); |
1161 | if (!skb) | 1165 | if (!skb) |
1162 | return -ENOMEM; | 1166 | return -ENOMEM; |
1163 | 1167 | ||
1164 | led = (struct p54_tx_control_led *)skb_put(skb, sizeof(*led)); | 1168 | led = (struct p54_led *)skb_put(skb, sizeof(*led)); |
1165 | led->mode = cpu_to_le16(mode); | 1169 | led->mode = cpu_to_le16(mode); |
1166 | led->led_permanent = cpu_to_le16(link); | 1170 | led->led_permanent = cpu_to_le16(link); |
1167 | led->led_temporary = cpu_to_le16(act); | 1171 | led->led_temporary = cpu_to_le16(act); |
@@ -1184,8 +1188,9 @@ static int p54_set_edcf(struct ieee80211_hw *dev) | |||
1184 | struct sk_buff *skb; | 1188 | struct sk_buff *skb; |
1185 | struct p54_edcf *edcf; | 1189 | struct p54_edcf *edcf; |
1186 | 1190 | ||
1187 | skb = p54_alloc_skb(dev, 0x8001, sizeof(struct p54_control_hdr) + | 1191 | skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*edcf) + |
1188 | sizeof(*edcf), P54_CONTROL_TYPE_DCFINIT, GFP_ATOMIC); | 1192 | sizeof(struct p54_hdr), P54_CONTROL_TYPE_DCFINIT, |
1193 | GFP_ATOMIC); | ||
1189 | if (!skb) | 1194 | if (!skb) |
1190 | return -ENOMEM; | 1195 | return -ENOMEM; |
1191 | 1196 | ||
@@ -1212,11 +1217,9 @@ static int p54_init_stats(struct ieee80211_hw *dev) | |||
1212 | { | 1217 | { |
1213 | struct p54_common *priv = dev->priv; | 1218 | struct p54_common *priv = dev->priv; |
1214 | 1219 | ||
1215 | priv->cached_stats = p54_alloc_skb(dev, 0x8000, | 1220 | priv->cached_stats = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL, |
1216 | sizeof(struct p54_control_hdr) + | 1221 | sizeof(struct p54_hdr) + sizeof(struct p54_statistics), |
1217 | sizeof(struct p54_statistics), | 1222 | P54_CONTROL_TYPE_STAT_READBACK, GFP_KERNEL); |
1218 | P54_CONTROL_TYPE_STAT_READBACK, | ||
1219 | GFP_KERNEL); | ||
1220 | if (!priv->cached_stats) | 1223 | if (!priv->cached_stats) |
1221 | return -ENOMEM; | 1224 | return -ENOMEM; |
1222 | 1225 | ||
@@ -1277,11 +1280,11 @@ static int p54_add_interface(struct ieee80211_hw *dev, | |||
1277 | 1280 | ||
1278 | memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); | 1281 | memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); |
1279 | 1282 | ||
1280 | p54_setup_mac(dev, 0, NULL); | 1283 | p54_setup_mac(dev, P54_FILTER_TYPE_NONE, NULL); |
1281 | 1284 | ||
1282 | switch (conf->type) { | 1285 | switch (conf->type) { |
1283 | case NL80211_IFTYPE_STATION: | 1286 | case NL80211_IFTYPE_STATION: |
1284 | p54_setup_mac(dev, 1, NULL); | 1287 | p54_setup_mac(dev, P54_FILTER_TYPE_STATION, NULL); |
1285 | break; | 1288 | break; |
1286 | default: | 1289 | default: |
1287 | BUG(); /* impossible */ | 1290 | BUG(); /* impossible */ |
@@ -1299,7 +1302,7 @@ static void p54_remove_interface(struct ieee80211_hw *dev, | |||
1299 | struct p54_common *priv = dev->priv; | 1302 | struct p54_common *priv = dev->priv; |
1300 | priv->mode = NL80211_IFTYPE_MONITOR; | 1303 | priv->mode = NL80211_IFTYPE_MONITOR; |
1301 | memset(priv->mac_addr, 0, ETH_ALEN); | 1304 | memset(priv->mac_addr, 0, ETH_ALEN); |
1302 | p54_setup_mac(dev, 0, NULL); | 1305 | p54_setup_mac(dev, P54_FILTER_TYPE_NONE, NULL); |
1303 | } | 1306 | } |
1304 | 1307 | ||
1305 | static int p54_config(struct ieee80211_hw *dev, u32 changed) | 1308 | static int p54_config(struct ieee80211_hw *dev, u32 changed) |
@@ -1325,7 +1328,7 @@ static int p54_config_interface(struct ieee80211_hw *dev, | |||
1325 | struct p54_common *priv = dev->priv; | 1328 | struct p54_common *priv = dev->priv; |
1326 | 1329 | ||
1327 | mutex_lock(&priv->conf_mutex); | 1330 | mutex_lock(&priv->conf_mutex); |
1328 | p54_setup_mac(dev, 0, conf->bssid); | 1331 | p54_setup_mac(dev, P54_FILTER_TYPE_STATION, conf->bssid); |
1329 | p54_set_leds(dev, 1, !is_multicast_ether_addr(conf->bssid), 0); | 1332 | p54_set_leds(dev, 1, !is_multicast_ether_addr(conf->bssid), 0); |
1330 | memcpy(priv->bssid, conf->bssid, ETH_ALEN); | 1333 | memcpy(priv->bssid, conf->bssid, ETH_ALEN); |
1331 | mutex_unlock(&priv->conf_mutex); | 1334 | mutex_unlock(&priv->conf_mutex); |
@@ -1378,15 +1381,16 @@ static int p54_init_xbow_synth(struct ieee80211_hw *dev) | |||
1378 | { | 1381 | { |
1379 | struct p54_common *priv = dev->priv; | 1382 | struct p54_common *priv = dev->priv; |
1380 | struct sk_buff *skb; | 1383 | struct sk_buff *skb; |
1381 | struct p54_tx_control_xbow_synth *xbow; | 1384 | struct p54_xbow_synth *xbow; |
1382 | 1385 | ||
1383 | skb = p54_alloc_skb(dev, 0x8001, sizeof(struct p54_control_hdr) + | 1386 | skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*xbow) + |
1384 | sizeof(*xbow), P54_CONTROL_TYPE_XBOW_SYNTH_CFG, | 1387 | sizeof(struct p54_hdr), |
1388 | P54_CONTROL_TYPE_XBOW_SYNTH_CFG, | ||
1385 | GFP_KERNEL); | 1389 | GFP_KERNEL); |
1386 | if (!skb) | 1390 | if (!skb) |
1387 | return -ENOMEM; | 1391 | return -ENOMEM; |
1388 | 1392 | ||
1389 | xbow = (struct p54_tx_control_xbow_synth *)skb_put(skb, sizeof(*xbow)); | 1393 | xbow = (struct p54_xbow_synth *)skb_put(skb, sizeof(*xbow)); |
1390 | xbow->magic1 = cpu_to_le16(0x1); | 1394 | xbow->magic1 = cpu_to_le16(0x1); |
1391 | xbow->magic2 = cpu_to_le16(0x2); | 1395 | xbow->magic2 = cpu_to_le16(0x2); |
1392 | xbow->freq = cpu_to_le16(5390); | 1396 | xbow->freq = cpu_to_le16(5390); |
@@ -1504,8 +1508,8 @@ struct ieee80211_hw *p54_init_common(size_t priv_data_len) | |||
1504 | */ | 1508 | */ |
1505 | dev->max_rates = 4; | 1509 | dev->max_rates = 4; |
1506 | dev->max_rate_tries = 7; | 1510 | dev->max_rate_tries = 7; |
1507 | dev->extra_tx_headroom = sizeof(struct p54_control_hdr) + 4 + | 1511 | dev->extra_tx_headroom = sizeof(struct p54_hdr) + 4 + |
1508 | sizeof(struct p54_tx_control_allocdata); | 1512 | sizeof(struct p54_tx_data); |
1509 | 1513 | ||
1510 | mutex_init(&priv->conf_mutex); | 1514 | mutex_init(&priv->conf_mutex); |
1511 | init_completion(&priv->eeprom_comp); | 1515 | init_completion(&priv->eeprom_comp); |