aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/p54
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2008-10-22 16:41:55 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-10-31 19:00:34 -0400
commit27df605ebe2c106c53957dfdaee5d948f01cfc97 (patch)
tree3f98e91643ebec86a2b07c8ed676a4aacd3c074a /drivers/net/wireless/p54
parent5e73444e91889ea6c7a83bc174ef8e8b6aaeea9b (diff)
p54: integrate parts of lmac_longbow.h and other parts of stlc45xx
This patch removes most/all? of the "magic" numbers and unknown structure variables inside the code and replaces them with meaningful prototypes. (Plus a one line warning fix from Larry Finger <Larry.Finger@lwfinger.net>.) Signed-off-by: Christian Lamparter <chunkeey@web.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/p54')
-rw-r--r--drivers/net/wireless/p54/p54.h29
-rw-r--r--drivers/net/wireless/p54/p54common.c142
-rw-r--r--drivers/net/wireless/p54/p54common.h240
-rw-r--r--drivers/net/wireless/p54/p54pci.c2
-rw-r--r--drivers/net/wireless/p54/p54usb.c8
5 files changed, 316 insertions, 105 deletions
diff --git a/drivers/net/wireless/p54/p54.h b/drivers/net/wireless/p54/p54.h
index 7a3bf759a40e..eb69b904f651 100644
--- a/drivers/net/wireless/p54/p54.h
+++ b/drivers/net/wireless/p54/p54.h
@@ -14,17 +14,17 @@
14 * published by the Free Software Foundation. 14 * published by the Free Software Foundation.
15 */ 15 */
16 16
17enum control_frame_types { 17enum p54_control_frame_types {
18 P54_CONTROL_TYPE_SETUP = 0, 18 P54_CONTROL_TYPE_SETUP = 0,
19 P54_CONTROL_TYPE_CHANNEL_CHANGE, 19 P54_CONTROL_TYPE_SCAN,
20 P54_CONTROL_TYPE_FREQDONE, 20 P54_CONTROL_TYPE_TRAP,
21 P54_CONTROL_TYPE_DCFINIT, 21 P54_CONTROL_TYPE_DCFINIT,
22 P54_CONTROL_TYPE_ENCRYPTION, 22 P54_CONTROL_TYPE_RX_KEYCACHE,
23 P54_CONTROL_TYPE_TIM, 23 P54_CONTROL_TYPE_TIM,
24 P54_CONTROL_TYPE_POWERMGT, 24 P54_CONTROL_TYPE_PSM,
25 P54_CONTROL_TYPE_FREEQUEUE, 25 P54_CONTROL_TYPE_TXCANCEL,
26 P54_CONTROL_TYPE_TXDONE, 26 P54_CONTROL_TYPE_TXDONE,
27 P54_CONTROL_TYPE_PING, 27 P54_CONTROL_TYPE_BURST,
28 P54_CONTROL_TYPE_STAT_READBACK, 28 P54_CONTROL_TYPE_STAT_READBACK,
29 P54_CONTROL_TYPE_BBP, 29 P54_CONTROL_TYPE_BBP,
30 P54_CONTROL_TYPE_EEPROM_READBACK, 30 P54_CONTROL_TYPE_EEPROM_READBACK,
@@ -37,15 +37,20 @@ enum control_frame_types {
37 P54_CONTROL_TYPE_XBOW_SYNTH_CFG, 37 P54_CONTROL_TYPE_XBOW_SYNTH_CFG,
38 P54_CONTROL_TYPE_CCE_QUIET, 38 P54_CONTROL_TYPE_CCE_QUIET,
39 P54_CONTROL_TYPE_PSM_STA_UNLOCK, 39 P54_CONTROL_TYPE_PSM_STA_UNLOCK,
40 P54_CONTROL_TYPE_PCS,
41 P54_CONTROL_TYPE_BT_BALANCER = 28,
42 P54_CONTROL_TYPE_GROUP_ADDRESS_TABLE = 30,
43 P54_CONTROL_TYPE_ARPTABLE = 31,
44 P54_CONTROL_TYPE_BT_OPTIONS = 35
40}; 45};
41 46
42struct p54_control_hdr { 47struct p54_hdr {
43 __le16 magic1; 48 __le16 flags;
44 __le16 len; 49 __le16 len;
45 __le32 req_id; 50 __le32 req_id;
46 __le16 type; /* enum control_frame_types */ 51 __le16 type; /* enum p54_control_frame_types */
47 u8 retry1; 52 u8 rts_tries;
48 u8 retry2; 53 u8 tries;
49 u8 data[0]; 54 u8 data[0];
50} __attribute__ ((packed)); 55} __attribute__ ((packed));
51 56
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)
481static int p54_rx_data(struct ieee80211_hw *dev, struct sk_buff *skb) 484static 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);
580static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb) 583static 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
664out: 667out:
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:
670static void p54_rx_eeprom_readback(struct ieee80211_hw *dev, 673static 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,
685static void p54_rx_stats(struct ieee80211_hw *dev, struct sk_buff *skb) 688static 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
706static int p54_rx_control(struct ieee80211_hw *dev, struct sk_buff *skb) 709static 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 */
752static int p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb, 755static 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,
843int p54_read_eeprom(struct ieee80211_hw *dev) 846int 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
1305static int p54_config(struct ieee80211_hw *dev, u32 changed) 1308static 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);
diff --git a/drivers/net/wireless/p54/p54common.h b/drivers/net/wireless/p54/p54common.h
index 125f70a90dab..b1101feace69 100644
--- a/drivers/net/wireless/p54/p54common.h
+++ b/drivers/net/wireless/p54/p54common.h
@@ -33,6 +33,13 @@ struct bootrec_exp_if {
33 __le16 top_compat; 33 __le16 top_compat;
34} __attribute__((packed)); 34} __attribute__((packed));
35 35
36#define BR_DESC_PRIV_CAP_WEP BIT(0)
37#define BR_DESC_PRIV_CAP_TKIP BIT(1)
38#define BR_DESC_PRIV_CAP_MICHAEL BIT(2)
39#define BR_DESC_PRIV_CAP_CCX_CP BIT(3)
40#define BR_DESC_PRIV_CAP_CCX_MIC BIT(4)
41#define BR_DESC_PRIV_CAP_AESCCMP BIT(5)
42
36struct bootrec_desc { 43struct bootrec_desc {
37 __le16 modes; 44 __le16 modes;
38 __le16 flags; 45 __le16 flags;
@@ -40,7 +47,12 @@ struct bootrec_desc {
40 __le32 rx_end; 47 __le32 rx_end;
41 u8 headroom; 48 u8 headroom;
42 u8 tailroom; 49 u8 tailroom;
43 u8 unimportant[6]; 50 u8 tx_queues;
51 u8 tx_depth;
52 u8 privacy_caps;
53 u8 rx_keycache_size;
54 u8 time_size;
55 u8 padding;
44 u8 rates[16]; 56 u8 rates[16];
45 u8 padding2[4]; 57 u8 padding2[4];
46 __le16 rx_mtu; 58 __le16 rx_mtu;
@@ -56,6 +68,34 @@ struct bootrec_desc {
56#define BR_CODE_END_OF_BRA 0xFF0000FF 68#define BR_CODE_END_OF_BRA 0xFF0000FF
57#define LEGACY_BR_CODE_END_OF_BRA 0xFFFFFFFF 69#define LEGACY_BR_CODE_END_OF_BRA 0xFFFFFFFF
58 70
71#define P54_HDR_FLAG_CONTROL BIT(15)
72#define P54_HDR_FLAG_CONTROL_OPSET (BIT(15) + BIT(0))
73
74#define P54_HDR_FLAG_DATA_ALIGN BIT(14)
75#define P54_HDR_FLAG_DATA_OUT_PROMISC BIT(0)
76#define P54_HDR_FLAG_DATA_OUT_TIMESTAMP BIT(1)
77#define P54_HDR_FLAG_DATA_OUT_SEQNR BIT(2)
78#define P54_HDR_FLAG_DATA_OUT_BIT3 BIT(3)
79#define P54_HDR_FLAG_DATA_OUT_BURST BIT(4)
80#define P54_HDR_FLAG_DATA_OUT_NOCANCEL BIT(5)
81#define P54_HDR_FLAG_DATA_OUT_CLEARTIM BIT(6)
82#define P54_HDR_FLAG_DATA_OUT_HITCHHIKE BIT(7)
83#define P54_HDR_FLAG_DATA_OUT_COMPRESS BIT(8)
84#define P54_HDR_FLAG_DATA_OUT_CONCAT BIT(9)
85#define P54_HDR_FLAG_DATA_OUT_PCS_ACCEPT BIT(10)
86#define P54_HDR_FLAG_DATA_OUT_WAITEOSP BIT(11)
87
88#define P54_HDR_FLAG_DATA_IN_FCS_GOOD BIT(0)
89#define P54_HDR_FLAG_DATA_IN_MATCH_MAC BIT(1)
90#define P54_HDR_FLAG_DATA_IN_MCBC BIT(2)
91#define P54_HDR_FLAG_DATA_IN_BEACON BIT(3)
92#define P54_HDR_FLAG_DATA_IN_MATCH_BSS BIT(4)
93#define P54_HDR_FLAG_DATA_IN_BCAST_BSS BIT(5)
94#define P54_HDR_FLAG_DATA_IN_DATA BIT(6)
95#define P54_HDR_FLAG_DATA_IN_TRUNCATED BIT(7)
96#define P54_HDR_FLAG_DATA_IN_BIT8 BIT(8)
97#define P54_HDR_FLAG_DATA_IN_TRANSPARENT BIT(9)
98
59/* PDA defines are Copyright (C) 2005 Nokia Corporation (taken from islsm_pda.h) */ 99/* PDA defines are Copyright (C) 2005 Nokia Corporation (taken from islsm_pda.h) */
60 100
61struct pda_entry { 101struct pda_entry {
@@ -182,36 +222,91 @@ struct p54_eeprom_lm86 {
182 u8 data[0]; 222 u8 data[0];
183} __attribute__ ((packed)); 223} __attribute__ ((packed));
184 224
185struct p54_rx_hdr { 225enum p54_rx_decrypt_status {
186 __le16 magic; 226 P54_DECRYPT_NONE = 0,
227 P54_DECRYPT_OK,
228 P54_DECRYPT_NOKEY,
229 P54_DECRYPT_NOMICHAEL,
230 P54_DECRYPT_NOCKIPMIC,
231 P54_DECRYPT_FAIL_WEP,
232 P54_DECRYPT_FAIL_TKIP,
233 P54_DECRYPT_FAIL_MICAHEL,
234 P54_DECRYPT_FAIL_CKIPKP,
235 P54_DECRYPT_FAIL_CKIPMIC,
236 P54_DECRYPT_FAIL_AESCCMP
237};
238
239struct p54_rx_data {
240 __le16 flags;
187 __le16 len; 241 __le16 len;
188 __le16 freq; 242 __le16 freq;
189 u8 antenna; 243 u8 antenna;
190 u8 rate; 244 u8 rate;
191 u8 rssi; 245 u8 rssi;
192 u8 quality; 246 u8 quality;
193 u16 unknown2; 247 u8 decrypt_status;
248 u8 rssi_raw;
194 __le32 tsf32; 249 __le32 tsf32;
195 __le32 unalloc0; 250 __le32 unalloc0;
196 u8 align[0]; 251 u8 align[0];
197} __attribute__ ((packed)); 252} __attribute__ ((packed));
198 253
199struct p54_frame_sent_hdr { 254enum p54_trap_type {
255 P54_TRAP_SCAN = 0,
256 P54_TRAP_TIMER,
257 P54_TRAP_BEACON_TX,
258 P54_TRAP_FAA_RADIO_ON,
259 P54_TRAP_FAA_RADIO_OFF,
260 P54_TRAP_RADAR,
261 P54_TRAP_NO_BEACON,
262 P54_TRAP_TBTT,
263 P54_TRAP_SCO_ENTER,
264 P54_TRAP_SCO_EXIT
265};
266
267struct p54_trap {
268 __le16 event;
269 __le16 frequency;
270} __attribute__ ((packed));
271
272enum p54_frame_sent_status {
273 P54_TX_OK = 0,
274 P54_TX_FAILED,
275 P54_TX_PSM,
276 P54_TX_PSM_CANCELLED
277};
278
279struct p54_frame_sent {
200 u8 status; 280 u8 status;
201 u8 retries; 281 u8 tries;
202 __le16 ack_rssi; 282 u8 ack_rssi;
283 u8 quality;
203 __le16 seq; 284 __le16 seq;
204 u16 rate; 285 u8 antenna;
286 u8 padding;
205} __attribute__ ((packed)); 287} __attribute__ ((packed));
206 288
207struct p54_tx_control_allocdata { 289enum p54_tx_data_crypt {
290 P54_CRYPTO_NONE = 0,
291 P54_CRYPTO_WEP,
292 P54_CRYPTO_TKIP,
293 P54_CRYPTO_TKIPMICHAEL,
294 P54_CRYPTO_CCX_WEPMIC,
295 P54_CRYPTO_CCX_KPMIC,
296 P54_CRYPTO_CCX_KP,
297 P54_CRYPTO_AESCCMP
298};
299
300struct p54_tx_data {
208 u8 rateset[8]; 301 u8 rateset[8];
209 u8 unalloc0[2]; 302 u8 rts_rate_idx;
303 u8 crypt_offset;
210 u8 key_type; 304 u8 key_type;
211 u8 key_len; 305 u8 key_len;
212 u8 key[16]; 306 u8 key[16];
213 u8 hw_queue; 307 u8 hw_queue;
214 u8 unalloc1[9]; 308 u8 backlog;
309 __le16 durations[4];
215 u8 tx_antenna; 310 u8 tx_antenna;
216 u8 output_power; 311 u8 output_power;
217 u8 cts_rate; 312 u8 cts_rate;
@@ -219,6 +314,16 @@ struct p54_tx_control_allocdata {
219 u8 align[0]; 314 u8 align[0];
220} __attribute__ ((packed)); 315} __attribute__ ((packed));
221 316
317#define P54_FILTER_TYPE_NONE 0
318#define P54_FILTER_TYPE_STATION BIT(0)
319#define P54_FILTER_TYPE_IBSS BIT(1)
320#define P54_FILTER_TYPE_AP BIT(2)
321#define P54_FILTER_TYPE_TRANSPARENT BIT(3)
322#define P54_FILTER_TYPE_PROMISCUOUS BIT(4)
323#define P54_FILTER_TYPE_HIBERNATE BIT(5)
324#define P54_FILTER_TYPE_NOACK BIT(6)
325#define P54_FILTER_TYPE_RX_DISABLED BIT(7)
326
222struct p54_setup_mac { 327struct p54_setup_mac {
223 __le16 mac_mode; 328 __le16 mac_mode;
224 u8 mac_addr[ETH_ALEN]; 329 u8 mac_addr[ETH_ALEN];
@@ -253,8 +358,16 @@ struct p54_setup_mac {
253 } __attribute__ ((packed)); 358 } __attribute__ ((packed));
254} __attribute__ ((packed)); 359} __attribute__ ((packed));
255 360
256struct p54_tx_control_channel { 361#define P54_SETUP_V1_LEN 40
257 __le16 flags; 362#define P54_SETUP_V2_LEN (sizeof(struct p54_setup_mac))
363
364#define P54_SCAN_EXIT BIT(0)
365#define P54_SCAN_TRAP BIT(1)
366#define P54_SCAN_ACTIVE BIT(2)
367#define P54_SCAN_FILTER BIT(3)
368
369struct p54_scan {
370 __le16 mode;
258 __le16 dwell; 371 __le16 dwell;
259 u8 padding1[20]; 372 u8 padding1[20];
260 struct pda_iq_autocal_entry iq_autocal; 373 struct pda_iq_autocal_entry iq_autocal;
@@ -277,17 +390,17 @@ struct p54_tx_control_channel {
277 390
278 struct { 391 struct {
279 __le32 basic_rate_mask; 392 __le32 basic_rate_mask;
280 u8 rts_rates[8]; 393 u8 rts_rates[8];
281 __le16 rssical_mul; 394 __le16 rssical_mul;
282 __le16 rssical_add; 395 __le16 rssical_add;
283 } v2 __attribute__ ((packed)); 396 } v2 __attribute__ ((packed));
284 } __attribute__ ((packed)); 397 } __attribute__ ((packed));
285} __attribute__ ((packed)); 398} __attribute__ ((packed));
286 399
287#define P54_TX_CONTROL_CHANNEL_V1_LEN (sizeof(struct p54_tx_control_channel)-12) 400#define P54_SCAN_V1_LEN (sizeof(struct p54_scan)-12)
288#define P54_TX_CONTROL_CHANNEL_V2_LEN (sizeof(struct p54_tx_control_channel)) 401#define P54_SCAN_V2_LEN (sizeof(struct p54_scan))
289 402
290struct p54_tx_control_led { 403struct p54_led {
291 __le16 mode; 404 __le16 mode;
292 __le16 led_temporary; 405 __le16 led_temporary;
293 __le16 led_permanent; 406 __le16 led_permanent;
@@ -315,14 +428,103 @@ struct p54_statistics {
315 __le32 tsf32; 428 __le32 tsf32;
316 __le32 airtime; 429 __le32 airtime;
317 __le32 noise; 430 __le32 noise;
318 __le32 unkn[10]; /* CCE / CCA / RADAR */ 431 __le32 sample_noise[8];
432 __le32 sample_cca;
433 __le32 sample_tx;
319} __attribute__ ((packed)); 434} __attribute__ ((packed));
320 435
321struct p54_tx_control_xbow_synth { 436struct p54_xbow_synth {
322 __le16 magic1; 437 __le16 magic1;
323 __le16 magic2; 438 __le16 magic2;
324 __le16 freq; 439 __le16 freq;
325 u32 padding[5]; 440 u32 padding[5];
326} __attribute__ ((packed)); 441} __attribute__ ((packed));
327 442
443struct p54_timer {
444 __le32 interval;
445} __attribute__ ((packed));
446
447struct p54_keycache {
448 u8 entry;
449 u8 key_id;
450 u8 mac[ETH_ALEN];
451 u8 padding[2];
452 u8 key_type;
453 u8 key_len;
454 u8 key[24];
455} __attribute__ ((packed));
456
457struct p54_burst {
458 u8 flags;
459 u8 queue;
460 u8 backlog;
461 u8 pad;
462 __le16 durations[32];
463} __attribute__ ((packed));
464
465struct p54_psm_interval {
466 __le16 interval;
467 __le16 periods;
468} __attribute__ ((packed));
469
470#define P54_PSM BIT(0)
471#define P54_PSM_DTIM BIT(1)
472#define P54_PSM_MCBC BIT(2)
473#define P54_PSM_CHECKSUM BIT(3)
474#define P54_PSM_SKIP_MORE_DATA BIT(4)
475#define P54_PSM_BEACON_TIMEOUT BIT(5)
476#define P54_PSM_HFOSLEEP BIT(6)
477#define P54_PSM_AUTOSWITCH_SLEEP BIT(7)
478#define P54_PSM_LPIT BIT(8)
479#define P54_PSM_BF_UCAST_SKIP BIT(9)
480#define P54_PSM_BF_MCAST_SKIP BIT(10)
481
482struct p54_psm {
483 __le16 mode;
484 __le16 aid;
485 struct p54_psm_interval intervals[4];
486 u8 beacon_rssi_skip_max;
487 u8 rssi_delta_threshold;
488 u8 nr;
489 u8 exclude[1];
490} __attribute__ ((packed));
491
492#define MC_FILTER_ADDRESS_NUM 4
493
494struct p54_group_address_table {
495 __le16 filter_enable;
496 __le16 num_address;
497 u8 mac_list[MC_FILTER_ADDRESS_NUM][ETH_ALEN];
498} __attribute__ ((packed));
499
500struct p54_txcancel {
501 __le32 req_id;
502} __attribute__ ((packed));
503
504struct p54_sta_unlock {
505 u8 addr[ETH_ALEN];
506 u16 padding;
507} __attribute__ ((packed));
508
509#define P54_TIM_CLEAR BIT(15)
510struct p54_tx_control_tim {
511 u8 count;
512 u8 padding[3];
513 __le16 entry[8];
514} __attribute__ ((packed));
515
516struct p54_cce_quiet {
517 __le32 period;
518} __attribute__ ((packed));
519
520struct p54_bt_balancer {
521 __le16 prio_thresh;
522 __le16 acl_thresh;
523} __attribute__ ((packed));
524
525struct p54_arp_table {
526 __le16 filter_enable;
527 u8 ipv4_addr[4];
528} __attribute__ ((packed));
529
328#endif /* P54COMMON_H */ 530#endif /* P54COMMON_H */
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c
index 1bb9584f0355..3c9d030ccb8d 100644
--- a/drivers/net/wireless/p54/p54pci.c
+++ b/drivers/net/wireless/p54/p54pci.c
@@ -326,7 +326,7 @@ static void p54p_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
326 PCI_DMA_TODEVICE); 326 PCI_DMA_TODEVICE);
327 desc = &ring_control->tx_data[i]; 327 desc = &ring_control->tx_data[i];
328 desc->host_addr = cpu_to_le32(mapping); 328 desc->host_addr = cpu_to_le32(mapping);
329 desc->device_addr = ((struct p54_control_hdr *)skb->data)->req_id; 329 desc->device_addr = ((struct p54_hdr *)skb->data)->req_id;
330 desc->len = cpu_to_le16(skb->len); 330 desc->len = cpu_to_le16(skb->len);
331 desc->flags = 0; 331 desc->flags = 0;
332 332
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
index 88fb65046c71..49739c36a449 100644
--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -230,7 +230,7 @@ static void p54u_tx_3887(struct ieee80211_hw *dev, struct sk_buff *skb,
230 230
231 usb_fill_bulk_urb(addr_urb, priv->udev, 231 usb_fill_bulk_urb(addr_urb, priv->udev,
232 usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), 232 usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA),
233 &((struct p54_control_hdr *)skb->data)->req_id, 4, 233 &((struct p54_hdr *)skb->data)->req_id, 4,
234 p54u_tx_cb, dev); 234 p54u_tx_cb, dev);
235 usb_fill_bulk_urb(data_urb, priv->udev, 235 usb_fill_bulk_urb(data_urb, priv->udev,
236 usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), 236 usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA),
@@ -262,7 +262,7 @@ static void p54u_tx_lm87(struct ieee80211_hw *dev, struct sk_buff *skb,
262 struct urb *data_urb; 262 struct urb *data_urb;
263 struct lm87_tx_hdr *hdr; 263 struct lm87_tx_hdr *hdr;
264 __le32 checksum; 264 __le32 checksum;
265 __le32 addr = ((struct p54_control_hdr *)skb->data)->req_id; 265 __le32 addr = ((struct p54_hdr *)skb->data)->req_id;
266 266
267 data_urb = usb_alloc_urb(0, GFP_ATOMIC); 267 data_urb = usb_alloc_urb(0, GFP_ATOMIC);
268 if (!data_urb) 268 if (!data_urb)
@@ -313,8 +313,8 @@ static void p54u_tx_net2280(struct ieee80211_hw *dev, struct sk_buff *skb,
313 313
314 hdr = (void *)skb_push(skb, sizeof(*hdr)); 314 hdr = (void *)skb_push(skb, sizeof(*hdr));
315 memset(hdr, 0, sizeof(*hdr)); 315 memset(hdr, 0, sizeof(*hdr));
316 hdr->device_addr = ((struct p54_control_hdr *)skb->data)->req_id; 316 hdr->device_addr = ((struct p54_hdr *)skb->data)->req_id;
317 hdr->len = cpu_to_le16(skb->len + sizeof(struct p54_control_hdr)); 317 hdr->len = cpu_to_le16(skb->len + sizeof(struct p54_hdr));
318 318
319 usb_fill_bulk_urb(int_urb, priv->udev, 319 usb_fill_bulk_urb(int_urb, priv->udev,
320 usb_sndbulkpipe(priv->udev, P54U_PIPE_DEV), reg, sizeof(*reg), 320 usb_sndbulkpipe(priv->udev, P54U_PIPE_DEV), reg, sizeof(*reg),