aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-17 01:37:09 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-17 01:37:09 -0400
commitade7615de0643a9da628688e661e08148cd7c463 (patch)
tree1bc3a1d37c914c761d8bc330a83b943593ba197c
parentad81f0545ef01ea651886dddac4bef6cec930092 (diff)
staging: csr: remove driver
This driver is not being updated as the specifications are not able to be gotten from CSR or anyone else. Without those, getting this driver into proper mergable shape is going to be impossible. So remove the driver from the tree. If the specifications ever become available, this patch can be reverted and the driver fixed up properly. Reported-by: Lidza Louina <lidza.louina@gmail.com> Cc: Veli-Pekka Peltola <veli-pekka.peltola@bluegiga.com> Cc: Mikko Virkkilä <mikko.virkkila@bluegiga.com> Cc: Lauri Hintsala <Lauri.Hintsala@bluegiga.com> Cc: Riku Mettälä <riku.mettala@bluegiga.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/Kconfig2
-rw-r--r--drivers/staging/Makefile1
-rw-r--r--drivers/staging/csr/Kconfig9
-rw-r--r--drivers/staging/csr/LICENSE.txt39
-rw-r--r--drivers/staging/csr/Makefile73
-rw-r--r--drivers/staging/csr/bh.c404
-rw-r--r--drivers/staging/csr/csr_framework_ext.c40
-rw-r--r--drivers/staging/csr/csr_framework_ext.h35
-rw-r--r--drivers/staging/csr/csr_framework_ext_types.h30
-rw-r--r--drivers/staging/csr/csr_log.h223
-rw-r--r--drivers/staging/csr/csr_log_configure.h39
-rw-r--r--drivers/staging/csr/csr_log_text.h124
-rw-r--r--drivers/staging/csr/csr_macro.h39
-rw-r--r--drivers/staging/csr/csr_msg_transport.h17
-rw-r--r--drivers/staging/csr/csr_msgconv.c291
-rw-r--r--drivers/staging/csr/csr_msgconv.h78
-rw-r--r--drivers/staging/csr/csr_prim_defs.h55
-rw-r--r--drivers/staging/csr/csr_result.h17
-rw-r--r--drivers/staging/csr/csr_sched.h85
-rw-r--r--drivers/staging/csr/csr_sdio.h723
-rw-r--r--drivers/staging/csr/csr_serialize_primitive_types.c100
-rw-r--r--drivers/staging/csr/csr_time.c33
-rw-r--r--drivers/staging/csr/csr_time.h76
-rw-r--r--drivers/staging/csr/csr_util.c15
-rw-r--r--drivers/staging/csr/csr_wifi_common.h101
-rw-r--r--drivers/staging/csr/csr_wifi_fsm.h240
-rw-r--r--drivers/staging/csr/csr_wifi_fsm_event.h42
-rw-r--r--drivers/staging/csr/csr_wifi_fsm_types.h430
-rw-r--r--drivers/staging/csr/csr_wifi_hip_card.h114
-rw-r--r--drivers/staging/csr/csr_wifi_hip_card_sdio.c4001
-rw-r--r--drivers/staging/csr/csr_wifi_hip_card_sdio.h694
-rw-r--r--drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c2595
-rw-r--r--drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c1713
-rw-r--r--drivers/staging/csr/csr_wifi_hip_chiphelper.c793
-rw-r--r--drivers/staging/csr/csr_wifi_hip_chiphelper.h407
-rw-r--r--drivers/staging/csr/csr_wifi_hip_chiphelper_private.h200
-rw-r--r--drivers/staging/csr/csr_wifi_hip_conversions.h73
-rw-r--r--drivers/staging/csr/csr_wifi_hip_download.c819
-rw-r--r--drivers/staging/csr/csr_wifi_hip_dump.c837
-rw-r--r--drivers/staging/csr/csr_wifi_hip_packing.c4804
-rw-r--r--drivers/staging/csr/csr_wifi_hip_send.c415
-rw-r--r--drivers/staging/csr/csr_wifi_hip_signals.c1313
-rw-r--r--drivers/staging/csr/csr_wifi_hip_signals.h128
-rw-r--r--drivers/staging/csr/csr_wifi_hip_sigs.h1417
-rw-r--r--drivers/staging/csr/csr_wifi_hip_ta_sampling.c541
-rw-r--r--drivers/staging/csr/csr_wifi_hip_ta_sampling.h66
-rw-r--r--drivers/staging/csr/csr_wifi_hip_udi.c173
-rw-r--r--drivers/staging/csr/csr_wifi_hip_unifi.h871
-rw-r--r--drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c41
-rw-r--r--drivers/staging/csr/csr_wifi_hip_unifi_udi.h52
-rw-r--r--drivers/staging/csr/csr_wifi_hip_unifihw.h59
-rw-r--r--drivers/staging/csr/csr_wifi_hip_unifiversion.h30
-rw-r--r--drivers/staging/csr/csr_wifi_hip_xbv.c1076
-rw-r--r--drivers/staging/csr/csr_wifi_hip_xbv.h119
-rw-r--r--drivers/staging/csr/csr_wifi_hostio_prim.h18
-rw-r--r--drivers/staging/csr/csr_wifi_lib.h103
-rw-r--r--drivers/staging/csr/csr_wifi_msgconv.h49
-rw-r--r--drivers/staging/csr/csr_wifi_nme_ap_converter_init.c90
-rw-r--r--drivers/staging/csr/csr_wifi_nme_ap_converter_init.h41
-rw-r--r--drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c84
-rw-r--r--drivers/staging/csr/csr_wifi_nme_ap_free_upstream_contents.c39
-rw-r--r--drivers/staging/csr/csr_wifi_nme_ap_lib.h495
-rw-r--r--drivers/staging/csr/csr_wifi_nme_ap_prim.h494
-rw-r--r--drivers/staging/csr/csr_wifi_nme_ap_sef.c30
-rw-r--r--drivers/staging/csr/csr_wifi_nme_ap_sef.h21
-rw-r--r--drivers/staging/csr/csr_wifi_nme_ap_serialize.c909
-rw-r--r--drivers/staging/csr/csr_wifi_nme_ap_serialize.h94
-rw-r--r--drivers/staging/csr/csr_wifi_nme_converter_init.h38
-rw-r--r--drivers/staging/csr/csr_wifi_nme_lib.h991
-rw-r--r--drivers/staging/csr/csr_wifi_nme_prim.h1657
-rw-r--r--drivers/staging/csr/csr_wifi_nme_serialize.h166
-rw-r--r--drivers/staging/csr/csr_wifi_nme_task.h27
-rw-r--r--drivers/staging/csr/csr_wifi_private_common.h81
-rw-r--r--drivers/staging/csr/csr_wifi_result.h27
-rw-r--r--drivers/staging/csr/csr_wifi_router_converter_init.c82
-rw-r--r--drivers/staging/csr/csr_wifi_router_converter_init.h34
-rw-r--r--drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c134
-rw-r--r--drivers/staging/csr/csr_wifi_router_ctrl_converter_init.h34
-rw-r--r--drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c108
-rw-r--r--drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c87
-rw-r--r--drivers/staging/csr/csr_wifi_router_ctrl_lib.h2082
-rw-r--r--drivers/staging/csr/csr_wifi_router_ctrl_prim.h2113
-rw-r--r--drivers/staging/csr/csr_wifi_router_ctrl_sef.c46
-rw-r--r--drivers/staging/csr/csr_wifi_router_ctrl_sef.h51
-rw-r--r--drivers/staging/csr/csr_wifi_router_ctrl_serialize.c2591
-rw-r--r--drivers/staging/csr/csr_wifi_router_ctrl_serialize.h333
-rw-r--r--drivers/staging/csr/csr_wifi_router_free_downstream_contents.c53
-rw-r--r--drivers/staging/csr/csr_wifi_router_free_upstream_contents.c47
-rw-r--r--drivers/staging/csr/csr_wifi_router_lib.h417
-rw-r--r--drivers/staging/csr/csr_wifi_router_prim.h421
-rw-r--r--drivers/staging/csr/csr_wifi_router_sef.c19
-rw-r--r--drivers/staging/csr/csr_wifi_router_sef.h25
-rw-r--r--drivers/staging/csr/csr_wifi_router_serialize.c418
-rw-r--r--drivers/staging/csr/csr_wifi_router_serialize.h67
-rw-r--r--drivers/staging/csr/csr_wifi_router_task.h25
-rw-r--r--drivers/staging/csr/csr_wifi_router_transport.c199
-rw-r--r--drivers/staging/csr/csr_wifi_serialize_primitive_types.c256
-rw-r--r--drivers/staging/csr/csr_wifi_sme_ap_lib.h774
-rw-r--r--drivers/staging/csr/csr_wifi_sme_ap_prim.h1030
-rw-r--r--drivers/staging/csr/csr_wifi_sme_converter_init.c201
-rw-r--r--drivers/staging/csr/csr_wifi_sme_converter_init.h34
-rw-r--r--drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c187
-rw-r--r--drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c275
-rw-r--r--drivers/staging/csr/csr_wifi_sme_lib.h4303
-rw-r--r--drivers/staging/csr/csr_wifi_sme_prim.h6510
-rw-r--r--drivers/staging/csr/csr_wifi_sme_sef.c85
-rw-r--r--drivers/staging/csr/csr_wifi_sme_sef.h142
-rw-r--r--drivers/staging/csr/csr_wifi_sme_serialize.c5809
-rw-r--r--drivers/staging/csr/csr_wifi_sme_serialize.h666
-rw-r--r--drivers/staging/csr/csr_wifi_sme_task.h25
-rw-r--r--drivers/staging/csr/csr_wifi_vif_utils.h27
-rw-r--r--drivers/staging/csr/data_tx.c54
-rw-r--r--drivers/staging/csr/drv.c2193
-rw-r--r--drivers/staging/csr/firmware.c396
-rw-r--r--drivers/staging/csr/inet.c104
-rw-r--r--drivers/staging/csr/init_hw.c108
-rw-r--r--drivers/staging/csr/io.c1098
-rw-r--r--drivers/staging/csr/mlme.c433
-rw-r--r--drivers/staging/csr/monitor.c384
-rw-r--r--drivers/staging/csr/netdev.c3307
-rw-r--r--drivers/staging/csr/os.c477
-rw-r--r--drivers/staging/csr/putest.c685
-rw-r--r--drivers/staging/csr/sdio_events.c134
-rw-r--r--drivers/staging/csr/sdio_mmc.c1288
-rw-r--r--drivers/staging/csr/sdio_stubs.c82
-rw-r--r--drivers/staging/csr/sme_blocking.c1466
-rw-r--r--drivers/staging/csr/sme_mgt.c1012
-rw-r--r--drivers/staging/csr/sme_native.c566
-rw-r--r--drivers/staging/csr/sme_sys.c3260
-rw-r--r--drivers/staging/csr/sme_userspace.c315
-rw-r--r--drivers/staging/csr/sme_userspace.h38
-rw-r--r--drivers/staging/csr/sme_wext.c3327
-rw-r--r--drivers/staging/csr/ul_int.c528
-rw-r--r--drivers/staging/csr/unifi_clients.h129
-rw-r--r--drivers/staging/csr/unifi_config.h34
-rw-r--r--drivers/staging/csr/unifi_dbg.c110
-rw-r--r--drivers/staging/csr/unifi_event.c692
-rw-r--r--drivers/staging/csr/unifi_native.h257
-rw-r--r--drivers/staging/csr/unifi_os.h122
-rw-r--r--drivers/staging/csr/unifi_pdu_processing.c3729
-rw-r--r--drivers/staging/csr/unifi_priv.h1136
-rw-r--r--drivers/staging/csr/unifi_sme.c1225
-rw-r--r--drivers/staging/csr/unifi_sme.h245
-rw-r--r--drivers/staging/csr/unifi_wext.h108
-rw-r--r--drivers/staging/csr/unifiio.h398
-rw-r--r--drivers/staging/csr/wext_events.c283
146 files changed, 0 insertions, 91599 deletions
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 3227ebeae3f1..57d8b3444600 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -118,8 +118,6 @@ source "drivers/staging/ozwpan/Kconfig"
118 118
119source "drivers/staging/gdm72xx/Kconfig" 119source "drivers/staging/gdm72xx/Kconfig"
120 120
121source "drivers/staging/csr/Kconfig"
122
123source "drivers/staging/silicom/Kconfig" 121source "drivers/staging/silicom/Kconfig"
124 122
125source "drivers/staging/ced1401/Kconfig" 123source "drivers/staging/ced1401/Kconfig"
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 4d79ebe2de06..429321f15105 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -52,7 +52,6 @@ obj-$(CONFIG_MFD_NVEC) += nvec/
52obj-$(CONFIG_ANDROID) += android/ 52obj-$(CONFIG_ANDROID) += android/
53obj-$(CONFIG_USB_WPAN_HCD) += ozwpan/ 53obj-$(CONFIG_USB_WPAN_HCD) += ozwpan/
54obj-$(CONFIG_WIMAX_GDM72XX) += gdm72xx/ 54obj-$(CONFIG_WIMAX_GDM72XX) += gdm72xx/
55obj-$(CONFIG_CSR_WIFI) += csr/
56obj-$(CONFIG_NET_VENDOR_SILICOM) += silicom/ 55obj-$(CONFIG_NET_VENDOR_SILICOM) += silicom/
57obj-$(CONFIG_CED1401) += ced1401/ 56obj-$(CONFIG_CED1401) += ced1401/
58obj-$(CONFIG_DRM_IMX) += imx-drm/ 57obj-$(CONFIG_DRM_IMX) += imx-drm/
diff --git a/drivers/staging/csr/Kconfig b/drivers/staging/csr/Kconfig
deleted file mode 100644
index ad2a1096e920..000000000000
--- a/drivers/staging/csr/Kconfig
+++ /dev/null
@@ -1,9 +0,0 @@
1config CSR_WIFI
2 tristate "CSR wireless driver"
3 depends on MMC && CFG80211_WEXT && INET
4 select WIRELESS_EXT
5 select WEXT_PRIV
6 help
7 Driver for the CSR wireless SDIO device.
8
9 If unsure, select N.
diff --git a/drivers/staging/csr/LICENSE.txt b/drivers/staging/csr/LICENSE.txt
deleted file mode 100644
index 364853e5fedc..000000000000
--- a/drivers/staging/csr/LICENSE.txt
+++ /dev/null
@@ -1,39 +0,0 @@
1Permission is hereby granted, free of charge, to any person obtaining
2a copy of this software and associated documentation files (the
3"Software"), to deal in the Software without restriction, including
4without limitation the rights to use, copy, modify, merge, publish,
5distribute, sublicense, and/or sell copies of the Software, and to
6permit persons to whom the Software is furnished to do so, subject to
7the following conditions:
8
9The above copyright notice and this permission notice shall be
10included in all copies or substantial portions of the Software.
11
12Except as contained in this notice, the names of above-listed
13copyright holders and the names of any contributors shall not be used
14in advertising or otherwise to promote the sale, use or other dealings
15in this Software without prior written authorization.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
21CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
23OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24THE SOFTWARE.
25
26Alternatively, this software may be distributed under the terms of the
27GNU General Public License ("GPL") version 2 as published
28by the Free Software Foundation.
29
30As a special exception, if other files instantiate templates or use
31macros or inline functions from this file, or you compile this file
32and link it with other works to produce a work based on this file,
33this file does not by itself cause the resulting work to be covered by
34the GNU General Public License. However the source code for this file
35must still be made available in accordance with section (3) of the GNU
36General Public License.
37
38This exception does not invalidate any other reasons why a work based
39on this file might be covered by the GNU General Public License.
diff --git a/drivers/staging/csr/Makefile b/drivers/staging/csr/Makefile
deleted file mode 100644
index dbd135a8b177..000000000000
--- a/drivers/staging/csr/Makefile
+++ /dev/null
@@ -1,73 +0,0 @@
1ccflags-y := -DCSR_SME_USERSPACE -DCSR_SUPPORT_SME -DREMOTE_SYS_SAP -DCSR_WIFI_SECURITY_WAPI_ENABLE -DENABLE_SHUTDOWN -DUNIFI_DEBUG
2ccflags-y += -DSDIO_EXPORTS_STRUCT_DEVICE -DCSR_WIFI_SUPPORT_MMC_DRIVER -DCSR_WIFI_SINGLE_FUNCTION -DCSR_WIFI_SPLIT_PATCH
3ccflags-y += -DCSR_SUPPORT_WEXT -DREMOTE_SYS_SAP -DREMOTE_MGT_SAP -DCSR_WIFI_SECURITY_WAPI_ENABLE -DCSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND -DENABLE_SHUTDOWN -DCSR_WIFI_NME_ENABLE -DCSR_WIFI_AP_ENABLE -DCSR_SUPPORT_WEXT_AP -DCSR_WIFI_REQUEUE_PACKET_TO_HAL
4
5obj-$(CONFIG_CSR_WIFI) += csr_wifi.o
6obj-$(CONFIG_CSR_WIFI) += csr_helper.o
7
8csr_wifi-y := bh.o \
9 data_tx.o \
10 drv.o \
11 firmware.o \
12 inet.o \
13 init_hw.o \
14 io.o \
15 monitor.o \
16 netdev.o \
17 os.o \
18 putest.o \
19 sdio_events.o \
20 sdio_mmc.o \
21 sdio_stubs.o \
22 sme_blocking.o \
23 ul_int.o \
24 unifi_dbg.o \
25 unifi_event.o \
26 unifi_pdu_processing.o \
27 unifi_sme.o \
28 csr_wifi_hip_card_sdio.o \
29 csr_wifi_hip_card_sdio_intr.o \
30 csr_wifi_hip_card_sdio_mem.o \
31 csr_wifi_hip_chiphelper.o \
32 csr_wifi_hip_download.o \
33 csr_wifi_hip_dump.o \
34 csr_wifi_hip_packing.o \
35 csr_wifi_hip_send.o \
36 csr_wifi_hip_signals.o \
37 csr_wifi_hip_ta_sampling.o \
38 csr_wifi_hip_udi.o \
39 csr_wifi_hip_unifi_signal_names.o \
40 csr_wifi_hip_xbv.o \
41 csr_wifi_nme_ap_converter_init.o \
42 csr_wifi_nme_ap_free_downstream_contents.o \
43 csr_wifi_nme_ap_free_upstream_contents.o \
44 csr_wifi_nme_ap_serialize.o \
45 csr_wifi_nme_ap_sef.o \
46 csr_wifi_router_ctrl_sef.o \
47 csr_wifi_router_sef.o \
48 csr_wifi_router_transport.o \
49 csr_wifi_sme_sef.o \
50 csr_wifi_sme_converter_init.o \
51 csr_wifi_sme_free_downstream_contents.o \
52 csr_wifi_sme_free_upstream_contents.o \
53 csr_wifi_sme_serialize.o \
54 csr_wifi_router_ctrl_converter_init.o \
55 csr_wifi_router_ctrl_free_downstream_contents.o \
56 csr_wifi_router_ctrl_free_upstream_contents.o \
57 csr_wifi_router_ctrl_serialize.o \
58 csr_wifi_router_converter_init.o \
59 csr_wifi_router_free_downstream_contents.o \
60 csr_wifi_router_free_upstream_contents.o \
61 csr_wifi_router_serialize.o \
62 sme_mgt.o \
63 sme_sys.o \
64 sme_userspace.o \
65 sme_wext.o \
66 wext_events.o
67
68csr_helper-y := csr_time.o \
69 csr_util.o \
70 csr_framework_ext.o \
71 csr_wifi_serialize_primitive_types.o \
72 csr_serialize_primitive_types.o \
73 csr_msgconv.o
diff --git a/drivers/staging/csr/bh.c b/drivers/staging/csr/bh.c
deleted file mode 100644
index d795852ccb1c..000000000000
--- a/drivers/staging/csr/bh.c
+++ /dev/null
@@ -1,404 +0,0 @@
1/*
2 * ---------------------------------------------------------------------------
3 * FILE: bh.c
4 *
5 * PURPOSE:
6 * Provides an implementation for the driver bottom-half.
7 * It is part of the porting exercise in Linux.
8 *
9 * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd.
10 *
11 * Refer to LICENSE.txt included with this source code for details on
12 * the license terms.
13 *
14 * ---------------------------------------------------------------------------
15 */
16#include "csr_wifi_hip_unifi.h"
17#include "unifi_priv.h"
18#include <linux/sched/rt.h>
19
20/*
21 * ---------------------------------------------------------------------------
22 * uf_start_thread
23 *
24 * Helper function to start a new thread.
25 *
26 * Arguments:
27 * priv Pointer to OS driver structure for the device.
28 * thread Pointer to the thread object
29 * func The thread function
30 *
31 * Returns:
32 * 0 on success or else a Linux error code.
33 * ---------------------------------------------------------------------------
34 */
35int uf_start_thread(unifi_priv_t *priv,
36 struct uf_thread *thread, int (*func)(void *))
37{
38 if (thread->thread_task != NULL) {
39 unifi_error(priv, "%s thread already started\n", thread->name);
40 return 0;
41 }
42
43 /* Start the kernel thread that handles all h/w accesses. */
44 thread->thread_task = kthread_run(func, priv, "%s", thread->name);
45 if (IS_ERR(thread->thread_task))
46 return PTR_ERR(thread->thread_task);
47
48 /* Module parameter overides the thread priority */
49 if (bh_priority != -1) {
50 if (bh_priority >= 0 && bh_priority <= MAX_RT_PRIO) {
51 struct sched_param param;
52 priv->bh_thread.prio = bh_priority;
53 unifi_trace(priv, UDBG1,
54 "%s thread (RT) priority = %d\n",
55 thread->name, bh_priority);
56 param.sched_priority = bh_priority;
57 sched_setscheduler(thread->thread_task,
58 SCHED_FIFO, &param);
59 } else if (bh_priority > MAX_RT_PRIO &&
60 bh_priority <= MAX_PRIO) {
61 priv->bh_thread.prio = bh_priority;
62 unifi_trace(priv, UDBG1, "%s thread priority = %d\n",
63 thread->name,
64 PRIO_TO_NICE(bh_priority));
65 set_user_nice(thread->thread_task,
66 PRIO_TO_NICE(bh_priority));
67 } else {
68 priv->bh_thread.prio = DEFAULT_PRIO;
69 unifi_warning(priv,
70 "%s thread unsupported (%d) priority\n",
71 thread->name, bh_priority);
72 }
73 } else
74 priv->bh_thread.prio = DEFAULT_PRIO;
75 unifi_trace(priv, UDBG2, "Started %s thread\n", thread->name);
76
77 return 0;
78} /* uf_start_thread() */
79
80
81/*
82 * ---------------------------------------------------------------------------
83 * uf_stop_thread
84 *
85 * Helper function to stop a thread.
86 *
87 * Arguments:
88 * priv Pointer to OS driver structure for the device.
89 * thread Pointer to the thread object
90 *
91 * Returns:
92 *
93 * ---------------------------------------------------------------------------
94 */
95void uf_stop_thread(unifi_priv_t *priv, struct uf_thread *thread)
96{
97 if (!thread->thread_task) {
98 unifi_notice(priv, "%s thread is already stopped\n",
99 thread->name);
100 return;
101 }
102
103 unifi_trace(priv, UDBG2, "Stopping %s thread\n", thread->name);
104
105 kthread_stop(thread->thread_task);
106 thread->thread_task = NULL;
107
108} /* uf_stop_thread() */
109
110
111
112/*
113 * ---------------------------------------------------------------------------
114 * uf_wait_for_thread_to_stop
115 *
116 * Helper function to wait until a thread is stopped.
117 *
118 * Arguments:
119 * priv Pointer to OS driver structure for the device.
120 *
121 * Returns:
122 *
123 * ---------------------------------------------------------------------------
124 */
125void
126uf_wait_for_thread_to_stop(unifi_priv_t *priv, struct uf_thread *thread)
127{
128 /*
129 * kthread_stop() cannot handle the thread exiting while
130 * kthread_should_stop() is false, so sleep until kthread_stop()
131 * wakes us up
132 */
133 unifi_trace(priv, UDBG2, "%s waiting for the stop signal.\n",
134 thread->name);
135 set_current_state(TASK_INTERRUPTIBLE);
136 if (!kthread_should_stop()) {
137 unifi_trace(priv, UDBG2, "%s schedule....\n", thread->name);
138 schedule();
139 }
140
141 thread->thread_task = NULL;
142 unifi_trace(priv, UDBG2, "%s exiting....\n", thread->name);
143} /* uf_wait_for_thread_to_stop() */
144
145
146/*
147 * ---------------------------------------------------------------------------
148 * handle_bh_error
149 *
150 * This function reports an error returned from the HIP core bottom-half.
151 * Normally, implemented during the porting exercise, passing the error
152 * to the SME using unifi_sys_wifi_off_ind().
153 * The SME will try to reset the device and go through
154 * the initialisation of the UniFi.
155 *
156 * Arguments:
157 * priv Pointer to OS driver structure for the device.
158 *
159 * Returns:
160 * None.
161 * ---------------------------------------------------------------------------
162 */
163static void
164handle_bh_error(unifi_priv_t *priv)
165{
166 netInterface_priv_t *interfacePriv;
167 u8 conf_param = CONFIG_IND_ERROR;
168 u8 interfaceTag;
169
170
171 /* Block unifi_run_bh() until the error has been handled. */
172 priv->bh_thread.block_thread = 1;
173
174 /* Consider UniFi to be uninitialised */
175 priv->init_progress = UNIFI_INIT_NONE;
176
177 /* Stop the network traffic */
178 for (interfaceTag = 0;
179 interfaceTag < CSR_WIFI_NUM_INTERFACES; interfaceTag++) {
180 interfacePriv = priv->interfacePriv[interfaceTag];
181 if (interfacePriv->netdev_registered)
182 netif_carrier_off(priv->netdev[interfaceTag]);
183 }
184
185#ifdef CSR_NATIVE_LINUX
186 /* Force any client waiting on an mlme_wait_for_reply() to abort. */
187 uf_abort_mlme(priv);
188
189 /* Cancel any pending workqueue tasks */
190 flush_workqueue(priv->unifi_workqueue);
191
192#endif /* CSR_NATIVE_LINUX */
193
194 unifi_error(priv,
195 "handle_bh_error: fatal error is reported to the SME.\n");
196 /* Notify the clients (SME or unifi_manager) for the error. */
197 ul_log_config_ind(priv, &conf_param, sizeof(u8));
198
199} /* handle_bh_error() */
200
201
202
203/*
204 * ---------------------------------------------------------------------------
205 * bh_thread_function
206 *
207 * All hardware access happens in this thread.
208 * This means there is no need for locks on the hardware and we don't need
209 * to worry about reentrancy with the SDIO library.
210 * Provides and example implementation on how to call unifi_bh(), which
211 * is part of the HIP core API.
212 *
213 * It processes the events generated by unifi_run_bh() to serialise calls
214 * to unifi_bh(). It also demonstrates how the timeout parameter passed in
215 * and returned from unifi_bh() needs to be handled.
216 *
217 * Arguments:
218 * arg Pointer to OS driver structure for the device.
219 *
220 * Returns:
221 * None.
222 *
223 * Notes:
224 * When the bottom half of the driver needs to process signals, events,
225 * or simply the host status (i.e sleep mode), it invokes unifi_run_bh().
226 * Since we need all SDIO transaction to be in a single thread, the
227 * unifi_run_bh() will wake up this thread to process it.
228 *
229 * ---------------------------------------------------------------------------
230 */
231static int bh_thread_function(void *arg)
232{
233 unifi_priv_t *priv = (unifi_priv_t *)arg;
234 CsrResult csrResult;
235 long ret;
236 u32 timeout, t;
237 struct uf_thread *this_thread;
238
239 unifi_trace(priv, UDBG2, "bh_thread_function starting\n");
240
241 this_thread = &priv->bh_thread;
242
243 t = timeout = 0;
244 while (!kthread_should_stop()) {
245 /*
246 * wait until an error occurs,
247 * or we need to process something.
248 */
249 unifi_trace(priv, UDBG3, "bh_thread goes to sleep.\n");
250
251 if (timeout > 0) {
252 /* Convert t in ms to jiffies */
253 t = msecs_to_jiffies(timeout);
254 ret = wait_event_interruptible_timeout(
255 this_thread->wakeup_q,
256 (this_thread->wakeup_flag && !this_thread->block_thread) ||
257 kthread_should_stop(),
258 t);
259 timeout = (ret > 0) ? jiffies_to_msecs(ret) : 0;
260 } else {
261 ret = wait_event_interruptible(this_thread->wakeup_q,
262 (this_thread->wakeup_flag && !this_thread->block_thread) ||
263 kthread_should_stop());
264 }
265
266 if (kthread_should_stop()) {
267 unifi_trace(priv, UDBG2,
268 "bh_thread: signalled to exit\n");
269 break;
270 }
271
272 if (ret < 0) {
273 unifi_notice(priv,
274 "bh_thread: wait_event returned %d, thread will exit\n",
275 ret);
276 uf_wait_for_thread_to_stop(priv, this_thread);
277 break;
278 }
279
280 this_thread->wakeup_flag = 0;
281
282 unifi_trace(priv, UDBG3, "bh_thread calls unifi_bh().\n");
283
284 CsrSdioClaim(priv->sdio);
285 csrResult = unifi_bh(priv->card, &timeout);
286 if (csrResult != CSR_RESULT_SUCCESS) {
287 if (csrResult == CSR_WIFI_HIP_RESULT_NO_DEVICE) {
288 CsrSdioRelease(priv->sdio);
289 uf_wait_for_thread_to_stop(priv, this_thread);
290 break;
291 }
292 /* Errors must be delivered to the error task */
293 handle_bh_error(priv);
294 }
295 CsrSdioRelease(priv->sdio);
296 }
297
298 /*
299 * I would normally try to call csr_sdio_remove_irq() here to make sure
300 * that we do not get any interrupts while this thread is not running.
301 * However, the MMC/SDIO driver tries to kill its' interrupt thread.
302 * The kernel threads implementation does not allow to kill threads
303 * from a signalled to stop thread.
304 * So, instead call csr_sdio_linux_remove_irq() always after calling
305 * uf_stop_thread() to kill this thread.
306 */
307
308 unifi_trace(priv, UDBG2, "bh_thread exiting....\n");
309 return 0;
310} /* bh_thread_function() */
311
312
313/*
314 * ---------------------------------------------------------------------------
315 * uf_init_bh
316 *
317 * Helper function to start the bottom half of the driver.
318 * All we need to do here is start the I/O bh thread.
319 *
320 * Arguments:
321 * priv Pointer to OS driver structure for the device.
322 *
323 * Returns:
324 * 0 on success or else a Linux error code.
325 * ---------------------------------------------------------------------------
326 */
327int
328uf_init_bh(unifi_priv_t *priv)
329{
330 int r;
331
332 /* Enable mlme interface. */
333 priv->io_aborted = 0;
334
335
336 /* Start the BH thread */
337 r = uf_start_thread(priv, &priv->bh_thread, bh_thread_function);
338 if (r) {
339 unifi_error(priv,
340 "uf_init_bh: failed to start the BH thread.\n");
341 return r;
342 }
343
344 /* Allow interrupts */
345 r = csr_sdio_linux_install_irq(priv->sdio);
346 if (r) {
347 unifi_error(priv,
348 "uf_init_bh: failed to install the IRQ.\n");
349
350 uf_stop_thread(priv, &priv->bh_thread);
351 }
352
353 return r;
354} /* uf_init_bh() */
355
356
357/*
358 * ---------------------------------------------------------------------------
359 * unifi_run_bh
360 *
361 * Part of the HIP core lib API, implemented in the porting exercise.
362 * The bottom half of the driver calls this function when
363 * it wants to process anything that requires access to unifi.
364 * We need to call unifi_bh() which in this implementation is done
365 * by waking up the I/O thread.
366 *
367 * Arguments:
368 * ospriv Pointer to OS driver structure for the device.
369 *
370 * Returns:
371 * 0 on success or else a Linux error code.
372 *
373 * Notes:
374 * ---------------------------------------------------------------------------
375 */
376CsrResult unifi_run_bh(void *ospriv)
377{
378 unifi_priv_t *priv = ospriv;
379
380 /*
381 * If an error has occurred, we discard silently all messages from the bh
382 * until the error has been processed and the unifi has been
383 * reinitialised.
384 */
385 if (priv->bh_thread.block_thread == 1) {
386 unifi_trace(priv, UDBG3, "unifi_run_bh: discard message.\n");
387 /*
388 * Do not try to acknowledge a pending interrupt here.
389 * This function is called by unifi_send_signal()
390 * which in turn can be running in an atomic or 'disabled irq'
391 * level if a signal is sent from a workqueue task
392 * (i.e multicass addresses set). We can not hold the SDIO lock
393 * because it might sleep.
394 */
395 return CSR_RESULT_FAILURE;
396 }
397
398 priv->bh_thread.wakeup_flag = 1;
399 /* wake up I/O thread */
400 wake_up_interruptible(&priv->bh_thread.wakeup_q);
401
402 return CSR_RESULT_SUCCESS;
403} /* unifi_run_bh() */
404
diff --git a/drivers/staging/csr/csr_framework_ext.c b/drivers/staging/csr/csr_framework_ext.c
deleted file mode 100644
index 98122bce1427..000000000000
--- a/drivers/staging/csr/csr_framework_ext.c
+++ /dev/null
@@ -1,40 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2010
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11#include <linux/kernel.h>
12#include <linux/kthread.h>
13#include <linux/module.h>
14#include <linux/freezer.h>
15#include <linux/semaphore.h>
16#include <linux/slab.h>
17#include <linux/bitops.h>
18
19#include "csr_framework_ext.h"
20
21/*----------------------------------------------------------------------------*
22 * NAME
23 * CsrThreadSleep
24 *
25 * DESCRIPTION
26 * Sleep for a given period.
27 *
28 * RETURNS
29 * void
30 *
31 *----------------------------------------------------------------------------*/
32void CsrThreadSleep(u16 sleepTimeInMs)
33{
34 unsigned long t;
35
36 /* Convert t in ms to jiffies and round up */
37 t = ((sleepTimeInMs * HZ) + 999) / 1000;
38 schedule_timeout_uninterruptible(t);
39}
40EXPORT_SYMBOL_GPL(CsrThreadSleep);
diff --git a/drivers/staging/csr/csr_framework_ext.h b/drivers/staging/csr/csr_framework_ext.h
deleted file mode 100644
index 6d26ac6173b0..000000000000
--- a/drivers/staging/csr/csr_framework_ext.h
+++ /dev/null
@@ -1,35 +0,0 @@
1#ifndef CSR_FRAMEWORK_EXT_H__
2#define CSR_FRAMEWORK_EXT_H__
3/*****************************************************************************
4
5 (c) Cambridge Silicon Radio Limited 2010
6 All rights reserved and confidential information of CSR
7
8 Refer to LICENSE.txt included with this source for details
9 on the license terms.
10
11*****************************************************************************/
12
13#include "csr_result.h"
14#include "csr_framework_ext_types.h"
15
16/* Result codes */
17#define CSR_FE_RESULT_NO_MORE_EVENTS ((CsrResult) 0x0001)
18#define CSR_FE_RESULT_INVALID_POINTER ((CsrResult) 0x0002)
19#define CSR_FE_RESULT_INVALID_HANDLE ((CsrResult) 0x0003)
20#define CSR_FE_RESULT_NO_MORE_MUTEXES ((CsrResult) 0x0004)
21#define CSR_FE_RESULT_TIMEOUT ((CsrResult) 0x0005)
22#define CSR_FE_RESULT_NO_MORE_THREADS ((CsrResult) 0x0006)
23
24/* Thread priorities */
25#define CSR_THREAD_PRIORITY_HIGHEST ((u16) 0)
26#define CSR_THREAD_PRIORITY_HIGH ((u16) 1)
27#define CSR_THREAD_PRIORITY_NORMAL ((u16) 2)
28#define CSR_THREAD_PRIORITY_LOW ((u16) 3)
29#define CSR_THREAD_PRIORITY_LOWEST ((u16) 4)
30
31#define CSR_EVENT_WAIT_INFINITE ((u16) 0xFFFF)
32
33void CsrThreadSleep(u16 sleepTimeInMs);
34
35#endif
diff --git a/drivers/staging/csr/csr_framework_ext_types.h b/drivers/staging/csr/csr_framework_ext_types.h
deleted file mode 100644
index 575598cf69b2..000000000000
--- a/drivers/staging/csr/csr_framework_ext_types.h
+++ /dev/null
@@ -1,30 +0,0 @@
1#ifndef CSR_FRAMEWORK_EXT_TYPES_H__
2#define CSR_FRAMEWORK_EXT_TYPES_H__
3/*****************************************************************************
4
5 (c) Cambridge Silicon Radio Limited 2010
6 All rights reserved and confidential information of CSR
7
8 Refer to LICENSE.txt included with this source for details
9 on the license terms.
10
11*****************************************************************************/
12
13#ifdef __KERNEL__
14#include <linux/kthread.h>
15#include <linux/semaphore.h>
16#else
17#include <pthread.h>
18#endif
19
20#ifdef __KERNEL__
21
22typedef struct semaphore CsrMutexHandle;
23
24#else /* __KERNEL __ */
25
26typedef pthread_mutex_t CsrMutexHandle;
27
28#endif /* __KERNEL__ */
29
30#endif
diff --git a/drivers/staging/csr/csr_log.h b/drivers/staging/csr/csr_log.h
deleted file mode 100644
index 982941043ddc..000000000000
--- a/drivers/staging/csr/csr_log.h
+++ /dev/null
@@ -1,223 +0,0 @@
1#ifndef CSR_LOG_H__
2#define CSR_LOG_H__
3/*****************************************************************************
4
5 (c) Cambridge Silicon Radio Limited 2010
6 All rights reserved and confidential information of CSR
7
8 Refer to LICENSE.txt included with this source for details
9 on the license terms.
10
11*****************************************************************************/
12
13#include "csr_sched.h"
14#include "csr_prim_defs.h"
15#include "csr_msgconv.h"
16
17/*
18 * Log filtering
19 */
20
21/*----------------------------------------------------*/
22/* Filtering on environment specific log levels */
23/*----------------------------------------------------*/
24typedef u32 CsrLogLevelEnvironment;
25#define CSR_LOG_LEVEL_ENVIRONMENT_OFF ((CsrLogLevelEnvironment) 0x00000000) /* No environment data/events are logged */
26#define CSR_LOG_LEVEL_ENVIRONMENT_BCI_ACL ((CsrLogLevelEnvironment) 0x00000001) /* BlueCore Channel Interface HCI Acl data are logged */
27#define CSR_LOG_LEVEL_ENVIRONMENT_BCI_HCI ((CsrLogLevelEnvironment) 0x00000002) /* BlueCore Channel Interface HCI Cmd/Evt data are logged */
28#define CSR_LOG_LEVEL_ENVIRONMENT_BCI_SCO ((CsrLogLevelEnvironment) 0x00000004) /* BlueCore Channel Interface HCI Sco data are logged */
29#define CSR_LOG_LEVEL_ENVIRONMENT_BCI_VENDOR ((CsrLogLevelEnvironment) 0x00000008) /* BlueCore Channel Interface HCI Vendor specific data are logged (This includes BCCMD, HQ, VM etc) */
30#define CSR_LOG_LEVEL_ENVIRONMENT_TRANSPORTS ((CsrLogLevelEnvironment) 0x00000010) /* Transport protocol data is logged (This includes transport protocols like BCSP, H4 etc.) */
31#define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_REG ((CsrLogLevelEnvironment) 0x00000020) /* Background Interrupt registration events are logged */
32#define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_UNREG ((CsrLogLevelEnvironment) 0x00000040) /* Background Interrupt unregistration events are logged */
33#define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_SET ((CsrLogLevelEnvironment) 0x00000080) /* Background Interrupt set events are logged */
34#define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_START ((CsrLogLevelEnvironment) 0x00000100) /* Background Interrupt start events are logged */
35#define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_DONE ((CsrLogLevelEnvironment) 0x00000200) /* Background Interrupt done events are logged */
36#define CSR_LOG_LEVEL_ENVIRONMENT_PROTO ((CsrLogLevelEnvironment) 0x00000400) /* Transport protocol events are logged */
37#define CSR_LOG_LEVEL_ENVIRONMENT_PROTO_LOC ((CsrLogLevelEnvironment) 0x00000800) /* The Location where the transport protocol event occurred are logged NB: This is a supplement to CSR_LOG_LEVEL_ENVIRONMENT_PROTO, it has no effect without it */
38/* The bit masks between here are reserved for future usage */
39#define CSR_LOG_LEVEL_ENVIRONMENT_ALL ((CsrLogLevelEnvironment) 0xFFFFFFFF) /* All possible environment data/events are logged WARNING: By using this define the application also accepts future possible environment data/events in the logs */
40
41/*----------------------------------------------------*/
42/* Filtering on task specific log levels */
43/*----------------------------------------------------*/
44typedef u32 CsrLogLevelTask;
45#define CSR_LOG_LEVEL_TASK_OFF ((CsrLogLevelTask) 0x00000000) /* No events are logged for this task */
46#define CSR_LOG_LEVEL_TASK_TEXT ((CsrLogLevelTask) 0x00000001) /* Text strings printed by a task are logged NB: This bit does not affect the CSR_LOG_TEXT_LEVEL interface. This has to be configured separately */
47#define CSR_LOG_LEVEL_TASK_TEXT_LOC ((CsrLogLevelTask) 0x00000002) /* The locaction where the text string call occurred are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_TEXT, it has no effect without it */
48#define CSR_LOG_LEVEL_TASK_STATE ((CsrLogLevelTask) 0x00000004) /* FSM state transitions in a task are logged */
49#define CSR_LOG_LEVEL_TASK_STATE_NAME ((CsrLogLevelTask) 0x00000008) /* The name of each state in a FSM state transition are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_STATE, it has no effect without it */
50#define CSR_LOG_LEVEL_TASK_STATE_LOC ((CsrLogLevelTask) 0x00000010) /* The location where the FSM state transition occurred are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_STATE, it has no effect without it */
51#define CSR_LOG_LEVEL_TASK_TASK_SWITCH ((CsrLogLevelTask) 0x00000020) /* Activation and deactiation of a task are logged */
52#define CSR_LOG_LEVEL_TASK_MESSAGE_PUT ((CsrLogLevelTask) 0x00000080) /* Message put operations are logged */
53#define CSR_LOG_LEVEL_TASK_MESSAGE_PUT_LOC ((CsrLogLevelTask) 0x00000100) /* The location where a message was sent are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_MESSAGE_PUT, it has no effect without it */
54#define CSR_LOG_LEVEL_TASK_MESSAGE_GET ((CsrLogLevelTask) 0x00000200) /* Message get operations are logged */
55#define CSR_LOG_LEVEL_TASK_MESSAGE_QUEUE_PUSH ((CsrLogLevelTask) 0x00000400) /* Message push operations are logged */
56#define CSR_LOG_LEVEL_TASK_MESSAGE_QUEUE_POP ((CsrLogLevelTask) 0x00000800) /* Message pop operations are logged */
57#define CSR_LOG_LEVEL_TASK_PRIM_ONLY_TYPE ((CsrLogLevelTask) 0x00001000) /* Only the type of primitives in messages are logged. By default the entire primitive is serialized and logged */
58#define CSR_LOG_LEVEL_TASK_PRIM_APPLY_LIMIT ((CsrLogLevelTask) 0x00002000) /* An upper limit (defined by CSR_LOG_PRIM_SIZE_UPPER_LIMIT) is applied to how much of a primitive in a message are logged. NB: This limit is only applied if CSR_LOG_LEVEL_TASK_PRIM_ONLY_TYPE is _not_ defined */
59#define CSR_LOG_LEVEL_TASK_TIMER_IN ((CsrLogLevelTask) 0x00004000) /* TimedEventIn events are logged */
60#define CSR_LOG_LEVEL_TASK_TIMER_IN_LOC ((CsrLogLevelTask) 0x00008000) /* The location where a timer was started are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_TIMER_IN, it has no effect without it */
61#define CSR_LOG_LEVEL_TASK_TIMER_CANCEL ((CsrLogLevelTask) 0x00010000) /* TimedEventCancel events are logged */
62#define CSR_LOG_LEVEL_TASK_TIMER_CANCEL_LOC ((CsrLogLevelTask) 0x00020000) /* The location where a timer was cancelled are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_TIMER_CANCEL, it has no effect without it */
63#define CSR_LOG_LEVEL_TASK_TIMER_FIRE ((CsrLogLevelTask) 0x00040000) /* TimedEventFire events are logged */
64#define CSR_LOG_LEVEL_TASK_TIMER_DONE ((CsrLogLevelTask) 0x00080000) /* TimedEventDone events are logged */
65/* The bit masks between here are reserved for future usage */
66#define CSR_LOG_LEVEL_TASK_ALL ((CsrLogLevelTask) 0xFFFFFFFF & ~(CSR_LOG_LEVEL_TASK_PRIM_ONLY_TYPE | CSR_LOG_LEVEL_TASK_PRIM_APPLY_LIMIT)) /* All info possible to log for a task are logged. WARNING: By using this define the application also accepts future possible task data/events in the logs */
67
68u8 CsrLogEnvironmentIsFiltered(CsrLogLevelEnvironment level);
69CsrLogLevelTask CsrLogTaskFilterGet(CsrSchedQid taskId);
70u8 CsrLogTaskIsFiltered(CsrSchedQid taskId, CsrLogLevelTask level);
71
72/*
73 * Logging stuff
74 */
75#define CSR_LOG_STRINGIFY_REAL(a) (#a)
76#define CSR_LOG_STRINGIFY(a) CSR_LOG_STRINGIFY_REAL(a)
77
78typedef struct {
79 u16 primitiveType;
80 const char *primitiveName;
81 CsrMsgConvMsgEntry *messageConv; /* Private - do not use */
82} CsrLogPrimitiveInformation;
83
84typedef struct {
85 const char *techVer;
86 u32 primitiveInfoCount;
87 CsrLogPrimitiveInformation *primitiveInfo;
88} CsrLogTechInformation;
89
90/*---------------------------------*/
91/* Tech logging */
92/*---------------------------------*/
93typedef u8 bitmask8_t;
94typedef u16 bitmask16_t;
95typedef u32 bitmask32_t;
96
97#ifdef CSR_LOG_ENABLE
98#ifdef CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER
99/* DEPRECATED - replaced by csr_log_text.h */
100#define CSR_LOG_TEXT(text) \
101 do { \
102 if (!CsrLogTaskIsFiltered(CsrSchedTaskQueueGet(), CSR_LOG_LEVEL_TASK_TEXT)) { \
103 CsrLogTaskText(text, __LINE__, __FILE__); \
104 } \
105 } while (0)
106#else
107/* DEPRECATED - replaced by csr_log_text.h */
108#define CSR_LOG_TEXT(text) \
109 do { \
110 if (!CsrLogTaskIsFiltered(CsrSchedTaskQueueGet(), CSR_LOG_LEVEL_TASK_TEXT)) { \
111 CsrLogTaskText(text, 0, NULL); \
112 } \
113 } while (0)
114#endif
115#else
116#define CSR_LOG_TEXT(text)
117#endif
118
119/* DEPRECATED - replaced by csr_log_text.h */
120void CsrLogTaskText(const char *text,
121 u32 line,
122 const char *file);
123
124#define CSR_LOG_STATE_TRANSITION_MASK_FSM_NAME (0x001)
125#define CSR_LOG_STATE_TRANSITION_MASK_NEXT_STATE (0x002)
126#define CSR_LOG_STATE_TRANSITION_MASK_NEXT_STATE_STR (0x004)
127#define CSR_LOG_STATE_TRANSITION_MASK_PREV_STATE (0x008)
128#define CSR_LOG_STATE_TRANSITION_MASK_PREV_STATE_STR (0x010)
129#define CSR_LOG_STATE_TRANSITION_MASK_EVENT (0x020)
130#define CSR_LOG_STATE_TRANSITION_MASK_EVENT_STR (0x040)
131
132/* DEPRECATED - replaced by csr_log_text.h */
133void CsrLogStateTransition(bitmask16_t mask,
134 u32 identifier,
135 const char *fsm_name,
136 u32 prev_state,
137 const char *prev_state_str,
138 u32 in_event,
139 const char *in_event_str,
140 u32 next_state,
141 const char *next_state_str,
142 u32 line,
143 const char *file);
144
145/*---------------------------------*/
146/* BSP logging */
147/*---------------------------------*/
148void CsrLogSchedInit(u8 thread_id);
149void CsrLogSchedDeinit(u8 thread_id);
150
151void CsrLogSchedStart(u8 thread_id);
152void CsrLogSchedStop(u8 thread_id);
153
154void CsrLogInitTask(u8 thread_id, CsrSchedQid tskid, const char *tskName);
155void CsrLogDeinitTask(u16 task_id);
156
157void CsrLogActivate(CsrSchedQid tskid);
158void CsrLogDeactivate(CsrSchedQid tskid);
159
160#define SYNERGY_SERIALIZER_TYPE_DUMP (0x000)
161#define SYNERGY_SERIALIZER_TYPE_SER (0x001)
162
163void CsrLogMessagePut(u32 line,
164 const char *file,
165 CsrSchedQid src_task_id,
166 CsrSchedQid dst_taskid,
167 CsrSchedMsgId msg_id,
168 u16 prim_type,
169 const void *msg);
170
171void CsrLogMessageGet(CsrSchedQid src_task_id,
172 CsrSchedQid dst_taskid,
173 u8 get_res,
174 CsrSchedMsgId msg_id,
175 u16 prim_type,
176 const void *msg);
177
178void CsrLogTimedEventIn(u32 line,
179 const char *file,
180 CsrSchedQid task_id,
181 CsrSchedTid tid,
182 u32 requested_delay,
183 u16 fniarg,
184 const void *fnvarg);
185
186void CsrLogTimedEventFire(CsrSchedQid task_id,
187 CsrSchedTid tid);
188
189void CsrLogTimedEventDone(CsrSchedQid task_id,
190 CsrSchedTid tid);
191
192void CsrLogTimedEventCancel(u32 line,
193 const char *file,
194 CsrSchedQid task_id,
195 CsrSchedTid tid,
196 u8 cancel_res);
197
198void CsrLogBgintRegister(u8 thread_id,
199 CsrSchedBgint irq,
200 const char *callback,
201 const void *ptr);
202void CsrLogBgintUnregister(CsrSchedBgint irq);
203void CsrLogBgintSet(CsrSchedBgint irq);
204void CsrLogBgintServiceStart(CsrSchedBgint irq);
205void CsrLogBgintServiceDone(CsrSchedBgint irq);
206
207void CsrLogExceptionStateEvent(u16 prim_type,
208 CsrPrim msg_type,
209 u16 state,
210 u32 line,
211 const char *file);
212void CsrLogExceptionGeneral(u16 prim_type,
213 u16 state,
214 const char *text,
215 u32 line,
216 const char *file);
217void CsrLogExceptionWarning(u16 prim_type,
218 u16 state,
219 const char *text,
220 u32 line,
221 const char *file);
222
223#endif
diff --git a/drivers/staging/csr/csr_log_configure.h b/drivers/staging/csr/csr_log_configure.h
deleted file mode 100644
index 283647cf9702..000000000000
--- a/drivers/staging/csr/csr_log_configure.h
+++ /dev/null
@@ -1,39 +0,0 @@
1#ifndef CSR_LOG_CONFIGURE_H__
2#define CSR_LOG_CONFIGURE_H__
3/*****************************************************************************
4
5 (c) Cambridge Silicon Radio Limited 2010
6 All rights reserved and confidential information of CSR
7
8 Refer to LICENSE.txt included with this source for details
9 on the license terms.
10
11 *****************************************************************************/
12
13#include "csr_log.h"
14
15/*--------------------------------------------*/
16/* Filtering on log text warning levels */
17/*--------------------------------------------*/
18typedef u32 CsrLogLevelText;
19#define CSR_LOG_LEVEL_TEXT_OFF ((CsrLogLevelText) 0x0000)
20
21#define CSR_LOG_LEVEL_TEXT_CRITICAL ((CsrLogLevelText) 0x0001)
22#define CSR_LOG_LEVEL_TEXT_ERROR ((CsrLogLevelText) 0x0002)
23#define CSR_LOG_LEVEL_TEXT_WARNING ((CsrLogLevelText) 0x0004)
24#define CSR_LOG_LEVEL_TEXT_INFO ((CsrLogLevelText) 0x0008)
25#define CSR_LOG_LEVEL_TEXT_DEBUG ((CsrLogLevelText) 0x0010)
26
27#define CSR_LOG_LEVEL_TEXT_ALL ((CsrLogLevelText) 0xFFFF)
28
29/* The log text interface is used by both scheduler tasks and components outside the scheduler context.
30 * Therefore a CsrLogTextTaskId is introduced. It is effectively considered as two u16's. The lower
31 * 16 bits corresponds one2one with the scheduler queueId's (CsrSchedQid) and as such these bits can not be used
32 * by components outside scheduler tasks. The upper 16 bits are allocated for use of components outside the
33 * scheduler like drivers etc. Components in this range is defined independently by each technology. To avoid
34 * clashes the technologies are only allowed to assign values within the same restrictive range as allies to
35 * primitive identifiers. eg. for the framework components outside the scheduler is only allowed to assign
36 * taskId's in the range 0x0600xxxx to 0x06FFxxxx. And so on for other technologies. */
37typedef u32 CsrLogTextTaskId;
38
39#endif
diff --git a/drivers/staging/csr/csr_log_text.h b/drivers/staging/csr/csr_log_text.h
deleted file mode 100644
index cfcf64aa6225..000000000000
--- a/drivers/staging/csr/csr_log_text.h
+++ /dev/null
@@ -1,124 +0,0 @@
1#ifndef CSR_LOG_TEXT_H__
2#define CSR_LOG_TEXT_H__
3/*****************************************************************************
4
5 (c) Cambridge Silicon Radio Limited 2010
6 All rights reserved and confidential information of CSR
7
8 Refer to LICENSE.txt included with this source for details
9 on the license terms.
10
11*****************************************************************************/
12
13#include "csr_log_configure.h"
14
15typedef struct CsrLogSubOrigin
16{
17 u16 subOriginNumber; /* Id of the given SubOrigin */
18 const char *subOriginName; /* Prefix Text for this SubOrigin */
19} CsrLogSubOrigin;
20
21/* Register a task which is going to use the CSR_LOG_TEXT_XXX interface */
22#ifdef CSR_LOG_ENABLE
23void CsrLogTextRegister(CsrLogTextTaskId taskId, const char *taskName, u16 subOriginsLength, const CsrLogSubOrigin *subOrigins);
24#else
25#define CsrLogTextRegister(taskId, taskName, subOriginsLength, subOrigins)
26#endif
27
28/* CRITICAL: Conditions that are threatening to the integrity/stability of the
29 system as a whole. */
30#if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_CRITICAL_DISABLE)
31void CsrLogTextCritical(CsrLogTextTaskId taskId, u16 subOrigin, const char *formatString, ...);
32void CsrLogTextBufferCritical(CsrLogTextTaskId taskId, u16 subOrigin, size_t bufferLength, const void *buffer, const char *formatString, ...);
33#define CSR_LOG_TEXT_CRITICAL(taskId_subOrigin_formatString_varargs) CsrLogTextCritical taskId_subOrigin_formatString_varargs
34#define CSR_LOG_TEXT_CONDITIONAL_CRITICAL(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_CRITICAL(logtextargs);}}
35#define CSR_LOG_TEXT_BUFFER_CRITICAL(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferCritical taskId_subOrigin_length_buffer_formatString_varargs
36#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_CRITICAL(condition, logtextbufferargs) {if (condition) {CSR_LOG_TEXT_BUFFER_CRITICAL(logtextbufferargs);}}
37#else
38#define CSR_LOG_TEXT_CRITICAL(taskId_subOrigin_formatString_varargs)
39#define CSR_LOG_TEXT_CONDITIONAL_CRITICAL(condition, logtextargs)
40#define CSR_LOG_TEXT_BUFFER_CRITICAL(taskId_subOrigin_length_buffer_formatString_varargs)
41#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_CRITICAL(condition, logtextbufferargs)
42#endif
43
44/* ERROR: Malfunction of a component rendering it unable to operate correctly,
45 causing lack of functionality but not loss of system integrity/stability. */
46#if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_ERROR_DISABLE)
47void CsrLogTextError(CsrLogTextTaskId taskId, u16 subOrigin, const char *formatString, ...);
48void CsrLogTextBufferError(CsrLogTextTaskId taskId, u16 subOrigin, size_t bufferLength, const void *buffer, const char *formatString, ...);
49#define CSR_LOG_TEXT_ERROR(taskId_subOrigin_formatString_varargs) CsrLogTextError taskId_subOrigin_formatString_varargs
50#define CSR_LOG_TEXT_CONDITIONAL_ERROR(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_ERROR(logtextargs);}}
51#define CSR_LOG_TEXT_BUFFER_ERROR(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferError taskId_subOrigin_length_buffer_formatString_varargs
52#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_ERROR(condition, logtextbufferargs) {if (condition) {CSR_LOG_TEXT_BUFFER_ERROR(logtextbufferargs);}}
53#else
54#define CSR_LOG_TEXT_ERROR(taskId_subOrigin_formatString_varargs)
55#define CSR_LOG_TEXT_CONDITIONAL_ERROR(condition, logtextargs)
56#define CSR_LOG_TEXT_BUFFER_ERROR(taskId_subOrigin_length_buffer_formatString_varargs)
57#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_ERROR(condition, logtextbufferargs)
58#endif
59
60/* WARNING: Conditions that are unexpected and indicative of possible problems
61 or violations of specifications, where the result of such deviations does not
62 lead to malfunction of the component. */
63#if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_WARNING_DISABLE)
64void CsrLogTextWarning(CsrLogTextTaskId taskId, u16 subOrigin, const char *formatString, ...);
65void CsrLogTextBufferWarning(CsrLogTextTaskId taskId, u16 subOrigin, size_t bufferLength, const void *buffer, const char *formatString, ...);
66#define CSR_LOG_TEXT_WARNING(taskId_subOrigin_formatString_varargs) CsrLogTextWarning taskId_subOrigin_formatString_varargs
67#define CSR_LOG_TEXT_CONDITIONAL_WARNING(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_WARNING(logtextargs);}}
68#define CSR_LOG_TEXT_BUFFER_WARNING(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferWarning taskId_subOrigin_length_buffer_formatString_varargs
69#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_WARNING(condition, logtextbufferargs) {if (condition) {CSR_LOG_TEXT_BUFFER_WARNING(logtextbufferargs);}}
70#else
71#define CSR_LOG_TEXT_WARNING(taskId_subOrigin_formatString_varargs)
72#define CSR_LOG_TEXT_CONDITIONAL_WARNING(condition, logtextargs)
73#define CSR_LOG_TEXT_BUFFER_WARNING(taskId_subOrigin_length_buffer_formatString_varargs)
74#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_WARNING(condition, logtextbufferargs)
75#endif
76
77/* INFO: Important events that may aid in determining the conditions under which
78 the more severe conditions are encountered. */
79#if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_INFO_DISABLE)
80void CsrLogTextInfo(CsrLogTextTaskId taskId, u16 subOrigin, const char *formatString, ...);
81void CsrLogTextBufferInfo(CsrLogTextTaskId taskId, u16 subOrigin, size_t bufferLength, const void *buffer, const char *formatString, ...);
82#define CSR_LOG_TEXT_INFO(taskId_subOrigin_formatString_varargs) CsrLogTextInfo taskId_subOrigin_formatString_varargs
83#define CSR_LOG_TEXT_CONDITIONAL_INFO(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_INFO(logtextargs);}}
84#define CSR_LOG_TEXT_BUFFER_INFO(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferInfo taskId_subOrigin_length_buffer_formatString_varargs
85#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_INFO(condition, logtextbufferargs) {if (condition) {CSR_LOG_TEXT_BUFFER_INFO(logtextbufferargs);}}
86#else
87#define CSR_LOG_TEXT_INFO(taskId_subOrigin_formatString_varargs)
88#define CSR_LOG_TEXT_CONDITIONAL_INFO(condition, logtextargs)
89#define CSR_LOG_TEXT_BUFFER_INFO(taskId_subOrigin_length_buffer_formatString_varargs)
90#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_INFO(condition, logtextbufferargs)
91#endif
92
93/* DEBUG: Similar to INFO, but dedicated to events that occur more frequently. */
94#if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_DEBUG_DISABLE)
95void CsrLogTextDebug(CsrLogTextTaskId taskId, u16 subOrigin, const char *formatString, ...);
96void CsrLogTextBufferDebug(CsrLogTextTaskId taskId, u16 subOrigin, size_t bufferLength, const void *buffer, const char *formatString, ...);
97#define CSR_LOG_TEXT_DEBUG(taskId_subOrigin_formatString_varargs) CsrLogTextDebug taskId_subOrigin_formatString_varargs
98#define CSR_LOG_TEXT_CONDITIONAL_DEBUG(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_DEBUG(logtextargs);}}
99#define CSR_LOG_TEXT_BUFFER_DEBUG(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferDebug taskId_subOrigin_length_buffer_formatString_varargs
100#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_DEBUG(condition, logtextbufferargs) {if (condition) {CSR_LOG_TEXT_BUFFER_DEBUG(logtextbufferargs);}}
101#else
102#define CSR_LOG_TEXT_DEBUG(taskId_subOrigin_formatString_varargs)
103#define CSR_LOG_TEXT_CONDITIONAL_DEBUG(condition, logtextargs)
104#define CSR_LOG_TEXT_BUFFER_DEBUG(taskId_subOrigin_length_buffer_formatString_varargs)
105#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_DEBUG(condition, logtextbufferargs)
106#endif
107
108/* CSR_LOG_TEXT_ASSERT (CRITICAL) */
109#ifdef CSR_LOG_ENABLE
110#define CSR_LOG_TEXT_ASSERT(origin, suborigin, condition) \
111 {if (!(condition)) {CSR_LOG_TEXT_CRITICAL((origin, suborigin, "Assertion \"%s\" failed at %s:%u", #condition, __FILE__, __LINE__));}}
112#else
113#define CSR_LOG_TEXT_ASSERT(origin, suborigin, condition)
114#endif
115
116/* CSR_LOG_TEXT_UNHANDLED_PRIM (CRITICAL) */
117#ifdef CSR_LOG_ENABLE
118#define CSR_LOG_TEXT_UNHANDLED_PRIMITIVE(origin, suborigin, primClass, primType) \
119 CSR_LOG_TEXT_CRITICAL((origin, suborigin, "Unhandled primitive 0x%04X:0x%04X at %s:%u", primClass, primType, __FILE__, __LINE__))
120#else
121#define CSR_LOG_TEXT_UNHANDLED_PRIMITIVE(origin, suborigin, primClass, primType)
122#endif
123
124#endif
diff --git a/drivers/staging/csr/csr_macro.h b/drivers/staging/csr/csr_macro.h
deleted file mode 100644
index c47f1d91b6fa..000000000000
--- a/drivers/staging/csr/csr_macro.h
+++ /dev/null
@@ -1,39 +0,0 @@
1#ifndef CSR_MACRO_H__
2#define CSR_MACRO_H__
3/*****************************************************************************
4
5 (c) Cambridge Silicon Radio Limited 2010
6 All rights reserved and confidential information of CSR
7
8 Refer to LICENSE.txt included with this source for details
9 on the license terms.
10
11*****************************************************************************/
12
13#include <linux/types.h>
14
15#define FALSE (0)
16#define TRUE (1)
17
18/*------------------------------------------------------------------*/
19/* Endian conversion */
20/*------------------------------------------------------------------*/
21#define CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr) (((u16) ((u8 *) (ptr))[0]) | ((u16) ((u8 *) (ptr))[1]) << 8)
22#define CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr) (((u32) ((u8 *) (ptr))[0]) | ((u32) ((u8 *) (ptr))[1]) << 8 | \
23 ((u32) ((u8 *) (ptr))[2]) << 16 | ((u32) ((u8 *) (ptr))[3]) << 24)
24#define CSR_COPY_UINT16_TO_LITTLE_ENDIAN(uint, ptr) ((u8 *) (ptr))[0] = ((u8) ((uint) & 0x00FF)); \
25 ((u8 *) (ptr))[1] = ((u8) ((uint) >> 8))
26#define CSR_COPY_UINT32_TO_LITTLE_ENDIAN(uint, ptr) ((u8 *) (ptr))[0] = ((u8) ((uint) & 0x000000FF)); \
27 ((u8 *) (ptr))[1] = ((u8) (((uint) >> 8) & 0x000000FF)); \
28 ((u8 *) (ptr))[2] = ((u8) (((uint) >> 16) & 0x000000FF)); \
29 ((u8 *) (ptr))[3] = ((u8) (((uint) >> 24) & 0x000000FF))
30
31/*------------------------------------------------------------------*/
32/* Misc */
33/*------------------------------------------------------------------*/
34/* Use this macro on unused local variables that cannot be removed (such as
35 unused function parameters). This will quell warnings from certain compilers
36 and static code analysis tools like Lint and Valgrind. */
37#define CSR_UNUSED(x) ((void) (x))
38
39#endif
diff --git a/drivers/staging/csr/csr_msg_transport.h b/drivers/staging/csr/csr_msg_transport.h
deleted file mode 100644
index 8d88e7836567..000000000000
--- a/drivers/staging/csr/csr_msg_transport.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef CSR_MSG_TRANSPORT_H__
2#define CSR_MSG_TRANSPORT_H__
3/*****************************************************************************
4
5 (c) Cambridge Silicon Radio Limited 2010
6 All rights reserved and confidential information of CSR
7
8 Refer to LICENSE.txt included with this source for details
9 on the license terms.
10
11*****************************************************************************/
12
13#ifndef CsrMsgTransport
14#define CsrMsgTransport CsrSchedMessagePut
15#endif
16
17#endif /* CSR_MSG_TRANSPORT */
diff --git a/drivers/staging/csr/csr_msgconv.c b/drivers/staging/csr/csr_msgconv.c
deleted file mode 100644
index db5e845e60f5..000000000000
--- a/drivers/staging/csr/csr_msgconv.c
+++ /dev/null
@@ -1,291 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2010
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11#include <linux/module.h>
12#include <linux/types.h>
13#include <linux/slab.h>
14#include "csr_sched.h"
15#include "csr_msgconv.h"
16#include "csr_macro.h"
17
18static CsrMsgConvEntry *converter;
19
20CsrMsgConvPrimEntry *CsrMsgConvFind(u16 primType)
21{
22 CsrMsgConvPrimEntry *ptr = NULL;
23
24 if (converter)
25 {
26 ptr = converter->profile_converters;
27 while (ptr)
28 {
29 if (ptr->primType == primType)
30 {
31 break;
32 }
33 else
34 {
35 ptr = ptr->next;
36 }
37 }
38 }
39
40 return ptr;
41}
42
43static const CsrMsgConvMsgEntry *find_msg_converter(CsrMsgConvPrimEntry *ptr, u16 msgType)
44{
45 const CsrMsgConvMsgEntry *cv = ptr->conv;
46 if (ptr->lookupFunc)
47 {
48 return (const CsrMsgConvMsgEntry *) ptr->lookupFunc((CsrMsgConvMsgEntry *) cv, msgType);
49 }
50
51 while (cv)
52 {
53 if (cv->serFunc == NULL)
54 {
55 /* We've reached the end of the chain */
56 cv = NULL;
57 break;
58 }
59
60 if (cv->msgType == msgType)
61 {
62 break;
63 }
64 else
65 {
66 cv++;
67 }
68 }
69
70 return cv;
71}
72
73static void *deserialize_data(u16 primType,
74 size_t length,
75 u8 *data)
76{
77 CsrMsgConvPrimEntry *ptr;
78 u8 *ret;
79
80 ptr = CsrMsgConvFind(primType);
81
82 if (ptr)
83 {
84 const CsrMsgConvMsgEntry *cv;
85 u16 msgId = 0;
86 size_t offset = 0;
87 CsrUint16Des(&msgId, data, &offset);
88
89 cv = find_msg_converter(ptr, msgId);
90 if (cv)
91 {
92 ret = cv->deserFunc(data, length);
93 }
94 else
95 {
96 ret = NULL;
97 }
98 }
99 else
100 {
101 ret = NULL;
102 }
103
104 return ret;
105}
106
107static size_t sizeof_message(u16 primType, void *msg)
108{
109 CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType);
110 size_t ret;
111
112 if (ptr)
113 {
114 const CsrMsgConvMsgEntry *cv;
115 u16 msgId = *(u16 *) msg;
116
117 cv = find_msg_converter(ptr, msgId);
118 if (cv)
119 {
120 ret = cv->sizeofFunc(msg);
121 }
122 else
123 {
124 ret = 0;
125 }
126 }
127 else
128 {
129 ret = 0;
130 }
131
132 return ret;
133}
134
135static u8 free_message(u16 primType, u8 *data)
136{
137 CsrMsgConvPrimEntry *ptr;
138 u8 ret;
139
140 ptr = CsrMsgConvFind(primType);
141
142 if (ptr)
143 {
144 const CsrMsgConvMsgEntry *cv;
145 u16 msgId = *(u16 *) data;
146
147 cv = find_msg_converter(ptr, msgId);
148 if (cv)
149 {
150 cv->freeFunc(data);
151 ret = TRUE;
152 }
153 else
154 {
155 ret = FALSE;
156 }
157 }
158 else
159 {
160 ret = FALSE;
161 }
162
163 return ret;
164}
165
166static u8 *serialize_message(u16 primType,
167 void *msg,
168 size_t *length,
169 u8 *buffer)
170{
171 CsrMsgConvPrimEntry *ptr;
172 u8 *ret;
173
174 ptr = CsrMsgConvFind(primType);
175
176 *length = 0;
177
178 if (ptr)
179 {
180 const CsrMsgConvMsgEntry *cv;
181
182 cv = find_msg_converter(ptr, *(u16 *) msg);
183 if (cv)
184 {
185 ret = cv->serFunc(buffer, length, msg);
186 }
187 else
188 {
189 ret = NULL;
190 }
191 }
192 else
193 {
194 ret = NULL;
195 }
196
197 return ret;
198}
199
200size_t CsrMsgConvSizeof(u16 primType, void *msg)
201{
202 return sizeof_message(primType, msg);
203}
204
205u8 *CsrMsgConvSerialize(u8 *buffer, size_t maxBufferOffset, size_t *offset, u16 primType, void *msg)
206{
207 if (converter)
208 {
209 size_t serializedLength;
210 u8 *bufSerialized;
211 u8 *bufOffset = &buffer[*offset];
212 bufSerialized = converter->serialize_message(primType, msg, &serializedLength, bufOffset);
213 *offset += serializedLength;
214 return bufSerialized;
215 }
216 else
217 {
218 return NULL;
219 }
220}
221
222/* Insert profile converter at head of converter list. */
223void CsrMsgConvInsert(u16 primType, const CsrMsgConvMsgEntry *ce)
224{
225 CsrMsgConvPrimEntry *pc;
226 pc = CsrMsgConvFind(primType);
227
228 if (pc)
229 {
230 /* Already registered. Do nothing */
231 }
232 else
233 {
234 pc = kmalloc(sizeof(*pc), GFP_KERNEL);
235 pc->primType = primType;
236 pc->conv = ce;
237 pc->lookupFunc = NULL;
238 pc->next = converter->profile_converters;
239 converter->profile_converters = pc;
240 }
241}
242EXPORT_SYMBOL_GPL(CsrMsgConvInsert);
243
244CsrMsgConvMsgEntry *CsrMsgConvFindEntry(u16 primType, u16 msgType)
245{
246 CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType);
247 if (ptr)
248 {
249 return (CsrMsgConvMsgEntry *) find_msg_converter(ptr, msgType);
250 }
251 return NULL;
252}
253EXPORT_SYMBOL_GPL(CsrMsgConvFindEntry);
254
255CsrMsgConvMsgEntry *CsrMsgConvFindEntryByMsg(u16 primType, const void *msg)
256{
257 CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType);
258 if (ptr && msg)
259 {
260 u16 msgType = *((u16 *) msg);
261 return (CsrMsgConvMsgEntry *) find_msg_converter(ptr, msgType);
262 }
263 return NULL;
264}
265
266void CsrMsgConvCustomLookupRegister(u16 primType, CsrMsgCustomLookupFunc *lookupFunc)
267{
268 CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType);
269 if (ptr)
270 {
271 ptr->lookupFunc = lookupFunc;
272 }
273}
274EXPORT_SYMBOL_GPL(CsrMsgConvCustomLookupRegister);
275
276CsrMsgConvEntry *CsrMsgConvInit(void)
277{
278 if (!converter)
279 {
280 converter = kmalloc(sizeof(CsrMsgConvEntry), GFP_KERNEL);
281
282 converter->profile_converters = NULL;
283 converter->free_message = free_message;
284 converter->sizeof_message = sizeof_message;
285 converter->serialize_message = serialize_message;
286 converter->deserialize_data = deserialize_data;
287 }
288
289 return converter;
290}
291EXPORT_SYMBOL_GPL(CsrMsgConvInit);
diff --git a/drivers/staging/csr/csr_msgconv.h b/drivers/staging/csr/csr_msgconv.h
deleted file mode 100644
index 7e4dd388ae37..000000000000
--- a/drivers/staging/csr/csr_msgconv.h
+++ /dev/null
@@ -1,78 +0,0 @@
1#ifndef CSR_MSGCONV_H__
2#define CSR_MSGCONV_H__
3
4/*****************************************************************************
5
6 (c) Cambridge Silicon Radio Limited 2010
7 All rights reserved and confidential information of CSR
8
9 Refer to LICENSE.txt included with this source for details
10 on the license terms.
11
12*****************************************************************************/
13
14#include <linux/types.h>
15#include "csr_prim_defs.h"
16#include "csr_sched.h"
17
18typedef size_t (CsrMsgSizeofFunc)(void *msg);
19typedef u8 *(CsrMsgSerializeFunc)(u8 *buffer, size_t *length, void *msg);
20typedef void (CsrMsgFreeFunc)(void *msg);
21typedef void *(CsrMsgDeserializeFunc)(u8 *buffer, size_t length);
22
23/* Converter entry for one message type */
24typedef struct CsrMsgConvMsgEntry
25{
26 u16 msgType;
27 CsrMsgSizeofFunc *sizeofFunc;
28 CsrMsgSerializeFunc *serFunc;
29 CsrMsgDeserializeFunc *deserFunc;
30 CsrMsgFreeFunc *freeFunc;
31} CsrMsgConvMsgEntry;
32
33/* Optional lookup function */
34typedef CsrMsgConvMsgEntry *(CsrMsgCustomLookupFunc)(CsrMsgConvMsgEntry *ce, u16 msgType);
35
36/* All converter entries for one specific primitive */
37typedef struct CsrMsgConvPrimEntry
38{
39 u16 primType;
40 const CsrMsgConvMsgEntry *conv;
41 CsrMsgCustomLookupFunc *lookupFunc;
42 struct CsrMsgConvPrimEntry *next;
43} CsrMsgConvPrimEntry;
44
45typedef struct
46{
47 CsrMsgConvPrimEntry *profile_converters;
48 void *(*deserialize_data)(u16 primType, size_t length, u8 * data);
49 u8 (*free_message)(u16 primType, u8 *data);
50 size_t (*sizeof_message)(u16 primType, void *msg);
51 u8 *(*serialize_message)(u16 primType, void *msg,
52 size_t * length,
53 u8 * buffer);
54} CsrMsgConvEntry;
55
56size_t CsrMsgConvSizeof(u16 primType, void *msg);
57u8 *CsrMsgConvSerialize(u8 *buffer, size_t maxBufferOffset, size_t *offset, u16 primType, void *msg);
58void CsrMsgConvCustomLookupRegister(u16 primType, CsrMsgCustomLookupFunc *lookupFunc);
59void CsrMsgConvInsert(u16 primType, const CsrMsgConvMsgEntry *ce);
60CsrMsgConvPrimEntry *CsrMsgConvFind(u16 primType);
61CsrMsgConvMsgEntry *CsrMsgConvFindEntry(u16 primType, u16 msgType);
62CsrMsgConvMsgEntry *CsrMsgConvFindEntryByMsg(u16 primType, const void *msg);
63CsrMsgConvEntry *CsrMsgConvInit(void);
64
65/* Prototypes for primitive type serializers */
66void CsrUint8Ser(u8 *buffer, size_t *offset, u8 value);
67void CsrUint16Ser(u8 *buffer, size_t *offset, u16 value);
68void CsrUint32Ser(u8 *buffer, size_t *offset, u32 value);
69void CsrMemCpySer(u8 *buffer, size_t *offset, const void *value, size_t length);
70void CsrCharStringSer(u8 *buffer, size_t *offset, const char *value);
71
72void CsrUint8Des(u8 *value, u8 *buffer, size_t *offset);
73void CsrUint16Des(u16 *value, u8 *buffer, size_t *offset);
74void CsrUint32Des(u32 *value, u8 *buffer, size_t *offset);
75void CsrMemCpyDes(void *value, u8 *buffer, size_t *offset, size_t length);
76void CsrCharStringDes(char **value, u8 *buffer, size_t *offset);
77
78#endif
diff --git a/drivers/staging/csr/csr_prim_defs.h b/drivers/staging/csr/csr_prim_defs.h
deleted file mode 100644
index 81a1eaac30d9..000000000000
--- a/drivers/staging/csr/csr_prim_defs.h
+++ /dev/null
@@ -1,55 +0,0 @@
1#ifndef CSR_PRIM_DEFS_H__
2#define CSR_PRIM_DEFS_H__
3/*****************************************************************************
4
5 (c) Cambridge Silicon Radio Limited 2010
6 All rights reserved and confidential information of CSR
7
8 Refer to LICENSE.txt included with this source for details
9 on the license terms.
10
11*****************************************************************************/
12
13/************************************************************************************
14 * Segmentation of primitives in upstream and downstream segment
15 ************************************************************************************/
16typedef u16 CsrPrim;
17#define CSR_PRIM_UPSTREAM ((CsrPrim) (0x8000))
18
19/************************************************************************************
20 * Primitive definitions for Synergy framework
21 ************************************************************************************/
22#define CSR_SYNERGY_EVENT_CLASS_BASE ((u16) (0x0600))
23
24#define CSR_HCI_PRIM ((u16) (0x0000 | CSR_SYNERGY_EVENT_CLASS_BASE))
25#define CSR_BCCMD_PRIM ((u16) (0x0001 | CSR_SYNERGY_EVENT_CLASS_BASE))
26#define CSR_HQ_PRIM ((u16) (0x0002 | CSR_SYNERGY_EVENT_CLASS_BASE))
27#define CSR_VM_PRIM ((u16) (0x0003 | CSR_SYNERGY_EVENT_CLASS_BASE))
28#define CSR_TM_BLUECORE_PRIM ((u16) (0x0004 | CSR_SYNERGY_EVENT_CLASS_BASE))
29#define CSR_FP_PRIM ((u16) (0x0005 | CSR_SYNERGY_EVENT_CLASS_BASE))
30#define CSR_IP_SOCKET_PRIM ((u16) (0x0006 | CSR_SYNERGY_EVENT_CLASS_BASE))
31#define CSR_IP_ETHER_PRIM ((u16) (0x0007 | CSR_SYNERGY_EVENT_CLASS_BASE))
32#define CSR_IP_IFCONFIG_PRIM ((u16) (0x0008 | CSR_SYNERGY_EVENT_CLASS_BASE))
33#define CSR_IP_INTERNAL_PRIM ((u16) (0x0009 | CSR_SYNERGY_EVENT_CLASS_BASE))
34#define CSR_FSAL_PRIM ((u16) (0x000A | CSR_SYNERGY_EVENT_CLASS_BASE))
35#define CSR_DATA_STORE_PRIM ((u16) (0x000B | CSR_SYNERGY_EVENT_CLASS_BASE))
36#define CSR_AM_PRIM ((u16) (0x000C | CSR_SYNERGY_EVENT_CLASS_BASE))
37#define CSR_TLS_PRIM ((u16) (0x000D | CSR_SYNERGY_EVENT_CLASS_BASE))
38#define CSR_DHCP_SERVER_PRIM ((u16) (0x000E | CSR_SYNERGY_EVENT_CLASS_BASE))
39#define CSR_TFTP_PRIM ((u16) (0x000F | CSR_SYNERGY_EVENT_CLASS_BASE))
40#define CSR_DSPM_PRIM ((u16) (0x0010 | CSR_SYNERGY_EVENT_CLASS_BASE))
41#define CSR_TLS_INTERNAL_PRIM ((u16) (0x0011 | CSR_SYNERGY_EVENT_CLASS_BASE))
42
43#define NUMBER_OF_CSR_FW_EVENTS (CSR_DSPM_PRIM - CSR_SYNERGY_EVENT_CLASS_BASE + 1)
44
45#define CSR_SYNERGY_EVENT_CLASS_MISC_BASE ((u16) (0x06A0))
46
47#define CSR_UI_PRIM ((u16) (0x0000 | CSR_SYNERGY_EVENT_CLASS_MISC_BASE))
48#define CSR_APP_PRIM ((u16) (0x0001 | CSR_SYNERGY_EVENT_CLASS_MISC_BASE))
49#define CSR_SDIO_PROBE_PRIM ((u16) (0x0002 | CSR_SYNERGY_EVENT_CLASS_MISC_BASE))
50
51#define NUMBER_OF_CSR_FW_MISC_EVENTS (CSR_SDIO_PROBE_PRIM - CSR_SYNERGY_EVENT_CLASS_MISC_BASE + 1)
52
53#define CSR_ENV_PRIM ((u16) (0x00FF | CSR_SYNERGY_EVENT_CLASS_MISC_BASE))
54
55#endif /* CSR_PRIM_DEFS_H__ */
diff --git a/drivers/staging/csr/csr_result.h b/drivers/staging/csr/csr_result.h
deleted file mode 100644
index cbb607d943c7..000000000000
--- a/drivers/staging/csr/csr_result.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef CSR_RESULT_H__
2#define CSR_RESULT_H__
3/*****************************************************************************
4
5 (c) Cambridge Silicon Radio Limited 2010
6 All rights reserved and confidential information of CSR
7
8 Refer to LICENSE.txt included with this source for details
9 on the license terms.
10
11*****************************************************************************/
12
13typedef u16 CsrResult;
14#define CSR_RESULT_SUCCESS ((CsrResult) 0x0000)
15#define CSR_RESULT_FAILURE ((CsrResult) 0xFFFF)
16
17#endif
diff --git a/drivers/staging/csr/csr_sched.h b/drivers/staging/csr/csr_sched.h
deleted file mode 100644
index c7d672c59f5b..000000000000
--- a/drivers/staging/csr/csr_sched.h
+++ /dev/null
@@ -1,85 +0,0 @@
1#ifndef CSR_SCHED_H__
2#define CSR_SCHED_H__
3/*****************************************************************************
4
5 (c) Cambridge Silicon Radio Limited 2010
6 All rights reserved and confidential information of CSR
7
8 Refer to LICENSE.txt included with this source for details
9 on the license terms.
10
11*****************************************************************************/
12#include <linux/types.h>
13#include "csr_time.h"
14
15/* An identifier issued by the scheduler. */
16typedef u32 CsrSchedIdentifier;
17
18/* A task identifier */
19typedef u16 CsrSchedTaskId;
20
21/* A queue identifier */
22typedef u16 CsrSchedQid;
23
24/* A message identifier */
25typedef CsrSchedIdentifier CsrSchedMsgId;
26
27/* A timer event identifier */
28typedef CsrSchedIdentifier CsrSchedTid;
29#define CSR_SCHED_TID_INVALID ((CsrSchedTid) 0)
30
31/* Time constants. */
32#define CSR_SCHED_TIME_MAX (0xFFFFFFFF)
33#define CSR_SCHED_MILLISECOND (1000)
34#define CSR_SCHED_SECOND (1000 * CSR_SCHED_MILLISECOND)
35#define CSR_SCHED_MINUTE (60 * CSR_SCHED_SECOND)
36
37/* Queue and primitive that identifies the environment */
38#define CSR_SCHED_TASK_ID 0xFFFF
39#define CSR_SCHED_PRIM (CSR_SCHED_TASK_ID)
40#define CSR_SCHED_EXCLUDED_MODULE_QUEUE 0xFFFF
41
42/*
43 * Background interrupt definitions
44 */
45typedef u16 CsrSchedBgint;
46#define CSR_SCHED_BGINT_INVALID ((CsrSchedBgint) 0xFFFF)
47
48/*----------------------------------------------------------------------------*
49 * NAME
50 * CsrSchedMessagePut
51 *
52 * DESCRIPTION
53 * Sends a message consisting of the integer "mi" and the void * pointer
54 * "mv" to the message queue "q".
55 *
56 * "mi" and "mv" are neither inspected nor changed by the scheduler - the
57 * task that owns "q" is expected to make sense of the values. "mv" may
58 * be null.
59 *
60 * NOTE
61 * If "mv" is not null then it will typically be a chunk of kmalloc()ed
62 * memory, though there is no need for it to be so. Tasks should normally
63 * obey the convention that when a message built with kmalloc()ed memory
64 * is given to CsrSchedMessagePut() then ownership of the memory is ceded to the
65 * scheduler - and eventually to the recipient task. I.e., the receiver of
66 * the message will be expected to kfree() the message storage.
67 *
68 * RETURNS
69 * void.
70 *
71 *----------------------------------------------------------------------------*/
72#if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER)
73void CsrSchedMessagePutStringLog(CsrSchedQid q,
74 u16 mi,
75 void *mv,
76 u32 line,
77 const char *file);
78#define CsrSchedMessagePut(q, mi, mv) CsrSchedMessagePutStringLog((q), (mi), (mv), __LINE__, __FILE__)
79#else
80void CsrSchedMessagePut(CsrSchedQid q,
81 u16 mi,
82 void *mv);
83#endif
84
85#endif
diff --git a/drivers/staging/csr/csr_sdio.h b/drivers/staging/csr/csr_sdio.h
deleted file mode 100644
index 0971d135abf6..000000000000
--- a/drivers/staging/csr/csr_sdio.h
+++ /dev/null
@@ -1,723 +0,0 @@
1#ifndef CSR_SDIO_H__
2#define CSR_SDIO_H__
3/*****************************************************************************
4
5 (c) Cambridge Silicon Radio Limited 2010
6 All rights reserved and confidential information of CSR
7
8 Refer to LICENSE.txt included with this source for details
9 on the license terms.
10
11*****************************************************************************/
12
13#include "csr_result.h"
14
15/* Result Codes */
16#define CSR_SDIO_RESULT_INVALID_VALUE ((CsrResult) 1) /* Invalid argument value */
17#define CSR_SDIO_RESULT_NO_DEVICE ((CsrResult) 2) /* The specified device is no longer present */
18#define CSR_SDIO_RESULT_CRC_ERROR ((CsrResult) 3) /* The transmitted/received data or command response contained a CRC error */
19#define CSR_SDIO_RESULT_TIMEOUT ((CsrResult) 4) /* No command response or data received from device, or function enable/disable did not succeed within timeout period */
20#define CSR_SDIO_RESULT_NOT_RESET ((CsrResult) 5) /* The device was not reset */
21
22/* Features (for use in features member of CsrSdioFunction) */
23#define CSR_SDIO_FEATURE_BYTE_MODE 0x00000001 /* Transfer sizes do not have to be a multiple of block size */
24#define CSR_SDIO_FEATURE_DMA_CAPABLE_MEM_REQUIRED 0x00000002 /* Bulk operations require DMA friendly memory */
25
26/* CsrSdioFunctionId wildcards (for use in CsrSdioFunctionId members) */
27#define CSR_SDIO_ANY_MANF_ID 0xFFFF
28#define CSR_SDIO_ANY_CARD_ID 0xFFFF
29#define CSR_SDIO_ANY_SDIO_FUNCTION 0xFF
30#define CSR_SDIO_ANY_SDIO_INTERFACE 0xFF
31
32/*----------------------------------------------------------------------------*
33 * NAME
34 * CsrSdioFunctionId
35 *
36 * DESCRIPTION
37 * This structure describes one or more functions of a device, based on
38 * four qualitative measures. The CsrSdioFunctionId wildcard defines can be
39 * used for making the CsrSdioFunctionId match more than one function.
40 *
41 * MEMBERS
42 * manfId - Vendor ID (or CSR_SDIO_ANY_MANF_ID).
43 * cardId - Device ID (or CSR_SDIO_ANY_CARD_ID).
44 * sdioFunction - SDIO Function number (or CSR_SDIO_ANY_SDIO_FUNCTION).
45 * sdioInterface - SDIO Standard Interface Code (or CSR_SDIO_ANY_SDIO_INTERFACE)
46 *
47 *----------------------------------------------------------------------------*/
48typedef struct
49{
50 u16 manfId; /* Vendor ID to match or CSR_SDIO_ANY_MANF_ID */
51 u16 cardId; /* Device ID to match or CSR_SDIO_ANY_CARD_ID */
52 u8 sdioFunction; /* SDIO Function number to match or CSR_SDIO_ANY_SDIO_FUNCTION */
53 u8 sdioInterface; /* SDIO Standard Interface Code to match or CSR_SDIO_ANY_SDIO_INTERFACE */
54} CsrSdioFunctionId;
55
56/*----------------------------------------------------------------------------*
57 * NAME
58 * CsrSdioFunction
59 *
60 * DESCRIPTION
61 * This structure represents a single function on a device.
62 *
63 * MEMBERS
64 * sdioId - A CsrSdioFunctionId describing this particular function. The
65 * subfield shall not contain any CsrSdioFunctionId wildcards. The
66 * subfields shall describe the specific single function
67 * represented by this structure.
68 * blockSize - Actual configured block size, or 0 if unconfigured.
69 * features - Bit mask with any of CSR_SDIO_FEATURE_* set.
70 * device - Handle of device containing the function. If two functions have
71 * the same device handle, they reside on the same device.
72 * driverData - For use by the Function Driver. The SDIO Driver shall not
73 * attempt to dereference the pointer.
74 * priv - For use by the SDIO Driver. The Function Driver shall not attempt
75 * to dereference the pointer.
76 *
77 *
78 *----------------------------------------------------------------------------*/
79typedef struct
80{
81 CsrSdioFunctionId sdioId;
82 u16 blockSize; /* Actual configured block size, or 0 if unconfigured */
83 u32 features; /* Bit mask with any of CSR_SDIO_FEATURE_* set */
84 void *device; /* Handle of device containing the function */
85 void *driverData; /* For use by the Function Driver */
86 void *priv; /* For use by the SDIO Driver */
87} CsrSdioFunction;
88
89/*----------------------------------------------------------------------------*
90 * NAME
91 * CsrSdioInsertedCallback, CsrSdioRemovedCallback
92 *
93 * DESCRIPTION
94 * CsrSdioInsertedCallback is called when a function becomes available to
95 * a registered Function Driver that supports the function.
96 * CsrSdioRemovedCallback is called when a function is no longer available
97 * to a Function Driver, either because the device has been removed, or the
98 * Function Driver has been unregistered.
99 *
100 * NOTE: These functions are implemented by the Function Driver, and are
101 * passed as function pointers in the CsrSdioFunctionDriver struct.
102 *
103 * PARAMETERS
104 * function - Pointer to struct representing the function.
105 *
106 *----------------------------------------------------------------------------*/
107typedef void (*CsrSdioInsertedCallback)(CsrSdioFunction *function);
108typedef void (*CsrSdioRemovedCallback)(CsrSdioFunction *function);
109
110/*----------------------------------------------------------------------------*
111 * NAME
112 * CsrSdioInterruptDsrCallback, CsrSdioInterruptCallback
113 *
114 * DESCRIPTION
115 * CsrSdioInterruptCallback is called when an interrupt occurs on the
116 * the device associated with the specified function.
117 *
118 * NOTE: These functions are implemented by the Function Driver, and are
119 * passed as function pointers in the CsrSdioFunctionDriver struct.
120 *
121 * PARAMETERS
122 * function - Pointer to struct representing the function.
123 *
124 * RETURNS (only CsrSdioInterruptCallback)
125 * A pointer to a CsrSdioInterruptDsrCallback function.
126 *
127 *----------------------------------------------------------------------------*/
128typedef void (*CsrSdioInterruptDsrCallback)(CsrSdioFunction *function);
129typedef CsrSdioInterruptDsrCallback (*CsrSdioInterruptCallback)(CsrSdioFunction *function);
130
131/*----------------------------------------------------------------------------*
132 * NAME
133 * CsrSdioSuspendCallback, CsrSdioResumeCallback
134 *
135 * DESCRIPTION
136 * CsrSdioSuspendCallback is called when the system is preparing to go
137 * into a suspended state. CsrSdioResumeCallback is called when the system
138 * has entered an active state again.
139 *
140 * NOTE: These functions are implemented by the Function Driver, and are
141 * passed as function pointers in the CsrSdioFunctionDriver struct.
142 *
143 * PARAMETERS
144 * function - Pointer to struct representing the function.
145 *
146 *----------------------------------------------------------------------------*/
147typedef void (*CsrSdioSuspendCallback)(CsrSdioFunction *function);
148typedef void (*CsrSdioResumeCallback)(CsrSdioFunction *function);
149
150/*----------------------------------------------------------------------------*
151 * NAME
152 * CsrSdioAsyncCallback, CsrSdioAsyncDsrCallback
153 *
154 * DESCRIPTION
155 * CsrSdioAsyncCallback is called when an asynchronous operation completes.
156 *
157 * NOTE: These functions are implemented by the Function Driver, and are
158 * passed as function pointers in the function calls that initiate
159 * the operation.
160 *
161 * PARAMETERS
162 * function - Pointer to struct representing the function.
163 * result - The result of the operation that completed. See the description
164 * of the initiating function for possible result values.
165 *
166 * RETURNS (only CsrSdioAsyncCallback)
167 * A pointer to a CsrSdioAsyncDsrCallback function.
168 *
169 *----------------------------------------------------------------------------*/
170typedef void (*CsrSdioAsyncDsrCallback)(CsrSdioFunction *function, CsrResult result);
171typedef CsrSdioAsyncDsrCallback (*CsrSdioAsyncCallback)(CsrSdioFunction *function, CsrResult result);
172
173/*----------------------------------------------------------------------------*
174 * NAME
175 * CsrSdioFunctionDriver
176 *
177 * DESCRIPTION
178 * Structure representing a Function Driver.
179 *
180 * MEMBERS
181 * inserted - Callback, see description of CsrSdioInsertedCallback.
182 * removed - Callback, see description of CsrSdioRemovedCallback.
183 * intr - Callback, see description of CsrSdioInterruptCallback.
184 * suspend - Callback, see description of CsrSdioSuspendCallback.
185 * resume - Callback, see description of CsrSdioResumeCallback.
186 * ids - Array of CsrSdioFunctionId describing one or more functions that
187 * are supported by the Function Driver.
188 * idsCount - Length of the ids array.
189 * priv - For use by the SDIO Driver. The Function Driver may initialise
190 * it to NULL, but shall otherwise not access the pointer or attempt
191 * to dereference it.
192 *
193 *----------------------------------------------------------------------------*/
194typedef struct
195{
196 CsrSdioInsertedCallback inserted;
197 CsrSdioRemovedCallback removed;
198 CsrSdioInterruptCallback intr;
199 CsrSdioSuspendCallback suspend;
200 CsrSdioResumeCallback resume;
201 CsrSdioFunctionId *ids;
202 u8 idsCount;
203 void *priv; /* For use by the SDIO Driver */
204} CsrSdioFunctionDriver;
205
206/*----------------------------------------------------------------------------*
207 * NAME
208 * CsrSdioFunctionDriverRegister
209 *
210 * DESCRIPTION
211 * Register a Function Driver.
212 *
213 * PARAMETERS
214 * functionDriver - Pointer to struct describing the Function Driver.
215 *
216 * RETURNS
217 * CSR_RESULT_SUCCESS - The Function Driver was successfully
218 * registered.
219 * CSR_RESULT_FAILURE - Unable to register the function driver,
220 * because of an unspecified/unknown error. The
221 * Function Driver has not been registered.
222 * CSR_SDIO_RESULT_INVALID_VALUE - The specified Function Driver pointer
223 * does not point at a valid Function
224 * Driver structure, or some of the members
225 * contain invalid entries.
226 *
227 *----------------------------------------------------------------------------*/
228CsrResult CsrSdioFunctionDriverRegister(CsrSdioFunctionDriver *functionDriver);
229
230/*----------------------------------------------------------------------------*
231 * NAME
232 * CsrSdioFunctionDriverUnregister
233 *
234 * DESCRIPTION
235 * Unregister a previously registered Function Driver.
236 *
237 * PARAMETERS
238 * functionDriver - pointer to struct describing the Function Driver.
239 *
240 *----------------------------------------------------------------------------*/
241void CsrSdioFunctionDriverUnregister(CsrSdioFunctionDriver *functionDriver);
242
243/*----------------------------------------------------------------------------*
244 * NAME
245 * CsrSdioFunctionEnable, CsrSdioFunctionDisable
246 *
247 * DESCRIPTION
248 * Enable/disable the specified function by setting/clearing the
249 * corresponding bit in the I/O Enable register in function 0, and then
250 * periodically reading the related bit in the I/O Ready register until it
251 * is set/clear, limited by an implementation defined timeout.
252 *
253 * PARAMETERS
254 * function - Pointer to struct representing the function.
255 *
256 * RETURNS
257 * CSR_RESULT_SUCCESS - The specified function was enabled/disabled.
258 * CSR_RESULT_FAILURE - Unspecified/unknown error.
259 * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
260 * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred. The state of the
261 * related bit in the I/O Enable register is
262 * undefined.
263 * CSR_SDIO_RESULT_TIMEOUT - No response from the device, or the related
264 * bit in the I/O ready register was not
265 * set/cleared within the timeout period.
266 *
267 * NOTE: If the SDIO R5 response is available, and either of the
268 * FUNCTION_NUMBER or OUT_OF_RANGE bits are set,
269 * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit
270 * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE),
271 * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and
272 * COM_CRC_ERROR bits shall be ignored.
273 *
274 * If the CSPI response is available, and any of the
275 * FUNCTION_DISABLED or CLOCK_DISABLED bits are set,
276 * CSR_SDIO_RESULT_INVALID_VALUE will be returned.
277 *
278 *----------------------------------------------------------------------------*/
279CsrResult CsrSdioFunctionEnable(CsrSdioFunction *function);
280CsrResult CsrSdioFunctionDisable(CsrSdioFunction *function);
281
282/*----------------------------------------------------------------------------*
283 * NAME
284 * CsrSdioInterruptEnable, CsrSdioInterruptDisable
285 *
286 * DESCRIPTION
287 * Enable/disable the interrupt for the specified function by
288 * setting/clearing the corresponding bit in the INT Enable register in
289 * function 0.
290 *
291 * PARAMETERS
292 * function - Pointer to struct representing the function.
293 *
294 * RETURNS
295 * CSR_RESULT_SUCCESS - The specified function was enabled/disabled.
296 * CSR_RESULT_FAILURE - Unspecified/unknown error.
297 * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
298 * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred. The state of the
299 * related bit in the INT Enable register is
300 * unchanged.
301 * CSR_SDIO_RESULT_INVALID_VALUE - The specified function cannot be
302 * enabled/disabled, because it either
303 * does not exist or it is not possible to
304 * individually enable/disable functions.
305 * CSR_SDIO_RESULT_TIMEOUT - No response from the device.
306 *
307 * NOTE: If the SDIO R5 response is available, and either of the
308 * FUNCTION_NUMBER or OUT_OF_RANGE bits are set,
309 * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit
310 * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE),
311 * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and
312 * COM_CRC_ERROR bits shall be ignored.
313 *
314 * If the CSPI response is available, and any of the
315 * FUNCTION_DISABLED or CLOCK_DISABLED bits are set,
316 * CSR_SDIO_RESULT_INVALID_VALUE will be returned.
317 *
318 *----------------------------------------------------------------------------*/
319CsrResult CsrSdioInterruptEnable(CsrSdioFunction *function);
320CsrResult CsrSdioInterruptDisable(CsrSdioFunction *function);
321
322/*----------------------------------------------------------------------------*
323 * NAME
324 * CsrSdioInterruptAcknowledge
325 *
326 * DESCRIPTION
327 * Acknowledge that a signalled interrupt has been handled. Shall only
328 * be called once, and exactly once for each signalled interrupt to the
329 * corresponding function.
330 *
331 * PARAMETERS
332 * function - Pointer to struct representing the function to which the
333 * event was signalled.
334 *
335 *----------------------------------------------------------------------------*/
336void CsrSdioInterruptAcknowledge(CsrSdioFunction *function);
337
338/*----------------------------------------------------------------------------*
339 * NAME
340 * CsrSdioInsertedAcknowledge, CsrSdioRemovedAcknowledge
341 *
342 * DESCRIPTION
343 * Acknowledge that a signalled inserted/removed event has been handled.
344 * Shall only be called once, and exactly once for each signalled event to
345 * the corresponding function.
346 *
347 * PARAMETERS
348 * function - Pointer to struct representing the function to which the
349 * inserted was signalled.
350 * result (CsrSdioInsertedAcknowledge only)
351 * CSR_RESULT_SUCCESS - The Function Driver has accepted the
352 * function, and the function is attached to
353 * the Function Driver until the
354 * CsrSdioRemovedCallback is called and
355 * acknowledged.
356 * CSR_RESULT_FAILURE - Unable to accept the function. The
357 * function is not attached to the Function
358 * Driver, and it may be passed to another
359 * Function Driver which supports the
360 * function.
361 *
362 *----------------------------------------------------------------------------*/
363void CsrSdioInsertedAcknowledge(CsrSdioFunction *function, CsrResult result);
364void CsrSdioRemovedAcknowledge(CsrSdioFunction *function);
365
366/*----------------------------------------------------------------------------*
367 * NAME
368 * CsrSdioSuspendAcknowledge, CsrSdioResumeAcknowledge
369 *
370 * DESCRIPTION
371 * Acknowledge that a signalled suspend event has been handled. Shall only
372 * be called once, and exactly once for each signalled event to the
373 * corresponding function.
374 *
375 * PARAMETERS
376 * function - Pointer to struct representing the function to which the
377 * event was signalled.
378 * result
379 * CSR_RESULT_SUCCESS - Successfully suspended/resumed.
380 * CSR_RESULT_FAILURE - Unspecified/unknown error.
381 *
382 *----------------------------------------------------------------------------*/
383void CsrSdioSuspendAcknowledge(CsrSdioFunction *function, CsrResult result);
384void CsrSdioResumeAcknowledge(CsrSdioFunction *function, CsrResult result);
385
386/*----------------------------------------------------------------------------*
387 * NAME
388 * CsrSdioBlockSizeSet
389 *
390 * DESCRIPTION
391 * Set the block size to use for the function. The actual configured block
392 * size shall be the minimum of:
393 * 1) Maximum block size supported by the function.
394 * 2) Maximum block size supported by the host controller.
395 * 3) The block size specified by the blockSize argument.
396 *
397 * When this function returns, the actual configured block size is
398 * available in the blockSize member of the function struct.
399 *
400 * PARAMETERS
401 * function - Pointer to struct representing the function.
402 * blockSize - Block size to use for the function. Valid range is 1 to
403 * 2048.
404 *
405 * RETURNS
406 * CSR_RESULT_SUCCESS - The block size register on the chip
407 * was updated.
408 * CSR_RESULT_FAILURE - Unspecified/unknown error.
409 * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid.
410 * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
411 * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred. The configured block
412 * size is undefined.
413 * CSR_SDIO_RESULT_TIMEOUT - No response from the device.
414 *
415 * NOTE: If the SDIO R5 response is available, and the FUNCTION_NUMBER
416 * bits is set, CSR_SDIO_RESULT_INVALID_VALUE shall be returned.
417 * If the ERROR bit is set (but not FUNCTION_NUMBER),
418 * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and
419 * COM_CRC_ERROR bits shall be ignored.
420 *
421 * If the CSPI response is available, and any of the
422 * FUNCTION_DISABLED or CLOCK_DISABLED bits are set,
423 * CSR_SDIO_RESULT_INVALID_VALUE will be returned.
424 *
425 * NOTE: Setting the block size requires two individual operations. The
426 * implementation shall ignore the OUT_OF_RANGE bit of the SDIO R5
427 * response for the first operation, as the partially configured
428 * block size may be out of range, even if the final block size
429 * (after the second operation) is in the valid range.
430 *
431 *----------------------------------------------------------------------------*/
432CsrResult CsrSdioBlockSizeSet(CsrSdioFunction *function, u16 blockSize);
433
434/*----------------------------------------------------------------------------*
435 * NAME
436 * CsrSdioMaxBusClockFrequencySet
437 *
438 * DESCRIPTION
439 * Set the maximum clock frequency to use for the device associated with
440 * the specified function. The actual configured clock frequency for the
441 * device shall be the minimum of:
442 * 1) Maximum clock frequency supported by the device.
443 * 2) Maximum clock frequency supported by the host controller.
444 * 3) Maximum clock frequency specified for any function on the same
445 * device.
446 *
447 * If the clock frequency exceeds 25MHz, it is the responsibility of the
448 * SDIO driver to enable high speed mode on the device, using the standard
449 * defined procedure, before increasing the frequency beyond the limit.
450 *
451 * Note that the clock frequency configured affects all functions on the
452 * same device.
453 *
454 * PARAMETERS
455 * function - Pointer to struct representing the function.
456 * maxFrequency - The maximum clock frequency for the function in Hertz.
457 *
458 * RETURNS
459 * CSR_RESULT_SUCCESS - The maximum clock frequency was successfully
460 * set for the function.
461 * CSR_RESULT_FAILURE - Unspecified/unknown error.
462 * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid.
463 * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
464 *
465 * NOTE: If the SDIO R5 response is available, and the FUNCTION_NUMBER
466 * bits is set, CSR_SDIO_RESULT_INVALID_VALUE shall be returned.
467 * If the ERROR bit is set (but not FUNCTION_NUMBER),
468 * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and
469 * COM_CRC_ERROR bits shall be ignored.
470 *
471 * If the CSPI response is available, and any of the
472 * FUNCTION_DISABLED or CLOCK_DISABLED bits are set,
473 * CSR_SDIO_RESULT_INVALID_VALUE will be returned.
474 *
475 *
476 *----------------------------------------------------------------------------*/
477CsrResult CsrSdioMaxBusClockFrequencySet(CsrSdioFunction *function, u32 maxFrequency);
478
479/*----------------------------------------------------------------------------*
480 * NAME
481 * CsrSdioRead8, CsrSdioWrite8, CsrSdioRead8Async, CsrSdioWrite8Async
482 *
483 * DESCRIPTION
484 * Read/write an 8bit value from/to the specified register address.
485 *
486 * PARAMETERS
487 * function - Pointer to struct representing the function.
488 * address - Register address within the function.
489 * data - The data to read/write.
490 * callback - The function to call on operation completion.
491 *
492 * RETURNS
493 * CSR_RESULT_SUCCESS - The data was successfully read/written.
494 * CSR_RESULT_FAILURE - Unspecified/unknown error.
495 * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid.
496 * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
497 * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred. No data read/written.
498 * CSR_SDIO_RESULT_TIMEOUT - No response from the device.
499 *
500 * NOTE: If the SDIO R5 response is available, and either of the
501 * FUNCTION_NUMBER or OUT_OF_RANGE bits are set,
502 * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit
503 * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE),
504 * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and
505 * COM_CRC_ERROR bits shall be ignored.
506 *
507 * If the CSPI response is available, and any of the
508 * FUNCTION_DISABLED or CLOCK_DISABLED bits are set,
509 * CSR_SDIO_RESULT_INVALID_VALUE will be returned.
510 *
511 * NOTE: The CsrSdioRead8Async and CsrSdioWrite8Async functions return
512 * immediately, and the supplied callback function is called when the
513 * operation is complete. The result value is given as an argument to
514 * the callback function.
515 *
516 *----------------------------------------------------------------------------*/
517CsrResult CsrSdioRead8(CsrSdioFunction *function, u32 address, u8 *data);
518CsrResult CsrSdioWrite8(CsrSdioFunction *function, u32 address, u8 data);
519void CsrSdioRead8Async(CsrSdioFunction *function, u32 address, u8 *data, CsrSdioAsyncCallback callback);
520void CsrSdioWrite8Async(CsrSdioFunction *function, u32 address, u8 data, CsrSdioAsyncCallback callback);
521
522/*----------------------------------------------------------------------------*
523 * NAME
524 * CsrSdioRead16, CsrSdioWrite16, CsrSdioRead16Async, CsrSdioWrite16Async
525 *
526 * DESCRIPTION
527 * Read/write a 16bit value from/to the specified register address.
528 *
529 * PARAMETERS
530 * function - Pointer to struct representing the function.
531 * address - Register address within the function.
532 * data - The data to read/write.
533 * callback - The function to call on operation completion.
534 *
535 * RETURNS
536 * CSR_RESULT_SUCCESS - The data was successfully read/written.
537 * CSR_RESULT_FAILURE - Unspecified/unknown error.
538 * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid.
539 * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
540 * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred. Data may have been
541 * partially read/written.
542 * CSR_SDIO_RESULT_TIMEOUT - No response from the device.
543 *
544 * NOTE: If the SDIO R5 response is available, and either of the
545 * FUNCTION_NUMBER or OUT_OF_RANGE bits are set,
546 * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit
547 * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE),
548 * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and
549 * COM_CRC_ERROR bits shall be ignored.
550 *
551 * If the CSPI response is available, and any of the
552 * FUNCTION_DISABLED or CLOCK_DISABLED bits are set,
553 * CSR_SDIO_RESULT_INVALID_VALUE will be returned.
554 *
555 * NOTE: The CsrSdioRead16Async and CsrSdioWrite16Async functions return
556 * immediately, and the supplied callback function is called when the
557 * operation is complete. The result value is given as an argument to
558 * the callback function.
559 *
560 *----------------------------------------------------------------------------*/
561CsrResult CsrSdioRead16(CsrSdioFunction *function, u32 address, u16 *data);
562CsrResult CsrSdioWrite16(CsrSdioFunction *function, u32 address, u16 data);
563void CsrSdioRead16Async(CsrSdioFunction *function, u32 address, u16 *data, CsrSdioAsyncCallback callback);
564void CsrSdioWrite16Async(CsrSdioFunction *function, u32 address, u16 data, CsrSdioAsyncCallback callback);
565
566/*----------------------------------------------------------------------------*
567 * NAME
568 * CsrSdioF0Read8, CsrSdioF0Write8, CsrSdioF0Read8Async,
569 * CsrSdioF0Write8Async
570 *
571 * DESCRIPTION
572 * Read/write an 8bit value from/to the specified register address in
573 * function 0.
574 *
575 * PARAMETERS
576 * function - Pointer to struct representing the function.
577 * address - Register address within the function.
578 * data - The data to read/write.
579 * callback - The function to call on operation completion.
580 *
581 * RETURNS
582 * CSR_RESULT_SUCCESS - The data was successfully read/written.
583 * CSR_RESULT_FAILURE - Unspecified/unknown error.
584 * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid.
585 * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
586 * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred. No data read/written.
587 * CSR_SDIO_RESULT_TIMEOUT - No response from the device.
588 *
589 * NOTE: If the SDIO R5 response is available, and either of the
590 * FUNCTION_NUMBER or OUT_OF_RANGE bits are set,
591 * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit
592 * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE),
593 * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and
594 * COM_CRC_ERROR bits shall be ignored.
595 *
596 * If the CSPI response is available, and any of the
597 * FUNCTION_DISABLED or CLOCK_DISABLED bits are set,
598 * CSR_SDIO_RESULT_INVALID_VALUE will be returned.
599 *
600 * NOTE: The CsrSdioF0Read8Async and CsrSdioF0Write8Async functions return
601 * immediately, and the supplied callback function is called when the
602 * operation is complete. The result value is given as an argument to
603 * the callback function.
604 *
605 *----------------------------------------------------------------------------*/
606CsrResult CsrSdioF0Read8(CsrSdioFunction *function, u32 address, u8 *data);
607CsrResult CsrSdioF0Write8(CsrSdioFunction *function, u32 address, u8 data);
608void CsrSdioF0Read8Async(CsrSdioFunction *function, u32 address, u8 *data, CsrSdioAsyncCallback callback);
609void CsrSdioF0Write8Async(CsrSdioFunction *function, u32 address, u8 data, CsrSdioAsyncCallback callback);
610
611/*----------------------------------------------------------------------------*
612 * NAME
613 * CsrSdioRead, CsrSdioWrite, CsrSdioReadAsync, CsrSdioWriteAsync
614 *
615 * DESCRIPTION
616 * Read/write a specified number of bytes from/to the specified register
617 * address.
618 *
619 * PARAMETERS
620 * function - Pointer to struct representing the function.
621 * address - Register address within the function.
622 * data - The data to read/write.
623 * length - Number of byte to read/write.
624 * callback - The function to call on operation completion.
625 *
626 * RETURNS
627 * CSR_RESULT_SUCCESS - The data was successfully read/written.
628 * CSR_RESULT_FAILURE - Unspecified/unknown error.
629 * CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid.
630 * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
631 * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred. Data may have been
632 * partially read/written.
633 * CSR_SDIO_RESULT_TIMEOUT - No response from the device.
634 *
635 * NOTE: If the SDIO R5 response is available, and either of the
636 * FUNCTION_NUMBER or OUT_OF_RANGE bits are set,
637 * CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit
638 * is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE),
639 * CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and
640 * COM_CRC_ERROR bits shall be ignored.
641 *
642 * If the CSPI response is available, and any of the
643 * FUNCTION_DISABLED or CLOCK_DISABLED bits are set,
644 * CSR_SDIO_RESULT_INVALID_VALUE will be returned.
645 *
646 * NOTE: The CsrSdioF0Read8Async and CsrSdioF0Write8Async functions return
647 * immediately, and the supplied callback function is called when the
648 * operation is complete. The result value is given as an argument to
649 * the callback function.
650 *
651 *----------------------------------------------------------------------------*/
652CsrResult CsrSdioRead(CsrSdioFunction *function, u32 address, void *data, u32 length);
653CsrResult CsrSdioWrite(CsrSdioFunction *function, u32 address, const void *data, u32 length);
654void CsrSdioReadAsync(CsrSdioFunction *function, u32 address, void *data, u32 length, CsrSdioAsyncCallback callback);
655void CsrSdioWriteAsync(CsrSdioFunction *function, u32 address, const void *data, u32 length, CsrSdioAsyncCallback callback);
656
657/*----------------------------------------------------------------------------*
658 * NAME
659 * CsrSdioPowerOn, CsrSdioPowerOff
660 *
661 * DESCRIPTION
662 * Power on/off the device.
663 *
664 * PARAMETERS
665 * function - Pointer to struct representing the function that resides on
666 * the device to power on/off.
667 *
668 * RETURNS (only CsrSdioPowerOn)
669 * CSR_RESULT_SUCCESS - Power was successfully reapplied and the device
670 * has been reinitialised.
671 * CSR_RESULT_FAILURE - Unspecified/unknown error.
672 * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
673 * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred during reinitialisation.
674 * CSR_SDIO_RESULT_TIMEOUT - No response from the device during
675 * reinitialisation.
676 * CSR_SDIO_RESULT_NOT_RESET - The power was not removed by the
677 * CsrSdioPowerOff call. The state of the
678 * device is unchanged.
679 *
680 *----------------------------------------------------------------------------*/
681CsrResult CsrSdioPowerOn(CsrSdioFunction *function);
682void CsrSdioPowerOff(CsrSdioFunction *function);
683
684/*----------------------------------------------------------------------------*
685 * NAME
686 * CsrSdioHardReset
687 *
688 * DESCRIPTION
689 * Perform a hardware reset of the device.
690 *
691 * PARAMETERS
692 * function - Pointer to struct representing the function that resides on
693 * the device to hard reset.
694 *
695 * RETURNS
696 * CSR_RESULT_SUCCESS - Reset was successfully performed and the device
697 * has been reinitialised.
698 * CSR_RESULT_FAILURE - Unspecified/unknown error.
699 * CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
700 * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred during reinitialisation.
701 * CSR_SDIO_RESULT_TIMEOUT - No response from the device during
702 * reinitialisation.
703 * CSR_SDIO_RESULT_NOT_RESET - The reset was not applied because it is not
704 * supported. The state of the device is
705 * unchanged.
706 *
707 *----------------------------------------------------------------------------*/
708CsrResult CsrSdioHardReset(CsrSdioFunction *function);
709
710/*----------------------------------------------------------------------------*
711 * NAME
712 * CsrSdioFunctionActive, CsrSdioFunctionIdle
713 *
714 * DESCRIPTION
715 *
716 * PARAMETERS
717 * function - Pointer to struct representing the function.
718 *
719 *----------------------------------------------------------------------------*/
720void CsrSdioFunctionActive(CsrSdioFunction *function);
721void CsrSdioFunctionIdle(CsrSdioFunction *function);
722
723#endif
diff --git a/drivers/staging/csr/csr_serialize_primitive_types.c b/drivers/staging/csr/csr_serialize_primitive_types.c
deleted file mode 100644
index 9713b9afef64..000000000000
--- a/drivers/staging/csr/csr_serialize_primitive_types.c
+++ /dev/null
@@ -1,100 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2010
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11#include <linux/module.h>
12#include <linux/slab.h>
13#include "csr_prim_defs.h"
14#include "csr_msgconv.h"
15#include "csr_macro.h"
16
17void CsrUint8Des(u8 *value, u8 *buffer, size_t *offset)
18{
19 *value = buffer[*offset];
20 *offset += sizeof(*value);
21}
22EXPORT_SYMBOL_GPL(CsrUint8Des);
23
24void CsrUint16Des(u16 *value, u8 *buffer, size_t *offset)
25{
26 *value = (buffer[*offset + 0] << 0) |
27 (buffer[*offset + 1] << 8);
28 *offset += sizeof(*value);
29}
30EXPORT_SYMBOL_GPL(CsrUint16Des);
31
32void CsrUint32Des(u32 *value, u8 *buffer, size_t *offset)
33{
34 *value = (buffer[*offset + 0] << 0) |
35 (buffer[*offset + 1] << 8) |
36 (buffer[*offset + 2] << 16) |
37 (buffer[*offset + 3] << 24);
38 *offset += sizeof(*value);
39}
40EXPORT_SYMBOL_GPL(CsrUint32Des);
41
42void CsrMemCpyDes(void *value, u8 *buffer, size_t *offset, size_t length)
43{
44 memcpy(value, &buffer[*offset], length);
45 *offset += length;
46}
47EXPORT_SYMBOL_GPL(CsrMemCpyDes);
48
49void CsrCharStringDes(char **value, u8 *buffer, size_t *offset)
50{
51 *value = kstrdup((char *) &buffer[*offset], GFP_KERNEL);
52 *offset += strlen(*value) + 1;
53}
54EXPORT_SYMBOL_GPL(CsrCharStringDes);
55
56void CsrUint8Ser(u8 *buffer, size_t *offset, u8 value)
57{
58 buffer[*offset] = value;
59 *offset += sizeof(value);
60}
61EXPORT_SYMBOL_GPL(CsrUint8Ser);
62
63void CsrUint16Ser(u8 *buffer, size_t *offset, u16 value)
64{
65 buffer[*offset + 0] = (u8) ((value >> 0) & 0xFF);
66 buffer[*offset + 1] = (u8) ((value >> 8) & 0xFF);
67 *offset += sizeof(value);
68}
69EXPORT_SYMBOL_GPL(CsrUint16Ser);
70
71void CsrUint32Ser(u8 *buffer, size_t *offset, u32 value)
72{
73 buffer[*offset + 0] = (u8) ((value >> 0) & 0xFF);
74 buffer[*offset + 1] = (u8) ((value >> 8) & 0xFF);
75 buffer[*offset + 2] = (u8) ((value >> 16) & 0xFF);
76 buffer[*offset + 3] = (u8) ((value >> 24) & 0xFF);
77 *offset += sizeof(value);
78}
79EXPORT_SYMBOL_GPL(CsrUint32Ser);
80
81void CsrMemCpySer(u8 *buffer, size_t *offset, const void *value, size_t length)
82{
83 memcpy(&buffer[*offset], value, length);
84 *offset += length;
85}
86EXPORT_SYMBOL_GPL(CsrMemCpySer);
87
88void CsrCharStringSer(u8 *buffer, size_t *offset, const char *value)
89{
90 if (value)
91 {
92 strcpy(((char *) &buffer[*offset]), value);
93 *offset += strlen(value) + 1;
94 }
95 else
96 {
97 CsrUint8Ser(buffer, offset, 0);
98 }
99}
100EXPORT_SYMBOL_GPL(CsrCharStringSer);
diff --git a/drivers/staging/csr/csr_time.c b/drivers/staging/csr/csr_time.c
deleted file mode 100644
index 01179e46f47d..000000000000
--- a/drivers/staging/csr/csr_time.c
+++ /dev/null
@@ -1,33 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2010
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11#include <linux/kernel.h>
12#include <linux/time.h>
13#include <linux/module.h>
14
15#include "csr_time.h"
16
17u32 CsrTimeGet(u32 *high)
18{
19 struct timespec ts;
20 u64 time;
21 u32 low;
22
23 ts = current_kernel_time();
24 time = (u64) ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
25
26 if (high != NULL)
27 *high = (u32) ((time >> 32) & 0xFFFFFFFF);
28
29 low = (u32) (time & 0xFFFFFFFF);
30
31 return low;
32}
33EXPORT_SYMBOL_GPL(CsrTimeGet);
diff --git a/drivers/staging/csr/csr_time.h b/drivers/staging/csr/csr_time.h
deleted file mode 100644
index fc29e8e5e478..000000000000
--- a/drivers/staging/csr/csr_time.h
+++ /dev/null
@@ -1,76 +0,0 @@
1#ifndef CSR_TIME_H__
2#define CSR_TIME_H__
3/*****************************************************************************
4
5(c) Cambridge Silicon Radio Limited 2010
6All rights reserved and confidential information of CSR
7
8Refer to LICENSE.txt included with this source for details
9on the license terms.
10
11*****************************************************************************/
12
13#include <linux/types.h>
14
15/*******************************************************************************
16
17NAME
18 CsrTimeGet
19
20DESCRIPTION
21 Returns the current system time in a low and a high part. The low part
22 is expressed in microseconds. The high part is incremented when the low
23 part wraps to provide an extended range.
24
25 The caller may provide a NULL pointer as the high parameter.
26 In this case the function just returns the low part and ignores the
27 high parameter.
28
29 Although the time is expressed in microseconds the actual resolution is
30 platform dependent and can be less. It is recommended that the
31 resolution is at least 10 milliseconds.
32
33PARAMETERS
34 high - Pointer to variable that will receive the high part of the
35 current system time. Passing NULL is valid.
36
37RETURNS
38 Low part of current system time in microseconds.
39
40*******************************************************************************/
41u32 CsrTimeGet(u32 *high);
42
43
44/*------------------------------------------------------------------*/
45/* CsrTime Macros */
46/*------------------------------------------------------------------*/
47
48/*----------------------------------------------------------------------------*
49 * NAME
50 * CsrTimeAdd
51 *
52 * DESCRIPTION
53 * Add two time values. Adding the numbers can overflow the range of a
54 * CsrTime, so the user must be cautious.
55 *
56 * RETURNS
57 * CsrTime - the sum of "t1" and "t2".
58 *
59 *----------------------------------------------------------------------------*/
60#define CsrTimeAdd(t1, t2) ((t1) + (t2))
61
62/*----------------------------------------------------------------------------*
63 * NAME
64 * CsrTimeSub
65 *
66 * DESCRIPTION
67 * Subtract two time values. Subtracting the numbers can provoke an
68 * underflow, so the user must be cautious.
69 *
70 * RETURNS
71 * CsrTime - "t1" - "t2".
72 *
73 *----------------------------------------------------------------------------*/
74#define CsrTimeSub(t1, t2) ((s32) (t1) - (s32) (t2))
75
76#endif
diff --git a/drivers/staging/csr/csr_util.c b/drivers/staging/csr/csr_util.c
deleted file mode 100644
index c3aa9d509e5c..000000000000
--- a/drivers/staging/csr/csr_util.c
+++ /dev/null
@@ -1,15 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2010
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11#include <linux/module.h>
12
13MODULE_DESCRIPTION("CSR Operating System Kernel Abstraction");
14MODULE_AUTHOR("Cambridge Silicon Radio Ltd.");
15MODULE_LICENSE("GPL and additional rights");
diff --git a/drivers/staging/csr/csr_wifi_common.h b/drivers/staging/csr/csr_wifi_common.h
deleted file mode 100644
index efc43a525a3d..000000000000
--- a/drivers/staging/csr/csr_wifi_common.h
+++ /dev/null
@@ -1,101 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11#ifndef CSR_WIFI_COMMON_H__
12#define CSR_WIFI_COMMON_H__
13
14#include <linux/types.h>
15#include "csr_result.h"
16
17/* MAC address */
18typedef struct
19{
20 u8 a[6];
21} CsrWifiMacAddress;
22
23/* IPv4 address */
24typedef struct
25{
26 u8 a[4];
27} CsrWifiIp4Address;
28
29/* IPv6 address */
30typedef struct
31{
32 u8 a[16];
33} CsrWifiIp6Address;
34
35typedef struct
36{
37 u8 ssid[32];
38 u8 length;
39} CsrWifiSsid;
40
41/*******************************************************************************
42
43 DESCRIPTION
44 Result values used on the Wifi Interfaces
45
46 VALUES
47 CSR_RESULT_SUCCESS
48 - The request/procedure succeeded
49 CSR_RESULT_FAILURE
50 - The request/procedure did not succeed because of an error
51 CSR_WIFI_RESULT_NOT_FOUND
52 - The request did not succeed because some resource was not
53 found.
54 CSR_WIFI_RESULT_TIMED_OUT
55 - The request/procedure did not succeed because of a time out
56 CSR_WIFI_RESULT_CANCELLED
57 - The request was canceled due to another conflicting
58 request that was issued before this one was completed
59 CSR_WIFI_RESULT_INVALID_PARAMETER
60 - The request/procedure did not succeed because it had an
61 invalid parameter
62 CSR_WIFI_RESULT_NO_ROOM
63 - The request did not succeed due to a lack of resources,
64 e.g. out of memory problem.
65 CSR_WIFI_RESULT_UNSUPPORTED
66 - The request/procedure did not succeed because the feature
67 is not supported yet
68 CSR_WIFI_RESULT_UNAVAILABLE
69 - The request cannot be processed at this time
70 CSR_WIFI_RESULT_WIFI_OFF
71 - The requested action is not available because Wi-Fi is
72 currently off
73 CSR_WIFI_RESULT_SECURITY_ERROR
74 - The request/procedure did not succeed because of a security
75 error
76 CSR_WIFI_RESULT_MIB_SET_FAILURE
77 - MIB Set Failure: either the MIB OID to be written to does
78 not exist or the MIB Value is invalid.
79 CSR_WIFI_RESULT_INVALID_INTERFACE_TAG
80 - The supplied Interface Tag is not valid.
81 CSR_WIFI_RESULT_P2P_NOA_CONFIG_CONFLICT
82 - The new NOA configuration conflicts with the existing NOA configuration
83 hence not accepted"
84*******************************************************************************/
85#define CSR_WIFI_RESULT_NOT_FOUND ((CsrResult) 0x0001)
86#define CSR_WIFI_RESULT_TIMED_OUT ((CsrResult) 0x0002)
87#define CSR_WIFI_RESULT_CANCELLED ((CsrResult) 0x0003)
88#define CSR_WIFI_RESULT_INVALID_PARAMETER ((CsrResult) 0x0004)
89#define CSR_WIFI_RESULT_NO_ROOM ((CsrResult) 0x0005)
90#define CSR_WIFI_RESULT_UNSUPPORTED ((CsrResult) 0x0006)
91#define CSR_WIFI_RESULT_UNAVAILABLE ((CsrResult) 0x0007)
92#define CSR_WIFI_RESULT_WIFI_OFF ((CsrResult) 0x0008)
93#define CSR_WIFI_RESULT_SECURITY_ERROR ((CsrResult) 0x0009)
94#define CSR_WIFI_RESULT_MIB_SET_FAILURE ((CsrResult) 0x000A)
95#define CSR_WIFI_RESULT_INVALID_INTERFACE_TAG ((CsrResult) 0x000B)
96#define CSR_WIFI_RESULT_P2P_NOA_CONFIG_CONFLICT ((CsrResult) 0x000C)
97
98#define CSR_WIFI_VERSION "5.1.0.0"
99
100#endif
101
diff --git a/drivers/staging/csr/csr_wifi_fsm.h b/drivers/staging/csr/csr_wifi_fsm.h
deleted file mode 100644
index fc5c5aa6a3c4..000000000000
--- a/drivers/staging/csr/csr_wifi_fsm.h
+++ /dev/null
@@ -1,240 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11#ifndef CSR_WIFI_FSM_H
12#define CSR_WIFI_FSM_H
13
14#include "csr_prim_defs.h"
15#include "csr_log_text.h"
16#include "csr_wifi_fsm_event.h"
17
18/* including this file for CsrWifiInterfaceMode*/
19#include "csr_wifi_common.h"
20
21#define CSR_WIFI_FSM_ENV (0xFFFF)
22
23/**
24 * @brief
25 * Toplevel FSM context data
26 *
27 * @par Description
28 * Holds ALL FSM static and dynamic data for a FSM
29 */
30typedef struct CsrWifiFsmContext CsrWifiFsmContext;
31
32/**
33 * @brief
34 * FSM External Wakeup CallbackFunction Pointer
35 *
36 * @par Description
37 * Defines the external wakeup function for the FSM
38 * to call when an external event is injected into the systen
39 *
40 * @param[in] context : External context
41 *
42 * @return
43 * void
44 */
45typedef void (*CsrWifiFsmExternalWakupCallbackPtr)(void *context);
46
47/**
48 * @brief
49 * Initialises a top level FSM context
50 *
51 * @par Description
52 * Initialises the FSM Context to an initial state and allocates
53 * space for "maxProcesses" number of instances
54 *
55 * @param[in] osaContext : OSA context
56 * @param[in] applicationContext : Internal fsm application context
57 * @param[in] externalContext : External context
58 * @param[in] maxProcesses : Max processes to allocate room for
59 *
60 * @return
61 * CsrWifiFsmContext* fsm context
62 */
63extern CsrWifiFsmContext* CsrWifiFsmInit(void *applicationContext, void *externalContext, u16 maxProcesses, CsrLogTextTaskId loggingTaskId);
64
65/**
66 * @brief
67 * Resets the FSM's back to first conditions
68 *
69 * @par Description
70 * This function is used to free any dynamic resources allocated for the
71 * given context by CsrWifiFsmInit().
72 * The FSM's reset function is called to cleanup any fsm specific memory
73 * The reset function does NOT need to free the fsm data pointer as
74 * CsrWifiFsmShutdown() will do it.
75 * the FSM's init function is call again to reinitialise the FSM context.
76 * CsrWifiFsmReset() should NEVER be called when CsrWifiFsmExecute() is running.
77 *
78 * @param[in] context : FSM context
79 *
80 * @return
81 * void
82 */
83extern void CsrWifiFsmReset(CsrWifiFsmContext *context);
84
85/**
86 * @brief
87 * Frees resources allocated by CsrWifiFsmInit
88 *
89 * @par Description
90 * This function is used to free any dynamic resources allocated for the
91 * given context by CsrWifiFsmInit(), prior to complete termination of
92 * the program.
93 * The FSM's reset function is called to cleanup any fsm specific memory.
94 * The reset function does NOT need to free the fsm data pointer as
95 * CsrWifiFsmShutdown() will do it.
96 * CsrWifiFsmShutdown() should NEVER be called when CsrWifiFsmExecute() is running.
97 *
98 * @param[in] context : FSM context
99 *
100 * @return
101 * void
102 */
103extern void CsrWifiFsmShutdown(CsrWifiFsmContext *context);
104
105/**
106 * @brief
107 * Executes the fsm context
108 *
109 * @par Description
110 * Executes the FSM context and runs until ALL events in the context are processed.
111 * When no more events are left to process then CsrWifiFsmExecute() returns to a time
112 * specifying when to next call the CsrWifiFsmExecute()
113 * Scheduling, threading, blocking and external event notification are outside
114 * the scope of the FSM and CsrWifiFsmExecute().
115 *
116 * @param[in] context : FSM context
117 *
118 * @return
119 * u32 Time in ms until next timeout or 0xFFFFFFFF for no timer set
120 */
121extern u32 CsrWifiFsmExecute(CsrWifiFsmContext *context);
122
123/**
124 * @brief
125 * Adds an event to the FSM context's external event queue for processing
126 *
127 * @par Description
128 * Adds an event to the contexts external queue
129 * This is thread safe and adds an event to the fsm's external event queue.
130 *
131 * @param[in] context : FSM context
132 * @param[in] event : event to add to the event queue
133 * @param[in] source : source of the event (this can be a synergy task queue or an fsm instance id)
134 * @param[in] destination : destination of the event (This can be a fsm instance id or CSR_WIFI_FSM_ENV)
135 * @param[in] id : event id
136 *
137 * @return
138 * void
139 */
140extern void CsrWifiFsmSendEventExternal(CsrWifiFsmContext *context, CsrWifiFsmEvent *event, u16 source, u16 destination, CsrPrim primtype, u16 id);
141
142/**
143 * @brief
144 * Adds an Alien event to the FSM context's external event queue for processing
145 *
146 * @par Description
147 * Adds an event to the contexts external queue
148 * This is thread safe and adds an event to the fsm's external event queue.
149 *
150 * @param[in] context : FSM context
151 * @param[in] event : event to add to the event queue
152 * @param[in] source : source of the event (this can be a synergy task queue or an fsm instance id)
153 * @param[in] destination : destination of the event (This can be a fsm instance id or CSR_WIFI_FSM_ENV)
154 * @param[in] id : event id
155 */
156#define CsrWifiFsmSendAlienEventExternal(_context, _alienEvent, _source, _destination, _primtype, _id) \
157 { \
158 CsrWifiFsmAlienEvent *_evt = kmalloc(sizeof(CsrWifiFsmAlienEvent), GFP_KERNEL); \
159 _evt->alienEvent = _alienEvent; \
160 CsrWifiFsmSendEventExternal(_context, (CsrWifiFsmEvent *)_evt, _source, _destination, _primtype, _id); \
161 }
162
163
164/**
165 * @brief
166 * Current time of day in ms
167 *
168 * @param[in] context : FSM context
169 *
170 * @return
171 * u32 32 bit ms tick
172 */
173extern u32 CsrWifiFsmGetTimeOfDayMs(CsrWifiFsmContext *context);
174
175/**
176 * @brief
177 * Gets the time until the next FSM timer expiry
178 *
179 * @par Description
180 * Returns the next timeout time or 0 if no timers are set.
181 *
182 * @param[in] context : FSM context
183 *
184 * @return
185 * u32 Time in ms until next timeout or 0xFFFFFFFF for no timer set
186 */
187extern u32 CsrWifiFsmGetNextTimeout(CsrWifiFsmContext *context);
188
189/**
190 * @brief
191 * Fast forwards the fsm timers by ms Milliseconds
192 *
193 * @param[in] context : FSM context
194 * @param[in] ms : Milliseconds to fast forward by
195 *
196 * @return
197 * void
198 */
199extern void CsrWifiFsmFastForward(CsrWifiFsmContext *context, u16 ms);
200
201/**
202 * @brief
203 * shift the current time of day by ms amount
204 *
205 * @par Description
206 * useful to speed up tests where time needs to pass
207 *
208 * @param[in] context : FSM context
209 * @param[in] ms : ms to adjust time by
210 *
211 * @return
212 * void
213 */
214extern void CsrWifiFsmTestAdvanceTime(CsrWifiFsmContext *context, u32 ms);
215
216/**
217 * @brief
218 * Check if the fsm has events to process
219 *
220 * @param[in] context : FSM context
221 *
222 * @return
223 * u8 returns TRUE if there are events for the FSM to process
224 */
225extern u8 CsrWifiFsmHasEvents(CsrWifiFsmContext *context);
226
227/**
228 * @brief
229 * function that installs the contexts wakeup function
230 *
231 * @param[in] context : FSM context
232 * @param[in] callback : Callback function pointer
233 *
234 * @return
235 * void
236 */
237extern void CsrWifiFsmInstallWakeupCallback(CsrWifiFsmContext *context, CsrWifiFsmExternalWakupCallbackPtr callback);
238
239#endif /* CSR_WIFI_FSM_H */
240
diff --git a/drivers/staging/csr/csr_wifi_fsm_event.h b/drivers/staging/csr/csr_wifi_fsm_event.h
deleted file mode 100644
index 0690ca955ef5..000000000000
--- a/drivers/staging/csr/csr_wifi_fsm_event.h
+++ /dev/null
@@ -1,42 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11#ifndef CSR_WIFI_FSM_EVENT_H
12#define CSR_WIFI_FSM_EVENT_H
13
14#include "csr_prim_defs.h"
15#include "csr_sched.h"
16
17/**
18 * @brief
19 * FSM event header.
20 *
21 * @par Description
22 * All events MUST have this struct as the FIRST member.
23 * The next member is used internally for linked lists
24 */
25typedef struct CsrWifiFsmEvent
26{
27 CsrPrim type;
28 u16 primtype;
29 CsrSchedQid destination;
30 CsrSchedQid source;
31
32 /* Private pointer to allow an optimal Event list */
33 /* NOTE: Ignore this pointer.
34 * Do not waste code initializing OR freeing it.
35 * The pointer is used internally in the CsrWifiFsm code
36 * to avoid a second malloc when queuing events.
37 */
38 struct CsrWifiFsmEvent *next;
39} CsrWifiFsmEvent;
40
41#endif /* CSR_WIFI_FSM_EVENT_H */
42
diff --git a/drivers/staging/csr/csr_wifi_fsm_types.h b/drivers/staging/csr/csr_wifi_fsm_types.h
deleted file mode 100644
index d21c60a81fcf..000000000000
--- a/drivers/staging/csr/csr_wifi_fsm_types.h
+++ /dev/null
@@ -1,430 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11#ifndef CSR_WIFI_FSM_TYPES_H
12#define CSR_WIFI_FSM_TYPES_H
13
14#include <linux/types.h>
15#include "csr_macro.h"
16#include "csr_sched.h"
17
18#ifdef CSR_WIFI_FSM_MUTEX_ENABLE
19#include "csr_framework_ext.h"
20#endif
21
22#include "csr_wifi_fsm.h"
23
24#define CSR_WIFI_FSM_MAX_TRANSITION_HISTORY 10
25
26/**
27 * @brief
28 * FSM event list header.
29 *
30 * @par Description
31 * Singly linked list of events.
32 */
33typedef struct CsrWifiFsmEventList
34{
35 CsrWifiFsmEvent *first;
36 CsrWifiFsmEvent *last;
37} CsrWifiFsmEventList;
38
39
40/**
41 * @brief
42 * FSM timer id.
43 *
44 * @par Description
45 * Composite Id made up of the type, dest and a unique id so
46 * CsrWifiFsmRemoveTimer knows where to look when removing the timer
47 */
48typedef struct CsrWifiFsmTimerId
49{
50 CsrPrim type;
51 u16 primtype;
52 CsrSchedQid destination;
53 u16 uniqueid;
54} CsrWifiFsmTimerId;
55
56/**
57 * @brief
58 * FSM timer header.
59 *
60 * @par Description
61 * All timer MUST have this struct as the FIRST member.
62 * The first members of the structure MUST remain compatable
63 * with the CsrWifiFsmEvent so that timers are just specialised events
64 */
65typedef struct CsrWifiFsmTimer
66{
67 CsrPrim type;
68 u16 primtype;
69 CsrSchedQid destination;
70 CsrSchedQid source;
71
72 /* Private pointer to allow an optimal Event list */
73 struct CsrWifiFsmTimer *next;
74
75 CsrWifiFsmTimerId timerid;
76 u32 timeoutTimeMs;
77} CsrWifiFsmTimer;
78
79
80/**
81 * @brief
82 * Fsm Alien Event
83 *
84 * @par Description
85 * Allows the wrapping of alien events that do not use CsrWifiFsmEvent
86 * as the first member of the Event struct
87 */
88typedef struct
89{
90 CsrWifiFsmEvent event;
91 void *alienEvent;
92} CsrWifiFsmAlienEvent;
93
94
95/**
96 * @brief
97 * FSM timer list header.
98 *
99 * @par Description
100 * Singly linked list of timers.
101 */
102typedef struct CsrWifiFsmTimerList
103{
104 CsrWifiFsmTimer *first;
105 CsrWifiFsmTimer *last;
106 u16 nexttimerid;
107} CsrWifiFsmTimerList;
108
109/**
110 * @brief
111 * Process Entry Function Pointer
112 *
113 * @par Description
114 * Defines the entry function for a processes.
115 * Called at process initialisation.
116 *
117 * @param[in] context : FSM context
118 *
119 * @return
120 * void
121 */
122typedef void (*CsrWifiFsmProcEntryFnPtr)(CsrWifiFsmContext *context);
123
124/**
125 * @brief
126 * Process Transition Function Pointer
127 *
128 * @par Description
129 * Defines a transition function for a processes.
130 * Called when an event causes a transition on a process
131 *
132 * @param[in] CsrWifiFsmContext* : FSM context
133 * @param[in] void* : FSM data (can be NULL)
134 * @param[in] const CsrWifiFsmEvent* : event to process
135 *
136 * @return
137 * void
138 */
139typedef void (*CsrWifiFsmTransitionFnPtr)(CsrWifiFsmContext *context, void *fsmData, const CsrWifiFsmEvent *event);
140
141/**
142 * @brief
143 * Process reset/shutdown Function Pointer
144 *
145 * @par Description
146 * Defines the reset/shutdown function for a processes.
147 * Called to reset or shutdown an fsm.
148 *
149 * @param[in] context : FSM context
150 *
151 * @return
152 * void
153 */
154typedef void (*CsrWifiFsmProcResetFnPtr)(CsrWifiFsmContext *context);
155
156/**
157 * @brief
158 * FSM Default Destination CallbackFunction Pointer
159 *
160 * @par Description
161 * Defines the default destination function for the FSM
162 * to call when an event does not have a valid destination.
163 * This
164 *
165 * @param[in] context : External context
166 *
167 * @return
168 * u16 a valid destination OR CSR_WIFI_FSM_ENV
169 */
170typedef u16 (*CsrWifiFsmDestLookupCallbackPtr)(void *context, const CsrWifiFsmEvent *event);
171
172
173#ifdef CSR_WIFI_FSM_DUMP_ENABLE
174/**
175 * @brief
176 * Trace Dump Function Pointer
177 *
178 * @par Description
179 * Called when we want to trace the FSM
180 *
181 * @param[in] context : FSM context
182 * @param[in] id : fsm id
183 *
184 * @return
185 * void
186 */
187typedef void (*CsrWifiFsmDumpFnPtr)(CsrWifiFsmContext *context, void *fsmData);
188#endif
189
190/**
191 * @brief
192 * Event ID to transition function entry
193 *
194 * @par Description
195 * Event ID to Transition Entry in a state table.
196 */
197typedef struct
198{
199 u32 eventid;
200 CsrWifiFsmTransitionFnPtr transition;
201#ifdef CSR_LOG_ENABLE
202 const char *transitionName;
203#endif
204} CsrWifiFsmEventEntry;
205
206/**
207 * @brief
208 * Single State's Transition Table
209 *
210 * @par Description
211 * Stores Data for a single State's event to
212 * transition functions mapping
213 */
214typedef struct
215{
216 const u8 numEntries;
217 const u8 saveAll;
218 const CsrWifiFsmEventEntry *eventEntryArray; /* array of transition function pointers for state */
219#ifdef CSR_LOG_ENABLE
220 u16 stateNumber;
221 const char *stateName;
222#endif
223} CsrWifiFsmTableEntry;
224
225/**
226 * @brief
227 * Process State Transtion table
228 *
229 * @par Description
230 * Stores Data for a processes State to transition table
231 */
232typedef struct
233{
234 u16 numStates; /* number of states */
235 const CsrWifiFsmTableEntry *aStateEventMatrix; /* state event matrix */
236} CsrWifiFsmTransitionFunctionTable;
237
238/**
239 * @brief
240 * Const Process definition
241 *
242 * @par Description
243 * Constant process specification.
244 * This is ALL the non dynamic data that defines
245 * a process.
246 */
247typedef struct
248{
249 const char *processName;
250 const u32 processId;
251 const CsrWifiFsmTransitionFunctionTable transitionTable;
252 const CsrWifiFsmTableEntry unhandledTransitions;
253 const CsrWifiFsmTableEntry ignoreFunctions;
254 const CsrWifiFsmProcEntryFnPtr entryFn;
255 const CsrWifiFsmProcResetFnPtr resetFn;
256#ifdef CSR_WIFI_FSM_DUMP_ENABLE
257 const CsrWifiFsmDumpFnPtr dumpFn; /* Called to dump fsm specific trace if not NULL */
258#endif
259} CsrWifiFsmProcessStateMachine;
260
261#ifdef CSR_WIFI_FSM_DUMP_ENABLE
262/**
263 * @brief
264 * Storage for state transition info
265 */
266typedef struct
267{
268 u16 transitionNumber;
269 CsrWifiFsmEvent event;
270 u16 fromState;
271 u16 toState;
272 CsrWifiFsmTransitionFnPtr transitionFn;
273 u16 transitionCount; /* number consecutive of times this transition was seen */
274#ifdef CSR_LOG_ENABLE
275 const char *transitionName;
276#endif
277} CsrWifiFsmTransitionRecord;
278
279/**
280 * @brief
281 * Storage for the last state X transitions
282 */
283typedef struct
284{
285 u16 numTransitions;
286 CsrWifiFsmTransitionRecord records[CSR_WIFI_FSM_MAX_TRANSITION_HISTORY];
287} CsrWifiFsmTransitionRecords;
288#endif
289
290/**
291 * @brief
292 * Dynamic Process data
293 *
294 * @par Description
295 * Dynamic process data that is used to keep track of the
296 * state and data for a process instance
297 */
298typedef struct
299{
300 const CsrWifiFsmProcessStateMachine *fsmInfo; /* state machine info that is constant regardless of context */
301 u16 instanceId; /* Runtime process id */
302 u16 state; /* Current state */
303 void *params; /* Instance user data */
304 CsrWifiFsmEventList savedEventQueue; /* The saved event queue */
305 struct CsrWifiFsmInstanceEntry *subFsm; /* Sub Fsm instance data */
306 struct CsrWifiFsmInstanceEntry *subFsmCaller; /* The Fsm instance that created the SubFsm and should be used for callbacks*/
307#ifdef CSR_WIFI_FSM_DUMP_ENABLE
308 CsrWifiFsmTransitionRecords transitionRecords; /* Last X transitions in the FSM */
309#endif
310} CsrWifiFsmInstanceEntry;
311
312/**
313 * @brief
314 * OnCreate Callback Function Pointer
315 *
316 * @par Description
317 * Called when an fsm is created.
318 *
319 * @param[in] extContext : External context
320 * @param[in] instance : FSM instance
321 *
322 * @return
323 * void
324 */
325typedef void (*CsrWifiFsmOnCreateFnPtr)(void *extContext, const CsrWifiFsmInstanceEntry *instance);
326
327/**
328 * @brief
329 * OnTransition Callback Function Pointer
330 *
331 * @par Description
332 * Called when an event is processed by a fsm
333 *
334 * @param[in] extContext : External context
335 * @param[in] eventEntryArray : Entry data
336 * @param[in] event : Event
337 *
338 * @return
339 * void
340 */
341typedef void (*CsrWifiFsmOnTransitionFnPtr)(void *extContext, const CsrWifiFsmEventEntry *eventEntryArray, const CsrWifiFsmEvent *event);
342
343/**
344 * @brief
345 * OnStateChange Callback Function Pointer
346 *
347 * @par Description
348 * Called when CsrWifiFsmNextState is called
349 *
350 * @param[in] extContext : External context
351 *
352 * @return
353 * void
354 */
355typedef void (*CsrWifiFsmOnStateChangeFnPtr)(void *extContext, u16 nextstate);
356
357/**
358 * @brief
359 * OnIgnore,OnError or OnInvalid Callback Function Pointer
360 *
361 * @par Description
362 * Called when an event is processed by a fsm
363 *
364 * @param[in] extContext : External context
365 * @param[in] event : Event
366 *
367 * @return
368 * void
369 */
370typedef void (*CsrWifiFsmOnEventFnPtr)(void *extContext, const CsrWifiFsmEvent *event);
371
372/**
373 * @brief
374 * Toplevel FSM context data
375 *
376 * @par Description
377 * Holds ALL FSM static and dynamic data for a FSM
378 */
379struct CsrWifiFsmContext
380{
381 CsrWifiFsmEventList eventQueue; /* The internal event queue */
382 CsrWifiFsmEventList externalEventQueue; /* The external event queue */
383#ifdef CSR_WIFI_FSM_MUTEX_ENABLE
384 CsrMutexHandle externalEventQueueLock; /* The external event queue mutex */
385#endif
386 u32 timeOffset; /* Amount to adjust the TimeOfDayMs by */
387 CsrWifiFsmTimerList timerQueue; /* The internal timer queue */
388 u8 useTempSaveList; /* Should the temp save list be used */
389 CsrWifiFsmEventList tempSaveList; /* The temp save event queue */
390 CsrWifiFsmEvent *eventForwardedOrSaved; /* The event that was forwarded or Saved */
391 u16 maxProcesses; /* Size of instanceArray */
392 u16 numProcesses; /* Current number allocated in instanceArray */
393 CsrWifiFsmInstanceEntry *instanceArray; /* Array of processes for this component */
394 CsrWifiFsmInstanceEntry *ownerInstance; /* The Process that owns currentInstance (SubFsm support) */
395 CsrWifiFsmInstanceEntry *currentInstance; /* Current Process that is executing */
396 CsrWifiFsmExternalWakupCallbackPtr externalEventFn; /* External event Callback */
397 CsrWifiFsmOnEventFnPtr appIgnoreCallback; /* Application Ignore event Callback */
398 CsrWifiFsmDestLookupCallbackPtr appEvtDstCallback; /* Application Lookup event Destination Function*/
399
400 void *applicationContext; /* Internal fsm application context */
401 void *externalContext; /* External context (set by the user of the fsm)*/
402 CsrLogTextTaskId loggingTaskId; /* Task Id to use in any logging output */
403
404#ifndef CSR_WIFI_FSM_SCHEDULER_DISABLED
405 CsrSchedTid schedTimerId; /* Scheduler TimerId for use in Scheduler Tasks */
406 u32 schedTimerNexttimeoutMs; /* Next timeout time for the current timer */
407#endif
408
409#ifdef CSR_WIFI_FSM_MUTEX_ENABLE
410#ifdef CSR_WIFI_FSM_TRANSITION_LOCK
411 CsrMutexHandle transitionLock; /* Lock when calling transition functions */
412#endif
413#endif
414
415#ifdef CSR_LOG_ENABLE
416 CsrWifiFsmOnCreateFnPtr onCreate; /* Debug Transition Callback */
417 CsrWifiFsmOnTransitionFnPtr onTransition; /* Debug Transition Callback */
418 CsrWifiFsmOnTransitionFnPtr onUnhandedCallback; /* Unhanded event Callback */
419 CsrWifiFsmOnStateChangeFnPtr onStateChange; /* Debug State Change Callback */
420 CsrWifiFsmOnEventFnPtr onIgnoreCallback; /* Ignore event Callback */
421 CsrWifiFsmOnEventFnPtr onSaveCallback; /* Save event Callback */
422 CsrWifiFsmOnEventFnPtr onErrorCallback; /* Error event Callback */
423 CsrWifiFsmOnEventFnPtr onInvalidCallback; /* Invalid event Callback */
424#endif
425#ifdef CSR_WIFI_FSM_DUMP_ENABLE
426 u16 masterTransitionNumber; /* Increments on every transition */
427#endif
428};
429
430#endif /* CSR_WIFI_FSM_TYPES_H */
diff --git a/drivers/staging/csr/csr_wifi_hip_card.h b/drivers/staging/csr/csr_wifi_hip_card.h
deleted file mode 100644
index bd47f606e0de..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_card.h
+++ /dev/null
@@ -1,114 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/*
12 ******************************************************************************
13 * FILE : csr_wifi_hip_card.h
14 *
15 * PURPOSE : Defines abstract interface for hardware specific functions.
16 * Note, this is a different file from one of the same name in the
17 * Windows driver.
18 *
19 *****************************************************************************
20 */
21#ifndef __CARD_H__
22#define __CARD_H__
23
24#include "csr_wifi_hip_card_sdio.h"
25#include "csr_wifi_hip_signals.h"
26#include "csr_wifi_hip_unifi_udi.h"
27
28
29/*****************************************************************************
30 * CardEnableInt -
31 */
32CsrResult CardEnableInt(card_t *card);
33
34/*****************************************************************************
35 * CardGenInt -
36 */
37CsrResult CardGenInt(card_t *card);
38
39/*****************************************************************************
40 * CardPendingInt -
41 */
42CsrResult CardPendingInt(card_t *card, u8 *pintr);
43
44/*****************************************************************************
45 * CardDisableInt -
46 */
47CsrResult CardDisableInt(card_t *card);
48
49/*****************************************************************************
50 * CardClearInt -
51 */
52CsrResult CardClearInt(card_t *card);
53
54/*****************************************************************************
55 * CardDisable -
56 */
57void CardDisable(card_t *card);
58
59/*****************************************************************************
60 * CardIntEnabled -
61 */
62CsrResult CardIntEnabled(card_t *card, u8 *enabled);
63
64/*****************************************************************************
65 * CardGetDataSlotSize
66 */
67u16 CardGetDataSlotSize(card_t *card);
68
69/*****************************************************************************
70 * CardWriteBulkData -
71 */
72CsrResult CardWriteBulkData(card_t *card, card_signal_t *csptr, unifi_TrafficQueue queue);
73
74
75/*****************************************************************************
76 * CardClearFromHostDataSlot -
77 */
78void CardClearFromHostDataSlot(card_t *card, const s16 aSlotNum);
79
80#ifdef CSR_WIFI_REQUEUE_PACKET_TO_HAL
81/*****************************************************************************
82 * CardClearFromHostDataSlotWithoutFreeingBulkData - Clear the data stot
83 * without freeing the bulk data
84 */
85
86void CardClearFromHostDataSlotWithoutFreeingBulkData(card_t *card, const s16 aSlotNum);
87#endif
88
89/*****************************************************************************
90 * CardGetFreeFromHostDataSlots -
91 */
92u16 CardGetFreeFromHostDataSlots(card_t *card);
93
94u16 CardAreAllFromHostDataSlotsEmpty(card_t *card);
95
96CsrResult card_start_processor(card_t *card, enum unifi_dbg_processors_select which);
97
98CsrResult card_wait_for_firmware_to_start(card_t *card, u32 *paddr);
99
100CsrResult unifi_dl_firmware(card_t *card, void *arg);
101CsrResult unifi_dl_patch(card_t *card, void *arg, u32 boot_ctrl);
102CsrResult unifi_do_loader_op(card_t *card, u32 op_addr, u8 opcode);
103void* unifi_dl_fw_read_start(card_t *card, s8 is_fw);
104
105CsrResult unifi_coredump_handle_request(card_t *card);
106
107CsrResult ConvertCsrSdioToCsrHipResult(card_t *card, CsrResult csrResult);
108#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
109void unifi_debug_log_to_buf(const char *fmt, ...);
110void unifi_debug_string_to_buf(const char *str);
111void unifi_debug_hex_to_buf(const char *buff, u16 length);
112#endif
113
114#endif /* __CARD_H__ */
diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c b/drivers/staging/csr/csr_wifi_hip_card_sdio.c
deleted file mode 100644
index d5425325894c..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_card_sdio.c
+++ /dev/null
@@ -1,4001 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/*
12 * ---------------------------------------------------------------------------
13 * FILE: csr_wifi_hip_card_sdio.c
14 *
15 * PURPOSE: Implementation of the Card API for SDIO.
16 *
17 * NOTES:
18 * CardInit() is called from the SDIO probe callback when a card is
19 * inserted. This performs the basic SDIO initialisation, enabling i/o
20 * etc.
21 *
22 * ---------------------------------------------------------------------------
23 */
24#include <linux/slab.h>
25#include "csr_wifi_hip_unifi.h"
26#include "csr_wifi_hip_conversions.h"
27#include "csr_wifi_hip_unifiversion.h"
28#include "csr_wifi_hip_card.h"
29#include "csr_wifi_hip_card_sdio.h"
30#include "csr_wifi_hip_chiphelper.h"
31
32
33/* Time to wait between attempts to read MAILBOX0 */
34#define MAILBOX1_TIMEOUT 10 /* in millisecs */
35#define MAILBOX1_ATTEMPTS 200 /* 2 seconds */
36
37#define MAILBOX2_TIMEOUT 5 /* in millisecs */
38#define MAILBOX2_ATTEMPTS 10 /* 50ms */
39
40#define RESET_SETTLE_DELAY 25 /* in millisecs */
41
42static CsrResult card_init_slots(card_t *card);
43static CsrResult card_hw_init(card_t *card);
44static CsrResult firmware_present_in_flash(card_t *card);
45static void bootstrap_chip_hw(card_t *card);
46static CsrResult unifi_reset_hardware(card_t *card);
47static CsrResult unifi_hip_init(card_t *card);
48static CsrResult card_access_panic(card_t *card);
49static CsrResult unifi_read_chip_version(card_t *card);
50
51/*
52 * ---------------------------------------------------------------------------
53 * unifi_alloc_card
54 *
55 * Allocate and initialise the card context structure.
56 *
57 * Arguments:
58 * sdio Pointer to SDIO context pointer to pass to low
59 * level i/o functions.
60 * ospriv Pointer to O/S private struct to pass when calling
61 * callbacks to the higher level system.
62 *
63 * Returns:
64 * Pointer to card struct, which represents the driver context or
65 * NULL if the allocation failed.
66 * ---------------------------------------------------------------------------
67 */
68card_t* unifi_alloc_card(CsrSdioFunction *sdio, void *ospriv)
69{
70 card_t *card;
71 u32 i;
72
73
74 card = kzalloc(sizeof(card_t), GFP_KERNEL);
75 if (card == NULL)
76 {
77 return NULL;
78 }
79
80 card->sdio_if = sdio;
81 card->ospriv = ospriv;
82
83 card->unifi_interrupt_seq = 1;
84
85 /* Make these invalid. */
86 card->proc_select = (u32)(-1);
87 card->dmem_page = (u32)(-1);
88 card->pmem_page = (u32)(-1);
89
90 card->bh_reason_host = 0;
91 card->bh_reason_unifi = 0;
92
93 for (i = 0; i < sizeof(card->tx_q_paused_flag) / sizeof(card->tx_q_paused_flag[0]); i++)
94 {
95 card->tx_q_paused_flag[i] = 0;
96 }
97 card->memory_resources_allocated = 0;
98
99 card->low_power_mode = UNIFI_LOW_POWER_DISABLED;
100 card->periodic_wake_mode = UNIFI_PERIODIC_WAKE_HOST_DISABLED;
101
102 card->host_state = UNIFI_HOST_STATE_AWAKE;
103 card->intmode = CSR_WIFI_INTMODE_DEFAULT;
104
105 /*
106 * Memory resources for buffers are allocated when the chip is initialised
107 * because we need configuration information from the firmware.
108 */
109
110 /*
111 * Initialise wait queues and lists
112 */
113 card->fh_command_queue.q_body = card->fh_command_q_body;
114 card->fh_command_queue.q_length = UNIFI_SOFT_COMMAND_Q_LENGTH;
115
116 for (i = 0; i < UNIFI_NO_OF_TX_QS; i++)
117 {
118 card->fh_traffic_queue[i].q_body = card->fh_traffic_q_body[i];
119 card->fh_traffic_queue[i].q_length = UNIFI_SOFT_TRAFFIC_Q_LENGTH;
120 }
121
122
123 /* Initialise mini-coredump pointers in case no coredump buffers
124 * are requested by the OS layer.
125 */
126 card->request_coredump_on_reset = 0;
127 card->dump_next_write = NULL;
128 card->dump_cur_read = NULL;
129 card->dump_buf = NULL;
130
131#ifdef UNIFI_DEBUG
132 /* Determine offset of LSB in pointer for later alignment sanity check.
133 * Synergy integer types have specific widths, which cause compiler
134 * warnings when casting pointer types, e.g. on 64-bit systems.
135 */
136 {
137 u32 val = 0x01234567;
138
139 if (*((u8 *)&val) == 0x01)
140 {
141 card->lsb = sizeof(void *) - 1; /* BE */
142 }
143 else
144 {
145 card->lsb = 0; /* LE */
146 }
147 }
148#endif
149 return card;
150} /* unifi_alloc_card() */
151
152
153/*
154 * ---------------------------------------------------------------------------
155 * unifi_init_card
156 *
157 * Reset the hardware and perform HIP initialization
158 *
159 * Arguments:
160 * card Pointer to card struct
161 *
162 * Returns:
163 * CsrResult code
164 * CSR_RESULT_SUCCESS if successful
165 * ---------------------------------------------------------------------------
166 */
167CsrResult unifi_init_card(card_t *card, s32 led_mask)
168{
169 CsrResult r;
170
171
172 if (card == NULL)
173 {
174 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
175 }
176
177 r = unifi_init(card);
178 if (r != CSR_RESULT_SUCCESS)
179 {
180 return r;
181 }
182
183 r = unifi_hip_init(card);
184 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
185 {
186 return r;
187 }
188 if (r != CSR_RESULT_SUCCESS)
189 {
190 unifi_error(card->ospriv, "Failed to start host protocol.\n");
191 return r;
192 }
193
194 return CSR_RESULT_SUCCESS;
195}
196
197
198/*
199 * ---------------------------------------------------------------------------
200 * unifi_init
201 *
202 * Init the hardware.
203 *
204 * Arguments:
205 * card Pointer to card struct
206 *
207 * Returns:
208 * CsrResult code
209 * CSR_RESULT_SUCCESS if successful
210 * ---------------------------------------------------------------------------
211 */
212CsrResult unifi_init(card_t *card)
213{
214 CsrResult r;
215 CsrResult csrResult;
216
217 if (card == NULL)
218 {
219 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
220 }
221
222 /*
223 * Disable the SDIO interrupts while initialising UniFi.
224 * Re-enable them when f/w is running.
225 */
226 csrResult = CsrSdioInterruptDisable(card->sdio_if);
227 if (csrResult == CSR_SDIO_RESULT_NO_DEVICE)
228 {
229 return CSR_WIFI_HIP_RESULT_NO_DEVICE;
230 }
231
232 /*
233 * UniFi's PLL may start with a slow clock (~ 1 MHz) so initially
234 * set the SDIO bus clock to a similar value or SDIO accesses may
235 * fail.
236 */
237 csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_SAFE_HZ);
238 if (csrResult != CSR_RESULT_SUCCESS)
239 {
240 r = ConvertCsrSdioToCsrHipResult(card, csrResult);
241 return r;
242 }
243 card->sdio_clock_speed = UNIFI_SDIO_CLOCK_SAFE_HZ;
244
245 /*
246 * Reset UniFi. Note, this only resets the WLAN function part of the chip,
247 * the SDIO interface is not reset.
248 */
249 unifi_trace(card->ospriv, UDBG1, "Resetting UniFi\n");
250 r = unifi_reset_hardware(card);
251 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
252 {
253 return r;
254 }
255 if (r != CSR_RESULT_SUCCESS)
256 {
257 unifi_error(card->ospriv, "Failed to reset UniFi\n");
258 return r;
259 }
260
261 /* Reset the power save mode, to be active until the MLME-reset is complete */
262 r = unifi_configure_low_power_mode(card,
263 UNIFI_LOW_POWER_DISABLED, UNIFI_PERIODIC_WAKE_HOST_DISABLED);
264 if (r != CSR_RESULT_SUCCESS)
265 {
266 unifi_error(card->ospriv, "Failed to set power save mode\n");
267 return r;
268 }
269
270 /*
271 * Set initial value of page registers.
272 * The page registers will be maintained by unifi_read...() and
273 * unifi_write...().
274 */
275 card->proc_select = (u32)(-1);
276 card->dmem_page = (u32)(-1);
277 card->pmem_page = (u32)(-1);
278 r = unifi_write_direct16(card, ChipHelper_HOST_WINDOW3_PAGE(card->helper) * 2, 0);
279 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
280 {
281 return r;
282 }
283 if (r != CSR_RESULT_SUCCESS)
284 {
285 unifi_error(card->ospriv, "Failed to write SHARED_DMEM_PAGE\n");
286 return r;
287 }
288 r = unifi_write_direct16(card, ChipHelper_HOST_WINDOW2_PAGE(card->helper) * 2, 0);
289 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
290 {
291 return r;
292 }
293 if (r != CSR_RESULT_SUCCESS)
294 {
295 unifi_error(card->ospriv, "Failed to write PROG_MEM2_PAGE\n");
296 return r;
297 }
298
299 /*
300 * If the driver has reset UniFi due to previous SDIO failure, this may
301 * have been due to a chip watchdog reset. In this case, the driver may
302 * have requested a mini-coredump which needs to be captured now the
303 * SDIO interface is alive.
304 */
305 (void)unifi_coredump_handle_request(card);
306
307 /*
308 * Probe to see if the UniFi has ROM/flash to boot from. CSR6xxx should do.
309 */
310 r = firmware_present_in_flash(card);
311 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
312 {
313 return r;
314 }
315 if (r == CSR_WIFI_HIP_RESULT_NOT_FOUND)
316 {
317 unifi_error(card->ospriv, "No firmware found\n");
318 }
319 else if (r != CSR_RESULT_SUCCESS)
320 {
321 unifi_error(card->ospriv, "Probe for Flash failed\n");
322 }
323
324 return r;
325} /* unifi_init() */
326
327
328/*
329 * ---------------------------------------------------------------------------
330 * unifi_download
331 *
332 * Load the firmware.
333 *
334 * Arguments:
335 * card Pointer to card struct
336 * led_mask Loader LED mask
337 *
338 * Returns:
339 * CSR_RESULT_SUCCESS on success
340 * CsrResult error code on failure.
341 * ---------------------------------------------------------------------------
342 */
343CsrResult unifi_download(card_t *card, s32 led_mask)
344{
345 CsrResult r;
346 void *dlpriv;
347
348 if (card == NULL)
349 {
350 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
351 }
352
353 /* Set the loader led mask */
354 card->loader_led_mask = led_mask;
355
356 /* Get the firmware file information */
357 unifi_trace(card->ospriv, UDBG1, "downloading firmware...\n");
358
359 dlpriv = unifi_dl_fw_read_start(card, UNIFI_FW_STA);
360 if (dlpriv == NULL)
361 {
362 return CSR_WIFI_HIP_RESULT_NOT_FOUND;
363 }
364
365 /* Download the firmware. */
366 r = unifi_dl_firmware(card, dlpriv);
367 if (r != CSR_RESULT_SUCCESS)
368 {
369 unifi_error(card->ospriv, "Failed to download firmware\n");
370 return r;
371 }
372
373 /* Free the firmware file information. */
374 unifi_fw_read_stop(card->ospriv, dlpriv);
375
376 return CSR_RESULT_SUCCESS;
377} /* unifi_download() */
378
379
380/*
381 * ---------------------------------------------------------------------------
382 * unifi_hip_init
383 *
384 * This function performs the f/w initialisation sequence as described
385 * in the Unifi Host Interface Protocol Specification.
386 * It allocates memory for host-side slot data and signal queues.
387 *
388 * Arguments:
389 * card Pointer to card struct
390 *
391 * Returns:
392 * CSR_RESULT_SUCCESS on success or else a CSR error code
393 *
394 * Notes:
395 * The firmware must have been downloaded.
396 * ---------------------------------------------------------------------------
397 */
398static CsrResult unifi_hip_init(card_t *card)
399{
400 CsrResult r;
401 CsrResult csrResult;
402
403 r = card_hw_init(card);
404 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
405 {
406 return r;
407 }
408 if (r != CSR_RESULT_SUCCESS)
409 {
410 unifi_error(card->ospriv, "Failed to establish communication with UniFi\n");
411 return r;
412 }
413#ifdef CSR_PRE_ALLOC_NET_DATA
414 /* if there is any preallocated netdata left from the prev session free it now */
415 prealloc_netdata_free(card);
416#endif
417 /*
418 * Allocate memory for host-side slot data and signal queues.
419 * We need the config info read from the firmware to know how much
420 * memory to allocate.
421 */
422 r = card_init_slots(card);
423 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
424 {
425 return r;
426 }
427 if (r != CSR_RESULT_SUCCESS)
428 {
429 unifi_error(card->ospriv, "Init slots failed: %d\n", r);
430 return r;
431 }
432
433 unifi_trace(card->ospriv, UDBG2, "Sending first UniFi interrupt\n");
434
435 r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE);
436 if (r != CSR_RESULT_SUCCESS)
437 {
438 return r;
439 }
440
441 /* Enable the SDIO interrupts now that the f/w is running. */
442 csrResult = CsrSdioInterruptEnable(card->sdio_if);
443 if (csrResult == CSR_SDIO_RESULT_NO_DEVICE)
444 {
445 return CSR_WIFI_HIP_RESULT_NO_DEVICE;
446 }
447
448 /* Signal the UniFi to start handling messages */
449 r = CardGenInt(card);
450 if (r != CSR_RESULT_SUCCESS)
451 {
452 return r;
453 }
454
455 return CSR_RESULT_SUCCESS;
456} /* unifi_hip_init() */
457
458
459/*
460 * ---------------------------------------------------------------------------
461 * _build_sdio_config_data
462 *
463 * Unpack the SDIO configuration information from a buffer read from
464 * UniFi into a host structure.
465 * The data is byte-swapped for a big-endian host if necessary by the
466 * UNPACK... macros.
467 *
468 * Arguments:
469 * card Pointer to card struct
470 * cfg_data Destination structure to unpack into.
471 * cfg_data_buf Source buffer to read from. This should be the raw
472 * data read from UniFi.
473 *
474 * Returns:
475 * None.
476 * ---------------------------------------------------------------------------
477 */
478static void _build_sdio_config_data(sdio_config_data_t *cfg_data,
479 const u8 *cfg_data_buf)
480{
481 s16 offset = 0;
482
483 cfg_data->version = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset);
484 offset += SIZEOF_UINT16;
485
486 cfg_data->sdio_ctrl_offset = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset);
487 offset += SIZEOF_UINT16;
488
489 cfg_data->fromhost_sigbuf_handle = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset);
490 offset += SIZEOF_UINT16;
491
492 cfg_data->tohost_sigbuf_handle = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset);
493 offset += SIZEOF_UINT16;
494
495 cfg_data->num_fromhost_sig_frags = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset);
496 offset += SIZEOF_UINT16;
497
498 cfg_data->num_tohost_sig_frags = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset);
499 offset += SIZEOF_UINT16;
500
501 cfg_data->num_fromhost_data_slots = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset);
502 offset += SIZEOF_UINT16;
503
504 cfg_data->num_tohost_data_slots = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset);
505 offset += SIZEOF_UINT16;
506
507 cfg_data->data_slot_size = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset);
508 offset += SIZEOF_UINT16;
509
510 cfg_data->initialised = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset);
511 offset += SIZEOF_UINT16;
512
513 cfg_data->overlay_size = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(cfg_data_buf + offset);
514 offset += SIZEOF_UINT32;
515
516 cfg_data->data_slot_round = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset);
517 offset += SIZEOF_UINT16;
518
519 cfg_data->sig_frag_size = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset);
520 offset += SIZEOF_UINT16;
521
522 cfg_data->tohost_signal_padding = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cfg_data_buf + offset);
523} /* _build_sdio_config_data() */
524
525
526/*
527 * - Function ----------------------------------------------------------------
528 * card_hw_init()
529 *
530 * Perform the initialisation procedure described in the UniFi Host
531 * Interface Protocol document (section 3.3.8) and read the run-time
532 * configuration information from the UniFi. This is stuff like number
533 * of bulk data slots etc.
534 *
535 * The card enumeration and SD initialisation has already been done by
536 * the SDIO library, see card_sdio_init().
537 *
538 * The initialisation is done when firmware is ready, i.e. this may need
539 * to be called after a f/w download operation.
540 *
541 * The initialisation procedure goes like this:
542 * - Wait for UniFi to start-up by polling SHARED_MAILBOX1
543 * - Find the symbol table and look up SLT_SDIO_SLOT_CONFIG
544 * - Read the config structure
545 * - Check the "SDIO initialised" flag, if not zero do a h/w reset and
546 * start again
547 * - Decide the number of bulk data slots to allocate, allocate them and
548 * set "SDIO initialised" flag (and generate an interrupt) to say so.
549 *
550 * Arguments:
551 * card Pointer to card struct
552 *
553 * Returns:
554 * CSR_RESULT_SUCEESS on success,
555 * a CSR error code on failure
556 *
557 * Notes:
558 * All data in the f/w is stored in a little endian format, without any
559 * padding bytes. Every read from this memory has to be transformed in
560 * host (cpu specific) format, before it is stored in driver's parameters
561 * or/and structures. Athough unifi_card_read16() and unifi_read32() do perform
562 * the conversion internally, unifi_readn() does not.
563 * ---------------------------------------------------------------------------
564 */
565static CsrResult card_hw_init(card_t *card)
566{
567 u32 slut_address;
568 u16 initialised;
569 u16 finger_print;
570 symbol_t slut;
571 sdio_config_data_t *cfg_data;
572 u8 cfg_data_buf[SDIO_CONFIG_DATA_SIZE];
573 CsrResult r;
574 void *dlpriv;
575 s16 major, minor;
576 s16 search_4slut_again;
577 CsrResult csrResult;
578
579 /*
580 * The device revision from the TPLMID_MANF and TPLMID_CARD fields
581 * of the CIS are available as
582 * card->sdio_if->pDevice->ManfID
583 * card->sdio_if->pDevice->AppID
584 */
585
586 /*
587 * Run in a loop so we can patch.
588 */
589 do
590 {
591 /* Reset these each time around the loop. */
592 search_4slut_again = 0;
593 cfg_data = NULL;
594
595 r = card_wait_for_firmware_to_start(card, &slut_address);
596 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
597 {
598 return r;
599 }
600 if (r != CSR_RESULT_SUCCESS)
601 {
602 unifi_error(card->ospriv, "Firmware hasn't started\n");
603 return r;
604 }
605 unifi_trace(card->ospriv, UDBG4, "SLUT addr 0x%lX\n", slut_address);
606
607 /*
608 * Firmware has started, but doesn't know full clock configuration yet
609 * as some of the information may be in the MIB. Therefore we set an
610 * initial SDIO clock speed, faster than UNIFI_SDIO_CLOCK_SAFE_HZ, for
611 * the patch download and subsequent firmware initialisation, and
612 * full speed UNIFI_SDIO_CLOCK_MAX_HZ will be set once the f/w tells us
613 * that it is ready.
614 */
615 csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_INIT_HZ);
616 if (csrResult != CSR_RESULT_SUCCESS)
617 {
618 r = ConvertCsrSdioToCsrHipResult(card, csrResult);
619 return r;
620 }
621 card->sdio_clock_speed = UNIFI_SDIO_CLOCK_INIT_HZ;
622
623 /*
624 * Check the SLUT fingerprint.
625 * The slut_address is a generic pointer so we must use unifi_card_read16().
626 */
627 unifi_trace(card->ospriv, UDBG4, "Looking for SLUT finger print\n");
628 finger_print = 0;
629 r = unifi_card_read16(card, slut_address, &finger_print);
630 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
631 {
632 return r;
633 }
634 if (r != CSR_RESULT_SUCCESS)
635 {
636 unifi_error(card->ospriv, "Failed to read SLUT finger print\n");
637 return r;
638 }
639
640 if (finger_print != SLUT_FINGERPRINT)
641 {
642 unifi_error(card->ospriv, "Failed to find Symbol lookup table fingerprint\n");
643 return CSR_RESULT_FAILURE;
644 }
645
646 /* Symbol table starts imedately after the fingerprint */
647 slut_address += 2;
648
649 /* Search the table until either the end marker is found, or the
650 * loading of patch firmware invalidates the current table.
651 */
652 while (!search_4slut_again)
653 {
654 u16 s;
655 u32 l;
656
657 r = unifi_card_read16(card, slut_address, &s);
658 if (r != CSR_RESULT_SUCCESS)
659 {
660 return r;
661 }
662 slut_address += 2;
663
664 if (s == CSR_SLT_END)
665 {
666 unifi_trace(card->ospriv, UDBG3, " found CSR_SLT_END\n");
667 break;
668 }
669
670 r = unifi_read32(card, slut_address, &l);
671 if (r != CSR_RESULT_SUCCESS)
672 {
673 return r;
674 }
675 slut_address += 4;
676
677 slut.id = s;
678 slut.obj = l;
679
680 unifi_trace(card->ospriv, UDBG3, " found SLUT id %02d.%08lx\n", slut.id, slut.obj);
681 switch (slut.id)
682 {
683 case CSR_SLT_SDIO_SLOT_CONFIG:
684 cfg_data = &card->config_data;
685 /*
686 * unifi_card_readn reads n bytes from the card, where data is stored
687 * in a little endian format, without any padding bytes. So, we
688 * can not just pass the cfg_data pointer or use the
689 * sizeof(sdio_config_data_t) since the structure in the host can
690 * be big endian formatted or have padding bytes for alignment.
691 * We use a char buffer to read the data from the card.
692 */
693 r = unifi_card_readn(card, slut.obj, cfg_data_buf, SDIO_CONFIG_DATA_SIZE);
694 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
695 {
696 return r;
697 }
698 if (r != CSR_RESULT_SUCCESS)
699 {
700 unifi_error(card->ospriv, "Failed to read config data\n");
701 return r;
702 }
703 /* .. and then we copy the data to the host structure */
704 _build_sdio_config_data(cfg_data, cfg_data_buf);
705
706 /* Make sure the from host data slots are what we expect
707 we reserve 2 for commands and there should be at least
708 1 left for each access category */
709 if ((cfg_data->num_fromhost_data_slots < UNIFI_RESERVED_COMMAND_SLOTS)
710 || (cfg_data->num_fromhost_data_slots - UNIFI_RESERVED_COMMAND_SLOTS) / UNIFI_NO_OF_TX_QS == 0)
711 {
712 unifi_error(card->ospriv, "From host data slots %d\n", cfg_data->num_fromhost_data_slots);
713 unifi_error(card->ospriv, "need to be (queues * x + 2) (UNIFI_RESERVED_COMMAND_SLOTS for commands)\n");
714 return CSR_RESULT_FAILURE;
715 }
716
717 /* Configure SDIO to-block-size padding */
718 if (card->sdio_io_block_pad)
719 {
720 /*
721 * Firmware limits the maximum padding size via data_slot_round.
722 * Therefore when padding to whole block sizes, the block size
723 * must be configured correctly by adjusting CSR_WIFI_HIP_SDIO_BLOCK_SIZE.
724 */
725 if (cfg_data->data_slot_round < card->sdio_io_block_size)
726 {
727 unifi_error(card->ospriv,
728 "Configuration error: Block size of %d exceeds f/w data_slot_round of %d\n",
729 card->sdio_io_block_size, cfg_data->data_slot_round);
730 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
731 }
732
733 /*
734 * To force the To-Host signals to be rounded up to the SDIO block
735 * size, we need to write the To-Host Signal Padding Fragments
736 * field of the SDIO configuration in UniFi.
737 */
738 if ((card->sdio_io_block_size % cfg_data->sig_frag_size) != 0)
739 {
740 unifi_error(card->ospriv, "Configuration error: Can not pad to-host signals.\n");
741 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
742 }
743 cfg_data->tohost_signal_padding = (u16) (card->sdio_io_block_size / cfg_data->sig_frag_size);
744 unifi_info(card->ospriv, "SDIO block size %d requires %d padding chunks\n",
745 card->sdio_io_block_size, cfg_data->tohost_signal_padding);
746 r = unifi_card_write16(card, slut.obj + SDIO_TO_HOST_SIG_PADDING_OFFSET, cfg_data->tohost_signal_padding);
747 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
748 {
749 return r;
750 }
751 if (r != CSR_RESULT_SUCCESS)
752 {
753 unifi_error(card->ospriv, "Failed to write To-Host Signal Padding Fragments\n");
754 return r;
755 }
756 }
757
758 /* Reconstruct the Generic Pointer address of the
759 * SDIO Control Data Struct.
760 */
761 card->sdio_ctrl_addr = cfg_data->sdio_ctrl_offset | (UNIFI_SH_DMEM << 24);
762 card->init_flag_addr = slut.obj + SDIO_INIT_FLAG_OFFSET;
763 break;
764
765 case CSR_SLT_BUILD_ID_NUMBER:
766 {
767 u32 n;
768 r = unifi_read32(card, slut.obj, &n);
769 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
770 {
771 return r;
772 }
773 if (r != CSR_RESULT_SUCCESS)
774 {
775 unifi_error(card->ospriv, "Failed to read build id\n");
776 return r;
777 }
778 card->build_id = n;
779 }
780 break;
781
782 case CSR_SLT_BUILD_ID_STRING:
783 r = unifi_readnz(card, slut.obj, card->build_id_string,
784 sizeof(card->build_id_string));
785 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
786 {
787 return r;
788 }
789 if (r != CSR_RESULT_SUCCESS)
790 {
791 unifi_error(card->ospriv, "Failed to read build string\n");
792 return r;
793 }
794 break;
795
796 case CSR_SLT_PERSISTENT_STORE_DB:
797 break;
798
799 case CSR_SLT_BOOT_LOADER_CONTROL:
800
801 /* This command copies most of the station firmware
802 * image from ROM into program RAM. It also clears
803 * out the zerod data and sets up the initialised
804 * data. */
805 r = unifi_do_loader_op(card, slut.obj + 6, UNIFI_BOOT_LOADER_LOAD_STA);
806 if (r != CSR_RESULT_SUCCESS)
807 {
808 unifi_error(card->ospriv, "Failed to write loader load image command\n");
809 return r;
810 }
811
812 dlpriv = unifi_dl_fw_read_start(card, UNIFI_FW_STA);
813
814 /* dlpriv might be NULL, we still need to do the do_loader_op step. */
815 if (dlpriv != NULL)
816 {
817 /* Download the firmware. */
818 r = unifi_dl_patch(card, dlpriv, slut.obj);
819
820 /* Free the firmware file information. */
821 unifi_fw_read_stop(card->ospriv, dlpriv);
822
823 if (r != CSR_RESULT_SUCCESS)
824 {
825 unifi_error(card->ospriv, "Failed to patch firmware\n");
826 return r;
827 }
828 }
829
830 /* This command starts the firmware image that we want (the
831 * station by default) with any patches required applied. */
832 r = unifi_do_loader_op(card, slut.obj + 6, UNIFI_BOOT_LOADER_RESTART);
833 if (r != CSR_RESULT_SUCCESS)
834 {
835 unifi_error(card->ospriv, "Failed to write loader restart command\n");
836 return r;
837 }
838
839 /* The now running patch f/w defines a new SLUT data structure -
840 * the current one is no longer valid. We must drop out of the
841 * processing loop and enumerate the new SLUT (which may appear
842 * at a different offset).
843 */
844 search_4slut_again = 1;
845 break;
846
847 case CSR_SLT_PANIC_DATA_PHY:
848 card->panic_data_phy_addr = slut.obj;
849 break;
850
851 case CSR_SLT_PANIC_DATA_MAC:
852 card->panic_data_mac_addr = slut.obj;
853 break;
854
855 default:
856 /* do nothing */
857 break;
858 }
859 } /* while */
860 } while (search_4slut_again);
861
862 /* Did we find the Config Data ? */
863 if (cfg_data == NULL)
864 {
865 unifi_error(card->ospriv, "Failed to find SDIO_SLOT_CONFIG Symbol\n");
866 return CSR_RESULT_FAILURE;
867 }
868
869 /*
870 * Has ths card already been initialised?
871 * If so, return an error so we do a h/w reset and start again.
872 */
873 r = unifi_card_read16(card, card->init_flag_addr, &initialised);
874 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
875 {
876 return r;
877 }
878 if (r != CSR_RESULT_SUCCESS)
879 {
880 unifi_error(card->ospriv, "Failed to read init flag at %08lx\n",
881 card->init_flag_addr);
882 return r;
883 }
884 if (initialised != 0)
885 {
886 return CSR_RESULT_FAILURE;
887 }
888
889
890 /*
891 * Now check the UniFi firmware version
892 */
893 major = (cfg_data->version >> 8) & 0xFF;
894 minor = cfg_data->version & 0xFF;
895 unifi_info(card->ospriv, "UniFi f/w protocol version %d.%d (driver %d.%d)\n",
896 major, minor,
897 UNIFI_HIP_MAJOR_VERSION, UNIFI_HIP_MINOR_VERSION);
898
899 unifi_info(card->ospriv, "Firmware build %u: %s\n",
900 card->build_id, card->build_id_string);
901
902 if (major != UNIFI_HIP_MAJOR_VERSION)
903 {
904 unifi_error(card->ospriv, "UniFi f/w protocol major version (%d) is different from driver (v%d.%d)\n",
905 major, UNIFI_HIP_MAJOR_VERSION, UNIFI_HIP_MINOR_VERSION);
906#ifndef CSR_WIFI_DISABLE_HIP_VERSION_CHECK
907 return CSR_RESULT_FAILURE;
908#endif
909 }
910 if (minor < UNIFI_HIP_MINOR_VERSION)
911 {
912 unifi_error(card->ospriv, "UniFi f/w protocol version (v%d.%d) is older than minimum required by driver (v%d.%d).\n",
913 major, minor,
914 UNIFI_HIP_MAJOR_VERSION, UNIFI_HIP_MINOR_VERSION);
915#ifndef CSR_WIFI_DISABLE_HIP_VERSION_CHECK
916 return CSR_RESULT_FAILURE;
917#endif
918 }
919
920 /* Read panic codes from a previous firmware panic. If the firmware has
921 * not panicked since power was applied (e.g. power-off hard reset)
922 * the stored panic codes will not be updated.
923 */
924 unifi_read_panic(card);
925
926 return CSR_RESULT_SUCCESS;
927} /* card_hw_init() */
928
929
930/*
931 * ---------------------------------------------------------------------------
932 * card_wait_for_unifi_to_reset
933 *
934 * Waits for a reset to complete by polling the WLAN function enable
935 * bit (which is cleared on reset).
936 *
937 * Arguments:
938 * card Pointer to card struct
939 *
940 * Returns:
941 * CSR_RESULT_SUCCESS on success, CSR error code on failure.
942 * ---------------------------------------------------------------------------
943 */
944static CsrResult card_wait_for_unifi_to_reset(card_t *card)
945{
946 s16 i;
947 CsrResult r;
948 u8 io_enable;
949 CsrResult csrResult;
950
951 r = CSR_RESULT_SUCCESS;
952 for (i = 0; i < MAILBOX2_ATTEMPTS; i++)
953 {
954 unifi_trace(card->ospriv, UDBG1, "waiting for reset to complete, attempt %d\n", i);
955 if (card->chip_id > SDIO_CARD_ID_UNIFI_2)
956 {
957 /* It's quite likely that this read will timeout for the
958 * first few tries - especially if we have reset via
959 * DBG_RESET.
960 */
961#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE)
962 unifi_debug_log_to_buf("m0@%02X=", SDIO_IO_READY);
963#endif
964 csrResult = CsrSdioF0Read8(card->sdio_if, SDIO_IO_READY, &io_enable);
965#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE)
966 if (csrResult != CSR_RESULT_SUCCESS)
967 {
968 unifi_debug_log_to_buf("error=%X\n", csrResult);
969 }
970 else
971 {
972 unifi_debug_log_to_buf("%X\n", io_enable);
973 }
974#endif
975 if (csrResult == CSR_SDIO_RESULT_NO_DEVICE)
976 {
977 return CSR_WIFI_HIP_RESULT_NO_DEVICE;
978 }
979 r = CSR_RESULT_SUCCESS;
980 if (csrResult != CSR_RESULT_SUCCESS)
981 {
982 r = ConvertCsrSdioToCsrHipResult(card, csrResult);
983 }
984 }
985 else
986 {
987 r = sdio_read_f0(card, SDIO_IO_ENABLE, &io_enable);
988 }
989 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
990 {
991 return r;
992 }
993 if (r == CSR_RESULT_SUCCESS)
994 {
995 u16 mbox2;
996 s16 enabled = io_enable & (1 << card->function);
997
998 if (!enabled)
999 {
1000 unifi_trace(card->ospriv, UDBG1,
1001 "Reset complete (function %d is disabled) in ~ %u msecs\n",
1002 card->function, i * MAILBOX2_TIMEOUT);
1003
1004 /* Enable WLAN function and verify MAILBOX2 is zero'd */
1005 csrResult = CsrSdioFunctionEnable(card->sdio_if);
1006 if (csrResult != CSR_RESULT_SUCCESS)
1007 {
1008 r = ConvertCsrSdioToCsrHipResult(card, csrResult);
1009 unifi_error(card->ospriv, "CsrSdioFunctionEnable failed %d\n", r);
1010 break;
1011 }
1012 }
1013
1014 r = unifi_read_direct16(card, ChipHelper_SDIO_HIP_HANDSHAKE(card->helper) * 2, &mbox2);
1015 if (r != CSR_RESULT_SUCCESS)
1016 {
1017 unifi_error(card->ospriv, "read HIP_HANDSHAKE failed %d\n", r);
1018 break;
1019 }
1020 if (mbox2 != 0)
1021 {
1022 unifi_error(card->ospriv, "MAILBOX2 non-zero after reset (mbox2 = %04x)\n", mbox2);
1023 r = CSR_RESULT_FAILURE;
1024 }
1025 break;
1026 }
1027 else
1028 {
1029 if (card->chip_id > SDIO_CARD_ID_UNIFI_2)
1030 {
1031 /* We ignore read failures for the first few reads,
1032 * they are probably benign. */
1033 if (i > MAILBOX2_ATTEMPTS / 4)
1034 {
1035 unifi_trace(card->ospriv, UDBG1, "Failed to read CCCR IO Ready register while polling for reset\n");
1036 }
1037 }
1038 else
1039 {
1040 unifi_trace(card->ospriv, UDBG1, "Failed to read CCCR IO Enable register while polling for reset\n");
1041 }
1042 }
1043 CsrThreadSleep(MAILBOX2_TIMEOUT);
1044 }
1045
1046 if (r == CSR_RESULT_SUCCESS && i == MAILBOX2_ATTEMPTS)
1047 {
1048 unifi_trace(card->ospriv, UDBG1, "Timeout waiting for UniFi to complete reset\n");
1049 r = CSR_RESULT_FAILURE;
1050 }
1051
1052 return r;
1053} /* card_wait_for_unifi_to_reset() */
1054
1055
1056/*
1057 * ---------------------------------------------------------------------------
1058 * card_wait_for_unifi_to_disable
1059 *
1060 * Waits for the function to become disabled by polling the
1061 * IO_READY bit.
1062 *
1063 * Arguments:
1064 * card Pointer to card struct
1065 *
1066 * Returns:
1067 * CSR_RESULT_SUCCESS on success, CSR error code on failure.
1068 *
1069 * Notes: This function can only be used with
1070 * card->chip_id > SDIO_CARD_ID_UNIFI_2
1071 * ---------------------------------------------------------------------------
1072 */
1073static CsrResult card_wait_for_unifi_to_disable(card_t *card)
1074{
1075 s16 i;
1076 CsrResult r;
1077 u8 io_enable;
1078 CsrResult csrResult;
1079
1080 if (card->chip_id <= SDIO_CARD_ID_UNIFI_2)
1081 {
1082 unifi_error(card->ospriv,
1083 "Function reset method not supported for chip_id=%d\n",
1084 card->chip_id);
1085 return CSR_RESULT_FAILURE;
1086 }
1087
1088 r = CSR_RESULT_SUCCESS;
1089 for (i = 0; i < MAILBOX2_ATTEMPTS; i++)
1090 {
1091 unifi_trace(card->ospriv, UDBG1, "waiting for disable to complete, attempt %d\n", i);
1092
1093 /*
1094 * It's quite likely that this read will timeout for the
1095 * first few tries - especially if we have reset via
1096 * DBG_RESET.
1097 */
1098#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE)
1099 unifi_debug_log_to_buf("r0@%02X=", SDIO_IO_READY);
1100#endif
1101 csrResult = CsrSdioF0Read8(card->sdio_if, SDIO_IO_READY, &io_enable);
1102#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE)
1103 if (csrResult != CSR_RESULT_SUCCESS)
1104 {
1105 unifi_debug_log_to_buf("error=%X\n", csrResult);
1106 }
1107 else
1108 {
1109 unifi_debug_log_to_buf("%X\n", io_enable);
1110 }
1111#endif
1112 if (csrResult == CSR_SDIO_RESULT_NO_DEVICE)
1113 {
1114 return CSR_WIFI_HIP_RESULT_NO_DEVICE;
1115 }
1116 if (csrResult == CSR_RESULT_SUCCESS)
1117 {
1118 s16 enabled = io_enable & (1 << card->function);
1119 r = CSR_RESULT_SUCCESS;
1120 if (!enabled)
1121 {
1122 unifi_trace(card->ospriv, UDBG1,
1123 "Disable complete (function %d is disabled) in ~ %u msecs\n",
1124 card->function, i * MAILBOX2_TIMEOUT);
1125
1126 break;
1127 }
1128 }
1129 else
1130 {
1131 /*
1132 * We ignore read failures for the first few reads,
1133 * they are probably benign.
1134 */
1135 r = ConvertCsrSdioToCsrHipResult(card, csrResult);
1136 if (i > (MAILBOX2_ATTEMPTS / 4))
1137 {
1138 unifi_trace(card->ospriv, UDBG1,
1139 "Failed to read CCCR IO Ready register while polling for disable\n");
1140 }
1141 }
1142 CsrThreadSleep(MAILBOX2_TIMEOUT);
1143 }
1144
1145 if ((r == CSR_RESULT_SUCCESS) && (i == MAILBOX2_ATTEMPTS))
1146 {
1147 unifi_trace(card->ospriv, UDBG1, "Timeout waiting for UniFi to complete disable\n");
1148 r = CSR_RESULT_FAILURE;
1149 }
1150
1151 return r;
1152} /* card_wait_for_unifi_to_reset() */
1153
1154
1155/*
1156 * ---------------------------------------------------------------------------
1157 * card_wait_for_firmware_to_start
1158 *
1159 * Polls the MAILBOX1 register for a non-zero value.
1160 * Then reads MAILBOX0 and forms the two values into a 32-bit address
1161 * which is returned to the caller.
1162 *
1163 * Arguments:
1164 * card Pointer to card struct
1165 * paddr Pointer to receive the UniFi address formed
1166 * by concatenating MAILBOX1 and MAILBOX0.
1167 *
1168 * Returns:
1169 * CSR_RESULT_SUCCESS on success, CSR error code on failure.
1170 * ---------------------------------------------------------------------------
1171 */
1172CsrResult card_wait_for_firmware_to_start(card_t *card, u32 *paddr)
1173{
1174 s32 i;
1175 u16 mbox0, mbox1;
1176 CsrResult r;
1177
1178 /*
1179 * Wait for UniFi to initialise its data structures by polling
1180 * the SHARED_MAILBOX1 register.
1181 * Experience shows this is typically 120ms.
1182 */
1183 CsrThreadSleep(MAILBOX1_TIMEOUT);
1184
1185 mbox1 = 0;
1186 unifi_trace(card->ospriv, UDBG1, "waiting for MAILBOX1 to be non-zero...\n");
1187 for (i = 0; i < MAILBOX1_ATTEMPTS; i++)
1188 {
1189 r = unifi_read_direct16(card, ChipHelper_MAILBOX1(card->helper) * 2, &mbox1);
1190 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
1191 {
1192 return r;
1193 }
1194 if (r != CSR_RESULT_SUCCESS)
1195 {
1196 /* These reads can fail if UniFi isn't up yet, so try again */
1197 unifi_warning(card->ospriv, "Failed to read UniFi Mailbox1 register\n");
1198 }
1199
1200 if ((r == CSR_RESULT_SUCCESS) && (mbox1 != 0))
1201 {
1202 unifi_trace(card->ospriv, UDBG1, "MAILBOX1 ready (0x%04X) in %u millisecs\n",
1203 mbox1, i * MAILBOX1_TIMEOUT);
1204
1205 /* Read the MAILBOX1 again in case we caught the value as it
1206 * changed. */
1207 r = unifi_read_direct16(card, ChipHelper_MAILBOX1(card->helper) * 2, &mbox1);
1208 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
1209 {
1210 return r;
1211 }
1212 if (r != CSR_RESULT_SUCCESS)
1213 {
1214 unifi_error(card->ospriv, "Failed to read UniFi Mailbox1 register for second time\n");
1215 return r;
1216 }
1217 unifi_trace(card->ospriv, UDBG1, "MAILBOX1 value=0x%04X\n", mbox1);
1218
1219 break;
1220 }
1221
1222 CsrThreadSleep(MAILBOX1_TIMEOUT);
1223 if ((i % 100) == 99)
1224 {
1225 unifi_trace(card->ospriv, UDBG2, "MAILBOX1 not ready (0x%X), still trying...\n", mbox1);
1226 }
1227 }
1228
1229 if ((r == CSR_RESULT_SUCCESS) && (mbox1 == 0))
1230 {
1231 unifi_trace(card->ospriv, UDBG1, "Timeout waiting for firmware to start, Mailbox1 still 0 after %d ms\n",
1232 MAILBOX1_ATTEMPTS * MAILBOX1_TIMEOUT);
1233 return CSR_RESULT_FAILURE;
1234 }
1235
1236
1237 /*
1238 * Complete the reset handshake by setting MAILBOX2 to 0xFFFF
1239 */
1240 r = unifi_write_direct16(card, ChipHelper_SDIO_HIP_HANDSHAKE(card->helper) * 2, 0xFFFF);
1241 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
1242 {
1243 return r;
1244 }
1245 if (r != CSR_RESULT_SUCCESS)
1246 {
1247 unifi_error(card->ospriv, "Failed to write f/w startup handshake to MAILBOX2\n");
1248 return r;
1249 }
1250
1251
1252 /*
1253 * Read the Symbol Look Up Table (SLUT) offset.
1254 * Top 16 bits are in mbox1, read the lower 16 bits from mbox0.
1255 */
1256 mbox0 = 0;
1257 r = unifi_read_direct16(card, ChipHelper_MAILBOX0(card->helper) * 2, &mbox0);
1258 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
1259 {
1260 return r;
1261 }
1262 if (r != CSR_RESULT_SUCCESS)
1263 {
1264 unifi_error(card->ospriv, "Failed to read UniFi Mailbox0 register\n");
1265 return r;
1266 }
1267
1268 *paddr = (((u32)mbox1 << 16) | mbox0);
1269
1270 return CSR_RESULT_SUCCESS;
1271} /* card_wait_for_firmware_to_start() */
1272
1273
1274/*
1275 * ---------------------------------------------------------------------------
1276 * unifi_capture_panic
1277 *
1278 * Attempt to capture panic codes from the firmware. This may involve
1279 * warm reset of the chip to regain access following a watchdog reset.
1280 *
1281 * Arguments:
1282 * card Pointer to card struct
1283 *
1284 * Returns:
1285 * CSR_RESULT_SUCCESS if panic codes were captured, or none available
1286 * CSR_RESULT_FAILURE if the driver could not access function 1
1287 * ---------------------------------------------------------------------------
1288 */
1289CsrResult unifi_capture_panic(card_t *card)
1290{
1291
1292 /* The firmware must have previously initialised to read the panic addresses
1293 * from the SLUT
1294 */
1295 if (!card->panic_data_phy_addr || !card->panic_data_mac_addr)
1296 {
1297 return CSR_RESULT_SUCCESS;
1298 }
1299
1300 /* Ensure we can access function 1 following a panic/watchdog reset */
1301 if (card_access_panic(card) == CSR_RESULT_SUCCESS)
1302 {
1303 /* Read the panic codes */
1304 unifi_read_panic(card);
1305 }
1306 else
1307 {
1308 unifi_info(card->ospriv, "Unable to read panic codes");
1309 }
1310
1311 return CSR_RESULT_SUCCESS;
1312}
1313
1314
1315/*
1316 * ---------------------------------------------------------------------------
1317 * card_access_panic
1318 * Attempt to read the WLAN SDIO function in order to read panic codes
1319 * and perform various reset steps to regain access if the read fails.
1320 *
1321 * Arguments:
1322 * card Pointer to card struct
1323 *
1324 * Returns:
1325 * CSR_RESULT_SUCCESS if panic codes can be read
1326 * CSR error code if panic codes can not be read
1327 * ---------------------------------------------------------------------------
1328 */
1329static CsrResult card_access_panic(card_t *card)
1330{
1331 u16 data_u16 = 0;
1332 s32 i;
1333 CsrResult r, sr;
1334
1335 /* A chip version of zero means that the version never got successfully read
1336 * during reset. In this case give up because it will not be possible to
1337 * verify the chip version.
1338 */
1339 if (!card->chip_version)
1340 {
1341 unifi_info(card->ospriv, "Unknown chip version\n");
1342 return CSR_RESULT_FAILURE;
1343 }
1344
1345 /* Ensure chip is awake or access to function 1 will fail */
1346 r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE);
1347 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
1348 {
1349 return r;
1350 }
1351 if (r != CSR_RESULT_SUCCESS)
1352 {
1353 unifi_error(card->ospriv, "unifi_set_host_state() failed %d\n", r);
1354 return CSR_RESULT_FAILURE; /* Card is probably unpowered */
1355 }
1356 CsrThreadSleep(20);
1357
1358 for (i = 0; i < 3; i++)
1359 {
1360 sr = CsrSdioRead16(card->sdio_if, CHIP_HELPER_UNIFI_GBL_CHIP_VERSION * 2, &data_u16);
1361 if (sr != CSR_RESULT_SUCCESS || data_u16 != card->chip_version)
1362 {
1363 unifi_info(card->ospriv, "Failed to read valid chip version sr=%d (0x%04x want 0x%04x) try %d\n",
1364 sr, data_u16, card->chip_version, i);
1365
1366 /* Set clock speed low */
1367 sr = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_SAFE_HZ);
1368 if (sr != CSR_RESULT_SUCCESS)
1369 {
1370 unifi_error(card->ospriv, "CsrSdioMaxBusClockFrequencySet() failed1 %d\n", sr);
1371 r = ConvertCsrSdioToCsrHipResult(card, sr);
1372 }
1373 card->sdio_clock_speed = UNIFI_SDIO_CLOCK_SAFE_HZ;
1374
1375 /* First try re-enabling function in case a f/w watchdog reset disabled it */
1376 if (i == 0)
1377 {
1378 unifi_info(card->ospriv, "Try function enable\n");
1379 sr = CsrSdioFunctionEnable(card->sdio_if);
1380 if (sr != CSR_RESULT_SUCCESS)
1381 {
1382 r = ConvertCsrSdioToCsrHipResult(card, sr);
1383 unifi_error(card->ospriv, "CsrSdioFunctionEnable failed %d (HIP %d)\n", sr, r);
1384 }
1385 continue;
1386 }
1387
1388 /* Second try, set awake */
1389 unifi_info(card->ospriv, "Try set awake\n");
1390
1391 /* Ensure chip is awake */
1392 r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE);
1393 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
1394 {
1395 return r;
1396 }
1397 if (r != CSR_RESULT_SUCCESS)
1398 {
1399 unifi_error(card->ospriv, "unifi_set_host_state() failed2 %d\n", r);
1400 }
1401
1402 /* Set clock speed low in case setting the host state raised it, which
1403 * would only happen if host state was previously TORPID
1404 */
1405 sr = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_SAFE_HZ);
1406 if (sr != CSR_RESULT_SUCCESS)
1407 {
1408 unifi_error(card->ospriv, "CsrSdioMaxBusClockFrequencySet() failed2 %d\n", sr);
1409 }
1410 card->sdio_clock_speed = UNIFI_SDIO_CLOCK_SAFE_HZ;
1411
1412 if (i == 1)
1413 {
1414 continue;
1415 }
1416
1417 /* Perform a s/w reset to preserve as much as the card state as possible,
1418 * (mainly the preserve RAM). The context will be lost for coredump - but as we
1419 * were unable to access the WLAN function for panic, the coredump would have
1420 * also failed without a reset.
1421 */
1422 unifi_info(card->ospriv, "Try s/w reset\n");
1423
1424 r = unifi_card_hard_reset(card);
1425 if (r != CSR_RESULT_SUCCESS)
1426 {
1427 unifi_error(card->ospriv, "unifi_card_hard_reset() failed %d\n", r);
1428 }
1429 }
1430 else
1431 {
1432 if (i > 0)
1433 {
1434 unifi_info(card->ospriv, "Read chip version 0x%x after %d retries\n", data_u16, i);
1435 }
1436 break;
1437 }
1438 }
1439
1440 r = ConvertCsrSdioToCsrHipResult(card, sr);
1441 return r;
1442}
1443
1444
1445/*
1446 * ---------------------------------------------------------------------------
1447 * unifi_read_panic
1448 * Reads, saves and prints panic codes stored by the firmware in UniFi's
1449 * preserve RAM by the last panic that occurred since chip was powered.
1450 * Nothing is saved if the panic codes are read as zero.
1451 *
1452 * Arguments:
1453 * card Pointer to card struct
1454 *
1455 * Returns:
1456 * ---------------------------------------------------------------------------
1457 */
1458void unifi_read_panic(card_t *card)
1459{
1460 CsrResult r;
1461 u16 p_code, p_arg;
1462
1463 /* The firmware must have previously initialised to read the panic addresses
1464 * from the SLUT
1465 */
1466 if (!card->panic_data_phy_addr || !card->panic_data_mac_addr)
1467 {
1468 return;
1469 }
1470
1471 /* Get the panic data from PHY */
1472 r = unifi_card_read16(card, card->panic_data_phy_addr, &p_code);
1473 if (r != CSR_RESULT_SUCCESS)
1474 {
1475 unifi_error(card->ospriv, "capture_panic: unifi_read16 %08x failed %d\n", card->panic_data_phy_addr, r);
1476 p_code = 0;
1477 }
1478 if (p_code)
1479 {
1480 r = unifi_card_read16(card, card->panic_data_phy_addr + 2, &p_arg);
1481 if (r != CSR_RESULT_SUCCESS)
1482 {
1483 unifi_error(card->ospriv, "capture_panic: unifi_read16 %08x failed %d\n", card->panic_data_phy_addr + 2, r);
1484 }
1485 unifi_error(card->ospriv, "Last UniFi PHY PANIC %04x arg %04x\n", p_code, p_arg);
1486 card->last_phy_panic_code = p_code;
1487 card->last_phy_panic_arg = p_arg;
1488 }
1489
1490 /* Get the panic data from MAC */
1491 r = unifi_card_read16(card, card->panic_data_mac_addr, &p_code);
1492 if (r != CSR_RESULT_SUCCESS)
1493 {
1494 unifi_error(card->ospriv, "capture_panic: unifi_read16 %08x failed %d\n", card->panic_data_mac_addr, r);
1495 p_code = 0;
1496 }
1497 if (p_code)
1498 {
1499 r = unifi_card_read16(card, card->panic_data_mac_addr + 2, &p_arg);
1500 if (r != CSR_RESULT_SUCCESS)
1501 {
1502 unifi_error(card->ospriv, "capture_panic: unifi_read16 %08x failed %d\n", card->panic_data_mac_addr + 2, r);
1503 }
1504 unifi_error(card->ospriv, "Last UniFi MAC PANIC %04x arg %04x\n", p_code, p_arg);
1505 card->last_mac_panic_code = p_code;
1506 card->last_mac_panic_arg = p_arg;
1507 }
1508
1509}
1510
1511
1512/*
1513 * ---------------------------------------------------------------------------
1514 * card_allocate_memory_resources
1515 *
1516 * Allocates memory for the from-host, to-host bulk data slots,
1517 * soft queue buffers and bulk data buffers.
1518 *
1519 * Arguments:
1520 * card Pointer to card struct
1521 *
1522 * Returns:
1523 * CSR_RESULT_SUCCESS on success, CSR error code on failure.
1524 * ---------------------------------------------------------------------------
1525 */
1526static CsrResult card_allocate_memory_resources(card_t *card)
1527{
1528 s16 n, i, k, r;
1529 sdio_config_data_t *cfg_data;
1530
1531 /* Reset any state carried forward from a previous life */
1532 card->fh_command_queue.q_rd_ptr = 0;
1533 card->fh_command_queue.q_wr_ptr = 0;
1534 (void)scnprintf(card->fh_command_queue.name, UNIFI_QUEUE_NAME_MAX_LENGTH,
1535 "fh_cmd_q");
1536 for (i = 0; i < UNIFI_NO_OF_TX_QS; i++)
1537 {
1538 card->fh_traffic_queue[i].q_rd_ptr = 0;
1539 card->fh_traffic_queue[i].q_wr_ptr = 0;
1540 (void)scnprintf(card->fh_traffic_queue[i].name,
1541 UNIFI_QUEUE_NAME_MAX_LENGTH, "fh_data_q%d", i);
1542 }
1543#ifndef CSR_WIFI_HIP_TA_DISABLE
1544 unifi_ta_sampling_init(card);
1545#endif
1546 /* Convenience short-cut */
1547 cfg_data = &card->config_data;
1548
1549 /*
1550 * Allocate memory for the from-host and to-host signal buffers.
1551 */
1552 card->fh_buffer.buf = kmalloc(UNIFI_FH_BUF_SIZE, GFP_KERNEL);
1553 if (card->fh_buffer.buf == NULL)
1554 {
1555 unifi_error(card->ospriv, "Failed to allocate memory for F-H signals\n");
1556 return CSR_WIFI_HIP_RESULT_NO_MEMORY;
1557 }
1558 card->fh_buffer.bufsize = UNIFI_FH_BUF_SIZE;
1559 card->fh_buffer.ptr = card->fh_buffer.buf;
1560 card->fh_buffer.count = 0;
1561
1562 card->th_buffer.buf = kmalloc(UNIFI_FH_BUF_SIZE, GFP_KERNEL);
1563 if (card->th_buffer.buf == NULL)
1564 {
1565 unifi_error(card->ospriv, "Failed to allocate memory for T-H signals\n");
1566 return CSR_WIFI_HIP_RESULT_NO_MEMORY;
1567 }
1568 card->th_buffer.bufsize = UNIFI_FH_BUF_SIZE;
1569 card->th_buffer.ptr = card->th_buffer.buf;
1570 card->th_buffer.count = 0;
1571
1572
1573 /*
1574 * Allocate memory for the from-host and to-host bulk data slots.
1575 * This is done as separate kmallocs because lots of smaller
1576 * allocations are more likely to succeed than one huge one.
1577 */
1578
1579 /* Allocate memory for the array of pointers */
1580 n = cfg_data->num_fromhost_data_slots;
1581
1582 unifi_trace(card->ospriv, UDBG3, "Alloc from-host resources, %d slots.\n", n);
1583 card->from_host_data = kmalloc(n * sizeof(slot_desc_t), GFP_KERNEL);
1584 if (card->from_host_data == NULL)
1585 {
1586 unifi_error(card->ospriv, "Failed to allocate memory for F-H bulk data array\n");
1587 return CSR_WIFI_HIP_RESULT_NO_MEMORY;
1588 }
1589
1590 /* Initialise from-host bulk data slots */
1591 for (i = 0; i < n; i++)
1592 {
1593 UNIFI_INIT_BULK_DATA(&card->from_host_data[i].bd);
1594 }
1595
1596 /* Allocate memory for the array used for slot host tag mapping */
1597 card->fh_slot_host_tag_record = kmalloc(n * sizeof(u32), GFP_KERNEL);
1598
1599 if (card->fh_slot_host_tag_record == NULL)
1600 {
1601 unifi_error(card->ospriv, "Failed to allocate memory for F-H slot host tag mapping array\n");
1602 return CSR_WIFI_HIP_RESULT_NO_MEMORY;
1603 }
1604
1605 /* Initialise host tag entries for from-host bulk data slots */
1606 for (i = 0; i < n; i++)
1607 {
1608 card->fh_slot_host_tag_record[i] = CSR_WIFI_HIP_RESERVED_HOST_TAG;
1609 }
1610
1611
1612 /* Allocate memory for the array of pointers */
1613 n = cfg_data->num_tohost_data_slots;
1614
1615 unifi_trace(card->ospriv, UDBG3, "Alloc to-host resources, %d slots.\n", n);
1616 card->to_host_data = kmalloc(n * sizeof(bulk_data_desc_t), GFP_KERNEL);
1617 if (card->to_host_data == NULL)
1618 {
1619 unifi_error(card->ospriv, "Failed to allocate memory for T-H bulk data array\n");
1620 return CSR_WIFI_HIP_RESULT_NO_MEMORY;
1621 }
1622
1623 /* Initialise to-host bulk data slots */
1624 for (i = 0; i < n; i++)
1625 {
1626 UNIFI_INIT_BULK_DATA(&card->to_host_data[i]);
1627 }
1628
1629 /*
1630 * Initialise buffers for soft Q
1631 */
1632 for (i = 0; i < UNIFI_SOFT_COMMAND_Q_LENGTH; i++)
1633 {
1634 for (r = 0; r < UNIFI_MAX_DATA_REFERENCES; r++)
1635 {
1636 UNIFI_INIT_BULK_DATA(&card->fh_command_q_body[i].bulkdata[r]);
1637 }
1638 }
1639
1640 for (k = 0; k < UNIFI_NO_OF_TX_QS; k++)
1641 {
1642 for (i = 0; i < UNIFI_SOFT_TRAFFIC_Q_LENGTH; i++)
1643 {
1644 for (r = 0; r < UNIFI_MAX_DATA_REFERENCES; r++)
1645 {
1646 UNIFI_INIT_BULK_DATA(&card->fh_traffic_q_body[k][i].bulkdata[r]);
1647 }
1648 }
1649 }
1650
1651 card->memory_resources_allocated = 1;
1652
1653 return CSR_RESULT_SUCCESS;
1654} /* card_allocate_memory_resources() */
1655
1656
1657/*
1658 * ---------------------------------------------------------------------------
1659 * unifi_free_bulk_data
1660 *
1661 * Free the data associated to a bulk data structure.
1662 *
1663 * Arguments:
1664 * card Pointer to card struct
1665 * bulk_data_slot Pointer to bulk data structure
1666 *
1667 * Returns:
1668 * None.
1669 *
1670 * ---------------------------------------------------------------------------
1671 */
1672static void unifi_free_bulk_data(card_t *card, bulk_data_desc_t *bulk_data_slot)
1673{
1674 if (bulk_data_slot->data_length != 0)
1675 {
1676 unifi_net_data_free(card->ospriv, bulk_data_slot);
1677 }
1678} /* unifi_free_bulk_data() */
1679
1680
1681/*
1682 * ---------------------------------------------------------------------------
1683 * card_free_memory_resources
1684 *
1685 * Frees memory allocated for the from-host, to-host bulk data slots,
1686 * soft queue buffers and bulk data buffers.
1687 *
1688 * Arguments:
1689 * card Pointer to card struct
1690 *
1691 * Returns:
1692 * None.
1693 * ---------------------------------------------------------------------------
1694 */
1695static void card_free_memory_resources(card_t *card)
1696{
1697
1698 unifi_trace(card->ospriv, UDBG1, "Freeing card memory resources.\n");
1699
1700 /* Clear our internal queues */
1701 unifi_cancel_pending_signals(card);
1702
1703
1704 kfree(card->to_host_data);
1705 card->to_host_data = NULL;
1706
1707 kfree(card->from_host_data);
1708 card->from_host_data = NULL;
1709
1710 /* free the memory for slot host tag mapping array */
1711 kfree(card->fh_slot_host_tag_record);
1712 card->fh_slot_host_tag_record = NULL;
1713
1714 kfree(card->fh_buffer.buf);
1715 card->fh_buffer.ptr = card->fh_buffer.buf = NULL;
1716 card->fh_buffer.bufsize = 0;
1717 card->fh_buffer.count = 0;
1718
1719 kfree(card->th_buffer.buf);
1720 card->th_buffer.ptr = card->th_buffer.buf = NULL;
1721 card->th_buffer.bufsize = 0;
1722 card->th_buffer.count = 0;
1723
1724
1725 card->memory_resources_allocated = 0;
1726
1727} /* card_free_memory_resources() */
1728
1729
1730static void card_init_soft_queues(card_t *card)
1731{
1732 s16 i;
1733
1734 unifi_trace(card->ospriv, UDBG1, "Initialising internal signal queues.\n");
1735 /* Reset any state carried forward from a previous life */
1736 card->fh_command_queue.q_rd_ptr = 0;
1737 card->fh_command_queue.q_wr_ptr = 0;
1738 (void)scnprintf(card->fh_command_queue.name, UNIFI_QUEUE_NAME_MAX_LENGTH,
1739 "fh_cmd_q");
1740 for (i = 0; i < UNIFI_NO_OF_TX_QS; i++)
1741 {
1742 card->fh_traffic_queue[i].q_rd_ptr = 0;
1743 card->fh_traffic_queue[i].q_wr_ptr = 0;
1744 (void)scnprintf(card->fh_traffic_queue[i].name,
1745 UNIFI_QUEUE_NAME_MAX_LENGTH, "fh_data_q%d", i);
1746 }
1747#ifndef CSR_WIFI_HIP_TA_DISABLE
1748 unifi_ta_sampling_init(card);
1749#endif
1750}
1751
1752
1753/*
1754 * ---------------------------------------------------------------------------
1755 * unifi_cancel_pending_signals
1756 *
1757 * Free the signals and associated bulk data, pending in the core.
1758 *
1759 * Arguments:
1760 * card Pointer to card struct
1761 *
1762 * Returns:
1763 * None.
1764 * ---------------------------------------------------------------------------
1765 */
1766void unifi_cancel_pending_signals(card_t *card)
1767{
1768 s16 i, n, r;
1769
1770 unifi_trace(card->ospriv, UDBG1, "Canceling pending signals.\n");
1771
1772 if (card->to_host_data)
1773 {
1774 /*
1775 * Free any bulk data buffers allocated for the t-h slots
1776 * This will clear all buffers that did not make it to
1777 * unifi_receive_event() before cancel was request.
1778 */
1779 n = card->config_data.num_tohost_data_slots;
1780 unifi_trace(card->ospriv, UDBG3, "Freeing to-host resources, %d slots.\n", n);
1781 for (i = 0; i < n; i++)
1782 {
1783 unifi_free_bulk_data(card, &card->to_host_data[i]);
1784 }
1785 }
1786
1787 /*
1788 * If any of the from-host bulk data has reached the card->from_host_data
1789 * but not UniFi, we need to free the buffers here.
1790 */
1791 if (card->from_host_data)
1792 {
1793 /* Free any bulk data buffers allocated for the f-h slots */
1794 n = card->config_data.num_fromhost_data_slots;
1795 unifi_trace(card->ospriv, UDBG3, "Freeing from-host resources, %d slots.\n", n);
1796 for (i = 0; i < n; i++)
1797 {
1798 unifi_free_bulk_data(card, &card->from_host_data[i].bd);
1799 }
1800
1801 for (i = 0; i < UNIFI_NO_OF_TX_QS; i++)
1802 {
1803 card->dynamic_slot_data.from_host_used_slots[i] = 0;
1804 card->dynamic_slot_data.from_host_max_slots[i] = 0;
1805 card->dynamic_slot_data.from_host_reserved_slots[i] = 0;
1806 }
1807 }
1808
1809 /*
1810 * Free any bulk data buffers allocated in the soft queues.
1811 * This covers the case where a bulk data pointer has reached the soft queue
1812 * but not the card->from_host_data.
1813 */
1814 unifi_trace(card->ospriv, UDBG3, "Freeing cmd q resources.\n");
1815 for (i = 0; i < UNIFI_SOFT_COMMAND_Q_LENGTH; i++)
1816 {
1817 for (r = 0; r < UNIFI_MAX_DATA_REFERENCES; r++)
1818 {
1819 unifi_free_bulk_data(card, &card->fh_command_q_body[i].bulkdata[r]);
1820 }
1821 }
1822
1823 unifi_trace(card->ospriv, UDBG3, "Freeing traffic q resources.\n");
1824 for (n = 0; n < UNIFI_NO_OF_TX_QS; n++)
1825 {
1826 for (i = 0; i < UNIFI_SOFT_TRAFFIC_Q_LENGTH; i++)
1827 {
1828 for (r = 0; r < UNIFI_MAX_DATA_REFERENCES; r++)
1829 {
1830 unifi_free_bulk_data(card, &card->fh_traffic_q_body[n][i].bulkdata[r]);
1831 }
1832 }
1833 }
1834
1835 card_init_soft_queues(card);
1836
1837} /* unifi_cancel_pending_signals() */
1838
1839
1840/*
1841 * ---------------------------------------------------------------------------
1842 * unifi_free_card
1843 *
1844 * Free the memory allocated for the card structure and buffers.
1845 *
1846 * Notes:
1847 * The porting layer is responsible for freeing any mini-coredump buffers
1848 * allocated when it called unifi_coredump_init(), by calling
1849 * unifi_coredump_free() before calling this function.
1850 *
1851 * Arguments:
1852 * card Pointer to card struct
1853 *
1854 * Returns:
1855 * None.
1856 * ---------------------------------------------------------------------------
1857 */
1858void unifi_free_card(card_t *card)
1859{
1860#ifdef CSR_PRE_ALLOC_NET_DATA
1861 prealloc_netdata_free(card);
1862#endif
1863 /* Free any memory allocated. */
1864 card_free_memory_resources(card);
1865
1866 /* Warn if caller didn't free coredump buffers */
1867 if (card->dump_buf)
1868 {
1869 unifi_error(card->ospriv, "Caller should call unifi_coredump_free()\n");
1870 unifi_coredump_free(card); /* free anyway to prevent memory leak */
1871 }
1872
1873 kfree(card);
1874
1875} /* unifi_free_card() */
1876
1877
1878/*
1879 * ---------------------------------------------------------------------------
1880 * card_init_slots
1881 *
1882 * Allocate memory for host-side slot data and signal queues.
1883 *
1884 * Arguments:
1885 * card Pointer to card object
1886 *
1887 * Returns:
1888 * CSR error code.
1889 * ---------------------------------------------------------------------------
1890 */
1891static CsrResult card_init_slots(card_t *card)
1892{
1893 CsrResult r;
1894 u8 i;
1895
1896 /* Allocate the buffers we need, only once. */
1897 if (card->memory_resources_allocated == 1)
1898 {
1899 card_free_memory_resources(card);
1900 }
1901 else
1902 {
1903 /* Initialise our internal command and traffic queues */
1904 card_init_soft_queues(card);
1905 }
1906
1907 r = card_allocate_memory_resources(card);
1908 if (r != CSR_RESULT_SUCCESS)
1909 {
1910 unifi_error(card->ospriv, "Failed to allocate card memory resources.\n");
1911 card_free_memory_resources(card);
1912 return r;
1913 }
1914
1915 if (card->sdio_ctrl_addr == 0)
1916 {
1917 unifi_error(card->ospriv, "Failed to find config struct!\n");
1918 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
1919 }
1920
1921 /*
1922 * Set initial counts.
1923 */
1924
1925 card->from_host_data_head = 0;
1926
1927 /* Get initial signal counts from UniFi, in case it has not been reset. */
1928 {
1929 u16 s;
1930
1931 /* Get the from-host-signals-written count */
1932 r = unifi_card_read16(card, card->sdio_ctrl_addr + 0, &s);
1933 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
1934 {
1935 return r;
1936 }
1937 if (r != CSR_RESULT_SUCCESS)
1938 {
1939 unifi_error(card->ospriv, "Failed to read from-host sig written count\n");
1940 return r;
1941 }
1942 card->from_host_signals_w = (s16)s;
1943
1944 /* Get the to-host-signals-written count */
1945 r = unifi_card_read16(card, card->sdio_ctrl_addr + 6, &s);
1946 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
1947 {
1948 return r;
1949 }
1950 if (r != CSR_RESULT_SUCCESS)
1951 {
1952 unifi_error(card->ospriv, "Failed to read to-host sig read count\n");
1953 return r;
1954 }
1955 card->to_host_signals_r = (s16)s;
1956 }
1957
1958 /* Set Initialised flag. */
1959 r = unifi_card_write16(card, card->init_flag_addr, 0x0001);
1960 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
1961 {
1962 return r;
1963 }
1964 if (r != CSR_RESULT_SUCCESS)
1965 {
1966 unifi_error(card->ospriv, "Failed to write initialised flag\n");
1967 return r;
1968 }
1969
1970 /* Dynamic queue reservation */
1971 memset(&card->dynamic_slot_data, 0, sizeof(card_dynamic_slot_t));
1972
1973 for (i = 0; i < UNIFI_NO_OF_TX_QS; i++)
1974 {
1975 card->dynamic_slot_data.from_host_max_slots[i] = card->config_data.num_fromhost_data_slots -
1976 UNIFI_RESERVED_COMMAND_SLOTS;
1977 card->dynamic_slot_data.queue_stable[i] = FALSE;
1978 }
1979
1980 card->dynamic_slot_data.packets_interval = UNIFI_PACKETS_INTERVAL;
1981
1982 return CSR_RESULT_SUCCESS;
1983} /* card_init_slots() */
1984
1985
1986/*
1987 * ---------------------------------------------------------------------------
1988 * unifi_set_udi_hook
1989 *
1990 * Registers the udi hook that reports the sent signals to the core.
1991 *
1992 * Arguments:
1993 * card Pointer to the card context struct
1994 * udi_fn Pointer to the callback function.
1995 *
1996 * Returns:
1997 * CSR_WIFI_HIP_RESULT_INVALID_VALUE if the card pointer is invalid,
1998 * CSR_RESULT_SUCCESS on success.
1999 * ---------------------------------------------------------------------------
2000 */
2001CsrResult unifi_set_udi_hook(card_t *card, udi_func_t udi_fn)
2002{
2003 if (card == NULL)
2004 {
2005 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
2006 }
2007
2008 if (card->udi_hook == NULL)
2009 {
2010 card->udi_hook = udi_fn;
2011 }
2012
2013 return CSR_RESULT_SUCCESS;
2014} /* unifi_set_udi_hook() */
2015
2016
2017/*
2018 * ---------------------------------------------------------------------------
2019 * unifi_remove_udi_hook
2020 *
2021 * Removes the udi hook that reports the sent signals from the core.
2022 *
2023 * Arguments:
2024 * card Pointer to the card context struct
2025 * udi_fn Pointer to the callback function.
2026 *
2027 * Returns:
2028 * CSR_WIFI_HIP_RESULT_INVALID_VALUE if the card pointer is invalid,
2029 * CSR_RESULT_SUCCESS on success.
2030 * ---------------------------------------------------------------------------
2031 */
2032CsrResult unifi_remove_udi_hook(card_t *card, udi_func_t udi_fn)
2033{
2034 if (card == NULL)
2035 {
2036 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
2037 }
2038
2039 if (card->udi_hook == udi_fn)
2040 {
2041 card->udi_hook = NULL;
2042 }
2043
2044 return CSR_RESULT_SUCCESS;
2045} /* unifi_remove_udi_hook() */
2046
2047
2048static void CardReassignDynamicReservation(card_t *card)
2049{
2050 u8 i;
2051
2052 unifi_trace(card->ospriv, UDBG5, "Packets Txed %d %d %d %d\n",
2053 card->dynamic_slot_data.packets_txed[0],
2054 card->dynamic_slot_data.packets_txed[1],
2055 card->dynamic_slot_data.packets_txed[2],
2056 card->dynamic_slot_data.packets_txed[3]);
2057
2058 /* Clear reservation and recalculate max slots */
2059 for (i = 0; i < UNIFI_NO_OF_TX_QS; i++)
2060 {
2061 card->dynamic_slot_data.queue_stable[i] = FALSE;
2062 card->dynamic_slot_data.from_host_reserved_slots[i] = 0;
2063 card->dynamic_slot_data.from_host_max_slots[i] = card->config_data.num_fromhost_data_slots -
2064 UNIFI_RESERVED_COMMAND_SLOTS;
2065 card->dynamic_slot_data.packets_txed[i] = 0;
2066
2067 unifi_trace(card->ospriv, UDBG5, "CardReassignDynamicReservation: queue %d reserved %d Max %d\n", i,
2068 card->dynamic_slot_data.from_host_reserved_slots[i],
2069 card->dynamic_slot_data.from_host_max_slots[i]);
2070 }
2071
2072 card->dynamic_slot_data.total_packets_txed = 0;
2073}
2074
2075
2076/* Algorithm to dynamically reserve slots. The logic is based mainly on the outstanding queue
2077 * length. Slots are reserved for particular queues during an interval and cleared after the interval.
2078 * Each queue has three associated variables.. a) used slots - the number of slots currently occupied
2079 * by the queue b) reserved slots - number of slots reserved specifically for the queue c) max slots - total
2080 * slots that this queue can actually use (may be higher than reserved slots and is dependent on reserved slots
2081 * for other queues).
2082 * This function is called when there are no slots available for a queue. It checks to see if there are enough
2083 * unreserved slots sufficient for this request. If available these slots are reserved for the queue.
2084 * If there are not enough unreserved slots, a fair share for each queue is calculated based on the total slots
2085 * and the number of active queues (any queue with existing reservation is considered active). Queues needing
2086 * less than their fair share are allowed to have the previously reserved slots. The remaining slots are
2087 * distributed evenly among queues that need more than the fair share
2088 *
2089 * A better scheme would take current bandwidth per AC into consideration when reserving slots. An
2090 * implementation scheme could consider the relative time/service period for slots in an AC. If the firmware
2091 * services other ACs faster than a particular AC (packets wait in the slots longer) then it is fair to reserve
2092 * less slots for the AC
2093 */
2094static void CardCheckDynamicReservation(card_t *card, unifi_TrafficQueue queue)
2095{
2096 u16 q_len, active_queues = 0, excess_queue_slots, div_extra_slots,
2097 queue_fair_share, reserved_slots = 0, q, excess_need_queues = 0, unmovable_slots = 0;
2098 s32 i;
2099 q_t *sigq;
2100 u16 num_data_slots = card->config_data.num_fromhost_data_slots - UNIFI_RESERVED_COMMAND_SLOTS;
2101
2102 /* Calculate the pending queue length */
2103 sigq = &card->fh_traffic_queue[queue];
2104 q_len = CSR_WIFI_HIP_Q_SLOTS_USED(sigq);
2105
2106 if (q_len <= card->dynamic_slot_data.from_host_reserved_slots[queue])
2107 {
2108 unifi_trace(card->ospriv, UDBG5, "queue %d q_len %d already has that many reserved slots, exiting\n", queue, q_len);
2109 return;
2110 }
2111
2112 /* Upper limit */
2113 if (q_len > num_data_slots)
2114 {
2115 q_len = num_data_slots;
2116 }
2117
2118 for (i = 0; i < UNIFI_NO_OF_TX_QS; i++)
2119 {
2120 if (i != (s32)queue)
2121 {
2122 reserved_slots += card->dynamic_slot_data.from_host_reserved_slots[i];
2123 }
2124 if ((i == (s32)queue) || (card->dynamic_slot_data.from_host_reserved_slots[i] > 0))
2125 {
2126 active_queues++;
2127 }
2128 }
2129
2130 unifi_trace(card->ospriv, UDBG5, "CardCheckDynamicReservation: queue %d q_len %d\n", queue, q_len);
2131 unifi_trace(card->ospriv, UDBG5, "Active queues %d reserved slots on other queues %d\n",
2132 active_queues, reserved_slots);
2133
2134 if (reserved_slots + q_len <= num_data_slots)
2135 {
2136 card->dynamic_slot_data.from_host_reserved_slots[queue] = q_len;
2137 if (q_len == num_data_slots)
2138 {
2139 /* This is the common case when just 1 stream is going */
2140 card->dynamic_slot_data.queue_stable[queue] = TRUE;
2141 }
2142 }
2143 else
2144 {
2145 queue_fair_share = num_data_slots / active_queues;
2146 unifi_trace(card->ospriv, UDBG5, "queue fair share %d\n", queue_fair_share);
2147
2148 /* Evenly distribute slots among active queues */
2149 /* Find out the queues that need excess of fair share. Also find slots allocated
2150 * to queues less than their fair share, these slots cannot be reallocated (unmovable slots) */
2151
2152 card->dynamic_slot_data.from_host_reserved_slots[queue] = q_len;
2153
2154 for (i = 0; i < UNIFI_NO_OF_TX_QS; i++)
2155 {
2156 if (card->dynamic_slot_data.from_host_reserved_slots[i] > queue_fair_share)
2157 {
2158 excess_need_queues++;
2159 }
2160 else
2161 {
2162 unmovable_slots += card->dynamic_slot_data.from_host_reserved_slots[i];
2163 }
2164 }
2165
2166 unifi_trace(card->ospriv, UDBG5, "Excess need queues %d\n", excess_need_queues);
2167
2168 /* Now find the slots per excess demand queue */
2169 excess_queue_slots = (num_data_slots - unmovable_slots) / excess_need_queues;
2170 div_extra_slots = (num_data_slots - unmovable_slots) - excess_queue_slots * excess_need_queues;
2171 for (i = UNIFI_NO_OF_TX_QS - 1; i >= 0; i--)
2172 {
2173 if (card->dynamic_slot_data.from_host_reserved_slots[i] > excess_queue_slots)
2174 {
2175 card->dynamic_slot_data.from_host_reserved_slots[i] = excess_queue_slots;
2176 if (div_extra_slots > 0)
2177 {
2178 card->dynamic_slot_data.from_host_reserved_slots[i]++;
2179 div_extra_slots--;
2180 }
2181 /* No more slots will be allocated to this queue during the current interval */
2182 card->dynamic_slot_data.queue_stable[i] = TRUE;
2183 unifi_trace(card->ospriv, UDBG5, "queue stable %d\n", i);
2184 }
2185 }
2186 }
2187
2188 /* Redistribute max slots */
2189 for (i = 0; i < UNIFI_NO_OF_TX_QS; i++)
2190 {
2191 reserved_slots = 0;
2192 for (q = 0; q < UNIFI_NO_OF_TX_QS; q++)
2193 {
2194 if (i != q)
2195 {
2196 reserved_slots += card->dynamic_slot_data.from_host_reserved_slots[q];
2197 }
2198 }
2199
2200 card->dynamic_slot_data.from_host_max_slots[i] = num_data_slots - reserved_slots;
2201 unifi_trace(card->ospriv, UDBG5, "queue %d reserved %d Max %d\n", i,
2202 card->dynamic_slot_data.from_host_reserved_slots[i],
2203 card->dynamic_slot_data.from_host_max_slots[i]);
2204 }
2205
2206}
2207
2208
2209/*
2210 * ---------------------------------------------------------------------------
2211 * CardClearFromHostDataSlot
2212 *
2213 * Clear a the given data slot, making it available again.
2214 *
2215 * Arguments:
2216 * card Pointer to Card object
2217 * slot Index of the signal slot to clear.
2218 *
2219 * Returns:
2220 * None.
2221 * ---------------------------------------------------------------------------
2222 */
2223void CardClearFromHostDataSlot(card_t *card, const s16 slot)
2224{
2225 u8 queue = card->from_host_data[slot].queue;
2226 const void *os_data_ptr = card->from_host_data[slot].bd.os_data_ptr;
2227
2228 if (card->from_host_data[slot].bd.data_length == 0)
2229 {
2230 unifi_warning(card->ospriv,
2231 "Surprise: request to clear an already free FH data slot: %d\n",
2232 slot);
2233 return;
2234 }
2235
2236 if (os_data_ptr == NULL)
2237 {
2238 unifi_warning(card->ospriv,
2239 "Clearing FH data slot %d: has null payload, len=%d\n",
2240 slot, card->from_host_data[slot].bd.data_length);
2241 }
2242
2243 /* Free card->from_host_data[slot].bd.os_net_ptr here. */
2244 /* Mark slot as free by setting length to 0. */
2245 unifi_free_bulk_data(card, &card->from_host_data[slot].bd);
2246 if (queue < UNIFI_NO_OF_TX_QS)
2247 {
2248 if (card->dynamic_slot_data.from_host_used_slots[queue] == 0)
2249 {
2250 unifi_error(card->ospriv, "Goofed up used slots q = %d used slots = %d\n",
2251 queue,
2252 card->dynamic_slot_data.from_host_used_slots[queue]);
2253 }
2254 else
2255 {
2256 card->dynamic_slot_data.from_host_used_slots[queue]--;
2257 }
2258 card->dynamic_slot_data.packets_txed[queue]++;
2259 card->dynamic_slot_data.total_packets_txed++;
2260 if (card->dynamic_slot_data.total_packets_txed >= card->dynamic_slot_data.packets_interval)
2261 {
2262 CardReassignDynamicReservation(card);
2263 }
2264 }
2265
2266 unifi_trace(card->ospriv, UDBG4, "CardClearFromHostDataSlot: slot %d recycled %p\n", slot, os_data_ptr);
2267
2268} /* CardClearFromHostDataSlot() */
2269
2270
2271#ifdef CSR_WIFI_REQUEUE_PACKET_TO_HAL
2272/*
2273 * ---------------------------------------------------------------------------
2274 * CardClearFromHostDataSlotWithoutFreeingBulkData
2275 *
2276 * Clear the given data slot with out freeing the bulk data.
2277 *
2278 * Arguments:
2279 * card Pointer to Card object
2280 * slot Index of the signal slot to clear.
2281 *
2282 * Returns:
2283 * None.
2284 * ---------------------------------------------------------------------------
2285 */
2286void CardClearFromHostDataSlotWithoutFreeingBulkData(card_t *card, const s16 slot)
2287{
2288 u8 queue = card->from_host_data[slot].queue;
2289
2290 /* Initialise the from_host data slot so it can be re-used,
2291 * Set length field in from_host_data array to 0.
2292 */
2293 UNIFI_INIT_BULK_DATA(&card->from_host_data[slot].bd);
2294
2295 queue = card->from_host_data[slot].queue;
2296
2297 if (queue < UNIFI_NO_OF_TX_QS)
2298 {
2299 if (card->dynamic_slot_data.from_host_used_slots[queue] == 0)
2300 {
2301 unifi_error(card->ospriv, "Goofed up used slots q = %d used slots = %d\n",
2302 queue,
2303 card->dynamic_slot_data.from_host_used_slots[queue]);
2304 }
2305 else
2306 {
2307 card->dynamic_slot_data.from_host_used_slots[queue]--;
2308 }
2309 card->dynamic_slot_data.packets_txed[queue]++;
2310 card->dynamic_slot_data.total_packets_txed++;
2311 if (card->dynamic_slot_data.total_packets_txed >=
2312 card->dynamic_slot_data.packets_interval)
2313 {
2314 CardReassignDynamicReservation(card);
2315 }
2316 }
2317} /* CardClearFromHostDataSlotWithoutFreeingBulkData() */
2318
2319
2320#endif
2321
2322u16 CardGetDataSlotSize(card_t *card)
2323{
2324 return card->config_data.data_slot_size;
2325} /* CardGetDataSlotSize() */
2326
2327
2328/*
2329 * ---------------------------------------------------------------------------
2330 * CardGetFreeFromHostDataSlots
2331 *
2332 * Retrieve the number of from-host bulk data slots available.
2333 *
2334 * Arguments:
2335 * card Pointer to the card context struct
2336 *
2337 * Returns:
2338 * Number of free from-host bulk data slots.
2339 * ---------------------------------------------------------------------------
2340 */
2341u16 CardGetFreeFromHostDataSlots(card_t *card)
2342{
2343 u16 i, n = 0;
2344
2345 /* First two slots reserved for MLME */
2346 for (i = 0; i < card->config_data.num_fromhost_data_slots; i++)
2347 {
2348 if (card->from_host_data[i].bd.data_length == 0)
2349 {
2350 /* Free slot */
2351 n++;
2352 }
2353 }
2354
2355 return n;
2356} /* CardGetFreeFromHostDataSlots() */
2357
2358
2359/*
2360 * ---------------------------------------------------------------------------
2361 * CardAreAllFromHostDataSlotsEmpty
2362 *
2363 * Returns the state of from-host bulk data slots.
2364 *
2365 * Arguments:
2366 * card Pointer to the card context struct
2367 *
2368 * Returns:
2369 * 1 The from-host bulk data slots are all empty (available).
2370 * 0 Some or all the from-host bulk data slots are in use.
2371 * ---------------------------------------------------------------------------
2372 */
2373u16 CardAreAllFromHostDataSlotsEmpty(card_t *card)
2374{
2375 u16 i;
2376
2377 for (i = 0; i < card->config_data.num_fromhost_data_slots; i++)
2378 {
2379 if (card->from_host_data[i].bd.data_length != 0)
2380 {
2381 return 0;
2382 }
2383 }
2384
2385 return 1;
2386} /* CardGetFreeFromHostDataSlots() */
2387
2388
2389static CsrResult unifi_identify_hw(card_t *card)
2390{
2391
2392 card->chip_id = card->sdio_if->sdioId.cardId;
2393 card->function = card->sdio_if->sdioId.sdioFunction;
2394 card->sdio_io_block_size = card->sdio_if->blockSize;
2395
2396 /* If SDIO controller doesn't support byte mode CMD53, pad transfers to block sizes */
2397 card->sdio_io_block_pad = (card->sdio_if->features & CSR_SDIO_FEATURE_BYTE_MODE)?FALSE : TRUE;
2398
2399 /*
2400 * Setup the chip helper so that we can access the registers (and
2401 * also tell what sub-type of HIP we should use).
2402 */
2403 card->helper = ChipHelper_GetVersionSdio((u8)card->chip_id);
2404 if (!card->helper)
2405 {
2406 unifi_error(card->ospriv, "Null ChipHelper\n");
2407 }
2408
2409 unifi_info(card->ospriv, "Chip ID 0x%02X Function %u Block Size %u Name %s(%s)\n",
2410 card->chip_id, card->function, card->sdio_io_block_size,
2411 ChipHelper_MarketingName(card->helper),
2412 ChipHelper_FriendlyName(card->helper));
2413
2414 return CSR_RESULT_SUCCESS;
2415} /* unifi_identify_hw() */
2416
2417
2418static CsrResult unifi_prepare_hw(card_t *card)
2419{
2420 CsrResult r;
2421 CsrResult csrResult;
2422 enum unifi_host_state old_state = card->host_state;
2423
2424 r = unifi_identify_hw(card);
2425 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
2426 {
2427 return r;
2428 }
2429 if (r != CSR_RESULT_SUCCESS)
2430 {
2431 unifi_error(card->ospriv, "Failed to identify hw\n");
2432 return r;
2433 }
2434
2435 unifi_trace(card->ospriv, UDBG1,
2436 "%s mode SDIO\n", card->sdio_io_block_pad?"Block" : "Byte");
2437 /*
2438 * Chip must be a awake or blocks that are asleep may not get
2439 * reset. We can only do this after we have read the chip_id.
2440 */
2441 r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE);
2442 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
2443 {
2444 return r;
2445 }
2446
2447 if (old_state == UNIFI_HOST_STATE_TORPID)
2448 {
2449 /* Ensure the initial clock rate is set; if a reset occurred when the chip was
2450 * TORPID, unifi_set_host_state() may have raised it to MAX.
2451 */
2452 csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_INIT_HZ);
2453 if (csrResult != CSR_RESULT_SUCCESS)
2454 {
2455 r = ConvertCsrSdioToCsrHipResult(card, csrResult);
2456 return r;
2457 }
2458 card->sdio_clock_speed = UNIFI_SDIO_CLOCK_INIT_HZ;
2459 }
2460
2461 /*
2462 * The WLAN function must be enabled to access MAILBOX2 and DEBUG_RST
2463 * registers.
2464 */
2465 csrResult = CsrSdioFunctionEnable(card->sdio_if);
2466 if (csrResult == CSR_SDIO_RESULT_NO_DEVICE)
2467 {
2468 return CSR_WIFI_HIP_RESULT_NO_DEVICE;
2469 }
2470 if (csrResult != CSR_RESULT_SUCCESS)
2471 {
2472 r = ConvertCsrSdioToCsrHipResult(card, csrResult);
2473 /* Can't enable WLAN function. Try resetting the SDIO block. */
2474 unifi_error(card->ospriv, "Failed to re-enable function %d.\n", card->function);
2475 return r;
2476 }
2477
2478 /*
2479 * Poke some registers to make sure the PLL has started,
2480 * otherwise memory accesses are likely to fail.
2481 */
2482 bootstrap_chip_hw(card);
2483
2484 /* Try to read the chip version from register. */
2485 r = unifi_read_chip_version(card);
2486 if (r != CSR_RESULT_SUCCESS)
2487 {
2488 return r;
2489 }
2490
2491 return CSR_RESULT_SUCCESS;
2492} /* unifi_prepare_hw() */
2493
2494
2495static CsrResult unifi_read_chip_version(card_t *card)
2496{
2497 u32 gbl_chip_version;
2498 CsrResult r;
2499 u16 ver;
2500
2501 gbl_chip_version = ChipHelper_GBL_CHIP_VERSION(card->helper);
2502
2503 /* Try to read the chip version from register. */
2504 if (gbl_chip_version != 0)
2505 {
2506 r = unifi_read_direct16(card, gbl_chip_version * 2, &ver);
2507 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
2508 {
2509 return r;
2510 }
2511 if (r != CSR_RESULT_SUCCESS)
2512 {
2513 unifi_error(card->ospriv, "Failed to read GBL_CHIP_VERSION\n");
2514 return r;
2515 }
2516 card->chip_version = ver;
2517 }
2518 else
2519 {
2520 unifi_info(card->ospriv, "Unknown Chip ID, cannot locate GBL_CHIP_VERSION\n");
2521 r = CSR_RESULT_FAILURE;
2522 }
2523
2524 unifi_info(card->ospriv, "Chip Version 0x%04X\n", card->chip_version);
2525
2526 return r;
2527} /* unifi_read_chip_version() */
2528
2529
2530/*
2531 * ---------------------------------------------------------------------------
2532 * unifi_reset_hardware
2533 *
2534 * Execute the UniFi reset sequence.
2535 *
2536 * Note: This may fail if the chip is going TORPID so retry at
2537 * least once.
2538 *
2539 * Arguments:
2540 * card - pointer to card context structure
2541 *
2542 * Returns:
2543 * CSR_RESULT_SUCCESS on success, CSR error otherwise.
2544 *
2545 * Notes:
2546 * Some platforms (e.g. Windows Vista) do not allow access to registers
2547 * that are necessary for a software soft reset.
2548 * ---------------------------------------------------------------------------
2549 */
2550static CsrResult unifi_reset_hardware(card_t *card)
2551{
2552 CsrResult r;
2553 u16 new_block_size = UNIFI_IO_BLOCK_SIZE;
2554 CsrResult csrResult;
2555
2556 /* Errors returned by unifi_prepare_hw() are not critical at this point */
2557 r = unifi_prepare_hw(card);
2558 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
2559 {
2560 return r;
2561 }
2562
2563 /* First try SDIO controller reset, which may power cycle the UniFi, assert
2564 * its reset line, or not be implemented depending on the platform.
2565 */
2566 unifi_info(card->ospriv, "Calling CsrSdioHardReset\n");
2567 csrResult = CsrSdioHardReset(card->sdio_if);
2568 if (csrResult == CSR_RESULT_SUCCESS)
2569 {
2570 unifi_info(card->ospriv, "CsrSdioHardReset succeeded on resetting UniFi\n");
2571 r = unifi_prepare_hw(card);
2572 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
2573 {
2574 return r;
2575 }
2576 if (r != CSR_RESULT_SUCCESS)
2577 {
2578 unifi_error(card->ospriv, "unifi_prepare_hw failed after hard reset\n");
2579 return r;
2580 }
2581 }
2582 else if (csrResult == CSR_SDIO_RESULT_NO_DEVICE)
2583 {
2584 return CSR_WIFI_HIP_RESULT_NO_DEVICE;
2585 }
2586 else
2587 {
2588 /* Falling back to software hard reset methods */
2589 unifi_info(card->ospriv, "Falling back to software hard reset\n");
2590 r = unifi_card_hard_reset(card);
2591 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
2592 {
2593 return r;
2594 }
2595 if (r != CSR_RESULT_SUCCESS)
2596 {
2597 unifi_error(card->ospriv, "software hard reset failed\n");
2598 return r;
2599 }
2600
2601 /* If we fell back to unifi_card_hard_reset() methods, chip version may
2602 * not have been read. (Note in the unlikely event that it is zero,
2603 * it will be harmlessly read again)
2604 */
2605 if (card->chip_version == 0)
2606 {
2607 r = unifi_read_chip_version(card);
2608 if (r != CSR_RESULT_SUCCESS)
2609 {
2610 return r;
2611 }
2612 }
2613 }
2614
2615#ifdef CSR_WIFI_HIP_SDIO_BLOCK_SIZE
2616 new_block_size = CSR_WIFI_HIP_SDIO_BLOCK_SIZE;
2617#endif
2618
2619 /* After hard reset, we need to restore the SDIO block size */
2620 csrResult = CsrSdioBlockSizeSet(card->sdio_if, new_block_size);
2621 r = ConvertCsrSdioToCsrHipResult(card, csrResult);
2622
2623 /* Warn if a different block size was achieved by the transport */
2624 if (card->sdio_if->blockSize != new_block_size)
2625 {
2626 unifi_info(card->ospriv,
2627 "Actually got block size %d\n", card->sdio_if->blockSize);
2628 }
2629
2630 /* sdio_io_block_size always needs be updated from the achieved block size,
2631 * as it is used by the OS layer to allocate memory in unifi_net_malloc().
2632 * Controllers which don't support block mode (e.g. CSPI) will report a
2633 * block size of zero.
2634 */
2635 if (card->sdio_if->blockSize == 0)
2636 {
2637 unifi_info(card->ospriv, "Block size 0, block mode not available\n");
2638
2639 /* Set sdio_io_block_size to 1 so that unifi_net_data_malloc() has a
2640 * sensible rounding value. Elsewhere padding will already be
2641 * disabled because the controller supports byte mode.
2642 */
2643 card->sdio_io_block_size = 1;
2644
2645 /* Controller features must declare support for byte mode */
2646 if (!(card->sdio_if->features & CSR_SDIO_FEATURE_BYTE_MODE))
2647 {
2648 unifi_error(card->ospriv, "Requires byte mode\n");
2649 r = CSR_WIFI_HIP_RESULT_INVALID_VALUE;
2650 }
2651 }
2652 else
2653 {
2654 /* Padding will be enabled if CSR_SDIO_FEATURE_BYTE_MODE isn't set */
2655 card->sdio_io_block_size = card->sdio_if->blockSize;
2656 }
2657
2658
2659 return r;
2660} /* unifi_reset_hardware() */
2661
2662
2663/*
2664 * ---------------------------------------------------------------------------
2665 * card_reset_method_io_enable
2666 *
2667 * Issue a hard reset to the hw writing the IO_ENABLE.
2668 *
2669 * Arguments:
2670 * card Pointer to Card object
2671 *
2672 * Returns:
2673 * 0 on success,
2674 * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected
2675 * CSR_RESULT_FAILURE if an SDIO error occurred or if a response
2676 * was not seen in the expected time
2677 * ---------------------------------------------------------------------------
2678 */
2679static CsrResult card_reset_method_io_enable(card_t *card)
2680{
2681 CsrResult r;
2682 CsrResult csrResult;
2683
2684 /*
2685 * This resets only function 1, so should be used in
2686 * preference to the method below (CSR_FUNC_EN)
2687 */
2688 unifi_trace(card->ospriv, UDBG1, "Hard reset (IO_ENABLE)\n");
2689
2690 csrResult = CsrSdioFunctionDisable(card->sdio_if);
2691 if (csrResult == CSR_SDIO_RESULT_NO_DEVICE)
2692 {
2693 return CSR_WIFI_HIP_RESULT_NO_DEVICE;
2694 }
2695 if (csrResult != CSR_RESULT_SUCCESS)
2696 {
2697 r = ConvertCsrSdioToCsrHipResult(card, csrResult);
2698 unifi_warning(card->ospriv, "SDIO error writing IO_ENABLE: %d\n", r);
2699 }
2700 else
2701 {
2702 /* Delay here to let the reset take affect. */
2703 CsrThreadSleep(RESET_SETTLE_DELAY);
2704
2705 r = card_wait_for_unifi_to_disable(card);
2706 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
2707 {
2708 return r;
2709 }
2710
2711 if (r == CSR_RESULT_SUCCESS)
2712 {
2713 r = card_wait_for_unifi_to_reset(card);
2714 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
2715 {
2716 return r;
2717 }
2718 }
2719 }
2720
2721 if (r != CSR_RESULT_SUCCESS)
2722 {
2723 unifi_trace(card->ospriv, UDBG1, "Hard reset (CSR_FUNC_EN)\n");
2724
2725 r = sdio_write_f0(card, SDIO_CSR_FUNC_EN, 0);
2726 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
2727 {
2728 return r;
2729 }
2730 if (r != CSR_RESULT_SUCCESS)
2731 {
2732 unifi_warning(card->ospriv, "SDIO error writing SDIO_CSR_FUNC_EN: %d\n", r);
2733 return r;
2734 }
2735 else
2736 {
2737 /* Delay here to let the reset take affect. */
2738 CsrThreadSleep(RESET_SETTLE_DELAY);
2739
2740 r = card_wait_for_unifi_to_reset(card);
2741 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
2742 {
2743 return r;
2744 }
2745 }
2746 }
2747
2748 if (r != CSR_RESULT_SUCCESS)
2749 {
2750 unifi_warning(card->ospriv, "card_reset_method_io_enable failed to reset UniFi\n");
2751 }
2752
2753 return r;
2754} /* card_reset_method_io_enable() */
2755
2756
2757/*
2758 * ---------------------------------------------------------------------------
2759 * card_reset_method_dbg_reset
2760 *
2761 * Issue a hard reset to the hw writing the DBG_RESET.
2762 *
2763 * Arguments:
2764 * card Pointer to Card object
2765 *
2766 * Returns:
2767 * CSR_RESULT_SUCCESS on success,
2768 * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected
2769 * CSR_RESULT_FAILURE if an SDIO error occurred or if a response
2770 * was not seen in the expected time
2771 * ---------------------------------------------------------------------------
2772 */
2773static CsrResult card_reset_method_dbg_reset(card_t *card)
2774{
2775 CsrResult r;
2776
2777 /*
2778 * Prepare UniFi for h/w reset
2779 */
2780 if (card->host_state == UNIFI_HOST_STATE_TORPID)
2781 {
2782 r = unifi_set_host_state(card, UNIFI_HOST_STATE_DROWSY);
2783 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
2784 {
2785 return r;
2786 }
2787 if (r != CSR_RESULT_SUCCESS)
2788 {
2789 unifi_error(card->ospriv, "Failed to set UNIFI_HOST_STATE_DROWSY\n");
2790 return r;
2791 }
2792 CsrThreadSleep(5);
2793 }
2794
2795 r = unifi_card_stop_processor(card, UNIFI_PROC_BOTH);
2796 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
2797 {
2798 return r;
2799 }
2800 if (r != CSR_RESULT_SUCCESS)
2801 {
2802 unifi_error(card->ospriv, "Can't stop processors\n");
2803 return r;
2804 }
2805
2806 unifi_trace(card->ospriv, UDBG1, "Hard reset (DBG_RESET)\n");
2807
2808 /*
2809 * This register write may fail. The debug reset resets
2810 * parts of the Function 0 sections of the chip, and
2811 * therefore the response cannot be sent back to the host.
2812 */
2813 r = unifi_write_direct_8_or_16(card, ChipHelper_DBG_RESET(card->helper) * 2, 1);
2814 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
2815 {
2816 return r;
2817 }
2818 if (r != CSR_RESULT_SUCCESS)
2819 {
2820 unifi_warning(card->ospriv, "SDIO error writing DBG_RESET: %d\n", r);
2821 return r;
2822 }
2823
2824 /* Delay here to let the reset take affect. */
2825 CsrThreadSleep(RESET_SETTLE_DELAY);
2826
2827 r = card_wait_for_unifi_to_reset(card);
2828 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
2829 {
2830 return r;
2831 }
2832 if (r != CSR_RESULT_SUCCESS)
2833 {
2834 unifi_warning(card->ospriv, "card_reset_method_dbg_reset failed to reset UniFi\n");
2835 }
2836
2837 return r;
2838} /* card_reset_method_dbg_reset() */
2839
2840
2841/*
2842 * ---------------------------------------------------------------------------
2843 * unifi_card_hard_reset
2844 *
2845 * Issue reset to hardware, by writing to registers on the card.
2846 * Power to the card is preserved.
2847 *
2848 * Arguments:
2849 * card Pointer to Card object
2850 *
2851 * Returns:
2852 * CSR_RESULT_SUCCESS on success,
2853 * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected
2854 * CSR_RESULT_FAILURE if an SDIO error occurred or if a response
2855 * was not seen in the expected time
2856 * ---------------------------------------------------------------------------
2857 */
2858CsrResult unifi_card_hard_reset(card_t *card)
2859{
2860 CsrResult r;
2861 const struct chip_helper_reset_values *init_data;
2862 u32 chunks;
2863
2864 /* Clear cache of page registers */
2865 card->proc_select = (u32)(-1);
2866 card->dmem_page = (u32)(-1);
2867 card->pmem_page = (u32)(-1);
2868
2869 /*
2870 * We need to have a valid card->helper before we use software hard reset.
2871 * If unifi_identify_hw() fails to get the card ID, it probably means
2872 * that there is no way to talk to the h/w.
2873 */
2874 r = unifi_identify_hw(card);
2875 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
2876 {
2877 return r;
2878 }
2879 if (r != CSR_RESULT_SUCCESS)
2880 {
2881 unifi_error(card->ospriv, "unifi_card_hard_reset failed to identify h/w\n");
2882 return r;
2883 }
2884
2885 /* Search for some reset code. */
2886 chunks = ChipHelper_HostResetSequence(card->helper, &init_data);
2887 if (chunks != 0)
2888 {
2889 unifi_error(card->ospriv,
2890 "Hard reset (Code download) is unsupported\n");
2891
2892 return CSR_RESULT_FAILURE;
2893 }
2894
2895 if (card->chip_id > SDIO_CARD_ID_UNIFI_2)
2896 {
2897 /* The HIP spec considers this a bus-specific reset.
2898 * This resets only function 1, so should be used in
2899 * preference to the method below (CSR_FUNC_EN)
2900 * If this method fails, it means that the f/w is probably
2901 * not running. In this case, try the DBG_RESET method.
2902 */
2903 r = card_reset_method_io_enable(card);
2904 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
2905 {
2906 return r;
2907 }
2908 if (r == CSR_RESULT_SUCCESS)
2909 {
2910 return r;
2911 }
2912 }
2913
2914 /* Software hard reset */
2915 r = card_reset_method_dbg_reset(card);
2916
2917 return r;
2918} /* unifi_card_hard_reset() */
2919
2920
2921/*
2922 * ---------------------------------------------------------------------------
2923 *
2924 * CardGenInt
2925 *
2926 * Prod the card.
2927 * This function causes an internal interrupt to be raised in the
2928 * UniFi chip. It is used to signal the firmware that some action has
2929 * been completed.
2930 * The UniFi Host Interface asks that the value used increments for
2931 * debugging purposes.
2932 *
2933 * Arguments:
2934 * card Pointer to Card object
2935 *
2936 * Returns:
2937 * CSR_RESULT_SUCCESS on success,
2938 * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected
2939 * CSR_RESULT_FAILURE if an SDIO error occurred or if a response
2940 * was not seen in the expected time
2941 * ---------------------------------------------------------------------------
2942 */
2943CsrResult CardGenInt(card_t *card)
2944{
2945 CsrResult r;
2946
2947 if (card->chip_id > SDIO_CARD_ID_UNIFI_2)
2948 {
2949 r = sdio_write_f0(card, SDIO_CSR_FROM_HOST_SCRATCH0,
2950 (u8)card->unifi_interrupt_seq);
2951 }
2952 else
2953 {
2954 r = unifi_write_direct_8_or_16(card,
2955 ChipHelper_SHARED_IO_INTERRUPT(card->helper) * 2,
2956 (u8)card->unifi_interrupt_seq);
2957 }
2958 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
2959 {
2960 return r;
2961 }
2962 if (r != CSR_RESULT_SUCCESS)
2963 {
2964 unifi_error(card->ospriv, "SDIO error writing UNIFI_SHARED_IO_INTERRUPT: %d\n", r);
2965 return r;
2966 }
2967
2968 card->unifi_interrupt_seq++;
2969
2970 return CSR_RESULT_SUCCESS;
2971} /* CardGenInt() */
2972
2973
2974/*
2975 * ---------------------------------------------------------------------------
2976 * CardEnableInt
2977 *
2978 * Enable the outgoing SDIO interrupt from UniFi to the host.
2979 *
2980 * Arguments:
2981 * card Pointer to Card object
2982 *
2983 * Returns:
2984 * CSR_RESULT_SUCCESS on success,
2985 * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected
2986 * CSR_RESULT_FAILURE if an SDIO error occurred,
2987 * ---------------------------------------------------------------------------
2988 */
2989CsrResult CardEnableInt(card_t *card)
2990{
2991 CsrResult r;
2992 u8 int_enable;
2993
2994 r = sdio_read_f0(card, SDIO_INT_ENABLE, &int_enable);
2995 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
2996 {
2997 return r;
2998 }
2999 if (r != CSR_RESULT_SUCCESS)
3000 {
3001 unifi_error(card->ospriv, "SDIO error reading SDIO_INT_ENABLE\n");
3002 return r;
3003 }
3004
3005 int_enable |= (1 << card->function) | UNIFI_SD_INT_ENABLE_IENM;
3006
3007 r = sdio_write_f0(card, SDIO_INT_ENABLE, int_enable);
3008 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
3009 {
3010 return r;
3011 }
3012 if (r != CSR_RESULT_SUCCESS)
3013 {
3014 unifi_error(card->ospriv, "SDIO error writing SDIO_INT_ENABLE\n");
3015 return r;
3016 }
3017
3018 return CSR_RESULT_SUCCESS;
3019} /* CardEnableInt() */
3020
3021
3022/*
3023 * ---------------------------------------------------------------------------
3024 * CardDisableInt
3025 *
3026 * Disable the outgoing SDIO interrupt from UniFi to the host.
3027 *
3028 * Arguments:
3029 * card Pointer to Card object
3030 *
3031 * Returns:
3032 * CSR_RESULT_SUCCESS on success,
3033 * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected
3034 * CSR_RESULT_FAILURE if an SDIO error occurred,
3035 * ---------------------------------------------------------------------------
3036 */
3037CsrResult CardDisableInt(card_t *card)
3038{
3039 CsrResult r;
3040 u8 int_enable;
3041
3042 r = sdio_read_f0(card, SDIO_INT_ENABLE, &int_enable);
3043 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
3044 {
3045 return r;
3046 }
3047 if (r != CSR_RESULT_SUCCESS)
3048 {
3049 unifi_error(card->ospriv, "SDIO error reading SDIO_INT_ENABLE\n");
3050 return r;
3051 }
3052
3053 int_enable &= ~(1 << card->function);
3054
3055 r = sdio_write_f0(card, SDIO_INT_ENABLE, int_enable);
3056 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
3057 {
3058 return r;
3059 }
3060 if (r != CSR_RESULT_SUCCESS)
3061 {
3062 unifi_error(card->ospriv, "SDIO error writing SDIO_INT_ENABLE\n");
3063 return r;
3064 }
3065
3066 return CSR_RESULT_SUCCESS;
3067} /* CardDisableInt() */
3068
3069
3070/*
3071 * ---------------------------------------------------------------------------
3072 * CardPendingInt
3073 *
3074 * Determine whether UniFi is currently asserting the SDIO interrupt
3075 * request.
3076 *
3077 * Arguments:
3078 * card Pointer to Card object
3079 * pintr Pointer to location to write interrupt status,
3080 * TRUE if interrupt pending,
3081 * FALSE if no interrupt pending.
3082 * Returns:
3083 * CSR_RESULT_SUCCESS interrupt status read successfully
3084 * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected
3085 * CSR_RESULT_FAILURE if an SDIO error occurred,
3086 * ---------------------------------------------------------------------------
3087 */
3088CsrResult CardPendingInt(card_t *card, u8 *pintr)
3089{
3090 CsrResult r;
3091 u8 pending;
3092
3093 *pintr = FALSE;
3094
3095 r = sdio_read_f0(card, SDIO_INT_PENDING, &pending);
3096 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
3097 {
3098 return r;
3099 }
3100 if (r != CSR_RESULT_SUCCESS)
3101 {
3102 unifi_error(card->ospriv, "SDIO error reading SDIO_INT_PENDING\n");
3103 return r;
3104 }
3105
3106 *pintr = (pending & (1 << card->function))?TRUE : FALSE;
3107
3108 return CSR_RESULT_SUCCESS;
3109} /* CardPendingInt() */
3110
3111
3112/*
3113 * ---------------------------------------------------------------------------
3114 * CardClearInt
3115 *
3116 * Clear the UniFi SDIO interrupt request.
3117 *
3118 * Arguments:
3119 * card Pointer to Card object
3120 *
3121 * Returns:
3122 * CSR_RESULT_SUCCESS if pending interrupt was cleared, or no pending interrupt.
3123 * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected
3124 * CSR_RESULT_FAILURE if an SDIO error occurred,
3125 * ---------------------------------------------------------------------------
3126 */
3127CsrResult CardClearInt(card_t *card)
3128{
3129 CsrResult r;
3130 u8 intr;
3131
3132 if (card->chip_id > SDIO_CARD_ID_UNIFI_2)
3133 {
3134 /* CardPendingInt() sets intr, if there is a pending interrupt */
3135 r = CardPendingInt(card, &intr);
3136 if (intr == FALSE)
3137 {
3138 return r;
3139 }
3140
3141 r = sdio_write_f0(card, SDIO_CSR_HOST_INT_CLEAR, 1);
3142 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
3143 {
3144 return r;
3145 }
3146 if (r != CSR_RESULT_SUCCESS)
3147 {
3148 unifi_error(card->ospriv, "SDIO error writing SDIO_CSR_HOST_INT_CLEAR\n");
3149 }
3150 }
3151 else
3152 {
3153 r = unifi_write_direct_8_or_16(card,
3154 ChipHelper_SDIO_HOST_INT(card->helper) * 2,
3155 0);
3156 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
3157 {
3158 return r;
3159 }
3160 if (r != CSR_RESULT_SUCCESS)
3161 {
3162 unifi_error(card->ospriv, "SDIO error writing UNIFI_SDIO_HOST_INT\n");
3163 }
3164 }
3165
3166 return r;
3167} /* CardClearInt() */
3168
3169
3170/*
3171 * ---------------------------------------------------------------------------
3172 * CardIntEnabled
3173 *
3174 * Determine whether UniFi is currently asserting the SDIO interrupt
3175 * request.
3176 *
3177 * Arguments:
3178 * card Pointer to Card object
3179 * enabled Pointer to location to write interrupt enable status,
3180 * TRUE if interrupts enabled,
3181 * FALSE if interupts disabled.
3182 *
3183 * Returns:
3184 * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected
3185 * CSR_RESULT_FAILURE if an SDIO error occurred,
3186 * ---------------------------------------------------------------------------
3187 */
3188CsrResult CardIntEnabled(card_t *card, u8 *enabled)
3189{
3190 CsrResult r;
3191 u8 int_enable;
3192
3193 r = sdio_read_f0(card, SDIO_INT_ENABLE, &int_enable);
3194 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
3195 {
3196 return r;
3197 }
3198 if (r != CSR_RESULT_SUCCESS)
3199 {
3200 unifi_error(card->ospriv, "SDIO error reading SDIO_INT_ENABLE\n");
3201 return r;
3202 }
3203
3204 *enabled = (int_enable & (1 << card->function))?TRUE : FALSE;
3205
3206 return CSR_RESULT_SUCCESS;
3207} /* CardIntEnabled() */
3208
3209
3210/*
3211 * ---------------------------------------------------------------------------
3212 * CardWriteBulkData
3213 * Allocate slot in the pending bulkdata arrays and assign it to a signal's
3214 * bulkdata reference. The slot is then ready for UniFi's bulkdata commands
3215 * to transfer the data to/from the host.
3216 *
3217 * Arguments:
3218 * card Pointer to Card object
3219 * csptr Pending signal pointer, including bulkdata ref
3220 * queue Traffic queue that this signal is using
3221 *
3222 * Returns:
3223 * CSR_RESULT_SUCCESS if a free slot was assigned
3224 * CSR_RESULT_FAILURE if no slot was available
3225 * ---------------------------------------------------------------------------
3226 */
3227CsrResult CardWriteBulkData(card_t *card, card_signal_t *csptr, unifi_TrafficQueue queue)
3228{
3229 u16 i, slots[UNIFI_MAX_DATA_REFERENCES], j = 0;
3230 u8 *packed_sigptr, num_slots_required = 0;
3231 bulk_data_desc_t *bulkdata = csptr->bulkdata;
3232 s16 h, nslots;
3233
3234 /* Count the number of slots required */
3235 for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++)
3236 {
3237 if (bulkdata[i].data_length != 0)
3238 {
3239 num_slots_required++;
3240 }
3241 }
3242
3243 /* Get the slot numbers */
3244 if (num_slots_required != 0)
3245 {
3246 /* Last 2 slots for MLME */
3247 if (queue == UNIFI_TRAFFIC_Q_MLME)
3248 {
3249 h = card->config_data.num_fromhost_data_slots - UNIFI_RESERVED_COMMAND_SLOTS;
3250 for (i = 0; i < card->config_data.num_fromhost_data_slots; i++)
3251 {
3252 if (card->from_host_data[h].bd.data_length == 0)
3253 {
3254 /* Free data slot, claim it */
3255 slots[j++] = h;
3256 if (j == num_slots_required)
3257 {
3258 break;
3259 }
3260 }
3261
3262 if (++h >= card->config_data.num_fromhost_data_slots)
3263 {
3264 h = 0;
3265 }
3266 }
3267 }
3268 else
3269 {
3270 if (card->dynamic_slot_data.from_host_used_slots[queue]
3271 < card->dynamic_slot_data.from_host_max_slots[queue])
3272 {
3273 /* Data commands get a free slot only after a few checks */
3274 nslots = card->config_data.num_fromhost_data_slots - UNIFI_RESERVED_COMMAND_SLOTS;
3275
3276 h = card->from_host_data_head;
3277
3278 for (i = 0; i < nslots; i++)
3279 {
3280 if (card->from_host_data[h].bd.data_length == 0)
3281 {
3282 /* Free data slot, claim it */
3283 slots[j++] = h;
3284 if (j == num_slots_required)
3285 {
3286 break;
3287 }
3288 }
3289
3290 if (++h >= nslots)
3291 {
3292 h = 0;
3293 }
3294 }
3295 card->from_host_data_head = h;
3296 }
3297 }
3298
3299 /* Required number of slots are not available, bail out */
3300 if (j != num_slots_required)
3301 {
3302 unifi_trace(card->ospriv, UDBG5, "CardWriteBulkData: didn't find free slot/s\n");
3303
3304 /* If we haven't already reached the stable state we can ask for reservation */
3305 if ((queue != UNIFI_TRAFFIC_Q_MLME) && (card->dynamic_slot_data.queue_stable[queue] == FALSE))
3306 {
3307 CardCheckDynamicReservation(card, queue);
3308 }
3309
3310 for (i = 0; i < card->config_data.num_fromhost_data_slots; i++)
3311 {
3312 unifi_trace(card->ospriv, UDBG5, "fh data slot %d: %d\n", i, card->from_host_data[i].bd.data_length);
3313 }
3314 return CSR_RESULT_FAILURE;
3315 }
3316 }
3317
3318 packed_sigptr = csptr->sigbuf;
3319
3320 /* Fill in the slots with data */
3321 j = 0;
3322 for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++)
3323 {
3324 if (bulkdata[i].data_length == 0)
3325 {
3326 /* Zero-out the DATAREF in the signal */
3327 SET_PACKED_DATAREF_SLOT(packed_sigptr, i, 0);
3328 SET_PACKED_DATAREF_LEN(packed_sigptr, i, 0);
3329 }
3330 else
3331 {
3332 /*
3333 * Fill in the slot number in the SIGNAL structure but
3334 * preserve the offset already in there
3335 */
3336 SET_PACKED_DATAREF_SLOT(packed_sigptr, i, slots[j] | (((u16)packed_sigptr[SIZEOF_SIGNAL_HEADER + (i * SIZEOF_DATAREF) + 1]) << 8));
3337 SET_PACKED_DATAREF_LEN(packed_sigptr, i, bulkdata[i].data_length);
3338
3339 /* Do not copy the data, just store the information to them */
3340 card->from_host_data[slots[j]].bd.os_data_ptr = bulkdata[i].os_data_ptr;
3341 card->from_host_data[slots[j]].bd.os_net_buf_ptr = bulkdata[i].os_net_buf_ptr;
3342 card->from_host_data[slots[j]].bd.data_length = bulkdata[i].data_length;
3343 card->from_host_data[slots[j]].bd.net_buf_length = bulkdata[i].net_buf_length;
3344 card->from_host_data[slots[j]].queue = queue;
3345
3346 unifi_trace(card->ospriv, UDBG4, "CardWriteBulkData sig=0x%x, fh slot %d = %p\n",
3347 GET_SIGNAL_ID(packed_sigptr), i, bulkdata[i].os_data_ptr);
3348
3349 /* Sanity-check that the bulk data desc being assigned to the slot
3350 * actually has a payload.
3351 */
3352 if (!bulkdata[i].os_data_ptr)
3353 {
3354 unifi_error(card->ospriv, "Assign null os_data_ptr (len=%d) fh slot %d, i=%d, q=%d, sig=0x%x",
3355 bulkdata[i].data_length, slots[j], i, queue, GET_SIGNAL_ID(packed_sigptr));
3356 }
3357
3358 j++;
3359 if (queue < UNIFI_NO_OF_TX_QS)
3360 {
3361 card->dynamic_slot_data.from_host_used_slots[queue]++;
3362 }
3363 }
3364 }
3365
3366 return CSR_RESULT_SUCCESS;
3367} /* CardWriteBulkData() */
3368
3369
3370/*
3371 * ---------------------------------------------------------------------------
3372 * card_find_data_slot
3373 *
3374 * Dereference references to bulk data slots into pointers to real data.
3375 *
3376 * Arguments:
3377 * card Pointer to the card struct.
3378 * slot Slot number from a signal structure
3379 *
3380 * Returns:
3381 * Pointer to entry in bulk_data_slot array.
3382 * ---------------------------------------------------------------------------
3383 */
3384bulk_data_desc_t* card_find_data_slot(card_t *card, s16 slot)
3385{
3386 s16 sn;
3387 bulk_data_desc_t *bd;
3388
3389 sn = slot & 0x7FFF;
3390
3391 /* ?? check sanity of slot number ?? */
3392
3393 if (slot & SLOT_DIR_TO_HOST)
3394 {
3395 bd = &card->to_host_data[sn];
3396 }
3397 else
3398 {
3399 bd = &card->from_host_data[sn].bd;
3400 }
3401
3402 return bd;
3403} /* card_find_data_slot() */
3404
3405
3406/*
3407 * ---------------------------------------------------------------------------
3408 * firmware_present_in_flash
3409 *
3410 * Probe for external Flash that looks like it might contain firmware.
3411 *
3412 * If Flash is not present, reads always return 0x0008.
3413 * If Flash is present, but empty, reads return 0xFFFF.
3414 * Anything else is considered to be firmware.
3415 *
3416 * Arguments:
3417 * card Pointer to card struct
3418 *
3419 * Returns:
3420 * CSR_RESULT_SUCCESS firmware is present in ROM or flash
3421 * CSR_WIFI_HIP_RESULT_NOT_FOUND firmware is not present in ROM or flash
3422 * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected
3423 * CSR_RESULT_FAILURE if an SDIO error occurred
3424 * ---------------------------------------------------------------------------
3425 */
3426static CsrResult firmware_present_in_flash(card_t *card)
3427{
3428 CsrResult r;
3429 u16 m1, m5;
3430
3431 if (ChipHelper_HasRom(card->helper))
3432 {
3433 return CSR_RESULT_SUCCESS;
3434 }
3435 if (!ChipHelper_HasFlash(card->helper))
3436 {
3437 return CSR_WIFI_HIP_RESULT_NOT_FOUND;
3438 }
3439
3440 /*
3441 * Examine the Flash locations that are the power-on default reset
3442 * vectors of the XAP processors.
3443 * These are words 1 and 5 in Flash.
3444 */
3445 r = unifi_card_read16(card, UNIFI_MAKE_GP(EXT_FLASH, 2), &m1);
3446 if (r != CSR_RESULT_SUCCESS)
3447 {
3448 return r;
3449 }
3450
3451 r = unifi_card_read16(card, UNIFI_MAKE_GP(EXT_FLASH, 10), &m5);
3452 if (r != CSR_RESULT_SUCCESS)
3453 {
3454 return r;
3455 }
3456
3457 /* Check for uninitialised/missing flash */
3458 if ((m1 == 0x0008) || (m1 == 0xFFFF) ||
3459 (m1 == 0x0004) || (m5 == 0x0004) ||
3460 (m5 == 0x0008) || (m5 == 0xFFFF))
3461 {
3462 return CSR_WIFI_HIP_RESULT_NOT_FOUND;
3463 }
3464
3465 return CSR_RESULT_SUCCESS;
3466} /* firmware_present_in_flash() */
3467
3468
3469/*
3470 * ---------------------------------------------------------------------------
3471 * bootstrap_chip_hw
3472 *
3473 * Perform chip specific magic to "Get It Working" TM. This will
3474 * increase speed of PLLs in analogue and maybe enable some
3475 * on-chip regulators.
3476 *
3477 * Arguments:
3478 * card Pointer to card struct
3479 *
3480 * Returns:
3481 * None.
3482 * ---------------------------------------------------------------------------
3483 */
3484static void bootstrap_chip_hw(card_t *card)
3485{
3486 const struct chip_helper_init_values *vals;
3487 u32 i, len;
3488 void *sdio = card->sdio_if;
3489 CsrResult csrResult;
3490
3491 len = ChipHelper_ClockStartupSequence(card->helper, &vals);
3492 if (len != 0)
3493 {
3494 for (i = 0; i < len; i++)
3495 {
3496 csrResult = CsrSdioWrite16(sdio, vals[i].addr * 2, vals[i].value);
3497 if (csrResult != CSR_RESULT_SUCCESS)
3498 {
3499 unifi_warning(card->ospriv, "Failed to write bootstrap value %d\n", i);
3500 /* Might not be fatal */
3501 }
3502
3503 CsrThreadSleep(1);
3504 }
3505 }
3506} /* bootstrap_chip_hw() */
3507
3508
3509/*
3510 * ---------------------------------------------------------------------------
3511 * unifi_card_stop_processor
3512 *
3513 * Stop the UniFi XAP processors.
3514 *
3515 * Arguments:
3516 * card Pointer to card struct
3517 * which One of UNIFI_PROC_MAC, UNIFI_PROC_PHY, UNIFI_PROC_BOTH
3518 *
3519 * Returns:
3520 * CSR_RESULT_SUCCESS if successful, or CSR error code
3521 * ---------------------------------------------------------------------------
3522 */
3523CsrResult unifi_card_stop_processor(card_t *card, enum unifi_dbg_processors_select which)
3524{
3525 CsrResult r = CSR_RESULT_SUCCESS;
3526 u8 status;
3527 s16 retry = 100;
3528
3529 while (retry--)
3530 {
3531 /* Select both XAPs */
3532 r = unifi_set_proc_select(card, which);
3533 if (r != CSR_RESULT_SUCCESS)
3534 {
3535 break;
3536 }
3537
3538 /* Stop processors */
3539 r = unifi_write_direct16(card, ChipHelper_DBG_EMU_CMD(card->helper) * 2, 2);
3540 if (r != CSR_RESULT_SUCCESS)
3541 {
3542 break;
3543 }
3544
3545 /* Read status */
3546 r = unifi_read_direct_8_or_16(card,
3547 ChipHelper_DBG_HOST_STOP_STATUS(card->helper) * 2,
3548 &status);
3549 if (r != CSR_RESULT_SUCCESS)
3550 {
3551 break;
3552 }
3553
3554 if ((status & 1) == 1)
3555 {
3556 /* Success! */
3557 return CSR_RESULT_SUCCESS;
3558 }
3559
3560 /* Processors didn't stop, try again */
3561 }
3562
3563 if (r != CSR_RESULT_SUCCESS)
3564 {
3565 /* An SDIO error occurred */
3566 unifi_error(card->ospriv, "Failed to stop processors: SDIO error\n");
3567 }
3568 else
3569 {
3570 /* If we reach here, we didn't the status in time. */
3571 unifi_error(card->ospriv, "Failed to stop processors: timeout waiting for stopped status\n");
3572 r = CSR_RESULT_FAILURE;
3573 }
3574
3575 return r;
3576} /* unifi_card_stop_processor() */
3577
3578
3579/*
3580 * ---------------------------------------------------------------------------
3581 * card_start_processor
3582 *
3583 * Start the UniFi XAP processors.
3584 *
3585 * Arguments:
3586 * card Pointer to card struct
3587 * which One of UNIFI_PROC_MAC, UNIFI_PROC_PHY, UNIFI_PROC_BOTH
3588 *
3589 * Returns:
3590 * CSR_RESULT_SUCCESS or CSR error code
3591 * ---------------------------------------------------------------------------
3592 */
3593CsrResult card_start_processor(card_t *card, enum unifi_dbg_processors_select which)
3594{
3595 CsrResult r;
3596
3597 /* Select both XAPs */
3598 r = unifi_set_proc_select(card, which);
3599 if (r != CSR_RESULT_SUCCESS)
3600 {
3601 unifi_error(card->ospriv, "unifi_set_proc_select failed: %d.\n", r);
3602 return r;
3603 }
3604
3605
3606 r = unifi_write_direct_8_or_16(card,
3607 ChipHelper_DBG_EMU_CMD(card->helper) * 2, 8);
3608 if (r != CSR_RESULT_SUCCESS)
3609 {
3610 return r;
3611 }
3612
3613 r = unifi_write_direct_8_or_16(card,
3614 ChipHelper_DBG_EMU_CMD(card->helper) * 2, 0);
3615 if (r != CSR_RESULT_SUCCESS)
3616 {
3617 return r;
3618 }
3619
3620 return CSR_RESULT_SUCCESS;
3621} /* card_start_processor() */
3622
3623
3624/*
3625 * ---------------------------------------------------------------------------
3626 * unifi_set_interrupt_mode
3627 *
3628 * Configure the interrupt processing mode used by the HIP
3629 *
3630 * Arguments:
3631 * card Pointer to card struct
3632 * mode Interrupt mode to apply
3633 *
3634 * Returns:
3635 * None
3636 * ---------------------------------------------------------------------------
3637 */
3638void unifi_set_interrupt_mode(card_t *card, u32 mode)
3639{
3640 if (mode == CSR_WIFI_INTMODE_RUN_BH_ONCE)
3641 {
3642 unifi_info(card->ospriv, "Scheduled interrupt mode");
3643 }
3644 card->intmode = mode;
3645} /* unifi_set_interrupt_mode() */
3646
3647
3648/*
3649 * ---------------------------------------------------------------------------
3650 * unifi_start_processors
3651 *
3652 * Start all UniFi XAP processors.
3653 *
3654 * Arguments:
3655 * card Pointer to card struct
3656 *
3657 * Returns:
3658 * CSR_RESULT_SUCCESS on success, CSR error code on error
3659 * ---------------------------------------------------------------------------
3660 */
3661CsrResult unifi_start_processors(card_t *card)
3662{
3663 return card_start_processor(card, UNIFI_PROC_BOTH);
3664} /* unifi_start_processors() */
3665
3666
3667/*
3668 * ---------------------------------------------------------------------------
3669 * unifi_request_max_sdio_clock
3670 *
3671 * Requests that the maximum SDIO clock rate is set at the next suitable
3672 * opportunity (e.g. when the BH next runs, so as not to interfere with
3673 * any current operation).
3674 *
3675 * Arguments:
3676 * card Pointer to card struct
3677 *
3678 * Returns:
3679 * None
3680 * ---------------------------------------------------------------------------
3681 */
3682void unifi_request_max_sdio_clock(card_t *card)
3683{
3684 card->request_max_clock = 1;
3685} /* unifi_request_max_sdio_clock() */
3686
3687
3688/*
3689 * ---------------------------------------------------------------------------
3690 * unifi_set_host_state
3691 *
3692 * Set the host deep-sleep state.
3693 *
3694 * If transitioning to TORPID, the SDIO driver will be notified
3695 * that the SD bus will be unused (idle) and conversely, when
3696 * transitioning from TORPID that the bus will be used (active).
3697 *
3698 * Arguments:
3699 * card Pointer to card struct
3700 * state New deep-sleep state.
3701 *
3702 * Returns:
3703 * CSR_RESULT_SUCCESS on success
3704 * CSR_WIFI_HIP_RESULT_NO_DEVICE if the card was ejected
3705 * CSR_RESULT_FAILURE if an SDIO error occurred
3706 *
3707 * Notes:
3708 * We need to reduce the SDIO clock speed before trying to wake up the
3709 * chip. Actually, in the implementation below we reduce the clock speed
3710 * not just before we try to wake up the chip, but when we put the chip to
3711 * deep sleep. This means that if the f/w wakes up on its' own, we waste
3712 * a reduce/increace cycle. However, trying to eliminate this overhead is
3713 * proved difficult, as the current state machine in the HIP lib does at
3714 * least a CMD52 to disable the interrupts before we configure the host
3715 * state.
3716 * ---------------------------------------------------------------------------
3717 */
3718CsrResult unifi_set_host_state(card_t *card, enum unifi_host_state state)
3719{
3720 CsrResult r = CSR_RESULT_SUCCESS;
3721 CsrResult csrResult;
3722 static const char *const states[] = {
3723 "AWAKE", "DROWSY", "TORPID"
3724 };
3725 static const u8 state_csr_host_wakeup[] = {
3726 1, 3, 0
3727 };
3728 static const u8 state_io_abort[] = {
3729 0, 2, 3
3730 };
3731
3732 unifi_trace(card->ospriv, UDBG4, "State %s to %s\n",
3733 states[card->host_state], states[state]);
3734
3735 if (card->host_state == UNIFI_HOST_STATE_TORPID)
3736 {
3737 CsrSdioFunctionActive(card->sdio_if);
3738 }
3739
3740 /* Write the new state to UniFi. */
3741 if (card->chip_id > SDIO_CARD_ID_UNIFI_2)
3742 {
3743 r = sdio_write_f0(card, SDIO_CSR_HOST_WAKEUP,
3744 (u8)((card->function << 4) | state_csr_host_wakeup[state]));
3745 }
3746 else
3747 {
3748 r = sdio_write_f0(card, SDIO_IO_ABORT, state_io_abort[state]);
3749 }
3750
3751 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
3752 {
3753 return r;
3754 }
3755 if (r != CSR_RESULT_SUCCESS)
3756 {
3757 unifi_error(card->ospriv, "Failed to write UniFi deep sleep state\n");
3758 }
3759 else
3760 {
3761 /*
3762 * If the chip was in state TORPID then we can now increase
3763 * the maximum bus clock speed.
3764 */
3765 if (card->host_state == UNIFI_HOST_STATE_TORPID)
3766 {
3767 csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if,
3768 UNIFI_SDIO_CLOCK_MAX_HZ);
3769 r = ConvertCsrSdioToCsrHipResult(card, csrResult);
3770 /* Non-fatal error */
3771 if (r != CSR_RESULT_SUCCESS && r != CSR_WIFI_HIP_RESULT_NO_DEVICE)
3772 {
3773 unifi_warning(card->ospriv,
3774 "Failed to increase the SDIO clock speed\n");
3775 }
3776 else
3777 {
3778 card->sdio_clock_speed = UNIFI_SDIO_CLOCK_MAX_HZ;
3779 }
3780 }
3781
3782 /*
3783 * Cache the current state in the card structure to avoid
3784 * unnecessary SDIO reads.
3785 */
3786 card->host_state = state;
3787
3788 if (state == UNIFI_HOST_STATE_TORPID)
3789 {
3790 /*
3791 * If the chip is now in state TORPID then we must now decrease
3792 * the maximum bus clock speed.
3793 */
3794 csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if,
3795 UNIFI_SDIO_CLOCK_SAFE_HZ);
3796 r = ConvertCsrSdioToCsrHipResult(card, csrResult);
3797 if (r != CSR_RESULT_SUCCESS && r != CSR_WIFI_HIP_RESULT_NO_DEVICE)
3798 {
3799 unifi_warning(card->ospriv,
3800 "Failed to decrease the SDIO clock speed\n");
3801 }
3802 else
3803 {
3804 card->sdio_clock_speed = UNIFI_SDIO_CLOCK_SAFE_HZ;
3805 }
3806 CsrSdioFunctionIdle(card->sdio_if);
3807 }
3808 }
3809
3810 return r;
3811} /* unifi_set_host_state() */
3812
3813
3814/*
3815 * ---------------------------------------------------------------------------
3816 * unifi_card_info
3817 *
3818 * Update the card information data structure
3819 *
3820 * Arguments:
3821 * card Pointer to card struct
3822 * card_info Pointer to info structure to update
3823 *
3824 * Returns:
3825 * None
3826 * ---------------------------------------------------------------------------
3827 */
3828void unifi_card_info(card_t *card, card_info_t *card_info)
3829{
3830 card_info->chip_id = card->chip_id;
3831 card_info->chip_version = card->chip_version;
3832 card_info->fw_build = card->build_id;
3833 card_info->fw_hip_version = card->config_data.version;
3834 card_info->sdio_block_size = card->sdio_io_block_size;
3835} /* unifi_card_info() */
3836
3837
3838/*
3839 * ---------------------------------------------------------------------------
3840 * unifi_check_io_status
3841 *
3842 * Check UniFi for spontaneous reset and pending interrupt.
3843 *
3844 * Arguments:
3845 * card Pointer to card struct
3846 * status Pointer to location to write chip status:
3847 * 0 if UniFi is running, and no interrupt pending
3848 * 1 if UniFi has spontaneously reset
3849 * 2 if there is a pending interrupt
3850 * Returns:
3851 * CSR_RESULT_SUCCESS if OK, or CSR error
3852 * ---------------------------------------------------------------------------
3853 */
3854CsrResult unifi_check_io_status(card_t *card, s32 *status)
3855{
3856 u8 io_en;
3857 CsrResult r;
3858 u8 pending;
3859
3860 *status = 0;
3861
3862 r = sdio_read_f0(card, SDIO_IO_ENABLE, &io_en);
3863 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
3864 {
3865 return r;
3866 }
3867 if (r != CSR_RESULT_SUCCESS)
3868 {
3869 unifi_error(card->ospriv, "Failed to read SDIO_IO_ENABLE to check for spontaneous reset\n");
3870 return r;
3871 }
3872
3873 if ((io_en & (1 << card->function)) == 0)
3874 {
3875 s32 fw_count;
3876 *status = 1;
3877 unifi_error(card->ospriv, "UniFi has spontaneously reset.\n");
3878
3879 /*
3880 * These reads are very likely to fail. We want to know if the function is really
3881 * disabled or the SDIO driver just returns rubbish.
3882 */
3883 fw_count = unifi_read_shared_count(card, card->sdio_ctrl_addr + 4);
3884 if (fw_count < 0)
3885 {
3886 unifi_error(card->ospriv, "Failed to read to-host sig written count\n");
3887 }
3888 else
3889 {
3890 unifi_error(card->ospriv, "thsw: %u (driver thinks is %u)\n",
3891 fw_count, card->to_host_signals_w);
3892 }
3893 fw_count = unifi_read_shared_count(card, card->sdio_ctrl_addr + 2);
3894 if (fw_count < 0)
3895 {
3896 unifi_error(card->ospriv, "Failed to read from-host sig read count\n");
3897 }
3898 else
3899 {
3900 unifi_error(card->ospriv, "fhsr: %u (driver thinks is %u)\n",
3901 fw_count, card->from_host_signals_r);
3902 }
3903
3904 return r;
3905 }
3906
3907 unifi_info(card->ospriv, "UniFi function %d is enabled.\n", card->function);
3908
3909 /* See if we missed an SDIO interrupt */
3910 r = CardPendingInt(card, &pending);
3911 if (pending)
3912 {
3913 unifi_error(card->ospriv, "There is an unhandled pending interrupt.\n");
3914 *status = 2;
3915 return r;
3916 }
3917
3918 return r;
3919} /* unifi_check_io_status() */
3920
3921
3922void unifi_get_hip_qos_info(card_t *card, unifi_HipQosInfo *hipqosinfo)
3923{
3924 s32 count_fhr;
3925 s16 t;
3926 u32 occupied_fh;
3927
3928 q_t *sigq;
3929 u16 nslots, i;
3930
3931 memset(hipqosinfo, 0, sizeof(unifi_HipQosInfo));
3932
3933 nslots = card->config_data.num_fromhost_data_slots;
3934
3935 for (i = 0; i < nslots; i++)
3936 {
3937 if (card->from_host_data[i].bd.data_length == 0)
3938 {
3939 hipqosinfo->free_fh_bulkdata_slots++;
3940 }
3941 }
3942
3943 for (i = 0; i < UNIFI_NO_OF_TX_QS; i++)
3944 {
3945 sigq = &card->fh_traffic_queue[i];
3946 t = sigq->q_wr_ptr - sigq->q_rd_ptr;
3947 if (t < 0)
3948 {
3949 t += sigq->q_length;
3950 }
3951 hipqosinfo->free_fh_sig_queue_slots[i] = (sigq->q_length - t) - 1;
3952 }
3953
3954 count_fhr = unifi_read_shared_count(card, card->sdio_ctrl_addr + 2);
3955 if (count_fhr < 0)
3956 {
3957 unifi_error(card->ospriv, "Failed to read from-host sig read count - %d\n", count_fhr);
3958 hipqosinfo->free_fh_fw_slots = 0xfa;
3959 return;
3960 }
3961
3962 occupied_fh = (card->from_host_signals_w - count_fhr) % 128;
3963
3964 hipqosinfo->free_fh_fw_slots = (u16)(card->config_data.num_fromhost_sig_frags - occupied_fh);
3965}
3966
3967
3968
3969CsrResult ConvertCsrSdioToCsrHipResult(card_t *card, CsrResult csrResult)
3970{
3971 CsrResult r = CSR_RESULT_FAILURE;
3972
3973 switch (csrResult)
3974 {
3975 case CSR_RESULT_SUCCESS:
3976 r = CSR_RESULT_SUCCESS;
3977 break;
3978 /* Timeout errors */
3979 case CSR_SDIO_RESULT_TIMEOUT:
3980 /* Integrity errors */
3981 case CSR_SDIO_RESULT_CRC_ERROR:
3982 r = CSR_RESULT_FAILURE;
3983 break;
3984 case CSR_SDIO_RESULT_NO_DEVICE:
3985 r = CSR_WIFI_HIP_RESULT_NO_DEVICE;
3986 break;
3987 case CSR_SDIO_RESULT_INVALID_VALUE:
3988 r = CSR_WIFI_HIP_RESULT_INVALID_VALUE;
3989 break;
3990 case CSR_RESULT_FAILURE:
3991 r = CSR_RESULT_FAILURE;
3992 break;
3993 default:
3994 unifi_warning(card->ospriv, "Unrecognised csrResult error code: %d\n", csrResult);
3995 break;
3996 }
3997
3998 return r;
3999} /* ConvertCsrSdioToCsrHipResult() */
4000
4001
diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.h b/drivers/staging/csr/csr_wifi_hip_card_sdio.h
deleted file mode 100644
index a9b9ec427320..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_card_sdio.h
+++ /dev/null
@@ -1,694 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/*
12 * ---------------------------------------------------------------------------
13 *
14 * FILE: csr_wifi_hip_card_sdio.h
15 *
16 * PURPOSE:
17 * Internal header for Card API for SDIO.
18 * ---------------------------------------------------------------------------
19 */
20#ifndef __CARD_SDIO_H__
21#define __CARD_SDIO_H__
22
23#include "csr_wifi_hip_unifi.h"
24#include "csr_wifi_hip_unifi_udi.h"
25#include "csr_wifi_hip_unifihw.h"
26#include "csr_wifi_hip_unifiversion.h"
27#ifndef CSR_WIFI_HIP_TA_DISABLE
28#include "csr_wifi_hip_ta_sampling.h"
29#endif
30#include "csr_wifi_hip_xbv.h"
31#include "csr_wifi_hip_chiphelper.h"
32
33
34/*
35 *
36 * Configuration items.
37 * Which of these should go in a platform unifi_config.h file?
38 *
39 */
40
41/*
42 * When the traffic queues contain more signals than there is space for on
43 * UniFi, a limiting algorithm comes into play.
44 * If a traffic queue has enough slots free to buffer more traffic from the
45 * network stack, then the following check is applied. The number of free
46 * slots is RESUME_XMIT_THRESHOLD.
47 */
48#define RESUME_XMIT_THRESHOLD 4
49
50
51/*
52 * When reading signals from UniFi, the host processes pending all signals
53 * and then acknowledges them together in a single write to update the
54 * to-host-chunks-read location.
55 * When there is more than one bulk data transfer (e.g. one received data
56 * packet and a request for the payload data of a transmitted packet), the
57 * update can be delayed significantly. This ties up resources on chip.
58 *
59 * To remedy this problem, to-host-chunks-read is updated after processing
60 * a signal if TO_HOST_FLUSH_THRESHOLD bytes of bulk data have been
61 * transferred since the last update.
62 */
63#define TO_HOST_FLUSH_THRESHOLD (500 * 5)
64
65
66/* SDIO Card Common Control Registers */
67#define SDIO_CCCR_SDIO_REVISION (0x00)
68#define SDIO_SD_SPEC_REVISION (0x01)
69#define SDIO_IO_ENABLE (0x02)
70#define SDIO_IO_READY (0x03)
71#define SDIO_INT_ENABLE (0x04)
72#define SDIO_INT_PENDING (0x05)
73#define SDIO_IO_ABORT (0x06)
74#define SDIO_BUS_IFACE_CONTROL (0x07)
75#define SDIO_CARD_CAPABILOTY (0x08)
76#define SDIO_COMMON_CIS_POINTER (0x09)
77#define SDIO_BUS_SUSPEND (0x0C)
78#define SDIO_FUNCTION_SELECT (0x0D)
79#define SDIO_EXEC_FLAGS (0x0E)
80#define SDIO_READY_FLAGS (0x0F)
81#define SDIO_FN0_BLOCK_SIZE (0x10)
82#define SDIO_POWER_CONTROL (0x12)
83#define SDIO_VENDOR_START (0xF0)
84
85#define SDIO_CSR_HOST_WAKEUP (0xf0)
86#define SDIO_CSR_HOST_INT_CLEAR (0xf1)
87#define SDIO_CSR_FROM_HOST_SCRATCH0 (0xf2)
88#define SDIO_CSR_FROM_HOST_SCRATCH1 (0xf3)
89#define SDIO_CSR_TO_HOST_SCRATCH0 (0xf4)
90#define SDIO_CSR_TO_HOST_SCRATCH1 (0xf5)
91#define SDIO_CSR_FUNC_EN (0xf6)
92#define SDIO_CSR_CSPI_MODE (0xf7)
93#define SDIO_CSR_CSPI_STATUS (0xf8)
94#define SDIO_CSR_CSPI_PADDING (0xf9)
95
96
97#define UNIFI_SD_INT_ENABLE_IENM 0x0001 /* Master INT Enable */
98
99#ifdef CSR_PRE_ALLOC_NET_DATA
100#define BULK_DATA_PRE_ALLOC_NUM 16
101#endif
102
103/*
104 * Structure to hold configuration information read from UniFi.
105 */
106typedef struct
107{
108 /*
109 * The version of the SDIO signal queues and bulk data pools
110 * configuration structure. The MSB is the major version number, used to
111 * indicate incompatible changes. The LSB gives the minor revision number,
112 * used to indicate changes that maintain backwards compatibility.
113 */
114 u16 version;
115
116 /*
117 * offset from the start of the shared data memory to the SD IO
118 * control structure.
119 */
120 u16 sdio_ctrl_offset;
121
122 /* Buffer handle of the from-host signal queue */
123 u16 fromhost_sigbuf_handle;
124
125 /* Buffer handle of the to-host signal queue */
126 u16 tohost_sigbuf_handle;
127
128 /*
129 * Maximum number of signal primitive or bulk data command fragments that may be
130 * pending in the to-hw signal queue.
131 */
132 u16 num_fromhost_sig_frags;
133
134 /*
135 * Number of signal primitive or bulk data command fragments that must be pending
136 * in the to-host signal queue before the host will generate an interrupt
137 * to indicate that it has read a signal. This will usually be the total
138 * capacity of the to-host signal buffer less the size of the largest signal
139 * primitive divided by the signal primitive fragment size, but may be set
140 * to 1 to request interrupts every time that the host read a signal.
141 * Note that the hw may place more signals in the to-host signal queue
142 * than indicated by this field.
143 */
144 u16 num_tohost_sig_frags;
145
146 /*
147 * Number of to-hw bulk data slots. Slots are numbered from 0 (zero) to
148 * one less than the value in this field
149 */
150 u16 num_fromhost_data_slots;
151
152 /*
153 * Number of frm-hw bulk data slots. Slots are numbered from 0 (zero) to
154 * one less than the value in this field
155 */
156 u16 num_tohost_data_slots;
157
158 /*
159 * Size of the bulk data slots (2 octets)
160 * The size of the bulk data slots in octets. This will usually be
161 * the size of the largest MSDU. The value should always be even.
162 */
163 u16 data_slot_size;
164
165 /*
166 * Indicates that the host has finished the initialisation sequence.
167 * Initialised to 0x0000 by the firmware, and set to 0x0001 by us.
168 */
169 u16 initialised;
170
171 /* Added by protocol version 0x0001 */
172 u32 overlay_size;
173
174 /* Added by protocol version 0x0300 */
175 u16 data_slot_round;
176 u16 sig_frag_size;
177
178 /* Added by protocol version 0x0500 */
179 u16 tohost_signal_padding;
180} sdio_config_data_t;
181
182/*
183 * These values may change with versions of the Host Interface Protocol.
184 */
185/*
186 * Size of config info block pointed to by the CSR_SLT_SDIO_SLOT_CONFIG
187 * entry in the f/w symbol table
188 */
189#define SDIO_CONFIG_DATA_SIZE 30
190
191/* Offset of the INIT flag in the config info block. */
192#define SDIO_INIT_FLAG_OFFSET 0x12
193#define SDIO_TO_HOST_SIG_PADDING_OFFSET 0x1C
194
195
196/* Structure for a bulk data transfer command */
197typedef struct
198{
199 u16 cmd_and_len; /* bits 12-15 cmd, bits 0-11 len */
200 u16 data_slot; /* slot number, perhaps OR'd with SLOT_DIR_TO_HOST */
201 u16 offset;
202 u16 buffer_handle;
203} bulk_data_cmd_t;
204
205
206/* Bulk Data signal command values */
207#define SDIO_CMD_SIGNAL 0x00
208#define SDIO_CMD_TO_HOST_TRANSFER 0x01
209#define SDIO_CMD_TO_HOST_TRANSFER_ACK 0x02 /*deprecated*/
210#define SDIO_CMD_FROM_HOST_TRANSFER 0x03
211#define SDIO_CMD_FROM_HOST_TRANSFER_ACK 0x04 /*deprecated*/
212#define SDIO_CMD_CLEAR_SLOT 0x05
213#define SDIO_CMD_OVERLAY_TRANSFER 0x06
214#define SDIO_CMD_OVERLAY_TRANSFER_ACK 0x07 /*deprecated*/
215#define SDIO_CMD_FROM_HOST_AND_CLEAR 0x08
216#define SDIO_CMD_PADDING 0x0f
217
218#define SLOT_DIR_TO_HOST 0x8000
219
220
221/* Initialise bulkdata slot
222 * params:
223 * bulk_data_desc_t *bulk_data_slot
224 */
225#define UNIFI_INIT_BULK_DATA(bulk_data_slot) \
226 { \
227 (bulk_data_slot)->os_data_ptr = NULL; \
228 (bulk_data_slot)->data_length = 0; \
229 (bulk_data_slot)->os_net_buf_ptr = NULL; \
230 (bulk_data_slot)->net_buf_length = 0; \
231 }
232
233/*
234 * Structure to contain a SIGNAL datagram.
235 * This is used to build signal queues between the main driver and the
236 * i/o thread.
237 * The fields are:
238 * sigbuf Contains the HIP signal is wire-format (i.e. packed,
239 * little-endian)
240 * bulkdata Contains a copy of any associated bulk data
241 * signal_length The size of the signal in the sigbuf
242 */
243typedef struct card_signal
244{
245 u8 sigbuf[UNIFI_PACKED_SIGBUF_SIZE];
246
247 /* Length of the SIGNAL inside sigbuf */
248 u16 signal_length;
249
250 bulk_data_desc_t bulkdata[UNIFI_MAX_DATA_REFERENCES];
251} card_signal_t;
252
253
254/*
255 * Control structure for a generic ring buffer.
256 */
257#define UNIFI_QUEUE_NAME_MAX_LENGTH 16
258typedef struct
259{
260 card_signal_t *q_body;
261
262 /* Num elements in queue (capacity is one less than this!) */
263 u16 q_length;
264
265 u16 q_wr_ptr;
266 u16 q_rd_ptr;
267
268 char name[UNIFI_QUEUE_NAME_MAX_LENGTH];
269} q_t;
270
271
272#define UNIFI_RESERVED_COMMAND_SLOTS 2
273
274/* Considering approx 500 us per packet giving 0.5 secs */
275#define UNIFI_PACKETS_INTERVAL 1000
276
277/*
278 * Dynamic slot reservation for QoS
279 */
280typedef struct
281{
282 u16 from_host_used_slots[UNIFI_NO_OF_TX_QS];
283 u16 from_host_max_slots[UNIFI_NO_OF_TX_QS];
284 u16 from_host_reserved_slots[UNIFI_NO_OF_TX_QS];
285
286 /* Parameters to determine if a queue was active.
287 If number of packets sent is greater than the threshold
288 for the queue, the queue is considered active and no
289 re reservation is done, it is important not to keep this
290 value too low */
291 /* Packets sent during this interval */
292 u16 packets_txed[UNIFI_NO_OF_TX_QS];
293 u16 total_packets_txed;
294
295 /* Number of packets to see if slots need to be reassigned */
296 u16 packets_interval;
297
298 /* Once a queue reaches a stable state, avoid processing */
299 u8 queue_stable[UNIFI_NO_OF_TX_QS];
300} card_dynamic_slot_t;
301
302
303/* These are type-safe and don't write incorrect values to the
304 * structure. */
305
306/* Return queue slots used count
307 * params:
308 * const q_t *q
309 * returns:
310 * u16
311 */
312#define CSR_WIFI_HIP_Q_SLOTS_USED(q) \
313 (((q)->q_wr_ptr - (q)->q_rd_ptr < 0)? \
314 ((q)->q_wr_ptr - (q)->q_rd_ptr + (q)->q_length) : ((q)->q_wr_ptr - (q)->q_rd_ptr))
315
316/* Return queue slots free count
317 * params:
318 * const q_t *q
319 * returns:
320 * u16
321 */
322#define CSR_WIFI_HIP_Q_SLOTS_FREE(q) \
323 ((q)->q_length - CSR_WIFI_HIP_Q_SLOTS_USED((q)) - 1)
324
325/* Return slot signal data pointer
326 * params:
327 * const q_t *q
328 * u16 slot
329 * returns:
330 * card_signal_t *
331 */
332#define CSR_WIFI_HIP_Q_SLOT_DATA(q, slot) \
333 ((q)->q_body + slot)
334
335/* Return queue next read slot
336 * params:
337 * const q_t *q
338 * returns:
339 * u16 slot offset
340 */
341#define CSR_WIFI_HIP_Q_NEXT_R_SLOT(q) \
342 ((q)->q_rd_ptr)
343
344/* Return queue next write slot
345 * params:
346 * const q_t *q
347 * returns:
348 * u16 slot offset
349 */
350#define CSR_WIFI_HIP_Q_NEXT_W_SLOT(q) \
351 ((q)->q_wr_ptr)
352
353/* Return updated queue pointer wrapped around its length
354 * params:
355 * const q_t *q
356 * u16 x amount to add to queue pointer
357 * returns:
358 * u16 wrapped queue pointer
359 */
360#define CSR_WIFI_HIP_Q_WRAP(q, x) \
361 ((((x) >= (q)->q_length)?((x) % (q)->q_length) : (x)))
362
363/* Advance queue read pointer
364 * params:
365 * const q_t *q
366 */
367#define CSR_WIFI_HIP_Q_INC_R(q) \
368 ((q)->q_rd_ptr = CSR_WIFI_HIP_Q_WRAP((q), (q)->q_rd_ptr + 1))
369
370/* Advance queue write pointer
371 * params:
372 * const q_t *q
373 */
374#define CSR_WIFI_HIP_Q_INC_W(q) \
375 ((q)->q_wr_ptr = CSR_WIFI_HIP_Q_WRAP((q), (q)->q_wr_ptr + 1))
376
377enum unifi_host_state
378{
379 UNIFI_HOST_STATE_AWAKE = 0,
380 UNIFI_HOST_STATE_DROWSY = 1,
381 UNIFI_HOST_STATE_TORPID = 2
382};
383
384typedef struct
385{
386 bulk_data_desc_t bd;
387 unifi_TrafficQueue queue; /* Used for dynamic slot reservation */
388} slot_desc_t;
389
390/*
391 * Structure describing a UniFi SDIO card.
392 */
393struct card
394{
395 /*
396 * Back pointer for the higher level OS code. This is passed as
397 * an argument to callbacks (e.g. for received data and indications).
398 */
399 void *ospriv;
400
401 /*
402 * mapping of HIP slot to MA-PACKET.req host tag, the
403 * array is indexed by slot numbers and each index stores
404 * information of the last host tag it was used for
405 */
406 u32 *fh_slot_host_tag_record;
407
408
409 /* Info read from Symbol Table during probe */
410 u32 build_id;
411 char build_id_string[128];
412
413 /* Retrieve from SDIO driver. */
414 u16 chip_id;
415
416 /* Read from GBL_CHIP_VERSION. */
417 u16 chip_version;
418
419 /* From the SDIO driver (probably 1) */
420 u8 function;
421
422 /* This is sused to get the register addresses and things. */
423 ChipDescript *helper;
424
425 /*
426 * Bit mask of PIOs for the loader to waggle during download.
427 * We assume these are connected to LEDs. The main firmware gets
428 * the mask from a MIB entry.
429 */
430 s32 loader_led_mask;
431
432 /*
433 * Support for flow control. When the from-host queue of signals
434 * is full, we ask the host upper layer to stop sending packets. When
435 * the queue drains we tell it that it can send packets again.
436 * We use this flag to remember the current state.
437 */
438#define card_is_tx_q_paused(card, q) (card->tx_q_paused_flag[q])
439#define card_tx_q_unpause(card, q) (card->tx_q_paused_flag[q] = 0)
440#define card_tx_q_pause(card, q) (card->tx_q_paused_flag[q] = 1)
441
442 u16 tx_q_paused_flag[UNIFI_TRAFFIC_Q_MAX + 1 + UNIFI_NO_OF_TX_QS]; /* defensive more than big enough */
443
444 /* UDI callback for logging UniFi interactions */
445 udi_func_t udi_hook;
446
447 u8 bh_reason_host;
448 u8 bh_reason_unifi;
449
450 /* SDIO clock speed request from OS layer */
451 u8 request_max_clock;
452
453 /* Last SDIO clock frequency set */
454 u32 sdio_clock_speed;
455
456 /*
457 * Current host state (copy of value in IOABORT register and
458 * spinlock to protect it.
459 */
460 enum unifi_host_state host_state;
461
462 enum unifi_low_power_mode low_power_mode;
463 enum unifi_periodic_wake_mode periodic_wake_mode;
464
465 /*
466 * Ring buffer of signal structs for a queue of data packets from
467 * the host.
468 * The queue is empty when fh_data_q_num_rd == fh_data_q_num_wr.
469 * To add a packet to the queue, copy it to index given by
470 * (fh_data_q_num_wr%UNIFI_SOFT_Q_LENGTH) and advance fh_data_q_num_wr.
471 * To take a packet from the queue, copy data from index given by
472 * (fh_data_q_num_rd%UNIFI_SOFT_Q_LENGTH) and advance fh_data_q_num_rd.
473 * fh_data_q_num_rd and fh_data_q_num_rd are both modulo 256.
474 */
475 card_signal_t fh_command_q_body[UNIFI_SOFT_COMMAND_Q_LENGTH];
476 q_t fh_command_queue;
477
478 card_signal_t fh_traffic_q_body[UNIFI_NO_OF_TX_QS][UNIFI_SOFT_TRAFFIC_Q_LENGTH];
479 q_t fh_traffic_queue[UNIFI_NO_OF_TX_QS];
480
481 /*
482 * Signal counts from UniFi SDIO Control Data Structure.
483 * These are cached and synchronised with the UniFi before and after
484 * a batch of operations.
485 *
486 * These are the modulo-256 count of signals written to or read from UniFi
487 * The value is incremented for every signal.
488 */
489 s32 from_host_signals_w;
490 s32 from_host_signals_r;
491 s32 to_host_signals_r;
492 s32 to_host_signals_w;
493
494
495 /* Should specify buffer size as a number of signals */
496 /*
497 * Enough for 10 th and 10 fh data slots:
498 * 1 * 10 * 8 = 80
499 * 2 * 10 * 8 = 160
500 */
501#define UNIFI_FH_BUF_SIZE 1024
502 struct sigbuf
503 {
504 u8 *buf; /* buffer area */
505 u8 *ptr; /* current pos */
506 u16 count; /* signal count */
507 u16 bufsize;
508 } fh_buffer;
509 struct sigbuf th_buffer;
510
511
512 /*
513 * Field to use for the incrementing value to write to the UniFi
514 * SHARED_IO_INTERRUPT register.
515 * Flag to say we need to generate an interrupt at end of processing.
516 */
517 u32 unifi_interrupt_seq;
518 u8 generate_interrupt;
519
520
521 /* Pointers to the bulk data slots */
522 slot_desc_t *from_host_data;
523 bulk_data_desc_t *to_host_data;
524
525
526 /*
527 * Index of the next (hopefully) free data slot.
528 * This is an optimisation that starts searching at a more likely point
529 * than the beginning.
530 */
531 s16 from_host_data_head;
532
533 /* Dynamic slot allocation for queues */
534 card_dynamic_slot_t dynamic_slot_data;
535
536 /*
537 * SDIO specific fields
538 */
539
540 /* Interface pointer for the SDIO library */
541 CsrSdioFunction *sdio_if;
542
543 /* Copy of config_data struct from the card */
544 sdio_config_data_t config_data;
545
546 /* SDIO address of the Initialised flag and Control Data struct */
547 u32 init_flag_addr;
548 u32 sdio_ctrl_addr;
549
550 /* The last value written to the Shared Data Memory Page register */
551 u32 proc_select;
552 u32 dmem_page;
553 u32 pmem_page;
554
555 /* SDIO traffic counters limited to 32 bits for Synergy compatibility */
556 u32 sdio_bytes_read;
557 u32 sdio_bytes_written;
558
559 u8 memory_resources_allocated;
560
561 /* UniFi SDIO I/O Block size. */
562 u16 sdio_io_block_size;
563
564 /* Pad transfer sizes to SDIO block boundaries */
565 u8 sdio_io_block_pad;
566
567 /* Read from the XBV */
568 struct FWOV fwov;
569
570#ifndef CSR_WIFI_HIP_TA_DISABLE
571 /* TA sampling */
572 ta_data_t ta_sampling;
573#endif
574
575 /* Auto-coredump */
576 s16 request_coredump_on_reset; /* request coredump on next reset */
577 struct coredump_buf *dump_buf; /* root node */
578 struct coredump_buf *dump_next_write; /* node to fill at next dump */
579 struct coredump_buf *dump_cur_read; /* valid node to read, or NULL */
580
581#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE
582 struct cmd_profile
583 {
584 u32 cmd52_count;
585 u32 cmd53_count;
586 u32 tx_count;
587 u32 tx_cfm_count;
588 u32 rx_count;
589 u32 bh_count;
590 u32 process_count;
591 u32 protocol_count;
592
593 u32 cmd52_f0_r_count;
594 u32 cmd52_f0_w_count;
595 u32 cmd52_r8or16_count;
596 u32 cmd52_w8or16_count;
597 u32 cmd52_r16_count;
598 u32 cmd52_w16_count;
599 u32 cmd52_r32_count;
600
601 u32 sdio_cmd_signal;
602 u32 sdio_cmd_clear_slot;
603 u32 sdio_cmd_to_host;
604 u32 sdio_cmd_from_host;
605 u32 sdio_cmd_from_host_and_clear;
606 } hip_prof;
607 struct cmd_profile cmd_prof;
608#endif
609
610 /* Interrupt processing mode flags */
611 u32 intmode;
612
613#ifdef UNIFI_DEBUG
614 u8 lsb;
615#endif
616
617 /* Historic firmware panic codes */
618 u32 panic_data_phy_addr;
619 u32 panic_data_mac_addr;
620 u16 last_phy_panic_code;
621 u16 last_phy_panic_arg;
622 u16 last_mac_panic_code;
623 u16 last_mac_panic_arg;
624#ifdef CSR_PRE_ALLOC_NET_DATA
625 bulk_data_desc_t bulk_data_desc_list[BULK_DATA_PRE_ALLOC_NUM];
626 u16 prealloc_netdata_r;
627 u16 prealloc_netdata_w;
628#endif
629}; /* struct card */
630
631
632/* Reset types */
633enum unifi_reset_type
634{
635 UNIFI_COLD_RESET = 1,
636 UNIFI_WARM_RESET = 2
637};
638
639/*
640 * unifi_set_host_state() implements signalling for waking UniFi from
641 * deep sleep. The host indicates to UniFi that it is in one of three states:
642 * Torpid - host has nothing to send, UniFi can go to sleep.
643 * Drowsy - host has data to send to UniFi. UniFi will respond with an
644 * SDIO interrupt. When hosts responds it moves to Awake.
645 * Awake - host has data to transfer, UniFi must stay awake.
646 * When host has finished, it moves to Torpid.
647 */
648CsrResult unifi_set_host_state(card_t *card, enum unifi_host_state state);
649
650
651CsrResult unifi_set_proc_select(card_t *card, enum unifi_dbg_processors_select select);
652s32 card_read_signal_counts(card_t *card);
653bulk_data_desc_t* card_find_data_slot(card_t *card, s16 slot);
654
655
656CsrResult unifi_read32(card_t *card, u32 unifi_addr, u32 *pdata);
657CsrResult unifi_readnz(card_t *card, u32 unifi_addr,
658 void *pdata, u16 len);
659s32 unifi_read_shared_count(card_t *card, u32 addr);
660
661CsrResult unifi_writen(card_t *card, u32 unifi_addr, void *pdata, u16 len);
662
663CsrResult unifi_bulk_rw(card_t *card, u32 handle,
664 void *pdata, u32 len, s16 direction);
665CsrResult unifi_bulk_rw_noretry(card_t *card, u32 handle,
666 void *pdata, u32 len, s16 direction);
667#define UNIFI_SDIO_READ 0
668#define UNIFI_SDIO_WRITE 1
669
670CsrResult unifi_read_8_or_16(card_t *card, u32 unifi_addr, u8 *pdata);
671CsrResult unifi_write_8_or_16(card_t *card, u32 unifi_addr, u8 data);
672CsrResult unifi_read_direct_8_or_16(card_t *card, u32 addr, u8 *pdata);
673CsrResult unifi_write_direct_8_or_16(card_t *card, u32 addr, u8 data);
674
675CsrResult unifi_read_direct16(card_t *card, u32 addr, u16 *pdata);
676CsrResult unifi_read_direct32(card_t *card, u32 addr, u32 *pdata);
677CsrResult unifi_read_directn(card_t *card, u32 addr, void *pdata, u16 len);
678
679CsrResult unifi_write_direct16(card_t *card, u32 addr, u16 data);
680CsrResult unifi_write_directn(card_t *card, u32 addr, void *pdata, u16 len);
681
682CsrResult sdio_read_f0(card_t *card, u32 addr, u8 *pdata);
683CsrResult sdio_write_f0(card_t *card, u32 addr, u8 data);
684
685void unifi_read_panic(card_t *card);
686#ifdef CSR_PRE_ALLOC_NET_DATA
687void prealloc_netdata_free(card_t *card);
688CsrResult prealloc_netdata_alloc(card_t *card);
689#endif
690/* For diagnostic use */
691void dump(void *mem, u16 len);
692void dump16(void *mem, u16 len);
693
694#endif /* __CARD_SDIO_H__ */
diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c
deleted file mode 100644
index cfe186e07071..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c
+++ /dev/null
@@ -1,2595 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/*
12 * ---------------------------------------------------------------------------
13 * FILE: csr_wifi_hip_card_sdio_intr.c
14 *
15 * PURPOSE:
16 * Interrupt processing for the UniFi SDIO driver.
17 *
18 * We may need another signal queue of responses to UniFi to hold
19 * bulk data commands generated by read_to_host_signals().
20 *
21 * ---------------------------------------------------------------------------
22 */
23#undef CSR_WIFI_HIP_NOISY
24
25#include "csr_wifi_hip_unifi.h"
26#include "csr_wifi_hip_conversions.h"
27#include "csr_wifi_hip_card.h"
28#include "csr_wifi_hip_xbv.h"
29
30
31/*
32 * If the SDIO link is idle for this time (in milliseconds),
33 * signal UniFi to go into Deep Sleep.
34 * Valid return value of unifi_bh().
35 */
36#define UNIFI_DEFAULT_HOST_IDLE_TIMEOUT 5
37/*
38 * If the UniFi has not woken up for this time (in milliseconds),
39 * signal the bottom half to take action.
40 * Valid return value of unifi_bh().
41 */
42#define UNIFI_DEFAULT_WAKE_TIMEOUT 1000
43
44
45static CsrResult process_bh(card_t *card);
46static CsrResult handle_host_protocol(card_t *card, u8 *processed_something);
47
48static CsrResult flush_fh_buffer(card_t *card);
49
50static CsrResult check_fh_sig_slots(card_t *card, u16 needed, s32 *space);
51
52static CsrResult read_to_host_signals(card_t *card, s32 *processed);
53static CsrResult process_to_host_signals(card_t *card, s32 *processed);
54
55static CsrResult process_bulk_data_command(card_t *card,
56 const u8 *cmdptr,
57 s16 cmd, u16 len);
58static CsrResult process_clear_slot_command(card_t *card,
59 const u8 *cmdptr);
60static CsrResult process_fh_cmd_queue(card_t *card, s32 *processed);
61static CsrResult process_fh_traffic_queue(card_t *card, s32 *processed);
62static void restart_packet_flow(card_t *card);
63static CsrResult process_clock_request(card_t *card);
64
65#ifdef CSR_WIFI_HIP_NOISY
66s16 dump_fh_buf = 0;
67#endif /* CSR_WIFI_HIP_NOISY */
68
69#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
70
71/*
72 * The unifi_debug_output buffer can be used to debug the HIP behaviour offline
73 * i.e. without using the tracing functions that change the timing.
74 *
75 * Call unifi_debug_log_to_buf() with printf arguments to store a string into
76 * unifi_debug_output. When unifi_debug_buf_dump() is called, the contents of the
77 * buffer are dumped with dump_str() which has to be implemented in the
78 * OS layer, during the porting exercise. The offset printed, holds the
79 * offset where the last character is (always a zero).
80 *
81 */
82
83#define UNIFI_DEBUG_GBUFFER_SIZE 8192
84static char unifi_debug_output[UNIFI_DEBUG_GBUFFER_SIZE];
85static char *unifi_dbgbuf_ptr = unifi_debug_output;
86static char *unifi_dbgbuf_start = unifi_debug_output;
87
88static void append_char(char c)
89{
90 /* write char and advance pointer */
91 *unifi_dbgbuf_ptr++ = c;
92 /* wrap pointer at end of buffer */
93 if ((unifi_dbgbuf_ptr - unifi_debug_output) >= UNIFI_DEBUG_GBUFFER_SIZE)
94 {
95 unifi_dbgbuf_ptr = unifi_debug_output;
96 }
97} /* append_char() */
98
99
100void unifi_debug_string_to_buf(const char *str)
101{
102 const char *p = str;
103 while (*p)
104 {
105 append_char(*p);
106 p++;
107 }
108 /* Update start-of-buffer pointer */
109 unifi_dbgbuf_start = unifi_dbgbuf_ptr + 1;
110 if ((unifi_dbgbuf_start - unifi_debug_output) >= UNIFI_DEBUG_GBUFFER_SIZE)
111 {
112 unifi_dbgbuf_start = unifi_debug_output;
113 }
114}
115
116
117void unifi_debug_log_to_buf(const char *fmt, ...)
118{
119#define DEBUG_BUFFER_SIZE 80
120 static char s[DEBUG_BUFFER_SIZE];
121 va_list args;
122
123 va_start(args, fmt);
124 vsnprintf(s, DEBUG_BUFFER_SIZE, fmt, args);
125 va_end(args);
126
127 unifi_debug_string_to_buf(s);
128} /* unifi_debug_log_to_buf() */
129
130
131/* Convert signed 32 bit (or less) integer to string */
132static void CsrUInt16ToHex(u16 number, char *str)
133{
134 u16 index;
135 u16 currentValue;
136
137 for (index = 0; index < 4; index++)
138 {
139 currentValue = (u16) (number & 0x000F);
140 number >>= 4;
141 str[3 - index] = (char) (currentValue > 9 ? currentValue + 55 : currentValue + '0');
142 }
143 str[4] = '\0';
144}
145
146
147/*
148 * ---------------------------------------------------------------------------
149 * unifi_debug_hex_to_buf
150 *
151 * puts the contents of the passed buffer into the debug buffer as a hex string
152 *
153 * Arguments:
154 * buff buffer to print as hex
155 * length number of chars to print
156 *
157 * Returns:
158 * None.
159 *
160 * ---------------------------------------------------------------------------
161 */
162void unifi_debug_hex_to_buf(const char *buff, u16 length)
163{
164 char s[5];
165 u16 i;
166
167 for (i = 0; i < length; i = i + 2)
168 {
169 CsrUInt16ToHex(*((u16 *)(buff + i)), s);
170 unifi_debug_string_to_buf(s);
171 }
172}
173
174
175void unifi_debug_buf_dump(void)
176{
177 s32 offset = unifi_dbgbuf_ptr - unifi_debug_output;
178
179 unifi_error(NULL, "HIP debug buffer offset=%d\n", offset);
180 dump_str(unifi_debug_output + offset, UNIFI_DEBUG_GBUFFER_SIZE - offset);
181 dump_str(unifi_debug_output, offset);
182} /* unifi_debug_buf_dump() */
183
184
185#endif /* CSR_WIFI_HIP_DEBUG_OFFLINE */
186
187#ifdef CSR_PRE_ALLOC_NET_DATA
188#define NETDATA_PRE_ALLOC_BUF_SIZE 8000
189
190void prealloc_netdata_free(card_t *card)
191{
192 unifi_warning(card->ospriv, "prealloc_netdata_free: IN: w=%d r=%d\n", card->prealloc_netdata_w, card->prealloc_netdata_r);
193
194 while (card->bulk_data_desc_list[card->prealloc_netdata_r].data_length != 0)
195 {
196 unifi_warning(card->ospriv, "prealloc_netdata_free: r=%d\n", card->prealloc_netdata_r);
197
198 unifi_net_data_free(card->ospriv, &card->bulk_data_desc_list[card->prealloc_netdata_r]);
199 card->prealloc_netdata_r++;
200 card->prealloc_netdata_r %= BULK_DATA_PRE_ALLOC_NUM;
201 }
202 card->prealloc_netdata_r = card->prealloc_netdata_w = 0;
203
204 unifi_warning(card->ospriv, "prealloc_netdata_free: OUT: w=%d r=%d\n", card->prealloc_netdata_w, card->prealloc_netdata_r);
205}
206
207
208CsrResult prealloc_netdata_alloc(card_t *card)
209{
210 CsrResult r;
211
212 unifi_trace(card->ospriv, UDBG5, "prealloc_netdata_alloc: IN: w=%d r=%d\n", card->prealloc_netdata_w, card->prealloc_netdata_r);
213
214 while (card->bulk_data_desc_list[card->prealloc_netdata_w].data_length == 0)
215 {
216 r = unifi_net_data_malloc(card->ospriv, &card->bulk_data_desc_list[card->prealloc_netdata_w], NETDATA_PRE_ALLOC_BUF_SIZE);
217 if (r != CSR_RESULT_SUCCESS)
218 {
219 unifi_error(card->ospriv, "prealloc_netdata_alloc: Failed to allocate t-h bulk data\n");
220 return CSR_RESULT_FAILURE;
221 }
222 card->prealloc_netdata_w++;
223 card->prealloc_netdata_w %= BULK_DATA_PRE_ALLOC_NUM;
224 }
225 unifi_trace(card->ospriv, UDBG5, "prealloc_netdata_alloc: OUT: w=%d r=%d\n", card->prealloc_netdata_w, card->prealloc_netdata_r);
226
227 return CSR_RESULT_SUCCESS;
228}
229
230
231static CsrResult prealloc_netdata_get(card_t *card, bulk_data_desc_t *bulk_data_slot, u32 size)
232{
233 CsrResult r;
234
235 unifi_trace(card->ospriv, UDBG5, "prealloc_netdata_get: IN: w=%d r=%d\n", card->prealloc_netdata_w, card->prealloc_netdata_r);
236
237 if (card->bulk_data_desc_list[card->prealloc_netdata_r].data_length == 0)
238 {
239 unifi_error(card->ospriv, "prealloc_netdata_get: data_length = 0\n");
240 }
241
242 if ((size > NETDATA_PRE_ALLOC_BUF_SIZE) || (card->bulk_data_desc_list[card->prealloc_netdata_r].data_length == 0))
243 {
244 unifi_warning(card->ospriv, "prealloc_netdata_get: Calling net_data_malloc\n");
245
246 r = unifi_net_data_malloc(card->ospriv, bulk_data_slot, size);
247 if (r != CSR_RESULT_SUCCESS)
248 {
249 unifi_error(card->ospriv, "prealloc_netdata_get: Failed to allocate t-h bulk data\n");
250 return CSR_RESULT_FAILURE;
251 }
252 return CSR_RESULT_SUCCESS;
253 }
254
255 *bulk_data_slot = card->bulk_data_desc_list[card->prealloc_netdata_r];
256 card->bulk_data_desc_list[card->prealloc_netdata_r].os_data_ptr = NULL;
257 card->bulk_data_desc_list[card->prealloc_netdata_r].os_net_buf_ptr = NULL;
258 card->bulk_data_desc_list[card->prealloc_netdata_r].net_buf_length = 0;
259 card->bulk_data_desc_list[card->prealloc_netdata_r].data_length = 0;
260
261 card->prealloc_netdata_r++;
262 card->prealloc_netdata_r %= BULK_DATA_PRE_ALLOC_NUM;
263
264 unifi_trace(card->ospriv, UDBG5, "prealloc_netdata_get: OUT: w=%d r=%d\n", card->prealloc_netdata_w, card->prealloc_netdata_r);
265
266 return CSR_RESULT_SUCCESS;
267}
268
269
270#endif
271
272/*
273 * ---------------------------------------------------------------------------
274 * unifi_sdio_interrupt_handler
275 *
276 * This function should be called by the OS-dependent code to handle
277 * an SDIO interrupt from the UniFi.
278 *
279 * Arguments:
280 * card Pointer to card context structure.
281 *
282 * Returns:
283 * None.
284 *
285 * Notes: This function may be called in DRS context. In this case,
286 * tracing with the unifi_trace(), etc, is not allowed.
287 * ---------------------------------------------------------------------------
288 */
289void unifi_sdio_interrupt_handler(card_t *card)
290{
291 /*
292 * Set the flag to say reason for waking was SDIO interrupt.
293 * Then ask the OS layer to run the unifi_bh to give attention to the UniFi.
294 */
295 card->bh_reason_unifi = 1;
296 (void)unifi_run_bh(card->ospriv);
297} /* sdio_interrupt_handler() */
298
299
300/*
301 * ---------------------------------------------------------------------------
302 * unifi_configure_low_power_mode
303 *
304 * This function should be called by the OS-dependent when
305 * the deep sleep signaling needs to be enabled or disabled.
306 *
307 * Arguments:
308 * card Pointer to card context structure.
309 * low_power_mode Disable/Enable the deep sleep signaling
310 * periodic_wake_mode UniFi wakes host periodically.
311 *
312 * Returns:
313 * CSR_RESULT_SUCCESS on success or a CSR error code.
314 * ---------------------------------------------------------------------------
315 */
316CsrResult unifi_configure_low_power_mode(card_t *card,
317 enum unifi_low_power_mode low_power_mode,
318 enum unifi_periodic_wake_mode periodic_wake_mode)
319{
320 card->low_power_mode = low_power_mode;
321 card->periodic_wake_mode = periodic_wake_mode;
322
323 unifi_trace(card->ospriv, UDBG1,
324 "unifi_configure_low_power_mode: new mode = %s, wake_host = %s\n",
325 (low_power_mode == UNIFI_LOW_POWER_DISABLED)?"disabled" : "enabled",
326 (periodic_wake_mode == UNIFI_PERIODIC_WAKE_HOST_DISABLED)?"FALSE" : "TRUE");
327
328 (void)unifi_run_bh(card->ospriv);
329 return CSR_RESULT_SUCCESS;
330} /* unifi_configure_low_power_mode() */
331
332
333/*
334 * ---------------------------------------------------------------------------
335 * unifi_force_low_power_mode
336 *
337 * This function should be called by the OS-dependent when
338 * UniFi needs to be set to the low power mode (e.g. on suspend)
339 *
340 * Arguments:
341 * card Pointer to card context structure.
342 *
343 * Returns:
344 * CSR_RESULT_SUCCESS on success or a CSR error code.
345 * ---------------------------------------------------------------------------
346 */
347CsrResult unifi_force_low_power_mode(card_t *card)
348{
349 if (card->low_power_mode == UNIFI_LOW_POWER_DISABLED)
350 {
351 unifi_error(card->ospriv, "Attempt to set mode to TORPID when lower power mode is disabled\n");
352 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
353 }
354
355 return unifi_set_host_state(card, UNIFI_HOST_STATE_TORPID);
356} /* unifi_force_low_power_mode() */
357
358
359/*
360 * ---------------------------------------------------------------------------
361 * unifi_bh
362 *
363 * This function should be called by the OS-dependent code when
364 * host and/or UniFi has requested an exchange of messages.
365 *
366 * Arguments:
367 * card Pointer to card context structure.
368 *
369 * Returns:
370 * CSR_RESULT_SUCCESS on success or a CSR error code.
371 * ---------------------------------------------------------------------------
372 */
373CsrResult unifi_bh(card_t *card, u32 *remaining)
374{
375 CsrResult r;
376 CsrResult csrResult;
377 u8 pending;
378 s32 iostate, j;
379 const enum unifi_low_power_mode low_power_mode = card->low_power_mode;
380 u16 data_slots_used = 0;
381
382
383 /* Process request to raise the maximum SDIO clock */
384 r = process_clock_request(card);
385 if (r != CSR_RESULT_SUCCESS)
386 {
387 unifi_error(card->ospriv, "Error setting maximum SDIO clock\n");
388 goto exit;
389 }
390
391 /*
392 * Why was the BH thread woken?
393 * If it was an SDIO interrupt, UniFi is awake and we need to process it.
394 * If it was a host process queueing data, then we need to awaken UniFi.
395 *
396 * Priority of flags is top down.
397 *
398 * ----------------------------------------------------------+
399 * \state| AWAKE | DROWSY | TORPID |
400 * flag\ | | | |
401 * ---------+--------------+----------------+----------------|
402 * | do the host | go to AWAKE and| go to AWAKE and|
403 * unifi | protocol | do the host | do the host |
404 * | | protocol | protocol |
405 * ---------+--------------+----------------+----------------|
406 * | do the host | | |
407 * host | protocol | do nothing | go to DROWSY |
408 * | | | |
409 * ---------+--------------+----------------+----------------|
410 * | | | should not |
411 * timeout | go to TORPID | error, unifi | occur |
412 * | | didn't wake up | do nothing |
413 * ----------------------------------------------------------+
414 *
415 * Note that if we end up in the AWAKE state we always do the host protocol.
416 */
417
418 do
419 {
420 /*
421 * When the host state is set to DROWSY, then we can not disable the
422 * interrupts as UniFi can generate an interrupt even when the INT_ENABLE
423 * register has the interrupts disabled. This interrupt will be lost.
424 */
425 if (card->host_state == UNIFI_HOST_STATE_DROWSY || card->host_state == UNIFI_HOST_STATE_TORPID)
426 {
427 u8 reason_unifi;
428
429 /*
430 * An interrupt may occur while or after we cache the reason.
431 * This interrupt will cause the unifi_bh() to be scheduled again.
432 * Any interrupt that has happened before the register is read
433 * and is considered spurious has to acknowledged.
434 */
435 reason_unifi = card->bh_reason_unifi;
436
437 /*
438 * If an interrupt is received, check if it was a real one,
439 * set the host state to AWAKE and run the BH.
440 */
441 r = CardPendingInt(card, &pending);
442 if (r != CSR_RESULT_SUCCESS)
443 {
444 goto exit;
445 }
446
447 if (pending)
448 {
449 unifi_trace(card->ospriv, UDBG5,
450 "UNIFI_HOST_STATE_%s: Set state to AWAKE.\n",
451 (card->host_state == UNIFI_HOST_STATE_TORPID)?"TORPID" : "DROWSY");
452
453 r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE);
454 if (r == CSR_RESULT_SUCCESS)
455 {
456 (*remaining) = 0;
457 break;
458 }
459 }
460 else if (reason_unifi)
461 {
462 CsrSdioInterruptAcknowledge(card->sdio_if);
463 }
464
465 /*
466 * If an chip is in TORPID, and the host wants to wake it up,
467 * set the host state to DROWSY and wait for the wake-up interrupt.
468 */
469 if ((card->host_state == UNIFI_HOST_STATE_TORPID) && card->bh_reason_host)
470 {
471 r = unifi_set_host_state(card, UNIFI_HOST_STATE_DROWSY);
472 if (r == CSR_RESULT_SUCCESS)
473 {
474 /*
475 * set the timeout value to UNIFI_DEFAULT_WAKE_TIMEOUT
476 * to capture a wake error.
477 */
478 card->bh_reason_host = 0;
479 (*remaining) = UNIFI_DEFAULT_WAKE_TIMEOUT;
480 return CSR_RESULT_SUCCESS;
481 }
482
483 goto exit;
484 }
485
486 /*
487 * If the chip is in DROWSY, and the timeout expires,
488 * we need to reset the chip. This should never occur.
489 * (If it does, check that the calling thread set "remaining"
490 * according to the time remaining when unifi_bh() was called).
491 */
492 if ((card->host_state == UNIFI_HOST_STATE_DROWSY) && ((*remaining) == 0))
493 {
494 unifi_error(card->ospriv, "UniFi did not wake up on time...\n");
495
496 /*
497 * Check if Function1 has gone away or
498 * if we missed an SDIO interrupt.
499 */
500 r = unifi_check_io_status(card, &iostate);
501 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
502 {
503 goto exit;
504 }
505 /* Need to reset and reboot */
506 return CSR_RESULT_FAILURE;
507 }
508 }
509 else
510 {
511 if (card->bh_reason_unifi || card->bh_reason_host)
512 {
513 break;
514 }
515
516 if (((*remaining) == 0) && (low_power_mode == UNIFI_LOW_POWER_ENABLED))
517 {
518 r = unifi_set_host_state(card, UNIFI_HOST_STATE_TORPID);
519 if (r == CSR_RESULT_SUCCESS)
520 {
521 (*remaining) = 0;
522 return CSR_RESULT_SUCCESS;
523 }
524
525 goto exit;
526 }
527 }
528
529 /* No need to run the host protocol */
530 return CSR_RESULT_SUCCESS;
531 } while (0);
532
533
534 /* Disable the SDIO interrupts while doing SDIO ops */
535 csrResult = CsrSdioInterruptDisable(card->sdio_if);
536 if (csrResult == CSR_SDIO_RESULT_NO_DEVICE)
537 {
538 r = CSR_WIFI_HIP_RESULT_NO_DEVICE;
539 goto exit;
540 }
541 if (csrResult != CSR_RESULT_SUCCESS)
542 {
543 r = ConvertCsrSdioToCsrHipResult(card, csrResult);
544 unifi_error(card->ospriv, "Failed to disable SDIO interrupts. unifi_bh queues error.\n");
545 goto exit;
546 }
547
548 /* Now that the interrupts are disabled, ack the interrupt */
549 CsrSdioInterruptAcknowledge(card->sdio_if);
550
551 /* Run the HIP */
552 r = process_bh(card);
553 if (r != CSR_RESULT_SUCCESS)
554 {
555 goto exit;
556 }
557
558 /*
559 * If host is now idle, schedule a timer for the delay before we
560 * let UniFi go into deep sleep.
561 * If the timer goes off, we will move to TORPID state.
562 * If UniFi raises an interrupt in the meantime, we will cancel
563 * the timer and start a new one when we become idle.
564 */
565 for (j = 0; j < UNIFI_NO_OF_TX_QS; j++)
566 {
567 data_slots_used += CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_traffic_queue[j]);
568 }
569
570 if ((low_power_mode == UNIFI_LOW_POWER_ENABLED) && (data_slots_used == 0))
571 {
572#ifndef CSR_WIFI_HIP_TA_DISABLE
573 if (card->ta_sampling.traffic_type != CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_PERIODIC)
574 {
575#endif
576 /* return the UNIFI_DEFAULT_HOST_IDLE_TIMEOUT, so we can go to sleep. */
577 unifi_trace(card->ospriv, UDBG5,
578 "Traffic is not periodic, set timer for TORPID.\n");
579 (*remaining) = UNIFI_DEFAULT_HOST_IDLE_TIMEOUT;
580#ifndef CSR_WIFI_HIP_TA_DISABLE
581 }
582 else
583 {
584 unifi_trace(card->ospriv, UDBG5,
585 "Traffic is periodic, set unifi to TORPID immediately.\n");
586 if (CardAreAllFromHostDataSlotsEmpty(card) == 1)
587 {
588 r = unifi_set_host_state(card, UNIFI_HOST_STATE_TORPID);
589 if (r != CSR_RESULT_SUCCESS)
590 {
591 goto exit;
592 }
593 }
594 }
595#endif
596 }
597
598 csrResult = CsrSdioInterruptEnable(card->sdio_if);
599 if (csrResult == CSR_SDIO_RESULT_NO_DEVICE)
600 {
601 r = CSR_WIFI_HIP_RESULT_NO_DEVICE;
602 }
603 if (csrResult != CSR_RESULT_SUCCESS)
604 {
605 r = ConvertCsrSdioToCsrHipResult(card, csrResult);
606 unifi_error(card->ospriv, "Failed to enable SDIO interrupt\n");
607 }
608
609exit:
610
611 unifi_trace(card->ospriv, UDBG4, "New state=%d\n", card->host_state);
612
613 if (r != CSR_RESULT_SUCCESS)
614 {
615#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE)
616 unifi_debug_buf_dump();
617#endif
618 /* If an interrupt has been raised, ack it here */
619 if (card->bh_reason_unifi)
620 {
621 CsrSdioInterruptAcknowledge(card->sdio_if);
622 }
623
624 unifi_error(card->ospriv,
625 "unifi_bh: state=%d %c, clock=%dkHz, interrupt=%d host=%d, power_save=%s\n",
626 card->host_state,
627 (card->host_state == UNIFI_HOST_STATE_AWAKE)?'A' : (card->host_state == UNIFI_HOST_STATE_DROWSY)?'D' : 'T',
628 card->sdio_clock_speed / 1000,
629 card->bh_reason_unifi, card->bh_reason_host,
630 (low_power_mode == UNIFI_LOW_POWER_DISABLED)?"disabled" : "enabled");
631
632 /* Try to capture firmware panic codes */
633 (void)unifi_capture_panic(card);
634
635 /* Ask for a mini-coredump when the driver has reset UniFi */
636 (void)unifi_coredump_request_at_next_reset(card, 1);
637 }
638
639 return r;
640} /* unifi_bh() */
641
642
643/*
644 * ---------------------------------------------------------------------------
645 * process_clock_request
646 *
647 * Handle request from the OS layer to increase the SDIO clock speed.
648 * The fast clock is limited until the firmware has indicated that it has
649 * completed initialisation to the OS layer.
650 *
651 * Arguments:
652 * card Pointer to card context structure.
653 *
654 * Returns:
655 * CSR_RESULT_SUCCESS on success or CSR error code.
656 * ---------------------------------------------------------------------------
657 */
658static CsrResult process_clock_request(card_t *card)
659{
660 CsrResult r = CSR_RESULT_SUCCESS;
661 CsrResult csrResult;
662
663 if (!card->request_max_clock)
664 {
665 return CSR_RESULT_SUCCESS; /* No pending request */
666 }
667
668 /*
669 * The SDIO clock speed request from the OS layer is only acted upon if
670 * the UniFi is awake. If it was in any other state, the clock speed will
671 * transition through SAFE to MAX while the host wakes it up, and the
672 * final speed reached will be UNIFI_SDIO_CLOCK_MAX_HZ.
673 * This assumes that the SME never requests low power mode while the f/w
674 * initialisation takes place.
675 */
676 if (card->host_state == UNIFI_HOST_STATE_AWAKE)
677 {
678 unifi_trace(card->ospriv, UDBG1, "Set SDIO max clock\n");
679 csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_MAX_HZ);
680 if (csrResult != CSR_RESULT_SUCCESS)
681 {
682 r = ConvertCsrSdioToCsrHipResult(card, csrResult);
683 }
684 else
685 {
686 card->sdio_clock_speed = UNIFI_SDIO_CLOCK_MAX_HZ; /* log the new freq */
687 }
688 }
689 else
690 {
691 unifi_trace(card->ospriv, UDBG1, "Will set SDIO max clock after wakeup\n");
692 }
693
694 /* Cancel the request now that it has been acted upon, or is about to be
695 * by the wakeup mechanism
696 */
697 card->request_max_clock = 0;
698
699 return r;
700}
701
702
703/*
704 * ---------------------------------------------------------------------------
705 * process_bh
706 *
707 * Exchange messages with UniFi
708 *
709 * Arguments:
710 * card Pointer to card context structure.
711 *
712 * Returns:
713 * CSR_RESULT_SUCCESS on success or CSR error code.
714 * ---------------------------------------------------------------------------
715 */
716static CsrResult process_bh(card_t *card)
717{
718 CsrResult r;
719 u8 more;
720 more = FALSE;
721
722 /* Process the reasons (interrupt, signals) */
723 do
724 {
725 /*
726 * Run in a while loop, to save clearing the interrupts
727 * every time around the outside loop.
728 */
729 do
730 {
731 /* If configured to run the HIP just once, skip first loop */
732 if (card->intmode & CSR_WIFI_INTMODE_RUN_BH_ONCE)
733 {
734 break;
735 }
736
737 r = handle_host_protocol(card, &more);
738 if (r != CSR_RESULT_SUCCESS)
739 {
740 return r;
741 }
742
743#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
744 unifi_debug_log_to_buf("c52=%d c53=%d tx=%d txc=%d rx=%d s=%d t=%d fc=%d\n",
745 card->cmd_prof.cmd52_count,
746 card->cmd_prof.cmd53_count,
747 card->cmd_prof.tx_count,
748 card->cmd_prof.tx_cfm_count,
749 card->cmd_prof.rx_count,
750 card->cmd_prof.sdio_cmd_signal,
751 card->cmd_prof.sdio_cmd_to_host,
752 card->cmd_prof.sdio_cmd_from_host_and_clear
753 );
754
755 card->cmd_prof.cmd52_count = card->cmd_prof.cmd53_count = 0;
756 card->cmd_prof.tx_count = card->cmd_prof.tx_cfm_count = card->cmd_prof.rx_count = 0;
757
758 card->cmd_prof.cmd52_f0_r_count = 0;
759 card->cmd_prof.cmd52_f0_w_count = 0;
760 card->cmd_prof.cmd52_r8or16_count = 0;
761 card->cmd_prof.cmd52_w8or16_count = 0;
762 card->cmd_prof.cmd52_r16_count = 0;
763 card->cmd_prof.cmd52_w16_count = 0;
764 card->cmd_prof.cmd52_r32_count = 0;
765
766 card->cmd_prof.sdio_cmd_signal = 0;
767 card->cmd_prof.sdio_cmd_clear_slot = 0;
768 card->cmd_prof.sdio_cmd_to_host = 0;
769 card->cmd_prof.sdio_cmd_from_host = 0;
770 card->cmd_prof.sdio_cmd_from_host_and_clear = 0;
771#endif
772
773
774 } while (more || card->bh_reason_unifi || card->bh_reason_host);
775
776 /* Acknowledge the h/w interrupt */
777 r = CardClearInt(card);
778 if (r != CSR_RESULT_SUCCESS)
779 {
780 unifi_error(card->ospriv, "Failed to acknowledge interrupt.\n");
781 return r;
782 }
783
784 /*
785 * UniFi may have tried to generate an interrupt during the
786 * CardClearInt() was running. So, we need to run the host
787 * protocol again, to check if there are any pending requests.
788 */
789 r = handle_host_protocol(card, &more);
790 if (r != CSR_RESULT_SUCCESS)
791 {
792 return r;
793 }
794
795#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
796 unifi_debug_log_to_buf("c52=%d c53=%d tx=%d txc=%d rx=%d s=%d t=%d fc=%d\n",
797 card->cmd_prof.cmd52_count,
798 card->cmd_prof.cmd53_count,
799 card->cmd_prof.tx_count,
800 card->cmd_prof.tx_cfm_count,
801 card->cmd_prof.rx_count,
802 card->cmd_prof.sdio_cmd_signal,
803 card->cmd_prof.sdio_cmd_to_host,
804 card->cmd_prof.sdio_cmd_from_host_and_clear
805 );
806
807 card->cmd_prof.cmd52_count = card->cmd_prof.cmd53_count = 0;
808 card->cmd_prof.tx_count = card->cmd_prof.tx_cfm_count = card->cmd_prof.rx_count = 0;
809
810 card->cmd_prof.cmd52_f0_r_count = 0;
811 card->cmd_prof.cmd52_f0_w_count = 0;
812 card->cmd_prof.cmd52_r8or16_count = 0;
813 card->cmd_prof.cmd52_w8or16_count = 0;
814 card->cmd_prof.cmd52_r16_count = 0;
815 card->cmd_prof.cmd52_w16_count = 0;
816 card->cmd_prof.cmd52_r32_count = 0;
817
818 card->cmd_prof.sdio_cmd_signal = 0;
819 card->cmd_prof.sdio_cmd_clear_slot = 0;
820 card->cmd_prof.sdio_cmd_to_host = 0;
821 card->cmd_prof.sdio_cmd_from_host = 0;
822 card->cmd_prof.sdio_cmd_from_host_and_clear = 0;
823#endif
824 /* If configured to run the HIP just once, work is now done */
825 if (card->intmode & CSR_WIFI_INTMODE_RUN_BH_ONCE)
826 {
827 break;
828 }
829
830 } while (more || card->bh_reason_unifi || card->bh_reason_host);
831
832#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
833 if ((card->intmode & CSR_WIFI_INTMODE_RUN_BH_ONCE) == 0)
834 {
835 unifi_debug_log_to_buf("proc=%d\n",
836 card->cmd_prof.process_count);
837 }
838#endif
839
840 return CSR_RESULT_SUCCESS;
841} /* process_bh() */
842
843
844/*
845 * ---------------------------------------------------------------------------
846 * handle_host_protocol
847 *
848 * This function implements the Host Interface Protocol (HIP) as
849 * described in the Host Interface Protocol Specification.
850 *
851 * Arguments:
852 * card Pointer to card context structure.
853 * processed_something Pointer to location to update processing status:
854 * TRUE when data was transferred
855 * FALSE when no data was transferred (queues empty)
856 *
857 * Returns:
858 * CSR_RESULT_SUCCESS on success or CSR error code.
859 * ---------------------------------------------------------------------------
860 */
861static CsrResult handle_host_protocol(card_t *card, u8 *processed_something)
862{
863 CsrResult r;
864 s32 done;
865
866 *processed_something = FALSE;
867
868#ifdef CSR_WIFI_HIP_NOISY
869 unifi_error(card->ospriv, " ======================== \n");
870#endif /* CSR_WIFI_HIP_NOISY */
871
872#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE
873 card->cmd_prof.process_count++;
874#endif
875
876 card->bh_reason_unifi = card->bh_reason_host = 0;
877 card->generate_interrupt = 0;
878
879
880 /*
881 * (Re)fill the T-H signal buffer
882 */
883 r = read_to_host_signals(card, &done);
884 if (r != CSR_RESULT_SUCCESS)
885 {
886 unifi_error(card->ospriv, "Error occurred reading to-host signals\n");
887 return r;
888 }
889 if (done > 0)
890 {
891 *processed_something = TRUE;
892 }
893
894 /*
895 * Process any to-host signals.
896 * Perform any requested CMD53 transfers here, but just queue any
897 * bulk data command responses.
898 */
899 r = process_to_host_signals(card, &done);
900 if (r != CSR_RESULT_SUCCESS)
901 {
902 unifi_error(card->ospriv, "Error occurred processing to-host signals\n");
903 return r;
904 }
905
906 /* Now send any signals in the F-H queues */
907 /* Give precedence to the command queue */
908 r = process_fh_cmd_queue(card, &done);
909 if (r != CSR_RESULT_SUCCESS)
910 {
911 unifi_error(card->ospriv, "Error occurred processing from-host signals\n");
912 return r;
913 }
914 if (done > 0)
915 {
916 *processed_something = TRUE;
917 }
918
919 r = process_fh_traffic_queue(card, &done);
920 if (r != CSR_RESULT_SUCCESS)
921 {
922 unifi_error(card->ospriv, "Error occurred processing from-host data signals\n");
923 return r;
924 }
925 if (done > 0)
926 {
927 *processed_something = TRUE;
928 }
929
930 /* Flush out the batch of signals to the UniFi. */
931 r = flush_fh_buffer(card);
932 if (r != CSR_RESULT_SUCCESS)
933 {
934 unifi_error(card->ospriv, "Failed to copy from-host signals to UniFi\n");
935 return r;
936 }
937
938
939 /*
940 * Send the host interrupt to say the queues have been modified.
941 */
942 if (card->generate_interrupt)
943 {
944 r = CardGenInt(card);
945 if (r != CSR_RESULT_SUCCESS)
946 {
947 unifi_error(card->ospriv, "Failed to notify UniFi that queues have been modified.\n");
948 return r;
949 }
950 }
951
952#ifdef CSR_WIFI_RX_PATH_SPLIT
953#ifdef CSR_WIFI_RX_PATH_SPLIT_DONT_USE_WQ
954 unifi_rx_queue_flush(card->ospriv);
955#endif
956#endif
957
958 /* See if we can re-enable transmission now */
959 restart_packet_flow(card);
960
961#ifdef CSR_PRE_ALLOC_NET_DATA
962 r = prealloc_netdata_alloc(card);
963 if (r != CSR_RESULT_SUCCESS)
964 {
965 unifi_error(card->ospriv, "prealloc_netdata failed\n");
966 return r;
967 }
968#endif
969
970 /*
971 * Don't put the thread sleep if we just interacted with the chip,
972 * there might be more to do if we look again.
973 */
974 return r;
975} /* handle_host_protocol() */
976
977
978/*
979 * Rounds the given signal length in bytes to a whole number
980 * of sig_frag_size.
981 */
982#define GET_CHUNKS_FOR(SIG_FRAG_SIZE, LENGTH) (((LENGTH) + ((SIG_FRAG_SIZE)-1)) / (SIG_FRAG_SIZE))
983
984
985/*
986 * ---------------------------------------------------------------------------
987 * read_to_host_signals
988 *
989 * Read everything pending in the UniFi TH signal buffer.
990 * Only do it if the local buffer is empty.
991 *
992 * Arguments:
993 * card Pointer to card context struct
994 * processed Number of signals read:
995 * 0 if there were no signals pending,
996 * 1 if we read at least one signal
997 * Returns:
998 * CSR error code if an error occurred.
999 * ---------------------------------------------------------------------------
1000 */
1001static CsrResult read_to_host_signals(card_t *card, s32 *processed)
1002{
1003 s32 count_thw, count_thr;
1004 s32 unread_chunks, unread_bytes;
1005 CsrResult r;
1006
1007 *processed = 0;
1008
1009 /* Read any pending signals or bulk data commands */
1010 count_thw = unifi_read_shared_count(card, card->sdio_ctrl_addr + 4);
1011 if (count_thw < 0)
1012 {
1013 unifi_error(card->ospriv, "Failed to read to-host sig written count\n");
1014 return CSR_RESULT_FAILURE;
1015 }
1016 card->to_host_signals_w = count_thw; /* diag */
1017
1018 count_thr = card->to_host_signals_r;
1019
1020 if (count_thw == count_thr)
1021 {
1022 return CSR_RESULT_SUCCESS;
1023 }
1024
1025 unread_chunks =
1026 (((count_thw - count_thr) + 128) % 128) - card->th_buffer.count;
1027
1028 if (unread_chunks == 0)
1029 {
1030 return CSR_RESULT_SUCCESS;
1031 }
1032
1033 unread_bytes = card->config_data.sig_frag_size * unread_chunks;
1034
1035
1036 r = unifi_bulk_rw(card,
1037 card->config_data.tohost_sigbuf_handle,
1038 card->th_buffer.ptr,
1039 unread_bytes,
1040 UNIFI_SDIO_READ);
1041 if (r != CSR_RESULT_SUCCESS)
1042 {
1043 unifi_error(card->ospriv, "Failed to read ToHost signal\n");
1044 return r;
1045 }
1046
1047 card->th_buffer.ptr += unread_bytes;
1048 card->th_buffer.count += (u16)unread_chunks;
1049
1050 *processed = 1;
1051
1052 return CSR_RESULT_SUCCESS;
1053} /* read_to_host_signals() */
1054
1055
1056/*
1057 * ---------------------------------------------------------------------------
1058 * update_to_host_signals_r
1059 *
1060 * Advance the shared-memory count of chunks read from the to-host
1061 * signal buffer.
1062 * Raise a UniFi internal interrupt to tell the firmware that the
1063 * count has changed.
1064 *
1065 * Arguments:
1066 * card Pointer to card context struct
1067 * pending Number of chunks remaining
1068 *
1069 * Returns:
1070 * CSR_RESULT_SUCCESS on success or CSR error code
1071 * ---------------------------------------------------------------------------
1072 */
1073static CsrResult update_to_host_signals_r(card_t *card, s16 pending)
1074{
1075 CsrResult r;
1076
1077 card->to_host_signals_r =
1078 (card->to_host_signals_r + (card->th_buffer.count - pending)) % 128;
1079 card->th_buffer.count = pending;
1080
1081 /* Update the count of signals read */
1082 r = unifi_write_8_or_16(card, card->sdio_ctrl_addr + 6,
1083 (u8)card->to_host_signals_r);
1084 if (r != CSR_RESULT_SUCCESS)
1085 {
1086 unifi_error(card->ospriv, "Failed to update to-host signals read\n");
1087 return r;
1088 }
1089
1090 r = CardGenInt(card);
1091 if (r != CSR_RESULT_SUCCESS)
1092 {
1093 unifi_error(card->ospriv, "Failed to notify UniFi that we processed to-host signals.\n");
1094 return r;
1095 }
1096
1097 card->generate_interrupt = 0;
1098
1099 return CSR_RESULT_SUCCESS;
1100} /* update_to_host_signals_r() */
1101
1102
1103/*
1104 * ---------------------------------------------------------------------------
1105 * read_unpack_cmd
1106 *
1107 * Converts a wire-formatted command to the host bulk_data_cmd_t structure.
1108 *
1109 * Arguments:
1110 * ptr Pointer to the command
1111 * bulk_data_cmd Pointer to the host structure
1112 *
1113 * Returns:
1114 * None.
1115 * ---------------------------------------------------------------------------
1116 */
1117static void read_unpack_cmd(const u8 *ptr, bulk_data_cmd_t *bulk_data_cmd)
1118{
1119 s16 index = 0;
1120 bulk_data_cmd->cmd_and_len = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1121 index += SIZEOF_UINT16;
1122 bulk_data_cmd->data_slot = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1123 index += SIZEOF_UINT16;
1124 bulk_data_cmd->offset = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1125 index += SIZEOF_UINT16;
1126 bulk_data_cmd->buffer_handle = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1127 index += SIZEOF_UINT16;
1128} /* read_unpack_cmd */
1129
1130
1131/*
1132 * ---------------------------------------------------------------------------
1133 * process_to_host_signals
1134 *
1135 * Read and dispatch signals from the UniFi
1136 *
1137 * Arguments:
1138 * card Pointer to card context struct
1139 * processed Pointer to location to write processing result:
1140 * 0 if there were no signals pending,
1141 * 1 if we read at least one signal
1142 *
1143 * Returns:
1144 * CSR error code if there was an error
1145 *
1146 * Notes:
1147 * Since bulk data transfers can take a long time, if we wait until
1148 * all are done before we acknowledge the signals, the UniFi runs out
1149 * of buffer space. Therefore we keep a count of the bytes transferred
1150 * in bulk data commands, and update the to-host-signals-read count
1151 * if we've done a large transfer.
1152 *
1153 * All data in the f/w is stored in a little endian format, without any
1154 * padding bytes. Every read from the memory has to be transformed in
1155 * host (cpu specific) format, before we can process it. Therefore we
1156 * use read_unpack_cmd() and read_unpack_signal() to convert the raw data
1157 * contained in the card->th_buffer.buf to host structures.
1158 * Important: UDI clients use wire-formatted structures, so we need to
1159 * indicate all data, as we have read it from the device.
1160 * ---------------------------------------------------------------------------
1161 */
1162static CsrResult process_to_host_signals(card_t *card, s32 *processed)
1163{
1164 s16 pending;
1165 s16 remaining;
1166 u8 *bufptr;
1167 bulk_data_param_t data_ptrs;
1168 s16 cmd;
1169 u16 sig_len;
1170 s16 i;
1171 u16 chunks_in_buf;
1172 u16 bytes_transferred = 0;
1173 CsrResult r = CSR_RESULT_SUCCESS;
1174
1175 *processed = 0;
1176
1177 pending = card->th_buffer.count;
1178
1179 /* Are there new to-host signals? */
1180 unifi_trace(card->ospriv, UDBG4, "handling %d to-host chunks\n", pending);
1181
1182 if (!pending)
1183 {
1184 return CSR_RESULT_SUCCESS;
1185 }
1186
1187 /*
1188 * This is a pointer to the raw data we have read from the f/w.
1189 * Can be a signal or a command. Note that we need to convert
1190 * it to a host structure before we process it.
1191 */
1192 bufptr = card->th_buffer.buf;
1193
1194 while (pending > 0)
1195 {
1196 s16 f_flush_count = 0;
1197
1198 /*
1199 * Command and length are common to signal and bulk data msgs.
1200 * If command == 0 (i.e. a signal), len is number of bytes
1201 * *following* the 2-byte header.
1202 */
1203 cmd = bufptr[1] >> 4;
1204 sig_len = bufptr[0] + ((bufptr[1] & 0x0F) << 8);
1205
1206#ifdef CSR_WIFI_HIP_NOISY
1207 unifi_error(card->ospriv, "Received UniFi msg cmd=%d, len=%d\n",
1208 cmd, sig_len);
1209#endif /* CSR_WIFI_HIP_NOISY */
1210
1211 if ((sig_len == 0) &&
1212 ((cmd != SDIO_CMD_CLEAR_SLOT) && (cmd != SDIO_CMD_PADDING)))
1213 {
1214 unifi_error(card->ospriv, "incomplete signal or command: has size zero\n");
1215 return CSR_RESULT_FAILURE;
1216 }
1217 /*
1218 * Make sure the buffer contains a complete message.
1219 * Signals may occupy multiple chunks, bulk-data commands occupy
1220 * one chunk.
1221 */
1222 if (cmd == SDIO_CMD_SIGNAL)
1223 {
1224 chunks_in_buf = GET_CHUNKS_FOR(card->config_data.sig_frag_size, (u16)(sig_len + 2));
1225 }
1226 else
1227 {
1228 chunks_in_buf = 1;
1229 }
1230
1231 if (chunks_in_buf > (u16)pending)
1232 {
1233 unifi_error(card->ospriv, "incomplete signal (0x%x?): need %d chunks, got %d\n",
1234 GET_SIGNAL_ID(bufptr + 2),
1235 chunks_in_buf, pending);
1236 unifi_error(card->ospriv, " thsw=%d, thsr=%d\n",
1237 card->to_host_signals_w,
1238 card->to_host_signals_r);
1239 return CSR_RESULT_FAILURE;
1240 }
1241
1242
1243 switch (cmd)
1244 {
1245 case SDIO_CMD_SIGNAL:
1246 /* This is a signal. Read the rest of it and then handle it. */
1247#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
1248 card->cmd_prof.sdio_cmd_signal++;
1249#endif
1250
1251 for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++)
1252 {
1253 /* Retrieve dataRefs[i].DataLength */
1254 u16 data_len = GET_PACKED_DATAREF_LEN(bufptr + 2, i);
1255
1256 /*
1257 * The bulk data length in the signal can not be greater than
1258 * the maximun length allowed by the SDIO config structure.
1259 */
1260 if (data_len > card->config_data.data_slot_size)
1261 {
1262 unifi_error(card->ospriv,
1263 "Bulk Data length (%d) exceeds Maximum Bulk Data length (%d)\n",
1264 data_len, card->config_data.data_slot_size);
1265 return CSR_RESULT_FAILURE;
1266 }
1267
1268 /*
1269 * Len here might not be the same as the length in the
1270 * bulk data slot. The slot length will always be even,
1271 * but len could be odd.
1272 */
1273 if (data_len != 0)
1274 {
1275 /* Retrieve dataRefs[i].SlotNumber */
1276 s16 slot = GET_PACKED_DATAREF_SLOT(bufptr + 2, i);
1277
1278 if (slot >= card->config_data.num_tohost_data_slots)
1279 {
1280 unifi_error(card->ospriv, "!!!bad slot number in to-host signal: %d, sig 0x%X\n",
1281 slot, cmd);
1282 return CSR_RESULT_FAILURE;
1283 }
1284
1285 data_ptrs.d[i].os_data_ptr = card->to_host_data[slot].os_data_ptr;
1286 data_ptrs.d[i].os_net_buf_ptr = card->to_host_data[slot].os_net_buf_ptr;
1287 data_ptrs.d[i].net_buf_length = card->to_host_data[slot].net_buf_length;
1288 data_ptrs.d[i].data_length = data_len;
1289 }
1290 else
1291 {
1292 UNIFI_INIT_BULK_DATA(&data_ptrs.d[i]);
1293 }
1294 }
1295
1296 /*
1297 * Log the signal to the UDI, before call unifi_receive_event() as
1298 * it can modify the bulk data.
1299 */
1300 if (card->udi_hook)
1301 {
1302 (*card->udi_hook)(card->ospriv, bufptr + 2, sig_len,
1303 &data_ptrs, UDI_LOG_TO_HOST);
1304 }
1305
1306#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE
1307 if (GET_SIGNAL_ID(bufptr + 2) == CSR_MA_PACKET_CONFIRM_ID)
1308 {
1309 card->cmd_prof.tx_cfm_count++;
1310 }
1311 else if (GET_SIGNAL_ID(bufptr + 2) == CSR_MA_PACKET_INDICATION_ID)
1312 {
1313 if (data_ptrs.d[0].os_data_ptr)
1314 {
1315 if ((*data_ptrs.d[0].os_data_ptr) & 0x08)
1316 {
1317 card->cmd_prof.rx_count++;
1318 }
1319 }
1320 }
1321#endif
1322 /*
1323 * Check if the signal is MA-PACKET.cfm and if so check the status.
1324 * If the status is failure, search through the slot records to find
1325 * if any slots are occupied for this host tag. This can happen if
1326 * f/w has not downloaded the bulkdata and before that itself it has
1327 * signalled the confirm with failure. If it finds a slot with that
1328 * host tag then, it clears the corresponding slot
1329 */
1330
1331 if (GET_SIGNAL_ID(bufptr + 2) == CSR_MA_PACKET_CONFIRM_ID)
1332 {
1333 /* Get host tag and transmission status */
1334 u32 host_tag = GET_PACKED_MA_PACKET_CONFIRM_HOST_TAG(bufptr + 2);
1335 u16 status = GET_PACKED_MA_PACKET_CONFIRM_TRANSMISSION_STATUS(bufptr + 2);
1336
1337 unifi_trace(card->ospriv, UDBG4, "process_to_host_signals signal ID=%x host Tag=%x status=%x\n",
1338 GET_SIGNAL_ID(bufptr + 2), host_tag, status);
1339
1340 /* If transmission status is failure then search through the slot records
1341 * and if for any slot records the clear slot is not done then do it now
1342 */
1343
1344 if (status && (card->fh_slot_host_tag_record))
1345 {
1346 u16 num_fh_slots = card->config_data.num_fromhost_data_slots;
1347
1348 /* search through the list of slot records and match with host tag
1349 * If a slot is not yet cleared then clear the slot from here
1350 */
1351 for (i = 0; i < num_fh_slots; i++)
1352 {
1353 if (card->fh_slot_host_tag_record[i] == host_tag)
1354 {
1355#ifdef CSR_WIFI_REQUEUE_PACKET_TO_HAL
1356 /* Invoke the HAL module function to requeue it back to HAL Queues */
1357 r = unifi_reque_ma_packet_request(card->ospriv, host_tag, status, &card->from_host_data[i].bd);
1358 card->fh_slot_host_tag_record[i] = CSR_WIFI_HIP_RESERVED_HOST_TAG;
1359 if (CSR_RESULT_SUCCESS != r)
1360 {
1361 unifi_trace(card->ospriv, UDBG5, "process_to_host_signals: Failed to requeue Packet(hTag:%x) back to HAL \n", host_tag);
1362 CardClearFromHostDataSlot(card, i);
1363 }
1364 else
1365 {
1366 CardClearFromHostDataSlotWithoutFreeingBulkData(card, i);
1367 }
1368
1369#else
1370 unifi_trace(card->ospriv, UDBG4, "process_to_host_signals Clear slot=%x host tag=%x\n", i, host_tag);
1371 card->fh_slot_host_tag_record[i] = CSR_WIFI_HIP_RESERVED_HOST_TAG;
1372
1373 /* Set length field in from_host_data array to 0 */
1374 CardClearFromHostDataSlot(card, i);
1375#endif
1376 break;
1377 }
1378 }
1379 }
1380 }
1381
1382 /* Pass event to OS layer */
1383 unifi_receive_event(card->ospriv, bufptr + 2, sig_len, &data_ptrs);
1384
1385 /* Initialise the to_host data, so it can be re-used. */
1386 for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++)
1387 {
1388 /* The slot is only valid if the length is non-zero. */
1389 if (GET_PACKED_DATAREF_LEN(bufptr + 2, i) != 0)
1390 {
1391 s16 slot = GET_PACKED_DATAREF_SLOT(bufptr + 2, i);
1392 if (slot < card->config_data.num_tohost_data_slots)
1393 {
1394 UNIFI_INIT_BULK_DATA(&card->to_host_data[slot]);
1395 }
1396 }
1397 }
1398
1399#ifndef CSR_WIFI_DEFER_TH_FLUSH
1400 /*
1401 * If we have previously transferred a lot of data, ack
1402 * the signals read so far, so f/w can reclaim the buffer
1403 * memory sooner.
1404 */
1405 if (bytes_transferred >= TO_HOST_FLUSH_THRESHOLD)
1406 {
1407 f_flush_count = 1;
1408 }
1409#endif
1410 break;
1411
1412
1413 case SDIO_CMD_CLEAR_SLOT:
1414#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
1415 card->cmd_prof.sdio_cmd_clear_slot++;
1416#endif
1417 /* This is a clear slot command. */
1418 if (sig_len != 0)
1419 {
1420 unifi_error(card->ospriv, "process_to_host_signals: clear slot, bad data len: 0x%X at offset %d\n",
1421 sig_len, bufptr - card->th_buffer.buf);
1422 return CSR_RESULT_FAILURE;
1423 }
1424
1425 r = process_clear_slot_command(card, bufptr);
1426 if (r != CSR_RESULT_SUCCESS)
1427 {
1428 unifi_error(card->ospriv, "Failed to process clear slot\n");
1429 return r;
1430 }
1431 break;
1432
1433 case SDIO_CMD_TO_HOST_TRANSFER:
1434 case SDIO_CMD_FROM_HOST_TRANSFER:
1435 case SDIO_CMD_FROM_HOST_AND_CLEAR:
1436 case SDIO_CMD_OVERLAY_TRANSFER:
1437 /* This is a bulk data command. */
1438 if (sig_len & 1)
1439 {
1440 unifi_error(card->ospriv, "process_to_host_signals: bulk data, bad data len: 0x%X at offset %d\n",
1441 sig_len, bufptr - card->th_buffer.buf);
1442 return CSR_RESULT_FAILURE;
1443 }
1444
1445 r = process_bulk_data_command(card, bufptr, cmd, sig_len);
1446 if (r != CSR_RESULT_SUCCESS)
1447 {
1448 unifi_error(card->ospriv, "Failed to process bulk cmd\n");
1449 return r;
1450 }
1451 /* Count the bytes transferred */
1452 bytes_transferred += sig_len;
1453
1454 if (cmd == SDIO_CMD_FROM_HOST_AND_CLEAR)
1455 {
1456#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
1457 card->cmd_prof.sdio_cmd_from_host_and_clear++;
1458#endif
1459#ifndef CSR_WIFI_DEFER_TH_FLUSH
1460 f_flush_count = 1;
1461#endif
1462 }
1463#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
1464 else if (cmd == SDIO_CMD_FROM_HOST_TRANSFER)
1465 {
1466 card->cmd_prof.sdio_cmd_from_host++;
1467 }
1468 else if (cmd == SDIO_CMD_TO_HOST_TRANSFER)
1469 {
1470 card->cmd_prof.sdio_cmd_to_host++;
1471 }
1472#endif
1473 break;
1474
1475 case SDIO_CMD_PADDING:
1476 break;
1477
1478 default:
1479 unifi_error(card->ospriv, "Unrecognised to-host command: %d\n", cmd);
1480 break;
1481 }
1482
1483 bufptr += chunks_in_buf * card->config_data.sig_frag_size;
1484 pending -= chunks_in_buf;
1485
1486 /*
1487 * Write out the host signal count when a significant
1488 * number of bytes of bulk data have been transferred or
1489 * when we have performed a CopyFromHostAndClear.
1490 */
1491 if (f_flush_count)
1492 {
1493 r = update_to_host_signals_r(card, pending);
1494 if (r != CSR_RESULT_SUCCESS)
1495 {
1496 return r;
1497 }
1498 bytes_transferred = 0;
1499 }
1500 }
1501
1502 if (pending)
1503 {
1504 unifi_warning(card->ospriv, "proc_th_sigs: %d unprocessed\n", pending);
1505 }
1506
1507 /* If we processed any signals, write the updated count to UniFi */
1508 if (card->th_buffer.count != pending)
1509 {
1510 r = update_to_host_signals_r(card, pending);
1511 if (r != CSR_RESULT_SUCCESS)
1512 {
1513 return r;
1514 }
1515 }
1516
1517 /*
1518 * Reset the buffer pointer, copying down any un-processed signals.
1519 * This can happen if we enable the optimisation in read_to_host_signals()
1520 * that limits the length to whole blocks.
1521 */
1522 remaining = card->th_buffer.ptr - bufptr;
1523 if (remaining < 0)
1524 {
1525 unifi_error(card->ospriv, "Processing TH signals overran the buffer\n");
1526 return CSR_RESULT_FAILURE;
1527 }
1528 if (remaining > 0)
1529 {
1530 /* Use a safe copy because source and destination may overlap */
1531 u8 *d = card->th_buffer.buf;
1532 u8 *s = bufptr;
1533 s32 n = remaining;
1534 while (n--)
1535 {
1536 *d++ = *s++;
1537 }
1538 }
1539 card->th_buffer.ptr = card->th_buffer.buf + remaining;
1540
1541
1542 /* If we reach here then we processed something */
1543 *processed = 1;
1544 return CSR_RESULT_SUCCESS;
1545} /* process_to_host_signals() */
1546
1547
1548/*
1549 * ---------------------------------------------------------------------------
1550 * process_clear_slot_command
1551 *
1552 * Process a clear slot command fom the UniFi.
1553 *
1554 * Arguments:
1555 * card Pointer to card context struct
1556 * bdcmd Pointer to bulk-data command msg from UniFi
1557 *
1558 * Returns:
1559 * 0 on success, CSR error code on error
1560 * ---------------------------------------------------------------------------
1561 */
1562static CsrResult process_clear_slot_command(card_t *card, const u8 *cmdptr)
1563{
1564 u16 data_slot;
1565 s16 slot;
1566
1567 data_slot = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(cmdptr + SIZEOF_UINT16);
1568
1569 unifi_trace(card->ospriv, UDBG4, "Processing clear slot cmd, slot=0x%X\n",
1570 data_slot);
1571
1572 slot = data_slot & 0x7FFF;
1573
1574#ifdef CSR_WIFI_HIP_NOISY
1575 unifi_error(card->ospriv, "CMD clear data slot 0x%04x\n", data_slot);
1576#endif /* CSR_WIFI_HIP_NOISY */
1577
1578 if (data_slot & SLOT_DIR_TO_HOST)
1579 {
1580 if (slot >= card->config_data.num_tohost_data_slots)
1581 {
1582 unifi_error(card->ospriv,
1583 "Invalid to-host data slot in SDIO_CMD_CLEAR_SLOT: %d\n",
1584 slot);
1585 return CSR_RESULT_FAILURE;
1586 }
1587 /* clear to-host data slot */
1588 unifi_warning(card->ospriv, "Unexpected clear to-host data slot cmd: 0x%04x\n",
1589 data_slot);
1590 }
1591 else
1592 {
1593 if (slot >= card->config_data.num_fromhost_data_slots)
1594 {
1595 unifi_error(card->ospriv,
1596 "Invalid from-host data slot in SDIO_CMD_CLEAR_SLOT: %d\n",
1597 slot);
1598 return CSR_RESULT_FAILURE;
1599 }
1600
1601 /*
1602 * The driver is the owner to clear all slots now
1603 * Ref - comment in process_fh_traffic_queue
1604 * so it will just ignore the clear slot command from firmware
1605 * and return success
1606 */
1607 return CSR_RESULT_SUCCESS;
1608
1609 /* Set length field in from_host_data array to 0 */
1610 /* CardClearFromHostDataSlot(card, slot); */
1611 }
1612
1613 return CSR_RESULT_SUCCESS;
1614} /* process_clear_slot_command() */
1615
1616
1617/*
1618 * ---------------------------------------------------------------------------
1619 * process_bulk_data_command
1620 *
1621 * Process a bulk data request from the UniFi.
1622 *
1623 * Arguments:
1624 * card Pointer to card context struct
1625 * bdcmd Pointer to bulk-data command msg from UniFi
1626 * cmd, len Decoded values of command and length from the msg header
1627 * Cmd will only be one of:
1628 * SDIO_CMD_TO_HOST_TRANSFER
1629 * SDIO_CMD_FROM_HOST_TRANSFER
1630 * SDIO_CMD_FROM_HOST_AND_CLEAR
1631 * SDIO_CMD_OVERLAY_TRANSFER
1632 *
1633 * Returns:
1634 * CSR_RESULT_SUCCESS on success, CSR error code on error
1635 * ---------------------------------------------------------------------------
1636 */
1637static CsrResult process_bulk_data_command(card_t *card, const u8 *cmdptr,
1638 s16 cmd, u16 len)
1639{
1640 bulk_data_desc_t *bdslot;
1641#ifdef CSR_WIFI_ALIGNMENT_WORKAROUND
1642 u8 *host_bulk_data_slot;
1643#endif
1644 bulk_data_cmd_t bdcmd;
1645 s16 offset;
1646 s16 slot;
1647 s16 dir;
1648 CsrResult r;
1649
1650 read_unpack_cmd(cmdptr, &bdcmd);
1651
1652 unifi_trace(card->ospriv, UDBG4, "Processing bulk data cmd %d %s, len=%d, slot=0x%X\n",
1653 cmd, lookup_bulkcmd_name(cmd), len, bdcmd.data_slot);
1654
1655 /*
1656 * Round up the transfer length if required.
1657 * This is useful to force all transfers to be a multiple of the SDIO block
1658 * size, so the SDIO driver won't try to use a byte-mode CMD53. These are
1659 * broken on some hardware platforms.
1660 */
1661 if (card->sdio_io_block_pad)
1662 {
1663 len = (len + card->sdio_io_block_size - 1) & ~(card->sdio_io_block_size - 1);
1664 unifi_trace(card->ospriv, UDBG4, "Rounded bulk data length up to %d\n", len);
1665 }
1666
1667 slot = bdcmd.data_slot & 0x7FFF;
1668
1669 if (cmd == SDIO_CMD_OVERLAY_TRANSFER)
1670 {
1671 return CSR_WIFI_HIP_RESULT_INVALID_VALUE; /* Not used on CSR6xxx */
1672 }
1673 else
1674 {
1675 if (bdcmd.data_slot & SLOT_DIR_TO_HOST)
1676 {
1677 /* Request is for to-host bulk data */
1678
1679 /* Check sanity of slot number */
1680 if (slot >= card->config_data.num_tohost_data_slots)
1681 {
1682 unifi_error(card->ospriv,
1683 "Invalid to-host data slot in SDIO bulk xfr req: %d\n",
1684 slot);
1685 return CSR_RESULT_FAILURE;
1686 }
1687
1688 /* Allocate memory for card->to_host_data[slot] bulk data here. */
1689#ifdef CSR_PRE_ALLOC_NET_DATA
1690 r = prealloc_netdata_get(card, &card->to_host_data[slot], len);
1691#else
1692 r = unifi_net_data_malloc(card->ospriv, &card->to_host_data[slot], len);
1693#endif
1694 if (r != CSR_RESULT_SUCCESS)
1695 {
1696 unifi_error(card->ospriv, "Failed to allocate t-h bulk data\n");
1697 return CSR_RESULT_FAILURE;
1698 }
1699
1700 bdslot = &card->to_host_data[slot];
1701
1702 /* Make sure that the buffer is 4-bytes aligned */
1703 r = unifi_net_dma_align(card->ospriv, bdslot);
1704 if (r != CSR_RESULT_SUCCESS)
1705 {
1706 unifi_error(card->ospriv, "Failed to align t-h bulk data buffer for DMA\n");
1707 return CSR_RESULT_FAILURE;
1708 }
1709 }
1710 else
1711 {
1712 /* Request is for from-host bulk data */
1713
1714 if (slot >= card->config_data.num_fromhost_data_slots)
1715 {
1716 unifi_error(card->ospriv,
1717 "Invalid from-host data slot in SDIO bulk xfr req: %d\n",
1718 slot);
1719 return CSR_RESULT_FAILURE;
1720 }
1721 bdslot = &card->from_host_data[slot].bd;
1722 }
1723 offset = bdcmd.offset;
1724 }
1725 /* Do the transfer */
1726 dir = (cmd == SDIO_CMD_TO_HOST_TRANSFER)?
1727 UNIFI_SDIO_READ : UNIFI_SDIO_WRITE;
1728
1729 unifi_trace(card->ospriv, UDBG4,
1730 "Bulk %c %s len=%d, handle %d - slot=%d %p+(%d)\n",
1731 (dir == UNIFI_SDIO_READ)?'R' : 'W',
1732 lookup_bulkcmd_name(cmd),
1733 len,
1734 bdcmd.buffer_handle,
1735 slot, bdslot->os_data_ptr, offset);
1736#ifdef CSR_WIFI_HIP_NOISY
1737 unifi_error(card->ospriv, "Bulk %s len=%d, handle %d - slot=%d %p+(%d)\n",
1738 lookup_bulkcmd_name(cmd),
1739 len,
1740 bdcmd.buffer_handle,
1741 slot, bdslot->os_data_ptr, offset);
1742#endif /* CSR_WIFI_HIP_NOISY */
1743
1744
1745 if (bdslot->os_data_ptr == NULL)
1746 {
1747 unifi_error(card->ospriv, "Null os_data_ptr - Bulk %s handle %d - slot=%d o=(%d)\n",
1748 lookup_bulkcmd_name(cmd),
1749 bdcmd.buffer_handle,
1750 slot,
1751 offset);
1752 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
1753 }
1754
1755#ifdef CSR_WIFI_ALIGNMENT_WORKAROUND
1756 /* if os_data_ptr is not 4-byte aligned, then allocate a new buffer and copy data
1757 to new buffer to ensure the address passed to unifi_bulk_rw is 4-byte aligned */
1758
1759 if (len != 0 && (dir == UNIFI_SDIO_WRITE) && (((ptrdiff_t)bdslot->os_data_ptr + offset) & 3))
1760 {
1761 host_bulk_data_slot = kmalloc(len, GFP_KERNEL);
1762
1763 if (!host_bulk_data_slot)
1764 {
1765 unifi_error(card->ospriv, " failed to allocate request_data before unifi_bulk_rw\n");
1766 return -1;
1767 }
1768
1769 memcpy((void *)host_bulk_data_slot,
1770 (void *)(bdslot->os_data_ptr + offset), len);
1771
1772 r = unifi_bulk_rw(card,
1773 bdcmd.buffer_handle,
1774 (void *)host_bulk_data_slot,
1775 len,
1776 dir);
1777 }
1778 else
1779#endif
1780 {
1781 r = unifi_bulk_rw(card,
1782 bdcmd.buffer_handle,
1783 (void *)(bdslot->os_data_ptr + offset),
1784 len,
1785 dir);
1786 }
1787
1788 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
1789 {
1790 return r;
1791 }
1792 if (r != CSR_RESULT_SUCCESS)
1793 {
1794 unifi_error(card->ospriv,
1795 "Failed: %s hlen=%d, slen=%d, handle %d - slot=%d %p+0x%X\n",
1796 lookup_bulkcmd_name(cmd),
1797 len, /* Header length */
1798 bdslot->data_length, /* Length stored in slot */
1799 bdcmd.buffer_handle,
1800 slot, bdslot->os_data_ptr, offset);
1801 return r;
1802 }
1803
1804 bdslot->data_length = len;
1805
1806 if (cmd == SDIO_CMD_FROM_HOST_AND_CLEAR)
1807 {
1808 if (slot >= card->config_data.num_fromhost_data_slots)
1809 {
1810 unifi_error(card->ospriv,
1811 "Invalid from-host data slot in SDIO_CMD_FROM_HOST_AND_CLEAR: %d\n",
1812 slot);
1813 return CSR_RESULT_FAILURE;
1814 }
1815
1816#ifdef CSR_WIFI_ALIGNMENT_WORKAROUND
1817 /* moving this check before we clear host data slot */
1818 if ((len != 0) && (dir == UNIFI_SDIO_WRITE) && (((ptrdiff_t)bdslot->os_data_ptr + offset) & 3))
1819 {
1820 kfree(host_bulk_data_slot);
1821 }
1822#endif
1823
1824 if (card->fh_slot_host_tag_record)
1825 {
1826 unifi_trace(card->ospriv, UDBG5, "CopyFromHostAndClearSlot Reset entry for slot=%d\n", slot);
1827
1828 /* reset the host tag entry for the corresponding slot */
1829 card->fh_slot_host_tag_record[slot] = CSR_WIFI_HIP_RESERVED_HOST_TAG;
1830 }
1831
1832
1833 /* Set length field in from_host_data array to 0 */
1834 CardClearFromHostDataSlot(card, slot);
1835 }
1836
1837 return CSR_RESULT_SUCCESS;
1838} /* process_bulk_data_command() */
1839
1840
1841/*
1842 * ---------------------------------------------------------------------------
1843 * check_fh_sig_slots
1844 *
1845 * Check whether there are <n> free signal slots available on UniFi.
1846 * This takes into account the signals already batched since the
1847 * from_host_signal counts were last read.
1848 * If the from_host_signal counts indicate not enough space, we read
1849 * the latest count from UniFi to see if some more have been freed.
1850 *
1851 * Arguments:
1852 * None.
1853 *
1854 * Returns:
1855 * CSR_RESULT_SUCCESS, otherwise CSR error code on error.
1856 * ---------------------------------------------------------------------------
1857 */
1858static CsrResult check_fh_sig_slots(card_t *card, u16 needed, s32 *space_fh)
1859{
1860 u32 count_fhw;
1861 u32 occupied_fh, slots_fh;
1862 s32 count_fhr;
1863
1864 count_fhw = card->from_host_signals_w;
1865 count_fhr = card->from_host_signals_r;
1866 slots_fh = card->config_data.num_fromhost_sig_frags;
1867
1868 /* Only read the space in from-host queue if necessary */
1869 occupied_fh = (count_fhw - count_fhr) % 128;
1870
1871 if (slots_fh < occupied_fh)
1872 {
1873 *space_fh = 0;
1874 }
1875 else
1876 {
1877 *space_fh = slots_fh - occupied_fh;
1878 }
1879
1880 if ((occupied_fh != 0) && (*space_fh < needed))
1881 {
1882 count_fhr = unifi_read_shared_count(card, card->sdio_ctrl_addr + 2);
1883 if (count_fhr < 0)
1884 {
1885 unifi_error(card->ospriv, "Failed to read from-host sig read count\n");
1886 return CSR_RESULT_FAILURE;
1887 }
1888 card->from_host_signals_r = count_fhr; /* diag */
1889
1890 occupied_fh = (count_fhw - count_fhr) % 128;
1891 *space_fh = slots_fh - occupied_fh;
1892 }
1893
1894 return CSR_RESULT_SUCCESS;
1895} /* check_fh_sig_slots() */
1896
1897
1898/*
1899* If we are padding the From-Host signals to the SDIO block size,
1900* we need to round up the needed_chunks to the SDIO block size.
1901*/
1902#define ROUND_UP_NEEDED_CHUNKS(_card, _needed_chunks) \
1903 { \
1904 u16 _chunks_per_block; \
1905 u16 _chunks_in_last_block; \
1906 \
1907 if (_card->sdio_io_block_pad) \
1908 { \
1909 _chunks_per_block = _card->sdio_io_block_size / _card->config_data.sig_frag_size; \
1910 _chunks_in_last_block = _needed_chunks % _chunks_per_block; \
1911 if (_chunks_in_last_block != 0) \
1912 { \
1913 _needed_chunks = _needed_chunks + (_chunks_per_block - _chunks_in_last_block); \
1914 } \
1915 } \
1916 }
1917
1918
1919#define ROUND_UP_SPACE_CHUNKS(_card, _space_chunks) \
1920 { \
1921 u16 _chunks_per_block; \
1922 \
1923 if (_card->sdio_io_block_pad) \
1924 { \
1925 _chunks_per_block = _card->sdio_io_block_size / _card->config_data.sig_frag_size; \
1926 _space_chunks = ((_space_chunks / _chunks_per_block) * _chunks_per_block); \
1927 } \
1928 }
1929
1930
1931
1932
1933
1934/*
1935 * ---------------------------------------------------------------------------
1936 * process_fh_cmd_queue
1937 *
1938 * Take one signal off the from-host queue and copy it to the UniFi.
1939 * Does nothing if the UniFi has no slots free.
1940 *
1941 * Arguments:
1942 * card Pointer to card context struct
1943 * processed Location to write:
1944 * 0 if there is nothing on the queue to process
1945 * 1 if a signal was successfully processed
1946 *
1947 * Returns:
1948 * CSR error code if an error occurred.
1949 *
1950 * Notes:
1951 * The from-host queue contains signal requests from the network driver
1952 * and any UDI clients interspersed. UDI clients' requests have been stored
1953 * in the from-host queue using the wire-format structures, as they arrive.
1954 * All other requests are stored in the from-host queue using the host
1955 * (cpu specific) structures. We use the is_packed member of the card_signal_t
1956 * structure that describes the queue to make the distinction.
1957 * ---------------------------------------------------------------------------
1958 */
1959static CsrResult process_fh_cmd_queue(card_t *card, s32 *processed)
1960{
1961 q_t *sigq = &card->fh_command_queue;
1962
1963 CsrResult r;
1964 u16 pending_sigs;
1965 u16 pending_chunks;
1966 u16 needed_chunks;
1967 s32 space_chunks;
1968 u16 q_index;
1969
1970 *processed = 0;
1971
1972 /* Get the number of pending signals. */
1973 pending_sigs = CSR_WIFI_HIP_Q_SLOTS_USED(sigq);
1974 unifi_trace(card->ospriv, UDBG5, "proc_fh: %d pending\n", pending_sigs);
1975 if (pending_sigs == 0)
1976 {
1977 /* Nothing to do */
1978 return CSR_RESULT_SUCCESS;
1979 }
1980
1981 /* Work out how many chunks we have waiting to send */
1982 for (pending_chunks = 0, q_index = CSR_WIFI_HIP_Q_NEXT_R_SLOT(sigq);
1983 q_index != CSR_WIFI_HIP_Q_NEXT_W_SLOT(sigq);
1984 q_index = CSR_WIFI_HIP_Q_WRAP(sigq, q_index + 1))
1985 {
1986 card_signal_t *csptr = CSR_WIFI_HIP_Q_SLOT_DATA(sigq, q_index);
1987
1988 /*
1989 * Note that GET_CHUNKS_FOR() needs the size of the packed
1990 * (wire-formatted) structure
1991 */
1992 pending_chunks += GET_CHUNKS_FOR(card->config_data.sig_frag_size, (u16)(csptr->signal_length + 2));
1993 }
1994
1995 /*
1996 * Check whether UniFi has space for all the buffered bulk-data
1997 * commands and signals as well.
1998 */
1999 needed_chunks = pending_chunks + card->fh_buffer.count;
2000
2001 /* Round up to the block size if necessary */
2002 ROUND_UP_NEEDED_CHUNKS(card, needed_chunks);
2003
2004 r = check_fh_sig_slots(card, needed_chunks, &space_chunks);
2005 if (r != CSR_RESULT_SUCCESS)
2006 {
2007 /* Error */
2008 unifi_error(card->ospriv, "Failed to read fh sig count\n");
2009 return r;
2010 }
2011
2012#ifdef CSR_WIFI_HIP_NOISY
2013 unifi_error(card->ospriv, "proc_fh: %d chunks free, need %d\n",
2014 space_chunks, needed_chunks);
2015#endif /* CSR_WIFI_HIP_NOISY */
2016
2017
2018 /*
2019 * Coalesce as many from-host signals as possible
2020 * into a single block and write using a single CMD53
2021 */
2022 if (needed_chunks > (u16)space_chunks)
2023 {
2024 /* Round up to the block size if necessary */
2025 ROUND_UP_SPACE_CHUNKS(card, space_chunks);
2026
2027 /*
2028 * If the f/w has less free chunks than those already pending
2029 * return immediately.
2030 */
2031 if ((u16)space_chunks <= card->fh_buffer.count)
2032 {
2033 /*
2034 * No room in UniFi for any signals after the buffered bulk
2035 * data commands have been sent.
2036 */
2037 unifi_error(card->ospriv, "not enough room to send signals, need %d chunks, %d free\n",
2038 card->fh_buffer.count, space_chunks);
2039 card->generate_interrupt = 1;
2040 return CSR_RESULT_SUCCESS;
2041 }
2042 pending_chunks = (u16)(space_chunks - card->fh_buffer.count);
2043 }
2044
2045 while (pending_sigs-- && pending_chunks > 0)
2046 {
2047 card_signal_t *csptr;
2048 s16 i;
2049 u16 sig_chunks, total_length, free_chunks_in_fh_buffer;
2050 bulk_data_param_t bulkdata;
2051 u8 *packed_sigptr;
2052 u16 signal_length = 0;
2053
2054 /* Retrieve the entry at the head of the queue */
2055 q_index = CSR_WIFI_HIP_Q_NEXT_R_SLOT(sigq);
2056
2057 /* Get a pointer to the containing card_signal_t struct */
2058 csptr = CSR_WIFI_HIP_Q_SLOT_DATA(sigq, q_index);
2059
2060 /* Get the new length of the packed signal */
2061 signal_length = csptr->signal_length;
2062
2063 if ((signal_length & 1) || (signal_length > UNIFI_PACKED_SIGBUF_SIZE))
2064 {
2065 unifi_error(card->ospriv, "process_fh_queue: Bad len: %d\n", signal_length);
2066 return CSR_RESULT_FAILURE;
2067 }
2068
2069 /* Need space for 2-byte SDIO protocol header + signal */
2070 sig_chunks = GET_CHUNKS_FOR(card->config_data.sig_frag_size, (u16)(signal_length + 2));
2071
2072 free_chunks_in_fh_buffer = GET_CHUNKS_FOR(card->config_data.sig_frag_size,
2073 (u16)((card->fh_buffer.buf + UNIFI_FH_BUF_SIZE) - card->fh_buffer.ptr));
2074 if (free_chunks_in_fh_buffer < sig_chunks)
2075 {
2076 /* No more room */
2077 unifi_notice(card->ospriv, "proc_fh_cmd_q: no room in fh buffer for 0x%.4X, deferring\n",
2078 (u16)(GET_SIGNAL_ID(csptr->sigbuf)));
2079 break;
2080 }
2081
2082 packed_sigptr = csptr->sigbuf;
2083
2084 /* Claim and set up a from-host data slot */
2085 if (CSR_RESULT_FAILURE == CardWriteBulkData(card, csptr, UNIFI_TRAFFIC_Q_MLME))
2086 {
2087 unifi_notice(card->ospriv, "proc_fh_cmd_q: no fh data slots for 0x%.4X, deferring\n",
2088 (u16)(GET_SIGNAL_ID(csptr->sigbuf)));
2089 break;
2090 }
2091
2092 for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++)
2093 {
2094 if (csptr->bulkdata[i].data_length == 0)
2095 {
2096 UNIFI_INIT_BULK_DATA(&bulkdata.d[i]);
2097 }
2098 else
2099 {
2100 bulkdata.d[i].os_data_ptr = csptr->bulkdata[i].os_data_ptr;
2101 bulkdata.d[i].data_length = csptr->bulkdata[i].data_length;
2102 }
2103
2104 /* Pass the free responsibility to the lower layer. */
2105 UNIFI_INIT_BULK_DATA(&csptr->bulkdata[i]);
2106 }
2107
2108 unifi_trace(card->ospriv, UDBG2, "Sending signal 0x%.4X\n",
2109 GET_SIGNAL_ID(packed_sigptr));
2110#ifdef CSR_WIFI_HIP_NOISY
2111 unifi_error(card->ospriv, "Sending signal 0x%.4X\n",
2112 GET_SIGNAL_ID(packed_sigptr));
2113#endif /* CSR_WIFI_HIP_NOISY */
2114
2115
2116 /* Append packed signal to F-H buffer */
2117 total_length = sig_chunks * card->config_data.sig_frag_size;
2118
2119 card->fh_buffer.ptr[0] = (u8)(signal_length & 0xff);
2120 card->fh_buffer.ptr[1] =
2121 (u8)(((signal_length >> 8) & 0xf) | (SDIO_CMD_SIGNAL << 4));
2122
2123 memcpy(card->fh_buffer.ptr + 2, packed_sigptr, signal_length);
2124 memset(card->fh_buffer.ptr + 2 + signal_length, 0,
2125 total_length - (2 + signal_length));
2126
2127#ifdef CSR_WIFI_HIP_NOISY
2128 unifi_error(card->ospriv, "proc_fh: fh_buffer %d bytes \n",
2129 signal_length + 2);
2130 dump(card->fh_buffer.ptr, signal_length + 2);
2131 unifi_trace(card->ospriv, UDBG1, " \n");
2132#endif /* CSR_WIFI_HIP_NOISY */
2133
2134 card->fh_buffer.ptr += total_length;
2135 card->fh_buffer.count += sig_chunks;
2136
2137#ifdef CSR_WIFI_HIP_NOISY
2138 unifi_error(card->ospriv, "Added %d to fh buf, len now %d, count %d\n",
2139 signal_length,
2140 card->fh_buffer.ptr - card->fh_buffer.buf,
2141 card->fh_buffer.count);
2142#endif /* CSR_WIFI_HIP_NOISY */
2143
2144 (*processed)++;
2145 pending_chunks -= sig_chunks;
2146
2147 /* Log the signal to the UDI. */
2148 /* UDI will get the packed structure */
2149 /* Can not log the unpacked signal, unless we reconstruct it! */
2150 if (card->udi_hook)
2151 {
2152 (*card->udi_hook)(card->ospriv, packed_sigptr, signal_length,
2153 &bulkdata, UDI_LOG_FROM_HOST);
2154 }
2155
2156 /* Remove entry from q */
2157 csptr->signal_length = 0;
2158 CSR_WIFI_HIP_Q_INC_R(sigq);
2159 }
2160
2161 return CSR_RESULT_SUCCESS;
2162} /* process_fh_cmd_queue() */
2163
2164
2165/*
2166 * ---------------------------------------------------------------------------
2167 * process_fh_traffic_queue
2168 *
2169 * Take signals off the from-host queue and copy them to the UniFi.
2170 * Does nothing if the UniFi has no slots free.
2171 *
2172 * Arguments:
2173 * card Pointer to card context struct
2174 * sigq Pointer to the traffic queue
2175 * processed Pointer to location to write:
2176 * 0 if there is nothing on the queue to process
2177 * 1 if a signal was successfully processed
2178 *
2179 * Returns:
2180 * CSR error code if an error occurred.
2181 *
2182 * Notes:
2183 * The from-host queue contains signal requests from the network driver
2184 * and any UDI clients interspersed.
2185 * ---------------------------------------------------------------------------
2186 */
2187static CsrResult process_fh_traffic_queue(card_t *card, s32 *processed)
2188{
2189 q_t *sigq = card->fh_traffic_queue;
2190
2191 CsrResult r;
2192 s16 n = 0;
2193 s32 q_no;
2194 u16 pending_sigs = 0;
2195 u16 pending_chunks = 0;
2196 u16 needed_chunks;
2197 s32 space_chunks;
2198 u16 q_index;
2199 u32 host_tag = 0;
2200 u16 slot_num = 0;
2201
2202 *processed = 0;
2203
2204 /* calculate how many signals are in queues and how many chunks are needed. */
2205 for (n = UNIFI_NO_OF_TX_QS - 1; n >= 0; n--)
2206 {
2207 /* Get the number of pending signals. */
2208 pending_sigs += CSR_WIFI_HIP_Q_SLOTS_USED(&sigq[n]);
2209 unifi_trace(card->ospriv, UDBG5, "proc_fh%d: %d pending\n", n, pending_sigs);
2210
2211 /* Work out how many chunks we have waiting to send */
2212 for (q_index = CSR_WIFI_HIP_Q_NEXT_R_SLOT(&sigq[n]);
2213 q_index != CSR_WIFI_HIP_Q_NEXT_W_SLOT(&sigq[n]);
2214 q_index = CSR_WIFI_HIP_Q_WRAP(&sigq[n], q_index + 1))
2215 {
2216 card_signal_t *csptr = CSR_WIFI_HIP_Q_SLOT_DATA(&sigq[n], q_index);
2217
2218 /*
2219 * Note that GET_CHUNKS_FOR() needs the size of the packed
2220 * (wire-formatted) structure
2221 */
2222 pending_chunks += GET_CHUNKS_FOR(card->config_data.sig_frag_size, (u16)(csptr->signal_length + 2));
2223 }
2224 }
2225
2226 /* If there are no pending signals, just return */
2227 if (pending_sigs == 0)
2228 {
2229 /* Nothing to do */
2230 return CSR_RESULT_SUCCESS;
2231 }
2232
2233 /*
2234 * Check whether UniFi has space for all the buffered bulk-data
2235 * commands and signals as well.
2236 */
2237 needed_chunks = pending_chunks + card->fh_buffer.count;
2238
2239 /* Round up to the block size if necessary */
2240 ROUND_UP_NEEDED_CHUNKS(card, needed_chunks);
2241
2242 r = check_fh_sig_slots(card, needed_chunks, &space_chunks);
2243 if (r != CSR_RESULT_SUCCESS)
2244 {
2245 /* Error */
2246 unifi_error(card->ospriv, "Failed to read fh sig count\n");
2247 return r;
2248 }
2249
2250#ifdef CSR_WIFI_HIP_NOISY
2251 unifi_error(card->ospriv,
2252 "process_fh_traffic_queue: %d chunks free, need %d\n",
2253 space_chunks, needed_chunks);
2254 read_fhsr(card); /* debugging only */
2255#endif /* CSR_WIFI_HIP_NOISY */
2256
2257 /* Coalesce as many from-host signals as possible
2258 into a single block and write using a single CMD53 */
2259 if (needed_chunks > (u16)space_chunks)
2260 {
2261 /* Round up to the block size if necessary */
2262 ROUND_UP_SPACE_CHUNKS(card, space_chunks);
2263
2264 if ((u16)space_chunks <= card->fh_buffer.count)
2265 {
2266 /*
2267 * No room in UniFi for any signals after the buffered bulk
2268 * data commands have been sent.
2269 */
2270 unifi_error(card->ospriv, "not enough room to send signals, need %d chunks, %d free\n",
2271 card->fh_buffer.count, space_chunks);
2272 card->generate_interrupt = 1;
2273 return 0;
2274 }
2275
2276 pending_chunks = (u16)space_chunks - card->fh_buffer.count;
2277 }
2278
2279 q_no = UNIFI_NO_OF_TX_QS - 1;
2280
2281 /*
2282 * pending_sigs will be exhausted if there are is no restriction to the pending
2283 * signals per queue. pending_chunks may be exhausted if there is a restriction.
2284 * q_no check will be exhausted if there is a restriction and our round-robin
2285 * algorith fails to fill all chunks.
2286 */
2287 do
2288 {
2289 card_signal_t *csptr;
2290 u16 sig_chunks, total_length, free_chunks_in_fh_buffer;
2291 bulk_data_param_t bulkdata;
2292 u8 *packed_sigptr;
2293 u16 signal_length = 0;
2294
2295 /* if this queue is empty go to next one. */
2296 if (CSR_WIFI_HIP_Q_SLOTS_USED(&sigq[q_no]) == 0)
2297 {
2298 q_no--;
2299 continue;
2300 }
2301
2302 /* Retrieve the entry at the head of the queue */
2303 q_index = CSR_WIFI_HIP_Q_NEXT_R_SLOT(&sigq[q_no]);
2304
2305 /* Get a pointer to the containing card_signal_t struct */
2306 csptr = CSR_WIFI_HIP_Q_SLOT_DATA(&sigq[q_no], q_index);
2307
2308 /* Get the new length of the packed signal */
2309 signal_length = csptr->signal_length;
2310
2311 if ((signal_length & 1) || (signal_length > UNIFI_PACKED_SIGBUF_SIZE))
2312 {
2313 unifi_error(card->ospriv, "process_fh_traffic_queue: Bad len: %d\n", signal_length);
2314 return CSR_RESULT_FAILURE;
2315 }
2316
2317 /* Need space for 2-byte SDIO protocol header + signal */
2318 sig_chunks = GET_CHUNKS_FOR(card->config_data.sig_frag_size, (u16)(signal_length + 2));
2319 free_chunks_in_fh_buffer = GET_CHUNKS_FOR(card->config_data.sig_frag_size,
2320 (u16)((card->fh_buffer.buf + UNIFI_FH_BUF_SIZE) - card->fh_buffer.ptr));
2321 if (free_chunks_in_fh_buffer < sig_chunks)
2322 {
2323 /* No more room */
2324 unifi_notice(card->ospriv, "process_fh_traffic_queue: no more chunks.\n");
2325 break;
2326 }
2327
2328 packed_sigptr = csptr->sigbuf;
2329 /* Claim and set up a from-host data slot */
2330 if (CSR_RESULT_FAILURE == CardWriteBulkData(card, csptr, (unifi_TrafficQueue)q_no))
2331 {
2332 q_no--;
2333 continue;
2334 }
2335
2336 /* Sanity check: MA-PACKET.req must have a valid bulk data */
2337 if ((csptr->bulkdata[0].data_length == 0) || (csptr->bulkdata[0].os_data_ptr == NULL))
2338 {
2339 unifi_error(card->ospriv, "MA-PACKET.req with empty bulk data (%d bytes in %p)\n",
2340 csptr->bulkdata[0].data_length, csptr->bulkdata[0].os_data_ptr);
2341 dump(packed_sigptr, signal_length);
2342 return CSR_RESULT_FAILURE;
2343 }
2344
2345 bulkdata.d[0].os_data_ptr = csptr->bulkdata[0].os_data_ptr;
2346 bulkdata.d[0].data_length = csptr->bulkdata[0].data_length;
2347 bulkdata.d[0].os_net_buf_ptr = csptr->bulkdata[0].os_net_buf_ptr;
2348 bulkdata.d[0].net_buf_length = csptr->bulkdata[0].net_buf_length;
2349
2350 /* The driver owns clearing of HIP slots for following scenario
2351 * - driver has requested a MA-PACKET.req signal
2352 * - The f/w after receiving the signal decides it can't send it out due to various reasons
2353 * - So the f/w without downloading the bulk data decides to just send a confirmation with fail
2354 * - and then sends a clear slot signal to HIP
2355 *
2356 * But in some cases the clear slot signal never comes and the slot remains --NOT-- freed for ever
2357 *
2358 * To handle this, HIP will keep the record of host tag for each occupied slot
2359 * and then based on status of that Host tag and slot the driver will decide if the slot is
2360 * cleared by f/w signal or the slot has to be freed by driver
2361 */
2362
2363 if (card->fh_slot_host_tag_record)
2364 {
2365 /* Update the f-h slot record for the corresponding host tag */
2366 host_tag = GET_PACKED_MA_PACKET_REQUEST_HOST_TAG(packed_sigptr);
2367 slot_num = GET_PACKED_DATAREF_SLOT(packed_sigptr, 0) & 0x00FF;
2368
2369 unifi_trace(card->ospriv, UDBG5,
2370 "process_fh_traffic_queue signal ID =%x fh slot=%x Host tag =%x\n",
2371 GET_SIGNAL_ID(packed_sigptr), slot_num, host_tag);
2372 card->fh_slot_host_tag_record[slot_num] = host_tag;
2373 }
2374 UNIFI_INIT_BULK_DATA(&bulkdata.d[1]);
2375 UNIFI_INIT_BULK_DATA(&csptr->bulkdata[0]);
2376 UNIFI_INIT_BULK_DATA(&csptr->bulkdata[1]);
2377
2378#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE
2379 if (bulkdata.d[0].os_data_ptr)
2380 {
2381 if ((*bulkdata.d[0].os_data_ptr) & 0x08)
2382 {
2383 card->cmd_prof.tx_count++;
2384 }
2385 }
2386#endif
2387 unifi_trace(card->ospriv, UDBG3, "Sending signal 0x%.4X\n",
2388 GET_SIGNAL_ID(packed_sigptr));
2389#ifdef CSR_WIFI_HIP_NOISY
2390 unifi_error(card->ospriv, "Sending signal 0x%.4X\n",
2391 GET_SIGNAL_ID(packed_sigptr));
2392#endif /* CSR_WIFI_HIP_NOISY */
2393
2394 /* Append packed signal to F-H buffer */
2395 total_length = sig_chunks * card->config_data.sig_frag_size;
2396
2397 card->fh_buffer.ptr[0] = (u8)(signal_length & 0xff);
2398 card->fh_buffer.ptr[1] =
2399 (u8)(((signal_length >> 8) & 0xf) | (SDIO_CMD_SIGNAL << 4));
2400
2401 memcpy(card->fh_buffer.ptr + 2, packed_sigptr, signal_length);
2402 memset(card->fh_buffer.ptr + 2 + signal_length, 0,
2403 total_length - (2 + signal_length));
2404
2405#ifdef CSR_WIFI_HIP_NOISY
2406 unifi_error(card->ospriv, "proc_fh: fh_buffer %d bytes \n",
2407 signal_length + 2);
2408 dump(card->fh_buffer.ptr, signal_length + 2);
2409 unifi_trace(card->ospriv, UDBG1, " \n");
2410#endif /* CSR_WIFI_HIP_NOISY */
2411
2412 card->fh_buffer.ptr += total_length;
2413 card->fh_buffer.count += sig_chunks;
2414
2415#ifdef CSR_WIFI_HIP_NOISY
2416 unifi_error(card->ospriv, "Added %d to fh buf, len now %d, count %d\n",
2417 signal_length,
2418 card->fh_buffer.ptr - card->fh_buffer.buf,
2419 card->fh_buffer.count);
2420#endif /* CSR_WIFI_HIP_NOISY */
2421
2422 (*processed)++;
2423 pending_sigs--;
2424 pending_chunks -= sig_chunks;
2425
2426 /* Log the signal to the UDI. */
2427 /* UDI will get the packed structure */
2428 /* Can not log the unpacked signal, unless we reconstruct it! */
2429 if (card->udi_hook)
2430 {
2431 (*card->udi_hook)(card->ospriv, packed_sigptr, signal_length,
2432 &bulkdata, UDI_LOG_FROM_HOST);
2433 }
2434
2435 /* Remove entry from q */
2436 csptr->signal_length = 0;
2437 /* Note that the traffic queue has only one valid bulk data buffer. */
2438 csptr->bulkdata[0].data_length = 0;
2439
2440 CSR_WIFI_HIP_Q_INC_R(&sigq[q_no]);
2441 } while ((pending_sigs > 0) && (pending_chunks > 0) && (q_no >= 0));
2442
2443 return CSR_RESULT_SUCCESS;
2444} /* process_fh_traffic_queue() */
2445
2446
2447/*
2448 * ---------------------------------------------------------------------------
2449 * flush_fh_buffer
2450 *
2451 * Write out the cache from-hosts signals to the UniFi.
2452 *
2453 * Arguments:
2454 * card Pointer to card context struct
2455 *
2456 * Returns:
2457 * CSR error code if an SDIO error occurred.
2458 * ---------------------------------------------------------------------------
2459 */
2460static CsrResult flush_fh_buffer(card_t *card)
2461{
2462 CsrResult r;
2463 u16 len;
2464 u16 sig_units;
2465 u16 data_round;
2466 u16 chunks_in_last_block;
2467 u16 padding_chunks;
2468 u16 i;
2469
2470 len = card->fh_buffer.ptr - card->fh_buffer.buf;
2471
2472#ifdef CSR_WIFI_HIP_NOISY
2473 unifi_error(card->ospriv, "fh_buffer is at %p, ptr= %p\n",
2474 card->fh_buffer.buf, card->fh_buffer.ptr);
2475#endif /* CSR_WIFI_HIP_NOISY */
2476
2477 if (len == 0)
2478 {
2479 return CSR_RESULT_SUCCESS;
2480 }
2481
2482#ifdef CSR_WIFI_HIP_NOISY
2483 if (dump_fh_buf)
2484 {
2485 dump(card->fh_buffer.buf, len);
2486 dump_fh_buf = 0;
2487 }
2488#endif /* CSR_WIFI_HIP_NOISY */
2489
2490 if (card->sdio_io_block_pad)
2491 {
2492 /* Both of these are powers of 2 */
2493 sig_units = card->config_data.sig_frag_size;
2494 data_round = card->sdio_io_block_size;
2495
2496 if (data_round > sig_units)
2497 {
2498 chunks_in_last_block = (len % data_round) / sig_units;
2499
2500 if (chunks_in_last_block != 0)
2501 {
2502 padding_chunks = (data_round / sig_units) - chunks_in_last_block;
2503
2504 memset(card->fh_buffer.ptr, 0, padding_chunks * sig_units);
2505 for (i = 0; i < padding_chunks; i++)
2506 {
2507 card->fh_buffer.ptr[1] = SDIO_CMD_PADDING << 4;
2508 card->fh_buffer.ptr += sig_units;
2509 }
2510
2511 card->fh_buffer.count += padding_chunks;
2512 len += padding_chunks * sig_units;
2513 }
2514 }
2515 }
2516
2517 r = unifi_bulk_rw(card,
2518 card->config_data.fromhost_sigbuf_handle,
2519 card->fh_buffer.buf,
2520 len, UNIFI_SDIO_WRITE);
2521 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
2522 {
2523 return r;
2524 }
2525 if (r != CSR_RESULT_SUCCESS)
2526 {
2527 unifi_error(card->ospriv, "Failed to write fh signals: %u bytes, error %d\n", len, r);
2528 return r;
2529 }
2530
2531 /* Update from-host-signals-written signal count */
2532 card->from_host_signals_w =
2533 (card->from_host_signals_w + card->fh_buffer.count) % 128u;
2534 r = unifi_write_8_or_16(card, card->sdio_ctrl_addr + 0,
2535 (u8)card->from_host_signals_w);
2536 if (r != CSR_RESULT_SUCCESS)
2537 {
2538 unifi_error(card->ospriv, "Failed to write fh signal count %u with error %d\n",
2539 card->from_host_signals_w, r);
2540 return r;
2541 }
2542 card->generate_interrupt = 1;
2543
2544 /* Reset the fh buffer pointer */
2545 card->fh_buffer.ptr = card->fh_buffer.buf;
2546 card->fh_buffer.count = 0;
2547
2548#ifdef CSR_WIFI_HIP_NOISY
2549 unifi_error(card->ospriv, "END flush: fh len %d, count %d\n",
2550 card->fh_buffer.ptr - card->fh_buffer.buf,
2551 card->fh_buffer.count);
2552#endif /* CSR_WIFI_HIP_NOISY */
2553
2554 return CSR_RESULT_SUCCESS;
2555} /* flush_fh_buffer() */
2556
2557
2558/*
2559 * ---------------------------------------------------------------------------
2560 * restart_packet_flow
2561 *
2562 * This function is called before the bottom-half thread sleeps.
2563 * It checks whether both data and signal resources are available and
2564 * then calls the OS-layer function to re-enable packet transmission.
2565 *
2566 * Arguments:
2567 * card Pointer to card context struct
2568 *
2569 * Returns:
2570 * None.
2571 * ---------------------------------------------------------------------------
2572 */
2573static void restart_packet_flow(card_t *card)
2574{
2575 u8 q;
2576
2577 /*
2578 * We only look at the fh_traffic_queue, because that is where packets from
2579 * the network stack are placed.
2580 */
2581 for (q = 0; q <= UNIFI_TRAFFIC_Q_VO; q++)
2582 {
2583 if (card_is_tx_q_paused(card, q) &&
2584 CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_traffic_queue[q]) >= RESUME_XMIT_THRESHOLD)
2585 {
2586#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
2587 unifi_debug_log_to_buf("U");
2588#endif
2589 card_tx_q_unpause(card, q);
2590 unifi_restart_xmit(card->ospriv, (unifi_TrafficQueue)q);
2591 }
2592 }
2593} /* restart_packet_flow() */
2594
2595
diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c
deleted file mode 100644
index 17867f60df16..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c
+++ /dev/null
@@ -1,1713 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/*
12 * ---------------------------------------------------------------------------
13 * FILE: csr_wifi_hip_card_sdio_mem.c
14 *
15 * PURPOSE: Implementation of the Card API for SDIO.
16 *
17 * ---------------------------------------------------------------------------
18 */
19#include "csr_wifi_hip_unifi.h"
20#include "csr_wifi_hip_card.h"
21
22#define SDIO_RETRIES 3
23#define CSR_WIFI_HIP_SDIO_TRACE_DATA_LENGTH 16
24
25
26#define retryable_sdio_error(_csrResult) (((_csrResult) == CSR_SDIO_RESULT_CRC_ERROR) || ((_csrResult) == CSR_SDIO_RESULT_TIMEOUT))
27
28
29/*
30 * ---------------------------------------------------------------------------
31 * retrying_read8
32 * retrying_write8
33 *
34 * These functions provide the first level of retry for SDIO operations.
35 * If an SDIO command fails for reason of a response timeout or CRC
36 * error, it is retried immediately. If three attempts fail we report a
37 * failure.
38 * If the command failed for any other reason, the failure is reported
39 * immediately.
40 *
41 * Arguments:
42 * card Pointer to card structure.
43 * funcnum The SDIO function to access.
44 * Function 0 is the Card Configuration Register space,
45 * function 1/2 is the UniFi register space.
46 * addr Address to access
47 * pdata Pointer in which to return the value read.
48 * data Value to write.
49 *
50 * Returns:
51 * CSR_RESULT_SUCCESS on success, non-zero error code on error:
52 * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected
53 * CSR_RESULT_FAILURE an SDIO error occurred
54 * ---------------------------------------------------------------------------
55 */
56static CsrResult retrying_read8(card_t *card, s16 funcnum, u32 addr, u8 *pdata)
57{
58 CsrSdioFunction *sdio = card->sdio_if;
59 CsrResult r = CSR_RESULT_SUCCESS;
60 s16 retries;
61 CsrResult csrResult = CSR_RESULT_SUCCESS;
62
63 retries = 0;
64 while (retries++ < SDIO_RETRIES)
65 {
66 if (funcnum == 0)
67 {
68#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE)
69 unifi_debug_log_to_buf("r0@%02X", addr);
70#endif
71 csrResult = CsrSdioF0Read8(sdio, addr, pdata);
72 }
73 else
74 {
75#ifdef CSR_WIFI_TRANSPORT_CSPI
76 unifi_error(card->ospriv,
77 "retrying_read_f0_8: F1 8-bit reads are not allowed.\n");
78 return CSR_RESULT_FAILURE;
79#else
80#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE)
81 unifi_debug_log_to_buf("r@%02X", addr);
82#endif
83 csrResult = CsrSdioRead8(sdio, addr, pdata);
84#endif
85 }
86#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE)
87 if (csrResult != CSR_RESULT_SUCCESS)
88 {
89 unifi_debug_log_to_buf("error=%X\n", csrResult);
90 }
91 else
92 {
93 unifi_debug_log_to_buf("=%X\n", *pdata);
94 }
95#endif
96 if (csrResult == CSR_SDIO_RESULT_NO_DEVICE)
97 {
98 return CSR_WIFI_HIP_RESULT_NO_DEVICE;
99 }
100 /*
101 * Try again for retryable (CRC or TIMEOUT) errors,
102 * break on success or fatal error
103 */
104 if (!retryable_sdio_error(csrResult))
105 {
106#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE
107 card->cmd_prof.cmd52_count++;
108#endif
109 break;
110 }
111 unifi_trace(card->ospriv, UDBG2, "retryable SDIO error reading F%d 0x%lX\n", funcnum, addr);
112 }
113
114 if ((csrResult == CSR_RESULT_SUCCESS) && (retries > 1))
115 {
116 unifi_warning(card->ospriv, "Read succeeded after %d attempts\n", retries);
117 }
118
119 if (csrResult != CSR_RESULT_SUCCESS)
120 {
121 unifi_error(card->ospriv, "Failed to read from UniFi (addr 0x%lX) after %d tries\n",
122 addr, retries - 1);
123 /* Report any SDIO error as a general i/o error */
124 r = CSR_RESULT_FAILURE;
125 }
126
127 return r;
128} /* retrying_read8() */
129
130
131static CsrResult retrying_write8(card_t *card, s16 funcnum, u32 addr, u8 data)
132{
133 CsrSdioFunction *sdio = card->sdio_if;
134 CsrResult r = CSR_RESULT_SUCCESS;
135 s16 retries;
136 CsrResult csrResult = CSR_RESULT_SUCCESS;
137
138 retries = 0;
139 while (retries++ < SDIO_RETRIES)
140 {
141 if (funcnum == 0)
142 {
143#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE)
144 unifi_debug_log_to_buf("w0@%02X=%X", addr, data);
145#endif
146 csrResult = CsrSdioF0Write8(sdio, addr, data);
147 }
148 else
149 {
150#ifdef CSR_WIFI_TRANSPORT_CSPI
151 unifi_error(card->ospriv,
152 "retrying_write_f0_8: F1 8-bit writes are not allowed.\n");
153 return CSR_RESULT_FAILURE;
154#else
155#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE)
156 unifi_debug_log_to_buf("w@%02X=%X", addr, data);
157#endif
158 csrResult = CsrSdioWrite8(sdio, addr, data);
159#endif
160 }
161#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE)
162 if (csrResult != CSR_RESULT_SUCCESS)
163 {
164 unifi_debug_log_to_buf(",error=%X", csrResult);
165 }
166 unifi_debug_string_to_buf("\n");
167#endif
168 if (csrResult == CSR_SDIO_RESULT_NO_DEVICE)
169 {
170 return CSR_WIFI_HIP_RESULT_NO_DEVICE;
171 }
172 /*
173 * Try again for retryable (CRC or TIMEOUT) errors,
174 * break on success or fatal error
175 */
176 if (!retryable_sdio_error(csrResult))
177 {
178#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE
179 card->cmd_prof.cmd52_count++;
180#endif
181 break;
182 }
183 unifi_trace(card->ospriv, UDBG2, "retryable SDIO error writing %02X to F%d 0x%lX\n",
184 data, funcnum, addr);
185 }
186
187 if ((csrResult == CSR_RESULT_SUCCESS) && (retries > 1))
188 {
189 unifi_warning(card->ospriv, "Write succeeded after %d attempts\n", retries);
190 }
191
192 if (csrResult != CSR_RESULT_SUCCESS)
193 {
194 unifi_error(card->ospriv, "Failed to write to UniFi (addr 0x%lX) after %d tries\n",
195 addr, retries - 1);
196 /* Report any SDIO error as a general i/o error */
197 r = CSR_RESULT_FAILURE;
198 }
199
200 return r;
201} /* retrying_write8() */
202
203
204static CsrResult retrying_read16(card_t *card, s16 funcnum,
205 u32 addr, u16 *pdata)
206{
207 CsrSdioFunction *sdio = card->sdio_if;
208 CsrResult r = CSR_RESULT_SUCCESS;
209 s16 retries;
210 CsrResult csrResult = CSR_RESULT_SUCCESS;
211
212 retries = 0;
213 while (retries++ < SDIO_RETRIES)
214 {
215#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE)
216 unifi_debug_log_to_buf("r@%02X", addr);
217#endif
218 csrResult = CsrSdioRead16(sdio, addr, pdata);
219#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE)
220 if (csrResult != CSR_RESULT_SUCCESS)
221 {
222 unifi_debug_log_to_buf("error=%X\n", csrResult);
223 }
224 else
225 {
226 unifi_debug_log_to_buf("=%X\n", *pdata);
227 }
228#endif
229 if (csrResult == CSR_SDIO_RESULT_NO_DEVICE)
230 {
231 return CSR_WIFI_HIP_RESULT_NO_DEVICE;
232 }
233
234 /*
235 * Try again for retryable (CRC or TIMEOUT) errors,
236 * break on success or fatal error
237 */
238 if (!retryable_sdio_error(csrResult))
239 {
240#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE
241 card->cmd_prof.cmd52_count++;
242#endif
243 break;
244 }
245 unifi_trace(card->ospriv, UDBG2, "retryable SDIO error reading F%d 0x%lX\n", funcnum, addr);
246 }
247
248 if ((csrResult == CSR_RESULT_SUCCESS) && (retries > 1))
249 {
250 unifi_warning(card->ospriv, "Read succeeded after %d attempts\n", retries);
251 }
252
253 if (csrResult != CSR_RESULT_SUCCESS)
254 {
255 unifi_error(card->ospriv, "Failed to read from UniFi (addr 0x%lX) after %d tries\n",
256 addr, retries - 1);
257 /* Report any SDIO error as a general i/o error */
258 r = CSR_RESULT_FAILURE;
259 }
260
261 return r;
262} /* retrying_read16() */
263
264
265static CsrResult retrying_write16(card_t *card, s16 funcnum,
266 u32 addr, u16 data)
267{
268 CsrSdioFunction *sdio = card->sdio_if;
269 CsrResult r = CSR_RESULT_SUCCESS;
270 s16 retries;
271 CsrResult csrResult = CSR_RESULT_SUCCESS;
272
273 retries = 0;
274 while (retries++ < SDIO_RETRIES)
275 {
276#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE)
277 unifi_debug_log_to_buf("w@%02X=%X", addr, data);
278#endif
279 csrResult = CsrSdioWrite16(sdio, addr, data);
280#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE)
281 if (csrResult != CSR_RESULT_SUCCESS)
282 {
283 unifi_debug_log_to_buf(",error=%X", csrResult);
284 }
285 unifi_debug_string_to_buf("\n");
286#endif
287 if (csrResult == CSR_SDIO_RESULT_NO_DEVICE)
288 {
289 return CSR_WIFI_HIP_RESULT_NO_DEVICE;
290 }
291
292 /*
293 * Try again for retryable (CRC or TIMEOUT) errors,
294 * break on success or fatal error
295 */
296 if (!retryable_sdio_error(csrResult))
297 {
298#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE
299 card->cmd_prof.cmd52_count++;
300#endif
301 break;
302 }
303 unifi_trace(card->ospriv, UDBG2, "retryable SDIO error writing %02X to F%d 0x%lX\n",
304 data, funcnum, addr);
305 }
306
307 if ((csrResult == CSR_RESULT_SUCCESS) && (retries > 1))
308 {
309 unifi_warning(card->ospriv, "Write succeeded after %d attempts\n", retries);
310 }
311
312 if (csrResult != CSR_RESULT_SUCCESS)
313 {
314 unifi_error(card->ospriv, "Failed to write to UniFi (addr 0x%lX) after %d tries\n",
315 addr, retries - 1);
316 /* Report any SDIO error as a general i/o error */
317 r = CSR_RESULT_FAILURE;
318 }
319
320 return r;
321} /* retrying_write16() */
322
323
324/*
325 * ---------------------------------------------------------------------------
326 * sdio_read_f0
327 *
328 * Reads a byte value from the CCCR (func 0) area of UniFi.
329 *
330 * Arguments:
331 * card Pointer to card structure.
332 * addr Address to read from
333 * pdata Pointer in which to store the read value.
334 *
335 * Returns:
336 * CSR_RESULT_SUCCESS on success, non-zero error code on error:
337 * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected
338 * CSR_RESULT_FAILURE an SDIO error occurred
339 * ---------------------------------------------------------------------------
340 */
341CsrResult sdio_read_f0(card_t *card, u32 addr, u8 *pdata)
342{
343#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
344 card->cmd_prof.cmd52_f0_r_count++;
345#endif
346 return retrying_read8(card, 0, addr, pdata);
347} /* sdio_read_f0() */
348
349
350/*
351 * ---------------------------------------------------------------------------
352 * sdio_write_f0
353 *
354 * Writes a byte value to the CCCR (func 0) area of UniFi.
355 *
356 * Arguments:
357 * card Pointer to card structure.
358 * addr Address to read from
359 * data Data value to write.
360 *
361 * Returns:
362 * CSR_RESULT_SUCCESS on success, non-zero error code on error:
363 * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected
364 * CSR_RESULT_FAILURE an SDIO error occurred
365 * ---------------------------------------------------------------------------
366 */
367CsrResult sdio_write_f0(card_t *card, u32 addr, u8 data)
368{
369#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
370 card->cmd_prof.cmd52_f0_w_count++;
371#endif
372 return retrying_write8(card, 0, addr, data);
373} /* sdio_write_f0() */
374
375
376/*
377 * ---------------------------------------------------------------------------
378 * unifi_read_direct_8_or_16
379 *
380 * Read a 8-bit value from the UniFi SDIO interface.
381 *
382 * Arguments:
383 * card Pointer to card structure.
384 * addr Address to read from
385 * pdata Pointer in which to return data.
386 *
387 * Returns:
388 * CSR_RESULT_SUCCESS on success, non-zero error code on error:
389 * ---------------------------------------------------------------------------
390 */
391CsrResult unifi_read_direct_8_or_16(card_t *card, u32 addr, u8 *pdata)
392{
393#ifdef CSR_WIFI_TRANSPORT_CSPI
394 u16 w;
395 CsrResult r;
396
397 r = retrying_read16(card, card->function, addr, &w);
398 *pdata = (u8)(w & 0xFF);
399 return r;
400#else
401 return retrying_read8(card, card->function, addr, pdata);
402#endif
403} /* unifi_read_direct_8_or_16() */
404
405
406/*
407 * ---------------------------------------------------------------------------
408 * unifi_write_direct_8_or_16
409 *
410 * Write a byte value to the UniFi SDIO interface.
411 *
412 * Arguments:
413 * card Pointer to card structure.
414 * addr Address to write to
415 * data Value to write.
416 *
417 * Returns:
418 * CSR_RESULT_SUCCESS on success, non-zero error code on error
419 *
420 * Notes:
421 * If 8-bit write is used, the even address *must* be written second.
422 * This is because writes to odd bytes are cached and not committed
423 * to memory until the preceding even address is written.
424 * ---------------------------------------------------------------------------
425 */
426CsrResult unifi_write_direct_8_or_16(card_t *card, u32 addr, u8 data)
427{
428 if (addr & 1)
429 {
430 unifi_warning(card->ospriv,
431 "Warning: Byte write to an odd address (0x%lX) is dangerous\n",
432 addr);
433 }
434
435#ifdef CSR_WIFI_TRANSPORT_CSPI
436 return retrying_write16(card, card->function, addr, (u16)data);
437#else
438 return retrying_write8(card, card->function, addr, data);
439#endif
440} /* unifi_write_direct_8_or_16() */
441
442
443/*
444 * ---------------------------------------------------------------------------
445 * unifi_read_direct16
446 *
447 * Read a 16-bit value from the UniFi SDIO interface.
448 *
449 * Arguments:
450 * card Pointer to card structure.
451 * addr Address to read from
452 * pdata Pointer in which to return data.
453 *
454 * Returns:
455 * CSR_RESULT_SUCCESS on success, non-zero error code on error:
456 * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected
457 * CSR_RESULT_FAILURE an SDIO error occurred
458 *
459 * Notes:
460 * The even address *must* be read first. This is because reads from
461 * odd bytes are cached and read from memory when the preceding
462 * even address is read.
463 * ---------------------------------------------------------------------------
464 */
465CsrResult unifi_read_direct16(card_t *card, u32 addr, u16 *pdata)
466{
467 return retrying_read16(card, card->function, addr, pdata);
468} /* unifi_read_direct16() */
469
470
471/*
472 * ---------------------------------------------------------------------------
473 * unifi_write_direct16
474 *
475 * Write a 16-bit value to the UniFi SDIO interface.
476 *
477 * Arguments:
478 * card Pointer to card structure.
479 * addr Address to write to
480 * data Value to write.
481 *
482 * Returns:
483 * CSR_RESULT_SUCCESS on success, non-zero error code on error:
484 * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected
485 * CSR_RESULT_FAILURE an SDIO error occurred
486 *
487 * Notes:
488 * The even address *must* be written second. This is because writes to
489 * odd bytes are cached and not committed to memory until the preceding
490 * even address is written.
491 * ---------------------------------------------------------------------------
492 */
493CsrResult unifi_write_direct16(card_t *card, u32 addr, u16 data)
494{
495 return retrying_write16(card, card->function, addr, data);
496} /* unifi_write_direct16() */
497
498
499/*
500 * ---------------------------------------------------------------------------
501 * unifi_read_direct32
502 *
503 * Read a 32-bit value from the UniFi SDIO interface.
504 *
505 * Arguments:
506 * card Pointer to card structure.
507 * addr Address to read from
508 * pdata Pointer in which to return data.
509 *
510 * Returns:
511 * CSR_RESULT_SUCCESS on success, non-zero error code on error:
512 * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected
513 * CSR_RESULT_FAILURE an SDIO error occurred
514 * ---------------------------------------------------------------------------
515 */
516CsrResult unifi_read_direct32(card_t *card, u32 addr, u32 *pdata)
517{
518 CsrResult r;
519 u16 w0, w1;
520
521 r = retrying_read16(card, card->function, addr, &w0);
522 if (r != CSR_RESULT_SUCCESS)
523 {
524 return r;
525 }
526
527 r = retrying_read16(card, card->function, addr + 2, &w1);
528 if (r != CSR_RESULT_SUCCESS)
529 {
530 return r;
531 }
532
533 *pdata = ((u32)w1 << 16) | (u32)w0;
534
535 return CSR_RESULT_SUCCESS;
536} /* unifi_read_direct32() */
537
538
539/*
540 * ---------------------------------------------------------------------------
541 * unifi_read_directn_match
542 *
543 * Read multiple 8-bit values from the UniFi SDIO interface,
544 * stopping when either we have read 'len' bytes or we have read
545 * a octet equal to 'match'. If 'match' is not a valid octet
546 * then this function is the same as 'unifi_read_directn'.
547 *
548 * Arguments:
549 * card Pointer to card structure.
550 * addr Start address to read from.
551 * pdata Pointer to which to write data.
552 * len Maximum umber of bytes to read
553 * match The value to stop reading at.
554 * num Pointer to buffer to write number of bytes read
555 *
556 * Returns:
557 * number of octets read on success, negative error code on error:
558 * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected
559 * CSR_RESULT_FAILURE an SDIO error occurred
560 *
561 * Notes:
562 * The even address *must* be read first. This is because reads from
563 * odd bytes are cached and read from memory when the preceding
564 * even address is read.
565 * ---------------------------------------------------------------------------
566 */
567static CsrResult unifi_read_directn_match(card_t *card, u32 addr, void *pdata, u16 len, s8 m, u32 *num)
568{
569 CsrResult r;
570 u32 i;
571 u8 *cptr;
572 u16 w;
573
574 *num = 0;
575
576 cptr = (u8 *)pdata;
577 for (i = 0; i < len; i += 2)
578 {
579 r = retrying_read16(card, card->function, addr, &w);
580 if (r != CSR_RESULT_SUCCESS)
581 {
582 return r;
583 }
584
585 *cptr++ = ((u8)w & 0xFF);
586 if ((m >= 0) && (((s8)w & 0xFF) == m))
587 {
588 break;
589 }
590
591 if (i + 1 == len)
592 {
593 /* The len is odd. Ignore the last high byte */
594 break;
595 }
596
597 *cptr++ = ((u8)(w >> 8) & 0xFF);
598 if ((m >= 0) && (((s8)(w >> 8) & 0xFF) == m))
599 {
600 break;
601 }
602
603 addr += 2;
604 }
605
606 *num = (s32)(cptr - (u8 *)pdata);
607 return CSR_RESULT_SUCCESS;
608}
609
610
611/*
612 * ---------------------------------------------------------------------------
613 * unifi_read_directn
614 *
615 * Read multiple 8-bit values from the UniFi SDIO interface.
616 *
617 * Arguments:
618 * card Pointer to card structure.
619 * addr Start address to read from.
620 * pdata Pointer to which to write data.
621 * len Number of bytes to read
622 *
623 * Returns:
624 * 0 on success, non-zero error code on error:
625 * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected
626 * CSR_RESULT_FAILURE an SDIO error occurred
627 *
628 * Notes:
629 * The even address *must* be read first. This is because reads from
630 * odd bytes are cached and read from memory when the preceding
631 * even address is read.
632 * ---------------------------------------------------------------------------
633 */
634CsrResult unifi_read_directn(card_t *card, u32 addr, void *pdata, u16 len)
635{
636 u32 num;
637
638 return unifi_read_directn_match(card, addr, pdata, len, -1, &num);
639} /* unifi_read_directn() */
640
641
642/*
643 * ---------------------------------------------------------------------------
644 * unifi_write_directn
645 *
646 * Write multiple 8-bit values to the UniFi SDIO interface.
647 *
648 * Arguments:
649 * card Pointer to card structure.
650 * addr Start address to write to.
651 * pdata Source data pointer.
652 * len Number of bytes to write, must be even.
653 *
654 * Returns:
655 * 0 on success, non-zero error code on error:
656 * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected
657 * CSR_RESULT_FAILURE an SDIO error occurred
658 *
659 * Notes:
660 * The UniFi has a peculiar 16-bit bus architecture. Writes are only
661 * committed to memory when an even address is accessed. Writes to
662 * odd addresses are cached and only committed if the next write is
663 * to the preceding address.
664 * This means we must write data as pairs of bytes in reverse order.
665 * ---------------------------------------------------------------------------
666 */
667CsrResult unifi_write_directn(card_t *card, u32 addr, void *pdata, u16 len)
668{
669 CsrResult r;
670 u8 *cptr;
671 s16 signed_len;
672
673 cptr = (u8 *)pdata;
674 signed_len = (s16)len;
675 while (signed_len > 0)
676 {
677 /* This is UniFi-1 specific code. CSPI not supported so 8-bit write allowed */
678 r = retrying_write16(card, card->function, addr, *cptr);
679 if (r != CSR_RESULT_SUCCESS)
680 {
681 return r;
682 }
683
684 cptr += 2;
685 addr += 2;
686 signed_len -= 2;
687 }
688
689 return CSR_RESULT_SUCCESS;
690} /* unifi_write_directn() */
691
692
693/*
694 * ---------------------------------------------------------------------------
695 * set_dmem_page
696 * set_pmem_page
697 *
698 * Set up the page register for the shared data memory window or program
699 * memory window.
700 *
701 * Arguments:
702 * card Pointer to card structure.
703 * dmem_addr UniFi shared-data-memory address to access.
704 * pmem_addr UniFi program memory address to access. This includes
705 * External FLASH memory at 0x000000
706 * Processor program memory at 0x200000
707 * External SRAM at memory 0x400000
708 * paddr Location to write an SDIO address (24-bit) for
709 * use in a unifi_read_direct or unifi_write_direct call.
710 *
711 * Returns:
712 * CSR_RESULT_SUCCESS on success
713 * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected
714 * CSR_RESULT_FAILURE an SDIO error occurred
715 * ---------------------------------------------------------------------------
716 */
717static CsrResult set_dmem_page(card_t *card, u32 dmem_addr, u32 *paddr)
718{
719 u16 page, addr;
720 u32 len;
721 CsrResult r;
722
723 *paddr = 0;
724
725 if (!ChipHelper_DecodeWindow(card->helper,
726 CHIP_HELPER_WINDOW_3,
727 CHIP_HELPER_WT_SHARED,
728 dmem_addr / 2,
729 &page, &addr, &len))
730 {
731 unifi_error(card->ospriv, "Failed to decode SHARED_DMEM_PAGE %08lx\n", dmem_addr);
732 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
733 }
734
735 if (page != card->dmem_page)
736 {
737 unifi_trace(card->ospriv, UDBG6, "setting dmem page=0x%X, addr=0x%lX\n", page, addr);
738
739 /* change page register */
740 r = unifi_write_direct16(card, ChipHelper_HOST_WINDOW3_PAGE(card->helper) * 2, page);
741 if (r != CSR_RESULT_SUCCESS)
742 {
743 unifi_error(card->ospriv, "Failed to write SHARED_DMEM_PAGE\n");
744 return r;
745 }
746
747 card->dmem_page = page;
748 }
749
750 *paddr = ((s32)addr * 2) + (dmem_addr & 1);
751
752 return CSR_RESULT_SUCCESS;
753} /* set_dmem_page() */
754
755
756static CsrResult set_pmem_page(card_t *card, u32 pmem_addr,
757 enum chip_helper_window_type mem_type, u32 *paddr)
758{
759 u16 page, addr;
760 u32 len;
761 CsrResult r;
762
763 *paddr = 0;
764
765 if (!ChipHelper_DecodeWindow(card->helper,
766 CHIP_HELPER_WINDOW_2,
767 mem_type,
768 pmem_addr / 2,
769 &page, &addr, &len))
770 {
771 unifi_error(card->ospriv, "Failed to decode PROG MEM PAGE %08lx %d\n", pmem_addr, mem_type);
772 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
773 }
774
775 if (page != card->pmem_page)
776 {
777 unifi_trace(card->ospriv, UDBG6, "setting pmem page=0x%X, addr=0x%lX\n", page, addr);
778
779 /* change page register */
780 r = unifi_write_direct16(card, ChipHelper_HOST_WINDOW2_PAGE(card->helper) * 2, page);
781 if (r != CSR_RESULT_SUCCESS)
782 {
783 unifi_error(card->ospriv, "Failed to write PROG MEM PAGE\n");
784 return r;
785 }
786
787 card->pmem_page = page;
788 }
789
790 *paddr = ((s32)addr * 2) + (pmem_addr & 1);
791
792 return CSR_RESULT_SUCCESS;
793} /* set_pmem_page() */
794
795
796/*
797 * ---------------------------------------------------------------------------
798 * set_page
799 *
800 * Sets up the appropriate page register to access the given address.
801 * Returns the sdio address at which the unifi address can be accessed.
802 *
803 * Arguments:
804 * card Pointer to card structure.
805 * generic_addr UniFi internal address to access, in Generic Pointer
806 * format, i.e. top byte is space indicator.
807 * paddr Location to write page address
808 * SDIO address (24-bit) for use in a unifi_read_direct or
809 * unifi_write_direct call
810 *
811 * Returns:
812 * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected
813 * CSR_RESULT_FAILURE an SDIO error occurred
814 * CSR_WIFI_HIP_RESULT_INVALID_VALUE the address is invalid
815 * ---------------------------------------------------------------------------
816 */
817static CsrResult set_page(card_t *card, u32 generic_addr, u32 *paddr)
818{
819 s32 space;
820 u32 addr;
821 CsrResult r = CSR_RESULT_SUCCESS;
822
823 if (!paddr)
824 {
825 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
826 }
827 *paddr = 0;
828 space = UNIFI_GP_SPACE(generic_addr);
829 addr = UNIFI_GP_OFFSET(generic_addr);
830 switch (space)
831 {
832 case UNIFI_SH_DMEM:
833 /* Shared Data Memory is accessed via the Shared Data Memory window */
834 r = set_dmem_page(card, addr, paddr);
835 if (r != CSR_RESULT_SUCCESS)
836 {
837 return r;
838 }
839 break;
840
841 case UNIFI_EXT_FLASH:
842 if (!ChipHelper_HasFlash(card->helper))
843 {
844 unifi_error(card->ospriv, "Bad address space for chip in generic pointer 0x%08lX (helper=0x%x)\n",
845 generic_addr, card->helper);
846 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
847 }
848 /* External FLASH is accessed via the Program Memory window */
849 r = set_pmem_page(card, addr, CHIP_HELPER_WT_FLASH, paddr);
850 break;
851
852 case UNIFI_EXT_SRAM:
853 if (!ChipHelper_HasExtSram(card->helper))
854 {
855 unifi_error(card->ospriv, "Bad address space for chip in generic pointer 0x%08l (helper=0x%x)\n",
856 generic_addr, card->helper);
857 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
858 }
859 /* External SRAM is accessed via the Program Memory window */
860 r = set_pmem_page(card, addr, CHIP_HELPER_WT_EXT_SRAM, paddr);
861 break;
862
863 case UNIFI_REGISTERS:
864 /* Registers are accessed directly */
865 *paddr = addr;
866 break;
867
868 case UNIFI_PHY_DMEM:
869 r = unifi_set_proc_select(card, UNIFI_PROC_PHY);
870 if (r != CSR_RESULT_SUCCESS)
871 {
872 return r;
873 }
874 *paddr = ChipHelper_DATA_MEMORY_RAM_OFFSET(card->helper) * 2 + addr;
875 break;
876
877 case UNIFI_MAC_DMEM:
878 r = unifi_set_proc_select(card, UNIFI_PROC_MAC);
879 if (r != CSR_RESULT_SUCCESS)
880 {
881 return r;
882 }
883 *paddr = ChipHelper_DATA_MEMORY_RAM_OFFSET(card->helper) * 2 + addr;
884 break;
885
886 case UNIFI_BT_DMEM:
887 if (!ChipHelper_HasBt(card->helper))
888 {
889 unifi_error(card->ospriv, "Bad address space for chip in generic pointer 0x%08lX (helper=0x%x)\n",
890 generic_addr, card->helper);
891 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
892 }
893 r = unifi_set_proc_select(card, UNIFI_PROC_BT);
894 if (r != CSR_RESULT_SUCCESS)
895 {
896 return r;
897 }
898 *paddr = ChipHelper_DATA_MEMORY_RAM_OFFSET(card->helper) * 2 + addr;
899 break;
900
901 case UNIFI_PHY_PMEM:
902 r = unifi_set_proc_select(card, UNIFI_PROC_PHY);
903 if (r != CSR_RESULT_SUCCESS)
904 {
905 return r;
906 }
907 r = set_pmem_page(card, addr, CHIP_HELPER_WT_CODE_RAM, paddr);
908 break;
909
910 case UNIFI_MAC_PMEM:
911 r = unifi_set_proc_select(card, UNIFI_PROC_MAC);
912 if (r != CSR_RESULT_SUCCESS)
913 {
914 return r;
915 }
916 r = set_pmem_page(card, addr, CHIP_HELPER_WT_CODE_RAM, paddr);
917 break;
918
919 case UNIFI_BT_PMEM:
920 if (!ChipHelper_HasBt(card->helper))
921 {
922 unifi_error(card->ospriv, "Bad address space for chip in generic pointer 0x%08lX (helper=0x%x)\n",
923 generic_addr, card->helper);
924 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
925 }
926 r = unifi_set_proc_select(card, UNIFI_PROC_BT);
927 if (r != CSR_RESULT_SUCCESS)
928 {
929 return r;
930 }
931 r = set_pmem_page(card, addr, CHIP_HELPER_WT_CODE_RAM, paddr);
932 break;
933
934 case UNIFI_PHY_ROM:
935 if (!ChipHelper_HasRom(card->helper))
936 {
937 unifi_error(card->ospriv, "Bad address space for chip in generic pointer 0x%08lX (helper=0x%x)\n",
938 generic_addr, card->helper);
939 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
940 }
941 r = unifi_set_proc_select(card, UNIFI_PROC_PHY);
942 if (r != CSR_RESULT_SUCCESS)
943 {
944 return r;
945 }
946 r = set_pmem_page(card, addr, CHIP_HELPER_WT_ROM, paddr);
947 break;
948
949 case UNIFI_MAC_ROM:
950 if (!ChipHelper_HasRom(card->helper))
951 {
952 unifi_error(card->ospriv, "Bad address space for chip in generic pointer 0x%08lX (helper=0x%x)\n",
953 generic_addr, card->helper);
954 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
955 }
956 r = unifi_set_proc_select(card, UNIFI_PROC_MAC);
957 if (r != CSR_RESULT_SUCCESS)
958 {
959 return r;
960 }
961 r = set_pmem_page(card, addr, CHIP_HELPER_WT_ROM, paddr);
962 break;
963
964 case UNIFI_BT_ROM:
965 if (!ChipHelper_HasRom(card->helper) || !ChipHelper_HasBt(card->helper))
966 {
967 unifi_error(card->ospriv, "Bad address space for chip in generic pointer 0x%08lX (helper=0x%x)\n",
968 generic_addr, card->helper);
969 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
970 }
971 r = unifi_set_proc_select(card, UNIFI_PROC_BT);
972 if (r != CSR_RESULT_SUCCESS)
973 {
974 return r;
975 }
976 r = set_pmem_page(card, addr, CHIP_HELPER_WT_ROM, paddr);
977 break;
978
979 default:
980 unifi_error(card->ospriv, "Bad address space %d in generic pointer 0x%08lX (helper=0x%x)\n",
981 space, generic_addr, card->helper);
982 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
983 }
984
985 return r;
986} /* set_page() */
987
988
989/*
990 * ---------------------------------------------------------------------------
991 * unifi_set_proc_select
992 *
993 *
994 * Arguments:
995 * card Pointer to card structure.
996 * select Which XAP core to select
997 *
998 * Returns:
999 * 0 on success, non-zero error code on error:
1000 * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected
1001 * CSR_RESULT_FAILURE an SDIO error occurred
1002 * ---------------------------------------------------------------------------
1003 */
1004CsrResult unifi_set_proc_select(card_t *card, enum unifi_dbg_processors_select select)
1005{
1006 CsrResult r;
1007
1008 /* Verify the the select value is allowed. */
1009 switch (select)
1010 {
1011 case UNIFI_PROC_MAC:
1012 case UNIFI_PROC_PHY:
1013 case UNIFI_PROC_BOTH:
1014 break;
1015
1016
1017 default:
1018 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
1019 }
1020
1021 if (card->proc_select != (u32)select)
1022 {
1023 r = unifi_write_direct16(card,
1024 ChipHelper_DBG_HOST_PROC_SELECT(card->helper) * 2,
1025 (u8)select);
1026 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
1027 {
1028 return r;
1029 }
1030 if (r != CSR_RESULT_SUCCESS)
1031 {
1032 unifi_error(card->ospriv, "Failed to write to Proc Select register\n");
1033 return r;
1034 }
1035
1036 card->proc_select = (u32)select;
1037 }
1038
1039 return CSR_RESULT_SUCCESS;
1040}
1041
1042
1043/*
1044 * ---------------------------------------------------------------------------
1045 * unifi_read_8_or_16
1046 *
1047 * Performs a byte read of the given address in shared data memory.
1048 * Set up the shared data memory page register as required.
1049 *
1050 * Arguments:
1051 * card Pointer to card structure.
1052 * unifi_addr UniFi shared-data-memory address to access.
1053 * pdata Pointer to a byte variable for the value read.
1054 *
1055 * Returns:
1056 * CSR_RESULT_SUCCESS on success, non-zero error code on error:
1057 * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected
1058 * CSR_RESULT_FAILURE an SDIO error occurred
1059 * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified
1060 * ---------------------------------------------------------------------------
1061 */
1062CsrResult unifi_read_8_or_16(card_t *card, u32 unifi_addr, u8 *pdata)
1063{
1064 u32 sdio_addr;
1065 CsrResult r;
1066#ifdef CSR_WIFI_TRANSPORT_CSPI
1067 u16 w;
1068#endif
1069
1070 r = set_page(card, unifi_addr, &sdio_addr);
1071 if (r != CSR_RESULT_SUCCESS)
1072 {
1073 return r;
1074 }
1075
1076#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
1077 card->cmd_prof.cmd52_r8or16_count++;
1078#endif
1079#ifdef CSR_WIFI_TRANSPORT_CSPI
1080 r = retrying_read16(card, card->function, sdio_addr, &w);
1081 *pdata = (u8)(w & 0xFF);
1082 return r;
1083#else
1084 return retrying_read8(card, card->function, sdio_addr, pdata);
1085#endif
1086} /* unifi_read_8_or_16() */
1087
1088
1089/*
1090 * ---------------------------------------------------------------------------
1091 * unifi_write_8_or_16
1092 *
1093 * Performs a byte write of the given address in shared data memory.
1094 * Set up the shared data memory page register as required.
1095 *
1096 * Arguments:
1097 * card Pointer to card context struct.
1098 * unifi_addr UniFi shared-data-memory address to access.
1099 * data Value to write.
1100 *
1101 * Returns:
1102 * CSR_RESULT_SUCCESS on success, non-zero error code on error:
1103 * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected
1104 * CSR_RESULT_FAILURE an SDIO error occurred
1105 * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified
1106 *
1107 * Notes:
1108 * Beware using unifi_write8() because byte writes are not safe on UniFi.
1109 * Writes to odd bytes are cached, writes to even bytes perform a 16-bit
1110 * write with the previously cached odd byte.
1111 * ---------------------------------------------------------------------------
1112 */
1113CsrResult unifi_write_8_or_16(card_t *card, u32 unifi_addr, u8 data)
1114{
1115 u32 sdio_addr;
1116 CsrResult r;
1117#ifdef CSR_WIFI_TRANSPORT_CSPI
1118 u16 w;
1119#endif
1120
1121 r = set_page(card, unifi_addr, &sdio_addr);
1122 if (r != CSR_RESULT_SUCCESS)
1123 {
1124 return r;
1125 }
1126
1127 if (sdio_addr & 1)
1128 {
1129 unifi_warning(card->ospriv,
1130 "Warning: Byte write to an odd address (0x%lX) is dangerous\n",
1131 sdio_addr);
1132 }
1133
1134#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
1135 card->cmd_prof.cmd52_w8or16_count++;
1136#endif
1137#ifdef CSR_WIFI_TRANSPORT_CSPI
1138 w = data;
1139 return retrying_write16(card, card->function, sdio_addr, w);
1140#else
1141 return retrying_write8(card, card->function, sdio_addr, data);
1142#endif
1143} /* unifi_write_8_or_16() */
1144
1145
1146/*
1147 * ---------------------------------------------------------------------------
1148 * unifi_card_read16
1149 *
1150 * Performs a 16-bit read of the given address in shared data memory.
1151 * Set up the shared data memory page register as required.
1152 *
1153 * Arguments:
1154 * card Pointer to card structure.
1155 * unifi_addr UniFi shared-data-memory address to access.
1156 * pdata Pointer to a 16-bit int variable for the value read.
1157 *
1158 * Returns:
1159 * CSR_RESULT_SUCCESS on success, non-zero error code on error:
1160 * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected
1161 * CSR_RESULT_FAILURE an SDIO error occurred
1162 * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified
1163 * ---------------------------------------------------------------------------
1164 */
1165CsrResult unifi_card_read16(card_t *card, u32 unifi_addr, u16 *pdata)
1166{
1167 u32 sdio_addr;
1168 CsrResult r;
1169
1170 r = set_page(card, unifi_addr, &sdio_addr);
1171 if (r != CSR_RESULT_SUCCESS)
1172 {
1173 return r;
1174 }
1175
1176#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
1177 card->cmd_prof.cmd52_r16_count++;
1178#endif
1179 return unifi_read_direct16(card, sdio_addr, pdata);
1180} /* unifi_card_read16() */
1181
1182
1183/*
1184 * ---------------------------------------------------------------------------
1185 * unifi_card_write16
1186 *
1187 * Performs a 16-bit write of the given address in shared data memory.
1188 * Set up the shared data memory page register as required.
1189 *
1190 * Arguments:
1191 * card Pointer to card structure.
1192 * unifi_addr UniFi shared-data-memory address to access.
1193 * pdata Pointer to a byte variable for the value write.
1194 *
1195 * Returns:
1196 * CSR_RESULT_SUCCESS on success, non-zero error code on error:
1197 * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected
1198 * CSR_RESULT_FAILURE an SDIO error occurred
1199 * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified
1200 * ---------------------------------------------------------------------------
1201 */
1202CsrResult unifi_card_write16(card_t *card, u32 unifi_addr, u16 data)
1203{
1204 u32 sdio_addr;
1205 CsrResult r;
1206
1207 r = set_page(card, unifi_addr, &sdio_addr);
1208 if (r != CSR_RESULT_SUCCESS)
1209 {
1210 return r;
1211 }
1212
1213#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
1214 card->cmd_prof.cmd52_w16_count++;
1215#endif
1216 return unifi_write_direct16(card, sdio_addr, data);
1217} /* unifi_card_write16() */
1218
1219
1220/*
1221 * ---------------------------------------------------------------------------
1222 * unifi_read32
1223 *
1224 * Performs a 32-bit read of the given address in shared data memory.
1225 * Set up the shared data memory page register as required.
1226 *
1227 * Arguments:
1228 * card Pointer to card structure.
1229 * unifi_addr UniFi shared-data-memory address to access.
1230 * pdata Pointer to a int variable for the value read.
1231 *
1232 * Returns:
1233 * CSR_RESULT_SUCCESS on success, non-zero error code on error:
1234 * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected
1235 * CSR_RESULT_FAILURE an SDIO error occurred
1236 * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified
1237 * ---------------------------------------------------------------------------
1238 */
1239CsrResult unifi_read32(card_t *card, u32 unifi_addr, u32 *pdata)
1240{
1241 u32 sdio_addr;
1242 CsrResult r;
1243
1244 r = set_page(card, unifi_addr, &sdio_addr);
1245 if (r != CSR_RESULT_SUCCESS)
1246 {
1247 return r;
1248 }
1249
1250#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
1251 card->cmd_prof.cmd52_r32_count++;
1252#endif
1253 return unifi_read_direct32(card, sdio_addr, pdata);
1254} /* unifi_read32() */
1255
1256
1257/*
1258 * ---------------------------------------------------------------------------
1259 * unifi_card_readn
1260 * unifi_readnz
1261 *
1262 * Read multiple 8-bit values from the UniFi SDIO interface.
1263 * This function interprets the address as a GenericPointer as
1264 * defined in the UniFi Host Interface Protocol Specification.
1265 * The readnz version of this function will stop when it reads a
1266 * zero octet.
1267 *
1268 * Arguments:
1269 * card Pointer to card structure.
1270 * unifi_addr UniFi shared-data-memory address to access.
1271 * pdata Pointer to which to write data.
1272 * len Number of bytes to read
1273 *
1274 * Returns:
1275 * CSR_RESULT_SUCCESS on success, non-zero error code on error:
1276 * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected
1277 * CSR_RESULT_FAILURE an SDIO error occurred
1278 * CSR_WIFI_HIP_RESULT_INVALID_VALUE a bad generic pointer was specified
1279 * ---------------------------------------------------------------------------
1280 */
1281CsrResult unifi_readn_match(card_t *card, u32 unifi_addr, void *pdata, u16 len, s8 match)
1282{
1283 u32 sdio_addr;
1284 CsrResult r;
1285 u32 num;
1286
1287 r = set_page(card, unifi_addr, &sdio_addr);
1288 if (r != CSR_RESULT_SUCCESS)
1289 {
1290 return r;
1291 }
1292
1293 r = unifi_read_directn_match(card, sdio_addr, pdata, len, match, &num);
1294 return r;
1295} /* unifi_readn_match() */
1296
1297
1298CsrResult unifi_card_readn(card_t *card, u32 unifi_addr, void *pdata, u16 len)
1299{
1300 return unifi_readn_match(card, unifi_addr, pdata, len, -1);
1301} /* unifi_card_readn() */
1302
1303
1304CsrResult unifi_readnz(card_t *card, u32 unifi_addr, void *pdata, u16 len)
1305{
1306 return unifi_readn_match(card, unifi_addr, pdata, len, 0);
1307} /* unifi_readnz() */
1308
1309
1310/*
1311 * ---------------------------------------------------------------------------
1312 * unifi_read_shared_count
1313 *
1314 * Read signal count locations, checking for an SDIO error. The
1315 * signal count locations only contain a valid number if the
1316 * highest bit isn't set.
1317 *
1318 * Arguments:
1319 * card Pointer to card context structure.
1320 * addr Shared-memory address to read.
1321 *
1322 * Returns:
1323 * Value read from memory (0-127) or -1 on error
1324 * ---------------------------------------------------------------------------
1325 */
1326s32 unifi_read_shared_count(card_t *card, u32 addr)
1327{
1328 u8 b;
1329 /* I've increased this count, because I have seen cases where
1330 * there were three reads in a row with the top bit set. I'm not
1331 * sure why this might have happened, but I can't see a problem
1332 * with increasing this limit. It's better to take a while to
1333 * recover than to fail. */
1334#define SHARED_READ_RETRY_LIMIT 10
1335 s32 i;
1336
1337 /*
1338 * Get the to-host-signals-written count.
1339 * The top-bit will be set if the firmware was in the process of
1340 * changing the value, in which case we read again.
1341 */
1342 /* Limit the number of repeats so we don't freeze */
1343 for (i = 0; i < SHARED_READ_RETRY_LIMIT; i++)
1344 {
1345 CsrResult r;
1346 r = unifi_read_8_or_16(card, addr, &b);
1347 if (r != CSR_RESULT_SUCCESS)
1348 {
1349 return -1;
1350 }
1351 if (!(b & 0x80))
1352 {
1353 /* There is a chance that the MSB may have contained invalid data
1354 * (overflow) at the time it was read. Therefore mask off the MSB.
1355 * This avoids a race between driver read and firmware write of the
1356 * word, the value we need is in the lower 8 bits anway.
1357 */
1358 return (s32)(b & 0xff);
1359 }
1360 }
1361
1362 return -1; /* this function has changed in WMM mods */
1363} /* unifi_read_shared_count() */
1364
1365
1366/*
1367 * ---------------------------------------------------------------------------
1368 * unifi_writen
1369 *
1370 * Write multiple 8-bit values to the UniFi SDIO interface using CMD52
1371 * This function interprets the address as a GenericPointer as
1372 * defined in the UniFi Host Interface Protocol Specification.
1373 *
1374 * Arguments:
1375 * card Pointer to card structure.
1376 * unifi_addr UniFi shared-data-memory address to access.
1377 * pdata Pointer to which to write data.
1378 * len Number of bytes to write
1379 *
1380 * Returns:
1381 * 0 on success, non-zero error code on error:
1382 * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected
1383 * CSR_RESULT_FAILURE an SDIO error occurred
1384 * CSR_WIFI_HIP_RESULT_INVALID_VALUE an odd length or length too big.
1385 * ---------------------------------------------------------------------------
1386 */
1387CsrResult unifi_writen(card_t *card, u32 unifi_addr, void *pdata, u16 len)
1388{
1389 u32 sdio_addr;
1390 CsrResult r;
1391
1392 r = set_page(card, unifi_addr, &sdio_addr);
1393 if (r != CSR_RESULT_SUCCESS)
1394 {
1395 return r;
1396 }
1397
1398 return unifi_write_directn(card, sdio_addr, pdata, len);
1399} /* unifi_writen() */
1400
1401
1402static CsrResult csr_sdio_block_rw(card_t *card, s16 funcnum,
1403 u32 addr, u8 *pdata,
1404 u16 count, s16 dir_is_write)
1405{
1406 CsrResult csrResult;
1407
1408 if (dir_is_write == UNIFI_SDIO_READ)
1409 {
1410#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE)
1411 unifi_debug_log_to_buf("r@%02X#%X=", addr, count);
1412#endif
1413#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
1414 unifi_debug_log_to_buf("R");
1415#endif
1416 csrResult = CsrSdioRead(card->sdio_if, addr, pdata, count);
1417#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
1418 unifi_debug_log_to_buf("<");
1419#endif
1420 }
1421 else
1422 {
1423#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE)
1424 unifi_debug_log_to_buf("w@%02X#%X=", addr, count);
1425 unifi_debug_hex_to_buf(pdata, count > CSR_WIFI_HIP_SDIO_TRACE_DATA_LENGTH?CSR_WIFI_HIP_SDIO_TRACE_DATA_LENGTH : count);
1426#endif
1427#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
1428 unifi_debug_log_to_buf("W");
1429#endif
1430 csrResult = CsrSdioWrite(card->sdio_if, addr, pdata, count);
1431#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
1432 unifi_debug_log_to_buf(">");
1433#endif
1434 }
1435#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE
1436 card->cmd_prof.cmd53_count++;
1437#endif
1438#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_SDIO_TRACE)
1439 if (csrResult != CSR_RESULT_SUCCESS)
1440 {
1441 unifi_debug_log_to_buf("error=%X", csrResult);
1442 }
1443 else if (dir_is_write == UNIFI_SDIO_READ)
1444 {
1445 unifi_debug_hex_to_buf(pdata, count > CSR_WIFI_HIP_SDIO_TRACE_DATA_LENGTH?CSR_WIFI_HIP_SDIO_TRACE_DATA_LENGTH : count);
1446 }
1447 unifi_debug_string_to_buf("\n");
1448#endif
1449 return csrResult; /* CSR SDIO (not HIP) error code */
1450}
1451
1452
1453/*
1454 * ---------------------------------------------------------------------------
1455 * unifi_bulk_rw
1456 *
1457 * Transfer bulk data to or from the UniFi SDIO interface.
1458 * This function is used to read or write signals and bulk data.
1459 *
1460 * Arguments:
1461 * card Pointer to card structure.
1462 * handle Value to put in the Register Address field of the CMD53 req.
1463 * data Pointer to data to write.
1464 * direction One of UNIFI_SDIO_READ or UNIFI_SDIO_WRITE
1465 *
1466 * Returns:
1467 * CSR_RESULT_SUCCESS on success, non-zero error code on error:
1468 * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected
1469 * CSR_RESULT_FAILURE an SDIO error occurred
1470 *
1471 * Notes:
1472 * This function uses SDIO CMD53, which is the block transfer mode.
1473 * ---------------------------------------------------------------------------
1474 */
1475CsrResult unifi_bulk_rw(card_t *card, u32 handle, void *pdata,
1476 u32 len, s16 direction)
1477{
1478#define CMD53_RETRIES 3
1479 /*
1480 * Ideally instead of sleeping, we want to busy wait.
1481 * Currently there is no framework API to do this. When it becomes available,
1482 * we can use it to busy wait using usecs
1483 */
1484#define REWIND_RETRIES 15 /* when REWIND_DELAY==1msec, or 250 when REWIND_DELAY==50usecs */
1485#define REWIND_POLLING_RETRIES 5
1486#define REWIND_DELAY 1 /* msec or 50usecs */
1487 CsrResult csrResult; /* SDIO error code */
1488 CsrResult r = CSR_RESULT_SUCCESS; /* HIP error code */
1489 s16 retries = CMD53_RETRIES;
1490 s16 stat_retries;
1491 u8 stat;
1492 s16 dump_read;
1493#ifdef UNIFI_DEBUG
1494 u8 *pdata_lsb = ((u8 *)&pdata) + card->lsb;
1495#endif
1496#ifdef CSR_WIFI_MAKE_FAKE_CMD53_ERRORS
1497 static s16 fake_error;
1498#endif
1499
1500 dump_read = 0;
1501#ifdef UNIFI_DEBUG
1502 if (*pdata_lsb & 1)
1503 {
1504 unifi_notice(card->ospriv, "CD53 request on a unaligned buffer (addr: 0x%X) dir %s-Host\n",
1505 pdata, (direction == UNIFI_SDIO_READ)?"To" : "From");
1506 if (direction == UNIFI_SDIO_WRITE)
1507 {
1508 dump(pdata, (u16)len);
1509 }
1510 else
1511 {
1512 dump_read = 1;
1513 }
1514 }
1515#endif
1516
1517 /* Defensive checks */
1518 if (!pdata)
1519 {
1520 unifi_error(card->ospriv, "Null pdata for unifi_bulk_rw() len: %d\n", len);
1521 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
1522 }
1523 if ((len & 1) || (len > 0xffff))
1524 {
1525 unifi_error(card->ospriv, "Impossible CMD53 length requested: %d\n", len);
1526 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
1527 }
1528
1529 while (1)
1530 {
1531 csrResult = csr_sdio_block_rw(card, card->function, handle,
1532 (u8 *)pdata, (u16)len,
1533 direction);
1534 if (csrResult == CSR_SDIO_RESULT_NO_DEVICE)
1535 {
1536 return CSR_WIFI_HIP_RESULT_NO_DEVICE;
1537 }
1538#ifdef CSR_WIFI_MAKE_FAKE_CMD53_ERRORS
1539 if (++fake_error > 100)
1540 {
1541 fake_error = 90;
1542 unifi_warning(card->ospriv, "Faking a CMD53 error,\n");
1543 if (csrResult == CSR_RESULT_SUCCESS)
1544 {
1545 csrResult = CSR_RESULT_FAILURE;
1546 }
1547 }
1548#endif
1549 if (csrResult == CSR_RESULT_SUCCESS)
1550 {
1551 if (dump_read)
1552 {
1553 dump(pdata, (u16)len);
1554 }
1555 break;
1556 }
1557
1558 /*
1559 * At this point the SDIO driver should have written the I/O Abort
1560 * register to notify UniFi that the command has failed.
1561 * UniFi-1 and UniFi-2 (not UF6xxx) use the same register to store the
1562 * Deep Sleep State. This means we have to restore the Deep Sleep
1563 * State (AWAKE in any case since we can not perform a CD53 in any other
1564 * state) by rewriting the I/O Abort register to its previous value.
1565 */
1566 if (card->chip_id <= SDIO_CARD_ID_UNIFI_2)
1567 {
1568 (void)unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE);
1569 }
1570
1571 /* If csr_sdio_block_rw() failed in a non-retryable way, or retries exhausted
1572 * then stop retrying
1573 */
1574 if (!retryable_sdio_error(csrResult))
1575 {
1576 unifi_error(card->ospriv, "Fatal error in a CMD53 transfer\n");
1577 break;
1578 }
1579
1580 /*
1581 * These happen from time to time, try again
1582 */
1583 if (--retries == 0)
1584 {
1585 break;
1586 }
1587
1588 unifi_trace(card->ospriv, UDBG4,
1589 "Error in a CMD53 transfer, retrying (h:%d,l:%u)...\n",
1590 (s16)handle & 0xff, len);
1591
1592 /* The transfer failed, rewind and try again */
1593 r = unifi_write_8_or_16(card, card->sdio_ctrl_addr + 8,
1594 (u8)(handle & 0xff));
1595 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
1596 {
1597 return r;
1598 }
1599 if (r != CSR_RESULT_SUCCESS)
1600 {
1601 /*
1602 * If we can't even do CMD52 (register read/write) then
1603 * stop here.
1604 */
1605 unifi_error(card->ospriv, "Failed to write REWIND cmd\n");
1606 return r;
1607 }
1608
1609 /* Signal the UniFi to look for the rewind request. */
1610 r = CardGenInt(card);
1611 if (r != CSR_RESULT_SUCCESS)
1612 {
1613 return r;
1614 }
1615
1616 /* Wait for UniFi to acknowledge the rewind */
1617 stat_retries = REWIND_RETRIES;
1618 while (1)
1619 {
1620 r = unifi_read_8_or_16(card, card->sdio_ctrl_addr + 8, &stat);
1621 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
1622 {
1623 return r;
1624 }
1625 if (r != CSR_RESULT_SUCCESS)
1626 {
1627 unifi_error(card->ospriv, "Failed to read REWIND status\n");
1628 return CSR_RESULT_FAILURE;
1629 }
1630
1631 if (stat == 0)
1632 {
1633 break;
1634 }
1635 if (--stat_retries == 0)
1636 {
1637 unifi_error(card->ospriv, "Timeout waiting for REWIND ready\n");
1638 return CSR_RESULT_FAILURE;
1639 }
1640
1641 /* Poll for the ack a few times */
1642 if (stat_retries < REWIND_RETRIES - REWIND_POLLING_RETRIES)
1643 {
1644 CsrThreadSleep(REWIND_DELAY);
1645 }
1646 }
1647 }
1648
1649 /* The call to csr_sdio_block_rw() still failed after retrying */
1650 if (csrResult != CSR_RESULT_SUCCESS)
1651 {
1652 unifi_error(card->ospriv, "Block %s failed after %d retries\n",
1653 (direction == UNIFI_SDIO_READ)?"read" : "write",
1654 CMD53_RETRIES - retries);
1655 /* Report any SDIO error as a general i/o error */
1656 return CSR_RESULT_FAILURE;
1657 }
1658
1659 /* Collect some stats */
1660 if (direction == UNIFI_SDIO_READ)
1661 {
1662 card->sdio_bytes_read += len;
1663 }
1664 else
1665 {
1666 card->sdio_bytes_written += len;
1667 }
1668
1669 return CSR_RESULT_SUCCESS;
1670} /* unifi_bulk_rw() */
1671
1672
1673/*
1674 * ---------------------------------------------------------------------------
1675 * unifi_bulk_rw_noretry
1676 *
1677 * Transfer bulk data to or from the UniFi SDIO interface.
1678 * This function is used to read or write signals and bulk data.
1679 *
1680 * Arguments:
1681 * card Pointer to card structure.
1682 * handle Value to put in the Register Address field of
1683 * the CMD53 req.
1684 * data Pointer to data to write.
1685 * direction One of UNIFI_SDIO_READ or UNIFI_SDIO_WRITE
1686 *
1687 * Returns:
1688 * 0 on success, non-zero error code on error:
1689 * CSR_WIFI_HIP_RESULT_NO_DEVICE card was ejected
1690 * CSR_RESULT_FAILURE an SDIO error occurred
1691 *
1692 * Notes:
1693 * This function uses SDIO CMD53, which is the block transfer mode.
1694 * ---------------------------------------------------------------------------
1695 */
1696CsrResult unifi_bulk_rw_noretry(card_t *card, u32 handle, void *pdata,
1697 u32 len, s16 direction)
1698{
1699 CsrResult csrResult;
1700
1701 csrResult = csr_sdio_block_rw(card, card->function, handle,
1702 (u8 *)pdata, (u16)len, direction);
1703 if (csrResult != CSR_RESULT_SUCCESS)
1704 {
1705 unifi_error(card->ospriv, "Block %s failed\n",
1706 (direction == UNIFI_SDIO_READ)?"read" : "write");
1707 return csrResult;
1708 }
1709
1710 return CSR_RESULT_SUCCESS;
1711} /* unifi_bulk_rw_noretry() */
1712
1713
diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper.c b/drivers/staging/csr/csr_wifi_hip_chiphelper.c
deleted file mode 100644
index 5cf5b8a5a1e1..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_chiphelper.c
+++ /dev/null
@@ -1,793 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11#include "csr_macro.h"
12#include "csr_wifi_hip_chiphelper_private.h"
13
14#ifndef nelem
15#define nelem(a) (sizeof(a) / sizeof(a[0]))
16#endif
17
18#define counted(foo) { nelem(foo), foo }
19#define null_counted() { 0, NULL }
20
21/* The init values are a set of register writes that we must
22 perform when we first connect to the chip to get it working.
23 They swicth on the correct clocks and possibly set the host
24 interface as a wkaeup source. They should not be used if
25 proper HIP opperation is required, but are useful before we
26 do a code download. */
27static const struct chip_helper_init_values init_vals_v1[] = {
28 { 0xFDBB, 0xFFFF },
29 { 0xFDB6, 0x03FF },
30 { 0xFDB1, 0x01E3 },
31 { 0xFDB3, 0x0FFF },
32 { 0xFEE3, 0x08F0 },
33 { 0xFEE7, 0x3C3F },
34 { 0xFEE6, 0x0050 },
35 { 0xFDBA, 0x0000 }
36};
37
38static const struct chip_helper_init_values init_vals_v2[] = {
39 { 0xFDB6, 0x0FFF },
40 { 0xF023, 0x3F3F },
41 { 0xFDB1, 0x01E3 },
42 { 0xFDB3, 0x0FFF },
43 { 0xF003, 0x08F0 },
44 { 0xF007, 0x3C3F },
45 { 0xF006, 0x0050 }
46};
47
48
49static const struct chip_helper_init_values init_vals_v22_v23[] = {
50 { 0xF81C, 0x00FF },
51 /*{ 0x????, 0x???? }, */
52 { 0xF80C, 0x1FFF },
53 { 0xFA25, 0x001F },
54 { 0xF804, 0x00FF },
55 { 0xF802, 0x0FFF },
56 /*{ 0x????, 0x???? },
57 { 0x????, 0x???? },
58 { 0x????, 0x???? }*/
59};
60
61static const u16 reset_program_a_v1_or_v2[] = {
62 0x0000
63};
64static const u16 reset_program_b_v1_or_v2[] = {
65 0x0010, 0xFE00, 0xA021, 0xFF00, 0x8111, 0x0009, 0x0CA4, 0x0114,
66 0x0280, 0x04F8, 0xFE00, 0x6F25, 0x06E0, 0x0010, 0xFC00, 0x0121,
67 0xFC00, 0x0225, 0xFE00, 0x7125, 0xFE00, 0x6D11, 0x03F0, 0xFE00,
68 0x6E25, 0x0008, 0x00E0
69};
70
71static const struct chip_helper_reset_values reset_program_v1_or_v2[] =
72{
73 {
74 MAKE_GP(REGISTERS, 0x000C),
75 nelem(reset_program_a_v1_or_v2),
76 reset_program_a_v1_or_v2
77 },
78 {
79 MAKE_GP(MAC_PMEM, 0x000000),
80 nelem(reset_program_b_v1_or_v2),
81 reset_program_b_v1_or_v2
82 }
83};
84
85static const struct chip_map_address_t unifi_map_address_v1_v2[] =
86{
87 { 0xFE9F, 0xFE7B }, /* PM1_BANK_SELECT */
88 { 0xFE9E, 0xFE78 }, /* PM2_BANK_SELECT */
89 { 0xFE9D, 0xFE7E }, /* SHARED_DMEM_PAGE */
90 { 0xFE91, 0xFE90 }, /* PROC_SELECT */
91 { 0xFE8D, 0xFE8C }, /* STOP_STATUS */
92};
93
94static const struct chip_map_address_t unifi_map_address_v22_v23[] =
95{
96 { 0xF8F9, 0xF8AC }, /* GW1_CONFIG */
97 { 0xF8FA, 0xF8AD }, /* GW2_CONFIG */
98 { 0xF8FB, 0xF8AE }, /* GW3_CONFIG */
99 { 0xF830, 0xF81E }, /* PROC_SELECT */
100 { 0xF831, 0xF81F }, /* STOP_STATUS */
101 { 0xF8FC, 0xF8AF }, /* IO_LOG_ADDRESS */
102};
103
104static const struct chip_device_regs_t unifi_device_regs_null =
105{
106 0xFE81, /* GBL_CHIP_VERSION */
107 0x0000, /* GBL_MISC_ENABLES */
108 0x0000, /* DBG_EMU_CMD */
109 {
110 0x0000, /* HOST.DBG_PROC_SELECT */
111 0x0000, /* HOST.DBG_STOP_STATUS */
112 0x0000, /* HOST.WINDOW1_PAGE */
113 0x0000, /* HOST.WINDOW2_PAGE */
114 0x0000, /* HOST.WINDOW3_PAGE */
115 0x0000 /* HOST.IO_LOG_ADDR */
116 },
117 {
118 0x0000, /* SPI.DBG_PROC_SELECT */
119 0x0000, /* SPI.DBG_STOP_STATUS */
120 0x0000, /* SPI.WINDOW1_PAGE */
121 0x0000, /* SPI.WINDOW2_PAGE */
122 0x0000, /* SPI.WINDOW3_PAGE */
123 0x0000 /* SPI.IO_LOG_ADDR */
124 },
125 0x0000, /* DBG_RESET */
126 0x0000, /* > DBG_RESET_VALUE */
127 0x0000, /* DBG_RESET_WARN */
128 0x0000, /* DBG_RESET_WARN_VALUE */
129 0x0000, /* DBG_RESET_RESULT */
130 0xFFE9, /* XAP_PCH */
131 0xFFEA, /* XAP_PCL */
132 0x0000, /* PROC_PC_SNOOP */
133 0x0000, /* WATCHDOG_DISABLE */
134 0x0000, /* MAILBOX0 */
135 0x0000, /* MAILBOX1 */
136 0x0000, /* MAILBOX2 */
137 0x0000, /* MAILBOX3 */
138 0x0000, /* SDIO_HOST_INT */
139 0x0000, /* SHARED_IO_INTERRUPT */
140 0x0000, /* SDIO HIP HANDSHAKE */
141 0x0000 /* COEX_STATUS */
142};
143
144/* UF105x */
145static const struct chip_device_regs_t unifi_device_regs_v1 =
146{
147 0xFE81, /* GBL_CHIP_VERSION */
148 0xFE87, /* GBL_MISC_ENABLES */
149 0xFE9C, /* DBG_EMU_CMD */
150 {
151 0xFE90, /* HOST.DBG_PROC_SELECT */
152 0xFE8C, /* HOST.DBG_STOP_STATUS */
153 0xFE7B, /* HOST.WINDOW1_PAGE */
154 0xFE78, /* HOST.WINDOW2_PAGE */
155 0xFE7E, /* HOST.WINDOW3_PAGE */
156 0x0000 /* HOST.IO_LOG_ADDR */
157 },
158 {
159 0xFE91, /* SPI.DBG_PROC_SELECT */
160 0xFE8D, /* SPI.DBG_STOP_STATUS */
161 0xFE9F, /* SPI.WINDOW1_PAGE */
162 0xFE9E, /* SPI.WINDOW2_PAGE */
163 0xFE9D, /* SPI.WINDOW3_PAGE */
164 0x0000 /* SPI.IO_LOG_ADDR */
165 },
166 0xFE92, /* DBG_RESET */
167 0x0001, /* > DBG_RESET_VALUE */
168 0xFDA0, /* DBG_RESET_WARN (HOST_SELECT) */
169 0x0000, /* DBG_RESET_WARN_VALUE */
170 0xFE92, /* DBG_RESET_RESULT */
171 0xFFE9, /* XAP_PCH */
172 0xFFEA, /* XAP_PCL */
173 0x0051, /* PROC_PC_SNOOP */
174 0xFE70, /* WATCHDOG_DISABLE */
175 0xFE6B, /* MAILBOX0 */
176 0xFE6A, /* MAILBOX1 */
177 0xFE69, /* MAILBOX2 */
178 0xFE68, /* MAILBOX3 */
179 0xFE67, /* SDIO_HOST_INT */
180 0xFE65, /* SHARED_IO_INTERRUPT */
181 0xFDE9, /* SDIO HIP HANDSHAKE */
182 0x0000 /* COEX_STATUS */
183};
184
185/* UF2... */
186static const struct chip_device_regs_t unifi_device_regs_v2 =
187{
188 0xFE81, /* GBL_CHIP_VERSION */
189 0xFE87, /* GBL_MISC_ENABLES */
190 0xFE9C, /* DBG_EMU_CMD */
191 {
192 0xFE90, /* HOST.DBG_PROC_SELECT */
193 0xFE8C, /* HOST.DBG_STOP_STATUS */
194 0xFE7B, /* HOST.WINDOW1_PAGE */
195 0xFE78, /* HOST.WINDOW2_PAGE */
196 0xFE7E, /* HOST.WINDOW3_PAGE */
197 0x0000 /* HOST.IO_LOG_ADDR */
198 },
199 {
200 0xFE91, /* SPI.DBG_PROC_SELECT */
201 0xFE8D, /* SPI.DBG_STOP_STATUS */
202 0xFE9F, /* SPI.WINDOW1_PAGE */
203 0xFE9E, /* SPI.WINDOW2_PAGE */
204 0xFE9D, /* SPI.WINDOW3_PAGE */
205 0x0000 /* SPI.IO_LOG_ADDR */
206 },
207 0xFE92, /* DBG_RESET */
208 0x0000, /* > DBG_RESET_VALUE */
209 0xFDE9, /* DBG_RESET_WARN (TEST_FLASH_DATA - SHARED_MAILBOX2B) */
210 0xFFFF, /* DBG_RESET_WARN_VALUE */
211 0xFDE9, /* DBG_RESET_RESULT (TEST_FLASH_DATA) */
212 0xFFE9, /* XAP_PCH */
213 0xFFEA, /* XAP_PCL */
214 0x0051, /* PROC_PC_SNOOP */
215 0xFE70, /* WATCHDOG_DISABLE */
216 0xFE6B, /* MAILBOX0 */
217 0xFE6A, /* MAILBOX1 */
218 0xFE69, /* MAILBOX2 */
219 0xFE68, /* MAILBOX3 */
220 0xFE67, /* SDIO_HOST_INT */
221 0xFE65, /* SHARED_IO_INTERRUPT */
222 0xFE69, /* SDIO HIP HANDSHAKE */
223 0x0000 /* COEX_STATUS */
224};
225
226/* UF60xx */
227static const struct chip_device_regs_t unifi_device_regs_v22_v23 =
228{
229 0xFE81, /* GBL_CHIP_VERSION */
230 0xF84F, /* GBL_MISC_ENABLES */
231 0xF81D, /* DBG_EMU_CMD */
232 {
233 0xF81E, /* HOST.DBG_PROC_SELECT */
234 0xF81F, /* HOST.DBG_STOP_STATUS */
235 0xF8AC, /* HOST.WINDOW1_PAGE */
236 0xF8AD, /* HOST.WINDOW2_PAGE */
237 0xF8AE, /* HOST.WINDOW3_PAGE */
238 0xF8AF /* HOST.IO_LOG_ADDR */
239 },
240 {
241 0xF830, /* SPI.DBG_PROC_SELECT */
242 0xF831, /* SPI.DBG_STOP_STATUS */
243 0xF8F9, /* SPI.WINDOW1_PAGE */
244 0xF8FA, /* SPI.WINDOW2_PAGE */
245 0xF8FB, /* SPI.WINDOW3_PAGE */
246 0xF8FC /* SPI.IO_LOG_ADDR */
247 },
248 0xF82F, /* DBG_RESET */
249 0x0001, /* > DBG_RESET_VALUE */
250 0x0000, /* DBG_RESET_WARN */
251 0x0000, /* DBG_RESET_WARN_VALUE */
252 0xF82F, /* DBG_RESET_RESULT */
253 0xFFE9, /* XAP_PCH */
254 0xFFEA, /* XAP_PCL */
255 0x001B, /* PROC_PC_SNOOP */
256 0x0055, /* WATCHDOG_DISABLE */
257 0xF84B, /* MAILBOX0 */
258 0xF84C, /* MAILBOX1 */
259 0xF84D, /* MAILBOX2 */
260 0xF84E, /* MAILBOX3 */
261 0xF92F, /* SDIO_HOST_INT */
262 0xF92B, /* SDIO_FROMHOST_SCRTACH0 / SHARED_IO_INTERRUPT */
263 0xF84D, /* SDIO HIP HANDSHAKE (MAILBOX2) */
264 0xF9FB /* COEX_STATUS */
265};
266
267/* Program memory window on UF105x. */
268static const struct window_shift_info_t prog_window_array_unifi_v1_v2[CHIP_HELPER_WT_COUNT] =
269{
270 { TRUE, 11, 0x0200 }, /* CODE RAM */
271 { TRUE, 11, 0x0000 }, /* FLASH */
272 { TRUE, 11, 0x0400 }, /* External SRAM */
273 { FALSE, 0, 0 }, /* ROM */
274 { FALSE, 0, 0 } /* SHARED */
275};
276
277/* Shared memory window on UF105x. */
278static const struct window_shift_info_t shared_window_array_unifi_v1_v2[CHIP_HELPER_WT_COUNT] =
279{
280 { FALSE, 0, 0 }, /* CODE RAM */
281 { FALSE, 0, 0 }, /* FLASH */
282 { FALSE, 0, 0 }, /* External SRAM */
283 { FALSE, 0, 0 }, /* ROM */
284 { TRUE, 11, 0x0000 } /* SHARED */
285};
286
287/* One of the Generic Windows on UF60xx and later. */
288static const struct window_shift_info_t generic_window_array_unifi_v22_v23[CHIP_HELPER_WT_COUNT] =
289{
290 { TRUE, 11, 0x3800 }, /* CODE RAM */
291 { FALSE, 0, 0 }, /* FLASH */
292 { FALSE, 0, 0 }, /* External SRAM */
293 { TRUE, 11, 0x2000 }, /* ROM */
294 { TRUE, 11, 0x0000 } /* SHARED */
295};
296
297/* The three windows on UF105x. */
298static const struct window_info_t prog1_window_unifi_v1_v2 = { 0x0000, 0x2000, 0x0080, prog_window_array_unifi_v1_v2 };
299static const struct window_info_t prog2_window_unifi_v1_v2 = { 0x2000, 0x2000, 0x0000, prog_window_array_unifi_v1_v2 };
300static const struct window_info_t shared_window_unifi_v1_v2 = { 0x4000, 0x2000, 0x0000, shared_window_array_unifi_v1_v2 };
301
302/* The three windows on UF60xx and later. */
303static const struct window_info_t generic1_window_unifi_v22_v23 = { 0x0000, 0x2000, 0x0080, generic_window_array_unifi_v22_v23 };
304static const struct window_info_t generic2_window_unifi_v22_v23 = { 0x2000, 0x2000, 0x0000, generic_window_array_unifi_v22_v23 };
305static const struct window_info_t generic3_window_unifi_v22_v23 = { 0x4000, 0x2000, 0x0000, generic_window_array_unifi_v22_v23 };
306
307static const struct chip_device_desc_t chip_device_desc_null =
308{
309 { FALSE, 0x0000, 0x0000, 0x00 },
310 "",
311 "",
312 null_counted(), /* init */
313 null_counted(), /* reset_prog */
314 &unifi_device_regs_null, /* regs */
315 {
316 FALSE, /* has_flash */
317 FALSE, /* has_ext_sram */
318 FALSE, /* has_rom */
319 FALSE, /* has_bt */
320 FALSE, /* has_wlan */
321 },
322 null_counted(),
323 /* prog_offset */
324 {
325 0x00000000,
326 0x00000000,
327 0x00000000,
328 0x00000000
329 },
330 /* data_offset */
331 {
332 0x0000 /* ram */
333 },
334 /* windows */
335 {
336 NULL,
337 NULL,
338 NULL
339 }
340};
341
342static const struct chip_device_desc_t unifi_device_desc_v1 =
343{
344 { FALSE, 0xf0ff, 0x1001, 0x01 }, /* UF105x R01 */
345 "UF105x",
346 "UniFi-1",
347 counted(init_vals_v1), /* init */
348 counted(reset_program_v1_or_v2), /* reset_prog */
349 &unifi_device_regs_v1, /* regs */
350 {
351 TRUE, /* has_flash */
352 TRUE, /* has_ext_sram */
353 FALSE, /* has_rom */
354 FALSE, /* has_bt */
355 TRUE, /* has_wlan */
356 },
357 counted(unifi_map_address_v1_v2), /* map */
358 /* prog_offset */
359 {
360 0x00100000, /* ram */
361 0x00000000, /* rom (invalid) */
362 0x00000000, /* flash */
363 0x00200000, /* ext_ram */
364 },
365 /* data_offset */
366 {
367 0x8000 /* ram */
368 },
369 /* windows */
370 {
371 &prog1_window_unifi_v1_v2,
372 &prog2_window_unifi_v1_v2,
373 &shared_window_unifi_v1_v2
374 }
375};
376
377static const struct chip_device_desc_t unifi_device_desc_v2 =
378{
379 { FALSE, 0xf0ff, 0x2001, 0x02 }, /* UF2... R02 */
380 "UF2...",
381 "UniFi-2",
382 counted(init_vals_v2), /* init */
383 counted(reset_program_v1_or_v2), /* reset_prog */
384 &unifi_device_regs_v2, /* regs */
385 {
386 TRUE, /* has_flash */
387 TRUE, /* has_ext_sram */
388 FALSE, /* has_rom */
389 FALSE, /* has_bt */
390 TRUE, /* has_wlan */
391 },
392 counted(unifi_map_address_v1_v2), /* map */
393 /* prog_offset */
394 {
395 0x00100000, /* ram */
396 0x00000000, /* rom (invalid) */
397 0x00000000, /* flash */
398 0x00200000, /* ext_ram */
399 },
400 /* data_offset */
401 {
402 0x8000 /* ram */
403 },
404 /* windows */
405 {
406 &prog1_window_unifi_v1_v2,
407 &prog2_window_unifi_v1_v2,
408 &shared_window_unifi_v1_v2
409 }
410};
411
412static const struct chip_device_desc_t unifi_device_desc_v3 =
413{
414 { FALSE, 0xf0ff, 0x3001, 0x02 }, /* UF2... R03 */
415 "UF2...",
416 "UniFi-3",
417 counted(init_vals_v2), /* init */
418 counted(reset_program_v1_or_v2), /* reset_prog */
419 &unifi_device_regs_v2, /* regs */
420 {
421 TRUE, /* has_flash */
422 TRUE, /* has_ext_sram */
423 FALSE, /* has_rom */
424 FALSE, /* has_bt */
425 TRUE, /* has_wlan */
426 },
427 counted(unifi_map_address_v1_v2), /* map */
428 /* prog_offset */
429 {
430 0x00100000, /* ram */
431 0x00000000, /* rom (invalid) */
432 0x00000000, /* flash */
433 0x00200000, /* ext_ram */
434 },
435 /* data_offset */
436 {
437 0x8000 /* ram */
438 },
439 /* windows */
440 {
441 &prog1_window_unifi_v1_v2,
442 &prog2_window_unifi_v1_v2,
443 &shared_window_unifi_v1_v2
444 }
445};
446
447static const struct chip_device_desc_t unifi_device_desc_v22 =
448{
449 { FALSE, 0x00ff, 0x0022, 0x07 }, /* UF60xx */
450 "UF60xx",
451 "UniFi-4",
452 counted(init_vals_v22_v23), /* init */
453 null_counted(), /* reset_prog */
454 &unifi_device_regs_v22_v23, /* regs */
455 {
456 FALSE, /* has_flash */
457 FALSE, /* has_ext_sram */
458 TRUE, /* has_rom */
459 FALSE, /* has_bt */
460 TRUE, /* has_wlan */
461 },
462 counted(unifi_map_address_v22_v23), /* map */
463 /* prog_offset */
464 {
465 0x00C00000, /* ram */
466 0x00000000, /* rom */
467 0x00000000, /* flash (invalid) */
468 0x00000000, /* ext_ram (invalid) */
469 },
470 /* data_offset */
471 {
472 0x8000 /* ram */
473 },
474 /* windows */
475 {
476 &generic1_window_unifi_v22_v23,
477 &generic2_window_unifi_v22_v23,
478 &generic3_window_unifi_v22_v23
479 }
480};
481
482static const struct chip_device_desc_t unifi_device_desc_v23 =
483{
484 { FALSE, 0x00ff, 0x0023, 0x08 }, /* UF.... */
485 "UF....",
486 "UF.... (5)",
487 counted(init_vals_v22_v23), /* init */
488 null_counted(), /* reset_prog */
489 &unifi_device_regs_v22_v23, /* regs */
490 {
491 FALSE, /* has_flash */
492 FALSE, /* has_ext_sram */
493 TRUE, /* has_rom */
494 TRUE, /* has_bt */
495 TRUE, /* has_wlan */
496 },
497 counted(unifi_map_address_v22_v23),
498 /* prog_offset */
499 {
500 0x00C00000, /* ram */
501 0x00000000, /* rom */
502 0x00000000, /* flash (invalid) */
503 0x00000000, /* ext_sram (invalid) */
504 },
505 /* data_offset */
506 {
507 0x8000 /* ram */
508 },
509 /* windows */
510 {
511 &generic1_window_unifi_v22_v23,
512 &generic2_window_unifi_v22_v23,
513 &generic3_window_unifi_v22_v23
514 }
515};
516
517static const struct chip_device_desc_t hyd_wlan_subsys_desc_v1 =
518{
519 { FALSE, 0x00ff, 0x0044, 0x00 }, /* UF.... */
520 "HYD...",
521 "HYD... ",
522 counted(init_vals_v22_v23), /* init */
523 null_counted(), /* reset_prog */
524 &unifi_device_regs_v22_v23, /* regs */
525 {
526 FALSE, /* has_flash */
527 FALSE, /* has_ext_sram */
528 TRUE, /* has_rom */
529 FALSE, /* has_bt */
530 TRUE, /* has_wlan */
531 },
532 counted(unifi_map_address_v22_v23),
533 /* prog_offset */
534 {
535 0x00C00000, /* ram */
536 0x00000000, /* rom */
537 0x00000000, /* flash (invalid) */
538 0x00000000, /* ext_sram (invalid) */
539 },
540 /* data_offset */
541 {
542 0x8000 /* ram */
543 },
544 /* windows */
545 {
546 &generic1_window_unifi_v22_v23,
547 &generic2_window_unifi_v22_v23,
548 &generic3_window_unifi_v22_v23
549 }
550};
551
552
553/* This is the list of all chips that we know about. I'm
554 assuming that the order here will be important - we
555 might have multiple entries witrh the same SDIO id for
556 instance. The first one in this list will be the one
557 that is returned if a search is done on only that id.
558 The client will then have to call GetVersionXXX again
559 but with more detailed info.
560
561 I don't know if we need to signal this up to the client
562 in some way?
563
564 (We get the SDIO id before we know anything else about
565 the chip. We might not be able to read any of the other
566 registers at first, but we still need to know about the
567 chip). */
568static const struct chip_device_desc_t *chip_ver_to_desc[] =
569{
570 &unifi_device_desc_v1, /* UF105x R01 */
571 &unifi_device_desc_v2, /* UF2... R02 */
572 &unifi_device_desc_v3, /* UF2... R03 */
573 &unifi_device_desc_v22, /* UF60xx */
574 &unifi_device_desc_v23, /* UF.... */
575 &hyd_wlan_subsys_desc_v1
576};
577
578ChipDescript* ChipHelper_GetVersionSdio(u8 sdio_ver)
579{
580 u32 i;
581
582 for (i = 0; i < nelem(chip_ver_to_desc); i++)
583 {
584 if (chip_ver_to_desc[i]->chip_version.sdio == sdio_ver)
585 {
586 return chip_ver_to_desc[i];
587 }
588 }
589
590 return &chip_device_desc_null;
591}
592
593
594ChipDescript* ChipHelper_GetVersionAny(u16 from_FF9A, u16 from_FE81)
595{
596 u32 i;
597
598 if ((from_FF9A & 0xFF00) != 0)
599 {
600 for (i = 0; i < nelem(chip_ver_to_desc); i++)
601 {
602 if (chip_ver_to_desc[i]->chip_version.pre_bc7 &&
603 ((from_FF9A & chip_ver_to_desc[i]->chip_version.mask) ==
604 chip_ver_to_desc[i]->chip_version.result))
605 {
606 return chip_ver_to_desc[i];
607 }
608 }
609 }
610 else
611 {
612 for (i = 0; i < nelem(chip_ver_to_desc); i++)
613 {
614 if (!chip_ver_to_desc[i]->chip_version.pre_bc7 &&
615 ((from_FE81 & chip_ver_to_desc[i]->chip_version.mask) ==
616 chip_ver_to_desc[i]->chip_version.result))
617 {
618 return chip_ver_to_desc[i];
619 }
620 }
621 }
622
623 return &chip_device_desc_null;
624}
625
626
627ChipDescript* ChipHelper_GetVersionUniFi(u16 ver)
628{
629 return ChipHelper_GetVersionAny(0x0000, ver);
630}
631
632
633ChipDescript *ChipHelper_Null(void)
634{
635 return &chip_device_desc_null;
636}
637
638
639ChipDescript* ChipHelper_GetVersionBlueCore(enum chip_helper_bluecore_age bc_age, u16 version)
640{
641 if (bc_age == chip_helper_bluecore_pre_bc7)
642 {
643 return ChipHelper_GetVersionAny(version, 0x0000);
644 }
645 else
646 {
647 return ChipHelper_GetVersionAny(0x0000, version);
648 }
649}
650
651
652/* Expand the DEF0 functions into simple code to return the
653 correct thing. The DEF1 functions expand to nothing in
654 this X macro expansion. */
655#define CHIP_HELPER_DEF0_C_DEF(ret_type, name, info) \
656 ret_type ChipHelper_ ## name(ChipDescript * chip_help) \
657 { \
658 return chip_help->info; \
659 }
660#define CHIP_HELPER_DEF1_C_DEF(ret_type, name, type1, name1)
661
662CHIP_HELPER_LIST(C_DEF)
663
664/*
665 * Map register addresses between HOST and SPI access.
666 */
667u16 ChipHelper_MapAddress_SPI2HOST(ChipDescript *chip_help, u16 addr)
668{
669 u32 i;
670 for (i = 0; i < chip_help->map.len; i++)
671 {
672 if (chip_help->map.vals[i].spi == addr)
673 {
674 return chip_help->map.vals[i].host;
675 }
676 }
677 return addr;
678}
679
680
681u16 ChipHelper_MapAddress_HOST2SPI(ChipDescript *chip_help, u16 addr)
682{
683 u32 i;
684 for (i = 0; i < chip_help->map.len; i++)
685 {
686 if (chip_help->map.vals[i].host == addr)
687 {
688 return chip_help->map.vals[i].spi;
689 }
690 }
691 return addr;
692}
693
694
695/* The address returned by this function is the start of the
696 window in the address space, that is where we can start
697 accessing data from. If a section of the window at the
698 start is unusable because something else is cluttering up
699 the address map then that is taken into account and this
700 function returns that address justt past that. */
701u16 ChipHelper_WINDOW_ADDRESS(ChipDescript *chip_help,
702 enum chip_helper_window_index window)
703{
704 if (window < CHIP_HELPER_WINDOW_COUNT &&
705 chip_help->windows[window] != NULL)
706 {
707 return chip_help->windows[window]->address + chip_help->windows[window]->blocked;
708 }
709 return 0;
710}
711
712
713/* This returns the size of the window minus any blocked section */
714u16 ChipHelper_WINDOW_SIZE(ChipDescript *chip_help,
715 enum chip_helper_window_index window)
716{
717 if (window < CHIP_HELPER_WINDOW_COUNT &&
718 chip_help->windows[window] != NULL)
719 {
720 return chip_help->windows[window]->size - chip_help->windows[window]->blocked;
721 }
722 return 0;
723}
724
725
726/* Get the register writes we should do to make sure that
727 the chip is running with most clocks on. */
728u32 ChipHelper_ClockStartupSequence(ChipDescript *chip_help,
729 const struct chip_helper_init_values **val)
730{
731 *val = chip_help->init.vals;
732 return chip_help->init.len;
733}
734
735
736/* Get the set of values tat we should write to the chip to perform a reset. */
737u32 ChipHelper_HostResetSequence(ChipDescript *chip_help,
738 const struct chip_helper_reset_values **val)
739{
740 *val = chip_help->reset_prog.vals;
741 return chip_help->reset_prog.len;
742}
743
744
745/* Decode a windowed access to the chip. */
746s32 ChipHelper_DecodeWindow(ChipDescript *chip_help,
747 enum chip_helper_window_index window,
748 enum chip_helper_window_type type,
749 u32 offset,
750 u16 *page, u16 *addr, u32 *len)
751{
752 const struct window_info_t *win;
753 const struct window_shift_info_t *mode;
754 u16 of, pg;
755
756 if (window >= CHIP_HELPER_WINDOW_COUNT)
757 {
758 return FALSE;
759 }
760 if ((win = chip_help->windows[window]) == NULL)
761 {
762 return FALSE;
763 }
764 if (type >= CHIP_HELPER_WT_COUNT)
765 {
766 return FALSE;
767 }
768 if ((mode = &win->mode[type]) == NULL)
769 {
770 return FALSE;
771 }
772 if (!mode->allowed)
773 {
774 return FALSE;
775 }
776
777 pg = (u16)(offset >> mode->page_shift) + mode->page_offset;
778 of = (u16)(offset & ((1 << mode->page_shift) - 1));
779 /* If 'blocked' is zero this does nothing, else decrease
780 the page register and increase the offset until we aren't
781 in the blocked region of the window. */
782 while (of < win->blocked)
783 {
784 of += 1 << mode->page_shift;
785 pg--;
786 }
787 *page = pg;
788 *addr = win->address + of;
789 *len = win->size - of;
790 return TRUE;
791}
792
793
diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper.h b/drivers/staging/csr/csr_wifi_hip_chiphelper.h
deleted file mode 100644
index 09b3aefcbced..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_chiphelper.h
+++ /dev/null
@@ -1,407 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11#ifndef CSR_WIFI_HIP_CHIPHELPER_H__
12#define CSR_WIFI_HIP_CHIPHELPER_H__
13
14
15#include <linux/types.h>
16
17/* The age of the BlueCore chip. This is probably not useful, if
18 you know the age then you can probably work out the version directly. */
19enum chip_helper_bluecore_age
20{
21 chip_helper_bluecore_pre_bc7,
22 chip_helper_bluecore_bc7_or_later
23};
24
25/* We support up to three windowed regions at the moment.
26 Don't reorder these - they're used to index into an array. */
27enum chip_helper_window_index
28{
29 CHIP_HELPER_WINDOW_1 = 0,
30 CHIP_HELPER_WINDOW_2 = 1,
31 CHIP_HELPER_WINDOW_3 = 2,
32 CHIP_HELPER_WINDOW_COUNT = 3
33};
34
35/* These are the things that we can access through a window.
36 Don't reorder these - they're used to index into an array. */
37enum chip_helper_window_type
38{
39 CHIP_HELPER_WT_CODE_RAM = 0,
40 CHIP_HELPER_WT_FLASH = 1,
41 CHIP_HELPER_WT_EXT_SRAM = 2,
42 CHIP_HELPER_WT_ROM = 3,
43 CHIP_HELPER_WT_SHARED = 4,
44 CHIP_HELPER_WT_COUNT = 5
45};
46
47/* Commands to stop and start the XAP */
48enum chip_helper_dbg_emu_cmd_enum
49{
50 CHIP_HELPER_DBG_EMU_CMD_XAP_STEP_MASK = 0x0001,
51 CHIP_HELPER_DBG_EMU_CMD_XAP_RUN_B_MASK = 0x0002,
52 CHIP_HELPER_DBG_EMU_CMD_XAP_BRK_MASK = 0x0004,
53 CHIP_HELPER_DBG_EMU_CMD_XAP_WAKEUP_MASK = 0x0008
54};
55
56/* Bitmasks for Stop and sleep status: DBG_SPI_STOP_STATUS & DBG_HOST_STOP_STATUS */
57enum chip_helper_dbg_stop_status_enum
58{
59 CHIP_HELPER_DBG_STOP_STATUS_NONE_MASK = 0x0000,
60 CHIP_HELPER_DBG_STOP_STATUS_P0_MASK = 0x0001,
61 CHIP_HELPER_DBG_STOP_STATUS_P1_MASK = 0x0002,
62 CHIP_HELPER_DBG_STOP_STATUS_P2_MASK = 0x0004,
63 CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_P0_MASK = 0x0008,
64 CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_P1_MASK = 0x0010,
65 CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_P2_MASK = 0x0020,
66 /* Legacy names/alias */
67 CHIP_HELPER_DBG_STOP_STATUS_MAC_MASK = 0x0001,
68 CHIP_HELPER_DBG_STOP_STATUS_PHY_MASK = 0x0002,
69 CHIP_HELPER_DBG_STOP_STATUS_BT_MASK = 0x0004,
70 CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_MAC_MASK = 0x0008,
71 CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_PHY_MASK = 0x0010,
72 CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_BT_MASK = 0x0020
73};
74
75/* Codes to disable the watchdog */
76enum chip_helper_watchdog_disable_enum
77{
78 CHIP_HELPER_WATCHDOG_DISABLE_CODE1 = 0x6734,
79 CHIP_HELPER_WATCHDOG_DISABLE_CODE2 = 0xD6BF,
80 CHIP_HELPER_WATCHDOG_DISABLE_CODE3 = 0xC31E
81};
82
83/* Other bits have changed between versions */
84enum chip_helper_gbl_misc_enum
85{
86 CHIP_HELPER_GBL_MISC_SPI_STOP_OUT_EN_MASK = 0x0001,
87 CHIP_HELPER_GBL_MISC_MMU_INIT_DONE_MASK = 0x0004
88};
89
90/* Coex status register, contains interrupt status and reset pullup status.
91 * CHIP_HELPER_COEX_STATUS_RST_PULLS_MSB_MASK can be used to check
92 * for WAPI on R03 chips and later. */
93enum chip_helper_coex_status_mask_enum
94{
95 CHIP_HELPER_COEX_STATUS_RST_PULLS_LSB_MASK = 0x0001,
96 CHIP_HELPER_COEX_STATUS_RST_PULLS_MSB_MASK = 0x0008,
97 CHIP_HELPER_COEX_STATUS_WL_FEC_PINS_LSB_MASK = 0x0010,
98 CHIP_HELPER_COEX_STATUS_WL_FEC_PINS_MSB_MASK = 0x0080,
99 CHIP_HELPER_COEX_STATUS_INT_UART_MASK = 0x0100,
100 CHIP_HELPER_COEX_STATUS_INT_BT_LEG_MASK = 0x0200
101};
102
103/* How to select the different CPUs */
104enum chip_helper_dbg_proc_sel_enum
105{
106 CHIP_HELPER_DBG_PROC_SEL_MAC = 0,
107 CHIP_HELPER_DBG_PROC_SEL_PHY = 1,
108 CHIP_HELPER_DBG_PROC_SEL_BT = 2,
109 CHIP_HELPER_DBG_PROC_SEL_NONE = 2,
110 CHIP_HELPER_DBG_PROC_SEL_BOTH = 3
111};
112
113/* These are the only registers that we have to know the
114 address of before we know the chip version. */
115enum chip_helper_fixed_registers
116{
117 /* This is the address of GBL_CHIP_VERISON on BC7,
118 UF105x, UF60xx and
119 anything later than that. */
120 CHIP_HELPER_UNIFI_GBL_CHIP_VERSION = 0xFE81,
121
122 CHIP_HELPER_OLD_BLUECORE_GBL_CHIP_VERSION = 0xFF9A
123
124 /* This isn't used at the moment (but might be needed
125 to distinguish the BlueCore sub version?) */
126 /* CHIP_HELPER_OLD_BLUECORE_ANA_VERSION_ID = 0xFF7D */
127};
128
129/* Address-value pairs for defining initialisation values */
130struct chip_helper_init_values
131{
132 u16 addr;
133 u16 value;
134};
135
136/* A block of data that should be written to the device */
137struct chip_helper_reset_values
138{
139 u32 gp_address;
140 u32 len;
141 const u16 *data;
142};
143
144/*
145 * This is the C API.
146 */
147
148/* opaque type */
149typedef const struct chip_device_desc_t ChipDescript;
150
151/* Return a NULL descriptor */
152ChipDescript* ChipHelper_Null(void);
153
154/* This should get the correct version for any CSR chip.
155 The two parameters are what is read from addresses
156 0xFF9A and 0xFE81 (OLD_BLUECORE_GBL_CHIP_VERSION and
157 UNIFI_GBL_CHIP_VERSION). These should give a unique identity
158 for most (all?) chips.
159
160 FF9A is the old GBL_CHIP_VERSION register. If the high
161 eight bits are zero then the chip is a new (BC7 +) one
162 and FE81 is the _new_ GBL_CHIP_VERSION register. */
163ChipDescript* ChipHelper_GetVersionAny(u16 from_FF9A, u16 from_FE81);
164
165/* The chip is a UniFi, but we don't know which type
166 The parameter is the value of UNIFI_GBL_CHIP_VERSION (0xFE81) */
167ChipDescript* ChipHelper_GetVersionUniFi(u16 version);
168
169/* This gets the version from the SDIO device id. This only
170 gives quite a coarse grained version, so we should update once
171 we hav access to the function N registers. */
172ChipDescript* ChipHelper_GetVersionSdio(u8 sdio_version);
173
174/* The chip is some sort of BlueCore. If "age" is "pre_bc7" then
175 "version" is what was read from FF9A. If "age" is bc7_or_later
176 then "version" is read from FE81. If we don't know if we're pre
177 or post BC7 then we should use "GetVersionAny". */
178ChipDescript* ChipHelper_GetVersionBlueCore(enum chip_helper_bluecore_age age,
179 u16 version);
180
181/* The main functions of this class are built with an X macro. This
182 means we can generate the C and C++ versions from the same source
183 without the two diverging.
184
185 The DEF0 functions are simple and take no parameters. The first
186 parameter to the macro is the return type. The second parameter
187 is the function name and the third parameter is where to get the
188 info from (this is hidden from the user).
189
190 The DEF1 functions take one parameter. This time the third macro
191 parameter is the type of this parameter, and the fourth macro
192 parameter is the name of the parameter. The bodies of these
193 functions are hand written. */
194#define CHIP_HELPER_LIST(m) \
195 CHIP_HELPER_DEF0(m, (const char *, FriendlyName, friendly_name)) \
196 CHIP_HELPER_DEF0(m, (const char *, MarketingName, marketing_name)) \
197 CHIP_HELPER_DEF0(m, (u16, DBG_EMU_CMD, regs->dbg_emu_cmd)) \
198 CHIP_HELPER_DEF0(m, (u16, DBG_HOST_PROC_SELECT, regs->host.dbg_proc_select)) \
199 CHIP_HELPER_DEF0(m, (u16, DBG_HOST_STOP_STATUS, regs->host.dbg_stop_status)) \
200 CHIP_HELPER_DEF0(m, (u16, HOST_WINDOW1_PAGE, regs->host.window1_page)) \
201 CHIP_HELPER_DEF0(m, (u16, HOST_WINDOW2_PAGE, regs->host.window2_page)) \
202 CHIP_HELPER_DEF0(m, (u16, HOST_WINDOW3_PAGE, regs->host.window3_page)) \
203 CHIP_HELPER_DEF0(m, (u16, HOST_IO_LOG_ADDR, regs->host.io_log_addr)) \
204 CHIP_HELPER_DEF0(m, (u16, DBG_SPI_PROC_SELECT, regs->spi.dbg_proc_select)) \
205 CHIP_HELPER_DEF0(m, (u16, DBG_SPI_STOP_STATUS, regs->spi.dbg_stop_status)) \
206 CHIP_HELPER_DEF0(m, (u16, SPI_WINDOW1_PAGE, regs->spi.window1_page)) \
207 CHIP_HELPER_DEF0(m, (u16, SPI_WINDOW2_PAGE, regs->spi.window2_page)) \
208 CHIP_HELPER_DEF0(m, (u16, SPI_WINDOW3_PAGE, regs->spi.window3_page)) \
209 CHIP_HELPER_DEF0(m, (u16, SPI_IO_LOG_ADDR, regs->spi.io_log_addr)) \
210 CHIP_HELPER_DEF0(m, (u16, DBG_RESET, regs->dbg_reset)) \
211 CHIP_HELPER_DEF0(m, (u16, DBG_RESET_VALUE, regs->dbg_reset_value)) \
212 CHIP_HELPER_DEF0(m, (u16, DBG_RESET_WARN, regs->dbg_reset_warn)) \
213 CHIP_HELPER_DEF0(m, (u16, DBG_RESET_WARN_VALUE, regs->dbg_reset_warn_value)) \
214 CHIP_HELPER_DEF0(m, (u16, DBG_RESET_RESULT, regs->dbg_reset_result)) \
215 CHIP_HELPER_DEF0(m, (u16, WATCHDOG_DISABLE, regs->watchdog_disable)) \
216 CHIP_HELPER_DEF0(m, (u16, PROC_PC_SNOOP, regs->proc_pc_snoop)) \
217 CHIP_HELPER_DEF0(m, (u16, GBL_CHIP_VERSION, regs->gbl_chip_version)) \
218 CHIP_HELPER_DEF0(m, (u16, GBL_MISC_ENABLES, regs->gbl_misc_enables)) \
219 CHIP_HELPER_DEF0(m, (u16, XAP_PCH, regs->xap_pch)) \
220 CHIP_HELPER_DEF0(m, (u16, XAP_PCL, regs->xap_pcl)) \
221 CHIP_HELPER_DEF0(m, (u16, MAILBOX0, regs->mailbox0)) \
222 CHIP_HELPER_DEF0(m, (u16, MAILBOX1, regs->mailbox1)) \
223 CHIP_HELPER_DEF0(m, (u16, MAILBOX2, regs->mailbox2)) \
224 CHIP_HELPER_DEF0(m, (u16, MAILBOX3, regs->mailbox3)) \
225 CHIP_HELPER_DEF0(m, (u16, SDIO_HIP_HANDSHAKE, regs->sdio_hip_handshake)) \
226 CHIP_HELPER_DEF0(m, (u16, SDIO_HOST_INT, regs->sdio_host_int)) \
227 CHIP_HELPER_DEF0(m, (u16, COEX_STATUS, regs->coex_status)) \
228 CHIP_HELPER_DEF0(m, (u16, SHARED_IO_INTERRUPT, regs->shared_io_interrupt)) \
229 CHIP_HELPER_DEF0(m, (u32, PROGRAM_MEMORY_RAM_OFFSET, prog_offset.ram)) \
230 CHIP_HELPER_DEF0(m, (u32, PROGRAM_MEMORY_ROM_OFFSET, prog_offset.rom)) \
231 CHIP_HELPER_DEF0(m, (u32, PROGRAM_MEMORY_FLASH_OFFSET, prog_offset.flash)) \
232 CHIP_HELPER_DEF0(m, (u32, PROGRAM_MEMORY_EXT_SRAM_OFFSET, prog_offset.ext_sram)) \
233 CHIP_HELPER_DEF0(m, (u16, DATA_MEMORY_RAM_OFFSET, data_offset.ram)) \
234 CHIP_HELPER_DEF0(m, (s32, HasFlash, bools.has_flash)) \
235 CHIP_HELPER_DEF0(m, (s32, HasExtSram, bools.has_ext_sram)) \
236 CHIP_HELPER_DEF0(m, (s32, HasRom, bools.has_rom)) \
237 CHIP_HELPER_DEF0(m, (s32, HasBt, bools.has_bt)) \
238 CHIP_HELPER_DEF0(m, (s32, HasWLan, bools.has_wlan)) \
239 CHIP_HELPER_DEF1(m, (u16, WINDOW_ADDRESS, enum chip_helper_window_index, window)) \
240 CHIP_HELPER_DEF1(m, (u16, WINDOW_SIZE, enum chip_helper_window_index, window)) \
241 CHIP_HELPER_DEF1(m, (u16, MapAddress_SPI2HOST, u16, addr)) \
242 CHIP_HELPER_DEF1(m, (u16, MapAddress_HOST2SPI, u16, addr)) \
243 CHIP_HELPER_DEF1(m, (u32, ClockStartupSequence, const struct chip_helper_init_values **, val)) \
244 CHIP_HELPER_DEF1(m, (u32, HostResetSequence, const struct chip_helper_reset_values **, val))
245
246/* Some magic to help the expansion */
247#define CHIP_HELPER_DEF0(a, b) \
248 CHIP_HELPER_DEF0_ ## a b
249#define CHIP_HELPER_DEF1(a, b) \
250 CHIP_HELPER_DEF1_ ## a b
251
252/* Macros so that when we expand the list we get "C" function prototypes. */
253#define CHIP_HELPER_DEF0_C_DEC(ret_type, name, info) \
254 ret_type ChipHelper_ ## name(ChipDescript * chip_help);
255#define CHIP_HELPER_DEF1_C_DEC(ret_type, name, type1, name1) \
256 ret_type ChipHelper_ ## name(ChipDescript * chip_help, type1 name1);
257
258CHIP_HELPER_LIST(C_DEC)
259
260/* FriendlyName
261 MarketingName
262
263 These two functions return human readable strings that describe
264 the chip. FriendlyName returns something that a software engineer
265 at CSR might understand. MarketingName returns something more like
266 an external name for a CSR chip.
267*/
268/* DBG_EMU_CMD
269 WATCHDOG_DISABLE
270 PROC_PC_SNOOP
271 GBL_CHIP_VERSION
272 XAP_PCH
273 XAP_PCL
274
275 These registers are used to control the XAPs.
276*/
277/* DBG_HOST_PROC_SELECT DBG_HOST_STOP_STATUS
278 HOST_WINDOW1_PAGE HOST_WINDOW2_PAGE HOST_WINDOW3_PAGE
279 HOST_IO_LOG_ADDR
280 DBG_SPI_PROC_SELECT DBG_SPI_STOP_STATUS
281 SPI_WINDOW1_PAGE SPI_WINDOW2_PAGE SPI_WINDOW3_PAGE
282 SPI_IO_LOG_ADDR
283
284 These register are used to control the XAPs and the memory
285 windows, normally while debugging the code on chip. There
286 are two versons of these registers, one for access via SPI
287 and another for access via the host interface.
288*/
289/* DBG_RESET
290 DBG_RESET_VALUE
291 DBG_RESET_WARN
292 DBG_RESET_WARN_VALUE
293 DBG_RESET_RESULT
294
295 These registers are used to reset the XAP. This can be
296 quite complex for some chips. If DBG_RESET_WARN is non
297 zero the DBG_RESET_WARN_VALUE should be written to address
298 DBG_RESET_WARN before the reset is perfeormed. DBG_RESET_VALUE
299 should then be written to DBG_RESET to make the reset happen.
300 The DBG_RESET_RESULT register should contain 0 if the reset
301 was successful.
302*/
303/* GBL_MISC_ENABLES
304
305 This register controls some special chip features. It
306 should be used with care is it changes quite a lot between
307 chip versions.
308*/
309/* MAILBOX0
310 MAILBOX1
311 MAILBOX2
312 MAILBOX3
313
314 The mailbox registers are for communication between the host
315 and the firmware. There use is described in part by the host
316 interface protcol specifcation.
317*/
318/* SDIO_HIP_HANDSHAKE
319
320 This is one of the more important SDIO HIP registers. On some
321 chips it has the same value as one of the mailbox registers
322 and on other chips it is different.
323*/
324/* SDIO_HOST_INT
325 SHARED_IO_INTERRUPT
326
327 These registers are used by some versions of the host interface
328 protocol specification. Their names should probably be changed
329 to hide the registers and to expose the functions more.
330*/
331/* COEX_STATUS
332
333 Coex status register, contains interrupt status and reset
334 pullup status. The latter is used to detect WAPI.
335*/
336/* PROGRAM_MEMORY_RAM_OFFSET
337 PROGRAM_MEMORY_ROM_OFFSET
338 PROGRAM_MEMORY_FLASH_OFFSET
339 PROGRAM_MEMORY_EXT_SRAM_OFFSET
340 DATA_MEMORY_RAM_OFFSET
341
342 These are constants that describe the offset of the different
343 memory types in the two different address spaces.
344*/
345/* HasFlash HasExtSram HasRom
346 HasBt HasWLan
347
348 These are a set of bools describing the chip.
349*/
350/* WINDOW_ADDRESS WINDOW_SIZE
351
352 These two functions return the size and address of the windows.
353 The address is the address of the lowest value in the address
354 map that is part of the window and the size is the number of
355 visible words.
356
357 Some of the windows have their lowest portion covered by
358 registers. For these windows address is the first address
359 after the registers and size is the siave excluding the part
360 covered by registers.
361*/
362/* MapAddress_SPI2HOST
363 MapAddress_HOST2SPI
364
365 The debugging interface is duplicated on UniFi and later chips
366 so that there are two versions - one over the SPI interaface and
367 the other over the SDIO interface. These functions map the
368 registers between these two interfaces.
369*/
370/* ClockStartupSequence
371
372 This function returns the list of register value pairs that
373 should be forced into UniFi to enable SPI communication. This
374 set of registers is not needed if the firmware is running, but
375 will be needed if the device is being booted from cold. These
376 register writes enable the clocks and setup the PLL to a basic
377 working state. SPI access might be unreliable until these writes
378 have occurred (And they may take mulitple goes).
379*/
380/* HostResetSequence
381
382 This returns a number of chunks of data and generic pointers.
383 All of the XAPs should be stopped. The data should be written
384 to the generic pointers. The instruction pointer for the MAC
385 should then be set to the start of program memory and then the
386 MAC should be "go"d. This will reset the chip in a reliable
387 and orderly manner without resetting the SDIO interface. It
388 is therefore not needed if the chip is being accessed by the
389 SPI interface (the DBG_RESET_ mechanism can be used instead).
390*/
391
392/* The Decode Window function is more complex. For the window
393 'window' it tries to return the address and page register
394 value needed to see offset 'offset' of memory type 'type'.
395
396 It return 1 on success and 0 on failure. 'page' is what
397 should be written to the page register. 'addr' is the
398 address in the XAPs 16 address map to read from. 'len'
399 is the length that we can read without having to change
400 the page registers. */
401s32 ChipHelper_DecodeWindow(ChipDescript *chip_help,
402 enum chip_helper_window_index window,
403 enum chip_helper_window_type type,
404 u32 offset,
405 u16 *page, u16 *addr, u32 *len);
406
407#endif
diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h b/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h
deleted file mode 100644
index e5e579912550..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_chiphelper_private.h
+++ /dev/null
@@ -1,200 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11#ifndef CSR_WIFI_HIP_CHIPHELPER_PRIVATE_H__
12#define CSR_WIFI_HIP_CHIPHELPER_PRIVATE_H__
13
14
15#include "csr_wifi_hip_chiphelper.h"
16
17/* This GP stuff should be somewhere else? */
18
19/* Memory spaces encoded in top byte of Generic Pointer type */
20#define UNIFI_SH_DMEM 0x01 /* Shared Data Memory */
21#define UNIFI_EXT_FLASH 0x02 /* External FLASH */
22#define UNIFI_EXT_SRAM 0x03 /* External SRAM */
23#define UNIFI_REGISTERS 0x04 /* Registers */
24#define UNIFI_PHY_DMEM 0x10 /* PHY Data Memory */
25#define UNIFI_PHY_PMEM 0x11 /* PHY Program Memory */
26#define UNIFI_PHY_ROM 0x12 /* PHY ROM */
27#define UNIFI_MAC_DMEM 0x20 /* MAC Data Memory */
28#define UNIFI_MAC_PMEM 0x21 /* MAC Program Memory */
29#define UNIFI_MAC_ROM 0x22 /* MAC ROM */
30#define UNIFI_BT_DMEM 0x30 /* BT Data Memory */
31#define UNIFI_BT_PMEM 0x31 /* BT Program Memory */
32#define UNIFI_BT_ROM 0x32 /* BT ROM */
33
34#define MAKE_GP(R, O) (((UNIFI_ ## R) << 24) | (O))
35#define GP_OFFSET(GP) ((GP) & 0xFFFFFF)
36#define GP_SPACE(GP) (((GP) >> 24) & 0xFF)
37
38
39/* Address value pairs */
40struct val_array_t
41{
42 u32 len;
43 const struct chip_helper_init_values *vals;
44};
45
46/* Just a (counted) u16 array */
47struct data_array_t
48{
49 u32 len;
50 const u16 *vals;
51};
52
53struct reset_prog_t
54{
55 u32 len;
56 const struct chip_helper_reset_values *vals;
57};
58
59/* The addresses of registers that are equivalent but on
60 different host transports. */
61struct chip_map_address_t
62{
63 u16 spi, host;
64};
65
66struct map_array_t
67{
68 u32 len;
69 const struct chip_map_address_t *vals;
70};
71
72struct chip_device_regs_per_transport_t
73{
74 u16 dbg_proc_select;
75 u16 dbg_stop_status;
76 u16 window1_page; /* PROG_PMEM1 or GW1 */
77 u16 window2_page; /* PROG_PMEM2 or GW2 */
78 u16 window3_page; /* SHARED or GW3 */
79 u16 io_log_addr;
80};
81
82struct chip_device_regs_t
83{
84 u16 gbl_chip_version;
85 u16 gbl_misc_enables;
86 u16 dbg_emu_cmd;
87 struct chip_device_regs_per_transport_t host;
88 struct chip_device_regs_per_transport_t spi;
89 u16 dbg_reset;
90 u16 dbg_reset_value;
91 u16 dbg_reset_warn;
92 u16 dbg_reset_warn_value;
93 u16 dbg_reset_result;
94 u16 xap_pch;
95 u16 xap_pcl;
96 u16 proc_pc_snoop;
97 u16 watchdog_disable;
98 u16 mailbox0;
99 u16 mailbox1;
100 u16 mailbox2;
101 u16 mailbox3;
102 u16 sdio_host_int;
103 u16 shared_io_interrupt;
104 u16 sdio_hip_handshake;
105 u16 coex_status; /* Allows WAPI detection */
106};
107
108/* If allowed is false then this window does not provide this
109 type of access.
110 This describes how addresses should be shifted to make the
111 "page" address. The address is shifted left by 'page_shift'
112 and then has 'page_offset' added. This value should then be
113 written to the page register. */
114struct window_shift_info_t
115{
116 s32 allowed;
117 u32 page_shift;
118 u16 page_offset;
119};
120
121/* Each window has an address and size. These are obvious. It then
122 has a description for each type of memory that might be accessed
123 through it. There might also be a start to the offset of the window.
124 This means that that number of addresses at the start of the window
125 are unusable. */
126struct window_info_t
127{
128 u16 address;
129 u16 size;
130 u16 blocked;
131 const struct window_shift_info_t *mode;
132};
133
134/* If GBL_CHIP_VERSION and'ed with 'mask' and is equal to 'result'
135 then this is the correct set of info. If pre_bc7 is true then the
136 address of GBL_CHIP_VERSION is FF9A, else its FE81. */
137struct chip_version_t
138{
139 s32 pre_bc7;
140 u16 mask;
141 u16 result;
142 u8 sdio;
143};
144
145struct chip_device_desc_t
146{
147 struct chip_version_t chip_version;
148
149 /* This is a text string that a human might find useful (BC02, UF105x) */
150 const char *friendly_name;
151 /* This is what we show to customers */
152 const char *marketing_name;
153
154 /* Initialisation values to write following a reset */
155 struct val_array_t init;
156
157 /* Binary sequence for hard reset */
158 struct reset_prog_t reset_prog;
159
160 /* The register map */
161 const struct chip_device_regs_t *regs;
162
163 /* Some misc. info on the chip */
164 struct
165 {
166 u32 has_flash : 1;
167 u32 has_ext_sram : 1;
168 u32 has_rom : 1;
169 u32 has_bt : 1;
170 u32 has_wlan : 1;
171 } bools;
172
173 /* This table is used to remap register addresses depending on what
174 host interface is used. On the BC7 and later chips there are
175 multiple sets of memory window registers, on for each host
176 interafce (SDIO / SPI). The correct one is needed. */
177 struct map_array_t map;
178
179 /* The offsets into the program address space of the different types of memory.
180 The RAM offset is probably the most useful. */
181 struct
182 {
183 u32 ram;
184 u32 rom;
185 u32 flash;
186 u32 ext_sram;
187 } prog_offset;
188
189 /* The offsets into the data address space of interesting things. */
190 struct
191 {
192 u16 ram;
193 /* maybe add shared / page tables? */
194 } data_offset;
195
196 /* Information on the different windows */
197 const struct window_info_t *windows[CHIP_HELPER_WINDOW_COUNT];
198};
199
200#endif /* CSR_WIFI_HIP_CHIPHELPER_PRIVATE_H__ */
diff --git a/drivers/staging/csr/csr_wifi_hip_conversions.h b/drivers/staging/csr/csr_wifi_hip_conversions.h
deleted file mode 100644
index bf7a52e82995..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_conversions.h
+++ /dev/null
@@ -1,73 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/*
12 * ---------------------------------------------------------------------------
13 *
14 * FILE: csr_wifi_hip_conversions.h
15 *
16 * PURPOSE:
17 * This header file provides the macros for converting to and from
18 * wire format.
19 * These macros *MUST* work for little-endian AND big-endian hosts.
20 *
21 * ---------------------------------------------------------------------------
22 */
23#ifndef __CSR_WIFI_HIP_CONVERSIONS_H__
24#define __CSR_WIFI_HIP_CONVERSIONS_H__
25
26#define SIZEOF_UINT16 2
27#define SIZEOF_UINT32 4
28#define SIZEOF_UINT64 8
29
30#define SIZEOF_SIGNAL_HEADER 6
31#define SIZEOF_DATAREF 4
32
33
34/*
35 * Macro to retrieve the signal ID from a wire-format signal.
36 */
37#define GET_SIGNAL_ID(_buf) CSR_GET_UINT16_FROM_LITTLE_ENDIAN((_buf))
38
39/*
40 * Macros to retrieve and set the DATAREF fields in a packed (i.e. wire-format)
41 * HIP signal.
42 */
43#define GET_PACKED_DATAREF_SLOT(_buf, _ref) \
44 CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 0))
45
46#define GET_PACKED_DATAREF_LEN(_buf, _ref) \
47 CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 2))
48
49#define SET_PACKED_DATAREF_SLOT(_buf, _ref, _slot) \
50 CSR_COPY_UINT16_TO_LITTLE_ENDIAN((_slot), ((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 0))
51
52#define SET_PACKED_DATAREF_LEN(_buf, _ref, _len) \
53 CSR_COPY_UINT16_TO_LITTLE_ENDIAN((_len), ((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 2))
54
55#define GET_PACKED_MA_PACKET_REQUEST_FRAME_PRIORITY(_buf) \
56 CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 8))
57
58#define GET_PACKED_MA_PACKET_REQUEST_HOST_TAG(_buf) \
59 CSR_GET_UINT32_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 4))
60
61#define GET_PACKED_MA_PACKET_CONFIRM_HOST_TAG(_buf) \
62 CSR_GET_UINT32_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 8))
63
64#define GET_PACKED_MA_PACKET_CONFIRM_TRANSMISSION_STATUS(_buf) \
65 CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 2))
66
67
68s32 get_packed_struct_size(const u8 *buf);
69CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig);
70CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len);
71
72#endif /* __CSR_WIFI_HIP_CONVERSIONS_H__ */
73
diff --git a/drivers/staging/csr/csr_wifi_hip_download.c b/drivers/staging/csr/csr_wifi_hip_download.c
deleted file mode 100644
index 2f44a383d2cf..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_download.c
+++ /dev/null
@@ -1,819 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/*
12 * ---------------------------------------------------------------------------
13 * FILE: csr_wifi_hip_download.c
14 *
15 * PURPOSE:
16 * Routines for downloading firmware to UniFi.
17 *
18 * ---------------------------------------------------------------------------
19 */
20#include <linux/slab.h>
21#include "csr_wifi_hip_unifi.h"
22#include "csr_wifi_hip_unifiversion.h"
23#include "csr_wifi_hip_card.h"
24#include "csr_wifi_hip_xbv.h"
25
26#undef CSR_WIFI_IGNORE_PATCH_VERSION_MISMATCH
27
28static CsrResult do_patch_download(card_t *card, void *dlpriv,
29 xbv1_t *pfwinfo, u32 boot_ctrl_addr);
30
31static CsrResult do_patch_convert_download(card_t *card,
32 void *dlpriv, xbv1_t *pfwinfo);
33
34/*
35 * ---------------------------------------------------------------------------
36 * _find_in_slut
37 *
38 * Find the offset of the appropriate object in the SLUT of a card
39 *
40 * Arguments:
41 * card Pointer to card struct
42 * psym Pointer to symbol object.
43 * id set up by caller
44 * obj will be set up by this function
45 * pslut Pointer to SLUT address, if 0xffffffff then it must be
46 * read from the chip.
47 * Returns:
48 * CSR_RESULT_SUCCESS on success
49 * Non-zero on error,
50 * CSR_WIFI_HIP_RESULT_NOT_FOUND if not found
51 * ---------------------------------------------------------------------------
52 */
53static CsrResult _find_in_slut(card_t *card, symbol_t *psym, u32 *pslut)
54{
55 u32 slut_address;
56 u16 finger_print;
57 CsrResult r;
58 CsrResult csrResult;
59
60 /* Get SLUT address */
61 if (*pslut == 0xffffffff)
62 {
63 r = card_wait_for_firmware_to_start(card, &slut_address);
64 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
65 {
66 return r;
67 }
68 if (r != CSR_RESULT_SUCCESS)
69 {
70 unifi_error(card->ospriv, "Firmware hasn't started\n");
71 return r;
72 }
73 *pslut = slut_address;
74
75 /*
76 * Firmware has started so set the SDIO bus clock to the initial speed,
77 * faster than UNIFI_SDIO_CLOCK_SAFE_HZ, to speed up the f/w download.
78 */
79 csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_INIT_HZ);
80 if (csrResult != CSR_RESULT_SUCCESS)
81 {
82 r = ConvertCsrSdioToCsrHipResult(card, csrResult);
83 return r;
84 }
85 card->sdio_clock_speed = UNIFI_SDIO_CLOCK_INIT_HZ;
86 }
87 else
88 {
89 slut_address = *pslut; /* Use previously discovered address */
90 }
91 unifi_trace(card->ospriv, UDBG4, "SLUT addr: 0x%lX\n", slut_address);
92
93 /*
94 * Check the SLUT fingerprint.
95 * The slut_address is a generic pointer so we must use unifi_card_read16().
96 */
97 unifi_trace(card->ospriv, UDBG4, "Looking for SLUT finger print\n");
98 finger_print = 0;
99 r = unifi_card_read16(card, slut_address, &finger_print);
100 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
101 {
102 return r;
103 }
104 if (r != CSR_RESULT_SUCCESS)
105 {
106 unifi_error(card->ospriv, "Failed to read SLUT finger print\n");
107 return r;
108 }
109
110 if (finger_print != SLUT_FINGERPRINT)
111 {
112 unifi_error(card->ospriv, "Failed to find SLUT fingerprint\n");
113 return CSR_RESULT_FAILURE;
114 }
115
116 /* Symbol table starts imedately after the fingerprint */
117 slut_address += 2;
118
119 while (1)
120 {
121 u16 id;
122 u32 obj;
123
124 r = unifi_card_read16(card, slut_address, &id);
125 if (r != CSR_RESULT_SUCCESS)
126 {
127 return r;
128 }
129 slut_address += 2;
130
131 if (id == CSR_SLT_END)
132 {
133 /* End of table reached: not found */
134 r = CSR_WIFI_HIP_RESULT_RANGE;
135 break;
136 }
137
138 r = unifi_read32(card, slut_address, &obj);
139 if (r != CSR_RESULT_SUCCESS)
140 {
141 return r;
142 }
143 slut_address += 4;
144
145 unifi_trace(card->ospriv, UDBG3, " found SLUT id %02d.%08lx\n", id, obj);
146
147 r = CSR_WIFI_HIP_RESULT_NOT_FOUND;
148 /* Found search term? */
149 if (id == psym->id)
150 {
151 unifi_trace(card->ospriv, UDBG1, " matched SLUT id %02d.%08lx\n", id, obj);
152 psym->obj = obj;
153 r = CSR_RESULT_SUCCESS;
154 break;
155 }
156 }
157
158 return r;
159}
160
161
162/*
163 * ---------------------------------------------------------------------------
164 * do_patch_convert_download
165 *
166 * Download the given firmware image to the UniFi, converting from FWDL
167 * to PTDL XBV format.
168 *
169 * Arguments:
170 * card Pointer to card struct
171 * dlpriv Pointer to source firmware image
172 * fwinfo Pointer to source firmware info struct
173 *
174 * Returns:
175 * CSR_RESULT_SUCCESS on success, CSR error code on error
176 *
177 * Notes:
178 * ---------------------------------------------------------------------------
179 */
180static CsrResult do_patch_convert_download(card_t *card, void *dlpriv, xbv1_t *pfwinfo)
181{
182 CsrResult r;
183 u32 slut_base = 0xffffffff;
184 void *pfw;
185 u32 psize;
186 symbol_t sym;
187
188 /* Reset the chip to guarantee that the ROM loader is running */
189 r = unifi_init(card);
190 if (r != CSR_RESULT_SUCCESS)
191 {
192 unifi_error(card->ospriv,
193 "do_patch_convert_download: failed to re-init UniFi\n");
194 return r;
195 }
196
197 /* If no unifi_helper is running, the firmware version must be read */
198 if (card->build_id == 0)
199 {
200 u32 ver = 0;
201 sym.id = CSR_SLT_BUILD_ID_NUMBER;
202 sym.obj = 0; /* To be updated by _find_in_slut() */
203
204 unifi_trace(card->ospriv, UDBG1, "Need f/w version\n");
205
206 /* Find chip build id entry in SLUT */
207 r = _find_in_slut(card, &sym, &slut_base);
208 if (r != CSR_RESULT_SUCCESS)
209 {
210 unifi_error(card->ospriv, "Failed to find CSR_SLT_BUILD_ID_NUMBER\n");
211 return CSR_RESULT_FAILURE;
212 }
213
214 /* Read running f/w version */
215 r = unifi_read32(card, sym.obj, &ver);
216 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
217 {
218 return r;
219 }
220 if (r != CSR_RESULT_SUCCESS)
221 {
222 unifi_error(card->ospriv, "Failed to read f/w id\n");
223 return CSR_RESULT_FAILURE;
224 }
225 card->build_id = ver;
226 }
227
228 /* Convert the ptest firmware to a patch against the running firmware */
229 pfw = xbv_to_patch(card, unifi_fw_read, dlpriv, pfwinfo, &psize);
230 if (!pfw)
231 {
232 unifi_error(card->ospriv, "Failed to convert f/w to patch");
233 return CSR_WIFI_HIP_RESULT_NO_MEMORY;
234 }
235 else
236 {
237 void *desc;
238 sym.id = CSR_SLT_BOOT_LOADER_CONTROL;
239 sym.obj = 0; /* To be updated by _find_in_slut() */
240
241 /* Find boot loader control entry in SLUT */
242 r = _find_in_slut(card, &sym, &slut_base);
243 if (r != CSR_RESULT_SUCCESS)
244 {
245 unifi_error(card->ospriv, "Failed to find BOOT_LOADER_CONTROL\n");
246 kfree(pfw);
247 return CSR_RESULT_FAILURE;
248 }
249
250 r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE);
251 if (r != CSR_RESULT_SUCCESS)
252 {
253 unifi_error(card->ospriv, "Failed to wake UniFi\n");
254 }
255
256 /* Get a dlpriv for the patch buffer so that unifi_fw_read() can
257 * access it.
258 */
259 desc = unifi_fw_open_buffer(card->ospriv, pfw, psize);
260 if (!desc)
261 {
262 kfree(pfw);
263 return CSR_WIFI_HIP_RESULT_NO_MEMORY;
264 }
265
266 /* Download the patch */
267 unifi_info(card->ospriv, "Downloading converted f/w as patch\n");
268 r = unifi_dl_patch(card, desc, sym.obj);
269 kfree(pfw);
270 unifi_fw_close_buffer(card->ospriv, desc);
271
272 if (r != CSR_RESULT_SUCCESS)
273 {
274 unifi_error(card->ospriv, "Converted patch download failed\n");
275 return r;
276 }
277 else
278 {
279 unifi_trace(card->ospriv, UDBG1, "Converted patch downloaded\n");
280 }
281
282 /* This command starts the firmware */
283 r = unifi_do_loader_op(card, sym.obj + 6, UNIFI_BOOT_LOADER_RESTART);
284 if (r != CSR_RESULT_SUCCESS)
285 {
286 unifi_error(card->ospriv, "Failed to write loader restart cmd\n");
287 }
288
289 return r;
290 }
291}
292
293
294/*
295 * ---------------------------------------------------------------------------
296 * unifi_dl_firmware
297 *
298 * Download the given firmware image to the UniFi.
299 *
300 * Arguments:
301 * card Pointer to card struct
302 * dlpriv A context pointer from the calling function to be
303 * passed when calling unifi_fw_read().
304 *
305 * Returns:
306 * CSR_RESULT_SUCCESS on success,
307 * CSR_WIFI_HIP_RESULT_NO_MEMORY memory allocation failed
308 * CSR_WIFI_HIP_RESULT_INVALID_VALUE error in XBV file
309 * CSR_RESULT_FAILURE SDIO error
310 *
311 * Notes:
312 * Stops and resets the chip, does the download and runs the new
313 * firmware.
314 * ---------------------------------------------------------------------------
315 */
316CsrResult unifi_dl_firmware(card_t *card, void *dlpriv)
317{
318 xbv1_t *fwinfo;
319 CsrResult r;
320
321 fwinfo = kmalloc(sizeof(xbv1_t), GFP_KERNEL);
322 if (fwinfo == NULL)
323 {
324 unifi_error(card->ospriv, "Failed to allocate memory for firmware\n");
325 return CSR_WIFI_HIP_RESULT_NO_MEMORY;
326 }
327
328 /*
329 * Scan the firmware file to find the TLVs we are interested in.
330 * These are:
331 * - check we support the file format version in VERF
332 * - SLTP Symbol Lookup Table Pointer
333 * - FWDL firmware download segments
334 * - FWOV firmware overlay segment
335 * - VMEQ Register probe tests to verify matching h/w
336 */
337 r = xbv1_parse(card, unifi_fw_read, dlpriv, fwinfo);
338 if (r != CSR_RESULT_SUCCESS || fwinfo->mode != xbv_firmware)
339 {
340 unifi_error(card->ospriv, "File type is %s, expected firmware.\n",
341 fwinfo->mode == xbv_patch?"patch" : "unknown");
342 kfree(fwinfo);
343 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
344 }
345
346 /* UF6xxx doesn't accept firmware, only patches. Therefore we convert
347 * the file to patch format with version numbers matching the current
348 * running firmware, and then download via the patch mechanism.
349 * The sole purpose of this is to support production test firmware across
350 * different ROM releases, the test firmware being provided in non-patch
351 * format.
352 */
353 if (card->chip_id > SDIO_CARD_ID_UNIFI_2)
354 {
355 unifi_info(card->ospriv, "Must convert f/w to patch format\n");
356 r = do_patch_convert_download(card, dlpriv, fwinfo);
357 }
358 else
359 {
360 /* Older UniFi chips allowed firmware to be directly loaded onto the
361 * chip, which is no longer supported.
362 */
363 unifi_error(card->ospriv, "Only patch downloading supported\n");
364 r = CSR_WIFI_HIP_RESULT_INVALID_VALUE;
365 }
366
367 kfree(fwinfo);
368 return r;
369} /* unifi_dl_firmware() */
370
371
372/*
373 * ---------------------------------------------------------------------------
374 * unifi_dl_patch
375 *
376 * Load the given patch set into UniFi.
377 *
378 * Arguments:
379 * card Pointer to card struct
380 * dlpriv The os specific handle to the firmware file.
381 * boot_ctrl The address of the boot loader control structure.
382 *
383 * Returns:
384 * CSR_RESULT_SUCCESS on success,
385 * CSR_WIFI_HIP_RESULT_NO_MEMORY memory allocation failed
386 * CSR_WIFI_HIP_RESULT_INVALID_VALUE error in XBV file
387 * CSR_RESULT_FAILURE SDIO error
388 *
389 * Notes:
390 * This ends up telling UniFi to restart.
391 * ---------------------------------------------------------------------------
392 */
393CsrResult unifi_dl_patch(card_t *card, void *dlpriv, u32 boot_ctrl)
394{
395 xbv1_t *fwinfo;
396 CsrResult r;
397
398 unifi_info(card->ospriv, "unifi_dl_patch %p %08x\n", dlpriv, boot_ctrl);
399
400 fwinfo = kmalloc(sizeof(xbv1_t), GFP_KERNEL);
401 if (fwinfo == NULL)
402 {
403 unifi_error(card->ospriv, "Failed to allocate memory for patches\n");
404 return CSR_WIFI_HIP_RESULT_NO_MEMORY;
405 }
406
407 /*
408 * Scan the firmware file to find the TLVs we are interested in.
409 * These are:
410 * - check we support the file format version in VERF
411 * - FWID The build ID of the ROM that we can patch
412 * - PTDL patch download segments
413 */
414 r = xbv1_parse(card, unifi_fw_read, dlpriv, fwinfo);
415 if (r != CSR_RESULT_SUCCESS || fwinfo->mode != xbv_patch)
416 {
417 kfree(fwinfo);
418 unifi_error(card->ospriv, "Failed to read in patch file\n");
419 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
420 }
421
422 /*
423 * We have to check the build id read from the SLUT against that
424 * for the patch file. They have to match exactly.
425 * "card->build_id" == XBV1.PTCH.FWID
426 */
427 if (card->build_id != fwinfo->build_id)
428 {
429 unifi_error(card->ospriv, "Wrong patch file for chip (chip = %lu, file = %lu)\n",
430 card->build_id, fwinfo->build_id);
431 kfree(fwinfo);
432#ifndef CSR_WIFI_IGNORE_PATCH_VERSION_MISMATCH
433 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
434#else
435 fwinfo = NULL;
436 dlpriv = NULL;
437 return CSR_RESULT_SUCCESS;
438#endif
439 }
440
441 r = do_patch_download(card, dlpriv, fwinfo, boot_ctrl);
442 if (r != CSR_RESULT_SUCCESS)
443 {
444 unifi_error(card->ospriv, "Failed to patch image\n");
445 }
446
447 kfree(fwinfo);
448
449 return r;
450} /* unifi_dl_patch() */
451
452
453void* unifi_dl_fw_read_start(card_t *card, s8 is_fw)
454{
455 card_info_t card_info;
456
457 unifi_card_info(card, &card_info);
458 unifi_trace(card->ospriv, UDBG5,
459 "id=%d, ver=0x%x, fw_build=%u, fw_hip=0x%x, block_size=%d\n",
460 card_info.chip_id, card_info.chip_version,
461 card_info.fw_build, card_info.fw_hip_version,
462 card_info.sdio_block_size);
463
464 return unifi_fw_read_start(card->ospriv, is_fw, &card_info);
465}
466
467
468/*
469 * ---------------------------------------------------------------------------
470 * safe_read_shared_location
471 *
472 * Read a shared memory location repeatedly until we get two readings
473 * the same.
474 *
475 * Arguments:
476 * card Pointer to card context struct.
477 * unifi_addr UniFi shared-data-memory address to access.
478 * pdata Pointer to a byte variable for the value read.
479 *
480 *
481 * Returns:
482 * CSR_RESULT_SUCCESS on success, CSR error code on failure
483 * ---------------------------------------------------------------------------
484 */
485static CsrResult safe_read_shared_location(card_t *card, u32 address, u8 *pdata)
486{
487 CsrResult r;
488 u16 limit = 1000;
489 u8 b, b2;
490
491 *pdata = 0;
492
493 r = unifi_read_8_or_16(card, address, &b);
494 if (r != CSR_RESULT_SUCCESS)
495 {
496 return r;
497 }
498
499 while (limit--)
500 {
501 r = unifi_read_8_or_16(card, address, &b2);
502 if (r != CSR_RESULT_SUCCESS)
503 {
504 return r;
505 }
506
507 /* When we have a stable value, return it */
508 if (b == b2)
509 {
510 *pdata = b;
511 return CSR_RESULT_SUCCESS;
512 }
513
514 b = b2;
515 }
516
517 return CSR_RESULT_FAILURE;
518} /* safe_read_shared_location() */
519
520
521/*
522 * ---------------------------------------------------------------------------
523 * unifi_do_loader_op
524 *
525 * Send a loader / boot_loader command to the UniFi and wait for
526 * it to complete.
527 *
528 * Arguments:
529 * card Pointer to card context struct.
530 * op_addr The address of the loader operation control word.
531 * opcode The operation to perform.
532 *
533 * Returns:
534 * CSR_RESULT_SUCCESS on success
535 * CSR_RESULT_FAILURE SDIO error or SDIO/XAP timeout
536 * ---------------------------------------------------------------------------
537 */
538
539/*
540 * Ideally instead of sleeping, we want to busy wait.
541 * Currently there is no framework API to do this. When it becomes available,
542 * we can use it to busy wait using usecs
543 */
544#define OPERATION_TIMEOUT_LOOPS (100) /* when OPERATION_TIMEOUT_DELAY==1, (500) otherwise */
545#define OPERATION_TIMEOUT_DELAY 1 /* msec, or 200usecs */
546
547CsrResult unifi_do_loader_op(card_t *card, u32 op_addr, u8 opcode)
548{
549 CsrResult r;
550 s16 op_retries;
551
552 unifi_trace(card->ospriv, UDBG4, "Loader cmd 0x%0x -> 0x%08x\n", opcode, op_addr);
553
554 /* Set the Operation command byte to the opcode */
555 r = unifi_write_8_or_16(card, op_addr, opcode);
556 if (r != CSR_RESULT_SUCCESS)
557 {
558 unifi_error(card->ospriv, "Failed to write loader copy command\n");
559 return r;
560 }
561
562 /* Wait for Operation command byte to be Idle */
563 /* Typically takes ~100us */
564 op_retries = 0;
565 r = CSR_RESULT_SUCCESS;
566 while (1)
567 {
568 u8 op;
569
570 /*
571 * Read the memory location until two successive reads give
572 * the same value.
573 * Then handle it.
574 */
575 r = safe_read_shared_location(card, op_addr, &op);
576 if (r != CSR_RESULT_SUCCESS)
577 {
578 unifi_error(card->ospriv, "Failed to read loader status\n");
579 break;
580 }
581
582 if (op == UNIFI_LOADER_IDLE)
583 {
584 /* Success */
585 break;
586 }
587
588 if (op != opcode)
589 {
590 unifi_error(card->ospriv, "Error reported by loader: 0x%X\n", op);
591 r = CSR_RESULT_FAILURE;
592 break;
593 }
594
595 /* Allow 500us timeout */
596 if (++op_retries >= OPERATION_TIMEOUT_LOOPS)
597 {
598 unifi_error(card->ospriv, "Timeout waiting for loader to ack transfer\n");
599 /* Stop XAPs to aid post-mortem */
600 r = unifi_card_stop_processor(card, UNIFI_PROC_BOTH);
601 if (r != CSR_RESULT_SUCCESS)
602 {
603 unifi_error(card->ospriv, "Failed to stop UniFi processors\n");
604 }
605 else
606 {
607 r = CSR_RESULT_FAILURE;
608 }
609 break;
610 }
611 CsrThreadSleep(OPERATION_TIMEOUT_DELAY);
612 } /* Loop exits with r != CSR_RESULT_SUCCESS on error */
613
614 return r;
615} /* unifi_do_loader_op() */
616
617
618/*
619 * ---------------------------------------------------------------------------
620 * send_ptdl_to_unifi
621 *
622 * Copy a patch block from userland to the UniFi.
623 * This function reads data, 2K at a time, from userland and writes
624 * it to the UniFi.
625 *
626 * Arguments:
627 * card A pointer to the card structure
628 * dlpriv The os specific handle for the firmware file
629 * ptdl A pointer ot the PTDL block
630 * handle The buffer handle to use for the xfer
631 * op_addr The address of the loader operation control word
632 *
633 * Returns:
634 * Number of bytes sent (Positive) or negative value indicating
635 * error code:
636 * CSR_WIFI_HIP_RESULT_NO_MEMORY memory allocation failed
637 * CSR_WIFI_HIP_RESULT_INVALID_VALUE error in XBV file
638 * CSR_RESULT_FAILURE SDIO error
639 * ---------------------------------------------------------------------------
640 */
641static CsrResult send_ptdl_to_unifi(card_t *card, void *dlpriv,
642 const struct PTDL *ptdl, u32 handle,
643 u32 op_addr)
644{
645 u32 offset;
646 u8 *buf;
647 s32 data_len;
648 u32 write_len;
649 CsrResult r;
650 const u16 buf_size = 2 * 1024;
651
652 offset = ptdl->dl_offset;
653 data_len = ptdl->dl_size;
654
655 if (data_len > buf_size)
656 {
657 unifi_error(card->ospriv, "PTDL block is too large (%u)\n",
658 ptdl->dl_size);
659 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
660 }
661
662 buf = kmalloc(buf_size, GFP_KERNEL);
663 if (buf == NULL)
664 {
665 unifi_error(card->ospriv, "Failed to allocate transfer buffer for firmware download\n");
666 return CSR_WIFI_HIP_RESULT_NO_MEMORY;
667 }
668
669 r = CSR_RESULT_SUCCESS;
670
671 if (unifi_fw_read(card->ospriv, dlpriv, offset, buf, data_len) != data_len)
672 {
673 unifi_error(card->ospriv, "Failed to read from file\n");
674 }
675 else
676 {
677 /* We can always round these if the host wants to */
678 if (card->sdio_io_block_pad)
679 {
680 write_len = (data_len + (card->sdio_io_block_size - 1)) &
681 ~(card->sdio_io_block_size - 1);
682
683 /* Zero out the rest of the buffer (This isn't needed, but it
684 * makes debugging things later much easier). */
685 memset(buf + data_len, 0, write_len - data_len);
686 }
687 else
688 {
689 write_len = data_len;
690 }
691
692 r = unifi_bulk_rw_noretry(card, handle, buf, write_len, UNIFI_SDIO_WRITE);
693 if (r != CSR_RESULT_SUCCESS)
694 {
695 unifi_error(card->ospriv, "CMD53 failed writing %d bytes to handle %ld\n",
696 data_len, handle);
697 }
698 else
699 {
700 /*
701 * Can change the order of things to overlap read from file
702 * with copy to unifi
703 */
704 r = unifi_do_loader_op(card, op_addr, UNIFI_BOOT_LOADER_PATCH);
705 }
706 }
707
708 kfree(buf);
709
710 if (r != CSR_RESULT_SUCCESS && r != CSR_WIFI_HIP_RESULT_NO_DEVICE)
711 {
712 unifi_error(card->ospriv, "Failed to copy block of %u bytes to UniFi\n",
713 ptdl->dl_size);
714 }
715
716 return r;
717} /* send_ptdl_to_unifi() */
718
719
720/*
721 * ---------------------------------------------------------------------------
722 * do_patch_download
723 *
724 * This function downloads a set of patches to UniFi and then
725 * causes it to restart.
726 *
727 * Arguments:
728 * card Pointer to card struct.
729 * dlpriv A context pointer from the calling function to be
730 * used when reading the XBV file. This can be NULL
731 * in which case not patches are applied.
732 * pfwinfo Pointer to a fwinfo struct describing the f/w
733 * XBV file.
734 * boot_ctrl_addr The address of the boot loader control structure.
735 *
736 * Returns:
737 * 0 on success, or an error code
738 * CSR_WIFI_HIP_RESULT_INVALID_VALUE for a bad laoader version number
739 * ---------------------------------------------------------------------------
740 */
741static CsrResult do_patch_download(card_t *card, void *dlpriv, xbv1_t *pfwinfo, u32 boot_ctrl_addr)
742{
743 CsrResult r;
744 s32 i;
745 u16 loader_version;
746 u16 handle;
747 u32 total_bytes;
748
749 /*
750 * Read info from the SDIO Loader Control Data Structure
751 */
752 /* Check the loader version */
753 r = unifi_card_read16(card, boot_ctrl_addr, &loader_version);
754 if (r != CSR_RESULT_SUCCESS)
755 {
756 unifi_error(card->ospriv, "Patch download: Failed to read loader version\n");
757 return r;
758 }
759 unifi_trace(card->ospriv, UDBG2, "Patch download: boot loader version 0x%04X\n", loader_version);
760 switch (loader_version)
761 {
762 case 0x0000:
763 break;
764
765 default:
766 unifi_error(card->ospriv, "Patch loader version (0x%04X) is not supported by this driver\n",
767 loader_version);
768 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
769 }
770
771 /* Retrieve the handle to use with CMD53 */
772 r = unifi_card_read16(card, boot_ctrl_addr + 4, &handle);
773 if (r != CSR_RESULT_SUCCESS)
774 {
775 unifi_error(card->ospriv, "Patch download: Failed to read loader handle\n");
776 return r;
777 }
778
779 /* Set the mask of LEDs to flash */
780 if (card->loader_led_mask)
781 {
782 r = unifi_card_write16(card, boot_ctrl_addr + 2,
783 (u16)card->loader_led_mask);
784 if (r != CSR_RESULT_SUCCESS)
785 {
786 unifi_error(card->ospriv, "Patch download: Failed to write LED mask\n");
787 return r;
788 }
789 }
790
791 total_bytes = 0;
792
793 /* Copy download data to UniFi memory */
794 for (i = 0; i < pfwinfo->num_ptdl; i++)
795 {
796 unifi_trace(card->ospriv, UDBG3, "Patch download: %d Downloading for %d from offset %d\n",
797 i,
798 pfwinfo->ptdl[i].dl_size,
799 pfwinfo->ptdl[i].dl_offset);
800
801 r = send_ptdl_to_unifi(card, dlpriv, &pfwinfo->ptdl[i],
802 handle, boot_ctrl_addr + 6);
803 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
804 {
805 return r;
806 }
807 if (r != CSR_RESULT_SUCCESS)
808 {
809 unifi_error(card->ospriv, "Patch failed after %u bytes\n",
810 total_bytes);
811 return r;
812 }
813 total_bytes += pfwinfo->ptdl[i].dl_size;
814 }
815
816 return CSR_RESULT_SUCCESS;
817} /* do_patch_download() */
818
819
diff --git a/drivers/staging/csr/csr_wifi_hip_dump.c b/drivers/staging/csr/csr_wifi_hip_dump.c
deleted file mode 100644
index 7b7eec49d028..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_dump.c
+++ /dev/null
@@ -1,837 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/*
12 * ---------------------------------------------------------------------------
13 * FILE: csr_wifi_hip_dump.c
14 *
15 * PURPOSE:
16 * Routines for retrieving and buffering core status from the UniFi
17 *
18 * ---------------------------------------------------------------------------
19 */
20#include <linux/slab.h>
21#include "csr_wifi_hip_unifi.h"
22#include "csr_wifi_hip_unifiversion.h"
23#include "csr_wifi_hip_card.h"
24
25/* Locations to capture in dump (XAP words) */
26#define HIP_CDUMP_FIRST_CPUREG (0xFFE0) /* First CPU register */
27#define HIP_CDUMP_FIRST_LO (0) /* Start of low address range */
28#define HIP_CDUMP_FIRST_HI_MAC (0x3C00) /* Start of MAC high area */
29#define HIP_CDUMP_FIRST_HI_PHY (0x1C00) /* Start of PHY high area */
30#define HIP_CDUMP_FIRST_SH (0) /* Start of shared memory area */
31
32#define HIP_CDUMP_NCPUREGS (10) /* No. of 16-bit XAP registers */
33#define HIP_CDUMP_NWORDS_LO (0x0100) /* Low area size in 16-bit words */
34#define HIP_CDUMP_NWORDS_HI (0x0400) /* High area size in 16-bit words */
35#define HIP_CDUMP_NWORDS_SH (0x0500) /* Shared memory area size, 16-bit words */
36
37#define HIP_CDUMP_NUM_ZONES 7 /* Number of UniFi memory areas to capture */
38
39/* Mini-coredump state */
40typedef struct coredump_buf
41{
42 u16 count; /* serial number of dump */
43 u32 timestamp; /* host's system time at capture */
44 s16 requestor; /* request: 0=auto dump, 1=manual */
45 u16 chip_ver;
46 u32 fw_ver;
47 u16 *zone[HIP_CDUMP_NUM_ZONES];
48
49 struct coredump_buf *next; /* circular list */
50 struct coredump_buf *prev; /* circular list */
51} coredump_buffer;
52
53/* Structure used to describe a zone of chip memory captured by mini-coredump */
54struct coredump_zone
55{
56 unifi_coredump_space_t space; /* XAP memory space this zone covers */
57 enum unifi_dbg_processors_select cpu; /* XAP CPU core selector */
58 u32 gp; /* Generic Pointer to memory zone on XAP */
59 u16 offset; /* 16-bit XAP word offset of zone in memory space */
60 u16 length; /* Length of zone in XAP words */
61};
62
63static CsrResult unifi_coredump_from_sdio(card_t *card, coredump_buffer *dump_buf);
64static CsrResult unifi_coredump_read_zones(card_t *card, coredump_buffer *dump_buf);
65static CsrResult unifi_coredump_read_zone(card_t *card, u16 *zone,
66 const struct coredump_zone *def);
67static s32 get_value_from_coredump(const coredump_buffer *dump,
68 const unifi_coredump_space_t space, const u16 offset);
69
70/* Table of chip memory zones we capture on mini-coredump */
71static const struct coredump_zone zonedef_table[HIP_CDUMP_NUM_ZONES] = {
72 { UNIFI_COREDUMP_MAC_REG, UNIFI_PROC_MAC, UNIFI_MAKE_GP(REGISTERS, HIP_CDUMP_FIRST_CPUREG * 2), HIP_CDUMP_FIRST_CPUREG, HIP_CDUMP_NCPUREGS },
73 { UNIFI_COREDUMP_PHY_REG, UNIFI_PROC_PHY, UNIFI_MAKE_GP(REGISTERS, HIP_CDUMP_FIRST_CPUREG * 2), HIP_CDUMP_FIRST_CPUREG, HIP_CDUMP_NCPUREGS },
74 { UNIFI_COREDUMP_SH_DMEM, UNIFI_PROC_INVALID, UNIFI_MAKE_GP(SH_DMEM, HIP_CDUMP_FIRST_SH * 2), HIP_CDUMP_FIRST_SH, HIP_CDUMP_NWORDS_SH },
75 { UNIFI_COREDUMP_MAC_DMEM, UNIFI_PROC_MAC, UNIFI_MAKE_GP(MAC_DMEM, HIP_CDUMP_FIRST_LO * 2), HIP_CDUMP_FIRST_LO, HIP_CDUMP_NWORDS_LO },
76 { UNIFI_COREDUMP_MAC_DMEM, UNIFI_PROC_MAC, UNIFI_MAKE_GP(MAC_DMEM, HIP_CDUMP_FIRST_HI_MAC * 2), HIP_CDUMP_FIRST_HI_MAC, HIP_CDUMP_NWORDS_HI },
77 { UNIFI_COREDUMP_PHY_DMEM, UNIFI_PROC_PHY, UNIFI_MAKE_GP(PHY_DMEM, HIP_CDUMP_FIRST_LO * 2), HIP_CDUMP_FIRST_LO, HIP_CDUMP_NWORDS_LO },
78 { UNIFI_COREDUMP_PHY_DMEM, UNIFI_PROC_PHY, UNIFI_MAKE_GP(PHY_DMEM, HIP_CDUMP_FIRST_HI_PHY * 2), HIP_CDUMP_FIRST_HI_PHY, HIP_CDUMP_NWORDS_HI },
79};
80
81/*
82 * ---------------------------------------------------------------------------
83 * unifi_coredump_request_at_next_reset
84 *
85 * Request that a mini-coredump is performed when the driver has
86 * completed resetting the UniFi device.
87 *
88 * Arguments:
89 * card Pointer to card struct
90 * enable If non-zero, sets the request.
91 * If zero, cancels any pending request.
92 *
93 * Returns:
94 * CSR_RESULT_SUCCESS or CSR HIP error code
95 *
96 * Notes:
97 * This function is typically called once the driver has detected that
98 * the UniFi device has become unresponsive due to crash, or internal
99 * watchdog reset. The driver must reset it to regain communication and,
100 * immediately after that, the mini-coredump can be captured.
101 * ---------------------------------------------------------------------------
102 */
103CsrResult unifi_coredump_request_at_next_reset(card_t *card, s8 enable)
104{
105 CsrResult r;
106
107 if (enable)
108 {
109 unifi_trace(card->ospriv, UDBG2, "Mini-coredump requested after reset\n");
110 }
111
112 if (card == NULL)
113 {
114 r = CSR_WIFI_HIP_RESULT_INVALID_VALUE;
115 }
116 else
117 {
118 card->request_coredump_on_reset = enable?1 : 0;
119 r = CSR_RESULT_SUCCESS;
120 }
121
122 return r;
123}
124
125
126/*
127 * ---------------------------------------------------------------------------
128 * unifi_coredump_handle_request
129 *
130 * Performs a coredump now, if one was requested, and clears the request.
131 *
132 * Arguments:
133 * card Pointer to card struct
134 *
135 * Returns:
136 * CSR_RESULT_SUCCESS or CSR HIP error code
137 *
138 * Notes:
139 * ---------------------------------------------------------------------------
140 */
141CsrResult unifi_coredump_handle_request(card_t *card)
142{
143 CsrResult r = CSR_RESULT_SUCCESS;
144
145 if (card == NULL)
146 {
147 r = CSR_WIFI_HIP_RESULT_INVALID_VALUE;
148 }
149 else
150 {
151 if (card->request_coredump_on_reset == 1)
152 {
153 card->request_coredump_on_reset = 0;
154 r = unifi_coredump_capture(card, NULL);
155 }
156 }
157
158 return r;
159}
160
161
162/*
163 * ---------------------------------------------------------------------------
164 * unifi_coredump_capture
165 *
166 * Capture the current status of the UniFi device.
167 * Various registers are buffered for future offline inspection.
168 *
169 * Arguments:
170 * card Pointer to card struct
171 * req Pointer to request struct, or NULL:
172 * A coredump requested manually by the user app
173 * will have a request struct pointer, an automatic
174 * coredump will have a NULL pointer.
175 * Returns:
176 * CSR_RESULT_SUCCESS on success,
177 * CSR_RESULT_FAILURE SDIO error
178 * CSR_WIFI_HIP_RESULT_INVALID_VALUE Initialisation not complete
179 *
180 * Notes:
181 * The result is a filled entry in the circular buffer of core dumps,
182 * values from which can be extracted to userland via an ioctl.
183 * ---------------------------------------------------------------------------
184 */
185CsrResult unifi_coredump_capture(card_t *card, struct unifi_coredump_req *req)
186{
187 CsrResult r = CSR_RESULT_SUCCESS;
188 static u16 dump_seq_no = 1;
189 u32 time_of_capture;
190
191 if (card->dump_next_write == NULL)
192 {
193 r = CSR_RESULT_SUCCESS;
194 goto done;
195 }
196
197 /* Reject forced capture before initialisation has happened */
198 if (card->helper == NULL)
199 {
200 r = CSR_WIFI_HIP_RESULT_INVALID_VALUE;
201 goto done;
202 }
203
204
205 /*
206 * Force a mini-coredump capture right now
207 */
208 time_of_capture = CsrTimeGet(NULL);
209 unifi_info(card->ospriv, "Mini-coredump capture at t=%u\n", time_of_capture);
210
211 /* Wake up the processors so we can talk to them */
212 r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE);
213 if (r != CSR_RESULT_SUCCESS)
214 {
215 unifi_error(card->ospriv, "Failed to wake UniFi\n");
216 goto done;
217 }
218 CsrThreadSleep(20);
219
220 /* Stop both XAPs */
221 unifi_trace(card->ospriv, UDBG4, "Stopping XAPs for coredump capture\n");
222 r = unifi_card_stop_processor(card, UNIFI_PROC_BOTH);
223 if (r != CSR_RESULT_SUCCESS)
224 {
225 unifi_error(card->ospriv, "Failed to stop UniFi XAPs\n");
226 goto done;
227 }
228
229 /* Dump core into the next available slot in the circular list */
230 r = unifi_coredump_from_sdio(card, card->dump_next_write);
231 if (r == CSR_RESULT_SUCCESS)
232 {
233 /* Record whether the dump was manual or automatic */
234 card->dump_next_write->requestor = (req?1 : 0);
235 card->dump_next_write->timestamp = time_of_capture;
236 /* Advance to the next buffer */
237 card->dump_next_write->count = dump_seq_no++;
238 card->dump_cur_read = card->dump_next_write;
239 card->dump_next_write = card->dump_next_write->next;
240
241 /* Sequence no. of zero indicates slot not in use, so handle wrap */
242 if (dump_seq_no == 0)
243 {
244 dump_seq_no = 1;
245 }
246
247 unifi_trace(card->ospriv, UDBG3,
248 "Coredump (%p), SeqNo=%d, cur_read=%p, next_write=%p\n",
249 req,
250 card->dump_cur_read->count,
251 card->dump_cur_read, card->dump_next_write);
252 }
253
254 /* Start both XAPs */
255 unifi_trace(card->ospriv, UDBG4, "Restart XAPs after coredump\n");
256 r = card_start_processor(card, UNIFI_PROC_BOTH);
257 if (r != CSR_RESULT_SUCCESS)
258 {
259 unifi_error(card->ospriv, "Failed to start UniFi XAPs\n");
260 goto done;
261 }
262
263done:
264 return r;
265} /* unifi_coredump_capture() */
266
267
268/*
269 * ---------------------------------------------------------------------------
270 * get_value_from_coredump
271 *
272 *
273 *
274 * Arguments:
275 * dump Pointer to buffered coredump data
276 * offset_in_space XAP memory space to retrieve from the buffer (there
277 * may be more than one zone covering the same memory
278 * space, but starting from different offsets).
279 * offset Offset within the XAP memory space to be retrieved
280 *
281 * Returns:
282 * >=0 Register value on success
283 * <0 Register out of range of any captured zones
284 *
285 * Notes:
286 * ---------------------------------------------------------------------------
287 */
288static s32 get_value_from_coredump(const coredump_buffer *coreDump,
289 const unifi_coredump_space_t space,
290 const u16 offset_in_space)
291{
292 s32 r = -1;
293 u16 offset_in_zone;
294 u32 zone_end_offset;
295 s32 i;
296 const struct coredump_zone *def = &zonedef_table[0];
297
298 /* Search zone def table for a match with the requested memory space */
299 for (i = 0; i < HIP_CDUMP_NUM_ZONES; i++, def++)
300 {
301 if (space == def->space)
302 {
303 zone_end_offset = def->offset + def->length;
304
305 /* Is the space offset contained in this zone? */
306 if (offset_in_space < zone_end_offset &&
307 offset_in_space >= def->offset)
308 {
309 /* Calculate the offset of data within the zone buffer */
310 offset_in_zone = offset_in_space - def->offset;
311 r = (s32) * (coreDump->zone[i] + offset_in_zone);
312
313 unifi_trace(NULL, UDBG6,
314 "sp %d, offs 0x%04x = 0x%04x (in z%d 0x%04x->0x%04x)\n",
315 space, offset_in_space, r,
316 i, def->offset, zone_end_offset - 1);
317 break;
318 }
319 }
320 }
321 return r;
322}
323
324
325/*
326 * ---------------------------------------------------------------------------
327 * unifi_coredump_get_value
328 *
329 * Retrieve the value of a register buffered from a previous core dump,
330 * so that it may be reported back to application code.
331 *
332 * Arguments:
333 * card Pointer to card struct
334 * req_reg Pointer to request parameter partially filled. This
335 * function puts in the values retrieved from the dump.
336 *
337 * Returns:
338 * CSR_RESULT_SUCCESS on success, or:
339 * CSR_WIFI_HIP_RESULT_INVALID_VALUE Null parameter error
340 * CSR_WIFI_HIP_RESULT_RANGE Register out of range
341 * CSR_WIFI_HIP_RESULT_NOT_FOUND Dump index not (yet) captured
342 *
343 * Notes:
344 * ---------------------------------------------------------------------------
345 */
346CsrResult unifi_coredump_get_value(card_t *card, struct unifi_coredump_req *req)
347{
348 CsrResult r;
349 s32 i = 0;
350 coredump_buffer *find_dump = NULL;
351
352 if (req == NULL || card == NULL)
353 {
354 r = CSR_WIFI_HIP_RESULT_INVALID_VALUE;
355 goto done;
356 }
357 req->value = -1;
358 if (card->dump_buf == NULL)
359 {
360 unifi_trace(card->ospriv, UDBG2, "No coredump buffers\n");
361 r = CSR_WIFI_HIP_RESULT_NOT_FOUND; /* Coredumping disabled */
362 goto done;
363 }
364 if (card->dump_cur_read == NULL)
365 {
366 unifi_trace(card->ospriv, UDBG4, "No coredumps captured\n");
367 r = CSR_WIFI_HIP_RESULT_NOT_FOUND; /* No coredump yet captured */
368 goto done;
369 }
370
371 /* Find the requested dump buffer */
372 switch (req->index)
373 {
374 case 0: /* Newest */
375 find_dump = card->dump_cur_read;
376 break;
377 case -1: /* Oldest: The next used slot forward */
378 for (find_dump = card->dump_cur_read->next;
379 (find_dump->count == 0) && (find_dump != card->dump_cur_read);
380 find_dump = card->dump_cur_read->next)
381 {
382 }
383 break;
384 default: /* Number of steps back from current read position */
385 for (i = 0, find_dump = card->dump_cur_read;
386 i < req->index;
387 i++, find_dump = find_dump->prev)
388 {
389 /* Walk the list for the index'th entry, but
390 * stop when about to wrap. */
391 unifi_trace(card->ospriv, UDBG6,
392 "%d: %d, @%p, p=%p, n=%p, cr=%p, h=%p\n",
393 i, find_dump->count, find_dump, find_dump->prev,
394 find_dump->next, card->dump_cur_read, card->dump_buf);
395 if (find_dump->prev == card->dump_cur_read)
396 {
397 /* Wrapped but still not found, index out of range */
398 if (i != req->index)
399 {
400 unifi_trace(card->ospriv, UDBG6,
401 "Dump index %d not found %d\n", req->index, i);
402 r = CSR_WIFI_HIP_RESULT_NOT_FOUND;
403 goto done;
404 }
405 break;
406 }
407 }
408 break;
409 }
410
411 /* Check if the slot is actually filled with a core dump */
412 if (find_dump->count == 0)
413 {
414 unifi_trace(card->ospriv, UDBG4, "Not captured %d\n", req->index);
415 r = CSR_WIFI_HIP_RESULT_NOT_FOUND;
416 goto done;
417 }
418
419 unifi_trace(card->ospriv, UDBG6, "Req index %d, found seq %d at step %d\n",
420 req->index, find_dump->count, i);
421
422 /* Find the appropriate entry in the buffer */
423 req->value = get_value_from_coredump(find_dump, req->space, (u16)req->offset);
424 if (req->value < 0)
425 {
426 r = CSR_WIFI_HIP_RESULT_RANGE; /* Un-captured register */
427 unifi_trace(card->ospriv, UDBG4,
428 "Can't read space %d, reg 0x%x from coredump buffer %d\n",
429 req->space, req->offset, req->index);
430 }
431 else
432 {
433 r = CSR_RESULT_SUCCESS;
434 }
435
436 /* Update the private request structure with the found values */
437 req->chip_ver = find_dump->chip_ver;
438 req->fw_ver = find_dump->fw_ver;
439 req->timestamp = find_dump->timestamp;
440 req->requestor = find_dump->requestor;
441 req->serial = find_dump->count;
442
443done:
444 return r;
445} /* unifi_coredump_get_value() */
446
447
448/*
449 * ---------------------------------------------------------------------------
450 * unifi_coredump_read_zone
451 *
452 * Captures a UniFi memory zone into a buffer on the host
453 *
454 * Arguments:
455 * card Pointer to card struct
456 * zonebuf Pointer to on-host buffer to dump the memory zone into
457 * def Pointer to description of the memory zone to read from UniFi.
458 *
459 * Returns:
460 * CSR_RESULT_SUCCESS on success, or:
461 * CSR_RESULT_FAILURE SDIO error
462 * CSR_WIFI_HIP_RESULT_INVALID_VALUE Parameter error
463 *
464 * Notes:
465 * It is assumed that the caller has already stopped the XAPs
466 * ---------------------------------------------------------------------------
467 */
468static CsrResult unifi_coredump_read_zone(card_t *card, u16 *zonebuf, const struct coredump_zone *def)
469{
470 CsrResult r;
471
472 if (zonebuf == NULL || def == NULL)
473 {
474 r = CSR_WIFI_HIP_RESULT_INVALID_VALUE;
475 goto done;
476 }
477
478 /* Select XAP CPU if necessary */
479 if (def->cpu != UNIFI_PROC_INVALID)
480 {
481 if (def->cpu != UNIFI_PROC_MAC && def->cpu != UNIFI_PROC_PHY)
482 {
483 r = CSR_WIFI_HIP_RESULT_INVALID_VALUE;
484 goto done;
485 }
486 r = unifi_set_proc_select(card, def->cpu);
487 if (r != CSR_RESULT_SUCCESS)
488 {
489 goto done;
490 }
491 }
492
493 unifi_trace(card->ospriv, UDBG4,
494 "Dump sp %d, offs 0x%04x, 0x%04x words @GP=%08x CPU %d\n",
495 def->space, def->offset, def->length, def->gp, def->cpu);
496
497 /* Read on-chip RAM (byte-wise) */
498 r = unifi_card_readn(card, def->gp, zonebuf, (u16)(def->length * 2));
499 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
500 {
501 goto done;
502 }
503 if (r != CSR_RESULT_SUCCESS)
504 {
505 unifi_error(card->ospriv, "Can't read UniFi shared data area\n");
506 goto done;
507 }
508
509done:
510 return r;
511}
512
513
514/*
515 * ---------------------------------------------------------------------------
516 * unifi_coredump_read_zones
517 *
518 * Walks through the table of on-chip memory zones defined in zonedef_table,
519 * and reads each of them from the UniFi chip
520 *
521 * Arguments:
522 * card Pointer to card struct
523 * dump_buf Buffer into which register values will be dumped
524 *
525 * Returns:
526 * CSR_RESULT_SUCCESS on success, or:
527 * CSR_RESULT_FAILURE SDIO error
528 * CSR_WIFI_HIP_RESULT_INVALID_VALUE Parameter error
529 *
530 * Notes:
531 * It is assumed that the caller has already stopped the XAPs
532 * ---------------------------------------------------------------------------
533 */
534static CsrResult unifi_coredump_read_zones(card_t *card, coredump_buffer *dump_buf)
535{
536 CsrResult r = CSR_RESULT_SUCCESS;
537 s32 i;
538
539 /* Walk the table of coredump zone definitions and read them from the chip */
540 for (i = 0;
541 (i < HIP_CDUMP_NUM_ZONES) && (r == 0);
542 i++)
543 {
544 r = unifi_coredump_read_zone(card, dump_buf->zone[i], &zonedef_table[i]);
545 }
546
547 return r;
548}
549
550
551/*
552 * ---------------------------------------------------------------------------
553 * unifi_coredump_from_sdio
554 *
555 * Capture the status of the UniFi processors, over SDIO
556 *
557 * Arguments:
558 * card Pointer to card struct
559 * reg_buffer Buffer into which register values will be dumped
560 *
561 * Returns:
562 * CSR_RESULT_SUCCESS on success, or:
563 * CSR_RESULT_FAILURE SDIO error
564 * CSR_WIFI_HIP_RESULT_INVALID_VALUE Parameter error
565 *
566 * Notes:
567 * ---------------------------------------------------------------------------
568 */
569static CsrResult unifi_coredump_from_sdio(card_t *card, coredump_buffer *dump_buf)
570{
571 u16 val;
572 CsrResult r;
573 u32 sdio_addr;
574
575 if (dump_buf == NULL)
576 {
577 r = CSR_WIFI_HIP_RESULT_INVALID_VALUE;
578 goto done;
579 }
580
581
582 /* Chip and firmware version */
583 unifi_trace(card->ospriv, UDBG4, "Get chip version\n");
584 sdio_addr = 2 * ChipHelper_GBL_CHIP_VERSION(card->helper);
585 if (sdio_addr != 0)
586 {
587 r = unifi_read_direct16(card, sdio_addr, &val);
588 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
589 {
590 goto done;
591 }
592 if (r != CSR_RESULT_SUCCESS)
593 {
594 unifi_error(card->ospriv, "Can't read GBL_CHIP_VERSION\n");
595 goto done;
596 }
597 }
598 dump_buf->chip_ver = val;
599 dump_buf->fw_ver = card->build_id;
600
601 unifi_trace(card->ospriv, UDBG4, "chip_ver 0x%04x, fw_ver %u\n",
602 dump_buf->chip_ver, dump_buf->fw_ver);
603
604 /* Capture the memory zones required from UniFi */
605 r = unifi_coredump_read_zones(card, dump_buf);
606 if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
607 {
608 goto done;
609 }
610 if (r != CSR_RESULT_SUCCESS)
611 {
612 unifi_error(card->ospriv, "Can't read UniFi memory areas\n");
613 goto done;
614 }
615
616done:
617 return r;
618} /* unifi_coredump_from_sdio() */
619
620
621#ifndef UNIFI_DISABLE_COREDUMP
622/*
623 * ---------------------------------------------------------------------------
624 * new_coredump_node
625 *
626 * Allocates a coredump linked-list node, and links it to the previous.
627 *
628 * Arguments:
629 * ospriv OS context
630 * prevnode Previous node to link into
631 *
632 * Returns:
633 * Pointer to valid coredump_buffer on success
634 * NULL on memory allocation failure
635 *
636 * Notes:
637 * Allocates "all or nothing"
638 * ---------------------------------------------------------------------------
639 */
640static
641coredump_buffer* new_coredump_node(void *ospriv, coredump_buffer *prevnode)
642{
643 coredump_buffer *newnode = NULL;
644 u16 *newzone = NULL;
645 s32 i;
646 u32 zone_size;
647
648 /* Allocate node header */
649 newnode = kzalloc(sizeof(coredump_buffer), GFP_KERNEL);
650 if (newnode == NULL)
651 {
652 return NULL;
653 }
654
655 /* Allocate chip memory zone capture buffers */
656 for (i = 0; i < HIP_CDUMP_NUM_ZONES; i++)
657 {
658 zone_size = sizeof(u16) * zonedef_table[i].length;
659 newzone = kzalloc(zone_size, GFP_KERNEL);
660 newnode->zone[i] = newzone;
661 if (newzone == NULL)
662 {
663 unifi_error(ospriv, "Out of memory on coredump zone %d (%d words)\n",
664 i, zonedef_table[i].length);
665 break;
666 }
667 }
668
669 /* Clean up if any zone alloc failed */
670 if (newzone == NULL)
671 {
672 for (i = 0; newnode->zone[i] != NULL; i++)
673 {
674 kfree(newnode->zone[i]);
675 newnode->zone[i] = NULL;
676 }
677 }
678
679 /* Link to previous node */
680 newnode->prev = prevnode;
681 if (prevnode)
682 {
683 prevnode->next = newnode;
684 }
685 newnode->next = NULL;
686
687 return newnode;
688}
689
690
691#endif /* UNIFI_DISABLE_COREDUMP */
692
693/*
694 * ---------------------------------------------------------------------------
695 * unifi_coredump_init
696 *
697 * Allocates buffers for the automatic SDIO core dump
698 *
699 * Arguments:
700 * card Pointer to card struct
701 * num_dump_buffers Number of buffers to reserve for coredumps
702 *
703 * Returns:
704 * CSR_RESULT_SUCCESS on success, or:
705 * CSR_WIFI_HIP_RESULT_NO_MEMORY memory allocation failed
706 *
707 * Notes:
708 * Allocates space in advance, to be used for the last n coredump buffers
709 * the intention being that the size is sufficient for at least one dump,
710 * probably several.
711 * It's probably advisable to have at least 2 coredump buffers to allow
712 * one to be enquired with the unifi_coredump tool, while leaving another
713 * free for capturing.
714 * ---------------------------------------------------------------------------
715 */
716CsrResult unifi_coredump_init(card_t *card, u16 num_dump_buffers)
717{
718#ifndef UNIFI_DISABLE_COREDUMP
719 void *ospriv = card->ospriv;
720 coredump_buffer *prev = NULL;
721 coredump_buffer *newnode = NULL;
722 u32 i = 0;
723#endif
724
725 card->request_coredump_on_reset = 0;
726 card->dump_next_write = NULL;
727 card->dump_cur_read = NULL;
728 card->dump_buf = NULL;
729
730#ifndef UNIFI_DISABLE_COREDUMP
731 unifi_trace(ospriv, UDBG1,
732 "Allocate buffers for %d core dumps\n", num_dump_buffers);
733 if (num_dump_buffers == 0)
734 {
735 goto done;
736 }
737
738 /* Root node */
739 card->dump_buf = new_coredump_node(ospriv, NULL);
740 if (card->dump_buf == NULL)
741 {
742 goto fail;
743 }
744 prev = card->dump_buf;
745 newnode = card->dump_buf;
746
747 /* Add each subsequent node at tail */
748 for (i = 1; i < num_dump_buffers; i++)
749 {
750 newnode = new_coredump_node(ospriv, prev);
751 if (newnode == NULL)
752 {
753 goto fail;
754 }
755 prev = newnode;
756 }
757
758 /* Link the first and last nodes to make the list circular */
759 card->dump_buf->prev = newnode;
760 newnode->next = card->dump_buf;
761
762 /* Set initial r/w access pointers */
763 card->dump_next_write = card->dump_buf;
764 card->dump_cur_read = NULL;
765
766 unifi_trace(ospriv, UDBG2, "Core dump configured (%d dumps max)\n", i);
767
768done:
769#endif
770 return CSR_RESULT_SUCCESS;
771
772#ifndef UNIFI_DISABLE_COREDUMP
773fail:
774 /* Unwind what we allocated so far */
775 unifi_error(ospriv, "Out of memory allocating core dump node %d\n", i);
776 unifi_coredump_free(card);
777 return CSR_WIFI_HIP_RESULT_NO_MEMORY;
778#endif
779} /* unifi_coreump_init() */
780
781
782/*
783 * ---------------------------------------------------------------------------
784 * unifi_coredump_free
785 *
786 * Free all memory dynamically allocated for core dump
787 *
788 * Arguments:
789 * card Pointer to card struct
790 *
791 * Returns:
792 * None
793 *
794 * Notes:
795 * ---------------------------------------------------------------------------
796 */
797void unifi_coredump_free(card_t *card)
798{
799 void *ospriv = card->ospriv;
800 coredump_buffer *node, *del_node;
801 s16 i = 0;
802 s16 j;
803
804 unifi_trace(ospriv, UDBG2, "Core dump de-configured\n");
805
806 if (card->dump_buf == NULL)
807 {
808 return;
809 }
810
811 node = card->dump_buf;
812 do
813 {
814 /* Free payload zones */
815 for (j = 0; j < HIP_CDUMP_NUM_ZONES; j++)
816 {
817 kfree(node->zone[j]);
818 node->zone[j] = NULL;
819 }
820
821 /* Detach */
822 del_node = node;
823 node = node->next;
824
825 /* Free header */
826 kfree(del_node);
827 i++;
828 } while ((node != NULL) && (node != card->dump_buf));
829
830 unifi_trace(ospriv, UDBG3, "Freed %d coredump buffers\n", i);
831
832 card->dump_buf = NULL;
833 card->dump_next_write = NULL;
834 card->dump_cur_read = NULL;
835} /* unifi_coredump_free() */
836
837
diff --git a/drivers/staging/csr/csr_wifi_hip_packing.c b/drivers/staging/csr/csr_wifi_hip_packing.c
deleted file mode 100644
index 0768aefc6d1f..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_packing.c
+++ /dev/null
@@ -1,4804 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#include "csr_wifi_hip_signals.h"
14#include "csr_wifi_hip_unifi.h"
15#include "csr_wifi_hip_conversions.h"
16
17
18/*
19 * ---------------------------------------------------------------------------
20 * get_packed_struct_size
21 *
22 * Examine a buffer containing a UniFi signal in wire-format.
23 * The first two bytes contain the signal ID, decode the signal ID and
24 * return the size, in bytes, of the signal, not including any bulk
25 * data.
26 *
27 * WARNING: This function is auto-generated, DO NOT EDIT!
28 *
29 * Arguments:
30 * buf Pointer to buffer to decode.
31 *
32 * Returns:
33 * 0 if the signal ID is not recognised (i.e. zero length),
34 * otherwise the number of bytes occupied by the signal in the buffer.
35 * This is useful for stepping past the signal to the object in the buffer.
36 * ---------------------------------------------------------------------------
37 */
38s32 get_packed_struct_size(const u8 *buf)
39{
40 s32 size = 0;
41 u16 sig_id;
42
43 sig_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(buf);
44
45 size += SIZEOF_UINT16;
46 size += SIZEOF_UINT16;
47 size += SIZEOF_UINT16;
48 switch (sig_id)
49 {
50#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
51 case CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID:
52 size += SIZEOF_UINT16;
53 size += SIZEOF_UINT16;
54 size += SIZEOF_UINT16;
55 size += SIZEOF_UINT16;
56 size += SIZEOF_UINT16;
57 size += SIZEOF_UINT16;
58 break;
59#endif
60#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
61 case CSR_MLME_SETKEYS_CONFIRM_ID:
62 size += SIZEOF_UINT16;
63 size += SIZEOF_UINT16;
64 size += SIZEOF_UINT16;
65 size += SIZEOF_UINT16;
66 size += SIZEOF_UINT16;
67 size += SIZEOF_UINT16;
68 break;
69#endif
70#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
71 case CSR_MLME_CONFIG_QUEUE_CONFIRM_ID:
72 size += SIZEOF_UINT16;
73 size += SIZEOF_UINT16;
74 size += SIZEOF_UINT16;
75 size += SIZEOF_UINT16;
76 size += SIZEOF_UINT16;
77 break;
78#endif
79#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
80 case CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID:
81 size += SIZEOF_UINT16;
82 size += SIZEOF_UINT16;
83 size += SIZEOF_UINT16;
84 size += SIZEOF_UINT16;
85 size += SIZEOF_UINT16;
86 size += SIZEOF_UINT16;
87 size += SIZEOF_UINT16;
88 break;
89#endif
90#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
91 case CSR_MLME_ADD_BLACKOUT_CONFIRM_ID:
92 size += SIZEOF_UINT16;
93 size += SIZEOF_UINT16;
94 size += SIZEOF_UINT16;
95 size += SIZEOF_UINT16;
96 size += SIZEOF_UINT16;
97 size += SIZEOF_UINT16;
98 size += SIZEOF_UINT16;
99 break;
100#endif
101#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
102 case CSR_MLME_DEL_BLACKOUT_REQUEST_ID:
103 size += SIZEOF_UINT16;
104 size += SIZEOF_UINT16;
105 size += SIZEOF_UINT16;
106 size += SIZEOF_UINT16;
107 size += SIZEOF_UINT16;
108 size += SIZEOF_UINT16;
109 break;
110#endif
111#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
112 case CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID:
113 size += SIZEOF_UINT16;
114 size += SIZEOF_UINT16;
115 size += SIZEOF_UINT16;
116 size += SIZEOF_UINT16;
117 size += SIZEOF_UINT16;
118 size += SIZEOF_UINT16;
119 size += SIZEOF_UINT16;
120 size += SIZEOF_UINT16;
121 size += SIZEOF_UINT16;
122 size += SIZEOF_UINT16;
123 size += SIZEOF_UINT16;
124 size += SIZEOF_UINT16;
125 size += SIZEOF_UINT16;
126 size += SIZEOF_UINT16;
127 break;
128#endif
129#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
130 case CSR_MLME_SM_START_CONFIRM_ID:
131 size += SIZEOF_UINT16;
132 size += SIZEOF_UINT16;
133 size += SIZEOF_UINT16;
134 size += SIZEOF_UINT16;
135 size += SIZEOF_UINT16;
136 size += SIZEOF_UINT16;
137 break;
138#endif
139#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
140 case CSR_MLME_STOP_AGGREGATION_CONFIRM_ID:
141 size += SIZEOF_UINT16;
142 size += SIZEOF_UINT16;
143 size += SIZEOF_UINT16;
144 size += SIZEOF_UINT16;
145 size += SIZEOF_UINT16;
146 size += 48 / 8;
147 size += SIZEOF_UINT16;
148 size += SIZEOF_UINT16;
149 size += SIZEOF_UINT16;
150 break;
151#endif
152#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
153 case CSR_MLME_DEL_TSPEC_REQUEST_ID:
154 size += SIZEOF_UINT16;
155 size += SIZEOF_UINT16;
156 size += SIZEOF_UINT16;
157 size += SIZEOF_UINT16;
158 size += SIZEOF_UINT16;
159 size += SIZEOF_UINT16;
160 size += SIZEOF_UINT16;
161 break;
162#endif
163 case CSR_DEBUG_WORD16_INDICATION_ID:
164 size += SIZEOF_UINT16;
165 size += SIZEOF_UINT16;
166 size += SIZEOF_UINT16;
167 size += SIZEOF_UINT16;
168 size += SIZEOF_UINT16;
169 size += SIZEOF_UINT16;
170 size += SIZEOF_UINT16;
171 size += SIZEOF_UINT16;
172 size += SIZEOF_UINT16;
173 size += SIZEOF_UINT16;
174 size += SIZEOF_UINT16;
175 size += SIZEOF_UINT16;
176 size += SIZEOF_UINT16;
177 size += SIZEOF_UINT16;
178 size += SIZEOF_UINT16;
179 size += SIZEOF_UINT16;
180 size += SIZEOF_UINT16;
181 size += SIZEOF_UINT16;
182 size += SIZEOF_UINT16;
183 size += SIZEOF_UINT16;
184 break;
185 case CSR_DEBUG_GENERIC_CONFIRM_ID:
186 size += SIZEOF_UINT16;
187 size += SIZEOF_UINT16;
188 size += SIZEOF_UINT16;
189 size += SIZEOF_UINT16;
190 size += SIZEOF_UINT16;
191 size += SIZEOF_UINT16;
192 size += SIZEOF_UINT16;
193 size += SIZEOF_UINT16;
194 size += SIZEOF_UINT16;
195 size += SIZEOF_UINT16;
196 size += SIZEOF_UINT16;
197 size += SIZEOF_UINT16;
198 break;
199 case CSR_MA_PACKET_INDICATION_ID:
200 size += SIZEOF_UINT16;
201 size += SIZEOF_UINT16;
202 size += SIZEOF_UINT16;
203 size += SIZEOF_UINT16;
204 size += SIZEOF_UINT16;
205 size += SIZEOF_UINT64;
206 size += SIZEOF_UINT16;
207 size += SIZEOF_UINT16;
208 size += SIZEOF_UINT16;
209 size += SIZEOF_UINT16;
210 size += SIZEOF_UINT16;
211 size += SIZEOF_UINT16;
212 break;
213 case CSR_MLME_SET_TIM_REQUEST_ID:
214 size += SIZEOF_UINT16;
215 size += SIZEOF_UINT16;
216 size += SIZEOF_UINT16;
217 size += SIZEOF_UINT16;
218 size += SIZEOF_UINT16;
219 size += SIZEOF_UINT16;
220 size += SIZEOF_UINT16;
221 break;
222#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
223 case CSR_MLME_CONNECTED_INDICATION_ID:
224 size += SIZEOF_UINT16;
225 size += SIZEOF_UINT16;
226 size += SIZEOF_UINT16;
227 size += SIZEOF_UINT16;
228 size += SIZEOF_UINT16;
229 size += SIZEOF_UINT16;
230 size += 48 / 8;
231 break;
232#endif
233#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
234 case CSR_MLME_DEL_RX_TRIGGER_REQUEST_ID:
235 size += SIZEOF_UINT16;
236 size += SIZEOF_UINT16;
237 size += SIZEOF_UINT16;
238 size += SIZEOF_UINT16;
239 size += SIZEOF_UINT16;
240 size += SIZEOF_UINT16;
241 break;
242#endif
243#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
244 case CSR_MLME_TRIGGERED_GET_INDICATION_ID:
245 size += SIZEOF_UINT16;
246 size += SIZEOF_UINT16;
247 size += SIZEOF_UINT16;
248 size += SIZEOF_UINT16;
249 size += SIZEOF_UINT16;
250 size += SIZEOF_UINT16;
251 size += SIZEOF_UINT16;
252 size += SIZEOF_UINT16;
253 break;
254#endif
255#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
256 case CSR_MLME_SCAN_REQUEST_ID:
257 size += SIZEOF_UINT16;
258 size += SIZEOF_UINT16;
259 size += SIZEOF_UINT16;
260 size += SIZEOF_UINT16;
261 size += SIZEOF_UINT16;
262 size += SIZEOF_UINT16;
263 size += SIZEOF_UINT16;
264 size += SIZEOF_UINT32;
265 size += SIZEOF_UINT16;
266 size += SIZEOF_UINT16;
267 break;
268#endif
269#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
270 case CSR_MLME_DELETEKEYS_CONFIRM_ID:
271 size += SIZEOF_UINT16;
272 size += SIZEOF_UINT16;
273 size += SIZEOF_UINT16;
274 size += SIZEOF_UINT16;
275 size += SIZEOF_UINT16;
276 size += SIZEOF_UINT16;
277 break;
278#endif
279#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
280 case CSR_MLME_GET_NEXT_REQUEST_ID:
281 size += SIZEOF_UINT16;
282 size += SIZEOF_UINT16;
283 size += SIZEOF_UINT16;
284 size += SIZEOF_UINT16;
285 break;
286#endif
287#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
288 case CSR_MLME_SET_CHANNEL_CONFIRM_ID:
289 size += SIZEOF_UINT16;
290 size += SIZEOF_UINT16;
291 size += SIZEOF_UINT16;
292 size += SIZEOF_UINT16;
293 size += SIZEOF_UINT16;
294 size += SIZEOF_UINT16;
295 break;
296#endif
297#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
298 case CSR_MLME_START_AGGREGATION_REQUEST_ID:
299 size += SIZEOF_UINT16;
300 size += SIZEOF_UINT16;
301 size += SIZEOF_UINT16;
302 size += SIZEOF_UINT16;
303 size += SIZEOF_UINT16;
304 size += 48 / 8;
305 size += SIZEOF_UINT16;
306 size += SIZEOF_UINT16;
307 size += SIZEOF_UINT16;
308 size += SIZEOF_UINT16;
309 size += SIZEOF_UINT16;
310 break;
311#endif
312#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
313 case CSR_MLME_HL_SYNC_REQUEST_ID:
314 size += SIZEOF_UINT16;
315 size += SIZEOF_UINT16;
316 size += SIZEOF_UINT16;
317 size += SIZEOF_UINT16;
318 size += 48 / 8;
319 break;
320#endif
321 case CSR_DEBUG_GENERIC_REQUEST_ID:
322 size += SIZEOF_UINT16;
323 size += SIZEOF_UINT16;
324 size += SIZEOF_UINT16;
325 size += SIZEOF_UINT16;
326 size += SIZEOF_UINT16;
327 size += SIZEOF_UINT16;
328 size += SIZEOF_UINT16;
329 size += SIZEOF_UINT16;
330 size += SIZEOF_UINT16;
331 size += SIZEOF_UINT16;
332 size += SIZEOF_UINT16;
333 size += SIZEOF_UINT16;
334 break;
335#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
336 case CSR_MLME_LEAVE_CONFIRM_ID:
337 size += SIZEOF_UINT16;
338 size += SIZEOF_UINT16;
339 size += SIZEOF_UINT16;
340 size += SIZEOF_UINT16;
341 size += SIZEOF_UINT16;
342 size += SIZEOF_UINT16;
343 break;
344#endif
345#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
346 case CSR_MLME_DEL_TRIGGERED_GET_REQUEST_ID:
347 size += SIZEOF_UINT16;
348 size += SIZEOF_UINT16;
349 size += SIZEOF_UINT16;
350 size += SIZEOF_UINT16;
351 size += SIZEOF_UINT16;
352 size += SIZEOF_UINT16;
353 break;
354#endif
355#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
356 case CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST_ID:
357 size += SIZEOF_UINT16;
358 size += SIZEOF_UINT16;
359 size += SIZEOF_UINT16;
360 size += SIZEOF_UINT16;
361 size += SIZEOF_UINT16;
362 size += SIZEOF_UINT16;
363 break;
364#endif
365#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
366 case CSR_MLME_RESET_REQUEST_ID:
367 size += SIZEOF_UINT16;
368 size += SIZEOF_UINT16;
369 size += SIZEOF_UINT16;
370 size += SIZEOF_UINT16;
371 size += 48 / 8;
372 size += SIZEOF_UINT16;
373 break;
374#endif
375#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
376 case CSR_MLME_SCAN_CANCEL_REQUEST_ID:
377 size += SIZEOF_UINT16;
378 size += SIZEOF_UINT16;
379 size += SIZEOF_UINT16;
380 size += SIZEOF_UINT16;
381 size += SIZEOF_UINT16;
382 break;
383#endif
384#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
385 case CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID:
386 size += SIZEOF_UINT16;
387 size += SIZEOF_UINT16;
388 size += SIZEOF_UINT16;
389 size += SIZEOF_UINT16;
390 size += SIZEOF_UINT16;
391 size += SIZEOF_UINT16;
392 size += SIZEOF_UINT16;
393 break;
394#endif
395#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
396 case CSR_MLME_SET_PACKET_FILTER_REQUEST_ID:
397 size += SIZEOF_UINT16;
398 size += SIZEOF_UINT16;
399 size += SIZEOF_UINT16;
400 size += SIZEOF_UINT16;
401 size += SIZEOF_UINT16;
402 size += SIZEOF_UINT16;
403 size += SIZEOF_UINT32;
404 break;
405#endif
406#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
407 case CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID:
408 size += SIZEOF_UINT16;
409 size += SIZEOF_UINT16;
410 size += SIZEOF_UINT16;
411 size += SIZEOF_UINT16;
412 size += SIZEOF_UINT16;
413 size += SIZEOF_UINT16;
414 size += SIZEOF_UINT16;
415 break;
416#endif
417#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
418 case CSR_MLME_CONNECT_STATUS_REQUEST_ID:
419 size += SIZEOF_UINT16;
420 size += SIZEOF_UINT16;
421 size += SIZEOF_UINT16;
422 size += SIZEOF_UINT16;
423 size += SIZEOF_UINT16;
424 size += SIZEOF_UINT16;
425 size += 48 / 8;
426 size += SIZEOF_UINT16;
427 size += SIZEOF_UINT16;
428 break;
429#endif
430#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
431 case CSR_MLME_LEAVE_REQUEST_ID:
432 size += SIZEOF_UINT16;
433 size += SIZEOF_UINT16;
434 size += SIZEOF_UINT16;
435 size += SIZEOF_UINT16;
436 size += SIZEOF_UINT16;
437 break;
438#endif
439#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
440 case CSR_MLME_CONFIG_QUEUE_REQUEST_ID:
441 size += SIZEOF_UINT16;
442 size += SIZEOF_UINT16;
443 size += SIZEOF_UINT16;
444 size += SIZEOF_UINT16;
445 size += SIZEOF_UINT16;
446 size += SIZEOF_UINT16;
447 size += SIZEOF_UINT16;
448 size += SIZEOF_UINT16;
449 size += SIZEOF_UINT16;
450 break;
451#endif
452#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
453 case CSR_MLME_DEL_TSPEC_CONFIRM_ID:
454 size += SIZEOF_UINT16;
455 size += SIZEOF_UINT16;
456 size += SIZEOF_UINT16;
457 size += SIZEOF_UINT16;
458 size += SIZEOF_UINT16;
459 size += SIZEOF_UINT16;
460 size += SIZEOF_UINT16;
461 break;
462#endif
463 case CSR_MLME_SET_TIM_CONFIRM_ID:
464 size += SIZEOF_UINT16;
465 size += SIZEOF_UINT16;
466 size += SIZEOF_UINT16;
467 size += SIZEOF_UINT16;
468 size += SIZEOF_UINT16;
469 size += SIZEOF_UINT16;
470 break;
471#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
472 case CSR_MLME_MEASURE_INDICATION_ID:
473 size += SIZEOF_UINT16;
474 size += SIZEOF_UINT16;
475 size += SIZEOF_UINT16;
476 size += SIZEOF_UINT16;
477 size += SIZEOF_UINT16;
478 break;
479#endif
480#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
481 case CSR_MLME_DEL_BLACKOUT_CONFIRM_ID:
482 size += SIZEOF_UINT16;
483 size += SIZEOF_UINT16;
484 size += SIZEOF_UINT16;
485 size += SIZEOF_UINT16;
486 size += SIZEOF_UINT16;
487 size += SIZEOF_UINT16;
488 size += SIZEOF_UINT16;
489 break;
490#endif
491#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
492 case CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID:
493 size += SIZEOF_UINT16;
494 size += SIZEOF_UINT16;
495 size += SIZEOF_UINT16;
496 size += SIZEOF_UINT16;
497 size += SIZEOF_UINT16;
498 size += SIZEOF_UINT16;
499 size += SIZEOF_UINT16;
500 break;
501#endif
502 case CSR_DEBUG_GENERIC_INDICATION_ID:
503 size += SIZEOF_UINT16;
504 size += SIZEOF_UINT16;
505 size += SIZEOF_UINT16;
506 size += SIZEOF_UINT16;
507 size += SIZEOF_UINT16;
508 size += SIZEOF_UINT16;
509 size += SIZEOF_UINT16;
510 size += SIZEOF_UINT16;
511 size += SIZEOF_UINT16;
512 size += SIZEOF_UINT16;
513 size += SIZEOF_UINT16;
514 size += SIZEOF_UINT16;
515 break;
516 case CSR_MA_PACKET_CANCEL_REQUEST_ID:
517 size += SIZEOF_UINT16;
518 size += SIZEOF_UINT16;
519 size += SIZEOF_UINT16;
520 size += SIZEOF_UINT16;
521 size += SIZEOF_UINT16;
522 size += SIZEOF_UINT32;
523 break;
524#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
525 case CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID:
526 size += SIZEOF_UINT16;
527 size += SIZEOF_UINT16;
528 size += SIZEOF_UINT16;
529 size += SIZEOF_UINT16;
530 size += SIZEOF_UINT16;
531 size += SIZEOF_UINT16;
532 break;
533#endif
534#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
535 case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID:
536 size += SIZEOF_UINT16;
537 size += SIZEOF_UINT16;
538 size += SIZEOF_UINT16;
539 size += SIZEOF_UINT16;
540 size += SIZEOF_UINT16;
541 size += SIZEOF_UINT16;
542 size += SIZEOF_UINT16;
543 break;
544#endif
545 case CSR_MA_PACKET_REQUEST_ID:
546 size += SIZEOF_UINT16;
547 size += SIZEOF_UINT16;
548 size += SIZEOF_UINT16;
549 size += SIZEOF_UINT16;
550 size += SIZEOF_UINT16;
551 size += SIZEOF_UINT16;
552 size += SIZEOF_UINT32;
553 size += SIZEOF_UINT16;
554 size += 48 / 8;
555 size += SIZEOF_UINT16;
556 break;
557#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
558 case CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST_ID:
559 size += SIZEOF_UINT16;
560 size += SIZEOF_UINT16;
561 size += SIZEOF_UINT16;
562 size += SIZEOF_UINT16;
563 size += SIZEOF_UINT16;
564 size += SIZEOF_UINT16;
565 size += SIZEOF_UINT16;
566 size += SIZEOF_UINT16;
567 size += 48 / 8;
568 size += SIZEOF_UINT16;
569 break;
570#endif
571#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
572 case CSR_MLME_ADD_RX_TRIGGER_REQUEST_ID:
573 size += SIZEOF_UINT16;
574 size += SIZEOF_UINT16;
575 size += SIZEOF_UINT16;
576 size += SIZEOF_UINT16;
577 size += SIZEOF_UINT16;
578 size += SIZEOF_UINT16;
579 size += SIZEOF_UINT16;
580 break;
581#endif
582 case CSR_MA_VIF_AVAILABILITY_INDICATION_ID:
583 size += SIZEOF_UINT16;
584 size += SIZEOF_UINT16;
585 size += SIZEOF_UINT16;
586 size += SIZEOF_UINT16;
587 size += SIZEOF_UINT16;
588 size += SIZEOF_UINT16;
589 break;
590#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
591 case CSR_MLME_HL_SYNC_CANCEL_REQUEST_ID:
592 size += SIZEOF_UINT16;
593 size += SIZEOF_UINT16;
594 size += SIZEOF_UINT16;
595 size += SIZEOF_UINT16;
596 size += 48 / 8;
597 break;
598#endif
599#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
600 case CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST_ID:
601 size += SIZEOF_UINT16;
602 size += SIZEOF_UINT16;
603 size += SIZEOF_UINT16;
604 size += SIZEOF_UINT16;
605 size += SIZEOF_UINT16;
606 size += SIZEOF_UINT16;
607 break;
608#endif
609#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
610 case CSR_MLME_BLACKOUT_ENDED_INDICATION_ID:
611 size += SIZEOF_UINT16;
612 size += SIZEOF_UINT16;
613 size += SIZEOF_UINT16;
614 size += SIZEOF_UINT16;
615 size += SIZEOF_UINT16;
616 size += SIZEOF_UINT16;
617 break;
618#endif
619#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
620 case CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION_ID:
621 size += SIZEOF_UINT16;
622 size += SIZEOF_UINT16;
623 size += SIZEOF_UINT16;
624 size += SIZEOF_UINT16;
625 size += SIZEOF_UINT16;
626 size += SIZEOF_UINT16;
627 size += SIZEOF_UINT16;
628 break;
629#endif
630#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
631 case CSR_MLME_GET_KEY_SEQUENCE_REQUEST_ID:
632 size += SIZEOF_UINT16;
633 size += SIZEOF_UINT16;
634 size += SIZEOF_UINT16;
635 size += SIZEOF_UINT16;
636 size += SIZEOF_UINT16;
637 size += SIZEOF_UINT16;
638 size += SIZEOF_UINT16;
639 size += 48 / 8;
640 break;
641#endif
642#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
643 case CSR_MLME_SET_CHANNEL_REQUEST_ID:
644 size += SIZEOF_UINT16;
645 size += SIZEOF_UINT16;
646 size += SIZEOF_UINT16;
647 size += SIZEOF_UINT16;
648 size += SIZEOF_UINT16;
649 size += SIZEOF_UINT16;
650 size += SIZEOF_UINT16;
651 size += 48 / 8;
652 size += SIZEOF_UINT16;
653 size += SIZEOF_UINT16;
654 break;
655#endif
656#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
657 case CSR_MLME_MEASURE_CONFIRM_ID:
658 size += SIZEOF_UINT16;
659 size += SIZEOF_UINT16;
660 size += SIZEOF_UINT16;
661 size += SIZEOF_UINT16;
662 size += SIZEOF_UINT16;
663 size += SIZEOF_UINT16;
664 break;
665#endif
666#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
667 case CSR_MLME_ADD_TRIGGERED_GET_REQUEST_ID:
668 size += SIZEOF_UINT16;
669 size += SIZEOF_UINT16;
670 size += SIZEOF_UINT16;
671 size += SIZEOF_UINT16;
672 size += SIZEOF_UINT16;
673 size += SIZEOF_UINT16;
674 break;
675#endif
676#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
677 case CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION_ID:
678 size += SIZEOF_UINT16;
679 size += SIZEOF_UINT16;
680 size += SIZEOF_UINT16;
681 size += SIZEOF_UINT16;
682 size += SIZEOF_UINT16;
683 size += 48 / 8;
684 break;
685#endif
686 case CSR_MA_VIF_AVAILABILITY_RESPONSE_ID:
687 size += SIZEOF_UINT16;
688 size += SIZEOF_UINT16;
689 size += SIZEOF_UINT16;
690 size += SIZEOF_UINT16;
691 size += SIZEOF_UINT16;
692 size += SIZEOF_UINT16;
693 break;
694#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
695 case CSR_MLME_ADD_TEMPLATE_REQUEST_ID:
696 size += SIZEOF_UINT16;
697 size += SIZEOF_UINT16;
698 size += SIZEOF_UINT16;
699 size += SIZEOF_UINT16;
700 size += SIZEOF_UINT16;
701 size += SIZEOF_UINT16;
702 size += SIZEOF_UINT16;
703 break;
704#endif
705#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
706 case CSR_MLME_POWERMGT_CONFIRM_ID:
707 size += SIZEOF_UINT16;
708 size += SIZEOF_UINT16;
709 size += SIZEOF_UINT16;
710 size += SIZEOF_UINT16;
711 size += SIZEOF_UINT16;
712 size += SIZEOF_UINT16;
713 break;
714#endif
715#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
716 case CSR_MLME_ADD_PERIODIC_CONFIRM_ID:
717 size += SIZEOF_UINT16;
718 size += SIZEOF_UINT16;
719 size += SIZEOF_UINT16;
720 size += SIZEOF_UINT16;
721 size += SIZEOF_UINT16;
722 size += SIZEOF_UINT16;
723 size += SIZEOF_UINT16;
724 break;
725#endif
726#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
727 case CSR_MLME_GET_CONFIRM_ID:
728 size += SIZEOF_UINT16;
729 size += SIZEOF_UINT16;
730 size += SIZEOF_UINT16;
731 size += SIZEOF_UINT16;
732 size += SIZEOF_UINT16;
733 size += SIZEOF_UINT16;
734 break;
735#endif
736#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
737 case CSR_MLME_GET_NEXT_CONFIRM_ID:
738 size += SIZEOF_UINT16;
739 size += SIZEOF_UINT16;
740 size += SIZEOF_UINT16;
741 size += SIZEOF_UINT16;
742 size += SIZEOF_UINT16;
743 size += SIZEOF_UINT16;
744 break;
745#endif
746#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
747 case CSR_MLME_STOP_AGGREGATION_REQUEST_ID:
748 size += SIZEOF_UINT16;
749 size += SIZEOF_UINT16;
750 size += SIZEOF_UINT16;
751 size += SIZEOF_UINT16;
752 size += SIZEOF_UINT16;
753 size += 48 / 8;
754 size += SIZEOF_UINT16;
755 size += SIZEOF_UINT16;
756 break;
757#endif
758#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
759 case CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID:
760 size += SIZEOF_UINT16;
761 size += SIZEOF_UINT16;
762 size += SIZEOF_UINT16;
763 size += SIZEOF_UINT16;
764 size += SIZEOF_UINT16;
765 size += SIZEOF_UINT16;
766 size += SIZEOF_UINT16;
767 break;
768#endif
769#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
770 case CSR_MLME_ADD_BLACKOUT_REQUEST_ID:
771 size += SIZEOF_UINT16;
772 size += SIZEOF_UINT16;
773 size += SIZEOF_UINT16;
774 size += SIZEOF_UINT16;
775 size += SIZEOF_UINT16;
776 size += SIZEOF_UINT16;
777 size += SIZEOF_UINT16;
778 size += SIZEOF_UINT16;
779 size += SIZEOF_UINT32;
780 size += SIZEOF_UINT32;
781 size += SIZEOF_UINT32;
782 size += 48 / 8;
783 size += SIZEOF_UINT16;
784 break;
785#endif
786#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
787 case CSR_MLME_DELETEKEYS_REQUEST_ID:
788 size += SIZEOF_UINT16;
789 size += SIZEOF_UINT16;
790 size += SIZEOF_UINT16;
791 size += SIZEOF_UINT16;
792 size += SIZEOF_UINT16;
793 size += SIZEOF_UINT16;
794 size += SIZEOF_UINT16;
795 size += 48 / 8;
796 break;
797#endif
798#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
799 case CSR_MLME_RESET_CONFIRM_ID:
800 size += SIZEOF_UINT16;
801 size += SIZEOF_UINT16;
802 size += SIZEOF_UINT16;
803 size += SIZEOF_UINT16;
804 size += SIZEOF_UINT16;
805 break;
806#endif
807#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
808 case CSR_MLME_HL_SYNC_CONFIRM_ID:
809 size += SIZEOF_UINT16;
810 size += SIZEOF_UINT16;
811 size += SIZEOF_UINT16;
812 size += SIZEOF_UINT16;
813 size += 48 / 8;
814 size += SIZEOF_UINT16;
815 break;
816#endif
817#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
818 case CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST_ID:
819 size += SIZEOF_UINT16;
820 size += SIZEOF_UINT16;
821 size += SIZEOF_UINT16;
822 size += SIZEOF_UINT16;
823 size += SIZEOF_UINT16;
824 size += SIZEOF_UINT16;
825 size += SIZEOF_UINT16;
826 size += SIZEOF_UINT16;
827 size += SIZEOF_UINT16;
828 size += SIZEOF_UINT32;
829 size += SIZEOF_UINT16;
830 size += SIZEOF_UINT16;
831 break;
832#endif
833#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
834 case CSR_MLME_SET_REQUEST_ID:
835 size += SIZEOF_UINT16;
836 size += SIZEOF_UINT16;
837 size += SIZEOF_UINT16;
838 size += SIZEOF_UINT16;
839 break;
840#endif
841#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
842 case CSR_MLME_SM_START_REQUEST_ID:
843 size += SIZEOF_UINT16;
844 size += SIZEOF_UINT16;
845 size += SIZEOF_UINT16;
846 size += SIZEOF_UINT16;
847 size += SIZEOF_UINT16;
848 size += SIZEOF_UINT16;
849 size += SIZEOF_UINT16;
850 size += 48 / 8;
851 size += 48 / 8;
852 size += SIZEOF_UINT16;
853 size += SIZEOF_UINT16;
854 size += SIZEOF_UINT16;
855 break;
856#endif
857#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
858 case CSR_MLME_CONNECT_STATUS_CONFIRM_ID:
859 size += SIZEOF_UINT16;
860 size += SIZEOF_UINT16;
861 size += SIZEOF_UINT16;
862 size += SIZEOF_UINT16;
863 size += SIZEOF_UINT16;
864 size += SIZEOF_UINT16;
865 break;
866#endif
867#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
868 case CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID:
869 size += SIZEOF_UINT16;
870 size += SIZEOF_UINT16;
871 size += SIZEOF_UINT16;
872 size += SIZEOF_UINT16;
873 size += SIZEOF_UINT16;
874 size += SIZEOF_UINT16;
875 size += SIZEOF_UINT16;
876 break;
877#endif
878#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
879 case CSR_MLME_DEL_PERIODIC_REQUEST_ID:
880 size += SIZEOF_UINT16;
881 size += SIZEOF_UINT16;
882 size += SIZEOF_UINT16;
883 size += SIZEOF_UINT16;
884 size += SIZEOF_UINT16;
885 size += SIZEOF_UINT16;
886 break;
887#endif
888#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
889 case CSR_MLME_SETKEYS_REQUEST_ID:
890 size += SIZEOF_UINT16;
891 size += SIZEOF_UINT16;
892 size += SIZEOF_UINT16;
893 size += SIZEOF_UINT16;
894 size += SIZEOF_UINT16;
895 size += SIZEOF_UINT16;
896 size += SIZEOF_UINT16;
897 size += SIZEOF_UINT16;
898 size += 48 / 8;
899 size += SIZEOF_UINT16;
900 size += SIZEOF_UINT16;
901 size += SIZEOF_UINT16;
902 size += SIZEOF_UINT16;
903 size += SIZEOF_UINT16;
904 size += SIZEOF_UINT16;
905 size += SIZEOF_UINT16;
906 size += SIZEOF_UINT16;
907 size += 32 / 8;
908 break;
909#endif
910#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
911 case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST_ID:
912 size += SIZEOF_UINT16;
913 size += SIZEOF_UINT16;
914 size += SIZEOF_UINT16;
915 size += SIZEOF_UINT16;
916 size += SIZEOF_UINT16;
917 size += SIZEOF_UINT16;
918 size += SIZEOF_UINT16;
919 break;
920#endif
921#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
922 case CSR_MLME_GET_REQUEST_ID:
923 size += SIZEOF_UINT16;
924 size += SIZEOF_UINT16;
925 size += SIZEOF_UINT16;
926 size += SIZEOF_UINT16;
927 break;
928#endif
929#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
930 case CSR_MLME_POWERMGT_REQUEST_ID:
931 size += SIZEOF_UINT16;
932 size += SIZEOF_UINT16;
933 size += SIZEOF_UINT16;
934 size += SIZEOF_UINT16;
935 size += SIZEOF_UINT16;
936 size += SIZEOF_UINT16;
937 size += SIZEOF_UINT16;
938 size += SIZEOF_UINT16;
939 size += SIZEOF_UINT16;
940 break;
941#endif
942 case CSR_MA_PACKET_ERROR_INDICATION_ID:
943 size += SIZEOF_UINT16;
944 size += SIZEOF_UINT16;
945 size += SIZEOF_UINT16;
946 size += SIZEOF_UINT16;
947 size += SIZEOF_UINT16;
948 size += 48 / 8;
949 size += SIZEOF_UINT16;
950 size += SIZEOF_UINT16;
951 break;
952#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
953 case CSR_MLME_ADD_PERIODIC_REQUEST_ID:
954 size += SIZEOF_UINT16;
955 size += SIZEOF_UINT16;
956 size += SIZEOF_UINT16;
957 size += SIZEOF_UINT16;
958 size += SIZEOF_UINT16;
959 size += SIZEOF_UINT16;
960 size += SIZEOF_UINT32;
961 size += SIZEOF_UINT16;
962 size += SIZEOF_UINT16;
963 size += SIZEOF_UINT16;
964 break;
965#endif
966#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
967 case CSR_MLME_ADD_TSPEC_REQUEST_ID:
968 size += SIZEOF_UINT16;
969 size += SIZEOF_UINT16;
970 size += SIZEOF_UINT16;
971 size += SIZEOF_UINT16;
972 size += SIZEOF_UINT16;
973 size += SIZEOF_UINT16;
974 size += SIZEOF_UINT16;
975 size += SIZEOF_UINT16;
976 size += SIZEOF_UINT16;
977 size += SIZEOF_UINT32;
978 size += SIZEOF_UINT32;
979 size += SIZEOF_UINT16;
980 break;
981#endif
982#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
983 case CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID:
984 size += SIZEOF_UINT16;
985 size += SIZEOF_UINT16;
986 size += SIZEOF_UINT16;
987 size += SIZEOF_UINT16;
988 size += SIZEOF_UINT16;
989 size += SIZEOF_UINT16;
990 break;
991#endif
992#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
993 case CSR_MLME_ADD_TSPEC_CONFIRM_ID:
994 size += SIZEOF_UINT16;
995 size += SIZEOF_UINT16;
996 size += SIZEOF_UINT16;
997 size += SIZEOF_UINT16;
998 size += SIZEOF_UINT16;
999 size += SIZEOF_UINT16;
1000 size += SIZEOF_UINT16;
1001 break;
1002#endif
1003#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1004 case CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID:
1005 size += SIZEOF_UINT16;
1006 size += SIZEOF_UINT16;
1007 size += SIZEOF_UINT16;
1008 size += SIZEOF_UINT16;
1009 size += SIZEOF_UINT16;
1010 break;
1011#endif
1012#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1013 case CSR_MLME_SCAN_CONFIRM_ID:
1014 size += SIZEOF_UINT16;
1015 size += SIZEOF_UINT16;
1016 size += SIZEOF_UINT16;
1017 size += SIZEOF_UINT16;
1018 size += SIZEOF_UINT16;
1019 size += SIZEOF_UINT16;
1020 break;
1021#endif
1022 case CSR_DEBUG_STRING_INDICATION_ID:
1023 size += SIZEOF_UINT16;
1024 size += SIZEOF_UINT16;
1025 size += SIZEOF_UINT16;
1026 size += SIZEOF_UINT16;
1027 break;
1028#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1029 case CSR_MLME_ADD_TEMPLATE_CONFIRM_ID:
1030 size += SIZEOF_UINT16;
1031 size += SIZEOF_UINT16;
1032 size += SIZEOF_UINT16;
1033 size += SIZEOF_UINT16;
1034 size += SIZEOF_UINT16;
1035 size += SIZEOF_UINT16;
1036 size += SIZEOF_UINT16;
1037 break;
1038#endif
1039#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1040 case CSR_MLME_BLOCKACK_ERROR_INDICATION_ID:
1041 size += SIZEOF_UINT16;
1042 size += SIZEOF_UINT16;
1043 size += SIZEOF_UINT16;
1044 size += SIZEOF_UINT16;
1045 size += SIZEOF_UINT16;
1046 size += SIZEOF_UINT16;
1047 size += 48 / 8;
1048 break;
1049#endif
1050#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1051 case CSR_MLME_SET_CONFIRM_ID:
1052 size += SIZEOF_UINT16;
1053 size += SIZEOF_UINT16;
1054 size += SIZEOF_UINT16;
1055 size += SIZEOF_UINT16;
1056 size += SIZEOF_UINT16;
1057 size += SIZEOF_UINT16;
1058 break;
1059#endif
1060#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1061 case CSR_MLME_MEASURE_REQUEST_ID:
1062 size += SIZEOF_UINT16;
1063 size += SIZEOF_UINT16;
1064 size += SIZEOF_UINT16;
1065 size += SIZEOF_UINT16;
1066 size += SIZEOF_UINT16;
1067 break;
1068#endif
1069#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1070 case CSR_MLME_START_AGGREGATION_CONFIRM_ID:
1071 size += SIZEOF_UINT16;
1072 size += SIZEOF_UINT16;
1073 size += SIZEOF_UINT16;
1074 size += SIZEOF_UINT16;
1075 size += SIZEOF_UINT16;
1076 size += 48 / 8;
1077 size += SIZEOF_UINT16;
1078 size += SIZEOF_UINT16;
1079 size += SIZEOF_UINT16;
1080 size += SIZEOF_UINT16;
1081 break;
1082#endif
1083#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1084 case CSR_MLME_STOP_MEASURE_CONFIRM_ID:
1085 size += SIZEOF_UINT16;
1086 size += SIZEOF_UINT16;
1087 size += SIZEOF_UINT16;
1088 size += SIZEOF_UINT16;
1089 size += SIZEOF_UINT16;
1090 size += SIZEOF_UINT16;
1091 break;
1092#endif
1093 case CSR_MA_PACKET_CONFIRM_ID:
1094 size += SIZEOF_UINT16;
1095 size += SIZEOF_UINT16;
1096 size += SIZEOF_UINT16;
1097 size += SIZEOF_UINT16;
1098 size += SIZEOF_UINT16;
1099 size += SIZEOF_UINT16;
1100 size += SIZEOF_UINT16;
1101 size += SIZEOF_UINT16;
1102 size += SIZEOF_UINT32;
1103 break;
1104#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1105 case CSR_MLME_DEL_PERIODIC_CONFIRM_ID:
1106 size += SIZEOF_UINT16;
1107 size += SIZEOF_UINT16;
1108 size += SIZEOF_UINT16;
1109 size += SIZEOF_UINT16;
1110 size += SIZEOF_UINT16;
1111 size += SIZEOF_UINT16;
1112 size += SIZEOF_UINT16;
1113 break;
1114#endif
1115#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1116 case CSR_MLME_STOP_MEASURE_REQUEST_ID:
1117 size += SIZEOF_UINT16;
1118 size += SIZEOF_UINT16;
1119 size += SIZEOF_UINT16;
1120 size += SIZEOF_UINT16;
1121 size += SIZEOF_UINT16;
1122 break;
1123#endif
1124 default:
1125 size = 0;
1126 }
1127 return size;
1128} /* get_packed_struct_size() */
1129
1130
1131/*
1132 * ---------------------------------------------------------------------------
1133 * read_unpack_signal
1134 *
1135 * Unpack a wire-format signal into a host-native structure.
1136 * This function handles any necessary conversions for endianness and
1137 * places no restrictions on packing or alignment for the structure
1138 * definition.
1139 *
1140 * WARNING: This function is auto-generated, DO NOT EDIT!
1141 *
1142 * Arguments:
1143 * ptr Signal buffer to unpack.
1144 * sig Pointer to destination structure to populate.
1145 *
1146 * Returns:
1147 * CSR_RESULT_SUCCESS on success,
1148 * CSR_WIFI_HIP_RESULT_INVALID_VALUE if the ID of signal was not recognised.
1149 * ---------------------------------------------------------------------------
1150 */
1151CsrResult read_unpack_signal(const u8 *ptr, CSR_SIGNAL *sig)
1152{
1153 s32 index = 0;
1154
1155 sig->SignalPrimitiveHeader.SignalId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1156 index += SIZEOF_UINT16;
1157
1158 sig->SignalPrimitiveHeader.ReceiverProcessId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1159 index += SIZEOF_UINT16;
1160
1161 sig->SignalPrimitiveHeader.SenderProcessId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1162 index += SIZEOF_UINT16;
1163
1164 switch (sig->SignalPrimitiveHeader.SignalId)
1165 {
1166#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1167 case CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID:
1168 sig->u.MlmeSetPacketFilterConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1169 index += SIZEOF_UINT16;
1170 sig->u.MlmeSetPacketFilterConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1171 index += SIZEOF_UINT16;
1172 sig->u.MlmeSetPacketFilterConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1173 index += SIZEOF_UINT16;
1174 sig->u.MlmeSetPacketFilterConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1175 index += SIZEOF_UINT16;
1176 sig->u.MlmeSetPacketFilterConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1177 index += SIZEOF_UINT16;
1178 sig->u.MlmeSetPacketFilterConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1179 index += SIZEOF_UINT16;
1180 break;
1181#endif
1182#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1183 case CSR_MLME_SETKEYS_CONFIRM_ID:
1184 sig->u.MlmeSetkeysConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1185 index += SIZEOF_UINT16;
1186 sig->u.MlmeSetkeysConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1187 index += SIZEOF_UINT16;
1188 sig->u.MlmeSetkeysConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1189 index += SIZEOF_UINT16;
1190 sig->u.MlmeSetkeysConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1191 index += SIZEOF_UINT16;
1192 sig->u.MlmeSetkeysConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1193 index += SIZEOF_UINT16;
1194 sig->u.MlmeSetkeysConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1195 index += SIZEOF_UINT16;
1196 break;
1197#endif
1198#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1199 case CSR_MLME_CONFIG_QUEUE_CONFIRM_ID:
1200 sig->u.MlmeConfigQueueConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1201 index += SIZEOF_UINT16;
1202 sig->u.MlmeConfigQueueConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1203 index += SIZEOF_UINT16;
1204 sig->u.MlmeConfigQueueConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1205 index += SIZEOF_UINT16;
1206 sig->u.MlmeConfigQueueConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1207 index += SIZEOF_UINT16;
1208 sig->u.MlmeConfigQueueConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1209 index += SIZEOF_UINT16;
1210 break;
1211#endif
1212#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1213 case CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID:
1214 sig->u.MlmeAddAutonomousScanConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1215 index += SIZEOF_UINT16;
1216 sig->u.MlmeAddAutonomousScanConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1217 index += SIZEOF_UINT16;
1218 sig->u.MlmeAddAutonomousScanConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1219 index += SIZEOF_UINT16;
1220 sig->u.MlmeAddAutonomousScanConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1221 index += SIZEOF_UINT16;
1222 sig->u.MlmeAddAutonomousScanConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1223 index += SIZEOF_UINT16;
1224 sig->u.MlmeAddAutonomousScanConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1225 index += SIZEOF_UINT16;
1226 sig->u.MlmeAddAutonomousScanConfirm.AutonomousScanId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1227 index += SIZEOF_UINT16;
1228 break;
1229#endif
1230#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1231 case CSR_MLME_ADD_BLACKOUT_CONFIRM_ID:
1232 sig->u.MlmeAddBlackoutConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1233 index += SIZEOF_UINT16;
1234 sig->u.MlmeAddBlackoutConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1235 index += SIZEOF_UINT16;
1236 sig->u.MlmeAddBlackoutConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1237 index += SIZEOF_UINT16;
1238 sig->u.MlmeAddBlackoutConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1239 index += SIZEOF_UINT16;
1240 sig->u.MlmeAddBlackoutConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1241 index += SIZEOF_UINT16;
1242 sig->u.MlmeAddBlackoutConfirm.BlackoutId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1243 index += SIZEOF_UINT16;
1244 sig->u.MlmeAddBlackoutConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1245 index += SIZEOF_UINT16;
1246 break;
1247#endif
1248#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1249 case CSR_MLME_DEL_BLACKOUT_REQUEST_ID:
1250 sig->u.MlmeDelBlackoutRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1251 index += SIZEOF_UINT16;
1252 sig->u.MlmeDelBlackoutRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1253 index += SIZEOF_UINT16;
1254 sig->u.MlmeDelBlackoutRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1255 index += SIZEOF_UINT16;
1256 sig->u.MlmeDelBlackoutRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1257 index += SIZEOF_UINT16;
1258 sig->u.MlmeDelBlackoutRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1259 index += SIZEOF_UINT16;
1260 sig->u.MlmeDelBlackoutRequest.BlackoutId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1261 index += SIZEOF_UINT16;
1262 break;
1263#endif
1264#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1265 case CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID:
1266 sig->u.MlmeGetKeySequenceConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1267 index += SIZEOF_UINT16;
1268 sig->u.MlmeGetKeySequenceConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1269 index += SIZEOF_UINT16;
1270 sig->u.MlmeGetKeySequenceConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1271 index += SIZEOF_UINT16;
1272 sig->u.MlmeGetKeySequenceConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1273 index += SIZEOF_UINT16;
1274 sig->u.MlmeGetKeySequenceConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1275 index += SIZEOF_UINT16;
1276 sig->u.MlmeGetKeySequenceConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1277 index += SIZEOF_UINT16;
1278 sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[0] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1279 index += SIZEOF_UINT16;
1280 sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[1] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1281 index += SIZEOF_UINT16;
1282 sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[2] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1283 index += SIZEOF_UINT16;
1284 sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[3] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1285 index += SIZEOF_UINT16;
1286 sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[4] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1287 index += SIZEOF_UINT16;
1288 sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[5] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1289 index += SIZEOF_UINT16;
1290 sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[6] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1291 index += SIZEOF_UINT16;
1292 sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[7] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1293 index += SIZEOF_UINT16;
1294 break;
1295#endif
1296#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1297 case CSR_MLME_SM_START_CONFIRM_ID:
1298 sig->u.MlmeSmStartConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1299 index += SIZEOF_UINT16;
1300 sig->u.MlmeSmStartConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1301 index += SIZEOF_UINT16;
1302 sig->u.MlmeSmStartConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1303 index += SIZEOF_UINT16;
1304 sig->u.MlmeSmStartConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1305 index += SIZEOF_UINT16;
1306 sig->u.MlmeSmStartConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1307 index += SIZEOF_UINT16;
1308 sig->u.MlmeSmStartConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1309 index += SIZEOF_UINT16;
1310 break;
1311#endif
1312#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1313 case CSR_MLME_STOP_AGGREGATION_CONFIRM_ID:
1314 sig->u.MlmeStopAggregationConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1315 index += SIZEOF_UINT16;
1316 sig->u.MlmeStopAggregationConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1317 index += SIZEOF_UINT16;
1318 sig->u.MlmeStopAggregationConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1319 index += SIZEOF_UINT16;
1320 sig->u.MlmeStopAggregationConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1321 index += SIZEOF_UINT16;
1322 sig->u.MlmeStopAggregationConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1323 index += SIZEOF_UINT16;
1324 memcpy(sig->u.MlmeStopAggregationConfirm.PeerQstaAddress.x, &ptr[index], 48 / 8);
1325 index += 48 / 8;
1326 sig->u.MlmeStopAggregationConfirm.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1327 index += SIZEOF_UINT16;
1328 sig->u.MlmeStopAggregationConfirm.Direction = (CSR_DIRECTION) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1329 index += SIZEOF_UINT16;
1330 sig->u.MlmeStopAggregationConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1331 index += SIZEOF_UINT16;
1332 break;
1333#endif
1334#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1335 case CSR_MLME_DEL_TSPEC_REQUEST_ID:
1336 sig->u.MlmeDelTspecRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1337 index += SIZEOF_UINT16;
1338 sig->u.MlmeDelTspecRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1339 index += SIZEOF_UINT16;
1340 sig->u.MlmeDelTspecRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1341 index += SIZEOF_UINT16;
1342 sig->u.MlmeDelTspecRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1343 index += SIZEOF_UINT16;
1344 sig->u.MlmeDelTspecRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1345 index += SIZEOF_UINT16;
1346 sig->u.MlmeDelTspecRequest.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1347 index += SIZEOF_UINT16;
1348 sig->u.MlmeDelTspecRequest.Direction = (CSR_DIRECTION) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1349 index += SIZEOF_UINT16;
1350 break;
1351#endif
1352 case CSR_DEBUG_WORD16_INDICATION_ID:
1353 sig->u.DebugWord16Indication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1354 index += SIZEOF_UINT16;
1355 sig->u.DebugWord16Indication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1356 index += SIZEOF_UINT16;
1357 sig->u.DebugWord16Indication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1358 index += SIZEOF_UINT16;
1359 sig->u.DebugWord16Indication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1360 index += SIZEOF_UINT16;
1361 sig->u.DebugWord16Indication.DebugWords[0] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1362 index += SIZEOF_UINT16;
1363 sig->u.DebugWord16Indication.DebugWords[1] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1364 index += SIZEOF_UINT16;
1365 sig->u.DebugWord16Indication.DebugWords[2] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1366 index += SIZEOF_UINT16;
1367 sig->u.DebugWord16Indication.DebugWords[3] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1368 index += SIZEOF_UINT16;
1369 sig->u.DebugWord16Indication.DebugWords[4] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1370 index += SIZEOF_UINT16;
1371 sig->u.DebugWord16Indication.DebugWords[5] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1372 index += SIZEOF_UINT16;
1373 sig->u.DebugWord16Indication.DebugWords[6] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1374 index += SIZEOF_UINT16;
1375 sig->u.DebugWord16Indication.DebugWords[7] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1376 index += SIZEOF_UINT16;
1377 sig->u.DebugWord16Indication.DebugWords[8] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1378 index += SIZEOF_UINT16;
1379 sig->u.DebugWord16Indication.DebugWords[9] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1380 index += SIZEOF_UINT16;
1381 sig->u.DebugWord16Indication.DebugWords[10] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1382 index += SIZEOF_UINT16;
1383 sig->u.DebugWord16Indication.DebugWords[11] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1384 index += SIZEOF_UINT16;
1385 sig->u.DebugWord16Indication.DebugWords[12] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1386 index += SIZEOF_UINT16;
1387 sig->u.DebugWord16Indication.DebugWords[13] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1388 index += SIZEOF_UINT16;
1389 sig->u.DebugWord16Indication.DebugWords[14] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1390 index += SIZEOF_UINT16;
1391 sig->u.DebugWord16Indication.DebugWords[15] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1392 index += SIZEOF_UINT16;
1393 break;
1394 case CSR_DEBUG_GENERIC_CONFIRM_ID:
1395 sig->u.DebugGenericConfirm.DebugVariable.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1396 index += SIZEOF_UINT16;
1397 sig->u.DebugGenericConfirm.DebugVariable.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1398 index += SIZEOF_UINT16;
1399 sig->u.DebugGenericConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1400 index += SIZEOF_UINT16;
1401 sig->u.DebugGenericConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1402 index += SIZEOF_UINT16;
1403 sig->u.DebugGenericConfirm.DebugWords[0] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1404 index += SIZEOF_UINT16;
1405 sig->u.DebugGenericConfirm.DebugWords[1] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1406 index += SIZEOF_UINT16;
1407 sig->u.DebugGenericConfirm.DebugWords[2] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1408 index += SIZEOF_UINT16;
1409 sig->u.DebugGenericConfirm.DebugWords[3] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1410 index += SIZEOF_UINT16;
1411 sig->u.DebugGenericConfirm.DebugWords[4] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1412 index += SIZEOF_UINT16;
1413 sig->u.DebugGenericConfirm.DebugWords[5] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1414 index += SIZEOF_UINT16;
1415 sig->u.DebugGenericConfirm.DebugWords[6] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1416 index += SIZEOF_UINT16;
1417 sig->u.DebugGenericConfirm.DebugWords[7] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1418 index += SIZEOF_UINT16;
1419 break;
1420 case CSR_MA_PACKET_INDICATION_ID:
1421 sig->u.MaPacketIndication.Data.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1422 index += SIZEOF_UINT16;
1423 sig->u.MaPacketIndication.Data.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1424 index += SIZEOF_UINT16;
1425 sig->u.MaPacketIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1426 index += SIZEOF_UINT16;
1427 sig->u.MaPacketIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1428 index += SIZEOF_UINT16;
1429 sig->u.MaPacketIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1430 index += SIZEOF_UINT16;
1431 memcpy(sig->u.MaPacketIndication.LocalTime.x, &ptr[index], 64 / 8);
1432 index += 64 / 8;
1433 sig->u.MaPacketIndication.Ifindex = (CSR_IFINTERFACE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1434 index += SIZEOF_UINT16;
1435 sig->u.MaPacketIndication.Channel = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1436 index += SIZEOF_UINT16;
1437 sig->u.MaPacketIndication.ReceptionStatus = (CSR_RECEPTION_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1438 index += SIZEOF_UINT16;
1439 sig->u.MaPacketIndication.Rssi = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1440 index += SIZEOF_UINT16;
1441 sig->u.MaPacketIndication.Snr = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1442 index += SIZEOF_UINT16;
1443 sig->u.MaPacketIndication.ReceivedRate = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1444 index += SIZEOF_UINT16;
1445 break;
1446 case CSR_MLME_SET_TIM_REQUEST_ID:
1447 sig->u.MlmeSetTimRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1448 index += SIZEOF_UINT16;
1449 sig->u.MlmeSetTimRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1450 index += SIZEOF_UINT16;
1451 sig->u.MlmeSetTimRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1452 index += SIZEOF_UINT16;
1453 sig->u.MlmeSetTimRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1454 index += SIZEOF_UINT16;
1455 sig->u.MlmeSetTimRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1456 index += SIZEOF_UINT16;
1457 sig->u.MlmeSetTimRequest.AssociationId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1458 index += SIZEOF_UINT16;
1459 sig->u.MlmeSetTimRequest.TimValue = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1460 index += SIZEOF_UINT16;
1461 break;
1462#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1463 case CSR_MLME_CONNECTED_INDICATION_ID:
1464 sig->u.MlmeConnectedIndication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1465 index += SIZEOF_UINT16;
1466 sig->u.MlmeConnectedIndication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1467 index += SIZEOF_UINT16;
1468 sig->u.MlmeConnectedIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1469 index += SIZEOF_UINT16;
1470 sig->u.MlmeConnectedIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1471 index += SIZEOF_UINT16;
1472 sig->u.MlmeConnectedIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1473 index += SIZEOF_UINT16;
1474 sig->u.MlmeConnectedIndication.ConnectionStatus = (CSR_CONNECTION_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1475 index += SIZEOF_UINT16;
1476 memcpy(sig->u.MlmeConnectedIndication.PeerMacAddress.x, &ptr[index], 48 / 8);
1477 index += 48 / 8;
1478 break;
1479#endif
1480#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1481 case CSR_MLME_DEL_RX_TRIGGER_REQUEST_ID:
1482 sig->u.MlmeDelRxTriggerRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1483 index += SIZEOF_UINT16;
1484 sig->u.MlmeDelRxTriggerRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1485 index += SIZEOF_UINT16;
1486 sig->u.MlmeDelRxTriggerRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1487 index += SIZEOF_UINT16;
1488 sig->u.MlmeDelRxTriggerRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1489 index += SIZEOF_UINT16;
1490 sig->u.MlmeDelRxTriggerRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1491 index += SIZEOF_UINT16;
1492 sig->u.MlmeDelRxTriggerRequest.TriggerId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1493 index += SIZEOF_UINT16;
1494 break;
1495#endif
1496#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1497 case CSR_MLME_TRIGGERED_GET_INDICATION_ID:
1498 sig->u.MlmeTriggeredGetIndication.MibAttributeValue.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1499 index += SIZEOF_UINT16;
1500 sig->u.MlmeTriggeredGetIndication.MibAttributeValue.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1501 index += SIZEOF_UINT16;
1502 sig->u.MlmeTriggeredGetIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1503 index += SIZEOF_UINT16;
1504 sig->u.MlmeTriggeredGetIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1505 index += SIZEOF_UINT16;
1506 sig->u.MlmeTriggeredGetIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1507 index += SIZEOF_UINT16;
1508 sig->u.MlmeTriggeredGetIndication.Status = (CSR_MIB_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1509 index += SIZEOF_UINT16;
1510 sig->u.MlmeTriggeredGetIndication.ErrorIndex = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1511 index += SIZEOF_UINT16;
1512 sig->u.MlmeTriggeredGetIndication.TriggeredId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1513 index += SIZEOF_UINT16;
1514 break;
1515#endif
1516#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1517 case CSR_MLME_SCAN_REQUEST_ID:
1518 sig->u.MlmeScanRequest.ChannelList.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1519 index += SIZEOF_UINT16;
1520 sig->u.MlmeScanRequest.ChannelList.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1521 index += SIZEOF_UINT16;
1522 sig->u.MlmeScanRequest.InformationElements.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1523 index += SIZEOF_UINT16;
1524 sig->u.MlmeScanRequest.InformationElements.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1525 index += SIZEOF_UINT16;
1526 sig->u.MlmeScanRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1527 index += SIZEOF_UINT16;
1528 sig->u.MlmeScanRequest.Ifindex = (CSR_IFINTERFACE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1529 index += SIZEOF_UINT16;
1530 sig->u.MlmeScanRequest.ScanType = (CSR_SCAN_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1531 index += SIZEOF_UINT16;
1532 sig->u.MlmeScanRequest.ProbeDelay = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index);
1533 index += SIZEOF_UINT32;
1534 sig->u.MlmeScanRequest.MinChannelTime = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1535 index += SIZEOF_UINT16;
1536 sig->u.MlmeScanRequest.MaxChannelTime = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1537 index += SIZEOF_UINT16;
1538 break;
1539#endif
1540#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1541 case CSR_MLME_DELETEKEYS_CONFIRM_ID:
1542 sig->u.MlmeDeletekeysConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1543 index += SIZEOF_UINT16;
1544 sig->u.MlmeDeletekeysConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1545 index += SIZEOF_UINT16;
1546 sig->u.MlmeDeletekeysConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1547 index += SIZEOF_UINT16;
1548 sig->u.MlmeDeletekeysConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1549 index += SIZEOF_UINT16;
1550 sig->u.MlmeDeletekeysConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1551 index += SIZEOF_UINT16;
1552 sig->u.MlmeDeletekeysConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1553 index += SIZEOF_UINT16;
1554 break;
1555#endif
1556#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1557 case CSR_MLME_GET_NEXT_REQUEST_ID:
1558 sig->u.MlmeGetNextRequest.MibAttribute.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1559 index += SIZEOF_UINT16;
1560 sig->u.MlmeGetNextRequest.MibAttribute.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1561 index += SIZEOF_UINT16;
1562 sig->u.MlmeGetNextRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1563 index += SIZEOF_UINT16;
1564 sig->u.MlmeGetNextRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1565 index += SIZEOF_UINT16;
1566 break;
1567#endif
1568#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1569 case CSR_MLME_SET_CHANNEL_CONFIRM_ID:
1570 sig->u.MlmeSetChannelConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1571 index += SIZEOF_UINT16;
1572 sig->u.MlmeSetChannelConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1573 index += SIZEOF_UINT16;
1574 sig->u.MlmeSetChannelConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1575 index += SIZEOF_UINT16;
1576 sig->u.MlmeSetChannelConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1577 index += SIZEOF_UINT16;
1578 sig->u.MlmeSetChannelConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1579 index += SIZEOF_UINT16;
1580 sig->u.MlmeSetChannelConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1581 index += SIZEOF_UINT16;
1582 break;
1583#endif
1584#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1585 case CSR_MLME_START_AGGREGATION_REQUEST_ID:
1586 sig->u.MlmeStartAggregationRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1587 index += SIZEOF_UINT16;
1588 sig->u.MlmeStartAggregationRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1589 index += SIZEOF_UINT16;
1590 sig->u.MlmeStartAggregationRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1591 index += SIZEOF_UINT16;
1592 sig->u.MlmeStartAggregationRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1593 index += SIZEOF_UINT16;
1594 sig->u.MlmeStartAggregationRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1595 index += SIZEOF_UINT16;
1596 memcpy(sig->u.MlmeStartAggregationRequest.PeerQstaAddress.x, &ptr[index], 48 / 8);
1597 index += 48 / 8;
1598 sig->u.MlmeStartAggregationRequest.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1599 index += SIZEOF_UINT16;
1600 sig->u.MlmeStartAggregationRequest.Direction = (CSR_DIRECTION) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1601 index += SIZEOF_UINT16;
1602 sig->u.MlmeStartAggregationRequest.StartingSequenceNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1603 index += SIZEOF_UINT16;
1604 sig->u.MlmeStartAggregationRequest.BufferSize = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1605 index += SIZEOF_UINT16;
1606 sig->u.MlmeStartAggregationRequest.BlockAckTimeout = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1607 index += SIZEOF_UINT16;
1608 break;
1609#endif
1610#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1611 case CSR_MLME_HL_SYNC_REQUEST_ID:
1612 sig->u.MlmeHlSyncRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1613 index += SIZEOF_UINT16;
1614 sig->u.MlmeHlSyncRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1615 index += SIZEOF_UINT16;
1616 sig->u.MlmeHlSyncRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1617 index += SIZEOF_UINT16;
1618 sig->u.MlmeHlSyncRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1619 index += SIZEOF_UINT16;
1620 memcpy(sig->u.MlmeHlSyncRequest.GroupAddress.x, &ptr[index], 48 / 8);
1621 index += 48 / 8;
1622 break;
1623#endif
1624 case CSR_DEBUG_GENERIC_REQUEST_ID:
1625 sig->u.DebugGenericRequest.DebugVariable.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1626 index += SIZEOF_UINT16;
1627 sig->u.DebugGenericRequest.DebugVariable.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1628 index += SIZEOF_UINT16;
1629 sig->u.DebugGenericRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1630 index += SIZEOF_UINT16;
1631 sig->u.DebugGenericRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1632 index += SIZEOF_UINT16;
1633 sig->u.DebugGenericRequest.DebugWords[0] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1634 index += SIZEOF_UINT16;
1635 sig->u.DebugGenericRequest.DebugWords[1] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1636 index += SIZEOF_UINT16;
1637 sig->u.DebugGenericRequest.DebugWords[2] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1638 index += SIZEOF_UINT16;
1639 sig->u.DebugGenericRequest.DebugWords[3] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1640 index += SIZEOF_UINT16;
1641 sig->u.DebugGenericRequest.DebugWords[4] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1642 index += SIZEOF_UINT16;
1643 sig->u.DebugGenericRequest.DebugWords[5] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1644 index += SIZEOF_UINT16;
1645 sig->u.DebugGenericRequest.DebugWords[6] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1646 index += SIZEOF_UINT16;
1647 sig->u.DebugGenericRequest.DebugWords[7] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1648 index += SIZEOF_UINT16;
1649 break;
1650#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1651 case CSR_MLME_LEAVE_CONFIRM_ID:
1652 sig->u.MlmeLeaveConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1653 index += SIZEOF_UINT16;
1654 sig->u.MlmeLeaveConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1655 index += SIZEOF_UINT16;
1656 sig->u.MlmeLeaveConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1657 index += SIZEOF_UINT16;
1658 sig->u.MlmeLeaveConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1659 index += SIZEOF_UINT16;
1660 sig->u.MlmeLeaveConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1661 index += SIZEOF_UINT16;
1662 sig->u.MlmeLeaveConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1663 index += SIZEOF_UINT16;
1664 break;
1665#endif
1666#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1667 case CSR_MLME_DEL_TRIGGERED_GET_REQUEST_ID:
1668 sig->u.MlmeDelTriggeredGetRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1669 index += SIZEOF_UINT16;
1670 sig->u.MlmeDelTriggeredGetRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1671 index += SIZEOF_UINT16;
1672 sig->u.MlmeDelTriggeredGetRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1673 index += SIZEOF_UINT16;
1674 sig->u.MlmeDelTriggeredGetRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1675 index += SIZEOF_UINT16;
1676 sig->u.MlmeDelTriggeredGetRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1677 index += SIZEOF_UINT16;
1678 sig->u.MlmeDelTriggeredGetRequest.TriggeredId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1679 index += SIZEOF_UINT16;
1680 break;
1681#endif
1682#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1683 case CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST_ID:
1684 sig->u.MlmeAddMulticastAddressRequest.Data.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1685 index += SIZEOF_UINT16;
1686 sig->u.MlmeAddMulticastAddressRequest.Data.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1687 index += SIZEOF_UINT16;
1688 sig->u.MlmeAddMulticastAddressRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1689 index += SIZEOF_UINT16;
1690 sig->u.MlmeAddMulticastAddressRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1691 index += SIZEOF_UINT16;
1692 sig->u.MlmeAddMulticastAddressRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1693 index += SIZEOF_UINT16;
1694 sig->u.MlmeAddMulticastAddressRequest.NumberOfMulticastGroupAddresses = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1695 index += SIZEOF_UINT16;
1696 break;
1697#endif
1698#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1699 case CSR_MLME_RESET_REQUEST_ID:
1700 sig->u.MlmeResetRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1701 index += SIZEOF_UINT16;
1702 sig->u.MlmeResetRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1703 index += SIZEOF_UINT16;
1704 sig->u.MlmeResetRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1705 index += SIZEOF_UINT16;
1706 sig->u.MlmeResetRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1707 index += SIZEOF_UINT16;
1708 memcpy(sig->u.MlmeResetRequest.StaAddress.x, &ptr[index], 48 / 8);
1709 index += 48 / 8;
1710 sig->u.MlmeResetRequest.SetDefaultMib = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1711 index += SIZEOF_UINT16;
1712 break;
1713#endif
1714#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1715 case CSR_MLME_SCAN_CANCEL_REQUEST_ID:
1716 sig->u.MlmeScanCancelRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1717 index += SIZEOF_UINT16;
1718 sig->u.MlmeScanCancelRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1719 index += SIZEOF_UINT16;
1720 sig->u.MlmeScanCancelRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1721 index += SIZEOF_UINT16;
1722 sig->u.MlmeScanCancelRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1723 index += SIZEOF_UINT16;
1724 sig->u.MlmeScanCancelRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1725 index += SIZEOF_UINT16;
1726 break;
1727#endif
1728#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1729 case CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID:
1730 sig->u.MlmeAddTriggeredGetConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1731 index += SIZEOF_UINT16;
1732 sig->u.MlmeAddTriggeredGetConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1733 index += SIZEOF_UINT16;
1734 sig->u.MlmeAddTriggeredGetConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1735 index += SIZEOF_UINT16;
1736 sig->u.MlmeAddTriggeredGetConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1737 index += SIZEOF_UINT16;
1738 sig->u.MlmeAddTriggeredGetConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1739 index += SIZEOF_UINT16;
1740 sig->u.MlmeAddTriggeredGetConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1741 index += SIZEOF_UINT16;
1742 sig->u.MlmeAddTriggeredGetConfirm.TriggeredId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1743 index += SIZEOF_UINT16;
1744 break;
1745#endif
1746#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1747 case CSR_MLME_SET_PACKET_FILTER_REQUEST_ID:
1748 sig->u.MlmeSetPacketFilterRequest.InformationElements.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1749 index += SIZEOF_UINT16;
1750 sig->u.MlmeSetPacketFilterRequest.InformationElements.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1751 index += SIZEOF_UINT16;
1752 sig->u.MlmeSetPacketFilterRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1753 index += SIZEOF_UINT16;
1754 sig->u.MlmeSetPacketFilterRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1755 index += SIZEOF_UINT16;
1756 sig->u.MlmeSetPacketFilterRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1757 index += SIZEOF_UINT16;
1758 sig->u.MlmeSetPacketFilterRequest.PacketFilterMode = (CSR_PACKET_FILTER_MODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1759 index += SIZEOF_UINT16;
1760 sig->u.MlmeSetPacketFilterRequest.ArpFilterAddress = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index);
1761 index += SIZEOF_UINT32;
1762 break;
1763#endif
1764#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1765 case CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID:
1766 sig->u.MlmeDelRxTriggerConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1767 index += SIZEOF_UINT16;
1768 sig->u.MlmeDelRxTriggerConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1769 index += SIZEOF_UINT16;
1770 sig->u.MlmeDelRxTriggerConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1771 index += SIZEOF_UINT16;
1772 sig->u.MlmeDelRxTriggerConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1773 index += SIZEOF_UINT16;
1774 sig->u.MlmeDelRxTriggerConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1775 index += SIZEOF_UINT16;
1776 sig->u.MlmeDelRxTriggerConfirm.TriggerId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1777 index += SIZEOF_UINT16;
1778 sig->u.MlmeDelRxTriggerConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1779 index += SIZEOF_UINT16;
1780 break;
1781#endif
1782#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1783 case CSR_MLME_CONNECT_STATUS_REQUEST_ID:
1784 sig->u.MlmeConnectStatusRequest.InformationElements.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1785 index += SIZEOF_UINT16;
1786 sig->u.MlmeConnectStatusRequest.InformationElements.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1787 index += SIZEOF_UINT16;
1788 sig->u.MlmeConnectStatusRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1789 index += SIZEOF_UINT16;
1790 sig->u.MlmeConnectStatusRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1791 index += SIZEOF_UINT16;
1792 sig->u.MlmeConnectStatusRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1793 index += SIZEOF_UINT16;
1794 sig->u.MlmeConnectStatusRequest.ConnectionStatus = (CSR_CONNECTION_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1795 index += SIZEOF_UINT16;
1796 memcpy(sig->u.MlmeConnectStatusRequest.StaAddress.x, &ptr[index], 48 / 8);
1797 index += 48 / 8;
1798 sig->u.MlmeConnectStatusRequest.AssociationId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1799 index += SIZEOF_UINT16;
1800 sig->u.MlmeConnectStatusRequest.AssociationCapabilityInformation = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1801 index += SIZEOF_UINT16;
1802 break;
1803#endif
1804#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1805 case CSR_MLME_LEAVE_REQUEST_ID:
1806 sig->u.MlmeLeaveRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1807 index += SIZEOF_UINT16;
1808 sig->u.MlmeLeaveRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1809 index += SIZEOF_UINT16;
1810 sig->u.MlmeLeaveRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1811 index += SIZEOF_UINT16;
1812 sig->u.MlmeLeaveRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1813 index += SIZEOF_UINT16;
1814 sig->u.MlmeLeaveRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1815 index += SIZEOF_UINT16;
1816 break;
1817#endif
1818#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1819 case CSR_MLME_CONFIG_QUEUE_REQUEST_ID:
1820 sig->u.MlmeConfigQueueRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1821 index += SIZEOF_UINT16;
1822 sig->u.MlmeConfigQueueRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1823 index += SIZEOF_UINT16;
1824 sig->u.MlmeConfigQueueRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1825 index += SIZEOF_UINT16;
1826 sig->u.MlmeConfigQueueRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1827 index += SIZEOF_UINT16;
1828 sig->u.MlmeConfigQueueRequest.QueueIndex = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1829 index += SIZEOF_UINT16;
1830 sig->u.MlmeConfigQueueRequest.Aifs = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1831 index += SIZEOF_UINT16;
1832 sig->u.MlmeConfigQueueRequest.Cwmin = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1833 index += SIZEOF_UINT16;
1834 sig->u.MlmeConfigQueueRequest.Cwmax = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1835 index += SIZEOF_UINT16;
1836 sig->u.MlmeConfigQueueRequest.TxopLimit = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1837 index += SIZEOF_UINT16;
1838 break;
1839#endif
1840#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1841 case CSR_MLME_DEL_TSPEC_CONFIRM_ID:
1842 sig->u.MlmeDelTspecConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1843 index += SIZEOF_UINT16;
1844 sig->u.MlmeDelTspecConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1845 index += SIZEOF_UINT16;
1846 sig->u.MlmeDelTspecConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1847 index += SIZEOF_UINT16;
1848 sig->u.MlmeDelTspecConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1849 index += SIZEOF_UINT16;
1850 sig->u.MlmeDelTspecConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1851 index += SIZEOF_UINT16;
1852 sig->u.MlmeDelTspecConfirm.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1853 index += SIZEOF_UINT16;
1854 sig->u.MlmeDelTspecConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1855 index += SIZEOF_UINT16;
1856 break;
1857#endif
1858 case CSR_MLME_SET_TIM_CONFIRM_ID:
1859 sig->u.MlmeSetTimConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1860 index += SIZEOF_UINT16;
1861 sig->u.MlmeSetTimConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1862 index += SIZEOF_UINT16;
1863 sig->u.MlmeSetTimConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1864 index += SIZEOF_UINT16;
1865 sig->u.MlmeSetTimConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1866 index += SIZEOF_UINT16;
1867 sig->u.MlmeSetTimConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1868 index += SIZEOF_UINT16;
1869 sig->u.MlmeSetTimConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1870 index += SIZEOF_UINT16;
1871 break;
1872#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1873 case CSR_MLME_MEASURE_INDICATION_ID:
1874 sig->u.MlmeMeasureIndication.MeasurementReportSet.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1875 index += SIZEOF_UINT16;
1876 sig->u.MlmeMeasureIndication.MeasurementReportSet.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1877 index += SIZEOF_UINT16;
1878 sig->u.MlmeMeasureIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1879 index += SIZEOF_UINT16;
1880 sig->u.MlmeMeasureIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1881 index += SIZEOF_UINT16;
1882 sig->u.MlmeMeasureIndication.DialogToken = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1883 index += SIZEOF_UINT16;
1884 break;
1885#endif
1886#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1887 case CSR_MLME_DEL_BLACKOUT_CONFIRM_ID:
1888 sig->u.MlmeDelBlackoutConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1889 index += SIZEOF_UINT16;
1890 sig->u.MlmeDelBlackoutConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1891 index += SIZEOF_UINT16;
1892 sig->u.MlmeDelBlackoutConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1893 index += SIZEOF_UINT16;
1894 sig->u.MlmeDelBlackoutConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1895 index += SIZEOF_UINT16;
1896 sig->u.MlmeDelBlackoutConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1897 index += SIZEOF_UINT16;
1898 sig->u.MlmeDelBlackoutConfirm.BlackoutId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1899 index += SIZEOF_UINT16;
1900 sig->u.MlmeDelBlackoutConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1901 index += SIZEOF_UINT16;
1902 break;
1903#endif
1904#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1905 case CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID:
1906 sig->u.MlmeDelTriggeredGetConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1907 index += SIZEOF_UINT16;
1908 sig->u.MlmeDelTriggeredGetConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1909 index += SIZEOF_UINT16;
1910 sig->u.MlmeDelTriggeredGetConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1911 index += SIZEOF_UINT16;
1912 sig->u.MlmeDelTriggeredGetConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1913 index += SIZEOF_UINT16;
1914 sig->u.MlmeDelTriggeredGetConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1915 index += SIZEOF_UINT16;
1916 sig->u.MlmeDelTriggeredGetConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1917 index += SIZEOF_UINT16;
1918 sig->u.MlmeDelTriggeredGetConfirm.TriggeredId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1919 index += SIZEOF_UINT16;
1920 break;
1921#endif
1922 case CSR_DEBUG_GENERIC_INDICATION_ID:
1923 sig->u.DebugGenericIndication.DebugVariable.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1924 index += SIZEOF_UINT16;
1925 sig->u.DebugGenericIndication.DebugVariable.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1926 index += SIZEOF_UINT16;
1927 sig->u.DebugGenericIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1928 index += SIZEOF_UINT16;
1929 sig->u.DebugGenericIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1930 index += SIZEOF_UINT16;
1931 sig->u.DebugGenericIndication.DebugWords[0] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1932 index += SIZEOF_UINT16;
1933 sig->u.DebugGenericIndication.DebugWords[1] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1934 index += SIZEOF_UINT16;
1935 sig->u.DebugGenericIndication.DebugWords[2] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1936 index += SIZEOF_UINT16;
1937 sig->u.DebugGenericIndication.DebugWords[3] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1938 index += SIZEOF_UINT16;
1939 sig->u.DebugGenericIndication.DebugWords[4] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1940 index += SIZEOF_UINT16;
1941 sig->u.DebugGenericIndication.DebugWords[5] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1942 index += SIZEOF_UINT16;
1943 sig->u.DebugGenericIndication.DebugWords[6] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1944 index += SIZEOF_UINT16;
1945 sig->u.DebugGenericIndication.DebugWords[7] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1946 index += SIZEOF_UINT16;
1947 break;
1948 case CSR_MA_PACKET_CANCEL_REQUEST_ID:
1949 sig->u.MaPacketCancelRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1950 index += SIZEOF_UINT16;
1951 sig->u.MaPacketCancelRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1952 index += SIZEOF_UINT16;
1953 sig->u.MaPacketCancelRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1954 index += SIZEOF_UINT16;
1955 sig->u.MaPacketCancelRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1956 index += SIZEOF_UINT16;
1957 sig->u.MaPacketCancelRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1958 index += SIZEOF_UINT16;
1959 sig->u.MaPacketCancelRequest.HostTag = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index);
1960 index += SIZEOF_UINT32;
1961 break;
1962#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1963 case CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID:
1964 sig->u.MlmeModifyBssParameterConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1965 index += SIZEOF_UINT16;
1966 sig->u.MlmeModifyBssParameterConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1967 index += SIZEOF_UINT16;
1968 sig->u.MlmeModifyBssParameterConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1969 index += SIZEOF_UINT16;
1970 sig->u.MlmeModifyBssParameterConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1971 index += SIZEOF_UINT16;
1972 sig->u.MlmeModifyBssParameterConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1973 index += SIZEOF_UINT16;
1974 sig->u.MlmeModifyBssParameterConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1975 index += SIZEOF_UINT16;
1976 break;
1977#endif
1978#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1979 case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID:
1980 sig->u.MlmePauseAutonomousScanConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1981 index += SIZEOF_UINT16;
1982 sig->u.MlmePauseAutonomousScanConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1983 index += SIZEOF_UINT16;
1984 sig->u.MlmePauseAutonomousScanConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1985 index += SIZEOF_UINT16;
1986 sig->u.MlmePauseAutonomousScanConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1987 index += SIZEOF_UINT16;
1988 sig->u.MlmePauseAutonomousScanConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1989 index += SIZEOF_UINT16;
1990 sig->u.MlmePauseAutonomousScanConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1991 index += SIZEOF_UINT16;
1992 sig->u.MlmePauseAutonomousScanConfirm.AutonomousScanId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1993 index += SIZEOF_UINT16;
1994 break;
1995#endif
1996 case CSR_MA_PACKET_REQUEST_ID:
1997 sig->u.MaPacketRequest.Data.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
1998 index += SIZEOF_UINT16;
1999 sig->u.MaPacketRequest.Data.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2000 index += SIZEOF_UINT16;
2001 sig->u.MaPacketRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2002 index += SIZEOF_UINT16;
2003 sig->u.MaPacketRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2004 index += SIZEOF_UINT16;
2005 sig->u.MaPacketRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2006 index += SIZEOF_UINT16;
2007 sig->u.MaPacketRequest.TransmitRate = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2008 index += SIZEOF_UINT16;
2009 sig->u.MaPacketRequest.HostTag = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index);
2010 index += SIZEOF_UINT32;
2011 sig->u.MaPacketRequest.Priority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2012 index += SIZEOF_UINT16;
2013 memcpy(sig->u.MaPacketRequest.Ra.x, &ptr[index], 48 / 8);
2014 index += 48 / 8;
2015 sig->u.MaPacketRequest.TransmissionControl = (CSR_TRANSMISSION_CONTROL) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2016 index += SIZEOF_UINT16;
2017 break;
2018#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2019 case CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST_ID:
2020 sig->u.MlmeModifyBssParameterRequest.Data.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2021 index += SIZEOF_UINT16;
2022 sig->u.MlmeModifyBssParameterRequest.Data.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2023 index += SIZEOF_UINT16;
2024 sig->u.MlmeModifyBssParameterRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2025 index += SIZEOF_UINT16;
2026 sig->u.MlmeModifyBssParameterRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2027 index += SIZEOF_UINT16;
2028 sig->u.MlmeModifyBssParameterRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2029 index += SIZEOF_UINT16;
2030 sig->u.MlmeModifyBssParameterRequest.BeaconPeriod = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2031 index += SIZEOF_UINT16;
2032 sig->u.MlmeModifyBssParameterRequest.DtimPeriod = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2033 index += SIZEOF_UINT16;
2034 sig->u.MlmeModifyBssParameterRequest.CapabilityInformation = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2035 index += SIZEOF_UINT16;
2036 memcpy(sig->u.MlmeModifyBssParameterRequest.Bssid.x, &ptr[index], 48 / 8);
2037 index += 48 / 8;
2038 sig->u.MlmeModifyBssParameterRequest.RtsThreshold = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2039 index += SIZEOF_UINT16;
2040 break;
2041#endif
2042#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2043 case CSR_MLME_ADD_RX_TRIGGER_REQUEST_ID:
2044 sig->u.MlmeAddRxTriggerRequest.InformationElements.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2045 index += SIZEOF_UINT16;
2046 sig->u.MlmeAddRxTriggerRequest.InformationElements.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2047 index += SIZEOF_UINT16;
2048 sig->u.MlmeAddRxTriggerRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2049 index += SIZEOF_UINT16;
2050 sig->u.MlmeAddRxTriggerRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2051 index += SIZEOF_UINT16;
2052 sig->u.MlmeAddRxTriggerRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2053 index += SIZEOF_UINT16;
2054 sig->u.MlmeAddRxTriggerRequest.TriggerId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2055 index += SIZEOF_UINT16;
2056 sig->u.MlmeAddRxTriggerRequest.Priority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2057 index += SIZEOF_UINT16;
2058 break;
2059#endif
2060 case CSR_MA_VIF_AVAILABILITY_INDICATION_ID:
2061 sig->u.MaVifAvailabilityIndication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2062 index += SIZEOF_UINT16;
2063 sig->u.MaVifAvailabilityIndication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2064 index += SIZEOF_UINT16;
2065 sig->u.MaVifAvailabilityIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2066 index += SIZEOF_UINT16;
2067 sig->u.MaVifAvailabilityIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2068 index += SIZEOF_UINT16;
2069 sig->u.MaVifAvailabilityIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2070 index += SIZEOF_UINT16;
2071 sig->u.MaVifAvailabilityIndication.Multicast = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2072 index += SIZEOF_UINT16;
2073 break;
2074#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2075 case CSR_MLME_HL_SYNC_CANCEL_REQUEST_ID:
2076 sig->u.MlmeHlSyncCancelRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2077 index += SIZEOF_UINT16;
2078 sig->u.MlmeHlSyncCancelRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2079 index += SIZEOF_UINT16;
2080 sig->u.MlmeHlSyncCancelRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2081 index += SIZEOF_UINT16;
2082 sig->u.MlmeHlSyncCancelRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2083 index += SIZEOF_UINT16;
2084 memcpy(sig->u.MlmeHlSyncCancelRequest.GroupAddress.x, &ptr[index], 48 / 8);
2085 index += 48 / 8;
2086 break;
2087#endif
2088#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2089 case CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST_ID:
2090 sig->u.MlmeDelAutonomousScanRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2091 index += SIZEOF_UINT16;
2092 sig->u.MlmeDelAutonomousScanRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2093 index += SIZEOF_UINT16;
2094 sig->u.MlmeDelAutonomousScanRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2095 index += SIZEOF_UINT16;
2096 sig->u.MlmeDelAutonomousScanRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2097 index += SIZEOF_UINT16;
2098 sig->u.MlmeDelAutonomousScanRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2099 index += SIZEOF_UINT16;
2100 sig->u.MlmeDelAutonomousScanRequest.AutonomousScanId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2101 index += SIZEOF_UINT16;
2102 break;
2103#endif
2104#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2105 case CSR_MLME_BLACKOUT_ENDED_INDICATION_ID:
2106 sig->u.MlmeBlackoutEndedIndication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2107 index += SIZEOF_UINT16;
2108 sig->u.MlmeBlackoutEndedIndication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2109 index += SIZEOF_UINT16;
2110 sig->u.MlmeBlackoutEndedIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2111 index += SIZEOF_UINT16;
2112 sig->u.MlmeBlackoutEndedIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2113 index += SIZEOF_UINT16;
2114 sig->u.MlmeBlackoutEndedIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2115 index += SIZEOF_UINT16;
2116 sig->u.MlmeBlackoutEndedIndication.BlackoutId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2117 index += SIZEOF_UINT16;
2118 break;
2119#endif
2120#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2121 case CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION_ID:
2122 sig->u.MlmeAutonomousScanDoneIndication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2123 index += SIZEOF_UINT16;
2124 sig->u.MlmeAutonomousScanDoneIndication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2125 index += SIZEOF_UINT16;
2126 sig->u.MlmeAutonomousScanDoneIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2127 index += SIZEOF_UINT16;
2128 sig->u.MlmeAutonomousScanDoneIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2129 index += SIZEOF_UINT16;
2130 sig->u.MlmeAutonomousScanDoneIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2131 index += SIZEOF_UINT16;
2132 sig->u.MlmeAutonomousScanDoneIndication.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2133 index += SIZEOF_UINT16;
2134 sig->u.MlmeAutonomousScanDoneIndication.AutonomousScanId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2135 index += SIZEOF_UINT16;
2136 break;
2137#endif
2138#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2139 case CSR_MLME_GET_KEY_SEQUENCE_REQUEST_ID:
2140 sig->u.MlmeGetKeySequenceRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2141 index += SIZEOF_UINT16;
2142 sig->u.MlmeGetKeySequenceRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2143 index += SIZEOF_UINT16;
2144 sig->u.MlmeGetKeySequenceRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2145 index += SIZEOF_UINT16;
2146 sig->u.MlmeGetKeySequenceRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2147 index += SIZEOF_UINT16;
2148 sig->u.MlmeGetKeySequenceRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2149 index += SIZEOF_UINT16;
2150 sig->u.MlmeGetKeySequenceRequest.KeyId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2151 index += SIZEOF_UINT16;
2152 sig->u.MlmeGetKeySequenceRequest.KeyType = (CSR_KEY_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2153 index += SIZEOF_UINT16;
2154 memcpy(sig->u.MlmeGetKeySequenceRequest.Address.x, &ptr[index], 48 / 8);
2155 index += 48 / 8;
2156 break;
2157#endif
2158#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2159 case CSR_MLME_SET_CHANNEL_REQUEST_ID:
2160 sig->u.MlmeSetChannelRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2161 index += SIZEOF_UINT16;
2162 sig->u.MlmeSetChannelRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2163 index += SIZEOF_UINT16;
2164 sig->u.MlmeSetChannelRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2165 index += SIZEOF_UINT16;
2166 sig->u.MlmeSetChannelRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2167 index += SIZEOF_UINT16;
2168 sig->u.MlmeSetChannelRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2169 index += SIZEOF_UINT16;
2170 sig->u.MlmeSetChannelRequest.Ifindex = (CSR_IFINTERFACE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2171 index += SIZEOF_UINT16;
2172 sig->u.MlmeSetChannelRequest.Channel = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2173 index += SIZEOF_UINT16;
2174 memcpy(sig->u.MlmeSetChannelRequest.Address.x, &ptr[index], 48 / 8);
2175 index += 48 / 8;
2176 sig->u.MlmeSetChannelRequest.AvailabilityDuration = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2177 index += SIZEOF_UINT16;
2178 sig->u.MlmeSetChannelRequest.AvailabilityInterval = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2179 index += SIZEOF_UINT16;
2180 break;
2181#endif
2182#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2183 case CSR_MLME_MEASURE_CONFIRM_ID:
2184 sig->u.MlmeMeasureConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2185 index += SIZEOF_UINT16;
2186 sig->u.MlmeMeasureConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2187 index += SIZEOF_UINT16;
2188 sig->u.MlmeMeasureConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2189 index += SIZEOF_UINT16;
2190 sig->u.MlmeMeasureConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2191 index += SIZEOF_UINT16;
2192 sig->u.MlmeMeasureConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2193 index += SIZEOF_UINT16;
2194 sig->u.MlmeMeasureConfirm.DialogToken = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2195 index += SIZEOF_UINT16;
2196 break;
2197#endif
2198#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2199 case CSR_MLME_ADD_TRIGGERED_GET_REQUEST_ID:
2200 sig->u.MlmeAddTriggeredGetRequest.MibAttribute.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2201 index += SIZEOF_UINT16;
2202 sig->u.MlmeAddTriggeredGetRequest.MibAttribute.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2203 index += SIZEOF_UINT16;
2204 sig->u.MlmeAddTriggeredGetRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2205 index += SIZEOF_UINT16;
2206 sig->u.MlmeAddTriggeredGetRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2207 index += SIZEOF_UINT16;
2208 sig->u.MlmeAddTriggeredGetRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2209 index += SIZEOF_UINT16;
2210 sig->u.MlmeAddTriggeredGetRequest.TriggeredId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2211 index += SIZEOF_UINT16;
2212 break;
2213#endif
2214#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2215 case CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION_ID:
2216 sig->u.MlmeAutonomousScanLossIndication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2217 index += SIZEOF_UINT16;
2218 sig->u.MlmeAutonomousScanLossIndication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2219 index += SIZEOF_UINT16;
2220 sig->u.MlmeAutonomousScanLossIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2221 index += SIZEOF_UINT16;
2222 sig->u.MlmeAutonomousScanLossIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2223 index += SIZEOF_UINT16;
2224 sig->u.MlmeAutonomousScanLossIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2225 index += SIZEOF_UINT16;
2226 memcpy(sig->u.MlmeAutonomousScanLossIndication.Bssid.x, &ptr[index], 48 / 8);
2227 index += 48 / 8;
2228 break;
2229#endif
2230 case CSR_MA_VIF_AVAILABILITY_RESPONSE_ID:
2231 sig->u.MaVifAvailabilityResponse.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2232 index += SIZEOF_UINT16;
2233 sig->u.MaVifAvailabilityResponse.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2234 index += SIZEOF_UINT16;
2235 sig->u.MaVifAvailabilityResponse.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2236 index += SIZEOF_UINT16;
2237 sig->u.MaVifAvailabilityResponse.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2238 index += SIZEOF_UINT16;
2239 sig->u.MaVifAvailabilityResponse.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2240 index += SIZEOF_UINT16;
2241 sig->u.MaVifAvailabilityResponse.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2242 index += SIZEOF_UINT16;
2243 break;
2244#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2245 case CSR_MLME_ADD_TEMPLATE_REQUEST_ID:
2246 sig->u.MlmeAddTemplateRequest.Data1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2247 index += SIZEOF_UINT16;
2248 sig->u.MlmeAddTemplateRequest.Data1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2249 index += SIZEOF_UINT16;
2250 sig->u.MlmeAddTemplateRequest.Data2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2251 index += SIZEOF_UINT16;
2252 sig->u.MlmeAddTemplateRequest.Data2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2253 index += SIZEOF_UINT16;
2254 sig->u.MlmeAddTemplateRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2255 index += SIZEOF_UINT16;
2256 sig->u.MlmeAddTemplateRequest.FrameType = (CSR_FRAME_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2257 index += SIZEOF_UINT16;
2258 sig->u.MlmeAddTemplateRequest.MinTransmitRate = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2259 index += SIZEOF_UINT16;
2260 break;
2261#endif
2262#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2263 case CSR_MLME_POWERMGT_CONFIRM_ID:
2264 sig->u.MlmePowermgtConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2265 index += SIZEOF_UINT16;
2266 sig->u.MlmePowermgtConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2267 index += SIZEOF_UINT16;
2268 sig->u.MlmePowermgtConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2269 index += SIZEOF_UINT16;
2270 sig->u.MlmePowermgtConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2271 index += SIZEOF_UINT16;
2272 sig->u.MlmePowermgtConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2273 index += SIZEOF_UINT16;
2274 sig->u.MlmePowermgtConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2275 index += SIZEOF_UINT16;
2276 break;
2277#endif
2278#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2279 case CSR_MLME_ADD_PERIODIC_CONFIRM_ID:
2280 sig->u.MlmeAddPeriodicConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2281 index += SIZEOF_UINT16;
2282 sig->u.MlmeAddPeriodicConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2283 index += SIZEOF_UINT16;
2284 sig->u.MlmeAddPeriodicConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2285 index += SIZEOF_UINT16;
2286 sig->u.MlmeAddPeriodicConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2287 index += SIZEOF_UINT16;
2288 sig->u.MlmeAddPeriodicConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2289 index += SIZEOF_UINT16;
2290 sig->u.MlmeAddPeriodicConfirm.PeriodicId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2291 index += SIZEOF_UINT16;
2292 sig->u.MlmeAddPeriodicConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2293 index += SIZEOF_UINT16;
2294 break;
2295#endif
2296#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2297 case CSR_MLME_GET_CONFIRM_ID:
2298 sig->u.MlmeGetConfirm.MibAttributeValue.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2299 index += SIZEOF_UINT16;
2300 sig->u.MlmeGetConfirm.MibAttributeValue.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2301 index += SIZEOF_UINT16;
2302 sig->u.MlmeGetConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2303 index += SIZEOF_UINT16;
2304 sig->u.MlmeGetConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2305 index += SIZEOF_UINT16;
2306 sig->u.MlmeGetConfirm.Status = (CSR_MIB_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2307 index += SIZEOF_UINT16;
2308 sig->u.MlmeGetConfirm.ErrorIndex = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2309 index += SIZEOF_UINT16;
2310 break;
2311#endif
2312#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2313 case CSR_MLME_GET_NEXT_CONFIRM_ID:
2314 sig->u.MlmeGetNextConfirm.MibAttributeValue.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2315 index += SIZEOF_UINT16;
2316 sig->u.MlmeGetNextConfirm.MibAttributeValue.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2317 index += SIZEOF_UINT16;
2318 sig->u.MlmeGetNextConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2319 index += SIZEOF_UINT16;
2320 sig->u.MlmeGetNextConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2321 index += SIZEOF_UINT16;
2322 sig->u.MlmeGetNextConfirm.Status = (CSR_MIB_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2323 index += SIZEOF_UINT16;
2324 sig->u.MlmeGetNextConfirm.ErrorIndex = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2325 index += SIZEOF_UINT16;
2326 break;
2327#endif
2328#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2329 case CSR_MLME_STOP_AGGREGATION_REQUEST_ID:
2330 sig->u.MlmeStopAggregationRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2331 index += SIZEOF_UINT16;
2332 sig->u.MlmeStopAggregationRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2333 index += SIZEOF_UINT16;
2334 sig->u.MlmeStopAggregationRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2335 index += SIZEOF_UINT16;
2336 sig->u.MlmeStopAggregationRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2337 index += SIZEOF_UINT16;
2338 sig->u.MlmeStopAggregationRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2339 index += SIZEOF_UINT16;
2340 memcpy(sig->u.MlmeStopAggregationRequest.PeerQstaAddress.x, &ptr[index], 48 / 8);
2341 index += 48 / 8;
2342 sig->u.MlmeStopAggregationRequest.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2343 index += SIZEOF_UINT16;
2344 sig->u.MlmeStopAggregationRequest.Direction = (CSR_DIRECTION) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2345 index += SIZEOF_UINT16;
2346 break;
2347#endif
2348#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2349 case CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID:
2350 sig->u.MlmeAddRxTriggerConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2351 index += SIZEOF_UINT16;
2352 sig->u.MlmeAddRxTriggerConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2353 index += SIZEOF_UINT16;
2354 sig->u.MlmeAddRxTriggerConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2355 index += SIZEOF_UINT16;
2356 sig->u.MlmeAddRxTriggerConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2357 index += SIZEOF_UINT16;
2358 sig->u.MlmeAddRxTriggerConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2359 index += SIZEOF_UINT16;
2360 sig->u.MlmeAddRxTriggerConfirm.TriggerId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2361 index += SIZEOF_UINT16;
2362 sig->u.MlmeAddRxTriggerConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2363 index += SIZEOF_UINT16;
2364 break;
2365#endif
2366#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2367 case CSR_MLME_ADD_BLACKOUT_REQUEST_ID:
2368 sig->u.MlmeAddBlackoutRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2369 index += SIZEOF_UINT16;
2370 sig->u.MlmeAddBlackoutRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2371 index += SIZEOF_UINT16;
2372 sig->u.MlmeAddBlackoutRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2373 index += SIZEOF_UINT16;
2374 sig->u.MlmeAddBlackoutRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2375 index += SIZEOF_UINT16;
2376 sig->u.MlmeAddBlackoutRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2377 index += SIZEOF_UINT16;
2378 sig->u.MlmeAddBlackoutRequest.BlackoutId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2379 index += SIZEOF_UINT16;
2380 sig->u.MlmeAddBlackoutRequest.BlackoutType = (CSR_BLACKOUT_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2381 index += SIZEOF_UINT16;
2382 sig->u.MlmeAddBlackoutRequest.BlackoutSource = (CSR_BLACKOUT_SOURCE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2383 index += SIZEOF_UINT16;
2384 sig->u.MlmeAddBlackoutRequest.BlackoutStartReference = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index);
2385 index += SIZEOF_UINT32;
2386 sig->u.MlmeAddBlackoutRequest.BlackoutPeriod = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index);
2387 index += SIZEOF_UINT32;
2388 sig->u.MlmeAddBlackoutRequest.BlackoutDuration = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index);
2389 index += SIZEOF_UINT32;
2390 memcpy(sig->u.MlmeAddBlackoutRequest.PeerStaAddress.x, &ptr[index], 48 / 8);
2391 index += 48 / 8;
2392 sig->u.MlmeAddBlackoutRequest.BlackoutCount = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2393 index += SIZEOF_UINT16;
2394 break;
2395#endif
2396#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2397 case CSR_MLME_DELETEKEYS_REQUEST_ID:
2398 sig->u.MlmeDeletekeysRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2399 index += SIZEOF_UINT16;
2400 sig->u.MlmeDeletekeysRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2401 index += SIZEOF_UINT16;
2402 sig->u.MlmeDeletekeysRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2403 index += SIZEOF_UINT16;
2404 sig->u.MlmeDeletekeysRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2405 index += SIZEOF_UINT16;
2406 sig->u.MlmeDeletekeysRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2407 index += SIZEOF_UINT16;
2408 sig->u.MlmeDeletekeysRequest.KeyId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2409 index += SIZEOF_UINT16;
2410 sig->u.MlmeDeletekeysRequest.KeyType = (CSR_KEY_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2411 index += SIZEOF_UINT16;
2412 memcpy(sig->u.MlmeDeletekeysRequest.Address.x, &ptr[index], 48 / 8);
2413 index += 48 / 8;
2414 break;
2415#endif
2416#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2417 case CSR_MLME_RESET_CONFIRM_ID:
2418 sig->u.MlmeResetConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2419 index += SIZEOF_UINT16;
2420 sig->u.MlmeResetConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2421 index += SIZEOF_UINT16;
2422 sig->u.MlmeResetConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2423 index += SIZEOF_UINT16;
2424 sig->u.MlmeResetConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2425 index += SIZEOF_UINT16;
2426 sig->u.MlmeResetConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2427 index += SIZEOF_UINT16;
2428 break;
2429#endif
2430#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2431 case CSR_MLME_HL_SYNC_CONFIRM_ID:
2432 sig->u.MlmeHlSyncConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2433 index += SIZEOF_UINT16;
2434 sig->u.MlmeHlSyncConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2435 index += SIZEOF_UINT16;
2436 sig->u.MlmeHlSyncConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2437 index += SIZEOF_UINT16;
2438 sig->u.MlmeHlSyncConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2439 index += SIZEOF_UINT16;
2440 memcpy(sig->u.MlmeHlSyncConfirm.GroupAddress.x, &ptr[index], 48 / 8);
2441 index += 48 / 8;
2442 sig->u.MlmeHlSyncConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2443 index += SIZEOF_UINT16;
2444 break;
2445#endif
2446#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2447 case CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST_ID:
2448 sig->u.MlmeAddAutonomousScanRequest.ChannelList.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2449 index += SIZEOF_UINT16;
2450 sig->u.MlmeAddAutonomousScanRequest.ChannelList.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2451 index += SIZEOF_UINT16;
2452 sig->u.MlmeAddAutonomousScanRequest.InformationElements.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2453 index += SIZEOF_UINT16;
2454 sig->u.MlmeAddAutonomousScanRequest.InformationElements.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2455 index += SIZEOF_UINT16;
2456 sig->u.MlmeAddAutonomousScanRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2457 index += SIZEOF_UINT16;
2458 sig->u.MlmeAddAutonomousScanRequest.AutonomousScanId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2459 index += SIZEOF_UINT16;
2460 sig->u.MlmeAddAutonomousScanRequest.Ifindex = (CSR_IFINTERFACE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2461 index += SIZEOF_UINT16;
2462 sig->u.MlmeAddAutonomousScanRequest.ChannelStartingFactor = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2463 index += SIZEOF_UINT16;
2464 sig->u.MlmeAddAutonomousScanRequest.ScanType = (CSR_SCAN_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2465 index += SIZEOF_UINT16;
2466 sig->u.MlmeAddAutonomousScanRequest.ProbeDelay = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index);
2467 index += SIZEOF_UINT32;
2468 sig->u.MlmeAddAutonomousScanRequest.MinChannelTime = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2469 index += SIZEOF_UINT16;
2470 sig->u.MlmeAddAutonomousScanRequest.MaxChannelTime = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2471 index += SIZEOF_UINT16;
2472 break;
2473#endif
2474#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2475 case CSR_MLME_SET_REQUEST_ID:
2476 sig->u.MlmeSetRequest.MibAttributeValue.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2477 index += SIZEOF_UINT16;
2478 sig->u.MlmeSetRequest.MibAttributeValue.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2479 index += SIZEOF_UINT16;
2480 sig->u.MlmeSetRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2481 index += SIZEOF_UINT16;
2482 sig->u.MlmeSetRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2483 index += SIZEOF_UINT16;
2484 break;
2485#endif
2486#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2487 case CSR_MLME_SM_START_REQUEST_ID:
2488 sig->u.MlmeSmStartRequest.Beacon.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2489 index += SIZEOF_UINT16;
2490 sig->u.MlmeSmStartRequest.Beacon.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2491 index += SIZEOF_UINT16;
2492 sig->u.MlmeSmStartRequest.BssParameters.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2493 index += SIZEOF_UINT16;
2494 sig->u.MlmeSmStartRequest.BssParameters.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2495 index += SIZEOF_UINT16;
2496 sig->u.MlmeSmStartRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2497 index += SIZEOF_UINT16;
2498 sig->u.MlmeSmStartRequest.Ifindex = (CSR_IFINTERFACE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2499 index += SIZEOF_UINT16;
2500 sig->u.MlmeSmStartRequest.Channel = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2501 index += SIZEOF_UINT16;
2502 memcpy(sig->u.MlmeSmStartRequest.InterfaceAddress.x, &ptr[index], 48 / 8);
2503 index += 48 / 8;
2504 memcpy(sig->u.MlmeSmStartRequest.Bssid.x, &ptr[index], 48 / 8);
2505 index += 48 / 8;
2506 sig->u.MlmeSmStartRequest.BeaconPeriod = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2507 index += SIZEOF_UINT16;
2508 sig->u.MlmeSmStartRequest.DtimPeriod = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2509 index += SIZEOF_UINT16;
2510 sig->u.MlmeSmStartRequest.CapabilityInformation = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2511 index += SIZEOF_UINT16;
2512 break;
2513#endif
2514#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2515 case CSR_MLME_CONNECT_STATUS_CONFIRM_ID:
2516 sig->u.MlmeConnectStatusConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2517 index += SIZEOF_UINT16;
2518 sig->u.MlmeConnectStatusConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2519 index += SIZEOF_UINT16;
2520 sig->u.MlmeConnectStatusConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2521 index += SIZEOF_UINT16;
2522 sig->u.MlmeConnectStatusConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2523 index += SIZEOF_UINT16;
2524 sig->u.MlmeConnectStatusConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2525 index += SIZEOF_UINT16;
2526 sig->u.MlmeConnectStatusConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2527 index += SIZEOF_UINT16;
2528 break;
2529#endif
2530#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2531 case CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID:
2532 sig->u.MlmeDelAutonomousScanConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2533 index += SIZEOF_UINT16;
2534 sig->u.MlmeDelAutonomousScanConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2535 index += SIZEOF_UINT16;
2536 sig->u.MlmeDelAutonomousScanConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2537 index += SIZEOF_UINT16;
2538 sig->u.MlmeDelAutonomousScanConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2539 index += SIZEOF_UINT16;
2540 sig->u.MlmeDelAutonomousScanConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2541 index += SIZEOF_UINT16;
2542 sig->u.MlmeDelAutonomousScanConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2543 index += SIZEOF_UINT16;
2544 sig->u.MlmeDelAutonomousScanConfirm.AutonomousScanId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2545 index += SIZEOF_UINT16;
2546 break;
2547#endif
2548#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2549 case CSR_MLME_DEL_PERIODIC_REQUEST_ID:
2550 sig->u.MlmeDelPeriodicRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2551 index += SIZEOF_UINT16;
2552 sig->u.MlmeDelPeriodicRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2553 index += SIZEOF_UINT16;
2554 sig->u.MlmeDelPeriodicRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2555 index += SIZEOF_UINT16;
2556 sig->u.MlmeDelPeriodicRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2557 index += SIZEOF_UINT16;
2558 sig->u.MlmeDelPeriodicRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2559 index += SIZEOF_UINT16;
2560 sig->u.MlmeDelPeriodicRequest.PeriodicId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2561 index += SIZEOF_UINT16;
2562 break;
2563#endif
2564#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2565 case CSR_MLME_SETKEYS_REQUEST_ID:
2566 sig->u.MlmeSetkeysRequest.Key.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2567 index += SIZEOF_UINT16;
2568 sig->u.MlmeSetkeysRequest.Key.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2569 index += SIZEOF_UINT16;
2570 sig->u.MlmeSetkeysRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2571 index += SIZEOF_UINT16;
2572 sig->u.MlmeSetkeysRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2573 index += SIZEOF_UINT16;
2574 sig->u.MlmeSetkeysRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2575 index += SIZEOF_UINT16;
2576 sig->u.MlmeSetkeysRequest.Length = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2577 index += SIZEOF_UINT16;
2578 sig->u.MlmeSetkeysRequest.KeyId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2579 index += SIZEOF_UINT16;
2580 sig->u.MlmeSetkeysRequest.KeyType = (CSR_KEY_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2581 index += SIZEOF_UINT16;
2582 memcpy(sig->u.MlmeSetkeysRequest.Address.x, &ptr[index], 48 / 8);
2583 index += 48 / 8;
2584 sig->u.MlmeSetkeysRequest.SequenceNumber[0] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2585 index += SIZEOF_UINT16;
2586 sig->u.MlmeSetkeysRequest.SequenceNumber[1] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2587 index += SIZEOF_UINT16;
2588 sig->u.MlmeSetkeysRequest.SequenceNumber[2] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2589 index += SIZEOF_UINT16;
2590 sig->u.MlmeSetkeysRequest.SequenceNumber[3] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2591 index += SIZEOF_UINT16;
2592 sig->u.MlmeSetkeysRequest.SequenceNumber[4] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2593 index += SIZEOF_UINT16;
2594 sig->u.MlmeSetkeysRequest.SequenceNumber[5] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2595 index += SIZEOF_UINT16;
2596 sig->u.MlmeSetkeysRequest.SequenceNumber[6] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2597 index += SIZEOF_UINT16;
2598 sig->u.MlmeSetkeysRequest.SequenceNumber[7] = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2599 index += SIZEOF_UINT16;
2600 memcpy(&sig->u.MlmeSetkeysRequest.CipherSuiteSelector, &ptr[index], 32 / 8);
2601 index += 32 / 8;
2602 break;
2603#endif
2604#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2605 case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST_ID:
2606 sig->u.MlmePauseAutonomousScanRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2607 index += SIZEOF_UINT16;
2608 sig->u.MlmePauseAutonomousScanRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2609 index += SIZEOF_UINT16;
2610 sig->u.MlmePauseAutonomousScanRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2611 index += SIZEOF_UINT16;
2612 sig->u.MlmePauseAutonomousScanRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2613 index += SIZEOF_UINT16;
2614 sig->u.MlmePauseAutonomousScanRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2615 index += SIZEOF_UINT16;
2616 sig->u.MlmePauseAutonomousScanRequest.AutonomousScanId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2617 index += SIZEOF_UINT16;
2618 sig->u.MlmePauseAutonomousScanRequest.Pause = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2619 index += SIZEOF_UINT16;
2620 break;
2621#endif
2622#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2623 case CSR_MLME_GET_REQUEST_ID:
2624 sig->u.MlmeGetRequest.MibAttribute.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2625 index += SIZEOF_UINT16;
2626 sig->u.MlmeGetRequest.MibAttribute.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2627 index += SIZEOF_UINT16;
2628 sig->u.MlmeGetRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2629 index += SIZEOF_UINT16;
2630 sig->u.MlmeGetRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2631 index += SIZEOF_UINT16;
2632 break;
2633#endif
2634#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2635 case CSR_MLME_POWERMGT_REQUEST_ID:
2636 sig->u.MlmePowermgtRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2637 index += SIZEOF_UINT16;
2638 sig->u.MlmePowermgtRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2639 index += SIZEOF_UINT16;
2640 sig->u.MlmePowermgtRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2641 index += SIZEOF_UINT16;
2642 sig->u.MlmePowermgtRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2643 index += SIZEOF_UINT16;
2644 sig->u.MlmePowermgtRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2645 index += SIZEOF_UINT16;
2646 sig->u.MlmePowermgtRequest.PowerManagementMode = (CSR_POWER_MANAGEMENT_MODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2647 index += SIZEOF_UINT16;
2648 sig->u.MlmePowermgtRequest.ReceiveDtims = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2649 index += SIZEOF_UINT16;
2650 sig->u.MlmePowermgtRequest.ListenInterval = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2651 index += SIZEOF_UINT16;
2652 sig->u.MlmePowermgtRequest.TrafficWindow = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2653 index += SIZEOF_UINT16;
2654 break;
2655#endif
2656 case CSR_MA_PACKET_ERROR_INDICATION_ID:
2657 sig->u.MaPacketErrorIndication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2658 index += SIZEOF_UINT16;
2659 sig->u.MaPacketErrorIndication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2660 index += SIZEOF_UINT16;
2661 sig->u.MaPacketErrorIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2662 index += SIZEOF_UINT16;
2663 sig->u.MaPacketErrorIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2664 index += SIZEOF_UINT16;
2665 sig->u.MaPacketErrorIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2666 index += SIZEOF_UINT16;
2667 memcpy(sig->u.MaPacketErrorIndication.PeerQstaAddress.x, &ptr[index], 48 / 8);
2668 index += 48 / 8;
2669 sig->u.MaPacketErrorIndication.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2670 index += SIZEOF_UINT16;
2671 sig->u.MaPacketErrorIndication.SequenceNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2672 index += SIZEOF_UINT16;
2673 break;
2674#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2675 case CSR_MLME_ADD_PERIODIC_REQUEST_ID:
2676 sig->u.MlmeAddPeriodicRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2677 index += SIZEOF_UINT16;
2678 sig->u.MlmeAddPeriodicRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2679 index += SIZEOF_UINT16;
2680 sig->u.MlmeAddPeriodicRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2681 index += SIZEOF_UINT16;
2682 sig->u.MlmeAddPeriodicRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2683 index += SIZEOF_UINT16;
2684 sig->u.MlmeAddPeriodicRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2685 index += SIZEOF_UINT16;
2686 sig->u.MlmeAddPeriodicRequest.PeriodicId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2687 index += SIZEOF_UINT16;
2688 sig->u.MlmeAddPeriodicRequest.MaximumLatency = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index);
2689 index += SIZEOF_UINT32;
2690 sig->u.MlmeAddPeriodicRequest.PeriodicSchedulingMode = (CSR_PERIODIC_SCHEDULING_MODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2691 index += SIZEOF_UINT16;
2692 sig->u.MlmeAddPeriodicRequest.WakeHost = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2693 index += SIZEOF_UINT16;
2694 sig->u.MlmeAddPeriodicRequest.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2695 index += SIZEOF_UINT16;
2696 break;
2697#endif
2698#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2699 case CSR_MLME_ADD_TSPEC_REQUEST_ID:
2700 sig->u.MlmeAddTspecRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2701 index += SIZEOF_UINT16;
2702 sig->u.MlmeAddTspecRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2703 index += SIZEOF_UINT16;
2704 sig->u.MlmeAddTspecRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2705 index += SIZEOF_UINT16;
2706 sig->u.MlmeAddTspecRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2707 index += SIZEOF_UINT16;
2708 sig->u.MlmeAddTspecRequest.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2709 index += SIZEOF_UINT16;
2710 sig->u.MlmeAddTspecRequest.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2711 index += SIZEOF_UINT16;
2712 sig->u.MlmeAddTspecRequest.Direction = (CSR_DIRECTION) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2713 index += SIZEOF_UINT16;
2714 sig->u.MlmeAddTspecRequest.PsScheme = (CSR_PS_SCHEME) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2715 index += SIZEOF_UINT16;
2716 sig->u.MlmeAddTspecRequest.MediumTime = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2717 index += SIZEOF_UINT16;
2718 sig->u.MlmeAddTspecRequest.ServiceStartTime = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index);
2719 index += SIZEOF_UINT32;
2720 sig->u.MlmeAddTspecRequest.ServiceInterval = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index);
2721 index += SIZEOF_UINT32;
2722 sig->u.MlmeAddTspecRequest.MinimumDataRate = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2723 index += SIZEOF_UINT16;
2724 break;
2725#endif
2726#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2727 case CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID:
2728 sig->u.MlmeAddMulticastAddressConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2729 index += SIZEOF_UINT16;
2730 sig->u.MlmeAddMulticastAddressConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2731 index += SIZEOF_UINT16;
2732 sig->u.MlmeAddMulticastAddressConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2733 index += SIZEOF_UINT16;
2734 sig->u.MlmeAddMulticastAddressConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2735 index += SIZEOF_UINT16;
2736 sig->u.MlmeAddMulticastAddressConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2737 index += SIZEOF_UINT16;
2738 sig->u.MlmeAddMulticastAddressConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2739 index += SIZEOF_UINT16;
2740 break;
2741#endif
2742#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2743 case CSR_MLME_ADD_TSPEC_CONFIRM_ID:
2744 sig->u.MlmeAddTspecConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2745 index += SIZEOF_UINT16;
2746 sig->u.MlmeAddTspecConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2747 index += SIZEOF_UINT16;
2748 sig->u.MlmeAddTspecConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2749 index += SIZEOF_UINT16;
2750 sig->u.MlmeAddTspecConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2751 index += SIZEOF_UINT16;
2752 sig->u.MlmeAddTspecConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2753 index += SIZEOF_UINT16;
2754 sig->u.MlmeAddTspecConfirm.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2755 index += SIZEOF_UINT16;
2756 sig->u.MlmeAddTspecConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2757 index += SIZEOF_UINT16;
2758 break;
2759#endif
2760#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2761 case CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID:
2762 sig->u.MlmeHlSyncCancelConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2763 index += SIZEOF_UINT16;
2764 sig->u.MlmeHlSyncCancelConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2765 index += SIZEOF_UINT16;
2766 sig->u.MlmeHlSyncCancelConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2767 index += SIZEOF_UINT16;
2768 sig->u.MlmeHlSyncCancelConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2769 index += SIZEOF_UINT16;
2770 sig->u.MlmeHlSyncCancelConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2771 index += SIZEOF_UINT16;
2772 break;
2773#endif
2774#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2775 case CSR_MLME_SCAN_CONFIRM_ID:
2776 sig->u.MlmeScanConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2777 index += SIZEOF_UINT16;
2778 sig->u.MlmeScanConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2779 index += SIZEOF_UINT16;
2780 sig->u.MlmeScanConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2781 index += SIZEOF_UINT16;
2782 sig->u.MlmeScanConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2783 index += SIZEOF_UINT16;
2784 sig->u.MlmeScanConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2785 index += SIZEOF_UINT16;
2786 sig->u.MlmeScanConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2787 index += SIZEOF_UINT16;
2788 break;
2789#endif
2790 case CSR_DEBUG_STRING_INDICATION_ID:
2791 sig->u.DebugStringIndication.DebugMessage.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2792 index += SIZEOF_UINT16;
2793 sig->u.DebugStringIndication.DebugMessage.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2794 index += SIZEOF_UINT16;
2795 sig->u.DebugStringIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2796 index += SIZEOF_UINT16;
2797 sig->u.DebugStringIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2798 index += SIZEOF_UINT16;
2799 break;
2800#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2801 case CSR_MLME_ADD_TEMPLATE_CONFIRM_ID:
2802 sig->u.MlmeAddTemplateConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2803 index += SIZEOF_UINT16;
2804 sig->u.MlmeAddTemplateConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2805 index += SIZEOF_UINT16;
2806 sig->u.MlmeAddTemplateConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2807 index += SIZEOF_UINT16;
2808 sig->u.MlmeAddTemplateConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2809 index += SIZEOF_UINT16;
2810 sig->u.MlmeAddTemplateConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2811 index += SIZEOF_UINT16;
2812 sig->u.MlmeAddTemplateConfirm.FrameType = (CSR_FRAME_TYPE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2813 index += SIZEOF_UINT16;
2814 sig->u.MlmeAddTemplateConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2815 index += SIZEOF_UINT16;
2816 break;
2817#endif
2818#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2819 case CSR_MLME_BLOCKACK_ERROR_INDICATION_ID:
2820 sig->u.MlmeBlockackErrorIndication.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2821 index += SIZEOF_UINT16;
2822 sig->u.MlmeBlockackErrorIndication.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2823 index += SIZEOF_UINT16;
2824 sig->u.MlmeBlockackErrorIndication.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2825 index += SIZEOF_UINT16;
2826 sig->u.MlmeBlockackErrorIndication.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2827 index += SIZEOF_UINT16;
2828 sig->u.MlmeBlockackErrorIndication.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2829 index += SIZEOF_UINT16;
2830 sig->u.MlmeBlockackErrorIndication.ResultCode = (CSR_REASON_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2831 index += SIZEOF_UINT16;
2832 memcpy(sig->u.MlmeBlockackErrorIndication.PeerQstaAddress.x, &ptr[index], 48 / 8);
2833 index += 48 / 8;
2834 break;
2835#endif
2836#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2837 case CSR_MLME_SET_CONFIRM_ID:
2838 sig->u.MlmeSetConfirm.MibAttributeValue.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2839 index += SIZEOF_UINT16;
2840 sig->u.MlmeSetConfirm.MibAttributeValue.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2841 index += SIZEOF_UINT16;
2842 sig->u.MlmeSetConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2843 index += SIZEOF_UINT16;
2844 sig->u.MlmeSetConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2845 index += SIZEOF_UINT16;
2846 sig->u.MlmeSetConfirm.Status = (CSR_MIB_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2847 index += SIZEOF_UINT16;
2848 sig->u.MlmeSetConfirm.ErrorIndex = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2849 index += SIZEOF_UINT16;
2850 break;
2851#endif
2852#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2853 case CSR_MLME_MEASURE_REQUEST_ID:
2854 sig->u.MlmeMeasureRequest.MeasurementRequestSet.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2855 index += SIZEOF_UINT16;
2856 sig->u.MlmeMeasureRequest.MeasurementRequestSet.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2857 index += SIZEOF_UINT16;
2858 sig->u.MlmeMeasureRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2859 index += SIZEOF_UINT16;
2860 sig->u.MlmeMeasureRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2861 index += SIZEOF_UINT16;
2862 sig->u.MlmeMeasureRequest.DialogToken = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2863 index += SIZEOF_UINT16;
2864 break;
2865#endif
2866#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2867 case CSR_MLME_START_AGGREGATION_CONFIRM_ID:
2868 sig->u.MlmeStartAggregationConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2869 index += SIZEOF_UINT16;
2870 sig->u.MlmeStartAggregationConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2871 index += SIZEOF_UINT16;
2872 sig->u.MlmeStartAggregationConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2873 index += SIZEOF_UINT16;
2874 sig->u.MlmeStartAggregationConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2875 index += SIZEOF_UINT16;
2876 sig->u.MlmeStartAggregationConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2877 index += SIZEOF_UINT16;
2878 memcpy(sig->u.MlmeStartAggregationConfirm.PeerQstaAddress.x, &ptr[index], 48 / 8);
2879 index += 48 / 8;
2880 sig->u.MlmeStartAggregationConfirm.UserPriority = (CSR_PRIORITY) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2881 index += SIZEOF_UINT16;
2882 sig->u.MlmeStartAggregationConfirm.Direction = (CSR_DIRECTION) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2883 index += SIZEOF_UINT16;
2884 sig->u.MlmeStartAggregationConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2885 index += SIZEOF_UINT16;
2886 sig->u.MlmeStartAggregationConfirm.SequenceNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2887 index += SIZEOF_UINT16;
2888 break;
2889#endif
2890#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2891 case CSR_MLME_STOP_MEASURE_CONFIRM_ID:
2892 sig->u.MlmeStopMeasureConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2893 index += SIZEOF_UINT16;
2894 sig->u.MlmeStopMeasureConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2895 index += SIZEOF_UINT16;
2896 sig->u.MlmeStopMeasureConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2897 index += SIZEOF_UINT16;
2898 sig->u.MlmeStopMeasureConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2899 index += SIZEOF_UINT16;
2900 sig->u.MlmeStopMeasureConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2901 index += SIZEOF_UINT16;
2902 sig->u.MlmeStopMeasureConfirm.DialogToken = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2903 index += SIZEOF_UINT16;
2904 break;
2905#endif
2906 case CSR_MA_PACKET_CONFIRM_ID:
2907 sig->u.MaPacketConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2908 index += SIZEOF_UINT16;
2909 sig->u.MaPacketConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2910 index += SIZEOF_UINT16;
2911 sig->u.MaPacketConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2912 index += SIZEOF_UINT16;
2913 sig->u.MaPacketConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2914 index += SIZEOF_UINT16;
2915 sig->u.MaPacketConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2916 index += SIZEOF_UINT16;
2917 sig->u.MaPacketConfirm.TransmissionStatus = (CSR_TRANSMISSION_STATUS) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2918 index += SIZEOF_UINT16;
2919 sig->u.MaPacketConfirm.RetryCount = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2920 index += SIZEOF_UINT16;
2921 sig->u.MaPacketConfirm.Rate = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2922 index += SIZEOF_UINT16;
2923 sig->u.MaPacketConfirm.HostTag = CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr + index);
2924 index += SIZEOF_UINT32;
2925 break;
2926#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2927 case CSR_MLME_DEL_PERIODIC_CONFIRM_ID:
2928 sig->u.MlmeDelPeriodicConfirm.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2929 index += SIZEOF_UINT16;
2930 sig->u.MlmeDelPeriodicConfirm.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2931 index += SIZEOF_UINT16;
2932 sig->u.MlmeDelPeriodicConfirm.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2933 index += SIZEOF_UINT16;
2934 sig->u.MlmeDelPeriodicConfirm.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2935 index += SIZEOF_UINT16;
2936 sig->u.MlmeDelPeriodicConfirm.VirtualInterfaceIdentifier = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2937 index += SIZEOF_UINT16;
2938 sig->u.MlmeDelPeriodicConfirm.PeriodicId = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2939 index += SIZEOF_UINT16;
2940 sig->u.MlmeDelPeriodicConfirm.ResultCode = (CSR_RESULT_CODE) CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2941 index += SIZEOF_UINT16;
2942 break;
2943#endif
2944#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
2945 case CSR_MLME_STOP_MEASURE_REQUEST_ID:
2946 sig->u.MlmeStopMeasureRequest.Dummydataref1.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2947 index += SIZEOF_UINT16;
2948 sig->u.MlmeStopMeasureRequest.Dummydataref1.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2949 index += SIZEOF_UINT16;
2950 sig->u.MlmeStopMeasureRequest.Dummydataref2.SlotNumber = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2951 index += SIZEOF_UINT16;
2952 sig->u.MlmeStopMeasureRequest.Dummydataref2.DataLength = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2953 index += SIZEOF_UINT16;
2954 sig->u.MlmeStopMeasureRequest.DialogToken = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr + index);
2955 index += SIZEOF_UINT16;
2956 break;
2957#endif
2958
2959 default:
2960 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
2961 }
2962 return CSR_RESULT_SUCCESS;
2963} /* read_unpack_signal() */
2964
2965
2966/*
2967 * ---------------------------------------------------------------------------
2968 * write_pack
2969 *
2970 * Convert a signal structure, in host-native format, to the
2971 * little-endian wire format specified in the UniFi Host Interface
2972 * Protocol Specification.
2973 *
2974 * WARNING: This function is auto-generated, DO NOT EDIT!
2975 *
2976 * Arguments:
2977 * sig Pointer to signal structure to pack.
2978 * ptr Destination buffer to pack into.
2979 * sig_len Returns the length of the packed signal, i.e. the
2980 * number of bytes written to ptr.
2981 *
2982 * Returns:
2983 * CSR_RESULT_SUCCESS on success,
2984 * CSR_WIFI_HIP_RESULT_INVALID_VALUE if the ID of signal was not recognised.
2985 * ---------------------------------------------------------------------------
2986 */
2987CsrResult write_pack(const CSR_SIGNAL *sig, u8 *ptr, u16 *sig_len)
2988{
2989 s16 index = 0;
2990
2991 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->SignalPrimitiveHeader.SignalId, ptr + index);
2992 index += SIZEOF_UINT16;
2993
2994 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->SignalPrimitiveHeader.ReceiverProcessId, ptr + index);
2995 index += SIZEOF_UINT16;
2996
2997 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->SignalPrimitiveHeader.SenderProcessId, ptr + index);
2998 index += SIZEOF_UINT16;
2999
3000 switch (sig->SignalPrimitiveHeader.SignalId)
3001 {
3002#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3003 case CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID:
3004 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterConfirm.Dummydataref1.SlotNumber, ptr + index);
3005 index += SIZEOF_UINT16;
3006 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterConfirm.Dummydataref1.DataLength, ptr + index);
3007 index += SIZEOF_UINT16;
3008 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterConfirm.Dummydataref2.SlotNumber, ptr + index);
3009 index += SIZEOF_UINT16;
3010 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterConfirm.Dummydataref2.DataLength, ptr + index);
3011 index += SIZEOF_UINT16;
3012 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterConfirm.VirtualInterfaceIdentifier, ptr + index);
3013 index += SIZEOF_UINT16;
3014 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterConfirm.ResultCode, ptr + index);
3015 index += SIZEOF_UINT16;
3016 break;
3017#endif
3018#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3019 case CSR_MLME_SETKEYS_CONFIRM_ID:
3020 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysConfirm.Dummydataref1.SlotNumber, ptr + index);
3021 index += SIZEOF_UINT16;
3022 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysConfirm.Dummydataref1.DataLength, ptr + index);
3023 index += SIZEOF_UINT16;
3024 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysConfirm.Dummydataref2.SlotNumber, ptr + index);
3025 index += SIZEOF_UINT16;
3026 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysConfirm.Dummydataref2.DataLength, ptr + index);
3027 index += SIZEOF_UINT16;
3028 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysConfirm.VirtualInterfaceIdentifier, ptr + index);
3029 index += SIZEOF_UINT16;
3030 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysConfirm.ResultCode, ptr + index);
3031 index += SIZEOF_UINT16;
3032 break;
3033#endif
3034#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3035 case CSR_MLME_CONFIG_QUEUE_CONFIRM_ID:
3036 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueConfirm.Dummydataref1.SlotNumber, ptr + index);
3037 index += SIZEOF_UINT16;
3038 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueConfirm.Dummydataref1.DataLength, ptr + index);
3039 index += SIZEOF_UINT16;
3040 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueConfirm.Dummydataref2.SlotNumber, ptr + index);
3041 index += SIZEOF_UINT16;
3042 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueConfirm.Dummydataref2.DataLength, ptr + index);
3043 index += SIZEOF_UINT16;
3044 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueConfirm.ResultCode, ptr + index);
3045 index += SIZEOF_UINT16;
3046 break;
3047#endif
3048#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3049 case CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID:
3050 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanConfirm.Dummydataref1.SlotNumber, ptr + index);
3051 index += SIZEOF_UINT16;
3052 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanConfirm.Dummydataref1.DataLength, ptr + index);
3053 index += SIZEOF_UINT16;
3054 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanConfirm.Dummydataref2.SlotNumber, ptr + index);
3055 index += SIZEOF_UINT16;
3056 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanConfirm.Dummydataref2.DataLength, ptr + index);
3057 index += SIZEOF_UINT16;
3058 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanConfirm.VirtualInterfaceIdentifier, ptr + index);
3059 index += SIZEOF_UINT16;
3060 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanConfirm.ResultCode, ptr + index);
3061 index += SIZEOF_UINT16;
3062 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanConfirm.AutonomousScanId, ptr + index);
3063 index += SIZEOF_UINT16;
3064 break;
3065#endif
3066#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3067 case CSR_MLME_ADD_BLACKOUT_CONFIRM_ID:
3068 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutConfirm.Dummydataref1.SlotNumber, ptr + index);
3069 index += SIZEOF_UINT16;
3070 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutConfirm.Dummydataref1.DataLength, ptr + index);
3071 index += SIZEOF_UINT16;
3072 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutConfirm.Dummydataref2.SlotNumber, ptr + index);
3073 index += SIZEOF_UINT16;
3074 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutConfirm.Dummydataref2.DataLength, ptr + index);
3075 index += SIZEOF_UINT16;
3076 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutConfirm.VirtualInterfaceIdentifier, ptr + index);
3077 index += SIZEOF_UINT16;
3078 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutConfirm.BlackoutId, ptr + index);
3079 index += SIZEOF_UINT16;
3080 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutConfirm.ResultCode, ptr + index);
3081 index += SIZEOF_UINT16;
3082 break;
3083#endif
3084#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3085 case CSR_MLME_DEL_BLACKOUT_REQUEST_ID:
3086 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutRequest.Dummydataref1.SlotNumber, ptr + index);
3087 index += SIZEOF_UINT16;
3088 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutRequest.Dummydataref1.DataLength, ptr + index);
3089 index += SIZEOF_UINT16;
3090 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutRequest.Dummydataref2.SlotNumber, ptr + index);
3091 index += SIZEOF_UINT16;
3092 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutRequest.Dummydataref2.DataLength, ptr + index);
3093 index += SIZEOF_UINT16;
3094 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutRequest.VirtualInterfaceIdentifier, ptr + index);
3095 index += SIZEOF_UINT16;
3096 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutRequest.BlackoutId, ptr + index);
3097 index += SIZEOF_UINT16;
3098 break;
3099#endif
3100#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3101 case CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID:
3102 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.Dummydataref1.SlotNumber, ptr + index);
3103 index += SIZEOF_UINT16;
3104 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.Dummydataref1.DataLength, ptr + index);
3105 index += SIZEOF_UINT16;
3106 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.Dummydataref2.SlotNumber, ptr + index);
3107 index += SIZEOF_UINT16;
3108 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.Dummydataref2.DataLength, ptr + index);
3109 index += SIZEOF_UINT16;
3110 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.VirtualInterfaceIdentifier, ptr + index);
3111 index += SIZEOF_UINT16;
3112 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.ResultCode, ptr + index);
3113 index += SIZEOF_UINT16;
3114 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[0], ptr + index);
3115 index += SIZEOF_UINT16;
3116 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[1], ptr + index);
3117 index += SIZEOF_UINT16;
3118 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[2], ptr + index);
3119 index += SIZEOF_UINT16;
3120 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[3], ptr + index);
3121 index += SIZEOF_UINT16;
3122 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[4], ptr + index);
3123 index += SIZEOF_UINT16;
3124 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[5], ptr + index);
3125 index += SIZEOF_UINT16;
3126 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[6], ptr + index);
3127 index += SIZEOF_UINT16;
3128 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceConfirm.SequenceNumber[7], ptr + index);
3129 index += SIZEOF_UINT16;
3130 break;
3131#endif
3132#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3133 case CSR_MLME_SM_START_CONFIRM_ID:
3134 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartConfirm.Dummydataref1.SlotNumber, ptr + index);
3135 index += SIZEOF_UINT16;
3136 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartConfirm.Dummydataref1.DataLength, ptr + index);
3137 index += SIZEOF_UINT16;
3138 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartConfirm.Dummydataref2.SlotNumber, ptr + index);
3139 index += SIZEOF_UINT16;
3140 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartConfirm.Dummydataref2.DataLength, ptr + index);
3141 index += SIZEOF_UINT16;
3142 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartConfirm.VirtualInterfaceIdentifier, ptr + index);
3143 index += SIZEOF_UINT16;
3144 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartConfirm.ResultCode, ptr + index);
3145 index += SIZEOF_UINT16;
3146 break;
3147#endif
3148#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3149 case CSR_MLME_STOP_AGGREGATION_CONFIRM_ID:
3150 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.Dummydataref1.SlotNumber, ptr + index);
3151 index += SIZEOF_UINT16;
3152 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.Dummydataref1.DataLength, ptr + index);
3153 index += SIZEOF_UINT16;
3154 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.Dummydataref2.SlotNumber, ptr + index);
3155 index += SIZEOF_UINT16;
3156 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.Dummydataref2.DataLength, ptr + index);
3157 index += SIZEOF_UINT16;
3158 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.VirtualInterfaceIdentifier, ptr + index);
3159 index += SIZEOF_UINT16;
3160 memcpy(ptr + index, sig->u.MlmeStopAggregationConfirm.PeerQstaAddress.x, 48 / 8);
3161 index += 48 / 8;
3162 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.UserPriority, ptr + index);
3163 index += SIZEOF_UINT16;
3164 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.Direction, ptr + index);
3165 index += SIZEOF_UINT16;
3166 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationConfirm.ResultCode, ptr + index);
3167 index += SIZEOF_UINT16;
3168 break;
3169#endif
3170#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3171 case CSR_MLME_DEL_TSPEC_REQUEST_ID:
3172 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecRequest.Dummydataref1.SlotNumber, ptr + index);
3173 index += SIZEOF_UINT16;
3174 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecRequest.Dummydataref1.DataLength, ptr + index);
3175 index += SIZEOF_UINT16;
3176 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecRequest.Dummydataref2.SlotNumber, ptr + index);
3177 index += SIZEOF_UINT16;
3178 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecRequest.Dummydataref2.DataLength, ptr + index);
3179 index += SIZEOF_UINT16;
3180 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecRequest.VirtualInterfaceIdentifier, ptr + index);
3181 index += SIZEOF_UINT16;
3182 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecRequest.UserPriority, ptr + index);
3183 index += SIZEOF_UINT16;
3184 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecRequest.Direction, ptr + index);
3185 index += SIZEOF_UINT16;
3186 break;
3187#endif
3188 case CSR_DEBUG_WORD16_INDICATION_ID:
3189 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.Dummydataref1.SlotNumber, ptr + index);
3190 index += SIZEOF_UINT16;
3191 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.Dummydataref1.DataLength, ptr + index);
3192 index += SIZEOF_UINT16;
3193 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.Dummydataref2.SlotNumber, ptr + index);
3194 index += SIZEOF_UINT16;
3195 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.Dummydataref2.DataLength, ptr + index);
3196 index += SIZEOF_UINT16;
3197 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[0], ptr + index);
3198 index += SIZEOF_UINT16;
3199 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[1], ptr + index);
3200 index += SIZEOF_UINT16;
3201 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[2], ptr + index);
3202 index += SIZEOF_UINT16;
3203 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[3], ptr + index);
3204 index += SIZEOF_UINT16;
3205 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[4], ptr + index);
3206 index += SIZEOF_UINT16;
3207 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[5], ptr + index);
3208 index += SIZEOF_UINT16;
3209 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[6], ptr + index);
3210 index += SIZEOF_UINT16;
3211 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[7], ptr + index);
3212 index += SIZEOF_UINT16;
3213 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[8], ptr + index);
3214 index += SIZEOF_UINT16;
3215 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[9], ptr + index);
3216 index += SIZEOF_UINT16;
3217 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[10], ptr + index);
3218 index += SIZEOF_UINT16;
3219 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[11], ptr + index);
3220 index += SIZEOF_UINT16;
3221 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[12], ptr + index);
3222 index += SIZEOF_UINT16;
3223 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[13], ptr + index);
3224 index += SIZEOF_UINT16;
3225 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[14], ptr + index);
3226 index += SIZEOF_UINT16;
3227 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugWord16Indication.DebugWords[15], ptr + index);
3228 index += SIZEOF_UINT16;
3229 break;
3230 case CSR_DEBUG_GENERIC_CONFIRM_ID:
3231 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugVariable.SlotNumber, ptr + index);
3232 index += SIZEOF_UINT16;
3233 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugVariable.DataLength, ptr + index);
3234 index += SIZEOF_UINT16;
3235 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.Dummydataref2.SlotNumber, ptr + index);
3236 index += SIZEOF_UINT16;
3237 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.Dummydataref2.DataLength, ptr + index);
3238 index += SIZEOF_UINT16;
3239 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[0], ptr + index);
3240 index += SIZEOF_UINT16;
3241 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[1], ptr + index);
3242 index += SIZEOF_UINT16;
3243 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[2], ptr + index);
3244 index += SIZEOF_UINT16;
3245 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[3], ptr + index);
3246 index += SIZEOF_UINT16;
3247 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[4], ptr + index);
3248 index += SIZEOF_UINT16;
3249 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[5], ptr + index);
3250 index += SIZEOF_UINT16;
3251 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[6], ptr + index);
3252 index += SIZEOF_UINT16;
3253 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericConfirm.DebugWords[7], ptr + index);
3254 index += SIZEOF_UINT16;
3255 break;
3256 case CSR_MA_PACKET_INDICATION_ID:
3257 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Data.SlotNumber, ptr + index);
3258 index += SIZEOF_UINT16;
3259 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Data.DataLength, ptr + index);
3260 index += SIZEOF_UINT16;
3261 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Dummydataref2.SlotNumber, ptr + index);
3262 index += SIZEOF_UINT16;
3263 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Dummydataref2.DataLength, ptr + index);
3264 index += SIZEOF_UINT16;
3265 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.VirtualInterfaceIdentifier, ptr + index);
3266 index += SIZEOF_UINT16;
3267 memcpy(ptr + index, sig->u.MaPacketIndication.LocalTime.x, 64 / 8);
3268 index += 64 / 8;
3269 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Ifindex, ptr + index);
3270 index += SIZEOF_UINT16;
3271 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Channel, ptr + index);
3272 index += SIZEOF_UINT16;
3273 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.ReceptionStatus, ptr + index);
3274 index += SIZEOF_UINT16;
3275 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Rssi, ptr + index);
3276 index += SIZEOF_UINT16;
3277 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.Snr, ptr + index);
3278 index += SIZEOF_UINT16;
3279 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketIndication.ReceivedRate, ptr + index);
3280 index += SIZEOF_UINT16;
3281 break;
3282 case CSR_MLME_SET_TIM_REQUEST_ID:
3283 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimRequest.Dummydataref1.SlotNumber, ptr + index);
3284 index += SIZEOF_UINT16;
3285 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimRequest.Dummydataref1.DataLength, ptr + index);
3286 index += SIZEOF_UINT16;
3287 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimRequest.Dummydataref2.SlotNumber, ptr + index);
3288 index += SIZEOF_UINT16;
3289 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimRequest.Dummydataref2.DataLength, ptr + index);
3290 index += SIZEOF_UINT16;
3291 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimRequest.VirtualInterfaceIdentifier, ptr + index);
3292 index += SIZEOF_UINT16;
3293 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimRequest.AssociationId, ptr + index);
3294 index += SIZEOF_UINT16;
3295 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimRequest.TimValue, ptr + index);
3296 index += SIZEOF_UINT16;
3297 break;
3298#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3299 case CSR_MLME_CONNECTED_INDICATION_ID:
3300 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectedIndication.Dummydataref1.SlotNumber, ptr + index);
3301 index += SIZEOF_UINT16;
3302 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectedIndication.Dummydataref1.DataLength, ptr + index);
3303 index += SIZEOF_UINT16;
3304 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectedIndication.Dummydataref2.SlotNumber, ptr + index);
3305 index += SIZEOF_UINT16;
3306 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectedIndication.Dummydataref2.DataLength, ptr + index);
3307 index += SIZEOF_UINT16;
3308 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectedIndication.VirtualInterfaceIdentifier, ptr + index);
3309 index += SIZEOF_UINT16;
3310 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectedIndication.ConnectionStatus, ptr + index);
3311 index += SIZEOF_UINT16;
3312 memcpy(ptr + index, sig->u.MlmeConnectedIndication.PeerMacAddress.x, 48 / 8);
3313 index += 48 / 8;
3314 break;
3315#endif
3316#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3317 case CSR_MLME_DEL_RX_TRIGGER_REQUEST_ID:
3318 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerRequest.Dummydataref1.SlotNumber, ptr + index);
3319 index += SIZEOF_UINT16;
3320 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerRequest.Dummydataref1.DataLength, ptr + index);
3321 index += SIZEOF_UINT16;
3322 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerRequest.Dummydataref2.SlotNumber, ptr + index);
3323 index += SIZEOF_UINT16;
3324 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerRequest.Dummydataref2.DataLength, ptr + index);
3325 index += SIZEOF_UINT16;
3326 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerRequest.VirtualInterfaceIdentifier, ptr + index);
3327 index += SIZEOF_UINT16;
3328 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerRequest.TriggerId, ptr + index);
3329 index += SIZEOF_UINT16;
3330 break;
3331#endif
3332#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3333 case CSR_MLME_TRIGGERED_GET_INDICATION_ID:
3334 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.MibAttributeValue.SlotNumber, ptr + index);
3335 index += SIZEOF_UINT16;
3336 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.MibAttributeValue.DataLength, ptr + index);
3337 index += SIZEOF_UINT16;
3338 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.Dummydataref2.SlotNumber, ptr + index);
3339 index += SIZEOF_UINT16;
3340 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.Dummydataref2.DataLength, ptr + index);
3341 index += SIZEOF_UINT16;
3342 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.VirtualInterfaceIdentifier, ptr + index);
3343 index += SIZEOF_UINT16;
3344 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.Status, ptr + index);
3345 index += SIZEOF_UINT16;
3346 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.ErrorIndex, ptr + index);
3347 index += SIZEOF_UINT16;
3348 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeTriggeredGetIndication.TriggeredId, ptr + index);
3349 index += SIZEOF_UINT16;
3350 break;
3351#endif
3352#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3353 case CSR_MLME_SCAN_REQUEST_ID:
3354 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.ChannelList.SlotNumber, ptr + index);
3355 index += SIZEOF_UINT16;
3356 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.ChannelList.DataLength, ptr + index);
3357 index += SIZEOF_UINT16;
3358 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.InformationElements.SlotNumber, ptr + index);
3359 index += SIZEOF_UINT16;
3360 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.InformationElements.DataLength, ptr + index);
3361 index += SIZEOF_UINT16;
3362 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.VirtualInterfaceIdentifier, ptr + index);
3363 index += SIZEOF_UINT16;
3364 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.Ifindex, ptr + index);
3365 index += SIZEOF_UINT16;
3366 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.ScanType, ptr + index);
3367 index += SIZEOF_UINT16;
3368 CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.ProbeDelay, ptr + index);
3369 index += SIZEOF_UINT32;
3370 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.MinChannelTime, ptr + index);
3371 index += SIZEOF_UINT16;
3372 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanRequest.MaxChannelTime, ptr + index);
3373 index += SIZEOF_UINT16;
3374 break;
3375#endif
3376#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3377 case CSR_MLME_DELETEKEYS_CONFIRM_ID:
3378 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysConfirm.Dummydataref1.SlotNumber, ptr + index);
3379 index += SIZEOF_UINT16;
3380 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysConfirm.Dummydataref1.DataLength, ptr + index);
3381 index += SIZEOF_UINT16;
3382 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysConfirm.Dummydataref2.SlotNumber, ptr + index);
3383 index += SIZEOF_UINT16;
3384 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysConfirm.Dummydataref2.DataLength, ptr + index);
3385 index += SIZEOF_UINT16;
3386 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysConfirm.VirtualInterfaceIdentifier, ptr + index);
3387 index += SIZEOF_UINT16;
3388 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysConfirm.ResultCode, ptr + index);
3389 index += SIZEOF_UINT16;
3390 break;
3391#endif
3392#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3393 case CSR_MLME_GET_NEXT_REQUEST_ID:
3394 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextRequest.MibAttribute.SlotNumber, ptr + index);
3395 index += SIZEOF_UINT16;
3396 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextRequest.MibAttribute.DataLength, ptr + index);
3397 index += SIZEOF_UINT16;
3398 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextRequest.Dummydataref2.SlotNumber, ptr + index);
3399 index += SIZEOF_UINT16;
3400 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextRequest.Dummydataref2.DataLength, ptr + index);
3401 index += SIZEOF_UINT16;
3402 break;
3403#endif
3404#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3405 case CSR_MLME_SET_CHANNEL_CONFIRM_ID:
3406 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelConfirm.Dummydataref1.SlotNumber, ptr + index);
3407 index += SIZEOF_UINT16;
3408 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelConfirm.Dummydataref1.DataLength, ptr + index);
3409 index += SIZEOF_UINT16;
3410 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelConfirm.Dummydataref2.SlotNumber, ptr + index);
3411 index += SIZEOF_UINT16;
3412 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelConfirm.Dummydataref2.DataLength, ptr + index);
3413 index += SIZEOF_UINT16;
3414 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelConfirm.VirtualInterfaceIdentifier, ptr + index);
3415 index += SIZEOF_UINT16;
3416 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelConfirm.ResultCode, ptr + index);
3417 index += SIZEOF_UINT16;
3418 break;
3419#endif
3420#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3421 case CSR_MLME_START_AGGREGATION_REQUEST_ID:
3422 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.Dummydataref1.SlotNumber, ptr + index);
3423 index += SIZEOF_UINT16;
3424 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.Dummydataref1.DataLength, ptr + index);
3425 index += SIZEOF_UINT16;
3426 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.Dummydataref2.SlotNumber, ptr + index);
3427 index += SIZEOF_UINT16;
3428 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.Dummydataref2.DataLength, ptr + index);
3429 index += SIZEOF_UINT16;
3430 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.VirtualInterfaceIdentifier, ptr + index);
3431 index += SIZEOF_UINT16;
3432 memcpy(ptr + index, sig->u.MlmeStartAggregationRequest.PeerQstaAddress.x, 48 / 8);
3433 index += 48 / 8;
3434 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.UserPriority, ptr + index);
3435 index += SIZEOF_UINT16;
3436 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.Direction, ptr + index);
3437 index += SIZEOF_UINT16;
3438 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.StartingSequenceNumber, ptr + index);
3439 index += SIZEOF_UINT16;
3440 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.BufferSize, ptr + index);
3441 index += SIZEOF_UINT16;
3442 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationRequest.BlockAckTimeout, ptr + index);
3443 index += SIZEOF_UINT16;
3444 break;
3445#endif
3446#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3447 case CSR_MLME_HL_SYNC_REQUEST_ID:
3448 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncRequest.Dummydataref1.SlotNumber, ptr + index);
3449 index += SIZEOF_UINT16;
3450 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncRequest.Dummydataref1.DataLength, ptr + index);
3451 index += SIZEOF_UINT16;
3452 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncRequest.Dummydataref2.SlotNumber, ptr + index);
3453 index += SIZEOF_UINT16;
3454 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncRequest.Dummydataref2.DataLength, ptr + index);
3455 index += SIZEOF_UINT16;
3456 memcpy(ptr + index, sig->u.MlmeHlSyncRequest.GroupAddress.x, 48 / 8);
3457 index += 48 / 8;
3458 break;
3459#endif
3460 case CSR_DEBUG_GENERIC_REQUEST_ID:
3461 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugVariable.SlotNumber, ptr + index);
3462 index += SIZEOF_UINT16;
3463 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugVariable.DataLength, ptr + index);
3464 index += SIZEOF_UINT16;
3465 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.Dummydataref2.SlotNumber, ptr + index);
3466 index += SIZEOF_UINT16;
3467 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.Dummydataref2.DataLength, ptr + index);
3468 index += SIZEOF_UINT16;
3469 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[0], ptr + index);
3470 index += SIZEOF_UINT16;
3471 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[1], ptr + index);
3472 index += SIZEOF_UINT16;
3473 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[2], ptr + index);
3474 index += SIZEOF_UINT16;
3475 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[3], ptr + index);
3476 index += SIZEOF_UINT16;
3477 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[4], ptr + index);
3478 index += SIZEOF_UINT16;
3479 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[5], ptr + index);
3480 index += SIZEOF_UINT16;
3481 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[6], ptr + index);
3482 index += SIZEOF_UINT16;
3483 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericRequest.DebugWords[7], ptr + index);
3484 index += SIZEOF_UINT16;
3485 break;
3486#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3487 case CSR_MLME_LEAVE_CONFIRM_ID:
3488 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveConfirm.Dummydataref1.SlotNumber, ptr + index);
3489 index += SIZEOF_UINT16;
3490 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveConfirm.Dummydataref1.DataLength, ptr + index);
3491 index += SIZEOF_UINT16;
3492 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveConfirm.Dummydataref2.SlotNumber, ptr + index);
3493 index += SIZEOF_UINT16;
3494 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveConfirm.Dummydataref2.DataLength, ptr + index);
3495 index += SIZEOF_UINT16;
3496 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveConfirm.VirtualInterfaceIdentifier, ptr + index);
3497 index += SIZEOF_UINT16;
3498 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveConfirm.ResultCode, ptr + index);
3499 index += SIZEOF_UINT16;
3500 break;
3501#endif
3502#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3503 case CSR_MLME_DEL_TRIGGERED_GET_REQUEST_ID:
3504 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetRequest.Dummydataref1.SlotNumber, ptr + index);
3505 index += SIZEOF_UINT16;
3506 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetRequest.Dummydataref1.DataLength, ptr + index);
3507 index += SIZEOF_UINT16;
3508 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetRequest.Dummydataref2.SlotNumber, ptr + index);
3509 index += SIZEOF_UINT16;
3510 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetRequest.Dummydataref2.DataLength, ptr + index);
3511 index += SIZEOF_UINT16;
3512 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetRequest.VirtualInterfaceIdentifier, ptr + index);
3513 index += SIZEOF_UINT16;
3514 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetRequest.TriggeredId, ptr + index);
3515 index += SIZEOF_UINT16;
3516 break;
3517#endif
3518#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3519 case CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST_ID:
3520 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressRequest.Data.SlotNumber, ptr + index);
3521 index += SIZEOF_UINT16;
3522 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressRequest.Data.DataLength, ptr + index);
3523 index += SIZEOF_UINT16;
3524 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressRequest.Dummydataref2.SlotNumber, ptr + index);
3525 index += SIZEOF_UINT16;
3526 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressRequest.Dummydataref2.DataLength, ptr + index);
3527 index += SIZEOF_UINT16;
3528 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressRequest.VirtualInterfaceIdentifier, ptr + index);
3529 index += SIZEOF_UINT16;
3530 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressRequest.NumberOfMulticastGroupAddresses, ptr + index);
3531 index += SIZEOF_UINT16;
3532 break;
3533#endif
3534#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3535 case CSR_MLME_RESET_REQUEST_ID:
3536 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetRequest.Dummydataref1.SlotNumber, ptr + index);
3537 index += SIZEOF_UINT16;
3538 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetRequest.Dummydataref1.DataLength, ptr + index);
3539 index += SIZEOF_UINT16;
3540 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetRequest.Dummydataref2.SlotNumber, ptr + index);
3541 index += SIZEOF_UINT16;
3542 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetRequest.Dummydataref2.DataLength, ptr + index);
3543 index += SIZEOF_UINT16;
3544 memcpy(ptr + index, sig->u.MlmeResetRequest.StaAddress.x, 48 / 8);
3545 index += 48 / 8;
3546 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetRequest.SetDefaultMib, ptr + index);
3547 index += SIZEOF_UINT16;
3548 break;
3549#endif
3550#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3551 case CSR_MLME_SCAN_CANCEL_REQUEST_ID:
3552 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanCancelRequest.Dummydataref1.SlotNumber, ptr + index);
3553 index += SIZEOF_UINT16;
3554 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanCancelRequest.Dummydataref1.DataLength, ptr + index);
3555 index += SIZEOF_UINT16;
3556 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanCancelRequest.Dummydataref2.SlotNumber, ptr + index);
3557 index += SIZEOF_UINT16;
3558 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanCancelRequest.Dummydataref2.DataLength, ptr + index);
3559 index += SIZEOF_UINT16;
3560 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanCancelRequest.VirtualInterfaceIdentifier, ptr + index);
3561 index += SIZEOF_UINT16;
3562 break;
3563#endif
3564#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3565 case CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID:
3566 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetConfirm.Dummydataref1.SlotNumber, ptr + index);
3567 index += SIZEOF_UINT16;
3568 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetConfirm.Dummydataref1.DataLength, ptr + index);
3569 index += SIZEOF_UINT16;
3570 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetConfirm.Dummydataref2.SlotNumber, ptr + index);
3571 index += SIZEOF_UINT16;
3572 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetConfirm.Dummydataref2.DataLength, ptr + index);
3573 index += SIZEOF_UINT16;
3574 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetConfirm.VirtualInterfaceIdentifier, ptr + index);
3575 index += SIZEOF_UINT16;
3576 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetConfirm.ResultCode, ptr + index);
3577 index += SIZEOF_UINT16;
3578 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetConfirm.TriggeredId, ptr + index);
3579 index += SIZEOF_UINT16;
3580 break;
3581#endif
3582#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3583 case CSR_MLME_SET_PACKET_FILTER_REQUEST_ID:
3584 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterRequest.InformationElements.SlotNumber, ptr + index);
3585 index += SIZEOF_UINT16;
3586 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterRequest.InformationElements.DataLength, ptr + index);
3587 index += SIZEOF_UINT16;
3588 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterRequest.Dummydataref2.SlotNumber, ptr + index);
3589 index += SIZEOF_UINT16;
3590 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterRequest.Dummydataref2.DataLength, ptr + index);
3591 index += SIZEOF_UINT16;
3592 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterRequest.VirtualInterfaceIdentifier, ptr + index);
3593 index += SIZEOF_UINT16;
3594 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterRequest.PacketFilterMode, ptr + index);
3595 index += SIZEOF_UINT16;
3596 CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeSetPacketFilterRequest.ArpFilterAddress, ptr + index);
3597 index += SIZEOF_UINT32;
3598 break;
3599#endif
3600#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3601 case CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID:
3602 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerConfirm.Dummydataref1.SlotNumber, ptr + index);
3603 index += SIZEOF_UINT16;
3604 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerConfirm.Dummydataref1.DataLength, ptr + index);
3605 index += SIZEOF_UINT16;
3606 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerConfirm.Dummydataref2.SlotNumber, ptr + index);
3607 index += SIZEOF_UINT16;
3608 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerConfirm.Dummydataref2.DataLength, ptr + index);
3609 index += SIZEOF_UINT16;
3610 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerConfirm.VirtualInterfaceIdentifier, ptr + index);
3611 index += SIZEOF_UINT16;
3612 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerConfirm.TriggerId, ptr + index);
3613 index += SIZEOF_UINT16;
3614 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelRxTriggerConfirm.ResultCode, ptr + index);
3615 index += SIZEOF_UINT16;
3616 break;
3617#endif
3618#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3619 case CSR_MLME_CONNECT_STATUS_REQUEST_ID:
3620 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.InformationElements.SlotNumber, ptr + index);
3621 index += SIZEOF_UINT16;
3622 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.InformationElements.DataLength, ptr + index);
3623 index += SIZEOF_UINT16;
3624 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.Dummydataref2.SlotNumber, ptr + index);
3625 index += SIZEOF_UINT16;
3626 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.Dummydataref2.DataLength, ptr + index);
3627 index += SIZEOF_UINT16;
3628 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.VirtualInterfaceIdentifier, ptr + index);
3629 index += SIZEOF_UINT16;
3630 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.ConnectionStatus, ptr + index);
3631 index += SIZEOF_UINT16;
3632 memcpy(ptr + index, sig->u.MlmeConnectStatusRequest.StaAddress.x, 48 / 8);
3633 index += 48 / 8;
3634 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.AssociationId, ptr + index);
3635 index += SIZEOF_UINT16;
3636 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusRequest.AssociationCapabilityInformation, ptr + index);
3637 index += SIZEOF_UINT16;
3638 break;
3639#endif
3640#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3641 case CSR_MLME_LEAVE_REQUEST_ID:
3642 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveRequest.Dummydataref1.SlotNumber, ptr + index);
3643 index += SIZEOF_UINT16;
3644 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveRequest.Dummydataref1.DataLength, ptr + index);
3645 index += SIZEOF_UINT16;
3646 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveRequest.Dummydataref2.SlotNumber, ptr + index);
3647 index += SIZEOF_UINT16;
3648 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveRequest.Dummydataref2.DataLength, ptr + index);
3649 index += SIZEOF_UINT16;
3650 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeLeaveRequest.VirtualInterfaceIdentifier, ptr + index);
3651 index += SIZEOF_UINT16;
3652 break;
3653#endif
3654#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3655 case CSR_MLME_CONFIG_QUEUE_REQUEST_ID:
3656 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.Dummydataref1.SlotNumber, ptr + index);
3657 index += SIZEOF_UINT16;
3658 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.Dummydataref1.DataLength, ptr + index);
3659 index += SIZEOF_UINT16;
3660 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.Dummydataref2.SlotNumber, ptr + index);
3661 index += SIZEOF_UINT16;
3662 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.Dummydataref2.DataLength, ptr + index);
3663 index += SIZEOF_UINT16;
3664 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.QueueIndex, ptr + index);
3665 index += SIZEOF_UINT16;
3666 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.Aifs, ptr + index);
3667 index += SIZEOF_UINT16;
3668 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.Cwmin, ptr + index);
3669 index += SIZEOF_UINT16;
3670 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.Cwmax, ptr + index);
3671 index += SIZEOF_UINT16;
3672 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConfigQueueRequest.TxopLimit, ptr + index);
3673 index += SIZEOF_UINT16;
3674 break;
3675#endif
3676#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3677 case CSR_MLME_DEL_TSPEC_CONFIRM_ID:
3678 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecConfirm.Dummydataref1.SlotNumber, ptr + index);
3679 index += SIZEOF_UINT16;
3680 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecConfirm.Dummydataref1.DataLength, ptr + index);
3681 index += SIZEOF_UINT16;
3682 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecConfirm.Dummydataref2.SlotNumber, ptr + index);
3683 index += SIZEOF_UINT16;
3684 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecConfirm.Dummydataref2.DataLength, ptr + index);
3685 index += SIZEOF_UINT16;
3686 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecConfirm.VirtualInterfaceIdentifier, ptr + index);
3687 index += SIZEOF_UINT16;
3688 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecConfirm.UserPriority, ptr + index);
3689 index += SIZEOF_UINT16;
3690 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTspecConfirm.ResultCode, ptr + index);
3691 index += SIZEOF_UINT16;
3692 break;
3693#endif
3694 case CSR_MLME_SET_TIM_CONFIRM_ID:
3695 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimConfirm.Dummydataref1.SlotNumber, ptr + index);
3696 index += SIZEOF_UINT16;
3697 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimConfirm.Dummydataref1.DataLength, ptr + index);
3698 index += SIZEOF_UINT16;
3699 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimConfirm.Dummydataref2.SlotNumber, ptr + index);
3700 index += SIZEOF_UINT16;
3701 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimConfirm.Dummydataref2.DataLength, ptr + index);
3702 index += SIZEOF_UINT16;
3703 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimConfirm.VirtualInterfaceIdentifier, ptr + index);
3704 index += SIZEOF_UINT16;
3705 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetTimConfirm.ResultCode, ptr + index);
3706 index += SIZEOF_UINT16;
3707 break;
3708#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3709 case CSR_MLME_MEASURE_INDICATION_ID:
3710 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureIndication.MeasurementReportSet.SlotNumber, ptr + index);
3711 index += SIZEOF_UINT16;
3712 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureIndication.MeasurementReportSet.DataLength, ptr + index);
3713 index += SIZEOF_UINT16;
3714 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureIndication.Dummydataref2.SlotNumber, ptr + index);
3715 index += SIZEOF_UINT16;
3716 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureIndication.Dummydataref2.DataLength, ptr + index);
3717 index += SIZEOF_UINT16;
3718 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureIndication.DialogToken, ptr + index);
3719 index += SIZEOF_UINT16;
3720 break;
3721#endif
3722#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3723 case CSR_MLME_DEL_BLACKOUT_CONFIRM_ID:
3724 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutConfirm.Dummydataref1.SlotNumber, ptr + index);
3725 index += SIZEOF_UINT16;
3726 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutConfirm.Dummydataref1.DataLength, ptr + index);
3727 index += SIZEOF_UINT16;
3728 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutConfirm.Dummydataref2.SlotNumber, ptr + index);
3729 index += SIZEOF_UINT16;
3730 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutConfirm.Dummydataref2.DataLength, ptr + index);
3731 index += SIZEOF_UINT16;
3732 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutConfirm.VirtualInterfaceIdentifier, ptr + index);
3733 index += SIZEOF_UINT16;
3734 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutConfirm.BlackoutId, ptr + index);
3735 index += SIZEOF_UINT16;
3736 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelBlackoutConfirm.ResultCode, ptr + index);
3737 index += SIZEOF_UINT16;
3738 break;
3739#endif
3740#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3741 case CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID:
3742 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetConfirm.Dummydataref1.SlotNumber, ptr + index);
3743 index += SIZEOF_UINT16;
3744 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetConfirm.Dummydataref1.DataLength, ptr + index);
3745 index += SIZEOF_UINT16;
3746 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetConfirm.Dummydataref2.SlotNumber, ptr + index);
3747 index += SIZEOF_UINT16;
3748 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetConfirm.Dummydataref2.DataLength, ptr + index);
3749 index += SIZEOF_UINT16;
3750 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetConfirm.VirtualInterfaceIdentifier, ptr + index);
3751 index += SIZEOF_UINT16;
3752 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetConfirm.ResultCode, ptr + index);
3753 index += SIZEOF_UINT16;
3754 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelTriggeredGetConfirm.TriggeredId, ptr + index);
3755 index += SIZEOF_UINT16;
3756 break;
3757#endif
3758 case CSR_DEBUG_GENERIC_INDICATION_ID:
3759 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugVariable.SlotNumber, ptr + index);
3760 index += SIZEOF_UINT16;
3761 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugVariable.DataLength, ptr + index);
3762 index += SIZEOF_UINT16;
3763 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.Dummydataref2.SlotNumber, ptr + index);
3764 index += SIZEOF_UINT16;
3765 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.Dummydataref2.DataLength, ptr + index);
3766 index += SIZEOF_UINT16;
3767 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[0], ptr + index);
3768 index += SIZEOF_UINT16;
3769 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[1], ptr + index);
3770 index += SIZEOF_UINT16;
3771 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[2], ptr + index);
3772 index += SIZEOF_UINT16;
3773 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[3], ptr + index);
3774 index += SIZEOF_UINT16;
3775 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[4], ptr + index);
3776 index += SIZEOF_UINT16;
3777 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[5], ptr + index);
3778 index += SIZEOF_UINT16;
3779 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[6], ptr + index);
3780 index += SIZEOF_UINT16;
3781 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugGenericIndication.DebugWords[7], ptr + index);
3782 index += SIZEOF_UINT16;
3783 break;
3784 case CSR_MA_PACKET_CANCEL_REQUEST_ID:
3785 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketCancelRequest.Dummydataref1.SlotNumber, ptr + index);
3786 index += SIZEOF_UINT16;
3787 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketCancelRequest.Dummydataref1.DataLength, ptr + index);
3788 index += SIZEOF_UINT16;
3789 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketCancelRequest.Dummydataref2.SlotNumber, ptr + index);
3790 index += SIZEOF_UINT16;
3791 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketCancelRequest.Dummydataref2.DataLength, ptr + index);
3792 index += SIZEOF_UINT16;
3793 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketCancelRequest.VirtualInterfaceIdentifier, ptr + index);
3794 index += SIZEOF_UINT16;
3795 CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MaPacketCancelRequest.HostTag, ptr + index);
3796 index += SIZEOF_UINT32;
3797 break;
3798#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3799 case CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID:
3800 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterConfirm.Dummydataref1.SlotNumber, ptr + index);
3801 index += SIZEOF_UINT16;
3802 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterConfirm.Dummydataref1.DataLength, ptr + index);
3803 index += SIZEOF_UINT16;
3804 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterConfirm.Dummydataref2.SlotNumber, ptr + index);
3805 index += SIZEOF_UINT16;
3806 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterConfirm.Dummydataref2.DataLength, ptr + index);
3807 index += SIZEOF_UINT16;
3808 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterConfirm.VirtualInterfaceIdentifier, ptr + index);
3809 index += SIZEOF_UINT16;
3810 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterConfirm.ResultCode, ptr + index);
3811 index += SIZEOF_UINT16;
3812 break;
3813#endif
3814#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3815 case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID:
3816 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanConfirm.Dummydataref1.SlotNumber, ptr + index);
3817 index += SIZEOF_UINT16;
3818 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanConfirm.Dummydataref1.DataLength, ptr + index);
3819 index += SIZEOF_UINT16;
3820 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanConfirm.Dummydataref2.SlotNumber, ptr + index);
3821 index += SIZEOF_UINT16;
3822 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanConfirm.Dummydataref2.DataLength, ptr + index);
3823 index += SIZEOF_UINT16;
3824 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanConfirm.VirtualInterfaceIdentifier, ptr + index);
3825 index += SIZEOF_UINT16;
3826 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanConfirm.ResultCode, ptr + index);
3827 index += SIZEOF_UINT16;
3828 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanConfirm.AutonomousScanId, ptr + index);
3829 index += SIZEOF_UINT16;
3830 break;
3831#endif
3832 case CSR_MA_PACKET_REQUEST_ID:
3833 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.Data.SlotNumber, ptr + index);
3834 index += SIZEOF_UINT16;
3835 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.Data.DataLength, ptr + index);
3836 index += SIZEOF_UINT16;
3837 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.Dummydataref2.SlotNumber, ptr + index);
3838 index += SIZEOF_UINT16;
3839 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.Dummydataref2.DataLength, ptr + index);
3840 index += SIZEOF_UINT16;
3841 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.VirtualInterfaceIdentifier, ptr + index);
3842 index += SIZEOF_UINT16;
3843 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.TransmitRate, ptr + index);
3844 index += SIZEOF_UINT16;
3845 CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.HostTag, ptr + index);
3846 index += SIZEOF_UINT32;
3847 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.Priority, ptr + index);
3848 index += SIZEOF_UINT16;
3849 memcpy(ptr + index, sig->u.MaPacketRequest.Ra.x, 48 / 8);
3850 index += 48 / 8;
3851 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketRequest.TransmissionControl, ptr + index);
3852 index += SIZEOF_UINT16;
3853 break;
3854#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3855 case CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST_ID:
3856 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.Data.SlotNumber, ptr + index);
3857 index += SIZEOF_UINT16;
3858 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.Data.DataLength, ptr + index);
3859 index += SIZEOF_UINT16;
3860 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.Dummydataref2.SlotNumber, ptr + index);
3861 index += SIZEOF_UINT16;
3862 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.Dummydataref2.DataLength, ptr + index);
3863 index += SIZEOF_UINT16;
3864 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.VirtualInterfaceIdentifier, ptr + index);
3865 index += SIZEOF_UINT16;
3866 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.BeaconPeriod, ptr + index);
3867 index += SIZEOF_UINT16;
3868 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.DtimPeriod, ptr + index);
3869 index += SIZEOF_UINT16;
3870 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.CapabilityInformation, ptr + index);
3871 index += SIZEOF_UINT16;
3872 memcpy(ptr + index, sig->u.MlmeModifyBssParameterRequest.Bssid.x, 48 / 8);
3873 index += 48 / 8;
3874 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeModifyBssParameterRequest.RtsThreshold, ptr + index);
3875 index += SIZEOF_UINT16;
3876 break;
3877#endif
3878#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3879 case CSR_MLME_ADD_RX_TRIGGER_REQUEST_ID:
3880 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerRequest.InformationElements.SlotNumber, ptr + index);
3881 index += SIZEOF_UINT16;
3882 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerRequest.InformationElements.DataLength, ptr + index);
3883 index += SIZEOF_UINT16;
3884 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerRequest.Dummydataref2.SlotNumber, ptr + index);
3885 index += SIZEOF_UINT16;
3886 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerRequest.Dummydataref2.DataLength, ptr + index);
3887 index += SIZEOF_UINT16;
3888 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerRequest.VirtualInterfaceIdentifier, ptr + index);
3889 index += SIZEOF_UINT16;
3890 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerRequest.TriggerId, ptr + index);
3891 index += SIZEOF_UINT16;
3892 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerRequest.Priority, ptr + index);
3893 index += SIZEOF_UINT16;
3894 break;
3895#endif
3896 case CSR_MA_VIF_AVAILABILITY_INDICATION_ID:
3897 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityIndication.Dummydataref1.SlotNumber, ptr + index);
3898 index += SIZEOF_UINT16;
3899 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityIndication.Dummydataref1.DataLength, ptr + index);
3900 index += SIZEOF_UINT16;
3901 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityIndication.Dummydataref2.SlotNumber, ptr + index);
3902 index += SIZEOF_UINT16;
3903 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityIndication.Dummydataref2.DataLength, ptr + index);
3904 index += SIZEOF_UINT16;
3905 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityIndication.VirtualInterfaceIdentifier, ptr + index);
3906 index += SIZEOF_UINT16;
3907 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityIndication.Multicast, ptr + index);
3908 index += SIZEOF_UINT16;
3909 break;
3910#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3911 case CSR_MLME_HL_SYNC_CANCEL_REQUEST_ID:
3912 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelRequest.Dummydataref1.SlotNumber, ptr + index);
3913 index += SIZEOF_UINT16;
3914 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelRequest.Dummydataref1.DataLength, ptr + index);
3915 index += SIZEOF_UINT16;
3916 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelRequest.Dummydataref2.SlotNumber, ptr + index);
3917 index += SIZEOF_UINT16;
3918 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelRequest.Dummydataref2.DataLength, ptr + index);
3919 index += SIZEOF_UINT16;
3920 memcpy(ptr + index, sig->u.MlmeHlSyncCancelRequest.GroupAddress.x, 48 / 8);
3921 index += 48 / 8;
3922 break;
3923#endif
3924#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3925 case CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST_ID:
3926 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanRequest.Dummydataref1.SlotNumber, ptr + index);
3927 index += SIZEOF_UINT16;
3928 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanRequest.Dummydataref1.DataLength, ptr + index);
3929 index += SIZEOF_UINT16;
3930 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanRequest.Dummydataref2.SlotNumber, ptr + index);
3931 index += SIZEOF_UINT16;
3932 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanRequest.Dummydataref2.DataLength, ptr + index);
3933 index += SIZEOF_UINT16;
3934 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanRequest.VirtualInterfaceIdentifier, ptr + index);
3935 index += SIZEOF_UINT16;
3936 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanRequest.AutonomousScanId, ptr + index);
3937 index += SIZEOF_UINT16;
3938 break;
3939#endif
3940#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3941 case CSR_MLME_BLACKOUT_ENDED_INDICATION_ID:
3942 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlackoutEndedIndication.Dummydataref1.SlotNumber, ptr + index);
3943 index += SIZEOF_UINT16;
3944 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlackoutEndedIndication.Dummydataref1.DataLength, ptr + index);
3945 index += SIZEOF_UINT16;
3946 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlackoutEndedIndication.Dummydataref2.SlotNumber, ptr + index);
3947 index += SIZEOF_UINT16;
3948 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlackoutEndedIndication.Dummydataref2.DataLength, ptr + index);
3949 index += SIZEOF_UINT16;
3950 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlackoutEndedIndication.VirtualInterfaceIdentifier, ptr + index);
3951 index += SIZEOF_UINT16;
3952 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlackoutEndedIndication.BlackoutId, ptr + index);
3953 index += SIZEOF_UINT16;
3954 break;
3955#endif
3956#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3957 case CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION_ID:
3958 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanDoneIndication.Dummydataref1.SlotNumber, ptr + index);
3959 index += SIZEOF_UINT16;
3960 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanDoneIndication.Dummydataref1.DataLength, ptr + index);
3961 index += SIZEOF_UINT16;
3962 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanDoneIndication.Dummydataref2.SlotNumber, ptr + index);
3963 index += SIZEOF_UINT16;
3964 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanDoneIndication.Dummydataref2.DataLength, ptr + index);
3965 index += SIZEOF_UINT16;
3966 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanDoneIndication.VirtualInterfaceIdentifier, ptr + index);
3967 index += SIZEOF_UINT16;
3968 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanDoneIndication.ResultCode, ptr + index);
3969 index += SIZEOF_UINT16;
3970 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanDoneIndication.AutonomousScanId, ptr + index);
3971 index += SIZEOF_UINT16;
3972 break;
3973#endif
3974#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3975 case CSR_MLME_GET_KEY_SEQUENCE_REQUEST_ID:
3976 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceRequest.Dummydataref1.SlotNumber, ptr + index);
3977 index += SIZEOF_UINT16;
3978 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceRequest.Dummydataref1.DataLength, ptr + index);
3979 index += SIZEOF_UINT16;
3980 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceRequest.Dummydataref2.SlotNumber, ptr + index);
3981 index += SIZEOF_UINT16;
3982 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceRequest.Dummydataref2.DataLength, ptr + index);
3983 index += SIZEOF_UINT16;
3984 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceRequest.VirtualInterfaceIdentifier, ptr + index);
3985 index += SIZEOF_UINT16;
3986 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceRequest.KeyId, ptr + index);
3987 index += SIZEOF_UINT16;
3988 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetKeySequenceRequest.KeyType, ptr + index);
3989 index += SIZEOF_UINT16;
3990 memcpy(ptr + index, sig->u.MlmeGetKeySequenceRequest.Address.x, 48 / 8);
3991 index += 48 / 8;
3992 break;
3993#endif
3994#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
3995 case CSR_MLME_SET_CHANNEL_REQUEST_ID:
3996 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.Dummydataref1.SlotNumber, ptr + index);
3997 index += SIZEOF_UINT16;
3998 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.Dummydataref1.DataLength, ptr + index);
3999 index += SIZEOF_UINT16;
4000 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.Dummydataref2.SlotNumber, ptr + index);
4001 index += SIZEOF_UINT16;
4002 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.Dummydataref2.DataLength, ptr + index);
4003 index += SIZEOF_UINT16;
4004 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.VirtualInterfaceIdentifier, ptr + index);
4005 index += SIZEOF_UINT16;
4006 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.Ifindex, ptr + index);
4007 index += SIZEOF_UINT16;
4008 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.Channel, ptr + index);
4009 index += SIZEOF_UINT16;
4010 memcpy(ptr + index, sig->u.MlmeSetChannelRequest.Address.x, 48 / 8);
4011 index += 48 / 8;
4012 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.AvailabilityDuration, ptr + index);
4013 index += SIZEOF_UINT16;
4014 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetChannelRequest.AvailabilityInterval, ptr + index);
4015 index += SIZEOF_UINT16;
4016 break;
4017#endif
4018#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4019 case CSR_MLME_MEASURE_CONFIRM_ID:
4020 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureConfirm.Dummydataref1.SlotNumber, ptr + index);
4021 index += SIZEOF_UINT16;
4022 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureConfirm.Dummydataref1.DataLength, ptr + index);
4023 index += SIZEOF_UINT16;
4024 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureConfirm.Dummydataref2.SlotNumber, ptr + index);
4025 index += SIZEOF_UINT16;
4026 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureConfirm.Dummydataref2.DataLength, ptr + index);
4027 index += SIZEOF_UINT16;
4028 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureConfirm.ResultCode, ptr + index);
4029 index += SIZEOF_UINT16;
4030 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureConfirm.DialogToken, ptr + index);
4031 index += SIZEOF_UINT16;
4032 break;
4033#endif
4034#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4035 case CSR_MLME_ADD_TRIGGERED_GET_REQUEST_ID:
4036 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetRequest.MibAttribute.SlotNumber, ptr + index);
4037 index += SIZEOF_UINT16;
4038 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetRequest.MibAttribute.DataLength, ptr + index);
4039 index += SIZEOF_UINT16;
4040 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetRequest.Dummydataref2.SlotNumber, ptr + index);
4041 index += SIZEOF_UINT16;
4042 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetRequest.Dummydataref2.DataLength, ptr + index);
4043 index += SIZEOF_UINT16;
4044 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetRequest.VirtualInterfaceIdentifier, ptr + index);
4045 index += SIZEOF_UINT16;
4046 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTriggeredGetRequest.TriggeredId, ptr + index);
4047 index += SIZEOF_UINT16;
4048 break;
4049#endif
4050#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4051 case CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION_ID:
4052 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanLossIndication.Dummydataref1.SlotNumber, ptr + index);
4053 index += SIZEOF_UINT16;
4054 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanLossIndication.Dummydataref1.DataLength, ptr + index);
4055 index += SIZEOF_UINT16;
4056 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanLossIndication.Dummydataref2.SlotNumber, ptr + index);
4057 index += SIZEOF_UINT16;
4058 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanLossIndication.Dummydataref2.DataLength, ptr + index);
4059 index += SIZEOF_UINT16;
4060 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAutonomousScanLossIndication.VirtualInterfaceIdentifier, ptr + index);
4061 index += SIZEOF_UINT16;
4062 memcpy(ptr + index, sig->u.MlmeAutonomousScanLossIndication.Bssid.x, 48 / 8);
4063 index += 48 / 8;
4064 break;
4065#endif
4066 case CSR_MA_VIF_AVAILABILITY_RESPONSE_ID:
4067 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityResponse.Dummydataref1.SlotNumber, ptr + index);
4068 index += SIZEOF_UINT16;
4069 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityResponse.Dummydataref1.DataLength, ptr + index);
4070 index += SIZEOF_UINT16;
4071 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityResponse.Dummydataref2.SlotNumber, ptr + index);
4072 index += SIZEOF_UINT16;
4073 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityResponse.Dummydataref2.DataLength, ptr + index);
4074 index += SIZEOF_UINT16;
4075 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityResponse.VirtualInterfaceIdentifier, ptr + index);
4076 index += SIZEOF_UINT16;
4077 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaVifAvailabilityResponse.ResultCode, ptr + index);
4078 index += SIZEOF_UINT16;
4079 break;
4080#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4081 case CSR_MLME_ADD_TEMPLATE_REQUEST_ID:
4082 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateRequest.Data1.SlotNumber, ptr + index);
4083 index += SIZEOF_UINT16;
4084 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateRequest.Data1.DataLength, ptr + index);
4085 index += SIZEOF_UINT16;
4086 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateRequest.Data2.SlotNumber, ptr + index);
4087 index += SIZEOF_UINT16;
4088 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateRequest.Data2.DataLength, ptr + index);
4089 index += SIZEOF_UINT16;
4090 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateRequest.VirtualInterfaceIdentifier, ptr + index);
4091 index += SIZEOF_UINT16;
4092 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateRequest.FrameType, ptr + index);
4093 index += SIZEOF_UINT16;
4094 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateRequest.MinTransmitRate, ptr + index);
4095 index += SIZEOF_UINT16;
4096 break;
4097#endif
4098#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4099 case CSR_MLME_POWERMGT_CONFIRM_ID:
4100 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtConfirm.Dummydataref1.SlotNumber, ptr + index);
4101 index += SIZEOF_UINT16;
4102 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtConfirm.Dummydataref1.DataLength, ptr + index);
4103 index += SIZEOF_UINT16;
4104 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtConfirm.Dummydataref2.SlotNumber, ptr + index);
4105 index += SIZEOF_UINT16;
4106 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtConfirm.Dummydataref2.DataLength, ptr + index);
4107 index += SIZEOF_UINT16;
4108 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtConfirm.VirtualInterfaceIdentifier, ptr + index);
4109 index += SIZEOF_UINT16;
4110 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtConfirm.ResultCode, ptr + index);
4111 index += SIZEOF_UINT16;
4112 break;
4113#endif
4114#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4115 case CSR_MLME_ADD_PERIODIC_CONFIRM_ID:
4116 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicConfirm.Dummydataref1.SlotNumber, ptr + index);
4117 index += SIZEOF_UINT16;
4118 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicConfirm.Dummydataref1.DataLength, ptr + index);
4119 index += SIZEOF_UINT16;
4120 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicConfirm.Dummydataref2.SlotNumber, ptr + index);
4121 index += SIZEOF_UINT16;
4122 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicConfirm.Dummydataref2.DataLength, ptr + index);
4123 index += SIZEOF_UINT16;
4124 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicConfirm.VirtualInterfaceIdentifier, ptr + index);
4125 index += SIZEOF_UINT16;
4126 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicConfirm.PeriodicId, ptr + index);
4127 index += SIZEOF_UINT16;
4128 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicConfirm.ResultCode, ptr + index);
4129 index += SIZEOF_UINT16;
4130 break;
4131#endif
4132#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4133 case CSR_MLME_GET_CONFIRM_ID:
4134 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetConfirm.MibAttributeValue.SlotNumber, ptr + index);
4135 index += SIZEOF_UINT16;
4136 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetConfirm.MibAttributeValue.DataLength, ptr + index);
4137 index += SIZEOF_UINT16;
4138 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetConfirm.Dummydataref2.SlotNumber, ptr + index);
4139 index += SIZEOF_UINT16;
4140 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetConfirm.Dummydataref2.DataLength, ptr + index);
4141 index += SIZEOF_UINT16;
4142 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetConfirm.Status, ptr + index);
4143 index += SIZEOF_UINT16;
4144 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetConfirm.ErrorIndex, ptr + index);
4145 index += SIZEOF_UINT16;
4146 break;
4147#endif
4148#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4149 case CSR_MLME_GET_NEXT_CONFIRM_ID:
4150 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextConfirm.MibAttributeValue.SlotNumber, ptr + index);
4151 index += SIZEOF_UINT16;
4152 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextConfirm.MibAttributeValue.DataLength, ptr + index);
4153 index += SIZEOF_UINT16;
4154 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextConfirm.Dummydataref2.SlotNumber, ptr + index);
4155 index += SIZEOF_UINT16;
4156 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextConfirm.Dummydataref2.DataLength, ptr + index);
4157 index += SIZEOF_UINT16;
4158 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextConfirm.Status, ptr + index);
4159 index += SIZEOF_UINT16;
4160 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetNextConfirm.ErrorIndex, ptr + index);
4161 index += SIZEOF_UINT16;
4162 break;
4163#endif
4164#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4165 case CSR_MLME_STOP_AGGREGATION_REQUEST_ID:
4166 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.Dummydataref1.SlotNumber, ptr + index);
4167 index += SIZEOF_UINT16;
4168 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.Dummydataref1.DataLength, ptr + index);
4169 index += SIZEOF_UINT16;
4170 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.Dummydataref2.SlotNumber, ptr + index);
4171 index += SIZEOF_UINT16;
4172 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.Dummydataref2.DataLength, ptr + index);
4173 index += SIZEOF_UINT16;
4174 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.VirtualInterfaceIdentifier, ptr + index);
4175 index += SIZEOF_UINT16;
4176 memcpy(ptr + index, sig->u.MlmeStopAggregationRequest.PeerQstaAddress.x, 48 / 8);
4177 index += 48 / 8;
4178 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.UserPriority, ptr + index);
4179 index += SIZEOF_UINT16;
4180 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopAggregationRequest.Direction, ptr + index);
4181 index += SIZEOF_UINT16;
4182 break;
4183#endif
4184#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4185 case CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID:
4186 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerConfirm.Dummydataref1.SlotNumber, ptr + index);
4187 index += SIZEOF_UINT16;
4188 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerConfirm.Dummydataref1.DataLength, ptr + index);
4189 index += SIZEOF_UINT16;
4190 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerConfirm.Dummydataref2.SlotNumber, ptr + index);
4191 index += SIZEOF_UINT16;
4192 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerConfirm.Dummydataref2.DataLength, ptr + index);
4193 index += SIZEOF_UINT16;
4194 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerConfirm.VirtualInterfaceIdentifier, ptr + index);
4195 index += SIZEOF_UINT16;
4196 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerConfirm.TriggerId, ptr + index);
4197 index += SIZEOF_UINT16;
4198 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddRxTriggerConfirm.ResultCode, ptr + index);
4199 index += SIZEOF_UINT16;
4200 break;
4201#endif
4202#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4203 case CSR_MLME_ADD_BLACKOUT_REQUEST_ID:
4204 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.Dummydataref1.SlotNumber, ptr + index);
4205 index += SIZEOF_UINT16;
4206 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.Dummydataref1.DataLength, ptr + index);
4207 index += SIZEOF_UINT16;
4208 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.Dummydataref2.SlotNumber, ptr + index);
4209 index += SIZEOF_UINT16;
4210 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.Dummydataref2.DataLength, ptr + index);
4211 index += SIZEOF_UINT16;
4212 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.VirtualInterfaceIdentifier, ptr + index);
4213 index += SIZEOF_UINT16;
4214 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutId, ptr + index);
4215 index += SIZEOF_UINT16;
4216 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutType, ptr + index);
4217 index += SIZEOF_UINT16;
4218 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutSource, ptr + index);
4219 index += SIZEOF_UINT16;
4220 CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutStartReference, ptr + index);
4221 index += SIZEOF_UINT32;
4222 CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutPeriod, ptr + index);
4223 index += SIZEOF_UINT32;
4224 CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutDuration, ptr + index);
4225 index += SIZEOF_UINT32;
4226 memcpy(ptr + index, sig->u.MlmeAddBlackoutRequest.PeerStaAddress.x, 48 / 8);
4227 index += 48 / 8;
4228 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddBlackoutRequest.BlackoutCount, ptr + index);
4229 index += SIZEOF_UINT16;
4230 break;
4231#endif
4232#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4233 case CSR_MLME_DELETEKEYS_REQUEST_ID:
4234 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysRequest.Dummydataref1.SlotNumber, ptr + index);
4235 index += SIZEOF_UINT16;
4236 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysRequest.Dummydataref1.DataLength, ptr + index);
4237 index += SIZEOF_UINT16;
4238 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysRequest.Dummydataref2.SlotNumber, ptr + index);
4239 index += SIZEOF_UINT16;
4240 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysRequest.Dummydataref2.DataLength, ptr + index);
4241 index += SIZEOF_UINT16;
4242 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysRequest.VirtualInterfaceIdentifier, ptr + index);
4243 index += SIZEOF_UINT16;
4244 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysRequest.KeyId, ptr + index);
4245 index += SIZEOF_UINT16;
4246 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDeletekeysRequest.KeyType, ptr + index);
4247 index += SIZEOF_UINT16;
4248 memcpy(ptr + index, sig->u.MlmeDeletekeysRequest.Address.x, 48 / 8);
4249 index += 48 / 8;
4250 break;
4251#endif
4252#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4253 case CSR_MLME_RESET_CONFIRM_ID:
4254 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetConfirm.Dummydataref1.SlotNumber, ptr + index);
4255 index += SIZEOF_UINT16;
4256 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetConfirm.Dummydataref1.DataLength, ptr + index);
4257 index += SIZEOF_UINT16;
4258 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetConfirm.Dummydataref2.SlotNumber, ptr + index);
4259 index += SIZEOF_UINT16;
4260 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetConfirm.Dummydataref2.DataLength, ptr + index);
4261 index += SIZEOF_UINT16;
4262 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeResetConfirm.ResultCode, ptr + index);
4263 index += SIZEOF_UINT16;
4264 break;
4265#endif
4266#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4267 case CSR_MLME_HL_SYNC_CONFIRM_ID:
4268 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncConfirm.Dummydataref1.SlotNumber, ptr + index);
4269 index += SIZEOF_UINT16;
4270 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncConfirm.Dummydataref1.DataLength, ptr + index);
4271 index += SIZEOF_UINT16;
4272 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncConfirm.Dummydataref2.SlotNumber, ptr + index);
4273 index += SIZEOF_UINT16;
4274 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncConfirm.Dummydataref2.DataLength, ptr + index);
4275 index += SIZEOF_UINT16;
4276 memcpy(ptr + index, sig->u.MlmeHlSyncConfirm.GroupAddress.x, 48 / 8);
4277 index += 48 / 8;
4278 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncConfirm.ResultCode, ptr + index);
4279 index += SIZEOF_UINT16;
4280 break;
4281#endif
4282#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4283 case CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST_ID:
4284 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.ChannelList.SlotNumber, ptr + index);
4285 index += SIZEOF_UINT16;
4286 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.ChannelList.DataLength, ptr + index);
4287 index += SIZEOF_UINT16;
4288 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.InformationElements.SlotNumber, ptr + index);
4289 index += SIZEOF_UINT16;
4290 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.InformationElements.DataLength, ptr + index);
4291 index += SIZEOF_UINT16;
4292 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.VirtualInterfaceIdentifier, ptr + index);
4293 index += SIZEOF_UINT16;
4294 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.AutonomousScanId, ptr + index);
4295 index += SIZEOF_UINT16;
4296 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.Ifindex, ptr + index);
4297 index += SIZEOF_UINT16;
4298 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.ChannelStartingFactor, ptr + index);
4299 index += SIZEOF_UINT16;
4300 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.ScanType, ptr + index);
4301 index += SIZEOF_UINT16;
4302 CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.ProbeDelay, ptr + index);
4303 index += SIZEOF_UINT32;
4304 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.MinChannelTime, ptr + index);
4305 index += SIZEOF_UINT16;
4306 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddAutonomousScanRequest.MaxChannelTime, ptr + index);
4307 index += SIZEOF_UINT16;
4308 break;
4309#endif
4310#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4311 case CSR_MLME_SET_REQUEST_ID:
4312 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetRequest.MibAttributeValue.SlotNumber, ptr + index);
4313 index += SIZEOF_UINT16;
4314 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetRequest.MibAttributeValue.DataLength, ptr + index);
4315 index += SIZEOF_UINT16;
4316 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetRequest.Dummydataref2.SlotNumber, ptr + index);
4317 index += SIZEOF_UINT16;
4318 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetRequest.Dummydataref2.DataLength, ptr + index);
4319 index += SIZEOF_UINT16;
4320 break;
4321#endif
4322#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4323 case CSR_MLME_SM_START_REQUEST_ID:
4324 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.Beacon.SlotNumber, ptr + index);
4325 index += SIZEOF_UINT16;
4326 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.Beacon.DataLength, ptr + index);
4327 index += SIZEOF_UINT16;
4328 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.BssParameters.SlotNumber, ptr + index);
4329 index += SIZEOF_UINT16;
4330 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.BssParameters.DataLength, ptr + index);
4331 index += SIZEOF_UINT16;
4332 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.VirtualInterfaceIdentifier, ptr + index);
4333 index += SIZEOF_UINT16;
4334 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.Ifindex, ptr + index);
4335 index += SIZEOF_UINT16;
4336 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.Channel, ptr + index);
4337 index += SIZEOF_UINT16;
4338 memcpy(ptr + index, sig->u.MlmeSmStartRequest.InterfaceAddress.x, 48 / 8);
4339 index += 48 / 8;
4340 memcpy(ptr + index, sig->u.MlmeSmStartRequest.Bssid.x, 48 / 8);
4341 index += 48 / 8;
4342 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.BeaconPeriod, ptr + index);
4343 index += SIZEOF_UINT16;
4344 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.DtimPeriod, ptr + index);
4345 index += SIZEOF_UINT16;
4346 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSmStartRequest.CapabilityInformation, ptr + index);
4347 index += SIZEOF_UINT16;
4348 break;
4349#endif
4350#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4351 case CSR_MLME_CONNECT_STATUS_CONFIRM_ID:
4352 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusConfirm.Dummydataref1.SlotNumber, ptr + index);
4353 index += SIZEOF_UINT16;
4354 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusConfirm.Dummydataref1.DataLength, ptr + index);
4355 index += SIZEOF_UINT16;
4356 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusConfirm.Dummydataref2.SlotNumber, ptr + index);
4357 index += SIZEOF_UINT16;
4358 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusConfirm.Dummydataref2.DataLength, ptr + index);
4359 index += SIZEOF_UINT16;
4360 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusConfirm.VirtualInterfaceIdentifier, ptr + index);
4361 index += SIZEOF_UINT16;
4362 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeConnectStatusConfirm.ResultCode, ptr + index);
4363 index += SIZEOF_UINT16;
4364 break;
4365#endif
4366#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4367 case CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID:
4368 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanConfirm.Dummydataref1.SlotNumber, ptr + index);
4369 index += SIZEOF_UINT16;
4370 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanConfirm.Dummydataref1.DataLength, ptr + index);
4371 index += SIZEOF_UINT16;
4372 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanConfirm.Dummydataref2.SlotNumber, ptr + index);
4373 index += SIZEOF_UINT16;
4374 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanConfirm.Dummydataref2.DataLength, ptr + index);
4375 index += SIZEOF_UINT16;
4376 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanConfirm.VirtualInterfaceIdentifier, ptr + index);
4377 index += SIZEOF_UINT16;
4378 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanConfirm.ResultCode, ptr + index);
4379 index += SIZEOF_UINT16;
4380 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelAutonomousScanConfirm.AutonomousScanId, ptr + index);
4381 index += SIZEOF_UINT16;
4382 break;
4383#endif
4384#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4385 case CSR_MLME_DEL_PERIODIC_REQUEST_ID:
4386 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicRequest.Dummydataref1.SlotNumber, ptr + index);
4387 index += SIZEOF_UINT16;
4388 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicRequest.Dummydataref1.DataLength, ptr + index);
4389 index += SIZEOF_UINT16;
4390 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicRequest.Dummydataref2.SlotNumber, ptr + index);
4391 index += SIZEOF_UINT16;
4392 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicRequest.Dummydataref2.DataLength, ptr + index);
4393 index += SIZEOF_UINT16;
4394 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicRequest.VirtualInterfaceIdentifier, ptr + index);
4395 index += SIZEOF_UINT16;
4396 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicRequest.PeriodicId, ptr + index);
4397 index += SIZEOF_UINT16;
4398 break;
4399#endif
4400#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4401 case CSR_MLME_SETKEYS_REQUEST_ID:
4402 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.Key.SlotNumber, ptr + index);
4403 index += SIZEOF_UINT16;
4404 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.Key.DataLength, ptr + index);
4405 index += SIZEOF_UINT16;
4406 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.Dummydataref2.SlotNumber, ptr + index);
4407 index += SIZEOF_UINT16;
4408 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.Dummydataref2.DataLength, ptr + index);
4409 index += SIZEOF_UINT16;
4410 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.VirtualInterfaceIdentifier, ptr + index);
4411 index += SIZEOF_UINT16;
4412 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.Length, ptr + index);
4413 index += SIZEOF_UINT16;
4414 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.KeyId, ptr + index);
4415 index += SIZEOF_UINT16;
4416 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.KeyType, ptr + index);
4417 index += SIZEOF_UINT16;
4418 memcpy(ptr + index, sig->u.MlmeSetkeysRequest.Address.x, 48 / 8);
4419 index += 48 / 8;
4420 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[0], ptr + index);
4421 index += SIZEOF_UINT16;
4422 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[1], ptr + index);
4423 index += SIZEOF_UINT16;
4424 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[2], ptr + index);
4425 index += SIZEOF_UINT16;
4426 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[3], ptr + index);
4427 index += SIZEOF_UINT16;
4428 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[4], ptr + index);
4429 index += SIZEOF_UINT16;
4430 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[5], ptr + index);
4431 index += SIZEOF_UINT16;
4432 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[6], ptr + index);
4433 index += SIZEOF_UINT16;
4434 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetkeysRequest.SequenceNumber[7], ptr + index);
4435 index += SIZEOF_UINT16;
4436 memcpy(ptr + index, &sig->u.MlmeSetkeysRequest.CipherSuiteSelector, 32 / 8);
4437 index += 32 / 8;
4438 break;
4439#endif
4440#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4441 case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST_ID:
4442 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanRequest.Dummydataref1.SlotNumber, ptr + index);
4443 index += SIZEOF_UINT16;
4444 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanRequest.Dummydataref1.DataLength, ptr + index);
4445 index += SIZEOF_UINT16;
4446 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanRequest.Dummydataref2.SlotNumber, ptr + index);
4447 index += SIZEOF_UINT16;
4448 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanRequest.Dummydataref2.DataLength, ptr + index);
4449 index += SIZEOF_UINT16;
4450 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanRequest.VirtualInterfaceIdentifier, ptr + index);
4451 index += SIZEOF_UINT16;
4452 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanRequest.AutonomousScanId, ptr + index);
4453 index += SIZEOF_UINT16;
4454 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePauseAutonomousScanRequest.Pause, ptr + index);
4455 index += SIZEOF_UINT16;
4456 break;
4457#endif
4458#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4459 case CSR_MLME_GET_REQUEST_ID:
4460 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetRequest.MibAttribute.SlotNumber, ptr + index);
4461 index += SIZEOF_UINT16;
4462 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetRequest.MibAttribute.DataLength, ptr + index);
4463 index += SIZEOF_UINT16;
4464 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetRequest.Dummydataref2.SlotNumber, ptr + index);
4465 index += SIZEOF_UINT16;
4466 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeGetRequest.Dummydataref2.DataLength, ptr + index);
4467 index += SIZEOF_UINT16;
4468 break;
4469#endif
4470#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4471 case CSR_MLME_POWERMGT_REQUEST_ID:
4472 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.Dummydataref1.SlotNumber, ptr + index);
4473 index += SIZEOF_UINT16;
4474 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.Dummydataref1.DataLength, ptr + index);
4475 index += SIZEOF_UINT16;
4476 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.Dummydataref2.SlotNumber, ptr + index);
4477 index += SIZEOF_UINT16;
4478 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.Dummydataref2.DataLength, ptr + index);
4479 index += SIZEOF_UINT16;
4480 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.VirtualInterfaceIdentifier, ptr + index);
4481 index += SIZEOF_UINT16;
4482 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.PowerManagementMode, ptr + index);
4483 index += SIZEOF_UINT16;
4484 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.ReceiveDtims, ptr + index);
4485 index += SIZEOF_UINT16;
4486 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.ListenInterval, ptr + index);
4487 index += SIZEOF_UINT16;
4488 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmePowermgtRequest.TrafficWindow, ptr + index);
4489 index += SIZEOF_UINT16;
4490 break;
4491#endif
4492 case CSR_MA_PACKET_ERROR_INDICATION_ID:
4493 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.Dummydataref1.SlotNumber, ptr + index);
4494 index += SIZEOF_UINT16;
4495 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.Dummydataref1.DataLength, ptr + index);
4496 index += SIZEOF_UINT16;
4497 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.Dummydataref2.SlotNumber, ptr + index);
4498 index += SIZEOF_UINT16;
4499 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.Dummydataref2.DataLength, ptr + index);
4500 index += SIZEOF_UINT16;
4501 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.VirtualInterfaceIdentifier, ptr + index);
4502 index += SIZEOF_UINT16;
4503 memcpy(ptr + index, sig->u.MaPacketErrorIndication.PeerQstaAddress.x, 48 / 8);
4504 index += 48 / 8;
4505 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.UserPriority, ptr + index);
4506 index += SIZEOF_UINT16;
4507 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketErrorIndication.SequenceNumber, ptr + index);
4508 index += SIZEOF_UINT16;
4509 break;
4510#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4511 case CSR_MLME_ADD_PERIODIC_REQUEST_ID:
4512 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.Dummydataref1.SlotNumber, ptr + index);
4513 index += SIZEOF_UINT16;
4514 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.Dummydataref1.DataLength, ptr + index);
4515 index += SIZEOF_UINT16;
4516 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.Dummydataref2.SlotNumber, ptr + index);
4517 index += SIZEOF_UINT16;
4518 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.Dummydataref2.DataLength, ptr + index);
4519 index += SIZEOF_UINT16;
4520 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.VirtualInterfaceIdentifier, ptr + index);
4521 index += SIZEOF_UINT16;
4522 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.PeriodicId, ptr + index);
4523 index += SIZEOF_UINT16;
4524 CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.MaximumLatency, ptr + index);
4525 index += SIZEOF_UINT32;
4526 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.PeriodicSchedulingMode, ptr + index);
4527 index += SIZEOF_UINT16;
4528 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.WakeHost, ptr + index);
4529 index += SIZEOF_UINT16;
4530 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddPeriodicRequest.UserPriority, ptr + index);
4531 index += SIZEOF_UINT16;
4532 break;
4533#endif
4534#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4535 case CSR_MLME_ADD_TSPEC_REQUEST_ID:
4536 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.Dummydataref1.SlotNumber, ptr + index);
4537 index += SIZEOF_UINT16;
4538 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.Dummydataref1.DataLength, ptr + index);
4539 index += SIZEOF_UINT16;
4540 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.Dummydataref2.SlotNumber, ptr + index);
4541 index += SIZEOF_UINT16;
4542 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.Dummydataref2.DataLength, ptr + index);
4543 index += SIZEOF_UINT16;
4544 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.VirtualInterfaceIdentifier, ptr + index);
4545 index += SIZEOF_UINT16;
4546 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.UserPriority, ptr + index);
4547 index += SIZEOF_UINT16;
4548 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.Direction, ptr + index);
4549 index += SIZEOF_UINT16;
4550 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.PsScheme, ptr + index);
4551 index += SIZEOF_UINT16;
4552 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.MediumTime, ptr + index);
4553 index += SIZEOF_UINT16;
4554 CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.ServiceStartTime, ptr + index);
4555 index += SIZEOF_UINT32;
4556 CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.ServiceInterval, ptr + index);
4557 index += SIZEOF_UINT32;
4558 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecRequest.MinimumDataRate, ptr + index);
4559 index += SIZEOF_UINT16;
4560 break;
4561#endif
4562#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4563 case CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID:
4564 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressConfirm.Dummydataref1.SlotNumber, ptr + index);
4565 index += SIZEOF_UINT16;
4566 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressConfirm.Dummydataref1.DataLength, ptr + index);
4567 index += SIZEOF_UINT16;
4568 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressConfirm.Dummydataref2.SlotNumber, ptr + index);
4569 index += SIZEOF_UINT16;
4570 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressConfirm.Dummydataref2.DataLength, ptr + index);
4571 index += SIZEOF_UINT16;
4572 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressConfirm.VirtualInterfaceIdentifier, ptr + index);
4573 index += SIZEOF_UINT16;
4574 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddMulticastAddressConfirm.ResultCode, ptr + index);
4575 index += SIZEOF_UINT16;
4576 break;
4577#endif
4578#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4579 case CSR_MLME_ADD_TSPEC_CONFIRM_ID:
4580 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecConfirm.Dummydataref1.SlotNumber, ptr + index);
4581 index += SIZEOF_UINT16;
4582 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecConfirm.Dummydataref1.DataLength, ptr + index);
4583 index += SIZEOF_UINT16;
4584 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecConfirm.Dummydataref2.SlotNumber, ptr + index);
4585 index += SIZEOF_UINT16;
4586 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecConfirm.Dummydataref2.DataLength, ptr + index);
4587 index += SIZEOF_UINT16;
4588 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecConfirm.VirtualInterfaceIdentifier, ptr + index);
4589 index += SIZEOF_UINT16;
4590 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecConfirm.UserPriority, ptr + index);
4591 index += SIZEOF_UINT16;
4592 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTspecConfirm.ResultCode, ptr + index);
4593 index += SIZEOF_UINT16;
4594 break;
4595#endif
4596#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4597 case CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID:
4598 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelConfirm.Dummydataref1.SlotNumber, ptr + index);
4599 index += SIZEOF_UINT16;
4600 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelConfirm.Dummydataref1.DataLength, ptr + index);
4601 index += SIZEOF_UINT16;
4602 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelConfirm.Dummydataref2.SlotNumber, ptr + index);
4603 index += SIZEOF_UINT16;
4604 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelConfirm.Dummydataref2.DataLength, ptr + index);
4605 index += SIZEOF_UINT16;
4606 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeHlSyncCancelConfirm.ResultCode, ptr + index);
4607 index += SIZEOF_UINT16;
4608 break;
4609#endif
4610#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4611 case CSR_MLME_SCAN_CONFIRM_ID:
4612 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanConfirm.Dummydataref1.SlotNumber, ptr + index);
4613 index += SIZEOF_UINT16;
4614 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanConfirm.Dummydataref1.DataLength, ptr + index);
4615 index += SIZEOF_UINT16;
4616 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanConfirm.Dummydataref2.SlotNumber, ptr + index);
4617 index += SIZEOF_UINT16;
4618 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanConfirm.Dummydataref2.DataLength, ptr + index);
4619 index += SIZEOF_UINT16;
4620 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanConfirm.VirtualInterfaceIdentifier, ptr + index);
4621 index += SIZEOF_UINT16;
4622 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeScanConfirm.ResultCode, ptr + index);
4623 index += SIZEOF_UINT16;
4624 break;
4625#endif
4626 case CSR_DEBUG_STRING_INDICATION_ID:
4627 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugStringIndication.DebugMessage.SlotNumber, ptr + index);
4628 index += SIZEOF_UINT16;
4629 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugStringIndication.DebugMessage.DataLength, ptr + index);
4630 index += SIZEOF_UINT16;
4631 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugStringIndication.Dummydataref2.SlotNumber, ptr + index);
4632 index += SIZEOF_UINT16;
4633 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.DebugStringIndication.Dummydataref2.DataLength, ptr + index);
4634 index += SIZEOF_UINT16;
4635 break;
4636#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4637 case CSR_MLME_ADD_TEMPLATE_CONFIRM_ID:
4638 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateConfirm.Dummydataref1.SlotNumber, ptr + index);
4639 index += SIZEOF_UINT16;
4640 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateConfirm.Dummydataref1.DataLength, ptr + index);
4641 index += SIZEOF_UINT16;
4642 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateConfirm.Dummydataref2.SlotNumber, ptr + index);
4643 index += SIZEOF_UINT16;
4644 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateConfirm.Dummydataref2.DataLength, ptr + index);
4645 index += SIZEOF_UINT16;
4646 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateConfirm.VirtualInterfaceIdentifier, ptr + index);
4647 index += SIZEOF_UINT16;
4648 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateConfirm.FrameType, ptr + index);
4649 index += SIZEOF_UINT16;
4650 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeAddTemplateConfirm.ResultCode, ptr + index);
4651 index += SIZEOF_UINT16;
4652 break;
4653#endif
4654#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4655 case CSR_MLME_BLOCKACK_ERROR_INDICATION_ID:
4656 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlockackErrorIndication.Dummydataref1.SlotNumber, ptr + index);
4657 index += SIZEOF_UINT16;
4658 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlockackErrorIndication.Dummydataref1.DataLength, ptr + index);
4659 index += SIZEOF_UINT16;
4660 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlockackErrorIndication.Dummydataref2.SlotNumber, ptr + index);
4661 index += SIZEOF_UINT16;
4662 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlockackErrorIndication.Dummydataref2.DataLength, ptr + index);
4663 index += SIZEOF_UINT16;
4664 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlockackErrorIndication.VirtualInterfaceIdentifier, ptr + index);
4665 index += SIZEOF_UINT16;
4666 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeBlockackErrorIndication.ResultCode, ptr + index);
4667 index += SIZEOF_UINT16;
4668 memcpy(ptr + index, sig->u.MlmeBlockackErrorIndication.PeerQstaAddress.x, 48 / 8);
4669 index += 48 / 8;
4670 break;
4671#endif
4672#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4673 case CSR_MLME_SET_CONFIRM_ID:
4674 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetConfirm.MibAttributeValue.SlotNumber, ptr + index);
4675 index += SIZEOF_UINT16;
4676 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetConfirm.MibAttributeValue.DataLength, ptr + index);
4677 index += SIZEOF_UINT16;
4678 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetConfirm.Dummydataref2.SlotNumber, ptr + index);
4679 index += SIZEOF_UINT16;
4680 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetConfirm.Dummydataref2.DataLength, ptr + index);
4681 index += SIZEOF_UINT16;
4682 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetConfirm.Status, ptr + index);
4683 index += SIZEOF_UINT16;
4684 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeSetConfirm.ErrorIndex, ptr + index);
4685 index += SIZEOF_UINT16;
4686 break;
4687#endif
4688#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4689 case CSR_MLME_MEASURE_REQUEST_ID:
4690 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureRequest.MeasurementRequestSet.SlotNumber, ptr + index);
4691 index += SIZEOF_UINT16;
4692 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureRequest.MeasurementRequestSet.DataLength, ptr + index);
4693 index += SIZEOF_UINT16;
4694 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureRequest.Dummydataref2.SlotNumber, ptr + index);
4695 index += SIZEOF_UINT16;
4696 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureRequest.Dummydataref2.DataLength, ptr + index);
4697 index += SIZEOF_UINT16;
4698 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeMeasureRequest.DialogToken, ptr + index);
4699 index += SIZEOF_UINT16;
4700 break;
4701#endif
4702#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4703 case CSR_MLME_START_AGGREGATION_CONFIRM_ID:
4704 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.Dummydataref1.SlotNumber, ptr + index);
4705 index += SIZEOF_UINT16;
4706 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.Dummydataref1.DataLength, ptr + index);
4707 index += SIZEOF_UINT16;
4708 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.Dummydataref2.SlotNumber, ptr + index);
4709 index += SIZEOF_UINT16;
4710 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.Dummydataref2.DataLength, ptr + index);
4711 index += SIZEOF_UINT16;
4712 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.VirtualInterfaceIdentifier, ptr + index);
4713 index += SIZEOF_UINT16;
4714 memcpy(ptr + index, sig->u.MlmeStartAggregationConfirm.PeerQstaAddress.x, 48 / 8);
4715 index += 48 / 8;
4716 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.UserPriority, ptr + index);
4717 index += SIZEOF_UINT16;
4718 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.Direction, ptr + index);
4719 index += SIZEOF_UINT16;
4720 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.ResultCode, ptr + index);
4721 index += SIZEOF_UINT16;
4722 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStartAggregationConfirm.SequenceNumber, ptr + index);
4723 index += SIZEOF_UINT16;
4724 break;
4725#endif
4726#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4727 case CSR_MLME_STOP_MEASURE_CONFIRM_ID:
4728 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureConfirm.Dummydataref1.SlotNumber, ptr + index);
4729 index += SIZEOF_UINT16;
4730 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureConfirm.Dummydataref1.DataLength, ptr + index);
4731 index += SIZEOF_UINT16;
4732 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureConfirm.Dummydataref2.SlotNumber, ptr + index);
4733 index += SIZEOF_UINT16;
4734 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureConfirm.Dummydataref2.DataLength, ptr + index);
4735 index += SIZEOF_UINT16;
4736 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureConfirm.ResultCode, ptr + index);
4737 index += SIZEOF_UINT16;
4738 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureConfirm.DialogToken, ptr + index);
4739 index += SIZEOF_UINT16;
4740 break;
4741#endif
4742 case CSR_MA_PACKET_CONFIRM_ID:
4743 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.Dummydataref1.SlotNumber, ptr + index);
4744 index += SIZEOF_UINT16;
4745 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.Dummydataref1.DataLength, ptr + index);
4746 index += SIZEOF_UINT16;
4747 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.Dummydataref2.SlotNumber, ptr + index);
4748 index += SIZEOF_UINT16;
4749 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.Dummydataref2.DataLength, ptr + index);
4750 index += SIZEOF_UINT16;
4751 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.VirtualInterfaceIdentifier, ptr + index);
4752 index += SIZEOF_UINT16;
4753 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.TransmissionStatus, ptr + index);
4754 index += SIZEOF_UINT16;
4755 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.RetryCount, ptr + index);
4756 index += SIZEOF_UINT16;
4757 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.Rate, ptr + index);
4758 index += SIZEOF_UINT16;
4759 CSR_COPY_UINT32_TO_LITTLE_ENDIAN(sig->u.MaPacketConfirm.HostTag, ptr + index);
4760 index += SIZEOF_UINT32;
4761 break;
4762#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4763 case CSR_MLME_DEL_PERIODIC_CONFIRM_ID:
4764 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicConfirm.Dummydataref1.SlotNumber, ptr + index);
4765 index += SIZEOF_UINT16;
4766 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicConfirm.Dummydataref1.DataLength, ptr + index);
4767 index += SIZEOF_UINT16;
4768 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicConfirm.Dummydataref2.SlotNumber, ptr + index);
4769 index += SIZEOF_UINT16;
4770 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicConfirm.Dummydataref2.DataLength, ptr + index);
4771 index += SIZEOF_UINT16;
4772 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicConfirm.VirtualInterfaceIdentifier, ptr + index);
4773 index += SIZEOF_UINT16;
4774 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicConfirm.PeriodicId, ptr + index);
4775 index += SIZEOF_UINT16;
4776 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeDelPeriodicConfirm.ResultCode, ptr + index);
4777 index += SIZEOF_UINT16;
4778 break;
4779#endif
4780#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
4781 case CSR_MLME_STOP_MEASURE_REQUEST_ID:
4782 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureRequest.Dummydataref1.SlotNumber, ptr + index);
4783 index += SIZEOF_UINT16;
4784 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureRequest.Dummydataref1.DataLength, ptr + index);
4785 index += SIZEOF_UINT16;
4786 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureRequest.Dummydataref2.SlotNumber, ptr + index);
4787 index += SIZEOF_UINT16;
4788 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureRequest.Dummydataref2.DataLength, ptr + index);
4789 index += SIZEOF_UINT16;
4790 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(sig->u.MlmeStopMeasureRequest.DialogToken, ptr + index);
4791 index += SIZEOF_UINT16;
4792 break;
4793#endif
4794
4795 default:
4796 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
4797 }
4798
4799 *sig_len = index;
4800
4801 return CSR_RESULT_SUCCESS;
4802} /* write_pack() */
4803
4804
diff --git a/drivers/staging/csr/csr_wifi_hip_send.c b/drivers/staging/csr/csr_wifi_hip_send.c
deleted file mode 100644
index 76429e5e77cf..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_send.c
+++ /dev/null
@@ -1,415 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/*
12 * ***************************************************************************
13 *
14 * FILE: csr_wifi_hip_send.c
15 *
16 * PURPOSE:
17 * Code for adding a signal request to the from-host queue.
18 * When the driver bottom-half is run, it will take requests from the
19 * queue and pass them to the UniFi.
20 *
21 * ***************************************************************************
22 */
23#include "csr_wifi_hip_unifi.h"
24#include "csr_wifi_hip_conversions.h"
25#include "csr_wifi_hip_sigs.h"
26#include "csr_wifi_hip_card.h"
27
28unifi_TrafficQueue unifi_frame_priority_to_queue(CSR_PRIORITY priority)
29{
30 switch (priority)
31 {
32 case CSR_QOS_UP0:
33 case CSR_QOS_UP3:
34 return UNIFI_TRAFFIC_Q_BE;
35 case CSR_QOS_UP1:
36 case CSR_QOS_UP2:
37 return UNIFI_TRAFFIC_Q_BK;
38 case CSR_QOS_UP4:
39 case CSR_QOS_UP5:
40 return UNIFI_TRAFFIC_Q_VI;
41 case CSR_QOS_UP6:
42 case CSR_QOS_UP7:
43 case CSR_MANAGEMENT:
44 return UNIFI_TRAFFIC_Q_VO;
45 default:
46 return UNIFI_TRAFFIC_Q_BE;
47 }
48}
49
50
51CSR_PRIORITY unifi_get_default_downgrade_priority(unifi_TrafficQueue queue)
52{
53 switch (queue)
54 {
55 case UNIFI_TRAFFIC_Q_BE:
56 return CSR_QOS_UP0;
57 case UNIFI_TRAFFIC_Q_BK:
58 return CSR_QOS_UP1;
59 case UNIFI_TRAFFIC_Q_VI:
60 return CSR_QOS_UP5;
61 case UNIFI_TRAFFIC_Q_VO:
62 return CSR_QOS_UP6;
63 default:
64 return CSR_QOS_UP0;
65 }
66}
67
68
69/*
70 * ---------------------------------------------------------------------------
71 * send_signal
72 *
73 * This function queues a signal for sending to UniFi. It first checks
74 * that there is space on the fh_signal_queue for another entry, then
75 * claims any bulk data slots required and copies data into them. Then
76 * increments the fh_signal_queue write count.
77 *
78 * The fh_signal_queue is later processed by the driver bottom half
79 * (in unifi_bh()).
80 *
81 * This function call unifi_pause_xmit() to pause the flow of data plane
82 * packets when:
83 * - the fh_signal_queue ring buffer is full
84 * - there are less than UNIFI_MAX_DATA_REFERENCES (2) bulk data
85 * slots available.
86 *
87 * Arguments:
88 * card Pointer to card context structure
89 * sigptr Pointer to the signal to write to UniFi.
90 * siglen Number of bytes pointer to by sigptr.
91 * bulkdata Array of pointers to an associated bulk data.
92 * sigq To which from-host queue to add the signal.
93 *
94 * Returns:
95 * CSR_RESULT_SUCCESS on success
96 * CSR_WIFI_HIP_RESULT_NO_SPACE if there were insufficient data slots or
97 * no free signal queue entry
98 *
99 * Notes:
100 * Calls unifi_pause_xmit() when the last slots are used.
101 * ---------------------------------------------------------------------------
102 */
103static CsrResult send_signal(card_t *card, const u8 *sigptr, u32 siglen,
104 const bulk_data_param_t *bulkdata,
105 q_t *sigq, u32 priority_q, u32 run_bh)
106{
107 u16 i, data_slot_size;
108 card_signal_t *csptr;
109 s16 qe;
110 CsrResult r;
111 s16 debug_print = 0;
112
113 data_slot_size = CardGetDataSlotSize(card);
114
115 /* Check that the fh_data_queue has a free slot */
116 if (!CSR_WIFI_HIP_Q_SLOTS_FREE(sigq))
117 {
118 unifi_trace(card->ospriv, UDBG3, "send_signal: %s full\n", sigq->name);
119
120 return CSR_WIFI_HIP_RESULT_NO_SPACE;
121 }
122
123 /*
124 * Now add the signal to the From Host signal queue
125 */
126 /* Get next slot on queue */
127 qe = CSR_WIFI_HIP_Q_NEXT_W_SLOT(sigq);
128 csptr = CSR_WIFI_HIP_Q_SLOT_DATA(sigq, qe);
129
130 /* Make up the card_signal struct */
131 csptr->signal_length = (u16)siglen;
132 memcpy((void *)csptr->sigbuf, (void *)sigptr, siglen);
133
134 for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; ++i)
135 {
136 if ((bulkdata != NULL) && (bulkdata->d[i].data_length != 0))
137 {
138 u32 datalen = bulkdata->d[i].data_length;
139
140 /* Make sure data will fit in a bulk data slot */
141 if (bulkdata->d[i].os_data_ptr == NULL)
142 {
143 unifi_error(card->ospriv, "send_signal - NULL bulkdata[%d]\n", i);
144 debug_print++;
145 csptr->bulkdata[i].data_length = 0;
146 }
147 else
148 {
149 if (datalen > data_slot_size)
150 {
151 unifi_error(card->ospriv,
152 "send_signal - Invalid data length %u (@%p), "
153 "truncating\n",
154 datalen, bulkdata->d[i].os_data_ptr);
155 datalen = data_slot_size;
156 debug_print++;
157 }
158 /* Store the bulk data info in the soft queue. */
159 csptr->bulkdata[i].os_data_ptr = (u8 *)bulkdata->d[i].os_data_ptr;
160 csptr->bulkdata[i].os_net_buf_ptr = (u8 *)bulkdata->d[i].os_net_buf_ptr;
161 csptr->bulkdata[i].net_buf_length = bulkdata->d[i].net_buf_length;
162 csptr->bulkdata[i].data_length = datalen;
163 }
164 }
165 else
166 {
167 UNIFI_INIT_BULK_DATA(&csptr->bulkdata[i]);
168 }
169 }
170
171 if (debug_print)
172 {
173 const u8 *sig = sigptr;
174
175 unifi_error(card->ospriv, "Signal(%d): %*ph\n", siglen,
176 16, sig);
177 unifi_error(card->ospriv, "Bulkdata pointer %p(%d), %p(%d)\n",
178 bulkdata != NULL?bulkdata->d[0].os_data_ptr : NULL,
179 bulkdata != NULL?bulkdata->d[0].data_length : 0,
180 bulkdata != NULL?bulkdata->d[1].os_data_ptr : NULL,
181 bulkdata != NULL?bulkdata->d[1].data_length : 0);
182 }
183
184 /* Advance the written count to say there is a new entry */
185 CSR_WIFI_HIP_Q_INC_W(sigq);
186
187 /*
188 * Set the flag to say reason for waking was a host request.
189 * Then ask the OS layer to run the unifi_bh.
190 */
191 if (run_bh == 1)
192 {
193 card->bh_reason_host = 1;
194 r = unifi_run_bh(card->ospriv);
195 if (r != CSR_RESULT_SUCCESS)
196 {
197 unifi_error(card->ospriv, "failed to run bh.\n");
198 card->bh_reason_host = 0;
199
200 /*
201 * The bulk data buffer will be freed by the caller.
202 * We need to invalidate the description of the bulk data in our
203 * soft queue, to prevent the core freeing the bulk data again later.
204 */
205 for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; ++i)
206 {
207 if (csptr->bulkdata[i].data_length != 0)
208 {
209 csptr->bulkdata[i].os_data_ptr = csptr->bulkdata[i].os_net_buf_ptr = NULL;
210 csptr->bulkdata[i].net_buf_length = csptr->bulkdata[i].data_length = 0;
211 }
212 }
213 return r;
214 }
215 }
216 else
217 {
218 unifi_error(card->ospriv, "run_bh=%d, bh not called.\n", run_bh);
219 }
220
221 /*
222 * Have we used up all the fh signal list entries?
223 */
224 if (CSR_WIFI_HIP_Q_SLOTS_FREE(sigq) == 0)
225 {
226 /* We have filled the queue, so stop the upper layer. The command queue
227 * is an exception, as suspending due to that being full could delay
228 * resume/retry until new commands or data are received.
229 */
230 if (sigq != &card->fh_command_queue)
231 {
232 /*
233 * Must call unifi_pause_xmit() *before* setting the paused flag.
234 * (the unifi_pause_xmit call should not be after setting the flag because of the possibility of being interrupted
235 * by the bh thread between our setting the flag and the call to unifi_pause_xmit()
236 * If bh thread then cleared the flag, we would end up paused, but without the flag set)
237 * Instead, setting it afterwards means that if this thread is interrupted by the bh thread
238 * the pause flag is still guaranteed to end up set
239 * However the potential deadlock now is that if bh thread emptied the queue and cleared the flag before this thread's
240 * call to unifi_pause_xmit(), then bh thread may not run again because it will be waiting for
241 * a packet to appear in the queue but nothing ever will because xmit is paused.
242 * So we will end up with the queue paused, and the flag set to say it is paused, but bh never runs to unpause it.
243 * (Note even this bad situation would not persist long in practice, because something else (eg rx, or tx in different queue)
244 * is likely to wake bh thread quite soon)
245 * But to avoid this deadlock completely, after setting the flag we check that there is something left in the queue.
246 * If there is, we know that bh thread has not emptied the queue yet.
247 * Since bh thread checks to unpause the queue *after* taking packets from the queue, we know that it is still going to make at
248 * least one more check to see whether it needs to unpause the queue. So all is well.
249 * If there are no packets in the queue, then the deadlock described above might happen. To make sure it does not, we
250 * unpause the queue here. A possible side effect is that unifi_restart_xmit() may (rarely) be called for second time
251 * unnecessarily, which is harmless
252 */
253
254#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
255 unifi_debug_log_to_buf("P");
256#endif
257 unifi_pause_xmit(card->ospriv, (unifi_TrafficQueue)priority_q);
258 card_tx_q_pause(card, priority_q);
259 if (CSR_WIFI_HIP_Q_SLOTS_USED(sigq) == 0)
260 {
261 card_tx_q_unpause(card, priority_q);
262 unifi_restart_xmit(card->ospriv, (unifi_TrafficQueue) priority_q);
263 }
264 }
265 else
266 {
267 unifi_warning(card->ospriv,
268 "send_signal: fh_cmd_q full, not pausing (run_bh=%d)\n",
269 run_bh);
270 }
271 }
272
273 return CSR_RESULT_SUCCESS;
274} /* send_signal() */
275
276
277/*
278 * ---------------------------------------------------------------------------
279 * unifi_send_signal
280 *
281 * Invokes send_signal() to queue a signal in the command or traffic queue
282 * If sigptr pointer is NULL, it pokes the bh to check if UniFi is responsive.
283 *
284 * Arguments:
285 * card Pointer to card context struct
286 * sigptr Pointer to signal from card.
287 * siglen Size of the signal
288 * bulkdata Pointer to the bulk data of the signal
289 *
290 * Returns:
291 * CSR_RESULT_SUCCESS on success
292 * CSR_WIFI_HIP_RESULT_NO_SPACE if there were insufficient data slots or no free signal queue entry
293 *
294 * Notes:
295 * unifi_send_signal() is used to queue signals, created by the driver,
296 * to the device. Signals are constructed using the UniFi packed structures.
297 * ---------------------------------------------------------------------------
298 */
299CsrResult unifi_send_signal(card_t *card, const u8 *sigptr, u32 siglen,
300 const bulk_data_param_t *bulkdata)
301{
302 q_t *sig_soft_q;
303 u16 signal_id;
304 CsrResult r;
305 u32 run_bh;
306 u32 priority_q;
307
308 /* A NULL signal pointer is a request to check if UniFi is responsive */
309 if (sigptr == NULL)
310 {
311 card->bh_reason_host = 1;
312 return unifi_run_bh(card->ospriv);
313 }
314
315 priority_q = 0;
316 run_bh = 1;
317 signal_id = GET_SIGNAL_ID(sigptr);
318 /*
319 * If the signal is a CSR_MA_PACKET_REQUEST ,
320 * we send it using the traffic soft queue. Else we use the command soft queue.
321 */
322 if (signal_id == CSR_MA_PACKET_REQUEST_ID)
323 {
324 u16 frame_priority;
325
326 if (card->periodic_wake_mode == UNIFI_PERIODIC_WAKE_HOST_ENABLED)
327 {
328 run_bh = 0;
329 }
330
331#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
332 unifi_debug_log_to_buf("D");
333#endif
334 /* Sanity check: MA-PACKET.req must have a valid bulk data */
335 if ((bulkdata->d[0].data_length == 0) || (bulkdata->d[0].os_data_ptr == NULL))
336 {
337 unifi_error(card->ospriv, "MA-PACKET.req with empty bulk data (%d bytes in %p)\n",
338 bulkdata->d[0].data_length, bulkdata->d[0].os_data_ptr);
339 dump((void *)sigptr, siglen);
340 return CSR_RESULT_FAILURE;
341 }
342
343 /* Map the frame priority to a traffic queue index. */
344 frame_priority = GET_PACKED_MA_PACKET_REQUEST_FRAME_PRIORITY(sigptr);
345 priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY)frame_priority);
346
347 sig_soft_q = &card->fh_traffic_queue[priority_q];
348 }
349 else
350 {
351 sig_soft_q = &card->fh_command_queue;
352 }
353
354 r = send_signal(card, sigptr, siglen, bulkdata, sig_soft_q, priority_q, run_bh);
355 /* On error, the caller must free or requeue bulkdata buffers */
356
357 return r;
358} /* unifi_send_signal() */
359
360
361/*
362 * ---------------------------------------------------------------------------
363 * unifi_send_resources_available
364 *
365 * Examines whether there is available space to queue
366 * a signal in the command or traffic queue
367 *
368 * Arguments:
369 * card Pointer to card context struct
370 * sigptr Pointer to signal.
371 *
372 * Returns:
373 * CSR_RESULT_SUCCESS if resources available
374 * CSR_WIFI_HIP_RESULT_NO_SPACE if there was no free signal queue entry
375 *
376 * Notes:
377 * ---------------------------------------------------------------------------
378 */
379CsrResult unifi_send_resources_available(card_t *card, const u8 *sigptr)
380{
381 q_t *sig_soft_q;
382 u16 signal_id = GET_SIGNAL_ID(sigptr);
383
384 /*
385 * If the signal is a CSR_MA_PACKET_REQUEST ,
386 * we send it using the traffic soft queue. Else we use the command soft queue.
387 */
388 if (signal_id == CSR_MA_PACKET_REQUEST_ID)
389 {
390 u16 frame_priority;
391 u32 priority_q;
392
393 /* Map the frame priority to a traffic queue index. */
394 frame_priority = GET_PACKED_MA_PACKET_REQUEST_FRAME_PRIORITY(sigptr);
395 priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY)frame_priority);
396
397 sig_soft_q = &card->fh_traffic_queue[priority_q];
398 }
399 else
400 {
401 sig_soft_q = &card->fh_command_queue;
402 }
403
404 /* Check that the fh_data_queue has a free slot */
405 if (!CSR_WIFI_HIP_Q_SLOTS_FREE(sig_soft_q))
406 {
407 unifi_notice(card->ospriv, "unifi_send_resources_available: %s full\n",
408 sig_soft_q->name);
409 return CSR_WIFI_HIP_RESULT_NO_SPACE;
410 }
411
412 return CSR_RESULT_SUCCESS;
413} /* unifi_send_resources_available() */
414
415
diff --git a/drivers/staging/csr/csr_wifi_hip_signals.c b/drivers/staging/csr/csr_wifi_hip_signals.c
deleted file mode 100644
index 3c821320df00..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_signals.c
+++ /dev/null
@@ -1,1313 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13
14/* Generated by hip_dd_l_c_gen.pl */
15
16#include "csr_wifi_hip_signals.h"
17
18#include "csr_wifi_hip_unifi.h"
19
20s32 SigGetSize(const CSR_SIGNAL *aSignal)
21{
22 switch (aSignal->SignalPrimitiveHeader.SignalId)
23 {
24 case CSR_MA_PACKET_REQUEST_ID:
25 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_REQUEST);
26 case CSR_MA_PACKET_CONFIRM_ID:
27 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_CONFIRM);
28 case CSR_MA_PACKET_INDICATION_ID:
29 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_INDICATION);
30 case CSR_MA_PACKET_CANCEL_REQUEST_ID:
31 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_CANCEL_REQUEST);
32 case CSR_MA_VIF_AVAILABILITY_RESPONSE_ID:
33 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_VIF_AVAILABILITY_RESPONSE);
34 case CSR_MA_VIF_AVAILABILITY_INDICATION_ID:
35 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_VIF_AVAILABILITY_INDICATION);
36 case CSR_MA_PACKET_ERROR_INDICATION_ID:
37 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MA_PACKET_ERROR_INDICATION);
38#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
39 case CSR_MLME_RESET_REQUEST_ID:
40 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_RESET_REQUEST);
41#endif
42#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
43 case CSR_MLME_RESET_CONFIRM_ID:
44 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_RESET_CONFIRM);
45#endif
46#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
47 case CSR_MLME_GET_REQUEST_ID:
48 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_REQUEST);
49#endif
50#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
51 case CSR_MLME_GET_CONFIRM_ID:
52 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_CONFIRM);
53#endif
54#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
55 case CSR_MLME_SET_REQUEST_ID:
56 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_REQUEST);
57#endif
58#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
59 case CSR_MLME_SET_CONFIRM_ID:
60 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_CONFIRM);
61#endif
62#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
63 case CSR_MLME_GET_NEXT_REQUEST_ID:
64 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_NEXT_REQUEST);
65#endif
66#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
67 case CSR_MLME_GET_NEXT_CONFIRM_ID:
68 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_NEXT_CONFIRM);
69#endif
70#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
71 case CSR_MLME_POWERMGT_REQUEST_ID:
72 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_POWERMGT_REQUEST);
73#endif
74#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
75 case CSR_MLME_POWERMGT_CONFIRM_ID:
76 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_POWERMGT_CONFIRM);
77#endif
78#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
79 case CSR_MLME_SCAN_REQUEST_ID:
80 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SCAN_REQUEST);
81#endif
82#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
83 case CSR_MLME_SCAN_CONFIRM_ID:
84 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SCAN_CONFIRM);
85#endif
86#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
87 case CSR_MLME_HL_SYNC_REQUEST_ID:
88 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_HL_SYNC_REQUEST);
89#endif
90#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
91 case CSR_MLME_HL_SYNC_CONFIRM_ID:
92 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_HL_SYNC_CONFIRM);
93#endif
94#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
95 case CSR_MLME_MEASURE_REQUEST_ID:
96 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MEASURE_REQUEST);
97#endif
98#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
99 case CSR_MLME_MEASURE_CONFIRM_ID:
100 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MEASURE_CONFIRM);
101#endif
102#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
103 case CSR_MLME_MEASURE_INDICATION_ID:
104 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MEASURE_INDICATION);
105#endif
106#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
107 case CSR_MLME_SETKEYS_REQUEST_ID:
108 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SETKEYS_REQUEST);
109#endif
110#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
111 case CSR_MLME_SETKEYS_CONFIRM_ID:
112 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SETKEYS_CONFIRM);
113#endif
114#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
115 case CSR_MLME_DELETEKEYS_REQUEST_ID:
116 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DELETEKEYS_REQUEST);
117#endif
118#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
119 case CSR_MLME_DELETEKEYS_CONFIRM_ID:
120 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DELETEKEYS_CONFIRM);
121#endif
122#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
123 case CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION_ID:
124 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION);
125#endif
126#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
127 case CSR_MLME_CONNECTED_INDICATION_ID:
128 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONNECTED_INDICATION);
129#endif
130#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
131 case CSR_MLME_SCAN_CANCEL_REQUEST_ID:
132 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SCAN_CANCEL_REQUEST);
133#endif
134#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
135 case CSR_MLME_HL_SYNC_CANCEL_REQUEST_ID:
136 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_HL_SYNC_CANCEL_REQUEST);
137#endif
138#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
139 case CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID:
140 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_HL_SYNC_CANCEL_CONFIRM);
141#endif
142#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
143 case CSR_MLME_ADD_PERIODIC_REQUEST_ID:
144 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_PERIODIC_REQUEST);
145#endif
146#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
147 case CSR_MLME_ADD_PERIODIC_CONFIRM_ID:
148 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_PERIODIC_CONFIRM);
149#endif
150#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
151 case CSR_MLME_DEL_PERIODIC_REQUEST_ID:
152 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_PERIODIC_REQUEST);
153#endif
154#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
155 case CSR_MLME_DEL_PERIODIC_CONFIRM_ID:
156 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_PERIODIC_CONFIRM);
157#endif
158#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
159 case CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST_ID:
160 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST);
161#endif
162#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
163 case CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID:
164 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM);
165#endif
166#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
167 case CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST_ID:
168 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST);
169#endif
170#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
171 case CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID:
172 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM);
173#endif
174#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
175 case CSR_MLME_SET_PACKET_FILTER_REQUEST_ID:
176 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_PACKET_FILTER_REQUEST);
177#endif
178#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
179 case CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID:
180 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_PACKET_FILTER_CONFIRM);
181#endif
182#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
183 case CSR_MLME_STOP_MEASURE_REQUEST_ID:
184 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_STOP_MEASURE_REQUEST);
185#endif
186#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
187 case CSR_MLME_STOP_MEASURE_CONFIRM_ID:
188 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_STOP_MEASURE_CONFIRM);
189#endif
190#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
191 case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST_ID:
192 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST);
193#endif
194#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
195 case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID:
196 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM);
197#endif
198#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
199 case CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION_ID:
200 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION);
201#endif
202#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
203 case CSR_MLME_ADD_TRIGGERED_GET_REQUEST_ID:
204 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TRIGGERED_GET_REQUEST);
205#endif
206#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
207 case CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID:
208 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TRIGGERED_GET_CONFIRM);
209#endif
210#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
211 case CSR_MLME_DEL_TRIGGERED_GET_REQUEST_ID:
212 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_TRIGGERED_GET_REQUEST);
213#endif
214#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
215 case CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID:
216 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_TRIGGERED_GET_CONFIRM);
217#endif
218#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
219 case CSR_MLME_TRIGGERED_GET_INDICATION_ID:
220 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_TRIGGERED_GET_INDICATION);
221#endif
222#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
223 case CSR_MLME_ADD_BLACKOUT_REQUEST_ID:
224 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_BLACKOUT_REQUEST);
225#endif
226#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
227 case CSR_MLME_ADD_BLACKOUT_CONFIRM_ID:
228 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_BLACKOUT_CONFIRM);
229#endif
230#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
231 case CSR_MLME_BLACKOUT_ENDED_INDICATION_ID:
232 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_BLACKOUT_ENDED_INDICATION);
233#endif
234#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
235 case CSR_MLME_DEL_BLACKOUT_REQUEST_ID:
236 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_BLACKOUT_REQUEST);
237#endif
238#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
239 case CSR_MLME_DEL_BLACKOUT_CONFIRM_ID:
240 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_BLACKOUT_CONFIRM);
241#endif
242#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
243 case CSR_MLME_ADD_RX_TRIGGER_REQUEST_ID:
244 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_RX_TRIGGER_REQUEST);
245#endif
246#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
247 case CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID:
248 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_RX_TRIGGER_CONFIRM);
249#endif
250#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
251 case CSR_MLME_DEL_RX_TRIGGER_REQUEST_ID:
252 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_RX_TRIGGER_REQUEST);
253#endif
254#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
255 case CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID:
256 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_RX_TRIGGER_CONFIRM);
257#endif
258#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
259 case CSR_MLME_CONNECT_STATUS_REQUEST_ID:
260 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONNECT_STATUS_REQUEST);
261#endif
262#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
263 case CSR_MLME_CONNECT_STATUS_CONFIRM_ID:
264 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONNECT_STATUS_CONFIRM);
265#endif
266#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
267 case CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST_ID:
268 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST);
269#endif
270#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
271 case CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID:
272 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM);
273#endif
274#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
275 case CSR_MLME_ADD_TEMPLATE_REQUEST_ID:
276 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TEMPLATE_REQUEST);
277#endif
278#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
279 case CSR_MLME_ADD_TEMPLATE_CONFIRM_ID:
280 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TEMPLATE_CONFIRM);
281#endif
282#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
283 case CSR_MLME_CONFIG_QUEUE_REQUEST_ID:
284 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONFIG_QUEUE_REQUEST);
285#endif
286#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
287 case CSR_MLME_CONFIG_QUEUE_CONFIRM_ID:
288 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_CONFIG_QUEUE_CONFIRM);
289#endif
290#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
291 case CSR_MLME_ADD_TSPEC_REQUEST_ID:
292 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TSPEC_REQUEST);
293#endif
294#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
295 case CSR_MLME_ADD_TSPEC_CONFIRM_ID:
296 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_TSPEC_CONFIRM);
297#endif
298#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
299 case CSR_MLME_DEL_TSPEC_REQUEST_ID:
300 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_TSPEC_REQUEST);
301#endif
302#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
303 case CSR_MLME_DEL_TSPEC_CONFIRM_ID:
304 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_DEL_TSPEC_CONFIRM);
305#endif
306#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
307 case CSR_MLME_START_AGGREGATION_REQUEST_ID:
308 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_START_AGGREGATION_REQUEST);
309#endif
310#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
311 case CSR_MLME_START_AGGREGATION_CONFIRM_ID:
312 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_START_AGGREGATION_CONFIRM);
313#endif
314#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
315 case CSR_MLME_BLOCKACK_ERROR_INDICATION_ID:
316 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_BLOCKACK_ERROR_INDICATION);
317#endif
318#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
319 case CSR_MLME_STOP_AGGREGATION_REQUEST_ID:
320 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_STOP_AGGREGATION_REQUEST);
321#endif
322#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
323 case CSR_MLME_STOP_AGGREGATION_CONFIRM_ID:
324 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_STOP_AGGREGATION_CONFIRM);
325#endif
326#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
327 case CSR_MLME_SM_START_REQUEST_ID:
328 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SM_START_REQUEST);
329#endif
330#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
331 case CSR_MLME_SM_START_CONFIRM_ID:
332 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SM_START_CONFIRM);
333#endif
334#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
335 case CSR_MLME_LEAVE_REQUEST_ID:
336 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_LEAVE_REQUEST);
337#endif
338#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
339 case CSR_MLME_LEAVE_CONFIRM_ID:
340 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_LEAVE_CONFIRM);
341#endif
342 case CSR_MLME_SET_TIM_REQUEST_ID:
343 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_TIM_REQUEST);
344 case CSR_MLME_SET_TIM_CONFIRM_ID:
345 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_TIM_CONFIRM);
346#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
347 case CSR_MLME_GET_KEY_SEQUENCE_REQUEST_ID:
348 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_KEY_SEQUENCE_REQUEST);
349#endif
350#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
351 case CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID:
352 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_GET_KEY_SEQUENCE_CONFIRM);
353#endif
354#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
355 case CSR_MLME_SET_CHANNEL_REQUEST_ID:
356 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_CHANNEL_REQUEST);
357#endif
358#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
359 case CSR_MLME_SET_CHANNEL_CONFIRM_ID:
360 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_SET_CHANNEL_CONFIRM);
361#endif
362#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
363 case CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST_ID:
364 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST);
365#endif
366#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
367 case CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID:
368 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM);
369#endif
370 case CSR_DEBUG_STRING_INDICATION_ID:
371 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_STRING_INDICATION);
372 case CSR_DEBUG_WORD16_INDICATION_ID:
373 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_WORD16_INDICATION);
374 case CSR_DEBUG_GENERIC_REQUEST_ID:
375 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_GENERIC_REQUEST);
376 case CSR_DEBUG_GENERIC_CONFIRM_ID:
377 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_GENERIC_CONFIRM);
378 case CSR_DEBUG_GENERIC_INDICATION_ID:
379 return offsetof(struct CSR_SIGNAL_PRIMITIVE, u) + sizeof(CSR_DEBUG_GENERIC_INDICATION);
380 default:
381 return 0;
382 }
383}
384
385
386s32 SigGetDataRefs(CSR_SIGNAL *aSignal, CSR_DATAREF **aDataRef)
387{
388 s32 numRefs = 0;
389
390 switch (aSignal->SignalPrimitiveHeader.SignalId)
391 {
392 case CSR_MA_PACKET_REQUEST_ID:
393 aDataRef[numRefs++] = &aSignal->u.MaPacketRequest.Data;
394 aDataRef[numRefs++] = &aSignal->u.MaPacketRequest.Dummydataref2;
395 break;
396 case CSR_MA_PACKET_CONFIRM_ID:
397 aDataRef[numRefs++] = &aSignal->u.MaPacketConfirm.Dummydataref1;
398 aDataRef[numRefs++] = &aSignal->u.MaPacketConfirm.Dummydataref2;
399 break;
400 case CSR_MA_PACKET_INDICATION_ID:
401 aDataRef[numRefs++] = &aSignal->u.MaPacketIndication.Data;
402 aDataRef[numRefs++] = &aSignal->u.MaPacketIndication.Dummydataref2;
403 break;
404 case CSR_MA_PACKET_CANCEL_REQUEST_ID:
405 aDataRef[numRefs++] = &aSignal->u.MaPacketCancelRequest.Dummydataref1;
406 aDataRef[numRefs++] = &aSignal->u.MaPacketCancelRequest.Dummydataref2;
407 break;
408 case CSR_MA_VIF_AVAILABILITY_RESPONSE_ID:
409 aDataRef[numRefs++] = &aSignal->u.MaVifAvailabilityResponse.Dummydataref1;
410 aDataRef[numRefs++] = &aSignal->u.MaVifAvailabilityResponse.Dummydataref2;
411 break;
412 case CSR_MA_VIF_AVAILABILITY_INDICATION_ID:
413 aDataRef[numRefs++] = &aSignal->u.MaVifAvailabilityIndication.Dummydataref1;
414 aDataRef[numRefs++] = &aSignal->u.MaVifAvailabilityIndication.Dummydataref2;
415 break;
416 case CSR_MA_PACKET_ERROR_INDICATION_ID:
417 aDataRef[numRefs++] = &aSignal->u.MaPacketErrorIndication.Dummydataref1;
418 aDataRef[numRefs++] = &aSignal->u.MaPacketErrorIndication.Dummydataref2;
419 break;
420#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
421 case CSR_MLME_RESET_REQUEST_ID:
422 aDataRef[numRefs++] = &aSignal->u.MlmeResetRequest.Dummydataref1;
423 aDataRef[numRefs++] = &aSignal->u.MlmeResetRequest.Dummydataref2;
424 break;
425#endif
426#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
427 case CSR_MLME_RESET_CONFIRM_ID:
428 aDataRef[numRefs++] = &aSignal->u.MlmeResetConfirm.Dummydataref1;
429 aDataRef[numRefs++] = &aSignal->u.MlmeResetConfirm.Dummydataref2;
430 break;
431#endif
432#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
433 case CSR_MLME_GET_REQUEST_ID:
434 aDataRef[numRefs++] = &aSignal->u.MlmeGetRequest.MibAttribute;
435 aDataRef[numRefs++] = &aSignal->u.MlmeGetRequest.Dummydataref2;
436 break;
437#endif
438#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
439 case CSR_MLME_GET_CONFIRM_ID:
440 aDataRef[numRefs++] = &aSignal->u.MlmeGetConfirm.MibAttributeValue;
441 aDataRef[numRefs++] = &aSignal->u.MlmeGetConfirm.Dummydataref2;
442 break;
443#endif
444#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
445 case CSR_MLME_SET_REQUEST_ID:
446 aDataRef[numRefs++] = &aSignal->u.MlmeSetRequest.MibAttributeValue;
447 aDataRef[numRefs++] = &aSignal->u.MlmeSetRequest.Dummydataref2;
448 break;
449#endif
450#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
451 case CSR_MLME_SET_CONFIRM_ID:
452 aDataRef[numRefs++] = &aSignal->u.MlmeSetConfirm.MibAttributeValue;
453 aDataRef[numRefs++] = &aSignal->u.MlmeSetConfirm.Dummydataref2;
454 break;
455#endif
456#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
457 case CSR_MLME_GET_NEXT_REQUEST_ID:
458 aDataRef[numRefs++] = &aSignal->u.MlmeGetNextRequest.MibAttribute;
459 aDataRef[numRefs++] = &aSignal->u.MlmeGetNextRequest.Dummydataref2;
460 break;
461#endif
462#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
463 case CSR_MLME_GET_NEXT_CONFIRM_ID:
464 aDataRef[numRefs++] = &aSignal->u.MlmeGetNextConfirm.MibAttributeValue;
465 aDataRef[numRefs++] = &aSignal->u.MlmeGetNextConfirm.Dummydataref2;
466 break;
467#endif
468#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
469 case CSR_MLME_POWERMGT_REQUEST_ID:
470 aDataRef[numRefs++] = &aSignal->u.MlmePowermgtRequest.Dummydataref1;
471 aDataRef[numRefs++] = &aSignal->u.MlmePowermgtRequest.Dummydataref2;
472 break;
473#endif
474#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
475 case CSR_MLME_POWERMGT_CONFIRM_ID:
476 aDataRef[numRefs++] = &aSignal->u.MlmePowermgtConfirm.Dummydataref1;
477 aDataRef[numRefs++] = &aSignal->u.MlmePowermgtConfirm.Dummydataref2;
478 break;
479#endif
480#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
481 case CSR_MLME_SCAN_REQUEST_ID:
482 aDataRef[numRefs++] = &aSignal->u.MlmeScanRequest.ChannelList;
483 aDataRef[numRefs++] = &aSignal->u.MlmeScanRequest.InformationElements;
484 break;
485#endif
486#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
487 case CSR_MLME_SCAN_CONFIRM_ID:
488 aDataRef[numRefs++] = &aSignal->u.MlmeScanConfirm.Dummydataref1;
489 aDataRef[numRefs++] = &aSignal->u.MlmeScanConfirm.Dummydataref2;
490 break;
491#endif
492#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
493 case CSR_MLME_HL_SYNC_REQUEST_ID:
494 aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncRequest.Dummydataref1;
495 aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncRequest.Dummydataref2;
496 break;
497#endif
498#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
499 case CSR_MLME_HL_SYNC_CONFIRM_ID:
500 aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncConfirm.Dummydataref1;
501 aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncConfirm.Dummydataref2;
502 break;
503#endif
504#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
505 case CSR_MLME_MEASURE_REQUEST_ID:
506 aDataRef[numRefs++] = &aSignal->u.MlmeMeasureRequest.MeasurementRequestSet;
507 aDataRef[numRefs++] = &aSignal->u.MlmeMeasureRequest.Dummydataref2;
508 break;
509#endif
510#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
511 case CSR_MLME_MEASURE_CONFIRM_ID:
512 aDataRef[numRefs++] = &aSignal->u.MlmeMeasureConfirm.Dummydataref1;
513 aDataRef[numRefs++] = &aSignal->u.MlmeMeasureConfirm.Dummydataref2;
514 break;
515#endif
516#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
517 case CSR_MLME_MEASURE_INDICATION_ID:
518 aDataRef[numRefs++] = &aSignal->u.MlmeMeasureIndication.MeasurementReportSet;
519 aDataRef[numRefs++] = &aSignal->u.MlmeMeasureIndication.Dummydataref2;
520 break;
521#endif
522#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
523 case CSR_MLME_SETKEYS_REQUEST_ID:
524 aDataRef[numRefs++] = &aSignal->u.MlmeSetkeysRequest.Key;
525 aDataRef[numRefs++] = &aSignal->u.MlmeSetkeysRequest.Dummydataref2;
526 break;
527#endif
528#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
529 case CSR_MLME_SETKEYS_CONFIRM_ID:
530 aDataRef[numRefs++] = &aSignal->u.MlmeSetkeysConfirm.Dummydataref1;
531 aDataRef[numRefs++] = &aSignal->u.MlmeSetkeysConfirm.Dummydataref2;
532 break;
533#endif
534#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
535 case CSR_MLME_DELETEKEYS_REQUEST_ID:
536 aDataRef[numRefs++] = &aSignal->u.MlmeDeletekeysRequest.Dummydataref1;
537 aDataRef[numRefs++] = &aSignal->u.MlmeDeletekeysRequest.Dummydataref2;
538 break;
539#endif
540#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
541 case CSR_MLME_DELETEKEYS_CONFIRM_ID:
542 aDataRef[numRefs++] = &aSignal->u.MlmeDeletekeysConfirm.Dummydataref1;
543 aDataRef[numRefs++] = &aSignal->u.MlmeDeletekeysConfirm.Dummydataref2;
544 break;
545#endif
546#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
547 case CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION_ID:
548 aDataRef[numRefs++] = &aSignal->u.MlmeAutonomousScanLossIndication.Dummydataref1;
549 aDataRef[numRefs++] = &aSignal->u.MlmeAutonomousScanLossIndication.Dummydataref2;
550 break;
551#endif
552#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
553 case CSR_MLME_CONNECTED_INDICATION_ID:
554 aDataRef[numRefs++] = &aSignal->u.MlmeConnectedIndication.Dummydataref1;
555 aDataRef[numRefs++] = &aSignal->u.MlmeConnectedIndication.Dummydataref2;
556 break;
557#endif
558#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
559 case CSR_MLME_SCAN_CANCEL_REQUEST_ID:
560 aDataRef[numRefs++] = &aSignal->u.MlmeScanCancelRequest.Dummydataref1;
561 aDataRef[numRefs++] = &aSignal->u.MlmeScanCancelRequest.Dummydataref2;
562 break;
563#endif
564#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
565 case CSR_MLME_HL_SYNC_CANCEL_REQUEST_ID:
566 aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncCancelRequest.Dummydataref1;
567 aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncCancelRequest.Dummydataref2;
568 break;
569#endif
570#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
571 case CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID:
572 aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncCancelConfirm.Dummydataref1;
573 aDataRef[numRefs++] = &aSignal->u.MlmeHlSyncCancelConfirm.Dummydataref2;
574 break;
575#endif
576#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
577 case CSR_MLME_ADD_PERIODIC_REQUEST_ID:
578 aDataRef[numRefs++] = &aSignal->u.MlmeAddPeriodicRequest.Dummydataref1;
579 aDataRef[numRefs++] = &aSignal->u.MlmeAddPeriodicRequest.Dummydataref2;
580 break;
581#endif
582#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
583 case CSR_MLME_ADD_PERIODIC_CONFIRM_ID:
584 aDataRef[numRefs++] = &aSignal->u.MlmeAddPeriodicConfirm.Dummydataref1;
585 aDataRef[numRefs++] = &aSignal->u.MlmeAddPeriodicConfirm.Dummydataref2;
586 break;
587#endif
588#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
589 case CSR_MLME_DEL_PERIODIC_REQUEST_ID:
590 aDataRef[numRefs++] = &aSignal->u.MlmeDelPeriodicRequest.Dummydataref1;
591 aDataRef[numRefs++] = &aSignal->u.MlmeDelPeriodicRequest.Dummydataref2;
592 break;
593#endif
594#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
595 case CSR_MLME_DEL_PERIODIC_CONFIRM_ID:
596 aDataRef[numRefs++] = &aSignal->u.MlmeDelPeriodicConfirm.Dummydataref1;
597 aDataRef[numRefs++] = &aSignal->u.MlmeDelPeriodicConfirm.Dummydataref2;
598 break;
599#endif
600#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
601 case CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST_ID:
602 aDataRef[numRefs++] = &aSignal->u.MlmeAddAutonomousScanRequest.ChannelList;
603 aDataRef[numRefs++] = &aSignal->u.MlmeAddAutonomousScanRequest.InformationElements;
604 break;
605#endif
606#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
607 case CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID:
608 aDataRef[numRefs++] = &aSignal->u.MlmeAddAutonomousScanConfirm.Dummydataref1;
609 aDataRef[numRefs++] = &aSignal->u.MlmeAddAutonomousScanConfirm.Dummydataref2;
610 break;
611#endif
612#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
613 case CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST_ID:
614 aDataRef[numRefs++] = &aSignal->u.MlmeDelAutonomousScanRequest.Dummydataref1;
615 aDataRef[numRefs++] = &aSignal->u.MlmeDelAutonomousScanRequest.Dummydataref2;
616 break;
617#endif
618#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
619 case CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID:
620 aDataRef[numRefs++] = &aSignal->u.MlmeDelAutonomousScanConfirm.Dummydataref1;
621 aDataRef[numRefs++] = &aSignal->u.MlmeDelAutonomousScanConfirm.Dummydataref2;
622 break;
623#endif
624#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
625 case CSR_MLME_SET_PACKET_FILTER_REQUEST_ID:
626 aDataRef[numRefs++] = &aSignal->u.MlmeSetPacketFilterRequest.InformationElements;
627 aDataRef[numRefs++] = &aSignal->u.MlmeSetPacketFilterRequest.Dummydataref2;
628 break;
629#endif
630#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
631 case CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID:
632 aDataRef[numRefs++] = &aSignal->u.MlmeSetPacketFilterConfirm.Dummydataref1;
633 aDataRef[numRefs++] = &aSignal->u.MlmeSetPacketFilterConfirm.Dummydataref2;
634 break;
635#endif
636#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
637 case CSR_MLME_STOP_MEASURE_REQUEST_ID:
638 aDataRef[numRefs++] = &aSignal->u.MlmeStopMeasureRequest.Dummydataref1;
639 aDataRef[numRefs++] = &aSignal->u.MlmeStopMeasureRequest.Dummydataref2;
640 break;
641#endif
642#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
643 case CSR_MLME_STOP_MEASURE_CONFIRM_ID:
644 aDataRef[numRefs++] = &aSignal->u.MlmeStopMeasureConfirm.Dummydataref1;
645 aDataRef[numRefs++] = &aSignal->u.MlmeStopMeasureConfirm.Dummydataref2;
646 break;
647#endif
648#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
649 case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST_ID:
650 aDataRef[numRefs++] = &aSignal->u.MlmePauseAutonomousScanRequest.Dummydataref1;
651 aDataRef[numRefs++] = &aSignal->u.MlmePauseAutonomousScanRequest.Dummydataref2;
652 break;
653#endif
654#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
655 case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID:
656 aDataRef[numRefs++] = &aSignal->u.MlmePauseAutonomousScanConfirm.Dummydataref1;
657 aDataRef[numRefs++] = &aSignal->u.MlmePauseAutonomousScanConfirm.Dummydataref2;
658 break;
659#endif
660#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
661 case CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION_ID:
662 aDataRef[numRefs++] = &aSignal->u.MlmeAutonomousScanDoneIndication.Dummydataref1;
663 aDataRef[numRefs++] = &aSignal->u.MlmeAutonomousScanDoneIndication.Dummydataref2;
664 break;
665#endif
666#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
667 case CSR_MLME_ADD_TRIGGERED_GET_REQUEST_ID:
668 aDataRef[numRefs++] = &aSignal->u.MlmeAddTriggeredGetRequest.MibAttribute;
669 aDataRef[numRefs++] = &aSignal->u.MlmeAddTriggeredGetRequest.Dummydataref2;
670 break;
671#endif
672#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
673 case CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID:
674 aDataRef[numRefs++] = &aSignal->u.MlmeAddTriggeredGetConfirm.Dummydataref1;
675 aDataRef[numRefs++] = &aSignal->u.MlmeAddTriggeredGetConfirm.Dummydataref2;
676 break;
677#endif
678#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
679 case CSR_MLME_DEL_TRIGGERED_GET_REQUEST_ID:
680 aDataRef[numRefs++] = &aSignal->u.MlmeDelTriggeredGetRequest.Dummydataref1;
681 aDataRef[numRefs++] = &aSignal->u.MlmeDelTriggeredGetRequest.Dummydataref2;
682 break;
683#endif
684#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
685 case CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID:
686 aDataRef[numRefs++] = &aSignal->u.MlmeDelTriggeredGetConfirm.Dummydataref1;
687 aDataRef[numRefs++] = &aSignal->u.MlmeDelTriggeredGetConfirm.Dummydataref2;
688 break;
689#endif
690#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
691 case CSR_MLME_TRIGGERED_GET_INDICATION_ID:
692 aDataRef[numRefs++] = &aSignal->u.MlmeTriggeredGetIndication.MibAttributeValue;
693 aDataRef[numRefs++] = &aSignal->u.MlmeTriggeredGetIndication.Dummydataref2;
694 break;
695#endif
696#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
697 case CSR_MLME_ADD_BLACKOUT_REQUEST_ID:
698 aDataRef[numRefs++] = &aSignal->u.MlmeAddBlackoutRequest.Dummydataref1;
699 aDataRef[numRefs++] = &aSignal->u.MlmeAddBlackoutRequest.Dummydataref2;
700 break;
701#endif
702#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
703 case CSR_MLME_ADD_BLACKOUT_CONFIRM_ID:
704 aDataRef[numRefs++] = &aSignal->u.MlmeAddBlackoutConfirm.Dummydataref1;
705 aDataRef[numRefs++] = &aSignal->u.MlmeAddBlackoutConfirm.Dummydataref2;
706 break;
707#endif
708#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
709 case CSR_MLME_BLACKOUT_ENDED_INDICATION_ID:
710 aDataRef[numRefs++] = &aSignal->u.MlmeBlackoutEndedIndication.Dummydataref1;
711 aDataRef[numRefs++] = &aSignal->u.MlmeBlackoutEndedIndication.Dummydataref2;
712 break;
713#endif
714#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
715 case CSR_MLME_DEL_BLACKOUT_REQUEST_ID:
716 aDataRef[numRefs++] = &aSignal->u.MlmeDelBlackoutRequest.Dummydataref1;
717 aDataRef[numRefs++] = &aSignal->u.MlmeDelBlackoutRequest.Dummydataref2;
718 break;
719#endif
720#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
721 case CSR_MLME_DEL_BLACKOUT_CONFIRM_ID:
722 aDataRef[numRefs++] = &aSignal->u.MlmeDelBlackoutConfirm.Dummydataref1;
723 aDataRef[numRefs++] = &aSignal->u.MlmeDelBlackoutConfirm.Dummydataref2;
724 break;
725#endif
726#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
727 case CSR_MLME_ADD_RX_TRIGGER_REQUEST_ID:
728 aDataRef[numRefs++] = &aSignal->u.MlmeAddRxTriggerRequest.InformationElements;
729 aDataRef[numRefs++] = &aSignal->u.MlmeAddRxTriggerRequest.Dummydataref2;
730 break;
731#endif
732#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
733 case CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID:
734 aDataRef[numRefs++] = &aSignal->u.MlmeAddRxTriggerConfirm.Dummydataref1;
735 aDataRef[numRefs++] = &aSignal->u.MlmeAddRxTriggerConfirm.Dummydataref2;
736 break;
737#endif
738#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
739 case CSR_MLME_DEL_RX_TRIGGER_REQUEST_ID:
740 aDataRef[numRefs++] = &aSignal->u.MlmeDelRxTriggerRequest.Dummydataref1;
741 aDataRef[numRefs++] = &aSignal->u.MlmeDelRxTriggerRequest.Dummydataref2;
742 break;
743#endif
744#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
745 case CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID:
746 aDataRef[numRefs++] = &aSignal->u.MlmeDelRxTriggerConfirm.Dummydataref1;
747 aDataRef[numRefs++] = &aSignal->u.MlmeDelRxTriggerConfirm.Dummydataref2;
748 break;
749#endif
750#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
751 case CSR_MLME_CONNECT_STATUS_REQUEST_ID:
752 aDataRef[numRefs++] = &aSignal->u.MlmeConnectStatusRequest.InformationElements;
753 aDataRef[numRefs++] = &aSignal->u.MlmeConnectStatusRequest.Dummydataref2;
754 break;
755#endif
756#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
757 case CSR_MLME_CONNECT_STATUS_CONFIRM_ID:
758 aDataRef[numRefs++] = &aSignal->u.MlmeConnectStatusConfirm.Dummydataref1;
759 aDataRef[numRefs++] = &aSignal->u.MlmeConnectStatusConfirm.Dummydataref2;
760 break;
761#endif
762#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
763 case CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST_ID:
764 aDataRef[numRefs++] = &aSignal->u.MlmeModifyBssParameterRequest.Data;
765 aDataRef[numRefs++] = &aSignal->u.MlmeModifyBssParameterRequest.Dummydataref2;
766 break;
767#endif
768#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
769 case CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID:
770 aDataRef[numRefs++] = &aSignal->u.MlmeModifyBssParameterConfirm.Dummydataref1;
771 aDataRef[numRefs++] = &aSignal->u.MlmeModifyBssParameterConfirm.Dummydataref2;
772 break;
773#endif
774#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
775 case CSR_MLME_ADD_TEMPLATE_REQUEST_ID:
776 aDataRef[numRefs++] = &aSignal->u.MlmeAddTemplateRequest.Data1;
777 aDataRef[numRefs++] = &aSignal->u.MlmeAddTemplateRequest.Data2;
778 break;
779#endif
780#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
781 case CSR_MLME_ADD_TEMPLATE_CONFIRM_ID:
782 aDataRef[numRefs++] = &aSignal->u.MlmeAddTemplateConfirm.Dummydataref1;
783 aDataRef[numRefs++] = &aSignal->u.MlmeAddTemplateConfirm.Dummydataref2;
784 break;
785#endif
786#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
787 case CSR_MLME_CONFIG_QUEUE_REQUEST_ID:
788 aDataRef[numRefs++] = &aSignal->u.MlmeConfigQueueRequest.Dummydataref1;
789 aDataRef[numRefs++] = &aSignal->u.MlmeConfigQueueRequest.Dummydataref2;
790 break;
791#endif
792#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
793 case CSR_MLME_CONFIG_QUEUE_CONFIRM_ID:
794 aDataRef[numRefs++] = &aSignal->u.MlmeConfigQueueConfirm.Dummydataref1;
795 aDataRef[numRefs++] = &aSignal->u.MlmeConfigQueueConfirm.Dummydataref2;
796 break;
797#endif
798#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
799 case CSR_MLME_ADD_TSPEC_REQUEST_ID:
800 aDataRef[numRefs++] = &aSignal->u.MlmeAddTspecRequest.Dummydataref1;
801 aDataRef[numRefs++] = &aSignal->u.MlmeAddTspecRequest.Dummydataref2;
802 break;
803#endif
804#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
805 case CSR_MLME_ADD_TSPEC_CONFIRM_ID:
806 aDataRef[numRefs++] = &aSignal->u.MlmeAddTspecConfirm.Dummydataref1;
807 aDataRef[numRefs++] = &aSignal->u.MlmeAddTspecConfirm.Dummydataref2;
808 break;
809#endif
810#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
811 case CSR_MLME_DEL_TSPEC_REQUEST_ID:
812 aDataRef[numRefs++] = &aSignal->u.MlmeDelTspecRequest.Dummydataref1;
813 aDataRef[numRefs++] = &aSignal->u.MlmeDelTspecRequest.Dummydataref2;
814 break;
815#endif
816#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
817 case CSR_MLME_DEL_TSPEC_CONFIRM_ID:
818 aDataRef[numRefs++] = &aSignal->u.MlmeDelTspecConfirm.Dummydataref1;
819 aDataRef[numRefs++] = &aSignal->u.MlmeDelTspecConfirm.Dummydataref2;
820 break;
821#endif
822#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
823 case CSR_MLME_START_AGGREGATION_REQUEST_ID:
824 aDataRef[numRefs++] = &aSignal->u.MlmeStartAggregationRequest.Dummydataref1;
825 aDataRef[numRefs++] = &aSignal->u.MlmeStartAggregationRequest.Dummydataref2;
826 break;
827#endif
828#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
829 case CSR_MLME_START_AGGREGATION_CONFIRM_ID:
830 aDataRef[numRefs++] = &aSignal->u.MlmeStartAggregationConfirm.Dummydataref1;
831 aDataRef[numRefs++] = &aSignal->u.MlmeStartAggregationConfirm.Dummydataref2;
832 break;
833#endif
834#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
835 case CSR_MLME_BLOCKACK_ERROR_INDICATION_ID:
836 aDataRef[numRefs++] = &aSignal->u.MlmeBlockackErrorIndication.Dummydataref1;
837 aDataRef[numRefs++] = &aSignal->u.MlmeBlockackErrorIndication.Dummydataref2;
838 break;
839#endif
840#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
841 case CSR_MLME_STOP_AGGREGATION_REQUEST_ID:
842 aDataRef[numRefs++] = &aSignal->u.MlmeStopAggregationRequest.Dummydataref1;
843 aDataRef[numRefs++] = &aSignal->u.MlmeStopAggregationRequest.Dummydataref2;
844 break;
845#endif
846#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
847 case CSR_MLME_STOP_AGGREGATION_CONFIRM_ID:
848 aDataRef[numRefs++] = &aSignal->u.MlmeStopAggregationConfirm.Dummydataref1;
849 aDataRef[numRefs++] = &aSignal->u.MlmeStopAggregationConfirm.Dummydataref2;
850 break;
851#endif
852#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
853 case CSR_MLME_SM_START_REQUEST_ID:
854 aDataRef[numRefs++] = &aSignal->u.MlmeSmStartRequest.Beacon;
855 aDataRef[numRefs++] = &aSignal->u.MlmeSmStartRequest.BssParameters;
856 break;
857#endif
858#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
859 case CSR_MLME_SM_START_CONFIRM_ID:
860 aDataRef[numRefs++] = &aSignal->u.MlmeSmStartConfirm.Dummydataref1;
861 aDataRef[numRefs++] = &aSignal->u.MlmeSmStartConfirm.Dummydataref2;
862 break;
863#endif
864#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
865 case CSR_MLME_LEAVE_REQUEST_ID:
866 aDataRef[numRefs++] = &aSignal->u.MlmeLeaveRequest.Dummydataref1;
867 aDataRef[numRefs++] = &aSignal->u.MlmeLeaveRequest.Dummydataref2;
868 break;
869#endif
870#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
871 case CSR_MLME_LEAVE_CONFIRM_ID:
872 aDataRef[numRefs++] = &aSignal->u.MlmeLeaveConfirm.Dummydataref1;
873 aDataRef[numRefs++] = &aSignal->u.MlmeLeaveConfirm.Dummydataref2;
874 break;
875#endif
876 case CSR_MLME_SET_TIM_REQUEST_ID:
877 aDataRef[numRefs++] = &aSignal->u.MlmeSetTimRequest.Dummydataref1;
878 aDataRef[numRefs++] = &aSignal->u.MlmeSetTimRequest.Dummydataref2;
879 break;
880 case CSR_MLME_SET_TIM_CONFIRM_ID:
881 aDataRef[numRefs++] = &aSignal->u.MlmeSetTimConfirm.Dummydataref1;
882 aDataRef[numRefs++] = &aSignal->u.MlmeSetTimConfirm.Dummydataref2;
883 break;
884#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
885 case CSR_MLME_GET_KEY_SEQUENCE_REQUEST_ID:
886 aDataRef[numRefs++] = &aSignal->u.MlmeGetKeySequenceRequest.Dummydataref1;
887 aDataRef[numRefs++] = &aSignal->u.MlmeGetKeySequenceRequest.Dummydataref2;
888 break;
889#endif
890#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
891 case CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID:
892 aDataRef[numRefs++] = &aSignal->u.MlmeGetKeySequenceConfirm.Dummydataref1;
893 aDataRef[numRefs++] = &aSignal->u.MlmeGetKeySequenceConfirm.Dummydataref2;
894 break;
895#endif
896#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
897 case CSR_MLME_SET_CHANNEL_REQUEST_ID:
898 aDataRef[numRefs++] = &aSignal->u.MlmeSetChannelRequest.Dummydataref1;
899 aDataRef[numRefs++] = &aSignal->u.MlmeSetChannelRequest.Dummydataref2;
900 break;
901#endif
902#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
903 case CSR_MLME_SET_CHANNEL_CONFIRM_ID:
904 aDataRef[numRefs++] = &aSignal->u.MlmeSetChannelConfirm.Dummydataref1;
905 aDataRef[numRefs++] = &aSignal->u.MlmeSetChannelConfirm.Dummydataref2;
906 break;
907#endif
908#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
909 case CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST_ID:
910 aDataRef[numRefs++] = &aSignal->u.MlmeAddMulticastAddressRequest.Data;
911 aDataRef[numRefs++] = &aSignal->u.MlmeAddMulticastAddressRequest.Dummydataref2;
912 break;
913#endif
914#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
915 case CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID:
916 aDataRef[numRefs++] = &aSignal->u.MlmeAddMulticastAddressConfirm.Dummydataref1;
917 aDataRef[numRefs++] = &aSignal->u.MlmeAddMulticastAddressConfirm.Dummydataref2;
918 break;
919#endif
920 case CSR_DEBUG_STRING_INDICATION_ID:
921 aDataRef[numRefs++] = &aSignal->u.DebugStringIndication.DebugMessage;
922 aDataRef[numRefs++] = &aSignal->u.DebugStringIndication.Dummydataref2;
923 break;
924 case CSR_DEBUG_WORD16_INDICATION_ID:
925 aDataRef[numRefs++] = &aSignal->u.DebugWord16Indication.Dummydataref1;
926 aDataRef[numRefs++] = &aSignal->u.DebugWord16Indication.Dummydataref2;
927 break;
928 case CSR_DEBUG_GENERIC_REQUEST_ID:
929 aDataRef[numRefs++] = &aSignal->u.DebugGenericRequest.DebugVariable;
930 aDataRef[numRefs++] = &aSignal->u.DebugGenericRequest.Dummydataref2;
931 break;
932 case CSR_DEBUG_GENERIC_CONFIRM_ID:
933 aDataRef[numRefs++] = &aSignal->u.DebugGenericConfirm.DebugVariable;
934 aDataRef[numRefs++] = &aSignal->u.DebugGenericConfirm.Dummydataref2;
935 break;
936 case CSR_DEBUG_GENERIC_INDICATION_ID:
937 aDataRef[numRefs++] = &aSignal->u.DebugGenericIndication.DebugVariable;
938 aDataRef[numRefs++] = &aSignal->u.DebugGenericIndication.Dummydataref2;
939 break;
940 default:
941 return 0;
942 }
943 return numRefs;
944}
945
946
947u32 SigGetFilterPos(u16 aSigID)
948{
949 switch (aSigID)
950 {
951 case CSR_MA_PACKET_REQUEST_ID:
952 return 0x00000001;
953 case CSR_MA_PACKET_CONFIRM_ID:
954 return 0x00000002;
955 case CSR_MA_PACKET_INDICATION_ID:
956 return 0x00000004;
957 case CSR_MA_PACKET_CANCEL_REQUEST_ID:
958 return 0x00000008;
959 case CSR_MA_VIF_AVAILABILITY_RESPONSE_ID:
960 return 0x00000010;
961 case CSR_MA_VIF_AVAILABILITY_INDICATION_ID:
962 return 0x00000020;
963 case CSR_MA_PACKET_ERROR_INDICATION_ID:
964 return 0x00000040;
965#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
966 case CSR_MLME_RESET_REQUEST_ID:
967 return 0x00000080;
968#endif
969#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
970 case CSR_MLME_RESET_CONFIRM_ID:
971 return 0x00000100;
972#endif
973#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
974 case CSR_MLME_GET_REQUEST_ID:
975 return 0x00000200;
976#endif
977#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
978 case CSR_MLME_GET_CONFIRM_ID:
979 return 0x00000400;
980#endif
981#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
982 case CSR_MLME_SET_REQUEST_ID:
983 return 0x00000800;
984#endif
985#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
986 case CSR_MLME_SET_CONFIRM_ID:
987 return 0x00001000;
988#endif
989#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
990 case CSR_MLME_GET_NEXT_REQUEST_ID:
991 return 0x00002000;
992#endif
993#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
994 case CSR_MLME_GET_NEXT_CONFIRM_ID:
995 return 0x00004000;
996#endif
997#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
998 case CSR_MLME_POWERMGT_REQUEST_ID:
999 return 0x00008000;
1000#endif
1001#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1002 case CSR_MLME_POWERMGT_CONFIRM_ID:
1003 return 0x00010001;
1004#endif
1005#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1006 case CSR_MLME_SCAN_REQUEST_ID:
1007 return 0x00010002;
1008#endif
1009#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1010 case CSR_MLME_SCAN_CONFIRM_ID:
1011 return 0x00010004;
1012#endif
1013#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1014 case CSR_MLME_HL_SYNC_REQUEST_ID:
1015 return 0x00010008;
1016#endif
1017#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1018 case CSR_MLME_HL_SYNC_CONFIRM_ID:
1019 return 0x00010010;
1020#endif
1021#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1022 case CSR_MLME_MEASURE_REQUEST_ID:
1023 return 0x00010020;
1024#endif
1025#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1026 case CSR_MLME_MEASURE_CONFIRM_ID:
1027 return 0x00010040;
1028#endif
1029#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1030 case CSR_MLME_MEASURE_INDICATION_ID:
1031 return 0x00010080;
1032#endif
1033#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1034 case CSR_MLME_SETKEYS_REQUEST_ID:
1035 return 0x00010100;
1036#endif
1037#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1038 case CSR_MLME_SETKEYS_CONFIRM_ID:
1039 return 0x00010200;
1040#endif
1041#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1042 case CSR_MLME_DELETEKEYS_REQUEST_ID:
1043 return 0x00010400;
1044#endif
1045#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1046 case CSR_MLME_DELETEKEYS_CONFIRM_ID:
1047 return 0x00010800;
1048#endif
1049#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1050 case CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION_ID:
1051 return 0x00011000;
1052#endif
1053#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1054 case CSR_MLME_CONNECTED_INDICATION_ID:
1055 return 0x00012000;
1056#endif
1057#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1058 case CSR_MLME_SCAN_CANCEL_REQUEST_ID:
1059 return 0x00014000;
1060#endif
1061#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1062 case CSR_MLME_HL_SYNC_CANCEL_REQUEST_ID:
1063 return 0x00018000;
1064#endif
1065#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1066 case CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID:
1067 return 0x00020001;
1068#endif
1069#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1070 case CSR_MLME_ADD_PERIODIC_REQUEST_ID:
1071 return 0x00020002;
1072#endif
1073#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1074 case CSR_MLME_ADD_PERIODIC_CONFIRM_ID:
1075 return 0x00020004;
1076#endif
1077#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1078 case CSR_MLME_DEL_PERIODIC_REQUEST_ID:
1079 return 0x00020008;
1080#endif
1081#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1082 case CSR_MLME_DEL_PERIODIC_CONFIRM_ID:
1083 return 0x00020010;
1084#endif
1085#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1086 case CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST_ID:
1087 return 0x00020020;
1088#endif
1089#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1090 case CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID:
1091 return 0x00020040;
1092#endif
1093#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1094 case CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST_ID:
1095 return 0x00020080;
1096#endif
1097#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1098 case CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID:
1099 return 0x00020100;
1100#endif
1101#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1102 case CSR_MLME_SET_PACKET_FILTER_REQUEST_ID:
1103 return 0x00020200;
1104#endif
1105#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1106 case CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID:
1107 return 0x00020400;
1108#endif
1109#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1110 case CSR_MLME_STOP_MEASURE_REQUEST_ID:
1111 return 0x00020800;
1112#endif
1113#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1114 case CSR_MLME_STOP_MEASURE_CONFIRM_ID:
1115 return 0x00021000;
1116#endif
1117#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1118 case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST_ID:
1119 return 0x00022000;
1120#endif
1121#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1122 case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID:
1123 return 0x00024000;
1124#endif
1125#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1126 case CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION_ID:
1127 return 0x00028000;
1128#endif
1129#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1130 case CSR_MLME_ADD_TRIGGERED_GET_REQUEST_ID:
1131 return 0x00030001;
1132#endif
1133#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1134 case CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID:
1135 return 0x00030002;
1136#endif
1137#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1138 case CSR_MLME_DEL_TRIGGERED_GET_REQUEST_ID:
1139 return 0x00030004;
1140#endif
1141#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1142 case CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID:
1143 return 0x00030008;
1144#endif
1145#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1146 case CSR_MLME_TRIGGERED_GET_INDICATION_ID:
1147 return 0x00030010;
1148#endif
1149#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1150 case CSR_MLME_ADD_BLACKOUT_REQUEST_ID:
1151 return 0x00030020;
1152#endif
1153#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1154 case CSR_MLME_ADD_BLACKOUT_CONFIRM_ID:
1155 return 0x00030040;
1156#endif
1157#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1158 case CSR_MLME_BLACKOUT_ENDED_INDICATION_ID:
1159 return 0x00030080;
1160#endif
1161#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1162 case CSR_MLME_DEL_BLACKOUT_REQUEST_ID:
1163 return 0x00030100;
1164#endif
1165#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1166 case CSR_MLME_DEL_BLACKOUT_CONFIRM_ID:
1167 return 0x00030200;
1168#endif
1169#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1170 case CSR_MLME_ADD_RX_TRIGGER_REQUEST_ID:
1171 return 0x00030400;
1172#endif
1173#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1174 case CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID:
1175 return 0x00030800;
1176#endif
1177#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1178 case CSR_MLME_DEL_RX_TRIGGER_REQUEST_ID:
1179 return 0x00031000;
1180#endif
1181#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1182 case CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID:
1183 return 0x00032000;
1184#endif
1185#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1186 case CSR_MLME_CONNECT_STATUS_REQUEST_ID:
1187 return 0x00034000;
1188#endif
1189#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1190 case CSR_MLME_CONNECT_STATUS_CONFIRM_ID:
1191 return 0x00038000;
1192#endif
1193#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1194 case CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST_ID:
1195 return 0x00040001;
1196#endif
1197#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1198 case CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID:
1199 return 0x00040002;
1200#endif
1201#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1202 case CSR_MLME_ADD_TEMPLATE_REQUEST_ID:
1203 return 0x00040004;
1204#endif
1205#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1206 case CSR_MLME_ADD_TEMPLATE_CONFIRM_ID:
1207 return 0x00040008;
1208#endif
1209#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1210 case CSR_MLME_CONFIG_QUEUE_REQUEST_ID:
1211 return 0x00040010;
1212#endif
1213#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1214 case CSR_MLME_CONFIG_QUEUE_CONFIRM_ID:
1215 return 0x00040020;
1216#endif
1217#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1218 case CSR_MLME_ADD_TSPEC_REQUEST_ID:
1219 return 0x00040040;
1220#endif
1221#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1222 case CSR_MLME_ADD_TSPEC_CONFIRM_ID:
1223 return 0x00040080;
1224#endif
1225#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1226 case CSR_MLME_DEL_TSPEC_REQUEST_ID:
1227 return 0x00040100;
1228#endif
1229#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1230 case CSR_MLME_DEL_TSPEC_CONFIRM_ID:
1231 return 0x00040200;
1232#endif
1233#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1234 case CSR_MLME_START_AGGREGATION_REQUEST_ID:
1235 return 0x00040400;
1236#endif
1237#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1238 case CSR_MLME_START_AGGREGATION_CONFIRM_ID:
1239 return 0x00040800;
1240#endif
1241#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1242 case CSR_MLME_BLOCKACK_ERROR_INDICATION_ID:
1243 return 0x00041000;
1244#endif
1245#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1246 case CSR_MLME_STOP_AGGREGATION_REQUEST_ID:
1247 return 0x00042000;
1248#endif
1249#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1250 case CSR_MLME_STOP_AGGREGATION_CONFIRM_ID:
1251 return 0x00044000;
1252#endif
1253#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1254 case CSR_MLME_SM_START_REQUEST_ID:
1255 return 0x00048000;
1256#endif
1257#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1258 case CSR_MLME_SM_START_CONFIRM_ID:
1259 return 0x00050001;
1260#endif
1261#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1262 case CSR_MLME_LEAVE_REQUEST_ID:
1263 return 0x00050002;
1264#endif
1265#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1266 case CSR_MLME_LEAVE_CONFIRM_ID:
1267 return 0x00050004;
1268#endif
1269 case CSR_MLME_SET_TIM_REQUEST_ID:
1270 return 0x00050008;
1271 case CSR_MLME_SET_TIM_CONFIRM_ID:
1272 return 0x00050010;
1273#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1274 case CSR_MLME_GET_KEY_SEQUENCE_REQUEST_ID:
1275 return 0x00050020;
1276#endif
1277#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1278 case CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID:
1279 return 0x00050040;
1280#endif
1281#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1282 case CSR_MLME_SET_CHANNEL_REQUEST_ID:
1283 return 0x00050080;
1284#endif
1285#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1286 case CSR_MLME_SET_CHANNEL_CONFIRM_ID:
1287 return 0x00050100;
1288#endif
1289#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1290 case CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST_ID:
1291 return 0x00050200;
1292#endif
1293#ifdef CSR_WIFI_HIP_FULL_SIGNAL_SET
1294 case CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID:
1295 return 0x00050400;
1296#endif
1297 case CSR_DEBUG_STRING_INDICATION_ID:
1298 return 0x00050800;
1299 case CSR_DEBUG_WORD16_INDICATION_ID:
1300 return 0x00051000;
1301 case CSR_DEBUG_GENERIC_REQUEST_ID:
1302 return 0x00052000;
1303 case CSR_DEBUG_GENERIC_CONFIRM_ID:
1304 return 0x00054000;
1305 case CSR_DEBUG_GENERIC_INDICATION_ID:
1306 return 0x00058000;
1307 default:
1308 break;
1309 }
1310 return 0xffffffff;
1311}
1312
1313
diff --git a/drivers/staging/csr/csr_wifi_hip_signals.h b/drivers/staging/csr/csr_wifi_hip_signals.h
deleted file mode 100644
index ca4d0774195c..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_signals.h
+++ /dev/null
@@ -1,128 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/*
12 *****************************************************************************
13 *
14 * FILE: csr_wifi_hip_signals.h
15 *
16 * PURPOSE:
17 * Header file wrapping the auto-generated code in csr_wifi_hip_sigs.h
18 * and csr_wifi_hip_signals.c -
19 * csr_wifi_hip_sigs.h provides structures defining UniFi signals and
20 * csr_wifi_hip_signals.c provides SigGetSize() and SigGetDataRefs().
21 *
22 *****************************************************************************
23 */
24#ifndef __CSR_WIFI_HIP_SIGNALS_H__
25#define __CSR_WIFI_HIP_SIGNALS_H__
26
27#include <linux/types.h>
28#include "csr_wifi_hip_sigs.h"
29
30
31/****************************************************************************/
32/* INFORMATION ELEMENTS */
33/****************************************************************************/
34
35/* Information Element ID's - shouldn't be in here, but nowhere better yet */
36#define IE_SSID_ID 0
37#define IE_SUPPORTED_RATES_ID 1
38#define IE_FH_PARAM_SET_ID 2
39#define IE_DS_PARAM_SET_ID 3
40#define IE_CF_PARAM_SET_ID 4
41#define IE_TIM_ID 5
42#define IE_IBSS_PARAM_SET_ID 6
43#define IE_COUNTRY_ID 7
44#define IE_HOPPING_PATTERN_PARAMS_ID 8
45#define IE_HOPPING_PATTERN_TABLE_ID 9
46#define IE_REQUEST_ID 10
47#define IE_QBSS_LOAD_ID 11
48#define IE_EDCA_PARAM_SET_ID 12
49#define IE_TRAFFIC_SPEC_ID 13
50#define IE_TRAFFIC_CLASS_ID 14
51#define IE_SCHEDULE_ID 15
52#define IE_CHALLENGE_TEXT_ID 16
53#define IE_POWER_CONSTRAINT_ID 32
54#define IE_POWER_CAPABILITY_ID 33
55#define IE_TPC_REQUEST_ID 34
56#define IE_TPC_REPORT_ID 35
57#define IE_SUPPORTED_CHANNELS_ID 36
58#define IE_CHANNEL_SWITCH_ANNOUNCE_ID 37
59#define IE_MEASUREMENT_REQUEST_ID 38
60#define IE_MEASUREMENT_REPORT_ID 39
61#define IE_QUIET_ID 40
62#define IE_IBSS_DFS_ID 41
63#define IE_ERP_INFO_ID 42
64#define IE_TS_DELAY_ID 43
65#define IE_TCLAS_PROCESSING_ID 44
66#define IE_QOS_CAPABILITY_ID 46
67#define IE_RSN_ID 48
68#define IE_EXTENDED_SUPPORTED_RATES_ID 50
69#define IE_AP_CHANNEL_REPORT_ID 52
70#define IE_RCPI_ID 53
71#define IE_WPA_ID 221
72
73
74/* The maximum number of data references in a signal structure */
75#define UNIFI_MAX_DATA_REFERENCES 2
76
77/* The space to allow for a wire-format signal structure */
78#define UNIFI_PACKED_SIGBUF_SIZE 64
79
80
81/******************************************************************************/
82/* SIGNAL PARAMETER VALUES */
83/******************************************************************************/
84
85/* ifIndex */
86#define UNIFI_IF_2G4 1
87#define UNIFI_IF_5G 2
88
89/* SendProcessId */
90#define HOST_PROC_ID 0xc000
91
92#define SIG_CAP_ESS 0x0001
93#define SIG_CAP_IBSS 0x0002
94#define SIG_CAP_CF_POLLABLE 0x0004
95#define SIG_CAP_CF_POLL_REQUEST 0x0008
96#define SIG_CAP_PRIVACY 0x0010
97#define SIG_CAP_SHORT_PREAMBLE 0x0020
98#define SIG_CAP_DSSSOFDM 0x2000
99
100/******************************************************************************/
101/* FUNCTION DECLARATIONS */
102/******************************************************************************/
103
104/******************************************************************************
105 * SigGetNumDataRefs - Retrieve pointers to data-refs from a signal.
106 *
107 * PARAMETERS:
108 * aSignal - Pointer to signal to retrieve the data refs of.
109 * aDataRef - Address of a pointer to the structure that the data refs
110 * pointers will be stored.
111 *
112 * RETURNS:
113 * The number of data-refs in the signal.
114 */
115s32 SigGetDataRefs(CSR_SIGNAL *aSignal, CSR_DATAREF **aDataRef);
116
117/******************************************************************************
118 * SigGetSize - Retrieve the size (in bytes) of a given signal.
119 *
120 * PARAMETERS:
121 * aSignal - Pointer to signal to retrieve size of.
122 *
123 * RETURNS:
124 * The size (in bytes) of the given signal.
125 */
126s32 SigGetSize(const CSR_SIGNAL *aSignal);
127
128#endif /* __CSR_WIFI_HIP_SIGNALS_H__ */
diff --git a/drivers/staging/csr/csr_wifi_hip_sigs.h b/drivers/staging/csr/csr_wifi_hip_sigs.h
deleted file mode 100644
index 6112cc3e87fa..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_sigs.h
+++ /dev/null
@@ -1,1417 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13
14/* Generated by hip_dd_l_h_gen.pl */
15
16#ifndef CSR_WIFI_HIP_SIGS_H
17#define CSR_WIFI_HIP_SIGS_H
18
19typedef s16 csr_place_holding_type;
20
21typedef u16 CSR_ASSOCIATION_ID;
22
23typedef u16 CSR_AUTONOMOUS_SCAN_ID;
24
25typedef u16 CSR_BEACON_PERIODS;
26
27typedef u16 CSR_BLACKOUT_ID;
28
29typedef enum CSR_BLACKOUT_SOURCE
30{
31 CSR_DOT11_LOCAL = 0x0000,
32 CSR_DOT11_REMOTE = 0x0001,
33 CSR_OTHER_RADIO = 0x0002,
34 CSR_NOT_LINKED = 0x0004
35} CSR_BLACKOUT_SOURCE;
36
37typedef enum CSR_BLACKOUT_TYPE
38{
39 CSR_LOCAL_DEVICE_ONLY = 0x0001,
40 CSR_SPECIFIED_PEER = 0x0002,
41 CSR_CURRENT_CHANNEL = 0x0004,
42 CSR_P2P = 0x0008
43} CSR_BLACKOUT_TYPE;
44
45typedef enum CSR_BOOT_LOADER_OPERATION
46{
47 CSR_BOOT_LOADER_IDLE = 0x00,
48 CSR_BOOT_LOADER_RESTART = 0x01,
49 CSR_BOOT_LOADER_PATCH = 0x02,
50 CSR_BOOT_LOADER_IMAGE_0 = 0x10,
51 CSR_BOOT_LOADER_IMAGE_1 = 0x11,
52 CSR_BOOT_LOADER_IMAGE_2 = 0x12,
53 CSR_BOOT_LOADER_IMAGE_3 = 0x13
54} CSR_BOOT_LOADER_OPERATION;
55
56typedef u16 CSR_CAPABILITY_INFORMATION;
57
58typedef u16 CSR_CHANNEL_STARTING_FACTOR;
59
60typedef u32 CSR_CIPHER_SUITE_SELECTOR;
61
62typedef u32 CSR_CLIENT_TAG;
63
64typedef enum CSR_CONNECTION_STATUS
65{
66 CSR_DISCONNECTED = 0x0000,
67 CSR_CONNECTED_AWAKE = 0x0001
68} CSR_CONNECTION_STATUS;
69
70typedef s16 CSR_DECIBELS;
71
72typedef enum CSR_DIRECTION
73{
74 CSR_TRANSMIT = 0x0000,
75 CSR_RECEIVE = 0x0001,
76 CSR_BIDIRECTIONAL = 0x0003
77} CSR_DIRECTION;
78
79typedef enum CSR_FRAME_TYPE
80{
81 CSR_RESERVED = 0x0000,
82 CSR_BEACON = 0x0001,
83 CSR_PROBE_RESPONSE = 0x0002,
84 CSR_BEACON_AND_PROBE_RESPONSE = 0x0003,
85 CSR_PROBE_REQUEST = 0x0004
86} CSR_FRAME_TYPE;
87
88typedef u32 CSR_IPV4_ADDRESS;
89
90typedef enum CSR_IFINTERFACE
91{
92 CSR_INDEX_2G4 = 0x0001,
93 CSR_INDEX_5G = 0x0002
94} CSR_IFINTERFACE;
95
96typedef enum CSR_KEY_TYPE
97{
98 CSR_GROUP = 0x0000,
99 CSR_PAIRWISE = 0x0001,
100 CSR_PEER_KEY = 0x0002,
101 CSR_IGTK = 0x0003
102} CSR_KEY_TYPE;
103
104typedef enum CSR_LOADER_OPERATION
105{
106 CSR_LOADER_IDLE = 0x0000,
107 CSR_LOADER_COPY = 0x0001
108} CSR_LOADER_OPERATION;
109
110typedef struct CSR_MAC_ADDRESS
111{
112 u8 x[6];
113} CSR_MACADDRESS;
114
115typedef enum CSR_MIB_STATUS
116{
117 CSR_MIB_SUCCESSFUL = 0x0000,
118 CSR_MIB_INVALID_PARAMETERS = 0x0001,
119 CSR_MIB_WRITE_ONLY = 0x0002,
120 CSR_MIB_READ_ONLY = 0x0003
121} CSR_MIB_STATUS;
122
123typedef enum CSR_MEMORY_SPACE
124{
125 CSR_NONE = 0x00,
126 CSR_SHARED_DATA_MEMORY = 0x01,
127 CSR_EXTERNAL_FLASH_MEMORY = 0x02,
128 CSR_EXTERNAL_SRAM = 0x03,
129 CSR_REGISTERS = 0x04,
130 CSR_PHY_PROCESSOR_DATA_MEMORY = 0x10,
131 CSR_PHY_PROCESSOR_PROGRAM_MEMORY = 0x11,
132 CSR_PHY_PROCESSOR_ROM = 0x12,
133 CSR_MAC_PROCESSOR_DATA_MEMORY = 0x20,
134 CSR_MAC_PROCESSOR_PROGRAM_MEMORY = 0x21,
135 CSR_MAC_PROCESSOR_ROM = 0x22,
136 CSR_BT_PROCESSOR_DATA_MEMORY = 0x30,
137 CSR_BT_PROCESSOR_PROGRAM_MEMORY = 0x31,
138 CSR_BT_PROCESSOR_ROM = 0x32
139} CSR_MEMORY_SPACE;
140
141typedef u16 CSR_MICROSECONDS16;
142
143typedef u32 CSR_MICROSECONDS32;
144
145typedef u16 CSR_NATURAL16;
146
147typedef enum CSR_PS_SCHEME
148{
149 CSR_LEGACY_PS = 0x0001,
150 CSR_U_APSD = 0x0002,
151 CSR_S_APSD = 0x0004
152} CSR_PS_SCHEME;
153
154typedef enum CSR_PACKET_FILTER_MODE
155{
156 CSR_PFM_OPT_OUT = 0x0000,
157 CSR_PFM_OPT_IN = 0x0003
158} CSR_PACKET_FILTER_MODE;
159
160typedef u16 CSR_PERIODIC_ID;
161
162typedef enum CSR_PERIODIC_SCHEDULING_MODE
163{
164 CSR_PSM_PERIODIC_SCHEDULE_PS_POLL = 0x0001,
165 CSR_PSM_PERIODIC_SCHEDULE_PM_BIT = 0x0002,
166 CSR_PSM_PERIODIC_SCHEDULE_UAPSD = 0x0004,
167 CSR_PSM_PERIODIC_SCHEDULE_SAPSD = 0x0008
168} CSR_PERIODIC_SCHEDULING_MODE;
169
170typedef enum CSR_POWER_MANAGEMENT_MODE
171{
172 CSR_PMM_ACTIVE_MODE = 0x0000,
173 CSR_PMM_POWER_SAVE = 0x0001,
174 CSR_PMM_FAST_POWER_SAVE = 0x0002
175} CSR_POWER_MANAGEMENT_MODE;
176
177typedef enum CSR_PRIORITY
178{
179 CSR_QOS_UP0 = 0x0000,
180 CSR_QOS_UP1 = 0x0001,
181 CSR_QOS_UP2 = 0x0002,
182 CSR_QOS_UP3 = 0x0003,
183 CSR_QOS_UP4 = 0x0004,
184 CSR_QOS_UP5 = 0x0005,
185 CSR_QOS_UP6 = 0x0006,
186 CSR_QOS_UP7 = 0x0007,
187 CSR_CONTENTION = 0x8000,
188 CSR_MANAGEMENT = 0x8010
189} CSR_PRIORITY;
190
191typedef enum CSR_REASON_CODE
192{
193 CSR_UNSPECIFIED_REASON = 0x0001,
194 CSR_INVALID_INFORMATION_ELEMENT = 0x000d,
195 CSR_QOS_UNSPECIFIED_REASON = 0x0020,
196 CSR_QOS_EXCESSIVE_NOT_ACK = 0x0022,
197 CSR_QOS_TXOP_LIMIT_EXCEEDED = 0x0023,
198 CSR_QSTA_LEAVING = 0x0024,
199 CSR_UNKNOWN_BA = 0x0026,
200 CSR_UNKNOWN_TS = 0x0026,
201 CSR_TIMEOUT = 0x0027
202} CSR_REASON_CODE;
203
204typedef enum CSR_RECEPTION_STATUS
205{
206 CSR_RX_SUCCESS = 0x0000,
207 CSR_RX_FAILURE_UNSPECIFIED = 0x0001,
208 CSR_MICHAEL_MIC_ERROR = 0x0002,
209 CSR_DECRYPTION_ERROR = 0x0003,
210 CSR_NO_TEMPORAL_KEY_AVAILABLE = 0x0004,
211 CSR_UNSUPPORTED_MODULATION = 0x0011,
212 CSR_BAD_FCS = 0x0012,
213 CSR_BAD_SIGNAL = 0x0013
214} CSR_RECEPTION_STATUS;
215
216typedef enum CSR_RESULT_CODE
217{
218 CSR_RC_SUCCESS = 0x0000,
219 CSR_RC_UNSPECIFIED_FAILURE = 0x0001,
220 CSR_RC_REFUSED = 0x0003,
221 CSR_RC_INVALID_PARAMETERS = 0x0026,
222 CSR_RC_REJECTED_INVALID_IE = 0x0028,
223 CSR_RC_REJECTED_INVALID_GROUP_CIPHER = 0x0029,
224 CSR_RC_REJECTED_INVALID_PAIRWISE_CIPHER = 0x002a,
225 CSR_RC_TIMEOUT = 0x8000,
226 CSR_RC_TOO_MANY_SIMULTANEOUS_REQUESTS = 0x8001,
227 CSR_RC_BSS_ALREADY_STARTED_OR_JOINED = 0x8002,
228 CSR_RC_NOT_SUPPORTED = 0x8003,
229 CSR_RC_TRANSMISSION_FAILURE = 0x8004,
230 CSR_RC_RESET_REQUIRED_BEFORE_START = 0x8006,
231 CSR_RC_INSUFFICIENT_RESOURCE = 0x8007,
232 CSR_RC_NO_BUFFERED_BROADCAST_MULTICAST_FRAMES = 0x8008,
233 CSR_RC_INVALID_UNICAST_CIPHER = 0xf02f,
234 CSR_RC_INVALID_MULTICAST_CIPHER = 0xf030
235} CSR_RESULT_CODE;
236
237typedef enum CSR_SCAN_TYPE
238{
239 CSR_SC_ACTIVE_SCAN = 0x0000,
240 CSR_SC_PASSIVE_SCAN = 0x0001
241} CSR_SCAN_TYPE;
242
243typedef enum CSR_SIGNAL_ID
244{
245 CSR_MA_PACKET_REQUEST_ID = 0x0110,
246 CSR_MA_PACKET_CONFIRM_ID = 0x0111,
247 CSR_MA_PACKET_INDICATION_ID = 0x0113,
248 CSR_MA_PACKET_CANCEL_REQUEST_ID = 0x0114,
249 CSR_MA_VIF_AVAILABILITY_RESPONSE_ID = 0x0116,
250 CSR_MA_VIF_AVAILABILITY_INDICATION_ID = 0x0117,
251 CSR_MA_PACKET_ERROR_INDICATION_ID = 0x011b,
252 CSR_MLME_RESET_REQUEST_ID = 0x0200,
253 CSR_MLME_RESET_CONFIRM_ID = 0x0201,
254 CSR_MLME_GET_REQUEST_ID = 0x0204,
255 CSR_MLME_GET_CONFIRM_ID = 0x0205,
256 CSR_MLME_SET_REQUEST_ID = 0x0208,
257 CSR_MLME_SET_CONFIRM_ID = 0x0209,
258 CSR_MLME_GET_NEXT_REQUEST_ID = 0x020c,
259 CSR_MLME_GET_NEXT_CONFIRM_ID = 0x020d,
260 CSR_MLME_POWERMGT_REQUEST_ID = 0x0210,
261 CSR_MLME_POWERMGT_CONFIRM_ID = 0x0211,
262 CSR_MLME_SCAN_REQUEST_ID = 0x0214,
263 CSR_MLME_SCAN_CONFIRM_ID = 0x0215,
264 CSR_MLME_HL_SYNC_REQUEST_ID = 0x0244,
265 CSR_MLME_HL_SYNC_CONFIRM_ID = 0x0245,
266 CSR_MLME_MEASURE_REQUEST_ID = 0x0258,
267 CSR_MLME_MEASURE_CONFIRM_ID = 0x0259,
268 CSR_MLME_MEASURE_INDICATION_ID = 0x025b,
269 CSR_MLME_SETKEYS_REQUEST_ID = 0x0268,
270 CSR_MLME_SETKEYS_CONFIRM_ID = 0x0269,
271 CSR_MLME_DELETEKEYS_REQUEST_ID = 0x026c,
272 CSR_MLME_DELETEKEYS_CONFIRM_ID = 0x026d,
273 CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION_ID = 0x0287,
274 CSR_MLME_CONNECTED_INDICATION_ID = 0x028b,
275 CSR_MLME_SCAN_CANCEL_REQUEST_ID = 0x028c,
276 CSR_MLME_HL_SYNC_CANCEL_REQUEST_ID = 0x0298,
277 CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID = 0x0299,
278 CSR_MLME_ADD_PERIODIC_REQUEST_ID = 0x02a0,
279 CSR_MLME_ADD_PERIODIC_CONFIRM_ID = 0x02a1,
280 CSR_MLME_DEL_PERIODIC_REQUEST_ID = 0x02a4,
281 CSR_MLME_DEL_PERIODIC_CONFIRM_ID = 0x02a5,
282 CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST_ID = 0x02a8,
283 CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID = 0x02a9,
284 CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST_ID = 0x02ac,
285 CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID = 0x02ad,
286 CSR_MLME_SET_PACKET_FILTER_REQUEST_ID = 0x02b8,
287 CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID = 0x02b9,
288 CSR_MLME_STOP_MEASURE_REQUEST_ID = 0x02bc,
289 CSR_MLME_STOP_MEASURE_CONFIRM_ID = 0x02bd,
290 CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST_ID = 0x02cc,
291 CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID = 0x02cd,
292 CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION_ID = 0x02db,
293 CSR_MLME_ADD_TRIGGERED_GET_REQUEST_ID = 0x02dc,
294 CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID = 0x02dd,
295 CSR_MLME_DEL_TRIGGERED_GET_REQUEST_ID = 0x02e0,
296 CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID = 0x02e1,
297 CSR_MLME_TRIGGERED_GET_INDICATION_ID = 0x02e7,
298 CSR_MLME_ADD_BLACKOUT_REQUEST_ID = 0x02f8,
299 CSR_MLME_ADD_BLACKOUT_CONFIRM_ID = 0x02f9,
300 CSR_MLME_BLACKOUT_ENDED_INDICATION_ID = 0x02fb,
301 CSR_MLME_DEL_BLACKOUT_REQUEST_ID = 0x02fc,
302 CSR_MLME_DEL_BLACKOUT_CONFIRM_ID = 0x02fd,
303 CSR_MLME_ADD_RX_TRIGGER_REQUEST_ID = 0x0304,
304 CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID = 0x0305,
305 CSR_MLME_DEL_RX_TRIGGER_REQUEST_ID = 0x0308,
306 CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID = 0x0309,
307 CSR_MLME_CONNECT_STATUS_REQUEST_ID = 0x0310,
308 CSR_MLME_CONNECT_STATUS_CONFIRM_ID = 0x0311,
309 CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST_ID = 0x0314,
310 CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID = 0x0315,
311 CSR_MLME_ADD_TEMPLATE_REQUEST_ID = 0x0318,
312 CSR_MLME_ADD_TEMPLATE_CONFIRM_ID = 0x0319,
313 CSR_MLME_CONFIG_QUEUE_REQUEST_ID = 0x031c,
314 CSR_MLME_CONFIG_QUEUE_CONFIRM_ID = 0x031d,
315 CSR_MLME_ADD_TSPEC_REQUEST_ID = 0x0320,
316 CSR_MLME_ADD_TSPEC_CONFIRM_ID = 0x0321,
317 CSR_MLME_DEL_TSPEC_REQUEST_ID = 0x0324,
318 CSR_MLME_DEL_TSPEC_CONFIRM_ID = 0x0325,
319 CSR_MLME_START_AGGREGATION_REQUEST_ID = 0x0328,
320 CSR_MLME_START_AGGREGATION_CONFIRM_ID = 0x0329,
321 CSR_MLME_BLOCKACK_ERROR_INDICATION_ID = 0x032b,
322 CSR_MLME_STOP_AGGREGATION_REQUEST_ID = 0x032c,
323 CSR_MLME_STOP_AGGREGATION_CONFIRM_ID = 0x032d,
324 CSR_MLME_SM_START_REQUEST_ID = 0x0334,
325 CSR_MLME_SM_START_CONFIRM_ID = 0x0335,
326 CSR_MLME_LEAVE_REQUEST_ID = 0x0338,
327 CSR_MLME_LEAVE_CONFIRM_ID = 0x0339,
328 CSR_MLME_SET_TIM_REQUEST_ID = 0x033c,
329 CSR_MLME_SET_TIM_CONFIRM_ID = 0x033d,
330 CSR_MLME_GET_KEY_SEQUENCE_REQUEST_ID = 0x0340,
331 CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID = 0x0341,
332 CSR_MLME_SET_CHANNEL_REQUEST_ID = 0x034c,
333 CSR_MLME_SET_CHANNEL_CONFIRM_ID = 0x034d,
334 CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST_ID = 0x040c,
335 CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID = 0x040d,
336 CSR_DEBUG_STRING_INDICATION_ID = 0x0803,
337 CSR_DEBUG_WORD16_INDICATION_ID = 0x0807,
338 CSR_DEBUG_GENERIC_REQUEST_ID = 0x0808,
339 CSR_DEBUG_GENERIC_CONFIRM_ID = 0x0809,
340 CSR_DEBUG_GENERIC_INDICATION_ID = 0x080b
341} CSR_SIGNAL_ID;
342
343typedef u16 CSR_SIMPLE_POINTER;
344
345typedef u16 CSR_STARTING_SEQUENCE_NUMBER;
346
347typedef enum CSR_SYMBOL_ID
348{
349 CSR_SLT_END = 0x0000,
350 CSR_SLT_PCI_SLOT_CONFIG = 0x0001,
351 CSR_SLT_SDIO_SLOT_CONFIG = 0x0002,
352 CSR_SLT_BUILD_ID_NUMBER = 0x0003,
353 CSR_SLT_BUILD_ID_STRING = 0x0004,
354 CSR_SLT_PERSISTENT_STORE_DB = 0x0005,
355 CSR_SLT_RESET_VECTOR_PHY = 0x0006,
356 CSR_SLT_RESET_VECTOR_MAC = 0x0007,
357 CSR_SLT_SDIO_LOADER_CONTROL = 0x0008,
358 CSR_SLT_TEST_CMD = 0x0009,
359 CSR_SLT_TEST_ALIVE_COUNTER = 0x000a,
360 CSR_SLT_TEST_PARAMETERS = 0x000b,
361 CSR_SLT_TEST_RESULTS = 0x000c,
362 CSR_SLT_TEST_VERSION = 0x000d,
363 CSR_SLT_MIB_PSID_RANGES = 0x000e,
364 CSR_SLT_KIP_TABLE = 0x000f,
365 CSR_SLT_PANIC_DATA_PHY = 0x0010,
366 CSR_SLT_PANIC_DATA_MAC = 0x0011,
367 CSR_SLT_BOOT_LOADER_CONTROL = 0x0012,
368 CSR_SLT_SOFT_MAC = 0x0013
369} CSR_SYMBOL_ID;
370
371typedef struct CSR_TSF_TIME
372{
373 u8 x[8];
374} CSR_TSF_TIME;
375
376typedef u16 CSR_TIME_UNITS;
377
378typedef enum CSR_TRANSMISSION_CONTROL
379{
380 CSR_TRIGGERED = 0x0001,
381 CSR_END_OF_SERVICE = 0x0002,
382 CSR_NO_CONFIRM_REQUIRED = 0x0004,
383 CSR_ALLOW_BA = 0x0008
384} CSR_TRANSMISSION_CONTROL;
385
386typedef enum CSR_TRANSMISSION_STATUS
387{
388 CSR_TX_SUCCESSFUL = 0x0000,
389 CSR_TX_RETRY_LIMIT = 0x0001,
390 CSR_TX_LIFETIME = 0x0002,
391 CSR_TX_NO_BSS = 0x0003,
392 CSR_TX_EXCESSIVE_DATA_LENGTH = 0x0004,
393 CSR_TX_UNSUPPORTED_PRIORITY = 0x0006,
394 CSR_TX_UNAVAILABLE_PRIORITY = 0x0007,
395 CSR_TX_UNAVAILABLE_KEY_MAPPING = 0x000a,
396 CSR_TX_EDCA_TIMEOUT = 0x000b,
397 CSR_TX_BLOCK_ACK_TIMEOUT = 0x000c,
398 CSR_TX_FAIL_TRANSMISSION_VIF_INTERRUPTED = 0x000d,
399 CSR_TX_REJECTED_PEER_STATION_SLEEPING = 0x000e,
400 CSR_TX_REJECTED_DTIM_ENDED = 0x000f,
401 CSR_TX_REJECTED_DTIM_STARTED = 0x0010
402} CSR_TRANSMISSION_STATUS;
403
404typedef u16 CSR_TRIGGER_ID;
405
406typedef u16 CSR_TRIGGERED_ID;
407
408typedef enum CSR_HIP_VERSIONS
409{
410 CSR_HIP_ENG_VERSION = 0x0001,
411 CSR_HIP_VERSION = 0x0900
412} CSR_HIP_VERSIONS;
413
414typedef u16 CSR_BUFFER_HANDLE;
415
416typedef u16 CSR_CHANNEL_NUMBER;
417
418typedef struct CSR_DATA_REFERENCE
419{
420 u16 SlotNumber;
421 u16 DataLength;
422} CSR_DATAREF;
423
424typedef u16 CSR_DIALOG_TOKEN;
425
426typedef struct CSR_GENERIC_POINTER
427{
428 u32 MemoryOffset;
429 CSR_MEMORY_SPACE MemorySpace;
430} CSR_GENERIC_POINTER;
431
432typedef struct CSR_MLME_CONFIG_QUEUE_CONFIRM
433{
434 CSR_DATAREF Dummydataref1;
435 CSR_DATAREF Dummydataref2;
436 CSR_RESULT_CODE ResultCode;
437} CSR_MLME_CONFIG_QUEUE_CONFIRM;
438
439typedef struct CSR_MLME_CONFIG_QUEUE_REQUEST
440{
441 CSR_DATAREF Dummydataref1;
442 CSR_DATAREF Dummydataref2;
443 CSR_NATURAL16 QueueIndex;
444 CSR_NATURAL16 Aifs;
445 CSR_NATURAL16 Cwmin;
446 CSR_NATURAL16 Cwmax;
447 CSR_NATURAL16 TxopLimit;
448} CSR_MLME_CONFIG_QUEUE_REQUEST;
449
450typedef struct CSR_MLME_GET_CONFIRM
451{
452 CSR_DATAREF MibAttributeValue;
453 CSR_DATAREF Dummydataref2;
454 CSR_MIB_STATUS Status;
455 CSR_NATURAL16 ErrorIndex;
456} CSR_MLME_GET_CONFIRM;
457
458typedef struct CSR_MLME_GET_REQUEST
459{
460 CSR_DATAREF MibAttribute;
461 CSR_DATAREF Dummydataref2;
462} CSR_MLME_GET_REQUEST;
463
464typedef struct CSR_MLME_GET_NEXT_CONFIRM
465{
466 CSR_DATAREF MibAttributeValue;
467 CSR_DATAREF Dummydataref2;
468 CSR_MIB_STATUS Status;
469 CSR_NATURAL16 ErrorIndex;
470} CSR_MLME_GET_NEXT_CONFIRM;
471
472typedef struct CSR_MLME_GET_NEXT_REQUEST
473{
474 CSR_DATAREF MibAttribute;
475 CSR_DATAREF Dummydataref2;
476} CSR_MLME_GET_NEXT_REQUEST;
477
478typedef struct CSR_MLME_HL_SYNC_CONFIRM
479{
480 CSR_DATAREF Dummydataref1;
481 CSR_DATAREF Dummydataref2;
482 CSR_MACADDRESS GroupAddress;
483 CSR_RESULT_CODE ResultCode;
484} CSR_MLME_HL_SYNC_CONFIRM;
485
486typedef struct CSR_MLME_HL_SYNC_REQUEST
487{
488 CSR_DATAREF Dummydataref1;
489 CSR_DATAREF Dummydataref2;
490 CSR_MACADDRESS GroupAddress;
491} CSR_MLME_HL_SYNC_REQUEST;
492
493typedef struct CSR_MLME_HL_SYNC_CANCEL_CONFIRM
494{
495 CSR_DATAREF Dummydataref1;
496 CSR_DATAREF Dummydataref2;
497 CSR_RESULT_CODE ResultCode;
498} CSR_MLME_HL_SYNC_CANCEL_CONFIRM;
499
500typedef struct CSR_MLME_HL_SYNC_CANCEL_REQUEST
501{
502 CSR_DATAREF Dummydataref1;
503 CSR_DATAREF Dummydataref2;
504 CSR_MACADDRESS GroupAddress;
505} CSR_MLME_HL_SYNC_CANCEL_REQUEST;
506
507typedef struct CSR_MLME_MEASURE_CONFIRM
508{
509 CSR_DATAREF Dummydataref1;
510 CSR_DATAREF Dummydataref2;
511 CSR_RESULT_CODE ResultCode;
512 CSR_DIALOG_TOKEN DialogToken;
513} CSR_MLME_MEASURE_CONFIRM;
514
515typedef struct CSR_MLME_MEASURE_INDICATION
516{
517 CSR_DATAREF MeasurementReportSet;
518 CSR_DATAREF Dummydataref2;
519 CSR_DIALOG_TOKEN DialogToken;
520} CSR_MLME_MEASURE_INDICATION;
521
522typedef struct CSR_MLME_MEASURE_REQUEST
523{
524 CSR_DATAREF MeasurementRequestSet;
525 CSR_DATAREF Dummydataref2;
526 CSR_DIALOG_TOKEN DialogToken;
527} CSR_MLME_MEASURE_REQUEST;
528
529typedef struct CSR_MLME_RESET_CONFIRM
530{
531 CSR_DATAREF Dummydataref1;
532 CSR_DATAREF Dummydataref2;
533 CSR_RESULT_CODE ResultCode;
534} CSR_MLME_RESET_CONFIRM;
535
536typedef struct CSR_MLME_RESET_REQUEST
537{
538 CSR_DATAREF Dummydataref1;
539 CSR_DATAREF Dummydataref2;
540 CSR_MACADDRESS StaAddress;
541 s16 SetDefaultMib;
542} CSR_MLME_RESET_REQUEST;
543
544typedef struct CSR_MLME_SET_CONFIRM
545{
546 CSR_DATAREF MibAttributeValue;
547 CSR_DATAREF Dummydataref2;
548 CSR_MIB_STATUS Status;
549 CSR_NATURAL16 ErrorIndex;
550} CSR_MLME_SET_CONFIRM;
551
552typedef struct CSR_MLME_SET_REQUEST
553{
554 CSR_DATAREF MibAttributeValue;
555 CSR_DATAREF Dummydataref2;
556} CSR_MLME_SET_REQUEST;
557
558typedef struct CSR_MLME_STOP_MEASURE_CONFIRM
559{
560 CSR_DATAREF Dummydataref1;
561 CSR_DATAREF Dummydataref2;
562 CSR_RESULT_CODE ResultCode;
563 CSR_DIALOG_TOKEN DialogToken;
564} CSR_MLME_STOP_MEASURE_CONFIRM;
565
566typedef struct CSR_MLME_STOP_MEASURE_REQUEST
567{
568 CSR_DATAREF Dummydataref1;
569 CSR_DATAREF Dummydataref2;
570 CSR_DIALOG_TOKEN DialogToken;
571} CSR_MLME_STOP_MEASURE_REQUEST;
572
573typedef u16 CSR_PROCESS_ID;
574
575typedef u16 CSR_RATE;
576
577typedef u16 CSR_SEQUENCE_NUMBER;
578
579typedef struct CSR_SIGNAL_PRIMITIVE_HEADER
580{
581 s16 SignalId;
582 CSR_PROCESS_ID ReceiverProcessId;
583 CSR_PROCESS_ID SenderProcessId;
584} CSR_SIGNAL_PRIMITIVE_HEADER;
585
586typedef u16 CSR_TRAFFIC_WINDOW;
587
588typedef u16 CSR_VIF_IDENTIFIER;
589
590typedef struct CSR_DEBUG_GENERIC_CONFIRM
591{
592 CSR_DATAREF DebugVariable;
593 CSR_DATAREF Dummydataref2;
594 CSR_NATURAL16 DebugWords[8];
595} CSR_DEBUG_GENERIC_CONFIRM;
596
597typedef struct CSR_DEBUG_GENERIC_INDICATION
598{
599 CSR_DATAREF DebugVariable;
600 CSR_DATAREF Dummydataref2;
601 CSR_NATURAL16 DebugWords[8];
602} CSR_DEBUG_GENERIC_INDICATION;
603
604typedef struct CSR_DEBUG_GENERIC_REQUEST
605{
606 CSR_DATAREF DebugVariable;
607 CSR_DATAREF Dummydataref2;
608 CSR_NATURAL16 DebugWords[8];
609} CSR_DEBUG_GENERIC_REQUEST;
610
611typedef struct CSR_DEBUG_STRING_INDICATION
612{
613 CSR_DATAREF DebugMessage;
614 CSR_DATAREF Dummydataref2;
615} CSR_DEBUG_STRING_INDICATION;
616
617typedef struct CSR_DEBUG_WORD16_INDICATION
618{
619 CSR_DATAREF Dummydataref1;
620 CSR_DATAREF Dummydataref2;
621 CSR_NATURAL16 DebugWords[16];
622} CSR_DEBUG_WORD16_INDICATION;
623
624typedef struct CSR_MA_PACKET_CONFIRM
625{
626 CSR_DATAREF Dummydataref1;
627 CSR_DATAREF Dummydataref2;
628 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
629 CSR_TRANSMISSION_STATUS TransmissionStatus;
630 CSR_NATURAL16 RetryCount;
631 CSR_RATE Rate;
632 CSR_CLIENT_TAG HostTag;
633} CSR_MA_PACKET_CONFIRM;
634
635typedef struct CSR_MA_PACKET_INDICATION
636{
637 CSR_DATAREF Data;
638 CSR_DATAREF Dummydataref2;
639 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
640 CSR_TSF_TIME LocalTime;
641 CSR_IFINTERFACE Ifindex;
642 CSR_CHANNEL_NUMBER Channel;
643 CSR_RECEPTION_STATUS ReceptionStatus;
644 CSR_DECIBELS Rssi;
645 CSR_DECIBELS Snr;
646 CSR_RATE ReceivedRate;
647} CSR_MA_PACKET_INDICATION;
648
649typedef struct CSR_MA_PACKET_REQUEST
650{
651 CSR_DATAREF Data;
652 CSR_DATAREF Dummydataref2;
653 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
654 CSR_RATE TransmitRate;
655 CSR_CLIENT_TAG HostTag;
656 CSR_PRIORITY Priority;
657 CSR_MACADDRESS Ra;
658 CSR_TRANSMISSION_CONTROL TransmissionControl;
659} CSR_MA_PACKET_REQUEST;
660
661typedef struct CSR_MA_PACKET_CANCEL_REQUEST
662{
663 CSR_DATAREF Dummydataref1;
664 CSR_DATAREF Dummydataref2;
665 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
666 CSR_CLIENT_TAG HostTag;
667} CSR_MA_PACKET_CANCEL_REQUEST;
668
669typedef struct CSR_MA_PACKET_ERROR_INDICATION
670{
671 CSR_DATAREF Dummydataref1;
672 CSR_DATAREF Dummydataref2;
673 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
674 CSR_MACADDRESS PeerQstaAddress;
675 CSR_PRIORITY UserPriority;
676 CSR_SEQUENCE_NUMBER SequenceNumber;
677} CSR_MA_PACKET_ERROR_INDICATION;
678
679typedef struct CSR_MA_VIF_AVAILABILITY_INDICATION
680{
681 CSR_DATAREF Dummydataref1;
682 CSR_DATAREF Dummydataref2;
683 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
684 s16 Multicast;
685} CSR_MA_VIF_AVAILABILITY_INDICATION;
686
687typedef struct CSR_MA_VIF_AVAILABILITY_RESPONSE
688{
689 CSR_DATAREF Dummydataref1;
690 CSR_DATAREF Dummydataref2;
691 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
692 CSR_RESULT_CODE ResultCode;
693} CSR_MA_VIF_AVAILABILITY_RESPONSE;
694
695typedef struct CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM
696{
697 CSR_DATAREF Dummydataref1;
698 CSR_DATAREF Dummydataref2;
699 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
700 CSR_RESULT_CODE ResultCode;
701 CSR_AUTONOMOUS_SCAN_ID AutonomousScanId;
702} CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM;
703
704typedef struct CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST
705{
706 CSR_DATAREF ChannelList;
707 CSR_DATAREF InformationElements;
708 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
709 CSR_AUTONOMOUS_SCAN_ID AutonomousScanId;
710 CSR_IFINTERFACE Ifindex;
711 CSR_CHANNEL_STARTING_FACTOR ChannelStartingFactor;
712 CSR_SCAN_TYPE ScanType;
713 CSR_MICROSECONDS32 ProbeDelay;
714 CSR_TIME_UNITS MinChannelTime;
715 CSR_TIME_UNITS MaxChannelTime;
716} CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST;
717
718typedef struct CSR_MLME_ADD_BLACKOUT_CONFIRM
719{
720 CSR_DATAREF Dummydataref1;
721 CSR_DATAREF Dummydataref2;
722 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
723 CSR_BLACKOUT_ID BlackoutId;
724 CSR_RESULT_CODE ResultCode;
725} CSR_MLME_ADD_BLACKOUT_CONFIRM;
726
727typedef struct CSR_MLME_ADD_BLACKOUT_REQUEST
728{
729 CSR_DATAREF Dummydataref1;
730 CSR_DATAREF Dummydataref2;
731 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
732 CSR_BLACKOUT_ID BlackoutId;
733 CSR_BLACKOUT_TYPE BlackoutType;
734 CSR_BLACKOUT_SOURCE BlackoutSource;
735 CSR_MICROSECONDS32 BlackoutStartReference;
736 CSR_MICROSECONDS32 BlackoutPeriod;
737 CSR_MICROSECONDS32 BlackoutDuration;
738 CSR_MACADDRESS PeerStaAddress;
739 CSR_NATURAL16 BlackoutCount;
740} CSR_MLME_ADD_BLACKOUT_REQUEST;
741
742typedef struct CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM
743{
744 CSR_DATAREF Dummydataref1;
745 CSR_DATAREF Dummydataref2;
746 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
747 CSR_RESULT_CODE ResultCode;
748} CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM;
749
750typedef struct CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST
751{
752 CSR_DATAREF Data;
753 CSR_DATAREF Dummydataref2;
754 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
755 CSR_NATURAL16 NumberOfMulticastGroupAddresses;
756} CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST;
757
758typedef struct CSR_MLME_ADD_PERIODIC_CONFIRM
759{
760 CSR_DATAREF Dummydataref1;
761 CSR_DATAREF Dummydataref2;
762 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
763 CSR_PERIODIC_ID PeriodicId;
764 CSR_RESULT_CODE ResultCode;
765} CSR_MLME_ADD_PERIODIC_CONFIRM;
766
767typedef struct CSR_MLME_ADD_PERIODIC_REQUEST
768{
769 CSR_DATAREF Dummydataref1;
770 CSR_DATAREF Dummydataref2;
771 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
772 CSR_PERIODIC_ID PeriodicId;
773 CSR_MICROSECONDS32 MaximumLatency;
774 CSR_PERIODIC_SCHEDULING_MODE PeriodicSchedulingMode;
775 s16 WakeHost;
776 CSR_PRIORITY UserPriority;
777} CSR_MLME_ADD_PERIODIC_REQUEST;
778
779typedef struct CSR_MLME_ADD_RX_TRIGGER_CONFIRM
780{
781 CSR_DATAREF Dummydataref1;
782 CSR_DATAREF Dummydataref2;
783 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
784 CSR_TRIGGER_ID TriggerId;
785 CSR_RESULT_CODE ResultCode;
786} CSR_MLME_ADD_RX_TRIGGER_CONFIRM;
787
788typedef struct CSR_MLME_ADD_RX_TRIGGER_REQUEST
789{
790 CSR_DATAREF InformationElements;
791 CSR_DATAREF Dummydataref2;
792 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
793 CSR_TRIGGER_ID TriggerId;
794 CSR_PRIORITY Priority;
795} CSR_MLME_ADD_RX_TRIGGER_REQUEST;
796
797typedef struct CSR_MLME_ADD_TEMPLATE_CONFIRM
798{
799 CSR_DATAREF Dummydataref1;
800 CSR_DATAREF Dummydataref2;
801 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
802 CSR_FRAME_TYPE FrameType;
803 CSR_RESULT_CODE ResultCode;
804} CSR_MLME_ADD_TEMPLATE_CONFIRM;
805
806typedef struct CSR_MLME_ADD_TEMPLATE_REQUEST
807{
808 CSR_DATAREF Data1;
809 CSR_DATAREF Data2;
810 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
811 CSR_FRAME_TYPE FrameType;
812 CSR_RATE MinTransmitRate;
813} CSR_MLME_ADD_TEMPLATE_REQUEST;
814
815typedef struct CSR_MLME_ADD_TRIGGERED_GET_CONFIRM
816{
817 CSR_DATAREF Dummydataref1;
818 CSR_DATAREF Dummydataref2;
819 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
820 CSR_RESULT_CODE ResultCode;
821 CSR_TRIGGERED_ID TriggeredId;
822} CSR_MLME_ADD_TRIGGERED_GET_CONFIRM;
823
824typedef struct CSR_MLME_ADD_TRIGGERED_GET_REQUEST
825{
826 CSR_DATAREF MibAttribute;
827 CSR_DATAREF Dummydataref2;
828 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
829 CSR_TRIGGERED_ID TriggeredId;
830} CSR_MLME_ADD_TRIGGERED_GET_REQUEST;
831
832typedef struct CSR_MLME_ADD_TSPEC_CONFIRM
833{
834 CSR_DATAREF Dummydataref1;
835 CSR_DATAREF Dummydataref2;
836 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
837 CSR_PRIORITY UserPriority;
838 CSR_RESULT_CODE ResultCode;
839} CSR_MLME_ADD_TSPEC_CONFIRM;
840
841typedef struct CSR_MLME_ADD_TSPEC_REQUEST
842{
843 CSR_DATAREF Dummydataref1;
844 CSR_DATAREF Dummydataref2;
845 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
846 CSR_PRIORITY UserPriority;
847 CSR_DIRECTION Direction;
848 CSR_PS_SCHEME PsScheme;
849 CSR_NATURAL16 MediumTime;
850 CSR_MICROSECONDS32 ServiceStartTime;
851 CSR_MICROSECONDS32 ServiceInterval;
852 CSR_RATE MinimumDataRate;
853} CSR_MLME_ADD_TSPEC_REQUEST;
854
855typedef struct CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION
856{
857 CSR_DATAREF Dummydataref1;
858 CSR_DATAREF Dummydataref2;
859 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
860 CSR_RESULT_CODE ResultCode;
861 CSR_AUTONOMOUS_SCAN_ID AutonomousScanId;
862} CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION;
863
864typedef struct CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION
865{
866 CSR_DATAREF Dummydataref1;
867 CSR_DATAREF Dummydataref2;
868 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
869 CSR_MACADDRESS Bssid;
870} CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION;
871
872typedef struct CSR_MLME_BLACKOUT_ENDED_INDICATION
873{
874 CSR_DATAREF Dummydataref1;
875 CSR_DATAREF Dummydataref2;
876 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
877 CSR_BLACKOUT_ID BlackoutId;
878} CSR_MLME_BLACKOUT_ENDED_INDICATION;
879
880typedef struct CSR_MLME_BLOCKACK_ERROR_INDICATION
881{
882 CSR_DATAREF Dummydataref1;
883 CSR_DATAREF Dummydataref2;
884 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
885 CSR_REASON_CODE ResultCode;
886 CSR_MACADDRESS PeerQstaAddress;
887} CSR_MLME_BLOCKACK_ERROR_INDICATION;
888
889typedef struct CSR_MLME_CONNECTED_INDICATION
890{
891 CSR_DATAREF Dummydataref1;
892 CSR_DATAREF Dummydataref2;
893 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
894 CSR_CONNECTION_STATUS ConnectionStatus;
895 CSR_MACADDRESS PeerMacAddress;
896} CSR_MLME_CONNECTED_INDICATION;
897
898typedef struct CSR_MLME_CONNECT_STATUS_CONFIRM
899{
900 CSR_DATAREF Dummydataref1;
901 CSR_DATAREF Dummydataref2;
902 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
903 CSR_RESULT_CODE ResultCode;
904} CSR_MLME_CONNECT_STATUS_CONFIRM;
905
906typedef struct CSR_MLME_CONNECT_STATUS_REQUEST
907{
908 CSR_DATAREF InformationElements;
909 CSR_DATAREF Dummydataref2;
910 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
911 CSR_CONNECTION_STATUS ConnectionStatus;
912 CSR_MACADDRESS StaAddress;
913 CSR_ASSOCIATION_ID AssociationId;
914 CSR_CAPABILITY_INFORMATION AssociationCapabilityInformation;
915} CSR_MLME_CONNECT_STATUS_REQUEST;
916
917typedef struct CSR_MLME_DELETEKEYS_CONFIRM
918{
919 CSR_DATAREF Dummydataref1;
920 CSR_DATAREF Dummydataref2;
921 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
922 CSR_RESULT_CODE ResultCode;
923} CSR_MLME_DELETEKEYS_CONFIRM;
924
925typedef struct CSR_MLME_DELETEKEYS_REQUEST
926{
927 CSR_DATAREF Dummydataref1;
928 CSR_DATAREF Dummydataref2;
929 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
930 CSR_NATURAL16 KeyId;
931 CSR_KEY_TYPE KeyType;
932 CSR_MACADDRESS Address;
933} CSR_MLME_DELETEKEYS_REQUEST;
934
935typedef struct CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM
936{
937 CSR_DATAREF Dummydataref1;
938 CSR_DATAREF Dummydataref2;
939 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
940 CSR_RESULT_CODE ResultCode;
941 CSR_AUTONOMOUS_SCAN_ID AutonomousScanId;
942} CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM;
943
944typedef struct CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST
945{
946 CSR_DATAREF Dummydataref1;
947 CSR_DATAREF Dummydataref2;
948 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
949 CSR_AUTONOMOUS_SCAN_ID AutonomousScanId;
950} CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST;
951
952typedef struct CSR_MLME_DEL_BLACKOUT_CONFIRM
953{
954 CSR_DATAREF Dummydataref1;
955 CSR_DATAREF Dummydataref2;
956 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
957 CSR_BLACKOUT_ID BlackoutId;
958 CSR_RESULT_CODE ResultCode;
959} CSR_MLME_DEL_BLACKOUT_CONFIRM;
960
961typedef struct CSR_MLME_DEL_BLACKOUT_REQUEST
962{
963 CSR_DATAREF Dummydataref1;
964 CSR_DATAREF Dummydataref2;
965 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
966 CSR_BLACKOUT_ID BlackoutId;
967} CSR_MLME_DEL_BLACKOUT_REQUEST;
968
969typedef struct CSR_MLME_DEL_PERIODIC_CONFIRM
970{
971 CSR_DATAREF Dummydataref1;
972 CSR_DATAREF Dummydataref2;
973 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
974 CSR_PERIODIC_ID PeriodicId;
975 CSR_RESULT_CODE ResultCode;
976} CSR_MLME_DEL_PERIODIC_CONFIRM;
977
978typedef struct CSR_MLME_DEL_PERIODIC_REQUEST
979{
980 CSR_DATAREF Dummydataref1;
981 CSR_DATAREF Dummydataref2;
982 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
983 CSR_PERIODIC_ID PeriodicId;
984} CSR_MLME_DEL_PERIODIC_REQUEST;
985
986typedef struct CSR_MLME_DEL_RX_TRIGGER_CONFIRM
987{
988 CSR_DATAREF Dummydataref1;
989 CSR_DATAREF Dummydataref2;
990 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
991 CSR_TRIGGER_ID TriggerId;
992 CSR_RESULT_CODE ResultCode;
993} CSR_MLME_DEL_RX_TRIGGER_CONFIRM;
994
995typedef struct CSR_MLME_DEL_RX_TRIGGER_REQUEST
996{
997 CSR_DATAREF Dummydataref1;
998 CSR_DATAREF Dummydataref2;
999 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1000 CSR_TRIGGER_ID TriggerId;
1001} CSR_MLME_DEL_RX_TRIGGER_REQUEST;
1002
1003typedef struct CSR_MLME_DEL_TRIGGERED_GET_CONFIRM
1004{
1005 CSR_DATAREF Dummydataref1;
1006 CSR_DATAREF Dummydataref2;
1007 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1008 CSR_RESULT_CODE ResultCode;
1009 CSR_TRIGGERED_ID TriggeredId;
1010} CSR_MLME_DEL_TRIGGERED_GET_CONFIRM;
1011
1012typedef struct CSR_MLME_DEL_TRIGGERED_GET_REQUEST
1013{
1014 CSR_DATAREF Dummydataref1;
1015 CSR_DATAREF Dummydataref2;
1016 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1017 CSR_TRIGGERED_ID TriggeredId;
1018} CSR_MLME_DEL_TRIGGERED_GET_REQUEST;
1019
1020typedef struct CSR_MLME_DEL_TSPEC_CONFIRM
1021{
1022 CSR_DATAREF Dummydataref1;
1023 CSR_DATAREF Dummydataref2;
1024 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1025 CSR_PRIORITY UserPriority;
1026 CSR_RESULT_CODE ResultCode;
1027} CSR_MLME_DEL_TSPEC_CONFIRM;
1028
1029typedef struct CSR_MLME_DEL_TSPEC_REQUEST
1030{
1031 CSR_DATAREF Dummydataref1;
1032 CSR_DATAREF Dummydataref2;
1033 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1034 CSR_PRIORITY UserPriority;
1035 CSR_DIRECTION Direction;
1036} CSR_MLME_DEL_TSPEC_REQUEST;
1037
1038typedef struct CSR_MLME_GET_KEY_SEQUENCE_CONFIRM
1039{
1040 CSR_DATAREF Dummydataref1;
1041 CSR_DATAREF Dummydataref2;
1042 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1043 CSR_RESULT_CODE ResultCode;
1044 CSR_NATURAL16 SequenceNumber[8];
1045} CSR_MLME_GET_KEY_SEQUENCE_CONFIRM;
1046
1047typedef struct CSR_MLME_GET_KEY_SEQUENCE_REQUEST
1048{
1049 CSR_DATAREF Dummydataref1;
1050 CSR_DATAREF Dummydataref2;
1051 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1052 CSR_NATURAL16 KeyId;
1053 CSR_KEY_TYPE KeyType;
1054 CSR_MACADDRESS Address;
1055} CSR_MLME_GET_KEY_SEQUENCE_REQUEST;
1056
1057typedef struct CSR_MLME_LEAVE_CONFIRM
1058{
1059 CSR_DATAREF Dummydataref1;
1060 CSR_DATAREF Dummydataref2;
1061 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1062 CSR_RESULT_CODE ResultCode;
1063} CSR_MLME_LEAVE_CONFIRM;
1064
1065typedef struct CSR_MLME_LEAVE_REQUEST
1066{
1067 CSR_DATAREF Dummydataref1;
1068 CSR_DATAREF Dummydataref2;
1069 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1070} CSR_MLME_LEAVE_REQUEST;
1071
1072typedef struct CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM
1073{
1074 CSR_DATAREF Dummydataref1;
1075 CSR_DATAREF Dummydataref2;
1076 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1077 CSR_RESULT_CODE ResultCode;
1078} CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM;
1079
1080typedef struct CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST
1081{
1082 CSR_DATAREF Data;
1083 CSR_DATAREF Dummydataref2;
1084 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1085 CSR_TIME_UNITS BeaconPeriod;
1086 CSR_BEACON_PERIODS DtimPeriod;
1087 CSR_CAPABILITY_INFORMATION CapabilityInformation;
1088 CSR_MACADDRESS Bssid;
1089 CSR_NATURAL16 RtsThreshold;
1090} CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST;
1091
1092typedef struct CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM
1093{
1094 CSR_DATAREF Dummydataref1;
1095 CSR_DATAREF Dummydataref2;
1096 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1097 CSR_RESULT_CODE ResultCode;
1098 CSR_AUTONOMOUS_SCAN_ID AutonomousScanId;
1099} CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM;
1100
1101typedef struct CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST
1102{
1103 CSR_DATAREF Dummydataref1;
1104 CSR_DATAREF Dummydataref2;
1105 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1106 CSR_AUTONOMOUS_SCAN_ID AutonomousScanId;
1107 s16 Pause;
1108} CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST;
1109
1110typedef struct CSR_MLME_POWERMGT_CONFIRM
1111{
1112 CSR_DATAREF Dummydataref1;
1113 CSR_DATAREF Dummydataref2;
1114 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1115 CSR_RESULT_CODE ResultCode;
1116} CSR_MLME_POWERMGT_CONFIRM;
1117
1118typedef struct CSR_MLME_POWERMGT_REQUEST
1119{
1120 CSR_DATAREF Dummydataref1;
1121 CSR_DATAREF Dummydataref2;
1122 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1123 CSR_POWER_MANAGEMENT_MODE PowerManagementMode;
1124 s16 ReceiveDtims;
1125 CSR_BEACON_PERIODS ListenInterval;
1126 CSR_TRAFFIC_WINDOW TrafficWindow;
1127} CSR_MLME_POWERMGT_REQUEST;
1128
1129typedef struct CSR_MLME_SCAN_CONFIRM
1130{
1131 CSR_DATAREF Dummydataref1;
1132 CSR_DATAREF Dummydataref2;
1133 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1134 CSR_RESULT_CODE ResultCode;
1135} CSR_MLME_SCAN_CONFIRM;
1136
1137typedef struct CSR_MLME_SCAN_REQUEST
1138{
1139 CSR_DATAREF ChannelList;
1140 CSR_DATAREF InformationElements;
1141 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1142 CSR_IFINTERFACE Ifindex;
1143 CSR_SCAN_TYPE ScanType;
1144 CSR_MICROSECONDS32 ProbeDelay;
1145 CSR_TIME_UNITS MinChannelTime;
1146 CSR_TIME_UNITS MaxChannelTime;
1147} CSR_MLME_SCAN_REQUEST;
1148
1149typedef struct CSR_MLME_SCAN_CANCEL_REQUEST
1150{
1151 CSR_DATAREF Dummydataref1;
1152 CSR_DATAREF Dummydataref2;
1153 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1154} CSR_MLME_SCAN_CANCEL_REQUEST;
1155
1156typedef struct CSR_MLME_SETKEYS_CONFIRM
1157{
1158 CSR_DATAREF Dummydataref1;
1159 CSR_DATAREF Dummydataref2;
1160 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1161 CSR_RESULT_CODE ResultCode;
1162} CSR_MLME_SETKEYS_CONFIRM;
1163
1164typedef struct CSR_MLME_SETKEYS_REQUEST
1165{
1166 CSR_DATAREF Key;
1167 CSR_DATAREF Dummydataref2;
1168 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1169 CSR_NATURAL16 Length;
1170 CSR_NATURAL16 KeyId;
1171 CSR_KEY_TYPE KeyType;
1172 CSR_MACADDRESS Address;
1173 CSR_NATURAL16 SequenceNumber[8];
1174 CSR_CIPHER_SUITE_SELECTOR CipherSuiteSelector;
1175} CSR_MLME_SETKEYS_REQUEST;
1176
1177typedef struct CSR_MLME_SET_CHANNEL_CONFIRM
1178{
1179 CSR_DATAREF Dummydataref1;
1180 CSR_DATAREF Dummydataref2;
1181 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1182 CSR_RESULT_CODE ResultCode;
1183} CSR_MLME_SET_CHANNEL_CONFIRM;
1184
1185typedef struct CSR_MLME_SET_CHANNEL_REQUEST
1186{
1187 CSR_DATAREF Dummydataref1;
1188 CSR_DATAREF Dummydataref2;
1189 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1190 CSR_IFINTERFACE Ifindex;
1191 CSR_CHANNEL_NUMBER Channel;
1192 CSR_MACADDRESS Address;
1193 CSR_TIME_UNITS AvailabilityDuration;
1194 CSR_TIME_UNITS AvailabilityInterval;
1195} CSR_MLME_SET_CHANNEL_REQUEST;
1196
1197typedef struct CSR_MLME_SET_PACKET_FILTER_CONFIRM
1198{
1199 CSR_DATAREF Dummydataref1;
1200 CSR_DATAREF Dummydataref2;
1201 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1202 CSR_RESULT_CODE ResultCode;
1203} CSR_MLME_SET_PACKET_FILTER_CONFIRM;
1204
1205typedef struct CSR_MLME_SET_PACKET_FILTER_REQUEST
1206{
1207 CSR_DATAREF InformationElements;
1208 CSR_DATAREF Dummydataref2;
1209 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1210 CSR_PACKET_FILTER_MODE PacketFilterMode;
1211 CSR_IPV4_ADDRESS ArpFilterAddress;
1212} CSR_MLME_SET_PACKET_FILTER_REQUEST;
1213
1214typedef struct CSR_MLME_SET_TIM_CONFIRM
1215{
1216 CSR_DATAREF Dummydataref1;
1217 CSR_DATAREF Dummydataref2;
1218 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1219 CSR_RESULT_CODE ResultCode;
1220} CSR_MLME_SET_TIM_CONFIRM;
1221
1222typedef struct CSR_MLME_SET_TIM_REQUEST
1223{
1224 CSR_DATAREF Dummydataref1;
1225 CSR_DATAREF Dummydataref2;
1226 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1227 CSR_ASSOCIATION_ID AssociationId;
1228 s16 TimValue;
1229} CSR_MLME_SET_TIM_REQUEST;
1230
1231typedef struct CSR_MLME_SM_START_CONFIRM
1232{
1233 CSR_DATAREF Dummydataref1;
1234 CSR_DATAREF Dummydataref2;
1235 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1236 CSR_RESULT_CODE ResultCode;
1237} CSR_MLME_SM_START_CONFIRM;
1238
1239typedef struct CSR_MLME_SM_START_REQUEST
1240{
1241 CSR_DATAREF Beacon;
1242 CSR_DATAREF BssParameters;
1243 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1244 CSR_IFINTERFACE Ifindex;
1245 CSR_CHANNEL_NUMBER Channel;
1246 CSR_MACADDRESS InterfaceAddress;
1247 CSR_MACADDRESS Bssid;
1248 CSR_TIME_UNITS BeaconPeriod;
1249 CSR_BEACON_PERIODS DtimPeriod;
1250 CSR_CAPABILITY_INFORMATION CapabilityInformation;
1251} CSR_MLME_SM_START_REQUEST;
1252
1253typedef struct CSR_MLME_START_AGGREGATION_CONFIRM
1254{
1255 CSR_DATAREF Dummydataref1;
1256 CSR_DATAREF Dummydataref2;
1257 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1258 CSR_MACADDRESS PeerQstaAddress;
1259 CSR_PRIORITY UserPriority;
1260 CSR_DIRECTION Direction;
1261 CSR_RESULT_CODE ResultCode;
1262 CSR_SEQUENCE_NUMBER SequenceNumber;
1263} CSR_MLME_START_AGGREGATION_CONFIRM;
1264
1265typedef struct CSR_MLME_START_AGGREGATION_REQUEST
1266{
1267 CSR_DATAREF Dummydataref1;
1268 CSR_DATAREF Dummydataref2;
1269 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1270 CSR_MACADDRESS PeerQstaAddress;
1271 CSR_PRIORITY UserPriority;
1272 CSR_DIRECTION Direction;
1273 CSR_STARTING_SEQUENCE_NUMBER StartingSequenceNumber;
1274 CSR_NATURAL16 BufferSize;
1275 CSR_TIME_UNITS BlockAckTimeout;
1276} CSR_MLME_START_AGGREGATION_REQUEST;
1277
1278typedef struct CSR_MLME_STOP_AGGREGATION_CONFIRM
1279{
1280 CSR_DATAREF Dummydataref1;
1281 CSR_DATAREF Dummydataref2;
1282 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1283 CSR_MACADDRESS PeerQstaAddress;
1284 CSR_PRIORITY UserPriority;
1285 CSR_DIRECTION Direction;
1286 CSR_RESULT_CODE ResultCode;
1287} CSR_MLME_STOP_AGGREGATION_CONFIRM;
1288
1289typedef struct CSR_MLME_STOP_AGGREGATION_REQUEST
1290{
1291 CSR_DATAREF Dummydataref1;
1292 CSR_DATAREF Dummydataref2;
1293 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1294 CSR_MACADDRESS PeerQstaAddress;
1295 CSR_PRIORITY UserPriority;
1296 CSR_DIRECTION Direction;
1297} CSR_MLME_STOP_AGGREGATION_REQUEST;
1298
1299typedef struct CSR_MLME_TRIGGERED_GET_INDICATION
1300{
1301 CSR_DATAREF MibAttributeValue;
1302 CSR_DATAREF Dummydataref2;
1303 CSR_VIF_IDENTIFIER VirtualInterfaceIdentifier;
1304 CSR_MIB_STATUS Status;
1305 CSR_NATURAL16 ErrorIndex;
1306 CSR_TRIGGERED_ID TriggeredId;
1307} CSR_MLME_TRIGGERED_GET_INDICATION;
1308
1309typedef struct CSR_SIGNAL_PRIMITIVE
1310{
1311 CSR_SIGNAL_PRIMITIVE_HEADER SignalPrimitiveHeader;
1312 union
1313 {
1314 CSR_MA_PACKET_REQUEST MaPacketRequest;
1315 CSR_MA_PACKET_CONFIRM MaPacketConfirm;
1316 CSR_MA_PACKET_INDICATION MaPacketIndication;
1317 CSR_MA_PACKET_CANCEL_REQUEST MaPacketCancelRequest;
1318 CSR_MA_VIF_AVAILABILITY_RESPONSE MaVifAvailabilityResponse;
1319 CSR_MA_VIF_AVAILABILITY_INDICATION MaVifAvailabilityIndication;
1320 CSR_MA_PACKET_ERROR_INDICATION MaPacketErrorIndication;
1321 CSR_MLME_RESET_REQUEST MlmeResetRequest;
1322 CSR_MLME_RESET_CONFIRM MlmeResetConfirm;
1323 CSR_MLME_GET_REQUEST MlmeGetRequest;
1324 CSR_MLME_GET_CONFIRM MlmeGetConfirm;
1325 CSR_MLME_SET_REQUEST MlmeSetRequest;
1326 CSR_MLME_SET_CONFIRM MlmeSetConfirm;
1327 CSR_MLME_GET_NEXT_REQUEST MlmeGetNextRequest;
1328 CSR_MLME_GET_NEXT_CONFIRM MlmeGetNextConfirm;
1329 CSR_MLME_POWERMGT_REQUEST MlmePowermgtRequest;
1330 CSR_MLME_POWERMGT_CONFIRM MlmePowermgtConfirm;
1331 CSR_MLME_SCAN_REQUEST MlmeScanRequest;
1332 CSR_MLME_SCAN_CONFIRM MlmeScanConfirm;
1333 CSR_MLME_HL_SYNC_REQUEST MlmeHlSyncRequest;
1334 CSR_MLME_HL_SYNC_CONFIRM MlmeHlSyncConfirm;
1335 CSR_MLME_MEASURE_REQUEST MlmeMeasureRequest;
1336 CSR_MLME_MEASURE_CONFIRM MlmeMeasureConfirm;
1337 CSR_MLME_MEASURE_INDICATION MlmeMeasureIndication;
1338 CSR_MLME_SETKEYS_REQUEST MlmeSetkeysRequest;
1339 CSR_MLME_SETKEYS_CONFIRM MlmeSetkeysConfirm;
1340 CSR_MLME_DELETEKEYS_REQUEST MlmeDeletekeysRequest;
1341 CSR_MLME_DELETEKEYS_CONFIRM MlmeDeletekeysConfirm;
1342 CSR_MLME_AUTONOMOUS_SCAN_LOSS_INDICATION MlmeAutonomousScanLossIndication;
1343 CSR_MLME_CONNECTED_INDICATION MlmeConnectedIndication;
1344 CSR_MLME_SCAN_CANCEL_REQUEST MlmeScanCancelRequest;
1345 CSR_MLME_HL_SYNC_CANCEL_REQUEST MlmeHlSyncCancelRequest;
1346 CSR_MLME_HL_SYNC_CANCEL_CONFIRM MlmeHlSyncCancelConfirm;
1347 CSR_MLME_ADD_PERIODIC_REQUEST MlmeAddPeriodicRequest;
1348 CSR_MLME_ADD_PERIODIC_CONFIRM MlmeAddPeriodicConfirm;
1349 CSR_MLME_DEL_PERIODIC_REQUEST MlmeDelPeriodicRequest;
1350 CSR_MLME_DEL_PERIODIC_CONFIRM MlmeDelPeriodicConfirm;
1351 CSR_MLME_ADD_AUTONOMOUS_SCAN_REQUEST MlmeAddAutonomousScanRequest;
1352 CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM MlmeAddAutonomousScanConfirm;
1353 CSR_MLME_DEL_AUTONOMOUS_SCAN_REQUEST MlmeDelAutonomousScanRequest;
1354 CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM MlmeDelAutonomousScanConfirm;
1355 CSR_MLME_SET_PACKET_FILTER_REQUEST MlmeSetPacketFilterRequest;
1356 CSR_MLME_SET_PACKET_FILTER_CONFIRM MlmeSetPacketFilterConfirm;
1357 CSR_MLME_STOP_MEASURE_REQUEST MlmeStopMeasureRequest;
1358 CSR_MLME_STOP_MEASURE_CONFIRM MlmeStopMeasureConfirm;
1359 CSR_MLME_PAUSE_AUTONOMOUS_SCAN_REQUEST MlmePauseAutonomousScanRequest;
1360 CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM MlmePauseAutonomousScanConfirm;
1361 CSR_MLME_AUTONOMOUS_SCAN_DONE_INDICATION MlmeAutonomousScanDoneIndication;
1362 CSR_MLME_ADD_TRIGGERED_GET_REQUEST MlmeAddTriggeredGetRequest;
1363 CSR_MLME_ADD_TRIGGERED_GET_CONFIRM MlmeAddTriggeredGetConfirm;
1364 CSR_MLME_DEL_TRIGGERED_GET_REQUEST MlmeDelTriggeredGetRequest;
1365 CSR_MLME_DEL_TRIGGERED_GET_CONFIRM MlmeDelTriggeredGetConfirm;
1366 CSR_MLME_TRIGGERED_GET_INDICATION MlmeTriggeredGetIndication;
1367 CSR_MLME_ADD_BLACKOUT_REQUEST MlmeAddBlackoutRequest;
1368 CSR_MLME_ADD_BLACKOUT_CONFIRM MlmeAddBlackoutConfirm;
1369 CSR_MLME_BLACKOUT_ENDED_INDICATION MlmeBlackoutEndedIndication;
1370 CSR_MLME_DEL_BLACKOUT_REQUEST MlmeDelBlackoutRequest;
1371 CSR_MLME_DEL_BLACKOUT_CONFIRM MlmeDelBlackoutConfirm;
1372 CSR_MLME_ADD_RX_TRIGGER_REQUEST MlmeAddRxTriggerRequest;
1373 CSR_MLME_ADD_RX_TRIGGER_CONFIRM MlmeAddRxTriggerConfirm;
1374 CSR_MLME_DEL_RX_TRIGGER_REQUEST MlmeDelRxTriggerRequest;
1375 CSR_MLME_DEL_RX_TRIGGER_CONFIRM MlmeDelRxTriggerConfirm;
1376 CSR_MLME_CONNECT_STATUS_REQUEST MlmeConnectStatusRequest;
1377 CSR_MLME_CONNECT_STATUS_CONFIRM MlmeConnectStatusConfirm;
1378 CSR_MLME_MODIFY_BSS_PARAMETER_REQUEST MlmeModifyBssParameterRequest;
1379 CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM MlmeModifyBssParameterConfirm;
1380 CSR_MLME_ADD_TEMPLATE_REQUEST MlmeAddTemplateRequest;
1381 CSR_MLME_ADD_TEMPLATE_CONFIRM MlmeAddTemplateConfirm;
1382 CSR_MLME_CONFIG_QUEUE_REQUEST MlmeConfigQueueRequest;
1383 CSR_MLME_CONFIG_QUEUE_CONFIRM MlmeConfigQueueConfirm;
1384 CSR_MLME_ADD_TSPEC_REQUEST MlmeAddTspecRequest;
1385 CSR_MLME_ADD_TSPEC_CONFIRM MlmeAddTspecConfirm;
1386 CSR_MLME_DEL_TSPEC_REQUEST MlmeDelTspecRequest;
1387 CSR_MLME_DEL_TSPEC_CONFIRM MlmeDelTspecConfirm;
1388 CSR_MLME_START_AGGREGATION_REQUEST MlmeStartAggregationRequest;
1389 CSR_MLME_START_AGGREGATION_CONFIRM MlmeStartAggregationConfirm;
1390 CSR_MLME_BLOCKACK_ERROR_INDICATION MlmeBlockackErrorIndication;
1391 CSR_MLME_STOP_AGGREGATION_REQUEST MlmeStopAggregationRequest;
1392 CSR_MLME_STOP_AGGREGATION_CONFIRM MlmeStopAggregationConfirm;
1393 CSR_MLME_SM_START_REQUEST MlmeSmStartRequest;
1394 CSR_MLME_SM_START_CONFIRM MlmeSmStartConfirm;
1395 CSR_MLME_LEAVE_REQUEST MlmeLeaveRequest;
1396 CSR_MLME_LEAVE_CONFIRM MlmeLeaveConfirm;
1397 CSR_MLME_SET_TIM_REQUEST MlmeSetTimRequest;
1398 CSR_MLME_SET_TIM_CONFIRM MlmeSetTimConfirm;
1399 CSR_MLME_GET_KEY_SEQUENCE_REQUEST MlmeGetKeySequenceRequest;
1400 CSR_MLME_GET_KEY_SEQUENCE_CONFIRM MlmeGetKeySequenceConfirm;
1401 CSR_MLME_SET_CHANNEL_REQUEST MlmeSetChannelRequest;
1402 CSR_MLME_SET_CHANNEL_CONFIRM MlmeSetChannelConfirm;
1403 CSR_MLME_ADD_MULTICAST_ADDRESS_REQUEST MlmeAddMulticastAddressRequest;
1404 CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM MlmeAddMulticastAddressConfirm;
1405 CSR_DEBUG_STRING_INDICATION DebugStringIndication;
1406 CSR_DEBUG_WORD16_INDICATION DebugWord16Indication;
1407 CSR_DEBUG_GENERIC_REQUEST DebugGenericRequest;
1408 CSR_DEBUG_GENERIC_CONFIRM DebugGenericConfirm;
1409 CSR_DEBUG_GENERIC_INDICATION DebugGenericIndication;
1410 } u;
1411} CSR_SIGNAL;
1412
1413#define SIG_FILTER_SIZE 6
1414
1415u32 SigGetFilterPos(u16 aSigID);
1416
1417#endif
diff --git a/drivers/staging/csr/csr_wifi_hip_ta_sampling.c b/drivers/staging/csr/csr_wifi_hip_ta_sampling.c
deleted file mode 100644
index f1df36aa87e7..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_ta_sampling.c
+++ /dev/null
@@ -1,541 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/*
12 * ---------------------------------------------------------------------------
13 * FILE: csr_wifi_hip_ta_sampling.c
14 *
15 * PURPOSE:
16 * The traffic analysis sampling module.
17 * This gathers data which is sent to the SME and used to analyse
18 * the traffic behaviour.
19 *
20 * Provides:
21 * unifi_ta_sampling_init - Initialise the internal state
22 * unifi_ta_sample - Sampling function, call this for every data packet
23 *
24 * Calls these external functions which must be provided:
25 * unifi_ta_indicate_sampling - Pass sample data to the SME.
26 * unifi_ta_indicate_protocol - Report certain data packet types to the SME.
27 * ---------------------------------------------------------------------------
28 */
29
30#include "csr_wifi_hip_card_sdio.h"
31
32/* Maximum number of Tx frames we store each CYCLE_1, for detecting period */
33#define TA_MAX_INTERVALS_IN_C1 100
34
35/* Number of intervals in CYCLE_1 (one second), for detecting periodic */
36/* Must match size of unifi_TrafficStats.intervals - 1 */
37#define TA_INTERVALS_NUM 10
38
39/* Step (in msecs) between intervals, for detecting periodic */
40/* We are only interested in periods up to 100ms, i.e. between beacons */
41/* This is correct for TA_INTERVALS_NUM=10 */
42#define TA_INTERVALS_STEP 10
43
44
45enum ta_frame_identity
46{
47 TA_FRAME_UNKNOWN,
48 TA_FRAME_ETHERNET_UNINTERESTING,
49 TA_FRAME_ETHERNET_INTERESTING
50};
51
52
53#define TA_ETHERNET_TYPE_OFFSET 6
54#define TA_LLC_HEADER_SIZE 8
55#define TA_IP_TYPE_OFFSET 17
56#define TA_UDP_SOURCE_PORT_OFFSET 28
57#define TA_UDP_DEST_PORT_OFFSET (TA_UDP_SOURCE_PORT_OFFSET + 2)
58#define TA_BOOTP_CLIENT_MAC_ADDR_OFFSET 64
59#define TA_DHCP_MESSAGE_TYPE_OFFSET 278
60#define TA_DHCP_MESSAGE_TYPE_ACK 0x05
61#define TA_PROTO_TYPE_IP 0x0800
62#define TA_PROTO_TYPE_EAP 0x888E
63#define TA_PROTO_TYPE_WAI 0x8864
64#define TA_PROTO_TYPE_ARP 0x0806
65#define TA_IP_TYPE_TCP 0x06
66#define TA_IP_TYPE_UDP 0x11
67#define TA_UDP_PORT_BOOTPC 0x0044
68#define TA_UDP_PORT_BOOTPS 0x0043
69#define TA_EAPOL_TYPE_OFFSET 9
70#define TA_EAPOL_TYPE_START 0x01
71
72#define snap_802_2 0xAAAA0300
73#define oui_rfc1042 0x00000000
74#define oui_8021h 0x0000f800
75static const u8 aironet_snap[5] = { 0x00, 0x40, 0x96, 0x00, 0x00 };
76
77
78/*
79 * ---------------------------------------------------------------------------
80 * ta_detect_protocol
81 *
82 * Internal only.
83 * Detects a specific protocol in a frame and indicates a TA event.
84 *
85 * Arguments:
86 * ta The pointer to the TA module.
87 * direction The direction of the frame (tx or rx).
88 * data Pointer to the structure that contains the data.
89 *
90 * Returns:
91 * None
92 * ---------------------------------------------------------------------------
93 */
94static enum ta_frame_identity ta_detect_protocol(card_t *card, CsrWifiRouterCtrlProtocolDirection direction,
95 const bulk_data_desc_t *data,
96 const u8 *saddr,
97 const u8 *sta_macaddr)
98{
99 ta_data_t *tad = &card->ta_sampling;
100 u16 proto;
101 u16 source_port, dest_port;
102 CsrWifiMacAddress srcAddress;
103 u32 snap_hdr, oui_hdr;
104
105 if (data->data_length < TA_LLC_HEADER_SIZE)
106 {
107 return TA_FRAME_UNKNOWN;
108 }
109
110 snap_hdr = (((u32)data->os_data_ptr[0]) << 24) |
111 (((u32)data->os_data_ptr[1]) << 16) |
112 (((u32)data->os_data_ptr[2]) << 8);
113 if (snap_hdr != snap_802_2)
114 {
115 return TA_FRAME_UNKNOWN;
116 }
117
118 if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM)
119 {
120 /*
121 * Here we would use the custom filter to detect interesting frames.
122 */
123 }
124
125 oui_hdr = (((u32)data->os_data_ptr[3]) << 24) |
126 (((u32)data->os_data_ptr[4]) << 16) |
127 (((u32)data->os_data_ptr[5]) << 8);
128 if ((oui_hdr == oui_rfc1042) || (oui_hdr == oui_8021h))
129 {
130 proto = (data->os_data_ptr[TA_ETHERNET_TYPE_OFFSET] * 256) +
131 data->os_data_ptr[TA_ETHERNET_TYPE_OFFSET + 1];
132
133 /* The only interesting IP frames are the DHCP */
134 if (proto == TA_PROTO_TYPE_IP)
135 {
136 if (data->data_length > TA_IP_TYPE_OFFSET)
137 {
138 if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM)
139 {
140 ta_l4stats_t *ta_l4stats = &tad->ta_l4stats;
141 u8 l4proto = data->os_data_ptr[TA_IP_TYPE_OFFSET];
142
143 if (l4proto == TA_IP_TYPE_TCP)
144 {
145 if (direction == CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX)
146 {
147 ta_l4stats->txTcpBytesCount += data->data_length;
148 }
149 else
150 {
151 ta_l4stats->rxTcpBytesCount += data->data_length;
152 }
153 }
154 else if (l4proto == TA_IP_TYPE_UDP)
155 {
156 if (direction == CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX)
157 {
158 ta_l4stats->txUdpBytesCount += data->data_length;
159 }
160 else
161 {
162 ta_l4stats->rxUdpBytesCount += data->data_length;
163 }
164 }
165 }
166
167 /* detect DHCP frames */
168 if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP)
169 {
170 /* DHCP frames are UDP frames with BOOTP ports */
171 if (data->os_data_ptr[TA_IP_TYPE_OFFSET] == TA_IP_TYPE_UDP)
172 {
173 if (data->data_length > TA_UDP_DEST_PORT_OFFSET)
174 {
175 source_port = (data->os_data_ptr[TA_UDP_SOURCE_PORT_OFFSET] * 256) +
176 data->os_data_ptr[TA_UDP_SOURCE_PORT_OFFSET + 1];
177 dest_port = (data->os_data_ptr[TA_UDP_DEST_PORT_OFFSET] * 256) +
178 data->os_data_ptr[TA_UDP_DEST_PORT_OFFSET + 1];
179
180 if (((source_port == TA_UDP_PORT_BOOTPC) && (dest_port == TA_UDP_PORT_BOOTPS)) ||
181 ((source_port == TA_UDP_PORT_BOOTPS) && (dest_port == TA_UDP_PORT_BOOTPC)))
182 {
183 /* The DHCP should have at least a message type (request, ack, nack, etc) */
184 if (data->data_length > TA_DHCP_MESSAGE_TYPE_OFFSET + 6)
185 {
186 UNIFI_MAC_ADDRESS_COPY(srcAddress.a, saddr);
187
188 if (direction == CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX)
189 {
190 unifi_ta_indicate_protocol(card->ospriv,
191 CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP,
192 direction,
193 &srcAddress);
194 return TA_FRAME_ETHERNET_UNINTERESTING;
195 }
196
197 /* DHCPACK is a special indication */
198 if (UNIFI_MAC_ADDRESS_CMP(data->os_data_ptr + TA_BOOTP_CLIENT_MAC_ADDR_OFFSET, sta_macaddr) == TRUE)
199 {
200 if (data->os_data_ptr[TA_DHCP_MESSAGE_TYPE_OFFSET] == TA_DHCP_MESSAGE_TYPE_ACK)
201 {
202 unifi_ta_indicate_protocol(card->ospriv,
203 CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP_ACK,
204 direction,
205 &srcAddress);
206 }
207 else
208 {
209 unifi_ta_indicate_protocol(card->ospriv,
210 CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP,
211 direction,
212 &srcAddress);
213 }
214 }
215 }
216 }
217 }
218 }
219 }
220 }
221
222 return TA_FRAME_ETHERNET_INTERESTING;
223 }
224
225 /* detect protocol type EAPOL or WAI (treated as equivalent here) */
226 if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_EAPOL)
227 {
228 if (TA_PROTO_TYPE_EAP == proto || TA_PROTO_TYPE_WAI == proto)
229 {
230 if ((TA_PROTO_TYPE_WAI == proto) || (direction != CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX) ||
231 (data->os_data_ptr[TA_EAPOL_TYPE_OFFSET] == TA_EAPOL_TYPE_START))
232 {
233 UNIFI_MAC_ADDRESS_COPY(srcAddress.a, saddr);
234 unifi_ta_indicate_protocol(card->ospriv,
235 CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_EAPOL,
236 direction, &srcAddress);
237 }
238 return TA_FRAME_ETHERNET_UNINTERESTING;
239 }
240 }
241
242 /* detect protocol type 0x0806 (ARP) */
243 if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_ARP)
244 {
245 if (proto == TA_PROTO_TYPE_ARP)
246 {
247 UNIFI_MAC_ADDRESS_COPY(srcAddress.a, saddr);
248 unifi_ta_indicate_protocol(card->ospriv,
249 CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_ARP,
250 direction, &srcAddress);
251 return TA_FRAME_ETHERNET_UNINTERESTING;
252 }
253 }
254
255 return TA_FRAME_ETHERNET_INTERESTING;
256 }
257 else if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_AIRONET)
258 {
259 /* detect Aironet frames */
260 if (!memcmp(data->os_data_ptr + 3, aironet_snap, 5))
261 {
262 UNIFI_MAC_ADDRESS_COPY(srcAddress.a, saddr);
263 unifi_ta_indicate_protocol(card->ospriv, CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_AIRONET,
264 direction, &srcAddress);
265 }
266 }
267
268 return TA_FRAME_ETHERNET_UNINTERESTING;
269} /* ta_detect_protocol() */
270
271
272static void tas_reset_data(ta_data_t *tad)
273{
274 s16 i;
275
276 for (i = 0; i < (TA_INTERVALS_NUM + 1); i++)
277 {
278 tad->stats.intervals[i] = 0;
279 }
280
281 tad->stats.rxFramesNum = 0;
282 tad->stats.txFramesNum = 0;
283 tad->stats.rxBytesCount = 0;
284 tad->stats.txBytesCount = 0;
285 tad->stats.rxMeanRate = 0;
286
287 tad->rx_sum_rate = 0;
288
289 tad->ta_l4stats.rxTcpBytesCount = 0;
290 tad->ta_l4stats.txTcpBytesCount = 0;
291 tad->ta_l4stats.rxUdpBytesCount = 0;
292 tad->ta_l4stats.txUdpBytesCount = 0;
293} /* tas_reset_data() */
294
295
296/*
297 * ---------------------------------------------------------------------------
298 * API.
299 * unifi_ta_sampling_init
300 *
301 * (Re)Initialise the Traffic Analysis sampling module.
302 * Resets the counters and timestamps.
303 *
304 * Arguments:
305 * tad Pointer to a ta_data_t structure containing the
306 * context for this device instance.
307 * drv_priv An opaque pointer that the TA sampling module will
308 * pass in call-outs.
309 *
310 * Returns:
311 * None.
312 * ---------------------------------------------------------------------------
313 */
314void unifi_ta_sampling_init(card_t *card)
315{
316 (void)unifi_ta_configure(card, CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_RESET, NULL);
317
318 card->ta_sampling.packet_filter = CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_NONE;
319 card->ta_sampling.traffic_type = CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_OCCASIONAL;
320} /* unifi_ta_sampling_init() */
321
322
323/*
324 * ---------------------------------------------------------------------------
325 * API.
326 * unifi_ta_sample
327 *
328 * Sample a data frame for the TA module.
329 * This function stores all the useful information it can extract from
330 * the frame and detects any specific protocols.
331 *
332 * Arguments:
333 * tad The pointer to the TA sampling context struct.
334 * direction The direction of the frame (rx, tx)
335 * data Pointer to the frame data
336 * saddr Source MAC address of frame.
337 * timestamp Time (in msecs) that the frame was received.
338 * rate Reported data rate for the rx frame (0 for tx frames)
339 *
340 * Returns:
341 * None
342 * ---------------------------------------------------------------------------
343 */
344void unifi_ta_sample(card_t *card,
345 CsrWifiRouterCtrlProtocolDirection direction,
346 const bulk_data_desc_t *data,
347 const u8 *saddr,
348 const u8 *sta_macaddr,
349 u32 timestamp,
350 u16 rate)
351{
352 ta_data_t *tad = &card->ta_sampling;
353 enum ta_frame_identity identity;
354 u32 time_delta;
355
356
357
358 /* Step1: Check for specific frames */
359 if (tad->packet_filter != CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_NONE)
360 {
361 identity = ta_detect_protocol(card, direction, data, saddr, sta_macaddr);
362 }
363 else
364 {
365 identity = TA_FRAME_ETHERNET_INTERESTING;
366 }
367
368
369 /* Step2: Update the information in the current record */
370 if (direction == CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_RX)
371 {
372 /* Update the Rx packet count and the throughput count */
373 tad->stats.rxFramesNum++;
374 tad->stats.rxBytesCount += data->data_length;
375
376 /* Accumulate packet Rx rates for later averaging */
377 tad->rx_sum_rate += rate;
378 }
379 else
380 {
381 if (identity == TA_FRAME_ETHERNET_INTERESTING)
382 {
383 /*
384 * Store the period between the last and the current frame.
385 * There is not point storing more than TA_MAX_INTERVALS_IN_C1 periods,
386 * the traffic will be bursty or continuous.
387 */
388 if (tad->stats.txFramesNum < TA_MAX_INTERVALS_IN_C1)
389 {
390 u32 interval;
391 u32 index_in_intervals;
392
393 interval = timestamp - tad->tx_last_ts;
394 tad->tx_last_ts = timestamp;
395 index_in_intervals = (interval + TA_INTERVALS_STEP / 2 - 1) / TA_INTERVALS_STEP;
396
397 /* If the interval is interesting, update the t1_intervals count */
398 if (index_in_intervals <= TA_INTERVALS_NUM)
399 {
400 unifi_trace(card->ospriv, UDBG5,
401 "unifi_ta_sample: TX interval=%d index=%d\n",
402 interval, index_in_intervals);
403 tad->stats.intervals[index_in_intervals]++;
404 }
405 }
406 }
407
408 /* Update the Tx packet count... */
409 tad->stats.txFramesNum++;
410 /* ... and the number of bytes for throughput. */
411 tad->stats.txBytesCount += data->data_length;
412 }
413
414 /*
415 * If more than one second has elapsed since the last report, send
416 * another one.
417 */
418 /* Unsigned subtraction handles wrap-around from 0xFFFFFFFF to 0 */
419 time_delta = timestamp - tad->last_indication_time;
420 if (time_delta >= 1000)
421 {
422 /*
423 * rxFramesNum can be flashed in tas_reset_data() by another thread.
424 * Use a temp to avoid division by zero.
425 */
426 u32 temp_rxFramesNum;
427 temp_rxFramesNum = tad->stats.rxFramesNum;
428
429 /* Calculate this interval's mean frame Rx rate from the sum */
430 if (temp_rxFramesNum)
431 {
432 tad->stats.rxMeanRate = tad->rx_sum_rate / temp_rxFramesNum;
433 }
434 unifi_trace(card->ospriv, UDBG5,
435 "unifi_ta_sample: RX fr=%lu, r=%u, sum=%lu, av=%lu\n",
436 tad->stats.rxFramesNum, rate,
437 tad->rx_sum_rate, tad->stats.rxMeanRate);
438
439 /*
440 * Send the information collected in the stats struct
441 * to the SME and reset the counters.
442 */
443 if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM)
444 {
445 u32 rxTcpThroughput = tad->ta_l4stats.rxTcpBytesCount / time_delta;
446 u32 txTcpThroughput = tad->ta_l4stats.txTcpBytesCount / time_delta;
447 u32 rxUdpThroughput = tad->ta_l4stats.rxUdpBytesCount / time_delta;
448 u32 txUdpThroughput = tad->ta_l4stats.txUdpBytesCount / time_delta;
449
450 unifi_ta_indicate_l4stats(card->ospriv,
451 rxTcpThroughput,
452 txTcpThroughput,
453 rxUdpThroughput,
454 txUdpThroughput
455 );
456 }
457 unifi_ta_indicate_sampling(card->ospriv, &tad->stats);
458 tas_reset_data(tad);
459 tad->last_indication_time = timestamp;
460 }
461} /* unifi_ta_sample() */
462
463
464/*
465 * ---------------------------------------------------------------------------
466 * External API.
467 * unifi_ta_configure
468 *
469 * Configures the TA module parameters.
470 *
471 * Arguments:
472 * ta The pointer to the TA module.
473 * config_type The type of the configuration request
474 * config Pointer to the configuration parameters.
475 *
476 * Returns:
477 * CSR_RESULT_SUCCESS on success, CSR error code otherwise
478 * ---------------------------------------------------------------------------
479 */
480CsrResult unifi_ta_configure(card_t *card,
481 CsrWifiRouterCtrlTrafficConfigType config_type,
482 const CsrWifiRouterCtrlTrafficConfig *config)
483{
484 ta_data_t *tad = &card->ta_sampling;
485
486 /* Reinitialise our data when we are reset */
487 if (config_type == CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_RESET)
488 {
489 /* Reset the stats to zero */
490 tas_reset_data(tad);
491
492 /* Reset the timer variables */
493 tad->tx_last_ts = 0;
494 tad->last_indication_time = 0;
495
496 return CSR_RESULT_SUCCESS;
497 }
498
499 if (config_type == CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_FILTER)
500 {
501 tad->packet_filter = config->packetFilter;
502
503 if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM)
504 {
505 tad->custom_filter = config->customFilter;
506 }
507
508 return CSR_RESULT_SUCCESS;
509 }
510
511 return CSR_RESULT_SUCCESS;
512} /* unifi_ta_configure() */
513
514
515/*
516 * ---------------------------------------------------------------------------
517 * External API.
518 * unifi_ta_classification
519 *
520 * Configures the current TA classification.
521 *
522 * Arguments:
523 * ta The pointer to the TA module.
524 * traffic_type The classification type
525 * period The traffic period if the type is periodic
526 *
527 * Returns:
528 * None
529 * ---------------------------------------------------------------------------
530 */
531void unifi_ta_classification(card_t *card,
532 CsrWifiRouterCtrlTrafficType traffic_type,
533 u16 period)
534{
535 unifi_trace(card->ospriv, UDBG3,
536 "Changed current ta classification to: %d\n", traffic_type);
537
538 card->ta_sampling.traffic_type = traffic_type;
539}
540
541
diff --git a/drivers/staging/csr/csr_wifi_hip_ta_sampling.h b/drivers/staging/csr/csr_wifi_hip_ta_sampling.h
deleted file mode 100644
index aa684c654d06..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_ta_sampling.h
+++ /dev/null
@@ -1,66 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/*
12 * ---------------------------------------------------------------------------
13 * FILE: csr_wifi_hip_ta_sampling.h
14 *
15 * PURPOSE:
16 * This file contains Traffic Analysis definitions common to the
17 * sampling and analysis modules.
18 *
19 * ---------------------------------------------------------------------------
20 */
21#ifndef __TA_SAMPLING_H__
22#define __TA_SAMPLING_H__
23
24#include "csr_wifi_hip_unifi.h"
25
26typedef struct ta_l4stats
27{
28 u32 rxTcpBytesCount;
29 u32 txTcpBytesCount;
30 u32 rxUdpBytesCount;
31 u32 txUdpBytesCount;
32} ta_l4stats_t;
33
34/*
35 * Context structure to preserve state between calls.
36 */
37
38typedef struct ta_data
39{
40 /* Current packet filter configuration */
41 u16 packet_filter;
42
43 /* Current packet custom filter configuration */
44 CsrWifiRouterCtrlTrafficFilter custom_filter;
45
46 /* The timestamp of the last tx packet processed. */
47 u32 tx_last_ts;
48
49 /* The timestamp of the last packet processed. */
50 u32 last_indication_time;
51
52 /* Statistics */
53 CsrWifiRouterCtrlTrafficStats stats;
54
55 /* Current traffic classification */
56 CsrWifiRouterCtrlTrafficType traffic_type;
57
58 /* Sum of packet rx rates for this interval used to calculate mean */
59 u32 rx_sum_rate;
60 ta_l4stats_t ta_l4stats;
61} ta_data_t;
62
63
64void unifi_ta_sampling_init(card_t *card);
65
66#endif /* __TA_SAMPLING_H__ */
diff --git a/drivers/staging/csr/csr_wifi_hip_udi.c b/drivers/staging/csr/csr_wifi_hip_udi.c
deleted file mode 100644
index a6b006b0e983..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_udi.c
+++ /dev/null
@@ -1,173 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/*
12 * ---------------------------------------------------------------------------
13 * FILE: csr_wifi_hip_card_udi.c
14 *
15 * PURPOSE:
16 * Maintain a list of callbacks to log UniFi exchanges to one or more
17 * debug/monitoring client applications.
18 *
19 * NOTES:
20 * Just call the UDI driver log fn directly for now.
21 * When done properly, each open() on the UDI device will install
22 * a log function. We will call all log fns whenever a signal is written
23 * to or read form the UniFi.
24 *
25 * ---------------------------------------------------------------------------
26 */
27#include <linux/seq_file.h>
28#include "csr_wifi_hip_unifi.h"
29#include "csr_wifi_hip_card.h"
30
31
32static void unifi_print_unsafe_sdio_status(card_t *card, struct seq_file *m)
33{
34#ifdef CSR_UNSAFE_SDIO_ACCESS
35 s32 iostate;
36 CsrResult r;
37 static const char *const states[] = {
38 "AWAKE", "DROWSY", "TORPID"
39 };
40#define SHARED_READ_RETRY_LIMIT 10
41 u8 b;
42
43 seq_printf(m, "Host State: %s\n", states[card->host_state]);
44
45 r = unifi_check_io_status(card, &iostate);
46 if (iostate == 1) {
47 seq_puts(m, remaining, "I/O Check: F1 disabled\n");
48 } else {
49 if (iostate == 1) {
50 seq_puts(m, "I/O Check: pending interrupt\n");
51
52 seq_printf(m, "BH reason interrupt = %d\n", card->bh_reason_unifi);
53 seq_printf(m, "BH reason host = %d\n", card->bh_reason_host);
54
55 for (i = 0; i < SHARED_READ_RETRY_LIMIT; i++) {
56 r = unifi_read_8_or_16(card, card->sdio_ctrl_addr + 2, &b);
57 if (r == CSR_RESULT_SUCCESS && !(b & 0x80)) {
58 seq_printf(m, "fhsr: %u (driver thinks is %u)\n",
59 b, card->from_host_signals_r);
60 break;
61 }
62 }
63
64 iostate = unifi_read_shared_count(card, card->sdio_ctrl_addr + 4);
65 seq_printf(m, "thsw: %u (driver thinks is %u)\n",
66 iostate, card->to_host_signals_w);
67 }
68#endif
69}
70
71/*
72 * ---------------------------------------------------------------------------
73 * unifi_print_status
74 *
75 * Print status info to given character buffer.
76 *
77 * Arguments:
78 * None.
79 *
80 * Returns:
81 * None.
82 * ---------------------------------------------------------------------------
83 */
84s32 unifi_print_status(card_t *card, struct seq_file *m)
85{
86 sdio_config_data_t *cfg;
87 u16 i, n;
88
89 i = n = 0;
90 seq_printf(m, "Chip ID %u\n", card->chip_id);
91 seq_printf(m, "Chip Version %04X\n", card->chip_version);
92 seq_printf(m, "HIP v%u.%u\n",
93 (card->config_data.version >> 8) & 0xFF,
94 card->config_data.version & 0xFF);
95 seq_printf(m, "Build %u: %s\n", card->build_id, card->build_id_string);
96
97 cfg = &card->config_data;
98
99 seq_printf(m, "sdio ctrl offset %u\n", cfg->sdio_ctrl_offset);
100 seq_printf(m, "fromhost sigbuf handle %u\n", cfg->fromhost_sigbuf_handle);
101 seq_printf(m, "tohost_sigbuf_handle %u\n", cfg->tohost_sigbuf_handle);
102 seq_printf(m, "num_fromhost_sig_frags %u\n", cfg->num_fromhost_sig_frags);
103 seq_printf(m, "num_tohost_sig_frags %u\n", cfg->num_tohost_sig_frags);
104 seq_printf(m, "num_fromhost_data_slots %u\n", cfg->num_fromhost_data_slots);
105 seq_printf(m, "num_tohost_data_slots %u\n", cfg->num_tohost_data_slots);
106 seq_printf(m, "data_slot_size %u\n", cfg->data_slot_size);
107
108 /* Added by protocol version 0x0001 */
109 seq_printf(m, "overlay_size %u\n", cfg->overlay_size);
110
111 /* Added by protocol version 0x0300 */
112 seq_printf(m, "data_slot_round %u\n", cfg->data_slot_round);
113 seq_printf(m, "sig_frag_size %u\n", cfg->sig_frag_size);
114
115 /* Added by protocol version 0x0300 */
116 seq_printf(m, "tohost_sig_pad %u\n", cfg->tohost_signal_padding);
117
118 seq_puts(m, "\nInternal state:\n");
119
120 seq_printf(m, "Last PHY PANIC: %04x:%04x\n",
121 card->last_phy_panic_code, card->last_phy_panic_arg);
122 seq_printf(m, "Last MAC PANIC: %04x:%04x\n",
123 card->last_mac_panic_code, card->last_mac_panic_arg);
124
125 seq_printf(m, "fhsr: %hu\n", (u16)card->from_host_signals_r);
126 seq_printf(m, "fhsw: %hu\n", (u16)card->from_host_signals_w);
127 seq_printf(m, "thsr: %hu\n", (u16)card->to_host_signals_r);
128 seq_printf(m, "thsw: %hu\n", (u16)card->to_host_signals_w);
129 seq_printf(m, "fh buffer contains: %d signals, %td bytes\n",
130 card->fh_buffer.count,
131 card->fh_buffer.ptr - card->fh_buffer.buf);
132
133 seq_puts(m, "paused: ");
134 for (i = 0; i < ARRAY_SIZE(card->tx_q_paused_flag); i++)
135 seq_printf(m, card->tx_q_paused_flag[i] ? "1" : "0");
136 seq_putc(m, '\n');
137
138 seq_printf(m, "fh command q: %u waiting, %u free of %u:\n",
139 CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_command_queue),
140 CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_command_queue),
141 UNIFI_SOFT_COMMAND_Q_LENGTH);
142
143 for (i = 0; i < UNIFI_NO_OF_TX_QS; i++)
144 seq_printf(m, "fh traffic q[%u]: %u waiting, %u free of %u:\n",
145 i,
146 CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_traffic_queue[i]),
147 CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_traffic_queue[i]),
148 UNIFI_SOFT_TRAFFIC_Q_LENGTH);
149
150 seq_printf(m, "fh data slots free: %u\n",
151 card->from_host_data ? CardGetFreeFromHostDataSlots(card) : 0);
152
153 seq_puts(m, "From host data slots:");
154 n = card->config_data.num_fromhost_data_slots;
155 for (i = 0; i < n && card->from_host_data; i++)
156 seq_printf(m, " %hu", (u16)card->from_host_data[i].bd.data_length);
157 seq_putc(m, '\n');
158
159 seq_puts(m, "To host data slots:");
160 n = card->config_data.num_tohost_data_slots;
161 for (i = 0; i < n && card->to_host_data; i++)
162 seq_printf(m, " %hu", (u16)card->to_host_data[i].data_length);
163 seq_putc(m, '\n');
164
165 unifi_print_unsafe_sdio_status(card, m);
166
167 seq_puts(m, "\nStats:\n");
168 seq_printf(m, "Total SDIO bytes: R=%u W=%u\n",
169 card->sdio_bytes_read, card->sdio_bytes_written);
170
171 seq_printf(m, "Interrupts generated on card: %u\n", card->unifi_interrupt_seq);
172 return 0;
173}
diff --git a/drivers/staging/csr/csr_wifi_hip_unifi.h b/drivers/staging/csr/csr_wifi_hip_unifi.h
deleted file mode 100644
index 1160a0e25c7d..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_unifi.h
+++ /dev/null
@@ -1,871 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/*
12 * ---------------------------------------------------------------------------
13 *
14 * FILE : csr_wifi_hip_unifi.h
15 *
16 * PURPOSE : Public API for the UniFi HIP core library.
17 *
18 * ---------------------------------------------------------------------------
19 */
20#ifndef __CSR_WIFI_HIP_UNIFI_H__
21#define __CSR_WIFI_HIP_UNIFI_H__ 1
22
23#ifndef CSR_WIFI_HIP_TA_DISABLE
24#include "csr_wifi_router_ctrl_prim.h"
25#include "csr_wifi_router_prim.h"
26#else
27#include "csr_time.h"
28#endif
29
30/* SDIO chip ID numbers */
31
32/* Manufacturer id */
33#define SDIO_MANF_ID_CSR 0x032a
34
35/* Device id */
36#define SDIO_CARD_ID_UNIFI_1 0x0001
37#define SDIO_CARD_ID_UNIFI_2 0x0002
38#define SDIO_CARD_ID_UNIFI_3 0x0007
39#define SDIO_CARD_ID_UNIFI_4 0x0008
40
41/* Function number for WLAN */
42#define SDIO_WLAN_FUNC_ID_UNIFI_1 0x0001
43#define SDIO_WLAN_FUNC_ID_UNIFI_2 0x0001
44#define SDIO_WLAN_FUNC_ID_UNIFI_3 0x0001
45#define SDIO_WLAN_FUNC_ID_UNIFI_4 0x0002
46
47/* Maximum SDIO bus clock supported. */
48#define UNIFI_SDIO_CLOCK_MAX_HZ 50000000 /* Hz */
49
50/*
51 * Initialisation SDIO bus clock.
52 *
53 * The initialisation clock speed should be used from when the chip has been
54 * reset until the first MLME-reset has been received (i.e. during firmware
55 * initialisation), unless UNIFI_SDIO_CLOCK_SAFE_HZ applies.
56 */
57#define UNIFI_SDIO_CLOCK_INIT_HZ 12500000 /* Hz */
58
59/*
60 * Safe SDIO bus clock.
61 *
62 * The safe speed should be used when the chip is in deep sleep or
63 * it's state is unknown (just after reset / power on).
64 */
65#define UNIFI_SDIO_CLOCK_SAFE_HZ 1000000 /* Hz */
66
67/* I/O default block size to use for UniFi. */
68#define UNIFI_IO_BLOCK_SIZE 64
69
70#define UNIFI_WOL_OFF 0
71#define UNIFI_WOL_SDIO 1
72#define UNIFI_WOL_PIO 2
73
74/* The number of Tx traffic queues */
75#define UNIFI_NO_OF_TX_QS 4
76
77#define CSR_WIFI_HIP_RESERVED_HOST_TAG 0xFFFFFFFF
78
79/*
80 * The number of slots in the from-host queues.
81 *
82 * UNIFI_SOFT_TRAFFIC_Q_LENGTH is the number of slots in the traffic queues
83 * and there will be UNIFI_NO_OF_TX_QS of them.
84 * Traffic queues are used for data packets.
85 *
86 * UNIFI_SOFT_COMMAND_Q_LENGTH is the number of slots in the command queue.
87 * The command queue is used for MLME management requests.
88 *
89 * Queues are ring buffers and so must always have 1 unused slot.
90 */
91#define UNIFI_SOFT_TRAFFIC_Q_LENGTH (20 + 1)
92#define UNIFI_SOFT_COMMAND_Q_LENGTH (16 + 1)
93
94#include "csr_framework_ext.h" /* from the synergy porting folder */
95#include "csr_sdio.h" /* from the synergy porting folder */
96#include "csr_macro.h" /* from the synergy porting folder */
97#include "csr_wifi_result.h"
98
99/* Utility MACROS. Note that UNIFI_MAC_ADDRESS_CMP returns TRUE on success */
100#define UNIFI_MAC_ADDRESS_COPY(dst, src) \
101 do { (dst)[0] = (src)[0]; (dst)[1] = (src)[1]; \
102 (dst)[2] = (src)[2]; (dst)[3] = (src)[3]; \
103 (dst)[4] = (src)[4]; (dst)[5] = (src)[5]; \
104 } while (0)
105
106#define UNIFI_MAC_ADDRESS_CMP(addr1, addr2) \
107 (((addr1)[0] == (addr2)[0]) && ((addr1)[1] == (addr2)[1]) && \
108 ((addr1)[2] == (addr2)[2]) && ((addr1)[3] == (addr2)[3]) && \
109 ((addr1)[4] == (addr2)[4]) && ((addr1)[5] == (addr2)[5]))
110
111/* Traffic queue ordered according to priority
112 * EAPOL/Uncontrolled port Queue should be the last
113 */
114typedef enum
115{
116 UNIFI_TRAFFIC_Q_BK = 0,
117 UNIFI_TRAFFIC_Q_BE,
118 UNIFI_TRAFFIC_Q_VI,
119 UNIFI_TRAFFIC_Q_VO,
120 UNIFI_TRAFFIC_Q_EAPOL, /* Non existent in HIP */
121 UNIFI_TRAFFIC_Q_MAX, /* Non existent */
122 UNIFI_TRAFFIC_Q_MLME /* Non existent */
123} unifi_TrafficQueue;
124
125/*
126 * Structure describing a bulk data slot.
127 * This structure is shared between the HIP core library and the OS
128 * layer. See the definition of unifi_net_data_malloc() for more details.
129 *
130 * The data_length field is used to indicate empty/occupied state.
131 * Needs to be defined before #include "unifi_os.h".
132 */
133typedef struct _bulk_data_desc
134{
135 const u8 *os_data_ptr;
136 u32 data_length;
137 const void *os_net_buf_ptr;
138 u32 net_buf_length;
139} bulk_data_desc_t;
140
141/* Structure of an entry in the Symbol Look Up Table (SLUT). */
142typedef struct _symbol
143{
144 u16 id;
145 u32 obj;
146} symbol_t;
147
148/*
149 * Header files need to be included from the current directory,
150 * the SME library, the synergy framework and the OS layer.
151 * A thin OS layer needs to be implemented in the porting exercise.
152 *
153 * Note that unifi_os.h should be included only in unifi.h
154 */
155
156#include "unifi_os.h"
157
158/*
159 * Contains the HIP core definitions selected in the porting exercise, such as
160 * UNIFI_PAD_BULK_DATA_TO_BLOCK_SIZE and UNIFI_PAD_SIGNALS_TO_BLOCK_SIZE.
161 * Implemented in the OS layer, as part of the porting exersice.
162 */
163#include "unifi_config.h"
164
165#include "csr_wifi_hip_signals.h" /* from this dir */
166
167/*
168 * The card structure is an opaque pointer that is used to pass context
169 * to the upper-edge API functions.
170 */
171typedef struct card card_t;
172
173
174/*
175 * This structure describes all of the bulk data that 'might' be
176 * associated with a signal.
177 */
178typedef struct _bulk_data_param
179{
180 bulk_data_desc_t d[UNIFI_MAX_DATA_REFERENCES];
181} bulk_data_param_t;
182
183
184/*
185 * This structure describes the chip and HIP core lib
186 * information that exposed to the OS layer.
187 */
188typedef struct _card_info
189{
190 u16 chip_id;
191 u16 chip_version;
192 u32 fw_build;
193 u16 fw_hip_version;
194 u32 sdio_block_size;
195} card_info_t;
196
197
198/*
199 * Mini-coredump definitions
200 */
201/* Definition of XAP memory ranges used by the mini-coredump system.
202 * Note that, these values are NOT the same as UNIFI_REGISTERS, etc
203 * in unifihw.h which don't allow selection of register areas for each XAP.
204 */
205typedef enum unifi_coredump_space
206{
207 UNIFI_COREDUMP_MAC_REG,
208 UNIFI_COREDUMP_PHY_REG,
209 UNIFI_COREDUMP_SH_DMEM,
210 UNIFI_COREDUMP_MAC_DMEM,
211 UNIFI_COREDUMP_PHY_DMEM,
212 UNIFI_COREDUMP_TRIGGER_MAGIC = 0xFEED
213} unifi_coredump_space_t;
214
215/* Structure used to request a register value from a mini-coredump buffer */
216typedef struct unifi_coredump_req
217{
218 /* From user */
219 s32 index; /* 0=newest, -1=oldest */
220 unifi_coredump_space_t space; /* memory space */
221 u32 offset; /* register offset in space */
222 /* From driver */
223 u32 drv_build; /* Driver build id */
224 u32 chip_ver; /* Chip version */
225 u32 fw_ver; /* Firmware version */
226 s32 requestor; /* Requestor: 0=auto dump, 1=manual */
227 u32 timestamp; /* time of capture by driver */
228 u32 serial; /* capture serial number */
229 s32 value; /* register value */
230} unifi_coredump_req_t; /* mini-coredumped reg value request */
231
232
233/**
234 * @defgroup upperedge Upper edge API
235 *
236 * The following functions are implemented in the HIP core lib.
237 */
238
239/**
240 *
241 * Initialise the HIP core lib.
242 * Note that the OS layer must initialise the SDIO glue layer and obtain
243 * an SDIO function context, prior to this call.
244 *
245 * @param sdiopriv the SDIO function context.
246 *
247 * @param ospriv the OS layer context.
248 *
249 * @return \p card_t the HIP core lib API context.
250 *
251 * @ingroup upperedge
252 */
253card_t* unifi_alloc_card(CsrSdioFunction *sdiopriv, void *ospriv);
254
255
256/**
257 *
258 * Initialise the UniFi chip.
259 *
260 * @param card the HIP core lib API context.
261 *
262 * @param led_mask the led mask to apply to UniFi.
263 *
264 * @return \b 0 if UniFi is initialized.
265 *
266 * @return \b -CSR_EIO if an I/O error occurred while initializing UniFi
267 *
268 * @return \b -CSR_ENODEV if the card is no longer present.
269 *
270 * @ingroup upperedge
271 */
272CsrResult unifi_init_card(card_t *card, s32 led_mask);
273
274/**
275 *
276 * De-Initialise the HIP core lib.
277 *
278 * @param card the HIP core lib API context.
279 *
280 * @ingroup upperedge
281 */
282void unifi_free_card(card_t *card);
283
284/**
285 *
286 * Cancel all the signals pending in the HIP core lib.
287 * Normally used during a system suspend when the power is retained on UniFi.
288 *
289 * @param card the HIP core lib API context.
290 *
291 * @ingroup upperedge
292 */
293void unifi_cancel_pending_signals(card_t *card);
294
295/**
296 *
297 * Send a signal to UniFi.
298 * Normally it is called from unifi_sys_hip_req() and the OS layer
299 * Tx data plane.
300 *
301 * Note that the bulkdata buffers ownership is passed to the HIP core lib.
302 * These buffers must be allocated using unifi_net_data_malloc().
303 *
304 * @param card the HIP core lib API context.
305 *
306 * @param sigptr pointer to the signal.
307 *
308 * @param siglen size of the signal.
309 *
310 * @param bulkdata pointer to the bulk data associated with the signal.
311 *
312 * @return \b 0 signal is sent.
313 *
314 * @return \b -CSR_EIO if an error occurred while sending the signal
315 *
316 * @return \b -CSR_ENODEV if the card is no longer present.
317 *
318 * @ingroup upperedge
319 */
320CsrResult unifi_send_signal(card_t *card, const u8 *sigptr,
321 u32 siglen,
322 const bulk_data_param_t *bulkdata);
323
324/**
325 *
326 * Check if the HIP core lib has resources to send a signal.
327 * Normally there no need to use this function.
328 *
329 * @param card the HIP core lib API context.
330 *
331 * @param sigptr pointer to the signal.
332 *
333 * @return \b 0 if there are resources for the signal.
334 *
335 * @return \b -CSR_ENOSPC if there are not enough resources
336 *
337 * @ingroup upperedge
338 */
339CsrResult unifi_send_resources_available(card_t *card, const u8 *sigptr);
340
341/**
342 *
343 * Read the UniFi chip and the HIP core lib information.
344 *
345 * @param card the HIP core lib API context.
346 *
347 * @param card_info pointer to save the information.
348 *
349 * @ingroup upperedge
350 */
351void unifi_card_info(card_t *card, card_info_t *card_info);
352
353/**
354 *
355 * Print the UniFi I/O and Interrupt status.
356 * Normally it is used for debug purposes only.
357 *
358 * @param card the HIP core lib API context.
359
360 * @param status buffer for the chip status
361 *
362 * @return \b 0 if the check was performed.
363 *
364 * @return \b -CSR_EIO if an error occurred while checking the status.
365 *
366 * @return \b -CSR_ENODEV if the card is no longer present.
367 *
368 * @ingroup upperedge
369 */
370CsrResult unifi_check_io_status(card_t *card, s32 *status);
371
372
373/**
374 *
375 * Run the HIP core lib Botton-Half.
376 * Whenever the HIP core lib want this function to be called
377 * by the OS layer, it calls unifi_run_bh().
378 *
379 * @param card the HIP core lib API context.
380 *
381 * @param remaining pointer to return the time (in msecs) that this function
382 * should be re-scheduled. A return value of 0 means that no re-scheduling
383 * is required. If unifi_bh() is called before the timeout expires,
384 * the caller must pass in the remaining time.
385 *
386 * @return \b 0 if no error occurred.
387 *
388 * @return \b -CSR_ENODEV if the card is no longer present.
389 *
390 * @return \b -CSR_E* if an error occurred while running the bottom half.
391 *
392 * @ingroup upperedge
393 */
394CsrResult unifi_bh(card_t *card, u32 *remaining);
395
396
397/**
398 * UniFi Low Power Mode (Deep Sleep Signaling)
399 *
400 * unifi_low_power_mode defines the UniFi Deep Sleep Signaling status.
401 * Use with unifi_configure_low_power_mode() to enable/disable
402 * the Deep Sleep Signaling.
403 */
404enum unifi_low_power_mode
405{
406 UNIFI_LOW_POWER_DISABLED,
407 UNIFI_LOW_POWER_ENABLED
408};
409
410/**
411 * Periodic Wake Host Mode
412 *
413 * unifi_periodic_wake_mode defines the Periodic Wake Host Mode.
414 * It can only be set to UNIFI_PERIODIC_WAKE_HOST_ENABLED if
415 * low_power_mode == UNIFI_LOW_POWER_ENABLED.
416 */
417enum unifi_periodic_wake_mode
418{
419 UNIFI_PERIODIC_WAKE_HOST_DISABLED,
420 UNIFI_PERIODIC_WAKE_HOST_ENABLED
421};
422
423/**
424 *
425 * Run the HIP core lib Botton-Half.
426 * Whenever the HIP core lib want this function to be called
427 * by the OS layer, it calls unifi_run_bh().
428 *
429 * Typically, the SME is responsible for configuring these parameters,
430 * so unifi_sys_configure_power_mode_req() is usually implemented
431 * as a direct call to unifi_configure_low_power_mode().
432 *
433 * Note: When polling mode is used instead of interrupts,
434 * low_power_mode must never be set to UNIFI_LOW_POWER_ENABLED.
435 *
436 * @param card the HIP core lib API context.
437 *
438 * @param low_power_mode the Low Power Mode.
439 *
440 * @param periodic_wake_mode the Periodic Wake Mode.
441 *
442 * @return \b 0 if no error occurred.
443 *
444 * @return \b -CSR_E* if the request failed.
445 *
446 * @ingroup upperedge
447 */
448CsrResult unifi_configure_low_power_mode(card_t *card,
449 enum unifi_low_power_mode low_power_mode,
450 enum unifi_periodic_wake_mode periodic_wake_mode);
451
452/**
453 *
454 * Forces the UniFi chip to enter a Deep Sleep state.
455 * This is normally called by the OS layer when the platform suspends.
456 *
457 * Note that if the UniFi Low Power Mode is disabled this call fails.
458 *
459 * @param card the HIP core lib API context.
460 *
461 * @return \b 0 if no error occurred.
462 *
463 * @return \b -CSR_ENODEV if the card is no longer present.
464 *
465 * @return \b -CSR_E* if the request failed.
466 *
467 * @ingroup upperedge
468 */
469CsrResult unifi_force_low_power_mode(card_t *card);
470
471#ifndef CSR_WIFI_HIP_TA_DISABLE
472/**
473 * Configure the Traffic Analysis sampling
474 *
475 * Enable or disable statistics gathering.
476 * Enable or disable particular packet detection.
477 *
478 * @param card the HIP core context
479 * @param config_type the item to configure
480 * @param config pointer to struct containing config info
481 *
482 * @return \b 0 if configuration was successful
483 *
484 * @return \b -CSR_EINVAL if a parameter had an invalid value
485 *
486 * @ingroup upperedge
487 */
488CsrResult unifi_ta_configure(card_t *card,
489 CsrWifiRouterCtrlTrafficConfigType config_type,
490 const CsrWifiRouterCtrlTrafficConfig *config);
491
492/**
493 * Pass a packet for Traffic Analysis sampling
494 *
495 * @param card the HIP core context
496 * @param direction the direction (Rx or Tx) of the frame.
497 * @param data pointer to bulkdata struct containing the packet
498 * @param saddr the source address of the packet
499 * @param sta_macaddr the MAC address of the UniFi chip
500 * @param timestamp the current time in msecs
501 *
502 * @ingroup upperedge
503 */
504void unifi_ta_sample(card_t *card,
505 CsrWifiRouterCtrlProtocolDirection direction,
506 const bulk_data_desc_t *data,
507 const u8 *saddr,
508 const u8 *sta_macaddr,
509 u32 timestamp,
510 u16 rate);
511
512/**
513 * Notify the HIP core lib for a detected Traffic Classification.
514 * Typically, the SME is responsible for configuring these parameters,
515 * so unifi_sys_traffic_classification_req() is usually implemented
516 * as a direct call to unifi_ta_classification().
517 *
518 * @param card the HIP core context.
519 * @param traffic_type the detected traffic type.
520 * @param period The detected period of the traffic.
521 *
522 * @ingroup upperedge
523 */
524void unifi_ta_classification(card_t *card,
525 CsrWifiRouterCtrlTrafficType traffic_type,
526 u16 period);
527
528#endif
529/**
530 * Use software to hard reset the chip.
531 * This is a subset of the unifi_init_card() functionality and should
532 * only be used only to reset a paniced chip before a coredump is taken.
533 *
534 * @param card the HIP core context.
535 *
536 * @ingroup upperedge
537 */
538CsrResult unifi_card_hard_reset(card_t *card);
539
540
541CsrResult unifi_card_readn(card_t *card, u32 unifi_addr, void *pdata, u16 len);
542CsrResult unifi_card_read16(card_t *card, u32 unifi_addr, u16 *pdata);
543CsrResult unifi_card_write16(card_t *card, u32 unifi_addr, u16 data);
544
545
546enum unifi_dbg_processors_select
547{
548 UNIFI_PROC_MAC,
549 UNIFI_PROC_PHY,
550 UNIFI_PROC_BT,
551 UNIFI_PROC_BOTH,
552 UNIFI_PROC_INVALID
553};
554
555CsrResult unifi_card_stop_processor(card_t *card, enum unifi_dbg_processors_select which);
556
557/**
558 * Call-outs from the HIP core lib to the OS layer.
559 * The following functions need to be implemented during the porting exercise.
560 */
561
562/**
563 * Selects appropriate queue according to priority
564 * Helps maintain uniformity in queue selection between the HIP
565 * and the OS layers.
566 *
567 * @param priority priority of the packet
568 *
569 * @return \b Traffic queue to which a packet of this priority belongs
570 *
571 * @ingroup upperedge
572 */
573unifi_TrafficQueue
574unifi_frame_priority_to_queue(CSR_PRIORITY priority);
575
576/**
577 * Returns the priority corresponding to a particular Queue when that is used
578 * when downgrading a packet to a lower AC.
579 * Helps maintain uniformity in queue - priority mapping between the HIP
580 * and the OS layers.
581 *
582 * @param queue
583 *
584 * @return \b Highest priority corresponding to this queue
585 *
586 * @ingroup upperedge
587 */
588CSR_PRIORITY unifi_get_default_downgrade_priority(unifi_TrafficQueue queue);
589
590/**
591 *
592 * Flow control callbacks.
593 * unifi_pause_xmit() is called when the HIP core lib does not have any
594 * resources to store data packets. The OS layer needs to pause
595 * the Tx data plane until unifi_restart_xmit() is called.
596 *
597 * @param ospriv the OS layer context.
598 *
599 * @ingroup upperedge
600 */
601void unifi_pause_xmit(void *ospriv, unifi_TrafficQueue queue);
602void unifi_restart_xmit(void *ospriv, unifi_TrafficQueue queue);
603
604/**
605 *
606 * Request to run the Bottom-Half.
607 * The HIP core lib calls this function to request that unifi_bh()
608 * needs to be run by the OS layer. It can be called anytime, i.e.
609 * when the unifi_bh() is running.
610 * Since unifi_bh() is not re-entrant, usually unifi_run_bh() sets
611 * an event to a thread that schedules a call to unifi_bh().
612 *
613 * @param ospriv the OS layer context.
614 *
615 * @ingroup upperedge
616 */
617CsrResult unifi_run_bh(void *ospriv);
618
619/**
620 *
621 * Delivers a signal received from UniFi to the OS layer.
622 * Normally, the data signals should be delivered to the data plane
623 * and all the rest to the SME (unifi_sys_hip_ind()).
624 *
625 * Note that the OS layer is responsible for freeing the bulkdata
626 * buffers, using unifi_net_data_free().
627 *
628 * @param ospriv the OS layer context.
629 *
630 * @param sigptr pointer to the signal.
631 *
632 * @param siglen size of the signal.
633 *
634 * @param bulkdata pointer to the bulk data associated with the signal.
635 *
636 * @ingroup upperedge
637 */
638void unifi_receive_event(void *ospriv,
639 u8 *sigdata, u32 siglen,
640 const bulk_data_param_t *bulkdata);
641
642#ifdef CSR_WIFI_REQUEUE_PACKET_TO_HAL
643/**
644 *
645 * Used to reque the failed ma packet request back to hal queues
646 *
647 * @param ospriv the OS layer context.
648 *
649 * @param host_tag host tag for the packet to requeue.
650 *
651 * @param bulkDataDesc pointer to the bulk data.
652 *
653 * @ingroup upperedge
654 */
655CsrResult unifi_reque_ma_packet_request(void *ospriv, u32 host_tag,
656 u16 status,
657 bulk_data_desc_t *bulkDataDesc);
658
659#endif
660typedef struct
661{
662 u16 free_fh_sig_queue_slots[UNIFI_NO_OF_TX_QS];
663 u16 free_fh_bulkdata_slots;
664 u16 free_fh_fw_slots;
665} unifi_HipQosInfo;
666
667void unifi_get_hip_qos_info(card_t *card, unifi_HipQosInfo *hipqosinfo);
668
669
670/**
671 * Functions that read a portion of a firmware file.
672 *
673 * Note: If the UniFi chip runs the f/w from ROM, the HIP core may never
674 * call these functions. Also, the HIP core may call these functions even if
675 * a f/w file is not available. In this case, it is safe to fail the request.
676 */
677#define UNIFI_FW_STA 1 /* Identify STA firmware file */
678
679/**
680 *
681 * Ask the OS layer to initialise a read from a f/w file.
682 *
683 * @param ospriv the OS layer context.
684 *
685 * @param is_fw if 0 the request if for the loader file, if 1 the request
686 * is for a f/w file.
687 *
688 * @param info a card_info_t structure containing versions information.
689 * Note that some members of the structure may not be initialised.
690 *
691 * @return \p NULL if the file is not available, or a pointer which contains
692 * OS specific information for the file (typically the contents of the file)
693 * that the HIP core uses when calling unifi_fw_read() and unifi_fw_read_stop()
694 *
695 * @ingroup upperedge
696 */
697void* unifi_fw_read_start(void *ospriv, s8 is_fw, const card_info_t *info);
698
699/**
700 *
701 * Ask the OS layer to return a portion from a f/w file.
702 *
703 * @param ospriv the OS layer context.
704 *
705 * @param arg the OS pointer returned by unifi_fw_read_start().
706 *
707 * @param offset the offset in the f/w file to read the read from.
708 *
709 * @param buf the buffer to store the returned data.
710 *
711 * @param len the size in bytes of the requested read.
712 *
713 * @ingroup upperedge
714 */
715s32 unifi_fw_read(void *ospriv, void *arg, u32 offset, void *buf, u32 len);
716
717/**
718 *
719 * Ask the OS layer to finish reading from a f/w file.
720 *
721 * @param ospriv the OS layer context.
722 *
723 * @param dlpriv the OS pointer returned by unifi_fw_read_start().
724 *
725 * @ingroup upperedge
726 */
727void unifi_fw_read_stop(void *ospriv, void *dlpriv);
728
729/**
730 *
731 * Ask OS layer for a handle to a dynamically allocated firmware buffer
732 * (primarily intended for production test images which may need conversion)
733 *
734 * @param ospriv the OS layer context.
735 *
736 * @param fwbuf pointer to dynamically allocated buffer
737 *
738 * @param len length of provided buffer in bytes
739 *
740 * @ingroup upperedge
741 */
742void* unifi_fw_open_buffer(void *ospriv, void *fwbuf, u32 len);
743
744/**
745 *
746 * Release a handle to a dynamically allocated firmware buffer
747 * (primarily intended for production test images which may need conversion)
748 *
749 * @param ospriv the OS layer context.
750 *
751 * @param fwbuf pointer to dynamically allocated buffer
752 *
753 * @ingroup upperedge
754 */
755void unifi_fw_close_buffer(void *ospriv, void *fwbuf);
756
757#ifndef CSR_WIFI_HIP_TA_DISABLE
758/*
759 * Driver must provide these.
760 *
761 * A simple implementation will just call
762 * unifi_sys_traffic_protocol_ind() or unifi_sys_traffic_classification_ind()
763 * respectively. See sme_csr_userspace/sme_userspace.c.
764 */
765/**
766 *
767 * Indicates a detected packet of type packet_type.
768 * Typically, this information is processed by the SME so
769 * unifi_ta_indicate_protocol() needs to schedule a call to
770 * unifi_sys_traffic_protocol_ind().
771 *
772 * @param ospriv the OS layer context.
773 *
774 * @param packet_type the detected packet type.
775 *
776 * @param direction the direction of the packet (Rx, Tx).
777 *
778 * @param src_addr the source address of the packet.
779 *
780 * @ingroup upperedge
781 */
782void unifi_ta_indicate_protocol(void *ospriv,
783 CsrWifiRouterCtrlTrafficPacketType packet_type,
784 CsrWifiRouterCtrlProtocolDirection direction,
785 const CsrWifiMacAddress *src_addr);
786
787/**
788 *
789 * Indicates statistics for the sample data over a period.
790 * Typically, this information is processed by the SME so
791 * unifi_ta_indicate_sampling() needs to schedule a call to
792 * unifi_sys_traffic_sample_ind().
793 *
794 * @param ospriv the OS layer context.
795 *
796 * @param stats the pointer to the structure that contains the statistics.
797 *
798 * @ingroup upperedge
799 */
800void unifi_ta_indicate_sampling(void *ospriv, CsrWifiRouterCtrlTrafficStats *stats);
801void unifi_ta_indicate_l4stats(void *ospriv,
802 u32 rxTcpThroughput,
803 u32 txTcpThroughput,
804 u32 rxUdpThroughput,
805 u32 txUdpThroughput);
806#endif
807
808void unifi_rx_queue_flush(void *ospriv);
809
810/**
811 * Call-out from the SDIO glue layer.
812 *
813 * The glue layer needs to call unifi_sdio_interrupt_handler() every time
814 * an interrupts occurs.
815 *
816 * @param card the HIP core context.
817 *
818 * @ingroup bottomedge
819 */
820void unifi_sdio_interrupt_handler(card_t *card);
821
822
823/* HELPER FUNCTIONS */
824
825/*
826 * unifi_init() and unifi_download() implement a subset of unifi_init_card functionality
827 * that excludes HIP initialization.
828 */
829CsrResult unifi_init(card_t *card);
830CsrResult unifi_download(card_t *card, s32 led_mask);
831
832/*
833 * unifi_start_processors() ensures both on-chip processors are running
834 */
835CsrResult unifi_start_processors(card_t *card);
836
837CsrResult unifi_capture_panic(card_t *card);
838
839/*
840 * Configure HIP interrupt processing mode
841 */
842#define CSR_WIFI_INTMODE_DEFAULT 0
843#define CSR_WIFI_INTMODE_RUN_BH_ONCE 1 /* Run BH once per interrupt */
844
845void unifi_set_interrupt_mode(card_t *card, u32 mode);
846
847/*
848 * unifi_request_max_clock() requests that max SDIO clock speed is set at the
849 * next suitable opportunity.
850 */
851void unifi_request_max_sdio_clock(card_t *card);
852
853
854/* Functions to lookup bulk data command names. */
855const char* lookup_bulkcmd_name(u16 id);
856
857/* Function to log HIP's global debug buffer */
858#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
859void unifi_debug_buf_dump(void);
860void unifi_debug_log_to_buf(const char *fmt, ...);
861void unifi_debug_hex_to_buf(const char *buff, u16 length);
862#endif
863
864/* Mini-coredump utility functions */
865CsrResult unifi_coredump_get_value(card_t *card, struct unifi_coredump_req *req);
866CsrResult unifi_coredump_capture(card_t *card, struct unifi_coredump_req *req);
867CsrResult unifi_coredump_request_at_next_reset(card_t *card, s8 enable);
868CsrResult unifi_coredump_init(card_t *card, u16 num_dump_buffers);
869void unifi_coredump_free(card_t *card);
870
871#endif /* __CSR_WIFI_HIP_UNIFI_H__ */
diff --git a/drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c b/drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c
deleted file mode 100644
index 9a3528599f3c..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c
+++ /dev/null
@@ -1,41 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11#include "csr_wifi_hip_unifi.h"
12
13struct sig_name {
14 s16 id;
15 const char *name;
16};
17
18static const struct sig_name Unifi_bulkcmd_names[] = {
19 { 0, "SignalCmd" },
20 { 1, "CopyToHost" },
21 { 2, "CopyToHostAck" },
22 { 3, "CopyFromHost" },
23 { 4, "CopyFromHostAck" },
24 { 5, "ClearSlot" },
25 { 6, "CopyOverlay" },
26 { 7, "CopyOverlayAck" },
27 { 8, "CopyFromHostAndClearSlot" },
28 { 15, "Padding" }
29};
30
31const char *lookup_bulkcmd_name(u16 id)
32{
33 if (id < 9)
34 return Unifi_bulkcmd_names[id].name;
35 if (id == 15)
36 return "Padding";
37
38 return "UNKNOWN";
39}
40
41
diff --git a/drivers/staging/csr/csr_wifi_hip_unifi_udi.h b/drivers/staging/csr/csr_wifi_hip_unifi_udi.h
deleted file mode 100644
index 4126e85bfe9b..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_unifi_udi.h
+++ /dev/null
@@ -1,52 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/*
12 * ---------------------------------------------------------------------------
13 * FILE: csr_wifi_hip_unifi_udi.h
14 *
15 * PURPOSE:
16 * Declarations and definitions for the UniFi Debug Interface.
17 *
18 * ---------------------------------------------------------------------------
19 */
20#ifndef __CSR_WIFI_HIP_UNIFI_UDI_H__
21#define __CSR_WIFI_HIP_UNIFI_UDI_H__
22
23#include "csr_wifi_hip_unifi.h"
24#include "csr_wifi_hip_signals.h"
25
26
27/*
28 * Support for tracing the wire protocol.
29 */
30enum udi_log_direction
31{
32 UDI_LOG_FROM_HOST = 0x0000,
33 UDI_LOG_TO_HOST = 0x0001
34};
35
36typedef void (*udi_func_t)(void *ospriv, u8 *sigdata,
37 u32 signal_len,
38 const bulk_data_param_t *bulkdata,
39 enum udi_log_direction dir);
40
41CsrResult unifi_set_udi_hook(card_t *card, udi_func_t udi_fn);
42CsrResult unifi_remove_udi_hook(card_t *card, udi_func_t udi_fn);
43
44
45/*
46 * Function to print current status info to a string.
47 * This is used in the linux /proc interface and might be useful
48 * in other systems.
49 */
50s32 unifi_print_status(card_t *card, struct seq_file *m);
51
52#endif /* __CSR_WIFI_HIP_UNIFI_UDI_H__ */
diff --git a/drivers/staging/csr/csr_wifi_hip_unifihw.h b/drivers/staging/csr/csr_wifi_hip_unifihw.h
deleted file mode 100644
index 3f9fcbd55b55..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_unifihw.h
+++ /dev/null
@@ -1,59 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/*
12 * ---------------------------------------------------------------------------
13 *
14 * File: csr_wifi_hip_unifihw.h
15 *
16 * Definitions of various chip registers, addresses, values etc.
17 *
18 * ---------------------------------------------------------------------------
19 */
20#ifndef __UNIFIHW_H__
21#define __UNIFIHW_H__ 1
22
23/* Symbol Look Up Table fingerprint. IDs are in sigs.h */
24#define SLUT_FINGERPRINT 0xD397
25
26
27/* Values of LoaderOperation */
28#define UNIFI_LOADER_IDLE 0x00
29#define UNIFI_LOADER_COPY 0x01
30#define UNIFI_LOADER_ERROR_MASK 0xF0
31
32/* Values of BootLoaderOperation */
33#define UNIFI_BOOT_LOADER_IDLE 0x00
34#define UNIFI_BOOT_LOADER_RESTART 0x01
35#define UNIFI_BOOT_LOADER_PATCH 0x02
36#define UNIFI_BOOT_LOADER_LOAD_STA 0x10
37#define UNIFI_BOOT_LOADER_LOAD_PTEST 0x11
38
39
40/* Memory spaces encoded in top byte of Generic Pointer type */
41#define UNIFI_SH_DMEM 0x01 /* Shared Data Memory */
42#define UNIFI_EXT_FLASH 0x02 /* External FLASH */
43#define UNIFI_EXT_SRAM 0x03 /* External SRAM */
44#define UNIFI_REGISTERS 0x04 /* Registers */
45#define UNIFI_PHY_DMEM 0x10 /* PHY Data Memory */
46#define UNIFI_PHY_PMEM 0x11 /* PHY Program Memory */
47#define UNIFI_PHY_ROM 0x12 /* PHY ROM */
48#define UNIFI_MAC_DMEM 0x20 /* MAC Data Memory */
49#define UNIFI_MAC_PMEM 0x21 /* MAC Program Memory */
50#define UNIFI_MAC_ROM 0x22 /* MAC ROM */
51#define UNIFI_BT_DMEM 0x30 /* BT Data Memory */
52#define UNIFI_BT_PMEM 0x31 /* BT Program Memory */
53#define UNIFI_BT_ROM 0x32 /* BT ROM */
54
55#define UNIFI_MAKE_GP(R, O) (((UNIFI_ ## R) << 24) | (O))
56#define UNIFI_GP_OFFSET(GP) ((GP) & 0xFFFFFF)
57#define UNIFI_GP_SPACE(GP) (((GP) >> 24) & 0xFF)
58
59#endif /* __UNIFIHW_H__ */
diff --git a/drivers/staging/csr/csr_wifi_hip_unifiversion.h b/drivers/staging/csr/csr_wifi_hip_unifiversion.h
deleted file mode 100644
index d1c66783f32c..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_unifiversion.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/*
12 * ---------------------------------------------------------------------------
13 * FILE: unifiversion.h
14 *
15 * PURPOSE:
16 * Version information for the portable UniFi driver.
17 *
18 * ---------------------------------------------------------------------------
19 */
20
21#ifndef __UNIFIVERSION_H__
22#define __UNIFIVERSION_H__
23
24/*
25 * The minimum version of Host Interface Protocol required by the driver.
26 */
27#define UNIFI_HIP_MAJOR_VERSION 9
28#define UNIFI_HIP_MINOR_VERSION 1
29
30#endif /* __UNIFIVERSION_H__ */
diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.c b/drivers/staging/csr/csr_wifi_hip_xbv.c
deleted file mode 100644
index 050a15fbadf9..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_xbv.c
+++ /dev/null
@@ -1,1076 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/*
12 * ---------------------------------------------------------------------------
13 * FILE: csr_wifi_hip_xbv.c
14 *
15 * PURPOSE:
16 * Routines for downloading firmware to UniFi.
17 *
18 * UniFi firmware files use a nested TLV (Tag-Length-Value) format.
19 *
20 * ---------------------------------------------------------------------------
21 */
22#include <linux/slab.h>
23
24#ifdef CSR_WIFI_XBV_TEST
25/* Standalone test harness */
26#include "unifi_xbv.h"
27#include "csr_wifi_hip_unifihw.h"
28#else
29/* Normal driver build */
30#include "csr_wifi_hip_unifiversion.h"
31#include "csr_wifi_hip_card.h"
32#define DBG_TAG(t)
33#endif
34
35#include "csr_wifi_hip_xbv.h"
36
37#define STREAM_CHECKSUM 0x6d34 /* Sum of uint16s in each patch stream */
38
39/* XBV sizes used in patch conversion
40 */
41#define PTDL_MAX_SIZE 2048 /* Max bytes allowed per PTDL */
42#define PTDL_HDR_SIZE (4 + 2 + 6 + 2) /* sizeof(fw_id, sec_len, patch_cmd, csum) */
43
44/* Struct to represent a buffer for reading firmware file */
45
46typedef struct
47{
48 void *dlpriv;
49 s32 ioffset;
50 fwreadfn_t iread;
51} ct_t;
52
53/* Struct to represent a TLV field */
54typedef struct
55{
56 char t_name[4];
57 u32 t_len;
58} tag_t;
59
60
61#define TAG_EQ(i, v) (((i)[0] == (v)[0]) && \
62 ((i)[1] == (v)[1]) && \
63 ((i)[2] == (v)[2]) && \
64 ((i)[3] == (v)[3]))
65
66/* We create a small stack on the stack that contains an enum
67 * indicating the containing list segments, and the offset at which
68 * those lists end. This enables a lot more error checking. */
69typedef enum
70{
71 xbv_xbv1,
72 /*xbv_info,*/
73 xbv_fw,
74 xbv_vers,
75 xbv_vand,
76 xbv_ptch,
77 xbv_other
78} xbv_container;
79
80#define XBV_STACK_SIZE 6
81#define XBV_MAX_OFFS 0x7fffffff
82
83typedef struct
84{
85 struct
86 {
87 xbv_container container;
88 s32 ioffset_end;
89 } s[XBV_STACK_SIZE];
90 u32 ptr;
91} xbv_stack_t;
92
93static s32 read_tag(card_t *card, ct_t *ct, tag_t *tag);
94static s32 read_bytes(card_t *card, ct_t *ct, void *buf, u32 len);
95static s32 read_uint(card_t *card, ct_t *ct, u32 *u, u32 len);
96static s32 xbv_check(xbv1_t *fwinfo, const xbv_stack_t *stack,
97 xbv_mode new_mode, xbv_container old_cont);
98static s32 xbv_push(xbv1_t *fwinfo, xbv_stack_t *stack,
99 xbv_mode new_mode, xbv_container old_cont,
100 xbv_container new_cont, u32 ioff);
101
102static u32 write_uint16(void *buf, const u32 offset,
103 const u16 val);
104static u32 write_uint32(void *buf, const u32 offset,
105 const u32 val);
106static u32 write_bytes(void *buf, const u32 offset,
107 const u8 *data, const u32 len);
108static u32 write_tag(void *buf, const u32 offset,
109 const char *tag_str);
110static u32 write_chunk(void *buf, const u32 offset,
111 const char *tag_str,
112 const u32 payload_len);
113static u16 calc_checksum(void *buf, const u32 offset,
114 const u32 bytes_len);
115static u32 calc_patch_size(const xbv1_t *fwinfo);
116
117static u32 write_xbv_header(void *buf, const u32 offset,
118 const u32 file_payload_length);
119static u32 write_ptch_header(void *buf, const u32 offset,
120 const u32 fw_id);
121static u32 write_patchcmd(void *buf, const u32 offset,
122 const u32 dst_genaddr, const u16 len);
123static u32 write_reset_ptdl(void *buf, const u32 offset,
124 const xbv1_t *fwinfo, u32 fw_id);
125static u32 write_fwdl_to_ptdl(void *buf, const u32 offset,
126 fwreadfn_t readfn, const struct FWDL *fwdl,
127 const void *fw_buf, const u32 fw_id,
128 void *rdbuf);
129
130/*
131 * ---------------------------------------------------------------------------
132 * parse_xbv1
133 *
134 * Scan the firmware file to find the TLVs we are interested in.
135 * Actions performed:
136 * - check we support the file format version in VERF
137 * Store these TLVs if we have a firmware image:
138 * - SLTP Symbol Lookup Table Pointer
139 * - FWDL firmware download segments
140 * - FWOL firmware overlay segment
141 * - VMEQ Register probe tests to verify matching h/w
142 * Store these TLVs if we have a patch file:
143 * - FWID the firmware build ID that this file patches
144 * - PTDL The actual patches
145 *
146 * The structure pointed to by fwinfo is cleared and
147 * 'fwinfo->mode' is set to 'unknown'. The 'fwinfo->mode'
148 * variable is set to 'firmware' or 'patch' once we know which
149 * sort of XBV file we have.
150 *
151 * Arguments:
152 * readfn Pointer to function to call to read from the file.
153 * dlpriv Opaque pointer arg to pass to readfn.
154 * fwinfo Pointer to fwinfo struct to fill in.
155 *
156 * Returns:
157 * CSR_RESULT_SUCCESS on success, CSR error code on failure
158 * ---------------------------------------------------------------------------
159 */
160CsrResult xbv1_parse(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo)
161{
162 ct_t ct;
163 tag_t tag;
164 xbv_stack_t stack;
165
166 ct.dlpriv = dlpriv;
167 ct.ioffset = 0;
168 ct.iread = readfn;
169
170 memset(fwinfo, 0, sizeof(xbv1_t));
171 fwinfo->mode = xbv_unknown;
172
173 /* File must start with XBV1 triplet */
174 if (read_tag(card, &ct, &tag) <= 0)
175 {
176 unifi_error(NULL, "File is not UniFi firmware\n");
177 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
178 }
179
180 DBG_TAG(tag.t_name);
181
182 if (!TAG_EQ(tag.t_name, "XBV1"))
183 {
184 unifi_error(NULL, "File is not UniFi firmware (%s)\n", tag.t_name);
185 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
186 }
187
188 stack.ptr = 0;
189 stack.s[stack.ptr].container = xbv_xbv1;
190 stack.s[stack.ptr].ioffset_end = XBV_MAX_OFFS;
191
192 /* Now scan the file */
193 while (1)
194 {
195 s32 n;
196
197 n = read_tag(card, &ct, &tag);
198 if (n < 0)
199 {
200 unifi_error(NULL, "No tag\n");
201 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
202 }
203 if (n == 0)
204 {
205 /* End of file */
206 break;
207 }
208
209 DBG_TAG(tag.t_name);
210
211 /* File format version */
212 if (TAG_EQ(tag.t_name, "VERF"))
213 {
214 u32 version;
215
216 if (xbv_check(fwinfo, &stack, xbv_unknown, xbv_xbv1) ||
217 (tag.t_len != 2) ||
218 read_uint(card, &ct, &version, 2))
219 {
220 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
221 }
222 if (version != 0)
223 {
224 unifi_error(NULL, "Unsupported firmware file version: %d.%d\n",
225 version >> 8, version & 0xFF);
226 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
227 }
228 }
229 else if (TAG_EQ(tag.t_name, "LIST"))
230 {
231 char name[4];
232 u32 list_end;
233
234 list_end = ct.ioffset + tag.t_len;
235
236 if (read_bytes(card, &ct, name, 4))
237 {
238 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
239 }
240
241 DBG_TAG(name);
242 if (TAG_EQ(name, "FW "))
243 {
244 if (xbv_push(fwinfo, &stack, xbv_firmware, xbv_xbv1, xbv_fw, list_end))
245 {
246 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
247 }
248 }
249 else if (TAG_EQ(name, "VERS"))
250 {
251 if (xbv_push(fwinfo, &stack, xbv_firmware, xbv_fw, xbv_vers, list_end) ||
252 (fwinfo->vers.num_vand != 0))
253 {
254 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
255 }
256 }
257 else if (TAG_EQ(name, "VAND"))
258 {
259 struct VAND *vand;
260
261 if (xbv_push(fwinfo, &stack, xbv_firmware, xbv_vers, xbv_vand, list_end) ||
262 (fwinfo->vers.num_vand >= MAX_VAND))
263 {
264 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
265 }
266
267 /* Get a new VAND */
268 vand = fwinfo->vand + fwinfo->vers.num_vand++;
269
270 /* Fill it in */
271 vand->first = fwinfo->num_vmeq;
272 vand->count = 0;
273 }
274 else if (TAG_EQ(name, "PTCH"))
275 {
276 if (xbv_push(fwinfo, &stack, xbv_patch, xbv_xbv1, xbv_ptch, list_end))
277 {
278 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
279 }
280 }
281 else
282 {
283 /* Skip over any other lists. We dont bother to push
284 * the new list type now as we would only pop it at
285 * the end of the outer loop. */
286 ct.ioffset += tag.t_len - 4;
287 }
288 }
289 else if (TAG_EQ(tag.t_name, "SLTP"))
290 {
291 u32 addr;
292
293 if (xbv_check(fwinfo, &stack, xbv_firmware, xbv_fw) ||
294 (tag.t_len != 4) ||
295 (fwinfo->slut_addr != 0) ||
296 read_uint(card, &ct, &addr, 4))
297 {
298 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
299 }
300
301 fwinfo->slut_addr = addr;
302 }
303 else if (TAG_EQ(tag.t_name, "FWDL"))
304 {
305 u32 addr;
306 struct FWDL *fwdl;
307
308 if (xbv_check(fwinfo, &stack, xbv_firmware, xbv_fw) ||
309 (fwinfo->num_fwdl >= MAX_FWDL) ||
310 (read_uint(card, &ct, &addr, 4)))
311 {
312 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
313 }
314
315 fwdl = fwinfo->fwdl + fwinfo->num_fwdl++;
316
317 fwdl->dl_size = tag.t_len - 4;
318 fwdl->dl_addr = addr;
319 fwdl->dl_offset = ct.ioffset;
320
321 ct.ioffset += tag.t_len - 4;
322 }
323 else if (TAG_EQ(tag.t_name, "FWOV"))
324 {
325 if (xbv_check(fwinfo, &stack, xbv_firmware, xbv_fw) ||
326 (fwinfo->fwov.dl_size != 0) ||
327 (fwinfo->fwov.dl_offset != 0))
328 {
329 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
330 }
331
332 fwinfo->fwov.dl_size = tag.t_len;
333 fwinfo->fwov.dl_offset = ct.ioffset;
334
335 ct.ioffset += tag.t_len;
336 }
337 else if (TAG_EQ(tag.t_name, "VMEQ"))
338 {
339 u32 temp[3];
340 struct VAND *vand;
341 struct VMEQ *vmeq;
342
343 if (xbv_check(fwinfo, &stack, xbv_firmware, xbv_vand) ||
344 (fwinfo->num_vmeq >= MAX_VMEQ) ||
345 (fwinfo->vers.num_vand == 0) ||
346 (tag.t_len != 8) ||
347 read_uint(card, &ct, &temp[0], 4) ||
348 read_uint(card, &ct, &temp[1], 2) ||
349 read_uint(card, &ct, &temp[2], 2))
350 {
351 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
352 }
353
354 /* Get the last VAND */
355 vand = fwinfo->vand + (fwinfo->vers.num_vand - 1);
356
357 /* Get a new VMEQ */
358 vmeq = fwinfo->vmeq + fwinfo->num_vmeq++;
359
360 /* Note that this VAND contains another VMEQ */
361 vand->count++;
362
363 /* Fill in the VMEQ */
364 vmeq->addr = temp[0];
365 vmeq->mask = (u16)temp[1];
366 vmeq->value = (u16)temp[2];
367 }
368 else if (TAG_EQ(tag.t_name, "FWID"))
369 {
370 u32 build_id;
371
372 if (xbv_check(fwinfo, &stack, xbv_patch, xbv_ptch) ||
373 (tag.t_len != 4) ||
374 (fwinfo->build_id != 0) ||
375 read_uint(card, &ct, &build_id, 4))
376 {
377 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
378 }
379
380 fwinfo->build_id = build_id;
381 }
382 else if (TAG_EQ(tag.t_name, "PTDL"))
383 {
384 struct PTDL *ptdl;
385
386 if (xbv_check(fwinfo, &stack, xbv_patch, xbv_ptch) ||
387 (fwinfo->num_ptdl >= MAX_PTDL))
388 {
389 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
390 }
391
392 /* Allocate a new PTDL */
393 ptdl = fwinfo->ptdl + fwinfo->num_ptdl++;
394
395 ptdl->dl_size = tag.t_len;
396 ptdl->dl_offset = ct.ioffset;
397
398 ct.ioffset += tag.t_len;
399 }
400 else
401 {
402 /*
403 * If we get here it is a tag we are not interested in,
404 * just skip over it.
405 */
406 ct.ioffset += tag.t_len;
407 }
408
409 /* Check to see if we are at the end of the currently stacked
410 * segment. We could finish more than one list at a time. */
411 while (ct.ioffset >= stack.s[stack.ptr].ioffset_end)
412 {
413 if (ct.ioffset > stack.s[stack.ptr].ioffset_end)
414 {
415 unifi_error(NULL,
416 "XBV file has overrun stack'd segment %d (%d > %d)\n",
417 stack.ptr, ct.ioffset, stack.s[stack.ptr].ioffset_end);
418 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
419 }
420 if (stack.ptr <= 0)
421 {
422 unifi_error(NULL, "XBV file has underrun stack pointer\n");
423 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
424 }
425 stack.ptr--;
426 }
427 }
428
429 if (stack.ptr != 0)
430 {
431 unifi_error(NULL, "Last list of XBV is not complete.\n");
432 return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
433 }
434
435 return CSR_RESULT_SUCCESS;
436} /* xbv1_parse() */
437
438
439/* Check the the XBV file is of a consistant sort (either firmware or
440 * patch) and that we are in the correct containing list type. */
441static s32 xbv_check(xbv1_t *fwinfo, const xbv_stack_t *stack,
442 xbv_mode new_mode, xbv_container old_cont)
443{
444 /* If the new file mode is unknown the current packet could be in
445 * either (any) type of XBV file, and we cant make a decission at
446 * this time. */
447 if (new_mode != xbv_unknown)
448 {
449 if (fwinfo->mode == xbv_unknown)
450 {
451 fwinfo->mode = new_mode;
452 }
453 else if (fwinfo->mode != new_mode)
454 {
455 return -1;
456 }
457 }
458 /* If the current stack top doesn't match what we expect then the
459 * file is corrupt. */
460 if (stack->s[stack->ptr].container != old_cont)
461 {
462 return -1;
463 }
464 return 0;
465}
466
467
468/* Make checks as above and then enter a new list */
469static s32 xbv_push(xbv1_t *fwinfo, xbv_stack_t *stack,
470 xbv_mode new_mode, xbv_container old_cont,
471 xbv_container new_cont, u32 new_ioff)
472{
473 if (xbv_check(fwinfo, stack, new_mode, old_cont))
474 {
475 return -1;
476 }
477
478 /* Check that our stack won't overflow. */
479 if (stack->ptr >= (XBV_STACK_SIZE - 1))
480 {
481 return -1;
482 }
483
484 /* Add the new list element to the top of the stack. */
485 stack->ptr++;
486 stack->s[stack->ptr].container = new_cont;
487 stack->s[stack->ptr].ioffset_end = new_ioff;
488
489 return 0;
490}
491
492
493static u32 xbv2uint(u8 *ptr, s32 len)
494{
495 u32 u = 0;
496 s16 i;
497
498 for (i = 0; i < len; i++)
499 {
500 u32 b;
501 b = ptr[i];
502 u += b << (i * 8);
503 }
504 return u;
505}
506
507
508static s32 read_tag(card_t *card, ct_t *ct, tag_t *tag)
509{
510 u8 buf[8];
511 s32 n;
512
513 n = (*ct->iread)(card->ospriv, ct->dlpriv, ct->ioffset, buf, 8);
514 if (n <= 0)
515 {
516 return n;
517 }
518
519 /* read the tag and length */
520 if (n != 8)
521 {
522 return -1;
523 }
524
525 /* get section tag */
526 memcpy(tag->t_name, buf, 4);
527
528 /* get section length */
529 tag->t_len = xbv2uint(buf + 4, 4);
530
531 ct->ioffset += 8;
532
533 return 8;
534} /* read_tag() */
535
536
537static s32 read_bytes(card_t *card, ct_t *ct, void *buf, u32 len)
538{
539 /* read the tag value */
540 if ((*ct->iread)(card->ospriv, ct->dlpriv, ct->ioffset, buf, len) != (s32)len)
541 {
542 return -1;
543 }
544
545 ct->ioffset += len;
546
547 return 0;
548} /* read_bytes() */
549
550
551static s32 read_uint(card_t *card, ct_t *ct, u32 *u, u32 len)
552{
553 u8 buf[4];
554
555 /* Integer cannot be more than 4 bytes */
556 if (len > 4)
557 {
558 return -1;
559 }
560
561 if (read_bytes(card, ct, buf, len))
562 {
563 return -1;
564 }
565
566 *u = xbv2uint(buf, len);
567
568 return 0;
569} /* read_uint() */
570
571
572static u32 write_uint16(void *buf, const u32 offset, const u16 val)
573{
574 u8 *dst = (u8 *)buf + offset;
575 *dst++ = (u8)(val & 0xff); /* LSB first */
576 *dst = (u8)(val >> 8);
577 return sizeof(u16);
578}
579
580
581static u32 write_uint32(void *buf, const u32 offset, const u32 val)
582{
583 (void)write_uint16(buf, offset + 0, (u16)(val & 0xffff));
584 (void)write_uint16(buf, offset + 2, (u16)(val >> 16));
585 return sizeof(u32);
586}
587
588
589static u32 write_bytes(void *buf, const u32 offset, const u8 *data, const u32 len)
590{
591 u32 i;
592 u8 *dst = (u8 *)buf + offset;
593
594 for (i = 0; i < len; i++)
595 {
596 *dst++ = *((u8 *)data + i);
597 }
598 return len;
599}
600
601
602static u32 write_tag(void *buf, const u32 offset, const char *tag_str)
603{
604 u8 *dst = (u8 *)buf + offset;
605 memcpy(dst, tag_str, 4);
606 return 4;
607}
608
609
610static u32 write_chunk(void *buf, const u32 offset, const char *tag_str, const u32 payload_len)
611{
612 u32 written = 0;
613 written += write_tag(buf, offset, tag_str);
614 written += write_uint32(buf, written + offset, (u32)payload_len);
615
616 return written;
617}
618
619
620static u16 calc_checksum(void *buf, const u32 offset, const u32 bytes_len)
621{
622 u32 i;
623 u8 *src = (u8 *)buf + offset;
624 u16 sum = 0;
625 u16 val;
626
627 for (i = 0; i < bytes_len / 2; i++)
628 {
629 /* Contents copied to file is LE, host might not be */
630 val = (u16) * src++; /* LSB */
631 val += (u16)(*src++) << 8; /* MSB */
632 sum += val;
633 }
634
635 /* Total of uint16s in the stream plus the stored check value
636 * should equal STREAM_CHECKSUM when decoded.
637 */
638 return (STREAM_CHECKSUM - sum);
639}
640
641
642#define PTDL_RESET_DATA_SIZE 20 /* Size of reset vectors PTDL */
643
644static u32 calc_patch_size(const xbv1_t *fwinfo)
645{
646 s16 i;
647 u32 size = 0;
648
649 /*
650 * Work out how big an equivalent patch format file must be for this image.
651 * This only needs to be approximate, so long as it's large enough.
652 */
653 if (fwinfo->mode != xbv_firmware)
654 {
655 return 0;
656 }
657
658 /* Payload (which will get put into a series of PTDLs) */
659 for (i = 0; i < fwinfo->num_fwdl; i++)
660 {
661 size += fwinfo->fwdl[i].dl_size;
662 }
663
664 /* Another PTDL at the end containing reset vectors */
665 size += PTDL_RESET_DATA_SIZE;
666
667 /* PTDL headers. Add one for remainder, one for reset vectors */
668 size += ((fwinfo->num_fwdl / PTDL_MAX_SIZE) + 2) * PTDL_HDR_SIZE;
669
670 /* Another 1K sufficient to cover miscellaneous headers */
671 size += 1024;
672
673 return size;
674}
675
676
677static u32 write_xbv_header(void *buf, const u32 offset, const u32 file_payload_length)
678{
679 u32 written = 0;
680
681 /* The length value given to the XBV chunk is the length of all subsequent
682 * contents of the file, excluding the 8 byte size of the XBV1 header itself
683 * (The added 6 bytes thus accounts for the size of the VERF)
684 */
685 written += write_chunk(buf, offset + written, (char *)"XBV1", file_payload_length + 6);
686
687 written += write_chunk(buf, offset + written, (char *)"VERF", 2);
688 written += write_uint16(buf, offset + written, 0); /* File version */
689
690 return written;
691}
692
693
694static u32 write_ptch_header(void *buf, const u32 offset, const u32 fw_id)
695{
696 u32 written = 0;
697
698 /* LIST is written with a zero length, to be updated later */
699 written += write_chunk(buf, offset + written, (char *)"LIST", 0);
700 written += write_tag(buf, offset + written, (char *)"PTCH"); /* List type */
701
702 written += write_chunk(buf, offset + written, (char *)"FWID", 4);
703 written += write_uint32(buf, offset + written, fw_id);
704
705
706 return written;
707}
708
709
710#define UF_REGION_PHY 1
711#define UF_REGION_MAC 2
712#define UF_MEMPUT_MAC 0x0000
713#define UF_MEMPUT_PHY 0x1000
714
715static u32 write_patchcmd(void *buf, const u32 offset, const u32 dst_genaddr, const u16 len)
716{
717 u32 written = 0;
718 u32 region = (dst_genaddr >> 28);
719 u16 cmd_and_len = UF_MEMPUT_MAC;
720
721 if (region == UF_REGION_PHY)
722 {
723 cmd_and_len = UF_MEMPUT_PHY;
724 }
725 else if (region != UF_REGION_MAC)
726 {
727 return 0; /* invalid */
728 }
729
730 /* Write the command and data length */
731 cmd_and_len |= len;
732 written += write_uint16(buf, offset + written, cmd_and_len);
733
734 /* Write the destination generic address */
735 written += write_uint16(buf, offset + written, (u16)(dst_genaddr >> 16));
736 written += write_uint16(buf, offset + written, (u16)(dst_genaddr & 0xffff));
737
738 /* The data payload should be appended to the command */
739 return written;
740}
741
742
743static u32 write_fwdl_to_ptdl(void *buf, const u32 offset, fwreadfn_t readfn,
744 const struct FWDL *fwdl, const void *dlpriv,
745 const u32 fw_id, void *fw_buf)
746{
747 u32 written = 0;
748 s16 chunks = 0;
749 u32 left = fwdl->dl_size; /* Bytes left in this fwdl */
750 u32 dl_addr = fwdl->dl_addr; /* Target address of fwdl image on XAP */
751 u32 dl_offs = fwdl->dl_offset; /* Offset of fwdl image data in source */
752 u16 csum;
753 u32 csum_start_offs; /* first offset to include in checksum */
754 u32 sec_data_len; /* section data byte count */
755 u32 sec_len; /* section data + header byte count */
756
757 /* FWDL maps to one or more PTDLs, as max size for a PTDL is 1K words */
758 while (left)
759 {
760 /* Calculate amount to be transferred */
761 sec_data_len = min_t(u32, left, PTDL_MAX_SIZE - PTDL_HDR_SIZE);
762 sec_len = sec_data_len + PTDL_HDR_SIZE;
763
764 /* Write PTDL header + entire PTDL size */
765 written += write_chunk(buf, offset + written, (char *)"PTDL", sec_len);
766 /* bug digest implies 4 bytes of padding here, but that seems wrong */
767
768 /* Checksum starts here */
769 csum_start_offs = offset + written;
770
771 /* Patch-chunk header: fw_id. Note that this is in XAP word order */
772 written += write_uint16(buf, offset + written, (u16)(fw_id >> 16));
773 written += write_uint16(buf, offset + written, (u16)(fw_id & 0xffff));
774
775 /* Patch-chunk header: section length in uint16s */
776 written += write_uint16(buf, offset + written, (u16)(sec_len / 2));
777
778
779 /* Write the appropriate patch command for the data's destination ptr */
780 written += write_patchcmd(buf, offset + written, dl_addr, (u16)(sec_data_len / 2));
781
782 /* Write the data itself (limited to the max chunk length) */
783 if (readfn(NULL, (void *)dlpriv, dl_offs, fw_buf, sec_data_len) < 0)
784 {
785 return 0;
786 }
787
788 written += write_bytes(buf,
789 offset + written,
790 fw_buf,
791 sec_data_len);
792
793 /* u16 checksum calculated over data written */
794 csum = calc_checksum(buf, csum_start_offs, written - (csum_start_offs - offset));
795 written += write_uint16(buf, offset + written, csum);
796
797 left -= sec_data_len;
798 dl_addr += sec_data_len;
799 dl_offs += sec_data_len;
800 chunks++;
801 }
802
803 return written;
804}
805
806
807#define SEC_CMD_LEN ((4 + 2) * 2) /* sizeof(cmd, vector) per XAP */
808#define PTDL_VEC_HDR_SIZE (4 + 2 + 2) /* sizeof(fw_id, sec_len, csum) */
809#define UF_MAC_START_VEC 0x00c00000 /* Start address of image on MAC */
810#define UF_PHY_START_VEC 0x00c00000 /* Start address of image on PHY */
811#define UF_MAC_START_CMD 0x6000 /* MAC "Set start address" command */
812#define UF_PHY_START_CMD 0x7000 /* PHY "Set start address" command */
813
814static u32 write_reset_ptdl(void *buf, const u32 offset, const xbv1_t *fwinfo, u32 fw_id)
815{
816 u32 written = 0;
817 u16 csum;
818 u32 csum_start_offs; /* first offset to include in checksum */
819 u32 sec_len; /* section data + header byte count */
820
821 sec_len = SEC_CMD_LEN + PTDL_VEC_HDR_SIZE; /* Total section byte length */
822
823 /* Write PTDL header + entire PTDL size */
824 written += write_chunk(buf, offset + written, (char *)"PTDL", sec_len);
825
826 /* Checksum starts here */
827 csum_start_offs = offset + written;
828
829 /* Patch-chunk header: fw_id. Note that this is in XAP word order */
830 written += write_uint16(buf, offset + written, (u16)(fw_id >> 16));
831 written += write_uint16(buf, offset + written, (u16)(fw_id & 0xffff));
832
833 /* Patch-chunk header: section length in uint16s */
834 written += write_uint16(buf, offset + written, (u16)(sec_len / 2));
835
836 /*
837 * Restart addresses to be executed on subsequent loader restart command.
838 */
839
840 /* Setup the MAC start address, note word ordering */
841 written += write_uint16(buf, offset + written, UF_MAC_START_CMD);
842 written += write_uint16(buf, offset + written, (UF_MAC_START_VEC >> 16));
843 written += write_uint16(buf, offset + written, (UF_MAC_START_VEC & 0xffff));
844
845 /* Setup the PHY start address, note word ordering */
846 written += write_uint16(buf, offset + written, UF_PHY_START_CMD);
847 written += write_uint16(buf, offset + written, (UF_PHY_START_VEC >> 16));
848 written += write_uint16(buf, offset + written, (UF_PHY_START_VEC & 0xffff));
849
850 /* u16 checksum calculated over data written */
851 csum = calc_checksum(buf, csum_start_offs, written - (csum_start_offs - offset));
852 written += write_uint16(buf, offset + written, csum);
853
854 return written;
855}
856
857
858/*
859 * ---------------------------------------------------------------------------
860 * read_slut
861 *
862 * desc
863 *
864 * Arguments:
865 * readfn Pointer to function to call to read from the file.
866 * dlpriv Opaque pointer arg to pass to readfn.
867 * addr Offset into firmware image of SLUT.
868 * fwinfo Pointer to fwinfo struct to fill in.
869 *
870 * Returns:
871 * Number of SLUT entries in the f/w, or -1 if the image was corrupt.
872 * ---------------------------------------------------------------------------
873 */
874s32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo,
875 symbol_t *slut, u32 slut_len)
876{
877 s16 i;
878 s32 offset;
879 u32 magic;
880 u32 count = 0;
881 ct_t ct;
882
883 if (fwinfo->mode != xbv_firmware)
884 {
885 return -1;
886 }
887
888 /* Find the d/l segment containing the SLUT */
889 /* This relies on the SLUT being entirely contained in one segment */
890 offset = -1;
891 for (i = 0; i < fwinfo->num_fwdl; i++)
892 {
893 if ((fwinfo->slut_addr >= fwinfo->fwdl[i].dl_addr) &&
894 (fwinfo->slut_addr < (fwinfo->fwdl[i].dl_addr + fwinfo->fwdl[i].dl_size)))
895 {
896 offset = fwinfo->fwdl[i].dl_offset +
897 (fwinfo->slut_addr - fwinfo->fwdl[i].dl_addr);
898 }
899 }
900 if (offset < 0)
901 {
902 return -1;
903 }
904
905 ct.dlpriv = dlpriv;
906 ct.ioffset = offset;
907 ct.iread = readfn;
908
909 if (read_uint(card, &ct, &magic, 2))
910 {
911 return -1;
912 }
913 if (magic != SLUT_FINGERPRINT)
914 {
915 return -1;
916 }
917
918 while (count < slut_len)
919 {
920 u32 id, obj;
921
922 /* Read Symbol Id */
923 if (read_uint(card, &ct, &id, 2))
924 {
925 return -1;
926 }
927
928 /* Check for end of table marker */
929 if (id == CSR_SLT_END)
930 {
931 break;
932 }
933
934 /* Read Symbol Value */
935 if (read_uint(card, &ct, &obj, 4))
936 {
937 return -1;
938 }
939
940 slut[count].id = (u16)id;
941 slut[count].obj = obj;
942 count++;
943 }
944
945 return count;
946} /* read_slut() */
947
948
949/*
950 * ---------------------------------------------------------------------------
951 * xbv_to_patch
952 *
953 * Convert (the relevant parts of) a firmware xbv file into a patch xbv
954 *
955 * Arguments:
956 * card
957 * fw_buf - pointer to xbv firmware image
958 * fwinfo - structure describing the firmware image
959 * size - pointer to location into which size of f/w is written.
960 *
961 * Returns:
962 * Pointer to firmware image, or NULL on error. Caller must free this
963 * buffer via kfree() once it's finished with.
964 *
965 * Notes:
966 * The input fw_buf should have been checked via xbv1_parse prior to
967 * calling this function, so the input image is assumed valid.
968 * ---------------------------------------------------------------------------
969 */
970#define PTCH_LIST_SIZE 16 /* sizeof PTCH+FWID chunk in LIST header */
971
972void* xbv_to_patch(card_t *card, fwreadfn_t readfn,
973 const void *fw_buf, const xbv1_t *fwinfo, u32 *size)
974{
975 void *patch_buf = NULL;
976 u32 patch_buf_size;
977 u32 payload_offs = 0; /* Start of XBV payload */
978 s16 i;
979 u32 patch_offs = 0;
980 u32 list_len_offs = 0; /* Offset of PTDL LIST length parameter */
981 u32 ptdl_start_offs = 0; /* Offset of first PTDL chunk */
982 u32 fw_id;
983 void *rdbuf;
984
985 if (!fw_buf || !fwinfo || !card)
986 {
987 return NULL;
988 }
989
990 if (fwinfo->mode != xbv_firmware)
991 {
992 unifi_error(NULL, "Not a firmware file\n");
993 return NULL;
994 }
995
996 /* Pre-allocate read buffer for chunk conversion */
997 rdbuf = kmalloc(PTDL_MAX_SIZE, GFP_KERNEL);
998 if (!rdbuf)
999 {
1000 unifi_error(card, "Couldn't alloc conversion buffer\n");
1001 return NULL;
1002 }
1003
1004 /* Loader requires patch file's build ID to match the running firmware's */
1005 fw_id = card->build_id;
1006
1007 /* Firmware XBV1 contains VERF, optional INFO, SLUT(s), FWDL(s) */
1008 /* Other chunks should get skipped. */
1009 /* VERF should be sanity-checked against chip version */
1010
1011 /* Patch XBV1 contains VERF, optional INFO, PTCH */
1012 /* PTCH contains FWID, optional INFO, PTDL(s), PTDL(start_vec) */
1013 /* Each FWDL is split into PTDLs (each is 1024 XAP words max) */
1014 /* Each PTDL contains running ROM f/w version, and checksum */
1015 /* MAC/PHY reset addresses (known) are added into a final PTDL */
1016
1017 /* The input image has already been parsed, and loaded into fwinfo, so we
1018 * can use that to build the output image
1019 */
1020 patch_buf_size = calc_patch_size(fwinfo);
1021
1022 patch_buf = kmalloc(patch_buf_size, GFP_KERNEL);
1023 if (!patch_buf)
1024 {
1025 kfree(rdbuf);
1026 unifi_error(NULL, "Can't malloc buffer for patch conversion\n");
1027 return NULL;
1028 }
1029
1030 memset(patch_buf, 0xdd, patch_buf_size);
1031
1032 /* Write XBV + VERF headers */
1033 patch_offs += write_xbv_header(patch_buf, patch_offs, 0);
1034 payload_offs = patch_offs;
1035
1036 /* Write patch (LIST) header */
1037 list_len_offs = patch_offs + 4; /* Save LIST.length offset for later update */
1038 patch_offs += write_ptch_header(patch_buf, patch_offs, fw_id);
1039
1040 /* Save start offset of the PTDL chunks */
1041 ptdl_start_offs = patch_offs;
1042
1043 /* Write LIST of firmware PTDL blocks */
1044 for (i = 0; i < fwinfo->num_fwdl; i++)
1045 {
1046 patch_offs += write_fwdl_to_ptdl(patch_buf,
1047 patch_offs,
1048 readfn,
1049 &fwinfo->fwdl[i],
1050 fw_buf,
1051 fw_id,
1052 rdbuf);
1053 }
1054
1055 /* Write restart-vector PTDL last */
1056 patch_offs += write_reset_ptdl(patch_buf, patch_offs, fwinfo, fw_id);
1057
1058 /* Now the length is known, update the LIST.length */
1059 (void)write_uint32(patch_buf, list_len_offs,
1060 (patch_offs - ptdl_start_offs) + PTCH_LIST_SIZE);
1061
1062 /* Re write XBV headers just to fill in the correct file size */
1063 (void)write_xbv_header(patch_buf, 0, (patch_offs - payload_offs));
1064
1065 unifi_trace(card->ospriv, UDBG1, "XBV:PTCH size %u, fw_id %u\n",
1066 patch_offs, fw_id);
1067 if (size)
1068 {
1069 *size = patch_offs;
1070 }
1071 kfree(rdbuf);
1072
1073 return patch_buf;
1074}
1075
1076
diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.h b/drivers/staging/csr/csr_wifi_hip_xbv.h
deleted file mode 100644
index 3c507235323d..000000000000
--- a/drivers/staging/csr/csr_wifi_hip_xbv.h
+++ /dev/null
@@ -1,119 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/*
12 * ---------------------------------------------------------------------------
13 * FILE: csr_wifi_hip_xbv.h
14 *
15 * PURPOSE:
16 * Definitions and declarations for code to read XBV files - the UniFi
17 * firmware download file format.
18 *
19 * ---------------------------------------------------------------------------
20 */
21#ifndef __XBV_H__
22#define __XBV_H__
23
24#ifndef CSR_WIFI_XBV_TEST
25/* Driver includes */
26#include "csr_wifi_hip_unifi.h"
27#endif
28
29
30struct VMEQ
31{
32 u32 addr;
33 u16 mask;
34 u16 value;
35};
36
37struct VAND
38{
39 u32 first;
40 u32 count;
41};
42
43struct VERS
44{
45 u32 num_vand;
46};
47
48struct FWDL
49{
50 u32 dl_addr;
51 u32 dl_size;
52 u32 dl_offset;
53};
54
55struct FWOV
56{
57 u32 dl_size;
58 u32 dl_offset;
59};
60
61struct PTDL
62{
63 u32 dl_size;
64 u32 dl_offset;
65};
66
67#define MAX_VMEQ 64
68#define MAX_VAND 64
69#define MAX_FWDL 256
70#define MAX_PTDL 256
71
72/* An XBV1 file can either contain firmware or patches (at the
73 * moment). The 'mode' member of the xbv1_t structure tells us which
74 * one is the case. */
75typedef enum
76{
77 xbv_unknown,
78 xbv_firmware,
79 xbv_patch
80} xbv_mode;
81
82typedef struct
83{
84 xbv_mode mode;
85
86 /* Parts of a Firmware XBV1 */
87
88 struct VMEQ vmeq[MAX_VMEQ];
89 u32 num_vmeq;
90 struct VAND vand[MAX_VAND];
91 struct VERS vers;
92
93 u32 slut_addr;
94
95 /* F/W download image, possibly more than one part */
96 struct FWDL fwdl[MAX_FWDL];
97 s16 num_fwdl;
98
99 /* F/W overlay image, add r not used */
100 struct FWOV fwov;
101
102 /* Parts of a Patch XBV1 */
103
104 u32 build_id;
105
106 struct PTDL ptdl[MAX_PTDL];
107 s16 num_ptdl;
108} xbv1_t;
109
110
111typedef s32 (*fwreadfn_t)(void *ospriv, void *dlpriv, u32 offset, void *buf, u32 len);
112
113CsrResult xbv1_parse(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo);
114s32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo,
115 symbol_t *slut, u32 slut_len);
116void* xbv_to_patch(card_t *card, fwreadfn_t readfn, const void *fw_buf, const xbv1_t *fwinfo,
117 u32 *size);
118
119#endif /* __XBV_H__ */
diff --git a/drivers/staging/csr/csr_wifi_hostio_prim.h b/drivers/staging/csr/csr_wifi_hostio_prim.h
deleted file mode 100644
index cfb3e272e359..000000000000
--- a/drivers/staging/csr/csr_wifi_hostio_prim.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11
12#ifndef CSR_WIFI_HOSTIO_H
13#define CSR_WIFI_HOSTIO_H
14
15#define CSR_WIFI_HOSTIO_PRIM 0x0453
16
17#endif /* CSR_WIFI_HOSTIO_H */
18
diff --git a/drivers/staging/csr/csr_wifi_lib.h b/drivers/staging/csr/csr_wifi_lib.h
deleted file mode 100644
index 5fde0efb5dca..000000000000
--- a/drivers/staging/csr/csr_wifi_lib.h
+++ /dev/null
@@ -1,103 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10#ifndef CSR_WIFI_LIB_H__
11#define CSR_WIFI_LIB_H__
12
13#include "csr_wifi_fsm_event.h"
14
15/*----------------------------------------------------------------------------*
16 * CsrWifiFsmEventInit
17 *
18 * DESCRIPTION
19 * Macro to initialise the members of a CsrWifiFsmEvent.
20 *----------------------------------------------------------------------------*/
21#define CsrWifiFsmEventInit(evt, p_primtype, p_msgtype, p_dst, p_src) \
22 (evt)->primtype = p_primtype; \
23 (evt)->type = p_msgtype; \
24 (evt)->destination = p_dst; \
25 (evt)->source = p_src
26
27
28/*----------------------------------------------------------------------------*
29 * CsrWifiEvent_struct
30 *
31 * DESCRIPTION
32 * Generic message creator.
33 * Allocates and fills in a message with the signature CsrWifiEvent
34 *
35 *----------------------------------------------------------------------------*/
36CsrWifiFsmEvent* CsrWifiEvent_struct(u16 primtype, u16 msgtype, CsrSchedQid dst, CsrSchedQid src);
37
38typedef struct
39{
40 CsrWifiFsmEvent common;
41 u8 value;
42} CsrWifiEventCsrUint8;
43
44/*----------------------------------------------------------------------------*
45 * CsrWifiEventCsrUint8_struct
46 *
47 * DESCRIPTION
48 * Generic message creator.
49 * Allocates and fills in a message with the signature CsrWifiEventCsrUint8
50 *
51 *----------------------------------------------------------------------------*/
52CsrWifiEventCsrUint8* CsrWifiEventCsrUint8_struct(u16 primtype, u16 msgtype, CsrSchedQid dst, CsrSchedQid src, u8 value);
53
54typedef struct
55{
56 CsrWifiFsmEvent common;
57 u16 value;
58} CsrWifiEventCsrUint16;
59
60/*----------------------------------------------------------------------------*
61 * CsrWifiEventCsrUint16_struct
62 *
63 * DESCRIPTION
64 * Generic message creator.
65 * Allocates and fills in a message with the signature CsrWifiEventCsrUint16
66 *
67 *----------------------------------------------------------------------------*/
68CsrWifiEventCsrUint16* CsrWifiEventCsrUint16_struct(u16 primtype, u16 msgtype, CsrSchedQid dst, CsrSchedQid src, u16 value);
69
70typedef struct
71{
72 CsrWifiFsmEvent common;
73 u32 value;
74} CsrWifiEventCsrUint32;
75
76/*----------------------------------------------------------------------------*
77 * CsrWifiEventCsrUint32_struct
78 *
79 * DESCRIPTION
80 * Generic message creator.
81 * Allocates and fills in a message with the signature CsrWifiEventCsrUint32
82 *
83 *----------------------------------------------------------------------------*/
84CsrWifiEventCsrUint32* CsrWifiEventCsrUint32_struct(u16 primtype, u16 msgtype, CsrSchedQid dst, CsrSchedQid src, u32 value);
85
86typedef struct
87{
88 CsrWifiFsmEvent common;
89 u16 value16;
90 u8 value8;
91} CsrWifiEventCsrUint16CsrUint8;
92
93/*----------------------------------------------------------------------------*
94 * CsrWifiEventCsrUint16CsrUint8_struct
95 *
96 * DESCRIPTION
97 * Generic message creator.
98 * Allocates and fills in a message with the signature CsrWifiEventCsrUint16CsrUint8
99 *
100 *----------------------------------------------------------------------------*/
101CsrWifiEventCsrUint16CsrUint8* CsrWifiEventCsrUint16CsrUint8_struct(u16 primtype, u16 msgtype, CsrSchedQid dst, CsrSchedQid src, u16 value16, u8 value8);
102
103#endif /* CSR_WIFI_LIB_H__ */
diff --git a/drivers/staging/csr/csr_wifi_msgconv.h b/drivers/staging/csr/csr_wifi_msgconv.h
deleted file mode 100644
index f8b402947a09..000000000000
--- a/drivers/staging/csr/csr_wifi_msgconv.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11#ifndef CSR_WIFI_MSGCONV_H__
12#define CSR_WIFI_MSGCONV_H__
13
14#include "csr_prim_defs.h"
15#include "csr_sched.h"
16
17void CsrUint16SerBigEndian(u8 *ptr, size_t *len, u16 v);
18void CsrUint24SerBigEndian(u8 *ptr, size_t *len, u32 v);
19void CsrUint32SerBigEndian(u8 *ptr, size_t *len, u32 v);
20
21void CsrUint16DesBigEndian(u16 *v, u8 *buffer, size_t *offset);
22void CsrUint24DesBigEndian(u32 *v, u8 *buffer, size_t *offset);
23void CsrUint32DesBigEndian(u32 *v, u8 *buffer, size_t *offset);
24
25void CsrUint24Ser(u8 *ptr, size_t *len, u32 v);
26void CsrUint24Des(u32 *v, u8 *buffer, size_t *offset);
27
28
29size_t CsrWifiEventSizeof(void *msg);
30u8* CsrWifiEventSer(u8 *ptr, size_t *len, void *msg);
31void* CsrWifiEventDes(u8 *buffer, size_t length);
32
33size_t CsrWifiEventCsrUint8Sizeof(void *msg);
34u8* CsrWifiEventCsrUint8Ser(u8 *ptr, size_t *len, void *msg);
35void* CsrWifiEventCsrUint8Des(u8 *buffer, size_t length);
36
37size_t CsrWifiEventCsrUint16Sizeof(void *msg);
38u8* CsrWifiEventCsrUint16Ser(u8 *ptr, size_t *len, void *msg);
39void* CsrWifiEventCsrUint16Des(u8 *buffer, size_t length);
40
41size_t CsrWifiEventCsrUint32Sizeof(void *msg);
42u8* CsrWifiEventCsrUint32Ser(u8 *ptr, size_t *len, void *msg);
43void* CsrWifiEventCsrUint32Des(u8 *buffer, size_t length);
44
45size_t CsrWifiEventCsrUint16CsrUint8Sizeof(void *msg);
46u8* CsrWifiEventCsrUint16CsrUint8Ser(u8 *ptr, size_t *len, void *msg);
47void* CsrWifiEventCsrUint16CsrUint8Des(u8 *buffer, size_t length);
48
49#endif /* CSR_WIFI_MSGCONV_H__ */
diff --git a/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c b/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c
deleted file mode 100644
index 0689d6f1cab1..000000000000
--- a/drivers/staging/csr/csr_wifi_nme_ap_converter_init.c
+++ /dev/null
@@ -1,90 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#include "csr_msgconv.h"
14#include "csr_macro.h"
15
16#ifdef CSR_WIFI_NME_ENABLE
17#ifdef CSR_WIFI_AP_ENABLE
18
19#ifdef CSR_LOG_ENABLE
20#include "csr_log.h"
21#endif
22
23#ifndef EXCLUDE_CSR_WIFI_NME_AP_MODULE
24#include "csr_wifi_nme_ap_serialize.h"
25#include "csr_wifi_nme_ap_prim.h"
26
27static CsrMsgConvMsgEntry csrwifinmeap_conv_lut[] = {
28 { CSR_WIFI_NME_AP_CONFIG_SET_REQ, CsrWifiNmeApConfigSetReqSizeof, CsrWifiNmeApConfigSetReqSer, CsrWifiNmeApConfigSetReqDes, CsrWifiNmeApConfigSetReqSerFree },
29 { CSR_WIFI_NME_AP_WPS_REGISTER_REQ, CsrWifiNmeApWpsRegisterReqSizeof, CsrWifiNmeApWpsRegisterReqSer, CsrWifiNmeApWpsRegisterReqDes, CsrWifiNmeApWpsRegisterReqSerFree },
30 { CSR_WIFI_NME_AP_START_REQ, CsrWifiNmeApStartReqSizeof, CsrWifiNmeApStartReqSer, CsrWifiNmeApStartReqDes, CsrWifiNmeApStartReqSerFree },
31 { CSR_WIFI_NME_AP_STOP_REQ, CsrWifiNmeApStopReqSizeof, CsrWifiNmeApStopReqSer, CsrWifiNmeApStopReqDes, CsrWifiNmeApStopReqSerFree },
32 { CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_REQ, CsrWifiNmeApWmmParamUpdateReqSizeof, CsrWifiNmeApWmmParamUpdateReqSer, CsrWifiNmeApWmmParamUpdateReqDes, CsrWifiNmeApWmmParamUpdateReqSerFree },
33 { CSR_WIFI_NME_AP_STA_REMOVE_REQ, CsrWifiNmeApStaRemoveReqSizeof, CsrWifiNmeApStaRemoveReqSer, CsrWifiNmeApStaRemoveReqDes, CsrWifiNmeApStaRemoveReqSerFree },
34 { CSR_WIFI_NME_AP_CONFIG_SET_CFM, CsrWifiNmeApConfigSetCfmSizeof, CsrWifiNmeApConfigSetCfmSer, CsrWifiNmeApConfigSetCfmDes, CsrWifiNmeApConfigSetCfmSerFree },
35 { CSR_WIFI_NME_AP_WPS_REGISTER_CFM, CsrWifiNmeApWpsRegisterCfmSizeof, CsrWifiNmeApWpsRegisterCfmSer, CsrWifiNmeApWpsRegisterCfmDes, CsrWifiNmeApWpsRegisterCfmSerFree },
36 { CSR_WIFI_NME_AP_START_CFM, CsrWifiNmeApStartCfmSizeof, CsrWifiNmeApStartCfmSer, CsrWifiNmeApStartCfmDes, CsrWifiNmeApStartCfmSerFree },
37 { CSR_WIFI_NME_AP_STOP_CFM, CsrWifiNmeApStopCfmSizeof, CsrWifiNmeApStopCfmSer, CsrWifiNmeApStopCfmDes, CsrWifiNmeApStopCfmSerFree },
38 { CSR_WIFI_NME_AP_STOP_IND, CsrWifiNmeApStopIndSizeof, CsrWifiNmeApStopIndSer, CsrWifiNmeApStopIndDes, CsrWifiNmeApStopIndSerFree },
39 { CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_CFM, CsrWifiNmeApWmmParamUpdateCfmSizeof, CsrWifiNmeApWmmParamUpdateCfmSer, CsrWifiNmeApWmmParamUpdateCfmDes, CsrWifiNmeApWmmParamUpdateCfmSerFree },
40 { CSR_WIFI_NME_AP_STATION_IND, CsrWifiNmeApStationIndSizeof, CsrWifiNmeApStationIndSer, CsrWifiNmeApStationIndDes, CsrWifiNmeApStationIndSerFree },
41
42 { 0, NULL, NULL, NULL, NULL },
43};
44
45CsrMsgConvMsgEntry* CsrWifiNmeApConverterLookup(CsrMsgConvMsgEntry *ce, u16 msgType)
46{
47 if (msgType & CSR_PRIM_UPSTREAM)
48 {
49 u16 idx = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_COUNT;
50 if (idx < (CSR_WIFI_NME_AP_PRIM_UPSTREAM_COUNT + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_COUNT) &&
51 csrwifinmeap_conv_lut[idx].msgType == msgType)
52 {
53 return &csrwifinmeap_conv_lut[idx];
54 }
55 }
56 else
57 {
58 if (msgType < CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_COUNT &&
59 csrwifinmeap_conv_lut[msgType].msgType == msgType)
60 {
61 return &csrwifinmeap_conv_lut[msgType];
62 }
63 }
64 return NULL;
65}
66
67
68void CsrWifiNmeApConverterInit(void)
69{
70 CsrMsgConvInsert(CSR_WIFI_NME_AP_PRIM, csrwifinmeap_conv_lut);
71 CsrMsgConvCustomLookupRegister(CSR_WIFI_NME_AP_PRIM, CsrWifiNmeApConverterLookup);
72}
73
74
75#ifdef CSR_LOG_ENABLE
76static const CsrLogPrimitiveInformation csrwifinmeap_conv_info = {
77 CSR_WIFI_NME_AP_PRIM,
78 (char *)"CSR_WIFI_NME_AP_PRIM",
79 csrwifinmeap_conv_lut
80};
81const CsrLogPrimitiveInformation* CsrWifiNmeApTechInfoGet(void)
82{
83 return &csrwifinmeap_conv_info;
84}
85
86
87#endif /* CSR_LOG_ENABLE */
88#endif /* EXCLUDE_CSR_WIFI_NME_AP_MODULE */
89#endif /* CSR_WIFI_NME_ENABLE */
90#endif /* CSR_WIFI_AP_ENABLE */
diff --git a/drivers/staging/csr/csr_wifi_nme_ap_converter_init.h b/drivers/staging/csr/csr_wifi_nme_ap_converter_init.h
deleted file mode 100644
index b89d7c7f8e21..000000000000
--- a/drivers/staging/csr/csr_wifi_nme_ap_converter_init.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_NME_AP_CONVERTER_INIT_H__
14#define CSR_WIFI_NME_AP_CONVERTER_INIT_H__
15
16#ifndef CSR_WIFI_NME_ENABLE
17#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_converter_init.h
18#endif
19#ifndef CSR_WIFI_AP_ENABLE
20#error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_converter_init.h
21#endif
22
23#ifndef EXCLUDE_CSR_WIFI_NME_AP_MODULE
24
25#include "csr_msgconv.h"
26
27#ifdef CSR_LOG_ENABLE
28#include "csr_log.h"
29
30extern const CsrLogPrimitiveInformation* CsrWifiNmeApTechInfoGet(void);
31#endif /* CSR_LOG_ENABLE */
32
33extern void CsrWifiNmeApConverterInit(void);
34
35#else /* EXCLUDE_CSR_WIFI_NME_AP_MODULE */
36
37#define CsrWifiNmeApConverterInit()
38
39#endif /* EXCLUDE_CSR_WIFI_NME_AP_MODULE */
40
41#endif /* CSR_WIFI_NME_AP_CONVERTER_INIT_H__ */
diff --git a/drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c
deleted file mode 100644
index ab9358873ec3..000000000000
--- a/drivers/staging/csr/csr_wifi_nme_ap_free_downstream_contents.c
+++ /dev/null
@@ -1,84 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12#include <linux/slab.h>
13#include "csr_wifi_nme_ap_prim.h"
14#include "csr_wifi_nme_ap_lib.h"
15
16/*----------------------------------------------------------------------------*
17 * NAME
18 * CsrWifiNmeApFreeDownstreamMessageContents
19 *
20 * DESCRIPTION
21 *
22 *
23 * PARAMETERS
24 * eventClass: only the value CSR_WIFI_NME_AP_PRIM will be handled
25 * message: the message to free
26 *----------------------------------------------------------------------------*/
27void CsrWifiNmeApFreeDownstreamMessageContents(u16 eventClass, void *message)
28{
29 if (eventClass != CSR_WIFI_NME_AP_PRIM)
30 {
31 return;
32 }
33 if (NULL == message)
34 {
35 return;
36 }
37
38 switch (*((CsrWifiNmeApPrim *) message))
39 {
40 case CSR_WIFI_NME_AP_CONFIG_SET_REQ:
41 {
42 CsrWifiNmeApConfigSetReq *p = (CsrWifiNmeApConfigSetReq *)message;
43 kfree(p->apMacConfig.macAddressList);
44 p->apMacConfig.macAddressList = NULL;
45 break;
46 }
47 case CSR_WIFI_NME_AP_START_REQ:
48 {
49 CsrWifiNmeApStartReq *p = (CsrWifiNmeApStartReq *)message;
50 switch (p->apCredentials.authType)
51 {
52 case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL:
53 switch (p->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase)
54 {
55 case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE:
56 kfree(p->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase);
57 p->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase = NULL;
58 break;
59 default:
60 break;
61 }
62 break;
63 default:
64 break;
65 }
66 {
67 u16 i3;
68 for (i3 = 0; i3 < p->p2pGoParam.operatingChanList.channelEntryListCount; i3++)
69 {
70 kfree(p->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel);
71 p->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel = NULL;
72 }
73 }
74 kfree(p->p2pGoParam.operatingChanList.channelEntryList);
75 p->p2pGoParam.operatingChanList.channelEntryList = NULL;
76 break;
77 }
78
79 default:
80 break;
81 }
82}
83
84
diff --git a/drivers/staging/csr/csr_wifi_nme_ap_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_nme_ap_free_upstream_contents.c
deleted file mode 100644
index 2786a6bbff97..000000000000
--- a/drivers/staging/csr/csr_wifi_nme_ap_free_upstream_contents.c
+++ /dev/null
@@ -1,39 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#include "csr_wifi_nme_ap_prim.h"
14#include "csr_wifi_nme_ap_lib.h"
15
16/*----------------------------------------------------------------------------*
17 * NAME
18 * CsrWifiNmeApFreeUpstreamMessageContents
19 *
20 * DESCRIPTION
21 *
22 *
23 * PARAMETERS
24 * eventClass: only the value CSR_WIFI_NME_AP_PRIM will be handled
25 * message: the message to free
26 *----------------------------------------------------------------------------*/
27void CsrWifiNmeApFreeUpstreamMessageContents(u16 eventClass, void *message)
28{
29 if (eventClass != CSR_WIFI_NME_AP_PRIM)
30 {
31 return;
32 }
33 if (NULL == message)
34 {
35 return;
36 }
37}
38
39
diff --git a/drivers/staging/csr/csr_wifi_nme_ap_lib.h b/drivers/staging/csr/csr_wifi_nme_ap_lib.h
deleted file mode 100644
index 6d8df8366817..000000000000
--- a/drivers/staging/csr/csr_wifi_nme_ap_lib.h
+++ /dev/null
@@ -1,495 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_NME_AP_LIB_H__
14#define CSR_WIFI_NME_AP_LIB_H__
15
16#include "csr_sched.h"
17#include "csr_macro.h"
18#include "csr_msg_transport.h"
19
20#include "csr_wifi_lib.h"
21
22#include "csr_wifi_nme_ap_prim.h"
23#include "csr_wifi_nme_task.h"
24
25#ifndef CSR_WIFI_NME_ENABLE
26#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_lib.h
27#endif
28#ifndef CSR_WIFI_AP_ENABLE
29#error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_lib.h
30#endif
31
32/*----------------------------------------------------------------------------*
33 * CsrWifiNmeApFreeUpstreamMessageContents
34 *
35 * DESCRIPTION
36 * Free the allocated memory in a CSR_WIFI_NME_AP upstream message. Does not
37 * free the message itself, and can only be used for upstream messages.
38 *
39 * PARAMETERS
40 * Deallocates the resources in a CSR_WIFI_NME_AP upstream message
41 *----------------------------------------------------------------------------*/
42void CsrWifiNmeApFreeUpstreamMessageContents(u16 eventClass, void *message);
43
44/*----------------------------------------------------------------------------*
45 * CsrWifiNmeApFreeDownstreamMessageContents
46 *
47 * DESCRIPTION
48 * Free the allocated memory in a CSR_WIFI_NME_AP downstream message. Does not
49 * free the message itself, and can only be used for downstream messages.
50 *
51 * PARAMETERS
52 * Deallocates the resources in a CSR_WIFI_NME_AP downstream message
53 *----------------------------------------------------------------------------*/
54void CsrWifiNmeApFreeDownstreamMessageContents(u16 eventClass, void *message);
55
56/*******************************************************************************
57
58 NAME
59 CsrWifiNmeApConfigSetReqSend
60
61 DESCRIPTION
62 This primitive passes AP configuration info for NME. This can be sent at
63 any time but will be acted upon when the AP is started again. This
64 information is common to both P2P GO and AP
65
66 PARAMETERS
67 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
68 apConfig - AP configuration for the NME.
69 apMacConfig - MAC configuration to be acted on when
70 CSR_WIFI_NME_AP_START.request is sent.
71
72*******************************************************************************/
73#define CsrWifiNmeApConfigSetReqCreate(msg__, dst__, src__, apConfig__, apMacConfig__) \
74 msg__ = kmalloc(sizeof(CsrWifiNmeApConfigSetReq), GFP_KERNEL); \
75 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_CONFIG_SET_REQ, dst__, src__); \
76 msg__->apConfig = (apConfig__); \
77 msg__->apMacConfig = (apMacConfig__);
78
79#define CsrWifiNmeApConfigSetReqSendTo(dst__, src__, apConfig__, apMacConfig__) \
80 { \
81 CsrWifiNmeApConfigSetReq *msg__; \
82 CsrWifiNmeApConfigSetReqCreate(msg__, dst__, src__, apConfig__, apMacConfig__); \
83 CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
84 }
85
86#define CsrWifiNmeApConfigSetReqSend(src__, apConfig__, apMacConfig__) \
87 CsrWifiNmeApConfigSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, apConfig__, apMacConfig__)
88
89/*******************************************************************************
90
91 NAME
92 CsrWifiNmeApConfigSetCfmSend
93
94 DESCRIPTION
95 This primitive reports the result of the request.
96
97 PARAMETERS
98 queue - Destination Task Queue
99 status - Status of the request.
100
101*******************************************************************************/
102#define CsrWifiNmeApConfigSetCfmCreate(msg__, dst__, src__, status__) \
103 msg__ = kmalloc(sizeof(CsrWifiNmeApConfigSetCfm), GFP_KERNEL); \
104 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_CONFIG_SET_CFM, dst__, src__); \
105 msg__->status = (status__);
106
107#define CsrWifiNmeApConfigSetCfmSendTo(dst__, src__, status__) \
108 { \
109 CsrWifiNmeApConfigSetCfm *msg__; \
110 CsrWifiNmeApConfigSetCfmCreate(msg__, dst__, src__, status__); \
111 CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
112 }
113
114#define CsrWifiNmeApConfigSetCfmSend(dst__, status__) \
115 CsrWifiNmeApConfigSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__)
116
117/*******************************************************************************
118
119 NAME
120 CsrWifiNmeApStaRemoveReqSend
121
122 DESCRIPTION
123 This primitive disconnects a connected station. If keepBlocking is set to
124 TRUE, the station with the specified MAC address is not allowed to
125 connect. If the requested station is not already connected,it may be
126 blocked based on keepBlocking parameter.
127
128 PARAMETERS
129 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
130 interfaceTag - Interface Identifier; unique identifier of an interface
131 staMacAddress - Mac Address of the station to be disconnected or blocked
132 keepBlocking - If TRUE, the station is blocked. If FALSE and the station is
133 connected, disconnect the station. If FALSE and the station
134 is not connected, no action is taken.
135
136*******************************************************************************/
137#define CsrWifiNmeApStaRemoveReqCreate(msg__, dst__, src__, interfaceTag__, staMacAddress__, keepBlocking__) \
138 msg__ = kmalloc(sizeof(CsrWifiNmeApStaRemoveReq), GFP_KERNEL); \
139 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STA_REMOVE_REQ, dst__, src__); \
140 msg__->interfaceTag = (interfaceTag__); \
141 msg__->staMacAddress = (staMacAddress__); \
142 msg__->keepBlocking = (keepBlocking__);
143
144#define CsrWifiNmeApStaRemoveReqSendTo(dst__, src__, interfaceTag__, staMacAddress__, keepBlocking__) \
145 { \
146 CsrWifiNmeApStaRemoveReq *msg__; \
147 CsrWifiNmeApStaRemoveReqCreate(msg__, dst__, src__, interfaceTag__, staMacAddress__, keepBlocking__); \
148 CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
149 }
150
151#define CsrWifiNmeApStaRemoveReqSend(src__, interfaceTag__, staMacAddress__, keepBlocking__) \
152 CsrWifiNmeApStaRemoveReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, staMacAddress__, keepBlocking__)
153
154/*******************************************************************************
155
156 NAME
157 CsrWifiNmeApStartReqSend
158
159 DESCRIPTION
160 This primitive requests NME to started the AP operation.
161
162 PARAMETERS
163 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
164 interfaceTag - Interface identifier; unique identifier of an interface
165 apType - AP Type specifies the Legacy AP or P2P GO operation
166 cloakSsid - Indicates whether the SSID should be cloaked (hidden and
167 not broadcast in beacon) or not
168 ssid - Service Set Identifier
169 ifIndex - Radio interface
170 channel - Channel number of the channel to use
171 apCredentials - Security credential configuration.
172 maxConnections - Maximum number of stations/P2P clients allowed
173 p2pGoParam - P2P specific GO parameters.
174 wpsEnabled - Indicates whether WPS should be enabled or not
175
176*******************************************************************************/
177#define CsrWifiNmeApStartReqCreate(msg__, dst__, src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__) \
178 msg__ = kmalloc(sizeof(CsrWifiNmeApStartReq), GFP_KERNEL); \
179 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_START_REQ, dst__, src__); \
180 msg__->interfaceTag = (interfaceTag__); \
181 msg__->apType = (apType__); \
182 msg__->cloakSsid = (cloakSsid__); \
183 msg__->ssid = (ssid__); \
184 msg__->ifIndex = (ifIndex__); \
185 msg__->channel = (channel__); \
186 msg__->apCredentials = (apCredentials__); \
187 msg__->maxConnections = (maxConnections__); \
188 msg__->p2pGoParam = (p2pGoParam__); \
189 msg__->wpsEnabled = (wpsEnabled__);
190
191#define CsrWifiNmeApStartReqSendTo(dst__, src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__) \
192 { \
193 CsrWifiNmeApStartReq *msg__; \
194 CsrWifiNmeApStartReqCreate(msg__, dst__, src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__); \
195 CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
196 }
197
198#define CsrWifiNmeApStartReqSend(src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__) \
199 CsrWifiNmeApStartReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__)
200
201/*******************************************************************************
202
203 NAME
204 CsrWifiNmeApStartCfmSend
205
206 DESCRIPTION
207 This primitive reports the result of CSR_WIFI_NME_AP_START.request.
208
209 PARAMETERS
210 queue - Destination Task Queue
211 interfaceTag - Interface identifier; unique identifier of an interface
212 status - Status of the request.
213 ssid - Service Set Identifier
214
215*******************************************************************************/
216#define CsrWifiNmeApStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, ssid__) \
217 msg__ = kmalloc(sizeof(CsrWifiNmeApStartCfm), GFP_KERNEL); \
218 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_START_CFM, dst__, src__); \
219 msg__->interfaceTag = (interfaceTag__); \
220 msg__->status = (status__); \
221 msg__->ssid = (ssid__);
222
223#define CsrWifiNmeApStartCfmSendTo(dst__, src__, interfaceTag__, status__, ssid__) \
224 { \
225 CsrWifiNmeApStartCfm *msg__; \
226 CsrWifiNmeApStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, ssid__); \
227 CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
228 }
229
230#define CsrWifiNmeApStartCfmSend(dst__, interfaceTag__, status__, ssid__) \
231 CsrWifiNmeApStartCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__, ssid__)
232
233/*******************************************************************************
234
235 NAME
236 CsrWifiNmeApStationIndSend
237
238 DESCRIPTION
239 This primitive indicates that a station has joined or a previously joined
240 station has left the BSS/group
241
242 PARAMETERS
243 queue - Destination Task Queue
244 interfaceTag - Interface Identifier; unique identifier of an interface
245 mediaStatus - Indicates whether the station is connected or
246 disconnected
247 peerMacAddress - MAC address of the station
248 peerDeviceAddress - P2P Device Address
249
250*******************************************************************************/
251#define CsrWifiNmeApStationIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__) \
252 msg__ = kmalloc(sizeof(CsrWifiNmeApStationInd), GFP_KERNEL); \
253 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STATION_IND, dst__, src__); \
254 msg__->interfaceTag = (interfaceTag__); \
255 msg__->mediaStatus = (mediaStatus__); \
256 msg__->peerMacAddress = (peerMacAddress__); \
257 msg__->peerDeviceAddress = (peerDeviceAddress__);
258
259#define CsrWifiNmeApStationIndSendTo(dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__) \
260 { \
261 CsrWifiNmeApStationInd *msg__; \
262 CsrWifiNmeApStationIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__); \
263 CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
264 }
265
266#define CsrWifiNmeApStationIndSend(dst__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__) \
267 CsrWifiNmeApStationIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__)
268
269/*******************************************************************************
270
271 NAME
272 CsrWifiNmeApStopReqSend
273
274 DESCRIPTION
275 This primitive requests NME to stop the AP operation.
276
277 PARAMETERS
278 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
279 interfaceTag - Interface identifier; unique identifier of an interface
280
281*******************************************************************************/
282#define CsrWifiNmeApStopReqCreate(msg__, dst__, src__, interfaceTag__) \
283 msg__ = kmalloc(sizeof(CsrWifiNmeApStopReq), GFP_KERNEL); \
284 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STOP_REQ, dst__, src__); \
285 msg__->interfaceTag = (interfaceTag__);
286
287#define CsrWifiNmeApStopReqSendTo(dst__, src__, interfaceTag__) \
288 { \
289 CsrWifiNmeApStopReq *msg__; \
290 CsrWifiNmeApStopReqCreate(msg__, dst__, src__, interfaceTag__); \
291 CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
292 }
293
294#define CsrWifiNmeApStopReqSend(src__, interfaceTag__) \
295 CsrWifiNmeApStopReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__)
296
297/*******************************************************************************
298
299 NAME
300 CsrWifiNmeApStopIndSend
301
302 DESCRIPTION
303 Indicates that AP operation had stopped because of some unrecoverable
304 error after AP operation was started successfully. NME sends this signal
305 after failing to restart the AP operation internally following an error
306
307 PARAMETERS
308 queue - Destination Task Queue
309 interfaceTag - Interface Identifier; unique identifier of an interface
310 apType - Reports AP Type (P2PGO or AP)
311 status - Error Status
312
313*******************************************************************************/
314#define CsrWifiNmeApStopIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__) \
315 msg__ = kmalloc(sizeof(CsrWifiNmeApStopInd), GFP_KERNEL); \
316 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STOP_IND, dst__, src__); \
317 msg__->interfaceTag = (interfaceTag__); \
318 msg__->apType = (apType__); \
319 msg__->status = (status__);
320
321#define CsrWifiNmeApStopIndSendTo(dst__, src__, interfaceTag__, apType__, status__) \
322 { \
323 CsrWifiNmeApStopInd *msg__; \
324 CsrWifiNmeApStopIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__); \
325 CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
326 }
327
328#define CsrWifiNmeApStopIndSend(dst__, interfaceTag__, apType__, status__) \
329 CsrWifiNmeApStopIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, apType__, status__)
330
331/*******************************************************************************
332
333 NAME
334 CsrWifiNmeApStopCfmSend
335
336 DESCRIPTION
337 This primitive confirms that the AP operation is stopped. NME shall send
338 this primitive in response to the request even if AP operation has
339 already been stopped
340
341 PARAMETERS
342 queue - Destination Task Queue
343 interfaceTag - Interface identifier; unique identifier of an interface
344 status - Status of the request.
345
346*******************************************************************************/
347#define CsrWifiNmeApStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
348 msg__ = kmalloc(sizeof(CsrWifiNmeApStopCfm), GFP_KERNEL); \
349 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STOP_CFM, dst__, src__); \
350 msg__->interfaceTag = (interfaceTag__); \
351 msg__->status = (status__);
352
353#define CsrWifiNmeApStopCfmSendTo(dst__, src__, interfaceTag__, status__) \
354 { \
355 CsrWifiNmeApStopCfm *msg__; \
356 CsrWifiNmeApStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
357 CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
358 }
359
360#define CsrWifiNmeApStopCfmSend(dst__, interfaceTag__, status__) \
361 CsrWifiNmeApStopCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__)
362
363/*******************************************************************************
364
365 NAME
366 CsrWifiNmeApWmmParamUpdateReqSend
367
368 DESCRIPTION
369 Application uses this primitive to update the WMM parameters
370
371 PARAMETERS
372 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
373 wmmApParams - WMM Access point parameters per access category. The array
374 index corresponds to the ACI
375 wmmApBcParams - WMM station parameters per access category to be advertised
376 in the beacons and probe response The array index
377 corresponds to the ACI
378
379*******************************************************************************/
380#define CsrWifiNmeApWmmParamUpdateReqCreate(msg__, dst__, src__, wmmApParams__, wmmApBcParams__) \
381 msg__ = kmalloc(sizeof(CsrWifiNmeApWmmParamUpdateReq), GFP_KERNEL); \
382 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_REQ, dst__, src__); \
383 memcpy(msg__->wmmApParams, (wmmApParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); \
384 memcpy(msg__->wmmApBcParams, (wmmApBcParams__), sizeof(CsrWifiSmeWmmAcParams) * 4);
385
386#define CsrWifiNmeApWmmParamUpdateReqSendTo(dst__, src__, wmmApParams__, wmmApBcParams__) \
387 { \
388 CsrWifiNmeApWmmParamUpdateReq *msg__; \
389 CsrWifiNmeApWmmParamUpdateReqCreate(msg__, dst__, src__, wmmApParams__, wmmApBcParams__); \
390 CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
391 }
392
393#define CsrWifiNmeApWmmParamUpdateReqSend(src__, wmmApParams__, wmmApBcParams__) \
394 CsrWifiNmeApWmmParamUpdateReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, wmmApParams__, wmmApBcParams__)
395
396/*******************************************************************************
397
398 NAME
399 CsrWifiNmeApWmmParamUpdateCfmSend
400
401 DESCRIPTION
402 A confirm for for the WMM parameters update
403
404 PARAMETERS
405 queue - Destination Task Queue
406 status - Status of the request.
407
408*******************************************************************************/
409#define CsrWifiNmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, status__) \
410 msg__ = kmalloc(sizeof(CsrWifiNmeApWmmParamUpdateCfm), GFP_KERNEL); \
411 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_CFM, dst__, src__); \
412 msg__->status = (status__);
413
414#define CsrWifiNmeApWmmParamUpdateCfmSendTo(dst__, src__, status__) \
415 { \
416 CsrWifiNmeApWmmParamUpdateCfm *msg__; \
417 CsrWifiNmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, status__); \
418 CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
419 }
420
421#define CsrWifiNmeApWmmParamUpdateCfmSend(dst__, status__) \
422 CsrWifiNmeApWmmParamUpdateCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__)
423
424/*******************************************************************************
425
426 NAME
427 CsrWifiNmeApWpsRegisterReqSend
428
429 DESCRIPTION
430 This primitive allows the NME to accept the WPS registration from an
431 enrollee. Such registration procedure can be cancelled by sending
432 CSR_WIFI_NME_WPS_CANCEL.request.
433
434 PARAMETERS
435 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
436 interfaceTag - Interface Identifier; unique identifier of an
437 interface
438 selectedDevicePasswordId - Selected password type
439 selectedConfigMethod - Selected WPS configuration method type
440 pin - PIN value.
441 Relevant if selected device password ID is PIN.4
442 digit pin is passed by sending the pin digits in
443 pin[0]..pin[3] and rest of the contents filled
444 with '-'.
445
446*******************************************************************************/
447#define CsrWifiNmeApWpsRegisterReqCreate(msg__, dst__, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__) \
448 msg__ = kmalloc(sizeof(CsrWifiNmeApWpsRegisterReq), GFP_KERNEL); \
449 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WPS_REGISTER_REQ, dst__, src__); \
450 msg__->interfaceTag = (interfaceTag__); \
451 msg__->selectedDevicePasswordId = (selectedDevicePasswordId__); \
452 msg__->selectedConfigMethod = (selectedConfigMethod__); \
453 memcpy(msg__->pin, (pin__), sizeof(u8) * 8);
454
455#define CsrWifiNmeApWpsRegisterReqSendTo(dst__, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__) \
456 { \
457 CsrWifiNmeApWpsRegisterReq *msg__; \
458 CsrWifiNmeApWpsRegisterReqCreate(msg__, dst__, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__); \
459 CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
460 }
461
462#define CsrWifiNmeApWpsRegisterReqSend(src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__) \
463 CsrWifiNmeApWpsRegisterReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__)
464
465/*******************************************************************************
466
467 NAME
468 CsrWifiNmeApWpsRegisterCfmSend
469
470 DESCRIPTION
471 This primitive reports the result of WPS procedure.
472
473 PARAMETERS
474 queue - Destination Task Queue
475 interfaceTag - Interface identifier; unique identifier of an interface
476 status - Status of the request.
477
478*******************************************************************************/
479#define CsrWifiNmeApWpsRegisterCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
480 msg__ = kmalloc(sizeof(CsrWifiNmeApWpsRegisterCfm), GFP_KERNEL); \
481 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WPS_REGISTER_CFM, dst__, src__); \
482 msg__->interfaceTag = (interfaceTag__); \
483 msg__->status = (status__);
484
485#define CsrWifiNmeApWpsRegisterCfmSendTo(dst__, src__, interfaceTag__, status__) \
486 { \
487 CsrWifiNmeApWpsRegisterCfm *msg__; \
488 CsrWifiNmeApWpsRegisterCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
489 CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
490 }
491
492#define CsrWifiNmeApWpsRegisterCfmSend(dst__, interfaceTag__, status__) \
493 CsrWifiNmeApWpsRegisterCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__)
494
495#endif /* CSR_WIFI_NME_AP_LIB_H__ */
diff --git a/drivers/staging/csr/csr_wifi_nme_ap_prim.h b/drivers/staging/csr/csr_wifi_nme_ap_prim.h
deleted file mode 100644
index b32bdbc7e22f..000000000000
--- a/drivers/staging/csr/csr_wifi_nme_ap_prim.h
+++ /dev/null
@@ -1,494 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_NME_AP_PRIM_H__
14#define CSR_WIFI_NME_AP_PRIM_H__
15
16#include <linux/types.h>
17#include "csr_prim_defs.h"
18#include "csr_sched.h"
19#include "csr_wifi_common.h"
20#include "csr_result.h"
21#include "csr_wifi_fsm_event.h"
22#include "csr_wifi_sme_ap_prim.h"
23#include "csr_wifi_nme_prim.h"
24
25#ifndef CSR_WIFI_NME_ENABLE
26#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_prim.h
27#endif
28#ifndef CSR_WIFI_AP_ENABLE
29#error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_prim.h
30#endif
31
32#define CSR_WIFI_NME_AP_PRIM (0x0426)
33
34typedef CsrPrim CsrWifiNmeApPrim;
35
36
37/*******************************************************************************
38
39 NAME
40 CsrWifiNmeApPersCredentialType
41
42 DESCRIPTION
43 NME Credential Types
44
45 VALUES
46 CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK
47 - Use PSK as credential.
48 CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE
49 - Use the specified passphrase as credential
50
51*******************************************************************************/
52typedef u8 CsrWifiNmeApPersCredentialType;
53#define CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK ((CsrWifiNmeApPersCredentialType) 0x00)
54#define CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE ((CsrWifiNmeApPersCredentialType) 0x01)
55
56
57/*******************************************************************************
58
59 NAME
60 CsrWifiNmeApConfig
61
62 DESCRIPTION
63 Structure holding AP config data.
64
65 MEMBERS
66 apGroupkeyTimeout - Access point group key timeout.
67 apStrictGtkRekey - Access point strict GTK rekey flag. If set TRUE, the AP
68 shall rekey GTK every time a connected STA leaves BSS.
69 apGmkTimeout - Access point GMK timeout
70 apResponseTimeout - Response timeout
71 apRetransLimit - Max allowed retransmissions
72
73*******************************************************************************/
74typedef struct
75{
76 u16 apGroupkeyTimeout;
77 u8 apStrictGtkRekey;
78 u16 apGmkTimeout;
79 u16 apResponseTimeout;
80 u8 apRetransLimit;
81} CsrWifiNmeApConfig;
82
83/*******************************************************************************
84
85 NAME
86 CsrWifiNmeApAuthPers
87
88 DESCRIPTION
89
90 MEMBERS
91 authSupport - Credential type value (as defined in the
92 enumeration type).
93 rsnCapabilities - RSN capabilities mask
94 wapiCapabilities - WAPI capabilities mask
95 pskOrPassphrase - Credential type value (as defined in the
96 enumeration type).
97 authPers_credentials - Union containing credentials which depends
98 on credentialType parameter.
99 authPers_credentialspsk -
100 authPers_credentialspassphrase -
101
102*******************************************************************************/
103typedef struct
104{
105 CsrWifiSmeApAuthSupportMask authSupport;
106 CsrWifiSmeApRsnCapabilitiesMask rsnCapabilities;
107 CsrWifiSmeApWapiCapabilitiesMask wapiCapabilities;
108 CsrWifiNmeApPersCredentialType pskOrPassphrase;
109 union {
110 CsrWifiNmePsk psk;
111 CsrWifiNmePassphrase passphrase;
112 } authPers_credentials;
113} CsrWifiNmeApAuthPers;
114
115/*******************************************************************************
116
117 NAME
118 CsrWifiNmeApCredentials
119
120 DESCRIPTION
121 Structure containing the Credentials data.
122
123 MEMBERS
124 authType - Authentication type
125 nmeAuthType - Authentication parameters
126 nmeAuthTypeopenSystemEmpty -
127 nmeAuthTypeauthwep -
128 nmeAuthTypeauthTypePersonal -
129
130*******************************************************************************/
131typedef struct
132{
133 CsrWifiSmeApAuthType authType;
134 union {
135 CsrWifiSmeEmpty openSystemEmpty;
136 CsrWifiSmeWepAuth authwep;
137 CsrWifiNmeApAuthPers authTypePersonal;
138 } nmeAuthType;
139} CsrWifiNmeApCredentials;
140
141
142/* Downstream */
143#define CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST (0x0000)
144
145#define CSR_WIFI_NME_AP_CONFIG_SET_REQ ((CsrWifiNmeApPrim) (0x0000 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST))
146#define CSR_WIFI_NME_AP_WPS_REGISTER_REQ ((CsrWifiNmeApPrim) (0x0001 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST))
147#define CSR_WIFI_NME_AP_START_REQ ((CsrWifiNmeApPrim) (0x0002 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST))
148#define CSR_WIFI_NME_AP_STOP_REQ ((CsrWifiNmeApPrim) (0x0003 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST))
149#define CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_REQ ((CsrWifiNmeApPrim) (0x0004 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST))
150#define CSR_WIFI_NME_AP_STA_REMOVE_REQ ((CsrWifiNmeApPrim) (0x0005 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST))
151
152
153#define CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_HIGHEST (0x0005 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST)
154
155/* Upstream */
156#define CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM)
157
158#define CSR_WIFI_NME_AP_CONFIG_SET_CFM ((CsrWifiNmeApPrim)(0x0000 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST))
159#define CSR_WIFI_NME_AP_WPS_REGISTER_CFM ((CsrWifiNmeApPrim)(0x0001 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST))
160#define CSR_WIFI_NME_AP_START_CFM ((CsrWifiNmeApPrim)(0x0002 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST))
161#define CSR_WIFI_NME_AP_STOP_CFM ((CsrWifiNmeApPrim)(0x0003 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST))
162#define CSR_WIFI_NME_AP_STOP_IND ((CsrWifiNmeApPrim)(0x0004 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST))
163#define CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_CFM ((CsrWifiNmeApPrim)(0x0005 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST))
164#define CSR_WIFI_NME_AP_STATION_IND ((CsrWifiNmeApPrim)(0x0006 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST))
165
166#define CSR_WIFI_NME_AP_PRIM_UPSTREAM_HIGHEST (0x0006 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST)
167
168#define CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_COUNT (CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_HIGHEST + 1 - CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST)
169#define CSR_WIFI_NME_AP_PRIM_UPSTREAM_COUNT (CSR_WIFI_NME_AP_PRIM_UPSTREAM_HIGHEST + 1 - CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST)
170
171/*******************************************************************************
172
173 NAME
174 CsrWifiNmeApConfigSetReq
175
176 DESCRIPTION
177 This primitive passes AP configuration info for NME. This can be sent at
178 any time but will be acted upon when the AP is started again. This
179 information is common to both P2P GO and AP
180
181 MEMBERS
182 common - Common header for use with the CsrWifiFsm Module
183 apConfig - AP configuration for the NME.
184 apMacConfig - MAC configuration to be acted on when
185 CSR_WIFI_NME_AP_START.request is sent.
186
187*******************************************************************************/
188typedef struct
189{
190 CsrWifiFsmEvent common;
191 CsrWifiNmeApConfig apConfig;
192 CsrWifiSmeApMacConfig apMacConfig;
193} CsrWifiNmeApConfigSetReq;
194
195/*******************************************************************************
196
197 NAME
198 CsrWifiNmeApWpsRegisterReq
199
200 DESCRIPTION
201 This primitive allows the NME to accept the WPS registration from an
202 enrollee. Such registration procedure can be cancelled by sending
203 CSR_WIFI_NME_WPS_CANCEL.request.
204
205 MEMBERS
206 common - Common header for use with the CsrWifiFsm Module
207 interfaceTag - Interface Identifier; unique identifier of an
208 interface
209 selectedDevicePasswordId - Selected password type
210 selectedConfigMethod - Selected WPS configuration method type
211 pin - PIN value.
212 Relevant if selected device password ID is PIN.4
213 digit pin is passed by sending the pin digits in
214 pin[0]..pin[3] and rest of the contents filled
215 with '-'.
216
217*******************************************************************************/
218typedef struct
219{
220 CsrWifiFsmEvent common;
221 u16 interfaceTag;
222 CsrWifiSmeWpsDpid selectedDevicePasswordId;
223 CsrWifiSmeWpsConfigType selectedConfigMethod;
224 u8 pin[8];
225} CsrWifiNmeApWpsRegisterReq;
226
227/*******************************************************************************
228
229 NAME
230 CsrWifiNmeApStartReq
231
232 DESCRIPTION
233 This primitive requests NME to started the AP operation.
234
235 MEMBERS
236 common - Common header for use with the CsrWifiFsm Module
237 interfaceTag - Interface identifier; unique identifier of an interface
238 apType - AP Type specifies the Legacy AP or P2P GO operation
239 cloakSsid - Indicates whether the SSID should be cloaked (hidden and
240 not broadcast in beacon) or not
241 ssid - Service Set Identifier
242 ifIndex - Radio interface
243 channel - Channel number of the channel to use
244 apCredentials - Security credential configuration.
245 maxConnections - Maximum number of stations/P2P clients allowed
246 p2pGoParam - P2P specific GO parameters.
247 wpsEnabled - Indicates whether WPS should be enabled or not
248
249*******************************************************************************/
250typedef struct
251{
252 CsrWifiFsmEvent common;
253 u16 interfaceTag;
254 CsrWifiSmeApType apType;
255 u8 cloakSsid;
256 CsrWifiSsid ssid;
257 CsrWifiSmeRadioIF ifIndex;
258 u8 channel;
259 CsrWifiNmeApCredentials apCredentials;
260 u8 maxConnections;
261 CsrWifiSmeApP2pGoConfig p2pGoParam;
262 u8 wpsEnabled;
263} CsrWifiNmeApStartReq;
264
265/*******************************************************************************
266
267 NAME
268 CsrWifiNmeApStopReq
269
270 DESCRIPTION
271 This primitive requests NME to stop the AP operation.
272
273 MEMBERS
274 common - Common header for use with the CsrWifiFsm Module
275 interfaceTag - Interface identifier; unique identifier of an interface
276
277*******************************************************************************/
278typedef struct
279{
280 CsrWifiFsmEvent common;
281 u16 interfaceTag;
282} CsrWifiNmeApStopReq;
283
284/*******************************************************************************
285
286 NAME
287 CsrWifiNmeApWmmParamUpdateReq
288
289 DESCRIPTION
290 Application uses this primitive to update the WMM parameters
291
292 MEMBERS
293 common - Common header for use with the CsrWifiFsm Module
294 wmmApParams - WMM Access point parameters per access category. The array
295 index corresponds to the ACI
296 wmmApBcParams - WMM station parameters per access category to be advertised
297 in the beacons and probe response The array index
298 corresponds to the ACI
299
300*******************************************************************************/
301typedef struct
302{
303 CsrWifiFsmEvent common;
304 CsrWifiSmeWmmAcParams wmmApParams[4];
305 CsrWifiSmeWmmAcParams wmmApBcParams[4];
306} CsrWifiNmeApWmmParamUpdateReq;
307
308/*******************************************************************************
309
310 NAME
311 CsrWifiNmeApStaRemoveReq
312
313 DESCRIPTION
314 This primitive disconnects a connected station. If keepBlocking is set to
315 TRUE, the station with the specified MAC address is not allowed to
316 connect. If the requested station is not already connected,it may be
317 blocked based on keepBlocking parameter.
318
319 MEMBERS
320 common - Common header for use with the CsrWifiFsm Module
321 interfaceTag - Interface Identifier; unique identifier of an interface
322 staMacAddress - Mac Address of the station to be disconnected or blocked
323 keepBlocking - If TRUE, the station is blocked. If FALSE and the station is
324 connected, disconnect the station. If FALSE and the station
325 is not connected, no action is taken.
326
327*******************************************************************************/
328typedef struct
329{
330 CsrWifiFsmEvent common;
331 u16 interfaceTag;
332 CsrWifiMacAddress staMacAddress;
333 u8 keepBlocking;
334} CsrWifiNmeApStaRemoveReq;
335
336/*******************************************************************************
337
338 NAME
339 CsrWifiNmeApConfigSetCfm
340
341 DESCRIPTION
342 This primitive reports the result of the request.
343
344 MEMBERS
345 common - Common header for use with the CsrWifiFsm Module
346 status - Status of the request.
347
348*******************************************************************************/
349typedef struct
350{
351 CsrWifiFsmEvent common;
352 CsrResult status;
353} CsrWifiNmeApConfigSetCfm;
354
355/*******************************************************************************
356
357 NAME
358 CsrWifiNmeApWpsRegisterCfm
359
360 DESCRIPTION
361 This primitive reports the result of WPS procedure.
362
363 MEMBERS
364 common - Common header for use with the CsrWifiFsm Module
365 interfaceTag - Interface identifier; unique identifier of an interface
366 status - Status of the request.
367
368*******************************************************************************/
369typedef struct
370{
371 CsrWifiFsmEvent common;
372 u16 interfaceTag;
373 CsrResult status;
374} CsrWifiNmeApWpsRegisterCfm;
375
376/*******************************************************************************
377
378 NAME
379 CsrWifiNmeApStartCfm
380
381 DESCRIPTION
382 This primitive reports the result of CSR_WIFI_NME_AP_START.request.
383
384 MEMBERS
385 common - Common header for use with the CsrWifiFsm Module
386 interfaceTag - Interface identifier; unique identifier of an interface
387 status - Status of the request.
388 ssid - Service Set Identifier
389
390*******************************************************************************/
391typedef struct
392{
393 CsrWifiFsmEvent common;
394 u16 interfaceTag;
395 CsrResult status;
396 CsrWifiSsid ssid;
397} CsrWifiNmeApStartCfm;
398
399/*******************************************************************************
400
401 NAME
402 CsrWifiNmeApStopCfm
403
404 DESCRIPTION
405 This primitive confirms that the AP operation is stopped. NME shall send
406 this primitive in response to the request even if AP operation has
407 already been stopped
408
409 MEMBERS
410 common - Common header for use with the CsrWifiFsm Module
411 interfaceTag - Interface identifier; unique identifier of an interface
412 status - Status of the request.
413
414*******************************************************************************/
415typedef struct
416{
417 CsrWifiFsmEvent common;
418 u16 interfaceTag;
419 CsrResult status;
420} CsrWifiNmeApStopCfm;
421
422/*******************************************************************************
423
424 NAME
425 CsrWifiNmeApStopInd
426
427 DESCRIPTION
428 Indicates that AP operation had stopped because of some unrecoverable
429 error after AP operation was started successfully. NME sends this signal
430 after failing to restart the AP operation internally following an error
431
432 MEMBERS
433 common - Common header for use with the CsrWifiFsm Module
434 interfaceTag - Interface Identifier; unique identifier of an interface
435 apType - Reports AP Type (P2PGO or AP)
436 status - Error Status
437
438*******************************************************************************/
439typedef struct
440{
441 CsrWifiFsmEvent common;
442 u16 interfaceTag;
443 CsrWifiSmeApType apType;
444 CsrResult status;
445} CsrWifiNmeApStopInd;
446
447/*******************************************************************************
448
449 NAME
450 CsrWifiNmeApWmmParamUpdateCfm
451
452 DESCRIPTION
453 A confirm for for the WMM parameters update
454
455 MEMBERS
456 common - Common header for use with the CsrWifiFsm Module
457 status - Status of the request.
458
459*******************************************************************************/
460typedef struct
461{
462 CsrWifiFsmEvent common;
463 CsrResult status;
464} CsrWifiNmeApWmmParamUpdateCfm;
465
466/*******************************************************************************
467
468 NAME
469 CsrWifiNmeApStationInd
470
471 DESCRIPTION
472 This primitive indicates that a station has joined or a previously joined
473 station has left the BSS/group
474
475 MEMBERS
476 common - Common header for use with the CsrWifiFsm Module
477 interfaceTag - Interface Identifier; unique identifier of an interface
478 mediaStatus - Indicates whether the station is connected or
479 disconnected
480 peerMacAddress - MAC address of the station
481 peerDeviceAddress - P2P Device Address
482
483*******************************************************************************/
484typedef struct
485{
486 CsrWifiFsmEvent common;
487 u16 interfaceTag;
488 CsrWifiSmeMediaStatus mediaStatus;
489 CsrWifiMacAddress peerMacAddress;
490 CsrWifiMacAddress peerDeviceAddress;
491} CsrWifiNmeApStationInd;
492
493#endif /* CSR_WIFI_NME_AP_PRIM_H__ */
494
diff --git a/drivers/staging/csr/csr_wifi_nme_ap_sef.c b/drivers/staging/csr/csr_wifi_nme_ap_sef.c
deleted file mode 100644
index bfebb1529779..000000000000
--- a/drivers/staging/csr/csr_wifi_nme_ap_sef.c
+++ /dev/null
@@ -1,30 +0,0 @@
1/*****************************************************************************
2
3 FILE: csr_wifi_nme_sef.c
4
5 (c) Cambridge Silicon Radio Limited 2010
6
7 Refer to LICENSE.txt included with this source for details
8 on the license terms.
9
10 *****************************************************************************/
11#include "csr_wifi_nme_ap_sef.h"
12#include "unifi_priv.h"
13
14void CsrWifiNmeApUpstreamStateHandlers(void* drvpriv, CsrWifiFsmEvent* msg)
15{
16 switch(msg->type) {
17 case CSR_WIFI_NME_AP_START_CFM:
18 CsrWifiNmeApStartCfmHandler(drvpriv, msg);
19 break;
20 case CSR_WIFI_NME_AP_STOP_CFM:
21 CsrWifiNmeApStopCfmHandler(drvpriv, msg);
22 break;
23 case CSR_WIFI_NME_AP_CONFIG_SET_CFM:
24 CsrWifiNmeApConfigSetCfmHandler(drvpriv, msg);
25 break;
26 default:
27 unifi_error(drvpriv, "CsrWifiNmeApUpstreamStateHandlers: unhandled NME_AP message type 0x%.4X\n", msg->type);
28 break;
29 }
30}
diff --git a/drivers/staging/csr/csr_wifi_nme_ap_sef.h b/drivers/staging/csr/csr_wifi_nme_ap_sef.h
deleted file mode 100644
index 3daaa0944dba..000000000000
--- a/drivers/staging/csr/csr_wifi_nme_ap_sef.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*****************************************************************************
2 FILE: csr_wifi_nme_sef.h
3 (c) Cambridge Silicon Radio Limited 2010
4
5 Refer to LICENSE.txt included with this source for details
6 on the license terms.
7
8*****************************************************************************/
9#ifndef CSR_WIFI_ROUTER_SEF_CSR_WIFI_NME_H__
10#define CSR_WIFI_ROUTER_SEF_CSR_WIFI_NME_H__
11
12#include "csr_wifi_nme_prim.h"
13
14void CsrWifiNmeApUpstreamStateHandlers(void* drvpriv, CsrWifiFsmEvent* msg);
15
16
17extern void CsrWifiNmeApConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg);
18extern void CsrWifiNmeApStartCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg);
19extern void CsrWifiNmeApStopCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg);
20
21#endif /* CSR_WIFI_ROUTER_SEF_CSR_WIFI_NME_H__ */
diff --git a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c
deleted file mode 100644
index 1a901a70d195..000000000000
--- a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c
+++ /dev/null
@@ -1,909 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12#include <linux/string.h>
13#include <linux/slab.h>
14#include "csr_msgconv.h"
15
16#ifdef CSR_WIFI_NME_ENABLE
17#ifdef CSR_WIFI_AP_ENABLE
18
19#include "csr_wifi_nme_ap_prim.h"
20#include "csr_wifi_nme_ap_serialize.h"
21
22void CsrWifiNmeApPfree(void *ptr)
23{
24 kfree(ptr);
25}
26
27
28size_t CsrWifiNmeApConfigSetReqSizeof(void *msg)
29{
30 CsrWifiNmeApConfigSetReq *primitive = (CsrWifiNmeApConfigSetReq *) msg;
31 size_t bufferSize = 2;
32
33 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 104) */
34 bufferSize += 2; /* u16 primitive->apConfig.apGroupkeyTimeout */
35 bufferSize += 1; /* u8 primitive->apConfig.apStrictGtkRekey */
36 bufferSize += 2; /* u16 primitive->apConfig.apGmkTimeout */
37 bufferSize += 2; /* u16 primitive->apConfig.apResponseTimeout */
38 bufferSize += 1; /* u8 primitive->apConfig.apRetransLimit */
39 bufferSize += 1; /* CsrWifiSmeApPhySupportMask primitive->apMacConfig.phySupportedBitmap */
40 bufferSize += 2; /* u16 primitive->apMacConfig.beaconInterval */
41 bufferSize += 1; /* u8 primitive->apMacConfig.dtimPeriod */
42 bufferSize += 2; /* u16 primitive->apMacConfig.maxListenInterval */
43 bufferSize += 1; /* u8 primitive->apMacConfig.supportedRatesCount */
44 bufferSize += 20; /* u8 primitive->apMacConfig.supportedRates[20] */
45 bufferSize += 1; /* CsrWifiSmePreambleType primitive->apMacConfig.preamble */
46 bufferSize += 1; /* u8 primitive->apMacConfig.shortSlotTimeEnabled */
47 bufferSize += 1; /* CsrWifiSmeCtsProtectionType primitive->apMacConfig.ctsProtectionType */
48 bufferSize += 1; /* u8 primitive->apMacConfig.wmmEnabled */
49 {
50 u16 i2;
51 for (i2 = 0; i2 < 4; i2++)
52 {
53 bufferSize += 1; /* u8 primitive->apMacConfig.wmmApParams[i2].cwMin */
54 bufferSize += 1; /* u8 primitive->apMacConfig.wmmApParams[i2].cwMax */
55 bufferSize += 1; /* u8 primitive->apMacConfig.wmmApParams[i2].aifs */
56 bufferSize += 2; /* u16 primitive->apMacConfig.wmmApParams[i2].txopLimit */
57 bufferSize += 1; /* u8 primitive->apMacConfig.wmmApParams[i2].admissionControlMandatory */
58 }
59 }
60 {
61 u16 i2;
62 for (i2 = 0; i2 < 4; i2++)
63 {
64 bufferSize += 1; /* u8 primitive->apMacConfig.wmmApBcParams[i2].cwMin */
65 bufferSize += 1; /* u8 primitive->apMacConfig.wmmApBcParams[i2].cwMax */
66 bufferSize += 1; /* u8 primitive->apMacConfig.wmmApBcParams[i2].aifs */
67 bufferSize += 2; /* u16 primitive->apMacConfig.wmmApBcParams[i2].txopLimit */
68 bufferSize += 1; /* u8 primitive->apMacConfig.wmmApBcParams[i2].admissionControlMandatory */
69 }
70 }
71 bufferSize += 1; /* CsrWifiSmeApAccessType primitive->apMacConfig.accessType */
72 bufferSize += 1; /* u8 primitive->apMacConfig.macAddressListCount */
73 {
74 u16 i2;
75 for (i2 = 0; i2 < primitive->apMacConfig.macAddressListCount; i2++)
76 {
77 bufferSize += 6; /* u8 primitive->apMacConfig.macAddressList[i2].a[6] */
78 }
79 }
80 bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.greenfieldSupported */
81 bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.shortGi20MHz */
82 bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.rxStbc */
83 bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.rifsModeAllowed */
84 bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.htProtection */
85 bufferSize += 1; /* u8 primitive->apMacConfig.apHtParams.dualCtsProtection */
86 return bufferSize;
87}
88
89
90u8* CsrWifiNmeApConfigSetReqSer(u8 *ptr, size_t *len, void *msg)
91{
92 CsrWifiNmeApConfigSetReq *primitive = (CsrWifiNmeApConfigSetReq *)msg;
93 *len = 0;
94 CsrUint16Ser(ptr, len, primitive->common.type);
95 CsrUint16Ser(ptr, len, (u16) primitive->apConfig.apGroupkeyTimeout);
96 CsrUint8Ser(ptr, len, (u8) primitive->apConfig.apStrictGtkRekey);
97 CsrUint16Ser(ptr, len, (u16) primitive->apConfig.apGmkTimeout);
98 CsrUint16Ser(ptr, len, (u16) primitive->apConfig.apResponseTimeout);
99 CsrUint8Ser(ptr, len, (u8) primitive->apConfig.apRetransLimit);
100 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.phySupportedBitmap);
101 CsrUint16Ser(ptr, len, (u16) primitive->apMacConfig.beaconInterval);
102 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.dtimPeriod);
103 CsrUint16Ser(ptr, len, (u16) primitive->apMacConfig.maxListenInterval);
104 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.supportedRatesCount);
105 CsrMemCpySer(ptr, len, (const void *) primitive->apMacConfig.supportedRates, ((u16) (20)));
106 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.preamble);
107 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.shortSlotTimeEnabled);
108 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.ctsProtectionType);
109 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmEnabled);
110 {
111 u16 i2;
112 for (i2 = 0; i2 < 4; i2++)
113 {
114 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApParams[i2].cwMin);
115 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApParams[i2].cwMax);
116 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApParams[i2].aifs);
117 CsrUint16Ser(ptr, len, (u16) primitive->apMacConfig.wmmApParams[i2].txopLimit);
118 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApParams[i2].admissionControlMandatory);
119 }
120 }
121 {
122 u16 i2;
123 for (i2 = 0; i2 < 4; i2++)
124 {
125 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApBcParams[i2].cwMin);
126 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApBcParams[i2].cwMax);
127 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApBcParams[i2].aifs);
128 CsrUint16Ser(ptr, len, (u16) primitive->apMacConfig.wmmApBcParams[i2].txopLimit);
129 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.wmmApBcParams[i2].admissionControlMandatory);
130 }
131 }
132 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.accessType);
133 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.macAddressListCount);
134 {
135 u16 i2;
136 for (i2 = 0; i2 < primitive->apMacConfig.macAddressListCount; i2++)
137 {
138 CsrMemCpySer(ptr, len, (const void *) primitive->apMacConfig.macAddressList[i2].a, ((u16) (6)));
139 }
140 }
141 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.greenfieldSupported);
142 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.shortGi20MHz);
143 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.rxStbc);
144 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.rifsModeAllowed);
145 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.htProtection);
146 CsrUint8Ser(ptr, len, (u8) primitive->apMacConfig.apHtParams.dualCtsProtection);
147 return(ptr);
148}
149
150
151void* CsrWifiNmeApConfigSetReqDes(u8 *buffer, size_t length)
152{
153 CsrWifiNmeApConfigSetReq *primitive = kmalloc(sizeof(CsrWifiNmeApConfigSetReq), GFP_KERNEL);
154 size_t offset;
155 offset = 0;
156
157 CsrUint16Des(&primitive->common.type, buffer, &offset);
158 CsrUint16Des((u16 *) &primitive->apConfig.apGroupkeyTimeout, buffer, &offset);
159 CsrUint8Des((u8 *) &primitive->apConfig.apStrictGtkRekey, buffer, &offset);
160 CsrUint16Des((u16 *) &primitive->apConfig.apGmkTimeout, buffer, &offset);
161 CsrUint16Des((u16 *) &primitive->apConfig.apResponseTimeout, buffer, &offset);
162 CsrUint8Des((u8 *) &primitive->apConfig.apRetransLimit, buffer, &offset);
163 CsrUint8Des((u8 *) &primitive->apMacConfig.phySupportedBitmap, buffer, &offset);
164 CsrUint16Des((u16 *) &primitive->apMacConfig.beaconInterval, buffer, &offset);
165 CsrUint8Des((u8 *) &primitive->apMacConfig.dtimPeriod, buffer, &offset);
166 CsrUint16Des((u16 *) &primitive->apMacConfig.maxListenInterval, buffer, &offset);
167 CsrUint8Des((u8 *) &primitive->apMacConfig.supportedRatesCount, buffer, &offset);
168 CsrMemCpyDes(primitive->apMacConfig.supportedRates, buffer, &offset, ((u16) (20)));
169 CsrUint8Des((u8 *) &primitive->apMacConfig.preamble, buffer, &offset);
170 CsrUint8Des((u8 *) &primitive->apMacConfig.shortSlotTimeEnabled, buffer, &offset);
171 CsrUint8Des((u8 *) &primitive->apMacConfig.ctsProtectionType, buffer, &offset);
172 CsrUint8Des((u8 *) &primitive->apMacConfig.wmmEnabled, buffer, &offset);
173 {
174 u16 i2;
175 for (i2 = 0; i2 < 4; i2++)
176 {
177 CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApParams[i2].cwMin, buffer, &offset);
178 CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApParams[i2].cwMax, buffer, &offset);
179 CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApParams[i2].aifs, buffer, &offset);
180 CsrUint16Des((u16 *) &primitive->apMacConfig.wmmApParams[i2].txopLimit, buffer, &offset);
181 CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApParams[i2].admissionControlMandatory, buffer, &offset);
182 }
183 }
184 {
185 u16 i2;
186 for (i2 = 0; i2 < 4; i2++)
187 {
188 CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApBcParams[i2].cwMin, buffer, &offset);
189 CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApBcParams[i2].cwMax, buffer, &offset);
190 CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApBcParams[i2].aifs, buffer, &offset);
191 CsrUint16Des((u16 *) &primitive->apMacConfig.wmmApBcParams[i2].txopLimit, buffer, &offset);
192 CsrUint8Des((u8 *) &primitive->apMacConfig.wmmApBcParams[i2].admissionControlMandatory, buffer, &offset);
193 }
194 }
195 CsrUint8Des((u8 *) &primitive->apMacConfig.accessType, buffer, &offset);
196 CsrUint8Des((u8 *) &primitive->apMacConfig.macAddressListCount, buffer, &offset);
197 primitive->apMacConfig.macAddressList = NULL;
198 if (primitive->apMacConfig.macAddressListCount)
199 {
200 primitive->apMacConfig.macAddressList = kmalloc(sizeof(CsrWifiMacAddress) * primitive->apMacConfig.macAddressListCount, GFP_KERNEL);
201 }
202 {
203 u16 i2;
204 for (i2 = 0; i2 < primitive->apMacConfig.macAddressListCount; i2++)
205 {
206 CsrMemCpyDes(primitive->apMacConfig.macAddressList[i2].a, buffer, &offset, ((u16) (6)));
207 }
208 }
209 CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.greenfieldSupported, buffer, &offset);
210 CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.shortGi20MHz, buffer, &offset);
211 CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.rxStbc, buffer, &offset);
212 CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.rifsModeAllowed, buffer, &offset);
213 CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.htProtection, buffer, &offset);
214 CsrUint8Des((u8 *) &primitive->apMacConfig.apHtParams.dualCtsProtection, buffer, &offset);
215
216 return primitive;
217}
218
219
220void CsrWifiNmeApConfigSetReqSerFree(void *voidPrimitivePointer)
221{
222 CsrWifiNmeApConfigSetReq *primitive = (CsrWifiNmeApConfigSetReq *) voidPrimitivePointer;
223 kfree(primitive->apMacConfig.macAddressList);
224 kfree(primitive);
225}
226
227
228size_t CsrWifiNmeApWpsRegisterReqSizeof(void *msg)
229{
230 size_t bufferSize = 2;
231
232 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */
233 bufferSize += 2; /* u16 primitive->interfaceTag */
234 bufferSize += 2; /* CsrWifiSmeWpsDpid primitive->selectedDevicePasswordId */
235 bufferSize += 2; /* CsrWifiSmeWpsConfigType primitive->selectedConfigMethod */
236 bufferSize += 8; /* u8 primitive->pin[8] */
237 return bufferSize;
238}
239
240
241u8* CsrWifiNmeApWpsRegisterReqSer(u8 *ptr, size_t *len, void *msg)
242{
243 CsrWifiNmeApWpsRegisterReq *primitive = (CsrWifiNmeApWpsRegisterReq *)msg;
244 *len = 0;
245 CsrUint16Ser(ptr, len, primitive->common.type);
246 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
247 CsrUint16Ser(ptr, len, (u16) primitive->selectedDevicePasswordId);
248 CsrUint16Ser(ptr, len, (u16) primitive->selectedConfigMethod);
249 CsrMemCpySer(ptr, len, (const void *) primitive->pin, ((u16) (8)));
250 return(ptr);
251}
252
253
254void* CsrWifiNmeApWpsRegisterReqDes(u8 *buffer, size_t length)
255{
256 CsrWifiNmeApWpsRegisterReq *primitive = kmalloc(sizeof(CsrWifiNmeApWpsRegisterReq), GFP_KERNEL);
257 size_t offset;
258 offset = 0;
259
260 CsrUint16Des(&primitive->common.type, buffer, &offset);
261 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
262 CsrUint16Des((u16 *) &primitive->selectedDevicePasswordId, buffer, &offset);
263 CsrUint16Des((u16 *) &primitive->selectedConfigMethod, buffer, &offset);
264 CsrMemCpyDes(primitive->pin, buffer, &offset, ((u16) (8)));
265
266 return primitive;
267}
268
269
270size_t CsrWifiNmeApStartReqSizeof(void *msg)
271{
272 CsrWifiNmeApStartReq *primitive = (CsrWifiNmeApStartReq *) msg;
273 size_t bufferSize = 2;
274
275 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 112) */
276 bufferSize += 2; /* u16 primitive->interfaceTag */
277 bufferSize += 1; /* CsrWifiSmeApType primitive->apType */
278 bufferSize += 1; /* u8 primitive->cloakSsid */
279 bufferSize += 32; /* u8 primitive->ssid.ssid[32] */
280 bufferSize += 1; /* u8 primitive->ssid.length */
281 bufferSize += 1; /* CsrWifiSmeRadioIF primitive->ifIndex */
282 bufferSize += 1; /* u8 primitive->channel */
283 bufferSize += 1; /* CsrWifiSmeApAuthType primitive->apCredentials.authType */
284 switch (primitive->apCredentials.authType)
285 {
286 case CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM:
287 bufferSize += 1; /* u8 primitive->apCredentials.nmeAuthType.openSystemEmpty.empty */
288 break;
289 case CSR_WIFI_SME_AP_AUTH_TYPE_WEP:
290 bufferSize += 1; /* CsrWifiSmeWepCredentialType primitive->apCredentials.nmeAuthType.authwep.wepKeyType */
291 switch (primitive->apCredentials.nmeAuthType.authwep.wepKeyType)
292 {
293 case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128:
294 bufferSize += 1; /* CsrWifiSmeWepAuthMode primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.wepAuthType */
295 bufferSize += 1; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.selectedWepKey */
296 bufferSize += 13; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key1[13] */
297 bufferSize += 13; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key2[13] */
298 bufferSize += 13; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key3[13] */
299 bufferSize += 13; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key4[13] */
300 break;
301 case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64:
302 bufferSize += 1; /* CsrWifiSmeWepAuthMode primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.wepAuthType */
303 bufferSize += 1; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.selectedWepKey */
304 bufferSize += 5; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key1[5] */
305 bufferSize += 5; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key2[5] */
306 bufferSize += 5; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key3[5] */
307 bufferSize += 5; /* u8 primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key4[5] */
308 break;
309 default:
310 break;
311 }
312 break;
313 case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL:
314 bufferSize += 1; /* CsrWifiSmeApAuthSupportMask primitive->apCredentials.nmeAuthType.authTypePersonal.authSupport */
315 bufferSize += 2; /* CsrWifiSmeApRsnCapabilitiesMask primitive->apCredentials.nmeAuthType.authTypePersonal.rsnCapabilities */
316 bufferSize += 2; /* CsrWifiSmeApWapiCapabilitiesMask primitive->apCredentials.nmeAuthType.authTypePersonal.wapiCapabilities */
317 bufferSize += 1; /* CsrWifiNmeApPersCredentialType primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase */
318 switch (primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase)
319 {
320 case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK:
321 bufferSize += 2; /* u16 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.encryptionMode */
322 bufferSize += 32; /* u8 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.psk[32] */
323 break;
324 case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE:
325 bufferSize += 2; /* u16 primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode */
326 bufferSize += (primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase ? strlen(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase) : 0) + 1; /* char* primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase (0 byte len + 1 for NULL Term) */
327 break;
328 default:
329 break;
330 }
331 break;
332 default:
333 break;
334 }
335 bufferSize += 1; /* u8 primitive->maxConnections */
336 bufferSize += 1; /* CsrWifiSmeP2pGroupCapabilityMask primitive->p2pGoParam.groupCapability */
337 bufferSize += 3; /* u8 primitive->p2pGoParam.operatingChanList.country[3] */
338 bufferSize += 1; /* u8 primitive->p2pGoParam.operatingChanList.channelEntryListCount */
339 {
340 u16 i3;
341 for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++)
342 {
343 bufferSize += 1; /* u8 primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingClass */
344 bufferSize += 1; /* u8 primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount */
345 bufferSize += primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount; /* u8 primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel */
346 }
347 }
348 bufferSize += 1; /* u8 primitive->p2pGoParam.opPsEnabled */
349 bufferSize += 1; /* u8 primitive->p2pGoParam.ctWindow */
350 bufferSize += 1; /* CsrWifiSmeP2pNoaConfigMethod primitive->p2pGoParam.noaConfigMethod */
351 bufferSize += 1; /* u8 primitive->p2pGoParam.allowNoaWithNonP2pDevices */
352 bufferSize += 1; /* u8 primitive->wpsEnabled */
353 return bufferSize;
354}
355
356
357u8* CsrWifiNmeApStartReqSer(u8 *ptr, size_t *len, void *msg)
358{
359 CsrWifiNmeApStartReq *primitive = (CsrWifiNmeApStartReq *)msg;
360 *len = 0;
361 CsrUint16Ser(ptr, len, primitive->common.type);
362 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
363 CsrUint8Ser(ptr, len, (u8) primitive->apType);
364 CsrUint8Ser(ptr, len, (u8) primitive->cloakSsid);
365 CsrMemCpySer(ptr, len, (const void *) primitive->ssid.ssid, ((u16) (32)));
366 CsrUint8Ser(ptr, len, (u8) primitive->ssid.length);
367 CsrUint8Ser(ptr, len, (u8) primitive->ifIndex);
368 CsrUint8Ser(ptr, len, (u8) primitive->channel);
369 CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.authType);
370 switch (primitive->apCredentials.authType)
371 {
372 case CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM:
373 CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.openSystemEmpty.empty);
374 break;
375 case CSR_WIFI_SME_AP_AUTH_TYPE_WEP:
376 CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepKeyType);
377 switch (primitive->apCredentials.nmeAuthType.authwep.wepKeyType)
378 {
379 case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128:
380 CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.wepAuthType);
381 CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.selectedWepKey);
382 CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key1, ((u16) (13)));
383 CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key2, ((u16) (13)));
384 CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key3, ((u16) (13)));
385 CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key4, ((u16) (13)));
386 break;
387 case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64:
388 CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.wepAuthType);
389 CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.selectedWepKey);
390 CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key1, ((u16) (5)));
391 CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key2, ((u16) (5)));
392 CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key3, ((u16) (5)));
393 CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key4, ((u16) (5)));
394 break;
395 default:
396 break;
397 }
398 break;
399 case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL:
400 CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authTypePersonal.authSupport);
401 CsrUint16Ser(ptr, len, (u16) primitive->apCredentials.nmeAuthType.authTypePersonal.rsnCapabilities);
402 CsrUint16Ser(ptr, len, (u16) primitive->apCredentials.nmeAuthType.authTypePersonal.wapiCapabilities);
403 CsrUint8Ser(ptr, len, (u8) primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase);
404 switch (primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase)
405 {
406 case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK:
407 CsrUint16Ser(ptr, len, (u16) primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.encryptionMode);
408 CsrMemCpySer(ptr, len, (const void *) primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.psk, ((u16) (32)));
409 break;
410 case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE:
411 CsrUint16Ser(ptr, len, (u16) primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode);
412 CsrCharStringSer(ptr, len, primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase);
413 break;
414 default:
415 break;
416 }
417 break;
418 default:
419 break;
420 }
421 CsrUint8Ser(ptr, len, (u8) primitive->maxConnections);
422 CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.groupCapability);
423 CsrMemCpySer(ptr, len, (const void *) primitive->p2pGoParam.operatingChanList.country, ((u16) (3)));
424 CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.operatingChanList.channelEntryListCount);
425 {
426 u16 i3;
427 for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++)
428 {
429 CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingClass);
430 CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount);
431 if (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount)
432 {
433 CsrMemCpySer(ptr, len, (const void *) primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel, ((u16) (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount)));
434 }
435 }
436 }
437 CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.opPsEnabled);
438 CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.ctWindow);
439 CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.noaConfigMethod);
440 CsrUint8Ser(ptr, len, (u8) primitive->p2pGoParam.allowNoaWithNonP2pDevices);
441 CsrUint8Ser(ptr, len, (u8) primitive->wpsEnabled);
442 return(ptr);
443}
444
445
446void* CsrWifiNmeApStartReqDes(u8 *buffer, size_t length)
447{
448 CsrWifiNmeApStartReq *primitive = kmalloc(sizeof(CsrWifiNmeApStartReq), GFP_KERNEL);
449 size_t offset;
450 offset = 0;
451
452 CsrUint16Des(&primitive->common.type, buffer, &offset);
453 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
454 CsrUint8Des((u8 *) &primitive->apType, buffer, &offset);
455 CsrUint8Des((u8 *) &primitive->cloakSsid, buffer, &offset);
456 CsrMemCpyDes(primitive->ssid.ssid, buffer, &offset, ((u16) (32)));
457 CsrUint8Des((u8 *) &primitive->ssid.length, buffer, &offset);
458 CsrUint8Des((u8 *) &primitive->ifIndex, buffer, &offset);
459 CsrUint8Des((u8 *) &primitive->channel, buffer, &offset);
460 CsrUint8Des((u8 *) &primitive->apCredentials.authType, buffer, &offset);
461 switch (primitive->apCredentials.authType)
462 {
463 case CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM:
464 CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.openSystemEmpty.empty, buffer, &offset);
465 break;
466 case CSR_WIFI_SME_AP_AUTH_TYPE_WEP:
467 CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepKeyType, buffer, &offset);
468 switch (primitive->apCredentials.nmeAuthType.authwep.wepKeyType)
469 {
470 case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128:
471 CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.wepAuthType, buffer, &offset);
472 CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.selectedWepKey, buffer, &offset);
473 CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key1, buffer, &offset, ((u16) (13)));
474 CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key2, buffer, &offset, ((u16) (13)));
475 CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key3, buffer, &offset, ((u16) (13)));
476 CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep128Key.key4, buffer, &offset, ((u16) (13)));
477 break;
478 case CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64:
479 CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.wepAuthType, buffer, &offset);
480 CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.selectedWepKey, buffer, &offset);
481 CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key1, buffer, &offset, ((u16) (5)));
482 CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key2, buffer, &offset, ((u16) (5)));
483 CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key3, buffer, &offset, ((u16) (5)));
484 CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authwep.wepCredentials.wep64Key.key4, buffer, &offset, ((u16) (5)));
485 break;
486 default:
487 break;
488 }
489 break;
490 case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL:
491 CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.authSupport, buffer, &offset);
492 CsrUint16Des((u16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.rsnCapabilities, buffer, &offset);
493 CsrUint16Des((u16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.wapiCapabilities, buffer, &offset);
494 CsrUint8Des((u8 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase, buffer, &offset);
495 switch (primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase)
496 {
497 case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK:
498 CsrUint16Des((u16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.encryptionMode, buffer, &offset);
499 CsrMemCpyDes(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.psk.psk, buffer, &offset, ((u16) (32)));
500 break;
501 case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE:
502 CsrUint16Des((u16 *) &primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.encryptionMode, buffer, &offset);
503 CsrCharStringDes(&primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase, buffer, &offset);
504 break;
505 default:
506 break;
507 }
508 break;
509 default:
510 break;
511 }
512 CsrUint8Des((u8 *) &primitive->maxConnections, buffer, &offset);
513 CsrUint8Des((u8 *) &primitive->p2pGoParam.groupCapability, buffer, &offset);
514 CsrMemCpyDes(primitive->p2pGoParam.operatingChanList.country, buffer, &offset, ((u16) (3)));
515 CsrUint8Des((u8 *) &primitive->p2pGoParam.operatingChanList.channelEntryListCount, buffer, &offset);
516 primitive->p2pGoParam.operatingChanList.channelEntryList = NULL;
517 if (primitive->p2pGoParam.operatingChanList.channelEntryListCount)
518 {
519 primitive->p2pGoParam.operatingChanList.channelEntryList = kmalloc(sizeof(CsrWifiSmeApP2pOperatingChanEntry) * primitive->p2pGoParam.operatingChanList.channelEntryListCount, GFP_KERNEL);
520 }
521 {
522 u16 i3;
523 for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++)
524 {
525 CsrUint8Des((u8 *) &primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingClass, buffer, &offset);
526 CsrUint8Des((u8 *) &primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount, buffer, &offset);
527 if (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount)
528 {
529 primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel = kmalloc(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount, GFP_KERNEL);
530 CsrMemCpyDes(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel, buffer, &offset, ((u16) (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount)));
531 }
532 else
533 {
534 primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel = NULL;
535 }
536 }
537 }
538 CsrUint8Des((u8 *) &primitive->p2pGoParam.opPsEnabled, buffer, &offset);
539 CsrUint8Des((u8 *) &primitive->p2pGoParam.ctWindow, buffer, &offset);
540 CsrUint8Des((u8 *) &primitive->p2pGoParam.noaConfigMethod, buffer, &offset);
541 CsrUint8Des((u8 *) &primitive->p2pGoParam.allowNoaWithNonP2pDevices, buffer, &offset);
542 CsrUint8Des((u8 *) &primitive->wpsEnabled, buffer, &offset);
543
544 return primitive;
545}
546
547
548void CsrWifiNmeApStartReqSerFree(void *voidPrimitivePointer)
549{
550 CsrWifiNmeApStartReq *primitive = (CsrWifiNmeApStartReq *) voidPrimitivePointer;
551 switch (primitive->apCredentials.authType)
552 {
553 case CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL:
554 switch (primitive->apCredentials.nmeAuthType.authTypePersonal.pskOrPassphrase)
555 {
556 case CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE:
557 kfree(primitive->apCredentials.nmeAuthType.authTypePersonal.authPers_credentials.passphrase.passphrase);
558 break;
559 default:
560 break;
561 }
562 break;
563 default:
564 break;
565 }
566 {
567 u16 i3;
568 for (i3 = 0; i3 < primitive->p2pGoParam.operatingChanList.channelEntryListCount; i3++)
569 {
570 kfree(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel);
571 }
572 }
573 kfree(primitive->p2pGoParam.operatingChanList.channelEntryList);
574 kfree(primitive);
575}
576
577
578size_t CsrWifiNmeApWmmParamUpdateReqSizeof(void *msg)
579{
580 size_t bufferSize = 2;
581
582 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 51) */
583 {
584 u16 i1;
585 for (i1 = 0; i1 < 4; i1++)
586 {
587 bufferSize += 1; /* u8 primitive->wmmApParams[i1].cwMin */
588 bufferSize += 1; /* u8 primitive->wmmApParams[i1].cwMax */
589 bufferSize += 1; /* u8 primitive->wmmApParams[i1].aifs */
590 bufferSize += 2; /* u16 primitive->wmmApParams[i1].txopLimit */
591 bufferSize += 1; /* u8 primitive->wmmApParams[i1].admissionControlMandatory */
592 }
593 }
594 {
595 u16 i1;
596 for (i1 = 0; i1 < 4; i1++)
597 {
598 bufferSize += 1; /* u8 primitive->wmmApBcParams[i1].cwMin */
599 bufferSize += 1; /* u8 primitive->wmmApBcParams[i1].cwMax */
600 bufferSize += 1; /* u8 primitive->wmmApBcParams[i1].aifs */
601 bufferSize += 2; /* u16 primitive->wmmApBcParams[i1].txopLimit */
602 bufferSize += 1; /* u8 primitive->wmmApBcParams[i1].admissionControlMandatory */
603 }
604 }
605 return bufferSize;
606}
607
608
609u8* CsrWifiNmeApWmmParamUpdateReqSer(u8 *ptr, size_t *len, void *msg)
610{
611 CsrWifiNmeApWmmParamUpdateReq *primitive = (CsrWifiNmeApWmmParamUpdateReq *)msg;
612 *len = 0;
613 CsrUint16Ser(ptr, len, primitive->common.type);
614 {
615 u16 i1;
616 for (i1 = 0; i1 < 4; i1++)
617 {
618 CsrUint8Ser(ptr, len, (u8) primitive->wmmApParams[i1].cwMin);
619 CsrUint8Ser(ptr, len, (u8) primitive->wmmApParams[i1].cwMax);
620 CsrUint8Ser(ptr, len, (u8) primitive->wmmApParams[i1].aifs);
621 CsrUint16Ser(ptr, len, (u16) primitive->wmmApParams[i1].txopLimit);
622 CsrUint8Ser(ptr, len, (u8) primitive->wmmApParams[i1].admissionControlMandatory);
623 }
624 }
625 {
626 u16 i1;
627 for (i1 = 0; i1 < 4; i1++)
628 {
629 CsrUint8Ser(ptr, len, (u8) primitive->wmmApBcParams[i1].cwMin);
630 CsrUint8Ser(ptr, len, (u8) primitive->wmmApBcParams[i1].cwMax);
631 CsrUint8Ser(ptr, len, (u8) primitive->wmmApBcParams[i1].aifs);
632 CsrUint16Ser(ptr, len, (u16) primitive->wmmApBcParams[i1].txopLimit);
633 CsrUint8Ser(ptr, len, (u8) primitive->wmmApBcParams[i1].admissionControlMandatory);
634 }
635 }
636 return(ptr);
637}
638
639
640void* CsrWifiNmeApWmmParamUpdateReqDes(u8 *buffer, size_t length)
641{
642 CsrWifiNmeApWmmParamUpdateReq *primitive = kmalloc(sizeof(CsrWifiNmeApWmmParamUpdateReq), GFP_KERNEL);
643 size_t offset;
644 offset = 0;
645
646 CsrUint16Des(&primitive->common.type, buffer, &offset);
647 {
648 u16 i1;
649 for (i1 = 0; i1 < 4; i1++)
650 {
651 CsrUint8Des((u8 *) &primitive->wmmApParams[i1].cwMin, buffer, &offset);
652 CsrUint8Des((u8 *) &primitive->wmmApParams[i1].cwMax, buffer, &offset);
653 CsrUint8Des((u8 *) &primitive->wmmApParams[i1].aifs, buffer, &offset);
654 CsrUint16Des((u16 *) &primitive->wmmApParams[i1].txopLimit, buffer, &offset);
655 CsrUint8Des((u8 *) &primitive->wmmApParams[i1].admissionControlMandatory, buffer, &offset);
656 }
657 }
658 {
659 u16 i1;
660 for (i1 = 0; i1 < 4; i1++)
661 {
662 CsrUint8Des((u8 *) &primitive->wmmApBcParams[i1].cwMin, buffer, &offset);
663 CsrUint8Des((u8 *) &primitive->wmmApBcParams[i1].cwMax, buffer, &offset);
664 CsrUint8Des((u8 *) &primitive->wmmApBcParams[i1].aifs, buffer, &offset);
665 CsrUint16Des((u16 *) &primitive->wmmApBcParams[i1].txopLimit, buffer, &offset);
666 CsrUint8Des((u8 *) &primitive->wmmApBcParams[i1].admissionControlMandatory, buffer, &offset);
667 }
668 }
669
670 return primitive;
671}
672
673
674size_t CsrWifiNmeApStaRemoveReqSizeof(void *msg)
675{
676 size_t bufferSize = 2;
677
678 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */
679 bufferSize += 2; /* u16 primitive->interfaceTag */
680 bufferSize += 6; /* u8 primitive->staMacAddress.a[6] */
681 bufferSize += 1; /* u8 primitive->keepBlocking */
682 return bufferSize;
683}
684
685
686u8* CsrWifiNmeApStaRemoveReqSer(u8 *ptr, size_t *len, void *msg)
687{
688 CsrWifiNmeApStaRemoveReq *primitive = (CsrWifiNmeApStaRemoveReq *)msg;
689 *len = 0;
690 CsrUint16Ser(ptr, len, primitive->common.type);
691 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
692 CsrMemCpySer(ptr, len, (const void *) primitive->staMacAddress.a, ((u16) (6)));
693 CsrUint8Ser(ptr, len, (u8) primitive->keepBlocking);
694 return(ptr);
695}
696
697
698void* CsrWifiNmeApStaRemoveReqDes(u8 *buffer, size_t length)
699{
700 CsrWifiNmeApStaRemoveReq *primitive = kmalloc(sizeof(CsrWifiNmeApStaRemoveReq), GFP_KERNEL);
701 size_t offset;
702 offset = 0;
703
704 CsrUint16Des(&primitive->common.type, buffer, &offset);
705 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
706 CsrMemCpyDes(primitive->staMacAddress.a, buffer, &offset, ((u16) (6)));
707 CsrUint8Des((u8 *) &primitive->keepBlocking, buffer, &offset);
708
709 return primitive;
710}
711
712
713size_t CsrWifiNmeApWpsRegisterCfmSizeof(void *msg)
714{
715 size_t bufferSize = 2;
716
717 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */
718 bufferSize += 2; /* u16 primitive->interfaceTag */
719 bufferSize += 2; /* CsrResult primitive->status */
720 return bufferSize;
721}
722
723
724u8* CsrWifiNmeApWpsRegisterCfmSer(u8 *ptr, size_t *len, void *msg)
725{
726 CsrWifiNmeApWpsRegisterCfm *primitive = (CsrWifiNmeApWpsRegisterCfm *)msg;
727 *len = 0;
728 CsrUint16Ser(ptr, len, primitive->common.type);
729 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
730 CsrUint16Ser(ptr, len, (u16) primitive->status);
731 return(ptr);
732}
733
734
735void* CsrWifiNmeApWpsRegisterCfmDes(u8 *buffer, size_t length)
736{
737 CsrWifiNmeApWpsRegisterCfm *primitive = kmalloc(sizeof(CsrWifiNmeApWpsRegisterCfm), GFP_KERNEL);
738 size_t offset;
739 offset = 0;
740
741 CsrUint16Des(&primitive->common.type, buffer, &offset);
742 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
743 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
744
745 return primitive;
746}
747
748
749size_t CsrWifiNmeApStartCfmSizeof(void *msg)
750{
751 size_t bufferSize = 2;
752
753 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 40) */
754 bufferSize += 2; /* u16 primitive->interfaceTag */
755 bufferSize += 2; /* CsrResult primitive->status */
756 bufferSize += 32; /* u8 primitive->ssid.ssid[32] */
757 bufferSize += 1; /* u8 primitive->ssid.length */
758 return bufferSize;
759}
760
761
762u8* CsrWifiNmeApStartCfmSer(u8 *ptr, size_t *len, void *msg)
763{
764 CsrWifiNmeApStartCfm *primitive = (CsrWifiNmeApStartCfm *)msg;
765 *len = 0;
766 CsrUint16Ser(ptr, len, primitive->common.type);
767 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
768 CsrUint16Ser(ptr, len, (u16) primitive->status);
769 CsrMemCpySer(ptr, len, (const void *) primitive->ssid.ssid, ((u16) (32)));
770 CsrUint8Ser(ptr, len, (u8) primitive->ssid.length);
771 return(ptr);
772}
773
774
775void* CsrWifiNmeApStartCfmDes(u8 *buffer, size_t length)
776{
777 CsrWifiNmeApStartCfm *primitive = kmalloc(sizeof(CsrWifiNmeApStartCfm), GFP_KERNEL);
778 size_t offset;
779 offset = 0;
780
781 CsrUint16Des(&primitive->common.type, buffer, &offset);
782 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
783 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
784 CsrMemCpyDes(primitive->ssid.ssid, buffer, &offset, ((u16) (32)));
785 CsrUint8Des((u8 *) &primitive->ssid.length, buffer, &offset);
786
787 return primitive;
788}
789
790
791size_t CsrWifiNmeApStopCfmSizeof(void *msg)
792{
793 size_t bufferSize = 2;
794
795 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */
796 bufferSize += 2; /* u16 primitive->interfaceTag */
797 bufferSize += 2; /* CsrResult primitive->status */
798 return bufferSize;
799}
800
801
802u8* CsrWifiNmeApStopCfmSer(u8 *ptr, size_t *len, void *msg)
803{
804 CsrWifiNmeApStopCfm *primitive = (CsrWifiNmeApStopCfm *)msg;
805 *len = 0;
806 CsrUint16Ser(ptr, len, primitive->common.type);
807 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
808 CsrUint16Ser(ptr, len, (u16) primitive->status);
809 return(ptr);
810}
811
812
813void* CsrWifiNmeApStopCfmDes(u8 *buffer, size_t length)
814{
815 CsrWifiNmeApStopCfm *primitive = kmalloc(sizeof(CsrWifiNmeApStopCfm), GFP_KERNEL);
816 size_t offset;
817 offset = 0;
818
819 CsrUint16Des(&primitive->common.type, buffer, &offset);
820 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
821 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
822
823 return primitive;
824}
825
826
827size_t CsrWifiNmeApStopIndSizeof(void *msg)
828{
829 size_t bufferSize = 2;
830
831 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */
832 bufferSize += 2; /* u16 primitive->interfaceTag */
833 bufferSize += 1; /* CsrWifiSmeApType primitive->apType */
834 bufferSize += 2; /* CsrResult primitive->status */
835 return bufferSize;
836}
837
838
839u8* CsrWifiNmeApStopIndSer(u8 *ptr, size_t *len, void *msg)
840{
841 CsrWifiNmeApStopInd *primitive = (CsrWifiNmeApStopInd *)msg;
842 *len = 0;
843 CsrUint16Ser(ptr, len, primitive->common.type);
844 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
845 CsrUint8Ser(ptr, len, (u8) primitive->apType);
846 CsrUint16Ser(ptr, len, (u16) primitive->status);
847 return(ptr);
848}
849
850
851void* CsrWifiNmeApStopIndDes(u8 *buffer, size_t length)
852{
853 CsrWifiNmeApStopInd *primitive = kmalloc(sizeof(CsrWifiNmeApStopInd), GFP_KERNEL);
854 size_t offset;
855 offset = 0;
856
857 CsrUint16Des(&primitive->common.type, buffer, &offset);
858 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
859 CsrUint8Des((u8 *) &primitive->apType, buffer, &offset);
860 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
861
862 return primitive;
863}
864
865
866size_t CsrWifiNmeApStationIndSizeof(void *msg)
867{
868 size_t bufferSize = 2;
869
870 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 18) */
871 bufferSize += 2; /* u16 primitive->interfaceTag */
872 bufferSize += 1; /* CsrWifiSmeMediaStatus primitive->mediaStatus */
873 bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */
874 bufferSize += 6; /* u8 primitive->peerDeviceAddress.a[6] */
875 return bufferSize;
876}
877
878
879u8* CsrWifiNmeApStationIndSer(u8 *ptr, size_t *len, void *msg)
880{
881 CsrWifiNmeApStationInd *primitive = (CsrWifiNmeApStationInd *)msg;
882 *len = 0;
883 CsrUint16Ser(ptr, len, primitive->common.type);
884 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
885 CsrUint8Ser(ptr, len, (u8) primitive->mediaStatus);
886 CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6)));
887 CsrMemCpySer(ptr, len, (const void *) primitive->peerDeviceAddress.a, ((u16) (6)));
888 return(ptr);
889}
890
891
892void* CsrWifiNmeApStationIndDes(u8 *buffer, size_t length)
893{
894 CsrWifiNmeApStationInd *primitive = kmalloc(sizeof(CsrWifiNmeApStationInd), GFP_KERNEL);
895 size_t offset;
896 offset = 0;
897
898 CsrUint16Des(&primitive->common.type, buffer, &offset);
899 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
900 CsrUint8Des((u8 *) &primitive->mediaStatus, buffer, &offset);
901 CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6)));
902 CsrMemCpyDes(primitive->peerDeviceAddress.a, buffer, &offset, ((u16) (6)));
903
904 return primitive;
905}
906
907
908#endif /* CSR_WIFI_NME_ENABLE */
909#endif /* CSR_WIFI_AP_ENABLE */
diff --git a/drivers/staging/csr/csr_wifi_nme_ap_serialize.h b/drivers/staging/csr/csr_wifi_nme_ap_serialize.h
deleted file mode 100644
index c04585e72460..000000000000
--- a/drivers/staging/csr/csr_wifi_nme_ap_serialize.h
+++ /dev/null
@@ -1,94 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_NME_AP_SERIALIZE_H__
14#define CSR_WIFI_NME_AP_SERIALIZE_H__
15
16#include "csr_wifi_msgconv.h"
17
18#include "csr_wifi_nme_ap_prim.h"
19
20#ifndef CSR_WIFI_NME_ENABLE
21#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_serialize.h
22#endif
23#ifndef CSR_WIFI_AP_ENABLE
24#error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_serialize.h
25#endif
26
27extern void CsrWifiNmeApPfree(void *ptr);
28
29extern u8* CsrWifiNmeApConfigSetReqSer(u8 *ptr, size_t *len, void *msg);
30extern void* CsrWifiNmeApConfigSetReqDes(u8 *buffer, size_t len);
31extern size_t CsrWifiNmeApConfigSetReqSizeof(void *msg);
32extern void CsrWifiNmeApConfigSetReqSerFree(void *msg);
33
34extern u8* CsrWifiNmeApWpsRegisterReqSer(u8 *ptr, size_t *len, void *msg);
35extern void* CsrWifiNmeApWpsRegisterReqDes(u8 *buffer, size_t len);
36extern size_t CsrWifiNmeApWpsRegisterReqSizeof(void *msg);
37#define CsrWifiNmeApWpsRegisterReqSerFree CsrWifiNmeApPfree
38
39extern u8* CsrWifiNmeApStartReqSer(u8 *ptr, size_t *len, void *msg);
40extern void* CsrWifiNmeApStartReqDes(u8 *buffer, size_t len);
41extern size_t CsrWifiNmeApStartReqSizeof(void *msg);
42extern void CsrWifiNmeApStartReqSerFree(void *msg);
43
44#define CsrWifiNmeApStopReqSer CsrWifiEventCsrUint16Ser
45#define CsrWifiNmeApStopReqDes CsrWifiEventCsrUint16Des
46#define CsrWifiNmeApStopReqSizeof CsrWifiEventCsrUint16Sizeof
47#define CsrWifiNmeApStopReqSerFree CsrWifiNmeApPfree
48
49extern u8* CsrWifiNmeApWmmParamUpdateReqSer(u8 *ptr, size_t *len, void *msg);
50extern void* CsrWifiNmeApWmmParamUpdateReqDes(u8 *buffer, size_t len);
51extern size_t CsrWifiNmeApWmmParamUpdateReqSizeof(void *msg);
52#define CsrWifiNmeApWmmParamUpdateReqSerFree CsrWifiNmeApPfree
53
54extern u8* CsrWifiNmeApStaRemoveReqSer(u8 *ptr, size_t *len, void *msg);
55extern void* CsrWifiNmeApStaRemoveReqDes(u8 *buffer, size_t len);
56extern size_t CsrWifiNmeApStaRemoveReqSizeof(void *msg);
57#define CsrWifiNmeApStaRemoveReqSerFree CsrWifiNmeApPfree
58
59#define CsrWifiNmeApConfigSetCfmSer CsrWifiEventCsrUint16Ser
60#define CsrWifiNmeApConfigSetCfmDes CsrWifiEventCsrUint16Des
61#define CsrWifiNmeApConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof
62#define CsrWifiNmeApConfigSetCfmSerFree CsrWifiNmeApPfree
63
64extern u8* CsrWifiNmeApWpsRegisterCfmSer(u8 *ptr, size_t *len, void *msg);
65extern void* CsrWifiNmeApWpsRegisterCfmDes(u8 *buffer, size_t len);
66extern size_t CsrWifiNmeApWpsRegisterCfmSizeof(void *msg);
67#define CsrWifiNmeApWpsRegisterCfmSerFree CsrWifiNmeApPfree
68
69extern u8* CsrWifiNmeApStartCfmSer(u8 *ptr, size_t *len, void *msg);
70extern void* CsrWifiNmeApStartCfmDes(u8 *buffer, size_t len);
71extern size_t CsrWifiNmeApStartCfmSizeof(void *msg);
72#define CsrWifiNmeApStartCfmSerFree CsrWifiNmeApPfree
73
74extern u8* CsrWifiNmeApStopCfmSer(u8 *ptr, size_t *len, void *msg);
75extern void* CsrWifiNmeApStopCfmDes(u8 *buffer, size_t len);
76extern size_t CsrWifiNmeApStopCfmSizeof(void *msg);
77#define CsrWifiNmeApStopCfmSerFree CsrWifiNmeApPfree
78
79extern u8* CsrWifiNmeApStopIndSer(u8 *ptr, size_t *len, void *msg);
80extern void* CsrWifiNmeApStopIndDes(u8 *buffer, size_t len);
81extern size_t CsrWifiNmeApStopIndSizeof(void *msg);
82#define CsrWifiNmeApStopIndSerFree CsrWifiNmeApPfree
83
84#define CsrWifiNmeApWmmParamUpdateCfmSer CsrWifiEventCsrUint16Ser
85#define CsrWifiNmeApWmmParamUpdateCfmDes CsrWifiEventCsrUint16Des
86#define CsrWifiNmeApWmmParamUpdateCfmSizeof CsrWifiEventCsrUint16Sizeof
87#define CsrWifiNmeApWmmParamUpdateCfmSerFree CsrWifiNmeApPfree
88
89extern u8* CsrWifiNmeApStationIndSer(u8 *ptr, size_t *len, void *msg);
90extern void* CsrWifiNmeApStationIndDes(u8 *buffer, size_t len);
91extern size_t CsrWifiNmeApStationIndSizeof(void *msg);
92#define CsrWifiNmeApStationIndSerFree CsrWifiNmeApPfree
93
94#endif /* CSR_WIFI_NME_AP_SERIALIZE_H__ */
diff --git a/drivers/staging/csr/csr_wifi_nme_converter_init.h b/drivers/staging/csr/csr_wifi_nme_converter_init.h
deleted file mode 100644
index 85e6f5f57130..000000000000
--- a/drivers/staging/csr/csr_wifi_nme_converter_init.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_NME_CONVERTER_INIT_H__
14#define CSR_WIFI_NME_CONVERTER_INIT_H__
15
16#ifndef CSR_WIFI_NME_ENABLE
17#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_converter_init.h
18#endif
19
20#ifndef EXCLUDE_CSR_WIFI_NME_MODULE
21
22#include "csr_msgconv.h"
23
24#ifdef CSR_LOG_ENABLE
25#include "csr_log.h"
26
27extern const CsrLogPrimitiveInformation* CsrWifiNmeTechInfoGet(void);
28#endif /* CSR_LOG_ENABLE */
29
30extern void CsrWifiNmeConverterInit(void);
31
32#else /* EXCLUDE_CSR_WIFI_NME_MODULE */
33
34#define CsrWifiNmeConverterInit()
35
36#endif /* EXCLUDE_CSR_WIFI_NME_MODULE */
37
38#endif /* CSR_WIFI_NME_CONVERTER_INIT_H__ */
diff --git a/drivers/staging/csr/csr_wifi_nme_lib.h b/drivers/staging/csr/csr_wifi_nme_lib.h
deleted file mode 100644
index 5a1f132009bf..000000000000
--- a/drivers/staging/csr/csr_wifi_nme_lib.h
+++ /dev/null
@@ -1,991 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_NME_LIB_H__
14#define CSR_WIFI_NME_LIB_H__
15
16#include "csr_sched.h"
17#include "csr_macro.h"
18#include "csr_msg_transport.h"
19
20#include "csr_wifi_lib.h"
21
22#include "csr_wifi_nme_prim.h"
23#include "csr_wifi_nme_task.h"
24
25
26#ifndef CSR_WIFI_NME_ENABLE
27#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_lib.h
28#endif
29
30/*******************************************************************************
31
32 NAME
33 CsrWifiNmeConnectionStatusGetReqSend
34
35 DESCRIPTION
36 Requests the current connection status of the NME.
37
38 PARAMETERS
39 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
40 interfaceTag - Interface Identifier; unique identifier of an interface
41
42*******************************************************************************/
43#define CsrWifiNmeConnectionStatusGetReqCreate(msg__, dst__, src__, interfaceTag__) \
44 msg__ = kmalloc(sizeof(CsrWifiNmeConnectionStatusGetReq), GFP_KERNEL); \
45 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_CONNECTION_STATUS_GET_REQ, dst__, src__); \
46 msg__->interfaceTag = (interfaceTag__);
47
48#define CsrWifiNmeConnectionStatusGetReqSendTo(dst__, src__, interfaceTag__) \
49 { \
50 CsrWifiNmeConnectionStatusGetReq *msg__; \
51 CsrWifiNmeConnectionStatusGetReqCreate(msg__, dst__, src__, interfaceTag__); \
52 CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
53 }
54
55#define CsrWifiNmeConnectionStatusGetReqSend(src__, interfaceTag__) \
56 CsrWifiNmeConnectionStatusGetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__)
57
58/*******************************************************************************
59
60 NAME
61 CsrWifiNmeConnectionStatusGetCfmSend
62
63 DESCRIPTION
64 Reports the connection status of the NME.
65
66 PARAMETERS
67 queue - Destination Task Queue
68 interfaceTag - Interface Identifier; unique identifier of an interface
69 status - Indicates the success or otherwise of the requested
70 operation.
71 connectionStatus - NME current connection status
72
73*******************************************************************************/
74#define CsrWifiNmeConnectionStatusGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionStatus__) \
75 msg__ = kmalloc(sizeof(CsrWifiNmeConnectionStatusGetCfm), GFP_KERNEL); \
76 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_CONNECTION_STATUS_GET_CFM, dst__, src__); \
77 msg__->interfaceTag = (interfaceTag__); \
78 msg__->status = (status__); \
79 msg__->connectionStatus = (connectionStatus__);
80
81#define CsrWifiNmeConnectionStatusGetCfmSendTo(dst__, src__, interfaceTag__, status__, connectionStatus__) \
82 { \
83 CsrWifiNmeConnectionStatusGetCfm *msg__; \
84 CsrWifiNmeConnectionStatusGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionStatus__); \
85 CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
86 }
87
88#define CsrWifiNmeConnectionStatusGetCfmSend(dst__, interfaceTag__, status__, connectionStatus__) \
89 CsrWifiNmeConnectionStatusGetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__, connectionStatus__)
90
91/*******************************************************************************
92
93 NAME
94 CsrWifiNmeEventMaskSetReqSend
95
96 DESCRIPTION
97 The wireless manager application may register with the NME to receive
98 notification of interesting events. Indications will be sent only if the
99 wireless manager explicitly registers to be notified of that event.
100 indMask is a bit mask of values defined in CsrWifiNmeIndicationsMask.
101
102 PARAMETERS
103 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
104 indMask - Set mask with values from CsrWifiNmeIndications
105
106*******************************************************************************/
107#define CsrWifiNmeEventMaskSetReqCreate(msg__, dst__, src__, indMask__) \
108 msg__ = kmalloc(sizeof(CsrWifiNmeEventMaskSetReq), GFP_KERNEL); \
109 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_EVENT_MASK_SET_REQ, dst__, src__); \
110 msg__->indMask = (indMask__);
111
112#define CsrWifiNmeEventMaskSetReqSendTo(dst__, src__, indMask__) \
113 { \
114 CsrWifiNmeEventMaskSetReq *msg__; \
115 CsrWifiNmeEventMaskSetReqCreate(msg__, dst__, src__, indMask__); \
116 CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
117 }
118
119#define CsrWifiNmeEventMaskSetReqSend(src__, indMask__) \
120 CsrWifiNmeEventMaskSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, indMask__)
121
122/*******************************************************************************
123
124 NAME
125 CsrWifiNmeEventMaskSetCfmSend
126
127 DESCRIPTION
128 The NME calls the primitive to report the result of the request
129 primitive.
130
131 PARAMETERS
132 queue - Destination Task Queue
133 status - Reports the result of the request
134
135*******************************************************************************/
136#define CsrWifiNmeEventMaskSetCfmCreate(msg__, dst__, src__, status__) \
137 msg__ = kmalloc(sizeof(CsrWifiNmeEventMaskSetCfm), GFP_KERNEL); \
138 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_EVENT_MASK_SET_CFM, dst__, src__); \
139 msg__->status = (status__);
140
141#define CsrWifiNmeEventMaskSetCfmSendTo(dst__, src__, status__) \
142 { \
143 CsrWifiNmeEventMaskSetCfm *msg__; \
144 CsrWifiNmeEventMaskSetCfmCreate(msg__, dst__, src__, status__); \
145 CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
146 }
147
148#define CsrWifiNmeEventMaskSetCfmSend(dst__, status__) \
149 CsrWifiNmeEventMaskSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__)
150
151/*******************************************************************************
152
153 NAME
154 CsrWifiNmeProfileConnectReqSend
155
156 DESCRIPTION
157 Requests the NME to attempt to connect to the specified profile.
158 Overrides any current connection attempt.
159
160 PARAMETERS
161 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
162 interfaceTag - Interface Identifier; unique identifier of an interface
163 profileIdentity - Identity (BSSID, SSID) of profile to be connected to.
164 It must match an existing profile in the NME.
165
166*******************************************************************************/
167#define CsrWifiNmeProfileConnectReqCreate(msg__, dst__, src__, interfaceTag__, profileIdentity__) \
168 msg__ = kmalloc(sizeof(CsrWifiNmeProfileConnectReq), GFP_KERNEL); \
169 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_CONNECT_REQ, dst__, src__); \
170 msg__->interfaceTag = (interfaceTag__); \
171 msg__->profileIdentity = (profileIdentity__);
172
173#define CsrWifiNmeProfileConnectReqSendTo(dst__, src__, interfaceTag__, profileIdentity__) \
174 { \
175 CsrWifiNmeProfileConnectReq *msg__; \
176 CsrWifiNmeProfileConnectReqCreate(msg__, dst__, src__, interfaceTag__, profileIdentity__); \
177 CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
178 }
179
180#define CsrWifiNmeProfileConnectReqSend(src__, interfaceTag__, profileIdentity__) \
181 CsrWifiNmeProfileConnectReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, profileIdentity__)
182
183/*******************************************************************************
184
185 NAME
186 CsrWifiNmeProfileConnectCfmSend
187
188 DESCRIPTION
189 Reports the status of the NME PROFILE CONNECT REQ. If unsuccessful the
190 connectAttempt parameters contain details of the APs that the NME
191 attempted to connect to before reporting the failure of the request.
192
193 PARAMETERS
194 queue - Destination Task Queue
195 interfaceTag - Interface Identifier; unique identifier of an
196 interface
197 status - Indicates the success or otherwise of the requested
198 operation.
199 connectAttemptsCount - This parameter is relevant only if
200 status!=CSR_WIFI_NME_STATUS_SUCCESS.
201 Number of connection attempt elements provided with
202 this primitive
203 connectAttempts - This parameter is relevant only if
204 status!=CSR_WIFI_NME_STATUS_SUCCESS.
205 Points to the list of connection attempt elements
206 provided with this primitive
207 Each element of the list provides information about
208 an AP on which the connection attempt was made and
209 the error that occurred during the attempt.
210
211*******************************************************************************/
212#define CsrWifiNmeProfileConnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__) \
213 msg__ = kmalloc(sizeof(CsrWifiNmeProfileConnectCfm), GFP_KERNEL); \
214 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_CONNECT_CFM, dst__, src__); \
215 msg__->interfaceTag = (interfaceTag__); \
216 msg__->status = (status__); \
217 msg__->connectAttemptsCount = (connectAttemptsCount__); \
218 msg__->connectAttempts = (connectAttempts__);
219
220#define CsrWifiNmeProfileConnectCfmSendTo(dst__, src__, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__) \
221 { \
222 CsrWifiNmeProfileConnectCfm *msg__; \
223 CsrWifiNmeProfileConnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__); \
224 CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
225 }
226
227#define CsrWifiNmeProfileConnectCfmSend(dst__, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__) \
228 CsrWifiNmeProfileConnectCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__, connectAttemptsCount__, connectAttempts__)
229
230/*******************************************************************************
231
232 NAME
233 CsrWifiNmeProfileDeleteAllReqSend
234
235 DESCRIPTION
236 Deletes all profiles present in the NME, but does NOT modify the
237 preferred profile list.
238
239 PARAMETERS
240 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
241
242*******************************************************************************/
243#define CsrWifiNmeProfileDeleteAllReqCreate(msg__, dst__, src__) \
244 msg__ = kmalloc(sizeof(CsrWifiNmeProfileDeleteAllReq), GFP_KERNEL); \
245 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_ALL_REQ, dst__, src__);
246
247#define CsrWifiNmeProfileDeleteAllReqSendTo(dst__, src__) \
248 { \
249 CsrWifiNmeProfileDeleteAllReq *msg__; \
250 CsrWifiNmeProfileDeleteAllReqCreate(msg__, dst__, src__); \
251 CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
252 }
253
254#define CsrWifiNmeProfileDeleteAllReqSend(src__) \
255 CsrWifiNmeProfileDeleteAllReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__)
256
257/*******************************************************************************
258
259 NAME
260 CsrWifiNmeProfileDeleteAllCfmSend
261
262 DESCRIPTION
263 Reports the status of the CSR_WIFI_NME_PROFILE_DELETE_ALL_REQ.
264 Returns always CSR_WIFI_NME_STATUS_SUCCESS.
265
266 PARAMETERS
267 queue - Destination Task Queue
268 status - Indicates the success or otherwise of the requested operation, but
269 in this case it always set to success.
270
271*******************************************************************************/
272#define CsrWifiNmeProfileDeleteAllCfmCreate(msg__, dst__, src__, status__) \
273 msg__ = kmalloc(sizeof(CsrWifiNmeProfileDeleteAllCfm), GFP_KERNEL); \
274 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_ALL_CFM, dst__, src__); \
275 msg__->status = (status__);
276
277#define CsrWifiNmeProfileDeleteAllCfmSendTo(dst__, src__, status__) \
278 { \
279 CsrWifiNmeProfileDeleteAllCfm *msg__; \
280 CsrWifiNmeProfileDeleteAllCfmCreate(msg__, dst__, src__, status__); \
281 CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
282 }
283
284#define CsrWifiNmeProfileDeleteAllCfmSend(dst__, status__) \
285 CsrWifiNmeProfileDeleteAllCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__)
286
287/*******************************************************************************
288
289 NAME
290 CsrWifiNmeProfileDeleteReqSend
291
292 DESCRIPTION
293 Will delete the profile with a matching identity, but does NOT modify the
294 preferred profile list.
295
296 PARAMETERS
297 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
298 profileIdentity - Identity (BSSID, SSID) of profile to be deleted.
299
300*******************************************************************************/
301#define CsrWifiNmeProfileDeleteReqCreate(msg__, dst__, src__, profileIdentity__) \
302 msg__ = kmalloc(sizeof(CsrWifiNmeProfileDeleteReq), GFP_KERNEL); \
303 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_REQ, dst__, src__); \
304 msg__->profileIdentity = (profileIdentity__);
305
306#define CsrWifiNmeProfileDeleteReqSendTo(dst__, src__, profileIdentity__) \
307 { \
308 CsrWifiNmeProfileDeleteReq *msg__; \
309 CsrWifiNmeProfileDeleteReqCreate(msg__, dst__, src__, profileIdentity__); \
310 CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
311 }
312
313#define CsrWifiNmeProfileDeleteReqSend(src__, profileIdentity__) \
314 CsrWifiNmeProfileDeleteReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, profileIdentity__)
315
316/*******************************************************************************
317
318 NAME
319 CsrWifiNmeProfileDeleteCfmSend
320
321 DESCRIPTION
322 Reports the status of the CSR_WIFI_NME_PROFILE_DELETE_REQ.
323 Returns CSR_WIFI_NME_STATUS_NOT_FOUND if there is no matching profile.
324
325 PARAMETERS
326 queue - Destination Task Queue
327 status - Indicates the success or otherwise of the requested operation.
328
329*******************************************************************************/
330#define CsrWifiNmeProfileDeleteCfmCreate(msg__, dst__, src__, status__) \
331 msg__ = kmalloc(sizeof(CsrWifiNmeProfileDeleteCfm), GFP_KERNEL); \
332 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DELETE_CFM, dst__, src__); \
333 msg__->status = (status__);
334
335#define CsrWifiNmeProfileDeleteCfmSendTo(dst__, src__, status__) \
336 { \
337 CsrWifiNmeProfileDeleteCfm *msg__; \
338 CsrWifiNmeProfileDeleteCfmCreate(msg__, dst__, src__, status__); \
339 CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
340 }
341
342#define CsrWifiNmeProfileDeleteCfmSend(dst__, status__) \
343 CsrWifiNmeProfileDeleteCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__)
344
345/*******************************************************************************
346
347 NAME
348 CsrWifiNmeProfileDisconnectIndSend
349
350 DESCRIPTION
351 Indication generated from the NME (if an application subscribes to
352 receive it) that informs that application that the current profile
353 connection has disconnected. The indication will contain information
354 about APs that it attempted to maintain the connection via i.e. in the
355 case of failed roaming.
356
357 PARAMETERS
358 queue - Destination Task Queue
359 interfaceTag - Interface Identifier; unique identifier of an
360 interface
361 connectAttemptsCount - Number of connection attempt elements provided with
362 this primitive
363 connectAttempts - Points to the list of connection attempt elements
364 provided with this primitive
365 Each element of the list provides information about
366 an AP on which the connection attempt was made and
367 the error occurred during the attempt.
368
369*******************************************************************************/
370#define CsrWifiNmeProfileDisconnectIndCreate(msg__, dst__, src__, interfaceTag__, connectAttemptsCount__, connectAttempts__) \
371 msg__ = kmalloc(sizeof(CsrWifiNmeProfileDisconnectInd), GFP_KERNEL); \
372 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_DISCONNECT_IND, dst__, src__); \
373 msg__->interfaceTag = (interfaceTag__); \
374 msg__->connectAttemptsCount = (connectAttemptsCount__); \
375 msg__->connectAttempts = (connectAttempts__);
376
377#define CsrWifiNmeProfileDisconnectIndSendTo(dst__, src__, interfaceTag__, connectAttemptsCount__, connectAttempts__) \
378 { \
379 CsrWifiNmeProfileDisconnectInd *msg__; \
380 CsrWifiNmeProfileDisconnectIndCreate(msg__, dst__, src__, interfaceTag__, connectAttemptsCount__, connectAttempts__); \
381 CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
382 }
383
384#define CsrWifiNmeProfileDisconnectIndSend(dst__, interfaceTag__, connectAttemptsCount__, connectAttempts__) \
385 CsrWifiNmeProfileDisconnectIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, connectAttemptsCount__, connectAttempts__)
386
387/*******************************************************************************
388
389 NAME
390 CsrWifiNmeProfileOrderSetReqSend
391
392 DESCRIPTION
393 Defines the preferred order that profiles present in the NME should be
394 used during the NME auto-connect behaviour.
395 If profileIdentitysCount == 0, it removes any existing preferred profile
396 list already present in the NME, effectively disabling the auto-connect
397 behaviour.
398 NOTE: Profile identities that do not match any profile stored in the NME
399 are ignored during the auto-connect procedure.
400 NOTE: during auto-connect the NME will only attempt to join an existing
401 adhoc network and it will never attempt to host an adhoc network; for
402 hosting and adhoc network, use CSR_WIFI_NME_PROFILE_CONNECT_REQ
403
404 PARAMETERS
405 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
406 interfaceTag - Interface Identifier; unique identifier of an
407 interface
408 profileIdentitysCount - The number of profiles identities in the list.
409 profileIdentitys - Points to the list of profile identities.
410
411*******************************************************************************/
412#define CsrWifiNmeProfileOrderSetReqCreate(msg__, dst__, src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__) \
413 msg__ = kmalloc(sizeof(CsrWifiNmeProfileOrderSetReq), GFP_KERNEL); \
414 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_ORDER_SET_REQ, dst__, src__); \
415 msg__->interfaceTag = (interfaceTag__); \
416 msg__->profileIdentitysCount = (profileIdentitysCount__); \
417 msg__->profileIdentitys = (profileIdentitys__);
418
419#define CsrWifiNmeProfileOrderSetReqSendTo(dst__, src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__) \
420 { \
421 CsrWifiNmeProfileOrderSetReq *msg__; \
422 CsrWifiNmeProfileOrderSetReqCreate(msg__, dst__, src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__); \
423 CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
424 }
425
426#define CsrWifiNmeProfileOrderSetReqSend(src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__) \
427 CsrWifiNmeProfileOrderSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, profileIdentitysCount__, profileIdentitys__)
428
429/*******************************************************************************
430
431 NAME
432 CsrWifiNmeProfileOrderSetCfmSend
433
434 DESCRIPTION
435 Confirmation to UNIFI_NME_PROFILE_ORDER_SET.request.
436
437 PARAMETERS
438 queue - Destination Task Queue
439 interfaceTag - Interface Identifier; unique identifier of an interface
440 status - Indicates the success or otherwise of the requested
441 operation.
442
443*******************************************************************************/
444#define CsrWifiNmeProfileOrderSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
445 msg__ = kmalloc(sizeof(CsrWifiNmeProfileOrderSetCfm), GFP_KERNEL); \
446 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_ORDER_SET_CFM, dst__, src__); \
447 msg__->interfaceTag = (interfaceTag__); \
448 msg__->status = (status__);
449
450#define CsrWifiNmeProfileOrderSetCfmSendTo(dst__, src__, interfaceTag__, status__) \
451 { \
452 CsrWifiNmeProfileOrderSetCfm *msg__; \
453 CsrWifiNmeProfileOrderSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
454 CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
455 }
456
457#define CsrWifiNmeProfileOrderSetCfmSend(dst__, interfaceTag__, status__) \
458 CsrWifiNmeProfileOrderSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__)
459
460/*******************************************************************************
461
462 NAME
463 CsrWifiNmeProfileSetReqSend
464
465 DESCRIPTION
466 Creates or updates an existing profile in the NME that matches the unique
467 identity of the profile. Each profile is identified by the combination of
468 BSSID and SSID. The profile contains all the required credentials for
469 attempting to connect to the network. Creating or updating a profile via
470 the NME PROFILE SET REQ does NOT add the profile to the preferred profile
471 list within the NME used for the NME auto-connect behaviour.
472
473 PARAMETERS
474 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
475 profile - Specifies the identity and credentials of the network.
476
477*******************************************************************************/
478#define CsrWifiNmeProfileSetReqCreate(msg__, dst__, src__, profile__) \
479 msg__ = kmalloc(sizeof(CsrWifiNmeProfileSetReq), GFP_KERNEL); \
480 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_SET_REQ, dst__, src__); \
481 msg__->profile = (profile__);
482
483#define CsrWifiNmeProfileSetReqSendTo(dst__, src__, profile__) \
484 { \
485 CsrWifiNmeProfileSetReq *msg__; \
486 CsrWifiNmeProfileSetReqCreate(msg__, dst__, src__, profile__); \
487 CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
488 }
489
490#define CsrWifiNmeProfileSetReqSend(src__, profile__) \
491 CsrWifiNmeProfileSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, profile__)
492
493/*******************************************************************************
494
495 NAME
496 CsrWifiNmeProfileSetCfmSend
497
498 DESCRIPTION
499 Reports the status of the NME PROFILE SET REQ; the request will only fail
500 if the details specified in the profile contains an invalid combination
501 of parameters for example specifying the profile as cloaked but not
502 specifying the SSID. The NME doesn't limit the number of profiles that
503 may be created. The NME assumes that the entity configuring it is aware
504 of the appropriate limits.
505
506 PARAMETERS
507 queue - Destination Task Queue
508 status - Indicates the success or otherwise of the requested operation.
509
510*******************************************************************************/
511#define CsrWifiNmeProfileSetCfmCreate(msg__, dst__, src__, status__) \
512 msg__ = kmalloc(sizeof(CsrWifiNmeProfileSetCfm), GFP_KERNEL); \
513 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_SET_CFM, dst__, src__); \
514 msg__->status = (status__);
515
516#define CsrWifiNmeProfileSetCfmSendTo(dst__, src__, status__) \
517 { \
518 CsrWifiNmeProfileSetCfm *msg__; \
519 CsrWifiNmeProfileSetCfmCreate(msg__, dst__, src__, status__); \
520 CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
521 }
522
523#define CsrWifiNmeProfileSetCfmSend(dst__, status__) \
524 CsrWifiNmeProfileSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__)
525
526/*******************************************************************************
527
528 NAME
529 CsrWifiNmeProfileUpdateIndSend
530
531 DESCRIPTION
532 Indication generated from the NME (if an application subscribes to
533 receive it) that informs that application that the contained profile has
534 changed.
535 For example, either the credentials EAP-FAST PAC file or the session data
536 within the profile has changed.
537 It is up to the application whether it stores this updated profile or
538 not.
539
540 PARAMETERS
541 queue - Destination Task Queue
542 interfaceTag - Interface Identifier; unique identifier of an interface
543 profile - The identity and credentials of the network.
544
545*******************************************************************************/
546#define CsrWifiNmeProfileUpdateIndCreate(msg__, dst__, src__, interfaceTag__, profile__) \
547 msg__ = kmalloc(sizeof(CsrWifiNmeProfileUpdateInd), GFP_KERNEL); \
548 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_PROFILE_UPDATE_IND, dst__, src__); \
549 msg__->interfaceTag = (interfaceTag__); \
550 msg__->profile = (profile__);
551
552#define CsrWifiNmeProfileUpdateIndSendTo(dst__, src__, interfaceTag__, profile__) \
553 { \
554 CsrWifiNmeProfileUpdateInd *msg__; \
555 CsrWifiNmeProfileUpdateIndCreate(msg__, dst__, src__, interfaceTag__, profile__); \
556 CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
557 }
558
559#define CsrWifiNmeProfileUpdateIndSend(dst__, interfaceTag__, profile__) \
560 CsrWifiNmeProfileUpdateIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, profile__)
561
562/*******************************************************************************
563
564 NAME
565 CsrWifiNmeSimGsmAuthIndSend
566
567 DESCRIPTION
568 Indication generated from the NME (if an application subscribes to
569 receive it) that requests the UICC Manager to perform a GSM
570 authentication on behalf of the NME. This indication is generated when
571 the NME is attempting to connect to a profile configured for EAP-SIM. An
572 application MUST register to receive this indication for the NME to
573 support the EAP-SIM credential types. Otherwise the NME has no route to
574 obtain the information from the UICC. EAP-SIM authentication requires 2
575 or 3 GSM authentication rounds and therefore 2 or 3 RANDS (GSM Random
576 Challenges) are included.
577
578 PARAMETERS
579 queue - Destination Task Queue
580 randsLength - GSM RAND is 16 bytes long hence valid values are 32 (2 RANDS)
581 or 48 (3 RANDs).
582 rands - 2 or 3 RANDs values.
583
584*******************************************************************************/
585#define CsrWifiNmeSimGsmAuthIndCreate(msg__, dst__, src__, randsLength__, rands__) \
586 msg__ = kmalloc(sizeof(CsrWifiNmeSimGsmAuthInd), GFP_KERNEL); \
587 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_GSM_AUTH_IND, dst__, src__); \
588 msg__->randsLength = (randsLength__); \
589 msg__->rands = (rands__);
590
591#define CsrWifiNmeSimGsmAuthIndSendTo(dst__, src__, randsLength__, rands__) \
592 { \
593 CsrWifiNmeSimGsmAuthInd *msg__; \
594 CsrWifiNmeSimGsmAuthIndCreate(msg__, dst__, src__, randsLength__, rands__); \
595 CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
596 }
597
598#define CsrWifiNmeSimGsmAuthIndSend(dst__, randsLength__, rands__) \
599 CsrWifiNmeSimGsmAuthIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, randsLength__, rands__)
600
601/*******************************************************************************
602
603 NAME
604 CsrWifiNmeSimGsmAuthResSend
605
606 DESCRIPTION
607 Response from the application that received the NME SIM GSM AUTH IND. For
608 each GSM authentication round a GSM Ciphering key (Kc) and a signed
609 response (SRES) are produced. Since 2 or 3 GSM authentication rounds are
610 used the 2 or 3 Kc's obtained respectively are combined into one buffer
611 and similarly the 2 or 3 SRES's obtained are combined into another
612 buffer. The order of Kc values (SRES values respectively) in their buffer
613 is the same as that of their corresponding RAND values in the incoming
614 indication.
615
616 PARAMETERS
617 status - Indicates the outcome of the requested operation:
618 STATUS_SUCCESS or STATUS_ERROR
619 kcsLength - Length in Bytes of Kc buffer. Legal values are: 16 or 24.
620 kcs - Kc buffer holding 2 or 3 Kc values.
621 sresLength - Length in Bytes of SRES buffer. Legal values are: 8 or 12.
622 sres - SRES buffer holding 2 or 3 SRES values.
623
624*******************************************************************************/
625#define CsrWifiNmeSimGsmAuthResCreate(msg__, dst__, src__, status__, kcsLength__, kcs__, sresLength__, sres__) \
626 msg__ = kmalloc(sizeof(CsrWifiNmeSimGsmAuthRes), GFP_KERNEL); \
627 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_GSM_AUTH_RES, dst__, src__); \
628 msg__->status = (status__); \
629 msg__->kcsLength = (kcsLength__); \
630 msg__->kcs = (kcs__); \
631 msg__->sresLength = (sresLength__); \
632 msg__->sres = (sres__);
633
634#define CsrWifiNmeSimGsmAuthResSendTo(dst__, src__, status__, kcsLength__, kcs__, sresLength__, sres__) \
635 { \
636 CsrWifiNmeSimGsmAuthRes *msg__; \
637 CsrWifiNmeSimGsmAuthResCreate(msg__, dst__, src__, status__, kcsLength__, kcs__, sresLength__, sres__); \
638 CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
639 }
640
641#define CsrWifiNmeSimGsmAuthResSend(src__, status__, kcsLength__, kcs__, sresLength__, sres__) \
642 CsrWifiNmeSimGsmAuthResSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, status__, kcsLength__, kcs__, sresLength__, sres__)
643
644/*******************************************************************************
645
646 NAME
647 CsrWifiNmeSimImsiGetIndSend
648
649 DESCRIPTION
650 Indication generated from the NME (if an application subscribes to
651 receive it) that requests the IMSI and UICC type from the UICC Manager.
652 This indication is generated when the NME is attempting to connect to a
653 profile configured for EAP-SIM/AKA. An application MUST register to
654 receive this indication for the NME to support the EAP-SIM/AKA credential
655 types. Otherwise the NME has no route to obtain the information from the
656 UICC.
657
658 PARAMETERS
659 queue - Destination Task Queue
660
661*******************************************************************************/
662#define CsrWifiNmeSimImsiGetIndCreate(msg__, dst__, src__) \
663 msg__ = kmalloc(sizeof(CsrWifiNmeSimImsiGetInd), GFP_KERNEL); \
664 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_IMSI_GET_IND, dst__, src__);
665
666#define CsrWifiNmeSimImsiGetIndSendTo(dst__, src__) \
667 { \
668 CsrWifiNmeSimImsiGetInd *msg__; \
669 CsrWifiNmeSimImsiGetIndCreate(msg__, dst__, src__); \
670 CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
671 }
672
673#define CsrWifiNmeSimImsiGetIndSend(dst__) \
674 CsrWifiNmeSimImsiGetIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE)
675
676/*******************************************************************************
677
678 NAME
679 CsrWifiNmeSimImsiGetResSend
680
681 DESCRIPTION
682 Response from the application that received the NME SIM IMSI GET IND.
683
684 PARAMETERS
685 status - Indicates the outcome of the requested operation: STATUS_SUCCESS
686 or STATUS_ERROR.
687 imsi - The value of the IMSI obtained from the UICC.
688 cardType - The UICC type (GSM only (SIM), UMTS only (USIM), Both).
689
690*******************************************************************************/
691#define CsrWifiNmeSimImsiGetResCreate(msg__, dst__, src__, status__, imsi__, cardType__) \
692 msg__ = kmalloc(sizeof(CsrWifiNmeSimImsiGetRes), GFP_KERNEL); \
693 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_IMSI_GET_RES, dst__, src__); \
694 msg__->status = (status__); \
695 msg__->imsi = (imsi__); \
696 msg__->cardType = (cardType__);
697
698#define CsrWifiNmeSimImsiGetResSendTo(dst__, src__, status__, imsi__, cardType__) \
699 { \
700 CsrWifiNmeSimImsiGetRes *msg__; \
701 CsrWifiNmeSimImsiGetResCreate(msg__, dst__, src__, status__, imsi__, cardType__); \
702 CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
703 }
704
705#define CsrWifiNmeSimImsiGetResSend(src__, status__, imsi__, cardType__) \
706 CsrWifiNmeSimImsiGetResSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, status__, imsi__, cardType__)
707
708/*******************************************************************************
709
710 NAME
711 CsrWifiNmeSimUmtsAuthIndSend
712
713 DESCRIPTION
714 Indication generated from the NME (if an application subscribes to
715 receive it) that requests the UICC Manager to perform a UMTS
716 authentication on behalf of the NME. This indication is generated when
717 the NME is attempting to connect to a profile configured for EAP-AKA. An
718 application MUST register to receive this indication for the NME to
719 support the EAP-AKA credential types. Otherwise the NME has no route to
720 obtain the information from the USIM. EAP-AKA requires one UMTS
721 authentication round and therefore only one RAND and one AUTN values are
722 included.
723
724 PARAMETERS
725 queue - Destination Task Queue
726 rand - UMTS RAND value.
727 autn - UMTS AUTN value.
728
729*******************************************************************************/
730#define CsrWifiNmeSimUmtsAuthIndCreate(msg__, dst__, src__, rand__, autn__) \
731 msg__ = kmalloc(sizeof(CsrWifiNmeSimUmtsAuthInd), GFP_KERNEL); \
732 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_UMTS_AUTH_IND, dst__, src__); \
733 memcpy(msg__->rand, (rand__), sizeof(u8) * 16); \
734 memcpy(msg__->autn, (autn__), sizeof(u8) * 16);
735
736#define CsrWifiNmeSimUmtsAuthIndSendTo(dst__, src__, rand__, autn__) \
737 { \
738 CsrWifiNmeSimUmtsAuthInd *msg__; \
739 CsrWifiNmeSimUmtsAuthIndCreate(msg__, dst__, src__, rand__, autn__); \
740 CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
741 }
742
743#define CsrWifiNmeSimUmtsAuthIndSend(dst__, rand__, autn__) \
744 CsrWifiNmeSimUmtsAuthIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, rand__, autn__)
745
746/*******************************************************************************
747
748 NAME
749 CsrWifiNmeSimUmtsAuthResSend
750
751 DESCRIPTION
752 Response from the application that received the NME SIM UMTS AUTH IND.
753 The values of umtsCipherKey, umtsIntegrityKey, resParameterLength and
754 resParameter are only meanigful when result = UMTS_AUTH_RESULT_SUCCESS.
755 The value of auts is only meaningful when
756 result=UMTS_AUTH_RESULT_SYNC_FAIL.
757
758 PARAMETERS
759 status - Indicates the outcome of the requested operation:
760 STATUS_SUCCESS or STATUS_ERROR.
761 result - The result of UMTS authentication as performed by the
762 UICC which could be: Success, Authentication Reject or
763 Synchronisation Failure. For all these 3 outcomes the
764 value of status is success.
765 umtsCipherKey - The UMTS Cipher Key as calculated and returned by the
766 UICC.
767 umtsIntegrityKey - The UMTS Integrity Key as calculated and returned by
768 the UICC.
769 resParameterLength - The length (in bytes) of the RES parameter (min=4; max
770 = 16).
771 resParameter - The RES parameter as calculated and returned by the
772 UICC.
773 auts - The AUTS parameter as calculated and returned by the
774 UICC.
775
776*******************************************************************************/
777#define CsrWifiNmeSimUmtsAuthResCreate(msg__, dst__, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__) \
778 msg__ = kmalloc(sizeof(CsrWifiNmeSimUmtsAuthRes), GFP_KERNEL); \
779 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_SIM_UMTS_AUTH_RES, dst__, src__); \
780 msg__->status = (status__); \
781 msg__->result = (result__); \
782 memcpy(msg__->umtsCipherKey, (umtsCipherKey__), sizeof(u8) * 16); \
783 memcpy(msg__->umtsIntegrityKey, (umtsIntegrityKey__), sizeof(u8) * 16); \
784 msg__->resParameterLength = (resParameterLength__); \
785 msg__->resParameter = (resParameter__); \
786 memcpy(msg__->auts, (auts__), sizeof(u8) * 14);
787
788#define CsrWifiNmeSimUmtsAuthResSendTo(dst__, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__) \
789 { \
790 CsrWifiNmeSimUmtsAuthRes *msg__; \
791 CsrWifiNmeSimUmtsAuthResCreate(msg__, dst__, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__); \
792 CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
793 }
794
795#define CsrWifiNmeSimUmtsAuthResSend(src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__) \
796 CsrWifiNmeSimUmtsAuthResSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, status__, result__, umtsCipherKey__, umtsIntegrityKey__, resParameterLength__, resParameter__, auts__)
797
798/*******************************************************************************
799
800 NAME
801 CsrWifiNmeWpsCancelReqSend
802
803 DESCRIPTION
804 Requests the NME to cancel any WPS procedure that it is currently
805 performing. This includes WPS registrar activities started because of
806 CSR_WIFI_NME_AP_REGISTER.request
807
808 PARAMETERS
809 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
810 interfaceTag - Interface Identifier; unique identifier of an interface
811
812*******************************************************************************/
813#define CsrWifiNmeWpsCancelReqCreate(msg__, dst__, src__, interfaceTag__) \
814 msg__ = kmalloc(sizeof(CsrWifiNmeWpsCancelReq), GFP_KERNEL); \
815 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CANCEL_REQ, dst__, src__); \
816 msg__->interfaceTag = (interfaceTag__);
817
818#define CsrWifiNmeWpsCancelReqSendTo(dst__, src__, interfaceTag__) \
819 { \
820 CsrWifiNmeWpsCancelReq *msg__; \
821 CsrWifiNmeWpsCancelReqCreate(msg__, dst__, src__, interfaceTag__); \
822 CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
823 }
824
825#define CsrWifiNmeWpsCancelReqSend(src__, interfaceTag__) \
826 CsrWifiNmeWpsCancelReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__)
827
828/*******************************************************************************
829
830 NAME
831 CsrWifiNmeWpsCancelCfmSend
832
833 DESCRIPTION
834 Reports the status of the NME WPS REQ, the request is always SUCCESSFUL.
835
836 PARAMETERS
837 queue - Destination Task Queue
838 interfaceTag - Interface Identifier; unique identifier of an interface
839 status - Only returns CSR_WIFI_NME_STATUS_SUCCESS
840
841*******************************************************************************/
842#define CsrWifiNmeWpsCancelCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
843 msg__ = kmalloc(sizeof(CsrWifiNmeWpsCancelCfm), GFP_KERNEL); \
844 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CANCEL_CFM, dst__, src__); \
845 msg__->interfaceTag = (interfaceTag__); \
846 msg__->status = (status__);
847
848#define CsrWifiNmeWpsCancelCfmSendTo(dst__, src__, interfaceTag__, status__) \
849 { \
850 CsrWifiNmeWpsCancelCfm *msg__; \
851 CsrWifiNmeWpsCancelCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
852 CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
853 }
854
855#define CsrWifiNmeWpsCancelCfmSend(dst__, interfaceTag__, status__) \
856 CsrWifiNmeWpsCancelCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__)
857
858/*******************************************************************************
859
860 NAME
861 CsrWifiNmeWpsCfmSend
862
863 DESCRIPTION
864 Reports the status of the NME WPS REQ.
865 If CSR_WIFI_NME_STATUS_SUCCESS, the profile parameter contains the
866 identity and credentials of the AP.
867
868 PARAMETERS
869 queue - Destination Task Queue
870 interfaceTag - Interface Identifier; unique identifier of an interface
871 status - Indicates the success or otherwise of the requested
872 operation.
873 profile - This parameter is relevant only if
874 status==CSR_WIFI_NME_STATUS_SUCCESS.
875 The identity and credentials of the network.
876
877*******************************************************************************/
878#define CsrWifiNmeWpsCfmCreate(msg__, dst__, src__, interfaceTag__, status__, profile__) \
879 msg__ = kmalloc(sizeof(CsrWifiNmeWpsCfm), GFP_KERNEL); \
880 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CFM, dst__, src__); \
881 msg__->interfaceTag = (interfaceTag__); \
882 msg__->status = (status__); \
883 msg__->profile = (profile__);
884
885#define CsrWifiNmeWpsCfmSendTo(dst__, src__, interfaceTag__, status__, profile__) \
886 { \
887 CsrWifiNmeWpsCfm *msg__; \
888 CsrWifiNmeWpsCfmCreate(msg__, dst__, src__, interfaceTag__, status__, profile__); \
889 CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
890 }
891
892#define CsrWifiNmeWpsCfmSend(dst__, interfaceTag__, status__, profile__) \
893 CsrWifiNmeWpsCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__, profile__)
894
895/*******************************************************************************
896
897 NAME
898 CsrWifiNmeWpsConfigSetReqSend
899
900 DESCRIPTION
901 This primitive passes the WPS information for the device to NME. This may
902 be accepted only if no interface is active.
903
904 PARAMETERS
905 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
906 wpsConfig - WPS config.
907
908*******************************************************************************/
909#define CsrWifiNmeWpsConfigSetReqCreate(msg__, dst__, src__, wpsConfig__) \
910 msg__ = kmalloc(sizeof(CsrWifiNmeWpsConfigSetReq), GFP_KERNEL); \
911 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CONFIG_SET_REQ, dst__, src__); \
912 msg__->wpsConfig = (wpsConfig__);
913
914#define CsrWifiNmeWpsConfigSetReqSendTo(dst__, src__, wpsConfig__) \
915 { \
916 CsrWifiNmeWpsConfigSetReq *msg__; \
917 CsrWifiNmeWpsConfigSetReqCreate(msg__, dst__, src__, wpsConfig__); \
918 CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
919 }
920
921#define CsrWifiNmeWpsConfigSetReqSend(src__, wpsConfig__) \
922 CsrWifiNmeWpsConfigSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, wpsConfig__)
923
924/*******************************************************************************
925
926 NAME
927 CsrWifiNmeWpsConfigSetCfmSend
928
929 DESCRIPTION
930 Confirm.
931
932 PARAMETERS
933 queue - Destination Task Queue
934 status - Status of the request.
935
936*******************************************************************************/
937#define CsrWifiNmeWpsConfigSetCfmCreate(msg__, dst__, src__, status__) \
938 msg__ = kmalloc(sizeof(CsrWifiNmeWpsConfigSetCfm), GFP_KERNEL); \
939 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_CONFIG_SET_CFM, dst__, src__); \
940 msg__->status = (status__);
941
942#define CsrWifiNmeWpsConfigSetCfmSendTo(dst__, src__, status__) \
943 { \
944 CsrWifiNmeWpsConfigSetCfm *msg__; \
945 CsrWifiNmeWpsConfigSetCfmCreate(msg__, dst__, src__, status__); \
946 CsrSchedMessagePut(dst__, CSR_WIFI_NME_PRIM, msg__); \
947 }
948
949#define CsrWifiNmeWpsConfigSetCfmSend(dst__, status__) \
950 CsrWifiNmeWpsConfigSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__)
951
952/*******************************************************************************
953
954 NAME
955 CsrWifiNmeWpsReqSend
956
957 DESCRIPTION
958 Requests the NME to look for WPS enabled APs and attempt to perform WPS
959 to determine the appropriate security credentials to connect to the AP.
960 If the PIN == '00000000' then 'push button mode' is indicated, otherwise
961 the PIN has to match that of the AP. 4 digit pin is passed by sending the
962 pin digits in pin[0]..pin[3] and rest of the contents filled with '-'.
963
964 PARAMETERS
965 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
966 interfaceTag - Interface Identifier; unique identifier of an interface
967 pin - PIN value.
968 ssid - Service Set identifier
969 bssid - ID of Basic Service Set for which a WPS connection attempt is
970 being made.
971
972*******************************************************************************/
973#define CsrWifiNmeWpsReqCreate(msg__, dst__, src__, interfaceTag__, pin__, ssid__, bssid__) \
974 msg__ = kmalloc(sizeof(CsrWifiNmeWpsReq), GFP_KERNEL); \
975 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_WPS_REQ, dst__, src__); \
976 msg__->interfaceTag = (interfaceTag__); \
977 memcpy(msg__->pin, (pin__), sizeof(u8) * 8); \
978 msg__->ssid = (ssid__); \
979 msg__->bssid = (bssid__);
980
981#define CsrWifiNmeWpsReqSendTo(dst__, src__, interfaceTag__, pin__, ssid__, bssid__) \
982 { \
983 CsrWifiNmeWpsReq *msg__; \
984 CsrWifiNmeWpsReqCreate(msg__, dst__, src__, interfaceTag__, pin__, ssid__, bssid__); \
985 CsrMsgTransport(dst__, CSR_WIFI_NME_PRIM, msg__); \
986 }
987
988#define CsrWifiNmeWpsReqSend(src__, interfaceTag__, pin__, ssid__, bssid__) \
989 CsrWifiNmeWpsReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, pin__, ssid__, bssid__)
990
991#endif /* CSR_WIFI_NME_LIB_H__ */
diff --git a/drivers/staging/csr/csr_wifi_nme_prim.h b/drivers/staging/csr/csr_wifi_nme_prim.h
deleted file mode 100644
index 9a7927a117ea..000000000000
--- a/drivers/staging/csr/csr_wifi_nme_prim.h
+++ /dev/null
@@ -1,1657 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_NME_PRIM_H__
14#define CSR_WIFI_NME_PRIM_H__
15
16#include <linux/types.h>
17#include "csr_prim_defs.h"
18#include "csr_sched.h"
19#include "csr_wifi_common.h"
20#include "csr_result.h"
21#include "csr_wifi_fsm_event.h"
22#include "csr_wifi_sme_prim.h"
23
24#ifndef CSR_WIFI_NME_ENABLE
25#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_prim.h
26#endif
27
28#define CSR_WIFI_NME_PRIM (0x0424)
29
30typedef CsrPrim CsrWifiNmePrim;
31
32typedef void (*CsrWifiNmeFrameFreeFunction)(void *frame);
33
34/*******************************************************************************
35
36 NAME
37 CsrWifiNmeAuthMode
38
39 DESCRIPTION
40 WiFi Authentication Mode
41
42 VALUES
43 CSR_WIFI_NME_AUTH_MODE_80211_OPEN
44 - Connects to an open system network (i.e. no authentication,
45 no encryption) or to a WEP enabled network.
46 CSR_WIFI_NME_AUTH_MODE_80211_SHARED
47 - Connect to a WEP enabled network.
48 CSR_WIFI_NME_AUTH_MODE_8021X_WPA
49 - Connects to a WPA Enterprise enabled network.
50 CSR_WIFI_NME_AUTH_MODE_8021X_WPAPSK
51 - Connects to a WPA with Pre-Shared Key enabled network.
52 CSR_WIFI_NME_AUTH_MODE_8021X_WPA2
53 - Connects to a WPA2 Enterprise enabled network.
54 CSR_WIFI_NME_AUTH_MODE_8021X_WPA2PSK
55 - Connects to a WPA2 with Pre-Shared Key enabled network.
56 CSR_WIFI_NME_AUTH_MODE_8021X_CCKM
57 - Connects to a CCKM enabled network.
58 CSR_WIFI_NME_AUTH_MODE_WAPI_WAI
59 - Connects to a WAPI Enterprise enabled network.
60 CSR_WIFI_NME_AUTH_MODE_WAPI_WAIPSK
61 - Connects to a WAPI with Pre-Shared Key enabled network.
62 CSR_WIFI_NME_AUTH_MODE_8021X_OTHER1X
63 - For future use.
64
65*******************************************************************************/
66typedef u16 CsrWifiNmeAuthMode;
67#define CSR_WIFI_NME_AUTH_MODE_80211_OPEN ((CsrWifiNmeAuthMode) 0x0001)
68#define CSR_WIFI_NME_AUTH_MODE_80211_SHARED ((CsrWifiNmeAuthMode) 0x0002)
69#define CSR_WIFI_NME_AUTH_MODE_8021X_WPA ((CsrWifiNmeAuthMode) 0x0004)
70#define CSR_WIFI_NME_AUTH_MODE_8021X_WPAPSK ((CsrWifiNmeAuthMode) 0x0008)
71#define CSR_WIFI_NME_AUTH_MODE_8021X_WPA2 ((CsrWifiNmeAuthMode) 0x0010)
72#define CSR_WIFI_NME_AUTH_MODE_8021X_WPA2PSK ((CsrWifiNmeAuthMode) 0x0020)
73#define CSR_WIFI_NME_AUTH_MODE_8021X_CCKM ((CsrWifiNmeAuthMode) 0x0040)
74#define CSR_WIFI_NME_AUTH_MODE_WAPI_WAI ((CsrWifiNmeAuthMode) 0x0080)
75#define CSR_WIFI_NME_AUTH_MODE_WAPI_WAIPSK ((CsrWifiNmeAuthMode) 0x0100)
76#define CSR_WIFI_NME_AUTH_MODE_8021X_OTHER1X ((CsrWifiNmeAuthMode) 0x0200)
77
78/*******************************************************************************
79
80 NAME
81 CsrWifiNmeBssType
82
83 DESCRIPTION
84 Type of BSS
85
86 VALUES
87 CSR_WIFI_NME_BSS_TYPE_INFRASTRUCTURE
88 - Infrastructure BSS type where access to the network is via
89 one or several Access Points.
90 CSR_WIFI_NME_BSS_TYPE_ADHOC
91 - Adhoc or Independent BSS Type where one Station acts as a
92 host and future stations can join the adhoc network without
93 needing an access point.
94 CSR_WIFI_NME_BSS_TYPE_RESERVED
95 - To be in sync with SME.This is not used.
96 CSR_WIFI_NME_BSS_TYPE_P2P
97 - P2P mode of operation.
98
99*******************************************************************************/
100typedef u8 CsrWifiNmeBssType;
101#define CSR_WIFI_NME_BSS_TYPE_INFRASTRUCTURE ((CsrWifiNmeBssType) 0x00)
102#define CSR_WIFI_NME_BSS_TYPE_ADHOC ((CsrWifiNmeBssType) 0x01)
103#define CSR_WIFI_NME_BSS_TYPE_RESERVED ((CsrWifiNmeBssType) 0x02)
104#define CSR_WIFI_NME_BSS_TYPE_P2P ((CsrWifiNmeBssType) 0x03)
105
106/*******************************************************************************
107
108 NAME
109 CsrWifiNmeCcxOptionsMask
110
111 DESCRIPTION
112 Enumeration type defining possible mask values for setting CCX options.
113
114 VALUES
115 CSR_WIFI_NME_CCX_OPTION_NONE - No CCX option is set.
116 CSR_WIFI_NME_CCX_OPTION_CCKM - CCX option cckm is set.
117
118*******************************************************************************/
119typedef u8 CsrWifiNmeCcxOptionsMask;
120#define CSR_WIFI_NME_CCX_OPTION_NONE ((CsrWifiNmeCcxOptionsMask) 0x00)
121#define CSR_WIFI_NME_CCX_OPTION_CCKM ((CsrWifiNmeCcxOptionsMask) 0x01)
122
123/*******************************************************************************
124
125 NAME
126 CsrWifiNmeConfigAction
127
128 DESCRIPTION
129
130 VALUES
131 CSR_WIFI_PIN_ENTRY_PUSH_BUTTON -
132 CSR_WIFI_PIN_ENTRY_DISPLAY_PIN -
133 CSR_WIFI_PIN_ENTRY_ENTER_PIN -
134
135*******************************************************************************/
136typedef u8 CsrWifiNmeConfigAction;
137#define CSR_WIFI_PIN_ENTRY_PUSH_BUTTON ((CsrWifiNmeConfigAction) 0x00)
138#define CSR_WIFI_PIN_ENTRY_DISPLAY_PIN ((CsrWifiNmeConfigAction) 0x01)
139#define CSR_WIFI_PIN_ENTRY_ENTER_PIN ((CsrWifiNmeConfigAction) 0x02)
140
141/*******************************************************************************
142
143 NAME
144 CsrWifiNmeConnectionStatus
145
146 DESCRIPTION
147 Indicate the NME Connection Status when connecting or when disconnecting
148
149 VALUES
150 CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_DISCONNECTED
151 - NME is disconnected.
152 CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_CONNECTING
153 - NME is in the process of connecting.
154 CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_AUTHENTICATING
155 - NME is in the authentication stage of a connection attempt.
156 CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_CONNECTED
157 - NME is connected.
158 CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_DISCONNECTING
159 - NME is in the process of disconnecting.
160
161*******************************************************************************/
162typedef u8 CsrWifiNmeConnectionStatus;
163#define CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_DISCONNECTED ((CsrWifiNmeConnectionStatus) 0x00)
164#define CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_CONNECTING ((CsrWifiNmeConnectionStatus) 0x01)
165#define CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_AUTHENTICATING ((CsrWifiNmeConnectionStatus) 0x02)
166#define CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_CONNECTED ((CsrWifiNmeConnectionStatus) 0x03)
167#define CSR_WIFI_NME_CONNECTION_STATUS_CONNECTION_STATUS_DISCONNECTING ((CsrWifiNmeConnectionStatus) 0x04)
168
169/*******************************************************************************
170
171 NAME
172 CsrWifiNmeCredentialType
173
174 DESCRIPTION
175 NME Credential Types
176
177 VALUES
178 CSR_WIFI_NME_CREDENTIAL_TYPE_OPEN_SYSTEM
179 - Credential Type Open System.
180 CSR_WIFI_NME_CREDENTIAL_TYPE_WEP64
181 - Credential Type WEP-64
182 CSR_WIFI_NME_CREDENTIAL_TYPE_WEP128
183 - Credential Type WEP-128
184 CSR_WIFI_NME_CREDENTIAL_TYPE_WPA_PSK
185 - Credential Type WPA Pre-Shared Key
186 CSR_WIFI_NME_CREDENTIAL_TYPE_WPA_PASSPHRASE
187 - Credential Type WPA pass phrase
188 CSR_WIFI_NME_CREDENTIAL_TYPE_WPA2_PSK
189 - Credential Type WPA2 Pre-Shared Key.
190 CSR_WIFI_NME_CREDENTIAL_TYPE_WPA2_PASSPHRASE
191 - Credential Type WPA2 pass phrase
192 CSR_WIFI_NME_CREDENTIAL_TYPE_WAPI_PSK
193 - Credential Type WAPI Pre-Shared Key.
194 CSR_WIFI_NME_CREDENTIAL_TYPE_WAPI_PASSPHRASE
195 - Credential Type WAPI pass phrase
196 CSR_WIFI_NME_CREDENTIAL_TYPE_WAPI
197 - Credential Type WAPI certificates
198 CSR_WIFI_NME_CREDENTIAL_TYPE_8021X
199 - Credential Type 802.1X: the associated type supports
200 FAST/LEAP/TLS/TTLS/PEAP/etc.
201
202*******************************************************************************/
203typedef u16 CsrWifiNmeCredentialType;
204#define CSR_WIFI_NME_CREDENTIAL_TYPE_OPEN_SYSTEM ((CsrWifiNmeCredentialType) 0x0000)
205#define CSR_WIFI_NME_CREDENTIAL_TYPE_WEP64 ((CsrWifiNmeCredentialType) 0x0001)
206#define CSR_WIFI_NME_CREDENTIAL_TYPE_WEP128 ((CsrWifiNmeCredentialType) 0x0002)
207#define CSR_WIFI_NME_CREDENTIAL_TYPE_WPA_PSK ((CsrWifiNmeCredentialType) 0x0003)
208#define CSR_WIFI_NME_CREDENTIAL_TYPE_WPA_PASSPHRASE ((CsrWifiNmeCredentialType) 0x0004)
209#define CSR_WIFI_NME_CREDENTIAL_TYPE_WPA2_PSK ((CsrWifiNmeCredentialType) 0x0005)
210#define CSR_WIFI_NME_CREDENTIAL_TYPE_WPA2_PASSPHRASE ((CsrWifiNmeCredentialType) 0x0006)
211#define CSR_WIFI_NME_CREDENTIAL_TYPE_WAPI_PSK ((CsrWifiNmeCredentialType) 0x0007)
212#define CSR_WIFI_NME_CREDENTIAL_TYPE_WAPI_PASSPHRASE ((CsrWifiNmeCredentialType) 0x0008)
213#define CSR_WIFI_NME_CREDENTIAL_TYPE_WAPI ((CsrWifiNmeCredentialType) 0x0009)
214#define CSR_WIFI_NME_CREDENTIAL_TYPE_8021X ((CsrWifiNmeCredentialType) 0x000A)
215
216/*******************************************************************************
217
218 NAME
219 CsrWifiNmeEapMethod
220
221 DESCRIPTION
222 Outer EAP method with possibly inner method.
223
224 VALUES
225 CSR_WIFI_NME_EAP_METHOD_TLS
226 - EAP-TLS Method.
227 CSR_WIFI_NME_EAP_METHOD_TTLS_MSCHAPV2
228 - EAP-TTLS Method with MSCHAPV2.
229 CSR_WIFI_NME_EAP_METHOD_PEAP_GTC
230 - EAP-PEAP Method with GTC.
231 CSR_WIFI_NME_EAP_METHOD_PEAP_MSCHAPV2
232 - EAP-PEAP Method with MSCHAPV2.
233 CSR_WIFI_NME_EAP_METHOD_SIM
234 - EAP-SIM Method.
235 CSR_WIFI_NME_EAP_METHOD_AKA
236 - EAP-AKA Method.
237 CSR_WIFI_NME_EAP_METHOD_FAST_GTC
238 - EAP-FAST Method with GTC.
239 CSR_WIFI_NME_EAP_METHOD_FAST_MSCHAPV2
240 - EAP-FAST Method with MSCHAPV2.
241 CSR_WIFI_NME_EAP_METHOD_LEAP
242 - EAP-LEAP Method.
243
244*******************************************************************************/
245typedef u16 CsrWifiNmeEapMethod;
246#define CSR_WIFI_NME_EAP_METHOD_TLS ((CsrWifiNmeEapMethod) 0x0001)
247#define CSR_WIFI_NME_EAP_METHOD_TTLS_MSCHAPV2 ((CsrWifiNmeEapMethod) 0x0002)
248#define CSR_WIFI_NME_EAP_METHOD_PEAP_GTC ((CsrWifiNmeEapMethod) 0x0004)
249#define CSR_WIFI_NME_EAP_METHOD_PEAP_MSCHAPV2 ((CsrWifiNmeEapMethod) 0x0008)
250#define CSR_WIFI_NME_EAP_METHOD_SIM ((CsrWifiNmeEapMethod) 0x0010)
251#define CSR_WIFI_NME_EAP_METHOD_AKA ((CsrWifiNmeEapMethod) 0x0020)
252#define CSR_WIFI_NME_EAP_METHOD_FAST_GTC ((CsrWifiNmeEapMethod) 0x0040)
253#define CSR_WIFI_NME_EAP_METHOD_FAST_MSCHAPV2 ((CsrWifiNmeEapMethod) 0x0080)
254#define CSR_WIFI_NME_EAP_METHOD_LEAP ((CsrWifiNmeEapMethod) 0x0100)
255
256/*******************************************************************************
257
258 NAME
259 CsrWifiNmeEncryption
260
261 DESCRIPTION
262 WiFi Encryption method
263
264 VALUES
265 CSR_WIFI_NME_ENCRYPTION_CIPHER_NONE
266 - No encryprion set.
267 CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_WEP40
268 - 40 bytes WEP key for peer to peer communication.
269 CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_WEP104
270 - 104 bytes WEP key for peer to peer communication.
271 CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_TKIP
272 - TKIP key for peer to peer communication.
273 CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_CCMP
274 - CCMP key for peer to peer communication.
275 CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_SMS4
276 - SMS4 key for peer to peer communication.
277 CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_WEP40
278 - 40 bytes WEP key for broadcast messages.
279 CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_WEP104
280 - 104 bytes WEP key for broadcast messages.
281 CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_TKIP
282 - TKIP key for broadcast messages.
283 CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_CCMP
284 - CCMP key for broadcast messages
285 CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_SMS4
286 - SMS4 key for broadcast messages.
287
288*******************************************************************************/
289typedef u16 CsrWifiNmeEncryption;
290#define CSR_WIFI_NME_ENCRYPTION_CIPHER_NONE ((CsrWifiNmeEncryption) 0x0000)
291#define CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_WEP40 ((CsrWifiNmeEncryption) 0x0001)
292#define CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_WEP104 ((CsrWifiNmeEncryption) 0x0002)
293#define CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_TKIP ((CsrWifiNmeEncryption) 0x0004)
294#define CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_CCMP ((CsrWifiNmeEncryption) 0x0008)
295#define CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_SMS4 ((CsrWifiNmeEncryption) 0x0010)
296#define CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_WEP40 ((CsrWifiNmeEncryption) 0x0020)
297#define CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_WEP104 ((CsrWifiNmeEncryption) 0x0040)
298#define CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_TKIP ((CsrWifiNmeEncryption) 0x0080)
299#define CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_CCMP ((CsrWifiNmeEncryption) 0x0100)
300#define CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_SMS4 ((CsrWifiNmeEncryption) 0x0200)
301
302/*******************************************************************************
303
304 NAME
305 CsrWifiNmeIndications
306
307 DESCRIPTION
308 NME indications
309
310 VALUES
311 CSR_WIFI_NME_INDICATIONS_IND_AP_STATION
312 - NME AP Station Indication.
313 CSR_WIFI_NME_INDICATIONS_IND_AP_STOP
314 - NME AP Stop Indication.
315 CSR_WIFI_NME_INDICATIONS_IND_SIM_UMTS_AUTH
316 - NME UMTS Authentication Indication.
317 CSR_WIFI_NME_INDICATIONS_IND_P2P_GROUP_START
318 - NME P2P Group Start Indication.
319 CSR_WIFI_NME_INDICATIONS_IND_P2P_GROUP_STATUS
320 - NME P2P Group Status Indication.
321 CSR_WIFI_NME_INDICATIONS_IND_P2P_GROUP_ROLE
322 - NME P2P Group Role Indication.
323 CSR_WIFI_NME_INDICATIONS_IND_PROFILE_DISCONNECT
324 - NME Profile Disconnect Indication.
325 CSR_WIFI_NME_INDICATIONS_IND_PROFILE_UPDATE
326 - NME Profile Update Indication.
327 CSR_WIFI_NME_INDICATIONS_IND_SIM_IMSI_GET
328 - NME GET IMSI Indication.
329 CSR_WIFI_NME_INDICATIONS_IND_SIM_GSM_AUTH
330 - NME GSM Authentication Indication.
331 CSR_WIFI_NME_INDICATIONS_ALL
332 - Used to register for all available indications
333
334*******************************************************************************/
335typedef u32 CsrWifiNmeIndications;
336#define CSR_WIFI_NME_INDICATIONS_IND_AP_STATION ((CsrWifiNmeIndications) 0x00100000)
337#define CSR_WIFI_NME_INDICATIONS_IND_AP_STOP ((CsrWifiNmeIndications) 0x00200000)
338#define CSR_WIFI_NME_INDICATIONS_IND_SIM_UMTS_AUTH ((CsrWifiNmeIndications) 0x01000000)
339#define CSR_WIFI_NME_INDICATIONS_IND_P2P_GROUP_START ((CsrWifiNmeIndications) 0x02000000)
340#define CSR_WIFI_NME_INDICATIONS_IND_P2P_GROUP_STATUS ((CsrWifiNmeIndications) 0x04000000)
341#define CSR_WIFI_NME_INDICATIONS_IND_P2P_GROUP_ROLE ((CsrWifiNmeIndications) 0x08000000)
342#define CSR_WIFI_NME_INDICATIONS_IND_PROFILE_DISCONNECT ((CsrWifiNmeIndications) 0x10000000)
343#define CSR_WIFI_NME_INDICATIONS_IND_PROFILE_UPDATE ((CsrWifiNmeIndications) 0x20000000)
344#define CSR_WIFI_NME_INDICATIONS_IND_SIM_IMSI_GET ((CsrWifiNmeIndications) 0x40000000)
345#define CSR_WIFI_NME_INDICATIONS_IND_SIM_GSM_AUTH ((CsrWifiNmeIndications) 0x80000000)
346#define CSR_WIFI_NME_INDICATIONS_ALL ((CsrWifiNmeIndications) 0xFFFFFFFF)
347
348/*******************************************************************************
349
350 NAME
351 CsrWifiNmeSecError
352
353 DESCRIPTION
354 NME Security Errors
355 place holder for the security library abort reason
356
357 VALUES
358 CSR_WIFI_NME_SEC_ERROR_SEC_ERROR_UNKNOWN
359 - Unknown Security Error.
360
361*******************************************************************************/
362typedef u8 CsrWifiNmeSecError;
363#define CSR_WIFI_NME_SEC_ERROR_SEC_ERROR_UNKNOWN ((CsrWifiNmeSecError) 0x00)
364
365/*******************************************************************************
366
367 NAME
368 CsrWifiNmeSimCardType
369
370 DESCRIPTION
371 (U)SIM Card (or UICC) types
372
373 VALUES
374 CSR_WIFI_NME_SIM_CARD_TYPE_2G - 2G SIM card, capable of performing GSM
375 authentication only.
376 CSR_WIFI_NME_SIM_CARD_TYPE_3G - UICC supporting USIM application, capable
377 of performing UMTS authentication only.
378 CSR_WIFI_NME_SIM_CARD_TYPE_2G3G - UICC supporting both USIM and SIM
379 applications, capable of performing both
380 UMTS and GSM authentications.
381
382*******************************************************************************/
383typedef u8 CsrWifiNmeSimCardType;
384#define CSR_WIFI_NME_SIM_CARD_TYPE_2G ((CsrWifiNmeSimCardType) 0x01)
385#define CSR_WIFI_NME_SIM_CARD_TYPE_3G ((CsrWifiNmeSimCardType) 0x02)
386#define CSR_WIFI_NME_SIM_CARD_TYPE_2G3G ((CsrWifiNmeSimCardType) 0x03)
387
388/*******************************************************************************
389
390 NAME
391 CsrWifiNmeUmtsAuthResult
392
393 DESCRIPTION
394 Only relevant for UMTS Authentication. It indicates if the UICC has
395 successfully authenticated the network or otherwise.
396
397 VALUES
398 CSR_WIFI_NME_UMTS_AUTH_RESULT_SUCCESS
399 - Successful outcome from USIM indicating that the card has
400 successfully authenticated the network.
401 CSR_WIFI_NME_UMTS_AUTH_RESULT_SYNC_FAIL
402 - Unsuccessful outcome from USIM indicating that the card is
403 requesting the network to synchronise and re-try again. If
404 no further request is received an NME timer will expire and
405 the authentication is aborted.
406 CSR_WIFI_NME_UMTS_AUTH_RESULT_REJECT
407 - Unsuccessful outcome from USIM indicating that the card has
408 rejected the network and that the authentication is
409 aborted.
410
411*******************************************************************************/
412typedef u8 CsrWifiNmeUmtsAuthResult;
413#define CSR_WIFI_NME_UMTS_AUTH_RESULT_SUCCESS ((CsrWifiNmeUmtsAuthResult) 0x00)
414#define CSR_WIFI_NME_UMTS_AUTH_RESULT_SYNC_FAIL ((CsrWifiNmeUmtsAuthResult) 0x01)
415#define CSR_WIFI_NME_UMTS_AUTH_RESULT_REJECT ((CsrWifiNmeUmtsAuthResult) 0x02)
416
417/*******************************************************************************
418
419 NAME
420 CsrWifiNmeWmmQosInfo
421
422 DESCRIPTION
423 Defines bits for the QoS Info octect as defined in the WMM specification.
424 The values of this type are used across the NME/SME/Router API's and they
425 must be kept consistent with the corresponding types in the .xml of the
426 other interfaces
427
428 VALUES
429 CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_ALL
430 - WMM AP may deliver all buffered frames.
431 CSR_WIFI_NME_WMM_QOS_INFO_AC_VO
432 - To enable the triggering and delivery of QoS Voice.
433 CSR_WIFI_NME_WMM_QOS_INFO_AC_VI
434 - To enable the triggering and delivery of QoS Video.
435 CSR_WIFI_NME_WMM_QOS_INFO_AC_BK
436 - To enable the triggering and delivery of QoS Background.
437 CSR_WIFI_NME_WMM_QOS_INFO_AC_BE
438 - To enable the triggering and delivery of QoS Best Effort.
439 CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_TWO
440 - WMM AP may deliver a maximum of 2 buffered frames per
441 Unscheduled Service Period (USP).
442 CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_FOUR
443 - WMM AP may deliver a maximum of 4 buffered frames per USP.
444 CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_SIX
445 - WMM AP may deliver a maximum of 6 buffered frames per USP.
446
447*******************************************************************************/
448typedef u8 CsrWifiNmeWmmQosInfo;
449#define CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_ALL ((CsrWifiNmeWmmQosInfo) 0x00)
450#define CSR_WIFI_NME_WMM_QOS_INFO_AC_VO ((CsrWifiNmeWmmQosInfo) 0x01)
451#define CSR_WIFI_NME_WMM_QOS_INFO_AC_VI ((CsrWifiNmeWmmQosInfo) 0x02)
452#define CSR_WIFI_NME_WMM_QOS_INFO_AC_BK ((CsrWifiNmeWmmQosInfo) 0x04)
453#define CSR_WIFI_NME_WMM_QOS_INFO_AC_BE ((CsrWifiNmeWmmQosInfo) 0x08)
454#define CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_TWO ((CsrWifiNmeWmmQosInfo) 0x20)
455#define CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_FOUR ((CsrWifiNmeWmmQosInfo) 0x40)
456#define CSR_WIFI_NME_WMM_QOS_INFO_AC_MAX_SP_SIX ((CsrWifiNmeWmmQosInfo) 0x60)
457
458
459/*******************************************************************************
460
461 NAME
462 CsrWifiNmeEapMethodMask
463
464 DESCRIPTION
465 Mask type for use with the values defined by CsrWifiNmeEapMethod.
466
467*******************************************************************************/
468typedef u16 CsrWifiNmeEapMethodMask;
469/*******************************************************************************
470
471 NAME
472 CsrWifiNmeEncryptionMask
473
474 DESCRIPTION
475 Mask type for use with the values defined by CsrWifiNmeEncryption
476
477*******************************************************************************/
478typedef u16 CsrWifiNmeEncryptionMask;
479/*******************************************************************************
480
481 NAME
482 CsrWifiNmeIndicationsMask
483
484 DESCRIPTION
485 Mask type for use with the values defined by CsrWifiNmeIndications
486
487*******************************************************************************/
488typedef u32 CsrWifiNmeIndicationsMask;
489/*******************************************************************************
490
491 NAME
492 CsrWifiNmeNmeIndicationsMask
493
494 DESCRIPTION
495 Mask type for use with the values defined by CsrWifiNmeNmeIndications.
496 Used to overlap the unused portion of the unifi_IndicationsMask For NME
497 specific indications
498
499*******************************************************************************/
500typedef u32 CsrWifiNmeNmeIndicationsMask;
501/*******************************************************************************
502
503 NAME
504 CsrWifiNmeWmmQosInfoMask
505
506 DESCRIPTION
507 Mask type for use with the values defined by CsrWifiNmeWmmQosInfo
508
509*******************************************************************************/
510typedef u8 CsrWifiNmeWmmQosInfoMask;
511
512
513/*******************************************************************************
514
515 NAME
516 CsrWifiNmeEmpty
517
518 DESCRIPTION
519 Empty Structure to indicate that no credentials are available.
520
521 MEMBERS
522 empty - Only element of the empty structure (always set to 0).
523
524*******************************************************************************/
525typedef struct
526{
527 u8 empty;
528} CsrWifiNmeEmpty;
529
530/*******************************************************************************
531
532 NAME
533 CsrWifiNmePassphrase
534
535 DESCRIPTION
536 Structure holding the ASCII Pass Phrase data.
537
538 MEMBERS
539 encryptionMode - Encryption type as defined in CsrWifiSmeEncryption.
540 passphrase - Pass phrase ASCII value.
541
542*******************************************************************************/
543typedef struct
544{
545 u16 encryptionMode;
546 char *passphrase;
547} CsrWifiNmePassphrase;
548
549/*******************************************************************************
550
551 NAME
552 CsrWifiNmePsk
553
554 DESCRIPTION
555 Structure holding the Pre-Shared Key data.
556
557 MEMBERS
558 encryptionMode - Encryption type as defined in CsrWifiSmeEncryption.
559 psk - Pre-Shared Key value.
560
561*******************************************************************************/
562typedef struct
563{
564 u16 encryptionMode;
565 u8 psk[32];
566} CsrWifiNmePsk;
567
568/*******************************************************************************
569
570 NAME
571 CsrWifiNmeWapiCredentials
572
573 DESCRIPTION
574 Structure holding WAPI credentials data.
575
576 MEMBERS
577 certificateLength - Length in bytes of the following client certificate.
578 certificate - The actual client certificate data (if present).
579 DER/PEM format supported.
580 privateKeyLength - Length in bytes of the following private key.
581 privateKey - The actual private key. DER/PEM format.
582 caCertificateLength - Length in bytes of the following certificate authority
583 certificate.
584 caCertificate - The actual certificate authority certificate data. If
585 not supplied the received certificate authority
586 certificate is assumed to be validate, if present the
587 received certificate is validated against it. DER/PEM
588 format supported.
589
590*******************************************************************************/
591typedef struct
592{
593 u32 certificateLength;
594 u8 *certificate;
595 u16 privateKeyLength;
596 u8 *privateKey;
597 u32 caCertificateLength;
598 u8 *caCertificate;
599} CsrWifiNmeWapiCredentials;
600
601/*******************************************************************************
602
603 NAME
604 CsrWifiNmeConnectAttempt
605
606 DESCRIPTION
607 Structure holding Connection attempt data.
608
609 MEMBERS
610 bssid - Id of Basic Service Set connections attempt have been made
611 to.
612 status - Status returned to indicate the success or otherwise of the
613 connection attempt.
614 securityError - Security error status indicating the nature of the failure
615 to connect.
616
617*******************************************************************************/
618typedef struct
619{
620 CsrWifiMacAddress bssid;
621 CsrResult status;
622 CsrWifiNmeSecError securityError;
623} CsrWifiNmeConnectAttempt;
624
625/*******************************************************************************
626
627 NAME
628 CsrWifiNmeEapCredentials
629
630 DESCRIPTION
631 Supports the use of multiple EAP methods via a single structure. The
632 methods required are indicated by the value set in the eapMethodMask
633
634 MEMBERS
635 eapMethodMask
636 - Bit mask of supported EAP methods
637 Currently only supports the setting of one bit.
638 Required for all the EAP methods.
639 authMode
640 - Bit mask representing the authentication types that may be
641 supported by a suitable AP. An AP must support at least one
642 of the authentication types specified to be considered for
643 connection. Required for all EAP methods.
644 encryptionMode
645 - Bit mask representing the encryption types that may be
646 supported by a suitable AP. An AP must support a suitable
647 mix of the pairwise and group encryption types requested to
648 be considered for connection. Required for all EAP methods.
649 userName
650 - User name. Required for all EAP methods except: SIM or AKA.
651 userPassword
652 - User Password. Required for all EAP methods except: TLS,
653 SIM or AKA.
654 authServerUserIdentity
655 - Authentication server user Identity. Required for all EAP
656 methods except: TLS, SIM, AKA or FAST.
657 clientCertificateLength
658 - Length in bytes of the following client certificate (if
659 present). Only required for TLS.
660 clientCertificate
661 - The actual client certificate data (if present). Only
662 required for TLS. DER/PEM format supported.
663 certificateAuthorityCertificateLength
664 - Length in bytes of the following certificate authority
665 certificate (if present). Optional for TLS, TTLS, PEAP.
666 certificateAuthorityCertificate
667 - The actual certificate authority certificate data (if
668 present). If not supplied the received certificate
669 authority certificate is assumed to be valid, if present
670 the received certificate is validated against it. Optional
671 for TLS, TTLS, PEAP. DER/PEM format supported.
672 privateKeyLength
673 - Length in bytes of the following private key (if present).
674 Only required for TLS.
675 privateKey
676 - The actual private key (if present). Only required for TLS.
677 DER/PEM format, maybe password protected.
678 privateKeyPassword
679 - Optional password to protect the private key.
680 sessionLength
681 - Length in bytes of the following session field Supported
682 for all EAP methods except: SIM or AKA.
683 session
684 - Session information to support faster re-authentication.
685 Supported for all EAP methods except: SIM or AKA.
686 allowPacProvisioning
687 - If TRUE: PAC provisioning is allowed 'over-the_air';
688 If FALSE: a PAC must be supplied.
689 Only required for FAST.
690 pacLength
691 - Length the following PAC field. If allowPacProvisioning is
692 FALSE then the PAC MUST be supplied (i.e. non-zero). Only
693 required for FAST.
694 pac
695 - The actual PAC data. If allowPacProvisioning is FALSE then
696 the PAC MUST be supplied. Only required for FAST.
697 pacPassword
698 - Optional password to protect the PAC. Only required for
699 FAST.
700
701*******************************************************************************/
702typedef struct
703{
704 CsrWifiNmeEapMethodMask eapMethodMask;
705 CsrWifiSmeAuthModeMask authMode;
706 CsrWifiNmeEncryptionMask encryptionMode;
707 char *userName;
708 char *userPassword;
709 char *authServerUserIdentity;
710 u32 clientCertificateLength;
711 u8 *clientCertificate;
712 u32 certificateAuthorityCertificateLength;
713 u8 *certificateAuthorityCertificate;
714 u16 privateKeyLength;
715 u8 *privateKey;
716 char *privateKeyPassword;
717 u32 sessionLength;
718 u8 *session;
719 u8 allowPacProvisioning;
720 u32 pacLength;
721 u8 *pac;
722 char *pacPassword;
723} CsrWifiNmeEapCredentials;
724
725/*******************************************************************************
726
727 NAME
728 CsrWifiNmePeerConfig
729
730 DESCRIPTION
731 Structure holding Peer Config data.
732
733 MEMBERS
734 p2pDeviceId -
735 groupCapabilityMask -
736 groupOwnerIntent -
737
738*******************************************************************************/
739typedef struct
740{
741 CsrWifiMacAddress p2pDeviceId;
742 CsrWifiSmeP2pGroupCapabilityMask groupCapabilityMask;
743 u8 groupOwnerIntent;
744} CsrWifiNmePeerConfig;
745
746/*******************************************************************************
747
748 NAME
749 CsrWifiNmeProfileIdentity
750
751 DESCRIPTION
752 The identity of a profile is defined as the unique combination the BSSID
753 and SSID.
754
755 MEMBERS
756 bssid - ID of Basic Service Set for or the P2pDevice address of the GO for
757 which a connection attempt was made.
758 ssid - Service Set Id.
759
760*******************************************************************************/
761typedef struct
762{
763 CsrWifiMacAddress bssid;
764 CsrWifiSsid ssid;
765} CsrWifiNmeProfileIdentity;
766
767/*******************************************************************************
768
769 NAME
770 CsrWifiNmeWep128Keys
771
772 DESCRIPTION
773 Structure holding WEP Authentication Type and WEP keys that can be used
774 when using WEP128.
775
776 MEMBERS
777 wepAuthType - Mask to select the WEP authentication type (Open or Shared)
778 selectedWepKey - Index to one of the four keys below indicating the
779 currently used WEP key.
780 key1 - Value for key number 1.
781 key2 - Value for key number 2.
782 key3 - Value for key number 3.
783 key4 - Value for key number 4.
784
785*******************************************************************************/
786typedef struct
787{
788 CsrWifiSmeAuthModeMask wepAuthType;
789 u8 selectedWepKey;
790 u8 key1[13];
791 u8 key2[13];
792 u8 key3[13];
793 u8 key4[13];
794} CsrWifiNmeWep128Keys;
795
796/*******************************************************************************
797
798 NAME
799 CsrWifiNmeWep64Keys
800
801 DESCRIPTION
802 Structure for holding WEP Authentication Type and WEP keys that can be
803 used when using WEP64.
804
805 MEMBERS
806 wepAuthType - Mask to select the WEP authentication type (Open or Shared)
807 selectedWepKey - Index to one of the four keys below indicating the
808 currently used WEP key.
809 key1 - Value for key number 1.
810 key2 - Value for key number 2.
811 key3 - Value for key number 3.
812 key4 - Value for key number 4.
813
814*******************************************************************************/
815typedef struct
816{
817 CsrWifiSmeAuthModeMask wepAuthType;
818 u8 selectedWepKey;
819 u8 key1[5];
820 u8 key2[5];
821 u8 key3[5];
822 u8 key4[5];
823} CsrWifiNmeWep64Keys;
824
825/*******************************************************************************
826
827 NAME
828 CsrWifiNmeCredentials
829
830 DESCRIPTION
831 Structure containing the Credentials data.
832
833 MEMBERS
834 credentialType - Credential type value (as defined in the
835 enumeration type).
836 credential - Union containing credentials which depends on
837 credentialType parameter.
838 credentialeap -
839 credentialwapiPassphrase -
840 credentialwpa2Passphrase -
841 credentialwpa2Psk -
842 credentialwapiPsk -
843 credentialwpaPassphrase -
844 credentialwapi -
845 credentialwep128Key -
846 credentialwpaPsk -
847 credentialopenSystem -
848 credentialwep64Key -
849
850*******************************************************************************/
851typedef struct
852{
853 CsrWifiNmeCredentialType credentialType;
854 union {
855 CsrWifiNmeEapCredentials eap;
856 CsrWifiNmePassphrase wapiPassphrase;
857 CsrWifiNmePassphrase wpa2Passphrase;
858 CsrWifiNmePsk wpa2Psk;
859 CsrWifiNmePsk wapiPsk;
860 CsrWifiNmePassphrase wpaPassphrase;
861 CsrWifiNmeWapiCredentials wapi;
862 CsrWifiNmeWep128Keys wep128Key;
863 CsrWifiNmePsk wpaPsk;
864 CsrWifiNmeEmpty openSystem;
865 CsrWifiNmeWep64Keys wep64Key;
866 } credential;
867} CsrWifiNmeCredentials;
868
869/*******************************************************************************
870
871 NAME
872 CsrWifiNmeProfile
873
874 DESCRIPTION
875 Structure containing the Profile data.
876
877 MEMBERS
878 profileIdentity - Profile Identity.
879 wmmQosInfoMask - Mask for WMM QoS information.
880 bssType - Type of BSS (Infrastructure or Adhoc).
881 channelNo - Channel Number.
882 ccxOptionsMask - Options mask for Cisco Compatible Extentions.
883 cloakedSsid - Flag to decide whether the SSID is cloaked (not
884 transmitted) or not.
885 credentials - Credentials data.
886
887*******************************************************************************/
888typedef struct
889{
890 CsrWifiNmeProfileIdentity profileIdentity;
891 CsrWifiNmeWmmQosInfoMask wmmQosInfoMask;
892 CsrWifiNmeBssType bssType;
893 u8 channelNo;
894 u8 ccxOptionsMask;
895 u8 cloakedSsid;
896 CsrWifiNmeCredentials credentials;
897} CsrWifiNmeProfile;
898
899
900/* Downstream */
901#define CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST (0x0000)
902
903#define CSR_WIFI_NME_PROFILE_SET_REQ ((CsrWifiNmePrim) (0x0000 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST))
904#define CSR_WIFI_NME_PROFILE_DELETE_REQ ((CsrWifiNmePrim) (0x0001 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST))
905#define CSR_WIFI_NME_PROFILE_DELETE_ALL_REQ ((CsrWifiNmePrim) (0x0002 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST))
906#define CSR_WIFI_NME_PROFILE_ORDER_SET_REQ ((CsrWifiNmePrim) (0x0003 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST))
907#define CSR_WIFI_NME_PROFILE_CONNECT_REQ ((CsrWifiNmePrim) (0x0004 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST))
908#define CSR_WIFI_NME_WPS_REQ ((CsrWifiNmePrim) (0x0005 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST))
909#define CSR_WIFI_NME_WPS_CANCEL_REQ ((CsrWifiNmePrim) (0x0006 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST))
910#define CSR_WIFI_NME_CONNECTION_STATUS_GET_REQ ((CsrWifiNmePrim) (0x0007 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST))
911#define CSR_WIFI_NME_SIM_IMSI_GET_RES ((CsrWifiNmePrim) (0x0008 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST))
912#define CSR_WIFI_NME_SIM_GSM_AUTH_RES ((CsrWifiNmePrim) (0x0009 + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST))
913#define CSR_WIFI_NME_SIM_UMTS_AUTH_RES ((CsrWifiNmePrim) (0x000A + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST))
914#define CSR_WIFI_NME_WPS_CONFIG_SET_REQ ((CsrWifiNmePrim) (0x000B + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST))
915#define CSR_WIFI_NME_EVENT_MASK_SET_REQ ((CsrWifiNmePrim) (0x000C + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST))
916
917
918#define CSR_WIFI_NME_PRIM_DOWNSTREAM_HIGHEST (0x000C + CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)
919
920/* Upstream */
921#define CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM)
922
923#define CSR_WIFI_NME_PROFILE_SET_CFM ((CsrWifiNmePrim)(0x0000 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST))
924#define CSR_WIFI_NME_PROFILE_DELETE_CFM ((CsrWifiNmePrim)(0x0001 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST))
925#define CSR_WIFI_NME_PROFILE_DELETE_ALL_CFM ((CsrWifiNmePrim)(0x0002 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST))
926#define CSR_WIFI_NME_PROFILE_ORDER_SET_CFM ((CsrWifiNmePrim)(0x0003 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST))
927#define CSR_WIFI_NME_PROFILE_CONNECT_CFM ((CsrWifiNmePrim)(0x0004 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST))
928#define CSR_WIFI_NME_WPS_CFM ((CsrWifiNmePrim)(0x0005 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST))
929#define CSR_WIFI_NME_WPS_CANCEL_CFM ((CsrWifiNmePrim)(0x0006 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST))
930#define CSR_WIFI_NME_CONNECTION_STATUS_GET_CFM ((CsrWifiNmePrim)(0x0007 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST))
931#define CSR_WIFI_NME_PROFILE_UPDATE_IND ((CsrWifiNmePrim)(0x0008 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST))
932#define CSR_WIFI_NME_PROFILE_DISCONNECT_IND ((CsrWifiNmePrim)(0x0009 + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST))
933#define CSR_WIFI_NME_SIM_IMSI_GET_IND ((CsrWifiNmePrim)(0x000A + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST))
934#define CSR_WIFI_NME_SIM_GSM_AUTH_IND ((CsrWifiNmePrim)(0x000B + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST))
935#define CSR_WIFI_NME_SIM_UMTS_AUTH_IND ((CsrWifiNmePrim)(0x000C + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST))
936#define CSR_WIFI_NME_WPS_CONFIG_SET_CFM ((CsrWifiNmePrim)(0x000D + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST))
937#define CSR_WIFI_NME_EVENT_MASK_SET_CFM ((CsrWifiNmePrim)(0x000E + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST))
938
939#define CSR_WIFI_NME_PRIM_UPSTREAM_HIGHEST (0x000E + CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)
940
941#define CSR_WIFI_NME_PRIM_DOWNSTREAM_COUNT (CSR_WIFI_NME_PRIM_DOWNSTREAM_HIGHEST + 1 - CSR_WIFI_NME_PRIM_DOWNSTREAM_LOWEST)
942#define CSR_WIFI_NME_PRIM_UPSTREAM_COUNT (CSR_WIFI_NME_PRIM_UPSTREAM_HIGHEST + 1 - CSR_WIFI_NME_PRIM_UPSTREAM_LOWEST)
943
944/*******************************************************************************
945
946 NAME
947 CsrWifiNmeProfileSetReq
948
949 DESCRIPTION
950 Creates or updates an existing profile in the NME that matches the unique
951 identity of the profile. Each profile is identified by the combination of
952 BSSID and SSID. The profile contains all the required credentials for
953 attempting to connect to the network. Creating or updating a profile via
954 the NME PROFILE SET REQ does NOT add the profile to the preferred profile
955 list within the NME used for the NME auto-connect behaviour.
956
957 MEMBERS
958 common - Common header for use with the CsrWifiFsm Module
959 profile - Specifies the identity and credentials of the network.
960
961*******************************************************************************/
962typedef struct
963{
964 CsrWifiFsmEvent common;
965 CsrWifiNmeProfile profile;
966} CsrWifiNmeProfileSetReq;
967
968/*******************************************************************************
969
970 NAME
971 CsrWifiNmeProfileDeleteReq
972
973 DESCRIPTION
974 Will delete the profile with a matching identity, but does NOT modify the
975 preferred profile list.
976
977 MEMBERS
978 common - Common header for use with the CsrWifiFsm Module
979 profileIdentity - Identity (BSSID, SSID) of profile to be deleted.
980
981*******************************************************************************/
982typedef struct
983{
984 CsrWifiFsmEvent common;
985 CsrWifiNmeProfileIdentity profileIdentity;
986} CsrWifiNmeProfileDeleteReq;
987
988/*******************************************************************************
989
990 NAME
991 CsrWifiNmeProfileDeleteAllReq
992
993 DESCRIPTION
994 Deletes all profiles present in the NME, but does NOT modify the
995 preferred profile list.
996
997 MEMBERS
998 common - Common header for use with the CsrWifiFsm Module
999
1000*******************************************************************************/
1001typedef struct
1002{
1003 CsrWifiFsmEvent common;
1004} CsrWifiNmeProfileDeleteAllReq;
1005
1006/*******************************************************************************
1007
1008 NAME
1009 CsrWifiNmeProfileOrderSetReq
1010
1011 DESCRIPTION
1012 Defines the preferred order that profiles present in the NME should be
1013 used during the NME auto-connect behaviour.
1014 If profileIdentitysCount == 0, it removes any existing preferred profile
1015 list already present in the NME, effectively disabling the auto-connect
1016 behaviour.
1017 NOTE: Profile identities that do not match any profile stored in the NME
1018 are ignored during the auto-connect procedure.
1019 NOTE: during auto-connect the NME will only attempt to join an existing
1020 adhoc network and it will never attempt to host an adhoc network; for
1021 hosting and adhoc network, use CSR_WIFI_NME_PROFILE_CONNECT_REQ
1022
1023 MEMBERS
1024 common - Common header for use with the CsrWifiFsm Module
1025 interfaceTag - Interface Identifier; unique identifier of an
1026 interface
1027 profileIdentitysCount - The number of profiles identities in the list.
1028 profileIdentitys - Points to the list of profile identities.
1029
1030*******************************************************************************/
1031typedef struct
1032{
1033 CsrWifiFsmEvent common;
1034 u16 interfaceTag;
1035 u8 profileIdentitysCount;
1036 CsrWifiNmeProfileIdentity *profileIdentitys;
1037} CsrWifiNmeProfileOrderSetReq;
1038
1039/*******************************************************************************
1040
1041 NAME
1042 CsrWifiNmeProfileConnectReq
1043
1044 DESCRIPTION
1045 Requests the NME to attempt to connect to the specified profile.
1046 Overrides any current connection attempt.
1047
1048 MEMBERS
1049 common - Common header for use with the CsrWifiFsm Module
1050 interfaceTag - Interface Identifier; unique identifier of an interface
1051 profileIdentity - Identity (BSSID, SSID) of profile to be connected to.
1052 It must match an existing profile in the NME.
1053
1054*******************************************************************************/
1055typedef struct
1056{
1057 CsrWifiFsmEvent common;
1058 u16 interfaceTag;
1059 CsrWifiNmeProfileIdentity profileIdentity;
1060} CsrWifiNmeProfileConnectReq;
1061
1062/*******************************************************************************
1063
1064 NAME
1065 CsrWifiNmeWpsReq
1066
1067 DESCRIPTION
1068 Requests the NME to look for WPS enabled APs and attempt to perform WPS
1069 to determine the appropriate security credentials to connect to the AP.
1070 If the PIN == '00000000' then 'push button mode' is indicated, otherwise
1071 the PIN has to match that of the AP. 4 digit pin is passed by sending the
1072 pin digits in pin[0]..pin[3] and rest of the contents filled with '-'.
1073
1074 MEMBERS
1075 common - Common header for use with the CsrWifiFsm Module
1076 interfaceTag - Interface Identifier; unique identifier of an interface
1077 pin - PIN value.
1078 ssid - Service Set identifier
1079 bssid - ID of Basic Service Set for which a WPS connection attempt is
1080 being made.
1081
1082*******************************************************************************/
1083typedef struct
1084{
1085 CsrWifiFsmEvent common;
1086 u16 interfaceTag;
1087 u8 pin[8];
1088 CsrWifiSsid ssid;
1089 CsrWifiMacAddress bssid;
1090} CsrWifiNmeWpsReq;
1091
1092/*******************************************************************************
1093
1094 NAME
1095 CsrWifiNmeWpsCancelReq
1096
1097 DESCRIPTION
1098 Requests the NME to cancel any WPS procedure that it is currently
1099 performing. This includes WPS registrar activities started because of
1100 CSR_WIFI_NME_AP_REGISTER.request
1101
1102 MEMBERS
1103 common - Common header for use with the CsrWifiFsm Module
1104 interfaceTag - Interface Identifier; unique identifier of an interface
1105
1106*******************************************************************************/
1107typedef struct
1108{
1109 CsrWifiFsmEvent common;
1110 u16 interfaceTag;
1111} CsrWifiNmeWpsCancelReq;
1112
1113/*******************************************************************************
1114
1115 NAME
1116 CsrWifiNmeConnectionStatusGetReq
1117
1118 DESCRIPTION
1119 Requests the current connection status of the NME.
1120
1121 MEMBERS
1122 common - Common header for use with the CsrWifiFsm Module
1123 interfaceTag - Interface Identifier; unique identifier of an interface
1124
1125*******************************************************************************/
1126typedef struct
1127{
1128 CsrWifiFsmEvent common;
1129 u16 interfaceTag;
1130} CsrWifiNmeConnectionStatusGetReq;
1131
1132/*******************************************************************************
1133
1134 NAME
1135 CsrWifiNmeSimImsiGetRes
1136
1137 DESCRIPTION
1138 Response from the application that received the NME SIM IMSI GET IND.
1139
1140 MEMBERS
1141 common - Common header for use with the CsrWifiFsm Module
1142 status - Indicates the outcome of the requested operation: STATUS_SUCCESS
1143 or STATUS_ERROR.
1144 imsi - The value of the IMSI obtained from the UICC.
1145 cardType - The UICC type (GSM only (SIM), UMTS only (USIM), Both).
1146
1147*******************************************************************************/
1148typedef struct
1149{
1150 CsrWifiFsmEvent common;
1151 CsrResult status;
1152 char *imsi;
1153 CsrWifiNmeSimCardType cardType;
1154} CsrWifiNmeSimImsiGetRes;
1155
1156/*******************************************************************************
1157
1158 NAME
1159 CsrWifiNmeSimGsmAuthRes
1160
1161 DESCRIPTION
1162 Response from the application that received the NME SIM GSM AUTH IND. For
1163 each GSM authentication round a GSM Ciphering key (Kc) and a signed
1164 response (SRES) are produced. Since 2 or 3 GSM authentication rounds are
1165 used the 2 or 3 Kc's obtained respectively are combined into one buffer
1166 and similarly the 2 or 3 SRES's obtained are combined into another
1167 buffer. The order of Kc values (SRES values respectively) in their buffer
1168 is the same as that of their corresponding RAND values in the incoming
1169 indication.
1170
1171 MEMBERS
1172 common - Common header for use with the CsrWifiFsm Module
1173 status - Indicates the outcome of the requested operation:
1174 STATUS_SUCCESS or STATUS_ERROR
1175 kcsLength - Length in Bytes of Kc buffer. Legal values are: 16 or 24.
1176 kcs - Kc buffer holding 2 or 3 Kc values.
1177 sresLength - Length in Bytes of SRES buffer. Legal values are: 8 or 12.
1178 sres - SRES buffer holding 2 or 3 SRES values.
1179
1180*******************************************************************************/
1181typedef struct
1182{
1183 CsrWifiFsmEvent common;
1184 CsrResult status;
1185 u8 kcsLength;
1186 u8 *kcs;
1187 u8 sresLength;
1188 u8 *sres;
1189} CsrWifiNmeSimGsmAuthRes;
1190
1191/*******************************************************************************
1192
1193 NAME
1194 CsrWifiNmeSimUmtsAuthRes
1195
1196 DESCRIPTION
1197 Response from the application that received the NME SIM UMTS AUTH IND.
1198 The values of umtsCipherKey, umtsIntegrityKey, resParameterLength and
1199 resParameter are only meanigful when result = UMTS_AUTH_RESULT_SUCCESS.
1200 The value of auts is only meaningful when
1201 result=UMTS_AUTH_RESULT_SYNC_FAIL.
1202
1203 MEMBERS
1204 common - Common header for use with the CsrWifiFsm Module
1205 status - Indicates the outcome of the requested operation:
1206 STATUS_SUCCESS or STATUS_ERROR.
1207 result - The result of UMTS authentication as performed by the
1208 UICC which could be: Success, Authentication Reject or
1209 Synchronisation Failure. For all these 3 outcomes the
1210 value of status is success.
1211 umtsCipherKey - The UMTS Cipher Key as calculated and returned by the
1212 UICC.
1213 umtsIntegrityKey - The UMTS Integrity Key as calculated and returned by
1214 the UICC.
1215 resParameterLength - The length (in bytes) of the RES parameter (min=4; max
1216 = 16).
1217 resParameter - The RES parameter as calculated and returned by the
1218 UICC.
1219 auts - The AUTS parameter as calculated and returned by the
1220 UICC.
1221
1222*******************************************************************************/
1223typedef struct
1224{
1225 CsrWifiFsmEvent common;
1226 CsrResult status;
1227 CsrWifiNmeUmtsAuthResult result;
1228 u8 umtsCipherKey[16];
1229 u8 umtsIntegrityKey[16];
1230 u8 resParameterLength;
1231 u8 *resParameter;
1232 u8 auts[14];
1233} CsrWifiNmeSimUmtsAuthRes;
1234
1235/*******************************************************************************
1236
1237 NAME
1238 CsrWifiNmeWpsConfigSetReq
1239
1240 DESCRIPTION
1241 This primitive passes the WPS information for the device to NME. This may
1242 be accepted only if no interface is active.
1243
1244 MEMBERS
1245 common - Common header for use with the CsrWifiFsm Module
1246 wpsConfig - WPS config.
1247
1248*******************************************************************************/
1249typedef struct
1250{
1251 CsrWifiFsmEvent common;
1252 CsrWifiSmeWpsConfig wpsConfig;
1253} CsrWifiNmeWpsConfigSetReq;
1254
1255/*******************************************************************************
1256
1257 NAME
1258 CsrWifiNmeEventMaskSetReq
1259
1260 DESCRIPTION
1261 The wireless manager application may register with the NME to receive
1262 notification of interesting events. Indications will be sent only if the
1263 wireless manager explicitly registers to be notified of that event.
1264 indMask is a bit mask of values defined in CsrWifiNmeIndicationsMask.
1265
1266 MEMBERS
1267 common - Common header for use with the CsrWifiFsm Module
1268 indMask - Set mask with values from CsrWifiNmeIndications
1269
1270*******************************************************************************/
1271typedef struct
1272{
1273 CsrWifiFsmEvent common;
1274 CsrWifiNmeIndicationsMask indMask;
1275} CsrWifiNmeEventMaskSetReq;
1276
1277/*******************************************************************************
1278
1279 NAME
1280 CsrWifiNmeProfileSetCfm
1281
1282 DESCRIPTION
1283 Reports the status of the NME PROFILE SET REQ; the request will only fail
1284 if the details specified in the profile contains an invalid combination
1285 of parameters for example specifying the profile as cloaked but not
1286 specifying the SSID. The NME doesn't limit the number of profiles that
1287 may be created. The NME assumes that the entity configuring it is aware
1288 of the appropriate limits.
1289
1290 MEMBERS
1291 common - Common header for use with the CsrWifiFsm Module
1292 status - Indicates the success or otherwise of the requested operation.
1293
1294*******************************************************************************/
1295typedef struct
1296{
1297 CsrWifiFsmEvent common;
1298 CsrResult status;
1299} CsrWifiNmeProfileSetCfm;
1300
1301/*******************************************************************************
1302
1303 NAME
1304 CsrWifiNmeProfileDeleteCfm
1305
1306 DESCRIPTION
1307 Reports the status of the CSR_WIFI_NME_PROFILE_DELETE_REQ.
1308 Returns CSR_WIFI_NME_STATUS_NOT_FOUND if there is no matching profile.
1309
1310 MEMBERS
1311 common - Common header for use with the CsrWifiFsm Module
1312 status - Indicates the success or otherwise of the requested operation.
1313
1314*******************************************************************************/
1315typedef struct
1316{
1317 CsrWifiFsmEvent common;
1318 CsrResult status;
1319} CsrWifiNmeProfileDeleteCfm;
1320
1321/*******************************************************************************
1322
1323 NAME
1324 CsrWifiNmeProfileDeleteAllCfm
1325
1326 DESCRIPTION
1327 Reports the status of the CSR_WIFI_NME_PROFILE_DELETE_ALL_REQ.
1328 Returns always CSR_WIFI_NME_STATUS_SUCCESS.
1329
1330 MEMBERS
1331 common - Common header for use with the CsrWifiFsm Module
1332 status - Indicates the success or otherwise of the requested operation, but
1333 in this case it always set to success.
1334
1335*******************************************************************************/
1336typedef struct
1337{
1338 CsrWifiFsmEvent common;
1339 CsrResult status;
1340} CsrWifiNmeProfileDeleteAllCfm;
1341
1342/*******************************************************************************
1343
1344 NAME
1345 CsrWifiNmeProfileOrderSetCfm
1346
1347 DESCRIPTION
1348 Confirmation to UNIFI_NME_PROFILE_ORDER_SET.request.
1349
1350 MEMBERS
1351 common - Common header for use with the CsrWifiFsm Module
1352 interfaceTag - Interface Identifier; unique identifier of an interface
1353 status - Indicates the success or otherwise of the requested
1354 operation.
1355
1356*******************************************************************************/
1357typedef struct
1358{
1359 CsrWifiFsmEvent common;
1360 u16 interfaceTag;
1361 CsrResult status;
1362} CsrWifiNmeProfileOrderSetCfm;
1363
1364/*******************************************************************************
1365
1366 NAME
1367 CsrWifiNmeProfileConnectCfm
1368
1369 DESCRIPTION
1370 Reports the status of the NME PROFILE CONNECT REQ. If unsuccessful the
1371 connectAttempt parameters contain details of the APs that the NME
1372 attempted to connect to before reporting the failure of the request.
1373
1374 MEMBERS
1375 common - Common header for use with the CsrWifiFsm Module
1376 interfaceTag - Interface Identifier; unique identifier of an
1377 interface
1378 status - Indicates the success or otherwise of the requested
1379 operation.
1380 connectAttemptsCount - This parameter is relevant only if
1381 status!=CSR_WIFI_NME_STATUS_SUCCESS.
1382 Number of connection attempt elements provided with
1383 this primitive
1384 connectAttempts - This parameter is relevant only if
1385 status!=CSR_WIFI_NME_STATUS_SUCCESS.
1386 Points to the list of connection attempt elements
1387 provided with this primitive
1388 Each element of the list provides information about
1389 an AP on which the connection attempt was made and
1390 the error that occurred during the attempt.
1391
1392*******************************************************************************/
1393typedef struct
1394{
1395 CsrWifiFsmEvent common;
1396 u16 interfaceTag;
1397 CsrResult status;
1398 u8 connectAttemptsCount;
1399 CsrWifiNmeConnectAttempt *connectAttempts;
1400} CsrWifiNmeProfileConnectCfm;
1401
1402/*******************************************************************************
1403
1404 NAME
1405 CsrWifiNmeWpsCfm
1406
1407 DESCRIPTION
1408 Reports the status of the NME WPS REQ.
1409 If CSR_WIFI_NME_STATUS_SUCCESS, the profile parameter contains the
1410 identity and credentials of the AP.
1411
1412 MEMBERS
1413 common - Common header for use with the CsrWifiFsm Module
1414 interfaceTag - Interface Identifier; unique identifier of an interface
1415 status - Indicates the success or otherwise of the requested
1416 operation.
1417 profile - This parameter is relevant only if
1418 status==CSR_WIFI_NME_STATUS_SUCCESS.
1419 The identity and credentials of the network.
1420
1421*******************************************************************************/
1422typedef struct
1423{
1424 CsrWifiFsmEvent common;
1425 u16 interfaceTag;
1426 CsrResult status;
1427 CsrWifiNmeProfile profile;
1428} CsrWifiNmeWpsCfm;
1429
1430/*******************************************************************************
1431
1432 NAME
1433 CsrWifiNmeWpsCancelCfm
1434
1435 DESCRIPTION
1436 Reports the status of the NME WPS REQ, the request is always SUCCESSFUL.
1437
1438 MEMBERS
1439 common - Common header for use with the CsrWifiFsm Module
1440 interfaceTag - Interface Identifier; unique identifier of an interface
1441 status - Only returns CSR_WIFI_NME_STATUS_SUCCESS
1442
1443*******************************************************************************/
1444typedef struct
1445{
1446 CsrWifiFsmEvent common;
1447 u16 interfaceTag;
1448 CsrResult status;
1449} CsrWifiNmeWpsCancelCfm;
1450
1451/*******************************************************************************
1452
1453 NAME
1454 CsrWifiNmeConnectionStatusGetCfm
1455
1456 DESCRIPTION
1457 Reports the connection status of the NME.
1458
1459 MEMBERS
1460 common - Common header for use with the CsrWifiFsm Module
1461 interfaceTag - Interface Identifier; unique identifier of an interface
1462 status - Indicates the success or otherwise of the requested
1463 operation.
1464 connectionStatus - NME current connection status
1465
1466*******************************************************************************/
1467typedef struct
1468{
1469 CsrWifiFsmEvent common;
1470 u16 interfaceTag;
1471 CsrResult status;
1472 CsrWifiNmeConnectionStatus connectionStatus;
1473} CsrWifiNmeConnectionStatusGetCfm;
1474
1475/*******************************************************************************
1476
1477 NAME
1478 CsrWifiNmeProfileUpdateInd
1479
1480 DESCRIPTION
1481 Indication generated from the NME (if an application subscribes to
1482 receive it) that informs that application that the contained profile has
1483 changed.
1484 For example, either the credentials EAP-FAST PAC file or the session data
1485 within the profile has changed.
1486 It is up to the application whether it stores this updated profile or
1487 not.
1488
1489 MEMBERS
1490 common - Common header for use with the CsrWifiFsm Module
1491 interfaceTag - Interface Identifier; unique identifier of an interface
1492 profile - The identity and credentials of the network.
1493
1494*******************************************************************************/
1495typedef struct
1496{
1497 CsrWifiFsmEvent common;
1498 u16 interfaceTag;
1499 CsrWifiNmeProfile profile;
1500} CsrWifiNmeProfileUpdateInd;
1501
1502/*******************************************************************************
1503
1504 NAME
1505 CsrWifiNmeProfileDisconnectInd
1506
1507 DESCRIPTION
1508 Indication generated from the NME (if an application subscribes to
1509 receive it) that informs that application that the current profile
1510 connection has disconnected. The indication will contain information
1511 about APs that it attempted to maintain the connection via i.e. in the
1512 case of failed roaming.
1513
1514 MEMBERS
1515 common - Common header for use with the CsrWifiFsm Module
1516 interfaceTag - Interface Identifier; unique identifier of an
1517 interface
1518 connectAttemptsCount - Number of connection attempt elements provided with
1519 this primitive
1520 connectAttempts - Points to the list of connection attempt elements
1521 provided with this primitive
1522 Each element of the list provides information about
1523 an AP on which the connection attempt was made and
1524 the error occurred during the attempt.
1525
1526*******************************************************************************/
1527typedef struct
1528{
1529 CsrWifiFsmEvent common;
1530 u16 interfaceTag;
1531 u8 connectAttemptsCount;
1532 CsrWifiNmeConnectAttempt *connectAttempts;
1533} CsrWifiNmeProfileDisconnectInd;
1534
1535/*******************************************************************************
1536
1537 NAME
1538 CsrWifiNmeSimImsiGetInd
1539
1540 DESCRIPTION
1541 Indication generated from the NME (if an application subscribes to
1542 receive it) that requests the IMSI and UICC type from the UICC Manager.
1543 This indication is generated when the NME is attempting to connect to a
1544 profile configured for EAP-SIM/AKA. An application MUST register to
1545 receive this indication for the NME to support the EAP-SIM/AKA credential
1546 types. Otherwise the NME has no route to obtain the information from the
1547 UICC.
1548
1549 MEMBERS
1550 common - Common header for use with the CsrWifiFsm Module
1551
1552*******************************************************************************/
1553typedef struct
1554{
1555 CsrWifiFsmEvent common;
1556} CsrWifiNmeSimImsiGetInd;
1557
1558/*******************************************************************************
1559
1560 NAME
1561 CsrWifiNmeSimGsmAuthInd
1562
1563 DESCRIPTION
1564 Indication generated from the NME (if an application subscribes to
1565 receive it) that requests the UICC Manager to perform a GSM
1566 authentication on behalf of the NME. This indication is generated when
1567 the NME is attempting to connect to a profile configured for EAP-SIM. An
1568 application MUST register to receive this indication for the NME to
1569 support the EAP-SIM credential types. Otherwise the NME has no route to
1570 obtain the information from the UICC. EAP-SIM authentication requires 2
1571 or 3 GSM authentication rounds and therefore 2 or 3 RANDS (GSM Random
1572 Challenges) are included.
1573
1574 MEMBERS
1575 common - Common header for use with the CsrWifiFsm Module
1576 randsLength - GSM RAND is 16 bytes long hence valid values are 32 (2 RANDS)
1577 or 48 (3 RANDs).
1578 rands - 2 or 3 RANDs values.
1579
1580*******************************************************************************/
1581typedef struct
1582{
1583 CsrWifiFsmEvent common;
1584 u8 randsLength;
1585 u8 *rands;
1586} CsrWifiNmeSimGsmAuthInd;
1587
1588/*******************************************************************************
1589
1590 NAME
1591 CsrWifiNmeSimUmtsAuthInd
1592
1593 DESCRIPTION
1594 Indication generated from the NME (if an application subscribes to
1595 receive it) that requests the UICC Manager to perform a UMTS
1596 authentication on behalf of the NME. This indication is generated when
1597 the NME is attempting to connect to a profile configured for EAP-AKA. An
1598 application MUST register to receive this indication for the NME to
1599 support the EAP-AKA credential types. Otherwise the NME has no route to
1600 obtain the information from the USIM. EAP-AKA requires one UMTS
1601 authentication round and therefore only one RAND and one AUTN values are
1602 included.
1603
1604 MEMBERS
1605 common - Common header for use with the CsrWifiFsm Module
1606 rand - UMTS RAND value.
1607 autn - UMTS AUTN value.
1608
1609*******************************************************************************/
1610typedef struct
1611{
1612 CsrWifiFsmEvent common;
1613 u8 rand[16];
1614 u8 autn[16];
1615} CsrWifiNmeSimUmtsAuthInd;
1616
1617/*******************************************************************************
1618
1619 NAME
1620 CsrWifiNmeWpsConfigSetCfm
1621
1622 DESCRIPTION
1623 Confirm.
1624
1625 MEMBERS
1626 common - Common header for use with the CsrWifiFsm Module
1627 status - Status of the request.
1628
1629*******************************************************************************/
1630typedef struct
1631{
1632 CsrWifiFsmEvent common;
1633 CsrResult status;
1634} CsrWifiNmeWpsConfigSetCfm;
1635
1636/*******************************************************************************
1637
1638 NAME
1639 CsrWifiNmeEventMaskSetCfm
1640
1641 DESCRIPTION
1642 The NME calls the primitive to report the result of the request
1643 primitive.
1644
1645 MEMBERS
1646 common - Common header for use with the CsrWifiFsm Module
1647 status - Reports the result of the request
1648
1649*******************************************************************************/
1650typedef struct
1651{
1652 CsrWifiFsmEvent common;
1653 CsrResult status;
1654} CsrWifiNmeEventMaskSetCfm;
1655
1656#endif /* CSR_WIFI_NME_PRIM_H__ */
1657
diff --git a/drivers/staging/csr/csr_wifi_nme_serialize.h b/drivers/staging/csr/csr_wifi_nme_serialize.h
deleted file mode 100644
index ebac484419cf..000000000000
--- a/drivers/staging/csr/csr_wifi_nme_serialize.h
+++ /dev/null
@@ -1,166 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_NME_SERIALIZE_H__
14#define CSR_WIFI_NME_SERIALIZE_H__
15
16#include "csr_wifi_msgconv.h"
17#include "csr_wifi_nme_prim.h"
18
19#ifndef CSR_WIFI_NME_ENABLE
20#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_serialize.h
21#endif
22
23extern void CsrWifiNmePfree(void *ptr);
24
25extern u8* CsrWifiNmeProfileSetReqSer(u8 *ptr, size_t *len, void *msg);
26extern void* CsrWifiNmeProfileSetReqDes(u8 *buffer, size_t len);
27extern size_t CsrWifiNmeProfileSetReqSizeof(void *msg);
28extern void CsrWifiNmeProfileSetReqSerFree(void *msg);
29
30extern u8* CsrWifiNmeProfileDeleteReqSer(u8 *ptr, size_t *len, void *msg);
31extern void* CsrWifiNmeProfileDeleteReqDes(u8 *buffer, size_t len);
32extern size_t CsrWifiNmeProfileDeleteReqSizeof(void *msg);
33#define CsrWifiNmeProfileDeleteReqSerFree CsrWifiNmePfree
34
35#define CsrWifiNmeProfileDeleteAllReqSer CsrWifiEventSer
36#define CsrWifiNmeProfileDeleteAllReqDes CsrWifiEventDes
37#define CsrWifiNmeProfileDeleteAllReqSizeof CsrWifiEventSizeof
38#define CsrWifiNmeProfileDeleteAllReqSerFree CsrWifiNmePfree
39
40extern u8* CsrWifiNmeProfileOrderSetReqSer(u8 *ptr, size_t *len, void *msg);
41extern void* CsrWifiNmeProfileOrderSetReqDes(u8 *buffer, size_t len);
42extern size_t CsrWifiNmeProfileOrderSetReqSizeof(void *msg);
43extern void CsrWifiNmeProfileOrderSetReqSerFree(void *msg);
44
45extern u8* CsrWifiNmeProfileConnectReqSer(u8 *ptr, size_t *len, void *msg);
46extern void* CsrWifiNmeProfileConnectReqDes(u8 *buffer, size_t len);
47extern size_t CsrWifiNmeProfileConnectReqSizeof(void *msg);
48#define CsrWifiNmeProfileConnectReqSerFree CsrWifiNmePfree
49
50extern u8* CsrWifiNmeWpsReqSer(u8 *ptr, size_t *len, void *msg);
51extern void* CsrWifiNmeWpsReqDes(u8 *buffer, size_t len);
52extern size_t CsrWifiNmeWpsReqSizeof(void *msg);
53#define CsrWifiNmeWpsReqSerFree CsrWifiNmePfree
54
55#define CsrWifiNmeWpsCancelReqSer CsrWifiEventCsrUint16Ser
56#define CsrWifiNmeWpsCancelReqDes CsrWifiEventCsrUint16Des
57#define CsrWifiNmeWpsCancelReqSizeof CsrWifiEventCsrUint16Sizeof
58#define CsrWifiNmeWpsCancelReqSerFree CsrWifiNmePfree
59
60#define CsrWifiNmeConnectionStatusGetReqSer CsrWifiEventCsrUint16Ser
61#define CsrWifiNmeConnectionStatusGetReqDes CsrWifiEventCsrUint16Des
62#define CsrWifiNmeConnectionStatusGetReqSizeof CsrWifiEventCsrUint16Sizeof
63#define CsrWifiNmeConnectionStatusGetReqSerFree CsrWifiNmePfree
64
65extern u8* CsrWifiNmeSimImsiGetResSer(u8 *ptr, size_t *len, void *msg);
66extern void* CsrWifiNmeSimImsiGetResDes(u8 *buffer, size_t len);
67extern size_t CsrWifiNmeSimImsiGetResSizeof(void *msg);
68extern void CsrWifiNmeSimImsiGetResSerFree(void *msg);
69
70extern u8* CsrWifiNmeSimGsmAuthResSer(u8 *ptr, size_t *len, void *msg);
71extern void* CsrWifiNmeSimGsmAuthResDes(u8 *buffer, size_t len);
72extern size_t CsrWifiNmeSimGsmAuthResSizeof(void *msg);
73extern void CsrWifiNmeSimGsmAuthResSerFree(void *msg);
74
75extern u8* CsrWifiNmeSimUmtsAuthResSer(u8 *ptr, size_t *len, void *msg);
76extern void* CsrWifiNmeSimUmtsAuthResDes(u8 *buffer, size_t len);
77extern size_t CsrWifiNmeSimUmtsAuthResSizeof(void *msg);
78extern void CsrWifiNmeSimUmtsAuthResSerFree(void *msg);
79
80extern u8* CsrWifiNmeWpsConfigSetReqSer(u8 *ptr, size_t *len, void *msg);
81extern void* CsrWifiNmeWpsConfigSetReqDes(u8 *buffer, size_t len);
82extern size_t CsrWifiNmeWpsConfigSetReqSizeof(void *msg);
83extern void CsrWifiNmeWpsConfigSetReqSerFree(void *msg);
84
85#define CsrWifiNmeEventMaskSetReqSer CsrWifiEventCsrUint32Ser
86#define CsrWifiNmeEventMaskSetReqDes CsrWifiEventCsrUint32Des
87#define CsrWifiNmeEventMaskSetReqSizeof CsrWifiEventCsrUint32Sizeof
88#define CsrWifiNmeEventMaskSetReqSerFree CsrWifiNmePfree
89
90#define CsrWifiNmeProfileSetCfmSer CsrWifiEventCsrUint16Ser
91#define CsrWifiNmeProfileSetCfmDes CsrWifiEventCsrUint16Des
92#define CsrWifiNmeProfileSetCfmSizeof CsrWifiEventCsrUint16Sizeof
93#define CsrWifiNmeProfileSetCfmSerFree CsrWifiNmePfree
94
95#define CsrWifiNmeProfileDeleteCfmSer CsrWifiEventCsrUint16Ser
96#define CsrWifiNmeProfileDeleteCfmDes CsrWifiEventCsrUint16Des
97#define CsrWifiNmeProfileDeleteCfmSizeof CsrWifiEventCsrUint16Sizeof
98#define CsrWifiNmeProfileDeleteCfmSerFree CsrWifiNmePfree
99
100#define CsrWifiNmeProfileDeleteAllCfmSer CsrWifiEventCsrUint16Ser
101#define CsrWifiNmeProfileDeleteAllCfmDes CsrWifiEventCsrUint16Des
102#define CsrWifiNmeProfileDeleteAllCfmSizeof CsrWifiEventCsrUint16Sizeof
103#define CsrWifiNmeProfileDeleteAllCfmSerFree CsrWifiNmePfree
104
105extern u8* CsrWifiNmeProfileOrderSetCfmSer(u8 *ptr, size_t *len, void *msg);
106extern void* CsrWifiNmeProfileOrderSetCfmDes(u8 *buffer, size_t len);
107extern size_t CsrWifiNmeProfileOrderSetCfmSizeof(void *msg);
108#define CsrWifiNmeProfileOrderSetCfmSerFree CsrWifiNmePfree
109
110extern u8* CsrWifiNmeProfileConnectCfmSer(u8 *ptr, size_t *len, void *msg);
111extern void* CsrWifiNmeProfileConnectCfmDes(u8 *buffer, size_t len);
112extern size_t CsrWifiNmeProfileConnectCfmSizeof(void *msg);
113extern void CsrWifiNmeProfileConnectCfmSerFree(void *msg);
114
115extern u8* CsrWifiNmeWpsCfmSer(u8 *ptr, size_t *len, void *msg);
116extern void* CsrWifiNmeWpsCfmDes(u8 *buffer, size_t len);
117extern size_t CsrWifiNmeWpsCfmSizeof(void *msg);
118extern void CsrWifiNmeWpsCfmSerFree(void *msg);
119
120extern u8* CsrWifiNmeWpsCancelCfmSer(u8 *ptr, size_t *len, void *msg);
121extern void* CsrWifiNmeWpsCancelCfmDes(u8 *buffer, size_t len);
122extern size_t CsrWifiNmeWpsCancelCfmSizeof(void *msg);
123#define CsrWifiNmeWpsCancelCfmSerFree CsrWifiNmePfree
124
125extern u8* CsrWifiNmeConnectionStatusGetCfmSer(u8 *ptr, size_t *len, void *msg);
126extern void* CsrWifiNmeConnectionStatusGetCfmDes(u8 *buffer, size_t len);
127extern size_t CsrWifiNmeConnectionStatusGetCfmSizeof(void *msg);
128#define CsrWifiNmeConnectionStatusGetCfmSerFree CsrWifiNmePfree
129
130extern u8* CsrWifiNmeProfileUpdateIndSer(u8 *ptr, size_t *len, void *msg);
131extern void* CsrWifiNmeProfileUpdateIndDes(u8 *buffer, size_t len);
132extern size_t CsrWifiNmeProfileUpdateIndSizeof(void *msg);
133extern void CsrWifiNmeProfileUpdateIndSerFree(void *msg);
134
135extern u8* CsrWifiNmeProfileDisconnectIndSer(u8 *ptr, size_t *len, void *msg);
136extern void* CsrWifiNmeProfileDisconnectIndDes(u8 *buffer, size_t len);
137extern size_t CsrWifiNmeProfileDisconnectIndSizeof(void *msg);
138extern void CsrWifiNmeProfileDisconnectIndSerFree(void *msg);
139
140#define CsrWifiNmeSimImsiGetIndSer CsrWifiEventSer
141#define CsrWifiNmeSimImsiGetIndDes CsrWifiEventDes
142#define CsrWifiNmeSimImsiGetIndSizeof CsrWifiEventSizeof
143#define CsrWifiNmeSimImsiGetIndSerFree CsrWifiNmePfree
144
145extern u8* CsrWifiNmeSimGsmAuthIndSer(u8 *ptr, size_t *len, void *msg);
146extern void* CsrWifiNmeSimGsmAuthIndDes(u8 *buffer, size_t len);
147extern size_t CsrWifiNmeSimGsmAuthIndSizeof(void *msg);
148extern void CsrWifiNmeSimGsmAuthIndSerFree(void *msg);
149
150extern u8* CsrWifiNmeSimUmtsAuthIndSer(u8 *ptr, size_t *len, void *msg);
151extern void* CsrWifiNmeSimUmtsAuthIndDes(u8 *buffer, size_t len);
152extern size_t CsrWifiNmeSimUmtsAuthIndSizeof(void *msg);
153#define CsrWifiNmeSimUmtsAuthIndSerFree CsrWifiNmePfree
154
155#define CsrWifiNmeWpsConfigSetCfmSer CsrWifiEventCsrUint16Ser
156#define CsrWifiNmeWpsConfigSetCfmDes CsrWifiEventCsrUint16Des
157#define CsrWifiNmeWpsConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof
158#define CsrWifiNmeWpsConfigSetCfmSerFree CsrWifiNmePfree
159
160#define CsrWifiNmeEventMaskSetCfmSer CsrWifiEventCsrUint16Ser
161#define CsrWifiNmeEventMaskSetCfmDes CsrWifiEventCsrUint16Des
162#define CsrWifiNmeEventMaskSetCfmSizeof CsrWifiEventCsrUint16Sizeof
163#define CsrWifiNmeEventMaskSetCfmSerFree CsrWifiNmePfree
164
165#endif /* CSR_WIFI_NME_SERIALIZE_H__ */
166
diff --git a/drivers/staging/csr/csr_wifi_nme_task.h b/drivers/staging/csr/csr_wifi_nme_task.h
deleted file mode 100644
index 84e973a59bb2..000000000000
--- a/drivers/staging/csr/csr_wifi_nme_task.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_NME_TASK_H__
14#define CSR_WIFI_NME_TASK_H__
15
16#include <linux/types.h>
17#include "csr_sched.h"
18
19#ifndef CSR_WIFI_NME_ENABLE
20#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_task.h
21#endif
22
23#define CSR_WIFI_NME_LOG_ID 0x1203FFFF
24extern CsrSchedQid CSR_WIFI_NME_IFACEQUEUE;
25
26#endif /* CSR_WIFI_NME_TASK_H__ */
27
diff --git a/drivers/staging/csr/csr_wifi_private_common.h b/drivers/staging/csr/csr_wifi_private_common.h
deleted file mode 100644
index ee3bd51b934a..000000000000
--- a/drivers/staging/csr/csr_wifi_private_common.h
+++ /dev/null
@@ -1,81 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11#ifndef CSR_WIFI_PRIVATE_COMMON_H__
12#define CSR_WIFI_PRIVATE_COMMON_H__
13
14/**
15 * @brief maximum number of STAs allowed to be connected
16 *
17 * @par Description
18 * min & max Beacon Interval
19 */
20#define CSR_WIFI_AP_MAX_ASSOC_STA 8
21
22/** Number of only b rates */
23#define CSR_WIFI_SME_AP_MAX_ONLY_B_RATES 4
24
25
26/** Number of mandatory b rates */
27#define CSR_WIFI_SME_AP_MAX_MANDATORY_B_RATES 2
28
29
30/** Number of mandatory bg rates */
31#define CSR_WIFI_SME_AP_MAX_MANDATORY_BG_RATES 4
32
33
34/** Number of bg rates */
35#define CSR_WIFI_SME_AP_MAX_BG_RATES 12
36
37
38/** Number of no b only g rates */
39#define CSR_WIFI_SME_AP_MAX_NO_B_ONLY_G_RATES 8
40
41
42/** Number of mandatory g rates */
43#define CSR_WIFI_SME_AP_MAX_MANDATORY_G_RATES 7
44
45
46/* Number of g mandatory rates */
47#define CSR_WIFI_SME_AP_G_MANDATORY_RATES_NUM 7
48
49
50/* Number of b mandatory rates */
51#define CSR_WIFI_SME_AP_B_MANDATORY_RATES_NUM 2
52
53
54/* Number of b/g mandatory rates */
55#define CSR_WIFI_SME_AP_BG_MANDATORY_RATES_NUM 4
56
57
58/* The maximum allowed length of SSID */
59#define CSR_WIFI_SME_AP_SSID_MAX_LENGTH 32
60
61/* Refer 8.4.2.27 RSN element - we support TKIP, WPA2, WAPI and PSK only, no pmkid, group cipher suite */
62#define CSR_WIFI_SME_RSN_PACKED_SIZE (1 + 1 + 2 + 4 + 2 + 4 * 2 + 2 + 4 * 1 + 2 + 24)
63
64/* Refer 7.3.2.9 (ISO/IEC 8802-11:2006) WAPI element - we support WAPI PSK only, no bkid, group cipher suite */
65#define CSR_WIFI_SME_WAPI_PACKED_SIZE (1 + 1 + 2 + 2 + 4 * 1 + 2 + 4 * 1 + 4 + 2 + 24)
66
67
68/* Common structure for NME and SME to maintain Interface mode*/
69typedef u8 CsrWifiInterfaceMode;
70#define CSR_WIFI_MODE_NONE ((CsrWifiInterfaceMode) 0xFF)
71#define CSR_WIFI_MODE_STA ((CsrWifiInterfaceMode) 0x00)
72#define CSR_WIFI_MODE_AP ((CsrWifiInterfaceMode) 0x01)
73#define CSR_WIFI_MODE_P2P_DEVICE ((CsrWifiInterfaceMode) 0x02)
74#define CSR_WIFI_MODE_P2P_CLI ((CsrWifiInterfaceMode) 0x03)
75#define CSR_WIFI_MODE_P2P_GO ((CsrWifiInterfaceMode) 0x04)
76#define CSR_WIFI_MODE_AMP ((CsrWifiInterfaceMode) 0x05)
77#define CSR_WIFI_MODE_WPS_ENROLLEE ((CsrWifiInterfaceMode) 0x06)
78#define CSR_WIFI_MODE_IBSS ((CsrWifiInterfaceMode) 0x07)
79
80#endif
81
diff --git a/drivers/staging/csr/csr_wifi_result.h b/drivers/staging/csr/csr_wifi_result.h
deleted file mode 100644
index 3c394c7e5fa9..000000000000
--- a/drivers/staging/csr/csr_wifi_result.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11#ifndef CSR_WIFI_RESULT_H__
12#define CSR_WIFI_RESULT_H__
13
14#include "csr_result.h"
15
16/* THIS FILE SHOULD CONTAIN ONLY RESULT CODES */
17
18/* Result Codes */
19#define CSR_WIFI_HIP_RESULT_INVALID_VALUE ((CsrResult) 1) /* Invalid argument value */
20#define CSR_WIFI_HIP_RESULT_NO_DEVICE ((CsrResult) 2) /* The specified device is no longer present */
21#define CSR_WIFI_HIP_RESULT_NO_SPACE ((CsrResult) 3) /* A queue or buffer is full */
22#define CSR_WIFI_HIP_RESULT_NO_MEMORY ((CsrResult) 4) /* Fatal error, no memory */
23#define CSR_WIFI_HIP_RESULT_RANGE ((CsrResult) 5) /* Request exceeds the range of a file or a buffer */
24#define CSR_WIFI_HIP_RESULT_NOT_FOUND ((CsrResult) 6) /* A file (typically a f/w patch) is not found */
25
26#endif /* CSR_WIFI_RESULT_H__ */
27
diff --git a/drivers/staging/csr/csr_wifi_router_converter_init.c b/drivers/staging/csr/csr_wifi_router_converter_init.c
deleted file mode 100644
index 775c013d0514..000000000000
--- a/drivers/staging/csr/csr_wifi_router_converter_init.c
+++ /dev/null
@@ -1,82 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#include "csr_msgconv.h"
14#include "csr_macro.h"
15
16
17#ifdef CSR_LOG_ENABLE
18#include "csr_log.h"
19#endif
20
21#ifndef EXCLUDE_CSR_WIFI_ROUTER_MODULE
22#include "csr_wifi_router_serialize.h"
23#include "csr_wifi_router_prim.h"
24
25static CsrMsgConvMsgEntry csrwifirouter_conv_lut[] = {
26 { CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_REQ, CsrWifiRouterMaPacketSubscribeReqSizeof, CsrWifiRouterMaPacketSubscribeReqSer, CsrWifiRouterMaPacketSubscribeReqDes, CsrWifiRouterMaPacketSubscribeReqSerFree },
27 { CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_REQ, CsrWifiRouterMaPacketUnsubscribeReqSizeof, CsrWifiRouterMaPacketUnsubscribeReqSer, CsrWifiRouterMaPacketUnsubscribeReqDes, CsrWifiRouterMaPacketUnsubscribeReqSerFree },
28 { CSR_WIFI_ROUTER_MA_PACKET_REQ, CsrWifiRouterMaPacketReqSizeof, CsrWifiRouterMaPacketReqSer, CsrWifiRouterMaPacketReqDes, CsrWifiRouterMaPacketReqSerFree },
29 { CSR_WIFI_ROUTER_MA_PACKET_RES, CsrWifiRouterMaPacketResSizeof, CsrWifiRouterMaPacketResSer, CsrWifiRouterMaPacketResDes, CsrWifiRouterMaPacketResSerFree },
30 { CSR_WIFI_ROUTER_MA_PACKET_CANCEL_REQ, CsrWifiRouterMaPacketCancelReqSizeof, CsrWifiRouterMaPacketCancelReqSer, CsrWifiRouterMaPacketCancelReqDes, CsrWifiRouterMaPacketCancelReqSerFree },
31 { CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_CFM, CsrWifiRouterMaPacketSubscribeCfmSizeof, CsrWifiRouterMaPacketSubscribeCfmSer, CsrWifiRouterMaPacketSubscribeCfmDes, CsrWifiRouterMaPacketSubscribeCfmSerFree },
32 { CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_CFM, CsrWifiRouterMaPacketUnsubscribeCfmSizeof, CsrWifiRouterMaPacketUnsubscribeCfmSer, CsrWifiRouterMaPacketUnsubscribeCfmDes, CsrWifiRouterMaPacketUnsubscribeCfmSerFree },
33 { CSR_WIFI_ROUTER_MA_PACKET_CFM, CsrWifiRouterMaPacketCfmSizeof, CsrWifiRouterMaPacketCfmSer, CsrWifiRouterMaPacketCfmDes, CsrWifiRouterMaPacketCfmSerFree },
34 { CSR_WIFI_ROUTER_MA_PACKET_IND, CsrWifiRouterMaPacketIndSizeof, CsrWifiRouterMaPacketIndSer, CsrWifiRouterMaPacketIndDes, CsrWifiRouterMaPacketIndSerFree },
35
36 { 0, NULL, NULL, NULL, NULL },
37};
38
39CsrMsgConvMsgEntry* CsrWifiRouterConverterLookup(CsrMsgConvMsgEntry *ce, u16 msgType)
40{
41 if (msgType & CSR_PRIM_UPSTREAM)
42 {
43 u16 idx = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT;
44 if (idx < (CSR_WIFI_ROUTER_PRIM_UPSTREAM_COUNT + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT) &&
45 csrwifirouter_conv_lut[idx].msgType == msgType)
46 {
47 return &csrwifirouter_conv_lut[idx];
48 }
49 }
50 else
51 {
52 if (msgType < CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT &&
53 csrwifirouter_conv_lut[msgType].msgType == msgType)
54 {
55 return &csrwifirouter_conv_lut[msgType];
56 }
57 }
58 return NULL;
59}
60
61
62void CsrWifiRouterConverterInit(void)
63{
64 CsrMsgConvInsert(CSR_WIFI_ROUTER_PRIM, csrwifirouter_conv_lut);
65 CsrMsgConvCustomLookupRegister(CSR_WIFI_ROUTER_PRIM, CsrWifiRouterConverterLookup);
66}
67
68
69#ifdef CSR_LOG_ENABLE
70static const CsrLogPrimitiveInformation csrwifirouter_conv_info = {
71 CSR_WIFI_ROUTER_PRIM,
72 (char *)"CSR_WIFI_ROUTER_PRIM",
73 csrwifirouter_conv_lut
74};
75const CsrLogPrimitiveInformation* CsrWifiRouterTechInfoGet(void)
76{
77 return &csrwifirouter_conv_info;
78}
79
80
81#endif /* CSR_LOG_ENABLE */
82#endif /* EXCLUDE_CSR_WIFI_ROUTER_MODULE */
diff --git a/drivers/staging/csr/csr_wifi_router_converter_init.h b/drivers/staging/csr/csr_wifi_router_converter_init.h
deleted file mode 100644
index 478327b75c18..000000000000
--- a/drivers/staging/csr/csr_wifi_router_converter_init.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_ROUTER_CONVERTER_INIT_H__
14#define CSR_WIFI_ROUTER_CONVERTER_INIT_H__
15
16#ifndef EXCLUDE_CSR_WIFI_ROUTER_MODULE
17
18#include "csr_msgconv.h"
19
20#ifdef CSR_LOG_ENABLE
21#include "csr_log.h"
22
23extern const CsrLogPrimitiveInformation* CsrWifiRouterTechInfoGet(void);
24#endif /* CSR_LOG_ENABLE */
25
26extern void CsrWifiRouterConverterInit(void);
27
28#else /* EXCLUDE_CSR_WIFI_ROUTER_MODULE */
29
30#define CsrWifiRouterConverterInit()
31
32#endif /* EXCLUDE_CSR_WIFI_ROUTER_MODULE */
33
34#endif /* CSR_WIFI_ROUTER_CONVERTER_INIT_H__ */
diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c b/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c
deleted file mode 100644
index a02e307e5a88..000000000000
--- a/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c
+++ /dev/null
@@ -1,134 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#include "csr_msgconv.h"
14#include "csr_macro.h"
15
16#ifdef CSR_LOG_ENABLE
17#include "csr_log.h"
18#endif
19
20#ifndef EXCLUDE_CSR_WIFI_ROUTER_CTRL_MODULE
21#include "csr_wifi_router_ctrl_serialize.h"
22#include "csr_wifi_router_ctrl_prim.h"
23
24static CsrMsgConvMsgEntry csrwifirouterctrl_conv_lut[] = {
25 { CSR_WIFI_ROUTER_CTRL_CONFIGURE_POWER_MODE_REQ, CsrWifiRouterCtrlConfigurePowerModeReqSizeof, CsrWifiRouterCtrlConfigurePowerModeReqSer, CsrWifiRouterCtrlConfigurePowerModeReqDes, CsrWifiRouterCtrlConfigurePowerModeReqSerFree },
26 { CSR_WIFI_ROUTER_CTRL_HIP_REQ, CsrWifiRouterCtrlHipReqSizeof, CsrWifiRouterCtrlHipReqSer, CsrWifiRouterCtrlHipReqDes, CsrWifiRouterCtrlHipReqSerFree },
27 { CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_REQ, CsrWifiRouterCtrlMediaStatusReqSizeof, CsrWifiRouterCtrlMediaStatusReqSer, CsrWifiRouterCtrlMediaStatusReqDes, CsrWifiRouterCtrlMediaStatusReqSerFree },
28 { CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_RES, CsrWifiRouterCtrlMulticastAddressResSizeof, CsrWifiRouterCtrlMulticastAddressResSer, CsrWifiRouterCtrlMulticastAddressResDes, CsrWifiRouterCtrlMulticastAddressResSerFree },
29 { CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_REQ, CsrWifiRouterCtrlPortConfigureReqSizeof, CsrWifiRouterCtrlPortConfigureReqSer, CsrWifiRouterCtrlPortConfigureReqDes, CsrWifiRouterCtrlPortConfigureReqSerFree },
30 { CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_REQ, CsrWifiRouterCtrlQosControlReqSizeof, CsrWifiRouterCtrlQosControlReqSer, CsrWifiRouterCtrlQosControlReqDes, CsrWifiRouterCtrlQosControlReqSerFree },
31 { CSR_WIFI_ROUTER_CTRL_SUSPEND_RES, CsrWifiRouterCtrlSuspendResSizeof, CsrWifiRouterCtrlSuspendResSer, CsrWifiRouterCtrlSuspendResDes, CsrWifiRouterCtrlSuspendResSerFree },
32 { CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_REQ, CsrWifiRouterCtrlTclasAddReqSizeof, CsrWifiRouterCtrlTclasAddReqSer, CsrWifiRouterCtrlTclasAddReqDes, CsrWifiRouterCtrlTclasAddReqSerFree },
33 { CSR_WIFI_ROUTER_CTRL_RESUME_RES, CsrWifiRouterCtrlResumeResSizeof, CsrWifiRouterCtrlResumeResSer, CsrWifiRouterCtrlResumeResDes, CsrWifiRouterCtrlResumeResSerFree },
34 { CSR_WIFI_ROUTER_CTRL_RAW_SDIO_DEINITIALISE_REQ, CsrWifiRouterCtrlRawSdioDeinitialiseReqSizeof, CsrWifiRouterCtrlRawSdioDeinitialiseReqSer, CsrWifiRouterCtrlRawSdioDeinitialiseReqDes, CsrWifiRouterCtrlRawSdioDeinitialiseReqSerFree },
35 { CSR_WIFI_ROUTER_CTRL_RAW_SDIO_INITIALISE_REQ, CsrWifiRouterCtrlRawSdioInitialiseReqSizeof, CsrWifiRouterCtrlRawSdioInitialiseReqSer, CsrWifiRouterCtrlRawSdioInitialiseReqDes, CsrWifiRouterCtrlRawSdioInitialiseReqSerFree },
36 { CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_REQ, CsrWifiRouterCtrlTclasDelReqSizeof, CsrWifiRouterCtrlTclasDelReqSer, CsrWifiRouterCtrlTclasDelReqDes, CsrWifiRouterCtrlTclasDelReqSerFree },
37 { CSR_WIFI_ROUTER_CTRL_TRAFFIC_CLASSIFICATION_REQ, CsrWifiRouterCtrlTrafficClassificationReqSizeof, CsrWifiRouterCtrlTrafficClassificationReqSer, CsrWifiRouterCtrlTrafficClassificationReqDes, CsrWifiRouterCtrlTrafficClassificationReqSerFree },
38 { CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_REQ, CsrWifiRouterCtrlTrafficConfigReqSizeof, CsrWifiRouterCtrlTrafficConfigReqSer, CsrWifiRouterCtrlTrafficConfigReqDes, CsrWifiRouterCtrlTrafficConfigReqSerFree },
39 { CSR_WIFI_ROUTER_CTRL_WIFI_OFF_REQ, CsrWifiRouterCtrlWifiOffReqSizeof, CsrWifiRouterCtrlWifiOffReqSer, CsrWifiRouterCtrlWifiOffReqDes, CsrWifiRouterCtrlWifiOffReqSerFree },
40 { CSR_WIFI_ROUTER_CTRL_WIFI_OFF_RES, CsrWifiRouterCtrlWifiOffResSizeof, CsrWifiRouterCtrlWifiOffResSer, CsrWifiRouterCtrlWifiOffResDes, CsrWifiRouterCtrlWifiOffResSerFree },
41 { CSR_WIFI_ROUTER_CTRL_WIFI_ON_REQ, CsrWifiRouterCtrlWifiOnReqSizeof, CsrWifiRouterCtrlWifiOnReqSer, CsrWifiRouterCtrlWifiOnReqDes, CsrWifiRouterCtrlWifiOnReqSerFree },
42 { CSR_WIFI_ROUTER_CTRL_WIFI_ON_RES, CsrWifiRouterCtrlWifiOnResSizeof, CsrWifiRouterCtrlWifiOnResSer, CsrWifiRouterCtrlWifiOnResDes, CsrWifiRouterCtrlWifiOnResSerFree },
43 { CSR_WIFI_ROUTER_CTRL_M4_TRANSMIT_REQ, CsrWifiRouterCtrlM4TransmitReqSizeof, CsrWifiRouterCtrlM4TransmitReqSer, CsrWifiRouterCtrlM4TransmitReqDes, CsrWifiRouterCtrlM4TransmitReqSerFree },
44 { CSR_WIFI_ROUTER_CTRL_MODE_SET_REQ, CsrWifiRouterCtrlModeSetReqSizeof, CsrWifiRouterCtrlModeSetReqSer, CsrWifiRouterCtrlModeSetReqDes, CsrWifiRouterCtrlModeSetReqSerFree },
45 { CSR_WIFI_ROUTER_CTRL_PEER_ADD_REQ, CsrWifiRouterCtrlPeerAddReqSizeof, CsrWifiRouterCtrlPeerAddReqSer, CsrWifiRouterCtrlPeerAddReqDes, CsrWifiRouterCtrlPeerAddReqSerFree },
46 { CSR_WIFI_ROUTER_CTRL_PEER_DEL_REQ, CsrWifiRouterCtrlPeerDelReqSizeof, CsrWifiRouterCtrlPeerDelReqSer, CsrWifiRouterCtrlPeerDelReqDes, CsrWifiRouterCtrlPeerDelReqSerFree },
47 { CSR_WIFI_ROUTER_CTRL_PEER_UPDATE_REQ, CsrWifiRouterCtrlPeerUpdateReqSizeof, CsrWifiRouterCtrlPeerUpdateReqSer, CsrWifiRouterCtrlPeerUpdateReqDes, CsrWifiRouterCtrlPeerUpdateReqSerFree },
48 { CSR_WIFI_ROUTER_CTRL_CAPABILITIES_REQ, CsrWifiRouterCtrlCapabilitiesReqSizeof, CsrWifiRouterCtrlCapabilitiesReqSer, CsrWifiRouterCtrlCapabilitiesReqDes, CsrWifiRouterCtrlCapabilitiesReqSerFree },
49 { CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_REQ, CsrWifiRouterCtrlBlockAckEnableReqSizeof, CsrWifiRouterCtrlBlockAckEnableReqSer, CsrWifiRouterCtrlBlockAckEnableReqDes, CsrWifiRouterCtrlBlockAckEnableReqSerFree },
50 { CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_REQ, CsrWifiRouterCtrlBlockAckDisableReqSizeof, CsrWifiRouterCtrlBlockAckDisableReqSer, CsrWifiRouterCtrlBlockAckDisableReqDes, CsrWifiRouterCtrlBlockAckDisableReqSerFree },
51 { CSR_WIFI_ROUTER_CTRL_WAPI_RX_PKT_REQ, CsrWifiRouterCtrlWapiRxPktReqSizeof, CsrWifiRouterCtrlWapiRxPktReqSer, CsrWifiRouterCtrlWapiRxPktReqDes, CsrWifiRouterCtrlWapiRxPktReqSerFree },
52 { CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_FILTER_REQ, CsrWifiRouterCtrlWapiMulticastFilterReqSizeof, CsrWifiRouterCtrlWapiMulticastFilterReqSer, CsrWifiRouterCtrlWapiMulticastFilterReqDes, CsrWifiRouterCtrlWapiMulticastFilterReqSerFree },
53 { CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_FILTER_REQ, CsrWifiRouterCtrlWapiUnicastFilterReqSizeof, CsrWifiRouterCtrlWapiUnicastFilterReqSer, CsrWifiRouterCtrlWapiUnicastFilterReqDes, CsrWifiRouterCtrlWapiUnicastFilterReqSerFree },
54 { CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_PKT_REQ, CsrWifiRouterCtrlWapiUnicastTxPktReqSizeof, CsrWifiRouterCtrlWapiUnicastTxPktReqSer, CsrWifiRouterCtrlWapiUnicastTxPktReqDes, CsrWifiRouterCtrlWapiUnicastTxPktReqSerFree },
55 { CSR_WIFI_ROUTER_CTRL_WAPI_FILTER_REQ, CsrWifiRouterCtrlWapiFilterReqSizeof, CsrWifiRouterCtrlWapiFilterReqSer, CsrWifiRouterCtrlWapiFilterReqDes, CsrWifiRouterCtrlWapiFilterReqSerFree },
56 { CSR_WIFI_ROUTER_CTRL_HIP_IND, CsrWifiRouterCtrlHipIndSizeof, CsrWifiRouterCtrlHipIndSer, CsrWifiRouterCtrlHipIndDes, CsrWifiRouterCtrlHipIndSerFree },
57 { CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_IND, CsrWifiRouterCtrlMulticastAddressIndSizeof, CsrWifiRouterCtrlMulticastAddressIndSer, CsrWifiRouterCtrlMulticastAddressIndDes, CsrWifiRouterCtrlMulticastAddressIndSerFree },
58 { CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_CFM, CsrWifiRouterCtrlPortConfigureCfmSizeof, CsrWifiRouterCtrlPortConfigureCfmSer, CsrWifiRouterCtrlPortConfigureCfmDes, CsrWifiRouterCtrlPortConfigureCfmSerFree },
59 { CSR_WIFI_ROUTER_CTRL_RESUME_IND, CsrWifiRouterCtrlResumeIndSizeof, CsrWifiRouterCtrlResumeIndSer, CsrWifiRouterCtrlResumeIndDes, CsrWifiRouterCtrlResumeIndSerFree },
60 { CSR_WIFI_ROUTER_CTRL_SUSPEND_IND, CsrWifiRouterCtrlSuspendIndSizeof, CsrWifiRouterCtrlSuspendIndSer, CsrWifiRouterCtrlSuspendIndDes, CsrWifiRouterCtrlSuspendIndSerFree },
61 { CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_CFM, CsrWifiRouterCtrlTclasAddCfmSizeof, CsrWifiRouterCtrlTclasAddCfmSer, CsrWifiRouterCtrlTclasAddCfmDes, CsrWifiRouterCtrlTclasAddCfmSerFree },
62 { CSR_WIFI_ROUTER_CTRL_RAW_SDIO_DEINITIALISE_CFM, CsrWifiRouterCtrlRawSdioDeinitialiseCfmSizeof, CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer, CsrWifiRouterCtrlRawSdioDeinitialiseCfmDes, CsrWifiRouterCtrlRawSdioDeinitialiseCfmSerFree },
63 { CSR_WIFI_ROUTER_CTRL_RAW_SDIO_INITIALISE_CFM, CsrWifiRouterCtrlRawSdioInitialiseCfmSizeof, CsrWifiRouterCtrlRawSdioInitialiseCfmSer, CsrWifiRouterCtrlRawSdioInitialiseCfmDes, CsrWifiRouterCtrlRawSdioInitialiseCfmSerFree },
64 { CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_CFM, CsrWifiRouterCtrlTclasDelCfmSizeof, CsrWifiRouterCtrlTclasDelCfmSer, CsrWifiRouterCtrlTclasDelCfmDes, CsrWifiRouterCtrlTclasDelCfmSerFree },
65 { CSR_WIFI_ROUTER_CTRL_TRAFFIC_PROTOCOL_IND, CsrWifiRouterCtrlTrafficProtocolIndSizeof, CsrWifiRouterCtrlTrafficProtocolIndSer, CsrWifiRouterCtrlTrafficProtocolIndDes, CsrWifiRouterCtrlTrafficProtocolIndSerFree },
66 { CSR_WIFI_ROUTER_CTRL_TRAFFIC_SAMPLE_IND, CsrWifiRouterCtrlTrafficSampleIndSizeof, CsrWifiRouterCtrlTrafficSampleIndSer, CsrWifiRouterCtrlTrafficSampleIndDes, CsrWifiRouterCtrlTrafficSampleIndSerFree },
67 { CSR_WIFI_ROUTER_CTRL_WIFI_OFF_IND, CsrWifiRouterCtrlWifiOffIndSizeof, CsrWifiRouterCtrlWifiOffIndSer, CsrWifiRouterCtrlWifiOffIndDes, CsrWifiRouterCtrlWifiOffIndSerFree },
68 { CSR_WIFI_ROUTER_CTRL_WIFI_OFF_CFM, CsrWifiRouterCtrlWifiOffCfmSizeof, CsrWifiRouterCtrlWifiOffCfmSer, CsrWifiRouterCtrlWifiOffCfmDes, CsrWifiRouterCtrlWifiOffCfmSerFree },
69 { CSR_WIFI_ROUTER_CTRL_WIFI_ON_IND, CsrWifiRouterCtrlWifiOnIndSizeof, CsrWifiRouterCtrlWifiOnIndSer, CsrWifiRouterCtrlWifiOnIndDes, CsrWifiRouterCtrlWifiOnIndSerFree },
70 { CSR_WIFI_ROUTER_CTRL_WIFI_ON_CFM, CsrWifiRouterCtrlWifiOnCfmSizeof, CsrWifiRouterCtrlWifiOnCfmSer, CsrWifiRouterCtrlWifiOnCfmDes, CsrWifiRouterCtrlWifiOnCfmSerFree },
71 { CSR_WIFI_ROUTER_CTRL_M4_READY_TO_SEND_IND, CsrWifiRouterCtrlM4ReadyToSendIndSizeof, CsrWifiRouterCtrlM4ReadyToSendIndSer, CsrWifiRouterCtrlM4ReadyToSendIndDes, CsrWifiRouterCtrlM4ReadyToSendIndSerFree },
72 { CSR_WIFI_ROUTER_CTRL_M4_TRANSMITTED_IND, CsrWifiRouterCtrlM4TransmittedIndSizeof, CsrWifiRouterCtrlM4TransmittedIndSer, CsrWifiRouterCtrlM4TransmittedIndDes, CsrWifiRouterCtrlM4TransmittedIndSerFree },
73 { CSR_WIFI_ROUTER_CTRL_MIC_FAILURE_IND, CsrWifiRouterCtrlMicFailureIndSizeof, CsrWifiRouterCtrlMicFailureIndSer, CsrWifiRouterCtrlMicFailureIndDes, CsrWifiRouterCtrlMicFailureIndSerFree },
74 { CSR_WIFI_ROUTER_CTRL_CONNECTED_IND, CsrWifiRouterCtrlConnectedIndSizeof, CsrWifiRouterCtrlConnectedIndSer, CsrWifiRouterCtrlConnectedIndDes, CsrWifiRouterCtrlConnectedIndSerFree },
75 { CSR_WIFI_ROUTER_CTRL_PEER_ADD_CFM, CsrWifiRouterCtrlPeerAddCfmSizeof, CsrWifiRouterCtrlPeerAddCfmSer, CsrWifiRouterCtrlPeerAddCfmDes, CsrWifiRouterCtrlPeerAddCfmSerFree },
76 { CSR_WIFI_ROUTER_CTRL_PEER_DEL_CFM, CsrWifiRouterCtrlPeerDelCfmSizeof, CsrWifiRouterCtrlPeerDelCfmSer, CsrWifiRouterCtrlPeerDelCfmDes, CsrWifiRouterCtrlPeerDelCfmSerFree },
77 { CSR_WIFI_ROUTER_CTRL_UNEXPECTED_FRAME_IND, CsrWifiRouterCtrlUnexpectedFrameIndSizeof, CsrWifiRouterCtrlUnexpectedFrameIndSer, CsrWifiRouterCtrlUnexpectedFrameIndDes, CsrWifiRouterCtrlUnexpectedFrameIndSerFree },
78 { CSR_WIFI_ROUTER_CTRL_PEER_UPDATE_CFM, CsrWifiRouterCtrlPeerUpdateCfmSizeof, CsrWifiRouterCtrlPeerUpdateCfmSer, CsrWifiRouterCtrlPeerUpdateCfmDes, CsrWifiRouterCtrlPeerUpdateCfmSerFree },
79 { CSR_WIFI_ROUTER_CTRL_CAPABILITIES_CFM, CsrWifiRouterCtrlCapabilitiesCfmSizeof, CsrWifiRouterCtrlCapabilitiesCfmSer, CsrWifiRouterCtrlCapabilitiesCfmDes, CsrWifiRouterCtrlCapabilitiesCfmSerFree },
80 { CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_CFM, CsrWifiRouterCtrlBlockAckEnableCfmSizeof, CsrWifiRouterCtrlBlockAckEnableCfmSer, CsrWifiRouterCtrlBlockAckEnableCfmDes, CsrWifiRouterCtrlBlockAckEnableCfmSerFree },
81 { CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_CFM, CsrWifiRouterCtrlBlockAckDisableCfmSizeof, CsrWifiRouterCtrlBlockAckDisableCfmSer, CsrWifiRouterCtrlBlockAckDisableCfmDes, CsrWifiRouterCtrlBlockAckDisableCfmSerFree },
82 { CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ERROR_IND, CsrWifiRouterCtrlBlockAckErrorIndSizeof, CsrWifiRouterCtrlBlockAckErrorIndSer, CsrWifiRouterCtrlBlockAckErrorIndDes, CsrWifiRouterCtrlBlockAckErrorIndSerFree },
83 { CSR_WIFI_ROUTER_CTRL_STA_INACTIVE_IND, CsrWifiRouterCtrlStaInactiveIndSizeof, CsrWifiRouterCtrlStaInactiveIndSer, CsrWifiRouterCtrlStaInactiveIndDes, CsrWifiRouterCtrlStaInactiveIndSerFree },
84 { CSR_WIFI_ROUTER_CTRL_WAPI_RX_MIC_CHECK_IND, CsrWifiRouterCtrlWapiRxMicCheckIndSizeof, CsrWifiRouterCtrlWapiRxMicCheckIndSer, CsrWifiRouterCtrlWapiRxMicCheckIndDes, CsrWifiRouterCtrlWapiRxMicCheckIndSerFree },
85 { CSR_WIFI_ROUTER_CTRL_MODE_SET_CFM, CsrWifiRouterCtrlModeSetCfmSizeof, CsrWifiRouterCtrlModeSetCfmSer, CsrWifiRouterCtrlModeSetCfmDes, CsrWifiRouterCtrlModeSetCfmSerFree },
86 { CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_ENCRYPT_IND, CsrWifiRouterCtrlWapiUnicastTxEncryptIndSizeof, CsrWifiRouterCtrlWapiUnicastTxEncryptIndSer, CsrWifiRouterCtrlWapiUnicastTxEncryptIndDes, CsrWifiRouterCtrlWapiUnicastTxEncryptIndSerFree },
87
88 { 0, NULL, NULL, NULL, NULL },
89};
90
91CsrMsgConvMsgEntry* CsrWifiRouterCtrlConverterLookup(CsrMsgConvMsgEntry *ce, u16 msgType)
92{
93 if (msgType & CSR_PRIM_UPSTREAM)
94 {
95 u16 idx = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT;
96 if (idx < (CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_COUNT + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT) &&
97 csrwifirouterctrl_conv_lut[idx].msgType == msgType)
98 {
99 return &csrwifirouterctrl_conv_lut[idx];
100 }
101 }
102 else
103 {
104 if (msgType < CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT &&
105 csrwifirouterctrl_conv_lut[msgType].msgType == msgType)
106 {
107 return &csrwifirouterctrl_conv_lut[msgType];
108 }
109 }
110 return NULL;
111}
112
113
114void CsrWifiRouterCtrlConverterInit(void)
115{
116 CsrMsgConvInsert(CSR_WIFI_ROUTER_CTRL_PRIM, csrwifirouterctrl_conv_lut);
117 CsrMsgConvCustomLookupRegister(CSR_WIFI_ROUTER_CTRL_PRIM, CsrWifiRouterCtrlConverterLookup);
118}
119
120
121#ifdef CSR_LOG_ENABLE
122static const CsrLogPrimitiveInformation csrwifirouterctrl_conv_info = {
123 CSR_WIFI_ROUTER_CTRL_PRIM,
124 (char *)"CSR_WIFI_ROUTER_CTRL_PRIM",
125 csrwifirouterctrl_conv_lut
126};
127const CsrLogPrimitiveInformation* CsrWifiRouterCtrlTechInfoGet(void)
128{
129 return &csrwifirouterctrl_conv_info;
130}
131
132
133#endif /* CSR_LOG_ENABLE */
134#endif /* EXCLUDE_CSR_WIFI_ROUTER_CTRL_MODULE */
diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.h b/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.h
deleted file mode 100644
index c98458912825..000000000000
--- a/drivers/staging/csr/csr_wifi_router_ctrl_converter_init.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_ROUTER_CTRL_CONVERTER_INIT_H__
14#define CSR_WIFI_ROUTER_CTRL_CONVERTER_INIT_H__
15
16#ifndef EXCLUDE_CSR_WIFI_ROUTER_CTRL_MODULE
17
18#include "csr_msgconv.h"
19
20#ifdef CSR_LOG_ENABLE
21#include "csr_log.h"
22
23extern const CsrLogPrimitiveInformation* CsrWifiRouterCtrlTechInfoGet(void);
24#endif /* CSR_LOG_ENABLE */
25
26extern void CsrWifiRouterCtrlConverterInit(void);
27
28#else /* EXCLUDE_CSR_WIFI_ROUTER_CTRL_MODULE */
29
30#define CsrWifiRouterCtrlConverterInit()
31
32#endif /* EXCLUDE_CSR_WIFI_ROUTER_CTRL_MODULE */
33
34#endif /* CSR_WIFI_ROUTER_CTRL_CONVERTER_INIT_H__ */
diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c
deleted file mode 100644
index 7fa85fb4d6c0..000000000000
--- a/drivers/staging/csr/csr_wifi_router_ctrl_free_downstream_contents.c
+++ /dev/null
@@ -1,108 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12#include <linux/slab.h>
13#include "csr_wifi_router_ctrl_prim.h"
14#include "csr_wifi_router_ctrl_lib.h"
15
16/*----------------------------------------------------------------------------*
17 * NAME
18 * CsrWifiRouterCtrlFreeDownstreamMessageContents
19 *
20 * DESCRIPTION
21 *
22 *
23 * PARAMETERS
24 * eventClass: only the value CSR_WIFI_ROUTER_CTRL_PRIM will be handled
25 * message: the message to free
26 *----------------------------------------------------------------------------*/
27void CsrWifiRouterCtrlFreeDownstreamMessageContents(u16 eventClass, void *message)
28{
29 if (eventClass != CSR_WIFI_ROUTER_CTRL_PRIM)
30 {
31 return;
32 }
33 if (NULL == message)
34 {
35 return;
36 }
37
38 switch (*((CsrWifiRouterCtrlPrim *) message))
39 {
40 case CSR_WIFI_ROUTER_CTRL_HIP_REQ:
41 {
42 CsrWifiRouterCtrlHipReq *p = (CsrWifiRouterCtrlHipReq *)message;
43 kfree(p->mlmeCommand);
44 p->mlmeCommand = NULL;
45 kfree(p->dataRef1);
46 p->dataRef1 = NULL;
47 kfree(p->dataRef2);
48 p->dataRef2 = NULL;
49 break;
50 }
51 case CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_RES:
52 {
53 CsrWifiRouterCtrlMulticastAddressRes *p = (CsrWifiRouterCtrlMulticastAddressRes *)message;
54 kfree(p->getAddresses);
55 p->getAddresses = NULL;
56 break;
57 }
58 case CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_REQ:
59 {
60 CsrWifiRouterCtrlTclasAddReq *p = (CsrWifiRouterCtrlTclasAddReq *)message;
61 kfree(p->tclas);
62 p->tclas = NULL;
63 break;
64 }
65 case CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_REQ:
66 {
67 CsrWifiRouterCtrlTclasDelReq *p = (CsrWifiRouterCtrlTclasDelReq *)message;
68 kfree(p->tclas);
69 p->tclas = NULL;
70 break;
71 }
72 case CSR_WIFI_ROUTER_CTRL_WIFI_ON_REQ:
73 {
74 CsrWifiRouterCtrlWifiOnReq *p = (CsrWifiRouterCtrlWifiOnReq *)message;
75 kfree(p->data);
76 p->data = NULL;
77 break;
78 }
79 case CSR_WIFI_ROUTER_CTRL_WIFI_ON_RES:
80 {
81 CsrWifiRouterCtrlWifiOnRes *p = (CsrWifiRouterCtrlWifiOnRes *)message;
82 kfree(p->smeVersions.smeBuild);
83 p->smeVersions.smeBuild = NULL;
84 break;
85 }
86 case CSR_WIFI_ROUTER_CTRL_WAPI_RX_PKT_REQ:
87 {
88 CsrWifiRouterCtrlWapiRxPktReq *p = (CsrWifiRouterCtrlWapiRxPktReq *)message;
89 kfree(p->signal);
90 p->signal = NULL;
91 kfree(p->data);
92 p->data = NULL;
93 break;
94 }
95 case CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_PKT_REQ:
96 {
97 CsrWifiRouterCtrlWapiUnicastTxPktReq *p = (CsrWifiRouterCtrlWapiUnicastTxPktReq *)message;
98 kfree(p->data);
99 p->data = NULL;
100 break;
101 }
102
103 default:
104 break;
105 }
106}
107
108
diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c
deleted file mode 100644
index 954b3defc49c..000000000000
--- a/drivers/staging/csr/csr_wifi_router_ctrl_free_upstream_contents.c
+++ /dev/null
@@ -1,87 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12#include <linux/slab.h>
13#include "csr_wifi_router_ctrl_prim.h"
14#include "csr_wifi_router_ctrl_lib.h"
15
16/*----------------------------------------------------------------------------*
17 * NAME
18 * CsrWifiRouterCtrlFreeUpstreamMessageContents
19 *
20 * DESCRIPTION
21 *
22 *
23 * PARAMETERS
24 * eventClass: only the value CSR_WIFI_ROUTER_CTRL_PRIM will be handled
25 * message: the message to free
26 *----------------------------------------------------------------------------*/
27void CsrWifiRouterCtrlFreeUpstreamMessageContents(u16 eventClass, void *message)
28{
29 if (eventClass != CSR_WIFI_ROUTER_CTRL_PRIM)
30 {
31 return;
32 }
33 if (NULL == message)
34 {
35 return;
36 }
37
38 switch (*((CsrWifiRouterCtrlPrim *) message))
39 {
40 case CSR_WIFI_ROUTER_CTRL_HIP_IND:
41 {
42 CsrWifiRouterCtrlHipInd *p = (CsrWifiRouterCtrlHipInd *)message;
43 kfree(p->mlmeCommand);
44 p->mlmeCommand = NULL;
45 kfree(p->dataRef1);
46 p->dataRef1 = NULL;
47 kfree(p->dataRef2);
48 p->dataRef2 = NULL;
49 break;
50 }
51 case CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_IND:
52 {
53 CsrWifiRouterCtrlMulticastAddressInd *p = (CsrWifiRouterCtrlMulticastAddressInd *)message;
54 kfree(p->setAddresses);
55 p->setAddresses = NULL;
56 break;
57 }
58 case CSR_WIFI_ROUTER_CTRL_WIFI_ON_IND:
59 {
60 CsrWifiRouterCtrlWifiOnInd *p = (CsrWifiRouterCtrlWifiOnInd *)message;
61 kfree(p->versions.routerBuild);
62 p->versions.routerBuild = NULL;
63 break;
64 }
65 case CSR_WIFI_ROUTER_CTRL_WAPI_RX_MIC_CHECK_IND:
66 {
67 CsrWifiRouterCtrlWapiRxMicCheckInd *p = (CsrWifiRouterCtrlWapiRxMicCheckInd *)message;
68 kfree(p->signal);
69 p->signal = NULL;
70 kfree(p->data);
71 p->data = NULL;
72 break;
73 }
74 case CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_ENCRYPT_IND:
75 {
76 CsrWifiRouterCtrlWapiUnicastTxEncryptInd *p = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *)message;
77 kfree(p->data);
78 p->data = NULL;
79 break;
80 }
81
82 default:
83 break;
84 }
85}
86
87
diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_lib.h b/drivers/staging/csr/csr_wifi_router_ctrl_lib.h
deleted file mode 100644
index f235153c42af..000000000000
--- a/drivers/staging/csr/csr_wifi_router_ctrl_lib.h
+++ /dev/null
@@ -1,2082 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_ROUTER_CTRL_LIB_H__
14#define CSR_WIFI_ROUTER_CTRL_LIB_H__
15
16#include "csr_sched.h"
17#include "csr_macro.h"
18#include "csr_msg_transport.h"
19
20#include "csr_wifi_lib.h"
21
22#include "csr_wifi_router_ctrl_prim.h"
23#include "csr_wifi_router_task.h"
24
25/*----------------------------------------------------------------------------*
26 * CsrWifiRouterCtrlFreeUpstreamMessageContents
27 *
28 * DESCRIPTION
29 * Free the allocated memory in a CSR_WIFI_ROUTER_CTRL upstream message. Does not
30 * free the message itself, and can only be used for upstream messages.
31 *
32 * PARAMETERS
33 * Deallocates the resources in a CSR_WIFI_ROUTER_CTRL upstream message
34 *----------------------------------------------------------------------------*/
35void CsrWifiRouterCtrlFreeUpstreamMessageContents(u16 eventClass, void *message);
36
37/*----------------------------------------------------------------------------*
38 * CsrWifiRouterCtrlFreeDownstreamMessageContents
39 *
40 * DESCRIPTION
41 * Free the allocated memory in a CSR_WIFI_ROUTER_CTRL downstream message. Does not
42 * free the message itself, and can only be used for downstream messages.
43 *
44 * PARAMETERS
45 * Deallocates the resources in a CSR_WIFI_ROUTER_CTRL downstream message
46 *----------------------------------------------------------------------------*/
47void CsrWifiRouterCtrlFreeDownstreamMessageContents(u16 eventClass, void *message);
48
49/*----------------------------------------------------------------------------*
50 * Enum to string functions
51 *----------------------------------------------------------------------------*/
52const char* CsrWifiRouterCtrlBlockAckRoleToString(CsrWifiRouterCtrlBlockAckRole value);
53const char* CsrWifiRouterCtrlControlIndicationToString(CsrWifiRouterCtrlControlIndication value);
54const char* CsrWifiRouterCtrlListActionToString(CsrWifiRouterCtrlListAction value);
55const char* CsrWifiRouterCtrlLowPowerModeToString(CsrWifiRouterCtrlLowPowerMode value);
56const char* CsrWifiRouterCtrlMediaStatusToString(CsrWifiRouterCtrlMediaStatus value);
57const char* CsrWifiRouterCtrlModeToString(CsrWifiRouterCtrlMode value);
58const char* CsrWifiRouterCtrlPeerStatusToString(CsrWifiRouterCtrlPeerStatus value);
59const char* CsrWifiRouterCtrlPortActionToString(CsrWifiRouterCtrlPortAction value);
60const char* CsrWifiRouterCtrlPowersaveTypeToString(CsrWifiRouterCtrlPowersaveType value);
61const char* CsrWifiRouterCtrlProtocolDirectionToString(CsrWifiRouterCtrlProtocolDirection value);
62const char* CsrWifiRouterCtrlQoSControlToString(CsrWifiRouterCtrlQoSControl value);
63const char* CsrWifiRouterCtrlQueueConfigToString(CsrWifiRouterCtrlQueueConfig value);
64const char* CsrWifiRouterCtrlTrafficConfigTypeToString(CsrWifiRouterCtrlTrafficConfigType value);
65const char* CsrWifiRouterCtrlTrafficPacketTypeToString(CsrWifiRouterCtrlTrafficPacketType value);
66const char* CsrWifiRouterCtrlTrafficTypeToString(CsrWifiRouterCtrlTrafficType value);
67
68
69/*----------------------------------------------------------------------------*
70 * CsrPrim Type toString function.
71 * Converts a message type to the String name of the Message
72 *----------------------------------------------------------------------------*/
73const char* CsrWifiRouterCtrlPrimTypeToString(CsrPrim msgType);
74
75/*----------------------------------------------------------------------------*
76 * Lookup arrays for PrimType name Strings
77 *----------------------------------------------------------------------------*/
78extern const char *CsrWifiRouterCtrlUpstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_COUNT];
79extern const char *CsrWifiRouterCtrlDownstreamPrimNames[CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT];
80
81/*******************************************************************************
82
83 NAME
84 CsrWifiRouterCtrlBlockAckDisableReqSend
85
86 DESCRIPTION
87
88 PARAMETERS
89 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
90 interfaceTag -
91 clientData -
92 macAddress -
93 trafficStreamID -
94 role -
95
96*******************************************************************************/
97#define CsrWifiRouterCtrlBlockAckDisableReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__) \
98 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckDisableReq), GFP_KERNEL); \
99 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_REQ, dst__, src__); \
100 msg__->interfaceTag = (interfaceTag__); \
101 msg__->clientData = (clientData__); \
102 msg__->macAddress = (macAddress__); \
103 msg__->trafficStreamID = (trafficStreamID__); \
104 msg__->role = (role__);
105
106#define CsrWifiRouterCtrlBlockAckDisableReqSendTo(dst__, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__) \
107 { \
108 CsrWifiRouterCtrlBlockAckDisableReq *msg__; \
109 CsrWifiRouterCtrlBlockAckDisableReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__); \
110 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
111 }
112
113#define CsrWifiRouterCtrlBlockAckDisableReqSend(src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__) \
114 CsrWifiRouterCtrlBlockAckDisableReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__)
115
116/*******************************************************************************
117
118 NAME
119 CsrWifiRouterCtrlBlockAckDisableCfmSend
120
121 DESCRIPTION
122
123 PARAMETERS
124 queue - Destination Task Queue
125 clientData -
126 interfaceTag -
127 status -
128
129*******************************************************************************/
130#define CsrWifiRouterCtrlBlockAckDisableCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \
131 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckDisableCfm), GFP_KERNEL); \
132 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_CFM, dst__, src__); \
133 msg__->clientData = (clientData__); \
134 msg__->interfaceTag = (interfaceTag__); \
135 msg__->status = (status__);
136
137#define CsrWifiRouterCtrlBlockAckDisableCfmSendTo(dst__, src__, clientData__, interfaceTag__, status__) \
138 { \
139 CsrWifiRouterCtrlBlockAckDisableCfm *msg__; \
140 CsrWifiRouterCtrlBlockAckDisableCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__); \
141 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
142 }
143
144#define CsrWifiRouterCtrlBlockAckDisableCfmSend(dst__, clientData__, interfaceTag__, status__) \
145 CsrWifiRouterCtrlBlockAckDisableCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, status__)
146
147/*******************************************************************************
148
149 NAME
150 CsrWifiRouterCtrlBlockAckEnableReqSend
151
152 DESCRIPTION
153
154 PARAMETERS
155 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
156 interfaceTag -
157 clientData -
158 macAddress -
159 trafficStreamID -
160 role -
161 bufferSize -
162 timeout -
163 ssn -
164
165*******************************************************************************/
166#define CsrWifiRouterCtrlBlockAckEnableReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__, bufferSize__, timeout__, ssn__) \
167 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckEnableReq), GFP_KERNEL); \
168 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_REQ, dst__, src__); \
169 msg__->interfaceTag = (interfaceTag__); \
170 msg__->clientData = (clientData__); \
171 msg__->macAddress = (macAddress__); \
172 msg__->trafficStreamID = (trafficStreamID__); \
173 msg__->role = (role__); \
174 msg__->bufferSize = (bufferSize__); \
175 msg__->timeout = (timeout__); \
176 msg__->ssn = (ssn__);
177
178#define CsrWifiRouterCtrlBlockAckEnableReqSendTo(dst__, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__, bufferSize__, timeout__, ssn__) \
179 { \
180 CsrWifiRouterCtrlBlockAckEnableReq *msg__; \
181 CsrWifiRouterCtrlBlockAckEnableReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__, bufferSize__, timeout__, ssn__); \
182 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
183 }
184
185#define CsrWifiRouterCtrlBlockAckEnableReqSend(src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__, bufferSize__, timeout__, ssn__) \
186 CsrWifiRouterCtrlBlockAckEnableReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, macAddress__, trafficStreamID__, role__, bufferSize__, timeout__, ssn__)
187
188/*******************************************************************************
189
190 NAME
191 CsrWifiRouterCtrlBlockAckEnableCfmSend
192
193 DESCRIPTION
194
195 PARAMETERS
196 queue - Destination Task Queue
197 clientData -
198 interfaceTag -
199 status -
200
201*******************************************************************************/
202#define CsrWifiRouterCtrlBlockAckEnableCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \
203 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckEnableCfm), GFP_KERNEL); \
204 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_CFM, dst__, src__); \
205 msg__->clientData = (clientData__); \
206 msg__->interfaceTag = (interfaceTag__); \
207 msg__->status = (status__);
208
209#define CsrWifiRouterCtrlBlockAckEnableCfmSendTo(dst__, src__, clientData__, interfaceTag__, status__) \
210 { \
211 CsrWifiRouterCtrlBlockAckEnableCfm *msg__; \
212 CsrWifiRouterCtrlBlockAckEnableCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__); \
213 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
214 }
215
216#define CsrWifiRouterCtrlBlockAckEnableCfmSend(dst__, clientData__, interfaceTag__, status__) \
217 CsrWifiRouterCtrlBlockAckEnableCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, status__)
218
219/*******************************************************************************
220
221 NAME
222 CsrWifiRouterCtrlBlockAckErrorIndSend
223
224 DESCRIPTION
225
226 PARAMETERS
227 queue - Destination Task Queue
228 clientData -
229 interfaceTag -
230 trafficStreamID -
231 peerMacAddress -
232 status -
233
234*******************************************************************************/
235#define CsrWifiRouterCtrlBlockAckErrorIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, trafficStreamID__, peerMacAddress__, status__) \
236 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckErrorInd), GFP_KERNEL); \
237 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ERROR_IND, dst__, src__); \
238 msg__->clientData = (clientData__); \
239 msg__->interfaceTag = (interfaceTag__); \
240 msg__->trafficStreamID = (trafficStreamID__); \
241 msg__->peerMacAddress = (peerMacAddress__); \
242 msg__->status = (status__);
243
244#define CsrWifiRouterCtrlBlockAckErrorIndSendTo(dst__, src__, clientData__, interfaceTag__, trafficStreamID__, peerMacAddress__, status__) \
245 { \
246 CsrWifiRouterCtrlBlockAckErrorInd *msg__; \
247 CsrWifiRouterCtrlBlockAckErrorIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, trafficStreamID__, peerMacAddress__, status__); \
248 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
249 }
250
251#define CsrWifiRouterCtrlBlockAckErrorIndSend(dst__, clientData__, interfaceTag__, trafficStreamID__, peerMacAddress__, status__) \
252 CsrWifiRouterCtrlBlockAckErrorIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, trafficStreamID__, peerMacAddress__, status__)
253
254/*******************************************************************************
255
256 NAME
257 CsrWifiRouterCtrlCapabilitiesReqSend
258
259 DESCRIPTION
260
261 PARAMETERS
262 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
263 clientData -
264
265*******************************************************************************/
266#define CsrWifiRouterCtrlCapabilitiesReqCreate(msg__, dst__, src__, clientData__) \
267 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlCapabilitiesReq), GFP_KERNEL); \
268 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_CAPABILITIES_REQ, dst__, src__); \
269 msg__->clientData = (clientData__);
270
271#define CsrWifiRouterCtrlCapabilitiesReqSendTo(dst__, src__, clientData__) \
272 { \
273 CsrWifiRouterCtrlCapabilitiesReq *msg__; \
274 CsrWifiRouterCtrlCapabilitiesReqCreate(msg__, dst__, src__, clientData__); \
275 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
276 }
277
278#define CsrWifiRouterCtrlCapabilitiesReqSend(src__, clientData__) \
279 CsrWifiRouterCtrlCapabilitiesReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__)
280
281/*******************************************************************************
282
283 NAME
284 CsrWifiRouterCtrlCapabilitiesCfmSend
285
286 DESCRIPTION
287 The router sends this primitive to confirm the size of the queues of the
288 HIP.
289
290 PARAMETERS
291 queue - Destination Task Queue
292 clientData -
293 commandQueueSize - Size of command queue
294 trafficQueueSize - Size of traffic queue (per AC)
295
296*******************************************************************************/
297#define CsrWifiRouterCtrlCapabilitiesCfmCreate(msg__, dst__, src__, clientData__, commandQueueSize__, trafficQueueSize__) \
298 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlCapabilitiesCfm), GFP_KERNEL); \
299 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_CAPABILITIES_CFM, dst__, src__); \
300 msg__->clientData = (clientData__); \
301 msg__->commandQueueSize = (commandQueueSize__); \
302 msg__->trafficQueueSize = (trafficQueueSize__);
303
304#define CsrWifiRouterCtrlCapabilitiesCfmSendTo(dst__, src__, clientData__, commandQueueSize__, trafficQueueSize__) \
305 { \
306 CsrWifiRouterCtrlCapabilitiesCfm *msg__; \
307 CsrWifiRouterCtrlCapabilitiesCfmCreate(msg__, dst__, src__, clientData__, commandQueueSize__, trafficQueueSize__); \
308 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
309 }
310
311#define CsrWifiRouterCtrlCapabilitiesCfmSend(dst__, clientData__, commandQueueSize__, trafficQueueSize__) \
312 CsrWifiRouterCtrlCapabilitiesCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, commandQueueSize__, trafficQueueSize__)
313
314/*******************************************************************************
315
316 NAME
317 CsrWifiRouterCtrlConfigurePowerModeReqSend
318
319 DESCRIPTION
320
321 PARAMETERS
322 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
323 clientData -
324 mode -
325 wakeHost -
326
327*******************************************************************************/
328#define CsrWifiRouterCtrlConfigurePowerModeReqCreate(msg__, dst__, src__, clientData__, mode__, wakeHost__) \
329 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlConfigurePowerModeReq), GFP_KERNEL); \
330 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_CONFIGURE_POWER_MODE_REQ, dst__, src__); \
331 msg__->clientData = (clientData__); \
332 msg__->mode = (mode__); \
333 msg__->wakeHost = (wakeHost__);
334
335#define CsrWifiRouterCtrlConfigurePowerModeReqSendTo(dst__, src__, clientData__, mode__, wakeHost__) \
336 { \
337 CsrWifiRouterCtrlConfigurePowerModeReq *msg__; \
338 CsrWifiRouterCtrlConfigurePowerModeReqCreate(msg__, dst__, src__, clientData__, mode__, wakeHost__); \
339 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
340 }
341
342#define CsrWifiRouterCtrlConfigurePowerModeReqSend(src__, clientData__, mode__, wakeHost__) \
343 CsrWifiRouterCtrlConfigurePowerModeReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__, mode__, wakeHost__)
344
345/*******************************************************************************
346
347 NAME
348 CsrWifiRouterCtrlConnectedIndSend
349
350 DESCRIPTION
351
352 PARAMETERS
353 queue - Destination Task Queue
354 clientData -
355 interfaceTag -
356 peerMacAddress -
357 peerStatus -
358
359*******************************************************************************/
360#define CsrWifiRouterCtrlConnectedIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, peerStatus__) \
361 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlConnectedInd), GFP_KERNEL); \
362 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_CONNECTED_IND, dst__, src__); \
363 msg__->clientData = (clientData__); \
364 msg__->interfaceTag = (interfaceTag__); \
365 msg__->peerMacAddress = (peerMacAddress__); \
366 msg__->peerStatus = (peerStatus__);
367
368#define CsrWifiRouterCtrlConnectedIndSendTo(dst__, src__, clientData__, interfaceTag__, peerMacAddress__, peerStatus__) \
369 { \
370 CsrWifiRouterCtrlConnectedInd *msg__; \
371 CsrWifiRouterCtrlConnectedIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, peerStatus__); \
372 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
373 }
374
375#define CsrWifiRouterCtrlConnectedIndSend(dst__, clientData__, interfaceTag__, peerMacAddress__, peerStatus__) \
376 CsrWifiRouterCtrlConnectedIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, peerMacAddress__, peerStatus__)
377
378/*******************************************************************************
379
380 NAME
381 CsrWifiRouterCtrlHipReqSend
382
383 DESCRIPTION
384 This primitive is used for transferring MLME messages to the HIP.
385
386 PARAMETERS
387 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
388 mlmeCommandLength - Length of the MLME signal
389 mlmeCommand - Pointer to the MLME signal
390 dataRef1Length - Length of the dataRef1 bulk data
391 dataRef1 - Pointer to the bulk data 1
392 dataRef2Length - Length of the dataRef2 bulk data
393 dataRef2 - Pointer to the bulk data 2
394
395*******************************************************************************/
396#define CsrWifiRouterCtrlHipReqCreate(msg__, dst__, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) \
397 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlHipReq), GFP_KERNEL); \
398 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_HIP_REQ, dst__, src__); \
399 msg__->mlmeCommandLength = (mlmeCommandLength__); \
400 msg__->mlmeCommand = (mlmeCommand__); \
401 msg__->dataRef1Length = (dataRef1Length__); \
402 msg__->dataRef1 = (dataRef1__); \
403 msg__->dataRef2Length = (dataRef2Length__); \
404 msg__->dataRef2 = (dataRef2__);
405
406#define CsrWifiRouterCtrlHipReqSendTo(dst__, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) \
407 { \
408 CsrWifiRouterCtrlHipReq *msg__; \
409 CsrWifiRouterCtrlHipReqCreate(msg__, dst__, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__); \
410 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
411 }
412
413#define CsrWifiRouterCtrlHipReqSend(src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) \
414 CsrWifiRouterCtrlHipReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__)
415
416/*******************************************************************************
417
418 NAME
419 CsrWifiRouterCtrlHipIndSend
420
421 DESCRIPTION
422 This primitive is used for transferring MLME messages from the HIP.
423
424 PARAMETERS
425 queue - Destination Task Queue
426 mlmeCommandLength - Length of the MLME signal
427 mlmeCommand - Pointer to the MLME signal
428 dataRef1Length - Length of the dataRef1 bulk data
429 dataRef1 - Pointer to the bulk data 1
430 dataRef2Length - Length of the dataRef2 bulk data
431 dataRef2 - Pointer to the bulk data 2
432
433*******************************************************************************/
434#define CsrWifiRouterCtrlHipIndCreate(msg__, dst__, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) \
435 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlHipInd), GFP_KERNEL); \
436 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_HIP_IND, dst__, src__); \
437 msg__->mlmeCommandLength = (mlmeCommandLength__); \
438 msg__->mlmeCommand = (mlmeCommand__); \
439 msg__->dataRef1Length = (dataRef1Length__); \
440 msg__->dataRef1 = (dataRef1__); \
441 msg__->dataRef2Length = (dataRef2Length__); \
442 msg__->dataRef2 = (dataRef2__);
443
444#define CsrWifiRouterCtrlHipIndSendTo(dst__, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) \
445 { \
446 CsrWifiRouterCtrlHipInd *msg__; \
447 CsrWifiRouterCtrlHipIndCreate(msg__, dst__, src__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__); \
448 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
449 }
450
451#define CsrWifiRouterCtrlHipIndSend(dst__, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__) \
452 CsrWifiRouterCtrlHipIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, mlmeCommandLength__, mlmeCommand__, dataRef1Length__, dataRef1__, dataRef2Length__, dataRef2__)
453
454/*******************************************************************************
455
456 NAME
457 CsrWifiRouterCtrlM4ReadyToSendIndSend
458
459 DESCRIPTION
460
461 PARAMETERS
462 queue - Destination Task Queue
463 clientData -
464 interfaceTag -
465 peerMacAddress -
466
467*******************************************************************************/
468#define CsrWifiRouterCtrlM4ReadyToSendIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__) \
469 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlM4ReadyToSendInd), GFP_KERNEL); \
470 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_M4_READY_TO_SEND_IND, dst__, src__); \
471 msg__->clientData = (clientData__); \
472 msg__->interfaceTag = (interfaceTag__); \
473 msg__->peerMacAddress = (peerMacAddress__);
474
475#define CsrWifiRouterCtrlM4ReadyToSendIndSendTo(dst__, src__, clientData__, interfaceTag__, peerMacAddress__) \
476 { \
477 CsrWifiRouterCtrlM4ReadyToSendInd *msg__; \
478 CsrWifiRouterCtrlM4ReadyToSendIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__); \
479 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
480 }
481
482#define CsrWifiRouterCtrlM4ReadyToSendIndSend(dst__, clientData__, interfaceTag__, peerMacAddress__) \
483 CsrWifiRouterCtrlM4ReadyToSendIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, peerMacAddress__)
484
485/*******************************************************************************
486
487 NAME
488 CsrWifiRouterCtrlM4TransmitReqSend
489
490 DESCRIPTION
491
492 PARAMETERS
493 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
494 interfaceTag -
495 clientData -
496
497*******************************************************************************/
498#define CsrWifiRouterCtrlM4TransmitReqCreate(msg__, dst__, src__, interfaceTag__, clientData__) \
499 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlM4TransmitReq), GFP_KERNEL); \
500 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_M4_TRANSMIT_REQ, dst__, src__); \
501 msg__->interfaceTag = (interfaceTag__); \
502 msg__->clientData = (clientData__);
503
504#define CsrWifiRouterCtrlM4TransmitReqSendTo(dst__, src__, interfaceTag__, clientData__) \
505 { \
506 CsrWifiRouterCtrlM4TransmitReq *msg__; \
507 CsrWifiRouterCtrlM4TransmitReqCreate(msg__, dst__, src__, interfaceTag__, clientData__); \
508 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
509 }
510
511#define CsrWifiRouterCtrlM4TransmitReqSend(src__, interfaceTag__, clientData__) \
512 CsrWifiRouterCtrlM4TransmitReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__)
513
514/*******************************************************************************
515
516 NAME
517 CsrWifiRouterCtrlM4TransmittedIndSend
518
519 DESCRIPTION
520
521 PARAMETERS
522 queue - Destination Task Queue
523 clientData -
524 interfaceTag -
525 peerMacAddress -
526 status -
527
528*******************************************************************************/
529#define CsrWifiRouterCtrlM4TransmittedIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, status__) \
530 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlM4TransmittedInd), GFP_KERNEL); \
531 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_M4_TRANSMITTED_IND, dst__, src__); \
532 msg__->clientData = (clientData__); \
533 msg__->interfaceTag = (interfaceTag__); \
534 msg__->peerMacAddress = (peerMacAddress__); \
535 msg__->status = (status__);
536
537#define CsrWifiRouterCtrlM4TransmittedIndSendTo(dst__, src__, clientData__, interfaceTag__, peerMacAddress__, status__) \
538 { \
539 CsrWifiRouterCtrlM4TransmittedInd *msg__; \
540 CsrWifiRouterCtrlM4TransmittedIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, status__); \
541 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
542 }
543
544#define CsrWifiRouterCtrlM4TransmittedIndSend(dst__, clientData__, interfaceTag__, peerMacAddress__, status__) \
545 CsrWifiRouterCtrlM4TransmittedIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, peerMacAddress__, status__)
546
547/*******************************************************************************
548
549 NAME
550 CsrWifiRouterCtrlMediaStatusReqSend
551
552 DESCRIPTION
553
554 PARAMETERS
555 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
556 interfaceTag -
557 clientData -
558 mediaStatus -
559
560*******************************************************************************/
561#define CsrWifiRouterCtrlMediaStatusReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, mediaStatus__) \
562 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlMediaStatusReq), GFP_KERNEL); \
563 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_REQ, dst__, src__); \
564 msg__->interfaceTag = (interfaceTag__); \
565 msg__->clientData = (clientData__); \
566 msg__->mediaStatus = (mediaStatus__);
567
568#define CsrWifiRouterCtrlMediaStatusReqSendTo(dst__, src__, interfaceTag__, clientData__, mediaStatus__) \
569 { \
570 CsrWifiRouterCtrlMediaStatusReq *msg__; \
571 CsrWifiRouterCtrlMediaStatusReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, mediaStatus__); \
572 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
573 }
574
575#define CsrWifiRouterCtrlMediaStatusReqSend(src__, interfaceTag__, clientData__, mediaStatus__) \
576 CsrWifiRouterCtrlMediaStatusReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, mediaStatus__)
577
578/*******************************************************************************
579
580 NAME
581 CsrWifiRouterCtrlMicFailureIndSend
582
583 DESCRIPTION
584
585 PARAMETERS
586 queue - Destination Task Queue
587 clientData -
588 interfaceTag -
589 peerMacAddress -
590 unicastPdu -
591
592*******************************************************************************/
593#define CsrWifiRouterCtrlMicFailureIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, unicastPdu__) \
594 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlMicFailureInd), GFP_KERNEL); \
595 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MIC_FAILURE_IND, dst__, src__); \
596 msg__->clientData = (clientData__); \
597 msg__->interfaceTag = (interfaceTag__); \
598 msg__->peerMacAddress = (peerMacAddress__); \
599 msg__->unicastPdu = (unicastPdu__);
600
601#define CsrWifiRouterCtrlMicFailureIndSendTo(dst__, src__, clientData__, interfaceTag__, peerMacAddress__, unicastPdu__) \
602 { \
603 CsrWifiRouterCtrlMicFailureInd *msg__; \
604 CsrWifiRouterCtrlMicFailureIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, unicastPdu__); \
605 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
606 }
607
608#define CsrWifiRouterCtrlMicFailureIndSend(dst__, clientData__, interfaceTag__, peerMacAddress__, unicastPdu__) \
609 CsrWifiRouterCtrlMicFailureIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, peerMacAddress__, unicastPdu__)
610
611/*******************************************************************************
612
613 NAME
614 CsrWifiRouterCtrlModeSetReqSend
615
616 DESCRIPTION
617
618 PARAMETERS
619 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
620 interfaceTag -
621 clientData -
622 mode -
623 bssid - BSSID of the network the device is going to be a part
624 of
625 protection - Set to TRUE if encryption is enabled for the
626 connection/broadcast frames
627 intraBssDistEnabled - If set to TRUE, intra BSS destribution will be
628 enabled. If set to FALSE, any unicast PDU which does
629 not have the RA as the the local MAC address, shall be
630 ignored. This field is interpreted by the receive if
631 mode is set to CSR_WIFI_ROUTER_CTRL_MODE_P2PGO
632
633*******************************************************************************/
634#define CsrWifiRouterCtrlModeSetReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, mode__, bssid__, protection__, intraBssDistEnabled__) \
635 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlModeSetReq), GFP_KERNEL); \
636 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MODE_SET_REQ, dst__, src__); \
637 msg__->interfaceTag = (interfaceTag__); \
638 msg__->clientData = (clientData__); \
639 msg__->mode = (mode__); \
640 msg__->bssid = (bssid__); \
641 msg__->protection = (protection__); \
642 msg__->intraBssDistEnabled = (intraBssDistEnabled__);
643
644#define CsrWifiRouterCtrlModeSetReqSendTo(dst__, src__, interfaceTag__, clientData__, mode__, bssid__, protection__, intraBssDistEnabled__) \
645 { \
646 CsrWifiRouterCtrlModeSetReq *msg__; \
647 CsrWifiRouterCtrlModeSetReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, mode__, bssid__, protection__, intraBssDistEnabled__); \
648 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
649 }
650
651#define CsrWifiRouterCtrlModeSetReqSend(src__, interfaceTag__, clientData__, mode__, bssid__, protection__, intraBssDistEnabled__) \
652 CsrWifiRouterCtrlModeSetReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, mode__, bssid__, protection__, intraBssDistEnabled__)
653
654/*******************************************************************************
655
656 NAME
657 CsrWifiRouterCtrlModeSetCfmSend
658
659 DESCRIPTION
660
661 PARAMETERS
662 queue - Destination Task Queue
663 clientData -
664 interfaceTag -
665 mode -
666 status -
667
668*******************************************************************************/
669#define CsrWifiRouterCtrlModeSetCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, mode__, status__) \
670 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlModeSetCfm), GFP_KERNEL); \
671 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MODE_SET_CFM, dst__, src__); \
672 msg__->clientData = (clientData__); \
673 msg__->interfaceTag = (interfaceTag__); \
674 msg__->mode = (mode__); \
675 msg__->status = (status__);
676
677#define CsrWifiRouterCtrlModeSetCfmSendTo(dst__, src__, clientData__, interfaceTag__, mode__, status__) \
678 { \
679 CsrWifiRouterCtrlModeSetCfm *msg__; \
680 CsrWifiRouterCtrlModeSetCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, mode__, status__); \
681 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
682 }
683
684#define CsrWifiRouterCtrlModeSetCfmSend(dst__, clientData__, interfaceTag__, mode__, status__) \
685 CsrWifiRouterCtrlModeSetCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, mode__, status__)
686
687/*******************************************************************************
688
689 NAME
690 CsrWifiRouterCtrlMulticastAddressIndSend
691
692 DESCRIPTION
693
694 PARAMETERS
695 queue - Destination Task Queue
696 clientData -
697 interfaceTag -
698 action -
699 setAddressesCount -
700 setAddresses -
701
702*******************************************************************************/
703#define CsrWifiRouterCtrlMulticastAddressIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \
704 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlMulticastAddressInd), GFP_KERNEL); \
705 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_IND, dst__, src__); \
706 msg__->clientData = (clientData__); \
707 msg__->interfaceTag = (interfaceTag__); \
708 msg__->action = (action__); \
709 msg__->setAddressesCount = (setAddressesCount__); \
710 msg__->setAddresses = (setAddresses__);
711
712#define CsrWifiRouterCtrlMulticastAddressIndSendTo(dst__, src__, clientData__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \
713 { \
714 CsrWifiRouterCtrlMulticastAddressInd *msg__; \
715 CsrWifiRouterCtrlMulticastAddressIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, action__, setAddressesCount__, setAddresses__); \
716 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
717 }
718
719#define CsrWifiRouterCtrlMulticastAddressIndSend(dst__, clientData__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \
720 CsrWifiRouterCtrlMulticastAddressIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, action__, setAddressesCount__, setAddresses__)
721
722/*******************************************************************************
723
724 NAME
725 CsrWifiRouterCtrlMulticastAddressResSend
726
727 DESCRIPTION
728
729 PARAMETERS
730 interfaceTag -
731 clientData -
732 status -
733 action -
734 getAddressesCount -
735 getAddresses -
736
737*******************************************************************************/
738#define CsrWifiRouterCtrlMulticastAddressResCreate(msg__, dst__, src__, interfaceTag__, clientData__, status__, action__, getAddressesCount__, getAddresses__) \
739 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlMulticastAddressRes), GFP_KERNEL); \
740 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_RES, dst__, src__); \
741 msg__->interfaceTag = (interfaceTag__); \
742 msg__->clientData = (clientData__); \
743 msg__->status = (status__); \
744 msg__->action = (action__); \
745 msg__->getAddressesCount = (getAddressesCount__); \
746 msg__->getAddresses = (getAddresses__);
747
748#define CsrWifiRouterCtrlMulticastAddressResSendTo(dst__, src__, interfaceTag__, clientData__, status__, action__, getAddressesCount__, getAddresses__) \
749 { \
750 CsrWifiRouterCtrlMulticastAddressRes *msg__; \
751 CsrWifiRouterCtrlMulticastAddressResCreate(msg__, dst__, src__, interfaceTag__, clientData__, status__, action__, getAddressesCount__, getAddresses__); \
752 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
753 }
754
755#define CsrWifiRouterCtrlMulticastAddressResSend(src__, interfaceTag__, clientData__, status__, action__, getAddressesCount__, getAddresses__) \
756 CsrWifiRouterCtrlMulticastAddressResSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, status__, action__, getAddressesCount__, getAddresses__)
757
758/*******************************************************************************
759
760 NAME
761 CsrWifiRouterCtrlPeerAddReqSend
762
763 DESCRIPTION
764
765 PARAMETERS
766 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
767 interfaceTag -
768 clientData -
769 peerMacAddress -
770 associationId -
771 staInfo -
772
773*******************************************************************************/
774#define CsrWifiRouterCtrlPeerAddReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, peerMacAddress__, associationId__, staInfo__) \
775 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPeerAddReq), GFP_KERNEL); \
776 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_ADD_REQ, dst__, src__); \
777 msg__->interfaceTag = (interfaceTag__); \
778 msg__->clientData = (clientData__); \
779 msg__->peerMacAddress = (peerMacAddress__); \
780 msg__->associationId = (associationId__); \
781 msg__->staInfo = (staInfo__);
782
783#define CsrWifiRouterCtrlPeerAddReqSendTo(dst__, src__, interfaceTag__, clientData__, peerMacAddress__, associationId__, staInfo__) \
784 { \
785 CsrWifiRouterCtrlPeerAddReq *msg__; \
786 CsrWifiRouterCtrlPeerAddReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, peerMacAddress__, associationId__, staInfo__); \
787 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
788 }
789
790#define CsrWifiRouterCtrlPeerAddReqSend(src__, interfaceTag__, clientData__, peerMacAddress__, associationId__, staInfo__) \
791 CsrWifiRouterCtrlPeerAddReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, peerMacAddress__, associationId__, staInfo__)
792
793/*******************************************************************************
794
795 NAME
796 CsrWifiRouterCtrlPeerAddCfmSend
797
798 DESCRIPTION
799
800 PARAMETERS
801 queue - Destination Task Queue
802 clientData -
803 interfaceTag -
804 peerMacAddress -
805 peerRecordHandle -
806 status -
807
808*******************************************************************************/
809#define CsrWifiRouterCtrlPeerAddCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, peerRecordHandle__, status__) \
810 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPeerAddCfm), GFP_KERNEL); \
811 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_ADD_CFM, dst__, src__); \
812 msg__->clientData = (clientData__); \
813 msg__->interfaceTag = (interfaceTag__); \
814 msg__->peerMacAddress = (peerMacAddress__); \
815 msg__->peerRecordHandle = (peerRecordHandle__); \
816 msg__->status = (status__);
817
818#define CsrWifiRouterCtrlPeerAddCfmSendTo(dst__, src__, clientData__, interfaceTag__, peerMacAddress__, peerRecordHandle__, status__) \
819 { \
820 CsrWifiRouterCtrlPeerAddCfm *msg__; \
821 CsrWifiRouterCtrlPeerAddCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__, peerRecordHandle__, status__); \
822 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
823 }
824
825#define CsrWifiRouterCtrlPeerAddCfmSend(dst__, clientData__, interfaceTag__, peerMacAddress__, peerRecordHandle__, status__) \
826 CsrWifiRouterCtrlPeerAddCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, peerMacAddress__, peerRecordHandle__, status__)
827
828/*******************************************************************************
829
830 NAME
831 CsrWifiRouterCtrlPeerDelReqSend
832
833 DESCRIPTION
834
835 PARAMETERS
836 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
837 interfaceTag -
838 clientData -
839 peerRecordHandle -
840
841*******************************************************************************/
842#define CsrWifiRouterCtrlPeerDelReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, peerRecordHandle__) \
843 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPeerDelReq), GFP_KERNEL); \
844 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_DEL_REQ, dst__, src__); \
845 msg__->interfaceTag = (interfaceTag__); \
846 msg__->clientData = (clientData__); \
847 msg__->peerRecordHandle = (peerRecordHandle__);
848
849#define CsrWifiRouterCtrlPeerDelReqSendTo(dst__, src__, interfaceTag__, clientData__, peerRecordHandle__) \
850 { \
851 CsrWifiRouterCtrlPeerDelReq *msg__; \
852 CsrWifiRouterCtrlPeerDelReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, peerRecordHandle__); \
853 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
854 }
855
856#define CsrWifiRouterCtrlPeerDelReqSend(src__, interfaceTag__, clientData__, peerRecordHandle__) \
857 CsrWifiRouterCtrlPeerDelReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, peerRecordHandle__)
858
859/*******************************************************************************
860
861 NAME
862 CsrWifiRouterCtrlPeerDelCfmSend
863
864 DESCRIPTION
865
866 PARAMETERS
867 queue - Destination Task Queue
868 clientData -
869 interfaceTag -
870 status -
871
872*******************************************************************************/
873#define CsrWifiRouterCtrlPeerDelCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \
874 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPeerDelCfm), GFP_KERNEL); \
875 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_DEL_CFM, dst__, src__); \
876 msg__->clientData = (clientData__); \
877 msg__->interfaceTag = (interfaceTag__); \
878 msg__->status = (status__);
879
880#define CsrWifiRouterCtrlPeerDelCfmSendTo(dst__, src__, clientData__, interfaceTag__, status__) \
881 { \
882 CsrWifiRouterCtrlPeerDelCfm *msg__; \
883 CsrWifiRouterCtrlPeerDelCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__); \
884 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
885 }
886
887#define CsrWifiRouterCtrlPeerDelCfmSend(dst__, clientData__, interfaceTag__, status__) \
888 CsrWifiRouterCtrlPeerDelCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, status__)
889
890/*******************************************************************************
891
892 NAME
893 CsrWifiRouterCtrlPeerUpdateReqSend
894
895 DESCRIPTION
896
897 PARAMETERS
898 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
899 interfaceTag -
900 clientData -
901 peerRecordHandle -
902 powersaveMode -
903
904*******************************************************************************/
905#define CsrWifiRouterCtrlPeerUpdateReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, peerRecordHandle__, powersaveMode__) \
906 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPeerUpdateReq), GFP_KERNEL); \
907 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_UPDATE_REQ, dst__, src__); \
908 msg__->interfaceTag = (interfaceTag__); \
909 msg__->clientData = (clientData__); \
910 msg__->peerRecordHandle = (peerRecordHandle__); \
911 msg__->powersaveMode = (powersaveMode__);
912
913#define CsrWifiRouterCtrlPeerUpdateReqSendTo(dst__, src__, interfaceTag__, clientData__, peerRecordHandle__, powersaveMode__) \
914 { \
915 CsrWifiRouterCtrlPeerUpdateReq *msg__; \
916 CsrWifiRouterCtrlPeerUpdateReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, peerRecordHandle__, powersaveMode__); \
917 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
918 }
919
920#define CsrWifiRouterCtrlPeerUpdateReqSend(src__, interfaceTag__, clientData__, peerRecordHandle__, powersaveMode__) \
921 CsrWifiRouterCtrlPeerUpdateReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, peerRecordHandle__, powersaveMode__)
922
923/*******************************************************************************
924
925 NAME
926 CsrWifiRouterCtrlPeerUpdateCfmSend
927
928 DESCRIPTION
929
930 PARAMETERS
931 queue - Destination Task Queue
932 clientData -
933 interfaceTag -
934 status -
935
936*******************************************************************************/
937#define CsrWifiRouterCtrlPeerUpdateCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \
938 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPeerUpdateCfm), GFP_KERNEL); \
939 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PEER_UPDATE_CFM, dst__, src__); \
940 msg__->clientData = (clientData__); \
941 msg__->interfaceTag = (interfaceTag__); \
942 msg__->status = (status__);
943
944#define CsrWifiRouterCtrlPeerUpdateCfmSendTo(dst__, src__, clientData__, interfaceTag__, status__) \
945 { \
946 CsrWifiRouterCtrlPeerUpdateCfm *msg__; \
947 CsrWifiRouterCtrlPeerUpdateCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__); \
948 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
949 }
950
951#define CsrWifiRouterCtrlPeerUpdateCfmSend(dst__, clientData__, interfaceTag__, status__) \
952 CsrWifiRouterCtrlPeerUpdateCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, status__)
953
954/*******************************************************************************
955
956 NAME
957 CsrWifiRouterCtrlPortConfigureReqSend
958
959 DESCRIPTION
960
961 PARAMETERS
962 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
963 interfaceTag -
964 clientData -
965 uncontrolledPortAction -
966 controlledPortAction -
967 macAddress -
968 setProtection -
969
970*******************************************************************************/
971#define CsrWifiRouterCtrlPortConfigureReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, uncontrolledPortAction__, controlledPortAction__, macAddress__, setProtection__) \
972 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPortConfigureReq), GFP_KERNEL); \
973 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_REQ, dst__, src__); \
974 msg__->interfaceTag = (interfaceTag__); \
975 msg__->clientData = (clientData__); \
976 msg__->uncontrolledPortAction = (uncontrolledPortAction__); \
977 msg__->controlledPortAction = (controlledPortAction__); \
978 msg__->macAddress = (macAddress__); \
979 msg__->setProtection = (setProtection__);
980
981#define CsrWifiRouterCtrlPortConfigureReqSendTo(dst__, src__, interfaceTag__, clientData__, uncontrolledPortAction__, controlledPortAction__, macAddress__, setProtection__) \
982 { \
983 CsrWifiRouterCtrlPortConfigureReq *msg__; \
984 CsrWifiRouterCtrlPortConfigureReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, uncontrolledPortAction__, controlledPortAction__, macAddress__, setProtection__); \
985 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
986 }
987
988#define CsrWifiRouterCtrlPortConfigureReqSend(src__, interfaceTag__, clientData__, uncontrolledPortAction__, controlledPortAction__, macAddress__, setProtection__) \
989 CsrWifiRouterCtrlPortConfigureReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, uncontrolledPortAction__, controlledPortAction__, macAddress__, setProtection__)
990
991/*******************************************************************************
992
993 NAME
994 CsrWifiRouterCtrlPortConfigureCfmSend
995
996 DESCRIPTION
997
998 PARAMETERS
999 queue - Destination Task Queue
1000 clientData -
1001 interfaceTag -
1002 status -
1003 macAddress -
1004
1005*******************************************************************************/
1006#define CsrWifiRouterCtrlPortConfigureCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__, macAddress__) \
1007 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlPortConfigureCfm), GFP_KERNEL); \
1008 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_CFM, dst__, src__); \
1009 msg__->clientData = (clientData__); \
1010 msg__->interfaceTag = (interfaceTag__); \
1011 msg__->status = (status__); \
1012 msg__->macAddress = (macAddress__);
1013
1014#define CsrWifiRouterCtrlPortConfigureCfmSendTo(dst__, src__, clientData__, interfaceTag__, status__, macAddress__) \
1015 { \
1016 CsrWifiRouterCtrlPortConfigureCfm *msg__; \
1017 CsrWifiRouterCtrlPortConfigureCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__, macAddress__); \
1018 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1019 }
1020
1021#define CsrWifiRouterCtrlPortConfigureCfmSend(dst__, clientData__, interfaceTag__, status__, macAddress__) \
1022 CsrWifiRouterCtrlPortConfigureCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, status__, macAddress__)
1023
1024/*******************************************************************************
1025
1026 NAME
1027 CsrWifiRouterCtrlQosControlReqSend
1028
1029 DESCRIPTION
1030
1031 PARAMETERS
1032 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1033 interfaceTag -
1034 clientData -
1035 control -
1036 queueConfig -
1037
1038*******************************************************************************/
1039#define CsrWifiRouterCtrlQosControlReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, control__, queueConfig__) \
1040 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlQosControlReq), GFP_KERNEL); \
1041 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_REQ, dst__, src__); \
1042 msg__->interfaceTag = (interfaceTag__); \
1043 msg__->clientData = (clientData__); \
1044 msg__->control = (control__); \
1045 msg__->queueConfig = (queueConfig__);
1046
1047#define CsrWifiRouterCtrlQosControlReqSendTo(dst__, src__, interfaceTag__, clientData__, control__, queueConfig__) \
1048 { \
1049 CsrWifiRouterCtrlQosControlReq *msg__; \
1050 CsrWifiRouterCtrlQosControlReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, control__, queueConfig__); \
1051 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1052 }
1053
1054#define CsrWifiRouterCtrlQosControlReqSend(src__, interfaceTag__, clientData__, control__, queueConfig__) \
1055 CsrWifiRouterCtrlQosControlReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, control__, queueConfig__)
1056
1057/*******************************************************************************
1058
1059 NAME
1060 CsrWifiRouterCtrlRawSdioDeinitialiseReqSend
1061
1062 DESCRIPTION
1063
1064 PARAMETERS
1065 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1066 clientData -
1067
1068*******************************************************************************/
1069#define CsrWifiRouterCtrlRawSdioDeinitialiseReqCreate(msg__, dst__, src__, clientData__) \
1070 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlRawSdioDeinitialiseReq), GFP_KERNEL); \
1071 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RAW_SDIO_DEINITIALISE_REQ, dst__, src__); \
1072 msg__->clientData = (clientData__);
1073
1074#define CsrWifiRouterCtrlRawSdioDeinitialiseReqSendTo(dst__, src__, clientData__) \
1075 { \
1076 CsrWifiRouterCtrlRawSdioDeinitialiseReq *msg__; \
1077 CsrWifiRouterCtrlRawSdioDeinitialiseReqCreate(msg__, dst__, src__, clientData__); \
1078 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1079 }
1080
1081#define CsrWifiRouterCtrlRawSdioDeinitialiseReqSend(src__, clientData__) \
1082 CsrWifiRouterCtrlRawSdioDeinitialiseReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__)
1083
1084/*******************************************************************************
1085
1086 NAME
1087 CsrWifiRouterCtrlRawSdioDeinitialiseCfmSend
1088
1089 DESCRIPTION
1090
1091 PARAMETERS
1092 queue - Destination Task Queue
1093 clientData -
1094 result -
1095
1096*******************************************************************************/
1097#define CsrWifiRouterCtrlRawSdioDeinitialiseCfmCreate(msg__, dst__, src__, clientData__, result__) \
1098 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlRawSdioDeinitialiseCfm), GFP_KERNEL); \
1099 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RAW_SDIO_DEINITIALISE_CFM, dst__, src__); \
1100 msg__->clientData = (clientData__); \
1101 msg__->result = (result__);
1102
1103#define CsrWifiRouterCtrlRawSdioDeinitialiseCfmSendTo(dst__, src__, clientData__, result__) \
1104 { \
1105 CsrWifiRouterCtrlRawSdioDeinitialiseCfm *msg__; \
1106 CsrWifiRouterCtrlRawSdioDeinitialiseCfmCreate(msg__, dst__, src__, clientData__, result__); \
1107 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1108 }
1109
1110#define CsrWifiRouterCtrlRawSdioDeinitialiseCfmSend(dst__, clientData__, result__) \
1111 CsrWifiRouterCtrlRawSdioDeinitialiseCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, result__)
1112
1113/*******************************************************************************
1114
1115 NAME
1116 CsrWifiRouterCtrlRawSdioInitialiseReqSend
1117
1118 DESCRIPTION
1119
1120 PARAMETERS
1121 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1122 clientData -
1123
1124*******************************************************************************/
1125#define CsrWifiRouterCtrlRawSdioInitialiseReqCreate(msg__, dst__, src__, clientData__) \
1126 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlRawSdioInitialiseReq), GFP_KERNEL); \
1127 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RAW_SDIO_INITIALISE_REQ, dst__, src__); \
1128 msg__->clientData = (clientData__);
1129
1130#define CsrWifiRouterCtrlRawSdioInitialiseReqSendTo(dst__, src__, clientData__) \
1131 { \
1132 CsrWifiRouterCtrlRawSdioInitialiseReq *msg__; \
1133 CsrWifiRouterCtrlRawSdioInitialiseReqCreate(msg__, dst__, src__, clientData__); \
1134 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1135 }
1136
1137#define CsrWifiRouterCtrlRawSdioInitialiseReqSend(src__, clientData__) \
1138 CsrWifiRouterCtrlRawSdioInitialiseReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__)
1139
1140/*******************************************************************************
1141
1142 NAME
1143 CsrWifiRouterCtrlRawSdioInitialiseCfmSend
1144
1145 DESCRIPTION
1146
1147 PARAMETERS
1148 queue - Destination Task Queue
1149 clientData -
1150 result -
1151 byteRead -
1152 byteWrite -
1153 firmwareDownload -
1154 reset -
1155 coreDumpPrepare -
1156 byteBlockRead -
1157 gpRead16 -
1158 gpWrite16 -
1159
1160*******************************************************************************/
1161#define CsrWifiRouterCtrlRawSdioInitialiseCfmCreate(msg__, dst__, src__, clientData__, result__, byteRead__, byteWrite__, firmwareDownload__, reset__, coreDumpPrepare__, byteBlockRead__, gpRead16__, gpWrite16__) \
1162 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlRawSdioInitialiseCfm), GFP_KERNEL); \
1163 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RAW_SDIO_INITIALISE_CFM, dst__, src__); \
1164 msg__->clientData = (clientData__); \
1165 msg__->result = (result__); \
1166 msg__->byteRead = (byteRead__); \
1167 msg__->byteWrite = (byteWrite__); \
1168 msg__->firmwareDownload = (firmwareDownload__); \
1169 msg__->reset = (reset__); \
1170 msg__->coreDumpPrepare = (coreDumpPrepare__); \
1171 msg__->byteBlockRead = (byteBlockRead__); \
1172 msg__->gpRead16 = (gpRead16__); \
1173 msg__->gpWrite16 = (gpWrite16__);
1174
1175#define CsrWifiRouterCtrlRawSdioInitialiseCfmSendTo(dst__, src__, clientData__, result__, byteRead__, byteWrite__, firmwareDownload__, reset__, coreDumpPrepare__, byteBlockRead__, gpRead16__, gpWrite16__) \
1176 { \
1177 CsrWifiRouterCtrlRawSdioInitialiseCfm *msg__; \
1178 CsrWifiRouterCtrlRawSdioInitialiseCfmCreate(msg__, dst__, src__, clientData__, result__, byteRead__, byteWrite__, firmwareDownload__, reset__, coreDumpPrepare__, byteBlockRead__, gpRead16__, gpWrite16__); \
1179 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1180 }
1181
1182#define CsrWifiRouterCtrlRawSdioInitialiseCfmSend(dst__, clientData__, result__, byteRead__, byteWrite__, firmwareDownload__, reset__, coreDumpPrepare__, byteBlockRead__, gpRead16__, gpWrite16__) \
1183 CsrWifiRouterCtrlRawSdioInitialiseCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, result__, byteRead__, byteWrite__, firmwareDownload__, reset__, coreDumpPrepare__, byteBlockRead__, gpRead16__, gpWrite16__)
1184
1185/*******************************************************************************
1186
1187 NAME
1188 CsrWifiRouterCtrlResumeIndSend
1189
1190 DESCRIPTION
1191
1192 PARAMETERS
1193 queue - Destination Task Queue
1194 clientData -
1195 powerMaintained -
1196
1197*******************************************************************************/
1198#define CsrWifiRouterCtrlResumeIndCreate(msg__, dst__, src__, clientData__, powerMaintained__) \
1199 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlResumeInd), GFP_KERNEL); \
1200 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RESUME_IND, dst__, src__); \
1201 msg__->clientData = (clientData__); \
1202 msg__->powerMaintained = (powerMaintained__);
1203
1204#define CsrWifiRouterCtrlResumeIndSendTo(dst__, src__, clientData__, powerMaintained__) \
1205 { \
1206 CsrWifiRouterCtrlResumeInd *msg__; \
1207 CsrWifiRouterCtrlResumeIndCreate(msg__, dst__, src__, clientData__, powerMaintained__); \
1208 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1209 }
1210
1211#define CsrWifiRouterCtrlResumeIndSend(dst__, clientData__, powerMaintained__) \
1212 CsrWifiRouterCtrlResumeIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, powerMaintained__)
1213
1214/*******************************************************************************
1215
1216 NAME
1217 CsrWifiRouterCtrlResumeResSend
1218
1219 DESCRIPTION
1220
1221 PARAMETERS
1222 clientData -
1223 status -
1224
1225*******************************************************************************/
1226#define CsrWifiRouterCtrlResumeResCreate(msg__, dst__, src__, clientData__, status__) \
1227 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlResumeRes), GFP_KERNEL); \
1228 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_RESUME_RES, dst__, src__); \
1229 msg__->clientData = (clientData__); \
1230 msg__->status = (status__);
1231
1232#define CsrWifiRouterCtrlResumeResSendTo(dst__, src__, clientData__, status__) \
1233 { \
1234 CsrWifiRouterCtrlResumeRes *msg__; \
1235 CsrWifiRouterCtrlResumeResCreate(msg__, dst__, src__, clientData__, status__); \
1236 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1237 }
1238
1239#define CsrWifiRouterCtrlResumeResSend(src__, clientData__, status__) \
1240 CsrWifiRouterCtrlResumeResSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__, status__)
1241
1242/*******************************************************************************
1243
1244 NAME
1245 CsrWifiRouterCtrlStaInactiveIndSend
1246
1247 DESCRIPTION
1248
1249 PARAMETERS
1250 queue - Destination Task Queue
1251 clientData -
1252 interfaceTag -
1253 staAddress -
1254
1255*******************************************************************************/
1256#define CsrWifiRouterCtrlStaInactiveIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, staAddress__) \
1257 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlStaInactiveInd), GFP_KERNEL); \
1258 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_STA_INACTIVE_IND, dst__, src__); \
1259 msg__->clientData = (clientData__); \
1260 msg__->interfaceTag = (interfaceTag__); \
1261 msg__->staAddress = (staAddress__);
1262
1263#define CsrWifiRouterCtrlStaInactiveIndSendTo(dst__, src__, clientData__, interfaceTag__, staAddress__) \
1264 { \
1265 CsrWifiRouterCtrlStaInactiveInd *msg__; \
1266 CsrWifiRouterCtrlStaInactiveIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, staAddress__); \
1267 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1268 }
1269
1270#define CsrWifiRouterCtrlStaInactiveIndSend(dst__, clientData__, interfaceTag__, staAddress__) \
1271 CsrWifiRouterCtrlStaInactiveIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, staAddress__)
1272
1273/*******************************************************************************
1274
1275 NAME
1276 CsrWifiRouterCtrlSuspendIndSend
1277
1278 DESCRIPTION
1279
1280 PARAMETERS
1281 queue - Destination Task Queue
1282 clientData -
1283 hardSuspend -
1284 d3Suspend -
1285
1286*******************************************************************************/
1287#define CsrWifiRouterCtrlSuspendIndCreate(msg__, dst__, src__, clientData__, hardSuspend__, d3Suspend__) \
1288 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlSuspendInd), GFP_KERNEL); \
1289 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_SUSPEND_IND, dst__, src__); \
1290 msg__->clientData = (clientData__); \
1291 msg__->hardSuspend = (hardSuspend__); \
1292 msg__->d3Suspend = (d3Suspend__);
1293
1294#define CsrWifiRouterCtrlSuspendIndSendTo(dst__, src__, clientData__, hardSuspend__, d3Suspend__) \
1295 { \
1296 CsrWifiRouterCtrlSuspendInd *msg__; \
1297 CsrWifiRouterCtrlSuspendIndCreate(msg__, dst__, src__, clientData__, hardSuspend__, d3Suspend__); \
1298 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1299 }
1300
1301#define CsrWifiRouterCtrlSuspendIndSend(dst__, clientData__, hardSuspend__, d3Suspend__) \
1302 CsrWifiRouterCtrlSuspendIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, hardSuspend__, d3Suspend__)
1303
1304/*******************************************************************************
1305
1306 NAME
1307 CsrWifiRouterCtrlSuspendResSend
1308
1309 DESCRIPTION
1310
1311 PARAMETERS
1312 clientData -
1313 status -
1314
1315*******************************************************************************/
1316#define CsrWifiRouterCtrlSuspendResCreate(msg__, dst__, src__, clientData__, status__) \
1317 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlSuspendRes), GFP_KERNEL); \
1318 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_SUSPEND_RES, dst__, src__); \
1319 msg__->clientData = (clientData__); \
1320 msg__->status = (status__);
1321
1322#define CsrWifiRouterCtrlSuspendResSendTo(dst__, src__, clientData__, status__) \
1323 { \
1324 CsrWifiRouterCtrlSuspendRes *msg__; \
1325 CsrWifiRouterCtrlSuspendResCreate(msg__, dst__, src__, clientData__, status__); \
1326 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1327 }
1328
1329#define CsrWifiRouterCtrlSuspendResSend(src__, clientData__, status__) \
1330 CsrWifiRouterCtrlSuspendResSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__, status__)
1331
1332/*******************************************************************************
1333
1334 NAME
1335 CsrWifiRouterCtrlTclasAddReqSend
1336
1337 DESCRIPTION
1338
1339 PARAMETERS
1340 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1341 interfaceTag -
1342 clientData -
1343 tclasLength -
1344 tclas -
1345
1346*******************************************************************************/
1347#define CsrWifiRouterCtrlTclasAddReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, tclasLength__, tclas__) \
1348 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTclasAddReq), GFP_KERNEL); \
1349 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_REQ, dst__, src__); \
1350 msg__->interfaceTag = (interfaceTag__); \
1351 msg__->clientData = (clientData__); \
1352 msg__->tclasLength = (tclasLength__); \
1353 msg__->tclas = (tclas__);
1354
1355#define CsrWifiRouterCtrlTclasAddReqSendTo(dst__, src__, interfaceTag__, clientData__, tclasLength__, tclas__) \
1356 { \
1357 CsrWifiRouterCtrlTclasAddReq *msg__; \
1358 CsrWifiRouterCtrlTclasAddReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, tclasLength__, tclas__); \
1359 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1360 }
1361
1362#define CsrWifiRouterCtrlTclasAddReqSend(src__, interfaceTag__, clientData__, tclasLength__, tclas__) \
1363 CsrWifiRouterCtrlTclasAddReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, tclasLength__, tclas__)
1364
1365/*******************************************************************************
1366
1367 NAME
1368 CsrWifiRouterCtrlTclasAddCfmSend
1369
1370 DESCRIPTION
1371
1372 PARAMETERS
1373 queue - Destination Task Queue
1374 clientData -
1375 interfaceTag -
1376 status -
1377
1378*******************************************************************************/
1379#define CsrWifiRouterCtrlTclasAddCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \
1380 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTclasAddCfm), GFP_KERNEL); \
1381 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_CFM, dst__, src__); \
1382 msg__->clientData = (clientData__); \
1383 msg__->interfaceTag = (interfaceTag__); \
1384 msg__->status = (status__);
1385
1386#define CsrWifiRouterCtrlTclasAddCfmSendTo(dst__, src__, clientData__, interfaceTag__, status__) \
1387 { \
1388 CsrWifiRouterCtrlTclasAddCfm *msg__; \
1389 CsrWifiRouterCtrlTclasAddCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__); \
1390 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1391 }
1392
1393#define CsrWifiRouterCtrlTclasAddCfmSend(dst__, clientData__, interfaceTag__, status__) \
1394 CsrWifiRouterCtrlTclasAddCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, status__)
1395
1396/*******************************************************************************
1397
1398 NAME
1399 CsrWifiRouterCtrlTclasDelReqSend
1400
1401 DESCRIPTION
1402
1403 PARAMETERS
1404 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1405 interfaceTag -
1406 clientData -
1407 tclasLength -
1408 tclas -
1409
1410*******************************************************************************/
1411#define CsrWifiRouterCtrlTclasDelReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, tclasLength__, tclas__) \
1412 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTclasDelReq), GFP_KERNEL); \
1413 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_REQ, dst__, src__); \
1414 msg__->interfaceTag = (interfaceTag__); \
1415 msg__->clientData = (clientData__); \
1416 msg__->tclasLength = (tclasLength__); \
1417 msg__->tclas = (tclas__);
1418
1419#define CsrWifiRouterCtrlTclasDelReqSendTo(dst__, src__, interfaceTag__, clientData__, tclasLength__, tclas__) \
1420 { \
1421 CsrWifiRouterCtrlTclasDelReq *msg__; \
1422 CsrWifiRouterCtrlTclasDelReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, tclasLength__, tclas__); \
1423 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1424 }
1425
1426#define CsrWifiRouterCtrlTclasDelReqSend(src__, interfaceTag__, clientData__, tclasLength__, tclas__) \
1427 CsrWifiRouterCtrlTclasDelReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, tclasLength__, tclas__)
1428
1429/*******************************************************************************
1430
1431 NAME
1432 CsrWifiRouterCtrlTclasDelCfmSend
1433
1434 DESCRIPTION
1435
1436 PARAMETERS
1437 queue - Destination Task Queue
1438 clientData -
1439 interfaceTag -
1440 status -
1441
1442*******************************************************************************/
1443#define CsrWifiRouterCtrlTclasDelCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__) \
1444 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTclasDelCfm), GFP_KERNEL); \
1445 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_CFM, dst__, src__); \
1446 msg__->clientData = (clientData__); \
1447 msg__->interfaceTag = (interfaceTag__); \
1448 msg__->status = (status__);
1449
1450#define CsrWifiRouterCtrlTclasDelCfmSendTo(dst__, src__, clientData__, interfaceTag__, status__) \
1451 { \
1452 CsrWifiRouterCtrlTclasDelCfm *msg__; \
1453 CsrWifiRouterCtrlTclasDelCfmCreate(msg__, dst__, src__, clientData__, interfaceTag__, status__); \
1454 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1455 }
1456
1457#define CsrWifiRouterCtrlTclasDelCfmSend(dst__, clientData__, interfaceTag__, status__) \
1458 CsrWifiRouterCtrlTclasDelCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, status__)
1459
1460/*******************************************************************************
1461
1462 NAME
1463 CsrWifiRouterCtrlTrafficClassificationReqSend
1464
1465 DESCRIPTION
1466
1467 PARAMETERS
1468 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1469 interfaceTag -
1470 clientData -
1471 trafficType -
1472 period -
1473
1474*******************************************************************************/
1475#define CsrWifiRouterCtrlTrafficClassificationReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, trafficType__, period__) \
1476 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTrafficClassificationReq), GFP_KERNEL); \
1477 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TRAFFIC_CLASSIFICATION_REQ, dst__, src__); \
1478 msg__->interfaceTag = (interfaceTag__); \
1479 msg__->clientData = (clientData__); \
1480 msg__->trafficType = (trafficType__); \
1481 msg__->period = (period__);
1482
1483#define CsrWifiRouterCtrlTrafficClassificationReqSendTo(dst__, src__, interfaceTag__, clientData__, trafficType__, period__) \
1484 { \
1485 CsrWifiRouterCtrlTrafficClassificationReq *msg__; \
1486 CsrWifiRouterCtrlTrafficClassificationReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, trafficType__, period__); \
1487 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1488 }
1489
1490#define CsrWifiRouterCtrlTrafficClassificationReqSend(src__, interfaceTag__, clientData__, trafficType__, period__) \
1491 CsrWifiRouterCtrlTrafficClassificationReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, trafficType__, period__)
1492
1493/*******************************************************************************
1494
1495 NAME
1496 CsrWifiRouterCtrlTrafficConfigReqSend
1497
1498 DESCRIPTION
1499
1500 PARAMETERS
1501 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1502 interfaceTag -
1503 clientData -
1504 trafficConfigType -
1505 config -
1506
1507*******************************************************************************/
1508#define CsrWifiRouterCtrlTrafficConfigReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, trafficConfigType__, config__) \
1509 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTrafficConfigReq), GFP_KERNEL); \
1510 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_REQ, dst__, src__); \
1511 msg__->interfaceTag = (interfaceTag__); \
1512 msg__->clientData = (clientData__); \
1513 msg__->trafficConfigType = (trafficConfigType__); \
1514 msg__->config = (config__);
1515
1516#define CsrWifiRouterCtrlTrafficConfigReqSendTo(dst__, src__, interfaceTag__, clientData__, trafficConfigType__, config__) \
1517 { \
1518 CsrWifiRouterCtrlTrafficConfigReq *msg__; \
1519 CsrWifiRouterCtrlTrafficConfigReqCreate(msg__, dst__, src__, interfaceTag__, clientData__, trafficConfigType__, config__); \
1520 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1521 }
1522
1523#define CsrWifiRouterCtrlTrafficConfigReqSend(src__, interfaceTag__, clientData__, trafficConfigType__, config__) \
1524 CsrWifiRouterCtrlTrafficConfigReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, clientData__, trafficConfigType__, config__)
1525
1526/*******************************************************************************
1527
1528 NAME
1529 CsrWifiRouterCtrlTrafficProtocolIndSend
1530
1531 DESCRIPTION
1532
1533 PARAMETERS
1534 queue - Destination Task Queue
1535 clientData -
1536 interfaceTag -
1537 packetType -
1538 direction -
1539 srcAddress -
1540
1541*******************************************************************************/
1542#define CsrWifiRouterCtrlTrafficProtocolIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, packetType__, direction__, srcAddress__) \
1543 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTrafficProtocolInd), GFP_KERNEL); \
1544 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TRAFFIC_PROTOCOL_IND, dst__, src__); \
1545 msg__->clientData = (clientData__); \
1546 msg__->interfaceTag = (interfaceTag__); \
1547 msg__->packetType = (packetType__); \
1548 msg__->direction = (direction__); \
1549 msg__->srcAddress = (srcAddress__);
1550
1551#define CsrWifiRouterCtrlTrafficProtocolIndSendTo(dst__, src__, clientData__, interfaceTag__, packetType__, direction__, srcAddress__) \
1552 { \
1553 CsrWifiRouterCtrlTrafficProtocolInd *msg__; \
1554 CsrWifiRouterCtrlTrafficProtocolIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, packetType__, direction__, srcAddress__); \
1555 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1556 }
1557
1558#define CsrWifiRouterCtrlTrafficProtocolIndSend(dst__, clientData__, interfaceTag__, packetType__, direction__, srcAddress__) \
1559 CsrWifiRouterCtrlTrafficProtocolIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, packetType__, direction__, srcAddress__)
1560
1561/*******************************************************************************
1562
1563 NAME
1564 CsrWifiRouterCtrlTrafficSampleIndSend
1565
1566 DESCRIPTION
1567
1568 PARAMETERS
1569 queue - Destination Task Queue
1570 clientData -
1571 interfaceTag -
1572 stats -
1573
1574*******************************************************************************/
1575#define CsrWifiRouterCtrlTrafficSampleIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, stats__) \
1576 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlTrafficSampleInd), GFP_KERNEL); \
1577 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_TRAFFIC_SAMPLE_IND, dst__, src__); \
1578 msg__->clientData = (clientData__); \
1579 msg__->interfaceTag = (interfaceTag__); \
1580 msg__->stats = (stats__);
1581
1582#define CsrWifiRouterCtrlTrafficSampleIndSendTo(dst__, src__, clientData__, interfaceTag__, stats__) \
1583 { \
1584 CsrWifiRouterCtrlTrafficSampleInd *msg__; \
1585 CsrWifiRouterCtrlTrafficSampleIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, stats__); \
1586 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1587 }
1588
1589#define CsrWifiRouterCtrlTrafficSampleIndSend(dst__, clientData__, interfaceTag__, stats__) \
1590 CsrWifiRouterCtrlTrafficSampleIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, stats__)
1591
1592/*******************************************************************************
1593
1594 NAME
1595 CsrWifiRouterCtrlUnexpectedFrameIndSend
1596
1597 DESCRIPTION
1598
1599 PARAMETERS
1600 queue - Destination Task Queue
1601 clientData -
1602 interfaceTag -
1603 peerMacAddress -
1604
1605*******************************************************************************/
1606#define CsrWifiRouterCtrlUnexpectedFrameIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__) \
1607 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlUnexpectedFrameInd), GFP_KERNEL); \
1608 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_UNEXPECTED_FRAME_IND, dst__, src__); \
1609 msg__->clientData = (clientData__); \
1610 msg__->interfaceTag = (interfaceTag__); \
1611 msg__->peerMacAddress = (peerMacAddress__);
1612
1613#define CsrWifiRouterCtrlUnexpectedFrameIndSendTo(dst__, src__, clientData__, interfaceTag__, peerMacAddress__) \
1614 { \
1615 CsrWifiRouterCtrlUnexpectedFrameInd *msg__; \
1616 CsrWifiRouterCtrlUnexpectedFrameIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, peerMacAddress__); \
1617 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1618 }
1619
1620#define CsrWifiRouterCtrlUnexpectedFrameIndSend(dst__, clientData__, interfaceTag__, peerMacAddress__) \
1621 CsrWifiRouterCtrlUnexpectedFrameIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, peerMacAddress__)
1622
1623/*******************************************************************************
1624
1625 NAME
1626 CsrWifiRouterCtrlWapiFilterReqSend
1627
1628 DESCRIPTION
1629
1630 PARAMETERS
1631 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1632 interfaceTag -
1633 isWapiConnected -
1634
1635*******************************************************************************/
1636#define CsrWifiRouterCtrlWapiFilterReqCreate(msg__, dst__, src__, interfaceTag__, isWapiConnected__) \
1637 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWapiFilterReq), GFP_KERNEL); \
1638 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_FILTER_REQ, dst__, src__); \
1639 msg__->interfaceTag = (interfaceTag__); \
1640 msg__->isWapiConnected = (isWapiConnected__);
1641
1642#define CsrWifiRouterCtrlWapiFilterReqSendTo(dst__, src__, interfaceTag__, isWapiConnected__) \
1643 { \
1644 CsrWifiRouterCtrlWapiFilterReq *msg__; \
1645 CsrWifiRouterCtrlWapiFilterReqCreate(msg__, dst__, src__, interfaceTag__, isWapiConnected__); \
1646 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1647 }
1648
1649#define CsrWifiRouterCtrlWapiFilterReqSend(src__, interfaceTag__, isWapiConnected__) \
1650 CsrWifiRouterCtrlWapiFilterReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, isWapiConnected__)
1651
1652/*******************************************************************************
1653
1654 NAME
1655 CsrWifiRouterCtrlWapiMulticastFilterReqSend
1656
1657 DESCRIPTION
1658
1659 PARAMETERS
1660 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1661 interfaceTag -
1662 status -
1663
1664*******************************************************************************/
1665#define CsrWifiRouterCtrlWapiMulticastFilterReqCreate(msg__, dst__, src__, interfaceTag__, status__) \
1666 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWapiMulticastFilterReq), GFP_KERNEL); \
1667 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_FILTER_REQ, dst__, src__); \
1668 msg__->interfaceTag = (interfaceTag__); \
1669 msg__->status = (status__);
1670
1671#define CsrWifiRouterCtrlWapiMulticastFilterReqSendTo(dst__, src__, interfaceTag__, status__) \
1672 { \
1673 CsrWifiRouterCtrlWapiMulticastFilterReq *msg__; \
1674 CsrWifiRouterCtrlWapiMulticastFilterReqCreate(msg__, dst__, src__, interfaceTag__, status__); \
1675 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1676 }
1677
1678#define CsrWifiRouterCtrlWapiMulticastFilterReqSend(src__, interfaceTag__, status__) \
1679 CsrWifiRouterCtrlWapiMulticastFilterReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, status__)
1680
1681/*******************************************************************************
1682
1683 NAME
1684 CsrWifiRouterCtrlWapiRxMicCheckIndSend
1685
1686 DESCRIPTION
1687
1688 PARAMETERS
1689 queue - Destination Task Queue
1690 clientData -
1691 interfaceTag -
1692 signalLength -
1693 signal -
1694 dataLength -
1695 data -
1696
1697*******************************************************************************/
1698#define CsrWifiRouterCtrlWapiRxMicCheckIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \
1699 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWapiRxMicCheckInd), GFP_KERNEL); \
1700 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_RX_MIC_CHECK_IND, dst__, src__); \
1701 msg__->clientData = (clientData__); \
1702 msg__->interfaceTag = (interfaceTag__); \
1703 msg__->signalLength = (signalLength__); \
1704 msg__->signal = (signal__); \
1705 msg__->dataLength = (dataLength__); \
1706 msg__->data = (data__);
1707
1708#define CsrWifiRouterCtrlWapiRxMicCheckIndSendTo(dst__, src__, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \
1709 { \
1710 CsrWifiRouterCtrlWapiRxMicCheckInd *msg__; \
1711 CsrWifiRouterCtrlWapiRxMicCheckIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__); \
1712 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1713 }
1714
1715#define CsrWifiRouterCtrlWapiRxMicCheckIndSend(dst__, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \
1716 CsrWifiRouterCtrlWapiRxMicCheckIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, signalLength__, signal__, dataLength__, data__)
1717
1718/*******************************************************************************
1719
1720 NAME
1721 CsrWifiRouterCtrlWapiRxPktReqSend
1722
1723 DESCRIPTION
1724
1725 PARAMETERS
1726 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1727 interfaceTag -
1728 signalLength -
1729 signal -
1730 dataLength -
1731 data -
1732
1733*******************************************************************************/
1734#define CsrWifiRouterCtrlWapiRxPktReqCreate(msg__, dst__, src__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \
1735 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWapiRxPktReq), GFP_KERNEL); \
1736 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_RX_PKT_REQ, dst__, src__); \
1737 msg__->interfaceTag = (interfaceTag__); \
1738 msg__->signalLength = (signalLength__); \
1739 msg__->signal = (signal__); \
1740 msg__->dataLength = (dataLength__); \
1741 msg__->data = (data__);
1742
1743#define CsrWifiRouterCtrlWapiRxPktReqSendTo(dst__, src__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \
1744 { \
1745 CsrWifiRouterCtrlWapiRxPktReq *msg__; \
1746 CsrWifiRouterCtrlWapiRxPktReqCreate(msg__, dst__, src__, interfaceTag__, signalLength__, signal__, dataLength__, data__); \
1747 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1748 }
1749
1750#define CsrWifiRouterCtrlWapiRxPktReqSend(src__, interfaceTag__, signalLength__, signal__, dataLength__, data__) \
1751 CsrWifiRouterCtrlWapiRxPktReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, signalLength__, signal__, dataLength__, data__)
1752
1753/*******************************************************************************
1754
1755 NAME
1756 CsrWifiRouterCtrlWapiUnicastFilterReqSend
1757
1758 DESCRIPTION
1759
1760 PARAMETERS
1761 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1762 interfaceTag -
1763 status -
1764
1765*******************************************************************************/
1766#define CsrWifiRouterCtrlWapiUnicastFilterReqCreate(msg__, dst__, src__, interfaceTag__, status__) \
1767 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWapiUnicastFilterReq), GFP_KERNEL); \
1768 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_FILTER_REQ, dst__, src__); \
1769 msg__->interfaceTag = (interfaceTag__); \
1770 msg__->status = (status__);
1771
1772#define CsrWifiRouterCtrlWapiUnicastFilterReqSendTo(dst__, src__, interfaceTag__, status__) \
1773 { \
1774 CsrWifiRouterCtrlWapiUnicastFilterReq *msg__; \
1775 CsrWifiRouterCtrlWapiUnicastFilterReqCreate(msg__, dst__, src__, interfaceTag__, status__); \
1776 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1777 }
1778
1779#define CsrWifiRouterCtrlWapiUnicastFilterReqSend(src__, interfaceTag__, status__) \
1780 CsrWifiRouterCtrlWapiUnicastFilterReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, status__)
1781
1782/*******************************************************************************
1783
1784 NAME
1785 CsrWifiRouterCtrlWapiUnicastTxEncryptIndSend
1786
1787 DESCRIPTION
1788
1789 PARAMETERS
1790 queue - Destination Task Queue
1791 clientData -
1792 interfaceTag -
1793 dataLength -
1794 data -
1795
1796*******************************************************************************/
1797#define CsrWifiRouterCtrlWapiUnicastTxEncryptIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, dataLength__, data__) \
1798 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxEncryptInd), GFP_KERNEL); \
1799 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_ENCRYPT_IND, dst__, src__); \
1800 msg__->clientData = (clientData__); \
1801 msg__->interfaceTag = (interfaceTag__); \
1802 msg__->dataLength = (dataLength__); \
1803 msg__->data = (data__);
1804
1805#define CsrWifiRouterCtrlWapiUnicastTxEncryptIndSendTo(dst__, src__, clientData__, interfaceTag__, dataLength__, data__) \
1806 { \
1807 CsrWifiRouterCtrlWapiUnicastTxEncryptInd *msg__; \
1808 CsrWifiRouterCtrlWapiUnicastTxEncryptIndCreate(msg__, dst__, src__, clientData__, interfaceTag__, dataLength__, data__); \
1809 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1810 }
1811
1812#define CsrWifiRouterCtrlWapiUnicastTxEncryptIndSend(dst__, clientData__, interfaceTag__, dataLength__, data__) \
1813 CsrWifiRouterCtrlWapiUnicastTxEncryptIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, interfaceTag__, dataLength__, data__)
1814
1815/*******************************************************************************
1816
1817 NAME
1818 CsrWifiRouterCtrlWapiUnicastTxPktReqSend
1819
1820 DESCRIPTION
1821
1822 PARAMETERS
1823 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1824 interfaceTag -
1825 dataLength -
1826 data -
1827
1828*******************************************************************************/
1829#define CsrWifiRouterCtrlWapiUnicastTxPktReqCreate(msg__, dst__, src__, interfaceTag__, dataLength__, data__) \
1830 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxPktReq), GFP_KERNEL); \
1831 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_PKT_REQ, dst__, src__); \
1832 msg__->interfaceTag = (interfaceTag__); \
1833 msg__->dataLength = (dataLength__); \
1834 msg__->data = (data__);
1835
1836#define CsrWifiRouterCtrlWapiUnicastTxPktReqSendTo(dst__, src__, interfaceTag__, dataLength__, data__) \
1837 { \
1838 CsrWifiRouterCtrlWapiUnicastTxPktReq *msg__; \
1839 CsrWifiRouterCtrlWapiUnicastTxPktReqCreate(msg__, dst__, src__, interfaceTag__, dataLength__, data__); \
1840 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1841 }
1842
1843#define CsrWifiRouterCtrlWapiUnicastTxPktReqSend(src__, interfaceTag__, dataLength__, data__) \
1844 CsrWifiRouterCtrlWapiUnicastTxPktReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, dataLength__, data__)
1845
1846/*******************************************************************************
1847
1848 NAME
1849 CsrWifiRouterCtrlWifiOffReqSend
1850
1851 DESCRIPTION
1852
1853 PARAMETERS
1854 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1855 clientData -
1856
1857*******************************************************************************/
1858#define CsrWifiRouterCtrlWifiOffReqCreate(msg__, dst__, src__, clientData__) \
1859 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOffReq), GFP_KERNEL); \
1860 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_OFF_REQ, dst__, src__); \
1861 msg__->clientData = (clientData__);
1862
1863#define CsrWifiRouterCtrlWifiOffReqSendTo(dst__, src__, clientData__) \
1864 { \
1865 CsrWifiRouterCtrlWifiOffReq *msg__; \
1866 CsrWifiRouterCtrlWifiOffReqCreate(msg__, dst__, src__, clientData__); \
1867 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1868 }
1869
1870#define CsrWifiRouterCtrlWifiOffReqSend(src__, clientData__) \
1871 CsrWifiRouterCtrlWifiOffReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__)
1872
1873/*******************************************************************************
1874
1875 NAME
1876 CsrWifiRouterCtrlWifiOffIndSend
1877
1878 DESCRIPTION
1879
1880 PARAMETERS
1881 queue - Destination Task Queue
1882 clientData -
1883 controlIndication -
1884
1885*******************************************************************************/
1886#define CsrWifiRouterCtrlWifiOffIndCreate(msg__, dst__, src__, clientData__, controlIndication__) \
1887 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOffInd), GFP_KERNEL); \
1888 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_OFF_IND, dst__, src__); \
1889 msg__->clientData = (clientData__); \
1890 msg__->controlIndication = (controlIndication__);
1891
1892#define CsrWifiRouterCtrlWifiOffIndSendTo(dst__, src__, clientData__, controlIndication__) \
1893 { \
1894 CsrWifiRouterCtrlWifiOffInd *msg__; \
1895 CsrWifiRouterCtrlWifiOffIndCreate(msg__, dst__, src__, clientData__, controlIndication__); \
1896 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1897 }
1898
1899#define CsrWifiRouterCtrlWifiOffIndSend(dst__, clientData__, controlIndication__) \
1900 CsrWifiRouterCtrlWifiOffIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, controlIndication__)
1901
1902/*******************************************************************************
1903
1904 NAME
1905 CsrWifiRouterCtrlWifiOffResSend
1906
1907 DESCRIPTION
1908
1909 PARAMETERS
1910 clientData -
1911
1912*******************************************************************************/
1913#define CsrWifiRouterCtrlWifiOffResCreate(msg__, dst__, src__, clientData__) \
1914 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOffRes), GFP_KERNEL); \
1915 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_OFF_RES, dst__, src__); \
1916 msg__->clientData = (clientData__);
1917
1918#define CsrWifiRouterCtrlWifiOffResSendTo(dst__, src__, clientData__) \
1919 { \
1920 CsrWifiRouterCtrlWifiOffRes *msg__; \
1921 CsrWifiRouterCtrlWifiOffResCreate(msg__, dst__, src__, clientData__); \
1922 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1923 }
1924
1925#define CsrWifiRouterCtrlWifiOffResSend(src__, clientData__) \
1926 CsrWifiRouterCtrlWifiOffResSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__)
1927
1928/*******************************************************************************
1929
1930 NAME
1931 CsrWifiRouterCtrlWifiOffCfmSend
1932
1933 DESCRIPTION
1934
1935 PARAMETERS
1936 queue - Destination Task Queue
1937 clientData -
1938
1939*******************************************************************************/
1940#define CsrWifiRouterCtrlWifiOffCfmCreate(msg__, dst__, src__, clientData__) \
1941 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOffCfm), GFP_KERNEL); \
1942 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_OFF_CFM, dst__, src__); \
1943 msg__->clientData = (clientData__);
1944
1945#define CsrWifiRouterCtrlWifiOffCfmSendTo(dst__, src__, clientData__) \
1946 { \
1947 CsrWifiRouterCtrlWifiOffCfm *msg__; \
1948 CsrWifiRouterCtrlWifiOffCfmCreate(msg__, dst__, src__, clientData__); \
1949 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1950 }
1951
1952#define CsrWifiRouterCtrlWifiOffCfmSend(dst__, clientData__) \
1953 CsrWifiRouterCtrlWifiOffCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__)
1954
1955/*******************************************************************************
1956
1957 NAME
1958 CsrWifiRouterCtrlWifiOnReqSend
1959
1960 DESCRIPTION
1961
1962 PARAMETERS
1963 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1964 clientData -
1965 dataLength - Number of bytes in the buffer pointed to by 'data'
1966 data - Pointer to the buffer containing 'dataLength' bytes
1967
1968*******************************************************************************/
1969#define CsrWifiRouterCtrlWifiOnReqCreate(msg__, dst__, src__, clientData__, dataLength__, data__) \
1970 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnReq), GFP_KERNEL); \
1971 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_ON_REQ, dst__, src__); \
1972 msg__->clientData = (clientData__); \
1973 msg__->dataLength = (dataLength__); \
1974 msg__->data = (data__);
1975
1976#define CsrWifiRouterCtrlWifiOnReqSendTo(dst__, src__, clientData__, dataLength__, data__) \
1977 { \
1978 CsrWifiRouterCtrlWifiOnReq *msg__; \
1979 CsrWifiRouterCtrlWifiOnReqCreate(msg__, dst__, src__, clientData__, dataLength__, data__); \
1980 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
1981 }
1982
1983#define CsrWifiRouterCtrlWifiOnReqSend(src__, clientData__, dataLength__, data__) \
1984 CsrWifiRouterCtrlWifiOnReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__, dataLength__, data__)
1985
1986/*******************************************************************************
1987
1988 NAME
1989 CsrWifiRouterCtrlWifiOnIndSend
1990
1991 DESCRIPTION
1992
1993 PARAMETERS
1994 queue - Destination Task Queue
1995 clientData -
1996 status -
1997 versions -
1998
1999*******************************************************************************/
2000#define CsrWifiRouterCtrlWifiOnIndCreate(msg__, dst__, src__, clientData__, status__, versions__) \
2001 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnInd), GFP_KERNEL); \
2002 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_ON_IND, dst__, src__); \
2003 msg__->clientData = (clientData__); \
2004 msg__->status = (status__); \
2005 msg__->versions = (versions__);
2006
2007#define CsrWifiRouterCtrlWifiOnIndSendTo(dst__, src__, clientData__, status__, versions__) \
2008 { \
2009 CsrWifiRouterCtrlWifiOnInd *msg__; \
2010 CsrWifiRouterCtrlWifiOnIndCreate(msg__, dst__, src__, clientData__, status__, versions__); \
2011 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
2012 }
2013
2014#define CsrWifiRouterCtrlWifiOnIndSend(dst__, clientData__, status__, versions__) \
2015 CsrWifiRouterCtrlWifiOnIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, status__, versions__)
2016
2017/*******************************************************************************
2018
2019 NAME
2020 CsrWifiRouterCtrlWifiOnResSend
2021
2022 DESCRIPTION
2023
2024 PARAMETERS
2025 clientData -
2026 status -
2027 numInterfaceAddress -
2028 stationMacAddress - array size 1 MUST match CSR_WIFI_NUM_INTERFACES
2029 smeVersions -
2030 scheduledInterrupt -
2031
2032*******************************************************************************/
2033#define CsrWifiRouterCtrlWifiOnResCreate(msg__, dst__, src__, clientData__, status__, numInterfaceAddress__, stationMacAddress__, smeVersions__, scheduledInterrupt__) \
2034 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnRes), GFP_KERNEL); \
2035 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_ON_RES, dst__, src__); \
2036 msg__->clientData = (clientData__); \
2037 msg__->status = (status__); \
2038 msg__->numInterfaceAddress = (numInterfaceAddress__); \
2039 memcpy(msg__->stationMacAddress, (stationMacAddress__), sizeof(CsrWifiMacAddress) * 2); \
2040 msg__->smeVersions = (smeVersions__); \
2041 msg__->scheduledInterrupt = (scheduledInterrupt__);
2042
2043#define CsrWifiRouterCtrlWifiOnResSendTo(dst__, src__, clientData__, status__, numInterfaceAddress__, stationMacAddress__, smeVersions__, scheduledInterrupt__) \
2044 { \
2045 CsrWifiRouterCtrlWifiOnRes *msg__; \
2046 CsrWifiRouterCtrlWifiOnResCreate(msg__, dst__, src__, clientData__, status__, numInterfaceAddress__, stationMacAddress__, smeVersions__, scheduledInterrupt__); \
2047 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
2048 }
2049
2050#define CsrWifiRouterCtrlWifiOnResSend(src__, clientData__, status__, numInterfaceAddress__, stationMacAddress__, smeVersions__, scheduledInterrupt__) \
2051 CsrWifiRouterCtrlWifiOnResSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, clientData__, status__, numInterfaceAddress__, stationMacAddress__, smeVersions__, scheduledInterrupt__)
2052
2053/*******************************************************************************
2054
2055 NAME
2056 CsrWifiRouterCtrlWifiOnCfmSend
2057
2058 DESCRIPTION
2059
2060 PARAMETERS
2061 queue - Destination Task Queue
2062 clientData -
2063 status -
2064
2065*******************************************************************************/
2066#define CsrWifiRouterCtrlWifiOnCfmCreate(msg__, dst__, src__, clientData__, status__) \
2067 msg__ = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnCfm), GFP_KERNEL); \
2068 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_CTRL_PRIM, CSR_WIFI_ROUTER_CTRL_WIFI_ON_CFM, dst__, src__); \
2069 msg__->clientData = (clientData__); \
2070 msg__->status = (status__);
2071
2072#define CsrWifiRouterCtrlWifiOnCfmSendTo(dst__, src__, clientData__, status__) \
2073 { \
2074 CsrWifiRouterCtrlWifiOnCfm *msg__; \
2075 CsrWifiRouterCtrlWifiOnCfmCreate(msg__, dst__, src__, clientData__, status__); \
2076 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_CTRL_PRIM, msg__); \
2077 }
2078
2079#define CsrWifiRouterCtrlWifiOnCfmSend(dst__, clientData__, status__) \
2080 CsrWifiRouterCtrlWifiOnCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, clientData__, status__)
2081
2082#endif /* CSR_WIFI_ROUTER_CTRL_LIB_H__ */
diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_prim.h b/drivers/staging/csr/csr_wifi_router_ctrl_prim.h
deleted file mode 100644
index 1312a335dd76..000000000000
--- a/drivers/staging/csr/csr_wifi_router_ctrl_prim.h
+++ /dev/null
@@ -1,2113 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_ROUTER_CTRL_PRIM_H__
14#define CSR_WIFI_ROUTER_CTRL_PRIM_H__
15
16#include <linux/types.h>
17#include "csr_prim_defs.h"
18#include "csr_sched.h"
19#include "csr_wifi_common.h"
20#include "csr_result.h"
21#include "csr_wifi_fsm_event.h"
22
23#define CSR_WIFI_ROUTER_CTRL_PRIM (0x0401)
24
25typedef CsrPrim CsrWifiRouterCtrlPrim;
26
27typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteWrite)(u8 func, u32 address, u8 data);
28typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteRead)(u8 func, u32 address, u8 *pdata);
29typedef CsrResult (*CsrWifiRouterCtrlRawSdioFirmwareDownload)(u32 length, const u8 *pdata);
30typedef CsrResult (*CsrWifiRouterCtrlRawSdioReset)(void);
31typedef CsrResult (*CsrWifiRouterCtrlRawSdioCoreDumpPrepare)(u8 suspendSme);
32typedef CsrResult (*CsrWifiRouterCtrlRawSdioByteBlockRead)(u8 func, u32 address, u8 *pdata, u32 length);
33typedef CsrResult (*CsrWifiRouterCtrlRawSdioGpRead16)(u8 func, u32 address, u16 *pdata);
34typedef CsrResult (*CsrWifiRouterCtrlRawSdioGpWrite16)(u8 func, u32 address, u16 data);
35
36/*******************************************************************************
37
38 NAME
39 CsrWifiRouterCtrlBlockAckRole
40
41 DESCRIPTION
42
43 VALUES
44 CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR
45 -
46 CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT
47 -
48
49*******************************************************************************/
50typedef u8 CsrWifiRouterCtrlBlockAckRole;
51#define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR ((CsrWifiRouterCtrlBlockAckRole) 0x00)
52#define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT ((CsrWifiRouterCtrlBlockAckRole) 0x01)
53
54/*******************************************************************************
55
56 NAME
57 CsrWifiRouterCtrlControlIndication
58
59 DESCRIPTION
60
61 VALUES
62 CSR_WIFI_ROUTER_CTRL_CONTROL_INDICATION_ERROR
63 -
64 CSR_WIFI_ROUTER_CTRL_CONTROL_INDICATION_EXIT
65 -
66 CSR_WIFI_ROUTER_CTRL_CONTROL_INDICATION_USER_REQUESTED
67 -
68
69*******************************************************************************/
70typedef u8 CsrWifiRouterCtrlControlIndication;
71#define CSR_WIFI_ROUTER_CTRL_CONTROL_INDICATION_ERROR ((CsrWifiRouterCtrlControlIndication) 0x01)
72#define CSR_WIFI_ROUTER_CTRL_CONTROL_INDICATION_EXIT ((CsrWifiRouterCtrlControlIndication) 0x02)
73#define CSR_WIFI_ROUTER_CTRL_CONTROL_INDICATION_USER_REQUESTED ((CsrWifiRouterCtrlControlIndication) 0x03)
74
75/*******************************************************************************
76
77 NAME
78 CsrWifiRouterCtrlListAction
79
80 DESCRIPTION
81
82 VALUES
83 CSR_WIFI_ROUTER_CTRL_LIST_ACTION_GET
84 -
85 CSR_WIFI_ROUTER_CTRL_LIST_ACTION_ADD
86 -
87 CSR_WIFI_ROUTER_CTRL_LIST_ACTION_REMOVE
88 -
89 CSR_WIFI_ROUTER_CTRL_LIST_ACTION_FLUSH
90 -
91
92*******************************************************************************/
93typedef u8 CsrWifiRouterCtrlListAction;
94#define CSR_WIFI_ROUTER_CTRL_LIST_ACTION_GET ((CsrWifiRouterCtrlListAction) 0x00)
95#define CSR_WIFI_ROUTER_CTRL_LIST_ACTION_ADD ((CsrWifiRouterCtrlListAction) 0x01)
96#define CSR_WIFI_ROUTER_CTRL_LIST_ACTION_REMOVE ((CsrWifiRouterCtrlListAction) 0x02)
97#define CSR_WIFI_ROUTER_CTRL_LIST_ACTION_FLUSH ((CsrWifiRouterCtrlListAction) 0x03)
98
99/*******************************************************************************
100
101 NAME
102 CsrWifiRouterCtrlLowPowerMode
103
104 DESCRIPTION
105
106 VALUES
107 CSR_WIFI_ROUTER_CTRL_LOW_POWER_MODE_DISABLED
108 -
109 CSR_WIFI_ROUTER_CTRL_LOW_POWER_MODE_ENABLED
110 -
111
112*******************************************************************************/
113typedef u16 CsrWifiRouterCtrlLowPowerMode;
114#define CSR_WIFI_ROUTER_CTRL_LOW_POWER_MODE_DISABLED ((CsrWifiRouterCtrlLowPowerMode) 0x0000)
115#define CSR_WIFI_ROUTER_CTRL_LOW_POWER_MODE_ENABLED ((CsrWifiRouterCtrlLowPowerMode) 0x0001)
116
117/*******************************************************************************
118
119 NAME
120 CsrWifiRouterCtrlMediaStatus
121
122 DESCRIPTION
123
124 VALUES
125 CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_CONNECTED
126 -
127 CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_DISCONNECTED
128 -
129
130*******************************************************************************/
131typedef u8 CsrWifiRouterCtrlMediaStatus;
132#define CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_CONNECTED ((CsrWifiRouterCtrlMediaStatus) 0x00)
133#define CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_DISCONNECTED ((CsrWifiRouterCtrlMediaStatus) 0x01)
134
135/*******************************************************************************
136
137 NAME
138 CsrWifiRouterCtrlMode
139
140 DESCRIPTION
141
142 VALUES
143 CSR_WIFI_ROUTER_CTRL_MODE_NONE -
144 CSR_WIFI_ROUTER_CTRL_MODE_IBSS -
145 CSR_WIFI_ROUTER_CTRL_MODE_STA -
146 CSR_WIFI_ROUTER_CTRL_MODE_AP -
147 CSR_WIFI_ROUTER_CTRL_MODE_MONITOR -
148 CSR_WIFI_ROUTER_CTRL_MODE_AMP -
149 CSR_WIFI_ROUTER_CTRL_MODE_P2P -
150 CSR_WIFI_ROUTER_CTRL_MODE_P2PGO -
151 CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI -
152
153*******************************************************************************/
154typedef u8 CsrWifiRouterCtrlMode;
155#define CSR_WIFI_ROUTER_CTRL_MODE_NONE ((CsrWifiRouterCtrlMode) 0x00)
156#define CSR_WIFI_ROUTER_CTRL_MODE_IBSS ((CsrWifiRouterCtrlMode) 0x01)
157#define CSR_WIFI_ROUTER_CTRL_MODE_STA ((CsrWifiRouterCtrlMode) 0x02)
158#define CSR_WIFI_ROUTER_CTRL_MODE_AP ((CsrWifiRouterCtrlMode) 0x03)
159#define CSR_WIFI_ROUTER_CTRL_MODE_MONITOR ((CsrWifiRouterCtrlMode) 0x04)
160#define CSR_WIFI_ROUTER_CTRL_MODE_AMP ((CsrWifiRouterCtrlMode) 0x05)
161#define CSR_WIFI_ROUTER_CTRL_MODE_P2P ((CsrWifiRouterCtrlMode) 0x06)
162#define CSR_WIFI_ROUTER_CTRL_MODE_P2PGO ((CsrWifiRouterCtrlMode) 0x07)
163#define CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI ((CsrWifiRouterCtrlMode) 0x08)
164
165/*******************************************************************************
166
167 NAME
168 CsrWifiRouterCtrlPeerStatus
169
170 DESCRIPTION
171
172 VALUES
173 CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE
174 -
175 CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE
176 -
177 CSR_WIFI_ROUTER_CTRL_PEER_DISCONNECTED
178 -
179
180*******************************************************************************/
181typedef u8 CsrWifiRouterCtrlPeerStatus;
182#define CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE ((CsrWifiRouterCtrlPeerStatus) 0x00)
183#define CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE ((CsrWifiRouterCtrlPeerStatus) 0x01)
184#define CSR_WIFI_ROUTER_CTRL_PEER_DISCONNECTED ((CsrWifiRouterCtrlPeerStatus) 0x02)
185
186/*******************************************************************************
187
188 NAME
189 CsrWifiRouterCtrlPortAction
190
191 DESCRIPTION
192
193 VALUES
194 CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN
195 -
196 CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD
197 -
198 CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_BLOCK
199 -
200
201*******************************************************************************/
202typedef u16 CsrWifiRouterCtrlPortAction;
203#define CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN ((CsrWifiRouterCtrlPortAction) 0x0000)
204#define CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD ((CsrWifiRouterCtrlPortAction) 0x0001)
205#define CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_BLOCK ((CsrWifiRouterCtrlPortAction) 0x0002)
206
207/*******************************************************************************
208
209 NAME
210 CsrWifiRouterCtrlPowersaveType
211
212 DESCRIPTION
213
214 VALUES
215 CSR_WIFI_ROUTER_CTRL_AC_BK_PS_INFO_PRESENT
216 - If set, AC BK PS info is present in b4 and b5
217 CSR_WIFI_ROUTER_CTRL_AC_BE_PS_INFO_PRESENT
218 - If set, AC BE PS info is present in b6 and b7
219 CSR_WIFI_ROUTER_CTRL_AC_VI_PS_INFO_PRESENT
220 - If set, AC VI PS info is present in b8 and b9
221 CSR_WIFI_ROUTER_CTRL_AC_VO_PS_INFO_PRESENT
222 - If set, AC VO PS info is present in b10 and b11
223 CSR_WIFI_ROUTER_CTRL_AC_BK_TRIGGER_ENABLED
224 -
225 CSR_WIFI_ROUTER_CTRL_AC_BK_DELIVERY_ENABLED
226 -
227 CSR_WIFI_ROUTER_CTRL_AC_BE_TRIGGER_ENABLED
228 -
229 CSR_WIFI_ROUTER_CTRL_AC_BE_DELIVERY_ENABLED
230 -
231 CSR_WIFI_ROUTER_CTRL_AC_VI_TRIGGER_ENABLED
232 -
233 CSR_WIFI_ROUTER_CTRL_AC_VI_DELIVERY_ENABLED
234 -
235 CSR_WIFI_ROUTER_CTRL_AC_VO_TRIGGER_ENABLED
236 -
237 CSR_WIFI_ROUTER_CTRL_AC_VO_DELIVERY_ENABLED
238 -
239
240*******************************************************************************/
241typedef u16 CsrWifiRouterCtrlPowersaveType;
242#define CSR_WIFI_ROUTER_CTRL_AC_BK_PS_INFO_PRESENT ((CsrWifiRouterCtrlPowersaveType) 0x0001)
243#define CSR_WIFI_ROUTER_CTRL_AC_BE_PS_INFO_PRESENT ((CsrWifiRouterCtrlPowersaveType) 0x0002)
244#define CSR_WIFI_ROUTER_CTRL_AC_VI_PS_INFO_PRESENT ((CsrWifiRouterCtrlPowersaveType) 0x0004)
245#define CSR_WIFI_ROUTER_CTRL_AC_VO_PS_INFO_PRESENT ((CsrWifiRouterCtrlPowersaveType) 0x0008)
246#define CSR_WIFI_ROUTER_CTRL_AC_BK_TRIGGER_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0010)
247#define CSR_WIFI_ROUTER_CTRL_AC_BK_DELIVERY_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0020)
248#define CSR_WIFI_ROUTER_CTRL_AC_BE_TRIGGER_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0040)
249#define CSR_WIFI_ROUTER_CTRL_AC_BE_DELIVERY_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0080)
250#define CSR_WIFI_ROUTER_CTRL_AC_VI_TRIGGER_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0100)
251#define CSR_WIFI_ROUTER_CTRL_AC_VI_DELIVERY_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0200)
252#define CSR_WIFI_ROUTER_CTRL_AC_VO_TRIGGER_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0400)
253#define CSR_WIFI_ROUTER_CTRL_AC_VO_DELIVERY_ENABLED ((CsrWifiRouterCtrlPowersaveType) 0x0800)
254
255/*******************************************************************************
256
257 NAME
258 CsrWifiRouterCtrlProtocolDirection
259
260 DESCRIPTION
261
262 VALUES
263 CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_RX
264 -
265 CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX
266 -
267
268*******************************************************************************/
269typedef u16 CsrWifiRouterCtrlProtocolDirection;
270#define CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_RX ((CsrWifiRouterCtrlProtocolDirection) 0x0000)
271#define CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX ((CsrWifiRouterCtrlProtocolDirection) 0x0001)
272
273/*******************************************************************************
274
275 NAME
276 CsrWifiRouterCtrlQoSControl
277
278 DESCRIPTION
279
280 VALUES
281 CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_OFF
282 -
283 CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_WMM_ON
284 -
285 CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_80211_ON
286 -
287
288*******************************************************************************/
289typedef u16 CsrWifiRouterCtrlQoSControl;
290#define CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_OFF ((CsrWifiRouterCtrlQoSControl) 0x0000)
291#define CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_WMM_ON ((CsrWifiRouterCtrlQoSControl) 0x0001)
292#define CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_80211_ON ((CsrWifiRouterCtrlQoSControl) 0x0002)
293
294/*******************************************************************************
295
296 NAME
297 CsrWifiRouterCtrlQueueConfig
298
299 DESCRIPTION
300 Defines which Queues are enabled for use.
301
302 VALUES
303 CSR_WIFI_ROUTER_CTRL_QUEUE_BE_ENABLE
304 -
305 CSR_WIFI_ROUTER_CTRL_QUEUE_BK_ENABLE
306 -
307 CSR_WIFI_ROUTER_CTRL_QUEUE_VI_ENABLE
308 -
309 CSR_WIFI_ROUTER_CTRL_QUEUE_VO_ENABLE
310 -
311
312*******************************************************************************/
313typedef u8 CsrWifiRouterCtrlQueueConfig;
314#define CSR_WIFI_ROUTER_CTRL_QUEUE_BE_ENABLE ((CsrWifiRouterCtrlQueueConfig) 0x01)
315#define CSR_WIFI_ROUTER_CTRL_QUEUE_BK_ENABLE ((CsrWifiRouterCtrlQueueConfig) 0x02)
316#define CSR_WIFI_ROUTER_CTRL_QUEUE_VI_ENABLE ((CsrWifiRouterCtrlQueueConfig) 0x04)
317#define CSR_WIFI_ROUTER_CTRL_QUEUE_VO_ENABLE ((CsrWifiRouterCtrlQueueConfig) 0x08)
318
319/*******************************************************************************
320
321 NAME
322 CsrWifiRouterCtrlTrafficConfigType
323
324 DESCRIPTION
325
326 VALUES
327 CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_RESET
328 -
329 CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_FILTER
330 -
331 CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_CLS
332 -
333
334*******************************************************************************/
335typedef u16 CsrWifiRouterCtrlTrafficConfigType;
336#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_RESET ((CsrWifiRouterCtrlTrafficConfigType) 0x0000)
337#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_FILTER ((CsrWifiRouterCtrlTrafficConfigType) 0x0001)
338#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_CLS ((CsrWifiRouterCtrlTrafficConfigType) 0x0002)
339
340/*******************************************************************************
341
342 NAME
343 CsrWifiRouterCtrlTrafficPacketType
344
345 DESCRIPTION
346
347 VALUES
348 CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_NONE
349 -
350 CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_EAPOL
351 -
352 CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP
353 -
354 CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP_ACK
355 -
356 CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_ARP
357 -
358 CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_AIRONET
359 -
360 CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM
361 -
362 CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_ALL
363 -
364
365*******************************************************************************/
366typedef u16 CsrWifiRouterCtrlTrafficPacketType;
367#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_NONE ((CsrWifiRouterCtrlTrafficPacketType) 0x0000)
368#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_EAPOL ((CsrWifiRouterCtrlTrafficPacketType) 0x0001)
369#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP ((CsrWifiRouterCtrlTrafficPacketType) 0x0002)
370#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP_ACK ((CsrWifiRouterCtrlTrafficPacketType) 0x0004)
371#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_ARP ((CsrWifiRouterCtrlTrafficPacketType) 0x0008)
372#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_AIRONET ((CsrWifiRouterCtrlTrafficPacketType) 0x0010)
373#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM ((CsrWifiRouterCtrlTrafficPacketType) 0x0020)
374#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_ALL ((CsrWifiRouterCtrlTrafficPacketType) 0x00FF)
375
376/*******************************************************************************
377
378 NAME
379 CsrWifiRouterCtrlTrafficType
380
381 DESCRIPTION
382
383 VALUES
384 CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_OCCASIONAL
385 -
386 CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_BURSTY
387 -
388 CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_PERIODIC
389 -
390 CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_CONTINUOUS
391 -
392
393*******************************************************************************/
394typedef u8 CsrWifiRouterCtrlTrafficType;
395#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_OCCASIONAL ((CsrWifiRouterCtrlTrafficType) 0x00)
396#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_BURSTY ((CsrWifiRouterCtrlTrafficType) 0x01)
397#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_PERIODIC ((CsrWifiRouterCtrlTrafficType) 0x02)
398#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_CONTINUOUS ((CsrWifiRouterCtrlTrafficType) 0x03)
399
400
401/*******************************************************************************
402
403 NAME
404 CsrWifiRouterCtrlPeerRecordHandle
405
406 DESCRIPTION
407
408*******************************************************************************/
409typedef u32 CsrWifiRouterCtrlPeerRecordHandle;
410/*******************************************************************************
411
412 NAME
413 CsrWifiRouterCtrlPowersaveTypeMask
414
415 DESCRIPTION
416 Mask type for use with the values defined by
417 CsrWifiRouterCtrlPowersaveType
418
419*******************************************************************************/
420typedef u16 CsrWifiRouterCtrlPowersaveTypeMask;
421/*******************************************************************************
422
423 NAME
424 CsrWifiRouterCtrlQueueConfigMask
425
426 DESCRIPTION
427 Mask type for use with the values defined by CsrWifiRouterCtrlQueueConfig
428
429*******************************************************************************/
430typedef u8 CsrWifiRouterCtrlQueueConfigMask;
431/*******************************************************************************
432
433 NAME
434 CsrWifiRouterCtrlRequestorInfo
435
436 DESCRIPTION
437
438*******************************************************************************/
439typedef u16 CsrWifiRouterCtrlRequestorInfo;
440/*******************************************************************************
441
442 NAME
443 CsrWifiRouterCtrlTrafficStreamId
444
445 DESCRIPTION
446
447*******************************************************************************/
448typedef u8 CsrWifiRouterCtrlTrafficStreamId;
449
450
451/*******************************************************************************
452
453 NAME
454 CsrWifiRouterCtrlSmeVersions
455
456 DESCRIPTION
457
458 MEMBERS
459 firmwarePatch -
460 smeBuild -
461 smeHip -
462
463*******************************************************************************/
464typedef struct
465{
466 u32 firmwarePatch;
467 char *smeBuild;
468 u32 smeHip;
469} CsrWifiRouterCtrlSmeVersions;
470
471/*******************************************************************************
472
473 NAME
474 CsrWifiRouterCtrlStaInfo
475
476 DESCRIPTION
477
478 MEMBERS
479 wmmOrQosEnabled -
480 powersaveMode -
481 maxSpLength -
482 listenIntervalInTus -
483
484*******************************************************************************/
485typedef struct
486{
487 u8 wmmOrQosEnabled;
488 CsrWifiRouterCtrlPowersaveTypeMask powersaveMode;
489 u8 maxSpLength;
490 u16 listenIntervalInTus;
491} CsrWifiRouterCtrlStaInfo;
492
493/*******************************************************************************
494
495 NAME
496 CsrWifiRouterCtrlTrafficFilter
497
498 DESCRIPTION
499
500 MEMBERS
501 etherType -
502 ipType -
503 udpSourcePort -
504 udpDestPort -
505
506*******************************************************************************/
507typedef struct
508{
509 u32 etherType;
510 u8 ipType;
511 u32 udpSourcePort;
512 u32 udpDestPort;
513} CsrWifiRouterCtrlTrafficFilter;
514
515/*******************************************************************************
516
517 NAME
518 CsrWifiRouterCtrlTrafficStats
519
520 DESCRIPTION
521
522 MEMBERS
523 rxMeanRate - Mean rx data rate over the interval
524 rxFramesNum - Keep number of Rx frames per second, for CYCLE_3.
525 txFramesNum - Keep number of Tx frames per second, for CYCLE_3.
526 rxBytesCount - Keep calculated Rx throughput per second, for CYCLE_2.
527 txBytesCount - Keep calculated Tx throughput per second, for CYCLE_2.
528 intervals - array size 11 MUST match TA_INTERVALS_NUM
529
530*******************************************************************************/
531typedef struct
532{
533 u32 rxMeanRate;
534 u32 rxFramesNum;
535 u32 txFramesNum;
536 u32 rxBytesCount;
537 u32 txBytesCount;
538 u8 intervals[11];
539} CsrWifiRouterCtrlTrafficStats;
540
541/*******************************************************************************
542
543 NAME
544 CsrWifiRouterCtrlVersions
545
546 DESCRIPTION
547
548 MEMBERS
549 chipId -
550 chipVersion -
551 firmwareBuild -
552 firmwareHip -
553 routerBuild -
554 routerHip -
555
556*******************************************************************************/
557typedef struct
558{
559 u32 chipId;
560 u32 chipVersion;
561 u32 firmwareBuild;
562 u32 firmwareHip;
563 char *routerBuild;
564 u32 routerHip;
565} CsrWifiRouterCtrlVersions;
566
567/*******************************************************************************
568
569 NAME
570 CsrWifiRouterCtrlTrafficConfig
571
572 DESCRIPTION
573
574 MEMBERS
575 packetFilter -
576 customFilter -
577
578*******************************************************************************/
579typedef struct
580{
581 u16 packetFilter;
582 CsrWifiRouterCtrlTrafficFilter customFilter;
583} CsrWifiRouterCtrlTrafficConfig;
584
585
586/* Downstream */
587#define CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST (0x0000)
588
589#define CSR_WIFI_ROUTER_CTRL_CONFIGURE_POWER_MODE_REQ ((CsrWifiRouterCtrlPrim) (0x0000 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
590#define CSR_WIFI_ROUTER_CTRL_HIP_REQ ((CsrWifiRouterCtrlPrim) (0x0001 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
591#define CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_REQ ((CsrWifiRouterCtrlPrim) (0x0002 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
592#define CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_RES ((CsrWifiRouterCtrlPrim) (0x0003 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
593#define CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_REQ ((CsrWifiRouterCtrlPrim) (0x0004 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
594#define CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_REQ ((CsrWifiRouterCtrlPrim) (0x0005 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
595#define CSR_WIFI_ROUTER_CTRL_SUSPEND_RES ((CsrWifiRouterCtrlPrim) (0x0006 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
596#define CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_REQ ((CsrWifiRouterCtrlPrim) (0x0007 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
597#define CSR_WIFI_ROUTER_CTRL_RESUME_RES ((CsrWifiRouterCtrlPrim) (0x0008 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
598#define CSR_WIFI_ROUTER_CTRL_RAW_SDIO_DEINITIALISE_REQ ((CsrWifiRouterCtrlPrim) (0x0009 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
599#define CSR_WIFI_ROUTER_CTRL_RAW_SDIO_INITIALISE_REQ ((CsrWifiRouterCtrlPrim) (0x000A + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
600#define CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_REQ ((CsrWifiRouterCtrlPrim) (0x000B + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
601#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_CLASSIFICATION_REQ ((CsrWifiRouterCtrlPrim) (0x000C + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
602#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_REQ ((CsrWifiRouterCtrlPrim) (0x000D + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
603#define CSR_WIFI_ROUTER_CTRL_WIFI_OFF_REQ ((CsrWifiRouterCtrlPrim) (0x000E + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
604#define CSR_WIFI_ROUTER_CTRL_WIFI_OFF_RES ((CsrWifiRouterCtrlPrim) (0x000F + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
605#define CSR_WIFI_ROUTER_CTRL_WIFI_ON_REQ ((CsrWifiRouterCtrlPrim) (0x0010 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
606#define CSR_WIFI_ROUTER_CTRL_WIFI_ON_RES ((CsrWifiRouterCtrlPrim) (0x0011 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
607#define CSR_WIFI_ROUTER_CTRL_M4_TRANSMIT_REQ ((CsrWifiRouterCtrlPrim) (0x0012 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
608#define CSR_WIFI_ROUTER_CTRL_MODE_SET_REQ ((CsrWifiRouterCtrlPrim) (0x0013 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
609#define CSR_WIFI_ROUTER_CTRL_PEER_ADD_REQ ((CsrWifiRouterCtrlPrim) (0x0014 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
610#define CSR_WIFI_ROUTER_CTRL_PEER_DEL_REQ ((CsrWifiRouterCtrlPrim) (0x0015 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
611#define CSR_WIFI_ROUTER_CTRL_PEER_UPDATE_REQ ((CsrWifiRouterCtrlPrim) (0x0016 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
612#define CSR_WIFI_ROUTER_CTRL_CAPABILITIES_REQ ((CsrWifiRouterCtrlPrim) (0x0017 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
613#define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_REQ ((CsrWifiRouterCtrlPrim) (0x0018 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
614#define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_REQ ((CsrWifiRouterCtrlPrim) (0x0019 + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
615#define CSR_WIFI_ROUTER_CTRL_WAPI_RX_PKT_REQ ((CsrWifiRouterCtrlPrim) (0x001A + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
616#define CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_FILTER_REQ ((CsrWifiRouterCtrlPrim) (0x001B + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
617#define CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_FILTER_REQ ((CsrWifiRouterCtrlPrim) (0x001C + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
618#define CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_PKT_REQ ((CsrWifiRouterCtrlPrim) (0x001D + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
619#define CSR_WIFI_ROUTER_CTRL_WAPI_FILTER_REQ ((CsrWifiRouterCtrlPrim) (0x001E + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST))
620
621
622#define CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_HIGHEST (0x001E + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)
623
624/* Upstream */
625#define CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM)
626
627#define CSR_WIFI_ROUTER_CTRL_HIP_IND ((CsrWifiRouterCtrlPrim)(0x0000 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
628#define CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_IND ((CsrWifiRouterCtrlPrim)(0x0001 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
629#define CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_CFM ((CsrWifiRouterCtrlPrim)(0x0002 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
630#define CSR_WIFI_ROUTER_CTRL_RESUME_IND ((CsrWifiRouterCtrlPrim)(0x0003 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
631#define CSR_WIFI_ROUTER_CTRL_SUSPEND_IND ((CsrWifiRouterCtrlPrim)(0x0004 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
632#define CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_CFM ((CsrWifiRouterCtrlPrim)(0x0005 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
633#define CSR_WIFI_ROUTER_CTRL_RAW_SDIO_DEINITIALISE_CFM ((CsrWifiRouterCtrlPrim)(0x0006 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
634#define CSR_WIFI_ROUTER_CTRL_RAW_SDIO_INITIALISE_CFM ((CsrWifiRouterCtrlPrim)(0x0007 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
635#define CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_CFM ((CsrWifiRouterCtrlPrim)(0x0008 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
636#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_PROTOCOL_IND ((CsrWifiRouterCtrlPrim)(0x0009 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
637#define CSR_WIFI_ROUTER_CTRL_TRAFFIC_SAMPLE_IND ((CsrWifiRouterCtrlPrim)(0x000A + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
638#define CSR_WIFI_ROUTER_CTRL_WIFI_OFF_IND ((CsrWifiRouterCtrlPrim)(0x000B + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
639#define CSR_WIFI_ROUTER_CTRL_WIFI_OFF_CFM ((CsrWifiRouterCtrlPrim)(0x000C + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
640#define CSR_WIFI_ROUTER_CTRL_WIFI_ON_IND ((CsrWifiRouterCtrlPrim)(0x000D + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
641#define CSR_WIFI_ROUTER_CTRL_WIFI_ON_CFM ((CsrWifiRouterCtrlPrim)(0x000E + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
642#define CSR_WIFI_ROUTER_CTRL_M4_READY_TO_SEND_IND ((CsrWifiRouterCtrlPrim)(0x000F + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
643#define CSR_WIFI_ROUTER_CTRL_M4_TRANSMITTED_IND ((CsrWifiRouterCtrlPrim)(0x0010 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
644#define CSR_WIFI_ROUTER_CTRL_MIC_FAILURE_IND ((CsrWifiRouterCtrlPrim)(0x0011 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
645#define CSR_WIFI_ROUTER_CTRL_CONNECTED_IND ((CsrWifiRouterCtrlPrim)(0x0012 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
646#define CSR_WIFI_ROUTER_CTRL_PEER_ADD_CFM ((CsrWifiRouterCtrlPrim)(0x0013 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
647#define CSR_WIFI_ROUTER_CTRL_PEER_DEL_CFM ((CsrWifiRouterCtrlPrim)(0x0014 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
648#define CSR_WIFI_ROUTER_CTRL_UNEXPECTED_FRAME_IND ((CsrWifiRouterCtrlPrim)(0x0015 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
649#define CSR_WIFI_ROUTER_CTRL_PEER_UPDATE_CFM ((CsrWifiRouterCtrlPrim)(0x0016 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
650#define CSR_WIFI_ROUTER_CTRL_CAPABILITIES_CFM ((CsrWifiRouterCtrlPrim)(0x0017 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
651#define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_CFM ((CsrWifiRouterCtrlPrim)(0x0018 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
652#define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_CFM ((CsrWifiRouterCtrlPrim)(0x0019 + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
653#define CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ERROR_IND ((CsrWifiRouterCtrlPrim)(0x001A + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
654#define CSR_WIFI_ROUTER_CTRL_STA_INACTIVE_IND ((CsrWifiRouterCtrlPrim)(0x001B + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
655#define CSR_WIFI_ROUTER_CTRL_WAPI_RX_MIC_CHECK_IND ((CsrWifiRouterCtrlPrim)(0x001C + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
656#define CSR_WIFI_ROUTER_CTRL_MODE_SET_CFM ((CsrWifiRouterCtrlPrim)(0x001D + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
657#define CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_TX_ENCRYPT_IND ((CsrWifiRouterCtrlPrim)(0x001E + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST))
658
659#define CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_HIGHEST (0x001E + CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)
660
661#define CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT (CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_HIGHEST + 1 - CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST)
662#define CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_COUNT (CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_HIGHEST + 1 - CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_LOWEST)
663
664/*******************************************************************************
665
666 NAME
667 CsrWifiRouterCtrlConfigurePowerModeReq
668
669 DESCRIPTION
670
671 MEMBERS
672 common - Common header for use with the CsrWifiFsm Module
673 clientData -
674 mode -
675 wakeHost -
676
677*******************************************************************************/
678typedef struct
679{
680 CsrWifiFsmEvent common;
681 CsrWifiRouterCtrlRequestorInfo clientData;
682 CsrWifiRouterCtrlLowPowerMode mode;
683 u8 wakeHost;
684} CsrWifiRouterCtrlConfigurePowerModeReq;
685
686/*******************************************************************************
687
688 NAME
689 CsrWifiRouterCtrlHipReq
690
691 DESCRIPTION
692 This primitive is used for transferring MLME messages to the HIP.
693
694 MEMBERS
695 common - Common header for use with the CsrWifiFsm Module
696 mlmeCommandLength - Length of the MLME signal
697 mlmeCommand - Pointer to the MLME signal
698 dataRef1Length - Length of the dataRef1 bulk data
699 dataRef1 - Pointer to the bulk data 1
700 dataRef2Length - Length of the dataRef2 bulk data
701 dataRef2 - Pointer to the bulk data 2
702
703*******************************************************************************/
704typedef struct
705{
706 CsrWifiFsmEvent common;
707 u16 mlmeCommandLength;
708 u8 *mlmeCommand;
709 u16 dataRef1Length;
710 u8 *dataRef1;
711 u16 dataRef2Length;
712 u8 *dataRef2;
713} CsrWifiRouterCtrlHipReq;
714
715/*******************************************************************************
716
717 NAME
718 CsrWifiRouterCtrlMediaStatusReq
719
720 DESCRIPTION
721
722 MEMBERS
723 common - Common header for use with the CsrWifiFsm Module
724 interfaceTag -
725 clientData -
726 mediaStatus -
727
728*******************************************************************************/
729typedef struct
730{
731 CsrWifiFsmEvent common;
732 u16 interfaceTag;
733 CsrWifiRouterCtrlRequestorInfo clientData;
734 CsrWifiRouterCtrlMediaStatus mediaStatus;
735} CsrWifiRouterCtrlMediaStatusReq;
736
737/*******************************************************************************
738
739 NAME
740 CsrWifiRouterCtrlMulticastAddressRes
741
742 DESCRIPTION
743
744 MEMBERS
745 common - Common header for use with the CsrWifiFsm Module
746 interfaceTag -
747 clientData -
748 status -
749 action -
750 getAddressesCount -
751 getAddresses -
752
753*******************************************************************************/
754typedef struct
755{
756 CsrWifiFsmEvent common;
757 u16 interfaceTag;
758 CsrWifiRouterCtrlRequestorInfo clientData;
759 CsrResult status;
760 CsrWifiRouterCtrlListAction action;
761 u8 getAddressesCount;
762 CsrWifiMacAddress *getAddresses;
763} CsrWifiRouterCtrlMulticastAddressRes;
764
765/*******************************************************************************
766
767 NAME
768 CsrWifiRouterCtrlPortConfigureReq
769
770 DESCRIPTION
771
772 MEMBERS
773 common - Common header for use with the CsrWifiFsm Module
774 interfaceTag -
775 clientData -
776 uncontrolledPortAction -
777 controlledPortAction -
778 macAddress -
779 setProtection -
780
781*******************************************************************************/
782typedef struct
783{
784 CsrWifiFsmEvent common;
785 u16 interfaceTag;
786 CsrWifiRouterCtrlRequestorInfo clientData;
787 CsrWifiRouterCtrlPortAction uncontrolledPortAction;
788 CsrWifiRouterCtrlPortAction controlledPortAction;
789 CsrWifiMacAddress macAddress;
790 u8 setProtection;
791} CsrWifiRouterCtrlPortConfigureReq;
792
793/*******************************************************************************
794
795 NAME
796 CsrWifiRouterCtrlQosControlReq
797
798 DESCRIPTION
799
800 MEMBERS
801 common - Common header for use with the CsrWifiFsm Module
802 interfaceTag -
803 clientData -
804 control -
805 queueConfig -
806
807*******************************************************************************/
808typedef struct
809{
810 CsrWifiFsmEvent common;
811 u16 interfaceTag;
812 CsrWifiRouterCtrlRequestorInfo clientData;
813 CsrWifiRouterCtrlQoSControl control;
814 CsrWifiRouterCtrlQueueConfigMask queueConfig;
815} CsrWifiRouterCtrlQosControlReq;
816
817/*******************************************************************************
818
819 NAME
820 CsrWifiRouterCtrlSuspendRes
821
822 DESCRIPTION
823
824 MEMBERS
825 common - Common header for use with the CsrWifiFsm Module
826 clientData -
827 status -
828
829*******************************************************************************/
830typedef struct
831{
832 CsrWifiFsmEvent common;
833 CsrWifiRouterCtrlRequestorInfo clientData;
834 CsrResult status;
835} CsrWifiRouterCtrlSuspendRes;
836
837/*******************************************************************************
838
839 NAME
840 CsrWifiRouterCtrlTclasAddReq
841
842 DESCRIPTION
843
844 MEMBERS
845 common - Common header for use with the CsrWifiFsm Module
846 interfaceTag -
847 clientData -
848 tclasLength -
849 tclas -
850
851*******************************************************************************/
852typedef struct
853{
854 CsrWifiFsmEvent common;
855 u16 interfaceTag;
856 CsrWifiRouterCtrlRequestorInfo clientData;
857 u16 tclasLength;
858 u8 *tclas;
859} CsrWifiRouterCtrlTclasAddReq;
860
861/*******************************************************************************
862
863 NAME
864 CsrWifiRouterCtrlResumeRes
865
866 DESCRIPTION
867
868 MEMBERS
869 common - Common header for use with the CsrWifiFsm Module
870 clientData -
871 status -
872
873*******************************************************************************/
874typedef struct
875{
876 CsrWifiFsmEvent common;
877 CsrWifiRouterCtrlRequestorInfo clientData;
878 CsrResult status;
879} CsrWifiRouterCtrlResumeRes;
880
881/*******************************************************************************
882
883 NAME
884 CsrWifiRouterCtrlRawSdioDeinitialiseReq
885
886 DESCRIPTION
887
888 MEMBERS
889 common - Common header for use with the CsrWifiFsm Module
890 clientData -
891
892*******************************************************************************/
893typedef struct
894{
895 CsrWifiFsmEvent common;
896 CsrWifiRouterCtrlRequestorInfo clientData;
897} CsrWifiRouterCtrlRawSdioDeinitialiseReq;
898
899/*******************************************************************************
900
901 NAME
902 CsrWifiRouterCtrlRawSdioInitialiseReq
903
904 DESCRIPTION
905
906 MEMBERS
907 common - Common header for use with the CsrWifiFsm Module
908 clientData -
909
910*******************************************************************************/
911typedef struct
912{
913 CsrWifiFsmEvent common;
914 CsrWifiRouterCtrlRequestorInfo clientData;
915} CsrWifiRouterCtrlRawSdioInitialiseReq;
916
917/*******************************************************************************
918
919 NAME
920 CsrWifiRouterCtrlTclasDelReq
921
922 DESCRIPTION
923
924 MEMBERS
925 common - Common header for use with the CsrWifiFsm Module
926 interfaceTag -
927 clientData -
928 tclasLength -
929 tclas -
930
931*******************************************************************************/
932typedef struct
933{
934 CsrWifiFsmEvent common;
935 u16 interfaceTag;
936 CsrWifiRouterCtrlRequestorInfo clientData;
937 u16 tclasLength;
938 u8 *tclas;
939} CsrWifiRouterCtrlTclasDelReq;
940
941/*******************************************************************************
942
943 NAME
944 CsrWifiRouterCtrlTrafficClassificationReq
945
946 DESCRIPTION
947
948 MEMBERS
949 common - Common header for use with the CsrWifiFsm Module
950 interfaceTag -
951 clientData -
952 trafficType -
953 period -
954
955*******************************************************************************/
956typedef struct
957{
958 CsrWifiFsmEvent common;
959 u16 interfaceTag;
960 CsrWifiRouterCtrlRequestorInfo clientData;
961 CsrWifiRouterCtrlTrafficType trafficType;
962 u16 period;
963} CsrWifiRouterCtrlTrafficClassificationReq;
964
965/*******************************************************************************
966
967 NAME
968 CsrWifiRouterCtrlTrafficConfigReq
969
970 DESCRIPTION
971
972 MEMBERS
973 common - Common header for use with the CsrWifiFsm Module
974 interfaceTag -
975 clientData -
976 trafficConfigType -
977 config -
978
979*******************************************************************************/
980typedef struct
981{
982 CsrWifiFsmEvent common;
983 u16 interfaceTag;
984 CsrWifiRouterCtrlRequestorInfo clientData;
985 CsrWifiRouterCtrlTrafficConfigType trafficConfigType;
986 CsrWifiRouterCtrlTrafficConfig config;
987} CsrWifiRouterCtrlTrafficConfigReq;
988
989/*******************************************************************************
990
991 NAME
992 CsrWifiRouterCtrlWifiOffReq
993
994 DESCRIPTION
995
996 MEMBERS
997 common - Common header for use with the CsrWifiFsm Module
998 clientData -
999
1000*******************************************************************************/
1001typedef struct
1002{
1003 CsrWifiFsmEvent common;
1004 CsrWifiRouterCtrlRequestorInfo clientData;
1005} CsrWifiRouterCtrlWifiOffReq;
1006
1007/*******************************************************************************
1008
1009 NAME
1010 CsrWifiRouterCtrlWifiOffRes
1011
1012 DESCRIPTION
1013
1014 MEMBERS
1015 common - Common header for use with the CsrWifiFsm Module
1016 clientData -
1017
1018*******************************************************************************/
1019typedef struct
1020{
1021 CsrWifiFsmEvent common;
1022 CsrWifiRouterCtrlRequestorInfo clientData;
1023} CsrWifiRouterCtrlWifiOffRes;
1024
1025/*******************************************************************************
1026
1027 NAME
1028 CsrWifiRouterCtrlWifiOnReq
1029
1030 DESCRIPTION
1031
1032 MEMBERS
1033 common - Common header for use with the CsrWifiFsm Module
1034 clientData -
1035 dataLength - Number of bytes in the buffer pointed to by 'data'
1036 data - Pointer to the buffer containing 'dataLength' bytes
1037
1038*******************************************************************************/
1039typedef struct
1040{
1041 CsrWifiFsmEvent common;
1042 CsrWifiRouterCtrlRequestorInfo clientData;
1043 u32 dataLength;
1044 u8 *data;
1045} CsrWifiRouterCtrlWifiOnReq;
1046
1047/*******************************************************************************
1048
1049 NAME
1050 CsrWifiRouterCtrlWifiOnRes
1051
1052 DESCRIPTION
1053
1054 MEMBERS
1055 common - Common header for use with the CsrWifiFsm Module
1056 clientData -
1057 status -
1058 numInterfaceAddress -
1059 stationMacAddress - array size 1 MUST match CSR_WIFI_NUM_INTERFACES
1060 smeVersions -
1061 scheduledInterrupt -
1062
1063*******************************************************************************/
1064typedef struct
1065{
1066 CsrWifiFsmEvent common;
1067 CsrWifiRouterCtrlRequestorInfo clientData;
1068 CsrResult status;
1069 u16 numInterfaceAddress;
1070 CsrWifiMacAddress stationMacAddress[2];
1071 CsrWifiRouterCtrlSmeVersions smeVersions;
1072 u8 scheduledInterrupt;
1073} CsrWifiRouterCtrlWifiOnRes;
1074
1075/*******************************************************************************
1076
1077 NAME
1078 CsrWifiRouterCtrlM4TransmitReq
1079
1080 DESCRIPTION
1081
1082 MEMBERS
1083 common - Common header for use with the CsrWifiFsm Module
1084 interfaceTag -
1085 clientData -
1086
1087*******************************************************************************/
1088typedef struct
1089{
1090 CsrWifiFsmEvent common;
1091 u16 interfaceTag;
1092 CsrWifiRouterCtrlRequestorInfo clientData;
1093} CsrWifiRouterCtrlM4TransmitReq;
1094
1095/*******************************************************************************
1096
1097 NAME
1098 CsrWifiRouterCtrlModeSetReq
1099
1100 DESCRIPTION
1101
1102 MEMBERS
1103 common - Common header for use with the CsrWifiFsm Module
1104 interfaceTag -
1105 clientData -
1106 mode -
1107 bssid - BSSID of the network the device is going to be a part
1108 of
1109 protection - Set to TRUE if encryption is enabled for the
1110 connection/broadcast frames
1111 intraBssDistEnabled - If set to TRUE, intra BSS destribution will be
1112 enabled. If set to FALSE, any unicast PDU which does
1113 not have the RA as the the local MAC address, shall be
1114 ignored. This field is interpreted by the receive if
1115 mode is set to CSR_WIFI_ROUTER_CTRL_MODE_P2PGO
1116
1117*******************************************************************************/
1118typedef struct
1119{
1120 CsrWifiFsmEvent common;
1121 u16 interfaceTag;
1122 CsrWifiRouterCtrlRequestorInfo clientData;
1123 CsrWifiRouterCtrlMode mode;
1124 CsrWifiMacAddress bssid;
1125 u8 protection;
1126 u8 intraBssDistEnabled;
1127} CsrWifiRouterCtrlModeSetReq;
1128
1129/*******************************************************************************
1130
1131 NAME
1132 CsrWifiRouterCtrlPeerAddReq
1133
1134 DESCRIPTION
1135
1136 MEMBERS
1137 common - Common header for use with the CsrWifiFsm Module
1138 interfaceTag -
1139 clientData -
1140 peerMacAddress -
1141 associationId -
1142 staInfo -
1143
1144*******************************************************************************/
1145typedef struct
1146{
1147 CsrWifiFsmEvent common;
1148 u16 interfaceTag;
1149 CsrWifiRouterCtrlRequestorInfo clientData;
1150 CsrWifiMacAddress peerMacAddress;
1151 u16 associationId;
1152 CsrWifiRouterCtrlStaInfo staInfo;
1153} CsrWifiRouterCtrlPeerAddReq;
1154
1155/*******************************************************************************
1156
1157 NAME
1158 CsrWifiRouterCtrlPeerDelReq
1159
1160 DESCRIPTION
1161
1162 MEMBERS
1163 common - Common header for use with the CsrWifiFsm Module
1164 interfaceTag -
1165 clientData -
1166 peerRecordHandle -
1167
1168*******************************************************************************/
1169typedef struct
1170{
1171 CsrWifiFsmEvent common;
1172 u16 interfaceTag;
1173 CsrWifiRouterCtrlRequestorInfo clientData;
1174 CsrWifiRouterCtrlPeerRecordHandle peerRecordHandle;
1175} CsrWifiRouterCtrlPeerDelReq;
1176
1177/*******************************************************************************
1178
1179 NAME
1180 CsrWifiRouterCtrlPeerUpdateReq
1181
1182 DESCRIPTION
1183
1184 MEMBERS
1185 common - Common header for use with the CsrWifiFsm Module
1186 interfaceTag -
1187 clientData -
1188 peerRecordHandle -
1189 powersaveMode -
1190
1191*******************************************************************************/
1192typedef struct
1193{
1194 CsrWifiFsmEvent common;
1195 u16 interfaceTag;
1196 CsrWifiRouterCtrlRequestorInfo clientData;
1197 CsrWifiRouterCtrlPeerRecordHandle peerRecordHandle;
1198 CsrWifiRouterCtrlPowersaveTypeMask powersaveMode;
1199} CsrWifiRouterCtrlPeerUpdateReq;
1200
1201/*******************************************************************************
1202
1203 NAME
1204 CsrWifiRouterCtrlCapabilitiesReq
1205
1206 DESCRIPTION
1207
1208 MEMBERS
1209 common - Common header for use with the CsrWifiFsm Module
1210 clientData -
1211
1212*******************************************************************************/
1213typedef struct
1214{
1215 CsrWifiFsmEvent common;
1216 CsrWifiRouterCtrlRequestorInfo clientData;
1217} CsrWifiRouterCtrlCapabilitiesReq;
1218
1219/*******************************************************************************
1220
1221 NAME
1222 CsrWifiRouterCtrlBlockAckEnableReq
1223
1224 DESCRIPTION
1225
1226 MEMBERS
1227 common - Common header for use with the CsrWifiFsm Module
1228 interfaceTag -
1229 clientData -
1230 macAddress -
1231 trafficStreamID -
1232 role -
1233 bufferSize -
1234 timeout -
1235 ssn -
1236
1237*******************************************************************************/
1238typedef struct
1239{
1240 CsrWifiFsmEvent common;
1241 u16 interfaceTag;
1242 CsrWifiRouterCtrlRequestorInfo clientData;
1243 CsrWifiMacAddress macAddress;
1244 CsrWifiRouterCtrlTrafficStreamId trafficStreamID;
1245 CsrWifiRouterCtrlBlockAckRole role;
1246 u16 bufferSize;
1247 u16 timeout;
1248 u16 ssn;
1249} CsrWifiRouterCtrlBlockAckEnableReq;
1250
1251/*******************************************************************************
1252
1253 NAME
1254 CsrWifiRouterCtrlBlockAckDisableReq
1255
1256 DESCRIPTION
1257
1258 MEMBERS
1259 common - Common header for use with the CsrWifiFsm Module
1260 interfaceTag -
1261 clientData -
1262 macAddress -
1263 trafficStreamID -
1264 role -
1265
1266*******************************************************************************/
1267typedef struct
1268{
1269 CsrWifiFsmEvent common;
1270 u16 interfaceTag;
1271 CsrWifiRouterCtrlRequestorInfo clientData;
1272 CsrWifiMacAddress macAddress;
1273 CsrWifiRouterCtrlTrafficStreamId trafficStreamID;
1274 CsrWifiRouterCtrlBlockAckRole role;
1275} CsrWifiRouterCtrlBlockAckDisableReq;
1276
1277/*******************************************************************************
1278
1279 NAME
1280 CsrWifiRouterCtrlWapiRxPktReq
1281
1282 DESCRIPTION
1283
1284 MEMBERS
1285 common - Common header for use with the CsrWifiFsm Module
1286 interfaceTag -
1287 signalLength -
1288 signal -
1289 dataLength -
1290 data -
1291
1292*******************************************************************************/
1293typedef struct
1294{
1295 CsrWifiFsmEvent common;
1296 u16 interfaceTag;
1297 u16 signalLength;
1298 u8 *signal;
1299 u16 dataLength;
1300 u8 *data;
1301} CsrWifiRouterCtrlWapiRxPktReq;
1302
1303/*******************************************************************************
1304
1305 NAME
1306 CsrWifiRouterCtrlWapiMulticastFilterReq
1307
1308 DESCRIPTION
1309
1310 MEMBERS
1311 common - Common header for use with the CsrWifiFsm Module
1312 interfaceTag -
1313 status -
1314
1315*******************************************************************************/
1316typedef struct
1317{
1318 CsrWifiFsmEvent common;
1319 u16 interfaceTag;
1320 u8 status;
1321} CsrWifiRouterCtrlWapiMulticastFilterReq;
1322
1323/*******************************************************************************
1324
1325 NAME
1326 CsrWifiRouterCtrlWapiUnicastFilterReq
1327
1328 DESCRIPTION
1329
1330 MEMBERS
1331 common - Common header for use with the CsrWifiFsm Module
1332 interfaceTag -
1333 status -
1334
1335*******************************************************************************/
1336typedef struct
1337{
1338 CsrWifiFsmEvent common;
1339 u16 interfaceTag;
1340 u8 status;
1341} CsrWifiRouterCtrlWapiUnicastFilterReq;
1342
1343/*******************************************************************************
1344
1345 NAME
1346 CsrWifiRouterCtrlWapiUnicastTxPktReq
1347
1348 DESCRIPTION
1349
1350 MEMBERS
1351 common - Common header for use with the CsrWifiFsm Module
1352 interfaceTag -
1353 dataLength -
1354 data -
1355
1356*******************************************************************************/
1357typedef struct
1358{
1359 CsrWifiFsmEvent common;
1360 u16 interfaceTag;
1361 u16 dataLength;
1362 u8 *data;
1363} CsrWifiRouterCtrlWapiUnicastTxPktReq;
1364
1365/*******************************************************************************
1366
1367 NAME
1368 CsrWifiRouterCtrlWapiFilterReq
1369
1370 DESCRIPTION
1371
1372 MEMBERS
1373 common - Common header for use with the CsrWifiFsm Module
1374 interfaceTag -
1375 isWapiConnected -
1376
1377*******************************************************************************/
1378typedef struct
1379{
1380 CsrWifiFsmEvent common;
1381 u16 interfaceTag;
1382 u8 isWapiConnected;
1383} CsrWifiRouterCtrlWapiFilterReq;
1384
1385/*******************************************************************************
1386
1387 NAME
1388 CsrWifiRouterCtrlHipInd
1389
1390 DESCRIPTION
1391 This primitive is used for transferring MLME messages from the HIP.
1392
1393 MEMBERS
1394 common - Common header for use with the CsrWifiFsm Module
1395 mlmeCommandLength - Length of the MLME signal
1396 mlmeCommand - Pointer to the MLME signal
1397 dataRef1Length - Length of the dataRef1 bulk data
1398 dataRef1 - Pointer to the bulk data 1
1399 dataRef2Length - Length of the dataRef2 bulk data
1400 dataRef2 - Pointer to the bulk data 2
1401
1402*******************************************************************************/
1403typedef struct
1404{
1405 CsrWifiFsmEvent common;
1406 u16 mlmeCommandLength;
1407 u8 *mlmeCommand;
1408 u16 dataRef1Length;
1409 u8 *dataRef1;
1410 u16 dataRef2Length;
1411 u8 *dataRef2;
1412} CsrWifiRouterCtrlHipInd;
1413
1414/*******************************************************************************
1415
1416 NAME
1417 CsrWifiRouterCtrlMulticastAddressInd
1418
1419 DESCRIPTION
1420
1421 MEMBERS
1422 common - Common header for use with the CsrWifiFsm Module
1423 clientData -
1424 interfaceTag -
1425 action -
1426 setAddressesCount -
1427 setAddresses -
1428
1429*******************************************************************************/
1430typedef struct
1431{
1432 CsrWifiFsmEvent common;
1433 CsrWifiRouterCtrlRequestorInfo clientData;
1434 u16 interfaceTag;
1435 CsrWifiRouterCtrlListAction action;
1436 u8 setAddressesCount;
1437 CsrWifiMacAddress *setAddresses;
1438} CsrWifiRouterCtrlMulticastAddressInd;
1439
1440/*******************************************************************************
1441
1442 NAME
1443 CsrWifiRouterCtrlPortConfigureCfm
1444
1445 DESCRIPTION
1446
1447 MEMBERS
1448 common - Common header for use with the CsrWifiFsm Module
1449 clientData -
1450 interfaceTag -
1451 status -
1452 macAddress -
1453
1454*******************************************************************************/
1455typedef struct
1456{
1457 CsrWifiFsmEvent common;
1458 CsrWifiRouterCtrlRequestorInfo clientData;
1459 u16 interfaceTag;
1460 CsrResult status;
1461 CsrWifiMacAddress macAddress;
1462} CsrWifiRouterCtrlPortConfigureCfm;
1463
1464/*******************************************************************************
1465
1466 NAME
1467 CsrWifiRouterCtrlResumeInd
1468
1469 DESCRIPTION
1470
1471 MEMBERS
1472 common - Common header for use with the CsrWifiFsm Module
1473 clientData -
1474 powerMaintained -
1475
1476*******************************************************************************/
1477typedef struct
1478{
1479 CsrWifiFsmEvent common;
1480 CsrWifiRouterCtrlRequestorInfo clientData;
1481 u8 powerMaintained;
1482} CsrWifiRouterCtrlResumeInd;
1483
1484/*******************************************************************************
1485
1486 NAME
1487 CsrWifiRouterCtrlSuspendInd
1488
1489 DESCRIPTION
1490
1491 MEMBERS
1492 common - Common header for use with the CsrWifiFsm Module
1493 clientData -
1494 hardSuspend -
1495 d3Suspend -
1496
1497*******************************************************************************/
1498typedef struct
1499{
1500 CsrWifiFsmEvent common;
1501 CsrWifiRouterCtrlRequestorInfo clientData;
1502 u8 hardSuspend;
1503 u8 d3Suspend;
1504} CsrWifiRouterCtrlSuspendInd;
1505
1506/*******************************************************************************
1507
1508 NAME
1509 CsrWifiRouterCtrlTclasAddCfm
1510
1511 DESCRIPTION
1512
1513 MEMBERS
1514 common - Common header for use with the CsrWifiFsm Module
1515 clientData -
1516 interfaceTag -
1517 status -
1518
1519*******************************************************************************/
1520typedef struct
1521{
1522 CsrWifiFsmEvent common;
1523 CsrWifiRouterCtrlRequestorInfo clientData;
1524 u16 interfaceTag;
1525 CsrResult status;
1526} CsrWifiRouterCtrlTclasAddCfm;
1527
1528/*******************************************************************************
1529
1530 NAME
1531 CsrWifiRouterCtrlRawSdioDeinitialiseCfm
1532
1533 DESCRIPTION
1534
1535 MEMBERS
1536 common - Common header for use with the CsrWifiFsm Module
1537 clientData -
1538 result -
1539
1540*******************************************************************************/
1541typedef struct
1542{
1543 CsrWifiFsmEvent common;
1544 CsrWifiRouterCtrlRequestorInfo clientData;
1545 CsrResult result;
1546} CsrWifiRouterCtrlRawSdioDeinitialiseCfm;
1547
1548/*******************************************************************************
1549
1550 NAME
1551 CsrWifiRouterCtrlRawSdioInitialiseCfm
1552
1553 DESCRIPTION
1554
1555 MEMBERS
1556 common - Common header for use with the CsrWifiFsm Module
1557 clientData -
1558 result -
1559 byteRead -
1560 byteWrite -
1561 firmwareDownload -
1562 reset -
1563 coreDumpPrepare -
1564 byteBlockRead -
1565 gpRead16 -
1566 gpWrite16 -
1567
1568*******************************************************************************/
1569typedef struct
1570{
1571 CsrWifiFsmEvent common;
1572 CsrWifiRouterCtrlRequestorInfo clientData;
1573 CsrResult result;
1574 CsrWifiRouterCtrlRawSdioByteRead byteRead;
1575 CsrWifiRouterCtrlRawSdioByteWrite byteWrite;
1576 CsrWifiRouterCtrlRawSdioFirmwareDownload firmwareDownload;
1577 CsrWifiRouterCtrlRawSdioReset reset;
1578 CsrWifiRouterCtrlRawSdioCoreDumpPrepare coreDumpPrepare;
1579 CsrWifiRouterCtrlRawSdioByteBlockRead byteBlockRead;
1580 CsrWifiRouterCtrlRawSdioGpRead16 gpRead16;
1581 CsrWifiRouterCtrlRawSdioGpWrite16 gpWrite16;
1582} CsrWifiRouterCtrlRawSdioInitialiseCfm;
1583
1584/*******************************************************************************
1585
1586 NAME
1587 CsrWifiRouterCtrlTclasDelCfm
1588
1589 DESCRIPTION
1590
1591 MEMBERS
1592 common - Common header for use with the CsrWifiFsm Module
1593 clientData -
1594 interfaceTag -
1595 status -
1596
1597*******************************************************************************/
1598typedef struct
1599{
1600 CsrWifiFsmEvent common;
1601 CsrWifiRouterCtrlRequestorInfo clientData;
1602 u16 interfaceTag;
1603 CsrResult status;
1604} CsrWifiRouterCtrlTclasDelCfm;
1605
1606/*******************************************************************************
1607
1608 NAME
1609 CsrWifiRouterCtrlTrafficProtocolInd
1610
1611 DESCRIPTION
1612
1613 MEMBERS
1614 common - Common header for use with the CsrWifiFsm Module
1615 clientData -
1616 interfaceTag -
1617 packetType -
1618 direction -
1619 srcAddress -
1620
1621*******************************************************************************/
1622typedef struct
1623{
1624 CsrWifiFsmEvent common;
1625 CsrWifiRouterCtrlRequestorInfo clientData;
1626 u16 interfaceTag;
1627 CsrWifiRouterCtrlTrafficPacketType packetType;
1628 CsrWifiRouterCtrlProtocolDirection direction;
1629 CsrWifiMacAddress srcAddress;
1630} CsrWifiRouterCtrlTrafficProtocolInd;
1631
1632/*******************************************************************************
1633
1634 NAME
1635 CsrWifiRouterCtrlTrafficSampleInd
1636
1637 DESCRIPTION
1638
1639 MEMBERS
1640 common - Common header for use with the CsrWifiFsm Module
1641 clientData -
1642 interfaceTag -
1643 stats -
1644
1645*******************************************************************************/
1646typedef struct
1647{
1648 CsrWifiFsmEvent common;
1649 CsrWifiRouterCtrlRequestorInfo clientData;
1650 u16 interfaceTag;
1651 CsrWifiRouterCtrlTrafficStats stats;
1652} CsrWifiRouterCtrlTrafficSampleInd;
1653
1654/*******************************************************************************
1655
1656 NAME
1657 CsrWifiRouterCtrlWifiOffInd
1658
1659 DESCRIPTION
1660
1661 MEMBERS
1662 common - Common header for use with the CsrWifiFsm Module
1663 clientData -
1664 controlIndication -
1665
1666*******************************************************************************/
1667typedef struct
1668{
1669 CsrWifiFsmEvent common;
1670 CsrWifiRouterCtrlRequestorInfo clientData;
1671 CsrWifiRouterCtrlControlIndication controlIndication;
1672} CsrWifiRouterCtrlWifiOffInd;
1673
1674/*******************************************************************************
1675
1676 NAME
1677 CsrWifiRouterCtrlWifiOffCfm
1678
1679 DESCRIPTION
1680
1681 MEMBERS
1682 common - Common header for use with the CsrWifiFsm Module
1683 clientData -
1684
1685*******************************************************************************/
1686typedef struct
1687{
1688 CsrWifiFsmEvent common;
1689 CsrWifiRouterCtrlRequestorInfo clientData;
1690} CsrWifiRouterCtrlWifiOffCfm;
1691
1692/*******************************************************************************
1693
1694 NAME
1695 CsrWifiRouterCtrlWifiOnInd
1696
1697 DESCRIPTION
1698
1699 MEMBERS
1700 common - Common header for use with the CsrWifiFsm Module
1701 clientData -
1702 status -
1703 versions -
1704
1705*******************************************************************************/
1706typedef struct
1707{
1708 CsrWifiFsmEvent common;
1709 CsrWifiRouterCtrlRequestorInfo clientData;
1710 CsrResult status;
1711 CsrWifiRouterCtrlVersions versions;
1712} CsrWifiRouterCtrlWifiOnInd;
1713
1714/*******************************************************************************
1715
1716 NAME
1717 CsrWifiRouterCtrlWifiOnCfm
1718
1719 DESCRIPTION
1720
1721 MEMBERS
1722 common - Common header for use with the CsrWifiFsm Module
1723 clientData -
1724 status -
1725
1726*******************************************************************************/
1727typedef struct
1728{
1729 CsrWifiFsmEvent common;
1730 CsrWifiRouterCtrlRequestorInfo clientData;
1731 CsrResult status;
1732} CsrWifiRouterCtrlWifiOnCfm;
1733
1734/*******************************************************************************
1735
1736 NAME
1737 CsrWifiRouterCtrlM4ReadyToSendInd
1738
1739 DESCRIPTION
1740
1741 MEMBERS
1742 common - Common header for use with the CsrWifiFsm Module
1743 clientData -
1744 interfaceTag -
1745 peerMacAddress -
1746
1747*******************************************************************************/
1748typedef struct
1749{
1750 CsrWifiFsmEvent common;
1751 CsrWifiRouterCtrlRequestorInfo clientData;
1752 u16 interfaceTag;
1753 CsrWifiMacAddress peerMacAddress;
1754} CsrWifiRouterCtrlM4ReadyToSendInd;
1755
1756/*******************************************************************************
1757
1758 NAME
1759 CsrWifiRouterCtrlM4TransmittedInd
1760
1761 DESCRIPTION
1762
1763 MEMBERS
1764 common - Common header for use with the CsrWifiFsm Module
1765 clientData -
1766 interfaceTag -
1767 peerMacAddress -
1768 status -
1769
1770*******************************************************************************/
1771typedef struct
1772{
1773 CsrWifiFsmEvent common;
1774 CsrWifiRouterCtrlRequestorInfo clientData;
1775 u16 interfaceTag;
1776 CsrWifiMacAddress peerMacAddress;
1777 CsrResult status;
1778} CsrWifiRouterCtrlM4TransmittedInd;
1779
1780/*******************************************************************************
1781
1782 NAME
1783 CsrWifiRouterCtrlMicFailureInd
1784
1785 DESCRIPTION
1786
1787 MEMBERS
1788 common - Common header for use with the CsrWifiFsm Module
1789 clientData -
1790 interfaceTag -
1791 peerMacAddress -
1792 unicastPdu -
1793
1794*******************************************************************************/
1795typedef struct
1796{
1797 CsrWifiFsmEvent common;
1798 CsrWifiRouterCtrlRequestorInfo clientData;
1799 u16 interfaceTag;
1800 CsrWifiMacAddress peerMacAddress;
1801 u8 unicastPdu;
1802} CsrWifiRouterCtrlMicFailureInd;
1803
1804/*******************************************************************************
1805
1806 NAME
1807 CsrWifiRouterCtrlConnectedInd
1808
1809 DESCRIPTION
1810
1811 MEMBERS
1812 common - Common header for use with the CsrWifiFsm Module
1813 clientData -
1814 interfaceTag -
1815 peerMacAddress -
1816 peerStatus -
1817
1818*******************************************************************************/
1819typedef struct
1820{
1821 CsrWifiFsmEvent common;
1822 CsrWifiRouterCtrlRequestorInfo clientData;
1823 u16 interfaceTag;
1824 CsrWifiMacAddress peerMacAddress;
1825 CsrWifiRouterCtrlPeerStatus peerStatus;
1826} CsrWifiRouterCtrlConnectedInd;
1827
1828/*******************************************************************************
1829
1830 NAME
1831 CsrWifiRouterCtrlPeerAddCfm
1832
1833 DESCRIPTION
1834
1835 MEMBERS
1836 common - Common header for use with the CsrWifiFsm Module
1837 clientData -
1838 interfaceTag -
1839 peerMacAddress -
1840 peerRecordHandle -
1841 status -
1842
1843*******************************************************************************/
1844typedef struct
1845{
1846 CsrWifiFsmEvent common;
1847 CsrWifiRouterCtrlRequestorInfo clientData;
1848 u16 interfaceTag;
1849 CsrWifiMacAddress peerMacAddress;
1850 CsrWifiRouterCtrlPeerRecordHandle peerRecordHandle;
1851 CsrResult status;
1852} CsrWifiRouterCtrlPeerAddCfm;
1853
1854/*******************************************************************************
1855
1856 NAME
1857 CsrWifiRouterCtrlPeerDelCfm
1858
1859 DESCRIPTION
1860
1861 MEMBERS
1862 common - Common header for use with the CsrWifiFsm Module
1863 clientData -
1864 interfaceTag -
1865 status -
1866
1867*******************************************************************************/
1868typedef struct
1869{
1870 CsrWifiFsmEvent common;
1871 CsrWifiRouterCtrlRequestorInfo clientData;
1872 u16 interfaceTag;
1873 CsrResult status;
1874} CsrWifiRouterCtrlPeerDelCfm;
1875
1876/*******************************************************************************
1877
1878 NAME
1879 CsrWifiRouterCtrlUnexpectedFrameInd
1880
1881 DESCRIPTION
1882
1883 MEMBERS
1884 common - Common header for use with the CsrWifiFsm Module
1885 clientData -
1886 interfaceTag -
1887 peerMacAddress -
1888
1889*******************************************************************************/
1890typedef struct
1891{
1892 CsrWifiFsmEvent common;
1893 CsrWifiRouterCtrlRequestorInfo clientData;
1894 u16 interfaceTag;
1895 CsrWifiMacAddress peerMacAddress;
1896} CsrWifiRouterCtrlUnexpectedFrameInd;
1897
1898/*******************************************************************************
1899
1900 NAME
1901 CsrWifiRouterCtrlPeerUpdateCfm
1902
1903 DESCRIPTION
1904
1905 MEMBERS
1906 common - Common header for use with the CsrWifiFsm Module
1907 clientData -
1908 interfaceTag -
1909 status -
1910
1911*******************************************************************************/
1912typedef struct
1913{
1914 CsrWifiFsmEvent common;
1915 CsrWifiRouterCtrlRequestorInfo clientData;
1916 u16 interfaceTag;
1917 CsrResult status;
1918} CsrWifiRouterCtrlPeerUpdateCfm;
1919
1920/*******************************************************************************
1921
1922 NAME
1923 CsrWifiRouterCtrlCapabilitiesCfm
1924
1925 DESCRIPTION
1926 The router sends this primitive to confirm the size of the queues of the
1927 HIP.
1928
1929 MEMBERS
1930 common - Common header for use with the CsrWifiFsm Module
1931 clientData -
1932 commandQueueSize - Size of command queue
1933 trafficQueueSize - Size of traffic queue (per AC)
1934
1935*******************************************************************************/
1936typedef struct
1937{
1938 CsrWifiFsmEvent common;
1939 CsrWifiRouterCtrlRequestorInfo clientData;
1940 u16 commandQueueSize;
1941 u16 trafficQueueSize;
1942} CsrWifiRouterCtrlCapabilitiesCfm;
1943
1944/*******************************************************************************
1945
1946 NAME
1947 CsrWifiRouterCtrlBlockAckEnableCfm
1948
1949 DESCRIPTION
1950
1951 MEMBERS
1952 common - Common header for use with the CsrWifiFsm Module
1953 clientData -
1954 interfaceTag -
1955 status -
1956
1957*******************************************************************************/
1958typedef struct
1959{
1960 CsrWifiFsmEvent common;
1961 CsrWifiRouterCtrlRequestorInfo clientData;
1962 u16 interfaceTag;
1963 CsrResult status;
1964} CsrWifiRouterCtrlBlockAckEnableCfm;
1965
1966/*******************************************************************************
1967
1968 NAME
1969 CsrWifiRouterCtrlBlockAckDisableCfm
1970
1971 DESCRIPTION
1972
1973 MEMBERS
1974 common - Common header for use with the CsrWifiFsm Module
1975 clientData -
1976 interfaceTag -
1977 status -
1978
1979*******************************************************************************/
1980typedef struct
1981{
1982 CsrWifiFsmEvent common;
1983 CsrWifiRouterCtrlRequestorInfo clientData;
1984 u16 interfaceTag;
1985 CsrResult status;
1986} CsrWifiRouterCtrlBlockAckDisableCfm;
1987
1988/*******************************************************************************
1989
1990 NAME
1991 CsrWifiRouterCtrlBlockAckErrorInd
1992
1993 DESCRIPTION
1994
1995 MEMBERS
1996 common - Common header for use with the CsrWifiFsm Module
1997 clientData -
1998 interfaceTag -
1999 trafficStreamID -
2000 peerMacAddress -
2001 status -
2002
2003*******************************************************************************/
2004typedef struct
2005{
2006 CsrWifiFsmEvent common;
2007 CsrWifiRouterCtrlRequestorInfo clientData;
2008 u16 interfaceTag;
2009 CsrWifiRouterCtrlTrafficStreamId trafficStreamID;
2010 CsrWifiMacAddress peerMacAddress;
2011 CsrResult status;
2012} CsrWifiRouterCtrlBlockAckErrorInd;
2013
2014/*******************************************************************************
2015
2016 NAME
2017 CsrWifiRouterCtrlStaInactiveInd
2018
2019 DESCRIPTION
2020
2021 MEMBERS
2022 common - Common header for use with the CsrWifiFsm Module
2023 clientData -
2024 interfaceTag -
2025 staAddress -
2026
2027*******************************************************************************/
2028typedef struct
2029{
2030 CsrWifiFsmEvent common;
2031 CsrWifiRouterCtrlRequestorInfo clientData;
2032 u16 interfaceTag;
2033 CsrWifiMacAddress staAddress;
2034} CsrWifiRouterCtrlStaInactiveInd;
2035
2036/*******************************************************************************
2037
2038 NAME
2039 CsrWifiRouterCtrlWapiRxMicCheckInd
2040
2041 DESCRIPTION
2042
2043 MEMBERS
2044 common - Common header for use with the CsrWifiFsm Module
2045 clientData -
2046 interfaceTag -
2047 signalLength -
2048 signal -
2049 dataLength -
2050 data -
2051
2052*******************************************************************************/
2053typedef struct
2054{
2055 CsrWifiFsmEvent common;
2056 CsrWifiRouterCtrlRequestorInfo clientData;
2057 u16 interfaceTag;
2058 u16 signalLength;
2059 u8 *signal;
2060 u16 dataLength;
2061 u8 *data;
2062} CsrWifiRouterCtrlWapiRxMicCheckInd;
2063
2064/*******************************************************************************
2065
2066 NAME
2067 CsrWifiRouterCtrlModeSetCfm
2068
2069 DESCRIPTION
2070
2071 MEMBERS
2072 common - Common header for use with the CsrWifiFsm Module
2073 clientData -
2074 interfaceTag -
2075 mode -
2076 status -
2077
2078*******************************************************************************/
2079typedef struct
2080{
2081 CsrWifiFsmEvent common;
2082 CsrWifiRouterCtrlRequestorInfo clientData;
2083 u16 interfaceTag;
2084 CsrWifiRouterCtrlMode mode;
2085 CsrResult status;
2086} CsrWifiRouterCtrlModeSetCfm;
2087
2088/*******************************************************************************
2089
2090 NAME
2091 CsrWifiRouterCtrlWapiUnicastTxEncryptInd
2092
2093 DESCRIPTION
2094
2095 MEMBERS
2096 common - Common header for use with the CsrWifiFsm Module
2097 clientData -
2098 interfaceTag -
2099 dataLength -
2100 data -
2101
2102*******************************************************************************/
2103typedef struct
2104{
2105 CsrWifiFsmEvent common;
2106 CsrWifiRouterCtrlRequestorInfo clientData;
2107 u16 interfaceTag;
2108 u16 dataLength;
2109 u8 *data;
2110} CsrWifiRouterCtrlWapiUnicastTxEncryptInd;
2111
2112#endif /* CSR_WIFI_ROUTER_CTRL_PRIM_H__ */
2113
diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_sef.c b/drivers/staging/csr/csr_wifi_router_ctrl_sef.c
deleted file mode 100644
index 99cf93061d1b..000000000000
--- a/drivers/staging/csr/csr_wifi_router_ctrl_sef.c
+++ /dev/null
@@ -1,46 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2010
4 Confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9 *****************************************************************************/
10#include "csr_wifi_router_ctrl_sef.h"
11
12const CsrWifiRouterCtrlStateHandlerType
13 CsrWifiRouterCtrlDownstreamStateHandlers
14 [CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT] = {
15 /* 0x0000 */ CsrWifiRouterCtrlConfigurePowerModeReqHandler,
16 /* 0x0001 */ CsrWifiRouterCtrlHipReqHandler,
17 /* 0x0002 */ CsrWifiRouterCtrlMediaStatusReqHandler,
18 /* 0x0003 */ CsrWifiRouterCtrlMulticastAddressResHandler,
19 /* 0x0004 */ CsrWifiRouterCtrlPortConfigureReqHandler,
20 /* 0x0005 */ CsrWifiRouterCtrlQosControlReqHandler,
21 /* 0x0006 */ CsrWifiRouterCtrlSuspendResHandler,
22 /* 0x0007 */ CsrWifiRouterCtrlTclasAddReqHandler,
23 /* 0x0008 */ CsrWifiRouterCtrlResumeResHandler,
24 /* 0x0009 */ CsrWifiRouterCtrlRawSdioDeinitialiseReqHandler,
25 /* 0x000A */ CsrWifiRouterCtrlRawSdioInitialiseReqHandler,
26 /* 0x000B */ CsrWifiRouterCtrlTclasDelReqHandler,
27 /* 0x000C */ CsrWifiRouterCtrlTrafficClassificationReqHandler,
28 /* 0x000D */ CsrWifiRouterCtrlTrafficConfigReqHandler,
29 /* 0x000E */ CsrWifiRouterCtrlWifiOffReqHandler,
30 /* 0x000F */ CsrWifiRouterCtrlWifiOffResHandler,
31 /* 0x0010 */ CsrWifiRouterCtrlWifiOnReqHandler,
32 /* 0x0011 */ CsrWifiRouterCtrlWifiOnResHandler,
33 /* 0x0012 */ CsrWifiRouterCtrlM4TransmitReqHandler,
34 /* 0x0013 */ CsrWifiRouterCtrlModeSetReqHandler,
35 /* 0x0014 */ CsrWifiRouterCtrlPeerAddReqHandler,
36 /* 0x0015 */ CsrWifiRouterCtrlPeerDelReqHandler,
37 /* 0x0016 */ CsrWifiRouterCtrlPeerUpdateReqHandler,
38 /* 0x0017 */ CsrWifiRouterCtrlCapabilitiesReqHandler,
39 /* 0x0018 */ CsrWifiRouterCtrlBlockAckEnableReqHandler,
40 /* 0x0019 */ CsrWifiRouterCtrlBlockAckDisableReqHandler,
41 /* 0x001A */ CsrWifiRouterCtrlWapiRxPktReqHandler,
42 /* 0x001B */ CsrWifiRouterCtrlWapiMulticastFilterReqHandler,
43 /* 0x001C */ CsrWifiRouterCtrlWapiUnicastFilterReqHandler,
44 /* 0x001D */ CsrWifiRouterCtrlWapiUnicastTxPktReqHandler,
45 /* 0x001E */ CsrWifiRouterCtrlWapiFilterReqHandler,
46};
diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_sef.h b/drivers/staging/csr/csr_wifi_router_ctrl_sef.h
deleted file mode 100644
index 2fb4937bc909..000000000000
--- a/drivers/staging/csr/csr_wifi_router_ctrl_sef.h
+++ /dev/null
@@ -1,51 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2010
4 Confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9 *****************************************************************************/
10#ifndef CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_CTRL_H__
11#define CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_CTRL_H__
12
13#include "csr_wifi_router_ctrl_prim.h"
14
15 typedef void (*CsrWifiRouterCtrlStateHandlerType)(void* drvpriv, CsrWifiFsmEvent* msg);
16
17 extern const CsrWifiRouterCtrlStateHandlerType CsrWifiRouterCtrlDownstreamStateHandlers[CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT];
18
19 extern void CsrWifiRouterCtrlConfigurePowerModeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
20 extern void CsrWifiRouterCtrlHipReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
21 extern void CsrWifiRouterCtrlMediaStatusReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
22 extern void CsrWifiRouterCtrlMulticastAddressResHandler(void* drvpriv, CsrWifiFsmEvent* msg);
23 extern void CsrWifiRouterCtrlPortConfigureReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
24 extern void CsrWifiRouterCtrlQosControlReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
25 extern void CsrWifiRouterCtrlSuspendResHandler(void* drvpriv, CsrWifiFsmEvent* msg);
26 extern void CsrWifiRouterCtrlTclasAddReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
27 extern void CsrWifiRouterCtrlResumeResHandler(void* drvpriv, CsrWifiFsmEvent* msg);
28 extern void CsrWifiRouterCtrlRawSdioDeinitialiseReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
29 extern void CsrWifiRouterCtrlRawSdioInitialiseReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
30 extern void CsrWifiRouterCtrlTclasDelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
31 extern void CsrWifiRouterCtrlTrafficClassificationReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
32 extern void CsrWifiRouterCtrlTrafficConfigReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
33 extern void CsrWifiRouterCtrlWifiOffReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
34 extern void CsrWifiRouterCtrlWifiOffResHandler(void* drvpriv, CsrWifiFsmEvent* msg);
35 extern void CsrWifiRouterCtrlWifiOnReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
36 extern void CsrWifiRouterCtrlWifiOnResHandler(void* drvpriv, CsrWifiFsmEvent* msg);
37 extern void CsrWifiRouterCtrlM4TransmitReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
38 extern void CsrWifiRouterCtrlModeSetReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
39 extern void CsrWifiRouterCtrlPeerAddReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
40 extern void CsrWifiRouterCtrlPeerDelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
41 extern void CsrWifiRouterCtrlPeerUpdateReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
42 extern void CsrWifiRouterCtrlCapabilitiesReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
43 extern void CsrWifiRouterCtrlBlockAckEnableReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
44 extern void CsrWifiRouterCtrlBlockAckDisableReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
45 extern void CsrWifiRouterCtrlWapiMulticastFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
46 extern void CsrWifiRouterCtrlWapiRxPktReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
47 extern void CsrWifiRouterCtrlWapiUnicastTxPktReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
48 extern void CsrWifiRouterCtrlWapiUnicastFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
49 extern void CsrWifiRouterCtrlWapiFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
50
51#endif /* CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_CTRL_H__ */
diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c
deleted file mode 100644
index 3eda1b66b336..000000000000
--- a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.c
+++ /dev/null
@@ -1,2591 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12#include <linux/string.h>
13#include <linux/slab.h>
14#include "csr_msgconv.h"
15#include "csr_wifi_router_ctrl_prim.h"
16#include "csr_wifi_router_ctrl_serialize.h"
17
18void CsrWifiRouterCtrlPfree(void *ptr)
19{
20 kfree(ptr);
21}
22
23
24size_t CsrWifiRouterCtrlConfigurePowerModeReqSizeof(void *msg)
25{
26 size_t bufferSize = 2;
27
28 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */
29 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
30 bufferSize += 2; /* CsrWifiRouterCtrlLowPowerMode primitive->mode */
31 bufferSize += 1; /* u8 primitive->wakeHost */
32 return bufferSize;
33}
34
35
36u8* CsrWifiRouterCtrlConfigurePowerModeReqSer(u8 *ptr, size_t *len, void *msg)
37{
38 CsrWifiRouterCtrlConfigurePowerModeReq *primitive = (CsrWifiRouterCtrlConfigurePowerModeReq *)msg;
39 *len = 0;
40 CsrUint16Ser(ptr, len, primitive->common.type);
41 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
42 CsrUint16Ser(ptr, len, (u16) primitive->mode);
43 CsrUint8Ser(ptr, len, (u8) primitive->wakeHost);
44 return(ptr);
45}
46
47
48void* CsrWifiRouterCtrlConfigurePowerModeReqDes(u8 *buffer, size_t length)
49{
50 CsrWifiRouterCtrlConfigurePowerModeReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlConfigurePowerModeReq), GFP_KERNEL);
51 size_t offset;
52 offset = 0;
53
54 CsrUint16Des(&primitive->common.type, buffer, &offset);
55 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
56 CsrUint16Des((u16 *) &primitive->mode, buffer, &offset);
57 CsrUint8Des((u8 *) &primitive->wakeHost, buffer, &offset);
58
59 return primitive;
60}
61
62
63size_t CsrWifiRouterCtrlHipReqSizeof(void *msg)
64{
65 CsrWifiRouterCtrlHipReq *primitive = (CsrWifiRouterCtrlHipReq *) msg;
66 size_t bufferSize = 2;
67
68 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */
69 bufferSize += 2; /* u16 primitive->mlmeCommandLength */
70 bufferSize += primitive->mlmeCommandLength; /* u8 primitive->mlmeCommand */
71 bufferSize += 2; /* u16 primitive->dataRef1Length */
72 bufferSize += primitive->dataRef1Length; /* u8 primitive->dataRef1 */
73 bufferSize += 2; /* u16 primitive->dataRef2Length */
74 bufferSize += primitive->dataRef2Length; /* u8 primitive->dataRef2 */
75 return bufferSize;
76}
77
78
79u8* CsrWifiRouterCtrlHipReqSer(u8 *ptr, size_t *len, void *msg)
80{
81 CsrWifiRouterCtrlHipReq *primitive = (CsrWifiRouterCtrlHipReq *)msg;
82 *len = 0;
83 CsrUint16Ser(ptr, len, primitive->common.type);
84 CsrUint16Ser(ptr, len, (u16) primitive->mlmeCommandLength);
85 if (primitive->mlmeCommandLength)
86 {
87 CsrMemCpySer(ptr, len, (const void *) primitive->mlmeCommand, ((u16) (primitive->mlmeCommandLength)));
88 }
89 CsrUint16Ser(ptr, len, (u16) primitive->dataRef1Length);
90 if (primitive->dataRef1Length)
91 {
92 CsrMemCpySer(ptr, len, (const void *) primitive->dataRef1, ((u16) (primitive->dataRef1Length)));
93 }
94 CsrUint16Ser(ptr, len, (u16) primitive->dataRef2Length);
95 if (primitive->dataRef2Length)
96 {
97 CsrMemCpySer(ptr, len, (const void *) primitive->dataRef2, ((u16) (primitive->dataRef2Length)));
98 }
99 return(ptr);
100}
101
102
103void* CsrWifiRouterCtrlHipReqDes(u8 *buffer, size_t length)
104{
105 CsrWifiRouterCtrlHipReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlHipReq), GFP_KERNEL);
106 size_t offset;
107 offset = 0;
108
109 CsrUint16Des(&primitive->common.type, buffer, &offset);
110 CsrUint16Des((u16 *) &primitive->mlmeCommandLength, buffer, &offset);
111 if (primitive->mlmeCommandLength)
112 {
113 primitive->mlmeCommand = kmalloc(primitive->mlmeCommandLength, GFP_KERNEL);
114 CsrMemCpyDes(primitive->mlmeCommand, buffer, &offset, ((u16) (primitive->mlmeCommandLength)));
115 }
116 else
117 {
118 primitive->mlmeCommand = NULL;
119 }
120 CsrUint16Des((u16 *) &primitive->dataRef1Length, buffer, &offset);
121 if (primitive->dataRef1Length)
122 {
123 primitive->dataRef1 = kmalloc(primitive->dataRef1Length, GFP_KERNEL);
124 CsrMemCpyDes(primitive->dataRef1, buffer, &offset, ((u16) (primitive->dataRef1Length)));
125 }
126 else
127 {
128 primitive->dataRef1 = NULL;
129 }
130 CsrUint16Des((u16 *) &primitive->dataRef2Length, buffer, &offset);
131 if (primitive->dataRef2Length)
132 {
133 primitive->dataRef2 = kmalloc(primitive->dataRef2Length, GFP_KERNEL);
134 CsrMemCpyDes(primitive->dataRef2, buffer, &offset, ((u16) (primitive->dataRef2Length)));
135 }
136 else
137 {
138 primitive->dataRef2 = NULL;
139 }
140
141 return primitive;
142}
143
144
145void CsrWifiRouterCtrlHipReqSerFree(void *voidPrimitivePointer)
146{
147 CsrWifiRouterCtrlHipReq *primitive = (CsrWifiRouterCtrlHipReq *) voidPrimitivePointer;
148 kfree(primitive->mlmeCommand);
149 kfree(primitive->dataRef1);
150 kfree(primitive->dataRef2);
151 kfree(primitive);
152}
153
154
155size_t CsrWifiRouterCtrlMediaStatusReqSizeof(void *msg)
156{
157 size_t bufferSize = 2;
158
159 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */
160 bufferSize += 2; /* u16 primitive->interfaceTag */
161 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
162 bufferSize += 1; /* CsrWifiRouterCtrlMediaStatus primitive->mediaStatus */
163 return bufferSize;
164}
165
166
167u8* CsrWifiRouterCtrlMediaStatusReqSer(u8 *ptr, size_t *len, void *msg)
168{
169 CsrWifiRouterCtrlMediaStatusReq *primitive = (CsrWifiRouterCtrlMediaStatusReq *)msg;
170 *len = 0;
171 CsrUint16Ser(ptr, len, primitive->common.type);
172 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
173 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
174 CsrUint8Ser(ptr, len, (u8) primitive->mediaStatus);
175 return(ptr);
176}
177
178
179void* CsrWifiRouterCtrlMediaStatusReqDes(u8 *buffer, size_t length)
180{
181 CsrWifiRouterCtrlMediaStatusReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlMediaStatusReq), GFP_KERNEL);
182 size_t offset;
183 offset = 0;
184
185 CsrUint16Des(&primitive->common.type, buffer, &offset);
186 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
187 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
188 CsrUint8Des((u8 *) &primitive->mediaStatus, buffer, &offset);
189
190 return primitive;
191}
192
193
194size_t CsrWifiRouterCtrlMulticastAddressResSizeof(void *msg)
195{
196 CsrWifiRouterCtrlMulticastAddressRes *primitive = (CsrWifiRouterCtrlMulticastAddressRes *) msg;
197 size_t bufferSize = 2;
198
199 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */
200 bufferSize += 2; /* u16 primitive->interfaceTag */
201 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
202 bufferSize += 2; /* CsrResult primitive->status */
203 bufferSize += 1; /* CsrWifiRouterCtrlListAction primitive->action */
204 bufferSize += 1; /* u8 primitive->getAddressesCount */
205 {
206 u16 i1;
207 for (i1 = 0; i1 < primitive->getAddressesCount; i1++)
208 {
209 bufferSize += 6; /* u8 primitive->getAddresses[i1].a[6] */
210 }
211 }
212 return bufferSize;
213}
214
215
216u8* CsrWifiRouterCtrlMulticastAddressResSer(u8 *ptr, size_t *len, void *msg)
217{
218 CsrWifiRouterCtrlMulticastAddressRes *primitive = (CsrWifiRouterCtrlMulticastAddressRes *)msg;
219 *len = 0;
220 CsrUint16Ser(ptr, len, primitive->common.type);
221 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
222 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
223 CsrUint16Ser(ptr, len, (u16) primitive->status);
224 CsrUint8Ser(ptr, len, (u8) primitive->action);
225 CsrUint8Ser(ptr, len, (u8) primitive->getAddressesCount);
226 {
227 u16 i1;
228 for (i1 = 0; i1 < primitive->getAddressesCount; i1++)
229 {
230 CsrMemCpySer(ptr, len, (const void *) primitive->getAddresses[i1].a, ((u16) (6)));
231 }
232 }
233 return(ptr);
234}
235
236
237void* CsrWifiRouterCtrlMulticastAddressResDes(u8 *buffer, size_t length)
238{
239 CsrWifiRouterCtrlMulticastAddressRes *primitive = kmalloc(sizeof(CsrWifiRouterCtrlMulticastAddressRes), GFP_KERNEL);
240 size_t offset;
241 offset = 0;
242
243 CsrUint16Des(&primitive->common.type, buffer, &offset);
244 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
245 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
246 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
247 CsrUint8Des((u8 *) &primitive->action, buffer, &offset);
248 CsrUint8Des((u8 *) &primitive->getAddressesCount, buffer, &offset);
249 primitive->getAddresses = NULL;
250 if (primitive->getAddressesCount)
251 {
252 primitive->getAddresses = kmalloc(sizeof(CsrWifiMacAddress) * primitive->getAddressesCount, GFP_KERNEL);
253 }
254 {
255 u16 i1;
256 for (i1 = 0; i1 < primitive->getAddressesCount; i1++)
257 {
258 CsrMemCpyDes(primitive->getAddresses[i1].a, buffer, &offset, ((u16) (6)));
259 }
260 }
261
262 return primitive;
263}
264
265
266void CsrWifiRouterCtrlMulticastAddressResSerFree(void *voidPrimitivePointer)
267{
268 CsrWifiRouterCtrlMulticastAddressRes *primitive = (CsrWifiRouterCtrlMulticastAddressRes *) voidPrimitivePointer;
269 kfree(primitive->getAddresses);
270 kfree(primitive);
271}
272
273
274size_t CsrWifiRouterCtrlPortConfigureReqSizeof(void *msg)
275{
276 size_t bufferSize = 2;
277
278 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 18) */
279 bufferSize += 2; /* u16 primitive->interfaceTag */
280 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
281 bufferSize += 2; /* CsrWifiRouterCtrlPortAction primitive->uncontrolledPortAction */
282 bufferSize += 2; /* CsrWifiRouterCtrlPortAction primitive->controlledPortAction */
283 bufferSize += 6; /* u8 primitive->macAddress.a[6] */
284 bufferSize += 1; /* u8 primitive->setProtection */
285 return bufferSize;
286}
287
288
289u8* CsrWifiRouterCtrlPortConfigureReqSer(u8 *ptr, size_t *len, void *msg)
290{
291 CsrWifiRouterCtrlPortConfigureReq *primitive = (CsrWifiRouterCtrlPortConfigureReq *)msg;
292 *len = 0;
293 CsrUint16Ser(ptr, len, primitive->common.type);
294 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
295 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
296 CsrUint16Ser(ptr, len, (u16) primitive->uncontrolledPortAction);
297 CsrUint16Ser(ptr, len, (u16) primitive->controlledPortAction);
298 CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((u16) (6)));
299 CsrUint8Ser(ptr, len, (u8) primitive->setProtection);
300 return(ptr);
301}
302
303
304void* CsrWifiRouterCtrlPortConfigureReqDes(u8 *buffer, size_t length)
305{
306 CsrWifiRouterCtrlPortConfigureReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPortConfigureReq), GFP_KERNEL);
307 size_t offset;
308 offset = 0;
309
310 CsrUint16Des(&primitive->common.type, buffer, &offset);
311 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
312 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
313 CsrUint16Des((u16 *) &primitive->uncontrolledPortAction, buffer, &offset);
314 CsrUint16Des((u16 *) &primitive->controlledPortAction, buffer, &offset);
315 CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((u16) (6)));
316 CsrUint8Des((u8 *) &primitive->setProtection, buffer, &offset);
317
318 return primitive;
319}
320
321
322size_t CsrWifiRouterCtrlQosControlReqSizeof(void *msg)
323{
324 size_t bufferSize = 2;
325
326 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */
327 bufferSize += 2; /* u16 primitive->interfaceTag */
328 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
329 bufferSize += 2; /* CsrWifiRouterCtrlQoSControl primitive->control */
330 bufferSize += 1; /* CsrWifiRouterCtrlQueueConfigMask primitive->queueConfig */
331 return bufferSize;
332}
333
334
335u8* CsrWifiRouterCtrlQosControlReqSer(u8 *ptr, size_t *len, void *msg)
336{
337 CsrWifiRouterCtrlQosControlReq *primitive = (CsrWifiRouterCtrlQosControlReq *)msg;
338 *len = 0;
339 CsrUint16Ser(ptr, len, primitive->common.type);
340 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
341 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
342 CsrUint16Ser(ptr, len, (u16) primitive->control);
343 CsrUint8Ser(ptr, len, (u8) primitive->queueConfig);
344 return(ptr);
345}
346
347
348void* CsrWifiRouterCtrlQosControlReqDes(u8 *buffer, size_t length)
349{
350 CsrWifiRouterCtrlQosControlReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlQosControlReq), GFP_KERNEL);
351 size_t offset;
352 offset = 0;
353
354 CsrUint16Des(&primitive->common.type, buffer, &offset);
355 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
356 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
357 CsrUint16Des((u16 *) &primitive->control, buffer, &offset);
358 CsrUint8Des((u8 *) &primitive->queueConfig, buffer, &offset);
359
360 return primitive;
361}
362
363
364size_t CsrWifiRouterCtrlSuspendResSizeof(void *msg)
365{
366 size_t bufferSize = 2;
367
368 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */
369 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
370 bufferSize += 2; /* CsrResult primitive->status */
371 return bufferSize;
372}
373
374
375u8* CsrWifiRouterCtrlSuspendResSer(u8 *ptr, size_t *len, void *msg)
376{
377 CsrWifiRouterCtrlSuspendRes *primitive = (CsrWifiRouterCtrlSuspendRes *)msg;
378 *len = 0;
379 CsrUint16Ser(ptr, len, primitive->common.type);
380 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
381 CsrUint16Ser(ptr, len, (u16) primitive->status);
382 return(ptr);
383}
384
385
386void* CsrWifiRouterCtrlSuspendResDes(u8 *buffer, size_t length)
387{
388 CsrWifiRouterCtrlSuspendRes *primitive = kmalloc(sizeof(CsrWifiRouterCtrlSuspendRes), GFP_KERNEL);
389 size_t offset;
390 offset = 0;
391
392 CsrUint16Des(&primitive->common.type, buffer, &offset);
393 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
394 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
395
396 return primitive;
397}
398
399
400size_t CsrWifiRouterCtrlTclasAddReqSizeof(void *msg)
401{
402 CsrWifiRouterCtrlTclasAddReq *primitive = (CsrWifiRouterCtrlTclasAddReq *) msg;
403 size_t bufferSize = 2;
404
405 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */
406 bufferSize += 2; /* u16 primitive->interfaceTag */
407 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
408 bufferSize += 2; /* u16 primitive->tclasLength */
409 bufferSize += primitive->tclasLength; /* u8 primitive->tclas */
410 return bufferSize;
411}
412
413
414u8* CsrWifiRouterCtrlTclasAddReqSer(u8 *ptr, size_t *len, void *msg)
415{
416 CsrWifiRouterCtrlTclasAddReq *primitive = (CsrWifiRouterCtrlTclasAddReq *)msg;
417 *len = 0;
418 CsrUint16Ser(ptr, len, primitive->common.type);
419 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
420 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
421 CsrUint16Ser(ptr, len, (u16) primitive->tclasLength);
422 if (primitive->tclasLength)
423 {
424 CsrMemCpySer(ptr, len, (const void *) primitive->tclas, ((u16) (primitive->tclasLength)));
425 }
426 return(ptr);
427}
428
429
430void* CsrWifiRouterCtrlTclasAddReqDes(u8 *buffer, size_t length)
431{
432 CsrWifiRouterCtrlTclasAddReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTclasAddReq), GFP_KERNEL);
433 size_t offset;
434 offset = 0;
435
436 CsrUint16Des(&primitive->common.type, buffer, &offset);
437 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
438 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
439 CsrUint16Des((u16 *) &primitive->tclasLength, buffer, &offset);
440 if (primitive->tclasLength)
441 {
442 primitive->tclas = kmalloc(primitive->tclasLength, GFP_KERNEL);
443 CsrMemCpyDes(primitive->tclas, buffer, &offset, ((u16) (primitive->tclasLength)));
444 }
445 else
446 {
447 primitive->tclas = NULL;
448 }
449
450 return primitive;
451}
452
453
454void CsrWifiRouterCtrlTclasAddReqSerFree(void *voidPrimitivePointer)
455{
456 CsrWifiRouterCtrlTclasAddReq *primitive = (CsrWifiRouterCtrlTclasAddReq *) voidPrimitivePointer;
457 kfree(primitive->tclas);
458 kfree(primitive);
459}
460
461
462size_t CsrWifiRouterCtrlResumeResSizeof(void *msg)
463{
464 size_t bufferSize = 2;
465
466 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */
467 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
468 bufferSize += 2; /* CsrResult primitive->status */
469 return bufferSize;
470}
471
472
473u8* CsrWifiRouterCtrlResumeResSer(u8 *ptr, size_t *len, void *msg)
474{
475 CsrWifiRouterCtrlResumeRes *primitive = (CsrWifiRouterCtrlResumeRes *)msg;
476 *len = 0;
477 CsrUint16Ser(ptr, len, primitive->common.type);
478 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
479 CsrUint16Ser(ptr, len, (u16) primitive->status);
480 return(ptr);
481}
482
483
484void* CsrWifiRouterCtrlResumeResDes(u8 *buffer, size_t length)
485{
486 CsrWifiRouterCtrlResumeRes *primitive = kmalloc(sizeof(CsrWifiRouterCtrlResumeRes), GFP_KERNEL);
487 size_t offset;
488 offset = 0;
489
490 CsrUint16Des(&primitive->common.type, buffer, &offset);
491 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
492 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
493
494 return primitive;
495}
496
497
498size_t CsrWifiRouterCtrlTclasDelReqSizeof(void *msg)
499{
500 CsrWifiRouterCtrlTclasDelReq *primitive = (CsrWifiRouterCtrlTclasDelReq *) msg;
501 size_t bufferSize = 2;
502
503 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */
504 bufferSize += 2; /* u16 primitive->interfaceTag */
505 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
506 bufferSize += 2; /* u16 primitive->tclasLength */
507 bufferSize += primitive->tclasLength; /* u8 primitive->tclas */
508 return bufferSize;
509}
510
511
512u8* CsrWifiRouterCtrlTclasDelReqSer(u8 *ptr, size_t *len, void *msg)
513{
514 CsrWifiRouterCtrlTclasDelReq *primitive = (CsrWifiRouterCtrlTclasDelReq *)msg;
515 *len = 0;
516 CsrUint16Ser(ptr, len, primitive->common.type);
517 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
518 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
519 CsrUint16Ser(ptr, len, (u16) primitive->tclasLength);
520 if (primitive->tclasLength)
521 {
522 CsrMemCpySer(ptr, len, (const void *) primitive->tclas, ((u16) (primitive->tclasLength)));
523 }
524 return(ptr);
525}
526
527
528void* CsrWifiRouterCtrlTclasDelReqDes(u8 *buffer, size_t length)
529{
530 CsrWifiRouterCtrlTclasDelReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTclasDelReq), GFP_KERNEL);
531 size_t offset;
532 offset = 0;
533
534 CsrUint16Des(&primitive->common.type, buffer, &offset);
535 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
536 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
537 CsrUint16Des((u16 *) &primitive->tclasLength, buffer, &offset);
538 if (primitive->tclasLength)
539 {
540 primitive->tclas = kmalloc(primitive->tclasLength, GFP_KERNEL);
541 CsrMemCpyDes(primitive->tclas, buffer, &offset, ((u16) (primitive->tclasLength)));
542 }
543 else
544 {
545 primitive->tclas = NULL;
546 }
547
548 return primitive;
549}
550
551
552void CsrWifiRouterCtrlTclasDelReqSerFree(void *voidPrimitivePointer)
553{
554 CsrWifiRouterCtrlTclasDelReq *primitive = (CsrWifiRouterCtrlTclasDelReq *) voidPrimitivePointer;
555 kfree(primitive->tclas);
556 kfree(primitive);
557}
558
559
560size_t CsrWifiRouterCtrlTrafficClassificationReqSizeof(void *msg)
561{
562 size_t bufferSize = 2;
563
564 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */
565 bufferSize += 2; /* u16 primitive->interfaceTag */
566 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
567 bufferSize += 1; /* CsrWifiRouterCtrlTrafficType primitive->trafficType */
568 bufferSize += 2; /* u16 primitive->period */
569 return bufferSize;
570}
571
572
573u8* CsrWifiRouterCtrlTrafficClassificationReqSer(u8 *ptr, size_t *len, void *msg)
574{
575 CsrWifiRouterCtrlTrafficClassificationReq *primitive = (CsrWifiRouterCtrlTrafficClassificationReq *)msg;
576 *len = 0;
577 CsrUint16Ser(ptr, len, primitive->common.type);
578 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
579 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
580 CsrUint8Ser(ptr, len, (u8) primitive->trafficType);
581 CsrUint16Ser(ptr, len, (u16) primitive->period);
582 return(ptr);
583}
584
585
586void* CsrWifiRouterCtrlTrafficClassificationReqDes(u8 *buffer, size_t length)
587{
588 CsrWifiRouterCtrlTrafficClassificationReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTrafficClassificationReq), GFP_KERNEL);
589 size_t offset;
590 offset = 0;
591
592 CsrUint16Des(&primitive->common.type, buffer, &offset);
593 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
594 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
595 CsrUint8Des((u8 *) &primitive->trafficType, buffer, &offset);
596 CsrUint16Des((u16 *) &primitive->period, buffer, &offset);
597
598 return primitive;
599}
600
601
602size_t CsrWifiRouterCtrlTrafficConfigReqSizeof(void *msg)
603{
604 size_t bufferSize = 2;
605
606 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 24) */
607 bufferSize += 2; /* u16 primitive->interfaceTag */
608 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
609 bufferSize += 2; /* CsrWifiRouterCtrlTrafficConfigType primitive->trafficConfigType */
610 bufferSize += 2; /* u16 primitive->config.packetFilter */
611 bufferSize += 4; /* u32 primitive->config.customFilter.etherType */
612 bufferSize += 1; /* u8 primitive->config.customFilter.ipType */
613 bufferSize += 4; /* u32 primitive->config.customFilter.udpSourcePort */
614 bufferSize += 4; /* u32 primitive->config.customFilter.udpDestPort */
615 return bufferSize;
616}
617
618
619u8* CsrWifiRouterCtrlTrafficConfigReqSer(u8 *ptr, size_t *len, void *msg)
620{
621 CsrWifiRouterCtrlTrafficConfigReq *primitive = (CsrWifiRouterCtrlTrafficConfigReq *)msg;
622 *len = 0;
623 CsrUint16Ser(ptr, len, primitive->common.type);
624 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
625 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
626 CsrUint16Ser(ptr, len, (u16) primitive->trafficConfigType);
627 CsrUint16Ser(ptr, len, (u16) primitive->config.packetFilter);
628 CsrUint32Ser(ptr, len, (u32) primitive->config.customFilter.etherType);
629 CsrUint8Ser(ptr, len, (u8) primitive->config.customFilter.ipType);
630 CsrUint32Ser(ptr, len, (u32) primitive->config.customFilter.udpSourcePort);
631 CsrUint32Ser(ptr, len, (u32) primitive->config.customFilter.udpDestPort);
632 return(ptr);
633}
634
635
636void* CsrWifiRouterCtrlTrafficConfigReqDes(u8 *buffer, size_t length)
637{
638 CsrWifiRouterCtrlTrafficConfigReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTrafficConfigReq), GFP_KERNEL);
639 size_t offset;
640 offset = 0;
641
642 CsrUint16Des(&primitive->common.type, buffer, &offset);
643 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
644 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
645 CsrUint16Des((u16 *) &primitive->trafficConfigType, buffer, &offset);
646 CsrUint16Des((u16 *) &primitive->config.packetFilter, buffer, &offset);
647 CsrUint32Des((u32 *) &primitive->config.customFilter.etherType, buffer, &offset);
648 CsrUint8Des((u8 *) &primitive->config.customFilter.ipType, buffer, &offset);
649 CsrUint32Des((u32 *) &primitive->config.customFilter.udpSourcePort, buffer, &offset);
650 CsrUint32Des((u32 *) &primitive->config.customFilter.udpDestPort, buffer, &offset);
651
652 return primitive;
653}
654
655
656size_t CsrWifiRouterCtrlWifiOnReqSizeof(void *msg)
657{
658 CsrWifiRouterCtrlWifiOnReq *primitive = (CsrWifiRouterCtrlWifiOnReq *) msg;
659 size_t bufferSize = 2;
660
661 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */
662 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
663 bufferSize += 4; /* u32 primitive->dataLength */
664 bufferSize += primitive->dataLength; /* u8 primitive->data */
665 return bufferSize;
666}
667
668
669u8* CsrWifiRouterCtrlWifiOnReqSer(u8 *ptr, size_t *len, void *msg)
670{
671 CsrWifiRouterCtrlWifiOnReq *primitive = (CsrWifiRouterCtrlWifiOnReq *)msg;
672 *len = 0;
673 CsrUint16Ser(ptr, len, primitive->common.type);
674 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
675 CsrUint32Ser(ptr, len, (u32) primitive->dataLength);
676 if (primitive->dataLength)
677 {
678 CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength)));
679 }
680 return(ptr);
681}
682
683
684void* CsrWifiRouterCtrlWifiOnReqDes(u8 *buffer, size_t length)
685{
686 CsrWifiRouterCtrlWifiOnReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnReq), GFP_KERNEL);
687 size_t offset;
688 offset = 0;
689
690 CsrUint16Des(&primitive->common.type, buffer, &offset);
691 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
692 CsrUint32Des((u32 *) &primitive->dataLength, buffer, &offset);
693 if (primitive->dataLength)
694 {
695 primitive->data = kmalloc(primitive->dataLength, GFP_KERNEL);
696 CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength)));
697 }
698 else
699 {
700 primitive->data = NULL;
701 }
702
703 return primitive;
704}
705
706
707void CsrWifiRouterCtrlWifiOnReqSerFree(void *voidPrimitivePointer)
708{
709 CsrWifiRouterCtrlWifiOnReq *primitive = (CsrWifiRouterCtrlWifiOnReq *) voidPrimitivePointer;
710 kfree(primitive->data);
711 kfree(primitive);
712}
713
714
715size_t CsrWifiRouterCtrlWifiOnResSizeof(void *msg)
716{
717 CsrWifiRouterCtrlWifiOnRes *primitive = (CsrWifiRouterCtrlWifiOnRes *) msg;
718 size_t bufferSize = 2;
719
720 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 30) */
721 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
722 bufferSize += 2; /* CsrResult primitive->status */
723 bufferSize += 2; /* u16 primitive->numInterfaceAddress */
724 {
725 u16 i1;
726 for (i1 = 0; i1 < 2; i1++)
727 {
728 bufferSize += 6; /* u8 primitive->stationMacAddress[i1].a[6] */
729 }
730 }
731 bufferSize += 4; /* u32 primitive->smeVersions.firmwarePatch */
732 bufferSize += (primitive->smeVersions.smeBuild ? strlen(primitive->smeVersions.smeBuild) : 0) + 1; /* char* primitive->smeVersions.smeBuild (0 byte len + 1 for NULL Term) */
733 bufferSize += 4; /* u32 primitive->smeVersions.smeHip */
734 bufferSize += 1; /* u8 primitive->scheduledInterrupt */
735 return bufferSize;
736}
737
738
739u8* CsrWifiRouterCtrlWifiOnResSer(u8 *ptr, size_t *len, void *msg)
740{
741 CsrWifiRouterCtrlWifiOnRes *primitive = (CsrWifiRouterCtrlWifiOnRes *)msg;
742 *len = 0;
743 CsrUint16Ser(ptr, len, primitive->common.type);
744 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
745 CsrUint16Ser(ptr, len, (u16) primitive->status);
746 CsrUint16Ser(ptr, len, (u16) primitive->numInterfaceAddress);
747 {
748 u16 i1;
749 for (i1 = 0; i1 < 2; i1++)
750 {
751 CsrMemCpySer(ptr, len, (const void *) primitive->stationMacAddress[i1].a, ((u16) (6)));
752 }
753 }
754 CsrUint32Ser(ptr, len, (u32) primitive->smeVersions.firmwarePatch);
755 CsrCharStringSer(ptr, len, primitive->smeVersions.smeBuild);
756 CsrUint32Ser(ptr, len, (u32) primitive->smeVersions.smeHip);
757 CsrUint8Ser(ptr, len, (u8) primitive->scheduledInterrupt);
758 return(ptr);
759}
760
761
762void* CsrWifiRouterCtrlWifiOnResDes(u8 *buffer, size_t length)
763{
764 CsrWifiRouterCtrlWifiOnRes *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnRes), GFP_KERNEL);
765 size_t offset;
766 offset = 0;
767
768 CsrUint16Des(&primitive->common.type, buffer, &offset);
769 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
770 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
771 CsrUint16Des((u16 *) &primitive->numInterfaceAddress, buffer, &offset);
772 {
773 u16 i1;
774 for (i1 = 0; i1 < 2; i1++)
775 {
776 CsrMemCpyDes(primitive->stationMacAddress[i1].a, buffer, &offset, ((u16) (6)));
777 }
778 }
779 CsrUint32Des((u32 *) &primitive->smeVersions.firmwarePatch, buffer, &offset);
780 CsrCharStringDes(&primitive->smeVersions.smeBuild, buffer, &offset);
781 CsrUint32Des((u32 *) &primitive->smeVersions.smeHip, buffer, &offset);
782 CsrUint8Des((u8 *) &primitive->scheduledInterrupt, buffer, &offset);
783
784 return primitive;
785}
786
787
788void CsrWifiRouterCtrlWifiOnResSerFree(void *voidPrimitivePointer)
789{
790 CsrWifiRouterCtrlWifiOnRes *primitive = (CsrWifiRouterCtrlWifiOnRes *) voidPrimitivePointer;
791 kfree(primitive->smeVersions.smeBuild);
792 kfree(primitive);
793}
794
795
796size_t CsrWifiRouterCtrlM4TransmitReqSizeof(void *msg)
797{
798 size_t bufferSize = 2;
799
800 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */
801 bufferSize += 2; /* u16 primitive->interfaceTag */
802 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
803 return bufferSize;
804}
805
806
807u8* CsrWifiRouterCtrlM4TransmitReqSer(u8 *ptr, size_t *len, void *msg)
808{
809 CsrWifiRouterCtrlM4TransmitReq *primitive = (CsrWifiRouterCtrlM4TransmitReq *)msg;
810 *len = 0;
811 CsrUint16Ser(ptr, len, primitive->common.type);
812 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
813 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
814 return(ptr);
815}
816
817
818void* CsrWifiRouterCtrlM4TransmitReqDes(u8 *buffer, size_t length)
819{
820 CsrWifiRouterCtrlM4TransmitReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlM4TransmitReq), GFP_KERNEL);
821 size_t offset;
822 offset = 0;
823
824 CsrUint16Des(&primitive->common.type, buffer, &offset);
825 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
826 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
827
828 return primitive;
829}
830
831
832size_t CsrWifiRouterCtrlModeSetReqSizeof(void *msg)
833{
834 size_t bufferSize = 2;
835
836 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 16) */
837 bufferSize += 2; /* u16 primitive->interfaceTag */
838 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
839 bufferSize += 1; /* CsrWifiRouterCtrlMode primitive->mode */
840 bufferSize += 6; /* u8 primitive->bssid.a[6] */
841 bufferSize += 1; /* u8 primitive->protection */
842 bufferSize += 1; /* u8 primitive->intraBssDistEnabled */
843 return bufferSize;
844}
845
846
847u8* CsrWifiRouterCtrlModeSetReqSer(u8 *ptr, size_t *len, void *msg)
848{
849 CsrWifiRouterCtrlModeSetReq *primitive = (CsrWifiRouterCtrlModeSetReq *)msg;
850 *len = 0;
851 CsrUint16Ser(ptr, len, primitive->common.type);
852 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
853 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
854 CsrUint8Ser(ptr, len, (u8) primitive->mode);
855 CsrMemCpySer(ptr, len, (const void *) primitive->bssid.a, ((u16) (6)));
856 CsrUint8Ser(ptr, len, (u8) primitive->protection);
857 CsrUint8Ser(ptr, len, (u8) primitive->intraBssDistEnabled);
858 return(ptr);
859}
860
861
862void* CsrWifiRouterCtrlModeSetReqDes(u8 *buffer, size_t length)
863{
864 CsrWifiRouterCtrlModeSetReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlModeSetReq), GFP_KERNEL);
865 size_t offset;
866 offset = 0;
867
868 CsrUint16Des(&primitive->common.type, buffer, &offset);
869 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
870 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
871 CsrUint8Des((u8 *) &primitive->mode, buffer, &offset);
872 CsrMemCpyDes(primitive->bssid.a, buffer, &offset, ((u16) (6)));
873 CsrUint8Des((u8 *) &primitive->protection, buffer, &offset);
874 CsrUint8Des((u8 *) &primitive->intraBssDistEnabled, buffer, &offset);
875
876 return primitive;
877}
878
879
880size_t CsrWifiRouterCtrlPeerAddReqSizeof(void *msg)
881{
882 size_t bufferSize = 2;
883
884 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 21) */
885 bufferSize += 2; /* u16 primitive->interfaceTag */
886 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
887 bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */
888 bufferSize += 2; /* u16 primitive->associationId */
889 bufferSize += 1; /* u8 primitive->staInfo.wmmOrQosEnabled */
890 bufferSize += 2; /* CsrWifiRouterCtrlPowersaveTypeMask primitive->staInfo.powersaveMode */
891 bufferSize += 1; /* u8 primitive->staInfo.maxSpLength */
892 bufferSize += 2; /* u16 primitive->staInfo.listenIntervalInTus */
893 return bufferSize;
894}
895
896
897u8* CsrWifiRouterCtrlPeerAddReqSer(u8 *ptr, size_t *len, void *msg)
898{
899 CsrWifiRouterCtrlPeerAddReq *primitive = (CsrWifiRouterCtrlPeerAddReq *)msg;
900 *len = 0;
901 CsrUint16Ser(ptr, len, primitive->common.type);
902 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
903 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
904 CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6)));
905 CsrUint16Ser(ptr, len, (u16) primitive->associationId);
906 CsrUint8Ser(ptr, len, (u8) primitive->staInfo.wmmOrQosEnabled);
907 CsrUint16Ser(ptr, len, (u16) primitive->staInfo.powersaveMode);
908 CsrUint8Ser(ptr, len, (u8) primitive->staInfo.maxSpLength);
909 CsrUint16Ser(ptr, len, (u16) primitive->staInfo.listenIntervalInTus);
910 return(ptr);
911}
912
913
914void* CsrWifiRouterCtrlPeerAddReqDes(u8 *buffer, size_t length)
915{
916 CsrWifiRouterCtrlPeerAddReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPeerAddReq), GFP_KERNEL);
917 size_t offset;
918 offset = 0;
919
920 CsrUint16Des(&primitive->common.type, buffer, &offset);
921 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
922 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
923 CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6)));
924 CsrUint16Des((u16 *) &primitive->associationId, buffer, &offset);
925 CsrUint8Des((u8 *) &primitive->staInfo.wmmOrQosEnabled, buffer, &offset);
926 CsrUint16Des((u16 *) &primitive->staInfo.powersaveMode, buffer, &offset);
927 CsrUint8Des((u8 *) &primitive->staInfo.maxSpLength, buffer, &offset);
928 CsrUint16Des((u16 *) &primitive->staInfo.listenIntervalInTus, buffer, &offset);
929
930 return primitive;
931}
932
933
934size_t CsrWifiRouterCtrlPeerDelReqSizeof(void *msg)
935{
936 size_t bufferSize = 2;
937
938 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */
939 bufferSize += 2; /* u16 primitive->interfaceTag */
940 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
941 bufferSize += 4; /* CsrWifiRouterCtrlPeerRecordHandle primitive->peerRecordHandle */
942 return bufferSize;
943}
944
945
946u8* CsrWifiRouterCtrlPeerDelReqSer(u8 *ptr, size_t *len, void *msg)
947{
948 CsrWifiRouterCtrlPeerDelReq *primitive = (CsrWifiRouterCtrlPeerDelReq *)msg;
949 *len = 0;
950 CsrUint16Ser(ptr, len, primitive->common.type);
951 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
952 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
953 CsrUint32Ser(ptr, len, (u32) primitive->peerRecordHandle);
954 return(ptr);
955}
956
957
958void* CsrWifiRouterCtrlPeerDelReqDes(u8 *buffer, size_t length)
959{
960 CsrWifiRouterCtrlPeerDelReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPeerDelReq), GFP_KERNEL);
961 size_t offset;
962 offset = 0;
963
964 CsrUint16Des(&primitive->common.type, buffer, &offset);
965 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
966 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
967 CsrUint32Des((u32 *) &primitive->peerRecordHandle, buffer, &offset);
968
969 return primitive;
970}
971
972
973size_t CsrWifiRouterCtrlPeerUpdateReqSizeof(void *msg)
974{
975 size_t bufferSize = 2;
976
977 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */
978 bufferSize += 2; /* u16 primitive->interfaceTag */
979 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
980 bufferSize += 4; /* CsrWifiRouterCtrlPeerRecordHandle primitive->peerRecordHandle */
981 bufferSize += 2; /* CsrWifiRouterCtrlPowersaveTypeMask primitive->powersaveMode */
982 return bufferSize;
983}
984
985
986u8* CsrWifiRouterCtrlPeerUpdateReqSer(u8 *ptr, size_t *len, void *msg)
987{
988 CsrWifiRouterCtrlPeerUpdateReq *primitive = (CsrWifiRouterCtrlPeerUpdateReq *)msg;
989 *len = 0;
990 CsrUint16Ser(ptr, len, primitive->common.type);
991 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
992 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
993 CsrUint32Ser(ptr, len, (u32) primitive->peerRecordHandle);
994 CsrUint16Ser(ptr, len, (u16) primitive->powersaveMode);
995 return(ptr);
996}
997
998
999void* CsrWifiRouterCtrlPeerUpdateReqDes(u8 *buffer, size_t length)
1000{
1001 CsrWifiRouterCtrlPeerUpdateReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPeerUpdateReq), GFP_KERNEL);
1002 size_t offset;
1003 offset = 0;
1004
1005 CsrUint16Des(&primitive->common.type, buffer, &offset);
1006 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
1007 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
1008 CsrUint32Des((u32 *) &primitive->peerRecordHandle, buffer, &offset);
1009 CsrUint16Des((u16 *) &primitive->powersaveMode, buffer, &offset);
1010
1011 return primitive;
1012}
1013
1014
1015size_t CsrWifiRouterCtrlBlockAckEnableReqSizeof(void *msg)
1016{
1017 size_t bufferSize = 2;
1018
1019 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 21) */
1020 bufferSize += 2; /* u16 primitive->interfaceTag */
1021 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
1022 bufferSize += 6; /* u8 primitive->macAddress.a[6] */
1023 bufferSize += 1; /* CsrWifiRouterCtrlTrafficStreamId primitive->trafficStreamID */
1024 bufferSize += 1; /* CsrWifiRouterCtrlBlockAckRole primitive->role */
1025 bufferSize += 2; /* u16 primitive->bufferSize */
1026 bufferSize += 2; /* u16 primitive->timeout */
1027 bufferSize += 2; /* u16 primitive->ssn */
1028 return bufferSize;
1029}
1030
1031
1032u8* CsrWifiRouterCtrlBlockAckEnableReqSer(u8 *ptr, size_t *len, void *msg)
1033{
1034 CsrWifiRouterCtrlBlockAckEnableReq *primitive = (CsrWifiRouterCtrlBlockAckEnableReq *)msg;
1035 *len = 0;
1036 CsrUint16Ser(ptr, len, primitive->common.type);
1037 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
1038 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
1039 CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((u16) (6)));
1040 CsrUint8Ser(ptr, len, (u8) primitive->trafficStreamID);
1041 CsrUint8Ser(ptr, len, (u8) primitive->role);
1042 CsrUint16Ser(ptr, len, (u16) primitive->bufferSize);
1043 CsrUint16Ser(ptr, len, (u16) primitive->timeout);
1044 CsrUint16Ser(ptr, len, (u16) primitive->ssn);
1045 return(ptr);
1046}
1047
1048
1049void* CsrWifiRouterCtrlBlockAckEnableReqDes(u8 *buffer, size_t length)
1050{
1051 CsrWifiRouterCtrlBlockAckEnableReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckEnableReq), GFP_KERNEL);
1052 size_t offset;
1053 offset = 0;
1054
1055 CsrUint16Des(&primitive->common.type, buffer, &offset);
1056 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
1057 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
1058 CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((u16) (6)));
1059 CsrUint8Des((u8 *) &primitive->trafficStreamID, buffer, &offset);
1060 CsrUint8Des((u8 *) &primitive->role, buffer, &offset);
1061 CsrUint16Des((u16 *) &primitive->bufferSize, buffer, &offset);
1062 CsrUint16Des((u16 *) &primitive->timeout, buffer, &offset);
1063 CsrUint16Des((u16 *) &primitive->ssn, buffer, &offset);
1064
1065 return primitive;
1066}
1067
1068
1069size_t CsrWifiRouterCtrlBlockAckDisableReqSizeof(void *msg)
1070{
1071 size_t bufferSize = 2;
1072
1073 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */
1074 bufferSize += 2; /* u16 primitive->interfaceTag */
1075 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
1076 bufferSize += 6; /* u8 primitive->macAddress.a[6] */
1077 bufferSize += 1; /* CsrWifiRouterCtrlTrafficStreamId primitive->trafficStreamID */
1078 bufferSize += 1; /* CsrWifiRouterCtrlBlockAckRole primitive->role */
1079 return bufferSize;
1080}
1081
1082
1083u8* CsrWifiRouterCtrlBlockAckDisableReqSer(u8 *ptr, size_t *len, void *msg)
1084{
1085 CsrWifiRouterCtrlBlockAckDisableReq *primitive = (CsrWifiRouterCtrlBlockAckDisableReq *)msg;
1086 *len = 0;
1087 CsrUint16Ser(ptr, len, primitive->common.type);
1088 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
1089 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
1090 CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((u16) (6)));
1091 CsrUint8Ser(ptr, len, (u8) primitive->trafficStreamID);
1092 CsrUint8Ser(ptr, len, (u8) primitive->role);
1093 return(ptr);
1094}
1095
1096
1097void* CsrWifiRouterCtrlBlockAckDisableReqDes(u8 *buffer, size_t length)
1098{
1099 CsrWifiRouterCtrlBlockAckDisableReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckDisableReq), GFP_KERNEL);
1100 size_t offset;
1101 offset = 0;
1102
1103 CsrUint16Des(&primitive->common.type, buffer, &offset);
1104 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
1105 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
1106 CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((u16) (6)));
1107 CsrUint8Des((u8 *) &primitive->trafficStreamID, buffer, &offset);
1108 CsrUint8Des((u8 *) &primitive->role, buffer, &offset);
1109
1110 return primitive;
1111}
1112
1113
1114size_t CsrWifiRouterCtrlWapiRxPktReqSizeof(void *msg)
1115{
1116 CsrWifiRouterCtrlWapiRxPktReq *primitive = (CsrWifiRouterCtrlWapiRxPktReq *) msg;
1117 size_t bufferSize = 2;
1118
1119 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */
1120 bufferSize += 2; /* u16 primitive->interfaceTag */
1121 bufferSize += 2; /* u16 primitive->signalLength */
1122 bufferSize += primitive->signalLength; /* u8 primitive->signal */
1123 bufferSize += 2; /* u16 primitive->dataLength */
1124 bufferSize += primitive->dataLength; /* u8 primitive->data */
1125 return bufferSize;
1126}
1127
1128
1129u8* CsrWifiRouterCtrlWapiRxPktReqSer(u8 *ptr, size_t *len, void *msg)
1130{
1131 CsrWifiRouterCtrlWapiRxPktReq *primitive = (CsrWifiRouterCtrlWapiRxPktReq *)msg;
1132 *len = 0;
1133 CsrUint16Ser(ptr, len, primitive->common.type);
1134 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
1135 CsrUint16Ser(ptr, len, (u16) primitive->signalLength);
1136 if (primitive->signalLength)
1137 {
1138 CsrMemCpySer(ptr, len, (const void *) primitive->signal, ((u16) (primitive->signalLength)));
1139 }
1140 CsrUint16Ser(ptr, len, (u16) primitive->dataLength);
1141 if (primitive->dataLength)
1142 {
1143 CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength)));
1144 }
1145 return(ptr);
1146}
1147
1148
1149void* CsrWifiRouterCtrlWapiRxPktReqDes(u8 *buffer, size_t length)
1150{
1151 CsrWifiRouterCtrlWapiRxPktReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWapiRxPktReq), GFP_KERNEL);
1152 size_t offset;
1153 offset = 0;
1154
1155 CsrUint16Des(&primitive->common.type, buffer, &offset);
1156 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
1157 CsrUint16Des((u16 *) &primitive->signalLength, buffer, &offset);
1158 if (primitive->signalLength)
1159 {
1160 primitive->signal = kmalloc(primitive->signalLength, GFP_KERNEL);
1161 CsrMemCpyDes(primitive->signal, buffer, &offset, ((u16) (primitive->signalLength)));
1162 }
1163 else
1164 {
1165 primitive->signal = NULL;
1166 }
1167 CsrUint16Des((u16 *) &primitive->dataLength, buffer, &offset);
1168 if (primitive->dataLength)
1169 {
1170 primitive->data = kmalloc(primitive->dataLength, GFP_KERNEL);
1171 CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength)));
1172 }
1173 else
1174 {
1175 primitive->data = NULL;
1176 }
1177
1178 return primitive;
1179}
1180
1181
1182void CsrWifiRouterCtrlWapiRxPktReqSerFree(void *voidPrimitivePointer)
1183{
1184 CsrWifiRouterCtrlWapiRxPktReq *primitive = (CsrWifiRouterCtrlWapiRxPktReq *) voidPrimitivePointer;
1185 kfree(primitive->signal);
1186 kfree(primitive->data);
1187 kfree(primitive);
1188}
1189
1190
1191size_t CsrWifiRouterCtrlWapiUnicastTxPktReqSizeof(void *msg)
1192{
1193 CsrWifiRouterCtrlWapiUnicastTxPktReq *primitive = (CsrWifiRouterCtrlWapiUnicastTxPktReq *) msg;
1194 size_t bufferSize = 2;
1195
1196 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */
1197 bufferSize += 2; /* u16 primitive->interfaceTag */
1198 bufferSize += 2; /* u16 primitive->dataLength */
1199 bufferSize += primitive->dataLength; /* u8 primitive->data */
1200 return bufferSize;
1201}
1202
1203
1204u8* CsrWifiRouterCtrlWapiUnicastTxPktReqSer(u8 *ptr, size_t *len, void *msg)
1205{
1206 CsrWifiRouterCtrlWapiUnicastTxPktReq *primitive = (CsrWifiRouterCtrlWapiUnicastTxPktReq *)msg;
1207 *len = 0;
1208 CsrUint16Ser(ptr, len, primitive->common.type);
1209 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
1210 CsrUint16Ser(ptr, len, (u16) primitive->dataLength);
1211 if (primitive->dataLength)
1212 {
1213 CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength)));
1214 }
1215 return(ptr);
1216}
1217
1218
1219void* CsrWifiRouterCtrlWapiUnicastTxPktReqDes(u8 *buffer, size_t length)
1220{
1221 CsrWifiRouterCtrlWapiUnicastTxPktReq *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxPktReq), GFP_KERNEL);
1222 size_t offset;
1223 offset = 0;
1224
1225 CsrUint16Des(&primitive->common.type, buffer, &offset);
1226 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
1227 CsrUint16Des((u16 *) &primitive->dataLength, buffer, &offset);
1228 if (primitive->dataLength)
1229 {
1230 primitive->data = kmalloc(primitive->dataLength, GFP_KERNEL);
1231 CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength)));
1232 }
1233 else
1234 {
1235 primitive->data = NULL;
1236 }
1237
1238 return primitive;
1239}
1240
1241
1242void CsrWifiRouterCtrlWapiUnicastTxPktReqSerFree(void *voidPrimitivePointer)
1243{
1244 CsrWifiRouterCtrlWapiUnicastTxPktReq *primitive = (CsrWifiRouterCtrlWapiUnicastTxPktReq *) voidPrimitivePointer;
1245 kfree(primitive->data);
1246 kfree(primitive);
1247}
1248
1249
1250size_t CsrWifiRouterCtrlHipIndSizeof(void *msg)
1251{
1252 CsrWifiRouterCtrlHipInd *primitive = (CsrWifiRouterCtrlHipInd *) msg;
1253 size_t bufferSize = 2;
1254
1255 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */
1256 bufferSize += 2; /* u16 primitive->mlmeCommandLength */
1257 bufferSize += primitive->mlmeCommandLength; /* u8 primitive->mlmeCommand */
1258 bufferSize += 2; /* u16 primitive->dataRef1Length */
1259 bufferSize += primitive->dataRef1Length; /* u8 primitive->dataRef1 */
1260 bufferSize += 2; /* u16 primitive->dataRef2Length */
1261 bufferSize += primitive->dataRef2Length; /* u8 primitive->dataRef2 */
1262 return bufferSize;
1263}
1264
1265
1266u8* CsrWifiRouterCtrlHipIndSer(u8 *ptr, size_t *len, void *msg)
1267{
1268 CsrWifiRouterCtrlHipInd *primitive = (CsrWifiRouterCtrlHipInd *)msg;
1269 *len = 0;
1270 CsrUint16Ser(ptr, len, primitive->common.type);
1271 CsrUint16Ser(ptr, len, (u16) primitive->mlmeCommandLength);
1272 if (primitive->mlmeCommandLength)
1273 {
1274 CsrMemCpySer(ptr, len, (const void *) primitive->mlmeCommand, ((u16) (primitive->mlmeCommandLength)));
1275 }
1276 CsrUint16Ser(ptr, len, (u16) primitive->dataRef1Length);
1277 if (primitive->dataRef1Length)
1278 {
1279 CsrMemCpySer(ptr, len, (const void *) primitive->dataRef1, ((u16) (primitive->dataRef1Length)));
1280 }
1281 CsrUint16Ser(ptr, len, (u16) primitive->dataRef2Length);
1282 if (primitive->dataRef2Length)
1283 {
1284 CsrMemCpySer(ptr, len, (const void *) primitive->dataRef2, ((u16) (primitive->dataRef2Length)));
1285 }
1286 return(ptr);
1287}
1288
1289
1290void* CsrWifiRouterCtrlHipIndDes(u8 *buffer, size_t length)
1291{
1292 CsrWifiRouterCtrlHipInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlHipInd), GFP_KERNEL);
1293 size_t offset;
1294 offset = 0;
1295
1296 CsrUint16Des(&primitive->common.type, buffer, &offset);
1297 CsrUint16Des((u16 *) &primitive->mlmeCommandLength, buffer, &offset);
1298 if (primitive->mlmeCommandLength)
1299 {
1300 primitive->mlmeCommand = kmalloc(primitive->mlmeCommandLength, GFP_KERNEL);
1301 CsrMemCpyDes(primitive->mlmeCommand, buffer, &offset, ((u16) (primitive->mlmeCommandLength)));
1302 }
1303 else
1304 {
1305 primitive->mlmeCommand = NULL;
1306 }
1307 CsrUint16Des((u16 *) &primitive->dataRef1Length, buffer, &offset);
1308 if (primitive->dataRef1Length)
1309 {
1310 primitive->dataRef1 = kmalloc(primitive->dataRef1Length, GFP_KERNEL);
1311 CsrMemCpyDes(primitive->dataRef1, buffer, &offset, ((u16) (primitive->dataRef1Length)));
1312 }
1313 else
1314 {
1315 primitive->dataRef1 = NULL;
1316 }
1317 CsrUint16Des((u16 *) &primitive->dataRef2Length, buffer, &offset);
1318 if (primitive->dataRef2Length)
1319 {
1320 primitive->dataRef2 = kmalloc(primitive->dataRef2Length, GFP_KERNEL);
1321 CsrMemCpyDes(primitive->dataRef2, buffer, &offset, ((u16) (primitive->dataRef2Length)));
1322 }
1323 else
1324 {
1325 primitive->dataRef2 = NULL;
1326 }
1327
1328 return primitive;
1329}
1330
1331
1332void CsrWifiRouterCtrlHipIndSerFree(void *voidPrimitivePointer)
1333{
1334 CsrWifiRouterCtrlHipInd *primitive = (CsrWifiRouterCtrlHipInd *) voidPrimitivePointer;
1335 kfree(primitive->mlmeCommand);
1336 kfree(primitive->dataRef1);
1337 kfree(primitive->dataRef2);
1338 kfree(primitive);
1339}
1340
1341
1342size_t CsrWifiRouterCtrlMulticastAddressIndSizeof(void *msg)
1343{
1344 CsrWifiRouterCtrlMulticastAddressInd *primitive = (CsrWifiRouterCtrlMulticastAddressInd *) msg;
1345 size_t bufferSize = 2;
1346
1347 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */
1348 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
1349 bufferSize += 2; /* u16 primitive->interfaceTag */
1350 bufferSize += 1; /* CsrWifiRouterCtrlListAction primitive->action */
1351 bufferSize += 1; /* u8 primitive->setAddressesCount */
1352 {
1353 u16 i1;
1354 for (i1 = 0; i1 < primitive->setAddressesCount; i1++)
1355 {
1356 bufferSize += 6; /* u8 primitive->setAddresses[i1].a[6] */
1357 }
1358 }
1359 return bufferSize;
1360}
1361
1362
1363u8* CsrWifiRouterCtrlMulticastAddressIndSer(u8 *ptr, size_t *len, void *msg)
1364{
1365 CsrWifiRouterCtrlMulticastAddressInd *primitive = (CsrWifiRouterCtrlMulticastAddressInd *)msg;
1366 *len = 0;
1367 CsrUint16Ser(ptr, len, primitive->common.type);
1368 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
1369 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
1370 CsrUint8Ser(ptr, len, (u8) primitive->action);
1371 CsrUint8Ser(ptr, len, (u8) primitive->setAddressesCount);
1372 {
1373 u16 i1;
1374 for (i1 = 0; i1 < primitive->setAddressesCount; i1++)
1375 {
1376 CsrMemCpySer(ptr, len, (const void *) primitive->setAddresses[i1].a, ((u16) (6)));
1377 }
1378 }
1379 return(ptr);
1380}
1381
1382
1383void* CsrWifiRouterCtrlMulticastAddressIndDes(u8 *buffer, size_t length)
1384{
1385 CsrWifiRouterCtrlMulticastAddressInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlMulticastAddressInd), GFP_KERNEL);
1386 size_t offset;
1387 offset = 0;
1388
1389 CsrUint16Des(&primitive->common.type, buffer, &offset);
1390 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
1391 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
1392 CsrUint8Des((u8 *) &primitive->action, buffer, &offset);
1393 CsrUint8Des((u8 *) &primitive->setAddressesCount, buffer, &offset);
1394 primitive->setAddresses = NULL;
1395 if (primitive->setAddressesCount)
1396 {
1397 primitive->setAddresses = kmalloc(sizeof(CsrWifiMacAddress) * primitive->setAddressesCount, GFP_KERNEL);
1398 }
1399 {
1400 u16 i1;
1401 for (i1 = 0; i1 < primitive->setAddressesCount; i1++)
1402 {
1403 CsrMemCpyDes(primitive->setAddresses[i1].a, buffer, &offset, ((u16) (6)));
1404 }
1405 }
1406
1407 return primitive;
1408}
1409
1410
1411void CsrWifiRouterCtrlMulticastAddressIndSerFree(void *voidPrimitivePointer)
1412{
1413 CsrWifiRouterCtrlMulticastAddressInd *primitive = (CsrWifiRouterCtrlMulticastAddressInd *) voidPrimitivePointer;
1414 kfree(primitive->setAddresses);
1415 kfree(primitive);
1416}
1417
1418
1419size_t CsrWifiRouterCtrlPortConfigureCfmSizeof(void *msg)
1420{
1421 size_t bufferSize = 2;
1422
1423 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */
1424 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
1425 bufferSize += 2; /* u16 primitive->interfaceTag */
1426 bufferSize += 2; /* CsrResult primitive->status */
1427 bufferSize += 6; /* u8 primitive->macAddress.a[6] */
1428 return bufferSize;
1429}
1430
1431
1432u8* CsrWifiRouterCtrlPortConfigureCfmSer(u8 *ptr, size_t *len, void *msg)
1433{
1434 CsrWifiRouterCtrlPortConfigureCfm *primitive = (CsrWifiRouterCtrlPortConfigureCfm *)msg;
1435 *len = 0;
1436 CsrUint16Ser(ptr, len, primitive->common.type);
1437 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
1438 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
1439 CsrUint16Ser(ptr, len, (u16) primitive->status);
1440 CsrMemCpySer(ptr, len, (const void *) primitive->macAddress.a, ((u16) (6)));
1441 return(ptr);
1442}
1443
1444
1445void* CsrWifiRouterCtrlPortConfigureCfmDes(u8 *buffer, size_t length)
1446{
1447 CsrWifiRouterCtrlPortConfigureCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPortConfigureCfm), GFP_KERNEL);
1448 size_t offset;
1449 offset = 0;
1450
1451 CsrUint16Des(&primitive->common.type, buffer, &offset);
1452 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
1453 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
1454 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
1455 CsrMemCpyDes(primitive->macAddress.a, buffer, &offset, ((u16) (6)));
1456
1457 return primitive;
1458}
1459
1460
1461size_t CsrWifiRouterCtrlSuspendIndSizeof(void *msg)
1462{
1463 size_t bufferSize = 2;
1464
1465 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */
1466 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
1467 bufferSize += 1; /* u8 primitive->hardSuspend */
1468 bufferSize += 1; /* u8 primitive->d3Suspend */
1469 return bufferSize;
1470}
1471
1472
1473u8* CsrWifiRouterCtrlSuspendIndSer(u8 *ptr, size_t *len, void *msg)
1474{
1475 CsrWifiRouterCtrlSuspendInd *primitive = (CsrWifiRouterCtrlSuspendInd *)msg;
1476 *len = 0;
1477 CsrUint16Ser(ptr, len, primitive->common.type);
1478 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
1479 CsrUint8Ser(ptr, len, (u8) primitive->hardSuspend);
1480 CsrUint8Ser(ptr, len, (u8) primitive->d3Suspend);
1481 return(ptr);
1482}
1483
1484
1485void* CsrWifiRouterCtrlSuspendIndDes(u8 *buffer, size_t length)
1486{
1487 CsrWifiRouterCtrlSuspendInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlSuspendInd), GFP_KERNEL);
1488 size_t offset;
1489 offset = 0;
1490
1491 CsrUint16Des(&primitive->common.type, buffer, &offset);
1492 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
1493 CsrUint8Des((u8 *) &primitive->hardSuspend, buffer, &offset);
1494 CsrUint8Des((u8 *) &primitive->d3Suspend, buffer, &offset);
1495
1496 return primitive;
1497}
1498
1499
1500size_t CsrWifiRouterCtrlTclasAddCfmSizeof(void *msg)
1501{
1502 size_t bufferSize = 2;
1503
1504 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */
1505 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
1506 bufferSize += 2; /* u16 primitive->interfaceTag */
1507 bufferSize += 2; /* CsrResult primitive->status */
1508 return bufferSize;
1509}
1510
1511
1512u8* CsrWifiRouterCtrlTclasAddCfmSer(u8 *ptr, size_t *len, void *msg)
1513{
1514 CsrWifiRouterCtrlTclasAddCfm *primitive = (CsrWifiRouterCtrlTclasAddCfm *)msg;
1515 *len = 0;
1516 CsrUint16Ser(ptr, len, primitive->common.type);
1517 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
1518 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
1519 CsrUint16Ser(ptr, len, (u16) primitive->status);
1520 return(ptr);
1521}
1522
1523
1524void* CsrWifiRouterCtrlTclasAddCfmDes(u8 *buffer, size_t length)
1525{
1526 CsrWifiRouterCtrlTclasAddCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTclasAddCfm), GFP_KERNEL);
1527 size_t offset;
1528 offset = 0;
1529
1530 CsrUint16Des(&primitive->common.type, buffer, &offset);
1531 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
1532 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
1533 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
1534
1535 return primitive;
1536}
1537
1538
1539size_t CsrWifiRouterCtrlRawSdioDeinitialiseCfmSizeof(void *msg)
1540{
1541 size_t bufferSize = 2;
1542
1543 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */
1544 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
1545 bufferSize += 2; /* CsrResult primitive->result */
1546 return bufferSize;
1547}
1548
1549
1550u8* CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer(u8 *ptr, size_t *len, void *msg)
1551{
1552 CsrWifiRouterCtrlRawSdioDeinitialiseCfm *primitive = (CsrWifiRouterCtrlRawSdioDeinitialiseCfm *)msg;
1553 *len = 0;
1554 CsrUint16Ser(ptr, len, primitive->common.type);
1555 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
1556 CsrUint16Ser(ptr, len, (u16) primitive->result);
1557 return(ptr);
1558}
1559
1560
1561void* CsrWifiRouterCtrlRawSdioDeinitialiseCfmDes(u8 *buffer, size_t length)
1562{
1563 CsrWifiRouterCtrlRawSdioDeinitialiseCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlRawSdioDeinitialiseCfm), GFP_KERNEL);
1564 size_t offset;
1565 offset = 0;
1566
1567 CsrUint16Des(&primitive->common.type, buffer, &offset);
1568 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
1569 CsrUint16Des((u16 *) &primitive->result, buffer, &offset);
1570
1571 return primitive;
1572}
1573
1574
1575size_t CsrWifiRouterCtrlRawSdioInitialiseCfmSizeof(void *msg)
1576{
1577 size_t bufferSize = 2;
1578
1579 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 39) */
1580 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
1581 bufferSize += 2; /* CsrResult primitive->result */
1582 bufferSize += 4; /* CsrWifiRouterCtrlRawSdioByteRead primitive->byteRead */
1583 bufferSize += 4; /* CsrWifiRouterCtrlRawSdioByteWrite primitive->byteWrite */
1584 bufferSize += 4; /* CsrWifiRouterCtrlRawSdioFirmwareDownload primitive->firmwareDownload */
1585 bufferSize += 4; /* CsrWifiRouterCtrlRawSdioReset primitive->reset */
1586 bufferSize += 4; /* CsrWifiRouterCtrlRawSdioCoreDumpPrepare primitive->coreDumpPrepare */
1587 bufferSize += 4; /* CsrWifiRouterCtrlRawSdioByteBlockRead primitive->byteBlockRead */
1588 bufferSize += 4; /* CsrWifiRouterCtrlRawSdioGpRead16 primitive->gpRead16 */
1589 bufferSize += 4; /* CsrWifiRouterCtrlRawSdioGpWrite16 primitive->gpWrite16 */
1590 return bufferSize;
1591}
1592
1593
1594u8* CsrWifiRouterCtrlRawSdioInitialiseCfmSer(u8 *ptr, size_t *len, void *msg)
1595{
1596 CsrWifiRouterCtrlRawSdioInitialiseCfm *primitive = (CsrWifiRouterCtrlRawSdioInitialiseCfm *)msg;
1597 *len = 0;
1598 CsrUint16Ser(ptr, len, primitive->common.type);
1599 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
1600 CsrUint16Ser(ptr, len, (u16) primitive->result);
1601 CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->byteRead */
1602 CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->byteWrite */
1603 CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->firmwareDownload */
1604 CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->reset */
1605 CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->coreDumpPrepare */
1606 CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->byteBlockRead */
1607 CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->gpRead16 */
1608 CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->gpWrite16 */
1609 return(ptr);
1610}
1611
1612
1613void* CsrWifiRouterCtrlRawSdioInitialiseCfmDes(u8 *buffer, size_t length)
1614{
1615 CsrWifiRouterCtrlRawSdioInitialiseCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlRawSdioInitialiseCfm), GFP_KERNEL);
1616 size_t offset;
1617 offset = 0;
1618
1619 CsrUint16Des(&primitive->common.type, buffer, &offset);
1620 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
1621 CsrUint16Des((u16 *) &primitive->result, buffer, &offset);
1622 primitive->byteRead = NULL; /* Special for Function Pointers... */
1623 offset += 4;
1624 primitive->byteWrite = NULL; /* Special for Function Pointers... */
1625 offset += 4;
1626 primitive->firmwareDownload = NULL; /* Special for Function Pointers... */
1627 offset += 4;
1628 primitive->reset = NULL; /* Special for Function Pointers... */
1629 offset += 4;
1630 primitive->coreDumpPrepare = NULL; /* Special for Function Pointers... */
1631 offset += 4;
1632 primitive->byteBlockRead = NULL; /* Special for Function Pointers... */
1633 offset += 4;
1634 primitive->gpRead16 = NULL; /* Special for Function Pointers... */
1635 offset += 4;
1636 primitive->gpWrite16 = NULL; /* Special for Function Pointers... */
1637 offset += 4;
1638
1639 return primitive;
1640}
1641
1642
1643size_t CsrWifiRouterCtrlTclasDelCfmSizeof(void *msg)
1644{
1645 size_t bufferSize = 2;
1646
1647 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */
1648 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
1649 bufferSize += 2; /* u16 primitive->interfaceTag */
1650 bufferSize += 2; /* CsrResult primitive->status */
1651 return bufferSize;
1652}
1653
1654
1655u8* CsrWifiRouterCtrlTclasDelCfmSer(u8 *ptr, size_t *len, void *msg)
1656{
1657 CsrWifiRouterCtrlTclasDelCfm *primitive = (CsrWifiRouterCtrlTclasDelCfm *)msg;
1658 *len = 0;
1659 CsrUint16Ser(ptr, len, primitive->common.type);
1660 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
1661 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
1662 CsrUint16Ser(ptr, len, (u16) primitive->status);
1663 return(ptr);
1664}
1665
1666
1667void* CsrWifiRouterCtrlTclasDelCfmDes(u8 *buffer, size_t length)
1668{
1669 CsrWifiRouterCtrlTclasDelCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTclasDelCfm), GFP_KERNEL);
1670 size_t offset;
1671 offset = 0;
1672
1673 CsrUint16Des(&primitive->common.type, buffer, &offset);
1674 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
1675 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
1676 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
1677
1678 return primitive;
1679}
1680
1681
1682size_t CsrWifiRouterCtrlTrafficProtocolIndSizeof(void *msg)
1683{
1684 size_t bufferSize = 2;
1685
1686 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */
1687 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
1688 bufferSize += 2; /* u16 primitive->interfaceTag */
1689 bufferSize += 2; /* CsrWifiRouterCtrlTrafficPacketType primitive->packetType */
1690 bufferSize += 2; /* CsrWifiRouterCtrlProtocolDirection primitive->direction */
1691 bufferSize += 6; /* u8 primitive->srcAddress.a[6] */
1692 return bufferSize;
1693}
1694
1695
1696u8* CsrWifiRouterCtrlTrafficProtocolIndSer(u8 *ptr, size_t *len, void *msg)
1697{
1698 CsrWifiRouterCtrlTrafficProtocolInd *primitive = (CsrWifiRouterCtrlTrafficProtocolInd *)msg;
1699 *len = 0;
1700 CsrUint16Ser(ptr, len, primitive->common.type);
1701 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
1702 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
1703 CsrUint16Ser(ptr, len, (u16) primitive->packetType);
1704 CsrUint16Ser(ptr, len, (u16) primitive->direction);
1705 CsrMemCpySer(ptr, len, (const void *) primitive->srcAddress.a, ((u16) (6)));
1706 return(ptr);
1707}
1708
1709
1710void* CsrWifiRouterCtrlTrafficProtocolIndDes(u8 *buffer, size_t length)
1711{
1712 CsrWifiRouterCtrlTrafficProtocolInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTrafficProtocolInd), GFP_KERNEL);
1713 size_t offset;
1714 offset = 0;
1715
1716 CsrUint16Des(&primitive->common.type, buffer, &offset);
1717 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
1718 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
1719 CsrUint16Des((u16 *) &primitive->packetType, buffer, &offset);
1720 CsrUint16Des((u16 *) &primitive->direction, buffer, &offset);
1721 CsrMemCpyDes(primitive->srcAddress.a, buffer, &offset, ((u16) (6)));
1722
1723 return primitive;
1724}
1725
1726
1727size_t CsrWifiRouterCtrlTrafficSampleIndSizeof(void *msg)
1728{
1729 size_t bufferSize = 2;
1730
1731 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 38) */
1732 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
1733 bufferSize += 2; /* u16 primitive->interfaceTag */
1734 bufferSize += 4; /* u32 primitive->stats.rxMeanRate */
1735 bufferSize += 4; /* u32 primitive->stats.rxFramesNum */
1736 bufferSize += 4; /* u32 primitive->stats.txFramesNum */
1737 bufferSize += 4; /* u32 primitive->stats.rxBytesCount */
1738 bufferSize += 4; /* u32 primitive->stats.txBytesCount */
1739 bufferSize += 11; /* u8 primitive->stats.intervals[11] */
1740 return bufferSize;
1741}
1742
1743
1744u8* CsrWifiRouterCtrlTrafficSampleIndSer(u8 *ptr, size_t *len, void *msg)
1745{
1746 CsrWifiRouterCtrlTrafficSampleInd *primitive = (CsrWifiRouterCtrlTrafficSampleInd *)msg;
1747 *len = 0;
1748 CsrUint16Ser(ptr, len, primitive->common.type);
1749 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
1750 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
1751 CsrUint32Ser(ptr, len, (u32) primitive->stats.rxMeanRate);
1752 CsrUint32Ser(ptr, len, (u32) primitive->stats.rxFramesNum);
1753 CsrUint32Ser(ptr, len, (u32) primitive->stats.txFramesNum);
1754 CsrUint32Ser(ptr, len, (u32) primitive->stats.rxBytesCount);
1755 CsrUint32Ser(ptr, len, (u32) primitive->stats.txBytesCount);
1756 CsrMemCpySer(ptr, len, (const void *) primitive->stats.intervals, ((u16) (11)));
1757 return(ptr);
1758}
1759
1760
1761void* CsrWifiRouterCtrlTrafficSampleIndDes(u8 *buffer, size_t length)
1762{
1763 CsrWifiRouterCtrlTrafficSampleInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlTrafficSampleInd), GFP_KERNEL);
1764 size_t offset;
1765 offset = 0;
1766
1767 CsrUint16Des(&primitive->common.type, buffer, &offset);
1768 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
1769 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
1770 CsrUint32Des((u32 *) &primitive->stats.rxMeanRate, buffer, &offset);
1771 CsrUint32Des((u32 *) &primitive->stats.rxFramesNum, buffer, &offset);
1772 CsrUint32Des((u32 *) &primitive->stats.txFramesNum, buffer, &offset);
1773 CsrUint32Des((u32 *) &primitive->stats.rxBytesCount, buffer, &offset);
1774 CsrUint32Des((u32 *) &primitive->stats.txBytesCount, buffer, &offset);
1775 CsrMemCpyDes(primitive->stats.intervals, buffer, &offset, ((u16) (11)));
1776
1777 return primitive;
1778}
1779
1780
1781size_t CsrWifiRouterCtrlWifiOnIndSizeof(void *msg)
1782{
1783 CsrWifiRouterCtrlWifiOnInd *primitive = (CsrWifiRouterCtrlWifiOnInd *) msg;
1784 size_t bufferSize = 2;
1785
1786 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 27) */
1787 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
1788 bufferSize += 2; /* CsrResult primitive->status */
1789 bufferSize += 4; /* u32 primitive->versions.chipId */
1790 bufferSize += 4; /* u32 primitive->versions.chipVersion */
1791 bufferSize += 4; /* u32 primitive->versions.firmwareBuild */
1792 bufferSize += 4; /* u32 primitive->versions.firmwareHip */
1793 bufferSize += (primitive->versions.routerBuild ? strlen(primitive->versions.routerBuild) : 0) + 1; /* char* primitive->versions.routerBuild (0 byte len + 1 for NULL Term) */
1794 bufferSize += 4; /* u32 primitive->versions.routerHip */
1795 return bufferSize;
1796}
1797
1798
1799u8* CsrWifiRouterCtrlWifiOnIndSer(u8 *ptr, size_t *len, void *msg)
1800{
1801 CsrWifiRouterCtrlWifiOnInd *primitive = (CsrWifiRouterCtrlWifiOnInd *)msg;
1802 *len = 0;
1803 CsrUint16Ser(ptr, len, primitive->common.type);
1804 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
1805 CsrUint16Ser(ptr, len, (u16) primitive->status);
1806 CsrUint32Ser(ptr, len, (u32) primitive->versions.chipId);
1807 CsrUint32Ser(ptr, len, (u32) primitive->versions.chipVersion);
1808 CsrUint32Ser(ptr, len, (u32) primitive->versions.firmwareBuild);
1809 CsrUint32Ser(ptr, len, (u32) primitive->versions.firmwareHip);
1810 CsrCharStringSer(ptr, len, primitive->versions.routerBuild);
1811 CsrUint32Ser(ptr, len, (u32) primitive->versions.routerHip);
1812 return(ptr);
1813}
1814
1815
1816void* CsrWifiRouterCtrlWifiOnIndDes(u8 *buffer, size_t length)
1817{
1818 CsrWifiRouterCtrlWifiOnInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnInd), GFP_KERNEL);
1819 size_t offset;
1820 offset = 0;
1821
1822 CsrUint16Des(&primitive->common.type, buffer, &offset);
1823 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
1824 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
1825 CsrUint32Des((u32 *) &primitive->versions.chipId, buffer, &offset);
1826 CsrUint32Des((u32 *) &primitive->versions.chipVersion, buffer, &offset);
1827 CsrUint32Des((u32 *) &primitive->versions.firmwareBuild, buffer, &offset);
1828 CsrUint32Des((u32 *) &primitive->versions.firmwareHip, buffer, &offset);
1829 CsrCharStringDes(&primitive->versions.routerBuild, buffer, &offset);
1830 CsrUint32Des((u32 *) &primitive->versions.routerHip, buffer, &offset);
1831
1832 return primitive;
1833}
1834
1835
1836void CsrWifiRouterCtrlWifiOnIndSerFree(void *voidPrimitivePointer)
1837{
1838 CsrWifiRouterCtrlWifiOnInd *primitive = (CsrWifiRouterCtrlWifiOnInd *) voidPrimitivePointer;
1839 kfree(primitive->versions.routerBuild);
1840 kfree(primitive);
1841}
1842
1843
1844size_t CsrWifiRouterCtrlWifiOnCfmSizeof(void *msg)
1845{
1846 size_t bufferSize = 2;
1847
1848 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */
1849 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
1850 bufferSize += 2; /* CsrResult primitive->status */
1851 return bufferSize;
1852}
1853
1854
1855u8* CsrWifiRouterCtrlWifiOnCfmSer(u8 *ptr, size_t *len, void *msg)
1856{
1857 CsrWifiRouterCtrlWifiOnCfm *primitive = (CsrWifiRouterCtrlWifiOnCfm *)msg;
1858 *len = 0;
1859 CsrUint16Ser(ptr, len, primitive->common.type);
1860 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
1861 CsrUint16Ser(ptr, len, (u16) primitive->status);
1862 return(ptr);
1863}
1864
1865
1866void* CsrWifiRouterCtrlWifiOnCfmDes(u8 *buffer, size_t length)
1867{
1868 CsrWifiRouterCtrlWifiOnCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWifiOnCfm), GFP_KERNEL);
1869 size_t offset;
1870 offset = 0;
1871
1872 CsrUint16Des(&primitive->common.type, buffer, &offset);
1873 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
1874 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
1875
1876 return primitive;
1877}
1878
1879
1880size_t CsrWifiRouterCtrlM4ReadyToSendIndSizeof(void *msg)
1881{
1882 size_t bufferSize = 2;
1883
1884 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */
1885 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
1886 bufferSize += 2; /* u16 primitive->interfaceTag */
1887 bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */
1888 return bufferSize;
1889}
1890
1891
1892u8* CsrWifiRouterCtrlM4ReadyToSendIndSer(u8 *ptr, size_t *len, void *msg)
1893{
1894 CsrWifiRouterCtrlM4ReadyToSendInd *primitive = (CsrWifiRouterCtrlM4ReadyToSendInd *)msg;
1895 *len = 0;
1896 CsrUint16Ser(ptr, len, primitive->common.type);
1897 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
1898 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
1899 CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6)));
1900 return(ptr);
1901}
1902
1903
1904void* CsrWifiRouterCtrlM4ReadyToSendIndDes(u8 *buffer, size_t length)
1905{
1906 CsrWifiRouterCtrlM4ReadyToSendInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlM4ReadyToSendInd), GFP_KERNEL);
1907 size_t offset;
1908 offset = 0;
1909
1910 CsrUint16Des(&primitive->common.type, buffer, &offset);
1911 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
1912 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
1913 CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6)));
1914
1915 return primitive;
1916}
1917
1918
1919size_t CsrWifiRouterCtrlM4TransmittedIndSizeof(void *msg)
1920{
1921 size_t bufferSize = 2;
1922
1923 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */
1924 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
1925 bufferSize += 2; /* u16 primitive->interfaceTag */
1926 bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */
1927 bufferSize += 2; /* CsrResult primitive->status */
1928 return bufferSize;
1929}
1930
1931
1932u8* CsrWifiRouterCtrlM4TransmittedIndSer(u8 *ptr, size_t *len, void *msg)
1933{
1934 CsrWifiRouterCtrlM4TransmittedInd *primitive = (CsrWifiRouterCtrlM4TransmittedInd *)msg;
1935 *len = 0;
1936 CsrUint16Ser(ptr, len, primitive->common.type);
1937 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
1938 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
1939 CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6)));
1940 CsrUint16Ser(ptr, len, (u16) primitive->status);
1941 return(ptr);
1942}
1943
1944
1945void* CsrWifiRouterCtrlM4TransmittedIndDes(u8 *buffer, size_t length)
1946{
1947 CsrWifiRouterCtrlM4TransmittedInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlM4TransmittedInd), GFP_KERNEL);
1948 size_t offset;
1949 offset = 0;
1950
1951 CsrUint16Des(&primitive->common.type, buffer, &offset);
1952 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
1953 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
1954 CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6)));
1955 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
1956
1957 return primitive;
1958}
1959
1960
1961size_t CsrWifiRouterCtrlMicFailureIndSizeof(void *msg)
1962{
1963 size_t bufferSize = 2;
1964
1965 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */
1966 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
1967 bufferSize += 2; /* u16 primitive->interfaceTag */
1968 bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */
1969 bufferSize += 1; /* u8 primitive->unicastPdu */
1970 return bufferSize;
1971}
1972
1973
1974u8* CsrWifiRouterCtrlMicFailureIndSer(u8 *ptr, size_t *len, void *msg)
1975{
1976 CsrWifiRouterCtrlMicFailureInd *primitive = (CsrWifiRouterCtrlMicFailureInd *)msg;
1977 *len = 0;
1978 CsrUint16Ser(ptr, len, primitive->common.type);
1979 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
1980 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
1981 CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6)));
1982 CsrUint8Ser(ptr, len, (u8) primitive->unicastPdu);
1983 return(ptr);
1984}
1985
1986
1987void* CsrWifiRouterCtrlMicFailureIndDes(u8 *buffer, size_t length)
1988{
1989 CsrWifiRouterCtrlMicFailureInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlMicFailureInd), GFP_KERNEL);
1990 size_t offset;
1991 offset = 0;
1992
1993 CsrUint16Des(&primitive->common.type, buffer, &offset);
1994 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
1995 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
1996 CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6)));
1997 CsrUint8Des((u8 *) &primitive->unicastPdu, buffer, &offset);
1998
1999 return primitive;
2000}
2001
2002
2003size_t CsrWifiRouterCtrlConnectedIndSizeof(void *msg)
2004{
2005 size_t bufferSize = 2;
2006
2007 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */
2008 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
2009 bufferSize += 2; /* u16 primitive->interfaceTag */
2010 bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */
2011 bufferSize += 1; /* CsrWifiRouterCtrlPeerStatus primitive->peerStatus */
2012 return bufferSize;
2013}
2014
2015
2016u8* CsrWifiRouterCtrlConnectedIndSer(u8 *ptr, size_t *len, void *msg)
2017{
2018 CsrWifiRouterCtrlConnectedInd *primitive = (CsrWifiRouterCtrlConnectedInd *)msg;
2019 *len = 0;
2020 CsrUint16Ser(ptr, len, primitive->common.type);
2021 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
2022 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
2023 CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6)));
2024 CsrUint8Ser(ptr, len, (u8) primitive->peerStatus);
2025 return(ptr);
2026}
2027
2028
2029void* CsrWifiRouterCtrlConnectedIndDes(u8 *buffer, size_t length)
2030{
2031 CsrWifiRouterCtrlConnectedInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlConnectedInd), GFP_KERNEL);
2032 size_t offset;
2033 offset = 0;
2034
2035 CsrUint16Des(&primitive->common.type, buffer, &offset);
2036 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
2037 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
2038 CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6)));
2039 CsrUint8Des((u8 *) &primitive->peerStatus, buffer, &offset);
2040
2041 return primitive;
2042}
2043
2044
2045size_t CsrWifiRouterCtrlPeerAddCfmSizeof(void *msg)
2046{
2047 size_t bufferSize = 2;
2048
2049 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 19) */
2050 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
2051 bufferSize += 2; /* u16 primitive->interfaceTag */
2052 bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */
2053 bufferSize += 4; /* CsrWifiRouterCtrlPeerRecordHandle primitive->peerRecordHandle */
2054 bufferSize += 2; /* CsrResult primitive->status */
2055 return bufferSize;
2056}
2057
2058
2059u8* CsrWifiRouterCtrlPeerAddCfmSer(u8 *ptr, size_t *len, void *msg)
2060{
2061 CsrWifiRouterCtrlPeerAddCfm *primitive = (CsrWifiRouterCtrlPeerAddCfm *)msg;
2062 *len = 0;
2063 CsrUint16Ser(ptr, len, primitive->common.type);
2064 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
2065 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
2066 CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6)));
2067 CsrUint32Ser(ptr, len, (u32) primitive->peerRecordHandle);
2068 CsrUint16Ser(ptr, len, (u16) primitive->status);
2069 return(ptr);
2070}
2071
2072
2073void* CsrWifiRouterCtrlPeerAddCfmDes(u8 *buffer, size_t length)
2074{
2075 CsrWifiRouterCtrlPeerAddCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPeerAddCfm), GFP_KERNEL);
2076 size_t offset;
2077 offset = 0;
2078
2079 CsrUint16Des(&primitive->common.type, buffer, &offset);
2080 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
2081 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
2082 CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6)));
2083 CsrUint32Des((u32 *) &primitive->peerRecordHandle, buffer, &offset);
2084 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
2085
2086 return primitive;
2087}
2088
2089
2090size_t CsrWifiRouterCtrlPeerDelCfmSizeof(void *msg)
2091{
2092 size_t bufferSize = 2;
2093
2094 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */
2095 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
2096 bufferSize += 2; /* u16 primitive->interfaceTag */
2097 bufferSize += 2; /* CsrResult primitive->status */
2098 return bufferSize;
2099}
2100
2101
2102u8* CsrWifiRouterCtrlPeerDelCfmSer(u8 *ptr, size_t *len, void *msg)
2103{
2104 CsrWifiRouterCtrlPeerDelCfm *primitive = (CsrWifiRouterCtrlPeerDelCfm *)msg;
2105 *len = 0;
2106 CsrUint16Ser(ptr, len, primitive->common.type);
2107 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
2108 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
2109 CsrUint16Ser(ptr, len, (u16) primitive->status);
2110 return(ptr);
2111}
2112
2113
2114void* CsrWifiRouterCtrlPeerDelCfmDes(u8 *buffer, size_t length)
2115{
2116 CsrWifiRouterCtrlPeerDelCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPeerDelCfm), GFP_KERNEL);
2117 size_t offset;
2118 offset = 0;
2119
2120 CsrUint16Des(&primitive->common.type, buffer, &offset);
2121 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
2122 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
2123 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
2124
2125 return primitive;
2126}
2127
2128
2129size_t CsrWifiRouterCtrlUnexpectedFrameIndSizeof(void *msg)
2130{
2131 size_t bufferSize = 2;
2132
2133 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */
2134 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
2135 bufferSize += 2; /* u16 primitive->interfaceTag */
2136 bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */
2137 return bufferSize;
2138}
2139
2140
2141u8* CsrWifiRouterCtrlUnexpectedFrameIndSer(u8 *ptr, size_t *len, void *msg)
2142{
2143 CsrWifiRouterCtrlUnexpectedFrameInd *primitive = (CsrWifiRouterCtrlUnexpectedFrameInd *)msg;
2144 *len = 0;
2145 CsrUint16Ser(ptr, len, primitive->common.type);
2146 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
2147 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
2148 CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6)));
2149 return(ptr);
2150}
2151
2152
2153void* CsrWifiRouterCtrlUnexpectedFrameIndDes(u8 *buffer, size_t length)
2154{
2155 CsrWifiRouterCtrlUnexpectedFrameInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlUnexpectedFrameInd), GFP_KERNEL);
2156 size_t offset;
2157 offset = 0;
2158
2159 CsrUint16Des(&primitive->common.type, buffer, &offset);
2160 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
2161 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
2162 CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6)));
2163
2164 return primitive;
2165}
2166
2167
2168size_t CsrWifiRouterCtrlPeerUpdateCfmSizeof(void *msg)
2169{
2170 size_t bufferSize = 2;
2171
2172 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */
2173 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
2174 bufferSize += 2; /* u16 primitive->interfaceTag */
2175 bufferSize += 2; /* CsrResult primitive->status */
2176 return bufferSize;
2177}
2178
2179
2180u8* CsrWifiRouterCtrlPeerUpdateCfmSer(u8 *ptr, size_t *len, void *msg)
2181{
2182 CsrWifiRouterCtrlPeerUpdateCfm *primitive = (CsrWifiRouterCtrlPeerUpdateCfm *)msg;
2183 *len = 0;
2184 CsrUint16Ser(ptr, len, primitive->common.type);
2185 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
2186 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
2187 CsrUint16Ser(ptr, len, (u16) primitive->status);
2188 return(ptr);
2189}
2190
2191
2192void* CsrWifiRouterCtrlPeerUpdateCfmDes(u8 *buffer, size_t length)
2193{
2194 CsrWifiRouterCtrlPeerUpdateCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlPeerUpdateCfm), GFP_KERNEL);
2195 size_t offset;
2196 offset = 0;
2197
2198 CsrUint16Des(&primitive->common.type, buffer, &offset);
2199 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
2200 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
2201 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
2202
2203 return primitive;
2204}
2205
2206
2207size_t CsrWifiRouterCtrlCapabilitiesCfmSizeof(void *msg)
2208{
2209 size_t bufferSize = 2;
2210
2211 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */
2212 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
2213 bufferSize += 2; /* u16 primitive->commandQueueSize */
2214 bufferSize += 2; /* u16 primitive->trafficQueueSize */
2215 return bufferSize;
2216}
2217
2218
2219u8* CsrWifiRouterCtrlCapabilitiesCfmSer(u8 *ptr, size_t *len, void *msg)
2220{
2221 CsrWifiRouterCtrlCapabilitiesCfm *primitive = (CsrWifiRouterCtrlCapabilitiesCfm *)msg;
2222 *len = 0;
2223 CsrUint16Ser(ptr, len, primitive->common.type);
2224 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
2225 CsrUint16Ser(ptr, len, (u16) primitive->commandQueueSize);
2226 CsrUint16Ser(ptr, len, (u16) primitive->trafficQueueSize);
2227 return(ptr);
2228}
2229
2230
2231void* CsrWifiRouterCtrlCapabilitiesCfmDes(u8 *buffer, size_t length)
2232{
2233 CsrWifiRouterCtrlCapabilitiesCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlCapabilitiesCfm), GFP_KERNEL);
2234 size_t offset;
2235 offset = 0;
2236
2237 CsrUint16Des(&primitive->common.type, buffer, &offset);
2238 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
2239 CsrUint16Des((u16 *) &primitive->commandQueueSize, buffer, &offset);
2240 CsrUint16Des((u16 *) &primitive->trafficQueueSize, buffer, &offset);
2241
2242 return primitive;
2243}
2244
2245
2246size_t CsrWifiRouterCtrlBlockAckEnableCfmSizeof(void *msg)
2247{
2248 size_t bufferSize = 2;
2249
2250 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */
2251 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
2252 bufferSize += 2; /* u16 primitive->interfaceTag */
2253 bufferSize += 2; /* CsrResult primitive->status */
2254 return bufferSize;
2255}
2256
2257
2258u8* CsrWifiRouterCtrlBlockAckEnableCfmSer(u8 *ptr, size_t *len, void *msg)
2259{
2260 CsrWifiRouterCtrlBlockAckEnableCfm *primitive = (CsrWifiRouterCtrlBlockAckEnableCfm *)msg;
2261 *len = 0;
2262 CsrUint16Ser(ptr, len, primitive->common.type);
2263 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
2264 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
2265 CsrUint16Ser(ptr, len, (u16) primitive->status);
2266 return(ptr);
2267}
2268
2269
2270void* CsrWifiRouterCtrlBlockAckEnableCfmDes(u8 *buffer, size_t length)
2271{
2272 CsrWifiRouterCtrlBlockAckEnableCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckEnableCfm), GFP_KERNEL);
2273 size_t offset;
2274 offset = 0;
2275
2276 CsrUint16Des(&primitive->common.type, buffer, &offset);
2277 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
2278 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
2279 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
2280
2281 return primitive;
2282}
2283
2284
2285size_t CsrWifiRouterCtrlBlockAckDisableCfmSizeof(void *msg)
2286{
2287 size_t bufferSize = 2;
2288
2289 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */
2290 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
2291 bufferSize += 2; /* u16 primitive->interfaceTag */
2292 bufferSize += 2; /* CsrResult primitive->status */
2293 return bufferSize;
2294}
2295
2296
2297u8* CsrWifiRouterCtrlBlockAckDisableCfmSer(u8 *ptr, size_t *len, void *msg)
2298{
2299 CsrWifiRouterCtrlBlockAckDisableCfm *primitive = (CsrWifiRouterCtrlBlockAckDisableCfm *)msg;
2300 *len = 0;
2301 CsrUint16Ser(ptr, len, primitive->common.type);
2302 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
2303 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
2304 CsrUint16Ser(ptr, len, (u16) primitive->status);
2305 return(ptr);
2306}
2307
2308
2309void* CsrWifiRouterCtrlBlockAckDisableCfmDes(u8 *buffer, size_t length)
2310{
2311 CsrWifiRouterCtrlBlockAckDisableCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckDisableCfm), GFP_KERNEL);
2312 size_t offset;
2313 offset = 0;
2314
2315 CsrUint16Des(&primitive->common.type, buffer, &offset);
2316 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
2317 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
2318 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
2319
2320 return primitive;
2321}
2322
2323
2324size_t CsrWifiRouterCtrlBlockAckErrorIndSizeof(void *msg)
2325{
2326 size_t bufferSize = 2;
2327
2328 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 16) */
2329 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
2330 bufferSize += 2; /* u16 primitive->interfaceTag */
2331 bufferSize += 1; /* CsrWifiRouterCtrlTrafficStreamId primitive->trafficStreamID */
2332 bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */
2333 bufferSize += 2; /* CsrResult primitive->status */
2334 return bufferSize;
2335}
2336
2337
2338u8* CsrWifiRouterCtrlBlockAckErrorIndSer(u8 *ptr, size_t *len, void *msg)
2339{
2340 CsrWifiRouterCtrlBlockAckErrorInd *primitive = (CsrWifiRouterCtrlBlockAckErrorInd *)msg;
2341 *len = 0;
2342 CsrUint16Ser(ptr, len, primitive->common.type);
2343 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
2344 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
2345 CsrUint8Ser(ptr, len, (u8) primitive->trafficStreamID);
2346 CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6)));
2347 CsrUint16Ser(ptr, len, (u16) primitive->status);
2348 return(ptr);
2349}
2350
2351
2352void* CsrWifiRouterCtrlBlockAckErrorIndDes(u8 *buffer, size_t length)
2353{
2354 CsrWifiRouterCtrlBlockAckErrorInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlBlockAckErrorInd), GFP_KERNEL);
2355 size_t offset;
2356 offset = 0;
2357
2358 CsrUint16Des(&primitive->common.type, buffer, &offset);
2359 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
2360 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
2361 CsrUint8Des((u8 *) &primitive->trafficStreamID, buffer, &offset);
2362 CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6)));
2363 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
2364
2365 return primitive;
2366}
2367
2368
2369size_t CsrWifiRouterCtrlStaInactiveIndSizeof(void *msg)
2370{
2371 size_t bufferSize = 2;
2372
2373 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */
2374 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
2375 bufferSize += 2; /* u16 primitive->interfaceTag */
2376 bufferSize += 6; /* u8 primitive->staAddress.a[6] */
2377 return bufferSize;
2378}
2379
2380
2381u8* CsrWifiRouterCtrlStaInactiveIndSer(u8 *ptr, size_t *len, void *msg)
2382{
2383 CsrWifiRouterCtrlStaInactiveInd *primitive = (CsrWifiRouterCtrlStaInactiveInd *)msg;
2384 *len = 0;
2385 CsrUint16Ser(ptr, len, primitive->common.type);
2386 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
2387 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
2388 CsrMemCpySer(ptr, len, (const void *) primitive->staAddress.a, ((u16) (6)));
2389 return(ptr);
2390}
2391
2392
2393void* CsrWifiRouterCtrlStaInactiveIndDes(u8 *buffer, size_t length)
2394{
2395 CsrWifiRouterCtrlStaInactiveInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlStaInactiveInd), GFP_KERNEL);
2396 size_t offset;
2397 offset = 0;
2398
2399 CsrUint16Des(&primitive->common.type, buffer, &offset);
2400 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
2401 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
2402 CsrMemCpyDes(primitive->staAddress.a, buffer, &offset, ((u16) (6)));
2403
2404 return primitive;
2405}
2406
2407
2408size_t CsrWifiRouterCtrlWapiRxMicCheckIndSizeof(void *msg)
2409{
2410 CsrWifiRouterCtrlWapiRxMicCheckInd *primitive = (CsrWifiRouterCtrlWapiRxMicCheckInd *) msg;
2411 size_t bufferSize = 2;
2412
2413 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */
2414 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
2415 bufferSize += 2; /* u16 primitive->interfaceTag */
2416 bufferSize += 2; /* u16 primitive->signalLength */
2417 bufferSize += primitive->signalLength; /* u8 primitive->signal */
2418 bufferSize += 2; /* u16 primitive->dataLength */
2419 bufferSize += primitive->dataLength; /* u8 primitive->data */
2420 return bufferSize;
2421}
2422
2423
2424u8* CsrWifiRouterCtrlWapiRxMicCheckIndSer(u8 *ptr, size_t *len, void *msg)
2425{
2426 CsrWifiRouterCtrlWapiRxMicCheckInd *primitive = (CsrWifiRouterCtrlWapiRxMicCheckInd *)msg;
2427 *len = 0;
2428 CsrUint16Ser(ptr, len, primitive->common.type);
2429 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
2430 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
2431 CsrUint16Ser(ptr, len, (u16) primitive->signalLength);
2432 if (primitive->signalLength)
2433 {
2434 CsrMemCpySer(ptr, len, (const void *) primitive->signal, ((u16) (primitive->signalLength)));
2435 }
2436 CsrUint16Ser(ptr, len, (u16) primitive->dataLength);
2437 if (primitive->dataLength)
2438 {
2439 CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength)));
2440 }
2441 return(ptr);
2442}
2443
2444
2445void* CsrWifiRouterCtrlWapiRxMicCheckIndDes(u8 *buffer, size_t length)
2446{
2447 CsrWifiRouterCtrlWapiRxMicCheckInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWapiRxMicCheckInd), GFP_KERNEL);
2448 size_t offset;
2449 offset = 0;
2450
2451 CsrUint16Des(&primitive->common.type, buffer, &offset);
2452 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
2453 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
2454 CsrUint16Des((u16 *) &primitive->signalLength, buffer, &offset);
2455 if (primitive->signalLength)
2456 {
2457 primitive->signal = kmalloc(primitive->signalLength, GFP_KERNEL);
2458 CsrMemCpyDes(primitive->signal, buffer, &offset, ((u16) (primitive->signalLength)));
2459 }
2460 else
2461 {
2462 primitive->signal = NULL;
2463 }
2464 CsrUint16Des((u16 *) &primitive->dataLength, buffer, &offset);
2465 if (primitive->dataLength)
2466 {
2467 primitive->data = kmalloc(primitive->dataLength, GFP_KERNEL);
2468 CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength)));
2469 }
2470 else
2471 {
2472 primitive->data = NULL;
2473 }
2474
2475 return primitive;
2476}
2477
2478
2479void CsrWifiRouterCtrlWapiRxMicCheckIndSerFree(void *voidPrimitivePointer)
2480{
2481 CsrWifiRouterCtrlWapiRxMicCheckInd *primitive = (CsrWifiRouterCtrlWapiRxMicCheckInd *) voidPrimitivePointer;
2482 kfree(primitive->signal);
2483 kfree(primitive->data);
2484 kfree(primitive);
2485}
2486
2487
2488size_t CsrWifiRouterCtrlModeSetCfmSizeof(void *msg)
2489{
2490 size_t bufferSize = 2;
2491
2492 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */
2493 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
2494 bufferSize += 2; /* u16 primitive->interfaceTag */
2495 bufferSize += 1; /* CsrWifiRouterCtrlMode primitive->mode */
2496 bufferSize += 2; /* CsrResult primitive->status */
2497 return bufferSize;
2498}
2499
2500
2501u8* CsrWifiRouterCtrlModeSetCfmSer(u8 *ptr, size_t *len, void *msg)
2502{
2503 CsrWifiRouterCtrlModeSetCfm *primitive = (CsrWifiRouterCtrlModeSetCfm *)msg;
2504 *len = 0;
2505 CsrUint16Ser(ptr, len, primitive->common.type);
2506 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
2507 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
2508 CsrUint8Ser(ptr, len, (u8) primitive->mode);
2509 CsrUint16Ser(ptr, len, (u16) primitive->status);
2510 return(ptr);
2511}
2512
2513
2514void* CsrWifiRouterCtrlModeSetCfmDes(u8 *buffer, size_t length)
2515{
2516 CsrWifiRouterCtrlModeSetCfm *primitive = kmalloc(sizeof(CsrWifiRouterCtrlModeSetCfm), GFP_KERNEL);
2517 size_t offset;
2518 offset = 0;
2519
2520 CsrUint16Des(&primitive->common.type, buffer, &offset);
2521 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
2522 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
2523 CsrUint8Des((u8 *) &primitive->mode, buffer, &offset);
2524 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
2525
2526 return primitive;
2527}
2528
2529
2530size_t CsrWifiRouterCtrlWapiUnicastTxEncryptIndSizeof(void *msg)
2531{
2532 CsrWifiRouterCtrlWapiUnicastTxEncryptInd *primitive = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *) msg;
2533 size_t bufferSize = 2;
2534
2535 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */
2536 bufferSize += 2; /* CsrWifiRouterCtrlRequestorInfo primitive->clientData */
2537 bufferSize += 2; /* u16 primitive->interfaceTag */
2538 bufferSize += 2; /* u16 primitive->dataLength */
2539 bufferSize += primitive->dataLength; /* u8 primitive->data */
2540 return bufferSize;
2541}
2542
2543
2544u8* CsrWifiRouterCtrlWapiUnicastTxEncryptIndSer(u8 *ptr, size_t *len, void *msg)
2545{
2546 CsrWifiRouterCtrlWapiUnicastTxEncryptInd *primitive = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *)msg;
2547 *len = 0;
2548 CsrUint16Ser(ptr, len, primitive->common.type);
2549 CsrUint16Ser(ptr, len, (u16) primitive->clientData);
2550 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
2551 CsrUint16Ser(ptr, len, (u16) primitive->dataLength);
2552 if (primitive->dataLength)
2553 {
2554 CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength)));
2555 }
2556 return(ptr);
2557}
2558
2559
2560void* CsrWifiRouterCtrlWapiUnicastTxEncryptIndDes(u8 *buffer, size_t length)
2561{
2562 CsrWifiRouterCtrlWapiUnicastTxEncryptInd *primitive = kmalloc(sizeof(CsrWifiRouterCtrlWapiUnicastTxEncryptInd), GFP_KERNEL);
2563 size_t offset;
2564 offset = 0;
2565
2566 CsrUint16Des(&primitive->common.type, buffer, &offset);
2567 CsrUint16Des((u16 *) &primitive->clientData, buffer, &offset);
2568 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
2569 CsrUint16Des((u16 *) &primitive->dataLength, buffer, &offset);
2570 if (primitive->dataLength)
2571 {
2572 primitive->data = kmalloc(primitive->dataLength, GFP_KERNEL);
2573 CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength)));
2574 }
2575 else
2576 {
2577 primitive->data = NULL;
2578 }
2579
2580 return primitive;
2581}
2582
2583
2584void CsrWifiRouterCtrlWapiUnicastTxEncryptIndSerFree(void *voidPrimitivePointer)
2585{
2586 CsrWifiRouterCtrlWapiUnicastTxEncryptInd *primitive = (CsrWifiRouterCtrlWapiUnicastTxEncryptInd *) voidPrimitivePointer;
2587 kfree(primitive->data);
2588 kfree(primitive);
2589}
2590
2591
diff --git a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h b/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h
deleted file mode 100644
index c9048386cfcb..000000000000
--- a/drivers/staging/csr/csr_wifi_router_ctrl_serialize.h
+++ /dev/null
@@ -1,333 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_ROUTER_CTRL_SERIALIZE_H__
14#define CSR_WIFI_ROUTER_CTRL_SERIALIZE_H__
15
16#include "csr_wifi_msgconv.h"
17
18#include "csr_wifi_router_ctrl_prim.h"
19
20extern void CsrWifiRouterCtrlPfree(void *ptr);
21
22extern u8* CsrWifiRouterCtrlConfigurePowerModeReqSer(u8 *ptr, size_t *len, void *msg);
23extern void* CsrWifiRouterCtrlConfigurePowerModeReqDes(u8 *buffer, size_t len);
24extern size_t CsrWifiRouterCtrlConfigurePowerModeReqSizeof(void *msg);
25#define CsrWifiRouterCtrlConfigurePowerModeReqSerFree CsrWifiRouterCtrlPfree
26
27extern u8* CsrWifiRouterCtrlHipReqSer(u8 *ptr, size_t *len, void *msg);
28extern void* CsrWifiRouterCtrlHipReqDes(u8 *buffer, size_t len);
29extern size_t CsrWifiRouterCtrlHipReqSizeof(void *msg);
30extern void CsrWifiRouterCtrlHipReqSerFree(void *msg);
31
32extern u8* CsrWifiRouterCtrlMediaStatusReqSer(u8 *ptr, size_t *len, void *msg);
33extern void* CsrWifiRouterCtrlMediaStatusReqDes(u8 *buffer, size_t len);
34extern size_t CsrWifiRouterCtrlMediaStatusReqSizeof(void *msg);
35#define CsrWifiRouterCtrlMediaStatusReqSerFree CsrWifiRouterCtrlPfree
36
37extern u8* CsrWifiRouterCtrlMulticastAddressResSer(u8 *ptr, size_t *len, void *msg);
38extern void* CsrWifiRouterCtrlMulticastAddressResDes(u8 *buffer, size_t len);
39extern size_t CsrWifiRouterCtrlMulticastAddressResSizeof(void *msg);
40extern void CsrWifiRouterCtrlMulticastAddressResSerFree(void *msg);
41
42extern u8* CsrWifiRouterCtrlPortConfigureReqSer(u8 *ptr, size_t *len, void *msg);
43extern void* CsrWifiRouterCtrlPortConfigureReqDes(u8 *buffer, size_t len);
44extern size_t CsrWifiRouterCtrlPortConfigureReqSizeof(void *msg);
45#define CsrWifiRouterCtrlPortConfigureReqSerFree CsrWifiRouterCtrlPfree
46
47extern u8* CsrWifiRouterCtrlQosControlReqSer(u8 *ptr, size_t *len, void *msg);
48extern void* CsrWifiRouterCtrlQosControlReqDes(u8 *buffer, size_t len);
49extern size_t CsrWifiRouterCtrlQosControlReqSizeof(void *msg);
50#define CsrWifiRouterCtrlQosControlReqSerFree CsrWifiRouterCtrlPfree
51
52extern u8* CsrWifiRouterCtrlSuspendResSer(u8 *ptr, size_t *len, void *msg);
53extern void* CsrWifiRouterCtrlSuspendResDes(u8 *buffer, size_t len);
54extern size_t CsrWifiRouterCtrlSuspendResSizeof(void *msg);
55#define CsrWifiRouterCtrlSuspendResSerFree CsrWifiRouterCtrlPfree
56
57extern u8* CsrWifiRouterCtrlTclasAddReqSer(u8 *ptr, size_t *len, void *msg);
58extern void* CsrWifiRouterCtrlTclasAddReqDes(u8 *buffer, size_t len);
59extern size_t CsrWifiRouterCtrlTclasAddReqSizeof(void *msg);
60extern void CsrWifiRouterCtrlTclasAddReqSerFree(void *msg);
61
62extern u8* CsrWifiRouterCtrlResumeResSer(u8 *ptr, size_t *len, void *msg);
63extern void* CsrWifiRouterCtrlResumeResDes(u8 *buffer, size_t len);
64extern size_t CsrWifiRouterCtrlResumeResSizeof(void *msg);
65#define CsrWifiRouterCtrlResumeResSerFree CsrWifiRouterCtrlPfree
66
67#define CsrWifiRouterCtrlRawSdioDeinitialiseReqSer CsrWifiEventCsrUint16Ser
68#define CsrWifiRouterCtrlRawSdioDeinitialiseReqDes CsrWifiEventCsrUint16Des
69#define CsrWifiRouterCtrlRawSdioDeinitialiseReqSizeof CsrWifiEventCsrUint16Sizeof
70#define CsrWifiRouterCtrlRawSdioDeinitialiseReqSerFree CsrWifiRouterCtrlPfree
71
72#define CsrWifiRouterCtrlRawSdioInitialiseReqSer CsrWifiEventCsrUint16Ser
73#define CsrWifiRouterCtrlRawSdioInitialiseReqDes CsrWifiEventCsrUint16Des
74#define CsrWifiRouterCtrlRawSdioInitialiseReqSizeof CsrWifiEventCsrUint16Sizeof
75#define CsrWifiRouterCtrlRawSdioInitialiseReqSerFree CsrWifiRouterCtrlPfree
76
77extern u8* CsrWifiRouterCtrlTclasDelReqSer(u8 *ptr, size_t *len, void *msg);
78extern void* CsrWifiRouterCtrlTclasDelReqDes(u8 *buffer, size_t len);
79extern size_t CsrWifiRouterCtrlTclasDelReqSizeof(void *msg);
80extern void CsrWifiRouterCtrlTclasDelReqSerFree(void *msg);
81
82extern u8* CsrWifiRouterCtrlTrafficClassificationReqSer(u8 *ptr, size_t *len, void *msg);
83extern void* CsrWifiRouterCtrlTrafficClassificationReqDes(u8 *buffer, size_t len);
84extern size_t CsrWifiRouterCtrlTrafficClassificationReqSizeof(void *msg);
85#define CsrWifiRouterCtrlTrafficClassificationReqSerFree CsrWifiRouterCtrlPfree
86
87extern u8* CsrWifiRouterCtrlTrafficConfigReqSer(u8 *ptr, size_t *len, void *msg);
88extern void* CsrWifiRouterCtrlTrafficConfigReqDes(u8 *buffer, size_t len);
89extern size_t CsrWifiRouterCtrlTrafficConfigReqSizeof(void *msg);
90#define CsrWifiRouterCtrlTrafficConfigReqSerFree CsrWifiRouterCtrlPfree
91
92#define CsrWifiRouterCtrlWifiOffReqSer CsrWifiEventCsrUint16Ser
93#define CsrWifiRouterCtrlWifiOffReqDes CsrWifiEventCsrUint16Des
94#define CsrWifiRouterCtrlWifiOffReqSizeof CsrWifiEventCsrUint16Sizeof
95#define CsrWifiRouterCtrlWifiOffReqSerFree CsrWifiRouterCtrlPfree
96
97#define CsrWifiRouterCtrlWifiOffResSer CsrWifiEventCsrUint16Ser
98#define CsrWifiRouterCtrlWifiOffResDes CsrWifiEventCsrUint16Des
99#define CsrWifiRouterCtrlWifiOffResSizeof CsrWifiEventCsrUint16Sizeof
100#define CsrWifiRouterCtrlWifiOffResSerFree CsrWifiRouterCtrlPfree
101
102extern u8* CsrWifiRouterCtrlWifiOnReqSer(u8 *ptr, size_t *len, void *msg);
103extern void* CsrWifiRouterCtrlWifiOnReqDes(u8 *buffer, size_t len);
104extern size_t CsrWifiRouterCtrlWifiOnReqSizeof(void *msg);
105extern void CsrWifiRouterCtrlWifiOnReqSerFree(void *msg);
106
107extern u8* CsrWifiRouterCtrlWifiOnResSer(u8 *ptr, size_t *len, void *msg);
108extern void* CsrWifiRouterCtrlWifiOnResDes(u8 *buffer, size_t len);
109extern size_t CsrWifiRouterCtrlWifiOnResSizeof(void *msg);
110extern void CsrWifiRouterCtrlWifiOnResSerFree(void *msg);
111
112extern u8* CsrWifiRouterCtrlM4TransmitReqSer(u8 *ptr, size_t *len, void *msg);
113extern void* CsrWifiRouterCtrlM4TransmitReqDes(u8 *buffer, size_t len);
114extern size_t CsrWifiRouterCtrlM4TransmitReqSizeof(void *msg);
115#define CsrWifiRouterCtrlM4TransmitReqSerFree CsrWifiRouterCtrlPfree
116
117extern u8* CsrWifiRouterCtrlModeSetReqSer(u8 *ptr, size_t *len, void *msg);
118extern void* CsrWifiRouterCtrlModeSetReqDes(u8 *buffer, size_t len);
119extern size_t CsrWifiRouterCtrlModeSetReqSizeof(void *msg);
120#define CsrWifiRouterCtrlModeSetReqSerFree CsrWifiRouterCtrlPfree
121
122extern u8* CsrWifiRouterCtrlPeerAddReqSer(u8 *ptr, size_t *len, void *msg);
123extern void* CsrWifiRouterCtrlPeerAddReqDes(u8 *buffer, size_t len);
124extern size_t CsrWifiRouterCtrlPeerAddReqSizeof(void *msg);
125#define CsrWifiRouterCtrlPeerAddReqSerFree CsrWifiRouterCtrlPfree
126
127extern u8* CsrWifiRouterCtrlPeerDelReqSer(u8 *ptr, size_t *len, void *msg);
128extern void* CsrWifiRouterCtrlPeerDelReqDes(u8 *buffer, size_t len);
129extern size_t CsrWifiRouterCtrlPeerDelReqSizeof(void *msg);
130#define CsrWifiRouterCtrlPeerDelReqSerFree CsrWifiRouterCtrlPfree
131
132extern u8* CsrWifiRouterCtrlPeerUpdateReqSer(u8 *ptr, size_t *len, void *msg);
133extern void* CsrWifiRouterCtrlPeerUpdateReqDes(u8 *buffer, size_t len);
134extern size_t CsrWifiRouterCtrlPeerUpdateReqSizeof(void *msg);
135#define CsrWifiRouterCtrlPeerUpdateReqSerFree CsrWifiRouterCtrlPfree
136
137#define CsrWifiRouterCtrlCapabilitiesReqSer CsrWifiEventCsrUint16Ser
138#define CsrWifiRouterCtrlCapabilitiesReqDes CsrWifiEventCsrUint16Des
139#define CsrWifiRouterCtrlCapabilitiesReqSizeof CsrWifiEventCsrUint16Sizeof
140#define CsrWifiRouterCtrlCapabilitiesReqSerFree CsrWifiRouterCtrlPfree
141
142extern u8* CsrWifiRouterCtrlBlockAckEnableReqSer(u8 *ptr, size_t *len, void *msg);
143extern void* CsrWifiRouterCtrlBlockAckEnableReqDes(u8 *buffer, size_t len);
144extern size_t CsrWifiRouterCtrlBlockAckEnableReqSizeof(void *msg);
145#define CsrWifiRouterCtrlBlockAckEnableReqSerFree CsrWifiRouterCtrlPfree
146
147extern u8* CsrWifiRouterCtrlBlockAckDisableReqSer(u8 *ptr, size_t *len, void *msg);
148extern void* CsrWifiRouterCtrlBlockAckDisableReqDes(u8 *buffer, size_t len);
149extern size_t CsrWifiRouterCtrlBlockAckDisableReqSizeof(void *msg);
150#define CsrWifiRouterCtrlBlockAckDisableReqSerFree CsrWifiRouterCtrlPfree
151
152extern u8* CsrWifiRouterCtrlWapiRxPktReqSer(u8 *ptr, size_t *len, void *msg);
153extern void* CsrWifiRouterCtrlWapiRxPktReqDes(u8 *buffer, size_t len);
154extern size_t CsrWifiRouterCtrlWapiRxPktReqSizeof(void *msg);
155extern void CsrWifiRouterCtrlWapiRxPktReqSerFree(void *msg);
156
157#define CsrWifiRouterCtrlWapiMulticastFilterReqSer CsrWifiEventCsrUint16CsrUint8Ser
158#define CsrWifiRouterCtrlWapiMulticastFilterReqDes CsrWifiEventCsrUint16CsrUint8Des
159#define CsrWifiRouterCtrlWapiMulticastFilterReqSizeof CsrWifiEventCsrUint16CsrUint8Sizeof
160#define CsrWifiRouterCtrlWapiMulticastFilterReqSerFree CsrWifiRouterCtrlPfree
161
162#define CsrWifiRouterCtrlWapiUnicastFilterReqSer CsrWifiEventCsrUint16CsrUint8Ser
163#define CsrWifiRouterCtrlWapiUnicastFilterReqDes CsrWifiEventCsrUint16CsrUint8Des
164#define CsrWifiRouterCtrlWapiUnicastFilterReqSizeof CsrWifiEventCsrUint16CsrUint8Sizeof
165#define CsrWifiRouterCtrlWapiUnicastFilterReqSerFree CsrWifiRouterCtrlPfree
166
167extern u8* CsrWifiRouterCtrlWapiUnicastTxPktReqSer(u8 *ptr, size_t *len, void *msg);
168extern void* CsrWifiRouterCtrlWapiUnicastTxPktReqDes(u8 *buffer, size_t len);
169extern size_t CsrWifiRouterCtrlWapiUnicastTxPktReqSizeof(void *msg);
170extern void CsrWifiRouterCtrlWapiUnicastTxPktReqSerFree(void *msg);
171
172#define CsrWifiRouterCtrlWapiFilterReqSer CsrWifiEventCsrUint16CsrUint8Ser
173#define CsrWifiRouterCtrlWapiFilterReqDes CsrWifiEventCsrUint16CsrUint8Des
174#define CsrWifiRouterCtrlWapiFilterReqSizeof CsrWifiEventCsrUint16CsrUint8Sizeof
175#define CsrWifiRouterCtrlWapiFilterReqSerFree CsrWifiRouterCtrlPfree
176
177extern u8* CsrWifiRouterCtrlHipIndSer(u8 *ptr, size_t *len, void *msg);
178extern void* CsrWifiRouterCtrlHipIndDes(u8 *buffer, size_t len);
179extern size_t CsrWifiRouterCtrlHipIndSizeof(void *msg);
180extern void CsrWifiRouterCtrlHipIndSerFree(void *msg);
181
182extern u8* CsrWifiRouterCtrlMulticastAddressIndSer(u8 *ptr, size_t *len, void *msg);
183extern void* CsrWifiRouterCtrlMulticastAddressIndDes(u8 *buffer, size_t len);
184extern size_t CsrWifiRouterCtrlMulticastAddressIndSizeof(void *msg);
185extern void CsrWifiRouterCtrlMulticastAddressIndSerFree(void *msg);
186
187extern u8* CsrWifiRouterCtrlPortConfigureCfmSer(u8 *ptr, size_t *len, void *msg);
188extern void* CsrWifiRouterCtrlPortConfigureCfmDes(u8 *buffer, size_t len);
189extern size_t CsrWifiRouterCtrlPortConfigureCfmSizeof(void *msg);
190#define CsrWifiRouterCtrlPortConfigureCfmSerFree CsrWifiRouterCtrlPfree
191
192#define CsrWifiRouterCtrlResumeIndSer CsrWifiEventCsrUint16CsrUint8Ser
193#define CsrWifiRouterCtrlResumeIndDes CsrWifiEventCsrUint16CsrUint8Des
194#define CsrWifiRouterCtrlResumeIndSizeof CsrWifiEventCsrUint16CsrUint8Sizeof
195#define CsrWifiRouterCtrlResumeIndSerFree CsrWifiRouterCtrlPfree
196
197extern u8* CsrWifiRouterCtrlSuspendIndSer(u8 *ptr, size_t *len, void *msg);
198extern void* CsrWifiRouterCtrlSuspendIndDes(u8 *buffer, size_t len);
199extern size_t CsrWifiRouterCtrlSuspendIndSizeof(void *msg);
200#define CsrWifiRouterCtrlSuspendIndSerFree CsrWifiRouterCtrlPfree
201
202extern u8* CsrWifiRouterCtrlTclasAddCfmSer(u8 *ptr, size_t *len, void *msg);
203extern void* CsrWifiRouterCtrlTclasAddCfmDes(u8 *buffer, size_t len);
204extern size_t CsrWifiRouterCtrlTclasAddCfmSizeof(void *msg);
205#define CsrWifiRouterCtrlTclasAddCfmSerFree CsrWifiRouterCtrlPfree
206
207extern u8* CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer(u8 *ptr, size_t *len, void *msg);
208extern void* CsrWifiRouterCtrlRawSdioDeinitialiseCfmDes(u8 *buffer, size_t len);
209extern size_t CsrWifiRouterCtrlRawSdioDeinitialiseCfmSizeof(void *msg);
210#define CsrWifiRouterCtrlRawSdioDeinitialiseCfmSerFree CsrWifiRouterCtrlPfree
211
212extern u8* CsrWifiRouterCtrlRawSdioInitialiseCfmSer(u8 *ptr, size_t *len, void *msg);
213extern void* CsrWifiRouterCtrlRawSdioInitialiseCfmDes(u8 *buffer, size_t len);
214extern size_t CsrWifiRouterCtrlRawSdioInitialiseCfmSizeof(void *msg);
215#define CsrWifiRouterCtrlRawSdioInitialiseCfmSerFree CsrWifiRouterCtrlPfree
216
217extern u8* CsrWifiRouterCtrlTclasDelCfmSer(u8 *ptr, size_t *len, void *msg);
218extern void* CsrWifiRouterCtrlTclasDelCfmDes(u8 *buffer, size_t len);
219extern size_t CsrWifiRouterCtrlTclasDelCfmSizeof(void *msg);
220#define CsrWifiRouterCtrlTclasDelCfmSerFree CsrWifiRouterCtrlPfree
221
222extern u8* CsrWifiRouterCtrlTrafficProtocolIndSer(u8 *ptr, size_t *len, void *msg);
223extern void* CsrWifiRouterCtrlTrafficProtocolIndDes(u8 *buffer, size_t len);
224extern size_t CsrWifiRouterCtrlTrafficProtocolIndSizeof(void *msg);
225#define CsrWifiRouterCtrlTrafficProtocolIndSerFree CsrWifiRouterCtrlPfree
226
227extern u8* CsrWifiRouterCtrlTrafficSampleIndSer(u8 *ptr, size_t *len, void *msg);
228extern void* CsrWifiRouterCtrlTrafficSampleIndDes(u8 *buffer, size_t len);
229extern size_t CsrWifiRouterCtrlTrafficSampleIndSizeof(void *msg);
230#define CsrWifiRouterCtrlTrafficSampleIndSerFree CsrWifiRouterCtrlPfree
231
232#define CsrWifiRouterCtrlWifiOffIndSer CsrWifiEventCsrUint16CsrUint8Ser
233#define CsrWifiRouterCtrlWifiOffIndDes CsrWifiEventCsrUint16CsrUint8Des
234#define CsrWifiRouterCtrlWifiOffIndSizeof CsrWifiEventCsrUint16CsrUint8Sizeof
235#define CsrWifiRouterCtrlWifiOffIndSerFree CsrWifiRouterCtrlPfree
236
237#define CsrWifiRouterCtrlWifiOffCfmSer CsrWifiEventCsrUint16Ser
238#define CsrWifiRouterCtrlWifiOffCfmDes CsrWifiEventCsrUint16Des
239#define CsrWifiRouterCtrlWifiOffCfmSizeof CsrWifiEventCsrUint16Sizeof
240#define CsrWifiRouterCtrlWifiOffCfmSerFree CsrWifiRouterCtrlPfree
241
242extern u8* CsrWifiRouterCtrlWifiOnIndSer(u8 *ptr, size_t *len, void *msg);
243extern void* CsrWifiRouterCtrlWifiOnIndDes(u8 *buffer, size_t len);
244extern size_t CsrWifiRouterCtrlWifiOnIndSizeof(void *msg);
245extern void CsrWifiRouterCtrlWifiOnIndSerFree(void *msg);
246
247extern u8* CsrWifiRouterCtrlWifiOnCfmSer(u8 *ptr, size_t *len, void *msg);
248extern void* CsrWifiRouterCtrlWifiOnCfmDes(u8 *buffer, size_t len);
249extern size_t CsrWifiRouterCtrlWifiOnCfmSizeof(void *msg);
250#define CsrWifiRouterCtrlWifiOnCfmSerFree CsrWifiRouterCtrlPfree
251
252extern u8* CsrWifiRouterCtrlM4ReadyToSendIndSer(u8 *ptr, size_t *len, void *msg);
253extern void* CsrWifiRouterCtrlM4ReadyToSendIndDes(u8 *buffer, size_t len);
254extern size_t CsrWifiRouterCtrlM4ReadyToSendIndSizeof(void *msg);
255#define CsrWifiRouterCtrlM4ReadyToSendIndSerFree CsrWifiRouterCtrlPfree
256
257extern u8* CsrWifiRouterCtrlM4TransmittedIndSer(u8 *ptr, size_t *len, void *msg);
258extern void* CsrWifiRouterCtrlM4TransmittedIndDes(u8 *buffer, size_t len);
259extern size_t CsrWifiRouterCtrlM4TransmittedIndSizeof(void *msg);
260#define CsrWifiRouterCtrlM4TransmittedIndSerFree CsrWifiRouterCtrlPfree
261
262extern u8* CsrWifiRouterCtrlMicFailureIndSer(u8 *ptr, size_t *len, void *msg);
263extern void* CsrWifiRouterCtrlMicFailureIndDes(u8 *buffer, size_t len);
264extern size_t CsrWifiRouterCtrlMicFailureIndSizeof(void *msg);
265#define CsrWifiRouterCtrlMicFailureIndSerFree CsrWifiRouterCtrlPfree
266
267extern u8* CsrWifiRouterCtrlConnectedIndSer(u8 *ptr, size_t *len, void *msg);
268extern void* CsrWifiRouterCtrlConnectedIndDes(u8 *buffer, size_t len);
269extern size_t CsrWifiRouterCtrlConnectedIndSizeof(void *msg);
270#define CsrWifiRouterCtrlConnectedIndSerFree CsrWifiRouterCtrlPfree
271
272extern u8* CsrWifiRouterCtrlPeerAddCfmSer(u8 *ptr, size_t *len, void *msg);
273extern void* CsrWifiRouterCtrlPeerAddCfmDes(u8 *buffer, size_t len);
274extern size_t CsrWifiRouterCtrlPeerAddCfmSizeof(void *msg);
275#define CsrWifiRouterCtrlPeerAddCfmSerFree CsrWifiRouterCtrlPfree
276
277extern u8* CsrWifiRouterCtrlPeerDelCfmSer(u8 *ptr, size_t *len, void *msg);
278extern void* CsrWifiRouterCtrlPeerDelCfmDes(u8 *buffer, size_t len);
279extern size_t CsrWifiRouterCtrlPeerDelCfmSizeof(void *msg);
280#define CsrWifiRouterCtrlPeerDelCfmSerFree CsrWifiRouterCtrlPfree
281
282extern u8* CsrWifiRouterCtrlUnexpectedFrameIndSer(u8 *ptr, size_t *len, void *msg);
283extern void* CsrWifiRouterCtrlUnexpectedFrameIndDes(u8 *buffer, size_t len);
284extern size_t CsrWifiRouterCtrlUnexpectedFrameIndSizeof(void *msg);
285#define CsrWifiRouterCtrlUnexpectedFrameIndSerFree CsrWifiRouterCtrlPfree
286
287extern u8* CsrWifiRouterCtrlPeerUpdateCfmSer(u8 *ptr, size_t *len, void *msg);
288extern void* CsrWifiRouterCtrlPeerUpdateCfmDes(u8 *buffer, size_t len);
289extern size_t CsrWifiRouterCtrlPeerUpdateCfmSizeof(void *msg);
290#define CsrWifiRouterCtrlPeerUpdateCfmSerFree CsrWifiRouterCtrlPfree
291
292extern u8* CsrWifiRouterCtrlCapabilitiesCfmSer(u8 *ptr, size_t *len, void *msg);
293extern void* CsrWifiRouterCtrlCapabilitiesCfmDes(u8 *buffer, size_t len);
294extern size_t CsrWifiRouterCtrlCapabilitiesCfmSizeof(void *msg);
295#define CsrWifiRouterCtrlCapabilitiesCfmSerFree CsrWifiRouterCtrlPfree
296
297extern u8* CsrWifiRouterCtrlBlockAckEnableCfmSer(u8 *ptr, size_t *len, void *msg);
298extern void* CsrWifiRouterCtrlBlockAckEnableCfmDes(u8 *buffer, size_t len);
299extern size_t CsrWifiRouterCtrlBlockAckEnableCfmSizeof(void *msg);
300#define CsrWifiRouterCtrlBlockAckEnableCfmSerFree CsrWifiRouterCtrlPfree
301
302extern u8* CsrWifiRouterCtrlBlockAckDisableCfmSer(u8 *ptr, size_t *len, void *msg);
303extern void* CsrWifiRouterCtrlBlockAckDisableCfmDes(u8 *buffer, size_t len);
304extern size_t CsrWifiRouterCtrlBlockAckDisableCfmSizeof(void *msg);
305#define CsrWifiRouterCtrlBlockAckDisableCfmSerFree CsrWifiRouterCtrlPfree
306
307extern u8* CsrWifiRouterCtrlBlockAckErrorIndSer(u8 *ptr, size_t *len, void *msg);
308extern void* CsrWifiRouterCtrlBlockAckErrorIndDes(u8 *buffer, size_t len);
309extern size_t CsrWifiRouterCtrlBlockAckErrorIndSizeof(void *msg);
310#define CsrWifiRouterCtrlBlockAckErrorIndSerFree CsrWifiRouterCtrlPfree
311
312extern u8* CsrWifiRouterCtrlStaInactiveIndSer(u8 *ptr, size_t *len, void *msg);
313extern void* CsrWifiRouterCtrlStaInactiveIndDes(u8 *buffer, size_t len);
314extern size_t CsrWifiRouterCtrlStaInactiveIndSizeof(void *msg);
315#define CsrWifiRouterCtrlStaInactiveIndSerFree CsrWifiRouterCtrlPfree
316
317extern u8* CsrWifiRouterCtrlWapiRxMicCheckIndSer(u8 *ptr, size_t *len, void *msg);
318extern void* CsrWifiRouterCtrlWapiRxMicCheckIndDes(u8 *buffer, size_t len);
319extern size_t CsrWifiRouterCtrlWapiRxMicCheckIndSizeof(void *msg);
320extern void CsrWifiRouterCtrlWapiRxMicCheckIndSerFree(void *msg);
321
322extern u8* CsrWifiRouterCtrlModeSetCfmSer(u8 *ptr, size_t *len, void *msg);
323extern void* CsrWifiRouterCtrlModeSetCfmDes(u8 *buffer, size_t len);
324extern size_t CsrWifiRouterCtrlModeSetCfmSizeof(void *msg);
325#define CsrWifiRouterCtrlModeSetCfmSerFree CsrWifiRouterCtrlPfree
326
327extern u8* CsrWifiRouterCtrlWapiUnicastTxEncryptIndSer(u8 *ptr, size_t *len, void *msg);
328extern void* CsrWifiRouterCtrlWapiUnicastTxEncryptIndDes(u8 *buffer, size_t len);
329extern size_t CsrWifiRouterCtrlWapiUnicastTxEncryptIndSizeof(void *msg);
330extern void CsrWifiRouterCtrlWapiUnicastTxEncryptIndSerFree(void *msg);
331
332#endif /* CSR_WIFI_ROUTER_CTRL_SERIALIZE_H__ */
333
diff --git a/drivers/staging/csr/csr_wifi_router_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_router_free_downstream_contents.c
deleted file mode 100644
index c4badc565a91..000000000000
--- a/drivers/staging/csr/csr_wifi_router_free_downstream_contents.c
+++ /dev/null
@@ -1,53 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12#include <linux/slab.h>
13#include "csr_wifi_router_prim.h"
14#include "csr_wifi_router_lib.h"
15
16/*----------------------------------------------------------------------------*
17 * NAME
18 * CsrWifiRouterFreeDownstreamMessageContents
19 *
20 * DESCRIPTION
21 *
22 *
23 * PARAMETERS
24 * eventClass: only the value CSR_WIFI_ROUTER_PRIM will be handled
25 * message: the message to free
26 *----------------------------------------------------------------------------*/
27void CsrWifiRouterFreeDownstreamMessageContents(u16 eventClass, void *message)
28{
29 if (eventClass != CSR_WIFI_ROUTER_PRIM)
30 {
31 return;
32 }
33 if (NULL == message)
34 {
35 return;
36 }
37
38 switch (*((CsrWifiRouterPrim *) message))
39 {
40 case CSR_WIFI_ROUTER_MA_PACKET_REQ:
41 {
42 CsrWifiRouterMaPacketReq *p = (CsrWifiRouterMaPacketReq *)message;
43 kfree(p->frame);
44 p->frame = NULL;
45 break;
46 }
47
48 default:
49 break;
50 }
51}
52
53
diff --git a/drivers/staging/csr/csr_wifi_router_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_router_free_upstream_contents.c
deleted file mode 100644
index 4cd126338e27..000000000000
--- a/drivers/staging/csr/csr_wifi_router_free_upstream_contents.c
+++ /dev/null
@@ -1,47 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12#include <linux/slab.h>
13#include "csr_wifi_router_prim.h"
14#include "csr_wifi_router_lib.h"
15
16/*----------------------------------------------------------------------------*
17 * NAME
18 * CsrWifiRouterFreeUpstreamMessageContents
19 *
20 * DESCRIPTION
21 *
22 *
23 * PARAMETERS
24 * eventClass: only the value CSR_WIFI_ROUTER_PRIM will be handled
25 * message: the message to free
26 *----------------------------------------------------------------------------*/
27void CsrWifiRouterFreeUpstreamMessageContents(u16 eventClass, void *message)
28{
29 if (eventClass != CSR_WIFI_ROUTER_PRIM)
30 return;
31 if (NULL == message)
32 return;
33 switch (*((CsrWifiRouterPrim *) message)) {
34 case CSR_WIFI_ROUTER_MA_PACKET_IND:
35 {
36 CsrWifiRouterMaPacketInd *p =
37 (CsrWifiRouterMaPacketInd *) message;
38 kfree(p->frame);
39 p->frame = NULL;
40 break;
41 }
42 default:
43 break;
44 }
45}
46
47
diff --git a/drivers/staging/csr/csr_wifi_router_lib.h b/drivers/staging/csr/csr_wifi_router_lib.h
deleted file mode 100644
index b0477c413aae..000000000000
--- a/drivers/staging/csr/csr_wifi_router_lib.h
+++ /dev/null
@@ -1,417 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_ROUTER_LIB_H__
14#define CSR_WIFI_ROUTER_LIB_H__
15
16#include "csr_sched.h"
17#include "csr_macro.h"
18#include "csr_msg_transport.h"
19
20#include "csr_wifi_lib.h"
21
22#include "csr_wifi_router_prim.h"
23#include "csr_wifi_router_task.h"
24
25/*----------------------------------------------------------------------------*
26 * CsrWifiRouterFreeUpstreamMessageContents
27 *
28 * DESCRIPTION
29 * Free the allocated memory in a CSR_WIFI_ROUTER upstream message. Does not
30 * free the message itself, and can only be used for upstream messages.
31 *
32 * PARAMETERS
33 * Deallocates the resources in a CSR_WIFI_ROUTER upstream message
34 *----------------------------------------------------------------------------*/
35void CsrWifiRouterFreeUpstreamMessageContents(u16 eventClass, void *message);
36
37/*----------------------------------------------------------------------------*
38 * CsrWifiRouterFreeDownstreamMessageContents
39 *
40 * DESCRIPTION
41 * Free the allocated memory in a CSR_WIFI_ROUTER downstream message. Does not
42 * free the message itself, and can only be used for downstream messages.
43 *
44 * PARAMETERS
45 * Deallocates the resources in a CSR_WIFI_ROUTER downstream message
46 *----------------------------------------------------------------------------*/
47void CsrWifiRouterFreeDownstreamMessageContents(u16 eventClass, void *message);
48
49/*----------------------------------------------------------------------------*
50 * Enum to string functions
51 *----------------------------------------------------------------------------*/
52const char* CsrWifiRouterAppTypeToString(CsrWifiRouterAppType value);
53const char* CsrWifiRouterEncapsulationToString(CsrWifiRouterEncapsulation value);
54const char* CsrWifiRouterOuiToString(CsrWifiRouterOui value);
55const char* CsrWifiRouterPriorityToString(CsrWifiRouterPriority value);
56
57
58/*----------------------------------------------------------------------------*
59 * CsrPrim Type toString function.
60 * Converts a message type to the String name of the Message
61 *----------------------------------------------------------------------------*/
62const char* CsrWifiRouterPrimTypeToString(CsrPrim msgType);
63
64/*----------------------------------------------------------------------------*
65 * Lookup arrays for PrimType name Strings
66 *----------------------------------------------------------------------------*/
67extern const char *CsrWifiRouterUpstreamPrimNames[CSR_WIFI_ROUTER_PRIM_UPSTREAM_COUNT];
68extern const char *CsrWifiRouterDownstreamPrimNames[CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT];
69
70/*******************************************************************************
71
72 NAME
73 CsrWifiRouterMaPacketCancelReqSend
74
75 DESCRIPTION
76 This primitive is used to request cancellation of a previously send
77 CsrWifiRouterMaPacketReq.
78 The frame may already have been transmitted so there is no guarantees
79 that the CsrWifiRouterMaPacketCancelReq actually cancels the transmission
80 of the frame in question.
81 If the cancellation fails, the Router will send, if required,
82 CsrWifiRouterMaPacketCfm.
83 If the cancellation succeeds, the Router will not send
84 CsrWifiRouterMaPacketCfm.
85
86 PARAMETERS
87 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
88 interfaceTag - Interface Identifier; unique identifier of an interface
89 hostTag - The hostTag for the frame, which should be cancelled.
90 priority - Priority of the frame, which should be cancelled
91 peerMacAddress - Destination MAC address of the frame, which should be
92 cancelled
93
94*******************************************************************************/
95#define CsrWifiRouterMaPacketCancelReqCreate(msg__, dst__, src__, interfaceTag__, hostTag__, priority__, peerMacAddress__) \
96 msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketCancelReq), GFP_KERNEL); \
97 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_CANCEL_REQ, dst__, src__); \
98 msg__->interfaceTag = (interfaceTag__); \
99 msg__->hostTag = (hostTag__); \
100 msg__->priority = (priority__); \
101 msg__->peerMacAddress = (peerMacAddress__);
102
103#define CsrWifiRouterMaPacketCancelReqSendTo(dst__, src__, interfaceTag__, hostTag__, priority__, peerMacAddress__) \
104 { \
105 CsrWifiRouterMaPacketCancelReq *msg__; \
106 CsrWifiRouterMaPacketCancelReqCreate(msg__, dst__, src__, interfaceTag__, hostTag__, priority__, peerMacAddress__); \
107 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \
108 }
109
110#define CsrWifiRouterMaPacketCancelReqSend(src__, interfaceTag__, hostTag__, priority__, peerMacAddress__) \
111 CsrWifiRouterMaPacketCancelReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, hostTag__, priority__, peerMacAddress__)
112
113/*******************************************************************************
114
115 NAME
116 CsrWifiRouterMaPacketReqSend
117
118 DESCRIPTION
119 A task sends this primitive to transmit a frame.
120
121 PARAMETERS
122 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
123 interfaceTag - Interface Identifier; unique identifier of an interface
124 subscriptionHandle - The handle of the subscription
125 frameLength - Length of the frame to be sent in bytes
126 frame - Pointer to the frame to be sent
127 freeFunction - Pointer to function to be used to free the frame
128 priority - Priority of the frame, which should be sent
129 hostTag - An application shall set the bits b31..b28 using one of
130 the CSR_WIFI_ROUTER_APP_TYPE_* masks. Bits b0..b27 can
131 be used by the requestor without any restrictions, but
132 the hostTag shall be unique so the hostTag for
133 CSR_WIFI_ROUTER_APP _TYPE_OTHER should be constructured
134 in the following way [ CSR_WIFI_ROUTER_APP_TYPE_OTHER
135 (4 bits) | SubscriptionHandle (8 bits) | Sequence no.
136 (20 bits) ]. If the hostTag is not unique, the
137 behaviour of the system is unpredicatable with respect
138 to data/management frame transfer.
139 cfmRequested - Indicates if the requestor needs a confirm for packet
140 requests sent under this subscription. If set to TRUE,
141 the router will send a confirm, else it will not send
142 any confirm
143
144*******************************************************************************/
145#define CsrWifiRouterMaPacketReqCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, frameLength__, frame__, freeFunction__, priority__, hostTag__, cfmRequested__) \
146 msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketReq), GFP_KERNEL); \
147 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_REQ, dst__, src__); \
148 msg__->interfaceTag = (interfaceTag__); \
149 msg__->subscriptionHandle = (subscriptionHandle__); \
150 msg__->frameLength = (frameLength__); \
151 msg__->frame = (frame__); \
152 msg__->freeFunction = (freeFunction__); \
153 msg__->priority = (priority__); \
154 msg__->hostTag = (hostTag__); \
155 msg__->cfmRequested = (cfmRequested__);
156
157#define CsrWifiRouterMaPacketReqSendTo(dst__, src__, interfaceTag__, subscriptionHandle__, frameLength__, frame__, freeFunction__, priority__, hostTag__, cfmRequested__) \
158 { \
159 CsrWifiRouterMaPacketReq *msg__; \
160 CsrWifiRouterMaPacketReqCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, frameLength__, frame__, freeFunction__, priority__, hostTag__, cfmRequested__); \
161 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \
162 }
163
164#define CsrWifiRouterMaPacketReqSend(src__, interfaceTag__, subscriptionHandle__, frameLength__, frame__, freeFunction__, priority__, hostTag__, cfmRequested__) \
165 CsrWifiRouterMaPacketReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, subscriptionHandle__, frameLength__, frame__, freeFunction__, priority__, hostTag__, cfmRequested__)
166
167/*******************************************************************************
168
169 NAME
170 CsrWifiRouterMaPacketIndSend
171
172 DESCRIPTION
173 The router sends the primitive to a subscribed task when it receives a
174 frame matching the subscription.
175
176 PARAMETERS
177 queue - Destination Task Queue
178 interfaceTag - Interface Identifier; unique identifier of an interface
179 subscriptionHandle - The handle of the subscription
180 result - Status of the operation
181 frameLength - Length of the received frame in bytes
182 frame - Pointer to the received frame
183 freeFunction - Pointer to function to be used to free the frame
184 rssi - Received signal strength indication in dBm
185 snr - Signal to Noise Ratio
186 rate - Transmission/Reception rate
187
188*******************************************************************************/
189#define CsrWifiRouterMaPacketIndCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, result__, frameLength__, frame__, freeFunction__, rssi__, snr__, rate__) \
190 msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketInd), GFP_KERNEL); \
191 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_IND, dst__, src__); \
192 msg__->interfaceTag = (interfaceTag__); \
193 msg__->subscriptionHandle = (subscriptionHandle__); \
194 msg__->result = (result__); \
195 msg__->frameLength = (frameLength__); \
196 msg__->frame = (frame__); \
197 msg__->freeFunction = (freeFunction__); \
198 msg__->rssi = (rssi__); \
199 msg__->snr = (snr__); \
200 msg__->rate = (rate__);
201
202#define CsrWifiRouterMaPacketIndSendTo(dst__, src__, interfaceTag__, subscriptionHandle__, result__, frameLength__, frame__, freeFunction__, rssi__, snr__, rate__) \
203 { \
204 CsrWifiRouterMaPacketInd *msg__; \
205 CsrWifiRouterMaPacketIndCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, result__, frameLength__, frame__, freeFunction__, rssi__, snr__, rate__); \
206 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \
207 }
208
209#define CsrWifiRouterMaPacketIndSend(dst__, interfaceTag__, subscriptionHandle__, result__, frameLength__, frame__, freeFunction__, rssi__, snr__, rate__) \
210 CsrWifiRouterMaPacketIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, interfaceTag__, subscriptionHandle__, result__, frameLength__, frame__, freeFunction__, rssi__, snr__, rate__)
211
212/*******************************************************************************
213
214 NAME
215 CsrWifiRouterMaPacketResSend
216
217 DESCRIPTION
218 A task send this primitive to confirm the reception of the received
219 frame.
220
221 PARAMETERS
222 interfaceTag - Interface Identifier; unique identifier of an interface
223 subscriptionHandle - The handle of the subscription
224 result - Status of the operation
225
226*******************************************************************************/
227#define CsrWifiRouterMaPacketResCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, result__) \
228 msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketRes), GFP_KERNEL); \
229 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_RES, dst__, src__); \
230 msg__->interfaceTag = (interfaceTag__); \
231 msg__->subscriptionHandle = (subscriptionHandle__); \
232 msg__->result = (result__);
233
234#define CsrWifiRouterMaPacketResSendTo(dst__, src__, interfaceTag__, subscriptionHandle__, result__) \
235 { \
236 CsrWifiRouterMaPacketRes *msg__; \
237 CsrWifiRouterMaPacketResCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, result__); \
238 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \
239 }
240
241#define CsrWifiRouterMaPacketResSend(src__, interfaceTag__, subscriptionHandle__, result__) \
242 CsrWifiRouterMaPacketResSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, subscriptionHandle__, result__)
243
244/*******************************************************************************
245
246 NAME
247 CsrWifiRouterMaPacketCfmSend
248
249 DESCRIPTION
250 The router sends the primitive to confirm the result of the transmission
251 of the packet of the corresponding CSR_WIFI_ROUTER MA_PACKET_REQ request.
252
253 PARAMETERS
254 queue - Destination Task Queue
255 interfaceTag - Interface Identifier; unique identifier of an interface
256 result - Status of the operation
257 hostTag - The hostTrag will match the hostTag sent in the request.
258 rate - Transmission/Reception rate
259
260*******************************************************************************/
261#define CsrWifiRouterMaPacketCfmCreate(msg__, dst__, src__, interfaceTag__, result__, hostTag__, rate__) \
262 msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketCfm), GFP_KERNEL); \
263 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_CFM, dst__, src__); \
264 msg__->interfaceTag = (interfaceTag__); \
265 msg__->result = (result__); \
266 msg__->hostTag = (hostTag__); \
267 msg__->rate = (rate__);
268
269#define CsrWifiRouterMaPacketCfmSendTo(dst__, src__, interfaceTag__, result__, hostTag__, rate__) \
270 { \
271 CsrWifiRouterMaPacketCfm *msg__; \
272 CsrWifiRouterMaPacketCfmCreate(msg__, dst__, src__, interfaceTag__, result__, hostTag__, rate__); \
273 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \
274 }
275
276#define CsrWifiRouterMaPacketCfmSend(dst__, interfaceTag__, result__, hostTag__, rate__) \
277 CsrWifiRouterMaPacketCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, interfaceTag__, result__, hostTag__, rate__)
278
279/*******************************************************************************
280
281 NAME
282 CsrWifiRouterMaPacketSubscribeReqSend
283
284 DESCRIPTION
285 A task can use this primitive to subscribe for a particular OUI/protocol
286 and transmit and receive frames matching the subscription.
287 NOTE: Multiple subscriptions for a given protocol and OUI will result in
288 the first subscription receiving the data and not the subsequent
289 subscriptions.
290
291 PARAMETERS
292 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
293 interfaceTag - Interface Identifier; unique identifier of an interface
294 encapsulation - Specifies the encapsulation type, which will be used for the
295 subscription
296 protocol - Together with the OUI, specifies the protocol, which a task
297 wants to subscribe to
298 oui - Specifies the OUI for the protocol, which a task wants to
299 subscribe to
300
301*******************************************************************************/
302#define CsrWifiRouterMaPacketSubscribeReqCreate(msg__, dst__, src__, interfaceTag__, encapsulation__, protocol__, oui__) \
303 msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketSubscribeReq), GFP_KERNEL); \
304 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_REQ, dst__, src__); \
305 msg__->interfaceTag = (interfaceTag__); \
306 msg__->encapsulation = (encapsulation__); \
307 msg__->protocol = (protocol__); \
308 msg__->oui = (oui__);
309
310#define CsrWifiRouterMaPacketSubscribeReqSendTo(dst__, src__, interfaceTag__, encapsulation__, protocol__, oui__) \
311 { \
312 CsrWifiRouterMaPacketSubscribeReq *msg__; \
313 CsrWifiRouterMaPacketSubscribeReqCreate(msg__, dst__, src__, interfaceTag__, encapsulation__, protocol__, oui__); \
314 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \
315 }
316
317#define CsrWifiRouterMaPacketSubscribeReqSend(src__, interfaceTag__, encapsulation__, protocol__, oui__) \
318 CsrWifiRouterMaPacketSubscribeReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, encapsulation__, protocol__, oui__)
319
320/*******************************************************************************
321
322 NAME
323 CsrWifiRouterMaPacketSubscribeCfmSend
324
325 DESCRIPTION
326 The router sends this primitive to confirm the result of the
327 subscription.
328
329 PARAMETERS
330 queue - Destination Task Queue
331 interfaceTag - Interface Identifier; unique identifier of an interface
332 subscriptionHandle - Handle to the subscription
333 This handle must be used in all subsequent requests
334 status - Status of the operation
335 allocOffset - Size of the offset for the frames of the subscription
336
337*******************************************************************************/
338#define CsrWifiRouterMaPacketSubscribeCfmCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, status__, allocOffset__) \
339 msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketSubscribeCfm), GFP_KERNEL); \
340 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_CFM, dst__, src__); \
341 msg__->interfaceTag = (interfaceTag__); \
342 msg__->subscriptionHandle = (subscriptionHandle__); \
343 msg__->status = (status__); \
344 msg__->allocOffset = (allocOffset__);
345
346#define CsrWifiRouterMaPacketSubscribeCfmSendTo(dst__, src__, interfaceTag__, subscriptionHandle__, status__, allocOffset__) \
347 { \
348 CsrWifiRouterMaPacketSubscribeCfm *msg__; \
349 CsrWifiRouterMaPacketSubscribeCfmCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, status__, allocOffset__); \
350 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \
351 }
352
353#define CsrWifiRouterMaPacketSubscribeCfmSend(dst__, interfaceTag__, subscriptionHandle__, status__, allocOffset__) \
354 CsrWifiRouterMaPacketSubscribeCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, interfaceTag__, subscriptionHandle__, status__, allocOffset__)
355
356/*******************************************************************************
357
358 NAME
359 CsrWifiRouterMaPacketUnsubscribeReqSend
360
361 DESCRIPTION
362 A task sends this primitive to unsubscribe a subscription
363
364 PARAMETERS
365 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
366 interfaceTag - Interface Identifier; unique identifier of an interface
367 subscriptionHandle - The handle of the subscription
368
369*******************************************************************************/
370#define CsrWifiRouterMaPacketUnsubscribeReqCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__) \
371 msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketUnsubscribeReq), GFP_KERNEL); \
372 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_REQ, dst__, src__); \
373 msg__->interfaceTag = (interfaceTag__); \
374 msg__->subscriptionHandle = (subscriptionHandle__);
375
376#define CsrWifiRouterMaPacketUnsubscribeReqSendTo(dst__, src__, interfaceTag__, subscriptionHandle__) \
377 { \
378 CsrWifiRouterMaPacketUnsubscribeReq *msg__; \
379 CsrWifiRouterMaPacketUnsubscribeReqCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__); \
380 CsrMsgTransport(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \
381 }
382
383#define CsrWifiRouterMaPacketUnsubscribeReqSend(src__, interfaceTag__, subscriptionHandle__) \
384 CsrWifiRouterMaPacketUnsubscribeReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, subscriptionHandle__)
385
386/*******************************************************************************
387
388 NAME
389 CsrWifiRouterMaPacketUnsubscribeCfmSend
390
391 DESCRIPTION
392 The router sends this primitive to confirm the result of the
393 unsubscription.
394
395 PARAMETERS
396 queue - Destination Task Queue
397 interfaceTag - Interface Identifier; unique identifier of an interface
398 status - Status of the operation
399
400*******************************************************************************/
401#define CsrWifiRouterMaPacketUnsubscribeCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
402 msg__ = kmalloc(sizeof(CsrWifiRouterMaPacketUnsubscribeCfm), GFP_KERNEL); \
403 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_CFM, dst__, src__); \
404 msg__->interfaceTag = (interfaceTag__); \
405 msg__->status = (status__);
406
407#define CsrWifiRouterMaPacketUnsubscribeCfmSendTo(dst__, src__, interfaceTag__, status__) \
408 { \
409 CsrWifiRouterMaPacketUnsubscribeCfm *msg__; \
410 CsrWifiRouterMaPacketUnsubscribeCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
411 CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \
412 }
413
414#define CsrWifiRouterMaPacketUnsubscribeCfmSend(dst__, interfaceTag__, status__) \
415 CsrWifiRouterMaPacketUnsubscribeCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, interfaceTag__, status__)
416
417#endif /* CSR_WIFI_ROUTER_LIB_H__ */
diff --git a/drivers/staging/csr/csr_wifi_router_prim.h b/drivers/staging/csr/csr_wifi_router_prim.h
deleted file mode 100644
index c52344b51f2f..000000000000
--- a/drivers/staging/csr/csr_wifi_router_prim.h
+++ /dev/null
@@ -1,421 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_ROUTER_PRIM_H__
14#define CSR_WIFI_ROUTER_PRIM_H__
15
16#include <linux/types.h>
17#include "csr_prim_defs.h"
18#include "csr_sched.h"
19#include "csr_wifi_common.h"
20#include "csr_result.h"
21#include "csr_wifi_fsm_event.h"
22
23#define CSR_WIFI_ROUTER_PRIM (0x0400)
24
25typedef CsrPrim CsrWifiRouterPrim;
26
27typedef void (*CsrWifiRouterFrameFreeFunction)(void *frame);
28
29/*******************************************************************************
30
31 NAME
32 CsrWifiRouterAppType
33
34 DESCRIPTION
35
36 VALUES
37 CSR_WIFI_ROUTER_APP_TYPE_SME -
38 CSR_WIFI_ROUTER_APP_TYPE_PAL -
39 CSR_WIFI_ROUTER_APP_TYPE_NME -
40 CSR_WIFI_ROUTER_APP_TYPE_OTHER -
41
42*******************************************************************************/
43typedef u8 CsrWifiRouterAppType;
44#define CSR_WIFI_ROUTER_APP_TYPE_SME ((CsrWifiRouterAppType) 0x0)
45#define CSR_WIFI_ROUTER_APP_TYPE_PAL ((CsrWifiRouterAppType) 0x1)
46#define CSR_WIFI_ROUTER_APP_TYPE_NME ((CsrWifiRouterAppType) 0x2)
47#define CSR_WIFI_ROUTER_APP_TYPE_OTHER ((CsrWifiRouterAppType) 0x3)
48
49/*******************************************************************************
50
51 NAME
52 CsrWifiRouterEncapsulation
53
54 DESCRIPTION
55 Indicates the type of encapsulation used for the subscription
56
57 VALUES
58 CSR_WIFI_ROUTER_ENCAPSULATION_ETHERNET
59 - Ethernet encapsulation
60 CSR_WIFI_ROUTER_ENCAPSULATION_LLC_SNAP
61 - LLC/SNAP encapsulation
62
63*******************************************************************************/
64typedef u8 CsrWifiRouterEncapsulation;
65#define CSR_WIFI_ROUTER_ENCAPSULATION_ETHERNET ((CsrWifiRouterEncapsulation) 0x00)
66#define CSR_WIFI_ROUTER_ENCAPSULATION_LLC_SNAP ((CsrWifiRouterEncapsulation) 0x01)
67
68/*******************************************************************************
69
70 NAME
71 CsrWifiRouterOui
72
73 DESCRIPTION
74
75 VALUES
76 CSR_WIFI_ROUTER_OUI_RFC_1042 -
77 CSR_WIFI_ROUTER_OUI_BT -
78
79*******************************************************************************/
80typedef u32 CsrWifiRouterOui;
81#define CSR_WIFI_ROUTER_OUI_RFC_1042 ((CsrWifiRouterOui) 0x000000)
82#define CSR_WIFI_ROUTER_OUI_BT ((CsrWifiRouterOui) 0x001958)
83
84/*******************************************************************************
85
86 NAME
87 CsrWifiRouterPriority
88
89 DESCRIPTION
90 As defined in the IEEE 802.11 standards
91
92 VALUES
93 CSR_WIFI_ROUTER_PRIORITY_QOS_UP0
94 - See IEEE 802.11 Standard
95 CSR_WIFI_ROUTER_PRIORITY_QOS_UP1
96 - See IEEE 802.11 Standard
97 CSR_WIFI_ROUTER_PRIORITY_QOS_UP2
98 - See IEEE 802.11 Standard
99 CSR_WIFI_ROUTER_PRIORITY_QOS_UP3
100 - See IEEE 802.11 Standard
101 CSR_WIFI_ROUTER_PRIORITY_QOS_UP4
102 - See IEEE 802.11 Standard
103 CSR_WIFI_ROUTER_PRIORITY_QOS_UP5
104 - See IEEE 802.11 Standard
105 CSR_WIFI_ROUTER_PRIORITY_QOS_UP6
106 - See IEEE 802.11 Standard
107 CSR_WIFI_ROUTER_PRIORITY_QOS_UP7
108 - See IEEE 802.11 Standard
109 CSR_WIFI_ROUTER_PRIORITY_CONTENTION
110 - See IEEE 802.11 Standard
111 CSR_WIFI_ROUTER_PRIORITY_MANAGEMENT
112 - See IEEE 802.11 Standard
113
114*******************************************************************************/
115typedef u16 CsrWifiRouterPriority;
116#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP0 ((CsrWifiRouterPriority) 0x0000)
117#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP1 ((CsrWifiRouterPriority) 0x0001)
118#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP2 ((CsrWifiRouterPriority) 0x0002)
119#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP3 ((CsrWifiRouterPriority) 0x0003)
120#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP4 ((CsrWifiRouterPriority) 0x0004)
121#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP5 ((CsrWifiRouterPriority) 0x0005)
122#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP6 ((CsrWifiRouterPriority) 0x0006)
123#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP7 ((CsrWifiRouterPriority) 0x0007)
124#define CSR_WIFI_ROUTER_PRIORITY_CONTENTION ((CsrWifiRouterPriority) 0x8000)
125#define CSR_WIFI_ROUTER_PRIORITY_MANAGEMENT ((CsrWifiRouterPriority) 0x8010)
126
127
128/* Downstream */
129#define CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST (0x0000)
130
131#define CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_REQ ((CsrWifiRouterPrim) (0x0000 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST))
132#define CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_REQ ((CsrWifiRouterPrim) (0x0001 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST))
133#define CSR_WIFI_ROUTER_MA_PACKET_REQ ((CsrWifiRouterPrim) (0x0002 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST))
134#define CSR_WIFI_ROUTER_MA_PACKET_RES ((CsrWifiRouterPrim) (0x0003 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST))
135#define CSR_WIFI_ROUTER_MA_PACKET_CANCEL_REQ ((CsrWifiRouterPrim) (0x0004 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST))
136
137
138#define CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_HIGHEST (0x0004 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST)
139
140/* Upstream */
141#define CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM)
142
143#define CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_CFM ((CsrWifiRouterPrim)(0x0000 + CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST))
144#define CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_CFM ((CsrWifiRouterPrim)(0x0001 + CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST))
145#define CSR_WIFI_ROUTER_MA_PACKET_CFM ((CsrWifiRouterPrim)(0x0002 + CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST))
146#define CSR_WIFI_ROUTER_MA_PACKET_IND ((CsrWifiRouterPrim)(0x0003 + CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST))
147
148#define CSR_WIFI_ROUTER_PRIM_UPSTREAM_HIGHEST (0x0003 + CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST)
149
150#define CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT (CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_HIGHEST + 1 - CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST)
151#define CSR_WIFI_ROUTER_PRIM_UPSTREAM_COUNT (CSR_WIFI_ROUTER_PRIM_UPSTREAM_HIGHEST + 1 - CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST)
152
153/*******************************************************************************
154
155 NAME
156 CsrWifiRouterMaPacketSubscribeReq
157
158 DESCRIPTION
159 A task can use this primitive to subscribe for a particular OUI/protocol
160 and transmit and receive frames matching the subscription.
161 NOTE: Multiple subscriptions for a given protocol and OUI will result in
162 the first subscription receiving the data and not the subsequent
163 subscriptions.
164
165 MEMBERS
166 common - Common header for use with the CsrWifiFsm Module
167 interfaceTag - Interface Identifier; unique identifier of an interface
168 encapsulation - Specifies the encapsulation type, which will be used for the
169 subscription
170 protocol - Together with the OUI, specifies the protocol, which a task
171 wants to subscribe to
172 oui - Specifies the OUI for the protocol, which a task wants to
173 subscribe to
174
175*******************************************************************************/
176typedef struct
177{
178 CsrWifiFsmEvent common;
179 u16 interfaceTag;
180 CsrWifiRouterEncapsulation encapsulation;
181 u16 protocol;
182 u32 oui;
183} CsrWifiRouterMaPacketSubscribeReq;
184
185/*******************************************************************************
186
187 NAME
188 CsrWifiRouterMaPacketUnsubscribeReq
189
190 DESCRIPTION
191 A task sends this primitive to unsubscribe a subscription
192
193 MEMBERS
194 common - Common header for use with the CsrWifiFsm Module
195 interfaceTag - Interface Identifier; unique identifier of an interface
196 subscriptionHandle - The handle of the subscription
197
198*******************************************************************************/
199typedef struct
200{
201 CsrWifiFsmEvent common;
202 u16 interfaceTag;
203 u8 subscriptionHandle;
204} CsrWifiRouterMaPacketUnsubscribeReq;
205
206/*******************************************************************************
207
208 NAME
209 CsrWifiRouterMaPacketReq
210
211 DESCRIPTION
212 A task sends this primitive to transmit a frame.
213
214 MEMBERS
215 common - Common header for use with the CsrWifiFsm Module
216 interfaceTag - Interface Identifier; unique identifier of an interface
217 subscriptionHandle - The handle of the subscription
218 frameLength - Length of the frame to be sent in bytes
219 frame - Pointer to the frame to be sent
220 freeFunction - Pointer to function to be used to free the frame
221 priority - Priority of the frame, which should be sent
222 hostTag - An application shall set the bits b31..b28 using one of
223 the CSR_WIFI_ROUTER_APP_TYPE_* masks. Bits b0..b27 can
224 be used by the requestor without any restrictions, but
225 the hostTag shall be unique so the hostTag for
226 CSR_WIFI_ROUTER_APP _TYPE_OTHER should be constructured
227 in the following way [ CSR_WIFI_ROUTER_APP_TYPE_OTHER
228 (4 bits) | SubscriptionHandle (8 bits) | Sequence no.
229 (20 bits) ]. If the hostTag is not unique, the
230 behaviour of the system is unpredicatable with respect
231 to data/management frame transfer.
232 cfmRequested - Indicates if the requestor needs a confirm for packet
233 requests sent under this subscription. If set to TRUE,
234 the router will send a confirm, else it will not send
235 any confirm
236
237*******************************************************************************/
238typedef struct
239{
240 CsrWifiFsmEvent common;
241 u16 interfaceTag;
242 u8 subscriptionHandle;
243 u16 frameLength;
244 u8 *frame;
245 CsrWifiRouterFrameFreeFunction freeFunction;
246 CsrWifiRouterPriority priority;
247 u32 hostTag;
248 u8 cfmRequested;
249} CsrWifiRouterMaPacketReq;
250
251/*******************************************************************************
252
253 NAME
254 CsrWifiRouterMaPacketRes
255
256 DESCRIPTION
257 A task send this primitive to confirm the reception of the received
258 frame.
259
260 MEMBERS
261 common - Common header for use with the CsrWifiFsm Module
262 interfaceTag - Interface Identifier; unique identifier of an interface
263 subscriptionHandle - The handle of the subscription
264 result - Status of the operation
265
266*******************************************************************************/
267typedef struct
268{
269 CsrWifiFsmEvent common;
270 u16 interfaceTag;
271 u8 subscriptionHandle;
272 CsrResult result;
273} CsrWifiRouterMaPacketRes;
274
275/*******************************************************************************
276
277 NAME
278 CsrWifiRouterMaPacketCancelReq
279
280 DESCRIPTION
281 This primitive is used to request cancellation of a previously send
282 CsrWifiRouterMaPacketReq.
283 The frame may already have been transmitted so there is no guarantees
284 that the CsrWifiRouterMaPacketCancelReq actually cancels the transmission
285 of the frame in question.
286 If the cancellation fails, the Router will send, if required,
287 CsrWifiRouterMaPacketCfm.
288 If the cancellation succeeds, the Router will not send
289 CsrWifiRouterMaPacketCfm.
290
291 MEMBERS
292 common - Common header for use with the CsrWifiFsm Module
293 interfaceTag - Interface Identifier; unique identifier of an interface
294 hostTag - The hostTag for the frame, which should be cancelled.
295 priority - Priority of the frame, which should be cancelled
296 peerMacAddress - Destination MAC address of the frame, which should be
297 cancelled
298
299*******************************************************************************/
300typedef struct
301{
302 CsrWifiFsmEvent common;
303 u16 interfaceTag;
304 u32 hostTag;
305 CsrWifiRouterPriority priority;
306 CsrWifiMacAddress peerMacAddress;
307} CsrWifiRouterMaPacketCancelReq;
308
309/*******************************************************************************
310
311 NAME
312 CsrWifiRouterMaPacketSubscribeCfm
313
314 DESCRIPTION
315 The router sends this primitive to confirm the result of the
316 subscription.
317
318 MEMBERS
319 common - Common header for use with the CsrWifiFsm Module
320 interfaceTag - Interface Identifier; unique identifier of an interface
321 subscriptionHandle - Handle to the subscription
322 This handle must be used in all subsequent requests
323 status - Status of the operation
324 allocOffset - Size of the offset for the frames of the subscription
325
326*******************************************************************************/
327typedef struct
328{
329 CsrWifiFsmEvent common;
330 u16 interfaceTag;
331 u8 subscriptionHandle;
332 CsrResult status;
333 u16 allocOffset;
334} CsrWifiRouterMaPacketSubscribeCfm;
335
336/*******************************************************************************
337
338 NAME
339 CsrWifiRouterMaPacketUnsubscribeCfm
340
341 DESCRIPTION
342 The router sends this primitive to confirm the result of the
343 unsubscription.
344
345 MEMBERS
346 common - Common header for use with the CsrWifiFsm Module
347 interfaceTag - Interface Identifier; unique identifier of an interface
348 status - Status of the operation
349
350*******************************************************************************/
351typedef struct
352{
353 CsrWifiFsmEvent common;
354 u16 interfaceTag;
355 CsrResult status;
356} CsrWifiRouterMaPacketUnsubscribeCfm;
357
358/*******************************************************************************
359
360 NAME
361 CsrWifiRouterMaPacketCfm
362
363 DESCRIPTION
364 The router sends the primitive to confirm the result of the transmission
365 of the packet of the corresponding CSR_WIFI_ROUTER MA_PACKET_REQ request.
366
367 MEMBERS
368 common - Common header for use with the CsrWifiFsm Module
369 interfaceTag - Interface Identifier; unique identifier of an interface
370 result - Status of the operation
371 hostTag - The hostTrag will match the hostTag sent in the request.
372 rate - Transmission/Reception rate
373
374*******************************************************************************/
375typedef struct
376{
377 CsrWifiFsmEvent common;
378 u16 interfaceTag;
379 CsrResult result;
380 u32 hostTag;
381 u16 rate;
382} CsrWifiRouterMaPacketCfm;
383
384/*******************************************************************************
385
386 NAME
387 CsrWifiRouterMaPacketInd
388
389 DESCRIPTION
390 The router sends the primitive to a subscribed task when it receives a
391 frame matching the subscription.
392
393 MEMBERS
394 common - Common header for use with the CsrWifiFsm Module
395 interfaceTag - Interface Identifier; unique identifier of an interface
396 subscriptionHandle - The handle of the subscription
397 result - Status of the operation
398 frameLength - Length of the received frame in bytes
399 frame - Pointer to the received frame
400 freeFunction - Pointer to function to be used to free the frame
401 rssi - Received signal strength indication in dBm
402 snr - Signal to Noise Ratio
403 rate - Transmission/Reception rate
404
405*******************************************************************************/
406typedef struct
407{
408 CsrWifiFsmEvent common;
409 u16 interfaceTag;
410 u8 subscriptionHandle;
411 CsrResult result;
412 u16 frameLength;
413 u8 *frame;
414 CsrWifiRouterFrameFreeFunction freeFunction;
415 s16 rssi;
416 s16 snr;
417 u16 rate;
418} CsrWifiRouterMaPacketInd;
419
420#endif /* CSR_WIFI_ROUTER_PRIM_H__ */
421
diff --git a/drivers/staging/csr/csr_wifi_router_sef.c b/drivers/staging/csr/csr_wifi_router_sef.c
deleted file mode 100644
index 45a10fb77296..000000000000
--- a/drivers/staging/csr/csr_wifi_router_sef.c
+++ /dev/null
@@ -1,19 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2010
4 Confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9 *****************************************************************************/
10#include "csr_wifi_router_sef.h"
11
12const CsrWifiRouterStateHandlerType CsrWifiRouterDownstreamStateHandlers[CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT] =
13{
14 /* 0x0000 */ CsrWifiRouterMaPacketSubscribeReqHandler,
15 /* 0x0001 */ CsrWifiRouterMaPacketUnsubscribeReqHandler,
16 /* 0x0002 */ CsrWifiRouterMaPacketReqHandler,
17 /* 0x0003 */ CsrWifiRouterMaPacketResHandler,
18 /* 0x0004 */ CsrWifiRouterMaPacketCancelReqHandler,
19};
diff --git a/drivers/staging/csr/csr_wifi_router_sef.h b/drivers/staging/csr/csr_wifi_router_sef.h
deleted file mode 100644
index 86692c7780c9..000000000000
--- a/drivers/staging/csr/csr_wifi_router_sef.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2010
4 Confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9 *****************************************************************************/
10#ifndef CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_H__
11#define CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_H__
12
13#include "csr_wifi_router_prim.h"
14
15 typedef void (*CsrWifiRouterStateHandlerType)(void* drvpriv, CsrWifiFsmEvent* msg);
16
17 extern const CsrWifiRouterStateHandlerType CsrWifiRouterDownstreamStateHandlers[CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT];
18
19 extern void CsrWifiRouterMaPacketSubscribeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
20 extern void CsrWifiRouterMaPacketUnsubscribeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
21 extern void CsrWifiRouterMaPacketReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
22 extern void CsrWifiRouterMaPacketResHandler(void* drvpriv, CsrWifiFsmEvent* msg);
23 extern void CsrWifiRouterMaPacketCancelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
24
25#endif /* CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_H__ */
diff --git a/drivers/staging/csr/csr_wifi_router_serialize.c b/drivers/staging/csr/csr_wifi_router_serialize.c
deleted file mode 100644
index 4eccf5d6c289..000000000000
--- a/drivers/staging/csr/csr_wifi_router_serialize.c
+++ /dev/null
@@ -1,418 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12#include <linux/slab.h>
13#include "csr_msgconv.h"
14#include "csr_wifi_router_prim.h"
15#include "csr_wifi_router_serialize.h"
16
17void CsrWifiRouterPfree(void *ptr)
18{
19 kfree(ptr);
20}
21
22
23size_t CsrWifiRouterMaPacketSubscribeReqSizeof(void *msg)
24{
25 size_t bufferSize = 2;
26
27 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */
28 bufferSize += 2; /* u16 primitive->interfaceTag */
29 bufferSize += 1; /* CsrWifiRouterEncapsulation primitive->encapsulation */
30 bufferSize += 2; /* u16 primitive->protocol */
31 bufferSize += 4; /* u32 primitive->oui */
32 return bufferSize;
33}
34
35
36u8* CsrWifiRouterMaPacketSubscribeReqSer(u8 *ptr, size_t *len, void *msg)
37{
38 CsrWifiRouterMaPacketSubscribeReq *primitive = (CsrWifiRouterMaPacketSubscribeReq *)msg;
39 *len = 0;
40 CsrUint16Ser(ptr, len, primitive->common.type);
41 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
42 CsrUint8Ser(ptr, len, (u8) primitive->encapsulation);
43 CsrUint16Ser(ptr, len, (u16) primitive->protocol);
44 CsrUint32Ser(ptr, len, (u32) primitive->oui);
45 return(ptr);
46}
47
48
49void* CsrWifiRouterMaPacketSubscribeReqDes(u8 *buffer, size_t length)
50{
51 CsrWifiRouterMaPacketSubscribeReq *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketSubscribeReq), GFP_KERNEL);
52 size_t offset;
53 offset = 0;
54
55 CsrUint16Des(&primitive->common.type, buffer, &offset);
56 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
57 CsrUint8Des((u8 *) &primitive->encapsulation, buffer, &offset);
58 CsrUint16Des((u16 *) &primitive->protocol, buffer, &offset);
59 CsrUint32Des((u32 *) &primitive->oui, buffer, &offset);
60
61 return primitive;
62}
63
64
65size_t CsrWifiRouterMaPacketReqSizeof(void *msg)
66{
67 CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *) msg;
68 size_t bufferSize = 2;
69
70 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 20) */
71 bufferSize += 2; /* u16 primitive->interfaceTag */
72 bufferSize += 1; /* u8 primitive->subscriptionHandle */
73 bufferSize += 2; /* u16 primitive->frameLength */
74 bufferSize += primitive->frameLength; /* u8 primitive->frame */
75 bufferSize += 4; /* CsrWifiRouterFrameFreeFunction primitive->freeFunction */
76 bufferSize += 2; /* CsrWifiRouterPriority primitive->priority */
77 bufferSize += 4; /* u32 primitive->hostTag */
78 bufferSize += 1; /* u8 primitive->cfmRequested */
79 return bufferSize;
80}
81
82
83u8* CsrWifiRouterMaPacketReqSer(u8 *ptr, size_t *len, void *msg)
84{
85 CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *)msg;
86 *len = 0;
87 CsrUint16Ser(ptr, len, primitive->common.type);
88 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
89 CsrUint8Ser(ptr, len, (u8) primitive->subscriptionHandle);
90 CsrUint16Ser(ptr, len, (u16) primitive->frameLength);
91 if (primitive->frameLength)
92 {
93 CsrMemCpySer(ptr, len, (const void *) primitive->frame, ((u16) (primitive->frameLength)));
94 }
95 CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->freeFunction */
96 CsrUint16Ser(ptr, len, (u16) primitive->priority);
97 CsrUint32Ser(ptr, len, (u32) primitive->hostTag);
98 CsrUint8Ser(ptr, len, (u8) primitive->cfmRequested);
99 return(ptr);
100}
101
102
103void* CsrWifiRouterMaPacketReqDes(u8 *buffer, size_t length)
104{
105 CsrWifiRouterMaPacketReq *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketReq), GFP_KERNEL);
106 size_t offset;
107 offset = 0;
108
109 CsrUint16Des(&primitive->common.type, buffer, &offset);
110 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
111 CsrUint8Des((u8 *) &primitive->subscriptionHandle, buffer, &offset);
112 CsrUint16Des((u16 *) &primitive->frameLength, buffer, &offset);
113 if (primitive->frameLength)
114 {
115 primitive->frame = kmalloc(primitive->frameLength, GFP_KERNEL);
116 CsrMemCpyDes(primitive->frame, buffer, &offset, ((u16) (primitive->frameLength)));
117 }
118 else
119 {
120 primitive->frame = NULL;
121 }
122 primitive->freeFunction = NULL; /* Special for Function Pointers... */
123 offset += 4;
124 CsrUint16Des((u16 *) &primitive->priority, buffer, &offset);
125 CsrUint32Des((u32 *) &primitive->hostTag, buffer, &offset);
126 CsrUint8Des((u8 *) &primitive->cfmRequested, buffer, &offset);
127
128 return primitive;
129}
130
131
132void CsrWifiRouterMaPacketReqSerFree(void *voidPrimitivePointer)
133{
134 CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *) voidPrimitivePointer;
135 kfree(primitive->frame);
136 kfree(primitive);
137}
138
139
140size_t CsrWifiRouterMaPacketResSizeof(void *msg)
141{
142 size_t bufferSize = 2;
143
144 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */
145 bufferSize += 2; /* u16 primitive->interfaceTag */
146 bufferSize += 1; /* u8 primitive->subscriptionHandle */
147 bufferSize += 2; /* CsrResult primitive->result */
148 return bufferSize;
149}
150
151
152u8* CsrWifiRouterMaPacketResSer(u8 *ptr, size_t *len, void *msg)
153{
154 CsrWifiRouterMaPacketRes *primitive = (CsrWifiRouterMaPacketRes *)msg;
155 *len = 0;
156 CsrUint16Ser(ptr, len, primitive->common.type);
157 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
158 CsrUint8Ser(ptr, len, (u8) primitive->subscriptionHandle);
159 CsrUint16Ser(ptr, len, (u16) primitive->result);
160 return(ptr);
161}
162
163
164void* CsrWifiRouterMaPacketResDes(u8 *buffer, size_t length)
165{
166 CsrWifiRouterMaPacketRes *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketRes), GFP_KERNEL);
167 size_t offset;
168 offset = 0;
169
170 CsrUint16Des(&primitive->common.type, buffer, &offset);
171 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
172 CsrUint8Des((u8 *) &primitive->subscriptionHandle, buffer, &offset);
173 CsrUint16Des((u16 *) &primitive->result, buffer, &offset);
174
175 return primitive;
176}
177
178
179size_t CsrWifiRouterMaPacketCancelReqSizeof(void *msg)
180{
181 size_t bufferSize = 2;
182
183 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */
184 bufferSize += 2; /* u16 primitive->interfaceTag */
185 bufferSize += 4; /* u32 primitive->hostTag */
186 bufferSize += 2; /* CsrWifiRouterPriority primitive->priority */
187 bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */
188 return bufferSize;
189}
190
191
192u8* CsrWifiRouterMaPacketCancelReqSer(u8 *ptr, size_t *len, void *msg)
193{
194 CsrWifiRouterMaPacketCancelReq *primitive = (CsrWifiRouterMaPacketCancelReq *)msg;
195 *len = 0;
196 CsrUint16Ser(ptr, len, primitive->common.type);
197 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
198 CsrUint32Ser(ptr, len, (u32) primitive->hostTag);
199 CsrUint16Ser(ptr, len, (u16) primitive->priority);
200 CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6)));
201 return(ptr);
202}
203
204
205void* CsrWifiRouterMaPacketCancelReqDes(u8 *buffer, size_t length)
206{
207 CsrWifiRouterMaPacketCancelReq *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketCancelReq), GFP_KERNEL);
208 size_t offset;
209 offset = 0;
210
211 CsrUint16Des(&primitive->common.type, buffer, &offset);
212 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
213 CsrUint32Des((u32 *) &primitive->hostTag, buffer, &offset);
214 CsrUint16Des((u16 *) &primitive->priority, buffer, &offset);
215 CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6)));
216
217 return primitive;
218}
219
220
221size_t CsrWifiRouterMaPacketSubscribeCfmSizeof(void *msg)
222{
223 size_t bufferSize = 2;
224
225 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */
226 bufferSize += 2; /* u16 primitive->interfaceTag */
227 bufferSize += 1; /* u8 primitive->subscriptionHandle */
228 bufferSize += 2; /* CsrResult primitive->status */
229 bufferSize += 2; /* u16 primitive->allocOffset */
230 return bufferSize;
231}
232
233
234u8* CsrWifiRouterMaPacketSubscribeCfmSer(u8 *ptr, size_t *len, void *msg)
235{
236 CsrWifiRouterMaPacketSubscribeCfm *primitive = (CsrWifiRouterMaPacketSubscribeCfm *)msg;
237 *len = 0;
238 CsrUint16Ser(ptr, len, primitive->common.type);
239 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
240 CsrUint8Ser(ptr, len, (u8) primitive->subscriptionHandle);
241 CsrUint16Ser(ptr, len, (u16) primitive->status);
242 CsrUint16Ser(ptr, len, (u16) primitive->allocOffset);
243 return(ptr);
244}
245
246
247void* CsrWifiRouterMaPacketSubscribeCfmDes(u8 *buffer, size_t length)
248{
249 CsrWifiRouterMaPacketSubscribeCfm *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketSubscribeCfm), GFP_KERNEL);
250 size_t offset;
251 offset = 0;
252
253 CsrUint16Des(&primitive->common.type, buffer, &offset);
254 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
255 CsrUint8Des((u8 *) &primitive->subscriptionHandle, buffer, &offset);
256 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
257 CsrUint16Des((u16 *) &primitive->allocOffset, buffer, &offset);
258
259 return primitive;
260}
261
262
263size_t CsrWifiRouterMaPacketUnsubscribeCfmSizeof(void *msg)
264{
265 size_t bufferSize = 2;
266
267 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */
268 bufferSize += 2; /* u16 primitive->interfaceTag */
269 bufferSize += 2; /* CsrResult primitive->status */
270 return bufferSize;
271}
272
273
274u8* CsrWifiRouterMaPacketUnsubscribeCfmSer(u8 *ptr, size_t *len, void *msg)
275{
276 CsrWifiRouterMaPacketUnsubscribeCfm *primitive = (CsrWifiRouterMaPacketUnsubscribeCfm *)msg;
277 *len = 0;
278 CsrUint16Ser(ptr, len, primitive->common.type);
279 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
280 CsrUint16Ser(ptr, len, (u16) primitive->status);
281 return(ptr);
282}
283
284
285void* CsrWifiRouterMaPacketUnsubscribeCfmDes(u8 *buffer, size_t length)
286{
287 CsrWifiRouterMaPacketUnsubscribeCfm *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketUnsubscribeCfm), GFP_KERNEL);
288 size_t offset;
289 offset = 0;
290
291 CsrUint16Des(&primitive->common.type, buffer, &offset);
292 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
293 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
294
295 return primitive;
296}
297
298
299size_t CsrWifiRouterMaPacketCfmSizeof(void *msg)
300{
301 size_t bufferSize = 2;
302
303 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */
304 bufferSize += 2; /* u16 primitive->interfaceTag */
305 bufferSize += 2; /* CsrResult primitive->result */
306 bufferSize += 4; /* u32 primitive->hostTag */
307 bufferSize += 2; /* u16 primitive->rate */
308 return bufferSize;
309}
310
311
312u8* CsrWifiRouterMaPacketCfmSer(u8 *ptr, size_t *len, void *msg)
313{
314 CsrWifiRouterMaPacketCfm *primitive = (CsrWifiRouterMaPacketCfm *)msg;
315 *len = 0;
316 CsrUint16Ser(ptr, len, primitive->common.type);
317 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
318 CsrUint16Ser(ptr, len, (u16) primitive->result);
319 CsrUint32Ser(ptr, len, (u32) primitive->hostTag);
320 CsrUint16Ser(ptr, len, (u16) primitive->rate);
321 return(ptr);
322}
323
324
325void* CsrWifiRouterMaPacketCfmDes(u8 *buffer, size_t length)
326{
327 CsrWifiRouterMaPacketCfm *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketCfm), GFP_KERNEL);
328 size_t offset;
329 offset = 0;
330
331 CsrUint16Des(&primitive->common.type, buffer, &offset);
332 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
333 CsrUint16Des((u16 *) &primitive->result, buffer, &offset);
334 CsrUint32Des((u32 *) &primitive->hostTag, buffer, &offset);
335 CsrUint16Des((u16 *) &primitive->rate, buffer, &offset);
336
337 return primitive;
338}
339
340
341size_t CsrWifiRouterMaPacketIndSizeof(void *msg)
342{
343 CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *) msg;
344 size_t bufferSize = 2;
345
346 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 21) */
347 bufferSize += 2; /* u16 primitive->interfaceTag */
348 bufferSize += 1; /* u8 primitive->subscriptionHandle */
349 bufferSize += 2; /* CsrResult primitive->result */
350 bufferSize += 2; /* u16 primitive->frameLength */
351 bufferSize += primitive->frameLength; /* u8 primitive->frame */
352 bufferSize += 4; /* CsrWifiRouterFrameFreeFunction primitive->freeFunction */
353 bufferSize += 2; /* s16 primitive->rssi */
354 bufferSize += 2; /* s16 primitive->snr */
355 bufferSize += 2; /* u16 primitive->rate */
356 return bufferSize;
357}
358
359
360u8* CsrWifiRouterMaPacketIndSer(u8 *ptr, size_t *len, void *msg)
361{
362 CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *)msg;
363 *len = 0;
364 CsrUint16Ser(ptr, len, primitive->common.type);
365 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
366 CsrUint8Ser(ptr, len, (u8) primitive->subscriptionHandle);
367 CsrUint16Ser(ptr, len, (u16) primitive->result);
368 CsrUint16Ser(ptr, len, (u16) primitive->frameLength);
369 if (primitive->frameLength)
370 {
371 CsrMemCpySer(ptr, len, (const void *) primitive->frame, ((u16) (primitive->frameLength)));
372 }
373 CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->freeFunction */
374 CsrUint16Ser(ptr, len, (u16) primitive->rssi);
375 CsrUint16Ser(ptr, len, (u16) primitive->snr);
376 CsrUint16Ser(ptr, len, (u16) primitive->rate);
377 return(ptr);
378}
379
380
381void* CsrWifiRouterMaPacketIndDes(u8 *buffer, size_t length)
382{
383 CsrWifiRouterMaPacketInd *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketInd), GFP_KERNEL);
384 size_t offset;
385 offset = 0;
386
387 CsrUint16Des(&primitive->common.type, buffer, &offset);
388 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
389 CsrUint8Des((u8 *) &primitive->subscriptionHandle, buffer, &offset);
390 CsrUint16Des((u16 *) &primitive->result, buffer, &offset);
391 CsrUint16Des((u16 *) &primitive->frameLength, buffer, &offset);
392 if (primitive->frameLength)
393 {
394 primitive->frame = kmalloc(primitive->frameLength, GFP_KERNEL);
395 CsrMemCpyDes(primitive->frame, buffer, &offset, ((u16) (primitive->frameLength)));
396 }
397 else
398 {
399 primitive->frame = NULL;
400 }
401 primitive->freeFunction = NULL; /* Special for Function Pointers... */
402 offset += 4;
403 CsrUint16Des((u16 *) &primitive->rssi, buffer, &offset);
404 CsrUint16Des((u16 *) &primitive->snr, buffer, &offset);
405 CsrUint16Des((u16 *) &primitive->rate, buffer, &offset);
406
407 return primitive;
408}
409
410
411void CsrWifiRouterMaPacketIndSerFree(void *voidPrimitivePointer)
412{
413 CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *) voidPrimitivePointer;
414 kfree(primitive->frame);
415 kfree(primitive);
416}
417
418
diff --git a/drivers/staging/csr/csr_wifi_router_serialize.h b/drivers/staging/csr/csr_wifi_router_serialize.h
deleted file mode 100644
index 94ccdac5606f..000000000000
--- a/drivers/staging/csr/csr_wifi_router_serialize.h
+++ /dev/null
@@ -1,67 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_ROUTER_SERIALIZE_H__
14#define CSR_WIFI_ROUTER_SERIALIZE_H__
15
16#include "csr_wifi_msgconv.h"
17#include "csr_wifi_router_prim.h"
18
19extern void CsrWifiRouterPfree(void *ptr);
20
21extern u8* CsrWifiRouterMaPacketSubscribeReqSer(u8 *ptr, size_t *len, void *msg);
22extern void* CsrWifiRouterMaPacketSubscribeReqDes(u8 *buffer, size_t len);
23extern size_t CsrWifiRouterMaPacketSubscribeReqSizeof(void *msg);
24#define CsrWifiRouterMaPacketSubscribeReqSerFree CsrWifiRouterPfree
25
26#define CsrWifiRouterMaPacketUnsubscribeReqSer CsrWifiEventCsrUint16CsrUint8Ser
27#define CsrWifiRouterMaPacketUnsubscribeReqDes CsrWifiEventCsrUint16CsrUint8Des
28#define CsrWifiRouterMaPacketUnsubscribeReqSizeof CsrWifiEventCsrUint16CsrUint8Sizeof
29#define CsrWifiRouterMaPacketUnsubscribeReqSerFree CsrWifiRouterPfree
30
31extern u8* CsrWifiRouterMaPacketReqSer(u8 *ptr, size_t *len, void *msg);
32extern void* CsrWifiRouterMaPacketReqDes(u8 *buffer, size_t len);
33extern size_t CsrWifiRouterMaPacketReqSizeof(void *msg);
34extern void CsrWifiRouterMaPacketReqSerFree(void *msg);
35
36extern u8* CsrWifiRouterMaPacketResSer(u8 *ptr, size_t *len, void *msg);
37extern void* CsrWifiRouterMaPacketResDes(u8 *buffer, size_t len);
38extern size_t CsrWifiRouterMaPacketResSizeof(void *msg);
39#define CsrWifiRouterMaPacketResSerFree CsrWifiRouterPfree
40
41extern u8* CsrWifiRouterMaPacketCancelReqSer(u8 *ptr, size_t *len, void *msg);
42extern void* CsrWifiRouterMaPacketCancelReqDes(u8 *buffer, size_t len);
43extern size_t CsrWifiRouterMaPacketCancelReqSizeof(void *msg);
44#define CsrWifiRouterMaPacketCancelReqSerFree CsrWifiRouterPfree
45
46extern u8* CsrWifiRouterMaPacketSubscribeCfmSer(u8 *ptr, size_t *len, void *msg);
47extern void* CsrWifiRouterMaPacketSubscribeCfmDes(u8 *buffer, size_t len);
48extern size_t CsrWifiRouterMaPacketSubscribeCfmSizeof(void *msg);
49#define CsrWifiRouterMaPacketSubscribeCfmSerFree CsrWifiRouterPfree
50
51extern u8* CsrWifiRouterMaPacketUnsubscribeCfmSer(u8 *ptr, size_t *len, void *msg);
52extern void* CsrWifiRouterMaPacketUnsubscribeCfmDes(u8 *buffer, size_t len);
53extern size_t CsrWifiRouterMaPacketUnsubscribeCfmSizeof(void *msg);
54#define CsrWifiRouterMaPacketUnsubscribeCfmSerFree CsrWifiRouterPfree
55
56extern u8* CsrWifiRouterMaPacketCfmSer(u8 *ptr, size_t *len, void *msg);
57extern void* CsrWifiRouterMaPacketCfmDes(u8 *buffer, size_t len);
58extern size_t CsrWifiRouterMaPacketCfmSizeof(void *msg);
59#define CsrWifiRouterMaPacketCfmSerFree CsrWifiRouterPfree
60
61extern u8* CsrWifiRouterMaPacketIndSer(u8 *ptr, size_t *len, void *msg);
62extern void* CsrWifiRouterMaPacketIndDes(u8 *buffer, size_t len);
63extern size_t CsrWifiRouterMaPacketIndSizeof(void *msg);
64extern void CsrWifiRouterMaPacketIndSerFree(void *msg);
65
66#endif /* CSR_WIFI_ROUTER_SERIALIZE_H__ */
67
diff --git a/drivers/staging/csr/csr_wifi_router_task.h b/drivers/staging/csr/csr_wifi_router_task.h
deleted file mode 100644
index 9ba892f34e6d..000000000000
--- a/drivers/staging/csr/csr_wifi_router_task.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_ROUTER_TASK_H__
14#define CSR_WIFI_ROUTER_TASK_H__
15
16#include "csr_sched.h"
17
18#define CSR_WIFI_ROUTER_LOG_ID 0x1201FFFF
19extern CsrSchedQid CSR_WIFI_ROUTER_IFACEQUEUE;
20void CsrWifiRouterInit(void **gash);
21void CsrWifiRouterDeinit(void **gash);
22void CsrWifiRouterHandler(void **gash);
23
24#endif /* CSR_WIFI_ROUTER_TASK_H__ */
25
diff --git a/drivers/staging/csr/csr_wifi_router_transport.c b/drivers/staging/csr/csr_wifi_router_transport.c
deleted file mode 100644
index e905ead9389b..000000000000
--- a/drivers/staging/csr/csr_wifi_router_transport.c
+++ /dev/null
@@ -1,199 +0,0 @@
1/** @file router_transport.c
2 *
3 *
4 * Copyright (C) Cambridge Silicon Radio Ltd 2006-2010. All rights reserved.
5 *
6 * Refer to LICENSE.txt included with this source code for details on
7 * the license terms.
8 *
9 ****************************************************************************/
10
11#include "unifi_priv.h"
12
13#include "csr_sched.h"
14#include "csr_msgconv.h"
15
16#include "sme_userspace.h"
17
18#include "csr_wifi_hostio_prim.h"
19#include "csr_wifi_router_lib.h"
20#include "csr_wifi_router_sef.h"
21#include "csr_wifi_router_converter_init.h"
22#include "csr_wifi_router_ctrl_lib.h"
23#include "csr_wifi_router_ctrl_sef.h"
24#include "csr_wifi_router_ctrl_converter_init.h"
25#include "csr_wifi_sme_prim.h"
26#include "csr_wifi_sme_sef.h"
27#include "csr_wifi_sme_converter_init.h"
28#ifdef CSR_SUPPORT_WEXT
29#ifdef CSR_SUPPORT_WEXT_AP
30#include "csr_wifi_nme_ap_prim.h"
31#include "csr_wifi_nme_ap_sef.h"
32#include "csr_wifi_nme_ap_converter_init.h"
33#endif
34#endif
35
36static unifi_priv_t *drvpriv = NULL;
37void CsrWifiRouterTransportInit(unifi_priv_t *priv)
38{
39 unifi_trace(priv, UDBG1, "CsrWifiRouterTransportInit: \n");
40
41 drvpriv = priv;
42 (void)CsrMsgConvInit();
43 CsrWifiRouterConverterInit();
44 CsrWifiRouterCtrlConverterInit();
45 CsrWifiSmeConverterInit();
46#ifdef CSR_SUPPORT_WEXT
47#ifdef CSR_SUPPORT_WEXT_AP
48 CsrWifiNmeApConverterInit();
49#endif
50#endif
51}
52
53void CsrWifiRouterTransportRecv(unifi_priv_t *priv, u8* buffer, size_t bufferLength)
54{
55 CsrMsgConvMsgEntry* msgEntry;
56 u16 primType;
57 CsrSchedQid src;
58 CsrSchedQid dest;
59 u16 msgType;
60 size_t offset = 0;
61 CsrWifiFsmEvent* msg;
62
63 /* Decode the prim and message type */
64 CsrUint16Des(&primType, buffer, &offset);
65 CsrUint16Des(&src, buffer, &offset);
66 CsrUint16Des(&dest, buffer, &offset);
67 CsrUint16Des(&msgType, buffer, &offset);
68 offset -= 2; /* Adjust as the Deserialise Function will read this as well */
69
70 unifi_trace(priv, UDBG4, "CsrWifiRouterTransportRecv: primType=0x%.4X, msgType=0x%.4X, bufferLength=%d\n",
71 primType, msgType, bufferLength);
72
73 /* Special handling for HOSTIO messages.... */
74 if (primType == CSR_WIFI_HOSTIO_PRIM)
75 {
76 CsrWifiRouterCtrlHipReq req = {{CSR_WIFI_ROUTER_CTRL_HIP_REQ, CSR_WIFI_ROUTER_CTRL_PRIM, dest, src, NULL}, 0, NULL, 0, NULL, 0, NULL};
77
78 req.mlmeCommandLength = bufferLength;
79 req.mlmeCommand = buffer;
80
81 offset += 8;/* Skip the id, src, dest and slot number */
82 CsrUint16Des(&req.dataRef1Length, buffer, &offset);
83 offset += 2; /* Skip the slot number */
84 CsrUint16Des(&req.dataRef2Length, buffer, &offset);
85
86 if (req.dataRef1Length)
87 {
88 u16 dr1Offset = (bufferLength - req.dataRef2Length) - req.dataRef1Length;
89 req.dataRef1 = &buffer[dr1Offset];
90 }
91
92 if (req.dataRef2Length)
93 {
94 u16 dr2Offset = bufferLength - req.dataRef2Length;
95 req.dataRef2 = &buffer[dr2Offset];
96 }
97
98 /* Copy the hip data but strip off the prim type */
99 req.mlmeCommandLength -= (req.dataRef1Length + req.dataRef2Length + 6);
100 req.mlmeCommand = &buffer[6];
101
102 CsrWifiRouterCtrlHipReqHandler(priv, &req.common);
103 return;
104 }
105
106 msgEntry = CsrMsgConvFindEntry(primType, msgType);
107 if (!msgEntry)
108 {
109 unifi_error(priv, "CsrWifiRouterTransportDeserialiseAndSend can not process the message. primType=0x%.4X, msgType=0x%.4X\n",
110 primType, msgType);
111 dump(buffer, bufferLength);
112 return;
113 }
114
115 msg = (CsrWifiFsmEvent*)(msgEntry->deserFunc)(&buffer[offset], bufferLength - offset);
116
117 msg->primtype = primType;
118 msg->type = msgType;
119 msg->source = src;
120 msg->destination = dest;
121
122 switch(primType)
123 {
124 case CSR_WIFI_ROUTER_CTRL_PRIM:
125 CsrWifiRouterCtrlDownstreamStateHandlers[msg->type - CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_LOWEST](priv, msg);
126 CsrWifiRouterCtrlFreeDownstreamMessageContents(CSR_WIFI_ROUTER_CTRL_PRIM, msg);
127 break;
128 case CSR_WIFI_ROUTER_PRIM:
129 CsrWifiRouterDownstreamStateHandlers[msg->type - CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST](priv, msg);
130 CsrWifiRouterFreeDownstreamMessageContents(CSR_WIFI_ROUTER_PRIM, msg);
131 break;
132 case CSR_WIFI_SME_PRIM:
133 CsrWifiSmeUpstreamStateHandlers[msg->type - CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST](priv, msg);
134 CsrWifiSmeFreeUpstreamMessageContents(CSR_WIFI_SME_PRIM, msg);
135 break;
136#ifdef CSR_SUPPORT_WEXT
137#ifdef CSR_SUPPORT_WEXT_AP
138 case CSR_WIFI_NME_AP_PRIM:
139 CsrWifiNmeApUpstreamStateHandlers(priv, msg);
140 CsrWifiNmeApFreeUpstreamMessageContents(CSR_WIFI_NME_AP_PRIM, msg);
141 break;
142#endif
143#endif
144 default:
145 unifi_error(priv, "CsrWifiRouterTransportDeserialiseAndSend unhandled prim type 0x%.4X\n", primType);
146 break;
147 }
148 kfree(msg);
149}
150
151static void CsrWifiRouterTransportSerialiseAndSend(u16 primType, void* msg)
152{
153 CsrWifiFsmEvent* evt = (CsrWifiFsmEvent*)msg;
154 CsrMsgConvMsgEntry* msgEntry;
155 size_t msgSize;
156 size_t encodeBufferLen = 0;
157 size_t offset = 0;
158 u8* encodeBuffer;
159
160 unifi_trace(drvpriv, UDBG4, "CsrWifiRouterTransportSerialiseAndSend: primType=0x%.4X, msgType=0x%.4X\n",
161 primType, evt->type);
162
163 msgEntry = CsrMsgConvFindEntry(primType, evt->type);
164 if (!msgEntry)
165 {
166 unifi_error(drvpriv, "CsrWifiRouterTransportSerialiseAndSend can not process the message. primType=0x%.4X, msgType=0x%.4X\n",
167 primType, evt->type);
168 return;
169 }
170
171 msgSize = 6 + (msgEntry->sizeofFunc)((void*)msg);
172
173 encodeBuffer = kmalloc(msgSize, GFP_KERNEL);
174
175 /* Encode PrimType */
176 CsrUint16Ser(encodeBuffer, &encodeBufferLen, primType);
177 CsrUint16Ser(encodeBuffer, &encodeBufferLen, evt->source);
178 CsrUint16Ser(encodeBuffer, &encodeBufferLen, evt->destination);
179
180 (void)(msgEntry->serFunc)(&encodeBuffer[encodeBufferLen], &offset, msg);
181 encodeBufferLen += offset;
182
183 uf_sme_queue_message(drvpriv, encodeBuffer, encodeBufferLen);
184
185 /* Do not use msgEntry->freeFunc because the memory is owned by the driver */
186 kfree(msg);
187}
188
189#if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER)
190void CsrSchedMessagePutStringLog(CsrSchedQid q, u16 mi, void *mv, u32 line, char *file)
191#else
192void CsrSchedMessagePut(CsrSchedQid q, u16 mi, void *mv)
193#endif
194{
195 CsrWifiFsmEvent* evt = (CsrWifiFsmEvent*)mv;
196 evt->destination = q;
197 CsrWifiRouterTransportSerialiseAndSend(mi, mv);
198}
199
diff --git a/drivers/staging/csr/csr_wifi_serialize_primitive_types.c b/drivers/staging/csr/csr_wifi_serialize_primitive_types.c
deleted file mode 100644
index dd93d0061190..000000000000
--- a/drivers/staging/csr/csr_wifi_serialize_primitive_types.c
+++ /dev/null
@@ -1,256 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11#include <linux/module.h>
12#include <linux/slab.h>
13#include "csr_macro.h"
14#include "csr_msgconv.h"
15#include "csr_wifi_msgconv.h"
16#include "csr_wifi_lib.h"
17
18void CsrUint24Des(u32 *v, u8 *buffer, size_t *offset)
19{
20 u32 val;
21
22 val = ((buffer[(*offset) + 2] << 16) |
23 (buffer[(*offset) + 1] << 8) |
24 (buffer[(*offset)]));
25
26 *offset += 3;
27 *v = val;
28}
29
30
31/* Big endian :e.g WSC, TCLAS */
32void CsrUint16DesBigEndian(u16 *v, u8 *buffer, size_t *offset)
33{
34 u16 val;
35
36 val = (buffer[(*offset)] << 8) | (buffer[(*offset) + 1]);
37 *offset += 2;
38
39 *v = val;
40}
41
42
43void CsrUint24DesBigEndian(u32 *v, u8 *buffer, size_t *offset)
44{
45 u32 val;
46
47 val = ((buffer[(*offset)] << 16) |
48 (buffer[(*offset) + 1] << 8) |
49 (buffer[(*offset) + 2]));
50
51 *offset += 3;
52 *v = val;
53}
54
55
56void CsrUint32DesBigEndian(u32 *v, u8 *buffer, size_t *offset)
57{
58 u32 val;
59
60 val = ((buffer[(*offset)] << 24) |
61 (buffer[(*offset) + 1] << 16) |
62 (buffer[(*offset) + 2] << 8) |
63 (buffer[(*offset) + 3]));
64
65 *offset += 4;
66 *v = val;
67}
68
69
70void CsrUint24Ser(u8 *ptr, size_t *len, u32 v)
71{
72 ptr[(*len) + 2] = (u8)((v & 0x00ff0000) >> 16);
73 ptr[(*len) + 1] = (u8)((v & 0x0000ff00) >> 8);
74 ptr[(*len)] = (u8)((v & 0x000000ff));
75
76 *len += 3;
77}
78
79
80/* Big endian :e.g WSC, TCLAS */
81void CsrUint16SerBigEndian(u8 *ptr, size_t *len, u16 v)
82{
83 ptr[(*len)] = (u8)((v & 0xff00) >> 8);
84 ptr[(*len) + 1] = (u8)((v & 0x00ff));
85
86 *len += 2;
87}
88
89
90void CsrUint32SerBigEndian(u8 *ptr, size_t *len, u32 v)
91{
92 ptr[(*len)] = (u8)((v & 0xff000000) >> 24);
93 ptr[(*len) + 1] = (u8)((v & 0x00ff0000) >> 16);
94 ptr[(*len) + 2] = (u8)((v & 0x0000ff00) >> 8);
95 ptr[(*len) + 3] = (u8)((v & 0x000000ff));
96
97 *len += 4;
98}
99
100
101void CsrUint24SerBigEndian(u8 *ptr, size_t *len, u32 v)
102{
103 ptr[(*len)] = (u8)((v & 0x00ff0000) >> 16);
104 ptr[(*len) + 1] = (u8)((v & 0x0000ff00) >> 8);
105 ptr[(*len) + 2] = (u8)((v & 0x000000ff));
106
107 *len += 3;
108}
109
110
111size_t CsrWifiEventSizeof(void *msg)
112{
113 return 2;
114}
115EXPORT_SYMBOL_GPL(CsrWifiEventSizeof);
116
117u8* CsrWifiEventSer(u8 *ptr, size_t *len, void *msg)
118{
119 CsrWifiFsmEvent *primitive = (CsrWifiFsmEvent *)msg;
120 *len = 0;
121 CsrUint16Ser(ptr, len, primitive->type);
122 return(ptr);
123}
124EXPORT_SYMBOL_GPL(CsrWifiEventSer);
125
126void* CsrWifiEventDes(u8 *buffer, size_t length)
127{
128 CsrWifiFsmEvent *primitive = kmalloc(sizeof(CsrWifiFsmEvent), GFP_KERNEL);
129 size_t offset = 0;
130 CsrUint16Des(&primitive->type, buffer, &offset);
131
132 return primitive;
133}
134EXPORT_SYMBOL_GPL(CsrWifiEventDes);
135
136size_t CsrWifiEventCsrUint8Sizeof(void *msg)
137{
138 return 3;
139}
140EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint8Sizeof);
141
142u8* CsrWifiEventCsrUint8Ser(u8 *ptr, size_t *len, void *msg)
143{
144 CsrWifiEventCsrUint8 *primitive = (CsrWifiEventCsrUint8 *)msg;
145 *len = 0;
146 CsrUint16Ser(ptr, len, primitive->common.type);
147 CsrUint8Ser(ptr, len, primitive->value);
148 return(ptr);
149}
150EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint8Ser);
151
152
153void* CsrWifiEventCsrUint8Des(u8 *buffer, size_t length)
154{
155 CsrWifiEventCsrUint8 *primitive = kmalloc(sizeof(CsrWifiEventCsrUint8), GFP_KERNEL);
156
157 size_t offset = 0;
158 CsrUint16Des(&primitive->common.type, buffer, &offset);
159 CsrUint8Des(&primitive->value, buffer, &offset);
160
161 return primitive;
162}
163EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint8Des);
164
165
166size_t CsrWifiEventCsrUint16Sizeof(void *msg)
167{
168 return 4;
169}
170EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16Sizeof);
171
172
173u8* CsrWifiEventCsrUint16Ser(u8 *ptr, size_t *len, void *msg)
174{
175 CsrWifiEventCsrUint16 *primitive = (CsrWifiEventCsrUint16 *)msg;
176 *len = 0;
177 CsrUint16Ser(ptr, len, primitive->common.type);
178 CsrUint16Ser(ptr, len, primitive->value);
179 return(ptr);
180}
181EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16Ser);
182
183void* CsrWifiEventCsrUint16Des(u8 *buffer, size_t length)
184{
185 CsrWifiEventCsrUint16 *primitive = kmalloc(sizeof(CsrWifiEventCsrUint16), GFP_KERNEL);
186
187 size_t offset = 0;
188 CsrUint16Des(&primitive->common.type, buffer, &offset);
189 CsrUint16Des(&primitive->value, buffer, &offset);
190
191 return primitive;
192}
193EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16Des);
194
195
196size_t CsrWifiEventCsrUint32Sizeof(void *msg)
197{
198 return 6;
199}
200EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint32Sizeof);
201
202u8* CsrWifiEventCsrUint32Ser(u8 *ptr, size_t *len, void *msg)
203{
204 CsrWifiEventCsrUint32 *primitive = (CsrWifiEventCsrUint32 *)msg;
205 *len = 0;
206 CsrUint16Ser(ptr, len, primitive->common.type);
207 CsrUint32Ser(ptr, len, primitive->value);
208 return(ptr);
209}
210EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint32Ser);
211
212
213void* CsrWifiEventCsrUint32Des(u8 *buffer, size_t length)
214{
215 CsrWifiEventCsrUint32 *primitive = kmalloc(sizeof(CsrWifiEventCsrUint32), GFP_KERNEL);
216
217 size_t offset = 0;
218 CsrUint16Des(&primitive->common.type, buffer, &offset);
219 CsrUint32Des(&primitive->value, buffer, &offset);
220
221 return primitive;
222}
223EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint32Des);
224
225size_t CsrWifiEventCsrUint16CsrUint8Sizeof(void *msg)
226{
227 return 5;
228}
229EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16CsrUint8Sizeof);
230
231u8* CsrWifiEventCsrUint16CsrUint8Ser(u8 *ptr, size_t *len, void *msg)
232{
233 CsrWifiEventCsrUint16CsrUint8 *primitive = (CsrWifiEventCsrUint16CsrUint8 *)msg;
234 *len = 0;
235 CsrUint16Ser(ptr, len, primitive->common.type);
236 CsrUint16Ser(ptr, len, primitive->value16);
237 CsrUint8Ser(ptr, len, primitive->value8);
238 return(ptr);
239}
240EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16CsrUint8Ser);
241
242
243void* CsrWifiEventCsrUint16CsrUint8Des(u8 *buffer, size_t length)
244{
245 CsrWifiEventCsrUint16CsrUint8 *primitive = kmalloc(sizeof(CsrWifiEventCsrUint16CsrUint8), GFP_KERNEL);
246
247 size_t offset = 0;
248 CsrUint16Des(&primitive->common.type, buffer, &offset);
249 CsrUint16Des(&primitive->value16, buffer, &offset);
250 CsrUint8Des(&primitive->value8, buffer, &offset);
251
252 return primitive;
253}
254EXPORT_SYMBOL_GPL(CsrWifiEventCsrUint16CsrUint8Des);
255
256
diff --git a/drivers/staging/csr/csr_wifi_sme_ap_lib.h b/drivers/staging/csr/csr_wifi_sme_ap_lib.h
deleted file mode 100644
index 48ea9143f591..000000000000
--- a/drivers/staging/csr/csr_wifi_sme_ap_lib.h
+++ /dev/null
@@ -1,774 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_SME_AP_LIB_H__
14#define CSR_WIFI_SME_AP_LIB_H__
15
16#include "csr_sched.h"
17#include "csr_macro.h"
18#include "csr_msg_transport.h"
19
20#include "csr_wifi_lib.h"
21
22#include "csr_wifi_sme_ap_prim.h"
23#include "csr_wifi_sme_task.h"
24
25#ifndef CSR_WIFI_AP_ENABLE
26#error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_sme_ap_lib.h
27#endif
28
29/*----------------------------------------------------------------------------*
30 * CsrWifiSmeApFreeUpstreamMessageContents
31 *
32 * DESCRIPTION
33 * Free the allocated memory in a CSR_WIFI_SME_AP upstream message. Does not
34 * free the message itself, and can only be used for upstream messages.
35 *
36 * PARAMETERS
37 * Deallocates the resources in a CSR_WIFI_SME_AP upstream message
38 *----------------------------------------------------------------------------*/
39void CsrWifiSmeApFreeUpstreamMessageContents(u16 eventClass, void *message);
40
41/*----------------------------------------------------------------------------*
42 * CsrWifiSmeApFreeDownstreamMessageContents
43 *
44 * DESCRIPTION
45 * Free the allocated memory in a CSR_WIFI_SME_AP downstream message. Does not
46 * free the message itself, and can only be used for downstream messages.
47 *
48 * PARAMETERS
49 * Deallocates the resources in a CSR_WIFI_SME_AP downstream message
50 *----------------------------------------------------------------------------*/
51void CsrWifiSmeApFreeDownstreamMessageContents(u16 eventClass, void *message);
52
53/*----------------------------------------------------------------------------*
54 * Enum to string functions
55 *----------------------------------------------------------------------------*/
56const char* CsrWifiSmeApAccessTypeToString(CsrWifiSmeApAccessType value);
57const char* CsrWifiSmeApAuthSupportToString(CsrWifiSmeApAuthSupport value);
58const char* CsrWifiSmeApAuthTypeToString(CsrWifiSmeApAuthType value);
59const char* CsrWifiSmeApDirectionToString(CsrWifiSmeApDirection value);
60const char* CsrWifiSmeApPhySupportToString(CsrWifiSmeApPhySupport value);
61const char* CsrWifiSmeApTypeToString(CsrWifiSmeApType value);
62
63
64/*----------------------------------------------------------------------------*
65 * CsrPrim Type toString function.
66 * Converts a message type to the String name of the Message
67 *----------------------------------------------------------------------------*/
68const char* CsrWifiSmeApPrimTypeToString(CsrPrim msgType);
69
70/*----------------------------------------------------------------------------*
71 * Lookup arrays for PrimType name Strings
72 *----------------------------------------------------------------------------*/
73extern const char *CsrWifiSmeApUpstreamPrimNames[CSR_WIFI_SME_AP_PRIM_UPSTREAM_COUNT];
74extern const char *CsrWifiSmeApDownstreamPrimNames[CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_COUNT];
75
76/*******************************************************************************
77
78 NAME
79 CsrWifiSmeApActiveBaGetReqSend
80
81 DESCRIPTION
82 This primitive used to retrieve information related to the active block
83 ack sessions
84
85 PARAMETERS
86 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
87 interfaceTag -
88
89*******************************************************************************/
90#define CsrWifiSmeApActiveBaGetReqCreate(msg__, dst__, src__, interfaceTag__) \
91 msg__ = kmalloc(sizeof(CsrWifiSmeApActiveBaGetReq), GFP_KERNEL); \
92 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_ACTIVE_BA_GET_REQ, dst__, src__); \
93 msg__->interfaceTag = (interfaceTag__);
94
95#define CsrWifiSmeApActiveBaGetReqSendTo(dst__, src__, interfaceTag__) \
96 { \
97 CsrWifiSmeApActiveBaGetReq *msg__; \
98 CsrWifiSmeApActiveBaGetReqCreate(msg__, dst__, src__, interfaceTag__); \
99 CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
100 }
101
102#define CsrWifiSmeApActiveBaGetReqSend(src__, interfaceTag__) \
103 CsrWifiSmeApActiveBaGetReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__)
104
105/*******************************************************************************
106
107 NAME
108 CsrWifiSmeApActiveBaGetCfmSend
109
110 DESCRIPTION
111 This primitive carries the information related to the active ba sessions
112
113 PARAMETERS
114 queue - Destination Task Queue
115 interfaceTag -
116 status - Reports the result of the request
117 activeBaCount - Number of active block ack session
118 activeBaSessions - Points to a buffer containing an array of
119 CsrWifiSmeApBaSession structures.
120
121*******************************************************************************/
122#define CsrWifiSmeApActiveBaGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, activeBaCount__, activeBaSessions__) \
123 msg__ = kmalloc(sizeof(CsrWifiSmeApActiveBaGetCfm), GFP_KERNEL); \
124 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_ACTIVE_BA_GET_CFM, dst__, src__); \
125 msg__->interfaceTag = (interfaceTag__); \
126 msg__->status = (status__); \
127 msg__->activeBaCount = (activeBaCount__); \
128 msg__->activeBaSessions = (activeBaSessions__);
129
130#define CsrWifiSmeApActiveBaGetCfmSendTo(dst__, src__, interfaceTag__, status__, activeBaCount__, activeBaSessions__) \
131 { \
132 CsrWifiSmeApActiveBaGetCfm *msg__; \
133 CsrWifiSmeApActiveBaGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, activeBaCount__, activeBaSessions__); \
134 CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
135 }
136
137#define CsrWifiSmeApActiveBaGetCfmSend(dst__, interfaceTag__, status__, activeBaCount__, activeBaSessions__) \
138 CsrWifiSmeApActiveBaGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, activeBaCount__, activeBaSessions__)
139
140/*******************************************************************************
141
142 NAME
143 CsrWifiSmeApBaDeleteReqSend
144
145 DESCRIPTION
146 This primitive is used to delete an active block ack session
147
148 PARAMETERS
149 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
150 interfaceTag -
151 reason -
152 baSession - BA session to be deleted
153
154*******************************************************************************/
155#define CsrWifiSmeApBaDeleteReqCreate(msg__, dst__, src__, interfaceTag__, reason__, baSession__) \
156 msg__ = kmalloc(sizeof(CsrWifiSmeApBaDeleteReq), GFP_KERNEL); \
157 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BA_DELETE_REQ, dst__, src__); \
158 msg__->interfaceTag = (interfaceTag__); \
159 msg__->reason = (reason__); \
160 msg__->baSession = (baSession__);
161
162#define CsrWifiSmeApBaDeleteReqSendTo(dst__, src__, interfaceTag__, reason__, baSession__) \
163 { \
164 CsrWifiSmeApBaDeleteReq *msg__; \
165 CsrWifiSmeApBaDeleteReqCreate(msg__, dst__, src__, interfaceTag__, reason__, baSession__); \
166 CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
167 }
168
169#define CsrWifiSmeApBaDeleteReqSend(src__, interfaceTag__, reason__, baSession__) \
170 CsrWifiSmeApBaDeleteReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, reason__, baSession__)
171
172/*******************************************************************************
173
174 NAME
175 CsrWifiSmeApBaDeleteCfmSend
176
177 DESCRIPTION
178 This primitive confirms the BA is deleted
179
180 PARAMETERS
181 queue - Destination Task Queue
182 interfaceTag -
183 status - Reports the result of the request
184 baSession - deleted BA session
185
186*******************************************************************************/
187#define CsrWifiSmeApBaDeleteCfmCreate(msg__, dst__, src__, interfaceTag__, status__, baSession__) \
188 msg__ = kmalloc(sizeof(CsrWifiSmeApBaDeleteCfm), GFP_KERNEL); \
189 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BA_DELETE_CFM, dst__, src__); \
190 msg__->interfaceTag = (interfaceTag__); \
191 msg__->status = (status__); \
192 msg__->baSession = (baSession__);
193
194#define CsrWifiSmeApBaDeleteCfmSendTo(dst__, src__, interfaceTag__, status__, baSession__) \
195 { \
196 CsrWifiSmeApBaDeleteCfm *msg__; \
197 CsrWifiSmeApBaDeleteCfmCreate(msg__, dst__, src__, interfaceTag__, status__, baSession__); \
198 CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
199 }
200
201#define CsrWifiSmeApBaDeleteCfmSend(dst__, interfaceTag__, status__, baSession__) \
202 CsrWifiSmeApBaDeleteCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, baSession__)
203
204/*******************************************************************************
205
206 NAME
207 CsrWifiSmeApBeaconingStartReqSend
208
209 DESCRIPTION
210 This primitive requests the SME to start AP or GO functionality
211
212 PARAMETERS
213 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
214 interfaceTag -
215 initialPresence - Set to 0, if Not in a group fomration phase, set to 1 ,
216 during group formation phase
217 apType - apType : Legacy AP or P2PGO
218 cloakSsid - cloakSsid flag.
219 ssid - ssid.
220 ifIndex - Radio Interface
221 channel - channel.
222 maxConnections - Maximum Stations + P2PClients allowed
223 apCredentials - AP security credeitals used to advertise in beacon /probe
224 response
225 smeApConfig - AP configuration
226 p2pGoParam - P2P specific GO parameters. Ignored if it is a leagacy AP
227
228*******************************************************************************/
229#define CsrWifiSmeApBeaconingStartReqCreate(msg__, dst__, src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__) \
230 msg__ = kmalloc(sizeof(CsrWifiSmeApBeaconingStartReq), GFP_KERNEL); \
231 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_START_REQ, dst__, src__); \
232 msg__->interfaceTag = (interfaceTag__); \
233 msg__->initialPresence = (initialPresence__); \
234 msg__->apType = (apType__); \
235 msg__->cloakSsid = (cloakSsid__); \
236 msg__->ssid = (ssid__); \
237 msg__->ifIndex = (ifIndex__); \
238 msg__->channel = (channel__); \
239 msg__->maxConnections = (maxConnections__); \
240 msg__->apCredentials = (apCredentials__); \
241 msg__->smeApConfig = (smeApConfig__); \
242 msg__->p2pGoParam = (p2pGoParam__);
243
244#define CsrWifiSmeApBeaconingStartReqSendTo(dst__, src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__) \
245 { \
246 CsrWifiSmeApBeaconingStartReq *msg__; \
247 CsrWifiSmeApBeaconingStartReqCreate(msg__, dst__, src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__); \
248 CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
249 }
250
251#define CsrWifiSmeApBeaconingStartReqSend(src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__) \
252 CsrWifiSmeApBeaconingStartReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, initialPresence__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, maxConnections__, apCredentials__, smeApConfig__, p2pGoParam__)
253
254/*******************************************************************************
255
256 NAME
257 CsrWifiSmeApBeaconingStartCfmSend
258
259 DESCRIPTION
260 This primitive confirms the completion of the request along with the
261 status
262
263 PARAMETERS
264 queue - Destination Task Queue
265 interfaceTag -
266 status -
267 secIeLength -
268 secIe -
269
270*******************************************************************************/
271#define CsrWifiSmeApBeaconingStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, secIeLength__, secIe__) \
272 msg__ = kmalloc(sizeof(CsrWifiSmeApBeaconingStartCfm), GFP_KERNEL); \
273 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_START_CFM, dst__, src__); \
274 msg__->interfaceTag = (interfaceTag__); \
275 msg__->status = (status__); \
276 msg__->secIeLength = (secIeLength__); \
277 msg__->secIe = (secIe__);
278
279#define CsrWifiSmeApBeaconingStartCfmSendTo(dst__, src__, interfaceTag__, status__, secIeLength__, secIe__) \
280 { \
281 CsrWifiSmeApBeaconingStartCfm *msg__; \
282 CsrWifiSmeApBeaconingStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, secIeLength__, secIe__); \
283 CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
284 }
285
286#define CsrWifiSmeApBeaconingStartCfmSend(dst__, interfaceTag__, status__, secIeLength__, secIe__) \
287 CsrWifiSmeApBeaconingStartCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, secIeLength__, secIe__)
288
289/*******************************************************************************
290
291 NAME
292 CsrWifiSmeApBeaconingStopReqSend
293
294 DESCRIPTION
295 This primitive requests the SME to STOP AP or P2PGO operation
296
297 PARAMETERS
298 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
299 interfaceTag -
300
301*******************************************************************************/
302#define CsrWifiSmeApBeaconingStopReqCreate(msg__, dst__, src__, interfaceTag__) \
303 msg__ = kmalloc(sizeof(CsrWifiSmeApBeaconingStopReq), GFP_KERNEL); \
304 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_STOP_REQ, dst__, src__); \
305 msg__->interfaceTag = (interfaceTag__);
306
307#define CsrWifiSmeApBeaconingStopReqSendTo(dst__, src__, interfaceTag__) \
308 { \
309 CsrWifiSmeApBeaconingStopReq *msg__; \
310 CsrWifiSmeApBeaconingStopReqCreate(msg__, dst__, src__, interfaceTag__); \
311 CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
312 }
313
314#define CsrWifiSmeApBeaconingStopReqSend(src__, interfaceTag__) \
315 CsrWifiSmeApBeaconingStopReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__)
316
317/*******************************************************************************
318
319 NAME
320 CsrWifiSmeApBeaconingStopCfmSend
321
322 DESCRIPTION
323 This primitive confirms AP or P2PGO operation is terminated
324
325 PARAMETERS
326 queue - Destination Task Queue
327 interfaceTag -
328 status -
329
330*******************************************************************************/
331#define CsrWifiSmeApBeaconingStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
332 msg__ = kmalloc(sizeof(CsrWifiSmeApBeaconingStopCfm), GFP_KERNEL); \
333 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_BEACONING_STOP_CFM, dst__, src__); \
334 msg__->interfaceTag = (interfaceTag__); \
335 msg__->status = (status__);
336
337#define CsrWifiSmeApBeaconingStopCfmSendTo(dst__, src__, interfaceTag__, status__) \
338 { \
339 CsrWifiSmeApBeaconingStopCfm *msg__; \
340 CsrWifiSmeApBeaconingStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
341 CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
342 }
343
344#define CsrWifiSmeApBeaconingStopCfmSend(dst__, interfaceTag__, status__) \
345 CsrWifiSmeApBeaconingStopCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
346
347/*******************************************************************************
348
349 NAME
350 CsrWifiSmeApErrorIndSend
351
352 DESCRIPTION
353 This primitve is sent by SME to indicate some error in AP operationi
354 after AP operations were started successfully and continuing the AP
355 operation may lead to undesired behaviour. It is the responsibility of
356 the upper layers to stop AP operation if needed
357
358 PARAMETERS
359 queue - Destination Task Queue
360 interfaceTag - Range 0-1
361 apType -
362 status - Contains the error status
363
364*******************************************************************************/
365#define CsrWifiSmeApErrorIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__) \
366 msg__ = kmalloc(sizeof(CsrWifiSmeApErrorInd), GFP_KERNEL); \
367 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_ERROR_IND, dst__, src__); \
368 msg__->interfaceTag = (interfaceTag__); \
369 msg__->apType = (apType__); \
370 msg__->status = (status__);
371
372#define CsrWifiSmeApErrorIndSendTo(dst__, src__, interfaceTag__, apType__, status__) \
373 { \
374 CsrWifiSmeApErrorInd *msg__; \
375 CsrWifiSmeApErrorIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__); \
376 CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
377 }
378
379#define CsrWifiSmeApErrorIndSend(dst__, interfaceTag__, apType__, status__) \
380 CsrWifiSmeApErrorIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, apType__, status__)
381
382/*******************************************************************************
383
384 NAME
385 CsrWifiSmeApStaConnectStartIndSend
386
387 DESCRIPTION
388 This primitive indicates that a stations request to join the group/BSS is
389 accepted
390
391 PARAMETERS
392 queue - Destination Task Queue
393 interfaceTag -
394 peerMacAddress -
395
396*******************************************************************************/
397#define CsrWifiSmeApStaConnectStartIndCreate(msg__, dst__, src__, interfaceTag__, peerMacAddress__) \
398 msg__ = kmalloc(sizeof(CsrWifiSmeApStaConnectStartInd), GFP_KERNEL); \
399 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_CONNECT_START_IND, dst__, src__); \
400 msg__->interfaceTag = (interfaceTag__); \
401 msg__->peerMacAddress = (peerMacAddress__);
402
403#define CsrWifiSmeApStaConnectStartIndSendTo(dst__, src__, interfaceTag__, peerMacAddress__) \
404 { \
405 CsrWifiSmeApStaConnectStartInd *msg__; \
406 CsrWifiSmeApStaConnectStartIndCreate(msg__, dst__, src__, interfaceTag__, peerMacAddress__); \
407 CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
408 }
409
410#define CsrWifiSmeApStaConnectStartIndSend(dst__, interfaceTag__, peerMacAddress__) \
411 CsrWifiSmeApStaConnectStartIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, peerMacAddress__)
412
413/*******************************************************************************
414
415 NAME
416 CsrWifiSmeApStaDisconnectReqSend
417
418 DESCRIPTION
419 This primitive tells SME to deauth ot disassociate a particular station
420 within BSS
421
422 PARAMETERS
423 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
424 interfaceTag -
425 deauthReason -
426 disassocReason -
427 peerMacaddress -
428 keepBlocking - If TRUE, the station is blocked. If FALSE and the station
429 is connected, disconnect the station. If FALSE and the
430 station is not connected, no action is taken.
431
432*******************************************************************************/
433#define CsrWifiSmeApStaDisconnectReqCreate(msg__, dst__, src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__) \
434 msg__ = kmalloc(sizeof(CsrWifiSmeApStaDisconnectReq), GFP_KERNEL); \
435 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_DISCONNECT_REQ, dst__, src__); \
436 msg__->interfaceTag = (interfaceTag__); \
437 msg__->deauthReason = (deauthReason__); \
438 msg__->disassocReason = (disassocReason__); \
439 msg__->peerMacaddress = (peerMacaddress__); \
440 msg__->keepBlocking = (keepBlocking__);
441
442#define CsrWifiSmeApStaDisconnectReqSendTo(dst__, src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__) \
443 { \
444 CsrWifiSmeApStaDisconnectReq *msg__; \
445 CsrWifiSmeApStaDisconnectReqCreate(msg__, dst__, src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__); \
446 CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
447 }
448
449#define CsrWifiSmeApStaDisconnectReqSend(src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__) \
450 CsrWifiSmeApStaDisconnectReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, deauthReason__, disassocReason__, peerMacaddress__, keepBlocking__)
451
452/*******************************************************************************
453
454 NAME
455 CsrWifiSmeApStaDisconnectCfmSend
456
457 DESCRIPTION
458 This primitive confirms the station is disconnected
459
460 PARAMETERS
461 queue - Destination Task Queue
462 interfaceTag -
463 status -
464 peerMacaddress -
465
466*******************************************************************************/
467#define CsrWifiSmeApStaDisconnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__, peerMacaddress__) \
468 msg__ = kmalloc(sizeof(CsrWifiSmeApStaDisconnectCfm), GFP_KERNEL); \
469 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_DISCONNECT_CFM, dst__, src__); \
470 msg__->interfaceTag = (interfaceTag__); \
471 msg__->status = (status__); \
472 msg__->peerMacaddress = (peerMacaddress__);
473
474#define CsrWifiSmeApStaDisconnectCfmSendTo(dst__, src__, interfaceTag__, status__, peerMacaddress__) \
475 { \
476 CsrWifiSmeApStaDisconnectCfm *msg__; \
477 CsrWifiSmeApStaDisconnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__, peerMacaddress__); \
478 CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
479 }
480
481#define CsrWifiSmeApStaDisconnectCfmSend(dst__, interfaceTag__, status__, peerMacaddress__) \
482 CsrWifiSmeApStaDisconnectCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, peerMacaddress__)
483
484/*******************************************************************************
485
486 NAME
487 CsrWifiSmeApStaNotifyIndSend
488
489 DESCRIPTION
490 This primitive indicates that a station has joined or a previously joined
491 station has left the BSS/group
492
493 PARAMETERS
494 queue - Destination Task Queue
495 interfaceTag -
496 mediaStatus -
497 peerMacAddress -
498 peerDeviceAddress -
499 disassocReason -
500 deauthReason -
501 WpsRegistration -
502 secIeLength -
503 secIe -
504 groupKeyId -
505 seqNumber -
506
507*******************************************************************************/
508#define CsrWifiSmeApStaNotifyIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__) \
509 msg__ = kmalloc(sizeof(CsrWifiSmeApStaNotifyInd), GFP_KERNEL); \
510 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_STA_NOTIFY_IND, dst__, src__); \
511 msg__->interfaceTag = (interfaceTag__); \
512 msg__->mediaStatus = (mediaStatus__); \
513 msg__->peerMacAddress = (peerMacAddress__); \
514 msg__->peerDeviceAddress = (peerDeviceAddress__); \
515 msg__->disassocReason = (disassocReason__); \
516 msg__->deauthReason = (deauthReason__); \
517 msg__->WpsRegistration = (WpsRegistration__); \
518 msg__->secIeLength = (secIeLength__); \
519 msg__->secIe = (secIe__); \
520 msg__->groupKeyId = (groupKeyId__); \
521 memcpy(msg__->seqNumber, (seqNumber__), sizeof(u16) * 8);
522
523#define CsrWifiSmeApStaNotifyIndSendTo(dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__) \
524 { \
525 CsrWifiSmeApStaNotifyInd *msg__; \
526 CsrWifiSmeApStaNotifyIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__); \
527 CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
528 }
529
530#define CsrWifiSmeApStaNotifyIndSend(dst__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__) \
531 CsrWifiSmeApStaNotifyIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__, disassocReason__, deauthReason__, WpsRegistration__, secIeLength__, secIe__, groupKeyId__, seqNumber__)
532
533/*******************************************************************************
534
535 NAME
536 CsrWifiSmeApWmmParamUpdateReqSend
537
538 DESCRIPTION
539 Application uses this primitive to update the WMM parameters on the fly
540
541 PARAMETERS
542 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
543 interfaceTag -
544 wmmApParams - WMM parameters to be used for local firmware queue
545 configuration
546 wmmApBcParams - WMM parameters to be advertised in beacon/probe response
547
548*******************************************************************************/
549#define CsrWifiSmeApWmmParamUpdateReqCreate(msg__, dst__, src__, interfaceTag__, wmmApParams__, wmmApBcParams__) \
550 msg__ = kmalloc(sizeof(CsrWifiSmeApWmmParamUpdateReq), GFP_KERNEL); \
551 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WMM_PARAM_UPDATE_REQ, dst__, src__); \
552 msg__->interfaceTag = (interfaceTag__); \
553 memcpy(msg__->wmmApParams, (wmmApParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); \
554 memcpy(msg__->wmmApBcParams, (wmmApBcParams__), sizeof(CsrWifiSmeWmmAcParams) * 4);
555
556#define CsrWifiSmeApWmmParamUpdateReqSendTo(dst__, src__, interfaceTag__, wmmApParams__, wmmApBcParams__) \
557 { \
558 CsrWifiSmeApWmmParamUpdateReq *msg__; \
559 CsrWifiSmeApWmmParamUpdateReqCreate(msg__, dst__, src__, interfaceTag__, wmmApParams__, wmmApBcParams__); \
560 CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
561 }
562
563#define CsrWifiSmeApWmmParamUpdateReqSend(src__, interfaceTag__, wmmApParams__, wmmApBcParams__) \
564 CsrWifiSmeApWmmParamUpdateReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, wmmApParams__, wmmApBcParams__)
565
566/*******************************************************************************
567
568 NAME
569 CsrWifiSmeApWmmParamUpdateCfmSend
570
571 DESCRIPTION
572 A confirm for CSR_WIFI_SME_AP_WMM_PARAM_UPDATE.request
573
574 PARAMETERS
575 queue - Destination Task Queue
576 interfaceTag -
577 status -
578
579*******************************************************************************/
580#define CsrWifiSmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
581 msg__ = kmalloc(sizeof(CsrWifiSmeApWmmParamUpdateCfm), GFP_KERNEL); \
582 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WMM_PARAM_UPDATE_CFM, dst__, src__); \
583 msg__->interfaceTag = (interfaceTag__); \
584 msg__->status = (status__);
585
586#define CsrWifiSmeApWmmParamUpdateCfmSendTo(dst__, src__, interfaceTag__, status__) \
587 { \
588 CsrWifiSmeApWmmParamUpdateCfm *msg__; \
589 CsrWifiSmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
590 CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
591 }
592
593#define CsrWifiSmeApWmmParamUpdateCfmSend(dst__, interfaceTag__, status__) \
594 CsrWifiSmeApWmmParamUpdateCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
595
596/*******************************************************************************
597
598 NAME
599 CsrWifiSmeApWpsConfigurationReqSend
600
601 DESCRIPTION
602 This primitive passes the WPS information for the device to SME. This may
603 be accepted only if no interface is active.
604
605 PARAMETERS
606 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
607 wpsConfig - WPS config.
608
609*******************************************************************************/
610#define CsrWifiSmeApWpsConfigurationReqCreate(msg__, dst__, src__, wpsConfig__) \
611 msg__ = kmalloc(sizeof(CsrWifiSmeApWpsConfigurationReq), GFP_KERNEL); \
612 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_CONFIGURATION_REQ, dst__, src__); \
613 msg__->wpsConfig = (wpsConfig__);
614
615#define CsrWifiSmeApWpsConfigurationReqSendTo(dst__, src__, wpsConfig__) \
616 { \
617 CsrWifiSmeApWpsConfigurationReq *msg__; \
618 CsrWifiSmeApWpsConfigurationReqCreate(msg__, dst__, src__, wpsConfig__); \
619 CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
620 }
621
622#define CsrWifiSmeApWpsConfigurationReqSend(src__, wpsConfig__) \
623 CsrWifiSmeApWpsConfigurationReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, wpsConfig__)
624
625/*******************************************************************************
626
627 NAME
628 CsrWifiSmeApWpsConfigurationCfmSend
629
630 DESCRIPTION
631 Confirm.
632
633 PARAMETERS
634 queue - Destination Task Queue
635 status - Status of the request.
636
637*******************************************************************************/
638#define CsrWifiSmeApWpsConfigurationCfmCreate(msg__, dst__, src__, status__) \
639 msg__ = kmalloc(sizeof(CsrWifiSmeApWpsConfigurationCfm), GFP_KERNEL); \
640 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_CONFIGURATION_CFM, dst__, src__); \
641 msg__->status = (status__);
642
643#define CsrWifiSmeApWpsConfigurationCfmSendTo(dst__, src__, status__) \
644 { \
645 CsrWifiSmeApWpsConfigurationCfm *msg__; \
646 CsrWifiSmeApWpsConfigurationCfmCreate(msg__, dst__, src__, status__); \
647 CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
648 }
649
650#define CsrWifiSmeApWpsConfigurationCfmSend(dst__, status__) \
651 CsrWifiSmeApWpsConfigurationCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
652
653/*******************************************************************************
654
655 NAME
656 CsrWifiSmeApWpsRegistrationFinishedReqSend
657
658 DESCRIPTION
659 This primitive tells SME that WPS registration procedure has finished
660
661 PARAMETERS
662 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
663 interfaceTag -
664
665*******************************************************************************/
666#define CsrWifiSmeApWpsRegistrationFinishedReqCreate(msg__, dst__, src__, interfaceTag__) \
667 msg__ = kmalloc(sizeof(CsrWifiSmeApWpsRegistrationFinishedReq), GFP_KERNEL); \
668 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_FINISHED_REQ, dst__, src__); \
669 msg__->interfaceTag = (interfaceTag__);
670
671#define CsrWifiSmeApWpsRegistrationFinishedReqSendTo(dst__, src__, interfaceTag__) \
672 { \
673 CsrWifiSmeApWpsRegistrationFinishedReq *msg__; \
674 CsrWifiSmeApWpsRegistrationFinishedReqCreate(msg__, dst__, src__, interfaceTag__); \
675 CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
676 }
677
678#define CsrWifiSmeApWpsRegistrationFinishedReqSend(src__, interfaceTag__) \
679 CsrWifiSmeApWpsRegistrationFinishedReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__)
680
681/*******************************************************************************
682
683 NAME
684 CsrWifiSmeApWpsRegistrationFinishedCfmSend
685
686 DESCRIPTION
687 A confirm for UNIFI_MGT_AP_WPS_REGISTRATION_FINISHED.request
688
689 PARAMETERS
690 queue - Destination Task Queue
691 interfaceTag -
692 status -
693
694*******************************************************************************/
695#define CsrWifiSmeApWpsRegistrationFinishedCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
696 msg__ = kmalloc(sizeof(CsrWifiSmeApWpsRegistrationFinishedCfm), GFP_KERNEL); \
697 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_FINISHED_CFM, dst__, src__); \
698 msg__->interfaceTag = (interfaceTag__); \
699 msg__->status = (status__);
700
701#define CsrWifiSmeApWpsRegistrationFinishedCfmSendTo(dst__, src__, interfaceTag__, status__) \
702 { \
703 CsrWifiSmeApWpsRegistrationFinishedCfm *msg__; \
704 CsrWifiSmeApWpsRegistrationFinishedCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
705 CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
706 }
707
708#define CsrWifiSmeApWpsRegistrationFinishedCfmSend(dst__, interfaceTag__, status__) \
709 CsrWifiSmeApWpsRegistrationFinishedCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
710
711/*******************************************************************************
712
713 NAME
714 CsrWifiSmeApWpsRegistrationStartedReqSend
715
716 DESCRIPTION
717 This primitive tells SME that WPS registration procedure has started
718
719 PARAMETERS
720 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
721 interfaceTag -
722 SelectedDevicePasswordId -
723 SelectedconfigMethod -
724
725*******************************************************************************/
726#define CsrWifiSmeApWpsRegistrationStartedReqCreate(msg__, dst__, src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__) \
727 msg__ = kmalloc(sizeof(CsrWifiSmeApWpsRegistrationStartedReq), GFP_KERNEL); \
728 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_STARTED_REQ, dst__, src__); \
729 msg__->interfaceTag = (interfaceTag__); \
730 msg__->SelectedDevicePasswordId = (SelectedDevicePasswordId__); \
731 msg__->SelectedconfigMethod = (SelectedconfigMethod__);
732
733#define CsrWifiSmeApWpsRegistrationStartedReqSendTo(dst__, src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__) \
734 { \
735 CsrWifiSmeApWpsRegistrationStartedReq *msg__; \
736 CsrWifiSmeApWpsRegistrationStartedReqCreate(msg__, dst__, src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__); \
737 CsrMsgTransport(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
738 }
739
740#define CsrWifiSmeApWpsRegistrationStartedReqSend(src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__) \
741 CsrWifiSmeApWpsRegistrationStartedReqSendTo(CSR_WIFI_SME_IFACEQUEUE, src__, interfaceTag__, SelectedDevicePasswordId__, SelectedconfigMethod__)
742
743/*******************************************************************************
744
745 NAME
746 CsrWifiSmeApWpsRegistrationStartedCfmSend
747
748 DESCRIPTION
749 A confirm for UNIFI_MGT_AP_WPS_REGISTRATION_STARTED.request
750
751 PARAMETERS
752 queue - Destination Task Queue
753 interfaceTag -
754 status -
755
756*******************************************************************************/
757#define CsrWifiSmeApWpsRegistrationStartedCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
758 msg__ = kmalloc(sizeof(CsrWifiSmeApWpsRegistrationStartedCfm), GFP_KERNEL); \
759 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_AP_PRIM, CSR_WIFI_SME_AP_WPS_REGISTRATION_STARTED_CFM, dst__, src__); \
760 msg__->interfaceTag = (interfaceTag__); \
761 msg__->status = (status__);
762
763#define CsrWifiSmeApWpsRegistrationStartedCfmSendTo(dst__, src__, interfaceTag__, status__) \
764 { \
765 CsrWifiSmeApWpsRegistrationStartedCfm *msg__; \
766 CsrWifiSmeApWpsRegistrationStartedCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
767 CsrSchedMessagePut(dst__, CSR_WIFI_SME_AP_PRIM, msg__); \
768 }
769
770#define CsrWifiSmeApWpsRegistrationStartedCfmSend(dst__, interfaceTag__, status__) \
771 CsrWifiSmeApWpsRegistrationStartedCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
772
773
774#endif /* CSR_WIFI_SME_AP_LIB_H__ */
diff --git a/drivers/staging/csr/csr_wifi_sme_ap_prim.h b/drivers/staging/csr/csr_wifi_sme_ap_prim.h
deleted file mode 100644
index 3c4bcbc16126..000000000000
--- a/drivers/staging/csr/csr_wifi_sme_ap_prim.h
+++ /dev/null
@@ -1,1030 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_SME_AP_PRIM_H__
14#define CSR_WIFI_SME_AP_PRIM_H__
15
16#include "csr_prim_defs.h"
17#include "csr_sched.h"
18#include "csr_wifi_common.h"
19#include "csr_result.h"
20#include "csr_wifi_fsm_event.h"
21#include "csr_wifi_sme_prim.h"
22
23#ifndef CSR_WIFI_AP_ENABLE
24#error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_sme_ap_prim.h
25#endif
26
27#define CSR_WIFI_SME_AP_PRIM (0x0407)
28
29typedef CsrPrim CsrWifiSmeApPrim;
30
31
32/*******************************************************************************
33
34 NAME
35 CsrWifiSmeApAccessType
36
37 DESCRIPTION
38 Allow or deny STAs based on MAC address
39
40 VALUES
41 CSR_WIFI_AP_ACCESS_TYPE_NONE - None
42 CSR_WIFI_AP_ACCESS_TYPE_ALLOW - Allow only if MAC address is from the list
43 CSR_WIFI_AP_ACCESS_TYPE_DENY - Disallow if MAC address is from the list
44
45*******************************************************************************/
46typedef u8 CsrWifiSmeApAccessType;
47#define CSR_WIFI_AP_ACCESS_TYPE_NONE ((CsrWifiSmeApAccessType) 0x00)
48#define CSR_WIFI_AP_ACCESS_TYPE_ALLOW ((CsrWifiSmeApAccessType) 0x01)
49#define CSR_WIFI_AP_ACCESS_TYPE_DENY ((CsrWifiSmeApAccessType) 0x02)
50
51/*******************************************************************************
52
53 NAME
54 CsrWifiSmeApAuthSupport
55
56 DESCRIPTION
57 Define bits for AP authentication support
58
59 VALUES
60 CSR_WIFI_SME_RSN_AUTH_WPAPSK - RSN WPA-PSK Support
61 CSR_WIFI_SME_RSN_AUTH_WPA2PSK - RSN WPA2-PSK Support
62 CSR_WIFI_SME_AUTH_WAPIPSK - WAPI-PSK Support
63
64*******************************************************************************/
65typedef u8 CsrWifiSmeApAuthSupport;
66#define CSR_WIFI_SME_RSN_AUTH_WPAPSK ((CsrWifiSmeApAuthSupport) 0x01)
67#define CSR_WIFI_SME_RSN_AUTH_WPA2PSK ((CsrWifiSmeApAuthSupport) 0x02)
68#define CSR_WIFI_SME_AUTH_WAPIPSK ((CsrWifiSmeApAuthSupport) 0x04)
69
70/*******************************************************************************
71
72 NAME
73 CsrWifiSmeApAuthType
74
75 DESCRIPTION
76 Definition of the SME AP Authentication Options
77
78 VALUES
79 CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM
80 - Open authentication
81 CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL
82 - Personal authentication using a passphrase or a pre-shared
83 key.
84 CSR_WIFI_SME_AP_AUTH_TYPE_WEP
85 - WEP authentication. This can be either open or shared key
86
87*******************************************************************************/
88typedef u8 CsrWifiSmeApAuthType;
89#define CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM ((CsrWifiSmeApAuthType) 0x00)
90#define CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL ((CsrWifiSmeApAuthType) 0x01)
91#define CSR_WIFI_SME_AP_AUTH_TYPE_WEP ((CsrWifiSmeApAuthType) 0x02)
92
93/*******************************************************************************
94
95 NAME
96 CsrWifiSmeApDirection
97
98 DESCRIPTION
99 Definition of Direction
100
101 VALUES
102 CSR_WIFI_AP_DIRECTION_RECEIPIENT - Receipient
103 CSR_WIFI_AP_DIRECTION_ORIGINATOR - Originator
104
105*******************************************************************************/
106typedef u8 CsrWifiSmeApDirection;
107#define CSR_WIFI_AP_DIRECTION_RECEIPIENT ((CsrWifiSmeApDirection) 0x00)
108#define CSR_WIFI_AP_DIRECTION_ORIGINATOR ((CsrWifiSmeApDirection) 0x01)
109
110/*******************************************************************************
111
112 NAME
113 CsrWifiSmeApPhySupport
114
115 DESCRIPTION
116 Define bits for CsrWifiSmeApPhySupportMask
117
118 VALUES
119 CSR_WIFI_SME_AP_PHY_SUPPORT_A - 802.11a. It is not supported in the current
120 release.
121 CSR_WIFI_SME_AP_PHY_SUPPORT_B - 802.11b
122 CSR_WIFI_SME_AP_PHY_SUPPORT_G - 802.11g
123 CSR_WIFI_SME_AP_PHY_SUPPORT_N - 802.11n
124
125*******************************************************************************/
126typedef u8 CsrWifiSmeApPhySupport;
127#define CSR_WIFI_SME_AP_PHY_SUPPORT_A ((CsrWifiSmeApPhySupport) 0x01)
128#define CSR_WIFI_SME_AP_PHY_SUPPORT_B ((CsrWifiSmeApPhySupport) 0x02)
129#define CSR_WIFI_SME_AP_PHY_SUPPORT_G ((CsrWifiSmeApPhySupport) 0x04)
130#define CSR_WIFI_SME_AP_PHY_SUPPORT_N ((CsrWifiSmeApPhySupport) 0x08)
131
132/*******************************************************************************
133
134 NAME
135 CsrWifiSmeApType
136
137 DESCRIPTION
138 Definition of AP types
139
140 VALUES
141 CSR_WIFI_AP_TYPE_LEGACY - Legacy AP
142 CSR_WIFI_AP_TYPE_P2P - P2P Group Owner(GO)
143
144*******************************************************************************/
145typedef u8 CsrWifiSmeApType;
146#define CSR_WIFI_AP_TYPE_LEGACY ((CsrWifiSmeApType) 0x00)
147#define CSR_WIFI_AP_TYPE_P2P ((CsrWifiSmeApType) 0x01)
148
149
150/*******************************************************************************
151
152 NAME
153 CsrWifiSmeApAuthSupportMask
154
155 DESCRIPTION
156 See CsrWifiSmeApAuthSupport for bit definitions
157
158*******************************************************************************/
159typedef u8 CsrWifiSmeApAuthSupportMask;
160/*******************************************************************************
161
162 NAME
163 CsrWifiSmeApPhySupportMask
164
165 DESCRIPTION
166 Mask type for use with the values defined by CsrWifiSmeApPhySupport
167
168*******************************************************************************/
169typedef u8 CsrWifiSmeApPhySupportMask;
170/*******************************************************************************
171
172 NAME
173 CsrWifiSmeApRsnCapabilities
174
175 DESCRIPTION
176 Set to 0 for the current release
177
178*******************************************************************************/
179typedef u16 CsrWifiSmeApRsnCapabilities;
180/*******************************************************************************
181
182 NAME
183 CsrWifiSmeApRsnCapabilitiesMask
184
185 DESCRIPTION
186 Mask type for use with the values defined by CsrWifiSmeApRsnCapabilities
187
188*******************************************************************************/
189typedef u16 CsrWifiSmeApRsnCapabilitiesMask;
190/*******************************************************************************
191
192 NAME
193 CsrWifiSmeApWapiCapabilities
194
195 DESCRIPTION
196 Ignored by the stack as WAPI is not supported for AP operations in the
197 current release
198
199*******************************************************************************/
200typedef u16 CsrWifiSmeApWapiCapabilities;
201/*******************************************************************************
202
203 NAME
204 CsrWifiSmeApWapiCapabilitiesMask
205
206 DESCRIPTION
207 Mask type for use with the values defined by CsrWifiSmeApWapiCapabilities
208
209*******************************************************************************/
210typedef u16 CsrWifiSmeApWapiCapabilitiesMask;
211
212
213/*******************************************************************************
214
215 NAME
216 CsrWifiSmeApHtParams
217
218 DESCRIPTION
219 Structure holding HT parameters
220
221 MEMBERS
222 greenfieldSupported - Indicates if the AP supports Htgreenfield operation
223 subject to the chip capability. If the chip does not
224 support Htgreenfield operation, this parameter will be
225 ignored.
226 NOTE: if shortGi20MHz is set to TRUE and the chip
227 supports short GI operation for 20MHz this field will
228 be be ignored and the AP will not support Htgreenfield
229 operation.
230 NOTE: This field is ignored by the Wi-Fi stack for the
231 current release. It implies that AP does not support
232 greenfield operation.
233 shortGi20MHz - Indicates if the AP support short GI operation for
234 20MHz subject to the chip capability.If the chip does
235 not support short GI for 20MHz, this parameter is
236 ignored
237 rxStbc - Support for STBC for receive. 0 => No support for STBC
238 , 1=> Use STBC for Rx
239 rifsModeAllowed - RIFS Mode is allowed to protect overlapping non-HT BSS
240 htProtection - Deprecated
241 dualCtsProtection - Dual CTS Protection enabled
242
243*******************************************************************************/
244typedef struct
245{
246 u8 greenfieldSupported;
247 u8 shortGi20MHz;
248 u8 rxStbc;
249 u8 rifsModeAllowed;
250 u8 htProtection;
251 u8 dualCtsProtection;
252} CsrWifiSmeApHtParams;
253
254/*******************************************************************************
255
256 NAME
257 CsrWifiSmeApP2pOperatingChanEntry
258
259 DESCRIPTION
260
261 MEMBERS
262 operatingClass - Channel operating class
263 operatingChannelCount - Number of channels in this entry
264 operatingChannel - List of channels
265
266*******************************************************************************/
267typedef struct
268{
269 u8 operatingClass;
270 u8 operatingChannelCount;
271 u8 *operatingChannel;
272} CsrWifiSmeApP2pOperatingChanEntry;
273
274/*******************************************************************************
275
276 NAME
277 CsrWifiSmeApP2pOperatingChanList
278
279 DESCRIPTION
280 This structure contains the lists of P2P operating channels
281
282 MEMBERS
283 country - Country
284 channelEntryListCount - Number of entries
285 channelEntryList - List of entries
286
287*******************************************************************************/
288typedef struct
289{
290 u8 country[3];
291 u8 channelEntryListCount;
292 CsrWifiSmeApP2pOperatingChanEntry *channelEntryList;
293} CsrWifiSmeApP2pOperatingChanList;
294
295/*******************************************************************************
296
297 NAME
298 CsrWifiSmeApAuthPers
299
300 DESCRIPTION
301
302 MEMBERS
303 authSupport -
304 encryptionModeMask -
305 rsnCapabilities -
306 wapiCapabilities -
307
308*******************************************************************************/
309typedef struct
310{
311 CsrWifiSmeApAuthSupportMask authSupport;
312 CsrWifiSmeEncryptionMask encryptionModeMask;
313 CsrWifiSmeApRsnCapabilitiesMask rsnCapabilities;
314 CsrWifiSmeApWapiCapabilitiesMask wapiCapabilities;
315} CsrWifiSmeApAuthPers;
316
317/*******************************************************************************
318
319 NAME
320 CsrWifiSmeApBaSession
321
322 DESCRIPTION
323
324 MEMBERS
325 peerMacAddress - Indicates MAC address of the peer station
326 tid - Specifies the TID of the MSDUs for which this Block Ack has
327 been set up. Range: 0-15
328 direction - Specifies if the AP is the originator or the recipient of
329 the data stream that uses the Block Ack.
330
331*******************************************************************************/
332typedef struct
333{
334 CsrWifiMacAddress peerMacAddress;
335 u8 tid;
336 CsrWifiSmeApDirection direction;
337} CsrWifiSmeApBaSession;
338
339/*******************************************************************************
340
341 NAME
342 CsrWifiSmeApMacConfig
343
344 DESCRIPTION
345 Structure holding AP MAC configuration.
346
347 MEMBERS
348 phySupportedBitmap - Indicates supported physical layers
349 beaconInterval - Beacon interval in terms of TUs
350 dtimPeriod - DTIM period in terms of number of beacon intervals
351 maxListenInterval - Maximum allowed listen interval as number of beacon
352 intervals
353 supportedRatesCount - Number of supported rates. Range : 0 to 20
354 supportedRates - List of supportedRates. A rate is specied in the
355 units of 500kbps. An entry for a basic rate shall
356 have the MSB set to 1.
357 preamble - Preamble to be advertised in beacons and probe
358 responses
359 shortSlotTimeEnabled - TRUE indicates the AP shall use short slot time if
360 all the stations use short slot operation.
361 ctsProtectionType - CTS protection to be used
362 wmmEnabled - Indicate whether WMM is enabled or not. If set to
363 FALSE,the WMM parameters shall be ignored by the
364 receiver.
365 wmmApParams - WMM parameters to be used for local firmware queue
366 configuration. Array index corresponds to the ACI.
367 wmmApBcParams - WMM parameters to be advertised in beacon/probe
368 response. Array index corresponds to the ACI
369 accessType - Specifies whether the MAC addresses from the list
370 should be allowed or denied
371 macAddressListCount - Number of MAC addresses
372 macAddressList - List of MAC addresses
373 apHtParams - AP HT parameters. The stack shall use these
374 parameters only if phySupportedBitmap indicates
375 support for IEEE 802.11n
376
377*******************************************************************************/
378typedef struct
379{
380 CsrWifiSmeApPhySupportMask phySupportedBitmap;
381 u16 beaconInterval;
382 u8 dtimPeriod;
383 u16 maxListenInterval;
384 u8 supportedRatesCount;
385 u8 supportedRates[20];
386 CsrWifiSmePreambleType preamble;
387 u8 shortSlotTimeEnabled;
388 CsrWifiSmeCtsProtectionType ctsProtectionType;
389 u8 wmmEnabled;
390 CsrWifiSmeWmmAcParams wmmApParams[4];
391 CsrWifiSmeWmmAcParams wmmApBcParams[4];
392 CsrWifiSmeApAccessType accessType;
393 u8 macAddressListCount;
394 CsrWifiMacAddress *macAddressList;
395 CsrWifiSmeApHtParams apHtParams;
396} CsrWifiSmeApMacConfig;
397
398/*******************************************************************************
399
400 NAME
401 CsrWifiSmeApP2pGoConfig
402
403 DESCRIPTION
404
405 MEMBERS
406 groupCapability - Indicates the P2P group capabilities
407 operatingChanList - List of operating channels in the order of
408 decreasing priority. It may contain channel
409 entry/entries not supported by the wifi stack.
410 These shall be filtered out by the wifi stack
411 opPsEnabled - Indicates whether opportunistic power save can
412 be used.
413 Note: This parameter is ignored by the WiFi
414 stack for the current release
415 ctWindow - Define Client Traffic window to be used in terms
416 of number of TUs. Range: 0 to 127.
417 Note: This parameter is ignored by the WiFi
418 stack for the current release.
419 noaConfigMethod - Notice of Absence configuration method.
420 Note: This parameter is ignored by the WiFi
421 stack for the current release.
422 allowNoaWithNonP2pDevices - Indicates if NOA should be allowed if non P2P
423 devices are connected. If allowed the non P2P
424 devices may suffer in throughput.
425 Note: This parameter is ignored by the WiFi
426 stack for the current release.
427
428*******************************************************************************/
429typedef struct
430{
431 CsrWifiSmeP2pGroupCapabilityMask groupCapability;
432 CsrWifiSmeApP2pOperatingChanList operatingChanList;
433 u8 opPsEnabled;
434 u8 ctWindow;
435 CsrWifiSmeP2pNoaConfigMethod noaConfigMethod;
436 u8 allowNoaWithNonP2pDevices;
437} CsrWifiSmeApP2pGoConfig;
438
439/*******************************************************************************
440
441 NAME
442 CsrWifiSmeApCredentials
443
444 DESCRIPTION
445
446 MEMBERS
447 authType -
448 smeAuthType -
449 smeAuthTypeopenSystemEmpty -
450 smeAuthTypeauthwep -
451 smeAuthTypeauthPers -
452
453*******************************************************************************/
454typedef struct
455{
456 CsrWifiSmeApAuthType authType;
457 union {
458 CsrWifiSmeEmpty openSystemEmpty;
459 CsrWifiSmeWepAuth authwep;
460 CsrWifiSmeApAuthPers authPers;
461 } smeAuthType;
462} CsrWifiSmeApCredentials;
463
464/*******************************************************************************
465
466 NAME
467 CsrWifiSmeApSecConfig
468
469 DESCRIPTION
470
471 MEMBERS
472 apCredentials -
473 wpsEnabled -
474
475*******************************************************************************/
476typedef struct
477{
478 CsrWifiSmeApCredentials apCredentials;
479 u8 wpsEnabled;
480} CsrWifiSmeApSecConfig;
481
482
483/* Downstream */
484#define CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST (0x0000)
485
486#define CSR_WIFI_SME_AP_BEACONING_START_REQ ((CsrWifiSmeApPrim) (0x0000 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST))
487#define CSR_WIFI_SME_AP_BEACONING_STOP_REQ ((CsrWifiSmeApPrim) (0x0001 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST))
488#define CSR_WIFI_SME_AP_WPS_REGISTRATION_STARTED_REQ ((CsrWifiSmeApPrim) (0x0002 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST))
489#define CSR_WIFI_SME_AP_WPS_REGISTRATION_FINISHED_REQ ((CsrWifiSmeApPrim) (0x0003 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST))
490#define CSR_WIFI_SME_AP_WMM_PARAM_UPDATE_REQ ((CsrWifiSmeApPrim) (0x0004 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST))
491#define CSR_WIFI_SME_AP_STA_DISCONNECT_REQ ((CsrWifiSmeApPrim) (0x0005 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST))
492#define CSR_WIFI_SME_AP_WPS_CONFIGURATION_REQ ((CsrWifiSmeApPrim) (0x0006 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST))
493#define CSR_WIFI_SME_AP_ACTIVE_BA_GET_REQ ((CsrWifiSmeApPrim) (0x0007 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST))
494#define CSR_WIFI_SME_AP_BA_DELETE_REQ ((CsrWifiSmeApPrim) (0x0008 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST))
495
496
497#define CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_HIGHEST (0x0008 + CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)
498
499/* Upstream */
500#define CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM)
501
502#define CSR_WIFI_SME_AP_BEACONING_START_CFM ((CsrWifiSmeApPrim)(0x0000 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST))
503#define CSR_WIFI_SME_AP_BEACONING_STOP_CFM ((CsrWifiSmeApPrim)(0x0001 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST))
504#define CSR_WIFI_SME_AP_STA_NOTIFY_IND ((CsrWifiSmeApPrim)(0x0002 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST))
505#define CSR_WIFI_SME_AP_STA_CONNECT_START_IND ((CsrWifiSmeApPrim)(0x0003 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST))
506#define CSR_WIFI_SME_AP_WPS_REGISTRATION_STARTED_CFM ((CsrWifiSmeApPrim)(0x0004 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST))
507#define CSR_WIFI_SME_AP_WPS_REGISTRATION_FINISHED_CFM ((CsrWifiSmeApPrim)(0x0005 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST))
508#define CSR_WIFI_SME_AP_WMM_PARAM_UPDATE_CFM ((CsrWifiSmeApPrim)(0x0006 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST))
509#define CSR_WIFI_SME_AP_STA_DISCONNECT_CFM ((CsrWifiSmeApPrim)(0x0007 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST))
510#define CSR_WIFI_SME_AP_WPS_CONFIGURATION_CFM ((CsrWifiSmeApPrim)(0x0008 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST))
511#define CSR_WIFI_SME_AP_ERROR_IND ((CsrWifiSmeApPrim)(0x0009 + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST))
512#define CSR_WIFI_SME_AP_ACTIVE_BA_GET_CFM ((CsrWifiSmeApPrim)(0x000A + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST))
513#define CSR_WIFI_SME_AP_BA_DELETE_CFM ((CsrWifiSmeApPrim)(0x000B + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST))
514
515#define CSR_WIFI_SME_AP_PRIM_UPSTREAM_HIGHEST (0x000B + CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)
516
517#define CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_COUNT (CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_HIGHEST + 1 - CSR_WIFI_SME_AP_PRIM_DOWNSTREAM_LOWEST)
518#define CSR_WIFI_SME_AP_PRIM_UPSTREAM_COUNT (CSR_WIFI_SME_AP_PRIM_UPSTREAM_HIGHEST + 1 - CSR_WIFI_SME_AP_PRIM_UPSTREAM_LOWEST)
519
520/*******************************************************************************
521
522 NAME
523 CsrWifiSmeApBeaconingStartReq
524
525 DESCRIPTION
526 This primitive requests the SME to start AP or GO functionality
527
528 MEMBERS
529 common - Common header for use with the CsrWifiFsm Module
530 interfaceTag -
531 initialPresence - Set to 0, if Not in a group fomration phase, set to 1 ,
532 during group formation phase
533 apType - apType : Legacy AP or P2PGO
534 cloakSsid - cloakSsid flag.
535 ssid - ssid.
536 ifIndex - Radio Interface
537 channel - channel.
538 maxConnections - Maximum Stations + P2PClients allowed
539 apCredentials - AP security credeitals used to advertise in beacon /probe
540 response
541 smeApConfig - AP configuration
542 p2pGoParam - P2P specific GO parameters. Ignored if it is a leagacy AP
543
544*******************************************************************************/
545typedef struct
546{
547 CsrWifiFsmEvent common;
548 u16 interfaceTag;
549 u8 initialPresence;
550 CsrWifiSmeApType apType;
551 u8 cloakSsid;
552 CsrWifiSsid ssid;
553 CsrWifiSmeRadioIF ifIndex;
554 u8 channel;
555 u8 maxConnections;
556 CsrWifiSmeApSecConfig apCredentials;
557 CsrWifiSmeApMacConfig smeApConfig;
558 CsrWifiSmeApP2pGoConfig p2pGoParam;
559} CsrWifiSmeApBeaconingStartReq;
560
561/*******************************************************************************
562
563 NAME
564 CsrWifiSmeApBeaconingStopReq
565
566 DESCRIPTION
567 This primitive requests the SME to STOP AP or P2PGO operation
568
569 MEMBERS
570 common - Common header for use with the CsrWifiFsm Module
571 interfaceTag -
572
573*******************************************************************************/
574typedef struct
575{
576 CsrWifiFsmEvent common;
577 u16 interfaceTag;
578} CsrWifiSmeApBeaconingStopReq;
579
580/*******************************************************************************
581
582 NAME
583 CsrWifiSmeApWpsRegistrationStartedReq
584
585 DESCRIPTION
586 This primitive tells SME that WPS registration procedure has started
587
588 MEMBERS
589 common - Common header for use with the CsrWifiFsm Module
590 interfaceTag -
591 SelectedDevicePasswordId -
592 SelectedconfigMethod -
593
594*******************************************************************************/
595typedef struct
596{
597 CsrWifiFsmEvent common;
598 u16 interfaceTag;
599 CsrWifiSmeWpsDpid SelectedDevicePasswordId;
600 CsrWifiSmeWpsConfigType SelectedconfigMethod;
601} CsrWifiSmeApWpsRegistrationStartedReq;
602
603/*******************************************************************************
604
605 NAME
606 CsrWifiSmeApWpsRegistrationFinishedReq
607
608 DESCRIPTION
609 This primitive tells SME that WPS registration procedure has finished
610
611 MEMBERS
612 common - Common header for use with the CsrWifiFsm Module
613 interfaceTag -
614
615*******************************************************************************/
616typedef struct
617{
618 CsrWifiFsmEvent common;
619 u16 interfaceTag;
620} CsrWifiSmeApWpsRegistrationFinishedReq;
621
622/*******************************************************************************
623
624 NAME
625 CsrWifiSmeApWmmParamUpdateReq
626
627 DESCRIPTION
628 Application uses this primitive to update the WMM parameters on the fly
629
630 MEMBERS
631 common - Common header for use with the CsrWifiFsm Module
632 interfaceTag -
633 wmmApParams - WMM parameters to be used for local firmware queue
634 configuration
635 wmmApBcParams - WMM parameters to be advertised in beacon/probe response
636
637*******************************************************************************/
638typedef struct
639{
640 CsrWifiFsmEvent common;
641 u16 interfaceTag;
642 CsrWifiSmeWmmAcParams wmmApParams[4];
643 CsrWifiSmeWmmAcParams wmmApBcParams[4];
644} CsrWifiSmeApWmmParamUpdateReq;
645
646/*******************************************************************************
647
648 NAME
649 CsrWifiSmeApStaDisconnectReq
650
651 DESCRIPTION
652 This primitive tells SME to deauth ot disassociate a particular station
653 within BSS
654
655 MEMBERS
656 common - Common header for use with the CsrWifiFsm Module
657 interfaceTag -
658 deauthReason -
659 disassocReason -
660 peerMacaddress -
661 keepBlocking - If TRUE, the station is blocked. If FALSE and the station
662 is connected, disconnect the station. If FALSE and the
663 station is not connected, no action is taken.
664
665*******************************************************************************/
666typedef struct
667{
668 CsrWifiFsmEvent common;
669 u16 interfaceTag;
670 CsrWifiSmeIEEE80211Reason deauthReason;
671 CsrWifiSmeIEEE80211Reason disassocReason;
672 CsrWifiMacAddress peerMacaddress;
673 u8 keepBlocking;
674} CsrWifiSmeApStaDisconnectReq;
675
676/*******************************************************************************
677
678 NAME
679 CsrWifiSmeApWpsConfigurationReq
680
681 DESCRIPTION
682 This primitive passes the WPS information for the device to SME. This may
683 be accepted only if no interface is active.
684
685 MEMBERS
686 common - Common header for use with the CsrWifiFsm Module
687 wpsConfig - WPS config.
688
689*******************************************************************************/
690typedef struct
691{
692 CsrWifiFsmEvent common;
693 CsrWifiSmeWpsConfig wpsConfig;
694} CsrWifiSmeApWpsConfigurationReq;
695
696/*******************************************************************************
697
698 NAME
699 CsrWifiSmeApActiveBaGetReq
700
701 DESCRIPTION
702 This primitive used to retrieve information related to the active block
703 ack sessions
704
705 MEMBERS
706 common - Common header for use with the CsrWifiFsm Module
707 interfaceTag -
708
709*******************************************************************************/
710typedef struct
711{
712 CsrWifiFsmEvent common;
713 u16 interfaceTag;
714} CsrWifiSmeApActiveBaGetReq;
715
716/*******************************************************************************
717
718 NAME
719 CsrWifiSmeApBaDeleteReq
720
721 DESCRIPTION
722 This primitive is used to delete an active block ack session
723
724 MEMBERS
725 common - Common header for use with the CsrWifiFsm Module
726 interfaceTag -
727 reason -
728 baSession - BA session to be deleted
729
730*******************************************************************************/
731typedef struct
732{
733 CsrWifiFsmEvent common;
734 u16 interfaceTag;
735 CsrWifiSmeIEEE80211Reason reason;
736 CsrWifiSmeApBaSession baSession;
737} CsrWifiSmeApBaDeleteReq;
738
739/*******************************************************************************
740
741 NAME
742 CsrWifiSmeApBeaconingStartCfm
743
744 DESCRIPTION
745 This primitive confirms the completion of the request along with the
746 status
747
748 MEMBERS
749 common - Common header for use with the CsrWifiFsm Module
750 interfaceTag -
751 status -
752 secIeLength -
753 secIe -
754
755*******************************************************************************/
756typedef struct
757{
758 CsrWifiFsmEvent common;
759 u16 interfaceTag;
760 CsrResult status;
761 u16 secIeLength;
762 u8 *secIe;
763} CsrWifiSmeApBeaconingStartCfm;
764
765/*******************************************************************************
766
767 NAME
768 CsrWifiSmeApBeaconingStopCfm
769
770 DESCRIPTION
771 This primitive confirms AP or P2PGO operation is terminated
772
773 MEMBERS
774 common - Common header for use with the CsrWifiFsm Module
775 interfaceTag -
776 status -
777
778*******************************************************************************/
779typedef struct
780{
781 CsrWifiFsmEvent common;
782 u16 interfaceTag;
783 CsrResult status;
784} CsrWifiSmeApBeaconingStopCfm;
785
786/*******************************************************************************
787
788 NAME
789 CsrWifiSmeApStaNotifyInd
790
791 DESCRIPTION
792 This primitive indicates that a station has joined or a previously joined
793 station has left the BSS/group
794
795 MEMBERS
796 common - Common header for use with the CsrWifiFsm Module
797 interfaceTag -
798 mediaStatus -
799 peerMacAddress -
800 peerDeviceAddress -
801 disassocReason -
802 deauthReason -
803 WpsRegistration -
804 secIeLength -
805 secIe -
806 groupKeyId -
807 seqNumber -
808
809*******************************************************************************/
810typedef struct
811{
812 CsrWifiFsmEvent common;
813 u16 interfaceTag;
814 CsrWifiSmeMediaStatus mediaStatus;
815 CsrWifiMacAddress peerMacAddress;
816 CsrWifiMacAddress peerDeviceAddress;
817 CsrWifiSmeIEEE80211Reason disassocReason;
818 CsrWifiSmeIEEE80211Reason deauthReason;
819 CsrWifiSmeWpsRegistration WpsRegistration;
820 u8 secIeLength;
821 u8 *secIe;
822 u8 groupKeyId;
823 u16 seqNumber[8];
824} CsrWifiSmeApStaNotifyInd;
825
826/*******************************************************************************
827
828 NAME
829 CsrWifiSmeApStaConnectStartInd
830
831 DESCRIPTION
832 This primitive indicates that a stations request to join the group/BSS is
833 accepted
834
835 MEMBERS
836 common - Common header for use with the CsrWifiFsm Module
837 interfaceTag -
838 peerMacAddress -
839
840*******************************************************************************/
841typedef struct
842{
843 CsrWifiFsmEvent common;
844 u16 interfaceTag;
845 CsrWifiMacAddress peerMacAddress;
846} CsrWifiSmeApStaConnectStartInd;
847
848/*******************************************************************************
849
850 NAME
851 CsrWifiSmeApWpsRegistrationStartedCfm
852
853 DESCRIPTION
854 A confirm for UNIFI_MGT_AP_WPS_REGISTRATION_STARTED.request
855
856 MEMBERS
857 common - Common header for use with the CsrWifiFsm Module
858 interfaceTag -
859 status -
860
861*******************************************************************************/
862typedef struct
863{
864 CsrWifiFsmEvent common;
865 u16 interfaceTag;
866 CsrResult status;
867} CsrWifiSmeApWpsRegistrationStartedCfm;
868
869/*******************************************************************************
870
871 NAME
872 CsrWifiSmeApWpsRegistrationFinishedCfm
873
874 DESCRIPTION
875 A confirm for UNIFI_MGT_AP_WPS_REGISTRATION_FINISHED.request
876
877 MEMBERS
878 common - Common header for use with the CsrWifiFsm Module
879 interfaceTag -
880 status -
881
882*******************************************************************************/
883typedef struct
884{
885 CsrWifiFsmEvent common;
886 u16 interfaceTag;
887 CsrResult status;
888} CsrWifiSmeApWpsRegistrationFinishedCfm;
889
890/*******************************************************************************
891
892 NAME
893 CsrWifiSmeApWmmParamUpdateCfm
894
895 DESCRIPTION
896 A confirm for CSR_WIFI_SME_AP_WMM_PARAM_UPDATE.request
897
898 MEMBERS
899 common - Common header for use with the CsrWifiFsm Module
900 interfaceTag -
901 status -
902
903*******************************************************************************/
904typedef struct
905{
906 CsrWifiFsmEvent common;
907 u16 interfaceTag;
908 CsrResult status;
909} CsrWifiSmeApWmmParamUpdateCfm;
910
911/*******************************************************************************
912
913 NAME
914 CsrWifiSmeApStaDisconnectCfm
915
916 DESCRIPTION
917 This primitive confirms the station is disconnected
918
919 MEMBERS
920 common - Common header for use with the CsrWifiFsm Module
921 interfaceTag -
922 status -
923 peerMacaddress -
924
925*******************************************************************************/
926typedef struct
927{
928 CsrWifiFsmEvent common;
929 u16 interfaceTag;
930 CsrResult status;
931 CsrWifiMacAddress peerMacaddress;
932} CsrWifiSmeApStaDisconnectCfm;
933
934/*******************************************************************************
935
936 NAME
937 CsrWifiSmeApWpsConfigurationCfm
938
939 DESCRIPTION
940 Confirm.
941
942 MEMBERS
943 common - Common header for use with the CsrWifiFsm Module
944 status - Status of the request.
945
946*******************************************************************************/
947typedef struct
948{
949 CsrWifiFsmEvent common;
950 CsrResult status;
951} CsrWifiSmeApWpsConfigurationCfm;
952
953/*******************************************************************************
954
955 NAME
956 CsrWifiSmeApErrorInd
957
958 DESCRIPTION
959 This primitve is sent by SME to indicate some error in AP operationi
960 after AP operations were started successfully and continuing the AP
961 operation may lead to undesired behaviour. It is the responsibility of
962 the upper layers to stop AP operation if needed
963
964 MEMBERS
965 common - Common header for use with the CsrWifiFsm Module
966 interfaceTag - Range 0-1
967 apType -
968 status - Contains the error status
969
970*******************************************************************************/
971typedef struct
972{
973 CsrWifiFsmEvent common;
974 u16 interfaceTag;
975 CsrWifiSmeApType apType;
976 CsrResult status;
977} CsrWifiSmeApErrorInd;
978
979/*******************************************************************************
980
981 NAME
982 CsrWifiSmeApActiveBaGetCfm
983
984 DESCRIPTION
985 This primitive carries the information related to the active ba sessions
986
987 MEMBERS
988 common - Common header for use with the CsrWifiFsm Module
989 interfaceTag -
990 status - Reports the result of the request
991 activeBaCount - Number of active block ack session
992 activeBaSessions - Points to a buffer containing an array of
993 CsrWifiSmeApBaSession structures.
994
995*******************************************************************************/
996typedef struct
997{
998 CsrWifiFsmEvent common;
999 u16 interfaceTag;
1000 CsrResult status;
1001 u16 activeBaCount;
1002 CsrWifiSmeApBaSession *activeBaSessions;
1003} CsrWifiSmeApActiveBaGetCfm;
1004
1005/*******************************************************************************
1006
1007 NAME
1008 CsrWifiSmeApBaDeleteCfm
1009
1010 DESCRIPTION
1011 This primitive confirms the BA is deleted
1012
1013 MEMBERS
1014 common - Common header for use with the CsrWifiFsm Module
1015 interfaceTag -
1016 status - Reports the result of the request
1017 baSession - deleted BA session
1018
1019*******************************************************************************/
1020typedef struct
1021{
1022 CsrWifiFsmEvent common;
1023 u16 interfaceTag;
1024 CsrResult status;
1025 CsrWifiSmeApBaSession baSession;
1026} CsrWifiSmeApBaDeleteCfm;
1027
1028
1029#endif /* CSR_WIFI_SME_AP_PRIM_H__ */
1030
diff --git a/drivers/staging/csr/csr_wifi_sme_converter_init.c b/drivers/staging/csr/csr_wifi_sme_converter_init.c
deleted file mode 100644
index 31835f06bbc2..000000000000
--- a/drivers/staging/csr/csr_wifi_sme_converter_init.c
+++ /dev/null
@@ -1,201 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#include "csr_msgconv.h"
14#include "csr_macro.h"
15
16
17#ifdef CSR_LOG_ENABLE
18#include "csr_log.h"
19#endif
20
21#ifndef EXCLUDE_CSR_WIFI_SME_MODULE
22#include "csr_wifi_sme_serialize.h"
23#include "csr_wifi_sme_prim.h"
24
25static CsrMsgConvMsgEntry csrwifisme_conv_lut[] = {
26 { CSR_WIFI_SME_ACTIVATE_REQ, CsrWifiSmeActivateReqSizeof, CsrWifiSmeActivateReqSer, CsrWifiSmeActivateReqDes, CsrWifiSmeActivateReqSerFree },
27 { CSR_WIFI_SME_ADHOC_CONFIG_GET_REQ, CsrWifiSmeAdhocConfigGetReqSizeof, CsrWifiSmeAdhocConfigGetReqSer, CsrWifiSmeAdhocConfigGetReqDes, CsrWifiSmeAdhocConfigGetReqSerFree },
28 { CSR_WIFI_SME_ADHOC_CONFIG_SET_REQ, CsrWifiSmeAdhocConfigSetReqSizeof, CsrWifiSmeAdhocConfigSetReqSer, CsrWifiSmeAdhocConfigSetReqDes, CsrWifiSmeAdhocConfigSetReqSerFree },
29 { CSR_WIFI_SME_BLACKLIST_REQ, CsrWifiSmeBlacklistReqSizeof, CsrWifiSmeBlacklistReqSer, CsrWifiSmeBlacklistReqDes, CsrWifiSmeBlacklistReqSerFree },
30 { CSR_WIFI_SME_CALIBRATION_DATA_GET_REQ, CsrWifiSmeCalibrationDataGetReqSizeof, CsrWifiSmeCalibrationDataGetReqSer, CsrWifiSmeCalibrationDataGetReqDes, CsrWifiSmeCalibrationDataGetReqSerFree },
31 { CSR_WIFI_SME_CALIBRATION_DATA_SET_REQ, CsrWifiSmeCalibrationDataSetReqSizeof, CsrWifiSmeCalibrationDataSetReqSer, CsrWifiSmeCalibrationDataSetReqDes, CsrWifiSmeCalibrationDataSetReqSerFree },
32 { CSR_WIFI_SME_CCX_CONFIG_GET_REQ, CsrWifiSmeCcxConfigGetReqSizeof, CsrWifiSmeCcxConfigGetReqSer, CsrWifiSmeCcxConfigGetReqDes, CsrWifiSmeCcxConfigGetReqSerFree },
33 { CSR_WIFI_SME_CCX_CONFIG_SET_REQ, CsrWifiSmeCcxConfigSetReqSizeof, CsrWifiSmeCcxConfigSetReqSer, CsrWifiSmeCcxConfigSetReqDes, CsrWifiSmeCcxConfigSetReqSerFree },
34 { CSR_WIFI_SME_COEX_CONFIG_GET_REQ, CsrWifiSmeCoexConfigGetReqSizeof, CsrWifiSmeCoexConfigGetReqSer, CsrWifiSmeCoexConfigGetReqDes, CsrWifiSmeCoexConfigGetReqSerFree },
35 { CSR_WIFI_SME_COEX_CONFIG_SET_REQ, CsrWifiSmeCoexConfigSetReqSizeof, CsrWifiSmeCoexConfigSetReqSer, CsrWifiSmeCoexConfigSetReqDes, CsrWifiSmeCoexConfigSetReqSerFree },
36 { CSR_WIFI_SME_COEX_INFO_GET_REQ, CsrWifiSmeCoexInfoGetReqSizeof, CsrWifiSmeCoexInfoGetReqSer, CsrWifiSmeCoexInfoGetReqDes, CsrWifiSmeCoexInfoGetReqSerFree },
37 { CSR_WIFI_SME_CONNECT_REQ, CsrWifiSmeConnectReqSizeof, CsrWifiSmeConnectReqSer, CsrWifiSmeConnectReqDes, CsrWifiSmeConnectReqSerFree },
38 { CSR_WIFI_SME_CONNECTION_CONFIG_GET_REQ, CsrWifiSmeConnectionConfigGetReqSizeof, CsrWifiSmeConnectionConfigGetReqSer, CsrWifiSmeConnectionConfigGetReqDes, CsrWifiSmeConnectionConfigGetReqSerFree },
39 { CSR_WIFI_SME_CONNECTION_INFO_GET_REQ, CsrWifiSmeConnectionInfoGetReqSizeof, CsrWifiSmeConnectionInfoGetReqSer, CsrWifiSmeConnectionInfoGetReqDes, CsrWifiSmeConnectionInfoGetReqSerFree },
40 { CSR_WIFI_SME_CONNECTION_STATS_GET_REQ, CsrWifiSmeConnectionStatsGetReqSizeof, CsrWifiSmeConnectionStatsGetReqSer, CsrWifiSmeConnectionStatsGetReqDes, CsrWifiSmeConnectionStatsGetReqSerFree },
41 { CSR_WIFI_SME_DEACTIVATE_REQ, CsrWifiSmeDeactivateReqSizeof, CsrWifiSmeDeactivateReqSer, CsrWifiSmeDeactivateReqDes, CsrWifiSmeDeactivateReqSerFree },
42 { CSR_WIFI_SME_DISCONNECT_REQ, CsrWifiSmeDisconnectReqSizeof, CsrWifiSmeDisconnectReqSer, CsrWifiSmeDisconnectReqDes, CsrWifiSmeDisconnectReqSerFree },
43 { CSR_WIFI_SME_EVENT_MASK_SET_REQ, CsrWifiSmeEventMaskSetReqSizeof, CsrWifiSmeEventMaskSetReqSer, CsrWifiSmeEventMaskSetReqDes, CsrWifiSmeEventMaskSetReqSerFree },
44 { CSR_WIFI_SME_HOST_CONFIG_GET_REQ, CsrWifiSmeHostConfigGetReqSizeof, CsrWifiSmeHostConfigGetReqSer, CsrWifiSmeHostConfigGetReqDes, CsrWifiSmeHostConfigGetReqSerFree },
45 { CSR_WIFI_SME_HOST_CONFIG_SET_REQ, CsrWifiSmeHostConfigSetReqSizeof, CsrWifiSmeHostConfigSetReqSer, CsrWifiSmeHostConfigSetReqDes, CsrWifiSmeHostConfigSetReqSerFree },
46 { CSR_WIFI_SME_KEY_REQ, CsrWifiSmeKeyReqSizeof, CsrWifiSmeKeyReqSer, CsrWifiSmeKeyReqDes, CsrWifiSmeKeyReqSerFree },
47 { CSR_WIFI_SME_LINK_QUALITY_GET_REQ, CsrWifiSmeLinkQualityGetReqSizeof, CsrWifiSmeLinkQualityGetReqSer, CsrWifiSmeLinkQualityGetReqDes, CsrWifiSmeLinkQualityGetReqSerFree },
48 { CSR_WIFI_SME_MIB_CONFIG_GET_REQ, CsrWifiSmeMibConfigGetReqSizeof, CsrWifiSmeMibConfigGetReqSer, CsrWifiSmeMibConfigGetReqDes, CsrWifiSmeMibConfigGetReqSerFree },
49 { CSR_WIFI_SME_MIB_CONFIG_SET_REQ, CsrWifiSmeMibConfigSetReqSizeof, CsrWifiSmeMibConfigSetReqSer, CsrWifiSmeMibConfigSetReqDes, CsrWifiSmeMibConfigSetReqSerFree },
50 { CSR_WIFI_SME_MIB_GET_NEXT_REQ, CsrWifiSmeMibGetNextReqSizeof, CsrWifiSmeMibGetNextReqSer, CsrWifiSmeMibGetNextReqDes, CsrWifiSmeMibGetNextReqSerFree },
51 { CSR_WIFI_SME_MIB_GET_REQ, CsrWifiSmeMibGetReqSizeof, CsrWifiSmeMibGetReqSer, CsrWifiSmeMibGetReqDes, CsrWifiSmeMibGetReqSerFree },
52 { CSR_WIFI_SME_MIB_SET_REQ, CsrWifiSmeMibSetReqSizeof, CsrWifiSmeMibSetReqSer, CsrWifiSmeMibSetReqDes, CsrWifiSmeMibSetReqSerFree },
53 { CSR_WIFI_SME_MULTICAST_ADDRESS_REQ, CsrWifiSmeMulticastAddressReqSizeof, CsrWifiSmeMulticastAddressReqSer, CsrWifiSmeMulticastAddressReqDes, CsrWifiSmeMulticastAddressReqSerFree },
54 { CSR_WIFI_SME_PACKET_FILTER_SET_REQ, CsrWifiSmePacketFilterSetReqSizeof, CsrWifiSmePacketFilterSetReqSer, CsrWifiSmePacketFilterSetReqDes, CsrWifiSmePacketFilterSetReqSerFree },
55 { CSR_WIFI_SME_PERMANENT_MAC_ADDRESS_GET_REQ, CsrWifiSmePermanentMacAddressGetReqSizeof, CsrWifiSmePermanentMacAddressGetReqSer, CsrWifiSmePermanentMacAddressGetReqDes, CsrWifiSmePermanentMacAddressGetReqSerFree },
56 { CSR_WIFI_SME_PMKID_REQ, CsrWifiSmePmkidReqSizeof, CsrWifiSmePmkidReqSer, CsrWifiSmePmkidReqDes, CsrWifiSmePmkidReqSerFree },
57 { CSR_WIFI_SME_POWER_CONFIG_GET_REQ, CsrWifiSmePowerConfigGetReqSizeof, CsrWifiSmePowerConfigGetReqSer, CsrWifiSmePowerConfigGetReqDes, CsrWifiSmePowerConfigGetReqSerFree },
58 { CSR_WIFI_SME_POWER_CONFIG_SET_REQ, CsrWifiSmePowerConfigSetReqSizeof, CsrWifiSmePowerConfigSetReqSer, CsrWifiSmePowerConfigSetReqDes, CsrWifiSmePowerConfigSetReqSerFree },
59 { CSR_WIFI_SME_REGULATORY_DOMAIN_INFO_GET_REQ, CsrWifiSmeRegulatoryDomainInfoGetReqSizeof, CsrWifiSmeRegulatoryDomainInfoGetReqSer, CsrWifiSmeRegulatoryDomainInfoGetReqDes, CsrWifiSmeRegulatoryDomainInfoGetReqSerFree },
60 { CSR_WIFI_SME_ROAMING_CONFIG_GET_REQ, CsrWifiSmeRoamingConfigGetReqSizeof, CsrWifiSmeRoamingConfigGetReqSer, CsrWifiSmeRoamingConfigGetReqDes, CsrWifiSmeRoamingConfigGetReqSerFree },
61 { CSR_WIFI_SME_ROAMING_CONFIG_SET_REQ, CsrWifiSmeRoamingConfigSetReqSizeof, CsrWifiSmeRoamingConfigSetReqSer, CsrWifiSmeRoamingConfigSetReqDes, CsrWifiSmeRoamingConfigSetReqSerFree },
62 { CSR_WIFI_SME_SCAN_CONFIG_GET_REQ, CsrWifiSmeScanConfigGetReqSizeof, CsrWifiSmeScanConfigGetReqSer, CsrWifiSmeScanConfigGetReqDes, CsrWifiSmeScanConfigGetReqSerFree },
63 { CSR_WIFI_SME_SCAN_CONFIG_SET_REQ, CsrWifiSmeScanConfigSetReqSizeof, CsrWifiSmeScanConfigSetReqSer, CsrWifiSmeScanConfigSetReqDes, CsrWifiSmeScanConfigSetReqSerFree },
64 { CSR_WIFI_SME_SCAN_FULL_REQ, CsrWifiSmeScanFullReqSizeof, CsrWifiSmeScanFullReqSer, CsrWifiSmeScanFullReqDes, CsrWifiSmeScanFullReqSerFree },
65 { CSR_WIFI_SME_SCAN_RESULTS_FLUSH_REQ, CsrWifiSmeScanResultsFlushReqSizeof, CsrWifiSmeScanResultsFlushReqSer, CsrWifiSmeScanResultsFlushReqDes, CsrWifiSmeScanResultsFlushReqSerFree },
66 { CSR_WIFI_SME_SCAN_RESULTS_GET_REQ, CsrWifiSmeScanResultsGetReqSizeof, CsrWifiSmeScanResultsGetReqSer, CsrWifiSmeScanResultsGetReqDes, CsrWifiSmeScanResultsGetReqSerFree },
67 { CSR_WIFI_SME_SME_STA_CONFIG_GET_REQ, CsrWifiSmeSmeStaConfigGetReqSizeof, CsrWifiSmeSmeStaConfigGetReqSer, CsrWifiSmeSmeStaConfigGetReqDes, CsrWifiSmeSmeStaConfigGetReqSerFree },
68 { CSR_WIFI_SME_SME_STA_CONFIG_SET_REQ, CsrWifiSmeSmeStaConfigSetReqSizeof, CsrWifiSmeSmeStaConfigSetReqSer, CsrWifiSmeSmeStaConfigSetReqDes, CsrWifiSmeSmeStaConfigSetReqSerFree },
69 { CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_REQ, CsrWifiSmeStationMacAddressGetReqSizeof, CsrWifiSmeStationMacAddressGetReqSer, CsrWifiSmeStationMacAddressGetReqDes, CsrWifiSmeStationMacAddressGetReqSerFree },
70 { CSR_WIFI_SME_TSPEC_REQ, CsrWifiSmeTspecReqSizeof, CsrWifiSmeTspecReqSer, CsrWifiSmeTspecReqDes, CsrWifiSmeTspecReqSerFree },
71 { CSR_WIFI_SME_VERSIONS_GET_REQ, CsrWifiSmeVersionsGetReqSizeof, CsrWifiSmeVersionsGetReqSer, CsrWifiSmeVersionsGetReqDes, CsrWifiSmeVersionsGetReqSerFree },
72 { CSR_WIFI_SME_WIFI_FLIGHTMODE_REQ, CsrWifiSmeWifiFlightmodeReqSizeof, CsrWifiSmeWifiFlightmodeReqSer, CsrWifiSmeWifiFlightmodeReqDes, CsrWifiSmeWifiFlightmodeReqSerFree },
73 { CSR_WIFI_SME_WIFI_OFF_REQ, CsrWifiSmeWifiOffReqSizeof, CsrWifiSmeWifiOffReqSer, CsrWifiSmeWifiOffReqDes, CsrWifiSmeWifiOffReqSerFree },
74 { CSR_WIFI_SME_WIFI_ON_REQ, CsrWifiSmeWifiOnReqSizeof, CsrWifiSmeWifiOnReqSer, CsrWifiSmeWifiOnReqDes, CsrWifiSmeWifiOnReqSerFree },
75 { CSR_WIFI_SME_CLOAKED_SSIDS_SET_REQ, CsrWifiSmeCloakedSsidsSetReqSizeof, CsrWifiSmeCloakedSsidsSetReqSer, CsrWifiSmeCloakedSsidsSetReqDes, CsrWifiSmeCloakedSsidsSetReqSerFree },
76 { CSR_WIFI_SME_CLOAKED_SSIDS_GET_REQ, CsrWifiSmeCloakedSsidsGetReqSizeof, CsrWifiSmeCloakedSsidsGetReqSer, CsrWifiSmeCloakedSsidsGetReqDes, CsrWifiSmeCloakedSsidsGetReqSerFree },
77 { CSR_WIFI_SME_SME_COMMON_CONFIG_GET_REQ, CsrWifiSmeSmeCommonConfigGetReqSizeof, CsrWifiSmeSmeCommonConfigGetReqSer, CsrWifiSmeSmeCommonConfigGetReqDes, CsrWifiSmeSmeCommonConfigGetReqSerFree },
78 { CSR_WIFI_SME_SME_COMMON_CONFIG_SET_REQ, CsrWifiSmeSmeCommonConfigSetReqSizeof, CsrWifiSmeSmeCommonConfigSetReqSer, CsrWifiSmeSmeCommonConfigSetReqDes, CsrWifiSmeSmeCommonConfigSetReqSerFree },
79 { CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_REQ, CsrWifiSmeInterfaceCapabilityGetReqSizeof, CsrWifiSmeInterfaceCapabilityGetReqSer, CsrWifiSmeInterfaceCapabilityGetReqDes, CsrWifiSmeInterfaceCapabilityGetReqSerFree },
80 { CSR_WIFI_SME_WPS_CONFIGURATION_REQ, CsrWifiSmeWpsConfigurationReqSizeof, CsrWifiSmeWpsConfigurationReqSer, CsrWifiSmeWpsConfigurationReqDes, CsrWifiSmeWpsConfigurationReqSerFree },
81 { CSR_WIFI_SME_SET_REQ, CsrWifiSmeSetReqSizeof, CsrWifiSmeSetReqSer, CsrWifiSmeSetReqDes, CsrWifiSmeSetReqSerFree },
82 { CSR_WIFI_SME_ACTIVATE_CFM, CsrWifiSmeActivateCfmSizeof, CsrWifiSmeActivateCfmSer, CsrWifiSmeActivateCfmDes, CsrWifiSmeActivateCfmSerFree },
83 { CSR_WIFI_SME_ADHOC_CONFIG_GET_CFM, CsrWifiSmeAdhocConfigGetCfmSizeof, CsrWifiSmeAdhocConfigGetCfmSer, CsrWifiSmeAdhocConfigGetCfmDes, CsrWifiSmeAdhocConfigGetCfmSerFree },
84 { CSR_WIFI_SME_ADHOC_CONFIG_SET_CFM, CsrWifiSmeAdhocConfigSetCfmSizeof, CsrWifiSmeAdhocConfigSetCfmSer, CsrWifiSmeAdhocConfigSetCfmDes, CsrWifiSmeAdhocConfigSetCfmSerFree },
85 { CSR_WIFI_SME_ASSOCIATION_COMPLETE_IND, CsrWifiSmeAssociationCompleteIndSizeof, CsrWifiSmeAssociationCompleteIndSer, CsrWifiSmeAssociationCompleteIndDes, CsrWifiSmeAssociationCompleteIndSerFree },
86 { CSR_WIFI_SME_ASSOCIATION_START_IND, CsrWifiSmeAssociationStartIndSizeof, CsrWifiSmeAssociationStartIndSer, CsrWifiSmeAssociationStartIndDes, CsrWifiSmeAssociationStartIndSerFree },
87 { CSR_WIFI_SME_BLACKLIST_CFM, CsrWifiSmeBlacklistCfmSizeof, CsrWifiSmeBlacklistCfmSer, CsrWifiSmeBlacklistCfmDes, CsrWifiSmeBlacklistCfmSerFree },
88 { CSR_WIFI_SME_CALIBRATION_DATA_GET_CFM, CsrWifiSmeCalibrationDataGetCfmSizeof, CsrWifiSmeCalibrationDataGetCfmSer, CsrWifiSmeCalibrationDataGetCfmDes, CsrWifiSmeCalibrationDataGetCfmSerFree },
89 { CSR_WIFI_SME_CALIBRATION_DATA_SET_CFM, CsrWifiSmeCalibrationDataSetCfmSizeof, CsrWifiSmeCalibrationDataSetCfmSer, CsrWifiSmeCalibrationDataSetCfmDes, CsrWifiSmeCalibrationDataSetCfmSerFree },
90 { CSR_WIFI_SME_CCX_CONFIG_GET_CFM, CsrWifiSmeCcxConfigGetCfmSizeof, CsrWifiSmeCcxConfigGetCfmSer, CsrWifiSmeCcxConfigGetCfmDes, CsrWifiSmeCcxConfigGetCfmSerFree },
91 { CSR_WIFI_SME_CCX_CONFIG_SET_CFM, CsrWifiSmeCcxConfigSetCfmSizeof, CsrWifiSmeCcxConfigSetCfmSer, CsrWifiSmeCcxConfigSetCfmDes, CsrWifiSmeCcxConfigSetCfmSerFree },
92 { CSR_WIFI_SME_COEX_CONFIG_GET_CFM, CsrWifiSmeCoexConfigGetCfmSizeof, CsrWifiSmeCoexConfigGetCfmSer, CsrWifiSmeCoexConfigGetCfmDes, CsrWifiSmeCoexConfigGetCfmSerFree },
93 { CSR_WIFI_SME_COEX_CONFIG_SET_CFM, CsrWifiSmeCoexConfigSetCfmSizeof, CsrWifiSmeCoexConfigSetCfmSer, CsrWifiSmeCoexConfigSetCfmDes, CsrWifiSmeCoexConfigSetCfmSerFree },
94 { CSR_WIFI_SME_COEX_INFO_GET_CFM, CsrWifiSmeCoexInfoGetCfmSizeof, CsrWifiSmeCoexInfoGetCfmSer, CsrWifiSmeCoexInfoGetCfmDes, CsrWifiSmeCoexInfoGetCfmSerFree },
95 { CSR_WIFI_SME_CONNECT_CFM, CsrWifiSmeConnectCfmSizeof, CsrWifiSmeConnectCfmSer, CsrWifiSmeConnectCfmDes, CsrWifiSmeConnectCfmSerFree },
96 { CSR_WIFI_SME_CONNECTION_CONFIG_GET_CFM, CsrWifiSmeConnectionConfigGetCfmSizeof, CsrWifiSmeConnectionConfigGetCfmSer, CsrWifiSmeConnectionConfigGetCfmDes, CsrWifiSmeConnectionConfigGetCfmSerFree },
97 { CSR_WIFI_SME_CONNECTION_INFO_GET_CFM, CsrWifiSmeConnectionInfoGetCfmSizeof, CsrWifiSmeConnectionInfoGetCfmSer, CsrWifiSmeConnectionInfoGetCfmDes, CsrWifiSmeConnectionInfoGetCfmSerFree },
98 { CSR_WIFI_SME_CONNECTION_QUALITY_IND, CsrWifiSmeConnectionQualityIndSizeof, CsrWifiSmeConnectionQualityIndSer, CsrWifiSmeConnectionQualityIndDes, CsrWifiSmeConnectionQualityIndSerFree },
99 { CSR_WIFI_SME_CONNECTION_STATS_GET_CFM, CsrWifiSmeConnectionStatsGetCfmSizeof, CsrWifiSmeConnectionStatsGetCfmSer, CsrWifiSmeConnectionStatsGetCfmDes, CsrWifiSmeConnectionStatsGetCfmSerFree },
100 { CSR_WIFI_SME_DEACTIVATE_CFM, CsrWifiSmeDeactivateCfmSizeof, CsrWifiSmeDeactivateCfmSer, CsrWifiSmeDeactivateCfmDes, CsrWifiSmeDeactivateCfmSerFree },
101 { CSR_WIFI_SME_DISCONNECT_CFM, CsrWifiSmeDisconnectCfmSizeof, CsrWifiSmeDisconnectCfmSer, CsrWifiSmeDisconnectCfmDes, CsrWifiSmeDisconnectCfmSerFree },
102 { CSR_WIFI_SME_EVENT_MASK_SET_CFM, CsrWifiSmeEventMaskSetCfmSizeof, CsrWifiSmeEventMaskSetCfmSer, CsrWifiSmeEventMaskSetCfmDes, CsrWifiSmeEventMaskSetCfmSerFree },
103 { CSR_WIFI_SME_HOST_CONFIG_GET_CFM, CsrWifiSmeHostConfigGetCfmSizeof, CsrWifiSmeHostConfigGetCfmSer, CsrWifiSmeHostConfigGetCfmDes, CsrWifiSmeHostConfigGetCfmSerFree },
104 { CSR_WIFI_SME_HOST_CONFIG_SET_CFM, CsrWifiSmeHostConfigSetCfmSizeof, CsrWifiSmeHostConfigSetCfmSer, CsrWifiSmeHostConfigSetCfmDes, CsrWifiSmeHostConfigSetCfmSerFree },
105 { CSR_WIFI_SME_IBSS_STATION_IND, CsrWifiSmeIbssStationIndSizeof, CsrWifiSmeIbssStationIndSer, CsrWifiSmeIbssStationIndDes, CsrWifiSmeIbssStationIndSerFree },
106 { CSR_WIFI_SME_KEY_CFM, CsrWifiSmeKeyCfmSizeof, CsrWifiSmeKeyCfmSer, CsrWifiSmeKeyCfmDes, CsrWifiSmeKeyCfmSerFree },
107 { CSR_WIFI_SME_LINK_QUALITY_GET_CFM, CsrWifiSmeLinkQualityGetCfmSizeof, CsrWifiSmeLinkQualityGetCfmSer, CsrWifiSmeLinkQualityGetCfmDes, CsrWifiSmeLinkQualityGetCfmSerFree },
108 { CSR_WIFI_SME_MEDIA_STATUS_IND, CsrWifiSmeMediaStatusIndSizeof, CsrWifiSmeMediaStatusIndSer, CsrWifiSmeMediaStatusIndDes, CsrWifiSmeMediaStatusIndSerFree },
109 { CSR_WIFI_SME_MIB_CONFIG_GET_CFM, CsrWifiSmeMibConfigGetCfmSizeof, CsrWifiSmeMibConfigGetCfmSer, CsrWifiSmeMibConfigGetCfmDes, CsrWifiSmeMibConfigGetCfmSerFree },
110 { CSR_WIFI_SME_MIB_CONFIG_SET_CFM, CsrWifiSmeMibConfigSetCfmSizeof, CsrWifiSmeMibConfigSetCfmSer, CsrWifiSmeMibConfigSetCfmDes, CsrWifiSmeMibConfigSetCfmSerFree },
111 { CSR_WIFI_SME_MIB_GET_CFM, CsrWifiSmeMibGetCfmSizeof, CsrWifiSmeMibGetCfmSer, CsrWifiSmeMibGetCfmDes, CsrWifiSmeMibGetCfmSerFree },
112 { CSR_WIFI_SME_MIB_GET_NEXT_CFM, CsrWifiSmeMibGetNextCfmSizeof, CsrWifiSmeMibGetNextCfmSer, CsrWifiSmeMibGetNextCfmDes, CsrWifiSmeMibGetNextCfmSerFree },
113 { CSR_WIFI_SME_MIB_SET_CFM, CsrWifiSmeMibSetCfmSizeof, CsrWifiSmeMibSetCfmSer, CsrWifiSmeMibSetCfmDes, CsrWifiSmeMibSetCfmSerFree },
114 { CSR_WIFI_SME_MIC_FAILURE_IND, CsrWifiSmeMicFailureIndSizeof, CsrWifiSmeMicFailureIndSer, CsrWifiSmeMicFailureIndDes, CsrWifiSmeMicFailureIndSerFree },
115 { CSR_WIFI_SME_MULTICAST_ADDRESS_CFM, CsrWifiSmeMulticastAddressCfmSizeof, CsrWifiSmeMulticastAddressCfmSer, CsrWifiSmeMulticastAddressCfmDes, CsrWifiSmeMulticastAddressCfmSerFree },
116 { CSR_WIFI_SME_PACKET_FILTER_SET_CFM, CsrWifiSmePacketFilterSetCfmSizeof, CsrWifiSmePacketFilterSetCfmSer, CsrWifiSmePacketFilterSetCfmDes, CsrWifiSmePacketFilterSetCfmSerFree },
117 { CSR_WIFI_SME_PERMANENT_MAC_ADDRESS_GET_CFM, CsrWifiSmePermanentMacAddressGetCfmSizeof, CsrWifiSmePermanentMacAddressGetCfmSer, CsrWifiSmePermanentMacAddressGetCfmDes, CsrWifiSmePermanentMacAddressGetCfmSerFree },
118 { CSR_WIFI_SME_PMKID_CANDIDATE_LIST_IND, CsrWifiSmePmkidCandidateListIndSizeof, CsrWifiSmePmkidCandidateListIndSer, CsrWifiSmePmkidCandidateListIndDes, CsrWifiSmePmkidCandidateListIndSerFree },
119 { CSR_WIFI_SME_PMKID_CFM, CsrWifiSmePmkidCfmSizeof, CsrWifiSmePmkidCfmSer, CsrWifiSmePmkidCfmDes, CsrWifiSmePmkidCfmSerFree },
120 { CSR_WIFI_SME_POWER_CONFIG_GET_CFM, CsrWifiSmePowerConfigGetCfmSizeof, CsrWifiSmePowerConfigGetCfmSer, CsrWifiSmePowerConfigGetCfmDes, CsrWifiSmePowerConfigGetCfmSerFree },
121 { CSR_WIFI_SME_POWER_CONFIG_SET_CFM, CsrWifiSmePowerConfigSetCfmSizeof, CsrWifiSmePowerConfigSetCfmSer, CsrWifiSmePowerConfigSetCfmDes, CsrWifiSmePowerConfigSetCfmSerFree },
122 { CSR_WIFI_SME_REGULATORY_DOMAIN_INFO_GET_CFM, CsrWifiSmeRegulatoryDomainInfoGetCfmSizeof, CsrWifiSmeRegulatoryDomainInfoGetCfmSer, CsrWifiSmeRegulatoryDomainInfoGetCfmDes, CsrWifiSmeRegulatoryDomainInfoGetCfmSerFree },
123 { CSR_WIFI_SME_ROAM_COMPLETE_IND, CsrWifiSmeRoamCompleteIndSizeof, CsrWifiSmeRoamCompleteIndSer, CsrWifiSmeRoamCompleteIndDes, CsrWifiSmeRoamCompleteIndSerFree },
124 { CSR_WIFI_SME_ROAM_START_IND, CsrWifiSmeRoamStartIndSizeof, CsrWifiSmeRoamStartIndSer, CsrWifiSmeRoamStartIndDes, CsrWifiSmeRoamStartIndSerFree },
125 { CSR_WIFI_SME_ROAMING_CONFIG_GET_CFM, CsrWifiSmeRoamingConfigGetCfmSizeof, CsrWifiSmeRoamingConfigGetCfmSer, CsrWifiSmeRoamingConfigGetCfmDes, CsrWifiSmeRoamingConfigGetCfmSerFree },
126 { CSR_WIFI_SME_ROAMING_CONFIG_SET_CFM, CsrWifiSmeRoamingConfigSetCfmSizeof, CsrWifiSmeRoamingConfigSetCfmSer, CsrWifiSmeRoamingConfigSetCfmDes, CsrWifiSmeRoamingConfigSetCfmSerFree },
127 { CSR_WIFI_SME_SCAN_CONFIG_GET_CFM, CsrWifiSmeScanConfigGetCfmSizeof, CsrWifiSmeScanConfigGetCfmSer, CsrWifiSmeScanConfigGetCfmDes, CsrWifiSmeScanConfigGetCfmSerFree },
128 { CSR_WIFI_SME_SCAN_CONFIG_SET_CFM, CsrWifiSmeScanConfigSetCfmSizeof, CsrWifiSmeScanConfigSetCfmSer, CsrWifiSmeScanConfigSetCfmDes, CsrWifiSmeScanConfigSetCfmSerFree },
129 { CSR_WIFI_SME_SCAN_FULL_CFM, CsrWifiSmeScanFullCfmSizeof, CsrWifiSmeScanFullCfmSer, CsrWifiSmeScanFullCfmDes, CsrWifiSmeScanFullCfmSerFree },
130 { CSR_WIFI_SME_SCAN_RESULT_IND, CsrWifiSmeScanResultIndSizeof, CsrWifiSmeScanResultIndSer, CsrWifiSmeScanResultIndDes, CsrWifiSmeScanResultIndSerFree },
131 { CSR_WIFI_SME_SCAN_RESULTS_FLUSH_CFM, CsrWifiSmeScanResultsFlushCfmSizeof, CsrWifiSmeScanResultsFlushCfmSer, CsrWifiSmeScanResultsFlushCfmDes, CsrWifiSmeScanResultsFlushCfmSerFree },
132 { CSR_WIFI_SME_SCAN_RESULTS_GET_CFM, CsrWifiSmeScanResultsGetCfmSizeof, CsrWifiSmeScanResultsGetCfmSer, CsrWifiSmeScanResultsGetCfmDes, CsrWifiSmeScanResultsGetCfmSerFree },
133 { CSR_WIFI_SME_SME_STA_CONFIG_GET_CFM, CsrWifiSmeSmeStaConfigGetCfmSizeof, CsrWifiSmeSmeStaConfigGetCfmSer, CsrWifiSmeSmeStaConfigGetCfmDes, CsrWifiSmeSmeStaConfigGetCfmSerFree },
134 { CSR_WIFI_SME_SME_STA_CONFIG_SET_CFM, CsrWifiSmeSmeStaConfigSetCfmSizeof, CsrWifiSmeSmeStaConfigSetCfmSer, CsrWifiSmeSmeStaConfigSetCfmDes, CsrWifiSmeSmeStaConfigSetCfmSerFree },
135 { CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_CFM, CsrWifiSmeStationMacAddressGetCfmSizeof, CsrWifiSmeStationMacAddressGetCfmSer, CsrWifiSmeStationMacAddressGetCfmDes, CsrWifiSmeStationMacAddressGetCfmSerFree },
136 { CSR_WIFI_SME_TSPEC_IND, CsrWifiSmeTspecIndSizeof, CsrWifiSmeTspecIndSer, CsrWifiSmeTspecIndDes, CsrWifiSmeTspecIndSerFree },
137 { CSR_WIFI_SME_TSPEC_CFM, CsrWifiSmeTspecCfmSizeof, CsrWifiSmeTspecCfmSer, CsrWifiSmeTspecCfmDes, CsrWifiSmeTspecCfmSerFree },
138 { CSR_WIFI_SME_VERSIONS_GET_CFM, CsrWifiSmeVersionsGetCfmSizeof, CsrWifiSmeVersionsGetCfmSer, CsrWifiSmeVersionsGetCfmDes, CsrWifiSmeVersionsGetCfmSerFree },
139 { CSR_WIFI_SME_WIFI_FLIGHTMODE_CFM, CsrWifiSmeWifiFlightmodeCfmSizeof, CsrWifiSmeWifiFlightmodeCfmSer, CsrWifiSmeWifiFlightmodeCfmDes, CsrWifiSmeWifiFlightmodeCfmSerFree },
140 { CSR_WIFI_SME_WIFI_OFF_IND, CsrWifiSmeWifiOffIndSizeof, CsrWifiSmeWifiOffIndSer, CsrWifiSmeWifiOffIndDes, CsrWifiSmeWifiOffIndSerFree },
141 { CSR_WIFI_SME_WIFI_OFF_CFM, CsrWifiSmeWifiOffCfmSizeof, CsrWifiSmeWifiOffCfmSer, CsrWifiSmeWifiOffCfmDes, CsrWifiSmeWifiOffCfmSerFree },
142 { CSR_WIFI_SME_WIFI_ON_CFM, CsrWifiSmeWifiOnCfmSizeof, CsrWifiSmeWifiOnCfmSer, CsrWifiSmeWifiOnCfmDes, CsrWifiSmeWifiOnCfmSerFree },
143 { CSR_WIFI_SME_CLOAKED_SSIDS_SET_CFM, CsrWifiSmeCloakedSsidsSetCfmSizeof, CsrWifiSmeCloakedSsidsSetCfmSer, CsrWifiSmeCloakedSsidsSetCfmDes, CsrWifiSmeCloakedSsidsSetCfmSerFree },
144 { CSR_WIFI_SME_CLOAKED_SSIDS_GET_CFM, CsrWifiSmeCloakedSsidsGetCfmSizeof, CsrWifiSmeCloakedSsidsGetCfmSer, CsrWifiSmeCloakedSsidsGetCfmDes, CsrWifiSmeCloakedSsidsGetCfmSerFree },
145 { CSR_WIFI_SME_WIFI_ON_IND, CsrWifiSmeWifiOnIndSizeof, CsrWifiSmeWifiOnIndSer, CsrWifiSmeWifiOnIndDes, CsrWifiSmeWifiOnIndSerFree },
146 { CSR_WIFI_SME_SME_COMMON_CONFIG_GET_CFM, CsrWifiSmeSmeCommonConfigGetCfmSizeof, CsrWifiSmeSmeCommonConfigGetCfmSer, CsrWifiSmeSmeCommonConfigGetCfmDes, CsrWifiSmeSmeCommonConfigGetCfmSerFree },
147 { CSR_WIFI_SME_SME_COMMON_CONFIG_SET_CFM, CsrWifiSmeSmeCommonConfigSetCfmSizeof, CsrWifiSmeSmeCommonConfigSetCfmSer, CsrWifiSmeSmeCommonConfigSetCfmDes, CsrWifiSmeSmeCommonConfigSetCfmSerFree },
148 { CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_CFM, CsrWifiSmeInterfaceCapabilityGetCfmSizeof, CsrWifiSmeInterfaceCapabilityGetCfmSer, CsrWifiSmeInterfaceCapabilityGetCfmDes, CsrWifiSmeInterfaceCapabilityGetCfmSerFree },
149 { CSR_WIFI_SME_ERROR_IND, CsrWifiSmeErrorIndSizeof, CsrWifiSmeErrorIndSer, CsrWifiSmeErrorIndDes, CsrWifiSmeErrorIndSerFree },
150 { CSR_WIFI_SME_INFO_IND, CsrWifiSmeInfoIndSizeof, CsrWifiSmeInfoIndSer, CsrWifiSmeInfoIndDes, CsrWifiSmeInfoIndSerFree },
151 { CSR_WIFI_SME_CORE_DUMP_IND, CsrWifiSmeCoreDumpIndSizeof, CsrWifiSmeCoreDumpIndSer, CsrWifiSmeCoreDumpIndDes, CsrWifiSmeCoreDumpIndSerFree },
152 { CSR_WIFI_SME_AMP_STATUS_CHANGE_IND, CsrWifiSmeAmpStatusChangeIndSizeof, CsrWifiSmeAmpStatusChangeIndSer, CsrWifiSmeAmpStatusChangeIndDes, CsrWifiSmeAmpStatusChangeIndSerFree },
153 { CSR_WIFI_SME_WPS_CONFIGURATION_CFM, CsrWifiSmeWpsConfigurationCfmSizeof, CsrWifiSmeWpsConfigurationCfmSer, CsrWifiSmeWpsConfigurationCfmDes, CsrWifiSmeWpsConfigurationCfmSerFree },
154
155 { 0, NULL, NULL, NULL, NULL },
156};
157
158CsrMsgConvMsgEntry* CsrWifiSmeConverterLookup(CsrMsgConvMsgEntry *ce, u16 msgType)
159{
160 if (msgType & CSR_PRIM_UPSTREAM)
161 {
162 u16 idx = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT;
163 if (idx < (CSR_WIFI_SME_PRIM_UPSTREAM_COUNT + CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT) &&
164 csrwifisme_conv_lut[idx].msgType == msgType)
165 {
166 return &csrwifisme_conv_lut[idx];
167 }
168 }
169 else
170 {
171 if (msgType < CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT &&
172 csrwifisme_conv_lut[msgType].msgType == msgType)
173 {
174 return &csrwifisme_conv_lut[msgType];
175 }
176 }
177 return NULL;
178}
179
180
181void CsrWifiSmeConverterInit(void)
182{
183 CsrMsgConvInsert(CSR_WIFI_SME_PRIM, csrwifisme_conv_lut);
184 CsrMsgConvCustomLookupRegister(CSR_WIFI_SME_PRIM, CsrWifiSmeConverterLookup);
185}
186
187
188#ifdef CSR_LOG_ENABLE
189static const CsrLogPrimitiveInformation csrwifisme_conv_info = {
190 CSR_WIFI_SME_PRIM,
191 (char *)"CSR_WIFI_SME_PRIM",
192 csrwifisme_conv_lut
193};
194const CsrLogPrimitiveInformation* CsrWifiSmeTechInfoGet(void)
195{
196 return &csrwifisme_conv_info;
197}
198
199
200#endif /* CSR_LOG_ENABLE */
201#endif /* EXCLUDE_CSR_WIFI_SME_MODULE */
diff --git a/drivers/staging/csr/csr_wifi_sme_converter_init.h b/drivers/staging/csr/csr_wifi_sme_converter_init.h
deleted file mode 100644
index ba5e4b44bb6b..000000000000
--- a/drivers/staging/csr/csr_wifi_sme_converter_init.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_SME_CONVERTER_INIT_H__
14#define CSR_WIFI_SME_CONVERTER_INIT_H__
15
16#ifndef EXCLUDE_CSR_WIFI_SME_MODULE
17
18#include "csr_msgconv.h"
19
20#ifdef CSR_LOG_ENABLE
21#include "csr_log.h"
22
23extern const CsrLogPrimitiveInformation* CsrWifiSmeTechInfoGet(void);
24#endif /* CSR_LOG_ENABLE */
25
26extern void CsrWifiSmeConverterInit(void);
27
28#else /* EXCLUDE_CSR_WIFI_SME_MODULE */
29
30#define CsrWifiSmeConverterInit()
31
32#endif /* EXCLUDE_CSR_WIFI_SME_MODULE */
33
34#endif /* CSR_WIFI_SME_CONVERTER_INIT_H__ */
diff --git a/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c b/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c
deleted file mode 100644
index 03b5ddb22cd7..000000000000
--- a/drivers/staging/csr/csr_wifi_sme_free_downstream_contents.c
+++ /dev/null
@@ -1,187 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12#include <linux/slab.h>
13#include "csr_wifi_sme_prim.h"
14#include "csr_wifi_sme_lib.h"
15
16/*----------------------------------------------------------------------------*
17 * NAME
18 * CsrWifiSmeFreeDownstreamMessageContents
19 *
20 * DESCRIPTION
21 *
22 *
23 * PARAMETERS
24 * eventClass: only the value CSR_WIFI_SME_PRIM will be handled
25 * message: the message to free
26 *----------------------------------------------------------------------------*/
27void CsrWifiSmeFreeDownstreamMessageContents(u16 eventClass, void *message)
28{
29 if (eventClass != CSR_WIFI_SME_PRIM)
30 {
31 return;
32 }
33 if (NULL == message)
34 {
35 return;
36 }
37
38 switch (*((CsrWifiSmePrim *) message))
39 {
40 case CSR_WIFI_SME_BLACKLIST_REQ:
41 {
42 CsrWifiSmeBlacklistReq *p = (CsrWifiSmeBlacklistReq *)message;
43 kfree(p->setAddresses);
44 p->setAddresses = NULL;
45 break;
46 }
47 case CSR_WIFI_SME_CALIBRATION_DATA_SET_REQ:
48 {
49 CsrWifiSmeCalibrationDataSetReq *p = (CsrWifiSmeCalibrationDataSetReq *)message;
50 kfree(p->calibrationData);
51 p->calibrationData = NULL;
52 break;
53 }
54 case CSR_WIFI_SME_CONNECT_REQ:
55 {
56 CsrWifiSmeConnectReq *p = (CsrWifiSmeConnectReq *)message;
57 kfree(p->connectionConfig.mlmeAssociateReqInformationElements);
58 p->connectionConfig.mlmeAssociateReqInformationElements = NULL;
59 break;
60 }
61 case CSR_WIFI_SME_MIB_GET_NEXT_REQ:
62 {
63 CsrWifiSmeMibGetNextReq *p = (CsrWifiSmeMibGetNextReq *)message;
64 kfree(p->mibAttribute);
65 p->mibAttribute = NULL;
66 break;
67 }
68 case CSR_WIFI_SME_MIB_GET_REQ:
69 {
70 CsrWifiSmeMibGetReq *p = (CsrWifiSmeMibGetReq *)message;
71 kfree(p->mibAttribute);
72 p->mibAttribute = NULL;
73 break;
74 }
75 case CSR_WIFI_SME_MIB_SET_REQ:
76 {
77 CsrWifiSmeMibSetReq *p = (CsrWifiSmeMibSetReq *)message;
78 kfree(p->mibAttribute);
79 p->mibAttribute = NULL;
80 break;
81 }
82 case CSR_WIFI_SME_MULTICAST_ADDRESS_REQ:
83 {
84 CsrWifiSmeMulticastAddressReq *p = (CsrWifiSmeMulticastAddressReq *)message;
85 kfree(p->setAddresses);
86 p->setAddresses = NULL;
87 break;
88 }
89 case CSR_WIFI_SME_PACKET_FILTER_SET_REQ:
90 {
91 CsrWifiSmePacketFilterSetReq *p = (CsrWifiSmePacketFilterSetReq *)message;
92 kfree(p->filter);
93 p->filter = NULL;
94 break;
95 }
96 case CSR_WIFI_SME_PMKID_REQ:
97 {
98 CsrWifiSmePmkidReq *p = (CsrWifiSmePmkidReq *)message;
99 kfree(p->setPmkids);
100 p->setPmkids = NULL;
101 break;
102 }
103 case CSR_WIFI_SME_SCAN_CONFIG_SET_REQ:
104 {
105 CsrWifiSmeScanConfigSetReq *p = (CsrWifiSmeScanConfigSetReq *)message;
106 kfree(p->scanConfig.passiveChannelList);
107 p->scanConfig.passiveChannelList = NULL;
108 break;
109 }
110 case CSR_WIFI_SME_SCAN_FULL_REQ:
111 {
112 CsrWifiSmeScanFullReq *p = (CsrWifiSmeScanFullReq *)message;
113 kfree(p->ssid);
114 p->ssid = NULL;
115 kfree(p->channelList);
116 p->channelList = NULL;
117 kfree(p->probeIe);
118 p->probeIe = NULL;
119 break;
120 }
121 case CSR_WIFI_SME_TSPEC_REQ:
122 {
123 CsrWifiSmeTspecReq *p = (CsrWifiSmeTspecReq *)message;
124 kfree(p->tspec);
125 p->tspec = NULL;
126 kfree(p->tclas);
127 p->tclas = NULL;
128 break;
129 }
130 case CSR_WIFI_SME_WIFI_FLIGHTMODE_REQ:
131 {
132 CsrWifiSmeWifiFlightmodeReq *p = (CsrWifiSmeWifiFlightmodeReq *)message;
133 {
134 u16 i1;
135 for (i1 = 0; i1 < p->mibFilesCount; i1++)
136 {
137 kfree(p->mibFiles[i1].data);
138 p->mibFiles[i1].data = NULL;
139 }
140 }
141 kfree(p->mibFiles);
142 p->mibFiles = NULL;
143 break;
144 }
145 case CSR_WIFI_SME_WIFI_ON_REQ:
146 {
147 CsrWifiSmeWifiOnReq *p = (CsrWifiSmeWifiOnReq *)message;
148 {
149 u16 i1;
150 for (i1 = 0; i1 < p->mibFilesCount; i1++)
151 {
152 kfree(p->mibFiles[i1].data);
153 p->mibFiles[i1].data = NULL;
154 }
155 }
156 kfree(p->mibFiles);
157 p->mibFiles = NULL;
158 break;
159 }
160 case CSR_WIFI_SME_CLOAKED_SSIDS_SET_REQ:
161 {
162 CsrWifiSmeCloakedSsidsSetReq *p = (CsrWifiSmeCloakedSsidsSetReq *)message;
163 kfree(p->cloakedSsids.cloakedSsids);
164 p->cloakedSsids.cloakedSsids = NULL;
165 break;
166 }
167 case CSR_WIFI_SME_WPS_CONFIGURATION_REQ:
168 {
169 CsrWifiSmeWpsConfigurationReq *p = (CsrWifiSmeWpsConfigurationReq *)message;
170 kfree(p->wpsConfig.secondaryDeviceType);
171 p->wpsConfig.secondaryDeviceType = NULL;
172 break;
173 }
174 case CSR_WIFI_SME_SET_REQ:
175 {
176 CsrWifiSmeSetReq *p = (CsrWifiSmeSetReq *)message;
177 kfree(p->data);
178 p->data = NULL;
179 break;
180 }
181
182 default:
183 break;
184 }
185}
186
187
diff --git a/drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c b/drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c
deleted file mode 100644
index c04767baaa5b..000000000000
--- a/drivers/staging/csr/csr_wifi_sme_free_upstream_contents.c
+++ /dev/null
@@ -1,275 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12#include <linux/slab.h>
13#include "csr_wifi_sme_prim.h"
14#include "csr_wifi_sme_lib.h"
15
16/*----------------------------------------------------------------------------*
17 * NAME
18 * CsrWifiSmeFreeUpstreamMessageContents
19 *
20 * DESCRIPTION
21 *
22 *
23 * PARAMETERS
24 * eventClass: only the value CSR_WIFI_SME_PRIM will be handled
25 * message: the message to free
26 *----------------------------------------------------------------------------*/
27void CsrWifiSmeFreeUpstreamMessageContents(u16 eventClass, void *message)
28{
29 if (eventClass != CSR_WIFI_SME_PRIM)
30 {
31 return;
32 }
33 if (NULL == message)
34 {
35 return;
36 }
37
38 switch (*((CsrWifiSmePrim *) message))
39 {
40 case CSR_WIFI_SME_ASSOCIATION_COMPLETE_IND:
41 {
42 CsrWifiSmeAssociationCompleteInd *p = (CsrWifiSmeAssociationCompleteInd *)message;
43 kfree(p->connectionInfo.beaconFrame);
44 p->connectionInfo.beaconFrame = NULL;
45 kfree(p->connectionInfo.associationReqFrame);
46 p->connectionInfo.associationReqFrame = NULL;
47 kfree(p->connectionInfo.associationRspFrame);
48 p->connectionInfo.associationRspFrame = NULL;
49 kfree(p->connectionInfo.assocScanInfoElements);
50 p->connectionInfo.assocScanInfoElements = NULL;
51 kfree(p->connectionInfo.assocReqInfoElements);
52 p->connectionInfo.assocReqInfoElements = NULL;
53 kfree(p->connectionInfo.assocRspInfoElements);
54 p->connectionInfo.assocRspInfoElements = NULL;
55 break;
56 }
57 case CSR_WIFI_SME_BLACKLIST_CFM:
58 {
59 CsrWifiSmeBlacklistCfm *p = (CsrWifiSmeBlacklistCfm *)message;
60 kfree(p->getAddresses);
61 p->getAddresses = NULL;
62 break;
63 }
64 case CSR_WIFI_SME_CALIBRATION_DATA_GET_CFM:
65 {
66 CsrWifiSmeCalibrationDataGetCfm *p = (CsrWifiSmeCalibrationDataGetCfm *)message;
67 kfree(p->calibrationData);
68 p->calibrationData = NULL;
69 break;
70 }
71 case CSR_WIFI_SME_CONNECTION_CONFIG_GET_CFM:
72 {
73 CsrWifiSmeConnectionConfigGetCfm *p = (CsrWifiSmeConnectionConfigGetCfm *)message;
74 kfree(p->connectionConfig.mlmeAssociateReqInformationElements);
75 p->connectionConfig.mlmeAssociateReqInformationElements = NULL;
76 break;
77 }
78 case CSR_WIFI_SME_CONNECTION_INFO_GET_CFM:
79 {
80 CsrWifiSmeConnectionInfoGetCfm *p = (CsrWifiSmeConnectionInfoGetCfm *)message;
81 kfree(p->connectionInfo.beaconFrame);
82 p->connectionInfo.beaconFrame = NULL;
83 kfree(p->connectionInfo.associationReqFrame);
84 p->connectionInfo.associationReqFrame = NULL;
85 kfree(p->connectionInfo.associationRspFrame);
86 p->connectionInfo.associationRspFrame = NULL;
87 kfree(p->connectionInfo.assocScanInfoElements);
88 p->connectionInfo.assocScanInfoElements = NULL;
89 kfree(p->connectionInfo.assocReqInfoElements);
90 p->connectionInfo.assocReqInfoElements = NULL;
91 kfree(p->connectionInfo.assocRspInfoElements);
92 p->connectionInfo.assocRspInfoElements = NULL;
93 break;
94 }
95 case CSR_WIFI_SME_MEDIA_STATUS_IND:
96 {
97 CsrWifiSmeMediaStatusInd *p = (CsrWifiSmeMediaStatusInd *)message;
98 kfree(p->connectionInfo.beaconFrame);
99 p->connectionInfo.beaconFrame = NULL;
100 kfree(p->connectionInfo.associationReqFrame);
101 p->connectionInfo.associationReqFrame = NULL;
102 kfree(p->connectionInfo.associationRspFrame);
103 p->connectionInfo.associationRspFrame = NULL;
104 kfree(p->connectionInfo.assocScanInfoElements);
105 p->connectionInfo.assocScanInfoElements = NULL;
106 kfree(p->connectionInfo.assocReqInfoElements);
107 p->connectionInfo.assocReqInfoElements = NULL;
108 kfree(p->connectionInfo.assocRspInfoElements);
109 p->connectionInfo.assocRspInfoElements = NULL;
110 break;
111 }
112 case CSR_WIFI_SME_MIB_GET_CFM:
113 {
114 CsrWifiSmeMibGetCfm *p = (CsrWifiSmeMibGetCfm *)message;
115 kfree(p->mibAttribute);
116 p->mibAttribute = NULL;
117 break;
118 }
119 case CSR_WIFI_SME_MIB_GET_NEXT_CFM:
120 {
121 CsrWifiSmeMibGetNextCfm *p = (CsrWifiSmeMibGetNextCfm *)message;
122 kfree(p->mibAttribute);
123 p->mibAttribute = NULL;
124 break;
125 }
126 case CSR_WIFI_SME_MULTICAST_ADDRESS_CFM:
127 {
128 CsrWifiSmeMulticastAddressCfm *p = (CsrWifiSmeMulticastAddressCfm *)message;
129 kfree(p->getAddresses);
130 p->getAddresses = NULL;
131 break;
132 }
133 case CSR_WIFI_SME_PMKID_CANDIDATE_LIST_IND:
134 {
135 CsrWifiSmePmkidCandidateListInd *p = (CsrWifiSmePmkidCandidateListInd *)message;
136 kfree(p->pmkidCandidates);
137 p->pmkidCandidates = NULL;
138 break;
139 }
140 case CSR_WIFI_SME_PMKID_CFM:
141 {
142 CsrWifiSmePmkidCfm *p = (CsrWifiSmePmkidCfm *)message;
143 kfree(p->getPmkids);
144 p->getPmkids = NULL;
145 break;
146 }
147 case CSR_WIFI_SME_SCAN_CONFIG_GET_CFM:
148 {
149 CsrWifiSmeScanConfigGetCfm *p = (CsrWifiSmeScanConfigGetCfm *)message;
150 kfree(p->scanConfig.passiveChannelList);
151 p->scanConfig.passiveChannelList = NULL;
152 break;
153 }
154 case CSR_WIFI_SME_SCAN_RESULT_IND:
155 {
156 CsrWifiSmeScanResultInd *p = (CsrWifiSmeScanResultInd *)message;
157 kfree(p->result.informationElements);
158 p->result.informationElements = NULL;
159 switch (p->result.p2pDeviceRole)
160 {
161 case CSR_WIFI_SME_P2P_ROLE_GO:
162 {
163 u16 i4;
164 for (i4 = 0; i4 < p->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++)
165 {
166 kfree(p->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType);
167 p->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL;
168 }
169 }
170 kfree(p->result.deviceInfo.groupInfo.p2PClientInfo);
171 p->result.deviceInfo.groupInfo.p2PClientInfo = NULL;
172 break;
173 case CSR_WIFI_SME_P2P_ROLE_STANDALONE:
174 kfree(p->result.deviceInfo.standalonedevInfo.secDeviceType);
175 p->result.deviceInfo.standalonedevInfo.secDeviceType = NULL;
176 break;
177 default:
178 break;
179 }
180 break;
181 }
182 case CSR_WIFI_SME_SCAN_RESULTS_GET_CFM:
183 {
184 CsrWifiSmeScanResultsGetCfm *p = (CsrWifiSmeScanResultsGetCfm *)message;
185 {
186 u16 i1;
187 for (i1 = 0; i1 < p->scanResultsCount; i1++)
188 {
189 kfree(p->scanResults[i1].informationElements);
190 p->scanResults[i1].informationElements = NULL;
191 switch (p->scanResults[i1].p2pDeviceRole)
192 {
193 case CSR_WIFI_SME_P2P_ROLE_GO:
194 {
195 u16 i4;
196 for (i4 = 0; i4 < p->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++)
197 {
198 kfree(p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType);
199 p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL;
200 }
201 }
202 kfree(p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo);
203 p->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo = NULL;
204 break;
205 case CSR_WIFI_SME_P2P_ROLE_STANDALONE:
206 kfree(p->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType);
207 p->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType = NULL;
208 break;
209 default:
210 break;
211 }
212 }
213 }
214 kfree(p->scanResults);
215 p->scanResults = NULL;
216 break;
217 }
218 case CSR_WIFI_SME_TSPEC_IND:
219 {
220 CsrWifiSmeTspecInd *p = (CsrWifiSmeTspecInd *)message;
221 kfree(p->tspec);
222 p->tspec = NULL;
223 break;
224 }
225 case CSR_WIFI_SME_TSPEC_CFM:
226 {
227 CsrWifiSmeTspecCfm *p = (CsrWifiSmeTspecCfm *)message;
228 kfree(p->tspec);
229 p->tspec = NULL;
230 break;
231 }
232 case CSR_WIFI_SME_VERSIONS_GET_CFM:
233 {
234 CsrWifiSmeVersionsGetCfm *p = (CsrWifiSmeVersionsGetCfm *)message;
235 kfree(p->versions.routerBuild);
236 p->versions.routerBuild = NULL;
237 kfree(p->versions.smeBuild);
238 p->versions.smeBuild = NULL;
239 break;
240 }
241 case CSR_WIFI_SME_CLOAKED_SSIDS_GET_CFM:
242 {
243 CsrWifiSmeCloakedSsidsGetCfm *p = (CsrWifiSmeCloakedSsidsGetCfm *)message;
244 kfree(p->cloakedSsids.cloakedSsids);
245 p->cloakedSsids.cloakedSsids = NULL;
246 break;
247 }
248 case CSR_WIFI_SME_ERROR_IND:
249 {
250 CsrWifiSmeErrorInd *p = (CsrWifiSmeErrorInd *)message;
251 kfree(p->errorMessage);
252 p->errorMessage = NULL;
253 break;
254 }
255 case CSR_WIFI_SME_INFO_IND:
256 {
257 CsrWifiSmeInfoInd *p = (CsrWifiSmeInfoInd *)message;
258 kfree(p->infoMessage);
259 p->infoMessage = NULL;
260 break;
261 }
262 case CSR_WIFI_SME_CORE_DUMP_IND:
263 {
264 CsrWifiSmeCoreDumpInd *p = (CsrWifiSmeCoreDumpInd *)message;
265 kfree(p->data);
266 p->data = NULL;
267 break;
268 }
269
270 default:
271 break;
272 }
273}
274
275
diff --git a/drivers/staging/csr/csr_wifi_sme_lib.h b/drivers/staging/csr/csr_wifi_sme_lib.h
deleted file mode 100644
index 53cf1268286e..000000000000
--- a/drivers/staging/csr/csr_wifi_sme_lib.h
+++ /dev/null
@@ -1,4303 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_SME_LIB_H__
14#define CSR_WIFI_SME_LIB_H__
15
16#include "csr_sched.h"
17#include "csr_macro.h"
18#include "csr_msg_transport.h"
19
20#include "csr_wifi_lib.h"
21
22#include "csr_wifi_sme_prim.h"
23#include "csr_wifi_sme_task.h"
24
25
26#ifndef CSR_WIFI_SME_LIB_DESTINATION_QUEUE
27# ifdef CSR_WIFI_NME_ENABLE
28# include "csr_wifi_nme_task.h"
29# define CSR_WIFI_SME_LIB_DESTINATION_QUEUE CSR_WIFI_NME_IFACEQUEUE
30# else
31# define CSR_WIFI_SME_LIB_DESTINATION_QUEUE CSR_WIFI_SME_IFACEQUEUE
32# endif
33#endif
34
35/*----------------------------------------------------------------------------*
36 * CsrWifiSmeFreeUpstreamMessageContents
37 *
38 * DESCRIPTION
39 * Free the allocated memory in a CSR_WIFI_SME upstream message. Does not
40 * free the message itself, and can only be used for upstream messages.
41 *
42 * PARAMETERS
43 * Deallocates the resources in a CSR_WIFI_SME upstream message
44 *----------------------------------------------------------------------------*/
45void CsrWifiSmeFreeUpstreamMessageContents(u16 eventClass, void *message);
46
47/*----------------------------------------------------------------------------*
48 * CsrWifiSmeFreeDownstreamMessageContents
49 *
50 * DESCRIPTION
51 * Free the allocated memory in a CSR_WIFI_SME downstream message. Does not
52 * free the message itself, and can only be used for downstream messages.
53 *
54 * PARAMETERS
55 * Deallocates the resources in a CSR_WIFI_SME downstream message
56 *----------------------------------------------------------------------------*/
57void CsrWifiSmeFreeDownstreamMessageContents(u16 eventClass, void *message);
58
59/*----------------------------------------------------------------------------*
60 * Enum to string functions
61 *----------------------------------------------------------------------------*/
62const char* CsrWifiSme80211NetworkTypeToString(CsrWifiSme80211NetworkType value);
63const char* CsrWifiSme80211PrivacyModeToString(CsrWifiSme80211PrivacyMode value);
64const char* CsrWifiSme80211dTrustLevelToString(CsrWifiSme80211dTrustLevel value);
65const char* CsrWifiSmeAmpStatusToString(CsrWifiSmeAmpStatus value);
66const char* CsrWifiSmeAuthModeToString(CsrWifiSmeAuthMode value);
67const char* CsrWifiSmeBasicUsabilityToString(CsrWifiSmeBasicUsability value);
68const char* CsrWifiSmeBssTypeToString(CsrWifiSmeBssType value);
69const char* CsrWifiSmeCoexSchemeToString(CsrWifiSmeCoexScheme value);
70const char* CsrWifiSmeControlIndicationToString(CsrWifiSmeControlIndication value);
71const char* CsrWifiSmeCtsProtectionTypeToString(CsrWifiSmeCtsProtectionType value);
72const char* CsrWifiSmeD3AutoScanModeToString(CsrWifiSmeD3AutoScanMode value);
73const char* CsrWifiSmeEncryptionToString(CsrWifiSmeEncryption value);
74const char* CsrWifiSmeFirmwareDriverInterfaceToString(CsrWifiSmeFirmwareDriverInterface value);
75const char* CsrWifiSmeHostPowerModeToString(CsrWifiSmeHostPowerMode value);
76const char* CsrWifiSmeIEEE80211ReasonToString(CsrWifiSmeIEEE80211Reason value);
77const char* CsrWifiSmeIEEE80211ResultToString(CsrWifiSmeIEEE80211Result value);
78const char* CsrWifiSmeIndicationsToString(CsrWifiSmeIndications value);
79const char* CsrWifiSmeKeyTypeToString(CsrWifiSmeKeyType value);
80const char* CsrWifiSmeListActionToString(CsrWifiSmeListAction value);
81const char* CsrWifiSmeMediaStatusToString(CsrWifiSmeMediaStatus value);
82const char* CsrWifiSmeP2pCapabilityToString(CsrWifiSmeP2pCapability value);
83const char* CsrWifiSmeP2pGroupCapabilityToString(CsrWifiSmeP2pGroupCapability value);
84const char* CsrWifiSmeP2pNoaConfigMethodToString(CsrWifiSmeP2pNoaConfigMethod value);
85const char* CsrWifiSmeP2pRoleToString(CsrWifiSmeP2pRole value);
86const char* CsrWifiSmeP2pStatusToString(CsrWifiSmeP2pStatus value);
87const char* CsrWifiSmePacketFilterModeToString(CsrWifiSmePacketFilterMode value);
88const char* CsrWifiSmePowerSaveLevelToString(CsrWifiSmePowerSaveLevel value);
89const char* CsrWifiSmePreambleTypeToString(CsrWifiSmePreambleType value);
90const char* CsrWifiSmeRadioIFToString(CsrWifiSmeRadioIF value);
91const char* CsrWifiSmeRegulatoryDomainToString(CsrWifiSmeRegulatoryDomain value);
92const char* CsrWifiSmeRoamReasonToString(CsrWifiSmeRoamReason value);
93const char* CsrWifiSmeScanTypeToString(CsrWifiSmeScanType value);
94const char* CsrWifiSmeTrafficTypeToString(CsrWifiSmeTrafficType value);
95const char* CsrWifiSmeTspecCtrlToString(CsrWifiSmeTspecCtrl value);
96const char* CsrWifiSmeTspecResultCodeToString(CsrWifiSmeTspecResultCode value);
97const char* CsrWifiSmeWepAuthModeToString(CsrWifiSmeWepAuthMode value);
98const char* CsrWifiSmeWepCredentialTypeToString(CsrWifiSmeWepCredentialType value);
99const char* CsrWifiSmeWmmModeToString(CsrWifiSmeWmmMode value);
100const char* CsrWifiSmeWmmQosInfoToString(CsrWifiSmeWmmQosInfo value);
101const char* CsrWifiSmeWpsConfigTypeToString(CsrWifiSmeWpsConfigType value);
102const char* CsrWifiSmeWpsDeviceCategoryToString(CsrWifiSmeWpsDeviceCategory value);
103const char* CsrWifiSmeWpsDeviceSubCategoryToString(CsrWifiSmeWpsDeviceSubCategory value);
104const char* CsrWifiSmeWpsDpidToString(CsrWifiSmeWpsDpid value);
105const char* CsrWifiSmeWpsRegistrationToString(CsrWifiSmeWpsRegistration value);
106
107
108/*----------------------------------------------------------------------------*
109 * CsrPrim Type toString function.
110 * Converts a message type to the String name of the Message
111 *----------------------------------------------------------------------------*/
112const char* CsrWifiSmePrimTypeToString(CsrPrim msgType);
113
114/*----------------------------------------------------------------------------*
115 * Lookup arrays for PrimType name Strings
116 *----------------------------------------------------------------------------*/
117extern const char *CsrWifiSmeUpstreamPrimNames[CSR_WIFI_SME_PRIM_UPSTREAM_COUNT];
118extern const char *CsrWifiSmeDownstreamPrimNames[CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT];
119
120/*******************************************************************************
121
122 NAME
123 CsrWifiSmeActivateReqSend
124
125 DESCRIPTION
126 The WMA sends this primitive to activate the SME.
127 The WMA must activate the SME before it can send any other primitive.
128
129 PARAMETERS
130 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
131
132*******************************************************************************/
133#define CsrWifiSmeActivateReqCreate(msg__, dst__, src__) \
134 msg__ = kmalloc(sizeof(CsrWifiSmeActivateReq), GFP_KERNEL); \
135 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ACTIVATE_REQ, dst__, src__);
136
137#define CsrWifiSmeActivateReqSendTo(dst__, src__) \
138 { \
139 CsrWifiSmeActivateReq *msg__; \
140 CsrWifiSmeActivateReqCreate(msg__, dst__, src__); \
141 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
142 }
143
144#define CsrWifiSmeActivateReqSend(src__) \
145 CsrWifiSmeActivateReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
146
147/*******************************************************************************
148
149 NAME
150 CsrWifiSmeActivateCfmSend
151
152 DESCRIPTION
153 The SME sends this primitive when the activation is complete.
154
155 PARAMETERS
156 queue - Destination Task Queue
157 status - Reports the result of the request
158
159*******************************************************************************/
160#define CsrWifiSmeActivateCfmCreate(msg__, dst__, src__, status__) \
161 msg__ = kmalloc(sizeof(CsrWifiSmeActivateCfm), GFP_KERNEL); \
162 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ACTIVATE_CFM, dst__, src__); \
163 msg__->status = (status__);
164
165#define CsrWifiSmeActivateCfmSendTo(dst__, src__, status__) \
166 { \
167 CsrWifiSmeActivateCfm *msg__; \
168 CsrWifiSmeActivateCfmCreate(msg__, dst__, src__, status__); \
169 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
170 }
171
172#define CsrWifiSmeActivateCfmSend(dst__, status__) \
173 CsrWifiSmeActivateCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
174
175/*******************************************************************************
176
177 NAME
178 CsrWifiSmeAdhocConfigGetReqSend
179
180 DESCRIPTION
181 This primitive gets the value of the adHocConfig parameter.
182
183 PARAMETERS
184 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
185
186*******************************************************************************/
187#define CsrWifiSmeAdhocConfigGetReqCreate(msg__, dst__, src__) \
188 msg__ = kmalloc(sizeof(CsrWifiSmeAdhocConfigGetReq), GFP_KERNEL); \
189 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ADHOC_CONFIG_GET_REQ, dst__, src__);
190
191#define CsrWifiSmeAdhocConfigGetReqSendTo(dst__, src__) \
192 { \
193 CsrWifiSmeAdhocConfigGetReq *msg__; \
194 CsrWifiSmeAdhocConfigGetReqCreate(msg__, dst__, src__); \
195 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
196 }
197
198#define CsrWifiSmeAdhocConfigGetReqSend(src__) \
199 CsrWifiSmeAdhocConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
200
201/*******************************************************************************
202
203 NAME
204 CsrWifiSmeAdhocConfigGetCfmSend
205
206 DESCRIPTION
207 This primitive reports the result of the request.
208
209 PARAMETERS
210 queue - Destination Task Queue
211 status - Reports the result of the request
212 adHocConfig - Contains the values used when starting an Ad-hoc (IBSS)
213 connection.
214
215*******************************************************************************/
216#define CsrWifiSmeAdhocConfigGetCfmCreate(msg__, dst__, src__, status__, adHocConfig__) \
217 msg__ = kmalloc(sizeof(CsrWifiSmeAdhocConfigGetCfm), GFP_KERNEL); \
218 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ADHOC_CONFIG_GET_CFM, dst__, src__); \
219 msg__->status = (status__); \
220 msg__->adHocConfig = (adHocConfig__);
221
222#define CsrWifiSmeAdhocConfigGetCfmSendTo(dst__, src__, status__, adHocConfig__) \
223 { \
224 CsrWifiSmeAdhocConfigGetCfm *msg__; \
225 CsrWifiSmeAdhocConfigGetCfmCreate(msg__, dst__, src__, status__, adHocConfig__); \
226 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
227 }
228
229#define CsrWifiSmeAdhocConfigGetCfmSend(dst__, status__, adHocConfig__) \
230 CsrWifiSmeAdhocConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, adHocConfig__)
231
232/*******************************************************************************
233
234 NAME
235 CsrWifiSmeAdhocConfigSetReqSend
236
237 DESCRIPTION
238 This primitive sets the value of the adHocConfig parameter.
239
240 PARAMETERS
241 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
242 adHocConfig - Sets the values to use when starting an ad hoc network.
243
244*******************************************************************************/
245#define CsrWifiSmeAdhocConfigSetReqCreate(msg__, dst__, src__, adHocConfig__) \
246 msg__ = kmalloc(sizeof(CsrWifiSmeAdhocConfigSetReq), GFP_KERNEL); \
247 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ADHOC_CONFIG_SET_REQ, dst__, src__); \
248 msg__->adHocConfig = (adHocConfig__);
249
250#define CsrWifiSmeAdhocConfigSetReqSendTo(dst__, src__, adHocConfig__) \
251 { \
252 CsrWifiSmeAdhocConfigSetReq *msg__; \
253 CsrWifiSmeAdhocConfigSetReqCreate(msg__, dst__, src__, adHocConfig__); \
254 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
255 }
256
257#define CsrWifiSmeAdhocConfigSetReqSend(src__, adHocConfig__) \
258 CsrWifiSmeAdhocConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, adHocConfig__)
259
260/*******************************************************************************
261
262 NAME
263 CsrWifiSmeAdhocConfigSetCfmSend
264
265 DESCRIPTION
266 This primitive reports the result of the request.
267
268 PARAMETERS
269 queue - Destination Task Queue
270 status - Reports the result of the request
271
272*******************************************************************************/
273#define CsrWifiSmeAdhocConfigSetCfmCreate(msg__, dst__, src__, status__) \
274 msg__ = kmalloc(sizeof(CsrWifiSmeAdhocConfigSetCfm), GFP_KERNEL); \
275 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ADHOC_CONFIG_SET_CFM, dst__, src__); \
276 msg__->status = (status__);
277
278#define CsrWifiSmeAdhocConfigSetCfmSendTo(dst__, src__, status__) \
279 { \
280 CsrWifiSmeAdhocConfigSetCfm *msg__; \
281 CsrWifiSmeAdhocConfigSetCfmCreate(msg__, dst__, src__, status__); \
282 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
283 }
284
285#define CsrWifiSmeAdhocConfigSetCfmSend(dst__, status__) \
286 CsrWifiSmeAdhocConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
287
288/*******************************************************************************
289
290 NAME
291 CsrWifiSmeAmpStatusChangeIndSend
292
293 DESCRIPTION
294 Indication of change to AMP activity.
295
296 PARAMETERS
297 queue - Destination Task Queue
298 interfaceTag - Interface on which the AMP activity changed.
299 ampStatus - The new status of AMP activity.Range: {AMP_ACTIVE,
300 AMP_INACTIVE}.
301
302*******************************************************************************/
303#define CsrWifiSmeAmpStatusChangeIndCreate(msg__, dst__, src__, interfaceTag__, ampStatus__) \
304 msg__ = kmalloc(sizeof(CsrWifiSmeAmpStatusChangeInd), GFP_KERNEL); \
305 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_AMP_STATUS_CHANGE_IND, dst__, src__); \
306 msg__->interfaceTag = (interfaceTag__); \
307 msg__->ampStatus = (ampStatus__);
308
309#define CsrWifiSmeAmpStatusChangeIndSendTo(dst__, src__, interfaceTag__, ampStatus__) \
310 { \
311 CsrWifiSmeAmpStatusChangeInd *msg__; \
312 CsrWifiSmeAmpStatusChangeIndCreate(msg__, dst__, src__, interfaceTag__, ampStatus__); \
313 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
314 }
315
316#define CsrWifiSmeAmpStatusChangeIndSend(dst__, interfaceTag__, ampStatus__) \
317 CsrWifiSmeAmpStatusChangeIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, ampStatus__)
318
319/*******************************************************************************
320
321 NAME
322 CsrWifiSmeAssociationCompleteIndSend
323
324 DESCRIPTION
325 The SME will send this primitive to all the tasks that have registered to
326 receive it whenever it completes an attempt to associate with an AP. If
327 the association was successful, status will be set to
328 CSR_WIFI_SME_STATUS_SUCCESS, otherwise status and deauthReason shall be
329 set to appropriate error codes.
330
331 PARAMETERS
332 queue - Destination Task Queue
333 interfaceTag - Interface Identifier; unique identifier of an interface
334 status - Reports the result of the association procedure
335 connectionInfo - This parameter is relevant only if result is
336 CSR_WIFI_SME_STATUS_SUCCESS:
337 it points to the connection information for the new network
338 deauthReason - This parameter is relevant only if result is not
339 CSR_WIFI_SME_STATUS_SUCCESS:
340 if the AP deauthorised the station, it gives the reason of
341 the deauthorization
342
343*******************************************************************************/
344#define CsrWifiSmeAssociationCompleteIndCreate(msg__, dst__, src__, interfaceTag__, status__, connectionInfo__, deauthReason__) \
345 msg__ = kmalloc(sizeof(CsrWifiSmeAssociationCompleteInd), GFP_KERNEL); \
346 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ASSOCIATION_COMPLETE_IND, dst__, src__); \
347 msg__->interfaceTag = (interfaceTag__); \
348 msg__->status = (status__); \
349 msg__->connectionInfo = (connectionInfo__); \
350 msg__->deauthReason = (deauthReason__);
351
352#define CsrWifiSmeAssociationCompleteIndSendTo(dst__, src__, interfaceTag__, status__, connectionInfo__, deauthReason__) \
353 { \
354 CsrWifiSmeAssociationCompleteInd *msg__; \
355 CsrWifiSmeAssociationCompleteIndCreate(msg__, dst__, src__, interfaceTag__, status__, connectionInfo__, deauthReason__); \
356 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
357 }
358
359#define CsrWifiSmeAssociationCompleteIndSend(dst__, interfaceTag__, status__, connectionInfo__, deauthReason__) \
360 CsrWifiSmeAssociationCompleteIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, connectionInfo__, deauthReason__)
361
362/*******************************************************************************
363
364 NAME
365 CsrWifiSmeAssociationStartIndSend
366
367 DESCRIPTION
368 The SME will send this primitive to all the tasks that have registered to
369 receive it whenever it begins an attempt to associate with an AP.
370
371 PARAMETERS
372 queue - Destination Task Queue
373 interfaceTag - Interface Identifier; unique identifier of an interface
374 address - BSSID of the associating network
375 ssid - Service Set identifier of the associating network
376
377*******************************************************************************/
378#define CsrWifiSmeAssociationStartIndCreate(msg__, dst__, src__, interfaceTag__, address__, ssid__) \
379 msg__ = kmalloc(sizeof(CsrWifiSmeAssociationStartInd), GFP_KERNEL); \
380 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ASSOCIATION_START_IND, dst__, src__); \
381 msg__->interfaceTag = (interfaceTag__); \
382 msg__->address = (address__); \
383 msg__->ssid = (ssid__);
384
385#define CsrWifiSmeAssociationStartIndSendTo(dst__, src__, interfaceTag__, address__, ssid__) \
386 { \
387 CsrWifiSmeAssociationStartInd *msg__; \
388 CsrWifiSmeAssociationStartIndCreate(msg__, dst__, src__, interfaceTag__, address__, ssid__); \
389 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
390 }
391
392#define CsrWifiSmeAssociationStartIndSend(dst__, interfaceTag__, address__, ssid__) \
393 CsrWifiSmeAssociationStartIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, address__, ssid__)
394
395/*******************************************************************************
396
397 NAME
398 CsrWifiSmeBlacklistReqSend
399
400 DESCRIPTION
401 The wireless manager application should call this primitive to notify the
402 driver of any networks that should not be connected to. The interface
403 allows the wireless manager application to query, add, remove, and flush
404 the BSSIDs that the driver may not connect or roam to.
405 When this primitive adds to the black list the BSSID to which the SME is
406 currently connected, the SME will try to roam, if applicable, to another
407 BSSID in the same ESS; if the roaming procedure fails, the SME will
408 disconnect.
409
410 PARAMETERS
411 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
412 interfaceTag - Interface Identifier; unique identifier of an interface
413 action - The value of the CsrWifiSmeListAction parameter instructs
414 the driver to modify or provide the list of blacklisted
415 networks.
416 setAddressCount - Number of BSSIDs sent with this primitive
417 setAddresses - Pointer to the list of BBSIDs sent with the primitive, set
418 to NULL if none is sent.
419
420*******************************************************************************/
421#define CsrWifiSmeBlacklistReqCreate(msg__, dst__, src__, interfaceTag__, action__, setAddressCount__, setAddresses__) \
422 msg__ = kmalloc(sizeof(CsrWifiSmeBlacklistReq), GFP_KERNEL); \
423 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_BLACKLIST_REQ, dst__, src__); \
424 msg__->interfaceTag = (interfaceTag__); \
425 msg__->action = (action__); \
426 msg__->setAddressCount = (setAddressCount__); \
427 msg__->setAddresses = (setAddresses__);
428
429#define CsrWifiSmeBlacklistReqSendTo(dst__, src__, interfaceTag__, action__, setAddressCount__, setAddresses__) \
430 { \
431 CsrWifiSmeBlacklistReq *msg__; \
432 CsrWifiSmeBlacklistReqCreate(msg__, dst__, src__, interfaceTag__, action__, setAddressCount__, setAddresses__); \
433 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
434 }
435
436#define CsrWifiSmeBlacklistReqSend(src__, interfaceTag__, action__, setAddressCount__, setAddresses__) \
437 CsrWifiSmeBlacklistReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, action__, setAddressCount__, setAddresses__)
438
439/*******************************************************************************
440
441 NAME
442 CsrWifiSmeBlacklistCfmSend
443
444 DESCRIPTION
445 The SME will call this primitive when the action on the blacklist has
446 completed. For a GET action, this primitive also reports the list of
447 BBSIDs in the blacklist.
448
449 PARAMETERS
450 queue - Destination Task Queue
451 interfaceTag - Interface Identifier; unique identifier of an interface
452 status - Reports the result of the request
453 action - Action in the request
454 getAddressCount - This parameter is only relevant if action is
455 CSR_WIFI_SME_LIST_ACTION_GET:
456 number of BSSIDs sent with this primitive
457 getAddresses - Pointer to the list of BBSIDs sent with the primitive, set
458 to NULL if none is sent.
459
460*******************************************************************************/
461#define CsrWifiSmeBlacklistCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getAddressCount__, getAddresses__) \
462 msg__ = kmalloc(sizeof(CsrWifiSmeBlacklistCfm), GFP_KERNEL); \
463 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_BLACKLIST_CFM, dst__, src__); \
464 msg__->interfaceTag = (interfaceTag__); \
465 msg__->status = (status__); \
466 msg__->action = (action__); \
467 msg__->getAddressCount = (getAddressCount__); \
468 msg__->getAddresses = (getAddresses__);
469
470#define CsrWifiSmeBlacklistCfmSendTo(dst__, src__, interfaceTag__, status__, action__, getAddressCount__, getAddresses__) \
471 { \
472 CsrWifiSmeBlacklistCfm *msg__; \
473 CsrWifiSmeBlacklistCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getAddressCount__, getAddresses__); \
474 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
475 }
476
477#define CsrWifiSmeBlacklistCfmSend(dst__, interfaceTag__, status__, action__, getAddressCount__, getAddresses__) \
478 CsrWifiSmeBlacklistCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, action__, getAddressCount__, getAddresses__)
479
480/*******************************************************************************
481
482 NAME
483 CsrWifiSmeCalibrationDataGetReqSend
484
485 DESCRIPTION
486 This primitive retrieves the Wi-Fi radio calibration data.
487
488 PARAMETERS
489 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
490
491*******************************************************************************/
492#define CsrWifiSmeCalibrationDataGetReqCreate(msg__, dst__, src__) \
493 msg__ = kmalloc(sizeof(CsrWifiSmeCalibrationDataGetReq), GFP_KERNEL); \
494 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CALIBRATION_DATA_GET_REQ, dst__, src__);
495
496#define CsrWifiSmeCalibrationDataGetReqSendTo(dst__, src__) \
497 { \
498 CsrWifiSmeCalibrationDataGetReq *msg__; \
499 CsrWifiSmeCalibrationDataGetReqCreate(msg__, dst__, src__); \
500 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
501 }
502
503#define CsrWifiSmeCalibrationDataGetReqSend(src__) \
504 CsrWifiSmeCalibrationDataGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
505
506/*******************************************************************************
507
508 NAME
509 CsrWifiSmeCalibrationDataGetCfmSend
510
511 DESCRIPTION
512 This primitive reports the result of the request.
513
514 PARAMETERS
515 queue - Destination Task Queue
516 status - Reports the result of the request
517 calibrationDataLength - Number of bytes in the buffer pointed by
518 calibrationData
519 calibrationData - Pointer to a buffer of length calibrationDataLength
520 containing the calibration data
521
522*******************************************************************************/
523#define CsrWifiSmeCalibrationDataGetCfmCreate(msg__, dst__, src__, status__, calibrationDataLength__, calibrationData__) \
524 msg__ = kmalloc(sizeof(CsrWifiSmeCalibrationDataGetCfm), GFP_KERNEL); \
525 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CALIBRATION_DATA_GET_CFM, dst__, src__); \
526 msg__->status = (status__); \
527 msg__->calibrationDataLength = (calibrationDataLength__); \
528 msg__->calibrationData = (calibrationData__);
529
530#define CsrWifiSmeCalibrationDataGetCfmSendTo(dst__, src__, status__, calibrationDataLength__, calibrationData__) \
531 { \
532 CsrWifiSmeCalibrationDataGetCfm *msg__; \
533 CsrWifiSmeCalibrationDataGetCfmCreate(msg__, dst__, src__, status__, calibrationDataLength__, calibrationData__); \
534 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
535 }
536
537#define CsrWifiSmeCalibrationDataGetCfmSend(dst__, status__, calibrationDataLength__, calibrationData__) \
538 CsrWifiSmeCalibrationDataGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, calibrationDataLength__, calibrationData__)
539
540/*******************************************************************************
541
542 NAME
543 CsrWifiSmeCalibrationDataSetReqSend
544
545 DESCRIPTION
546 This primitive sets the Wi-Fi radio calibration data.
547 The usage of the primitive with proper calibration data will avoid
548 time-consuming configuration after power-up.
549
550 PARAMETERS
551 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
552 calibrationDataLength - Number of bytes in the buffer pointed by
553 calibrationData
554 calibrationData - Pointer to a buffer of length calibrationDataLength
555 containing the calibration data
556
557*******************************************************************************/
558#define CsrWifiSmeCalibrationDataSetReqCreate(msg__, dst__, src__, calibrationDataLength__, calibrationData__) \
559 msg__ = kmalloc(sizeof(CsrWifiSmeCalibrationDataSetReq), GFP_KERNEL); \
560 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CALIBRATION_DATA_SET_REQ, dst__, src__); \
561 msg__->calibrationDataLength = (calibrationDataLength__); \
562 msg__->calibrationData = (calibrationData__);
563
564#define CsrWifiSmeCalibrationDataSetReqSendTo(dst__, src__, calibrationDataLength__, calibrationData__) \
565 { \
566 CsrWifiSmeCalibrationDataSetReq *msg__; \
567 CsrWifiSmeCalibrationDataSetReqCreate(msg__, dst__, src__, calibrationDataLength__, calibrationData__); \
568 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
569 }
570
571#define CsrWifiSmeCalibrationDataSetReqSend(src__, calibrationDataLength__, calibrationData__) \
572 CsrWifiSmeCalibrationDataSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, calibrationDataLength__, calibrationData__)
573
574/*******************************************************************************
575
576 NAME
577 CsrWifiSmeCalibrationDataSetCfmSend
578
579 DESCRIPTION
580 This primitive reports the result of the request.
581
582 PARAMETERS
583 queue - Destination Task Queue
584 status - Reports the result of the request
585
586*******************************************************************************/
587#define CsrWifiSmeCalibrationDataSetCfmCreate(msg__, dst__, src__, status__) \
588 msg__ = kmalloc(sizeof(CsrWifiSmeCalibrationDataSetCfm), GFP_KERNEL); \
589 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CALIBRATION_DATA_SET_CFM, dst__, src__); \
590 msg__->status = (status__);
591
592#define CsrWifiSmeCalibrationDataSetCfmSendTo(dst__, src__, status__) \
593 { \
594 CsrWifiSmeCalibrationDataSetCfm *msg__; \
595 CsrWifiSmeCalibrationDataSetCfmCreate(msg__, dst__, src__, status__); \
596 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
597 }
598
599#define CsrWifiSmeCalibrationDataSetCfmSend(dst__, status__) \
600 CsrWifiSmeCalibrationDataSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
601
602/*******************************************************************************
603
604 NAME
605 CsrWifiSmeCcxConfigGetReqSend
606
607 DESCRIPTION
608 This primitive gets the value of the CcxConfig parameter.
609 CURRENTLY NOT SUPPORTED.
610
611 PARAMETERS
612 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
613 interfaceTag - Interface Identifier; unique identifier of an interface
614
615*******************************************************************************/
616#define CsrWifiSmeCcxConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \
617 msg__ = kmalloc(sizeof(CsrWifiSmeCcxConfigGetReq), GFP_KERNEL); \
618 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CCX_CONFIG_GET_REQ, dst__, src__); \
619 msg__->interfaceTag = (interfaceTag__);
620
621#define CsrWifiSmeCcxConfigGetReqSendTo(dst__, src__, interfaceTag__) \
622 { \
623 CsrWifiSmeCcxConfigGetReq *msg__; \
624 CsrWifiSmeCcxConfigGetReqCreate(msg__, dst__, src__, interfaceTag__); \
625 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
626 }
627
628#define CsrWifiSmeCcxConfigGetReqSend(src__, interfaceTag__) \
629 CsrWifiSmeCcxConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__)
630
631/*******************************************************************************
632
633 NAME
634 CsrWifiSmeCcxConfigGetCfmSend
635
636 DESCRIPTION
637 This primitive reports the result of the request.
638
639 PARAMETERS
640 queue - Destination Task Queue
641 interfaceTag - Interface Identifier; unique identifier of an interface
642 status - Reports the result of the request
643 ccxConfig - Currently not supported
644
645*******************************************************************************/
646#define CsrWifiSmeCcxConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, ccxConfig__) \
647 msg__ = kmalloc(sizeof(CsrWifiSmeCcxConfigGetCfm), GFP_KERNEL); \
648 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CCX_CONFIG_GET_CFM, dst__, src__); \
649 msg__->interfaceTag = (interfaceTag__); \
650 msg__->status = (status__); \
651 msg__->ccxConfig = (ccxConfig__);
652
653#define CsrWifiSmeCcxConfigGetCfmSendTo(dst__, src__, interfaceTag__, status__, ccxConfig__) \
654 { \
655 CsrWifiSmeCcxConfigGetCfm *msg__; \
656 CsrWifiSmeCcxConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, ccxConfig__); \
657 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
658 }
659
660#define CsrWifiSmeCcxConfigGetCfmSend(dst__, interfaceTag__, status__, ccxConfig__) \
661 CsrWifiSmeCcxConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, ccxConfig__)
662
663/*******************************************************************************
664
665 NAME
666 CsrWifiSmeCcxConfigSetReqSend
667
668 DESCRIPTION
669 This primitive sets the value of the CcxConfig parameter.
670 CURRENTLY NOT SUPPORTED.
671
672 PARAMETERS
673 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
674 interfaceTag - Interface Identifier; unique identifier of an interface
675 ccxConfig - Currently not supported
676
677*******************************************************************************/
678#define CsrWifiSmeCcxConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, ccxConfig__) \
679 msg__ = kmalloc(sizeof(CsrWifiSmeCcxConfigSetReq), GFP_KERNEL); \
680 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CCX_CONFIG_SET_REQ, dst__, src__); \
681 msg__->interfaceTag = (interfaceTag__); \
682 msg__->ccxConfig = (ccxConfig__);
683
684#define CsrWifiSmeCcxConfigSetReqSendTo(dst__, src__, interfaceTag__, ccxConfig__) \
685 { \
686 CsrWifiSmeCcxConfigSetReq *msg__; \
687 CsrWifiSmeCcxConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, ccxConfig__); \
688 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
689 }
690
691#define CsrWifiSmeCcxConfigSetReqSend(src__, interfaceTag__, ccxConfig__) \
692 CsrWifiSmeCcxConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, ccxConfig__)
693
694/*******************************************************************************
695
696 NAME
697 CsrWifiSmeCcxConfigSetCfmSend
698
699 DESCRIPTION
700 This primitive reports the result of the request.
701
702 PARAMETERS
703 queue - Destination Task Queue
704 interfaceTag - Interface Identifier; unique identifier of an interface
705 status - Reports the result of the request
706
707*******************************************************************************/
708#define CsrWifiSmeCcxConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
709 msg__ = kmalloc(sizeof(CsrWifiSmeCcxConfigSetCfm), GFP_KERNEL); \
710 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CCX_CONFIG_SET_CFM, dst__, src__); \
711 msg__->interfaceTag = (interfaceTag__); \
712 msg__->status = (status__);
713
714#define CsrWifiSmeCcxConfigSetCfmSendTo(dst__, src__, interfaceTag__, status__) \
715 { \
716 CsrWifiSmeCcxConfigSetCfm *msg__; \
717 CsrWifiSmeCcxConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
718 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
719 }
720
721#define CsrWifiSmeCcxConfigSetCfmSend(dst__, interfaceTag__, status__) \
722 CsrWifiSmeCcxConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
723
724/*******************************************************************************
725
726 NAME
727 CsrWifiSmeCloakedSsidsGetReqSend
728
729 DESCRIPTION
730 This primitive gets the value of the CloakedSsids parameter.
731
732 PARAMETERS
733 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
734
735*******************************************************************************/
736#define CsrWifiSmeCloakedSsidsGetReqCreate(msg__, dst__, src__) \
737 msg__ = kmalloc(sizeof(CsrWifiSmeCloakedSsidsGetReq), GFP_KERNEL); \
738 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CLOAKED_SSIDS_GET_REQ, dst__, src__);
739
740#define CsrWifiSmeCloakedSsidsGetReqSendTo(dst__, src__) \
741 { \
742 CsrWifiSmeCloakedSsidsGetReq *msg__; \
743 CsrWifiSmeCloakedSsidsGetReqCreate(msg__, dst__, src__); \
744 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
745 }
746
747#define CsrWifiSmeCloakedSsidsGetReqSend(src__) \
748 CsrWifiSmeCloakedSsidsGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
749
750/*******************************************************************************
751
752 NAME
753 CsrWifiSmeCloakedSsidsGetCfmSend
754
755 DESCRIPTION
756 This primitive reports the result of the request.
757
758 PARAMETERS
759 queue - Destination Task Queue
760 status - Reports the result of the request
761 cloakedSsids - Reports list of cloaked SSIDs that are explicitly scanned for
762 by the driver
763
764*******************************************************************************/
765#define CsrWifiSmeCloakedSsidsGetCfmCreate(msg__, dst__, src__, status__, cloakedSsids__) \
766 msg__ = kmalloc(sizeof(CsrWifiSmeCloakedSsidsGetCfm), GFP_KERNEL); \
767 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CLOAKED_SSIDS_GET_CFM, dst__, src__); \
768 msg__->status = (status__); \
769 msg__->cloakedSsids = (cloakedSsids__);
770
771#define CsrWifiSmeCloakedSsidsGetCfmSendTo(dst__, src__, status__, cloakedSsids__) \
772 { \
773 CsrWifiSmeCloakedSsidsGetCfm *msg__; \
774 CsrWifiSmeCloakedSsidsGetCfmCreate(msg__, dst__, src__, status__, cloakedSsids__); \
775 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
776 }
777
778#define CsrWifiSmeCloakedSsidsGetCfmSend(dst__, status__, cloakedSsids__) \
779 CsrWifiSmeCloakedSsidsGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, cloakedSsids__)
780
781/*******************************************************************************
782
783 NAME
784 CsrWifiSmeCloakedSsidsSetReqSend
785
786 DESCRIPTION
787 This primitive sets the list of cloaked SSIDs for which the WMA possesses
788 profiles.
789 When the driver detects a cloaked AP, the SME will explicitly scan for it
790 using the list of cloaked SSIDs provided it, and, if the scan succeeds,
791 it will report the AP to the WMA either via CSR_WIFI_SME_SCAN_RESULT_IND
792 (if registered) or via CSR_WIFI_SCAN_RESULT_GET_CFM.
793
794 PARAMETERS
795 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
796 cloakedSsids - Sets the list of cloaked SSIDs
797
798*******************************************************************************/
799#define CsrWifiSmeCloakedSsidsSetReqCreate(msg__, dst__, src__, cloakedSsids__) \
800 msg__ = kmalloc(sizeof(CsrWifiSmeCloakedSsidsSetReq), GFP_KERNEL); \
801 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CLOAKED_SSIDS_SET_REQ, dst__, src__); \
802 msg__->cloakedSsids = (cloakedSsids__);
803
804#define CsrWifiSmeCloakedSsidsSetReqSendTo(dst__, src__, cloakedSsids__) \
805 { \
806 CsrWifiSmeCloakedSsidsSetReq *msg__; \
807 CsrWifiSmeCloakedSsidsSetReqCreate(msg__, dst__, src__, cloakedSsids__); \
808 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
809 }
810
811#define CsrWifiSmeCloakedSsidsSetReqSend(src__, cloakedSsids__) \
812 CsrWifiSmeCloakedSsidsSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, cloakedSsids__)
813
814/*******************************************************************************
815
816 NAME
817 CsrWifiSmeCloakedSsidsSetCfmSend
818
819 DESCRIPTION
820 This primitive reports the result of the request.
821
822 PARAMETERS
823 queue - Destination Task Queue
824 status - Reports the result of the request
825
826*******************************************************************************/
827#define CsrWifiSmeCloakedSsidsSetCfmCreate(msg__, dst__, src__, status__) \
828 msg__ = kmalloc(sizeof(CsrWifiSmeCloakedSsidsSetCfm), GFP_KERNEL); \
829 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CLOAKED_SSIDS_SET_CFM, dst__, src__); \
830 msg__->status = (status__);
831
832#define CsrWifiSmeCloakedSsidsSetCfmSendTo(dst__, src__, status__) \
833 { \
834 CsrWifiSmeCloakedSsidsSetCfm *msg__; \
835 CsrWifiSmeCloakedSsidsSetCfmCreate(msg__, dst__, src__, status__); \
836 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
837 }
838
839#define CsrWifiSmeCloakedSsidsSetCfmSend(dst__, status__) \
840 CsrWifiSmeCloakedSsidsSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
841
842/*******************************************************************************
843
844 NAME
845 CsrWifiSmeCoexConfigGetReqSend
846
847 DESCRIPTION
848 This primitive gets the value of the CoexConfig parameter.
849
850 PARAMETERS
851 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
852
853*******************************************************************************/
854#define CsrWifiSmeCoexConfigGetReqCreate(msg__, dst__, src__) \
855 msg__ = kmalloc(sizeof(CsrWifiSmeCoexConfigGetReq), GFP_KERNEL); \
856 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_CONFIG_GET_REQ, dst__, src__);
857
858#define CsrWifiSmeCoexConfigGetReqSendTo(dst__, src__) \
859 { \
860 CsrWifiSmeCoexConfigGetReq *msg__; \
861 CsrWifiSmeCoexConfigGetReqCreate(msg__, dst__, src__); \
862 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
863 }
864
865#define CsrWifiSmeCoexConfigGetReqSend(src__) \
866 CsrWifiSmeCoexConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
867
868/*******************************************************************************
869
870 NAME
871 CsrWifiSmeCoexConfigGetCfmSend
872
873 DESCRIPTION
874 This primitive reports the result of the request.
875
876 PARAMETERS
877 queue - Destination Task Queue
878 status - Reports the result of the request
879 coexConfig - Reports the parameters used to configure the coexistence
880 behaviour
881
882*******************************************************************************/
883#define CsrWifiSmeCoexConfigGetCfmCreate(msg__, dst__, src__, status__, coexConfig__) \
884 msg__ = kmalloc(sizeof(CsrWifiSmeCoexConfigGetCfm), GFP_KERNEL); \
885 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_CONFIG_GET_CFM, dst__, src__); \
886 msg__->status = (status__); \
887 msg__->coexConfig = (coexConfig__);
888
889#define CsrWifiSmeCoexConfigGetCfmSendTo(dst__, src__, status__, coexConfig__) \
890 { \
891 CsrWifiSmeCoexConfigGetCfm *msg__; \
892 CsrWifiSmeCoexConfigGetCfmCreate(msg__, dst__, src__, status__, coexConfig__); \
893 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
894 }
895
896#define CsrWifiSmeCoexConfigGetCfmSend(dst__, status__, coexConfig__) \
897 CsrWifiSmeCoexConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, coexConfig__)
898
899/*******************************************************************************
900
901 NAME
902 CsrWifiSmeCoexConfigSetReqSend
903
904 DESCRIPTION
905 This primitive sets the value of the CoexConfig parameter.
906
907 PARAMETERS
908 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
909 coexConfig - Configures the coexistence behaviour
910
911*******************************************************************************/
912#define CsrWifiSmeCoexConfigSetReqCreate(msg__, dst__, src__, coexConfig__) \
913 msg__ = kmalloc(sizeof(CsrWifiSmeCoexConfigSetReq), GFP_KERNEL); \
914 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_CONFIG_SET_REQ, dst__, src__); \
915 msg__->coexConfig = (coexConfig__);
916
917#define CsrWifiSmeCoexConfigSetReqSendTo(dst__, src__, coexConfig__) \
918 { \
919 CsrWifiSmeCoexConfigSetReq *msg__; \
920 CsrWifiSmeCoexConfigSetReqCreate(msg__, dst__, src__, coexConfig__); \
921 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
922 }
923
924#define CsrWifiSmeCoexConfigSetReqSend(src__, coexConfig__) \
925 CsrWifiSmeCoexConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, coexConfig__)
926
927/*******************************************************************************
928
929 NAME
930 CsrWifiSmeCoexConfigSetCfmSend
931
932 DESCRIPTION
933 This primitive reports the result of the request.
934
935 PARAMETERS
936 queue - Destination Task Queue
937 status - Reports the result of the request
938
939*******************************************************************************/
940#define CsrWifiSmeCoexConfigSetCfmCreate(msg__, dst__, src__, status__) \
941 msg__ = kmalloc(sizeof(CsrWifiSmeCoexConfigSetCfm), GFP_KERNEL); \
942 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_CONFIG_SET_CFM, dst__, src__); \
943 msg__->status = (status__);
944
945#define CsrWifiSmeCoexConfigSetCfmSendTo(dst__, src__, status__) \
946 { \
947 CsrWifiSmeCoexConfigSetCfm *msg__; \
948 CsrWifiSmeCoexConfigSetCfmCreate(msg__, dst__, src__, status__); \
949 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
950 }
951
952#define CsrWifiSmeCoexConfigSetCfmSend(dst__, status__) \
953 CsrWifiSmeCoexConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
954
955/*******************************************************************************
956
957 NAME
958 CsrWifiSmeCoexInfoGetReqSend
959
960 DESCRIPTION
961 This primitive gets the value of the CoexInfo parameter.
962
963 PARAMETERS
964 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
965
966*******************************************************************************/
967#define CsrWifiSmeCoexInfoGetReqCreate(msg__, dst__, src__) \
968 msg__ = kmalloc(sizeof(CsrWifiSmeCoexInfoGetReq), GFP_KERNEL); \
969 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_INFO_GET_REQ, dst__, src__);
970
971#define CsrWifiSmeCoexInfoGetReqSendTo(dst__, src__) \
972 { \
973 CsrWifiSmeCoexInfoGetReq *msg__; \
974 CsrWifiSmeCoexInfoGetReqCreate(msg__, dst__, src__); \
975 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
976 }
977
978#define CsrWifiSmeCoexInfoGetReqSend(src__) \
979 CsrWifiSmeCoexInfoGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
980
981/*******************************************************************************
982
983 NAME
984 CsrWifiSmeCoexInfoGetCfmSend
985
986 DESCRIPTION
987 This primitive reports the result of the request.
988
989 PARAMETERS
990 queue - Destination Task Queue
991 status - Reports the result of the request
992 coexInfo - Reports information and state related to coexistence.
993
994*******************************************************************************/
995#define CsrWifiSmeCoexInfoGetCfmCreate(msg__, dst__, src__, status__, coexInfo__) \
996 msg__ = kmalloc(sizeof(CsrWifiSmeCoexInfoGetCfm), GFP_KERNEL); \
997 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_COEX_INFO_GET_CFM, dst__, src__); \
998 msg__->status = (status__); \
999 msg__->coexInfo = (coexInfo__);
1000
1001#define CsrWifiSmeCoexInfoGetCfmSendTo(dst__, src__, status__, coexInfo__) \
1002 { \
1003 CsrWifiSmeCoexInfoGetCfm *msg__; \
1004 CsrWifiSmeCoexInfoGetCfmCreate(msg__, dst__, src__, status__, coexInfo__); \
1005 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1006 }
1007
1008#define CsrWifiSmeCoexInfoGetCfmSend(dst__, status__, coexInfo__) \
1009 CsrWifiSmeCoexInfoGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, coexInfo__)
1010
1011/*******************************************************************************
1012
1013 NAME
1014 CsrWifiSmeConnectReqSend
1015
1016 DESCRIPTION
1017 The wireless manager application calls this primitive to start the
1018 process of joining an 802.11 wireless network or to start an ad hoc
1019 network.
1020 The structure pointed by connectionConfig contains parameters describing
1021 the network to join or, in case of an ad hoc network, to host or join.
1022 The SME will select a network, perform the IEEE 802.11 Join, Authenticate
1023 and Associate exchanges.
1024 The SME selects the networks from the current scan list that match both
1025 the SSID and BSSID, however either or both of these may be the wildcard
1026 value. Using this rule, the following operations are possible:
1027 * To connect to a network by name, specify the SSID and set the BSSID to
1028 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF. If there are two or more networks visible,
1029 the SME will select the one with the strongest signal.
1030 * To connect to a specific network, specify the BSSID. The SSID is
1031 optional, but if given it must match the SSID of the network. An empty
1032 SSID may be specified by setting the SSID length to zero. Please note
1033 that if the BSSID is specified (i.e. not equal to 0xFF 0xFF 0xFF 0xFF
1034 0xFF 0xFF), the SME will not attempt to roam if signal conditions become
1035 poor, even if there is an alternative AP with an SSID that matches the
1036 current network SSID.
1037 * To connect to any network matching the other parameters (i.e. security,
1038 etc), set the SSID length to zero and set the BSSID to 0xFF 0xFF 0xFF
1039 0xFF 0xFF 0xFF. In this case, the SME will order all available networks
1040 by their signal strengths and will iterate through this list until it
1041 successfully connects.
1042 NOTE: Specifying the BSSID will restrict the selection to one specific
1043 network. If SSID and BSSID are given, they must both match the network
1044 for it to be selected. To select a network based on the SSID only, the
1045 wireless manager application must set the BSSID to 0xFF 0xFF 0xFF 0xFF
1046 0xFF 0xFF.
1047 The SME will try to connect to each network that matches the provided
1048 parameters, one by one, until it succeeds or has tried unsuccessfully
1049 with all the matching networks.
1050 If there is no network that matches the parameters and the request allows
1051 to host an ad hoc network, the SME will advertise a new ad hoc network
1052 instead.
1053 If the SME cannot connect, it will notify the failure in the confirm.
1054
1055 PARAMETERS
1056 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1057 interfaceTag - Interface Identifier; unique identifier of an interface
1058 connectionConfig - Describes the candidate network to join or to host.
1059
1060*******************************************************************************/
1061#define CsrWifiSmeConnectReqCreate(msg__, dst__, src__, interfaceTag__, connectionConfig__) \
1062 msg__ = kmalloc(sizeof(CsrWifiSmeConnectReq), GFP_KERNEL); \
1063 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECT_REQ, dst__, src__); \
1064 msg__->interfaceTag = (interfaceTag__); \
1065 msg__->connectionConfig = (connectionConfig__);
1066
1067#define CsrWifiSmeConnectReqSendTo(dst__, src__, interfaceTag__, connectionConfig__) \
1068 { \
1069 CsrWifiSmeConnectReq *msg__; \
1070 CsrWifiSmeConnectReqCreate(msg__, dst__, src__, interfaceTag__, connectionConfig__); \
1071 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1072 }
1073
1074#define CsrWifiSmeConnectReqSend(src__, interfaceTag__, connectionConfig__) \
1075 CsrWifiSmeConnectReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, connectionConfig__)
1076
1077/*******************************************************************************
1078
1079 NAME
1080 CsrWifiSmeConnectCfmSend
1081
1082 DESCRIPTION
1083 The SME calls this primitive when the connection exchange is complete or
1084 all connection attempts fail.
1085
1086 PARAMETERS
1087 queue - Destination Task Queue
1088 interfaceTag - Interface Identifier; unique identifier of an interface
1089 status - Reports the result of the request.
1090 CSR_WIFI_SME_STATUS_NOT_FOUND: all attempts by the SME to
1091 locate the requested AP failed
1092
1093*******************************************************************************/
1094#define CsrWifiSmeConnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
1095 msg__ = kmalloc(sizeof(CsrWifiSmeConnectCfm), GFP_KERNEL); \
1096 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECT_CFM, dst__, src__); \
1097 msg__->interfaceTag = (interfaceTag__); \
1098 msg__->status = (status__);
1099
1100#define CsrWifiSmeConnectCfmSendTo(dst__, src__, interfaceTag__, status__) \
1101 { \
1102 CsrWifiSmeConnectCfm *msg__; \
1103 CsrWifiSmeConnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
1104 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1105 }
1106
1107#define CsrWifiSmeConnectCfmSend(dst__, interfaceTag__, status__) \
1108 CsrWifiSmeConnectCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
1109
1110/*******************************************************************************
1111
1112 NAME
1113 CsrWifiSmeConnectionConfigGetReqSend
1114
1115 DESCRIPTION
1116 This primitive gets the value of the ConnectionConfig parameter.
1117
1118 PARAMETERS
1119 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1120 interfaceTag - Interface Identifier; unique identifier of an interface
1121
1122*******************************************************************************/
1123#define CsrWifiSmeConnectionConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \
1124 msg__ = kmalloc(sizeof(CsrWifiSmeConnectionConfigGetReq), GFP_KERNEL); \
1125 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_CONFIG_GET_REQ, dst__, src__); \
1126 msg__->interfaceTag = (interfaceTag__);
1127
1128#define CsrWifiSmeConnectionConfigGetReqSendTo(dst__, src__, interfaceTag__) \
1129 { \
1130 CsrWifiSmeConnectionConfigGetReq *msg__; \
1131 CsrWifiSmeConnectionConfigGetReqCreate(msg__, dst__, src__, interfaceTag__); \
1132 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1133 }
1134
1135#define CsrWifiSmeConnectionConfigGetReqSend(src__, interfaceTag__) \
1136 CsrWifiSmeConnectionConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__)
1137
1138/*******************************************************************************
1139
1140 NAME
1141 CsrWifiSmeConnectionConfigGetCfmSend
1142
1143 DESCRIPTION
1144 This primitive reports the result of the request.
1145
1146 PARAMETERS
1147 queue - Destination Task Queue
1148 interfaceTag - Interface Identifier; unique identifier of an interface
1149 status - Reports the result of the request
1150 connectionConfig - Parameters used by the SME for selecting a network
1151
1152*******************************************************************************/
1153#define CsrWifiSmeConnectionConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionConfig__) \
1154 msg__ = kmalloc(sizeof(CsrWifiSmeConnectionConfigGetCfm), GFP_KERNEL); \
1155 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_CONFIG_GET_CFM, dst__, src__); \
1156 msg__->interfaceTag = (interfaceTag__); \
1157 msg__->status = (status__); \
1158 msg__->connectionConfig = (connectionConfig__);
1159
1160#define CsrWifiSmeConnectionConfigGetCfmSendTo(dst__, src__, interfaceTag__, status__, connectionConfig__) \
1161 { \
1162 CsrWifiSmeConnectionConfigGetCfm *msg__; \
1163 CsrWifiSmeConnectionConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionConfig__); \
1164 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1165 }
1166
1167#define CsrWifiSmeConnectionConfigGetCfmSend(dst__, interfaceTag__, status__, connectionConfig__) \
1168 CsrWifiSmeConnectionConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, connectionConfig__)
1169
1170/*******************************************************************************
1171
1172 NAME
1173 CsrWifiSmeConnectionInfoGetReqSend
1174
1175 DESCRIPTION
1176 This primitive gets the value of the ConnectionInfo parameter.
1177
1178 PARAMETERS
1179 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1180 interfaceTag - Interface Identifier; unique identifier of an interface
1181
1182*******************************************************************************/
1183#define CsrWifiSmeConnectionInfoGetReqCreate(msg__, dst__, src__, interfaceTag__) \
1184 msg__ = kmalloc(sizeof(CsrWifiSmeConnectionInfoGetReq), GFP_KERNEL); \
1185 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_INFO_GET_REQ, dst__, src__); \
1186 msg__->interfaceTag = (interfaceTag__);
1187
1188#define CsrWifiSmeConnectionInfoGetReqSendTo(dst__, src__, interfaceTag__) \
1189 { \
1190 CsrWifiSmeConnectionInfoGetReq *msg__; \
1191 CsrWifiSmeConnectionInfoGetReqCreate(msg__, dst__, src__, interfaceTag__); \
1192 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1193 }
1194
1195#define CsrWifiSmeConnectionInfoGetReqSend(src__, interfaceTag__) \
1196 CsrWifiSmeConnectionInfoGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__)
1197
1198/*******************************************************************************
1199
1200 NAME
1201 CsrWifiSmeConnectionInfoGetCfmSend
1202
1203 DESCRIPTION
1204 This primitive reports the result of the request.
1205
1206 PARAMETERS
1207 queue - Destination Task Queue
1208 interfaceTag - Interface Identifier; unique identifier of an interface
1209 status - Reports the result of the request
1210 connectionInfo - Information about the current connection
1211
1212*******************************************************************************/
1213#define CsrWifiSmeConnectionInfoGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionInfo__) \
1214 msg__ = kmalloc(sizeof(CsrWifiSmeConnectionInfoGetCfm), GFP_KERNEL); \
1215 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_INFO_GET_CFM, dst__, src__); \
1216 msg__->interfaceTag = (interfaceTag__); \
1217 msg__->status = (status__); \
1218 msg__->connectionInfo = (connectionInfo__);
1219
1220#define CsrWifiSmeConnectionInfoGetCfmSendTo(dst__, src__, interfaceTag__, status__, connectionInfo__) \
1221 { \
1222 CsrWifiSmeConnectionInfoGetCfm *msg__; \
1223 CsrWifiSmeConnectionInfoGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionInfo__); \
1224 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1225 }
1226
1227#define CsrWifiSmeConnectionInfoGetCfmSend(dst__, interfaceTag__, status__, connectionInfo__) \
1228 CsrWifiSmeConnectionInfoGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, connectionInfo__)
1229
1230/*******************************************************************************
1231
1232 NAME
1233 CsrWifiSmeConnectionQualityIndSend
1234
1235 DESCRIPTION
1236 The SME sends this primitive to all the tasks that have registered to
1237 receive it whenever the value of the current connection quality
1238 parameters change by more than a certain configurable amount.
1239 The wireless manager application may configure the trigger thresholds for
1240 this indication using the field in smeConfig parameter of
1241 CSR_WIFI_SME_SME_CONFIG_SET_REQ.
1242 Connection quality messages can be suppressed by setting both thresholds
1243 to zero.
1244
1245 PARAMETERS
1246 queue - Destination Task Queue
1247 interfaceTag - Interface Identifier; unique identifier of an interface
1248 linkQuality - Indicates the quality of the link
1249
1250*******************************************************************************/
1251#define CsrWifiSmeConnectionQualityIndCreate(msg__, dst__, src__, interfaceTag__, linkQuality__) \
1252 msg__ = kmalloc(sizeof(CsrWifiSmeConnectionQualityInd), GFP_KERNEL); \
1253 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_QUALITY_IND, dst__, src__); \
1254 msg__->interfaceTag = (interfaceTag__); \
1255 msg__->linkQuality = (linkQuality__);
1256
1257#define CsrWifiSmeConnectionQualityIndSendTo(dst__, src__, interfaceTag__, linkQuality__) \
1258 { \
1259 CsrWifiSmeConnectionQualityInd *msg__; \
1260 CsrWifiSmeConnectionQualityIndCreate(msg__, dst__, src__, interfaceTag__, linkQuality__); \
1261 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1262 }
1263
1264#define CsrWifiSmeConnectionQualityIndSend(dst__, interfaceTag__, linkQuality__) \
1265 CsrWifiSmeConnectionQualityIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, linkQuality__)
1266
1267/*******************************************************************************
1268
1269 NAME
1270 CsrWifiSmeConnectionStatsGetReqSend
1271
1272 DESCRIPTION
1273 This primitive gets the value of the ConnectionStats parameter.
1274
1275 PARAMETERS
1276 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1277 interfaceTag - Interface Identifier; unique identifier of an interface
1278
1279*******************************************************************************/
1280#define CsrWifiSmeConnectionStatsGetReqCreate(msg__, dst__, src__, interfaceTag__) \
1281 msg__ = kmalloc(sizeof(CsrWifiSmeConnectionStatsGetReq), GFP_KERNEL); \
1282 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_STATS_GET_REQ, dst__, src__); \
1283 msg__->interfaceTag = (interfaceTag__);
1284
1285#define CsrWifiSmeConnectionStatsGetReqSendTo(dst__, src__, interfaceTag__) \
1286 { \
1287 CsrWifiSmeConnectionStatsGetReq *msg__; \
1288 CsrWifiSmeConnectionStatsGetReqCreate(msg__, dst__, src__, interfaceTag__); \
1289 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1290 }
1291
1292#define CsrWifiSmeConnectionStatsGetReqSend(src__, interfaceTag__) \
1293 CsrWifiSmeConnectionStatsGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__)
1294
1295/*******************************************************************************
1296
1297 NAME
1298 CsrWifiSmeConnectionStatsGetCfmSend
1299
1300 DESCRIPTION
1301 This primitive reports the result of the request.
1302
1303 PARAMETERS
1304 queue - Destination Task Queue
1305 interfaceTag - Interface Identifier; unique identifier of an interface
1306 status - Reports the result of the request
1307 connectionStats - Statistics for current connection.
1308
1309*******************************************************************************/
1310#define CsrWifiSmeConnectionStatsGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionStats__) \
1311 msg__ = kmalloc(sizeof(CsrWifiSmeConnectionStatsGetCfm), GFP_KERNEL); \
1312 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CONNECTION_STATS_GET_CFM, dst__, src__); \
1313 msg__->interfaceTag = (interfaceTag__); \
1314 msg__->status = (status__); \
1315 msg__->connectionStats = (connectionStats__);
1316
1317#define CsrWifiSmeConnectionStatsGetCfmSendTo(dst__, src__, interfaceTag__, status__, connectionStats__) \
1318 { \
1319 CsrWifiSmeConnectionStatsGetCfm *msg__; \
1320 CsrWifiSmeConnectionStatsGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionStats__); \
1321 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1322 }
1323
1324#define CsrWifiSmeConnectionStatsGetCfmSend(dst__, interfaceTag__, status__, connectionStats__) \
1325 CsrWifiSmeConnectionStatsGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, connectionStats__)
1326
1327/*******************************************************************************
1328
1329 NAME
1330 CsrWifiSmeCoreDumpIndSend
1331
1332 DESCRIPTION
1333 The SME will send this primitive to all the tasks that have registered to
1334 receive Wi-Fi Chip core dump data.
1335 The core dump data may be fragmented and sent using more than one
1336 indication.
1337 To indicate that all the data has been sent, the last indication contains
1338 a 'length' of 0 and 'data' of NULL.
1339
1340 PARAMETERS
1341 queue - Destination Task Queue
1342 dataLength - Number of bytes in the buffer pointed to by 'data'
1343 data - Pointer to the buffer containing 'dataLength' bytes of core
1344 dump data
1345
1346*******************************************************************************/
1347#define CsrWifiSmeCoreDumpIndCreate(msg__, dst__, src__, dataLength__, data__) \
1348 msg__ = kmalloc(sizeof(CsrWifiSmeCoreDumpInd), GFP_KERNEL); \
1349 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_CORE_DUMP_IND, dst__, src__); \
1350 msg__->dataLength = (dataLength__); \
1351 msg__->data = (data__);
1352
1353#define CsrWifiSmeCoreDumpIndSendTo(dst__, src__, dataLength__, data__) \
1354 { \
1355 CsrWifiSmeCoreDumpInd *msg__; \
1356 CsrWifiSmeCoreDumpIndCreate(msg__, dst__, src__, dataLength__, data__); \
1357 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1358 }
1359
1360#define CsrWifiSmeCoreDumpIndSend(dst__, dataLength__, data__) \
1361 CsrWifiSmeCoreDumpIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, dataLength__, data__)
1362
1363/*******************************************************************************
1364
1365 NAME
1366 CsrWifiSmeDeactivateReqSend
1367
1368 DESCRIPTION
1369 The WMA sends this primitive to deactivate the SME.
1370
1371 PARAMETERS
1372 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1373
1374*******************************************************************************/
1375#define CsrWifiSmeDeactivateReqCreate(msg__, dst__, src__) \
1376 msg__ = kmalloc(sizeof(CsrWifiSmeDeactivateReq), GFP_KERNEL); \
1377 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_DEACTIVATE_REQ, dst__, src__);
1378
1379#define CsrWifiSmeDeactivateReqSendTo(dst__, src__) \
1380 { \
1381 CsrWifiSmeDeactivateReq *msg__; \
1382 CsrWifiSmeDeactivateReqCreate(msg__, dst__, src__); \
1383 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1384 }
1385
1386#define CsrWifiSmeDeactivateReqSend(src__) \
1387 CsrWifiSmeDeactivateReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
1388
1389/*******************************************************************************
1390
1391 NAME
1392 CsrWifiSmeDeactivateCfmSend
1393
1394 DESCRIPTION
1395 The SME sends this primitive when the deactivation is complete.
1396 The WMA cannot send any more primitives until it actives the SME again
1397 sending another CSR_WIFI_SME_ACTIVATE_REQ.
1398
1399 PARAMETERS
1400 queue - Destination Task Queue
1401 status - Reports the result of the request
1402
1403*******************************************************************************/
1404#define CsrWifiSmeDeactivateCfmCreate(msg__, dst__, src__, status__) \
1405 msg__ = kmalloc(sizeof(CsrWifiSmeDeactivateCfm), GFP_KERNEL); \
1406 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_DEACTIVATE_CFM, dst__, src__); \
1407 msg__->status = (status__);
1408
1409#define CsrWifiSmeDeactivateCfmSendTo(dst__, src__, status__) \
1410 { \
1411 CsrWifiSmeDeactivateCfm *msg__; \
1412 CsrWifiSmeDeactivateCfmCreate(msg__, dst__, src__, status__); \
1413 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1414 }
1415
1416#define CsrWifiSmeDeactivateCfmSend(dst__, status__) \
1417 CsrWifiSmeDeactivateCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
1418
1419/*******************************************************************************
1420
1421 NAME
1422 CsrWifiSmeDisconnectReqSend
1423
1424 DESCRIPTION
1425 The wireless manager application may disconnect from the current network
1426 by calling this primitive
1427
1428 PARAMETERS
1429 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1430 interfaceTag - Interface Identifier; unique identifier of an interface
1431
1432*******************************************************************************/
1433#define CsrWifiSmeDisconnectReqCreate(msg__, dst__, src__, interfaceTag__) \
1434 msg__ = kmalloc(sizeof(CsrWifiSmeDisconnectReq), GFP_KERNEL); \
1435 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_DISCONNECT_REQ, dst__, src__); \
1436 msg__->interfaceTag = (interfaceTag__);
1437
1438#define CsrWifiSmeDisconnectReqSendTo(dst__, src__, interfaceTag__) \
1439 { \
1440 CsrWifiSmeDisconnectReq *msg__; \
1441 CsrWifiSmeDisconnectReqCreate(msg__, dst__, src__, interfaceTag__); \
1442 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1443 }
1444
1445#define CsrWifiSmeDisconnectReqSend(src__, interfaceTag__) \
1446 CsrWifiSmeDisconnectReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__)
1447
1448/*******************************************************************************
1449
1450 NAME
1451 CsrWifiSmeDisconnectCfmSend
1452
1453 DESCRIPTION
1454 On reception of CSR_WIFI_SME_DISCONNECT_REQ the SME will perform a
1455 disconnect operation, sending a CsrWifiSmeMediaStatusInd with
1456 CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED and then call this primitive when
1457 disconnection is complete.
1458
1459 PARAMETERS
1460 queue - Destination Task Queue
1461 interfaceTag - Interface Identifier; unique identifier of an interface
1462 status - Reports the result of the request
1463
1464*******************************************************************************/
1465#define CsrWifiSmeDisconnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
1466 msg__ = kmalloc(sizeof(CsrWifiSmeDisconnectCfm), GFP_KERNEL); \
1467 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_DISCONNECT_CFM, dst__, src__); \
1468 msg__->interfaceTag = (interfaceTag__); \
1469 msg__->status = (status__);
1470
1471#define CsrWifiSmeDisconnectCfmSendTo(dst__, src__, interfaceTag__, status__) \
1472 { \
1473 CsrWifiSmeDisconnectCfm *msg__; \
1474 CsrWifiSmeDisconnectCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
1475 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1476 }
1477
1478#define CsrWifiSmeDisconnectCfmSend(dst__, interfaceTag__, status__) \
1479 CsrWifiSmeDisconnectCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
1480
1481/*******************************************************************************
1482
1483 NAME
1484 CsrWifiSmeErrorIndSend
1485
1486 DESCRIPTION
1487 Important error message indicating a error of some importance
1488
1489 PARAMETERS
1490 queue - Destination Task Queue
1491 errorMessage - Contains the error message.
1492
1493*******************************************************************************/
1494#define CsrWifiSmeErrorIndCreate(msg__, dst__, src__, errorMessage__) \
1495 msg__ = kmalloc(sizeof(CsrWifiSmeErrorInd), GFP_KERNEL); \
1496 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ERROR_IND, dst__, src__); \
1497 msg__->errorMessage = (errorMessage__);
1498
1499#define CsrWifiSmeErrorIndSendTo(dst__, src__, errorMessage__) \
1500 { \
1501 CsrWifiSmeErrorInd *msg__; \
1502 CsrWifiSmeErrorIndCreate(msg__, dst__, src__, errorMessage__); \
1503 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1504 }
1505
1506#define CsrWifiSmeErrorIndSend(dst__, errorMessage__) \
1507 CsrWifiSmeErrorIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, errorMessage__)
1508
1509/*******************************************************************************
1510
1511 NAME
1512 CsrWifiSmeEventMaskSetReqSend
1513
1514 DESCRIPTION
1515 The wireless manager application may register with the SME to receive
1516 notification of interesting events. Indications will be sent only if the
1517 wireless manager explicitly registers to be notified of that event.
1518 indMask is a bit mask of values defined in CsrWifiSmeIndicationsMask.
1519
1520 PARAMETERS
1521 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1522 indMask - Set mask with values from CsrWifiSmeIndications
1523
1524*******************************************************************************/
1525#define CsrWifiSmeEventMaskSetReqCreate(msg__, dst__, src__, indMask__) \
1526 msg__ = kmalloc(sizeof(CsrWifiSmeEventMaskSetReq), GFP_KERNEL); \
1527 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_EVENT_MASK_SET_REQ, dst__, src__); \
1528 msg__->indMask = (indMask__);
1529
1530#define CsrWifiSmeEventMaskSetReqSendTo(dst__, src__, indMask__) \
1531 { \
1532 CsrWifiSmeEventMaskSetReq *msg__; \
1533 CsrWifiSmeEventMaskSetReqCreate(msg__, dst__, src__, indMask__); \
1534 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1535 }
1536
1537#define CsrWifiSmeEventMaskSetReqSend(src__, indMask__) \
1538 CsrWifiSmeEventMaskSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, indMask__)
1539
1540/*******************************************************************************
1541
1542 NAME
1543 CsrWifiSmeEventMaskSetCfmSend
1544
1545 DESCRIPTION
1546 The SME calls the primitive to report the result of the request
1547 primitive.
1548
1549 PARAMETERS
1550 queue - Destination Task Queue
1551 status - Reports the result of the request
1552
1553*******************************************************************************/
1554#define CsrWifiSmeEventMaskSetCfmCreate(msg__, dst__, src__, status__) \
1555 msg__ = kmalloc(sizeof(CsrWifiSmeEventMaskSetCfm), GFP_KERNEL); \
1556 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_EVENT_MASK_SET_CFM, dst__, src__); \
1557 msg__->status = (status__);
1558
1559#define CsrWifiSmeEventMaskSetCfmSendTo(dst__, src__, status__) \
1560 { \
1561 CsrWifiSmeEventMaskSetCfm *msg__; \
1562 CsrWifiSmeEventMaskSetCfmCreate(msg__, dst__, src__, status__); \
1563 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1564 }
1565
1566#define CsrWifiSmeEventMaskSetCfmSend(dst__, status__) \
1567 CsrWifiSmeEventMaskSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
1568
1569/*******************************************************************************
1570
1571 NAME
1572 CsrWifiSmeHostConfigGetReqSend
1573
1574 DESCRIPTION
1575 This primitive gets the value of the hostConfig parameter.
1576
1577 PARAMETERS
1578 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1579 interfaceTag - Interface Identifier; unique identifier of an interface
1580
1581*******************************************************************************/
1582#define CsrWifiSmeHostConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \
1583 msg__ = kmalloc(sizeof(CsrWifiSmeHostConfigGetReq), GFP_KERNEL); \
1584 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_HOST_CONFIG_GET_REQ, dst__, src__); \
1585 msg__->interfaceTag = (interfaceTag__);
1586
1587#define CsrWifiSmeHostConfigGetReqSendTo(dst__, src__, interfaceTag__) \
1588 { \
1589 CsrWifiSmeHostConfigGetReq *msg__; \
1590 CsrWifiSmeHostConfigGetReqCreate(msg__, dst__, src__, interfaceTag__); \
1591 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1592 }
1593
1594#define CsrWifiSmeHostConfigGetReqSend(src__, interfaceTag__) \
1595 CsrWifiSmeHostConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__)
1596
1597/*******************************************************************************
1598
1599 NAME
1600 CsrWifiSmeHostConfigGetCfmSend
1601
1602 DESCRIPTION
1603 This primitive reports the result of the request.
1604
1605 PARAMETERS
1606 queue - Destination Task Queue
1607 interfaceTag - Interface Identifier; unique identifier of an interface
1608 status - Reports the result of the request
1609 hostConfig - Current host power state.
1610
1611*******************************************************************************/
1612#define CsrWifiSmeHostConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, hostConfig__) \
1613 msg__ = kmalloc(sizeof(CsrWifiSmeHostConfigGetCfm), GFP_KERNEL); \
1614 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_HOST_CONFIG_GET_CFM, dst__, src__); \
1615 msg__->interfaceTag = (interfaceTag__); \
1616 msg__->status = (status__); \
1617 msg__->hostConfig = (hostConfig__);
1618
1619#define CsrWifiSmeHostConfigGetCfmSendTo(dst__, src__, interfaceTag__, status__, hostConfig__) \
1620 { \
1621 CsrWifiSmeHostConfigGetCfm *msg__; \
1622 CsrWifiSmeHostConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, hostConfig__); \
1623 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1624 }
1625
1626#define CsrWifiSmeHostConfigGetCfmSend(dst__, interfaceTag__, status__, hostConfig__) \
1627 CsrWifiSmeHostConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, hostConfig__)
1628
1629/*******************************************************************************
1630
1631 NAME
1632 CsrWifiSmeHostConfigSetReqSend
1633
1634 DESCRIPTION
1635 This primitive sets the value of the hostConfig parameter.
1636
1637 PARAMETERS
1638 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1639 interfaceTag - Interface Identifier; unique identifier of an interface
1640 hostConfig - Communicates a change of host power state (for example, on
1641 mains power, on battery power etc) and of the periodicity of
1642 traffic data
1643
1644*******************************************************************************/
1645#define CsrWifiSmeHostConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, hostConfig__) \
1646 msg__ = kmalloc(sizeof(CsrWifiSmeHostConfigSetReq), GFP_KERNEL); \
1647 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_HOST_CONFIG_SET_REQ, dst__, src__); \
1648 msg__->interfaceTag = (interfaceTag__); \
1649 msg__->hostConfig = (hostConfig__);
1650
1651#define CsrWifiSmeHostConfigSetReqSendTo(dst__, src__, interfaceTag__, hostConfig__) \
1652 { \
1653 CsrWifiSmeHostConfigSetReq *msg__; \
1654 CsrWifiSmeHostConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, hostConfig__); \
1655 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1656 }
1657
1658#define CsrWifiSmeHostConfigSetReqSend(src__, interfaceTag__, hostConfig__) \
1659 CsrWifiSmeHostConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, hostConfig__)
1660
1661/*******************************************************************************
1662
1663 NAME
1664 CsrWifiSmeHostConfigSetCfmSend
1665
1666 DESCRIPTION
1667 This primitive reports the result of the request.
1668
1669 PARAMETERS
1670 queue - Destination Task Queue
1671 interfaceTag - Interface Identifier; unique identifier of an interface
1672 status - Reports the result of the request
1673
1674*******************************************************************************/
1675#define CsrWifiSmeHostConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
1676 msg__ = kmalloc(sizeof(CsrWifiSmeHostConfigSetCfm), GFP_KERNEL); \
1677 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_HOST_CONFIG_SET_CFM, dst__, src__); \
1678 msg__->interfaceTag = (interfaceTag__); \
1679 msg__->status = (status__);
1680
1681#define CsrWifiSmeHostConfigSetCfmSendTo(dst__, src__, interfaceTag__, status__) \
1682 { \
1683 CsrWifiSmeHostConfigSetCfm *msg__; \
1684 CsrWifiSmeHostConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
1685 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1686 }
1687
1688#define CsrWifiSmeHostConfigSetCfmSend(dst__, interfaceTag__, status__) \
1689 CsrWifiSmeHostConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
1690
1691/*******************************************************************************
1692
1693 NAME
1694 CsrWifiSmeIbssStationIndSend
1695
1696 DESCRIPTION
1697 The SME will send this primitive to indicate that a station has joined or
1698 left the ad-hoc network.
1699
1700 PARAMETERS
1701 queue - Destination Task Queue
1702 address - MAC address of the station that has joined or left
1703 isconnected - TRUE if the station joined, FALSE if the station left
1704
1705*******************************************************************************/
1706#define CsrWifiSmeIbssStationIndCreate(msg__, dst__, src__, address__, isconnected__) \
1707 msg__ = kmalloc(sizeof(CsrWifiSmeIbssStationInd), GFP_KERNEL); \
1708 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_IBSS_STATION_IND, dst__, src__); \
1709 msg__->address = (address__); \
1710 msg__->isconnected = (isconnected__);
1711
1712#define CsrWifiSmeIbssStationIndSendTo(dst__, src__, address__, isconnected__) \
1713 { \
1714 CsrWifiSmeIbssStationInd *msg__; \
1715 CsrWifiSmeIbssStationIndCreate(msg__, dst__, src__, address__, isconnected__); \
1716 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1717 }
1718
1719#define CsrWifiSmeIbssStationIndSend(dst__, address__, isconnected__) \
1720 CsrWifiSmeIbssStationIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, address__, isconnected__)
1721
1722/*******************************************************************************
1723
1724 NAME
1725 CsrWifiSmeInfoIndSend
1726
1727 DESCRIPTION
1728 Message indicating a some info about current activity. Mostly of interest
1729 in testing but may be useful in the field.
1730
1731 PARAMETERS
1732 queue - Destination Task Queue
1733 infoMessage - Contains the message.
1734
1735*******************************************************************************/
1736#define CsrWifiSmeInfoIndCreate(msg__, dst__, src__, infoMessage__) \
1737 msg__ = kmalloc(sizeof(CsrWifiSmeInfoInd), GFP_KERNEL); \
1738 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_INFO_IND, dst__, src__); \
1739 msg__->infoMessage = (infoMessage__);
1740
1741#define CsrWifiSmeInfoIndSendTo(dst__, src__, infoMessage__) \
1742 { \
1743 CsrWifiSmeInfoInd *msg__; \
1744 CsrWifiSmeInfoIndCreate(msg__, dst__, src__, infoMessage__); \
1745 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1746 }
1747
1748#define CsrWifiSmeInfoIndSend(dst__, infoMessage__) \
1749 CsrWifiSmeInfoIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, infoMessage__)
1750
1751/*******************************************************************************
1752
1753 NAME
1754 CsrWifiSmeInterfaceCapabilityGetReqSend
1755
1756 DESCRIPTION
1757 The Wireless Manager calls this primitive to ask the SME for the
1758 capabilities of the supported interfaces
1759
1760 PARAMETERS
1761 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1762
1763*******************************************************************************/
1764#define CsrWifiSmeInterfaceCapabilityGetReqCreate(msg__, dst__, src__) \
1765 msg__ = kmalloc(sizeof(CsrWifiSmeInterfaceCapabilityGetReq), GFP_KERNEL); \
1766 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_REQ, dst__, src__);
1767
1768#define CsrWifiSmeInterfaceCapabilityGetReqSendTo(dst__, src__) \
1769 { \
1770 CsrWifiSmeInterfaceCapabilityGetReq *msg__; \
1771 CsrWifiSmeInterfaceCapabilityGetReqCreate(msg__, dst__, src__); \
1772 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1773 }
1774
1775#define CsrWifiSmeInterfaceCapabilityGetReqSend(src__) \
1776 CsrWifiSmeInterfaceCapabilityGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
1777
1778/*******************************************************************************
1779
1780 NAME
1781 CsrWifiSmeInterfaceCapabilityGetCfmSend
1782
1783 DESCRIPTION
1784 This primitive reports the result of the request.
1785
1786 PARAMETERS
1787 queue - Destination Task Queue
1788 status - Result of the request
1789 numInterfaces - Number of the interfaces supported
1790 capBitmap - Points to the list of capabilities bitmaps provided for each
1791 interface.
1792 The bits represent the following capabilities:
1793 -bits 7 to 4-Reserved
1794 -bit 3-AMP
1795 -bit 2-P2P
1796 -bit 1-AP
1797 -bit 0-STA
1798
1799*******************************************************************************/
1800#define CsrWifiSmeInterfaceCapabilityGetCfmCreate(msg__, dst__, src__, status__, numInterfaces__, capBitmap__) \
1801 msg__ = kmalloc(sizeof(CsrWifiSmeInterfaceCapabilityGetCfm), GFP_KERNEL); \
1802 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_CFM, dst__, src__); \
1803 msg__->status = (status__); \
1804 msg__->numInterfaces = (numInterfaces__); \
1805 memcpy(msg__->capBitmap, (capBitmap__), sizeof(u8) * 2);
1806
1807#define CsrWifiSmeInterfaceCapabilityGetCfmSendTo(dst__, src__, status__, numInterfaces__, capBitmap__) \
1808 { \
1809 CsrWifiSmeInterfaceCapabilityGetCfm *msg__; \
1810 CsrWifiSmeInterfaceCapabilityGetCfmCreate(msg__, dst__, src__, status__, numInterfaces__, capBitmap__); \
1811 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1812 }
1813
1814#define CsrWifiSmeInterfaceCapabilityGetCfmSend(dst__, status__, numInterfaces__, capBitmap__) \
1815 CsrWifiSmeInterfaceCapabilityGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, numInterfaces__, capBitmap__)
1816
1817/*******************************************************************************
1818
1819 NAME
1820 CsrWifiSmeKeyReqSend
1821
1822 DESCRIPTION
1823 The wireless manager application calls this primitive to add or remove
1824 keys that the chip should use for encryption of data.
1825 The interface allows the wireless manager application to add and remove
1826 keys according to the specified action.
1827
1828 PARAMETERS
1829 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1830 interfaceTag - Interface Identifier; unique identifier of an interface
1831 action - The value of the CsrWifiSmeListAction parameter instructs the
1832 driver to modify or provide the list of keys.
1833 CSR_WIFI_SME_LIST_ACTION_GET is not supported here.
1834 key - Key to be added or removed
1835
1836*******************************************************************************/
1837#define CsrWifiSmeKeyReqCreate(msg__, dst__, src__, interfaceTag__, action__, key__) \
1838 msg__ = kmalloc(sizeof(CsrWifiSmeKeyReq), GFP_KERNEL); \
1839 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_KEY_REQ, dst__, src__); \
1840 msg__->interfaceTag = (interfaceTag__); \
1841 msg__->action = (action__); \
1842 msg__->key = (key__);
1843
1844#define CsrWifiSmeKeyReqSendTo(dst__, src__, interfaceTag__, action__, key__) \
1845 { \
1846 CsrWifiSmeKeyReq *msg__; \
1847 CsrWifiSmeKeyReqCreate(msg__, dst__, src__, interfaceTag__, action__, key__); \
1848 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1849 }
1850
1851#define CsrWifiSmeKeyReqSend(src__, interfaceTag__, action__, key__) \
1852 CsrWifiSmeKeyReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, action__, key__)
1853
1854/*******************************************************************************
1855
1856 NAME
1857 CsrWifiSmeKeyCfmSend
1858
1859 DESCRIPTION
1860 The SME calls the primitive to report the result of the request
1861 primitive.
1862
1863 PARAMETERS
1864 queue - Destination Task Queue
1865 interfaceTag - Interface Identifier; unique identifier of an interface
1866 status - Reports the result of the request
1867 action - Action in the request
1868 keyType - Type of the key added/deleted
1869 peerMacAddress - Peer MAC Address of the key added/deleted
1870
1871*******************************************************************************/
1872#define CsrWifiSmeKeyCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, keyType__, peerMacAddress__) \
1873 msg__ = kmalloc(sizeof(CsrWifiSmeKeyCfm), GFP_KERNEL); \
1874 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_KEY_CFM, dst__, src__); \
1875 msg__->interfaceTag = (interfaceTag__); \
1876 msg__->status = (status__); \
1877 msg__->action = (action__); \
1878 msg__->keyType = (keyType__); \
1879 msg__->peerMacAddress = (peerMacAddress__);
1880
1881#define CsrWifiSmeKeyCfmSendTo(dst__, src__, interfaceTag__, status__, action__, keyType__, peerMacAddress__) \
1882 { \
1883 CsrWifiSmeKeyCfm *msg__; \
1884 CsrWifiSmeKeyCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, keyType__, peerMacAddress__); \
1885 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1886 }
1887
1888#define CsrWifiSmeKeyCfmSend(dst__, interfaceTag__, status__, action__, keyType__, peerMacAddress__) \
1889 CsrWifiSmeKeyCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, action__, keyType__, peerMacAddress__)
1890
1891/*******************************************************************************
1892
1893 NAME
1894 CsrWifiSmeLinkQualityGetReqSend
1895
1896 DESCRIPTION
1897 This primitive gets the value of the LinkQuality parameter.
1898
1899 PARAMETERS
1900 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
1901 interfaceTag - Interface Identifier; unique identifier of an interface
1902
1903*******************************************************************************/
1904#define CsrWifiSmeLinkQualityGetReqCreate(msg__, dst__, src__, interfaceTag__) \
1905 msg__ = kmalloc(sizeof(CsrWifiSmeLinkQualityGetReq), GFP_KERNEL); \
1906 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_LINK_QUALITY_GET_REQ, dst__, src__); \
1907 msg__->interfaceTag = (interfaceTag__);
1908
1909#define CsrWifiSmeLinkQualityGetReqSendTo(dst__, src__, interfaceTag__) \
1910 { \
1911 CsrWifiSmeLinkQualityGetReq *msg__; \
1912 CsrWifiSmeLinkQualityGetReqCreate(msg__, dst__, src__, interfaceTag__); \
1913 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
1914 }
1915
1916#define CsrWifiSmeLinkQualityGetReqSend(src__, interfaceTag__) \
1917 CsrWifiSmeLinkQualityGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__)
1918
1919/*******************************************************************************
1920
1921 NAME
1922 CsrWifiSmeLinkQualityGetCfmSend
1923
1924 DESCRIPTION
1925 This primitive reports the result of the request.
1926
1927 PARAMETERS
1928 queue - Destination Task Queue
1929 interfaceTag - Interface Identifier; unique identifier of an interface
1930 status - Reports the result of the request
1931 linkQuality - Indicates the quality of the link
1932
1933*******************************************************************************/
1934#define CsrWifiSmeLinkQualityGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, linkQuality__) \
1935 msg__ = kmalloc(sizeof(CsrWifiSmeLinkQualityGetCfm), GFP_KERNEL); \
1936 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_LINK_QUALITY_GET_CFM, dst__, src__); \
1937 msg__->interfaceTag = (interfaceTag__); \
1938 msg__->status = (status__); \
1939 msg__->linkQuality = (linkQuality__);
1940
1941#define CsrWifiSmeLinkQualityGetCfmSendTo(dst__, src__, interfaceTag__, status__, linkQuality__) \
1942 { \
1943 CsrWifiSmeLinkQualityGetCfm *msg__; \
1944 CsrWifiSmeLinkQualityGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, linkQuality__); \
1945 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1946 }
1947
1948#define CsrWifiSmeLinkQualityGetCfmSend(dst__, interfaceTag__, status__, linkQuality__) \
1949 CsrWifiSmeLinkQualityGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, linkQuality__)
1950
1951/*******************************************************************************
1952
1953 NAME
1954 CsrWifiSmeMediaStatusIndSend
1955
1956 DESCRIPTION
1957 The SME sends this primitive to all the tasks that have registered to
1958 receive it when a network connection is established, lost or has moved to
1959 another AP.
1960
1961 PARAMETERS
1962 queue - Destination Task Queue
1963 interfaceTag - Interface Identifier; unique identifier of an interface
1964 mediaStatus - Indicates the media status
1965 connectionInfo - This parameter is relevant only if the mediaStatus is
1966 CSR_WIFI_SME_MEDIA_STATUS_CONNECTED:
1967 it points to the connection information for the new network
1968 disassocReason - This parameter is relevant only if the mediaStatus is
1969 CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED:
1970 if a disassociation has occurred it gives the reason of the
1971 disassociation
1972 deauthReason - This parameter is relevant only if the mediaStatus is
1973 CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED:
1974 if a deauthentication has occurred it gives the reason of
1975 the deauthentication
1976
1977*******************************************************************************/
1978#define CsrWifiSmeMediaStatusIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, connectionInfo__, disassocReason__, deauthReason__) \
1979 msg__ = kmalloc(sizeof(CsrWifiSmeMediaStatusInd), GFP_KERNEL); \
1980 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MEDIA_STATUS_IND, dst__, src__); \
1981 msg__->interfaceTag = (interfaceTag__); \
1982 msg__->mediaStatus = (mediaStatus__); \
1983 msg__->connectionInfo = (connectionInfo__); \
1984 msg__->disassocReason = (disassocReason__); \
1985 msg__->deauthReason = (deauthReason__);
1986
1987#define CsrWifiSmeMediaStatusIndSendTo(dst__, src__, interfaceTag__, mediaStatus__, connectionInfo__, disassocReason__, deauthReason__) \
1988 { \
1989 CsrWifiSmeMediaStatusInd *msg__; \
1990 CsrWifiSmeMediaStatusIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, connectionInfo__, disassocReason__, deauthReason__); \
1991 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
1992 }
1993
1994#define CsrWifiSmeMediaStatusIndSend(dst__, interfaceTag__, mediaStatus__, connectionInfo__, disassocReason__, deauthReason__) \
1995 CsrWifiSmeMediaStatusIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, mediaStatus__, connectionInfo__, disassocReason__, deauthReason__)
1996
1997/*******************************************************************************
1998
1999 NAME
2000 CsrWifiSmeMibConfigGetReqSend
2001
2002 DESCRIPTION
2003 This primitive gets the value of the MibConfig parameter.
2004
2005 PARAMETERS
2006 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
2007
2008*******************************************************************************/
2009#define CsrWifiSmeMibConfigGetReqCreate(msg__, dst__, src__) \
2010 msg__ = kmalloc(sizeof(CsrWifiSmeMibConfigGetReq), GFP_KERNEL); \
2011 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_CONFIG_GET_REQ, dst__, src__);
2012
2013#define CsrWifiSmeMibConfigGetReqSendTo(dst__, src__) \
2014 { \
2015 CsrWifiSmeMibConfigGetReq *msg__; \
2016 CsrWifiSmeMibConfigGetReqCreate(msg__, dst__, src__); \
2017 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2018 }
2019
2020#define CsrWifiSmeMibConfigGetReqSend(src__) \
2021 CsrWifiSmeMibConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
2022
2023/*******************************************************************************
2024
2025 NAME
2026 CsrWifiSmeMibConfigGetCfmSend
2027
2028 DESCRIPTION
2029 This primitive reports the result of the request.
2030
2031 PARAMETERS
2032 queue - Destination Task Queue
2033 status - Reports the result of the request
2034 mibConfig - Reports various IEEE 802.11 attributes as currently configured
2035
2036*******************************************************************************/
2037#define CsrWifiSmeMibConfigGetCfmCreate(msg__, dst__, src__, status__, mibConfig__) \
2038 msg__ = kmalloc(sizeof(CsrWifiSmeMibConfigGetCfm), GFP_KERNEL); \
2039 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_CONFIG_GET_CFM, dst__, src__); \
2040 msg__->status = (status__); \
2041 msg__->mibConfig = (mibConfig__);
2042
2043#define CsrWifiSmeMibConfigGetCfmSendTo(dst__, src__, status__, mibConfig__) \
2044 { \
2045 CsrWifiSmeMibConfigGetCfm *msg__; \
2046 CsrWifiSmeMibConfigGetCfmCreate(msg__, dst__, src__, status__, mibConfig__); \
2047 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2048 }
2049
2050#define CsrWifiSmeMibConfigGetCfmSend(dst__, status__, mibConfig__) \
2051 CsrWifiSmeMibConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, mibConfig__)
2052
2053/*******************************************************************************
2054
2055 NAME
2056 CsrWifiSmeMibConfigSetReqSend
2057
2058 DESCRIPTION
2059 This primitive sets the value of the MibConfig parameter.
2060
2061 PARAMETERS
2062 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
2063 mibConfig - Conveys the desired value of various IEEE 802.11 attributes as
2064 currently configured
2065
2066*******************************************************************************/
2067#define CsrWifiSmeMibConfigSetReqCreate(msg__, dst__, src__, mibConfig__) \
2068 msg__ = kmalloc(sizeof(CsrWifiSmeMibConfigSetReq), GFP_KERNEL); \
2069 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_CONFIG_SET_REQ, dst__, src__); \
2070 msg__->mibConfig = (mibConfig__);
2071
2072#define CsrWifiSmeMibConfigSetReqSendTo(dst__, src__, mibConfig__) \
2073 { \
2074 CsrWifiSmeMibConfigSetReq *msg__; \
2075 CsrWifiSmeMibConfigSetReqCreate(msg__, dst__, src__, mibConfig__); \
2076 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2077 }
2078
2079#define CsrWifiSmeMibConfigSetReqSend(src__, mibConfig__) \
2080 CsrWifiSmeMibConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, mibConfig__)
2081
2082/*******************************************************************************
2083
2084 NAME
2085 CsrWifiSmeMibConfigSetCfmSend
2086
2087 DESCRIPTION
2088 This primitive reports the result of the request.
2089
2090 PARAMETERS
2091 queue - Destination Task Queue
2092 status - Reports the result of the request
2093
2094*******************************************************************************/
2095#define CsrWifiSmeMibConfigSetCfmCreate(msg__, dst__, src__, status__) \
2096 msg__ = kmalloc(sizeof(CsrWifiSmeMibConfigSetCfm), GFP_KERNEL); \
2097 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_CONFIG_SET_CFM, dst__, src__); \
2098 msg__->status = (status__);
2099
2100#define CsrWifiSmeMibConfigSetCfmSendTo(dst__, src__, status__) \
2101 { \
2102 CsrWifiSmeMibConfigSetCfm *msg__; \
2103 CsrWifiSmeMibConfigSetCfmCreate(msg__, dst__, src__, status__); \
2104 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2105 }
2106
2107#define CsrWifiSmeMibConfigSetCfmSend(dst__, status__) \
2108 CsrWifiSmeMibConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
2109
2110/*******************************************************************************
2111
2112 NAME
2113 CsrWifiSmeMibGetCfmSend
2114
2115 DESCRIPTION
2116 The SME calls this primitive to return the requested MIB variable values.
2117
2118 PARAMETERS
2119 queue - Destination Task Queue
2120 status - Reports the result of the request
2121 mibAttributeLength - Length of mibAttribute
2122 mibAttribute - Points to the VarBind or VarBindList containing the
2123 names and values of the MIB variables requested
2124
2125*******************************************************************************/
2126#define CsrWifiSmeMibGetCfmCreate(msg__, dst__, src__, status__, mibAttributeLength__, mibAttribute__) \
2127 msg__ = kmalloc(sizeof(CsrWifiSmeMibGetCfm), GFP_KERNEL); \
2128 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_GET_CFM, dst__, src__); \
2129 msg__->status = (status__); \
2130 msg__->mibAttributeLength = (mibAttributeLength__); \
2131 msg__->mibAttribute = (mibAttribute__);
2132
2133#define CsrWifiSmeMibGetCfmSendTo(dst__, src__, status__, mibAttributeLength__, mibAttribute__) \
2134 { \
2135 CsrWifiSmeMibGetCfm *msg__; \
2136 CsrWifiSmeMibGetCfmCreate(msg__, dst__, src__, status__, mibAttributeLength__, mibAttribute__); \
2137 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2138 }
2139
2140#define CsrWifiSmeMibGetCfmSend(dst__, status__, mibAttributeLength__, mibAttribute__) \
2141 CsrWifiSmeMibGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, mibAttributeLength__, mibAttribute__)
2142
2143/*******************************************************************************
2144
2145 NAME
2146 CsrWifiSmeMibGetNextReqSend
2147
2148 DESCRIPTION
2149 To read a sequence of MIB parameters, for example a table, call this
2150 primitive to find the name of the next MIB variable
2151
2152 PARAMETERS
2153 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
2154 mibAttributeLength - Length of mibAttribute
2155 mibAttribute - Points to a VarBind or VarBindList containing the
2156 name(s) of the MIB variable(s) to search from.
2157
2158*******************************************************************************/
2159#define CsrWifiSmeMibGetNextReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__) \
2160 msg__ = kmalloc(sizeof(CsrWifiSmeMibGetNextReq), GFP_KERNEL); \
2161 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_GET_NEXT_REQ, dst__, src__); \
2162 msg__->mibAttributeLength = (mibAttributeLength__); \
2163 msg__->mibAttribute = (mibAttribute__);
2164
2165#define CsrWifiSmeMibGetNextReqSendTo(dst__, src__, mibAttributeLength__, mibAttribute__) \
2166 { \
2167 CsrWifiSmeMibGetNextReq *msg__; \
2168 CsrWifiSmeMibGetNextReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__); \
2169 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2170 }
2171
2172#define CsrWifiSmeMibGetNextReqSend(src__, mibAttributeLength__, mibAttribute__) \
2173 CsrWifiSmeMibGetNextReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, mibAttributeLength__, mibAttribute__)
2174
2175/*******************************************************************************
2176
2177 NAME
2178 CsrWifiSmeMibGetNextCfmSend
2179
2180 DESCRIPTION
2181 The SME calls this primitive to return the requested MIB name(s).
2182 The wireless manager application can then read the value of the MIB
2183 variable using CSR_WIFI_SME_MIB_GET_REQ, using the names provided.
2184
2185 PARAMETERS
2186 queue - Destination Task Queue
2187 status - Reports the result of the request
2188 mibAttributeLength - Length of mibAttribute
2189 mibAttribute - Points to a VarBind or VarBindList containing the
2190 name(s) of the MIB variable(s) lexicographically
2191 following the name(s) given in the request
2192
2193*******************************************************************************/
2194#define CsrWifiSmeMibGetNextCfmCreate(msg__, dst__, src__, status__, mibAttributeLength__, mibAttribute__) \
2195 msg__ = kmalloc(sizeof(CsrWifiSmeMibGetNextCfm), GFP_KERNEL); \
2196 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_GET_NEXT_CFM, dst__, src__); \
2197 msg__->status = (status__); \
2198 msg__->mibAttributeLength = (mibAttributeLength__); \
2199 msg__->mibAttribute = (mibAttribute__);
2200
2201#define CsrWifiSmeMibGetNextCfmSendTo(dst__, src__, status__, mibAttributeLength__, mibAttribute__) \
2202 { \
2203 CsrWifiSmeMibGetNextCfm *msg__; \
2204 CsrWifiSmeMibGetNextCfmCreate(msg__, dst__, src__, status__, mibAttributeLength__, mibAttribute__); \
2205 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2206 }
2207
2208#define CsrWifiSmeMibGetNextCfmSend(dst__, status__, mibAttributeLength__, mibAttribute__) \
2209 CsrWifiSmeMibGetNextCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, mibAttributeLength__, mibAttribute__)
2210
2211/*******************************************************************************
2212
2213 NAME
2214 CsrWifiSmeMibGetReqSend
2215
2216 DESCRIPTION
2217 The wireless manager application calls this primitive to retrieve one or
2218 more MIB variables.
2219
2220 PARAMETERS
2221 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
2222 mibAttributeLength - Length of mibAttribute
2223 mibAttribute - Points to the VarBind or VarBindList containing the
2224 names of the MIB variables to be retrieved
2225
2226*******************************************************************************/
2227#define CsrWifiSmeMibGetReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__) \
2228 msg__ = kmalloc(sizeof(CsrWifiSmeMibGetReq), GFP_KERNEL); \
2229 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_GET_REQ, dst__, src__); \
2230 msg__->mibAttributeLength = (mibAttributeLength__); \
2231 msg__->mibAttribute = (mibAttribute__);
2232
2233#define CsrWifiSmeMibGetReqSendTo(dst__, src__, mibAttributeLength__, mibAttribute__) \
2234 { \
2235 CsrWifiSmeMibGetReq *msg__; \
2236 CsrWifiSmeMibGetReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__); \
2237 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2238 }
2239
2240#define CsrWifiSmeMibGetReqSend(src__, mibAttributeLength__, mibAttribute__) \
2241 CsrWifiSmeMibGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, mibAttributeLength__, mibAttribute__)
2242
2243/*******************************************************************************
2244
2245 NAME
2246 CsrWifiSmeMibSetReqSend
2247
2248 DESCRIPTION
2249 The SME provides raw access to the MIB on the chip, which may be used by
2250 some configuration or diagnostic utilities, but is not normally needed by
2251 the wireless manager application.
2252 The MIB access functions use BER encoded names (OID) of the MIB
2253 parameters and BER encoded values, as described in the chip Host
2254 Interface Protocol Specification.
2255 The MIB parameters are described in 'Wi-Fi 5.0.0 Management Information
2256 Base Reference Guide'.
2257 The wireless manager application calls this primitive to set one or more
2258 MIB variables
2259
2260 PARAMETERS
2261 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
2262 mibAttributeLength - Length of mibAttribute
2263 mibAttribute - Points to the VarBind or VarBindList containing the
2264 names and values of the MIB variables to set
2265
2266*******************************************************************************/
2267#define CsrWifiSmeMibSetReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__) \
2268 msg__ = kmalloc(sizeof(CsrWifiSmeMibSetReq), GFP_KERNEL); \
2269 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_SET_REQ, dst__, src__); \
2270 msg__->mibAttributeLength = (mibAttributeLength__); \
2271 msg__->mibAttribute = (mibAttribute__);
2272
2273#define CsrWifiSmeMibSetReqSendTo(dst__, src__, mibAttributeLength__, mibAttribute__) \
2274 { \
2275 CsrWifiSmeMibSetReq *msg__; \
2276 CsrWifiSmeMibSetReqCreate(msg__, dst__, src__, mibAttributeLength__, mibAttribute__); \
2277 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2278 }
2279
2280#define CsrWifiSmeMibSetReqSend(src__, mibAttributeLength__, mibAttribute__) \
2281 CsrWifiSmeMibSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, mibAttributeLength__, mibAttribute__)
2282
2283/*******************************************************************************
2284
2285 NAME
2286 CsrWifiSmeMibSetCfmSend
2287
2288 DESCRIPTION
2289 The SME calls the primitive to report the result of the set primitive.
2290
2291 PARAMETERS
2292 queue - Destination Task Queue
2293 status - Reports the result of the request
2294
2295*******************************************************************************/
2296#define CsrWifiSmeMibSetCfmCreate(msg__, dst__, src__, status__) \
2297 msg__ = kmalloc(sizeof(CsrWifiSmeMibSetCfm), GFP_KERNEL); \
2298 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIB_SET_CFM, dst__, src__); \
2299 msg__->status = (status__);
2300
2301#define CsrWifiSmeMibSetCfmSendTo(dst__, src__, status__) \
2302 { \
2303 CsrWifiSmeMibSetCfm *msg__; \
2304 CsrWifiSmeMibSetCfmCreate(msg__, dst__, src__, status__); \
2305 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2306 }
2307
2308#define CsrWifiSmeMibSetCfmSend(dst__, status__) \
2309 CsrWifiSmeMibSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
2310
2311/*******************************************************************************
2312
2313 NAME
2314 CsrWifiSmeMicFailureIndSend
2315
2316 DESCRIPTION
2317 The SME sends this primitive to all the tasks that have registered to
2318 receive it whenever the chip firmware reports a MIC failure.
2319
2320 PARAMETERS
2321 queue - Destination Task Queue
2322 interfaceTag - Interface Identifier; unique identifier of an interface
2323 secondFailure - TRUE if this indication is for a second failure in 60
2324 seconds
2325 count - The number of MIC failure events since the connection was
2326 established
2327 address - MAC address of the transmitter that caused the MIC failure
2328 keyType - Type of key for which the failure occurred
2329
2330*******************************************************************************/
2331#define CsrWifiSmeMicFailureIndCreate(msg__, dst__, src__, interfaceTag__, secondFailure__, count__, address__, keyType__) \
2332 msg__ = kmalloc(sizeof(CsrWifiSmeMicFailureInd), GFP_KERNEL); \
2333 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MIC_FAILURE_IND, dst__, src__); \
2334 msg__->interfaceTag = (interfaceTag__); \
2335 msg__->secondFailure = (secondFailure__); \
2336 msg__->count = (count__); \
2337 msg__->address = (address__); \
2338 msg__->keyType = (keyType__);
2339
2340#define CsrWifiSmeMicFailureIndSendTo(dst__, src__, interfaceTag__, secondFailure__, count__, address__, keyType__) \
2341 { \
2342 CsrWifiSmeMicFailureInd *msg__; \
2343 CsrWifiSmeMicFailureIndCreate(msg__, dst__, src__, interfaceTag__, secondFailure__, count__, address__, keyType__); \
2344 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2345 }
2346
2347#define CsrWifiSmeMicFailureIndSend(dst__, interfaceTag__, secondFailure__, count__, address__, keyType__) \
2348 CsrWifiSmeMicFailureIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, secondFailure__, count__, address__, keyType__)
2349
2350/*******************************************************************************
2351
2352 NAME
2353 CsrWifiSmeMulticastAddressReqSend
2354
2355 DESCRIPTION
2356 The wireless manager application calls this primitive to specify the
2357 multicast addresses which the chip should recognise. The interface allows
2358 the wireless manager application to query, add, remove and flush the
2359 multicast addresses for the network interface according to the specified
2360 action.
2361
2362 PARAMETERS
2363 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
2364 interfaceTag - Interface Identifier; unique identifier of an interface
2365 action - The value of the CsrWifiSmeListAction parameter
2366 instructs the driver to modify or provide the list of
2367 MAC addresses.
2368 setAddressesCount - Number of MAC addresses sent with the primitive
2369 setAddresses - Pointer to the list of MAC Addresses sent with the
2370 primitive, set to NULL if none is sent.
2371
2372*******************************************************************************/
2373#define CsrWifiSmeMulticastAddressReqCreate(msg__, dst__, src__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \
2374 msg__ = kmalloc(sizeof(CsrWifiSmeMulticastAddressReq), GFP_KERNEL); \
2375 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MULTICAST_ADDRESS_REQ, dst__, src__); \
2376 msg__->interfaceTag = (interfaceTag__); \
2377 msg__->action = (action__); \
2378 msg__->setAddressesCount = (setAddressesCount__); \
2379 msg__->setAddresses = (setAddresses__);
2380
2381#define CsrWifiSmeMulticastAddressReqSendTo(dst__, src__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \
2382 { \
2383 CsrWifiSmeMulticastAddressReq *msg__; \
2384 CsrWifiSmeMulticastAddressReqCreate(msg__, dst__, src__, interfaceTag__, action__, setAddressesCount__, setAddresses__); \
2385 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2386 }
2387
2388#define CsrWifiSmeMulticastAddressReqSend(src__, interfaceTag__, action__, setAddressesCount__, setAddresses__) \
2389 CsrWifiSmeMulticastAddressReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, action__, setAddressesCount__, setAddresses__)
2390
2391/*******************************************************************************
2392
2393 NAME
2394 CsrWifiSmeMulticastAddressCfmSend
2395
2396 DESCRIPTION
2397 The SME will call this primitive when the operation is complete. For a
2398 GET action, this primitive reports the current list of MAC addresses.
2399
2400 PARAMETERS
2401 queue - Destination Task Queue
2402 interfaceTag - Interface Identifier; unique identifier of an interface
2403 status - Reports the result of the request
2404 action - Action in the request
2405 getAddressesCount - This parameter is only relevant if action is
2406 CSR_WIFI_SME_LIST_ACTION_GET:
2407 number of MAC addresses sent with the primitive
2408 getAddresses - Pointer to the list of MAC Addresses sent with the
2409 primitive, set to NULL if none is sent.
2410
2411*******************************************************************************/
2412#define CsrWifiSmeMulticastAddressCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getAddressesCount__, getAddresses__) \
2413 msg__ = kmalloc(sizeof(CsrWifiSmeMulticastAddressCfm), GFP_KERNEL); \
2414 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_MULTICAST_ADDRESS_CFM, dst__, src__); \
2415 msg__->interfaceTag = (interfaceTag__); \
2416 msg__->status = (status__); \
2417 msg__->action = (action__); \
2418 msg__->getAddressesCount = (getAddressesCount__); \
2419 msg__->getAddresses = (getAddresses__);
2420
2421#define CsrWifiSmeMulticastAddressCfmSendTo(dst__, src__, interfaceTag__, status__, action__, getAddressesCount__, getAddresses__) \
2422 { \
2423 CsrWifiSmeMulticastAddressCfm *msg__; \
2424 CsrWifiSmeMulticastAddressCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getAddressesCount__, getAddresses__); \
2425 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2426 }
2427
2428#define CsrWifiSmeMulticastAddressCfmSend(dst__, interfaceTag__, status__, action__, getAddressesCount__, getAddresses__) \
2429 CsrWifiSmeMulticastAddressCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, action__, getAddressesCount__, getAddresses__)
2430
2431/*******************************************************************************
2432
2433 NAME
2434 CsrWifiSmePacketFilterSetReqSend
2435
2436 DESCRIPTION
2437 The wireless manager application should call this primitive to enable or
2438 disable filtering of broadcast packets: uninteresting broadcast packets
2439 will be dropped by the Wi-Fi chip, instead of passing them up to the
2440 host.
2441 This has the advantage of saving power in the host application processor
2442 as it removes the need to process unwanted packets.
2443 All broadcast packets are filtered according to the filter and the filter
2444 mode provided, except ARP packets, which are filtered using
2445 arpFilterAddress.
2446 Filters are not cumulative: only the parameters specified in the most
2447 recent successful request are significant.
2448 For more information, see 'UniFi Firmware API Specification'.
2449
2450 PARAMETERS
2451 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
2452 interfaceTag - Interface Identifier; unique identifier of an interface
2453 filterLength - Length of the filter in bytes.
2454 filterLength=0 disables the filter previously set
2455 filter - Points to the first byte of the filter provided, if any.
2456 This shall include zero or more instance of the
2457 information elements of one of these types
2458 * Traffic Classification (TCLAS) elements
2459 * WMM-SA TCLAS elements
2460 mode - Specifies whether the filter selects or excludes packets
2461 matching the filter
2462 arpFilterAddress - IPv4 address to be used for filtering the ARP packets.
2463 * If the specified address is the IPv4 broadcast address
2464 (255.255.255.255), all ARP packets are reported to the
2465 host,
2466 * If the specified address is NOT the IPv4 broadcast
2467 address, only ARP packets with the specified address in
2468 the Source or Target Protocol Address fields are reported
2469 to the host
2470
2471*******************************************************************************/
2472#define CsrWifiSmePacketFilterSetReqCreate(msg__, dst__, src__, interfaceTag__, filterLength__, filter__, mode__, arpFilterAddress__) \
2473 msg__ = kmalloc(sizeof(CsrWifiSmePacketFilterSetReq), GFP_KERNEL); \
2474 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PACKET_FILTER_SET_REQ, dst__, src__); \
2475 msg__->interfaceTag = (interfaceTag__); \
2476 msg__->filterLength = (filterLength__); \
2477 msg__->filter = (filter__); \
2478 msg__->mode = (mode__); \
2479 msg__->arpFilterAddress = (arpFilterAddress__);
2480
2481#define CsrWifiSmePacketFilterSetReqSendTo(dst__, src__, interfaceTag__, filterLength__, filter__, mode__, arpFilterAddress__) \
2482 { \
2483 CsrWifiSmePacketFilterSetReq *msg__; \
2484 CsrWifiSmePacketFilterSetReqCreate(msg__, dst__, src__, interfaceTag__, filterLength__, filter__, mode__, arpFilterAddress__); \
2485 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2486 }
2487
2488#define CsrWifiSmePacketFilterSetReqSend(src__, interfaceTag__, filterLength__, filter__, mode__, arpFilterAddress__) \
2489 CsrWifiSmePacketFilterSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, filterLength__, filter__, mode__, arpFilterAddress__)
2490
2491/*******************************************************************************
2492
2493 NAME
2494 CsrWifiSmePacketFilterSetCfmSend
2495
2496 DESCRIPTION
2497 The SME calls the primitive to report the result of the set primitive.
2498
2499 PARAMETERS
2500 queue - Destination Task Queue
2501 interfaceTag - Interface Identifier; unique identifier of an interface
2502 status - Reports the result of the request
2503
2504*******************************************************************************/
2505#define CsrWifiSmePacketFilterSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
2506 msg__ = kmalloc(sizeof(CsrWifiSmePacketFilterSetCfm), GFP_KERNEL); \
2507 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PACKET_FILTER_SET_CFM, dst__, src__); \
2508 msg__->interfaceTag = (interfaceTag__); \
2509 msg__->status = (status__);
2510
2511#define CsrWifiSmePacketFilterSetCfmSendTo(dst__, src__, interfaceTag__, status__) \
2512 { \
2513 CsrWifiSmePacketFilterSetCfm *msg__; \
2514 CsrWifiSmePacketFilterSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
2515 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2516 }
2517
2518#define CsrWifiSmePacketFilterSetCfmSend(dst__, interfaceTag__, status__) \
2519 CsrWifiSmePacketFilterSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
2520
2521/*******************************************************************************
2522
2523 NAME
2524 CsrWifiSmePermanentMacAddressGetReqSend
2525
2526 DESCRIPTION
2527 This primitive retrieves the MAC address stored in EEPROM
2528
2529 PARAMETERS
2530 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
2531
2532*******************************************************************************/
2533#define CsrWifiSmePermanentMacAddressGetReqCreate(msg__, dst__, src__) \
2534 msg__ = kmalloc(sizeof(CsrWifiSmePermanentMacAddressGetReq), GFP_KERNEL); \
2535 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PERMANENT_MAC_ADDRESS_GET_REQ, dst__, src__);
2536
2537#define CsrWifiSmePermanentMacAddressGetReqSendTo(dst__, src__) \
2538 { \
2539 CsrWifiSmePermanentMacAddressGetReq *msg__; \
2540 CsrWifiSmePermanentMacAddressGetReqCreate(msg__, dst__, src__); \
2541 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2542 }
2543
2544#define CsrWifiSmePermanentMacAddressGetReqSend(src__) \
2545 CsrWifiSmePermanentMacAddressGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
2546
2547/*******************************************************************************
2548
2549 NAME
2550 CsrWifiSmePermanentMacAddressGetCfmSend
2551
2552 DESCRIPTION
2553 This primitive reports the result of the request.
2554
2555 PARAMETERS
2556 queue - Destination Task Queue
2557 status - Reports the result of the request
2558 permanentMacAddress - MAC address stored in the EEPROM
2559
2560*******************************************************************************/
2561#define CsrWifiSmePermanentMacAddressGetCfmCreate(msg__, dst__, src__, status__, permanentMacAddress__) \
2562 msg__ = kmalloc(sizeof(CsrWifiSmePermanentMacAddressGetCfm), GFP_KERNEL); \
2563 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PERMANENT_MAC_ADDRESS_GET_CFM, dst__, src__); \
2564 msg__->status = (status__); \
2565 msg__->permanentMacAddress = (permanentMacAddress__);
2566
2567#define CsrWifiSmePermanentMacAddressGetCfmSendTo(dst__, src__, status__, permanentMacAddress__) \
2568 { \
2569 CsrWifiSmePermanentMacAddressGetCfm *msg__; \
2570 CsrWifiSmePermanentMacAddressGetCfmCreate(msg__, dst__, src__, status__, permanentMacAddress__); \
2571 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2572 }
2573
2574#define CsrWifiSmePermanentMacAddressGetCfmSend(dst__, status__, permanentMacAddress__) \
2575 CsrWifiSmePermanentMacAddressGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, permanentMacAddress__)
2576
2577/*******************************************************************************
2578
2579 NAME
2580 CsrWifiSmePmkidCandidateListIndSend
2581
2582 DESCRIPTION
2583 The SME will send this primitive to all the tasks that have registered to
2584 receive it when a new network supporting preauthentication and/or PMK
2585 caching is seen.
2586
2587 PARAMETERS
2588 queue - Destination Task Queue
2589 interfaceTag - Interface Identifier; unique identifier of an
2590 interface
2591 pmkidCandidatesCount - Number of PMKID candidates provided
2592 pmkidCandidates - Points to the first PMKID candidate
2593
2594*******************************************************************************/
2595#define CsrWifiSmePmkidCandidateListIndCreate(msg__, dst__, src__, interfaceTag__, pmkidCandidatesCount__, pmkidCandidates__) \
2596 msg__ = kmalloc(sizeof(CsrWifiSmePmkidCandidateListInd), GFP_KERNEL); \
2597 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PMKID_CANDIDATE_LIST_IND, dst__, src__); \
2598 msg__->interfaceTag = (interfaceTag__); \
2599 msg__->pmkidCandidatesCount = (pmkidCandidatesCount__); \
2600 msg__->pmkidCandidates = (pmkidCandidates__);
2601
2602#define CsrWifiSmePmkidCandidateListIndSendTo(dst__, src__, interfaceTag__, pmkidCandidatesCount__, pmkidCandidates__) \
2603 { \
2604 CsrWifiSmePmkidCandidateListInd *msg__; \
2605 CsrWifiSmePmkidCandidateListIndCreate(msg__, dst__, src__, interfaceTag__, pmkidCandidatesCount__, pmkidCandidates__); \
2606 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2607 }
2608
2609#define CsrWifiSmePmkidCandidateListIndSend(dst__, interfaceTag__, pmkidCandidatesCount__, pmkidCandidates__) \
2610 CsrWifiSmePmkidCandidateListIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, pmkidCandidatesCount__, pmkidCandidates__)
2611
2612/*******************************************************************************
2613
2614 NAME
2615 CsrWifiSmePmkidReqSend
2616
2617 DESCRIPTION
2618 The wireless manager application calls this primitive to request an
2619 operation on the SME PMKID list.
2620 The action argument specifies the operation to perform.
2621 When the connection is complete, the wireless manager application may
2622 then send and receive EAPOL packets to complete WPA or WPA2
2623 authentication if appropriate.
2624 The wireless manager application can then pass the resulting encryption
2625 keys using this primitive.
2626
2627 PARAMETERS
2628 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
2629 interfaceTag - Interface Identifier; unique identifier of an interface
2630 action - The value of the CsrWifiSmeListAction parameter instructs
2631 the driver to modify or provide the list of PMKIDs.
2632 setPmkidsCount - Number of PMKIDs sent with the primitive
2633 setPmkids - Pointer to the list of PMKIDs sent with the primitive, set
2634 to NULL if none is sent.
2635
2636*******************************************************************************/
2637#define CsrWifiSmePmkidReqCreate(msg__, dst__, src__, interfaceTag__, action__, setPmkidsCount__, setPmkids__) \
2638 msg__ = kmalloc(sizeof(CsrWifiSmePmkidReq), GFP_KERNEL); \
2639 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PMKID_REQ, dst__, src__); \
2640 msg__->interfaceTag = (interfaceTag__); \
2641 msg__->action = (action__); \
2642 msg__->setPmkidsCount = (setPmkidsCount__); \
2643 msg__->setPmkids = (setPmkids__);
2644
2645#define CsrWifiSmePmkidReqSendTo(dst__, src__, interfaceTag__, action__, setPmkidsCount__, setPmkids__) \
2646 { \
2647 CsrWifiSmePmkidReq *msg__; \
2648 CsrWifiSmePmkidReqCreate(msg__, dst__, src__, interfaceTag__, action__, setPmkidsCount__, setPmkids__); \
2649 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2650 }
2651
2652#define CsrWifiSmePmkidReqSend(src__, interfaceTag__, action__, setPmkidsCount__, setPmkids__) \
2653 CsrWifiSmePmkidReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, action__, setPmkidsCount__, setPmkids__)
2654
2655/*******************************************************************************
2656
2657 NAME
2658 CsrWifiSmePmkidCfmSend
2659
2660 DESCRIPTION
2661 The SME will call this primitive when the operation is complete. For a
2662 GET action, this primitive reports the current list of PMKIDs
2663
2664 PARAMETERS
2665 queue - Destination Task Queue
2666 interfaceTag - Interface Identifier; unique identifier of an interface
2667 status - Reports the result of the request
2668 action - Action in the request
2669 getPmkidsCount - This parameter is only relevant if action is
2670 CSR_WIFI_SME_LIST_ACTION_GET:
2671 number of PMKIDs sent with the primitive
2672 getPmkids - Pointer to the list of PMKIDs sent with the primitive, set
2673 to NULL if none is sent.
2674
2675*******************************************************************************/
2676#define CsrWifiSmePmkidCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getPmkidsCount__, getPmkids__) \
2677 msg__ = kmalloc(sizeof(CsrWifiSmePmkidCfm), GFP_KERNEL); \
2678 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_PMKID_CFM, dst__, src__); \
2679 msg__->interfaceTag = (interfaceTag__); \
2680 msg__->status = (status__); \
2681 msg__->action = (action__); \
2682 msg__->getPmkidsCount = (getPmkidsCount__); \
2683 msg__->getPmkids = (getPmkids__);
2684
2685#define CsrWifiSmePmkidCfmSendTo(dst__, src__, interfaceTag__, status__, action__, getPmkidsCount__, getPmkids__) \
2686 { \
2687 CsrWifiSmePmkidCfm *msg__; \
2688 CsrWifiSmePmkidCfmCreate(msg__, dst__, src__, interfaceTag__, status__, action__, getPmkidsCount__, getPmkids__); \
2689 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2690 }
2691
2692#define CsrWifiSmePmkidCfmSend(dst__, interfaceTag__, status__, action__, getPmkidsCount__, getPmkids__) \
2693 CsrWifiSmePmkidCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, action__, getPmkidsCount__, getPmkids__)
2694
2695/*******************************************************************************
2696
2697 NAME
2698 CsrWifiSmePowerConfigGetReqSend
2699
2700 DESCRIPTION
2701 This primitive gets the value of the PowerConfig parameter.
2702
2703 PARAMETERS
2704 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
2705
2706*******************************************************************************/
2707#define CsrWifiSmePowerConfigGetReqCreate(msg__, dst__, src__) \
2708 msg__ = kmalloc(sizeof(CsrWifiSmePowerConfigGetReq), GFP_KERNEL); \
2709 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_POWER_CONFIG_GET_REQ, dst__, src__);
2710
2711#define CsrWifiSmePowerConfigGetReqSendTo(dst__, src__) \
2712 { \
2713 CsrWifiSmePowerConfigGetReq *msg__; \
2714 CsrWifiSmePowerConfigGetReqCreate(msg__, dst__, src__); \
2715 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2716 }
2717
2718#define CsrWifiSmePowerConfigGetReqSend(src__) \
2719 CsrWifiSmePowerConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
2720
2721/*******************************************************************************
2722
2723 NAME
2724 CsrWifiSmePowerConfigGetCfmSend
2725
2726 DESCRIPTION
2727 This primitive reports the result of the request.
2728
2729 PARAMETERS
2730 queue - Destination Task Queue
2731 status - Reports the result of the request
2732 powerConfig - Returns the current parameters for the power configuration of
2733 the firmware
2734
2735*******************************************************************************/
2736#define CsrWifiSmePowerConfigGetCfmCreate(msg__, dst__, src__, status__, powerConfig__) \
2737 msg__ = kmalloc(sizeof(CsrWifiSmePowerConfigGetCfm), GFP_KERNEL); \
2738 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_POWER_CONFIG_GET_CFM, dst__, src__); \
2739 msg__->status = (status__); \
2740 msg__->powerConfig = (powerConfig__);
2741
2742#define CsrWifiSmePowerConfigGetCfmSendTo(dst__, src__, status__, powerConfig__) \
2743 { \
2744 CsrWifiSmePowerConfigGetCfm *msg__; \
2745 CsrWifiSmePowerConfigGetCfmCreate(msg__, dst__, src__, status__, powerConfig__); \
2746 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2747 }
2748
2749#define CsrWifiSmePowerConfigGetCfmSend(dst__, status__, powerConfig__) \
2750 CsrWifiSmePowerConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, powerConfig__)
2751
2752/*******************************************************************************
2753
2754 NAME
2755 CsrWifiSmePowerConfigSetReqSend
2756
2757 DESCRIPTION
2758 This primitive sets the value of the PowerConfig parameter.
2759
2760 PARAMETERS
2761 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
2762 powerConfig - Power saving configuration
2763
2764*******************************************************************************/
2765#define CsrWifiSmePowerConfigSetReqCreate(msg__, dst__, src__, powerConfig__) \
2766 msg__ = kmalloc(sizeof(CsrWifiSmePowerConfigSetReq), GFP_KERNEL); \
2767 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_POWER_CONFIG_SET_REQ, dst__, src__); \
2768 msg__->powerConfig = (powerConfig__);
2769
2770#define CsrWifiSmePowerConfigSetReqSendTo(dst__, src__, powerConfig__) \
2771 { \
2772 CsrWifiSmePowerConfigSetReq *msg__; \
2773 CsrWifiSmePowerConfigSetReqCreate(msg__, dst__, src__, powerConfig__); \
2774 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2775 }
2776
2777#define CsrWifiSmePowerConfigSetReqSend(src__, powerConfig__) \
2778 CsrWifiSmePowerConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, powerConfig__)
2779
2780/*******************************************************************************
2781
2782 NAME
2783 CsrWifiSmePowerConfigSetCfmSend
2784
2785 DESCRIPTION
2786 This primitive reports the result of the request.
2787
2788 PARAMETERS
2789 queue - Destination Task Queue
2790 status - Reports the result of the request
2791
2792*******************************************************************************/
2793#define CsrWifiSmePowerConfigSetCfmCreate(msg__, dst__, src__, status__) \
2794 msg__ = kmalloc(sizeof(CsrWifiSmePowerConfigSetCfm), GFP_KERNEL); \
2795 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_POWER_CONFIG_SET_CFM, dst__, src__); \
2796 msg__->status = (status__);
2797
2798#define CsrWifiSmePowerConfigSetCfmSendTo(dst__, src__, status__) \
2799 { \
2800 CsrWifiSmePowerConfigSetCfm *msg__; \
2801 CsrWifiSmePowerConfigSetCfmCreate(msg__, dst__, src__, status__); \
2802 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2803 }
2804
2805#define CsrWifiSmePowerConfigSetCfmSend(dst__, status__) \
2806 CsrWifiSmePowerConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
2807
2808/*******************************************************************************
2809
2810 NAME
2811 CsrWifiSmeRegulatoryDomainInfoGetReqSend
2812
2813 DESCRIPTION
2814 This primitive gets the value of the RegulatoryDomainInfo parameter.
2815
2816 PARAMETERS
2817 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
2818
2819*******************************************************************************/
2820#define CsrWifiSmeRegulatoryDomainInfoGetReqCreate(msg__, dst__, src__) \
2821 msg__ = kmalloc(sizeof(CsrWifiSmeRegulatoryDomainInfoGetReq), GFP_KERNEL); \
2822 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_REGULATORY_DOMAIN_INFO_GET_REQ, dst__, src__);
2823
2824#define CsrWifiSmeRegulatoryDomainInfoGetReqSendTo(dst__, src__) \
2825 { \
2826 CsrWifiSmeRegulatoryDomainInfoGetReq *msg__; \
2827 CsrWifiSmeRegulatoryDomainInfoGetReqCreate(msg__, dst__, src__); \
2828 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2829 }
2830
2831#define CsrWifiSmeRegulatoryDomainInfoGetReqSend(src__) \
2832 CsrWifiSmeRegulatoryDomainInfoGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
2833
2834/*******************************************************************************
2835
2836 NAME
2837 CsrWifiSmeRegulatoryDomainInfoGetCfmSend
2838
2839 DESCRIPTION
2840 This primitive reports the result of the request.
2841
2842 PARAMETERS
2843 queue - Destination Task Queue
2844 status - Reports the result of the request
2845 regDomInfo - Reports information and state related to regulatory domain
2846 operation.
2847
2848*******************************************************************************/
2849#define CsrWifiSmeRegulatoryDomainInfoGetCfmCreate(msg__, dst__, src__, status__, regDomInfo__) \
2850 msg__ = kmalloc(sizeof(CsrWifiSmeRegulatoryDomainInfoGetCfm), GFP_KERNEL); \
2851 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_REGULATORY_DOMAIN_INFO_GET_CFM, dst__, src__); \
2852 msg__->status = (status__); \
2853 msg__->regDomInfo = (regDomInfo__);
2854
2855#define CsrWifiSmeRegulatoryDomainInfoGetCfmSendTo(dst__, src__, status__, regDomInfo__) \
2856 { \
2857 CsrWifiSmeRegulatoryDomainInfoGetCfm *msg__; \
2858 CsrWifiSmeRegulatoryDomainInfoGetCfmCreate(msg__, dst__, src__, status__, regDomInfo__); \
2859 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2860 }
2861
2862#define CsrWifiSmeRegulatoryDomainInfoGetCfmSend(dst__, status__, regDomInfo__) \
2863 CsrWifiSmeRegulatoryDomainInfoGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, regDomInfo__)
2864
2865/*******************************************************************************
2866
2867 NAME
2868 CsrWifiSmeRoamCompleteIndSend
2869
2870 DESCRIPTION
2871 The SME will send this primitive to all the tasks that have registered to
2872 receive it whenever it completes an attempt to roam to an AP. If the roam
2873 attempt was successful, status will be set to CSR_WIFI_SME_SUCCESS,
2874 otherwise it shall be set to the appropriate error code.
2875
2876 PARAMETERS
2877 queue - Destination Task Queue
2878 interfaceTag - Interface Identifier; unique identifier of an interface
2879 status - Reports the result of the roaming procedure
2880
2881*******************************************************************************/
2882#define CsrWifiSmeRoamCompleteIndCreate(msg__, dst__, src__, interfaceTag__, status__) \
2883 msg__ = kmalloc(sizeof(CsrWifiSmeRoamCompleteInd), GFP_KERNEL); \
2884 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAM_COMPLETE_IND, dst__, src__); \
2885 msg__->interfaceTag = (interfaceTag__); \
2886 msg__->status = (status__);
2887
2888#define CsrWifiSmeRoamCompleteIndSendTo(dst__, src__, interfaceTag__, status__) \
2889 { \
2890 CsrWifiSmeRoamCompleteInd *msg__; \
2891 CsrWifiSmeRoamCompleteIndCreate(msg__, dst__, src__, interfaceTag__, status__); \
2892 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2893 }
2894
2895#define CsrWifiSmeRoamCompleteIndSend(dst__, interfaceTag__, status__) \
2896 CsrWifiSmeRoamCompleteIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
2897
2898/*******************************************************************************
2899
2900 NAME
2901 CsrWifiSmeRoamStartIndSend
2902
2903 DESCRIPTION
2904 The SME will send this primitive to all the tasks that have registered to
2905 receive it whenever it begins an attempt to roam to an AP.
2906 If the wireless manager application connect request specified the SSID
2907 and the BSSID was set to the broadcast address (0xFF 0xFF 0xFF 0xFF 0xFF
2908 0xFF), the SME monitors the signal quality and maintains a list of
2909 candidates to roam to. When the signal quality of the current connection
2910 falls below a threshold, and there is a candidate with better quality,
2911 the SME will attempt to the candidate AP.
2912 If the roaming procedure succeeds, the SME will also issue a Media
2913 Connect indication to inform the wireless manager application of the
2914 change.
2915 NOTE: to prevent the SME from initiating roaming the WMA must specify the
2916 BSSID in the connection request; this forces the SME to connect only to
2917 that AP.
2918 The wireless manager application can obtain statistics for roaming
2919 purposes using CSR_WIFI_SME_CONNECTION_QUALITY_IND and
2920 CSR_WIFI_SME_CONNECTION_STATS_GET_REQ.
2921 When the wireless manager application wishes to roam to another AP, it
2922 must issue a connection request specifying the BSSID of the desired AP.
2923
2924 PARAMETERS
2925 queue - Destination Task Queue
2926 interfaceTag - Interface Identifier; unique identifier of an interface
2927 roamReason - Indicates the reason for starting the roaming procedure
2928 reason80211 - Indicates the reason for deauthentication or disassociation
2929
2930*******************************************************************************/
2931#define CsrWifiSmeRoamStartIndCreate(msg__, dst__, src__, interfaceTag__, roamReason__, reason80211__) \
2932 msg__ = kmalloc(sizeof(CsrWifiSmeRoamStartInd), GFP_KERNEL); \
2933 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAM_START_IND, dst__, src__); \
2934 msg__->interfaceTag = (interfaceTag__); \
2935 msg__->roamReason = (roamReason__); \
2936 msg__->reason80211 = (reason80211__);
2937
2938#define CsrWifiSmeRoamStartIndSendTo(dst__, src__, interfaceTag__, roamReason__, reason80211__) \
2939 { \
2940 CsrWifiSmeRoamStartInd *msg__; \
2941 CsrWifiSmeRoamStartIndCreate(msg__, dst__, src__, interfaceTag__, roamReason__, reason80211__); \
2942 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
2943 }
2944
2945#define CsrWifiSmeRoamStartIndSend(dst__, interfaceTag__, roamReason__, reason80211__) \
2946 CsrWifiSmeRoamStartIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, roamReason__, reason80211__)
2947
2948/*******************************************************************************
2949
2950 NAME
2951 CsrWifiSmeRoamingConfigGetReqSend
2952
2953 DESCRIPTION
2954 This primitive gets the value of the RoamingConfig parameter.
2955
2956 PARAMETERS
2957 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
2958 interfaceTag - Interface Identifier; unique identifier of an interface
2959
2960*******************************************************************************/
2961#define CsrWifiSmeRoamingConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \
2962 msg__ = kmalloc(sizeof(CsrWifiSmeRoamingConfigGetReq), GFP_KERNEL); \
2963 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAMING_CONFIG_GET_REQ, dst__, src__); \
2964 msg__->interfaceTag = (interfaceTag__);
2965
2966#define CsrWifiSmeRoamingConfigGetReqSendTo(dst__, src__, interfaceTag__) \
2967 { \
2968 CsrWifiSmeRoamingConfigGetReq *msg__; \
2969 CsrWifiSmeRoamingConfigGetReqCreate(msg__, dst__, src__, interfaceTag__); \
2970 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
2971 }
2972
2973#define CsrWifiSmeRoamingConfigGetReqSend(src__, interfaceTag__) \
2974 CsrWifiSmeRoamingConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__)
2975
2976/*******************************************************************************
2977
2978 NAME
2979 CsrWifiSmeRoamingConfigGetCfmSend
2980
2981 DESCRIPTION
2982 This primitive reports the result of the request.
2983
2984 PARAMETERS
2985 queue - Destination Task Queue
2986 interfaceTag - Interface Identifier; unique identifier of an interface
2987 status - Reports the result of the request
2988 roamingConfig - Reports the roaming behaviour of the driver and firmware
2989
2990*******************************************************************************/
2991#define CsrWifiSmeRoamingConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, roamingConfig__) \
2992 msg__ = kmalloc(sizeof(CsrWifiSmeRoamingConfigGetCfm), GFP_KERNEL); \
2993 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAMING_CONFIG_GET_CFM, dst__, src__); \
2994 msg__->interfaceTag = (interfaceTag__); \
2995 msg__->status = (status__); \
2996 msg__->roamingConfig = (roamingConfig__);
2997
2998#define CsrWifiSmeRoamingConfigGetCfmSendTo(dst__, src__, interfaceTag__, status__, roamingConfig__) \
2999 { \
3000 CsrWifiSmeRoamingConfigGetCfm *msg__; \
3001 CsrWifiSmeRoamingConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, roamingConfig__); \
3002 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3003 }
3004
3005#define CsrWifiSmeRoamingConfigGetCfmSend(dst__, interfaceTag__, status__, roamingConfig__) \
3006 CsrWifiSmeRoamingConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, roamingConfig__)
3007
3008/*******************************************************************************
3009
3010 NAME
3011 CsrWifiSmeRoamingConfigSetReqSend
3012
3013 DESCRIPTION
3014 This primitive sets the value of the RoamingConfig parameter.
3015
3016 PARAMETERS
3017 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
3018 interfaceTag - Interface Identifier; unique identifier of an interface
3019 roamingConfig - Desired roaming behaviour values
3020
3021*******************************************************************************/
3022#define CsrWifiSmeRoamingConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, roamingConfig__) \
3023 msg__ = kmalloc(sizeof(CsrWifiSmeRoamingConfigSetReq), GFP_KERNEL); \
3024 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAMING_CONFIG_SET_REQ, dst__, src__); \
3025 msg__->interfaceTag = (interfaceTag__); \
3026 msg__->roamingConfig = (roamingConfig__);
3027
3028#define CsrWifiSmeRoamingConfigSetReqSendTo(dst__, src__, interfaceTag__, roamingConfig__) \
3029 { \
3030 CsrWifiSmeRoamingConfigSetReq *msg__; \
3031 CsrWifiSmeRoamingConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, roamingConfig__); \
3032 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3033 }
3034
3035#define CsrWifiSmeRoamingConfigSetReqSend(src__, interfaceTag__, roamingConfig__) \
3036 CsrWifiSmeRoamingConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, roamingConfig__)
3037
3038/*******************************************************************************
3039
3040 NAME
3041 CsrWifiSmeRoamingConfigSetCfmSend
3042
3043 DESCRIPTION
3044 This primitive sets the value of the RoamingConfig parameter.
3045
3046 PARAMETERS
3047 queue - Destination Task Queue
3048 interfaceTag - Interface Identifier; unique identifier of an interface
3049 status - Reports the result of the request
3050
3051*******************************************************************************/
3052#define CsrWifiSmeRoamingConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
3053 msg__ = kmalloc(sizeof(CsrWifiSmeRoamingConfigSetCfm), GFP_KERNEL); \
3054 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_ROAMING_CONFIG_SET_CFM, dst__, src__); \
3055 msg__->interfaceTag = (interfaceTag__); \
3056 msg__->status = (status__);
3057
3058#define CsrWifiSmeRoamingConfigSetCfmSendTo(dst__, src__, interfaceTag__, status__) \
3059 { \
3060 CsrWifiSmeRoamingConfigSetCfm *msg__; \
3061 CsrWifiSmeRoamingConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
3062 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3063 }
3064
3065#define CsrWifiSmeRoamingConfigSetCfmSend(dst__, interfaceTag__, status__) \
3066 CsrWifiSmeRoamingConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
3067
3068/*******************************************************************************
3069
3070 NAME
3071 CsrWifiSmeScanConfigGetReqSend
3072
3073 DESCRIPTION
3074 This primitive gets the value of the ScanConfig parameter.
3075
3076 PARAMETERS
3077 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
3078
3079*******************************************************************************/
3080#define CsrWifiSmeScanConfigGetReqCreate(msg__, dst__, src__) \
3081 msg__ = kmalloc(sizeof(CsrWifiSmeScanConfigGetReq), GFP_KERNEL); \
3082 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_CONFIG_GET_REQ, dst__, src__);
3083
3084#define CsrWifiSmeScanConfigGetReqSendTo(dst__, src__) \
3085 { \
3086 CsrWifiSmeScanConfigGetReq *msg__; \
3087 CsrWifiSmeScanConfigGetReqCreate(msg__, dst__, src__); \
3088 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3089 }
3090
3091#define CsrWifiSmeScanConfigGetReqSend(src__) \
3092 CsrWifiSmeScanConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
3093
3094/*******************************************************************************
3095
3096 NAME
3097 CsrWifiSmeScanConfigGetCfmSend
3098
3099 DESCRIPTION
3100 This primitive reports the result of the request.
3101
3102 PARAMETERS
3103 queue - Destination Task Queue
3104 status - Reports the result of the request
3105 scanConfig - Returns the current parameters for the autonomous scanning
3106 behaviour of the firmware
3107
3108*******************************************************************************/
3109#define CsrWifiSmeScanConfigGetCfmCreate(msg__, dst__, src__, status__, scanConfig__) \
3110 msg__ = kmalloc(sizeof(CsrWifiSmeScanConfigGetCfm), GFP_KERNEL); \
3111 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_CONFIG_GET_CFM, dst__, src__); \
3112 msg__->status = (status__); \
3113 msg__->scanConfig = (scanConfig__);
3114
3115#define CsrWifiSmeScanConfigGetCfmSendTo(dst__, src__, status__, scanConfig__) \
3116 { \
3117 CsrWifiSmeScanConfigGetCfm *msg__; \
3118 CsrWifiSmeScanConfigGetCfmCreate(msg__, dst__, src__, status__, scanConfig__); \
3119 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3120 }
3121
3122#define CsrWifiSmeScanConfigGetCfmSend(dst__, status__, scanConfig__) \
3123 CsrWifiSmeScanConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, scanConfig__)
3124
3125/*******************************************************************************
3126
3127 NAME
3128 CsrWifiSmeScanConfigSetReqSend
3129
3130 DESCRIPTION
3131 This primitive sets the value of the ScanConfig parameter.
3132 The SME normally configures the firmware to perform autonomous scanning
3133 without involving the host.
3134 The firmware passes beacon / probe response or indicates loss of beacon
3135 on certain changes of state, for example:
3136 * A new AP is seen for the first time
3137 * An AP is no longer visible
3138 * The signal strength of an AP changes by more than a certain amount, as
3139 configured by the thresholds in the scanConfig parameter
3140 In addition to the autonomous scan, the wireless manager application may
3141 request a scan at any time using CSR_WIFI_SME_SCAN_FULL_REQ.
3142
3143 PARAMETERS
3144 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
3145 scanConfig - Reports the configuration for the autonomous scanning behaviour
3146 of the firmware
3147
3148*******************************************************************************/
3149#define CsrWifiSmeScanConfigSetReqCreate(msg__, dst__, src__, scanConfig__) \
3150 msg__ = kmalloc(sizeof(CsrWifiSmeScanConfigSetReq), GFP_KERNEL); \
3151 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_CONFIG_SET_REQ, dst__, src__); \
3152 msg__->scanConfig = (scanConfig__);
3153
3154#define CsrWifiSmeScanConfigSetReqSendTo(dst__, src__, scanConfig__) \
3155 { \
3156 CsrWifiSmeScanConfigSetReq *msg__; \
3157 CsrWifiSmeScanConfigSetReqCreate(msg__, dst__, src__, scanConfig__); \
3158 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3159 }
3160
3161#define CsrWifiSmeScanConfigSetReqSend(src__, scanConfig__) \
3162 CsrWifiSmeScanConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, scanConfig__)
3163
3164/*******************************************************************************
3165
3166 NAME
3167 CsrWifiSmeScanConfigSetCfmSend
3168
3169 DESCRIPTION
3170 This primitive reports the result of the request.
3171
3172 PARAMETERS
3173 queue - Destination Task Queue
3174 status - Reports the result of the request
3175
3176*******************************************************************************/
3177#define CsrWifiSmeScanConfigSetCfmCreate(msg__, dst__, src__, status__) \
3178 msg__ = kmalloc(sizeof(CsrWifiSmeScanConfigSetCfm), GFP_KERNEL); \
3179 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_CONFIG_SET_CFM, dst__, src__); \
3180 msg__->status = (status__);
3181
3182#define CsrWifiSmeScanConfigSetCfmSendTo(dst__, src__, status__) \
3183 { \
3184 CsrWifiSmeScanConfigSetCfm *msg__; \
3185 CsrWifiSmeScanConfigSetCfmCreate(msg__, dst__, src__, status__); \
3186 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3187 }
3188
3189#define CsrWifiSmeScanConfigSetCfmSend(dst__, status__) \
3190 CsrWifiSmeScanConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
3191
3192/*******************************************************************************
3193
3194 NAME
3195 CsrWifiSmeScanFullReqSend
3196
3197 DESCRIPTION
3198 The wireless manager application should call this primitive to request a
3199 full scan.
3200 Channels are scanned actively or passively according to the requirement
3201 set by regulatory domain.
3202 If the SME receives this primitive while a full scan is going on, the new
3203 request is buffered and it will be served after the current full scan is
3204 completed.
3205
3206 PARAMETERS
3207 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
3208 ssidCount - Number of SSIDs provided.
3209 If it is 0, the SME will attempt to detect any network
3210 ssid - Points to the first SSID provided, if any.
3211 bssid - BSS identifier.
3212 If it is equal to FF-FF-FF-FF-FF, the SME will listen for
3213 messages from any BSS.
3214 If it is different from FF-FF-FF-FF-FF and any SSID is
3215 provided, one SSID must match the network of the BSS.
3216 forceScan - Forces the scan even if the SME is in a state which would
3217 normally prevent it (e.g. autonomous scan is running).
3218 bssType - Type of BSS to scan for
3219 scanType - Type of scan to perform
3220 channelListCount - Number of channels provided.
3221 If it is 0, the SME will initiate a scan of all the
3222 supported channels that are permitted by the current
3223 regulatory domain.
3224 channelList - Points to the first channel , or NULL if channelListCount
3225 is zero.
3226 probeIeLength - Length of the information element in bytes to be sent
3227 with the probe message.
3228 probeIe - Points to the first byte of the information element to be
3229 sent with the probe message.
3230
3231*******************************************************************************/
3232#define CsrWifiSmeScanFullReqCreate(msg__, dst__, src__, ssidCount__, ssid__, bssid__, forceScan__, bssType__, scanType__, channelListCount__, channelList__, probeIeLength__, probeIe__) \
3233 msg__ = kmalloc(sizeof(CsrWifiSmeScanFullReq), GFP_KERNEL); \
3234 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_FULL_REQ, dst__, src__); \
3235 msg__->ssidCount = (ssidCount__); \
3236 msg__->ssid = (ssid__); \
3237 msg__->bssid = (bssid__); \
3238 msg__->forceScan = (forceScan__); \
3239 msg__->bssType = (bssType__); \
3240 msg__->scanType = (scanType__); \
3241 msg__->channelListCount = (channelListCount__); \
3242 msg__->channelList = (channelList__); \
3243 msg__->probeIeLength = (probeIeLength__); \
3244 msg__->probeIe = (probeIe__);
3245
3246#define CsrWifiSmeScanFullReqSendTo(dst__, src__, ssidCount__, ssid__, bssid__, forceScan__, bssType__, scanType__, channelListCount__, channelList__, probeIeLength__, probeIe__) \
3247 { \
3248 CsrWifiSmeScanFullReq *msg__; \
3249 CsrWifiSmeScanFullReqCreate(msg__, dst__, src__, ssidCount__, ssid__, bssid__, forceScan__, bssType__, scanType__, channelListCount__, channelList__, probeIeLength__, probeIe__); \
3250 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3251 }
3252
3253#define CsrWifiSmeScanFullReqSend(src__, ssidCount__, ssid__, bssid__, forceScan__, bssType__, scanType__, channelListCount__, channelList__, probeIeLength__, probeIe__) \
3254 CsrWifiSmeScanFullReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, ssidCount__, ssid__, bssid__, forceScan__, bssType__, scanType__, channelListCount__, channelList__, probeIeLength__, probeIe__)
3255
3256/*******************************************************************************
3257
3258 NAME
3259 CsrWifiSmeScanFullCfmSend
3260
3261 DESCRIPTION
3262 The SME calls this primitive when the results from the scan are
3263 available.
3264
3265 PARAMETERS
3266 queue - Destination Task Queue
3267 status - Reports the result of the request
3268
3269*******************************************************************************/
3270#define CsrWifiSmeScanFullCfmCreate(msg__, dst__, src__, status__) \
3271 msg__ = kmalloc(sizeof(CsrWifiSmeScanFullCfm), GFP_KERNEL); \
3272 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_FULL_CFM, dst__, src__); \
3273 msg__->status = (status__);
3274
3275#define CsrWifiSmeScanFullCfmSendTo(dst__, src__, status__) \
3276 { \
3277 CsrWifiSmeScanFullCfm *msg__; \
3278 CsrWifiSmeScanFullCfmCreate(msg__, dst__, src__, status__); \
3279 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3280 }
3281
3282#define CsrWifiSmeScanFullCfmSend(dst__, status__) \
3283 CsrWifiSmeScanFullCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
3284
3285/*******************************************************************************
3286
3287 NAME
3288 CsrWifiSmeScanResultIndSend
3289
3290 DESCRIPTION
3291 The SME sends this primitive to all the tasks that have registered to
3292 receive it whenever a scan indication is received from the firmware.
3293
3294 PARAMETERS
3295 queue - Destination Task Queue
3296 result - Points to a buffer containing a scan result.
3297
3298*******************************************************************************/
3299#define CsrWifiSmeScanResultIndCreate(msg__, dst__, src__, result__) \
3300 msg__ = kmalloc(sizeof(CsrWifiSmeScanResultInd), GFP_KERNEL); \
3301 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULT_IND, dst__, src__); \
3302 msg__->result = (result__);
3303
3304#define CsrWifiSmeScanResultIndSendTo(dst__, src__, result__) \
3305 { \
3306 CsrWifiSmeScanResultInd *msg__; \
3307 CsrWifiSmeScanResultIndCreate(msg__, dst__, src__, result__); \
3308 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3309 }
3310
3311#define CsrWifiSmeScanResultIndSend(dst__, result__) \
3312 CsrWifiSmeScanResultIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, result__)
3313
3314/*******************************************************************************
3315
3316 NAME
3317 CsrWifiSmeScanResultsFlushReqSend
3318
3319 DESCRIPTION
3320 The Wireless Manager calls this primitive to ask the SME to delete all
3321 scan results from its cache, except for the scan result of any currently
3322 connected network.
3323 As scan results are received by the SME from the firmware, they are
3324 cached in the SME memory.
3325 Any time the Wireless Manager requests scan results, they are returned
3326 from the SME internal cache.
3327 For some applications it may be desirable to clear this cache prior to
3328 requesting that a scan be performed; this will ensure that the cache then
3329 only contains the networks detected in the most recent scan.
3330
3331 PARAMETERS
3332 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
3333
3334*******************************************************************************/
3335#define CsrWifiSmeScanResultsFlushReqCreate(msg__, dst__, src__) \
3336 msg__ = kmalloc(sizeof(CsrWifiSmeScanResultsFlushReq), GFP_KERNEL); \
3337 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULTS_FLUSH_REQ, dst__, src__);
3338
3339#define CsrWifiSmeScanResultsFlushReqSendTo(dst__, src__) \
3340 { \
3341 CsrWifiSmeScanResultsFlushReq *msg__; \
3342 CsrWifiSmeScanResultsFlushReqCreate(msg__, dst__, src__); \
3343 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3344 }
3345
3346#define CsrWifiSmeScanResultsFlushReqSend(src__) \
3347 CsrWifiSmeScanResultsFlushReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
3348
3349/*******************************************************************************
3350
3351 NAME
3352 CsrWifiSmeScanResultsFlushCfmSend
3353
3354 DESCRIPTION
3355 The SME will call this primitive when the cache has been cleared.
3356
3357 PARAMETERS
3358 queue - Destination Task Queue
3359 status - Reports the result of the request
3360
3361*******************************************************************************/
3362#define CsrWifiSmeScanResultsFlushCfmCreate(msg__, dst__, src__, status__) \
3363 msg__ = kmalloc(sizeof(CsrWifiSmeScanResultsFlushCfm), GFP_KERNEL); \
3364 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULTS_FLUSH_CFM, dst__, src__); \
3365 msg__->status = (status__);
3366
3367#define CsrWifiSmeScanResultsFlushCfmSendTo(dst__, src__, status__) \
3368 { \
3369 CsrWifiSmeScanResultsFlushCfm *msg__; \
3370 CsrWifiSmeScanResultsFlushCfmCreate(msg__, dst__, src__, status__); \
3371 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3372 }
3373
3374#define CsrWifiSmeScanResultsFlushCfmSend(dst__, status__) \
3375 CsrWifiSmeScanResultsFlushCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
3376
3377/*******************************************************************************
3378
3379 NAME
3380 CsrWifiSmeScanResultsGetReqSend
3381
3382 DESCRIPTION
3383 The wireless manager application calls this primitive to retrieve the
3384 current set of scan results, either after receiving a successful
3385 CSR_WIFI_SME_SCAN_FULL_CFM, or to get autonomous scan results.
3386
3387 PARAMETERS
3388 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
3389
3390*******************************************************************************/
3391#define CsrWifiSmeScanResultsGetReqCreate(msg__, dst__, src__) \
3392 msg__ = kmalloc(sizeof(CsrWifiSmeScanResultsGetReq), GFP_KERNEL); \
3393 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULTS_GET_REQ, dst__, src__);
3394
3395#define CsrWifiSmeScanResultsGetReqSendTo(dst__, src__) \
3396 { \
3397 CsrWifiSmeScanResultsGetReq *msg__; \
3398 CsrWifiSmeScanResultsGetReqCreate(msg__, dst__, src__); \
3399 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3400 }
3401
3402#define CsrWifiSmeScanResultsGetReqSend(src__) \
3403 CsrWifiSmeScanResultsGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
3404
3405/*******************************************************************************
3406
3407 NAME
3408 CsrWifiSmeScanResultsGetCfmSend
3409
3410 DESCRIPTION
3411 The SME sends this primitive to provide the current set of scan results.
3412
3413 PARAMETERS
3414 queue - Destination Task Queue
3415 status - Reports the result of the request
3416 scanResultsCount - Number of scan results
3417 scanResults - Points to a buffer containing an array of
3418 CsrWifiSmeScanResult structures.
3419
3420*******************************************************************************/
3421#define CsrWifiSmeScanResultsGetCfmCreate(msg__, dst__, src__, status__, scanResultsCount__, scanResults__) \
3422 msg__ = kmalloc(sizeof(CsrWifiSmeScanResultsGetCfm), GFP_KERNEL); \
3423 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SCAN_RESULTS_GET_CFM, dst__, src__); \
3424 msg__->status = (status__); \
3425 msg__->scanResultsCount = (scanResultsCount__); \
3426 msg__->scanResults = (scanResults__);
3427
3428#define CsrWifiSmeScanResultsGetCfmSendTo(dst__, src__, status__, scanResultsCount__, scanResults__) \
3429 { \
3430 CsrWifiSmeScanResultsGetCfm *msg__; \
3431 CsrWifiSmeScanResultsGetCfmCreate(msg__, dst__, src__, status__, scanResultsCount__, scanResults__); \
3432 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3433 }
3434
3435#define CsrWifiSmeScanResultsGetCfmSend(dst__, status__, scanResultsCount__, scanResults__) \
3436 CsrWifiSmeScanResultsGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, scanResultsCount__, scanResults__)
3437
3438/*******************************************************************************
3439
3440 NAME
3441 CsrWifiSmeSetReqSend
3442
3443 DESCRIPTION
3444 Used to pass custom data to the SME. Format is the same as 802.11 Info
3445 Elements => | Id | Length | Data
3446 1) Cmanr Test Mode "Id:0 Length:1 Data:0x00 = OFF 0x01 = ON" "0x00 0x01
3447 (0x00|0x01)"
3448
3449 PARAMETERS
3450 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
3451 dataLength - Number of bytes in the buffer pointed to by 'data'
3452 data - Pointer to the buffer containing 'dataLength' bytes
3453
3454*******************************************************************************/
3455#define CsrWifiSmeSetReqCreate(msg__, dst__, src__, dataLength__, data__) \
3456 msg__ = kmalloc(sizeof(CsrWifiSmeSetReq), GFP_KERNEL); \
3457 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SET_REQ, dst__, src__); \
3458 msg__->dataLength = (dataLength__); \
3459 msg__->data = (data__);
3460
3461#define CsrWifiSmeSetReqSendTo(dst__, src__, dataLength__, data__) \
3462 { \
3463 CsrWifiSmeSetReq *msg__; \
3464 CsrWifiSmeSetReqCreate(msg__, dst__, src__, dataLength__, data__); \
3465 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3466 }
3467
3468#define CsrWifiSmeSetReqSend(src__, dataLength__, data__) \
3469 CsrWifiSmeSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, dataLength__, data__)
3470
3471/*******************************************************************************
3472
3473 NAME
3474 CsrWifiSmeSmeCommonConfigGetReqSend
3475
3476 DESCRIPTION
3477 This primitive gets the value of the Sme common parameter.
3478
3479 PARAMETERS
3480 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
3481
3482*******************************************************************************/
3483#define CsrWifiSmeSmeCommonConfigGetReqCreate(msg__, dst__, src__) \
3484 msg__ = kmalloc(sizeof(CsrWifiSmeSmeCommonConfigGetReq), GFP_KERNEL); \
3485 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_COMMON_CONFIG_GET_REQ, dst__, src__);
3486
3487#define CsrWifiSmeSmeCommonConfigGetReqSendTo(dst__, src__) \
3488 { \
3489 CsrWifiSmeSmeCommonConfigGetReq *msg__; \
3490 CsrWifiSmeSmeCommonConfigGetReqCreate(msg__, dst__, src__); \
3491 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3492 }
3493
3494#define CsrWifiSmeSmeCommonConfigGetReqSend(src__) \
3495 CsrWifiSmeSmeCommonConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
3496
3497/*******************************************************************************
3498
3499 NAME
3500 CsrWifiSmeSmeCommonConfigGetCfmSend
3501
3502 DESCRIPTION
3503 This primitive reports the result of the request.
3504
3505 PARAMETERS
3506 queue - Destination Task Queue
3507 status - Reports the result of the request
3508 deviceConfig - Configuration options in the SME
3509
3510*******************************************************************************/
3511#define CsrWifiSmeSmeCommonConfigGetCfmCreate(msg__, dst__, src__, status__, deviceConfig__) \
3512 msg__ = kmalloc(sizeof(CsrWifiSmeSmeCommonConfigGetCfm), GFP_KERNEL); \
3513 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_COMMON_CONFIG_GET_CFM, dst__, src__); \
3514 msg__->status = (status__); \
3515 msg__->deviceConfig = (deviceConfig__);
3516
3517#define CsrWifiSmeSmeCommonConfigGetCfmSendTo(dst__, src__, status__, deviceConfig__) \
3518 { \
3519 CsrWifiSmeSmeCommonConfigGetCfm *msg__; \
3520 CsrWifiSmeSmeCommonConfigGetCfmCreate(msg__, dst__, src__, status__, deviceConfig__); \
3521 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3522 }
3523
3524#define CsrWifiSmeSmeCommonConfigGetCfmSend(dst__, status__, deviceConfig__) \
3525 CsrWifiSmeSmeCommonConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, deviceConfig__)
3526
3527/*******************************************************************************
3528
3529 NAME
3530 CsrWifiSmeSmeCommonConfigSetReqSend
3531
3532 DESCRIPTION
3533 This primitive sets the value of the Sme common.
3534
3535 PARAMETERS
3536 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
3537 deviceConfig - Configuration options in the SME
3538
3539*******************************************************************************/
3540#define CsrWifiSmeSmeCommonConfigSetReqCreate(msg__, dst__, src__, deviceConfig__) \
3541 msg__ = kmalloc(sizeof(CsrWifiSmeSmeCommonConfigSetReq), GFP_KERNEL); \
3542 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_COMMON_CONFIG_SET_REQ, dst__, src__); \
3543 msg__->deviceConfig = (deviceConfig__);
3544
3545#define CsrWifiSmeSmeCommonConfigSetReqSendTo(dst__, src__, deviceConfig__) \
3546 { \
3547 CsrWifiSmeSmeCommonConfigSetReq *msg__; \
3548 CsrWifiSmeSmeCommonConfigSetReqCreate(msg__, dst__, src__, deviceConfig__); \
3549 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3550 }
3551
3552#define CsrWifiSmeSmeCommonConfigSetReqSend(src__, deviceConfig__) \
3553 CsrWifiSmeSmeCommonConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, deviceConfig__)
3554
3555/*******************************************************************************
3556
3557 NAME
3558 CsrWifiSmeSmeCommonConfigSetCfmSend
3559
3560 DESCRIPTION
3561 Reports the result of the request
3562
3563 PARAMETERS
3564 queue - Destination Task Queue
3565 status - Reports the result of the request
3566
3567*******************************************************************************/
3568#define CsrWifiSmeSmeCommonConfigSetCfmCreate(msg__, dst__, src__, status__) \
3569 msg__ = kmalloc(sizeof(CsrWifiSmeSmeCommonConfigSetCfm), GFP_KERNEL); \
3570 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_COMMON_CONFIG_SET_CFM, dst__, src__); \
3571 msg__->status = (status__);
3572
3573#define CsrWifiSmeSmeCommonConfigSetCfmSendTo(dst__, src__, status__) \
3574 { \
3575 CsrWifiSmeSmeCommonConfigSetCfm *msg__; \
3576 CsrWifiSmeSmeCommonConfigSetCfmCreate(msg__, dst__, src__, status__); \
3577 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3578 }
3579
3580#define CsrWifiSmeSmeCommonConfigSetCfmSend(dst__, status__) \
3581 CsrWifiSmeSmeCommonConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
3582
3583/*******************************************************************************
3584
3585 NAME
3586 CsrWifiSmeSmeStaConfigGetReqSend
3587
3588 DESCRIPTION
3589 This primitive gets the value of the SmeStaConfig parameter.
3590
3591 PARAMETERS
3592 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
3593 interfaceTag - Interface Identifier; unique identifier of an interface
3594
3595*******************************************************************************/
3596#define CsrWifiSmeSmeStaConfigGetReqCreate(msg__, dst__, src__, interfaceTag__) \
3597 msg__ = kmalloc(sizeof(CsrWifiSmeSmeStaConfigGetReq), GFP_KERNEL); \
3598 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_STA_CONFIG_GET_REQ, dst__, src__); \
3599 msg__->interfaceTag = (interfaceTag__);
3600
3601#define CsrWifiSmeSmeStaConfigGetReqSendTo(dst__, src__, interfaceTag__) \
3602 { \
3603 CsrWifiSmeSmeStaConfigGetReq *msg__; \
3604 CsrWifiSmeSmeStaConfigGetReqCreate(msg__, dst__, src__, interfaceTag__); \
3605 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3606 }
3607
3608#define CsrWifiSmeSmeStaConfigGetReqSend(src__, interfaceTag__) \
3609 CsrWifiSmeSmeStaConfigGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__)
3610
3611/*******************************************************************************
3612
3613 NAME
3614 CsrWifiSmeSmeStaConfigGetCfmSend
3615
3616 DESCRIPTION
3617 This primitive reports the result of the request.
3618
3619 PARAMETERS
3620 queue - Destination Task Queue
3621 interfaceTag - Interface Identifier; unique identifier of an interface
3622 status - Reports the result of the request
3623 smeConfig - Current SME Station Parameters
3624
3625*******************************************************************************/
3626#define CsrWifiSmeSmeStaConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, smeConfig__) \
3627 msg__ = kmalloc(sizeof(CsrWifiSmeSmeStaConfigGetCfm), GFP_KERNEL); \
3628 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_STA_CONFIG_GET_CFM, dst__, src__); \
3629 msg__->interfaceTag = (interfaceTag__); \
3630 msg__->status = (status__); \
3631 msg__->smeConfig = (smeConfig__);
3632
3633#define CsrWifiSmeSmeStaConfigGetCfmSendTo(dst__, src__, interfaceTag__, status__, smeConfig__) \
3634 { \
3635 CsrWifiSmeSmeStaConfigGetCfm *msg__; \
3636 CsrWifiSmeSmeStaConfigGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, smeConfig__); \
3637 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3638 }
3639
3640#define CsrWifiSmeSmeStaConfigGetCfmSend(dst__, interfaceTag__, status__, smeConfig__) \
3641 CsrWifiSmeSmeStaConfigGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, smeConfig__)
3642
3643/*******************************************************************************
3644
3645 NAME
3646 CsrWifiSmeSmeStaConfigSetReqSend
3647
3648 DESCRIPTION
3649 This primitive sets the value of the SmeConfig parameter.
3650
3651 PARAMETERS
3652 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
3653 interfaceTag - Interface Identifier; unique identifier of an interface
3654 smeConfig - SME Station Parameters to be set
3655
3656*******************************************************************************/
3657#define CsrWifiSmeSmeStaConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, smeConfig__) \
3658 msg__ = kmalloc(sizeof(CsrWifiSmeSmeStaConfigSetReq), GFP_KERNEL); \
3659 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_STA_CONFIG_SET_REQ, dst__, src__); \
3660 msg__->interfaceTag = (interfaceTag__); \
3661 msg__->smeConfig = (smeConfig__);
3662
3663#define CsrWifiSmeSmeStaConfigSetReqSendTo(dst__, src__, interfaceTag__, smeConfig__) \
3664 { \
3665 CsrWifiSmeSmeStaConfigSetReq *msg__; \
3666 CsrWifiSmeSmeStaConfigSetReqCreate(msg__, dst__, src__, interfaceTag__, smeConfig__); \
3667 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3668 }
3669
3670#define CsrWifiSmeSmeStaConfigSetReqSend(src__, interfaceTag__, smeConfig__) \
3671 CsrWifiSmeSmeStaConfigSetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, smeConfig__)
3672
3673/*******************************************************************************
3674
3675 NAME
3676 CsrWifiSmeSmeStaConfigSetCfmSend
3677
3678 DESCRIPTION
3679 This primitive reports the result of the request.
3680
3681 PARAMETERS
3682 queue - Destination Task Queue
3683 interfaceTag - Interface Identifier; unique identifier of an interface
3684 status - Reports the result of the request
3685
3686*******************************************************************************/
3687#define CsrWifiSmeSmeStaConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
3688 msg__ = kmalloc(sizeof(CsrWifiSmeSmeStaConfigSetCfm), GFP_KERNEL); \
3689 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_SME_STA_CONFIG_SET_CFM, dst__, src__); \
3690 msg__->interfaceTag = (interfaceTag__); \
3691 msg__->status = (status__);
3692
3693#define CsrWifiSmeSmeStaConfigSetCfmSendTo(dst__, src__, interfaceTag__, status__) \
3694 { \
3695 CsrWifiSmeSmeStaConfigSetCfm *msg__; \
3696 CsrWifiSmeSmeStaConfigSetCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
3697 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3698 }
3699
3700#define CsrWifiSmeSmeStaConfigSetCfmSend(dst__, interfaceTag__, status__) \
3701 CsrWifiSmeSmeStaConfigSetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__)
3702
3703/*******************************************************************************
3704
3705 NAME
3706 CsrWifiSmeStationMacAddressGetReqSend
3707
3708 DESCRIPTION
3709 This primitives is used to retrieve the current MAC address used by the
3710 station.
3711
3712 PARAMETERS
3713 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
3714
3715*******************************************************************************/
3716#define CsrWifiSmeStationMacAddressGetReqCreate(msg__, dst__, src__) \
3717 msg__ = kmalloc(sizeof(CsrWifiSmeStationMacAddressGetReq), GFP_KERNEL); \
3718 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_REQ, dst__, src__);
3719
3720#define CsrWifiSmeStationMacAddressGetReqSendTo(dst__, src__) \
3721 { \
3722 CsrWifiSmeStationMacAddressGetReq *msg__; \
3723 CsrWifiSmeStationMacAddressGetReqCreate(msg__, dst__, src__); \
3724 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3725 }
3726
3727#define CsrWifiSmeStationMacAddressGetReqSend(src__) \
3728 CsrWifiSmeStationMacAddressGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
3729
3730/*******************************************************************************
3731
3732 NAME
3733 CsrWifiSmeStationMacAddressGetCfmSend
3734
3735 DESCRIPTION
3736 This primitive reports the result of the request.
3737
3738 PARAMETERS
3739 queue - Destination Task Queue
3740 status - Reports the result of the request
3741 stationMacAddress - Current MAC address of the station.
3742
3743*******************************************************************************/
3744#define CsrWifiSmeStationMacAddressGetCfmCreate(msg__, dst__, src__, status__, stationMacAddress__) \
3745 msg__ = kmalloc(sizeof(CsrWifiSmeStationMacAddressGetCfm), GFP_KERNEL); \
3746 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_CFM, dst__, src__); \
3747 msg__->status = (status__); \
3748 memcpy(msg__->stationMacAddress, (stationMacAddress__), sizeof(CsrWifiMacAddress) * 2);
3749
3750#define CsrWifiSmeStationMacAddressGetCfmSendTo(dst__, src__, status__, stationMacAddress__) \
3751 { \
3752 CsrWifiSmeStationMacAddressGetCfm *msg__; \
3753 CsrWifiSmeStationMacAddressGetCfmCreate(msg__, dst__, src__, status__, stationMacAddress__); \
3754 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3755 }
3756
3757#define CsrWifiSmeStationMacAddressGetCfmSend(dst__, status__, stationMacAddress__) \
3758 CsrWifiSmeStationMacAddressGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, stationMacAddress__)
3759
3760/*******************************************************************************
3761
3762 NAME
3763 CsrWifiSmeTspecReqSend
3764
3765 DESCRIPTION
3766 The wireless manager application should call this primitive to use the
3767 TSPEC feature.
3768 The chip supports the use of TSPECs and TCLAS for the use of IEEE
3769 802.11/WMM Quality of Service features.
3770 The API allows the wireless manager application to supply a correctly
3771 formatted TSPEC and TCLAS pair to the driver.
3772 After performing basic validation, the driver negotiates the installation
3773 of the TSPEC with the AP as defined by the 802.11 specification.
3774 The driver retains all TSPEC and TCLAS pairs until they are specifically
3775 removed.
3776 It is not compulsory for a TSPEC to have a TCLAS (NULL is used to
3777 indicate that no TCLAS is supplied), while a TCLASS always require a
3778 TSPEC.
3779 The format of the TSPEC element is specified in 'WMM (including WMM Power
3780 Save) Specification - Version 1.1' and 'ANSI/IEEE Std 802.11-REVmb/D3.0'.
3781 For more information, see 'UniFi Configuring WMM and WMM-PS'.
3782
3783 PARAMETERS
3784 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
3785 interfaceTag - Interface Identifier; unique identifier of an interface
3786 action - Specifies the action to be carried out on the list of TSPECs.
3787 CSR_WIFI_SME_LIST_ACTION_FLUSH is not applicable here.
3788 transactionId - Unique Transaction ID for the TSPEC, as assigned by the
3789 driver
3790 strict - If it set to false, allows the SME to perform automatic
3791 TSPEC negotiation
3792 ctrlMask - Additional TSPEC configuration for CCX.
3793 Set mask with values from CsrWifiSmeTspecCtrl.
3794 CURRENTLY NOT SUPPORTED
3795 tspecLength - Length of the TSPEC.
3796 tspec - Points to the first byte of the TSPEC
3797 tclasLength - Length of the TCLAS.
3798 If it is equal to 0, no TCLASS is provided for the TSPEC
3799 tclas - Points to the first byte of the TCLAS, if any.
3800
3801*******************************************************************************/
3802#define CsrWifiSmeTspecReqCreate(msg__, dst__, src__, interfaceTag__, action__, transactionId__, strict__, ctrlMask__, tspecLength__, tspec__, tclasLength__, tclas__) \
3803 msg__ = kmalloc(sizeof(CsrWifiSmeTspecReq), GFP_KERNEL); \
3804 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_TSPEC_REQ, dst__, src__); \
3805 msg__->interfaceTag = (interfaceTag__); \
3806 msg__->action = (action__); \
3807 msg__->transactionId = (transactionId__); \
3808 msg__->strict = (strict__); \
3809 msg__->ctrlMask = (ctrlMask__); \
3810 msg__->tspecLength = (tspecLength__); \
3811 msg__->tspec = (tspec__); \
3812 msg__->tclasLength = (tclasLength__); \
3813 msg__->tclas = (tclas__);
3814
3815#define CsrWifiSmeTspecReqSendTo(dst__, src__, interfaceTag__, action__, transactionId__, strict__, ctrlMask__, tspecLength__, tspec__, tclasLength__, tclas__) \
3816 { \
3817 CsrWifiSmeTspecReq *msg__; \
3818 CsrWifiSmeTspecReqCreate(msg__, dst__, src__, interfaceTag__, action__, transactionId__, strict__, ctrlMask__, tspecLength__, tspec__, tclasLength__, tclas__); \
3819 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3820 }
3821
3822#define CsrWifiSmeTspecReqSend(src__, interfaceTag__, action__, transactionId__, strict__, ctrlMask__, tspecLength__, tspec__, tclasLength__, tclas__) \
3823 CsrWifiSmeTspecReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, interfaceTag__, action__, transactionId__, strict__, ctrlMask__, tspecLength__, tspec__, tclasLength__, tclas__)
3824
3825/*******************************************************************************
3826
3827 NAME
3828 CsrWifiSmeTspecIndSend
3829
3830 DESCRIPTION
3831 The SME will send this primitive to all the task that have registered to
3832 receive it when a status change in the TSPEC occurs.
3833
3834 PARAMETERS
3835 queue - Destination Task Queue
3836 interfaceTag - Interface Identifier; unique identifier of an interface
3837 transactionId - Unique Transaction ID for the TSPEC, as assigned by the
3838 driver
3839 tspecResultCode - Specifies the TSPEC operation requested by the peer
3840 station
3841 tspecLength - Length of the TSPEC.
3842 tspec - Points to the first byte of the TSPEC
3843
3844*******************************************************************************/
3845#define CsrWifiSmeTspecIndCreate(msg__, dst__, src__, interfaceTag__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \
3846 msg__ = kmalloc(sizeof(CsrWifiSmeTspecInd), GFP_KERNEL); \
3847 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_TSPEC_IND, dst__, src__); \
3848 msg__->interfaceTag = (interfaceTag__); \
3849 msg__->transactionId = (transactionId__); \
3850 msg__->tspecResultCode = (tspecResultCode__); \
3851 msg__->tspecLength = (tspecLength__); \
3852 msg__->tspec = (tspec__);
3853
3854#define CsrWifiSmeTspecIndSendTo(dst__, src__, interfaceTag__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \
3855 { \
3856 CsrWifiSmeTspecInd *msg__; \
3857 CsrWifiSmeTspecIndCreate(msg__, dst__, src__, interfaceTag__, transactionId__, tspecResultCode__, tspecLength__, tspec__); \
3858 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3859 }
3860
3861#define CsrWifiSmeTspecIndSend(dst__, interfaceTag__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \
3862 CsrWifiSmeTspecIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, transactionId__, tspecResultCode__, tspecLength__, tspec__)
3863
3864/*******************************************************************************
3865
3866 NAME
3867 CsrWifiSmeTspecCfmSend
3868
3869 DESCRIPTION
3870 The SME calls the primitive to report the result of the TSpec primitive
3871 request.
3872
3873 PARAMETERS
3874 queue - Destination Task Queue
3875 interfaceTag - Interface Identifier; unique identifier of an interface
3876 status - Reports the result of the request
3877 transactionId - Unique Transaction ID for the TSPEC, as assigned by the
3878 driver
3879 tspecResultCode - Specifies the result of the negotiated TSPEC operation
3880 tspecLength - Length of the TSPEC.
3881 tspec - Points to the first byte of the TSPEC
3882
3883*******************************************************************************/
3884#define CsrWifiSmeTspecCfmCreate(msg__, dst__, src__, interfaceTag__, status__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \
3885 msg__ = kmalloc(sizeof(CsrWifiSmeTspecCfm), GFP_KERNEL); \
3886 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_TSPEC_CFM, dst__, src__); \
3887 msg__->interfaceTag = (interfaceTag__); \
3888 msg__->status = (status__); \
3889 msg__->transactionId = (transactionId__); \
3890 msg__->tspecResultCode = (tspecResultCode__); \
3891 msg__->tspecLength = (tspecLength__); \
3892 msg__->tspec = (tspec__);
3893
3894#define CsrWifiSmeTspecCfmSendTo(dst__, src__, interfaceTag__, status__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \
3895 { \
3896 CsrWifiSmeTspecCfm *msg__; \
3897 CsrWifiSmeTspecCfmCreate(msg__, dst__, src__, interfaceTag__, status__, transactionId__, tspecResultCode__, tspecLength__, tspec__); \
3898 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3899 }
3900
3901#define CsrWifiSmeTspecCfmSend(dst__, interfaceTag__, status__, transactionId__, tspecResultCode__, tspecLength__, tspec__) \
3902 CsrWifiSmeTspecCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, interfaceTag__, status__, transactionId__, tspecResultCode__, tspecLength__, tspec__)
3903
3904/*******************************************************************************
3905
3906 NAME
3907 CsrWifiSmeVersionsGetReqSend
3908
3909 DESCRIPTION
3910 This primitive gets the value of the Versions parameter.
3911
3912 PARAMETERS
3913 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
3914
3915*******************************************************************************/
3916#define CsrWifiSmeVersionsGetReqCreate(msg__, dst__, src__) \
3917 msg__ = kmalloc(sizeof(CsrWifiSmeVersionsGetReq), GFP_KERNEL); \
3918 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_VERSIONS_GET_REQ, dst__, src__);
3919
3920#define CsrWifiSmeVersionsGetReqSendTo(dst__, src__) \
3921 { \
3922 CsrWifiSmeVersionsGetReq *msg__; \
3923 CsrWifiSmeVersionsGetReqCreate(msg__, dst__, src__); \
3924 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
3925 }
3926
3927#define CsrWifiSmeVersionsGetReqSend(src__) \
3928 CsrWifiSmeVersionsGetReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
3929
3930/*******************************************************************************
3931
3932 NAME
3933 CsrWifiSmeVersionsGetCfmSend
3934
3935 DESCRIPTION
3936 This primitive reports the result of the request.
3937
3938 PARAMETERS
3939 queue - Destination Task Queue
3940 status - Reports the result of the request
3941 versions - Version IDs of the product
3942
3943*******************************************************************************/
3944#define CsrWifiSmeVersionsGetCfmCreate(msg__, dst__, src__, status__, versions__) \
3945 msg__ = kmalloc(sizeof(CsrWifiSmeVersionsGetCfm), GFP_KERNEL); \
3946 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_VERSIONS_GET_CFM, dst__, src__); \
3947 msg__->status = (status__); \
3948 msg__->versions = (versions__);
3949
3950#define CsrWifiSmeVersionsGetCfmSendTo(dst__, src__, status__, versions__) \
3951 { \
3952 CsrWifiSmeVersionsGetCfm *msg__; \
3953 CsrWifiSmeVersionsGetCfmCreate(msg__, dst__, src__, status__, versions__); \
3954 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
3955 }
3956
3957#define CsrWifiSmeVersionsGetCfmSend(dst__, status__, versions__) \
3958 CsrWifiSmeVersionsGetCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__, versions__)
3959
3960/*******************************************************************************
3961
3962 NAME
3963 CsrWifiSmeWifiFlightmodeReqSend
3964
3965 DESCRIPTION
3966 The wireless manager application may call this primitive on boot-up of
3967 the platform to ensure that the chip is placed in a mode that prevents
3968 any emission of RF energy.
3969 This primitive is an alternative to CSR_WIFI_SME_WIFI_ON_REQ.
3970 As in CSR_WIFI_SME_WIFI_ON_REQ, it causes the download of the patch file
3971 (if any) and the programming of the initial MIB settings (if supplied by
3972 the WMA), but it also ensures that the chip is left in its lowest
3973 possible power-mode with the radio subsystems disabled.
3974 This feature is useful on platforms where power cannot be removed from
3975 the chip (leaving the chip not initialised will cause it to consume more
3976 power so calling this function ensures that the chip is initialised into
3977 a low power mode but without entering a state where it could emit any RF
3978 energy).
3979 NOTE: this primitive does not cause the Wi-Fi to change state: Wi-Fi
3980 stays conceptually off. Configuration primitives can be sent after
3981 CSR_WIFI_SME_WIFI_FLIGHTMODE_REQ and the configuration will be maintained.
3982 Requests that require the state of the Wi-Fi to be ON will return
3983 CSR_WIFI_SME_STATUS_WIFI_OFF in their confirms.
3984
3985 PARAMETERS
3986 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
3987 address - Optionally specifies a station MAC address.
3988 In normal use, the manager should set the address to 0xFF
3989 0xFF 0xFF 0xFF 0xFF 0xFF, which will cause the chip to use
3990 the MAC address in the MIB.
3991 mibFilesCount - Number of provided data blocks with initial MIB values
3992 mibFiles - Points to the first data block with initial MIB values.
3993 These data blocks are typically the contents of the provided
3994 files ufmib.dat and localmib.dat, available from the host
3995 file system, if they exist.
3996 These files typically contain radio tuning and calibration
3997 values.
3998 More values can be created using the Host Tools.
3999
4000*******************************************************************************/
4001#define CsrWifiSmeWifiFlightmodeReqCreate(msg__, dst__, src__, address__, mibFilesCount__, mibFiles__) \
4002 msg__ = kmalloc(sizeof(CsrWifiSmeWifiFlightmodeReq), GFP_KERNEL); \
4003 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_FLIGHTMODE_REQ, dst__, src__); \
4004 msg__->address = (address__); \
4005 msg__->mibFilesCount = (mibFilesCount__); \
4006 msg__->mibFiles = (mibFiles__);
4007
4008#define CsrWifiSmeWifiFlightmodeReqSendTo(dst__, src__, address__, mibFilesCount__, mibFiles__) \
4009 { \
4010 CsrWifiSmeWifiFlightmodeReq *msg__; \
4011 CsrWifiSmeWifiFlightmodeReqCreate(msg__, dst__, src__, address__, mibFilesCount__, mibFiles__); \
4012 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
4013 }
4014
4015#define CsrWifiSmeWifiFlightmodeReqSend(src__, address__, mibFilesCount__, mibFiles__) \
4016 CsrWifiSmeWifiFlightmodeReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, address__, mibFilesCount__, mibFiles__)
4017
4018/*******************************************************************************
4019
4020 NAME
4021 CsrWifiSmeWifiFlightmodeCfmSend
4022
4023 DESCRIPTION
4024 The SME calls this primitive when the chip is initialised for low power
4025 mode and with the radio subsystem disabled. To leave flight mode, and
4026 enable Wi-Fi, the wireless manager application should call
4027 CSR_WIFI_SME_WIFI_ON_REQ.
4028
4029 PARAMETERS
4030 queue - Destination Task Queue
4031 status - Reports the result of the request
4032
4033*******************************************************************************/
4034#define CsrWifiSmeWifiFlightmodeCfmCreate(msg__, dst__, src__, status__) \
4035 msg__ = kmalloc(sizeof(CsrWifiSmeWifiFlightmodeCfm), GFP_KERNEL); \
4036 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_FLIGHTMODE_CFM, dst__, src__); \
4037 msg__->status = (status__);
4038
4039#define CsrWifiSmeWifiFlightmodeCfmSendTo(dst__, src__, status__) \
4040 { \
4041 CsrWifiSmeWifiFlightmodeCfm *msg__; \
4042 CsrWifiSmeWifiFlightmodeCfmCreate(msg__, dst__, src__, status__); \
4043 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
4044 }
4045
4046#define CsrWifiSmeWifiFlightmodeCfmSend(dst__, status__) \
4047 CsrWifiSmeWifiFlightmodeCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
4048
4049/*******************************************************************************
4050
4051 NAME
4052 CsrWifiSmeWifiOffReqSend
4053
4054 DESCRIPTION
4055 The wireless manager application calls this primitive to turn off the
4056 chip, thus saving power when Wi-Fi is not in use.
4057
4058 PARAMETERS
4059 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
4060
4061*******************************************************************************/
4062#define CsrWifiSmeWifiOffReqCreate(msg__, dst__, src__) \
4063 msg__ = kmalloc(sizeof(CsrWifiSmeWifiOffReq), GFP_KERNEL); \
4064 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_OFF_REQ, dst__, src__);
4065
4066#define CsrWifiSmeWifiOffReqSendTo(dst__, src__) \
4067 { \
4068 CsrWifiSmeWifiOffReq *msg__; \
4069 CsrWifiSmeWifiOffReqCreate(msg__, dst__, src__); \
4070 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
4071 }
4072
4073#define CsrWifiSmeWifiOffReqSend(src__) \
4074 CsrWifiSmeWifiOffReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__)
4075
4076/*******************************************************************************
4077
4078 NAME
4079 CsrWifiSmeWifiOffIndSend
4080
4081 DESCRIPTION
4082 The SME sends this primitive to all the tasks that have registered to
4083 receive it to report that the chip has been turned off.
4084
4085 PARAMETERS
4086 queue - Destination Task Queue
4087 reason - Indicates the reason why the Wi-Fi has been switched off.
4088
4089*******************************************************************************/
4090#define CsrWifiSmeWifiOffIndCreate(msg__, dst__, src__, reason__) \
4091 msg__ = kmalloc(sizeof(CsrWifiSmeWifiOffInd), GFP_KERNEL); \
4092 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_OFF_IND, dst__, src__); \
4093 msg__->reason = (reason__);
4094
4095#define CsrWifiSmeWifiOffIndSendTo(dst__, src__, reason__) \
4096 { \
4097 CsrWifiSmeWifiOffInd *msg__; \
4098 CsrWifiSmeWifiOffIndCreate(msg__, dst__, src__, reason__); \
4099 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
4100 }
4101
4102#define CsrWifiSmeWifiOffIndSend(dst__, reason__) \
4103 CsrWifiSmeWifiOffIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, reason__)
4104
4105/*******************************************************************************
4106
4107 NAME
4108 CsrWifiSmeWifiOffCfmSend
4109
4110 DESCRIPTION
4111 After receiving CSR_WIFI_SME_WIFI_OFF_REQ, if the chip is connected to a
4112 network, the SME will perform a disconnect operation, will send a
4113 CSR_WIFI_SME_MEDIA_STATUS_IND with
4114 CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED, and then will call
4115 CSR_WIFI_SME_WIFI_OFF_CFM when the chip is off.
4116
4117 PARAMETERS
4118 queue - Destination Task Queue
4119 status - Reports the result of the request
4120
4121*******************************************************************************/
4122#define CsrWifiSmeWifiOffCfmCreate(msg__, dst__, src__, status__) \
4123 msg__ = kmalloc(sizeof(CsrWifiSmeWifiOffCfm), GFP_KERNEL); \
4124 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_OFF_CFM, dst__, src__); \
4125 msg__->status = (status__);
4126
4127#define CsrWifiSmeWifiOffCfmSendTo(dst__, src__, status__) \
4128 { \
4129 CsrWifiSmeWifiOffCfm *msg__; \
4130 CsrWifiSmeWifiOffCfmCreate(msg__, dst__, src__, status__); \
4131 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
4132 }
4133
4134#define CsrWifiSmeWifiOffCfmSend(dst__, status__) \
4135 CsrWifiSmeWifiOffCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
4136
4137/*******************************************************************************
4138
4139 NAME
4140 CsrWifiSmeWifiOnReqSend
4141
4142 DESCRIPTION
4143 The wireless manager application calls this primitive to turn on the
4144 Wi-Fi chip.
4145 If the Wi-Fi chip is currently off, the SME turns the Wi-Fi chip on,
4146 downloads the patch file (if any), and programs the initial MIB settings
4147 (if supplied by the WMA).
4148 The patch file is not provided with the SME API; its downloading is
4149 automatic and handled internally by the system.
4150 The MIB settings, when provided, override the default values that the
4151 firmware loads from EEPROM.
4152 If the Wi-Fi chip is already on, the SME takes no action and returns a
4153 successful status in the confirm.
4154
4155 PARAMETERS
4156 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
4157 address - Optionally specifies a station MAC address.
4158 In normal use, the manager should set the address to 0xFF
4159 0xFF 0xFF 0xFF 0xFF 0xFF, which will cause the chip to use
4160 the MAC address in the MIB
4161 mibFilesCount - Number of provided data blocks with initial MIB values
4162 mibFiles - Points to the first data block with initial MIB values.
4163 These data blocks are typically the contents of the provided
4164 files ufmib.dat and localmib.dat, available from the host
4165 file system, if they exist.
4166 These files typically contain radio tuning and calibration
4167 values.
4168 More values can be created using the Host Tools.
4169
4170*******************************************************************************/
4171#define CsrWifiSmeWifiOnReqCreate(msg__, dst__, src__, address__, mibFilesCount__, mibFiles__) \
4172 msg__ = kmalloc(sizeof(CsrWifiSmeWifiOnReq), GFP_KERNEL); \
4173 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_ON_REQ, dst__, src__); \
4174 msg__->address = (address__); \
4175 msg__->mibFilesCount = (mibFilesCount__); \
4176 msg__->mibFiles = (mibFiles__);
4177
4178#define CsrWifiSmeWifiOnReqSendTo(dst__, src__, address__, mibFilesCount__, mibFiles__) \
4179 { \
4180 CsrWifiSmeWifiOnReq *msg__; \
4181 CsrWifiSmeWifiOnReqCreate(msg__, dst__, src__, address__, mibFilesCount__, mibFiles__); \
4182 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
4183 }
4184
4185#define CsrWifiSmeWifiOnReqSend(src__, address__, mibFilesCount__, mibFiles__) \
4186 CsrWifiSmeWifiOnReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, address__, mibFilesCount__, mibFiles__)
4187
4188/*******************************************************************************
4189
4190 NAME
4191 CsrWifiSmeWifiOnIndSend
4192
4193 DESCRIPTION
4194 The SME sends this primitive to all tasks that have registered to receive
4195 it once the chip becomes available and ready to use.
4196
4197 PARAMETERS
4198 queue - Destination Task Queue
4199 address - Current MAC address
4200
4201*******************************************************************************/
4202#define CsrWifiSmeWifiOnIndCreate(msg__, dst__, src__, address__) \
4203 msg__ = kmalloc(sizeof(CsrWifiSmeWifiOnInd), GFP_KERNEL); \
4204 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_ON_IND, dst__, src__); \
4205 msg__->address = (address__);
4206
4207#define CsrWifiSmeWifiOnIndSendTo(dst__, src__, address__) \
4208 { \
4209 CsrWifiSmeWifiOnInd *msg__; \
4210 CsrWifiSmeWifiOnIndCreate(msg__, dst__, src__, address__); \
4211 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
4212 }
4213
4214#define CsrWifiSmeWifiOnIndSend(dst__, address__) \
4215 CsrWifiSmeWifiOnIndSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, address__)
4216
4217/*******************************************************************************
4218
4219 NAME
4220 CsrWifiSmeWifiOnCfmSend
4221
4222 DESCRIPTION
4223 The SME sends this primitive to the task that has sent the request once
4224 the chip has been initialised and is available for use.
4225
4226 PARAMETERS
4227 queue - Destination Task Queue
4228 status - Reports the result of the request
4229
4230*******************************************************************************/
4231#define CsrWifiSmeWifiOnCfmCreate(msg__, dst__, src__, status__) \
4232 msg__ = kmalloc(sizeof(CsrWifiSmeWifiOnCfm), GFP_KERNEL); \
4233 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WIFI_ON_CFM, dst__, src__); \
4234 msg__->status = (status__);
4235
4236#define CsrWifiSmeWifiOnCfmSendTo(dst__, src__, status__) \
4237 { \
4238 CsrWifiSmeWifiOnCfm *msg__; \
4239 CsrWifiSmeWifiOnCfmCreate(msg__, dst__, src__, status__); \
4240 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
4241 }
4242
4243#define CsrWifiSmeWifiOnCfmSend(dst__, status__) \
4244 CsrWifiSmeWifiOnCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
4245
4246/*******************************************************************************
4247
4248 NAME
4249 CsrWifiSmeWpsConfigurationReqSend
4250
4251 DESCRIPTION
4252 This primitive passes the WPS information for the device to SME. This may
4253 be accepted only if no interface is active.
4254
4255 PARAMETERS
4256 queue - Message Source Task Queue (Cfm's will be sent to this Queue)
4257 wpsConfig - WPS config.
4258
4259*******************************************************************************/
4260#define CsrWifiSmeWpsConfigurationReqCreate(msg__, dst__, src__, wpsConfig__) \
4261 msg__ = kmalloc(sizeof(CsrWifiSmeWpsConfigurationReq), GFP_KERNEL); \
4262 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WPS_CONFIGURATION_REQ, dst__, src__); \
4263 msg__->wpsConfig = (wpsConfig__);
4264
4265#define CsrWifiSmeWpsConfigurationReqSendTo(dst__, src__, wpsConfig__) \
4266 { \
4267 CsrWifiSmeWpsConfigurationReq *msg__; \
4268 CsrWifiSmeWpsConfigurationReqCreate(msg__, dst__, src__, wpsConfig__); \
4269 CsrMsgTransport(dst__, CSR_WIFI_SME_PRIM, msg__); \
4270 }
4271
4272#define CsrWifiSmeWpsConfigurationReqSend(src__, wpsConfig__) \
4273 CsrWifiSmeWpsConfigurationReqSendTo(CSR_WIFI_SME_LIB_DESTINATION_QUEUE, src__, wpsConfig__)
4274
4275/*******************************************************************************
4276
4277 NAME
4278 CsrWifiSmeWpsConfigurationCfmSend
4279
4280 DESCRIPTION
4281 Confirm.
4282
4283 PARAMETERS
4284 queue - Destination Task Queue
4285 status - Status of the request.
4286
4287*******************************************************************************/
4288#define CsrWifiSmeWpsConfigurationCfmCreate(msg__, dst__, src__, status__) \
4289 msg__ = kmalloc(sizeof(CsrWifiSmeWpsConfigurationCfm), GFP_KERNEL); \
4290 CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_SME_PRIM, CSR_WIFI_SME_WPS_CONFIGURATION_CFM, dst__, src__); \
4291 msg__->status = (status__);
4292
4293#define CsrWifiSmeWpsConfigurationCfmSendTo(dst__, src__, status__) \
4294 { \
4295 CsrWifiSmeWpsConfigurationCfm *msg__; \
4296 CsrWifiSmeWpsConfigurationCfmCreate(msg__, dst__, src__, status__); \
4297 CsrSchedMessagePut(dst__, CSR_WIFI_SME_PRIM, msg__); \
4298 }
4299
4300#define CsrWifiSmeWpsConfigurationCfmSend(dst__, status__) \
4301 CsrWifiSmeWpsConfigurationCfmSendTo(dst__, CSR_WIFI_SME_IFACEQUEUE, status__)
4302
4303#endif /* CSR_WIFI_SME_LIB_H__ */
diff --git a/drivers/staging/csr/csr_wifi_sme_prim.h b/drivers/staging/csr/csr_wifi_sme_prim.h
deleted file mode 100644
index 17ec79c77e54..000000000000
--- a/drivers/staging/csr/csr_wifi_sme_prim.h
+++ /dev/null
@@ -1,6510 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_SME_PRIM_H__
14#define CSR_WIFI_SME_PRIM_H__
15
16#include <linux/types.h>
17#include "csr_prim_defs.h"
18#include "csr_sched.h"
19#include "csr_wifi_common.h"
20#include "csr_result.h"
21#include "csr_wifi_fsm_event.h"
22
23#define CSR_WIFI_SME_PRIM (0x0404)
24
25typedef CsrPrim CsrWifiSmePrim;
26
27
28/*******************************************************************************
29
30 NAME
31 CsrWifiSme80211NetworkType
32
33 DESCRIPTION
34 Indicates the physical layer of the network
35
36 VALUES
37 CSR_WIFI_SME_80211_NETWORK_TYPE_DS
38 - Direct-sequence spread spectrum
39 CSR_WIFI_SME_80211_NETWORK_TYPE_OFDM24
40 - Orthogonal Frequency Division Multiplexing at 2.4 GHz
41 CSR_WIFI_SME_80211_NETWORK_TYPE_OFDM5
42 - Orthogonal Frequency Division Multiplexing at 5 GHz
43 CSR_WIFI_SME_80211_NETWORK_TYPE_AUTO
44 - Automatic
45
46*******************************************************************************/
47typedef u8 CsrWifiSme80211NetworkType;
48#define CSR_WIFI_SME_80211_NETWORK_TYPE_DS ((CsrWifiSme80211NetworkType) 0x00)
49#define CSR_WIFI_SME_80211_NETWORK_TYPE_OFDM24 ((CsrWifiSme80211NetworkType) 0x01)
50#define CSR_WIFI_SME_80211_NETWORK_TYPE_OFDM5 ((CsrWifiSme80211NetworkType) 0x02)
51#define CSR_WIFI_SME_80211_NETWORK_TYPE_AUTO ((CsrWifiSme80211NetworkType) 0x03)
52
53/*******************************************************************************
54
55 NAME
56 CsrWifiSme80211PrivacyMode
57
58 DESCRIPTION
59 Bits to enable or disable the privacy mode
60
61 VALUES
62 CSR_WIFI_SME_80211_PRIVACY_MODE_DISABLED
63 - Privacy mode is enabled: use of WEP for confidentiality is
64 required.
65 CSR_WIFI_SME_80211_PRIVACY_MODE_ENABLED
66 - Privacy mode is disabled
67
68*******************************************************************************/
69typedef u8 CsrWifiSme80211PrivacyMode;
70#define CSR_WIFI_SME_80211_PRIVACY_MODE_DISABLED ((CsrWifiSme80211PrivacyMode) 0x00)
71#define CSR_WIFI_SME_80211_PRIVACY_MODE_ENABLED ((CsrWifiSme80211PrivacyMode) 0x01)
72
73/*******************************************************************************
74
75 NAME
76 CsrWifiSme80211dTrustLevel
77
78 DESCRIPTION
79 Level of trust for the information coming from the network
80
81 VALUES
82 CSR_WIFI_SME_80211D_TRUST_LEVEL_STRICT
83 - Start with passive scanning and only accept country IE for
84 updating channel lists
85 CSR_WIFI_SME_80211D_TRUST_LEVEL_ADJUNCT
86 - As above plus accept adjunct technology location
87 information
88 CSR_WIFI_SME_80211D_TRUST_LEVEL_BSS
89 - As above accept plus receiving channel from infrastructure
90 networks
91 CSR_WIFI_SME_80211D_TRUST_LEVEL_IBSS
92 - As above accept plus receiving channel from the ad hoc
93 networks
94 CSR_WIFI_SME_80211D_TRUST_LEVEL_MIB
95 - Start with active scanning with list of active channels
96 from the MIB and accept as above
97 CSR_WIFI_SME_80211D_TRUST_LEVEL_DISABLED
98 - Start with active scanning with list of active channels
99 from the MIB and ignore any channel information from the
100 network
101
102*******************************************************************************/
103typedef u8 CsrWifiSme80211dTrustLevel;
104#define CSR_WIFI_SME_80211D_TRUST_LEVEL_STRICT ((CsrWifiSme80211dTrustLevel) 0x01)
105#define CSR_WIFI_SME_80211D_TRUST_LEVEL_ADJUNCT ((CsrWifiSme80211dTrustLevel) 0x02)
106#define CSR_WIFI_SME_80211D_TRUST_LEVEL_BSS ((CsrWifiSme80211dTrustLevel) 0x03)
107#define CSR_WIFI_SME_80211D_TRUST_LEVEL_IBSS ((CsrWifiSme80211dTrustLevel) 0x04)
108#define CSR_WIFI_SME_80211D_TRUST_LEVEL_MIB ((CsrWifiSme80211dTrustLevel) 0x05)
109#define CSR_WIFI_SME_80211D_TRUST_LEVEL_DISABLED ((CsrWifiSme80211dTrustLevel) 0x06)
110
111/*******************************************************************************
112
113 NAME
114 CsrWifiSmeAmpStatus
115
116 DESCRIPTION
117 AMP Current Status
118
119 VALUES
120 CSR_WIFI_SME_AMP_ACTIVE - AMP ACTIVE.
121 CSR_WIFI_SME_AMP_INACTIVE - AMP INACTIVE
122
123*******************************************************************************/
124typedef u8 CsrWifiSmeAmpStatus;
125#define CSR_WIFI_SME_AMP_ACTIVE ((CsrWifiSmeAmpStatus) 0x00)
126#define CSR_WIFI_SME_AMP_INACTIVE ((CsrWifiSmeAmpStatus) 0x01)
127
128/*******************************************************************************
129
130 NAME
131 CsrWifiSmeAuthMode
132
133 DESCRIPTION
134 Define bits for CsrWifiSmeAuthMode
135
136 VALUES
137 CSR_WIFI_SME_AUTH_MODE_80211_OPEN
138 - Connects to an open system network (i.e. no authentication,
139 no encryption) or to a WEP enabled network.
140 CSR_WIFI_SME_AUTH_MODE_80211_SHARED
141 - Connect to a WEP enabled network.
142 CSR_WIFI_SME_AUTH_MODE_8021X_WPA
143 - Connects to a WPA Enterprise enabled network.
144 CSR_WIFI_SME_AUTH_MODE_8021X_WPAPSK
145 - Connects to a WPA with Pre-Shared Key enabled network.
146 CSR_WIFI_SME_AUTH_MODE_8021X_WPA2
147 - Connects to a WPA2 Enterprise enabled network.
148 CSR_WIFI_SME_AUTH_MODE_8021X_WPA2PSK
149 - Connects to a WPA2 with Pre-Shared Key enabled network.
150 CSR_WIFI_SME_AUTH_MODE_8021X_CCKM
151 - Connects to a CCKM enabled network.
152 CSR_WIFI_SME_AUTH_MODE_WAPI_WAI
153 - Connects to a WAPI Enterprise enabled network.
154 CSR_WIFI_SME_AUTH_MODE_WAPI_WAIPSK
155 - Connects to a WAPI with Pre-Shared Key enabled network.
156 CSR_WIFI_SME_AUTH_MODE_8021X_OTHER1X
157 - For future use.
158
159*******************************************************************************/
160typedef u16 CsrWifiSmeAuthMode;
161#define CSR_WIFI_SME_AUTH_MODE_80211_OPEN ((CsrWifiSmeAuthMode) 0x0001)
162#define CSR_WIFI_SME_AUTH_MODE_80211_SHARED ((CsrWifiSmeAuthMode) 0x0002)
163#define CSR_WIFI_SME_AUTH_MODE_8021X_WPA ((CsrWifiSmeAuthMode) 0x0004)
164#define CSR_WIFI_SME_AUTH_MODE_8021X_WPAPSK ((CsrWifiSmeAuthMode) 0x0008)
165#define CSR_WIFI_SME_AUTH_MODE_8021X_WPA2 ((CsrWifiSmeAuthMode) 0x0010)
166#define CSR_WIFI_SME_AUTH_MODE_8021X_WPA2PSK ((CsrWifiSmeAuthMode) 0x0020)
167#define CSR_WIFI_SME_AUTH_MODE_8021X_CCKM ((CsrWifiSmeAuthMode) 0x0040)
168#define CSR_WIFI_SME_AUTH_MODE_WAPI_WAI ((CsrWifiSmeAuthMode) 0x0080)
169#define CSR_WIFI_SME_AUTH_MODE_WAPI_WAIPSK ((CsrWifiSmeAuthMode) 0x0100)
170#define CSR_WIFI_SME_AUTH_MODE_8021X_OTHER1X ((CsrWifiSmeAuthMode) 0x0200)
171
172/*******************************************************************************
173
174 NAME
175 CsrWifiSmeBasicUsability
176
177 DESCRIPTION
178 Indicates the usability level of a channel
179
180 VALUES
181 CSR_WIFI_SME_BASIC_USABILITY_UNUSABLE
182 - Not usable; connection not recommended
183 CSR_WIFI_SME_BASIC_USABILITY_POOR
184 - Poor quality; connect only if nothing better is available
185 CSR_WIFI_SME_BASIC_USABILITY_SATISFACTORY
186 - Quality is satisfactory
187 CSR_WIFI_SME_BASIC_USABILITY_NOT_CONNECTED
188 - Not connected
189
190*******************************************************************************/
191typedef u8 CsrWifiSmeBasicUsability;
192#define CSR_WIFI_SME_BASIC_USABILITY_UNUSABLE ((CsrWifiSmeBasicUsability) 0x00)
193#define CSR_WIFI_SME_BASIC_USABILITY_POOR ((CsrWifiSmeBasicUsability) 0x01)
194#define CSR_WIFI_SME_BASIC_USABILITY_SATISFACTORY ((CsrWifiSmeBasicUsability) 0x02)
195#define CSR_WIFI_SME_BASIC_USABILITY_NOT_CONNECTED ((CsrWifiSmeBasicUsability) 0x03)
196
197/*******************************************************************************
198
199 NAME
200 CsrWifiSmeBssType
201
202 DESCRIPTION
203 Indicates the BSS type
204
205 VALUES
206 CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE
207 - Infrastructure BSS.
208 CSR_WIFI_SME_BSS_TYPE_ADHOC
209 - Ad hoc or Independent BSS.
210 CSR_WIFI_SME_BSS_TYPE_ANY_BSS
211 - Specifies any type of BSS
212 CSR_WIFI_SME_BSS_TYPE_P2P
213 - Specifies P2P
214
215*******************************************************************************/
216typedef u8 CsrWifiSmeBssType;
217#define CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE ((CsrWifiSmeBssType) 0x00)
218#define CSR_WIFI_SME_BSS_TYPE_ADHOC ((CsrWifiSmeBssType) 0x01)
219#define CSR_WIFI_SME_BSS_TYPE_ANY_BSS ((CsrWifiSmeBssType) 0x02)
220#define CSR_WIFI_SME_BSS_TYPE_P2P ((CsrWifiSmeBssType) 0x03)
221
222/*******************************************************************************
223
224 NAME
225 CsrWifiSmeCoexScheme
226
227 DESCRIPTION
228 Options for the coexistence signalling
229 Same as MibValues
230
231 VALUES
232 CSR_WIFI_SME_COEX_SCHEME_DISABLED
233 - The coexistence signalling is disabled
234 CSR_WIFI_SME_COEX_SCHEME_CSR
235 - Basic CSR coexistence signalling
236 CSR_WIFI_SME_COEX_SCHEME_CSR_CHANNEL
237 - Full CSR coexistence signalling
238 CSR_WIFI_SME_COEX_SCHEME_PTA
239 - Packet Traffic Arbitrator coexistence signalling
240
241*******************************************************************************/
242typedef u8 CsrWifiSmeCoexScheme;
243#define CSR_WIFI_SME_COEX_SCHEME_DISABLED ((CsrWifiSmeCoexScheme) 0x00)
244#define CSR_WIFI_SME_COEX_SCHEME_CSR ((CsrWifiSmeCoexScheme) 0x01)
245#define CSR_WIFI_SME_COEX_SCHEME_CSR_CHANNEL ((CsrWifiSmeCoexScheme) 0x02)
246#define CSR_WIFI_SME_COEX_SCHEME_PTA ((CsrWifiSmeCoexScheme) 0x03)
247
248/*******************************************************************************
249
250 NAME
251 CsrWifiSmeControlIndication
252
253 DESCRIPTION
254 Indicates the reason why the Wi-Fi has been switched off.
255 The values of this type are used across the NME/SME/Router API's and they
256 must be kept consistent with the corresponding types in the .xml of the
257 ottherinterfaces
258
259 VALUES
260 CSR_WIFI_SME_CONTROL_INDICATION_ERROR
261 - An unrecoverable error (for example, an unrecoverable SDIO
262 error) has occurred.
263 The wireless manager application should reinitialise the
264 chip by calling CSR_WIFI_SME_WIFI_ON_REQ.
265 CSR_WIFI_SME_CONTROL_INDICATION_EXIT
266 - The chip became unavailable due to an external action, for
267 example, when a plug-in card is ejected or the driver is
268 unloaded.
269 CSR_WIFI_SME_CONTROL_INDICATION_USER_REQUESTED
270 - The Wi-Fi has been switched off as the wireless manager
271 application has sent CSR_WIFI_SME_WIFI_OFF_REQ
272
273*******************************************************************************/
274typedef u8 CsrWifiSmeControlIndication;
275#define CSR_WIFI_SME_CONTROL_INDICATION_ERROR ((CsrWifiSmeControlIndication) 0x01)
276#define CSR_WIFI_SME_CONTROL_INDICATION_EXIT ((CsrWifiSmeControlIndication) 0x02)
277#define CSR_WIFI_SME_CONTROL_INDICATION_USER_REQUESTED ((CsrWifiSmeControlIndication) 0x03)
278
279/*******************************************************************************
280
281 NAME
282 CsrWifiSmeCtsProtectionType
283
284 DESCRIPTION
285 SME CTS Protection Types
286
287 VALUES
288 CSR_WIFI_SME_CTS_PROTECTION_AUTOMATIC
289 - AP CTS Protection automatic based on non-ERP station in own
290 BSS or neighbouring BSS on the same channel based on OLBC.
291 This requires monitoring of beacons from other APs.
292 CSR_WIFI_SME_CTS_PROTECTION_FORCE_ENABLED
293 - AP CTS Protection Force enabled
294 CSR_WIFI_SME_CTS_PROTECTION_FORCE_DISABLED
295 - AP CTS Protection Force disabled.
296 CSR_WIFI_SME_CTS_PROTECTION_AUTOMATIC_NO_OLBC
297 - AP CTS Protection automatic without considering OLBC but
298 considering non-ERP station in the own BSS Valid only if AP
299 is configured to work in 802.11bg or 802.11g mode otherwise
300 this option specifies the same behaviour as AUTOMATIC
301
302*******************************************************************************/
303typedef u8 CsrWifiSmeCtsProtectionType;
304#define CSR_WIFI_SME_CTS_PROTECTION_AUTOMATIC ((CsrWifiSmeCtsProtectionType) 0x00)
305#define CSR_WIFI_SME_CTS_PROTECTION_FORCE_ENABLED ((CsrWifiSmeCtsProtectionType) 0x01)
306#define CSR_WIFI_SME_CTS_PROTECTION_FORCE_DISABLED ((CsrWifiSmeCtsProtectionType) 0x02)
307#define CSR_WIFI_SME_CTS_PROTECTION_AUTOMATIC_NO_OLBC ((CsrWifiSmeCtsProtectionType) 0x03)
308
309/*******************************************************************************
310
311 NAME
312 CsrWifiSmeD3AutoScanMode
313
314 DESCRIPTION
315 Autonomous scan status while in D3 suspended period
316
317 VALUES
318 CSR_WIFI_SME_D3AUTO_SCAN_MODE_PSON
319 - Autonomous scan stays on
320 CSR_WIFI_SME_D3AUTO_SCAN_MODE_PSOFF
321 - Autonomous scan is switched off
322 CSR_WIFI_SME_D3AUTO_SCAN_MODE_PSAUTO
323 - Automatically select autoscanning behaviour.
324 CURRENTLY NOT SUPPORTED
325
326*******************************************************************************/
327typedef u8 CsrWifiSmeD3AutoScanMode;
328#define CSR_WIFI_SME_D3AUTO_SCAN_MODE_PSON ((CsrWifiSmeD3AutoScanMode) 0x00)
329#define CSR_WIFI_SME_D3AUTO_SCAN_MODE_PSOFF ((CsrWifiSmeD3AutoScanMode) 0x01)
330#define CSR_WIFI_SME_D3AUTO_SCAN_MODE_PSAUTO ((CsrWifiSmeD3AutoScanMode) 0x02)
331
332/*******************************************************************************
333
334 NAME
335 CsrWifiSmeEncryption
336
337 DESCRIPTION
338 Defines bits for CsrWifiSmeEncryption
339 For a WEP enabled network, the caller must specify the correct
340 combination of flags in the encryptionModeMask.
341
342 VALUES
343 CSR_WIFI_SME_ENCRYPTION_CIPHER_NONE
344 - No encryption set
345 CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP40
346 - Selects 40 byte key WEP for unicast communication
347 CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP104
348 - Selects 104 byte key WEP for unicast communication
349 CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_TKIP
350 - Selects TKIP for unicast communication
351 CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_CCMP
352 - Selects CCMP for unicast communication
353 CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_SMS4
354 - Selects SMS4 for unicast communication
355 CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP40
356 - Selects 40 byte key WEP for broadcast messages
357 CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP104
358 - Selects 104 byte key WEP for broadcast messages
359 CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_TKIP
360 - Selects a TKIP for broadcast messages
361 CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_CCMP
362 - Selects CCMP for broadcast messages
363 CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_SMS4
364 - Selects SMS4 for broadcast messages
365
366*******************************************************************************/
367typedef u16 CsrWifiSmeEncryption;
368#define CSR_WIFI_SME_ENCRYPTION_CIPHER_NONE ((CsrWifiSmeEncryption) 0x0000)
369#define CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP40 ((CsrWifiSmeEncryption) 0x0001)
370#define CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP104 ((CsrWifiSmeEncryption) 0x0002)
371#define CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_TKIP ((CsrWifiSmeEncryption) 0x0004)
372#define CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_CCMP ((CsrWifiSmeEncryption) 0x0008)
373#define CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_SMS4 ((CsrWifiSmeEncryption) 0x0010)
374#define CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP40 ((CsrWifiSmeEncryption) 0x0020)
375#define CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP104 ((CsrWifiSmeEncryption) 0x0040)
376#define CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_TKIP ((CsrWifiSmeEncryption) 0x0080)
377#define CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_CCMP ((CsrWifiSmeEncryption) 0x0100)
378#define CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_SMS4 ((CsrWifiSmeEncryption) 0x0200)
379
380/*******************************************************************************
381
382 NAME
383 CsrWifiSmeFirmwareDriverInterface
384
385 DESCRIPTION
386 Type of communication between Host and Firmware
387
388 VALUES
389 CSR_WIFI_SME_FIRMWARE_DRIVER_INTERFACE_UNIT_DATA_INTERFACE
390 - No preformated header. NOT SUPPORTED in the current release
391 CSR_WIFI_SME_FIRMWARE_DRIVER_INTERFACE_PACKET_INTERFACE
392 - Preformated IEEE 802.11 header for user plane
393
394*******************************************************************************/
395typedef u8 CsrWifiSmeFirmwareDriverInterface;
396#define CSR_WIFI_SME_FIRMWARE_DRIVER_INTERFACE_UNIT_DATA_INTERFACE ((CsrWifiSmeFirmwareDriverInterface) 0x00)
397#define CSR_WIFI_SME_FIRMWARE_DRIVER_INTERFACE_PACKET_INTERFACE ((CsrWifiSmeFirmwareDriverInterface) 0x01)
398
399/*******************************************************************************
400
401 NAME
402 CsrWifiSmeHostPowerMode
403
404 DESCRIPTION
405 Defines the power mode
406
407 VALUES
408 CSR_WIFI_SME_HOST_POWER_MODE_ACTIVE
409 - Host device is running on external power.
410 CSR_WIFI_SME_HOST_POWER_MODE_POWER_SAVE
411 - Host device is running on (internal) battery power.
412 CSR_WIFI_SME_HOST_POWER_MODE_FULL_POWER_SAVE
413 - For future use.
414
415*******************************************************************************/
416typedef u8 CsrWifiSmeHostPowerMode;
417#define CSR_WIFI_SME_HOST_POWER_MODE_ACTIVE ((CsrWifiSmeHostPowerMode) 0x00)
418#define CSR_WIFI_SME_HOST_POWER_MODE_POWER_SAVE ((CsrWifiSmeHostPowerMode) 0x01)
419#define CSR_WIFI_SME_HOST_POWER_MODE_FULL_POWER_SAVE ((CsrWifiSmeHostPowerMode) 0x02)
420
421/*******************************************************************************
422
423 NAME
424 CsrWifiSmeIEEE80211Reason
425
426 DESCRIPTION
427 As definined in the IEEE 802.11 standards
428
429 VALUES
430 CSR_WIFI_SME_IEEE80211_REASON_SUCCESS
431 - See IEEE 802.11 Standard
432 CSR_WIFI_SME_IEEE80211_REASON_UNSPECIFIED_REASON
433 - See IEEE 802.11 Standard
434 CSR_WIFI_SME_IEEE80211_REASON_AUTHENTICATION_NOT_VALID
435 - See IEEE 802.11 Standard
436 CSR_WIFI_SME_IEEE80211_REASON_DEAUTHENTICATED_LEAVE_BSS
437 - See IEEE 802.11 Standard
438 CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_INACTIVITY
439 - See IEEE 802.11 Standard
440 CSR_WIFI_SME_IEEE80211_REASON_AP_OVERLOAD
441 - See IEEE 802.11 Standard
442 CSR_WIFI_SME_IEEE80211_REASON_CLASS_2FRAME_ERROR
443 - See IEEE 802.11 Standard
444 CSR_WIFI_SME_IEEE80211_REASON_CLASS_3FRAME_ERROR
445 - See IEEE 802.11 Standard
446 CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_LEAVE_BSS
447 - See IEEE 802.11 Standard
448 CSR_WIFI_SME_IEEE80211_REASON_ASSOCIATION_NOT_AUTHENTICATED
449 - See IEEE 802.11 Standard
450 CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_POWER_CAPABILITY
451 - See IEEE 802.11 Standard
452 CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_SUPPORTED_CHANNELS
453 - See IEEE 802.11 Standard
454 CSR_WIFI_SME_IEEE80211_REASON_INVALID_INFORMATION_ELEMENT
455 - See IEEE 802.11 Standard
456 CSR_WIFI_SME_IEEE80211_REASON_MICHAEL_MIC_FAILURE
457 - See IEEE 802.11 Standard
458 CSR_WIFI_SME_IEEE80211_REASON_FOURWAY_HANDSHAKE_TIMEOUT
459 - See IEEE 802.11 Standard
460 CSR_WIFI_SME_IEEE80211_REASON_GROUP_KEY_UPDATE_TIMEOUT
461 - See IEEE 802.11 Standard
462 CSR_WIFI_SME_IEEE80211_REASON_HANDSHAKE_ELEMENT_DIFFERENT
463 - See IEEE 802.11 Standard
464 CSR_WIFI_SME_IEEE80211_REASON_INVALID_GROUP_CIPHER
465 - See IEEE 802.11 Standard
466 CSR_WIFI_SME_IEEE80211_REASON_INVALID_PAIRWISE_CIPHER
467 - See IEEE 802.11 Standard
468 CSR_WIFI_SME_IEEE80211_REASON_INVALID_AKMP
469 - See IEEE 802.11 Standard
470 CSR_WIFI_SME_IEEE80211_REASON_UNSUPPORTED_RSN_IEVERSION
471 - See IEEE 802.11 Standard
472 CSR_WIFI_SME_IEEE80211_REASON_INVALID_RSN_IECAPABILITIES
473 - See IEEE 802.11 Standard
474 CSR_WIFI_SME_IEEE80211_REASON_DOT1X_AUTH_FAILED
475 - See IEEE 802.11 Standard
476 CSR_WIFI_SME_IEEE80211_REASON_CIPHER_REJECTED_BY_POLICY
477 - See IEEE 802.11 Standard
478 CSR_WIFI_SME_IEEE80211_REASON_SERVICE_CHANGE_PRECLUDES_TS
479 - See IEEE 802.11 Standard
480 CSR_WIFI_SME_IEEE80211_REASON_QOS_UNSPECIFIED_REASON
481 - See IEEE 802.11 Standard
482 CSR_WIFI_SME_IEEE80211_REASON_QOS_INSUFFICIENT_BANDWIDTH
483 - See IEEE 802.11 Standard
484 CSR_WIFI_SME_IEEE80211_REASON_QOS_EXCESSIVE_NOT_ACK
485 - See IEEE 802.11 Standard
486 CSR_WIFI_SME_IEEE80211_REASON_QOS_TXOPLIMIT_EXCEEDED
487 - See IEEE 802.11 Standard
488 CSR_WIFI_SME_IEEE80211_REASON_QSTA_LEAVING
489 - See IEEE 802.11 Standard
490 CSR_WIFI_SME_IEEE80211_REASON_END_TS
491 - See IEEE 802.11 Standard
492 CSR_WIFI_SME_IEEE80211_REASON_END_DLS
493 - See IEEE 802.11 Standard
494 CSR_WIFI_SME_IEEE80211_REASON_END_BA
495 - See IEEE 802.11 Standard
496 CSR_WIFI_SME_IEEE80211_REASON_UNKNOWN_TS
497 - See IEEE 802.11 Standard
498 CSR_WIFI_SME_IEEE80211_REASON_UNKNOWN_BA
499 - See IEEE 802.11 Standard
500 CSR_WIFI_SME_IEEE80211_REASON_UNKNOWN_DLS
501 - See IEEE 802.11 Standard
502 CSR_WIFI_SME_IEEE80211_REASON_TIMEOUT
503 - See IEEE 802.11 Standard
504 CSR_WIFI_SME_IEEE80211_REASON_STAKEY_MISMATCH
505 - See IEEE 802.11 Standard
506 CSR_WIFI_SME_IEEE80211_REASON_UNICAST_KEY_NEGOTIATION_TIMEOUT
507 - See IEEE 802.11 Standard
508 CSR_WIFI_SME_IEEE80211_REASON_MULTICAST_KEY_ANNOUNCEMENT_TIMEOUT
509 - See IEEE 802.11 Standard
510 CSR_WIFI_SME_IEEE80211_REASON_INCOMPATIBLE_UNICAST_KEY_NEGOTIATION_IE
511 - See IEEE 802.11 Standard
512 CSR_WIFI_SME_IEEE80211_REASON_INVALID_MULTICAST_CIPHER
513 - See IEEE 802.11 Standard
514 CSR_WIFI_SME_IEEE80211_REASON_INVALID_UNICAST_CIPHER
515 - See IEEE 802.11 Standard
516 CSR_WIFI_SME_IEEE80211_REASON_UNSUPPORTED_WAPI_IE_VERSION
517 - See IEEE 802.11 Standard
518 CSR_WIFI_SME_IEEE80211_REASON_INVALID_WAPI_CAPABILITY_IE
519 - See IEEE 802.11 Standard
520 CSR_WIFI_SME_IEEE80211_REASON_WAI_CERTIFICATE_AUTHENTICATION_FAILED
521 - See IEEE 802.11 Standard
522
523*******************************************************************************/
524typedef u16 CsrWifiSmeIEEE80211Reason;
525#define CSR_WIFI_SME_IEEE80211_REASON_SUCCESS ((CsrWifiSmeIEEE80211Reason) 0x0000)
526#define CSR_WIFI_SME_IEEE80211_REASON_UNSPECIFIED_REASON ((CsrWifiSmeIEEE80211Reason) 0x0001)
527#define CSR_WIFI_SME_IEEE80211_REASON_AUTHENTICATION_NOT_VALID ((CsrWifiSmeIEEE80211Reason) 0x0002)
528#define CSR_WIFI_SME_IEEE80211_REASON_DEAUTHENTICATED_LEAVE_BSS ((CsrWifiSmeIEEE80211Reason) 0x0003)
529#define CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_INACTIVITY ((CsrWifiSmeIEEE80211Reason) 0x0004)
530#define CSR_WIFI_SME_IEEE80211_REASON_AP_OVERLOAD ((CsrWifiSmeIEEE80211Reason) 0x0005)
531#define CSR_WIFI_SME_IEEE80211_REASON_CLASS_2FRAME_ERROR ((CsrWifiSmeIEEE80211Reason) 0x0006)
532#define CSR_WIFI_SME_IEEE80211_REASON_CLASS_3FRAME_ERROR ((CsrWifiSmeIEEE80211Reason) 0x0007)
533#define CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_LEAVE_BSS ((CsrWifiSmeIEEE80211Reason) 0x0008)
534#define CSR_WIFI_SME_IEEE80211_REASON_ASSOCIATION_NOT_AUTHENTICATED ((CsrWifiSmeIEEE80211Reason) 0x0009)
535#define CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_POWER_CAPABILITY ((CsrWifiSmeIEEE80211Reason) 0x000a)
536#define CSR_WIFI_SME_IEEE80211_REASON_DISASSOCIATED_SUPPORTED_CHANNELS ((CsrWifiSmeIEEE80211Reason) 0x000b)
537#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_INFORMATION_ELEMENT ((CsrWifiSmeIEEE80211Reason) 0x000d)
538#define CSR_WIFI_SME_IEEE80211_REASON_MICHAEL_MIC_FAILURE ((CsrWifiSmeIEEE80211Reason) 0x000e)
539#define CSR_WIFI_SME_IEEE80211_REASON_FOURWAY_HANDSHAKE_TIMEOUT ((CsrWifiSmeIEEE80211Reason) 0x000f)
540#define CSR_WIFI_SME_IEEE80211_REASON_GROUP_KEY_UPDATE_TIMEOUT ((CsrWifiSmeIEEE80211Reason) 0x0010)
541#define CSR_WIFI_SME_IEEE80211_REASON_HANDSHAKE_ELEMENT_DIFFERENT ((CsrWifiSmeIEEE80211Reason) 0x0011)
542#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_GROUP_CIPHER ((CsrWifiSmeIEEE80211Reason) 0x0012)
543#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_PAIRWISE_CIPHER ((CsrWifiSmeIEEE80211Reason) 0x0013)
544#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_AKMP ((CsrWifiSmeIEEE80211Reason) 0x0014)
545#define CSR_WIFI_SME_IEEE80211_REASON_UNSUPPORTED_RSN_IEVERSION ((CsrWifiSmeIEEE80211Reason) 0x0015)
546#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_RSN_IECAPABILITIES ((CsrWifiSmeIEEE80211Reason) 0x0016)
547#define CSR_WIFI_SME_IEEE80211_REASON_DOT1X_AUTH_FAILED ((CsrWifiSmeIEEE80211Reason) 0x0017)
548#define CSR_WIFI_SME_IEEE80211_REASON_CIPHER_REJECTED_BY_POLICY ((CsrWifiSmeIEEE80211Reason) 0x0018)
549#define CSR_WIFI_SME_IEEE80211_REASON_SERVICE_CHANGE_PRECLUDES_TS ((CsrWifiSmeIEEE80211Reason) 0x001F)
550#define CSR_WIFI_SME_IEEE80211_REASON_QOS_UNSPECIFIED_REASON ((CsrWifiSmeIEEE80211Reason) 0x0020)
551#define CSR_WIFI_SME_IEEE80211_REASON_QOS_INSUFFICIENT_BANDWIDTH ((CsrWifiSmeIEEE80211Reason) 0x0021)
552#define CSR_WIFI_SME_IEEE80211_REASON_QOS_EXCESSIVE_NOT_ACK ((CsrWifiSmeIEEE80211Reason) 0x0022)
553#define CSR_WIFI_SME_IEEE80211_REASON_QOS_TXOPLIMIT_EXCEEDED ((CsrWifiSmeIEEE80211Reason) 0x0023)
554#define CSR_WIFI_SME_IEEE80211_REASON_QSTA_LEAVING ((CsrWifiSmeIEEE80211Reason) 0x0024)
555#define CSR_WIFI_SME_IEEE80211_REASON_END_TS ((CsrWifiSmeIEEE80211Reason) 0x0025)
556#define CSR_WIFI_SME_IEEE80211_REASON_END_DLS ((CsrWifiSmeIEEE80211Reason) 0x0025)
557#define CSR_WIFI_SME_IEEE80211_REASON_END_BA ((CsrWifiSmeIEEE80211Reason) 0x0025)
558#define CSR_WIFI_SME_IEEE80211_REASON_UNKNOWN_TS ((CsrWifiSmeIEEE80211Reason) 0x0026)
559#define CSR_WIFI_SME_IEEE80211_REASON_UNKNOWN_BA ((CsrWifiSmeIEEE80211Reason) 0x0026)
560#define CSR_WIFI_SME_IEEE80211_REASON_UNKNOWN_DLS ((CsrWifiSmeIEEE80211Reason) 0x0026)
561#define CSR_WIFI_SME_IEEE80211_REASON_TIMEOUT ((CsrWifiSmeIEEE80211Reason) 0x0027)
562#define CSR_WIFI_SME_IEEE80211_REASON_STAKEY_MISMATCH ((CsrWifiSmeIEEE80211Reason) 0x002d)
563#define CSR_WIFI_SME_IEEE80211_REASON_UNICAST_KEY_NEGOTIATION_TIMEOUT ((CsrWifiSmeIEEE80211Reason) 0xf019)
564#define CSR_WIFI_SME_IEEE80211_REASON_MULTICAST_KEY_ANNOUNCEMENT_TIMEOUT ((CsrWifiSmeIEEE80211Reason) 0xf01a)
565#define CSR_WIFI_SME_IEEE80211_REASON_INCOMPATIBLE_UNICAST_KEY_NEGOTIATION_IE ((CsrWifiSmeIEEE80211Reason) 0xf01b)
566#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_MULTICAST_CIPHER ((CsrWifiSmeIEEE80211Reason) 0xf01c)
567#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_UNICAST_CIPHER ((CsrWifiSmeIEEE80211Reason) 0xf01d)
568#define CSR_WIFI_SME_IEEE80211_REASON_UNSUPPORTED_WAPI_IE_VERSION ((CsrWifiSmeIEEE80211Reason) 0xf01e)
569#define CSR_WIFI_SME_IEEE80211_REASON_INVALID_WAPI_CAPABILITY_IE ((CsrWifiSmeIEEE80211Reason) 0xf01f)
570#define CSR_WIFI_SME_IEEE80211_REASON_WAI_CERTIFICATE_AUTHENTICATION_FAILED ((CsrWifiSmeIEEE80211Reason) 0xf020)
571
572/*******************************************************************************
573
574 NAME
575 CsrWifiSmeIEEE80211Result
576
577 DESCRIPTION
578 As definined in the IEEE 802.11 standards
579
580 VALUES
581 CSR_WIFI_SME_IEEE80211_RESULT_SUCCESS
582 - See IEEE 802.11 Standard
583 CSR_WIFI_SME_IEEE80211_RESULT_UNSPECIFIED_FAILURE
584 - See IEEE 802.11 Standard
585 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_CAPABILITIES_MISMATCH
586 - See IEEE 802.11 Standard
587 CSR_WIFI_SME_IEEE80211_RESULT_REASSOCIATION_DENIED_NO_ASSOCIATION
588 - See IEEE 802.11 Standard
589 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_EXTERNAL_REASON
590 - See IEEE 802.11 Standard
591 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AUTHENTICATION_MISMATCH
592 - See IEEE 802.11 Standard
593 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_INVALID_AUTHENTICATION_SEQUENCE_NUMBER
594 - See IEEE 802.11 Standard
595 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_CHALLENGE_FAILURE
596 - See IEEE 802.11 Standard
597 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AUTHENTICATION_TIMEOUT
598 - See IEEE 802.11 Standard
599 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AP_OUT_OF_MEMORY
600 - See IEEE 802.11 Standard
601 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_BASIC_RATES_MISMATCH
602 - See IEEE 802.11 Standard
603 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SHORT_PREAMBLE_REQUIRED
604 - See IEEE 802.11 Standard
605 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_PBCC_MODULATION_REQUIRED
606 - See IEEE 802.11 Standard
607 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_CHANNEL_AGILITY_REQUIRED
608 - See IEEE 802.11 Standard
609 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SPECTRUM_MANAGEMENT_REQUIRED
610 - See IEEE 802.11 Standard
611 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_POWER_CAPABILITY_UNACCEPTABLE
612 - See IEEE 802.11 Standard
613 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SUPPORTED_CHANNELS_UNACCEPTABLE
614 - See IEEE 802.11 Standard
615 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SHORT_SLOT_REQUIRED
616 - See IEEE 802.11 Standard
617 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_DSSS_OFDMREQUIRED
618 - See IEEE 802.11 Standard
619 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_NO_HT_SUPPORT
620 - See IEEE 802.11 Standard
621 CSR_WIFI_SME_IEEE80211_RESULT_R0KH_UNREACHABLE
622 - See IEEE 802.11 Standard
623 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_PCO_TRANSITION_SUPPORT
624 - See IEEE 802.11 Standard
625 CSR_WIFI_SME_IEEE80211_RESULT_ASSOCIATION_REQUEST_REJECTED_TEMPORARILY
626 - See IEEE 802.11 Standard
627 CSR_WIFI_SME_IEEE80211_RESULT_ROBUST_MANAGEMENT_FRAME_POLICY_VIOLATION
628 - See IEEE 802.11 Standard
629 CSR_WIFI_SME_IEEE80211_RESULT_FAILURE
630 - See IEEE 802.11 Standard
631 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AP_BANDWIDTH_INSUFFICIENT
632 - See IEEE 802.11 Standard
633 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_POOR_OPERATING_CHANNEL
634 - See IEEE 802.11 Standard
635 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_QOS_REQUIRED
636 - See IEEE 802.11 Standard
637 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_REASON_UNSPECIFIED
638 - See IEEE 802.11 Standard
639 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED
640 - See IEEE 802.11 Standard
641 CSR_WIFI_SME_IEEE80211_RESULT_INVALID_PARAMETERS
642 - See IEEE 802.11 Standard
643 CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_WITH_SUGGESTED_TSPEC_CHANGES
644 - See IEEE 802.11 Standard
645 CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_IE
646 - See IEEE 802.11 Standard
647 CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_GROUP_CIPHER
648 - See IEEE 802.11 Standard
649 CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_PAIRWISE_CIPHER
650 - See IEEE 802.11 Standard
651 CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_AKMP
652 - See IEEE 802.11 Standard
653 CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_UNSUPPORTED_RSN_VERSION
654 - See IEEE 802.11 Standard
655 CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_RSN_CAPABILITY
656 - See IEEE 802.11 Standard
657 CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_SECURITY_POLICY
658 - See IEEE 802.11 Standard
659 CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_FOR_DELAY_PERIOD
660 - See IEEE 802.11 Standard
661 CSR_WIFI_SME_IEEE80211_RESULT_NOT_ALLOWED
662 - See IEEE 802.11 Standard
663 CSR_WIFI_SME_IEEE80211_RESULT_NOT_PRESENT
664 - See IEEE 802.11 Standard
665 CSR_WIFI_SME_IEEE80211_RESULT_NOT_QSTA
666 - See IEEE 802.11 Standard
667 CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_LISTEN_INTERVAL_TOO_LARGE
668 - See IEEE 802.11 Standard
669 CSR_WIFI_SME_IEEE80211_RESULT_INVALID_FT_ACTION_FRAME_COUNT
670 - See IEEE 802.11 Standard
671 CSR_WIFI_SME_IEEE80211_RESULT_INVALID_PMKID
672 - See IEEE 802.11 Standard
673 CSR_WIFI_SME_IEEE80211_RESULT_INVALID_MDIE
674 - See IEEE 802.11 Standard
675 CSR_WIFI_SME_IEEE80211_RESULT_INVALID_FTIE
676 - See IEEE 802.11 Standard
677 CSR_WIFI_SME_IEEE80211_RESULT_UNSPECIFIED_QOS_FAILURE
678 - See IEEE 802.11 Standard
679 CSR_WIFI_SME_IEEE80211_RESULT_WRONG_POLICY
680 - See IEEE 802.11 Standard
681 CSR_WIFI_SME_IEEE80211_RESULT_INSUFFICIENT_BANDWIDTH
682 - See IEEE 802.11 Standard
683 CSR_WIFI_SME_IEEE80211_RESULT_INVALID_TSPEC_PARAMETERS
684 - See IEEE 802.11 Standard
685 CSR_WIFI_SME_IEEE80211_RESULT_TIMEOUT
686 - See IEEE 802.11 Standard
687 CSR_WIFI_SME_IEEE80211_RESULT_TOO_MANY_SIMULTANEOUS_REQUESTS
688 - See IEEE 802.11 Standard
689 CSR_WIFI_SME_IEEE80211_RESULT_BSS_ALREADY_STARTED_OR_JOINED
690 - See IEEE 802.11 Standard
691 CSR_WIFI_SME_IEEE80211_RESULT_NOT_SUPPORTED
692 - See IEEE 802.11 Standard
693 CSR_WIFI_SME_IEEE80211_RESULT_TRANSMISSION_FAILURE
694 - See IEEE 802.11 Standard
695 CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_NOT_AUTHENTICATED
696 - See IEEE 802.11 Standard
697 CSR_WIFI_SME_IEEE80211_RESULT_RESET_REQUIRED_BEFORE_START
698 - See IEEE 802.11 Standard
699 CSR_WIFI_SME_IEEE80211_RESULT_LM_INFO_UNAVAILABLE
700 - See IEEE 802.11 Standard
701 CSR_WIFI_SME_IEEE80211_RESULT_INVALID_UNICAST_CIPHER
702 - See IEEE 802.11 Standard
703 CSR_WIFI_SME_IEEE80211_RESULT_INVALID_MULTICAST_CIPHER
704 - See IEEE 802.11 Standard
705 CSR_WIFI_SME_IEEE80211_RESULT_UNSUPPORTED_WAPI_IE_VERSION
706 - See IEEE 802.11 Standard
707 CSR_WIFI_SME_IEEE80211_RESULT_INVALID_WAPI_CAPABILITY_IE
708 - See IEEE 802.11 Standard
709
710*******************************************************************************/
711typedef u16 CsrWifiSmeIEEE80211Result;
712#define CSR_WIFI_SME_IEEE80211_RESULT_SUCCESS ((CsrWifiSmeIEEE80211Result) 0x0000)
713#define CSR_WIFI_SME_IEEE80211_RESULT_UNSPECIFIED_FAILURE ((CsrWifiSmeIEEE80211Result) 0x0001)
714#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_CAPABILITIES_MISMATCH ((CsrWifiSmeIEEE80211Result) 0x000a)
715#define CSR_WIFI_SME_IEEE80211_RESULT_REASSOCIATION_DENIED_NO_ASSOCIATION ((CsrWifiSmeIEEE80211Result) 0x000b)
716#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_EXTERNAL_REASON ((CsrWifiSmeIEEE80211Result) 0x000c)
717#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AUTHENTICATION_MISMATCH ((CsrWifiSmeIEEE80211Result) 0x000d)
718#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_INVALID_AUTHENTICATION_SEQUENCE_NUMBER ((CsrWifiSmeIEEE80211Result) 0x000e)
719#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_CHALLENGE_FAILURE ((CsrWifiSmeIEEE80211Result) 0x000f)
720#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AUTHENTICATION_TIMEOUT ((CsrWifiSmeIEEE80211Result) 0x0010)
721#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AP_OUT_OF_MEMORY ((CsrWifiSmeIEEE80211Result) 0x0011)
722#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_BASIC_RATES_MISMATCH ((CsrWifiSmeIEEE80211Result) 0x0012)
723#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SHORT_PREAMBLE_REQUIRED ((CsrWifiSmeIEEE80211Result) 0x0013)
724#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_PBCC_MODULATION_REQUIRED ((CsrWifiSmeIEEE80211Result) 0x0014)
725#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_CHANNEL_AGILITY_REQUIRED ((CsrWifiSmeIEEE80211Result) 0x0015)
726#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SPECTRUM_MANAGEMENT_REQUIRED ((CsrWifiSmeIEEE80211Result) 0x0016)
727#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_POWER_CAPABILITY_UNACCEPTABLE ((CsrWifiSmeIEEE80211Result) 0x0017)
728#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SUPPORTED_CHANNELS_UNACCEPTABLE ((CsrWifiSmeIEEE80211Result) 0x0018)
729#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_SHORT_SLOT_REQUIRED ((CsrWifiSmeIEEE80211Result) 0x0019)
730#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_DSSS_OFDMREQUIRED ((CsrWifiSmeIEEE80211Result) 0x001a)
731#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_NO_HT_SUPPORT ((CsrWifiSmeIEEE80211Result) 0x001b)
732#define CSR_WIFI_SME_IEEE80211_RESULT_R0KH_UNREACHABLE ((CsrWifiSmeIEEE80211Result) 0x001c)
733#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_PCO_TRANSITION_SUPPORT ((CsrWifiSmeIEEE80211Result) 0x001d)
734#define CSR_WIFI_SME_IEEE80211_RESULT_ASSOCIATION_REQUEST_REJECTED_TEMPORARILY ((CsrWifiSmeIEEE80211Result) 0x001e)
735#define CSR_WIFI_SME_IEEE80211_RESULT_ROBUST_MANAGEMENT_FRAME_POLICY_VIOLATION ((CsrWifiSmeIEEE80211Result) 0x001f)
736#define CSR_WIFI_SME_IEEE80211_RESULT_FAILURE ((CsrWifiSmeIEEE80211Result) 0x0020)
737#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_AP_BANDWIDTH_INSUFFICIENT ((CsrWifiSmeIEEE80211Result) 0x0021)
738#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_POOR_OPERATING_CHANNEL ((CsrWifiSmeIEEE80211Result) 0x0022)
739#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_QOS_REQUIRED ((CsrWifiSmeIEEE80211Result) 0x0023)
740#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_REASON_UNSPECIFIED ((CsrWifiSmeIEEE80211Result) 0x0025)
741#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED ((CsrWifiSmeIEEE80211Result) 0x0025)
742#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_PARAMETERS ((CsrWifiSmeIEEE80211Result) 0x0026)
743#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_WITH_SUGGESTED_TSPEC_CHANGES ((CsrWifiSmeIEEE80211Result) 0x0027)
744#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_IE ((CsrWifiSmeIEEE80211Result) 0x0028)
745#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_GROUP_CIPHER ((CsrWifiSmeIEEE80211Result) 0x0029)
746#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_PAIRWISE_CIPHER ((CsrWifiSmeIEEE80211Result) 0x002a)
747#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_AKMP ((CsrWifiSmeIEEE80211Result) 0x002b)
748#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_UNSUPPORTED_RSN_VERSION ((CsrWifiSmeIEEE80211Result) 0x002c)
749#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_INVALID_RSN_CAPABILITY ((CsrWifiSmeIEEE80211Result) 0x002d)
750#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_SECURITY_POLICY ((CsrWifiSmeIEEE80211Result) 0x002e)
751#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_FOR_DELAY_PERIOD ((CsrWifiSmeIEEE80211Result) 0x002f)
752#define CSR_WIFI_SME_IEEE80211_RESULT_NOT_ALLOWED ((CsrWifiSmeIEEE80211Result) 0x0030)
753#define CSR_WIFI_SME_IEEE80211_RESULT_NOT_PRESENT ((CsrWifiSmeIEEE80211Result) 0x0031)
754#define CSR_WIFI_SME_IEEE80211_RESULT_NOT_QSTA ((CsrWifiSmeIEEE80211Result) 0x0032)
755#define CSR_WIFI_SME_IEEE80211_RESULT_REJECTED_LISTEN_INTERVAL_TOO_LARGE ((CsrWifiSmeIEEE80211Result) 0x0033)
756#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_FT_ACTION_FRAME_COUNT ((CsrWifiSmeIEEE80211Result) 0x0034)
757#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_PMKID ((CsrWifiSmeIEEE80211Result) 0x0035)
758#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_MDIE ((CsrWifiSmeIEEE80211Result) 0x0036)
759#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_FTIE ((CsrWifiSmeIEEE80211Result) 0x0037)
760#define CSR_WIFI_SME_IEEE80211_RESULT_UNSPECIFIED_QOS_FAILURE ((CsrWifiSmeIEEE80211Result) 0x00c8)
761#define CSR_WIFI_SME_IEEE80211_RESULT_WRONG_POLICY ((CsrWifiSmeIEEE80211Result) 0x00c9)
762#define CSR_WIFI_SME_IEEE80211_RESULT_INSUFFICIENT_BANDWIDTH ((CsrWifiSmeIEEE80211Result) 0x00ca)
763#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_TSPEC_PARAMETERS ((CsrWifiSmeIEEE80211Result) 0x00cb)
764#define CSR_WIFI_SME_IEEE80211_RESULT_TIMEOUT ((CsrWifiSmeIEEE80211Result) 0x8000)
765#define CSR_WIFI_SME_IEEE80211_RESULT_TOO_MANY_SIMULTANEOUS_REQUESTS ((CsrWifiSmeIEEE80211Result) 0x8001)
766#define CSR_WIFI_SME_IEEE80211_RESULT_BSS_ALREADY_STARTED_OR_JOINED ((CsrWifiSmeIEEE80211Result) 0x8002)
767#define CSR_WIFI_SME_IEEE80211_RESULT_NOT_SUPPORTED ((CsrWifiSmeIEEE80211Result) 0x8003)
768#define CSR_WIFI_SME_IEEE80211_RESULT_TRANSMISSION_FAILURE ((CsrWifiSmeIEEE80211Result) 0x8004)
769#define CSR_WIFI_SME_IEEE80211_RESULT_REFUSED_NOT_AUTHENTICATED ((CsrWifiSmeIEEE80211Result) 0x8005)
770#define CSR_WIFI_SME_IEEE80211_RESULT_RESET_REQUIRED_BEFORE_START ((CsrWifiSmeIEEE80211Result) 0x8006)
771#define CSR_WIFI_SME_IEEE80211_RESULT_LM_INFO_UNAVAILABLE ((CsrWifiSmeIEEE80211Result) 0x8007)
772#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_UNICAST_CIPHER ((CsrWifiSmeIEEE80211Result) 0xf02f)
773#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_MULTICAST_CIPHER ((CsrWifiSmeIEEE80211Result) 0xf030)
774#define CSR_WIFI_SME_IEEE80211_RESULT_UNSUPPORTED_WAPI_IE_VERSION ((CsrWifiSmeIEEE80211Result) 0xf031)
775#define CSR_WIFI_SME_IEEE80211_RESULT_INVALID_WAPI_CAPABILITY_IE ((CsrWifiSmeIEEE80211Result) 0xf032)
776
777/*******************************************************************************
778
779 NAME
780 CsrWifiSmeIndications
781
782 DESCRIPTION
783 Defines bits for CsrWifiSmeIndicationsMask
784
785 VALUES
786 CSR_WIFI_SME_INDICATIONS_NONE
787 - Used to cancel the registrations for receiving indications
788 CSR_WIFI_SME_INDICATIONS_WIFIOFF
789 - Used to register for CSR_WIFI_SME_WIFI_OFF_IND events
790 CSR_WIFI_SME_INDICATIONS_SCANRESULT
791 - Used to register for CSR_WIFI_SME_SCAN_RESULT_IND events
792 CSR_WIFI_SME_INDICATIONS_CONNECTIONQUALITY
793 - Used to register for CSR_WIFI_SME_CONNECTION_QUALITY_IND
794 events
795 CSR_WIFI_SME_INDICATIONS_MEDIASTATUS
796 - Used to register for CSR_WIFI_SME_MEDIA_STATUS_IND events
797 CSR_WIFI_SME_INDICATIONS_MICFAILURE
798 - Used to register for CSR_WIFI_SME_MICFAILURE_IND events
799 CSR_WIFI_SME_INDICATIONS_PMKIDCANDIDATELIST
800 - Used to register for CSR_WIFI_SME_PMKIDCANDIDATE_LIST_IND
801 events
802 CSR_WIFI_SME_INDICATIONS_TSPEC
803 - Used to register for CSR_WIFI_SME_TSPEC_IND events
804 CSR_WIFI_SME_INDICATIONS_ROAMSTART
805 - Used to register for CSR_WIFI_SME_ROAM_START_IND events
806 CSR_WIFI_SME_INDICATIONS_ROAMCOMPLETE
807 - Used to register for CSR_WIFI_SME_ROAM_COMPLETE_IND events
808 CSR_WIFI_SME_INDICATIONS_ASSOCIATIONSTART
809 - Used to register for CSR_WIFI_SME_ASSOCIATION_START_IND
810 events
811 CSR_WIFI_SME_INDICATIONS_ASSOCIATIONCOMPLETE
812 - Used to register for CSR_WIFI_SME_ASSOCIATION_COMPLETE_IND
813 events
814 CSR_WIFI_SME_INDICATIONS_IBSSSTATION
815 - Used to register for CSR_WIFI_SME_IBSS_STATION_IND events
816 CSR_WIFI_SME_INDICATIONS_WIFION
817 - Used to register for CSR_WIFI_SME_WIFI_ON_IND events
818 CSR_WIFI_SME_INDICATIONS_ERROR
819 - Used to register for CSR_WIFI_SME_ERROR_IND events
820 CSR_WIFI_SME_INDICATIONS_INFO
821 - Used to register for CSR_WIFI_SME_INFO_IND events
822 CSR_WIFI_SME_INDICATIONS_COREDUMP
823 - Used to register for CSR_WIFI_SME_CORE_DUMP_IND events
824 CSR_WIFI_SME_INDICATIONS_ALL
825 - Used to register for all available indications
826
827*******************************************************************************/
828typedef u32 CsrWifiSmeIndications;
829#define CSR_WIFI_SME_INDICATIONS_NONE ((CsrWifiSmeIndications) 0x00000000)
830#define CSR_WIFI_SME_INDICATIONS_WIFIOFF ((CsrWifiSmeIndications) 0x00000001)
831#define CSR_WIFI_SME_INDICATIONS_SCANRESULT ((CsrWifiSmeIndications) 0x00000002)
832#define CSR_WIFI_SME_INDICATIONS_CONNECTIONQUALITY ((CsrWifiSmeIndications) 0x00000004)
833#define CSR_WIFI_SME_INDICATIONS_MEDIASTATUS ((CsrWifiSmeIndications) 0x00000008)
834#define CSR_WIFI_SME_INDICATIONS_MICFAILURE ((CsrWifiSmeIndications) 0x00000010)
835#define CSR_WIFI_SME_INDICATIONS_PMKIDCANDIDATELIST ((CsrWifiSmeIndications) 0x00000020)
836#define CSR_WIFI_SME_INDICATIONS_TSPEC ((CsrWifiSmeIndications) 0x00000040)
837#define CSR_WIFI_SME_INDICATIONS_ROAMSTART ((CsrWifiSmeIndications) 0x00000080)
838#define CSR_WIFI_SME_INDICATIONS_ROAMCOMPLETE ((CsrWifiSmeIndications) 0x00000100)
839#define CSR_WIFI_SME_INDICATIONS_ASSOCIATIONSTART ((CsrWifiSmeIndications) 0x00000200)
840#define CSR_WIFI_SME_INDICATIONS_ASSOCIATIONCOMPLETE ((CsrWifiSmeIndications) 0x00000400)
841#define CSR_WIFI_SME_INDICATIONS_IBSSSTATION ((CsrWifiSmeIndications) 0x00000800)
842#define CSR_WIFI_SME_INDICATIONS_WIFION ((CsrWifiSmeIndications) 0x00001000)
843#define CSR_WIFI_SME_INDICATIONS_ERROR ((CsrWifiSmeIndications) 0x00002000)
844#define CSR_WIFI_SME_INDICATIONS_INFO ((CsrWifiSmeIndications) 0x00004000)
845#define CSR_WIFI_SME_INDICATIONS_COREDUMP ((CsrWifiSmeIndications) 0x00008000)
846#define CSR_WIFI_SME_INDICATIONS_ALL ((CsrWifiSmeIndications) 0xFFFFFFFF)
847
848/*******************************************************************************
849
850 NAME
851 CsrWifiSmeKeyType
852
853 DESCRIPTION
854 Indicates the type of the key
855
856 VALUES
857 CSR_WIFI_SME_KEY_TYPE_GROUP - Key for broadcast communication
858 CSR_WIFI_SME_KEY_TYPE_PAIRWISE - Key for unicast communication
859 CSR_WIFI_SME_KEY_TYPE_STAKEY - Key for direct link communication to
860 another station in infrastructure networks
861 CSR_WIFI_SME_KEY_TYPE_IGTK - Integrity Group Temporal Key
862 CSR_WIFI_SME_KEY_TYPE_CCKM - Key for Cisco Centralized Key Management
863
864*******************************************************************************/
865typedef u8 CsrWifiSmeKeyType;
866#define CSR_WIFI_SME_KEY_TYPE_GROUP ((CsrWifiSmeKeyType) 0x00)
867#define CSR_WIFI_SME_KEY_TYPE_PAIRWISE ((CsrWifiSmeKeyType) 0x01)
868#define CSR_WIFI_SME_KEY_TYPE_STAKEY ((CsrWifiSmeKeyType) 0x02)
869#define CSR_WIFI_SME_KEY_TYPE_IGTK ((CsrWifiSmeKeyType) 0x03)
870#define CSR_WIFI_SME_KEY_TYPE_CCKM ((CsrWifiSmeKeyType) 0x04)
871
872/*******************************************************************************
873
874 NAME
875 CsrWifiSmeListAction
876
877 DESCRIPTION
878 Identifies the type of action to be performed on a list of items
879 The values of this type are used across the NME/SME/Router API's and they
880 must be kept consistent with the corresponding types in the .xml of the
881 ottherinterfaces
882
883 VALUES
884 CSR_WIFI_SME_LIST_ACTION_GET - Retrieve the current list of items
885 CSR_WIFI_SME_LIST_ACTION_ADD - Add one or more items
886 CSR_WIFI_SME_LIST_ACTION_REMOVE - Remove one or more items
887 CSR_WIFI_SME_LIST_ACTION_FLUSH - Remove all items
888
889*******************************************************************************/
890typedef u8 CsrWifiSmeListAction;
891#define CSR_WIFI_SME_LIST_ACTION_GET ((CsrWifiSmeListAction) 0x00)
892#define CSR_WIFI_SME_LIST_ACTION_ADD ((CsrWifiSmeListAction) 0x01)
893#define CSR_WIFI_SME_LIST_ACTION_REMOVE ((CsrWifiSmeListAction) 0x02)
894#define CSR_WIFI_SME_LIST_ACTION_FLUSH ((CsrWifiSmeListAction) 0x03)
895
896/*******************************************************************************
897
898 NAME
899 CsrWifiSmeMediaStatus
900
901 DESCRIPTION
902 Indicates the connection status
903 The values of this type are used across the NME/SME/Router API's and they
904 must be kept consistent with the corresponding types in the .xml of the
905 ottherinterfaces
906
907 VALUES
908 CSR_WIFI_SME_MEDIA_STATUS_CONNECTED
909 - Value CSR_WIFI_SME_MEDIA_STATUS_CONNECTED can happen in two
910 situations:
911 * A network connection is established. Specifically, this is
912 when the MLME_ASSOCIATION completes or the first peer
913 relationship is established in an IBSS. In a WPA/WPA2
914 network, this indicates that the stack is ready to perform
915 the 4-way handshake or 802.1x authentication if CSR NME
916 security library is not used. If CSR NME security library
917 is used this indicates, completion of 4way handshake or
918 802.1x authentication
919 * The SME roams to another AP on the same ESS
920 During the AP operation, it indicates that the peer station
921 is connected to the AP and is ready for data transfer.
922 CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED
923 - Value CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED can happen in
924 two situations:
925 * when the connection to a network is lost and there is no
926 alternative on the same ESS to roam to
927 * when a CSR_WIFI_SME_DISCONNECT_REQ request is issued
928 During AP or P2PGO operation, it indicates that the peer
929 station has disconnected from the AP
930
931*******************************************************************************/
932typedef u8 CsrWifiSmeMediaStatus;
933#define CSR_WIFI_SME_MEDIA_STATUS_CONNECTED ((CsrWifiSmeMediaStatus) 0x00)
934#define CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED ((CsrWifiSmeMediaStatus) 0x01)
935
936/*******************************************************************************
937
938 NAME
939 CsrWifiSmeP2pCapability
940
941 DESCRIPTION
942 Defines P2P Device Capabilities
943
944 VALUES
945 CSR_WIFI_SME_P2P_SERVICE_DISCOVERY_CAPABILITY
946 - This field is set to 1 if the P2P Device supports Service
947 Discovery, and to 0 otherwise
948 CSR_WIFI_SME_P2P_CLIENT_DISCOVERABILITY_CAPABILITY
949 - This field is set to 1 when the P2P Device supports P2P
950 Client Discoverability, and to 0 otherwise.
951 CSR_WIFI_SME_P2P_CONCURRENT_OPERATION_CAPABILITY
952 - This field is set to 1 when the P2P Device supports
953 Concurrent Operation with WLAN, and to 0 otherwise.
954 CSR_WIFI_SME_P2P_MANAGED_DEVICE_CAPABILITY
955 - This field is set to 1 when the P2P interface of the P2P
956 Device is capable of being managed by the WLAN
957 (infrastructure network) based on P2P coexistence
958 parameters, and to 0 otherwise
959 CSR_WIFI_SME_P2P_INVITAION_CAPABILITY
960 - This field is set to 1 if the P2P Device is capable of
961 processing P2P Invitation Procedure signaling, and to 0
962 otherwise.
963
964*******************************************************************************/
965typedef u8 CsrWifiSmeP2pCapability;
966#define CSR_WIFI_SME_P2P_SERVICE_DISCOVERY_CAPABILITY ((CsrWifiSmeP2pCapability) 0x01)
967#define CSR_WIFI_SME_P2P_CLIENT_DISCOVERABILITY_CAPABILITY ((CsrWifiSmeP2pCapability) 0x02)
968#define CSR_WIFI_SME_P2P_CONCURRENT_OPERATION_CAPABILITY ((CsrWifiSmeP2pCapability) 0x04)
969#define CSR_WIFI_SME_P2P_MANAGED_DEVICE_CAPABILITY ((CsrWifiSmeP2pCapability) 0x08)
970#define CSR_WIFI_SME_P2P_INVITAION_CAPABILITY ((CsrWifiSmeP2pCapability) 0x20)
971
972/*******************************************************************************
973
974 NAME
975 CsrWifiSmeP2pGroupCapability
976
977 DESCRIPTION
978 Define bits for P2P Group Capability
979
980 VALUES
981 CSR_WIFI_P2P_GRP_CAP_GO
982 - Indicates if the local device has become a GO after GO
983 negotiation
984 CSR_WIFI_P2P_GRP_CAP_PERSISTENT
985 - Persistent group
986 CSR_WIFI_P2P_GRP_CAP_INTRABSS_DIST
987 - Intra-BSS data distribution support
988 CSR_WIFI_P2P_GRP_CAP_CROSS_CONN
989 - Support of cross connection
990 CSR_WIFI_P2P_GRP_CAP_PERSISTENT_RECONNECT
991 - Support of persistent reconnect
992
993*******************************************************************************/
994typedef u8 CsrWifiSmeP2pGroupCapability;
995#define CSR_WIFI_P2P_GRP_CAP_GO ((CsrWifiSmeP2pGroupCapability) 0x01)
996#define CSR_WIFI_P2P_GRP_CAP_PERSISTENT ((CsrWifiSmeP2pGroupCapability) 0x02)
997#define CSR_WIFI_P2P_GRP_CAP_INTRABSS_DIST ((CsrWifiSmeP2pGroupCapability) 0x08)
998#define CSR_WIFI_P2P_GRP_CAP_CROSS_CONN ((CsrWifiSmeP2pGroupCapability) 0x10)
999#define CSR_WIFI_P2P_GRP_CAP_PERSISTENT_RECONNECT ((CsrWifiSmeP2pGroupCapability) 0x20)
1000
1001/*******************************************************************************
1002
1003 NAME
1004 CsrWifiSmeP2pNoaConfigMethod
1005
1006 DESCRIPTION
1007 Notice of Absece Configuration
1008
1009 VALUES
1010 CSR_WIFI_P2P_NOA_NONE - Do not use NOA
1011 CSR_WIFI_P2P_NOA_AUTONOMOUS - NOA based on the traffic analysis
1012 CSR_WIFI_P2P_NOA_USER_DEFINED - NOA as specified by the user
1013
1014*******************************************************************************/
1015typedef u8 CsrWifiSmeP2pNoaConfigMethod;
1016#define CSR_WIFI_P2P_NOA_NONE ((CsrWifiSmeP2pNoaConfigMethod) 0x00)
1017#define CSR_WIFI_P2P_NOA_AUTONOMOUS ((CsrWifiSmeP2pNoaConfigMethod) 0x01)
1018#define CSR_WIFI_P2P_NOA_USER_DEFINED ((CsrWifiSmeP2pNoaConfigMethod) 0x02)
1019
1020/*******************************************************************************
1021
1022 NAME
1023 CsrWifiSmeP2pRole
1024
1025 DESCRIPTION
1026 Definition of roles for a P2P Device
1027
1028 VALUES
1029 CSR_WIFI_SME_P2P_ROLE_NONE - A non-P2PDevice device
1030 CSR_WIFI_SME_P2P_ROLE_STANDALONE - A Standalone P2P device
1031 CSR_WIFI_SME_P2P_ROLE_GO - Role Assumed is that of a Group Owner
1032 within a P2P Group
1033 CSR_WIFI_SME_P2P_ROLE_CLI - Role Assumed is that of a P2P Client
1034 within a P2P Group
1035
1036*******************************************************************************/
1037typedef u8 CsrWifiSmeP2pRole;
1038#define CSR_WIFI_SME_P2P_ROLE_NONE ((CsrWifiSmeP2pRole) 0x00)
1039#define CSR_WIFI_SME_P2P_ROLE_STANDALONE ((CsrWifiSmeP2pRole) 0x01)
1040#define CSR_WIFI_SME_P2P_ROLE_GO ((CsrWifiSmeP2pRole) 0x02)
1041#define CSR_WIFI_SME_P2P_ROLE_CLI ((CsrWifiSmeP2pRole) 0x03)
1042
1043/*******************************************************************************
1044
1045 NAME
1046 CsrWifiSmeP2pStatus
1047
1048 DESCRIPTION
1049 This data type enumerates the outcome of P2P procedure
1050
1051 VALUES
1052 CSR_WIFI_SME_P2P_STATUS_SUCCESS
1053 - Success
1054 CSR_WIFI_SME_P2P_STATUS_FAIL_INFO_UNAVAILABLE
1055 - Fail; information is currently unavailable
1056 CSR_WIFI_SME_P2P_STATUS_FAIL_INCOMPATIBLE_PARAM
1057 - Fail; incompatible parameters
1058 CSR_WIFI_SME_P2P_STATUS_FAIL_LIMIT_REACHED
1059 - Fail; limit reached
1060 CSR_WIFI_SME_P2P_STATUS_FAIL_INVALID_PARAM
1061 - Fail; invalid parameters
1062 CSR_WIFI_SME_P2P_STATUS_FAIL_ACCOMODATE
1063 - Fail; unable to accommodate request
1064 CSR_WIFI_SME_P2P_STATUS_FAIL_PREV_ERROR
1065 - Fail; previous protocol error, or disruptive behavior
1066 CSR_WIFI_SME_P2P_STATUS_FAIL_COMMON_CHANNELS
1067 - Fail; no common channels
1068 CSR_WIFI_SME_P2P_STATUS_FAIL_UNKNOWN_GROUP
1069 - Fail; unknown P2P Group
1070 CSR_WIFI_SME_P2P_STATUS_FAIL_GO_INTENT
1071 - Fail: both P2P Devices indicated an Intent of 15 in Group
1072 Owner Negotiation
1073 CSR_WIFI_SME_P2P_STATUS_FAIL_PROVISION_METHOD_INCOMPATIBLE
1074 - Fail; incompatible provisioning method
1075 CSR_WIFI_SME_P2P_STATUS_FAIL_REJECT
1076 - Fail: rejected by user
1077 CSR_WIFI_SME_P2P_STATUS_FAIL_RESERVED
1078 - Fail; Status Reserved
1079
1080*******************************************************************************/
1081typedef u8 CsrWifiSmeP2pStatus;
1082#define CSR_WIFI_SME_P2P_STATUS_SUCCESS ((CsrWifiSmeP2pStatus) 0x00)
1083#define CSR_WIFI_SME_P2P_STATUS_FAIL_INFO_UNAVAILABLE ((CsrWifiSmeP2pStatus) 0x01)
1084#define CSR_WIFI_SME_P2P_STATUS_FAIL_INCOMPATIBLE_PARAM ((CsrWifiSmeP2pStatus) 0x02)
1085#define CSR_WIFI_SME_P2P_STATUS_FAIL_LIMIT_REACHED ((CsrWifiSmeP2pStatus) 0x03)
1086#define CSR_WIFI_SME_P2P_STATUS_FAIL_INVALID_PARAM ((CsrWifiSmeP2pStatus) 0x04)
1087#define CSR_WIFI_SME_P2P_STATUS_FAIL_ACCOMODATE ((CsrWifiSmeP2pStatus) 0x05)
1088#define CSR_WIFI_SME_P2P_STATUS_FAIL_PREV_ERROR ((CsrWifiSmeP2pStatus) 0x06)
1089#define CSR_WIFI_SME_P2P_STATUS_FAIL_COMMON_CHANNELS ((CsrWifiSmeP2pStatus) 0x07)
1090#define CSR_WIFI_SME_P2P_STATUS_FAIL_UNKNOWN_GROUP ((CsrWifiSmeP2pStatus) 0x08)
1091#define CSR_WIFI_SME_P2P_STATUS_FAIL_GO_INTENT ((CsrWifiSmeP2pStatus) 0x09)
1092#define CSR_WIFI_SME_P2P_STATUS_FAIL_PROVISION_METHOD_INCOMPATIBLE ((CsrWifiSmeP2pStatus) 0x0A)
1093#define CSR_WIFI_SME_P2P_STATUS_FAIL_REJECT ((CsrWifiSmeP2pStatus) 0x0B)
1094#define CSR_WIFI_SME_P2P_STATUS_FAIL_RESERVED ((CsrWifiSmeP2pStatus) 0xFF)
1095
1096/*******************************************************************************
1097
1098 NAME
1099 CsrWifiSmePacketFilterMode
1100
1101 DESCRIPTION
1102 Options for the filter mode parameter.
1103 The Values here match the HIP interface
1104
1105 VALUES
1106 CSR_WIFI_SME_PACKET_FILTER_MODE_OPT_OUT
1107 - Broadcast packets are always reported to the host unless
1108 they match at least one of the specified TCLAS IEs.
1109 CSR_WIFI_SME_PACKET_FILTER_MODE_OPT_IN
1110 - Broadcast packets are reported to the host only if they
1111 match at least one of the specified TCLAS IEs.
1112
1113*******************************************************************************/
1114typedef u8 CsrWifiSmePacketFilterMode;
1115#define CSR_WIFI_SME_PACKET_FILTER_MODE_OPT_OUT ((CsrWifiSmePacketFilterMode) 0x00)
1116#define CSR_WIFI_SME_PACKET_FILTER_MODE_OPT_IN ((CsrWifiSmePacketFilterMode) 0x03)
1117
1118/*******************************************************************************
1119
1120 NAME
1121 CsrWifiSmePowerSaveLevel
1122
1123 DESCRIPTION
1124 Power Save Level options as defined in the IEEE 802.11 standards
1125 First 3 values are set to match the mlme PowerManagementMode
1126
1127 VALUES
1128 CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW - No power save: the driver will remain
1129 active at all times
1130 CSR_WIFI_SME_POWER_SAVE_LEVEL_HIGH - Enter power save after all packets in
1131 the queues are transmitted and received
1132 CSR_WIFI_SME_POWER_SAVE_LEVEL_MED - Enter power save after all packets in
1133 the queues are transmitted and received
1134 and a further configurable delay
1135 (default 1s) has elapsed
1136 CSR_WIFI_SME_POWER_SAVE_LEVEL_AUTO - The SME will decide when to enter power
1137 save mode according to the traffic
1138 analysis
1139
1140*******************************************************************************/
1141typedef u8 CsrWifiSmePowerSaveLevel;
1142#define CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW ((CsrWifiSmePowerSaveLevel) 0x00)
1143#define CSR_WIFI_SME_POWER_SAVE_LEVEL_HIGH ((CsrWifiSmePowerSaveLevel) 0x01)
1144#define CSR_WIFI_SME_POWER_SAVE_LEVEL_MED ((CsrWifiSmePowerSaveLevel) 0x02)
1145#define CSR_WIFI_SME_POWER_SAVE_LEVEL_AUTO ((CsrWifiSmePowerSaveLevel) 0x03)
1146
1147/*******************************************************************************
1148
1149 NAME
1150 CsrWifiSmePreambleType
1151
1152 DESCRIPTION
1153 SME Preamble Types
1154
1155 VALUES
1156 CSR_WIFI_SME_USE_LONG_PREAMBLE - Use legacy (long) preamble
1157 CSR_WIFI_SME_USE_SHORT_PREAMBLE - Use short PPDU format
1158
1159*******************************************************************************/
1160typedef u8 CsrWifiSmePreambleType;
1161#define CSR_WIFI_SME_USE_LONG_PREAMBLE ((CsrWifiSmePreambleType) 0x00)
1162#define CSR_WIFI_SME_USE_SHORT_PREAMBLE ((CsrWifiSmePreambleType) 0x01)
1163
1164/*******************************************************************************
1165
1166 NAME
1167 CsrWifiSmeRadioIF
1168
1169 DESCRIPTION
1170 Indicates the frequency
1171
1172 VALUES
1173 CSR_WIFI_SME_RADIO_IF_GHZ_2_4 - Indicates the 2.4 GHZ frequency
1174 CSR_WIFI_SME_RADIO_IF_GHZ_5_0 - Future use: currently not supported
1175 CSR_WIFI_SME_RADIO_IF_BOTH - Future use: currently not supported
1176
1177*******************************************************************************/
1178typedef u8 CsrWifiSmeRadioIF;
1179#define CSR_WIFI_SME_RADIO_IF_GHZ_2_4 ((CsrWifiSmeRadioIF) 0x01)
1180#define CSR_WIFI_SME_RADIO_IF_GHZ_5_0 ((CsrWifiSmeRadioIF) 0x02)
1181#define CSR_WIFI_SME_RADIO_IF_BOTH ((CsrWifiSmeRadioIF) 0x03)
1182
1183/*******************************************************************************
1184
1185 NAME
1186 CsrWifiSmeRegulatoryDomain
1187
1188 DESCRIPTION
1189 Indicates the regulatory domain as defined in IEEE 802.11 standards
1190
1191 VALUES
1192 CSR_WIFI_SME_REGULATORY_DOMAIN_OTHER
1193 - See IEEE 802.11 Standard
1194 CSR_WIFI_SME_REGULATORY_DOMAIN_FCC
1195 - See IEEE 802.11 Standard
1196 CSR_WIFI_SME_REGULATORY_DOMAIN_IC
1197 - See IEEE 802.11 Standard
1198 CSR_WIFI_SME_REGULATORY_DOMAIN_ETSI
1199 - See IEEE 802.11 Standard
1200 CSR_WIFI_SME_REGULATORY_DOMAIN_SPAIN
1201 - See IEEE 802.11 Standard
1202 CSR_WIFI_SME_REGULATORY_DOMAIN_FRANCE
1203 - See IEEE 802.11 Standard
1204 CSR_WIFI_SME_REGULATORY_DOMAIN_JAPAN
1205 - See IEEE 802.11 Standard
1206 CSR_WIFI_SME_REGULATORY_DOMAIN_JAPANBIS
1207 - See IEEE 802.11 Standard
1208 CSR_WIFI_SME_REGULATORY_DOMAIN_CHINA
1209 - See IEEE 802.11 Standard
1210 CSR_WIFI_SME_REGULATORY_DOMAIN_CHINABIS
1211 - See IEEE 802.11 Standard
1212 CSR_WIFI_SME_REGULATORY_DOMAIN_NONE
1213 - See IEEE 802.11 Standard
1214
1215*******************************************************************************/
1216typedef u8 CsrWifiSmeRegulatoryDomain;
1217#define CSR_WIFI_SME_REGULATORY_DOMAIN_OTHER ((CsrWifiSmeRegulatoryDomain) 0x00)
1218#define CSR_WIFI_SME_REGULATORY_DOMAIN_FCC ((CsrWifiSmeRegulatoryDomain) 0x10)
1219#define CSR_WIFI_SME_REGULATORY_DOMAIN_IC ((CsrWifiSmeRegulatoryDomain) 0x20)
1220#define CSR_WIFI_SME_REGULATORY_DOMAIN_ETSI ((CsrWifiSmeRegulatoryDomain) 0x30)
1221#define CSR_WIFI_SME_REGULATORY_DOMAIN_SPAIN ((CsrWifiSmeRegulatoryDomain) 0x31)
1222#define CSR_WIFI_SME_REGULATORY_DOMAIN_FRANCE ((CsrWifiSmeRegulatoryDomain) 0x32)
1223#define CSR_WIFI_SME_REGULATORY_DOMAIN_JAPAN ((CsrWifiSmeRegulatoryDomain) 0x40)
1224#define CSR_WIFI_SME_REGULATORY_DOMAIN_JAPANBIS ((CsrWifiSmeRegulatoryDomain) 0x41)
1225#define CSR_WIFI_SME_REGULATORY_DOMAIN_CHINA ((CsrWifiSmeRegulatoryDomain) 0x50)
1226#define CSR_WIFI_SME_REGULATORY_DOMAIN_CHINABIS ((CsrWifiSmeRegulatoryDomain) 0x51)
1227#define CSR_WIFI_SME_REGULATORY_DOMAIN_NONE ((CsrWifiSmeRegulatoryDomain) 0xFF)
1228
1229/*******************************************************************************
1230
1231 NAME
1232 CsrWifiSmeRoamReason
1233
1234 DESCRIPTION
1235 Indicates the reason for roaming
1236
1237 VALUES
1238 CSR_WIFI_SME_ROAM_REASON_BEACONLOST
1239 - The station cannot receive the beacon signal any more
1240 CSR_WIFI_SME_ROAM_REASON_DISASSOCIATED
1241 - The station has been disassociated
1242 CSR_WIFI_SME_ROAM_REASON_DEAUTHENTICATED
1243 - The station has been deauthenticated
1244 CSR_WIFI_SME_ROAM_REASON_BETTERAPFOUND
1245 - A better AP has been found
1246
1247*******************************************************************************/
1248typedef u8 CsrWifiSmeRoamReason;
1249#define CSR_WIFI_SME_ROAM_REASON_BEACONLOST ((CsrWifiSmeRoamReason) 0x00)
1250#define CSR_WIFI_SME_ROAM_REASON_DISASSOCIATED ((CsrWifiSmeRoamReason) 0x01)
1251#define CSR_WIFI_SME_ROAM_REASON_DEAUTHENTICATED ((CsrWifiSmeRoamReason) 0x02)
1252#define CSR_WIFI_SME_ROAM_REASON_BETTERAPFOUND ((CsrWifiSmeRoamReason) 0x03)
1253
1254/*******************************************************************************
1255
1256 NAME
1257 CsrWifiSmeScanType
1258
1259 DESCRIPTION
1260 Identifies the type of scan to be performed
1261
1262 VALUES
1263 CSR_WIFI_SME_SCAN_TYPE_ALL - Scan actively or passively according to the
1264 regulatory domain restrictions
1265 CSR_WIFI_SME_SCAN_TYPE_ACTIVE - Scan actively only: send probes and listen
1266 for answers
1267 CSR_WIFI_SME_SCAN_TYPE_PASSIVE - Scan passively only: listen for beacon
1268 messages
1269
1270*******************************************************************************/
1271typedef u8 CsrWifiSmeScanType;
1272#define CSR_WIFI_SME_SCAN_TYPE_ALL ((CsrWifiSmeScanType) 0x00)
1273#define CSR_WIFI_SME_SCAN_TYPE_ACTIVE ((CsrWifiSmeScanType) 0x01)
1274#define CSR_WIFI_SME_SCAN_TYPE_PASSIVE ((CsrWifiSmeScanType) 0x02)
1275
1276/*******************************************************************************
1277
1278 NAME
1279 CsrWifiSmeTrafficType
1280
1281 DESCRIPTION
1282 Identifies the type of traffic going on on the connection.
1283 The values of this type are used across the NME/SME/Router API's and they
1284 must be kept consistent with the corresponding types in the .xml of the
1285 ottherinterfaces
1286
1287 VALUES
1288 CSR_WIFI_SME_TRAFFIC_TYPE_OCCASIONAL
1289 - During the last 30 seconds there were fewer than 20 packets
1290 per seconds in each second in both directions
1291 CSR_WIFI_SME_TRAFFIC_TYPE_BURSTY
1292 - During the last 30 seconds there was at least one second
1293 during which more than 20 packets were received in either
1294 direction
1295 CSR_WIFI_SME_TRAFFIC_TYPE_PERIODIC
1296 - During the last 5 seconds there were at least 10 packets
1297 received each second and a defined period for the traffic
1298 can be recognized
1299 CSR_WIFI_SME_TRAFFIC_TYPE_CONTINUOUS
1300 - During the last 5 seconds there were at least 20 packets
1301 received each second in either direction
1302
1303*******************************************************************************/
1304typedef u8 CsrWifiSmeTrafficType;
1305#define CSR_WIFI_SME_TRAFFIC_TYPE_OCCASIONAL ((CsrWifiSmeTrafficType) 0x00)
1306#define CSR_WIFI_SME_TRAFFIC_TYPE_BURSTY ((CsrWifiSmeTrafficType) 0x01)
1307#define CSR_WIFI_SME_TRAFFIC_TYPE_PERIODIC ((CsrWifiSmeTrafficType) 0x02)
1308#define CSR_WIFI_SME_TRAFFIC_TYPE_CONTINUOUS ((CsrWifiSmeTrafficType) 0x03)
1309
1310/*******************************************************************************
1311
1312 NAME
1313 CsrWifiSmeTspecCtrl
1314
1315 DESCRIPTION
1316 Defines bits for CsrWifiSmeTspecCtrlMask for additional CCX configuration.
1317 CURRENTLY NOT SUPPORTED.
1318
1319 VALUES
1320 CSR_WIFI_SME_TSPEC_CTRL_STRICT
1321 - No automatic negotiation
1322 CSR_WIFI_SME_TSPEC_CTRL_CCX_SIGNALLING
1323 - Signalling TSPEC
1324 CSR_WIFI_SME_TSPEC_CTRL_CCX_VOICE
1325 - Voice traffic TSPEC
1326
1327*******************************************************************************/
1328typedef u8 CsrWifiSmeTspecCtrl;
1329#define CSR_WIFI_SME_TSPEC_CTRL_STRICT ((CsrWifiSmeTspecCtrl) 0x01)
1330#define CSR_WIFI_SME_TSPEC_CTRL_CCX_SIGNALLING ((CsrWifiSmeTspecCtrl) 0x02)
1331#define CSR_WIFI_SME_TSPEC_CTRL_CCX_VOICE ((CsrWifiSmeTspecCtrl) 0x04)
1332
1333/*******************************************************************************
1334
1335 NAME
1336 CsrWifiSmeTspecResultCode
1337
1338 DESCRIPTION
1339 Defines the result of the TSPEC exchanges with the AP
1340
1341 VALUES
1342 CSR_WIFI_SME_TSPEC_RESULT_SUCCESS
1343 - TSPEC command has been processed correctly
1344 CSR_WIFI_SME_TSPEC_RESULT_UNSPECIFIED_QOS_FAILURE
1345 - The Access Point reported a failure
1346 CSR_WIFI_SME_TSPEC_RESULT_FAILURE
1347 - Internal failure in the SME
1348 CSR_WIFI_SME_TSPEC_RESULT_INVALID_TSPEC_PARAMETERS
1349 - The TSPEC parameters are invalid
1350 CSR_WIFI_SME_TSPEC_RESULT_INVALID_TCLAS_PARAMETERS
1351 - The TCLASS parameters are invalid
1352 CSR_WIFI_SME_TSPEC_RESULT_INSUFFICIENT_BANDWIDTH
1353 - As specified by the WMM Spec
1354 CSR_WIFI_SME_TSPEC_RESULT_WRONG_POLICY
1355 - As specified by the WMM Spec
1356 CSR_WIFI_SME_TSPEC_RESULT_REJECTED_WITH_SUGGESTED_CHANGES
1357 - As specified by the WMM Spec
1358 CSR_WIFI_SME_TSPEC_RESULT_TIMEOUT
1359 - The TSPEC negotiation timed out
1360 CSR_WIFI_SME_TSPEC_RESULT_NOT_SUPPORTED
1361 - The Access Point does not support the TSPEC
1362 CSR_WIFI_SME_TSPEC_RESULT_IE_LENGTH_INCORRECT
1363 - The length of the TSPEC is not correct
1364 CSR_WIFI_SME_TSPEC_RESULT_INVALID_TRANSACTION_ID
1365 - The TSPEC transaction id is not in the list
1366 CSR_WIFI_SME_TSPEC_RESULT_INSTALLED
1367 - The TSPEC has been installed and it is now active.
1368 CSR_WIFI_SME_TSPEC_RESULT_TID_ALREADY_INSTALLED
1369 - The Traffic ID has already been installed
1370 CSR_WIFI_SME_TSPEC_RESULT_TSPEC_REMOTELY_DELETED
1371 - The AP has deleted the TSPEC
1372
1373*******************************************************************************/
1374typedef u8 CsrWifiSmeTspecResultCode;
1375#define CSR_WIFI_SME_TSPEC_RESULT_SUCCESS ((CsrWifiSmeTspecResultCode) 0x00)
1376#define CSR_WIFI_SME_TSPEC_RESULT_UNSPECIFIED_QOS_FAILURE ((CsrWifiSmeTspecResultCode) 0x01)
1377#define CSR_WIFI_SME_TSPEC_RESULT_FAILURE ((CsrWifiSmeTspecResultCode) 0x02)
1378#define CSR_WIFI_SME_TSPEC_RESULT_INVALID_TSPEC_PARAMETERS ((CsrWifiSmeTspecResultCode) 0x05)
1379#define CSR_WIFI_SME_TSPEC_RESULT_INVALID_TCLAS_PARAMETERS ((CsrWifiSmeTspecResultCode) 0x06)
1380#define CSR_WIFI_SME_TSPEC_RESULT_INSUFFICIENT_BANDWIDTH ((CsrWifiSmeTspecResultCode) 0x07)
1381#define CSR_WIFI_SME_TSPEC_RESULT_WRONG_POLICY ((CsrWifiSmeTspecResultCode) 0x08)
1382#define CSR_WIFI_SME_TSPEC_RESULT_REJECTED_WITH_SUGGESTED_CHANGES ((CsrWifiSmeTspecResultCode) 0x09)
1383#define CSR_WIFI_SME_TSPEC_RESULT_TIMEOUT ((CsrWifiSmeTspecResultCode) 0x0D)
1384#define CSR_WIFI_SME_TSPEC_RESULT_NOT_SUPPORTED ((CsrWifiSmeTspecResultCode) 0x0E)
1385#define CSR_WIFI_SME_TSPEC_RESULT_IE_LENGTH_INCORRECT ((CsrWifiSmeTspecResultCode) 0x10)
1386#define CSR_WIFI_SME_TSPEC_RESULT_INVALID_TRANSACTION_ID ((CsrWifiSmeTspecResultCode) 0x11)
1387#define CSR_WIFI_SME_TSPEC_RESULT_INSTALLED ((CsrWifiSmeTspecResultCode) 0x12)
1388#define CSR_WIFI_SME_TSPEC_RESULT_TID_ALREADY_INSTALLED ((CsrWifiSmeTspecResultCode) 0x13)
1389#define CSR_WIFI_SME_TSPEC_RESULT_TSPEC_REMOTELY_DELETED ((CsrWifiSmeTspecResultCode) 0x14)
1390
1391/*******************************************************************************
1392
1393 NAME
1394 CsrWifiSmeWepAuthMode
1395
1396 DESCRIPTION
1397 Define bits for CsrWifiSmeWepAuthMode
1398
1399 VALUES
1400 CSR_WIFI_SME_WEP_AUTH_MODE_OPEN - Open-WEP enabled network
1401 CSR_WIFI_SME_WEP_AUTH_MODE_SHARED - Shared-key WEP enabled network.
1402
1403*******************************************************************************/
1404typedef u8 CsrWifiSmeWepAuthMode;
1405#define CSR_WIFI_SME_WEP_AUTH_MODE_OPEN ((CsrWifiSmeWepAuthMode) 0x00)
1406#define CSR_WIFI_SME_WEP_AUTH_MODE_SHARED ((CsrWifiSmeWepAuthMode) 0x01)
1407
1408/*******************************************************************************
1409
1410 NAME
1411 CsrWifiSmeWepCredentialType
1412
1413 DESCRIPTION
1414 Definition of types of WEP Credentials
1415
1416 VALUES
1417 CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64
1418 - WEP 64 credential
1419 CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128
1420 - WEP 128 credential
1421
1422*******************************************************************************/
1423typedef u8 CsrWifiSmeWepCredentialType;
1424#define CSR_WIFI_SME_CREDENTIAL_TYPE_WEP64 ((CsrWifiSmeWepCredentialType) 0x00)
1425#define CSR_WIFI_SME_CREDENTIAL_TYPE_WEP128 ((CsrWifiSmeWepCredentialType) 0x01)
1426
1427/*******************************************************************************
1428
1429 NAME
1430 CsrWifiSmeWmmMode
1431
1432 DESCRIPTION
1433 Defines bits for CsrWifiSmeWmmModeMask: enable/disable WMM features.
1434
1435 VALUES
1436 CSR_WIFI_SME_WMM_MODE_DISABLED - Disables the WMM features.
1437 CSR_WIFI_SME_WMM_MODE_AC_ENABLED - Enables support for WMM-AC.
1438 CSR_WIFI_SME_WMM_MODE_PS_ENABLED - Enables support for WMM Power Save.
1439 CSR_WIFI_SME_WMM_MODE_SA_ENABLED - Currently not supported
1440 CSR_WIFI_SME_WMM_MODE_ENABLED - Enables support for all currently
1441 available WMM features.
1442
1443*******************************************************************************/
1444typedef u8 CsrWifiSmeWmmMode;
1445#define CSR_WIFI_SME_WMM_MODE_DISABLED ((CsrWifiSmeWmmMode) 0x00)
1446#define CSR_WIFI_SME_WMM_MODE_AC_ENABLED ((CsrWifiSmeWmmMode) 0x01)
1447#define CSR_WIFI_SME_WMM_MODE_PS_ENABLED ((CsrWifiSmeWmmMode) 0x02)
1448#define CSR_WIFI_SME_WMM_MODE_SA_ENABLED ((CsrWifiSmeWmmMode) 0x04)
1449#define CSR_WIFI_SME_WMM_MODE_ENABLED ((CsrWifiSmeWmmMode) 0xFF)
1450
1451/*******************************************************************************
1452
1453 NAME
1454 CsrWifiSmeWmmQosInfo
1455
1456 DESCRIPTION
1457 Defines bits for the QoS Info Octect as defined in the WMM specification.
1458 The first four values define one bit each that can be set or cleared.
1459 Each of the last four values define all the remaining 4 bits and only one
1460 of them at the time shall be used.
1461 For more information, see 'WMM (including WMM Power Save) Specification -
1462 Version 1.1' and 'UniFi Configuring WMM and WMM-PS, Application Note'.
1463
1464 VALUES
1465 CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_ALL
1466 - WMM AP may deliver all buffered frames
1467 CSR_WIFI_SME_WMM_QOS_INFO_AC_VO
1468 - Enable UAPSD(both trigger and delivery) for Voice Access
1469 Category
1470 CSR_WIFI_SME_WMM_QOS_INFO_AC_VI
1471 - Enable UAPSD(both trigger and delivery) for Video Access
1472 Category
1473 CSR_WIFI_SME_WMM_QOS_INFO_AC_BK
1474 - Enable UAPSD(both trigger and delivery) for Background
1475 Access Category
1476 CSR_WIFI_SME_WMM_QOS_INFO_AC_BE
1477 - Enable UAPSD(both trigger and delivery) for Best Effort
1478 Access Category
1479 CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_TWO
1480 - WMM AP may deliver a maximum of 2 buffered frames (MSDUs
1481 and MMPDUs) per USP
1482 CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_FOUR
1483 - WMM AP may deliver a maximum of 4 buffered frames (MSDUs
1484 and MMPDUs) per USP
1485 CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_SIX
1486 - WMM AP may deliver a maximum of 6 buffered frames (MSDUs
1487 and MMPDUs) per USP
1488
1489*******************************************************************************/
1490typedef u8 CsrWifiSmeWmmQosInfo;
1491#define CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_ALL ((CsrWifiSmeWmmQosInfo) 0x00)
1492#define CSR_WIFI_SME_WMM_QOS_INFO_AC_VO ((CsrWifiSmeWmmQosInfo) 0x01)
1493#define CSR_WIFI_SME_WMM_QOS_INFO_AC_VI ((CsrWifiSmeWmmQosInfo) 0x02)
1494#define CSR_WIFI_SME_WMM_QOS_INFO_AC_BK ((CsrWifiSmeWmmQosInfo) 0x04)
1495#define CSR_WIFI_SME_WMM_QOS_INFO_AC_BE ((CsrWifiSmeWmmQosInfo) 0x08)
1496#define CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_TWO ((CsrWifiSmeWmmQosInfo) 0x20)
1497#define CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_FOUR ((CsrWifiSmeWmmQosInfo) 0x40)
1498#define CSR_WIFI_SME_WMM_QOS_INFO_AC_MAX_SP_SIX ((CsrWifiSmeWmmQosInfo) 0x60)
1499
1500/*******************************************************************************
1501
1502 NAME
1503 CsrWifiSmeWpsConfigType
1504
1505 DESCRIPTION
1506 WPS config methods supported/used by a device
1507
1508 VALUES
1509 CSR_WIFI_WPS_CONFIG_LABEL
1510 - Label
1511 CSR_WIFI_WPS_CONFIG_DISPLAY
1512 - Display
1513 CSR_WIFI_WPS_CONFIG_EXT_NFC
1514 - External NFC : Not supported in this release
1515 CSR_WIFI_WPS_CONFIG_INT_NFC
1516 - Internal NFC : Not supported in this release
1517 CSR_WIFI_WPS_CONFIG_NFC_IFACE
1518 - NFC interface : Not supported in this release
1519 CSR_WIFI_WPS_CONFIG_PBC
1520 - PBC
1521 CSR_WIFI_WPS_CONFIG_KEYPAD
1522 - KeyPad
1523 CSR_WIFI_WPS_CONFIG_VIRTUAL_PBC
1524 - PBC through software user interface
1525 CSR_WIFI_WPS_CONFIG_PHYSICAL_PBC
1526 - Physical PBC
1527 CSR_WIFI_WPS_CONFIG_VIRTUAL_DISPLAY
1528 - Virtual Display : via html config page etc
1529 CSR_WIFI_WPS_CONFIG_PHYSICAL_DISPLAY
1530 - Physical Display : Attached to the device
1531
1532*******************************************************************************/
1533typedef u16 CsrWifiSmeWpsConfigType;
1534#define CSR_WIFI_WPS_CONFIG_LABEL ((CsrWifiSmeWpsConfigType) 0x0004)
1535#define CSR_WIFI_WPS_CONFIG_DISPLAY ((CsrWifiSmeWpsConfigType) 0x0008)
1536#define CSR_WIFI_WPS_CONFIG_EXT_NFC ((CsrWifiSmeWpsConfigType) 0x0010)
1537#define CSR_WIFI_WPS_CONFIG_INT_NFC ((CsrWifiSmeWpsConfigType) 0x0020)
1538#define CSR_WIFI_WPS_CONFIG_NFC_IFACE ((CsrWifiSmeWpsConfigType) 0x0040)
1539#define CSR_WIFI_WPS_CONFIG_PBC ((CsrWifiSmeWpsConfigType) 0x0080)
1540#define CSR_WIFI_WPS_CONFIG_KEYPAD ((CsrWifiSmeWpsConfigType) 0x0100)
1541#define CSR_WIFI_WPS_CONFIG_VIRTUAL_PBC ((CsrWifiSmeWpsConfigType) 0x0280)
1542#define CSR_WIFI_WPS_CONFIG_PHYSICAL_PBC ((CsrWifiSmeWpsConfigType) 0x0480)
1543#define CSR_WIFI_WPS_CONFIG_VIRTUAL_DISPLAY ((CsrWifiSmeWpsConfigType) 0x2008)
1544#define CSR_WIFI_WPS_CONFIG_PHYSICAL_DISPLAY ((CsrWifiSmeWpsConfigType) 0x4008)
1545
1546/*******************************************************************************
1547
1548 NAME
1549 CsrWifiSmeWpsDeviceCategory
1550
1551 DESCRIPTION
1552 Wps Primary Device Types
1553
1554 VALUES
1555 CSR_WIFI_SME_WPS_CATEGORY_UNSPECIFIED
1556 - Unspecified.
1557 CSR_WIFI_SME_WPS_CATEGORY_COMPUTER
1558 - Computer.
1559 CSR_WIFI_SME_WPS_CATEGORY_INPUT_DEV
1560 - Input device
1561 CSR_WIFI_SME_WPS_CATEGORY_PRT_SCAN_FX_CP
1562 - Printer Scanner Fax Copier etc
1563 CSR_WIFI_SME_WPS_CATEGORY_CAMERA
1564 - Camera
1565 CSR_WIFI_SME_WPS_CATEGORY_STORAGE
1566 - Storage
1567 CSR_WIFI_SME_WPS_CATEGORY_NET_INFRA
1568 - Net Infra
1569 CSR_WIFI_SME_WPS_CATEGORY_DISPLAY
1570 - Display
1571 CSR_WIFI_SME_WPS_CATEGORY_MULTIMEDIA
1572 - Multimedia
1573 CSR_WIFI_SME_WPS_CATEGORY_GAMING
1574 - Gaming.
1575 CSR_WIFI_SME_WPS_CATEGORY_TELEPHONE
1576 - Telephone.
1577 CSR_WIFI_SME_WPS_CATEGORY_AUDIO
1578 - Audio
1579 CSR_WIFI_SME_WPS_CATEOARY_OTHERS
1580 - Others.
1581
1582*******************************************************************************/
1583typedef u8 CsrWifiSmeWpsDeviceCategory;
1584#define CSR_WIFI_SME_WPS_CATEGORY_UNSPECIFIED ((CsrWifiSmeWpsDeviceCategory) 0x00)
1585#define CSR_WIFI_SME_WPS_CATEGORY_COMPUTER ((CsrWifiSmeWpsDeviceCategory) 0x01)
1586#define CSR_WIFI_SME_WPS_CATEGORY_INPUT_DEV ((CsrWifiSmeWpsDeviceCategory) 0x02)
1587#define CSR_WIFI_SME_WPS_CATEGORY_PRT_SCAN_FX_CP ((CsrWifiSmeWpsDeviceCategory) 0x03)
1588#define CSR_WIFI_SME_WPS_CATEGORY_CAMERA ((CsrWifiSmeWpsDeviceCategory) 0x04)
1589#define CSR_WIFI_SME_WPS_CATEGORY_STORAGE ((CsrWifiSmeWpsDeviceCategory) 0x05)
1590#define CSR_WIFI_SME_WPS_CATEGORY_NET_INFRA ((CsrWifiSmeWpsDeviceCategory) 0x06)
1591#define CSR_WIFI_SME_WPS_CATEGORY_DISPLAY ((CsrWifiSmeWpsDeviceCategory) 0x07)
1592#define CSR_WIFI_SME_WPS_CATEGORY_MULTIMEDIA ((CsrWifiSmeWpsDeviceCategory) 0x08)
1593#define CSR_WIFI_SME_WPS_CATEGORY_GAMING ((CsrWifiSmeWpsDeviceCategory) 0x09)
1594#define CSR_WIFI_SME_WPS_CATEGORY_TELEPHONE ((CsrWifiSmeWpsDeviceCategory) 0x0A)
1595#define CSR_WIFI_SME_WPS_CATEGORY_AUDIO ((CsrWifiSmeWpsDeviceCategory) 0x0B)
1596#define CSR_WIFI_SME_WPS_CATEOARY_OTHERS ((CsrWifiSmeWpsDeviceCategory) 0xFF)
1597
1598/*******************************************************************************
1599
1600 NAME
1601 CsrWifiSmeWpsDeviceSubCategory
1602
1603 DESCRIPTION
1604 Wps Secondary Device Types
1605
1606 VALUES
1607 CSR_WIFI_SME_WPS_SUB_CATEGORY_UNSPECIFIED
1608 - Unspecied
1609 CSR_WIFI_SME_WPS_STORAGE_SUB_CATEGORY_NAS
1610 - Network Associated Storage
1611 CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_PRNTR
1612 - Printer or print server
1613 CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_WM
1614 - Windows mobile
1615 CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_TUNER
1616 - Audio tuner/receiver
1617 CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_DIG_STL
1618 - Digital still camera
1619 CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_AP
1620 - Access Point
1621 CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_TV
1622 - TV.
1623 CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_DAR
1624 - DAR.
1625 CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_KEYBD
1626 - Keyboard.
1627 CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_PC
1628 - PC.
1629 CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_XBOX
1630 - Xbox.
1631 CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_SCNR
1632 - Scanner
1633 CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_SERVER
1634 - Server
1635 CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_ROUTER
1636 - Router
1637 CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_PVR
1638 - PVR
1639 CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_SPEAKER
1640 - Speaker
1641 CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_FP_SM
1642 - Feature phone - Single mode
1643 CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_VIDEO
1644 - Video camera
1645 CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_PIC_FRM
1646 - Picture frame
1647 CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_XBOX_360
1648 - Xbox360
1649 CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_MOUSE
1650 - Mouse
1651 CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_SWITCH
1652 - Switch
1653 CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_PMP
1654 - Portable music player
1655 CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_JOYSTK
1656 - Joy stick
1657 CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_PLAY_STN
1658 - Play-station
1659 CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_MED_CENT
1660 - Media Center
1661 CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_MCX
1662 - MCX
1663 CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_FP_DM
1664 - Feature phone - Dual mode
1665 CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_WEB
1666 - Web camera
1667 CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_FAX
1668 - Fax
1669 CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_PROJECTOR
1670 - Projector
1671 CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_TRKBL
1672 - Track Ball
1673 CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_ST_BOX
1674 - Set-Top-Box
1675 CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_GATEWAY
1676 - GateWay.
1677 CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_SECURITY
1678 - Security camera
1679 CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_ULTRA_MOB_PC
1680 - Ultra mobile PC.
1681 CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_CONSOLE
1682 - Game console/Game console adapter
1683 CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_CPR
1684 - Copier
1685 CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_HEADSET
1686 - Headset(headphones + microphone)
1687 CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_SP_SM
1688 - Smart phone - Single mode
1689 CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_MONITOR
1690 - Monitor.
1691 CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_GAME_CTRL
1692 - Game control.
1693 CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_ALL
1694 - All-in-One
1695 CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_MEDIA
1696 - Media Server/Media Adapter/Media Extender
1697 CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_SP_DM
1698 - Smart phone - Dual mode
1699 CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_PORT_DEV
1700 - Portable gaming device
1701 CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_HEADPHONE
1702 - Headphone.
1703 CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_NOTEBOOK
1704 - Notebook.
1705 CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_REMOTE
1706 - Remote control
1707 CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_MIC
1708 - Microphone
1709 CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_DESKTOP
1710 - Desktop.
1711 CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_VP
1712 - Portable video player
1713 CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_MID
1714 - Mobile internet device
1715 CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_TOUCH_SCRN
1716 - Touch screen
1717 CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_BIOMET_RDR
1718 - Biometric reader
1719 CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_NETBOOK
1720 - Netbook
1721 CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_BRCD_RDR
1722 - Bar code reader.
1723
1724*******************************************************************************/
1725typedef u8 CsrWifiSmeWpsDeviceSubCategory;
1726#define CSR_WIFI_SME_WPS_SUB_CATEGORY_UNSPECIFIED ((CsrWifiSmeWpsDeviceSubCategory) 0x00)
1727#define CSR_WIFI_SME_WPS_STORAGE_SUB_CATEGORY_NAS ((CsrWifiSmeWpsDeviceSubCategory) 0x01)
1728#define CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_PRNTR ((CsrWifiSmeWpsDeviceSubCategory) 0x01)
1729#define CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_WM ((CsrWifiSmeWpsDeviceSubCategory) 0x01)
1730#define CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_TUNER ((CsrWifiSmeWpsDeviceSubCategory) 0x01)
1731#define CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_DIG_STL ((CsrWifiSmeWpsDeviceSubCategory) 0x01)
1732#define CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_AP ((CsrWifiSmeWpsDeviceSubCategory) 0x01)
1733#define CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_TV ((CsrWifiSmeWpsDeviceSubCategory) 0x01)
1734#define CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_DAR ((CsrWifiSmeWpsDeviceSubCategory) 0x01)
1735#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_KEYBD ((CsrWifiSmeWpsDeviceSubCategory) 0x01)
1736#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_PC ((CsrWifiSmeWpsDeviceSubCategory) 0x01)
1737#define CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_XBOX ((CsrWifiSmeWpsDeviceSubCategory) 0x01)
1738#define CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_SCNR ((CsrWifiSmeWpsDeviceSubCategory) 0x02)
1739#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_SERVER ((CsrWifiSmeWpsDeviceSubCategory) 0x02)
1740#define CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_ROUTER ((CsrWifiSmeWpsDeviceSubCategory) 0x02)
1741#define CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_PVR ((CsrWifiSmeWpsDeviceSubCategory) 0x02)
1742#define CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_SPEAKER ((CsrWifiSmeWpsDeviceSubCategory) 0x02)
1743#define CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_FP_SM ((CsrWifiSmeWpsDeviceSubCategory) 0x02)
1744#define CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_VIDEO ((CsrWifiSmeWpsDeviceSubCategory) 0x02)
1745#define CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_PIC_FRM ((CsrWifiSmeWpsDeviceSubCategory) 0x02)
1746#define CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_XBOX_360 ((CsrWifiSmeWpsDeviceSubCategory) 0x02)
1747#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_MOUSE ((CsrWifiSmeWpsDeviceSubCategory) 0x02)
1748#define CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_SWITCH ((CsrWifiSmeWpsDeviceSubCategory) 0x03)
1749#define CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_PMP ((CsrWifiSmeWpsDeviceSubCategory) 0x03)
1750#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_JOYSTK ((CsrWifiSmeWpsDeviceSubCategory) 0x03)
1751#define CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_PLAY_STN ((CsrWifiSmeWpsDeviceSubCategory) 0x03)
1752#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_MED_CENT ((CsrWifiSmeWpsDeviceSubCategory) 0x03)
1753#define CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_MCX ((CsrWifiSmeWpsDeviceSubCategory) 0x03)
1754#define CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_FP_DM ((CsrWifiSmeWpsDeviceSubCategory) 0x03)
1755#define CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_WEB ((CsrWifiSmeWpsDeviceSubCategory) 0x03)
1756#define CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_FAX ((CsrWifiSmeWpsDeviceSubCategory) 0x03)
1757#define CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_PROJECTOR ((CsrWifiSmeWpsDeviceSubCategory) 0x03)
1758#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_TRKBL ((CsrWifiSmeWpsDeviceSubCategory) 0x04)
1759#define CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_ST_BOX ((CsrWifiSmeWpsDeviceSubCategory) 0x04)
1760#define CSR_WIFI_SME_WPS_NET_INFRA_SUB_CATEGORY_GATEWAY ((CsrWifiSmeWpsDeviceSubCategory) 0x04)
1761#define CSR_WIFI_SME_WPS_CAMERA_SUB_CATEGORY_SECURITY ((CsrWifiSmeWpsDeviceSubCategory) 0x04)
1762#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_ULTRA_MOB_PC ((CsrWifiSmeWpsDeviceSubCategory) 0x04)
1763#define CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_CONSOLE ((CsrWifiSmeWpsDeviceSubCategory) 0x04)
1764#define CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_CPR ((CsrWifiSmeWpsDeviceSubCategory) 0x04)
1765#define CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_HEADSET ((CsrWifiSmeWpsDeviceSubCategory) 0x04)
1766#define CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_SP_SM ((CsrWifiSmeWpsDeviceSubCategory) 0x04)
1767#define CSR_WIFI_SME_WPS_DISPLAY_SUB_CATEGORY_MONITOR ((CsrWifiSmeWpsDeviceSubCategory) 0x04)
1768#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_GAME_CTRL ((CsrWifiSmeWpsDeviceSubCategory) 0x05)
1769#define CSR_WIFI_SME_WPS_PSFC_SUB_CATEGORY_ALL ((CsrWifiSmeWpsDeviceSubCategory) 0x05)
1770#define CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_MEDIA ((CsrWifiSmeWpsDeviceSubCategory) 0x05)
1771#define CSR_WIFI_SME_WPS_TELEPHONE_SUB_CATEGORY_SP_DM ((CsrWifiSmeWpsDeviceSubCategory) 0x05)
1772#define CSR_WIFI_SME_WPS_GAMING_SUB_CATEGORY_PORT_DEV ((CsrWifiSmeWpsDeviceSubCategory) 0x05)
1773#define CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_HEADPHONE ((CsrWifiSmeWpsDeviceSubCategory) 0x05)
1774#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_NOTEBOOK ((CsrWifiSmeWpsDeviceSubCategory) 0x05)
1775#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_REMOTE ((CsrWifiSmeWpsDeviceSubCategory) 0x06)
1776#define CSR_WIFI_SME_WPS_AUDIO_SUB_CATEGORY_MIC ((CsrWifiSmeWpsDeviceSubCategory) 0x06)
1777#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_DESKTOP ((CsrWifiSmeWpsDeviceSubCategory) 0x06)
1778#define CSR_WIFI_SME_WPS_MM_SUB_CATEGORY_VP ((CsrWifiSmeWpsDeviceSubCategory) 0x06)
1779#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_MID ((CsrWifiSmeWpsDeviceSubCategory) 0x07)
1780#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_TOUCH_SCRN ((CsrWifiSmeWpsDeviceSubCategory) 0x07)
1781#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_BIOMET_RDR ((CsrWifiSmeWpsDeviceSubCategory) 0x08)
1782#define CSR_WIFI_SME_WPS_COMPUTER_SUB_CATEGORY_NETBOOK ((CsrWifiSmeWpsDeviceSubCategory) 0x08)
1783#define CSR_WIFI_SME_WPS_INPUT_DEV_SUB_CATEGORY_BRCD_RDR ((CsrWifiSmeWpsDeviceSubCategory) 0x09)
1784
1785/*******************************************************************************
1786
1787 NAME
1788 CsrWifiSmeWpsDpid
1789
1790 DESCRIPTION
1791 Device Password ID for the chosen config method
1792
1793 VALUES
1794 CSR_WIFI_SME_WPS_DPID_PIN - PIN
1795 CSR_WIFI_SME_WPS_DPID_USER - User specified : Used only during P2P GO
1796 negotiation procedure
1797 CSR_WIFI_SME_WPS_DPID_MACHINE - Machine specified i: Not used in this
1798 release
1799 CSR_WIFI_SME_WPS_DPID_REKEY - Rekey : Not used in this release
1800 CSR_WIFI_SME_WPS_DPID_PBC - PBC
1801 CSR_WIFI_SME_WPS_DPID_REGISTRAR - Registrar specified : Used only in P2P Go
1802 negotiation procedure
1803
1804*******************************************************************************/
1805typedef u16 CsrWifiSmeWpsDpid;
1806#define CSR_WIFI_SME_WPS_DPID_PIN ((CsrWifiSmeWpsDpid) 0x0000)
1807#define CSR_WIFI_SME_WPS_DPID_USER ((CsrWifiSmeWpsDpid) 0x0001)
1808#define CSR_WIFI_SME_WPS_DPID_MACHINE ((CsrWifiSmeWpsDpid) 0x0002)
1809#define CSR_WIFI_SME_WPS_DPID_REKEY ((CsrWifiSmeWpsDpid) 0x0003)
1810#define CSR_WIFI_SME_WPS_DPID_PBC ((CsrWifiSmeWpsDpid) 0x0004)
1811#define CSR_WIFI_SME_WPS_DPID_REGISTRAR ((CsrWifiSmeWpsDpid) 0x0005)
1812
1813/*******************************************************************************
1814
1815 NAME
1816 CsrWifiSmeWpsRegistration
1817
1818 DESCRIPTION
1819
1820 VALUES
1821 CSR_WIFI_SME_WPS_REG_NOT_REQUIRED - No encryption set
1822 CSR_WIFI_SME_WPS_REG_REQUIRED - No encryption set
1823 CSR_WIFI_SME_WPS_REG_UNKNOWN - No encryption set
1824
1825*******************************************************************************/
1826typedef u8 CsrWifiSmeWpsRegistration;
1827#define CSR_WIFI_SME_WPS_REG_NOT_REQUIRED ((CsrWifiSmeWpsRegistration) 0x00)
1828#define CSR_WIFI_SME_WPS_REG_REQUIRED ((CsrWifiSmeWpsRegistration) 0x01)
1829#define CSR_WIFI_SME_WPS_REG_UNKNOWN ((CsrWifiSmeWpsRegistration) 0x02)
1830
1831
1832/*******************************************************************************
1833
1834 NAME
1835 CsrWifiSmeAuthModeMask
1836
1837 DESCRIPTION
1838 Mask type for use with the values defined by CsrWifiSmeAuthMode
1839
1840*******************************************************************************/
1841typedef u16 CsrWifiSmeAuthModeMask;
1842/*******************************************************************************
1843
1844 NAME
1845 CsrWifiSmeEncryptionMask
1846
1847 DESCRIPTION
1848 Mask type for use with the values defined by CsrWifiSmeEncryption
1849
1850*******************************************************************************/
1851typedef u16 CsrWifiSmeEncryptionMask;
1852/*******************************************************************************
1853
1854 NAME
1855 CsrWifiSmeIndicationsMask
1856
1857 DESCRIPTION
1858 Mask type for use with the values defined by CsrWifiSmeIndications
1859
1860*******************************************************************************/
1861typedef u32 CsrWifiSmeIndicationsMask;
1862/*******************************************************************************
1863
1864 NAME
1865 CsrWifiSmeP2pCapabilityMask
1866
1867 DESCRIPTION
1868 Mask type for use with the values defined by CsrWifiSmeP2pCapability
1869
1870*******************************************************************************/
1871typedef u8 CsrWifiSmeP2pCapabilityMask;
1872/*******************************************************************************
1873
1874 NAME
1875 CsrWifiSmeP2pGroupCapabilityMask
1876
1877 DESCRIPTION
1878 Mask type for use with the values defined by CsrWifiSmeP2pGroupCapability
1879
1880*******************************************************************************/
1881typedef u8 CsrWifiSmeP2pGroupCapabilityMask;
1882/*******************************************************************************
1883
1884 NAME
1885 CsrWifiSmeTspecCtrlMask
1886
1887 DESCRIPTION
1888 Mask type for use with the values defined by CsrWifiSmeTspecCtrl
1889
1890*******************************************************************************/
1891typedef u8 CsrWifiSmeTspecCtrlMask;
1892/*******************************************************************************
1893
1894 NAME
1895 CsrWifiSmeWmmModeMask
1896
1897 DESCRIPTION
1898 Mask type for use with the values defined by CsrWifiSmeWmmMode
1899
1900*******************************************************************************/
1901typedef u8 CsrWifiSmeWmmModeMask;
1902/*******************************************************************************
1903
1904 NAME
1905 CsrWifiSmeWmmQosInfoMask
1906
1907 DESCRIPTION
1908 Mask type for use with the values defined by CsrWifiSmeWmmQosInfo
1909
1910*******************************************************************************/
1911typedef u8 CsrWifiSmeWmmQosInfoMask;
1912/*******************************************************************************
1913
1914 NAME
1915 CsrWifiSmeWpsConfigTypeMask
1916
1917 DESCRIPTION
1918 Mask type for use with the values defined by CsrWifiSmeWpsConfigType
1919
1920*******************************************************************************/
1921typedef u16 CsrWifiSmeWpsConfigTypeMask;
1922
1923
1924/*******************************************************************************
1925
1926 NAME
1927 CsrWifiSmeAdHocConfig
1928
1929 DESCRIPTION
1930 Defines values to use when starting an Ad-hoc (IBSS) network.
1931
1932 MEMBERS
1933 atimWindowTu - ATIM window specified for IBSS
1934 beaconPeriodTu - Interval between beacon packets
1935 joinOnlyAttempts - Maximum number of attempts to join an ad-hoc network.
1936 The default value is 1.
1937 Set to 0 for infinite attempts.
1938 joinAttemptIntervalMs - Time between scans for joining the requested IBSS.
1939
1940*******************************************************************************/
1941typedef struct
1942{
1943 u16 atimWindowTu;
1944 u16 beaconPeriodTu;
1945 u16 joinOnlyAttempts;
1946 u16 joinAttemptIntervalMs;
1947} CsrWifiSmeAdHocConfig;
1948
1949/*******************************************************************************
1950
1951 NAME
1952 CsrWifiSmeAvailabilityConfig
1953
1954 DESCRIPTION
1955
1956 MEMBERS
1957 listenChannel -
1958 availabilityDuration -
1959 avalabilityPeriod -
1960
1961*******************************************************************************/
1962typedef struct
1963{
1964 u8 listenChannel;
1965 u16 availabilityDuration;
1966 u16 avalabilityPeriod;
1967} CsrWifiSmeAvailabilityConfig;
1968
1969/*******************************************************************************
1970
1971 NAME
1972 CsrWifiSmeCcxConfig
1973
1974 DESCRIPTION
1975 This type is reserved for future use and should not be used.
1976
1977 MEMBERS
1978 keepAliveTimeMs - NOT USED
1979 apRoamingEnabled - NOT USED
1980 measurementsMask - NOT USED
1981 ccxRadioMgtEnabled - NOT USED
1982
1983*******************************************************************************/
1984typedef struct
1985{
1986 u8 keepAliveTimeMs;
1987 u8 apRoamingEnabled;
1988 u8 measurementsMask;
1989 u8 ccxRadioMgtEnabled;
1990} CsrWifiSmeCcxConfig;
1991
1992/*******************************************************************************
1993
1994 NAME
1995 CsrWifiSmeCoexConfig
1996
1997 DESCRIPTION
1998 Parameters for the coexistence behaviour.
1999
2000 MEMBERS
2001 coexEnableSchemeManagement - Enables the Coexistence Management Scheme
2002 coexPeriodicWakeHost - If TRUE the firmware wakes up the host
2003 periodically according to the traffic
2004 period and latency parameters; the host
2005 will then send the data to transmit only
2006 when woken up.
2007 If FALSE, the firmware does not wake up the
2008 host and the host will send the data to
2009 transmit to the firmware whenever there is
2010 data to transmit
2011 coexTrafficBurstyLatencyMs - Period of awakening for the firmware used
2012 when bursty traffic is detected
2013 coexTrafficContinuousLatencyMs - Period of awakening for the firmware used
2014 when continuous traffic is detected
2015 coexObexBlackoutDurationMs - Blackout Duration when a Obex Connection is
2016 used
2017 coexObexBlackoutPeriodMs - Blackout Period when a Obex Connection is
2018 used
2019 coexA2dpBrBlackoutDurationMs - Blackout Duration when a Basic Rate A2DP
2020 Connection streaming data
2021 coexA2dpBrBlackoutPeriodMs - Blackout Period when a Basic Rate A2DP
2022 Connection streaming data
2023 coexA2dpEdrBlackoutDurationMs - Blackout Duration when an Enhanced Data
2024 Rate A2DP Connection streaming data
2025 coexA2dpEdrBlackoutPeriodMs - Blackout Period when an Enhanced Data Rate
2026 A2DP Connection streaming data
2027 coexPagingBlackoutDurationMs - Blackout Duration when a BT page is active
2028 coexPagingBlackoutPeriodMs - Blackout Period when a BT page is active
2029 coexInquiryBlackoutDurationMs - Blackout Duration when a BT inquiry is
2030 active
2031 coexInquiryBlackoutPeriodMs - Blackout Period when a BT inquiry is active
2032
2033*******************************************************************************/
2034typedef struct
2035{
2036 u8 coexEnableSchemeManagement;
2037 u8 coexPeriodicWakeHost;
2038 u16 coexTrafficBurstyLatencyMs;
2039 u16 coexTrafficContinuousLatencyMs;
2040 u16 coexObexBlackoutDurationMs;
2041 u16 coexObexBlackoutPeriodMs;
2042 u16 coexA2dpBrBlackoutDurationMs;
2043 u16 coexA2dpBrBlackoutPeriodMs;
2044 u16 coexA2dpEdrBlackoutDurationMs;
2045 u16 coexA2dpEdrBlackoutPeriodMs;
2046 u16 coexPagingBlackoutDurationMs;
2047 u16 coexPagingBlackoutPeriodMs;
2048 u16 coexInquiryBlackoutDurationMs;
2049 u16 coexInquiryBlackoutPeriodMs;
2050} CsrWifiSmeCoexConfig;
2051
2052/*******************************************************************************
2053
2054 NAME
2055 CsrWifiSmeConnectionStats
2056
2057 DESCRIPTION
2058 Indicates the statistics of the connection.
2059 The dot11 fields are defined in the Annex D of the IEEE 802.11 standard.
2060
2061 MEMBERS
2062 unifiTxDataRate
2063 - The bit rate currently in use for transmissions of unicast
2064 data frames; a data rate in units of 500kbit/s.
2065 On an infrastructure BSS, this is the data rate used in
2066 communicating with the associated access point; if there is
2067 none, an error is returned.
2068 On an IBSS, this is the data rate used for the last
2069 transmission of a unicast data frame to any station in the
2070 IBSS. If no such transmission has been made, an error is
2071 returned.
2072 unifiRxDataRate
2073 - As above for receiving data
2074 dot11RetryCount
2075 - See IEEE 802.11 Standard
2076 dot11MultipleRetryCount
2077 - See IEEE 802.11 Standard
2078 dot11AckFailureCount
2079 - See IEEE 802.11 Standard
2080 dot11FrameDuplicateCount
2081 - See IEEE 802.11 Standard
2082 dot11FcsErrorCount
2083 - See IEEE 802.11 Standard
2084 dot11RtsSuccessCount
2085 - See IEEE 802.11 Standard
2086 dot11RtsFailureCount
2087 - See IEEE 802.11 Standard
2088 dot11FailedCount
2089 - See IEEE 802.11 Standard
2090 dot11TransmittedFragmentCount
2091 - See IEEE 802.11 Standard
2092 dot11TransmittedFrameCount
2093 - See IEEE 802.11 Standard
2094 dot11WepExcludedCount
2095 - See IEEE 802.11 Standard
2096 dot11WepIcvErrorCount
2097 - See IEEE 802.11 Standard
2098 dot11WepUndecryptableCount
2099 - See IEEE 802.11 Standard
2100 dot11MulticastReceivedFrameCount
2101 - See IEEE 802.11 Standard
2102 dot11MulticastTransmittedFrameCount
2103 - See IEEE 802.11 Standard
2104 dot11ReceivedFragmentCount
2105 - See IEEE 802.11 Standard
2106 dot11Rsna4WayHandshakeFailures
2107 - See IEEE 802.11 Standard
2108 dot11RsnaTkipCounterMeasuresInvoked
2109 - See IEEE 802.11 Standard
2110 dot11RsnaStatsTkipLocalMicFailures
2111 - See IEEE 802.11 Standard
2112 dot11RsnaStatsTkipReplays
2113 - See IEEE 802.11 Standard
2114 dot11RsnaStatsTkipIcvErrors
2115 - See IEEE 802.11 Standard
2116 dot11RsnaStatsCcmpReplays
2117 - See IEEE 802.11 Standard
2118 dot11RsnaStatsCcmpDecryptErrors
2119 - See IEEE 802.11 Standard
2120
2121*******************************************************************************/
2122typedef struct
2123{
2124 u8 unifiTxDataRate;
2125 u8 unifiRxDataRate;
2126 u32 dot11RetryCount;
2127 u32 dot11MultipleRetryCount;
2128 u32 dot11AckFailureCount;
2129 u32 dot11FrameDuplicateCount;
2130 u32 dot11FcsErrorCount;
2131 u32 dot11RtsSuccessCount;
2132 u32 dot11RtsFailureCount;
2133 u32 dot11FailedCount;
2134 u32 dot11TransmittedFragmentCount;
2135 u32 dot11TransmittedFrameCount;
2136 u32 dot11WepExcludedCount;
2137 u32 dot11WepIcvErrorCount;
2138 u32 dot11WepUndecryptableCount;
2139 u32 dot11MulticastReceivedFrameCount;
2140 u32 dot11MulticastTransmittedFrameCount;
2141 u32 dot11ReceivedFragmentCount;
2142 u32 dot11Rsna4WayHandshakeFailures;
2143 u32 dot11RsnaTkipCounterMeasuresInvoked;
2144 u32 dot11RsnaStatsTkipLocalMicFailures;
2145 u32 dot11RsnaStatsTkipReplays;
2146 u32 dot11RsnaStatsTkipIcvErrors;
2147 u32 dot11RsnaStatsCcmpReplays;
2148 u32 dot11RsnaStatsCcmpDecryptErrors;
2149} CsrWifiSmeConnectionStats;
2150
2151/*******************************************************************************
2152
2153 NAME
2154 CsrWifiSmeDataBlock
2155
2156 DESCRIPTION
2157 Holds a generic data block to be passed through the interface
2158
2159 MEMBERS
2160 length - Length of the data block
2161 data - Points to the first byte of the data block
2162
2163*******************************************************************************/
2164typedef struct
2165{
2166 u16 length;
2167 u8 *data;
2168} CsrWifiSmeDataBlock;
2169
2170/*******************************************************************************
2171
2172 NAME
2173 CsrWifiSmeEmpty
2174
2175 DESCRIPTION
2176 Empty Structure to indicate that no parameters are available.
2177
2178 MEMBERS
2179 empty - Only element of the empty structure (always set to 0).
2180
2181*******************************************************************************/
2182typedef struct
2183{
2184 u8 empty;
2185} CsrWifiSmeEmpty;
2186
2187/*******************************************************************************
2188
2189 NAME
2190 CsrWifiSmeLinkQuality
2191
2192 DESCRIPTION
2193 Indicates the quality of the link
2194
2195 MEMBERS
2196 unifiRssi - Indicates the received signal strength indication of the link in
2197 dBm
2198 unifiSnr - Indicates the signal to noise ratio of the link in dB
2199
2200*******************************************************************************/
2201typedef struct
2202{
2203 s16 unifiRssi;
2204 s16 unifiSnr;
2205} CsrWifiSmeLinkQuality;
2206
2207/*******************************************************************************
2208
2209 NAME
2210 CsrWifiSmeMibConfig
2211
2212 DESCRIPTION
2213 Allows low level configuration in the chip.
2214
2215 MEMBERS
2216 unifiFixMaxTxDataRate - This attribute is used in combination with
2217 unifiFixTxDataRate. If it is FALSE, then
2218 unifiFixTxDataRate specifies a specific data
2219 rate to use. If it is TRUE, unifiFixTxDataRate
2220 instead specifies a maximum data rate.
2221 unifiFixTxDataRate - Transmit rate for unicast data.
2222 See MIB description for more details
2223 dot11RtsThreshold - See IEEE 802.11 Standard
2224 dot11FragmentationThreshold - See IEEE 802.11 Standard
2225 dot11CurrentTxPowerLevel - See IEEE 802.11 Standard
2226
2227*******************************************************************************/
2228typedef struct
2229{
2230 u8 unifiFixMaxTxDataRate;
2231 u8 unifiFixTxDataRate;
2232 u16 dot11RtsThreshold;
2233 u16 dot11FragmentationThreshold;
2234 u16 dot11CurrentTxPowerLevel;
2235} CsrWifiSmeMibConfig;
2236
2237/*******************************************************************************
2238
2239 NAME
2240 CsrWifiSmeP2pProfileIdentity
2241
2242 DESCRIPTION
2243 Details to be filled in
2244
2245 MEMBERS
2246 listenChannel -
2247 availabilityDuration -
2248 avalabilityPeriod -
2249
2250*******************************************************************************/
2251typedef struct
2252{
2253 u8 listenChannel;
2254 u16 availabilityDuration;
2255 u16 avalabilityPeriod;
2256} CsrWifiSmeP2pProfileIdentity;
2257
2258/*******************************************************************************
2259
2260 NAME
2261 CsrWifiSmePmkid
2262
2263 DESCRIPTION
2264 Defines a PMKID association with BSS
2265
2266 MEMBERS
2267 bssid - BSS identifier
2268 pmkid - PMKID
2269
2270*******************************************************************************/
2271typedef struct
2272{
2273 CsrWifiMacAddress bssid;
2274 u8 pmkid[16];
2275} CsrWifiSmePmkid;
2276
2277/*******************************************************************************
2278
2279 NAME
2280 CsrWifiSmePmkidCandidate
2281
2282 DESCRIPTION
2283 Information for a PMKID candidate
2284
2285 MEMBERS
2286 bssid - BSS identifier
2287 preAuthAllowed - Indicates whether preauthentication is allowed
2288
2289*******************************************************************************/
2290typedef struct
2291{
2292 CsrWifiMacAddress bssid;
2293 u8 preAuthAllowed;
2294} CsrWifiSmePmkidCandidate;
2295
2296/*******************************************************************************
2297
2298 NAME
2299 CsrWifiSmePmkidList
2300
2301 DESCRIPTION
2302 NOT USED
2303 Used in the Sync access API
2304
2305 MEMBERS
2306 pmkidsCount - Number of PMKIDs in the list
2307 pmkids - Points to the first PMKID in the list
2308
2309*******************************************************************************/
2310typedef struct
2311{
2312 u8 pmkidsCount;
2313 CsrWifiSmePmkid *pmkids;
2314} CsrWifiSmePmkidList;
2315
2316/*******************************************************************************
2317
2318 NAME
2319 CsrWifiSmeRegulatoryDomainInfo
2320
2321 DESCRIPTION
2322 Regulatory domain options.
2323
2324 MEMBERS
2325 dot11MultiDomainCapabilityImplemented
2326 - TRUE is the multi domain capability is implemented
2327 dot11MultiDomainCapabilityEnabled
2328 - TRUE is the multi domain capability is enabled
2329 currentRegulatoryDomain
2330 - Current regulatory domain
2331 currentCountryCode
2332 - Current country code as defined by the IEEE 802.11
2333 standards
2334
2335*******************************************************************************/
2336typedef struct
2337{
2338 u8 dot11MultiDomainCapabilityImplemented;
2339 u8 dot11MultiDomainCapabilityEnabled;
2340 CsrWifiSmeRegulatoryDomain currentRegulatoryDomain;
2341 u8 currentCountryCode[2];
2342} CsrWifiSmeRegulatoryDomainInfo;
2343
2344/*******************************************************************************
2345
2346 NAME
2347 CsrWifiSmeRoamingBandData
2348
2349 DESCRIPTION
2350 Thresholds to define one usability level category for the received signal
2351
2352 MEMBERS
2353 rssiHighThreshold - Received Signal Strength Indication upper bound in dBm
2354 for the usability level
2355 rssiLowThreshold - Received Signal Strength Indication lower bound in dBm
2356 for the usability level
2357 snrHighThreshold - Signal to Noise Ratio upper bound in dB for the
2358 usability level
2359 snrLowThreshold - Signal to Noise Ratio lower bound in dB for the
2360 usability level
2361
2362*******************************************************************************/
2363typedef struct
2364{
2365 s16 rssiHighThreshold;
2366 s16 rssiLowThreshold;
2367 s16 snrHighThreshold;
2368 s16 snrLowThreshold;
2369} CsrWifiSmeRoamingBandData;
2370
2371/*******************************************************************************
2372
2373 NAME
2374 CsrWifiSmeScanConfigData
2375
2376 DESCRIPTION
2377 Configures the scanning behaviour of the driver and firmware
2378
2379 MEMBERS
2380 intervalSeconds - All the channels will be scanned once in this time
2381 interval.
2382 If connected, the channel scans are spread across
2383 the interval.
2384 If disconnected, all the channels will be scanned
2385 together
2386 validitySeconds - How long the scan result are cached
2387 minActiveChannelTimeTu - Minimum time of listening on a channel being
2388 actively scanned before leaving if no probe
2389 responses or beacon frames have been received
2390 maxActiveChannelTimeTu - Maximum time of listening on a channel being
2391 actively scanned
2392 minPassiveChannelTimeTu - Minimum time of listening on a channel being
2393 passive scanned before leaving if no beacon frames
2394 have been received
2395 maxPassiveChannelTimeTu - Maximum time of listening on a channel being
2396 passively scanned
2397
2398*******************************************************************************/
2399typedef struct
2400{
2401 u16 intervalSeconds;
2402 u16 validitySeconds;
2403 u16 minActiveChannelTimeTu;
2404 u16 maxActiveChannelTimeTu;
2405 u16 minPassiveChannelTimeTu;
2406 u16 maxPassiveChannelTimeTu;
2407} CsrWifiSmeScanConfigData;
2408
2409/*******************************************************************************
2410
2411 NAME
2412 CsrWifiSmeTsfTime
2413
2414 DESCRIPTION
2415 Time stamp representation
2416
2417 MEMBERS
2418 data - TSF Bytes
2419
2420*******************************************************************************/
2421typedef struct
2422{
2423 u8 data[8];
2424} CsrWifiSmeTsfTime;
2425
2426/*******************************************************************************
2427
2428 NAME
2429 CsrWifiSmeVersions
2430
2431 DESCRIPTION
2432 Reports version information for the chip, the firmware and the driver and
2433 the SME.
2434
2435 MEMBERS
2436 chipId - Chip ID
2437 chipVersion - Chip version ID
2438 firmwareBuild - Firmware Rom build number
2439 firmwarePatch - Firmware Patch build number (if applicable)
2440 firmwareHip - Firmware HIP protocol version number
2441 routerBuild - Router build number
2442 routerHip - Router HIP protocol version number
2443 smeBuild - SME build number
2444 smeHip - SME HIP protocol version number
2445
2446*******************************************************************************/
2447typedef struct
2448{
2449 u32 chipId;
2450 u32 chipVersion;
2451 u32 firmwareBuild;
2452 u32 firmwarePatch;
2453 u32 firmwareHip;
2454 char *routerBuild;
2455 u32 routerHip;
2456 char *smeBuild;
2457 u32 smeHip;
2458} CsrWifiSmeVersions;
2459
2460/*******************************************************************************
2461
2462 NAME
2463 CsrWifiSmeWmmAcParams
2464
2465 DESCRIPTION
2466 Structure holding WMM AC params data.
2467
2468 MEMBERS
2469 cwMin - Exponent for the calculation of CWmin. Range: 0
2470 to 15
2471 cwMax - Exponent for the calculation of CWmax. Range: 0
2472 to15
2473 aifs - Arbitration Inter Frame Spacing in terms of
2474 number of timeslots. Range 2 to 15
2475 txopLimit - TXOP Limit in the units of 32 microseconds
2476 admissionControlMandatory - Indicates whether the admission control is
2477 mandatory or not. Current release does not
2478 support admission control , hence shall be set
2479 to FALSE.
2480
2481*******************************************************************************/
2482typedef struct
2483{
2484 u8 cwMin;
2485 u8 cwMax;
2486 u8 aifs;
2487 u16 txopLimit;
2488 u8 admissionControlMandatory;
2489} CsrWifiSmeWmmAcParams;
2490
2491/*******************************************************************************
2492
2493 NAME
2494 CsrWifiSmeWpsDeviceType
2495
2496 DESCRIPTION
2497 Structure holding AP WPS device type data.
2498
2499 MEMBERS
2500 deviceDetails - category , sub category etc
2501
2502*******************************************************************************/
2503typedef struct
2504{
2505 u8 deviceDetails[8];
2506} CsrWifiSmeWpsDeviceType;
2507
2508/*******************************************************************************
2509
2510 NAME
2511 CsrWifiSmeWpsDeviceTypeCommon
2512
2513 DESCRIPTION
2514
2515 MEMBERS
2516 spportWps -
2517 deviceType -
2518
2519*******************************************************************************/
2520typedef struct
2521{
2522 u8 spportWps;
2523 u8 deviceType;
2524} CsrWifiSmeWpsDeviceTypeCommon;
2525
2526/*******************************************************************************
2527
2528 NAME
2529 CsrWifiSmeWpsInfo
2530
2531 DESCRIPTION
2532
2533 MEMBERS
2534 version -
2535 configMethods -
2536 devicePassworId -
2537
2538*******************************************************************************/
2539typedef struct
2540{
2541 u16 version;
2542 u16 configMethods;
2543 u16 devicePassworId;
2544} CsrWifiSmeWpsInfo;
2545
2546/*******************************************************************************
2547
2548 NAME
2549 CsrWifiSmeCloakedSsidConfig
2550
2551 DESCRIPTION
2552 List of cloaked SSIDs .
2553
2554 MEMBERS
2555 cloakedSsidsCount - Number of cloaked SSID
2556 cloakedSsids - Points to the first byte of the first SSID provided
2557
2558*******************************************************************************/
2559typedef struct
2560{
2561 u8 cloakedSsidsCount;
2562 CsrWifiSsid *cloakedSsids;
2563} CsrWifiSmeCloakedSsidConfig;
2564
2565/*******************************************************************************
2566
2567 NAME
2568 CsrWifiSmeCoexInfo
2569
2570 DESCRIPTION
2571 Information and state related to coexistence.
2572
2573 MEMBERS
2574 hasTrafficData - TRUE if any Wi-Fi traffic is detected
2575 currentTrafficType - Current type of traffic
2576 currentPeriodMs - Period of the traffic as detected by the traffic
2577 analysis.
2578 If the traffic is not periodic, it is set to 0.
2579 currentPowerSave - Current power save level
2580 currentCoexPeriodMs - Period of awakening for the firmware used when
2581 periodic traffic is detected.
2582 If the traffic is not periodic, it is set to 0.
2583 currentCoexLatencyMs - Period of awakening for the firmware used when
2584 non-periodic traffic is detected
2585 hasBtDevice - TRUE if there is a Bluetooth device connected
2586 currentBlackoutDurationUs - Current blackout duration for protecting
2587 Bluetooth
2588 currentBlackoutPeriodUs - Current blackout period
2589 currentCoexScheme - Defines the scheme for the coexistence
2590 signalling
2591
2592*******************************************************************************/
2593typedef struct
2594{
2595 u8 hasTrafficData;
2596 CsrWifiSmeTrafficType currentTrafficType;
2597 u16 currentPeriodMs;
2598 CsrWifiSmePowerSaveLevel currentPowerSave;
2599 u16 currentCoexPeriodMs;
2600 u16 currentCoexLatencyMs;
2601 u8 hasBtDevice;
2602 u32 currentBlackoutDurationUs;
2603 u32 currentBlackoutPeriodUs;
2604 CsrWifiSmeCoexScheme currentCoexScheme;
2605} CsrWifiSmeCoexInfo;
2606
2607/*******************************************************************************
2608
2609 NAME
2610 CsrWifiSmeConnectionConfig
2611
2612 DESCRIPTION
2613 Specifies the parameters that the SME should use in selecting a network.
2614
2615 MEMBERS
2616 ssid
2617 - Service Set identifier
2618 bssid
2619 - BSS identifier
2620 bssType
2621 - Indicates the type of BSS
2622 ifIndex
2623 - Indicates the radio interface
2624 privacyMode
2625 - Specifies whether the privacy mode is enabled or disabled.
2626 authModeMask
2627 - Sets the authentication options that the SME can use while
2628 associating to the AP
2629 Set mask with values from CsrWifiSmeAuthMode
2630 encryptionModeMask
2631 - Sets the encryption options that the SME can use while
2632 associating to the AP
2633 Set mask with values from CsrWifiSmeEncryption
2634 mlmeAssociateReqInformationElementsLength
2635 - Length in bytes of information elements to be sent in the
2636 Association Request.
2637 mlmeAssociateReqInformationElements
2638 - Points to the first byte of the information elements, if
2639 any.
2640 wmmQosInfo
2641 - This parameter allows the driver's WMM behaviour to be
2642 configured.
2643 To enable support for WMM, use
2644 CSR_WIFI_SME_SME_CONFIG_SET_REQ with the
2645 CSR_WIFI_SME_WMM_MODE_AC_ENABLED bit set in wmmModeMask
2646 field in smeConfig parameter.
2647 Set mask with values from CsrWifiSmeWmmQosInfo
2648 adhocJoinOnly
2649 - This parameter is relevant only if bssType is NOT set to
2650 CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE:
2651 if TRUE the SME will only try to join an ad-hoc network if
2652 there is one already established;
2653 if FALSE the SME will try to join an ad-hoc network if
2654 there is one already established or it will try to
2655 establish a new one
2656 adhocChannel
2657 - This parameter is relevant only if bssType is NOT set to
2658 CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE:
2659 it indicates the channel to use joining an ad hoc network.
2660 Setting this to 0 causes the SME to select a channel from
2661 those permitted in the regulatory domain.
2662
2663*******************************************************************************/
2664typedef struct
2665{
2666 CsrWifiSsid ssid;
2667 CsrWifiMacAddress bssid;
2668 CsrWifiSmeBssType bssType;
2669 CsrWifiSmeRadioIF ifIndex;
2670 CsrWifiSme80211PrivacyMode privacyMode;
2671 CsrWifiSmeAuthModeMask authModeMask;
2672 CsrWifiSmeEncryptionMask encryptionModeMask;
2673 u16 mlmeAssociateReqInformationElementsLength;
2674 u8 *mlmeAssociateReqInformationElements;
2675 CsrWifiSmeWmmQosInfoMask wmmQosInfo;
2676 u8 adhocJoinOnly;
2677 u8 adhocChannel;
2678} CsrWifiSmeConnectionConfig;
2679
2680/*******************************************************************************
2681
2682 NAME
2683 CsrWifiSmeConnectionInfo
2684
2685 DESCRIPTION
2686 Parameters that the SME should use in selecting a network
2687
2688 MEMBERS
2689 ssid - Service set identifier
2690 bssid - BSS identifier
2691 networkType80211 - Physical layer used for the connection
2692 channelNumber - Channel number
2693 channelFrequency - Channel frequency
2694 authMode - Authentication mode used for the connection
2695 pairwiseCipher - Encryption type for peer to peer communication
2696 groupCipher - Encryption type for broadcast and multicast
2697 communication
2698 ifIndex - Indicates the radio interface
2699 atimWindowTu - ATIM window specified for IBSS
2700 beaconPeriodTu - Interval between beacon packets
2701 reassociation - Indicates whether a reassociation occurred
2702 beaconFrameLength - Indicates the number of bytes of the beacon
2703 frame
2704 beaconFrame - Points at the first byte of the beacon frame
2705 associationReqFrameLength - Indicates the number of bytes of the
2706 association request frame
2707 associationReqFrame - Points at the first byte of the association
2708 request frame
2709 associationRspFrameLength - Indicates the number of bytes of the
2710 association response frame
2711 associationRspFrame - Points at the first byte of the association
2712 response frame
2713 assocScanInfoElementsLength - Indicates the number of bytes in the buffer
2714 pointed by assocScanInfoElements
2715 assocScanInfoElements - Pointer to the buffer containing the
2716 information elements of the probe response
2717 received after the probe requests sent before
2718 attempting to authenticate to the network
2719 assocReqCapabilities - Reports the content of the Capability
2720 information element as specified in the
2721 association request.
2722 assocReqListenIntervalTu - Listen Interval specified in the association
2723 request
2724 assocReqApAddress - AP address to which the association requests
2725 has been sent
2726 assocReqInfoElementsLength - Indicates the number of bytes of the
2727 association request information elements
2728 assocReqInfoElements - Points at the first byte of the association
2729 request information elements
2730 assocRspResult - Result reported in the association response
2731 assocRspCapabilityInfo - Reports the content of the Capability
2732 information element as received in the
2733 association response.
2734 assocRspAssociationId - Reports the association ID received in the
2735 association response.
2736 assocRspInfoElementsLength - Indicates the number of bytes of the
2737 association response information elements
2738 assocRspInfoElements - Points at the first byte of the association
2739 response information elements
2740
2741*******************************************************************************/
2742typedef struct
2743{
2744 CsrWifiSsid ssid;
2745 CsrWifiMacAddress bssid;
2746 CsrWifiSme80211NetworkType networkType80211;
2747 u8 channelNumber;
2748 u16 channelFrequency;
2749 CsrWifiSmeAuthMode authMode;
2750 CsrWifiSmeEncryption pairwiseCipher;
2751 CsrWifiSmeEncryption groupCipher;
2752 CsrWifiSmeRadioIF ifIndex;
2753 u16 atimWindowTu;
2754 u16 beaconPeriodTu;
2755 u8 reassociation;
2756 u16 beaconFrameLength;
2757 u8 *beaconFrame;
2758 u16 associationReqFrameLength;
2759 u8 *associationReqFrame;
2760 u16 associationRspFrameLength;
2761 u8 *associationRspFrame;
2762 u16 assocScanInfoElementsLength;
2763 u8 *assocScanInfoElements;
2764 u16 assocReqCapabilities;
2765 u16 assocReqListenIntervalTu;
2766 CsrWifiMacAddress assocReqApAddress;
2767 u16 assocReqInfoElementsLength;
2768 u8 *assocReqInfoElements;
2769 CsrWifiSmeIEEE80211Result assocRspResult;
2770 u16 assocRspCapabilityInfo;
2771 u16 assocRspAssociationId;
2772 u16 assocRspInfoElementsLength;
2773 u8 *assocRspInfoElements;
2774} CsrWifiSmeConnectionInfo;
2775
2776/*******************************************************************************
2777
2778 NAME
2779 CsrWifiSmeDeviceConfig
2780
2781 DESCRIPTION
2782 General configuration options in the SME
2783
2784 MEMBERS
2785 trustLevel - Level of trust of the information coming from the
2786 network
2787 countryCode - Country code as specified by IEEE 802.11 standard
2788 firmwareDriverInterface - Specifies the type of communication between Host
2789 and Firmware
2790 enableStrictDraftN - If TRUE TKIP is disallowed when connecting to
2791 802.11n enabled access points
2792
2793*******************************************************************************/
2794typedef struct
2795{
2796 CsrWifiSme80211dTrustLevel trustLevel;
2797 u8 countryCode[2];
2798 CsrWifiSmeFirmwareDriverInterface firmwareDriverInterface;
2799 u8 enableStrictDraftN;
2800} CsrWifiSmeDeviceConfig;
2801
2802/*******************************************************************************
2803
2804 NAME
2805 CsrWifiSmeDeviceInfo
2806
2807 DESCRIPTION
2808 P2P Information for a P2P Device
2809
2810 MEMBERS
2811 deviceAddress - Device Address of the P2P device
2812 configMethods - Supported WPS configuration methods.
2813 p2PDeviceCap - P2P device capabilities
2814 primDeviceType - Primary WPS device type
2815 secondaryDeviceTypeCount - Number of secondary device types
2816 secDeviceType - list of secondary WPS device types
2817 deviceName - Device name without up to 32 characters'\0'.
2818 deviceNameLength - Number of characters of the device name
2819
2820*******************************************************************************/
2821typedef struct
2822{
2823 CsrWifiMacAddress deviceAddress;
2824 CsrWifiSmeWpsConfigTypeMask configMethods;
2825 CsrWifiSmeP2pCapabilityMask p2PDeviceCap;
2826 CsrWifiSmeWpsDeviceType primDeviceType;
2827 u8 secondaryDeviceTypeCount;
2828 CsrWifiSmeWpsDeviceType *secDeviceType;
2829 u8 deviceName[32];
2830 u8 deviceNameLength;
2831} CsrWifiSmeDeviceInfo;
2832
2833/*******************************************************************************
2834
2835 NAME
2836 CsrWifiSmeDeviceInfoCommon
2837
2838 DESCRIPTION
2839 Structure holding device information.
2840
2841 MEMBERS
2842 p2pDeviceAddress -
2843 primaryDeviceType -
2844 secondaryDeviceTypesCount -
2845 secondaryDeviceTypes -
2846 deviceNameLength -
2847 deviceName -
2848
2849*******************************************************************************/
2850typedef struct
2851{
2852 CsrWifiMacAddress p2pDeviceAddress;
2853 CsrWifiSmeWpsDeviceTypeCommon primaryDeviceType;
2854 u8 secondaryDeviceTypesCount;
2855 u8 secondaryDeviceTypes[10];
2856 u8 deviceNameLength;
2857 u8 deviceName[32];
2858} CsrWifiSmeDeviceInfoCommon;
2859
2860/*******************************************************************************
2861
2862 NAME
2863 CsrWifiSmeHostConfig
2864
2865 DESCRIPTION
2866 Defines the host power state (for example, on mains power, on battery
2867 power etc) and the periodicity of the traffic data.
2868
2869 MEMBERS
2870 powerMode - The wireless manager application should use the
2871 powerMode parameter to inform the SME of the host
2872 power state.
2873 applicationDataPeriodMs - The applicationDataPeriodMs parameter allows a
2874 wireless manager application to inform the SME
2875 that an application is running that generates
2876 periodic network traffic and the period of the
2877 traffic.
2878 An example of such an application is a VoIP client.
2879 The wireless manager application should set
2880 applicationDataPeriodMs to the period in
2881 milliseconds between data packets or zero if no
2882 periodic application is running.
2883 Voip etc 0 = No Periodic Data
2884
2885*******************************************************************************/
2886typedef struct
2887{
2888 CsrWifiSmeHostPowerMode powerMode;
2889 u16 applicationDataPeriodMs;
2890} CsrWifiSmeHostConfig;
2891
2892/*******************************************************************************
2893
2894 NAME
2895 CsrWifiSmeKey
2896
2897 DESCRIPTION
2898 Information for a key to be used for encryption
2899
2900 MEMBERS
2901 keyType - Specifies whether the key is a pairwise or group key; it
2902 should be set to CSR_WIFI_SME_GROUP_KEY or
2903 CSR_WIFI_SME_PAIRWISE_KEY, as required.
2904 keyIndex - Specifies which WEP key (0-3) to set; it should be set to 0
2905 for a WPA/WPA2 pairwise key and non-zero for a WPA/WPA2
2906 group key.
2907 wepTxKey - If wepTxKey is TRUE, and the key is a WEP key, the key will
2908 be selected for encrypting transmitted packets.
2909 To select a previously defined key as the transmit
2910 encryption key, set keyIndex to the required key, wepTxKey
2911 to TRUE and the keyLength to 0.
2912 keyRsc - Key Receive Sequence Counter
2913 authenticator - If TRUE the WMA will act as authenticator.
2914 CURRENTLY NOT SUPPORTED
2915 address - BSS identifier of the AP
2916 keyLength - Length of the key in bytes
2917 key - Points to the first byte of the key
2918
2919*******************************************************************************/
2920typedef struct
2921{
2922 CsrWifiSmeKeyType keyType;
2923 u8 keyIndex;
2924 u8 wepTxKey;
2925 u16 keyRsc[8];
2926 u8 authenticator;
2927 CsrWifiMacAddress address;
2928 u8 keyLength;
2929 u8 key[32];
2930} CsrWifiSmeKey;
2931
2932/*******************************************************************************
2933
2934 NAME
2935 CsrWifiSmeP2pClientInfoType
2936
2937 DESCRIPTION
2938 P2P Information for a P2P Client
2939
2940 MEMBERS
2941 p2PClientInterfaceAddress - MAC address of the P2P Client
2942 clientDeviceInfo - Device Information
2943
2944*******************************************************************************/
2945typedef struct
2946{
2947 CsrWifiMacAddress p2PClientInterfaceAddress;
2948 CsrWifiSmeDeviceInfo clientDeviceInfo;
2949} CsrWifiSmeP2pClientInfoType;
2950
2951/*******************************************************************************
2952
2953 NAME
2954 CsrWifiSmeP2pGroupInfo
2955
2956 DESCRIPTION
2957 P2P Information for a P2P Group
2958
2959 MEMBERS
2960 groupCapability - P2P group capabilities
2961 p2pDeviceAddress - Device Address of the GO
2962 p2pClientInfoCount - Number of P2P Clients that belong to the group.
2963 p2PClientInfo - Pointer to the list containing client information for
2964 each client in the group
2965
2966*******************************************************************************/
2967typedef struct
2968{
2969 CsrWifiSmeP2pGroupCapabilityMask groupCapability;
2970 CsrWifiMacAddress p2pDeviceAddress;
2971 u8 p2pClientInfoCount;
2972 CsrWifiSmeP2pClientInfoType *p2PClientInfo;
2973} CsrWifiSmeP2pGroupInfo;
2974
2975/*******************************************************************************
2976
2977 NAME
2978 CsrWifiSmePowerConfig
2979
2980 DESCRIPTION
2981 Configures the power-save behaviour of the driver and firmware.
2982
2983 MEMBERS
2984 powerSaveLevel - Power Save Level option
2985 listenIntervalTu - Interval for waking to receive beacon frames
2986 rxDtims - If TRUE, wake for DTIM every beacon period, to
2987 allow the reception broadcast packets
2988 d3AutoScanMode - Defines whether the autonomous scanning will be
2989 turned off or will stay on during a D3 suspended
2990 period
2991 clientTrafficWindow - Deprecated
2992 opportunisticPowerSave - Deprecated
2993 noticeOfAbsence - Deprecated
2994
2995*******************************************************************************/
2996typedef struct
2997{
2998 CsrWifiSmePowerSaveLevel powerSaveLevel;
2999 u16 listenIntervalTu;
3000 u8 rxDtims;
3001 CsrWifiSmeD3AutoScanMode d3AutoScanMode;
3002 u8 clientTrafficWindow;
3003 u8 opportunisticPowerSave;
3004 u8 noticeOfAbsence;
3005} CsrWifiSmePowerConfig;
3006
3007/*******************************************************************************
3008
3009 NAME
3010 CsrWifiSmeRoamingConfig
3011
3012 DESCRIPTION
3013 Configures the roaming behaviour of the driver and firmware
3014
3015 MEMBERS
3016 roamingBands - Defines the thresholds to determine the usability
3017 level of the current connection.
3018 roamingBands is indexed by the first 3 entries of
3019 the CsrWifiSmeBasicUsability enum
3020 disableSmoothRoaming - Disable the RSSI/SNR triggers from the Firmware
3021 that the SME uses to detect the quality of the
3022 connection.
3023 This implicitly disables disableRoamScans
3024 disableRoamScans - Disables the scanning for the roaming operation
3025 reconnectLimit - Maximum number of times SME may reconnect in the
3026 given interval
3027 reconnectLimitIntervalMs - Interval for maximum number of times SME may
3028 reconnect to the same Access Point
3029 roamScanCfg - Scanning behaviour for the specifically aimed at
3030 improving roaming performance.
3031 roamScanCfg is indexed by the first 3 entries of
3032 the CsrWifiSmeBasicUsability enum
3033
3034*******************************************************************************/
3035typedef struct
3036{
3037 CsrWifiSmeRoamingBandData roamingBands[3];
3038 u8 disableSmoothRoaming;
3039 u8 disableRoamScans;
3040 u8 reconnectLimit;
3041 u16 reconnectLimitIntervalMs;
3042 CsrWifiSmeScanConfigData roamScanCfg[3];
3043} CsrWifiSmeRoamingConfig;
3044
3045/*******************************************************************************
3046
3047 NAME
3048 CsrWifiSmeScanConfig
3049
3050 DESCRIPTION
3051 Parameters for the autonomous scanning behaviour of the system
3052
3053 MEMBERS
3054 scanCfg - Scan configuration data.
3055 Indexed by the CsrWifiSmeBasicUsability enum
3056 disableAutonomousScans - Enables or disables the autonomous scan
3057 maxResults - Maximum number of results to be cached in the SME
3058 highRssiThreshold - High received signal strength indication threshold
3059 in dBm for an AP above which the system will
3060 report scan indications
3061 lowRssiThreshold - Low received signal strength indication threshold
3062 in dBm for an AP below which the system will
3063 report scan indications
3064 deltaRssiThreshold - Minimum difference for received signal strength
3065 indication in dBm for an AP which trigger a scan
3066 indication to be sent.
3067 highSnrThreshold - High Signal to Noise Ratio threshold in dB for an
3068 AP above which the system will report scan
3069 indications
3070 lowSnrThreshold - Low Signal to Noise Ratio threshold in dB for an
3071 AP below which the system will report scan
3072 indications
3073 deltaSnrThreshold - Minimum difference for Signal to Noise Ratio in dB
3074 for an AP which trigger a scan indication to be
3075 sent.
3076 passiveChannelListCount - Number of channels to be scanned passively.
3077 passiveChannelList - Points to the first channel to be scanned
3078 passively , if any.
3079
3080*******************************************************************************/
3081typedef struct
3082{
3083 CsrWifiSmeScanConfigData scanCfg[4];
3084 u8 disableAutonomousScans;
3085 u16 maxResults;
3086 s8 highRssiThreshold;
3087 s8 lowRssiThreshold;
3088 s8 deltaRssiThreshold;
3089 s8 highSnrThreshold;
3090 s8 lowSnrThreshold;
3091 s8 deltaSnrThreshold;
3092 u16 passiveChannelListCount;
3093 u8 *passiveChannelList;
3094} CsrWifiSmeScanConfig;
3095
3096/*******************************************************************************
3097
3098 NAME
3099 CsrWifiSmeScanResult
3100
3101 DESCRIPTION
3102 This structure defines the scan result for each BSS found
3103
3104 MEMBERS
3105 ssid - Service set identifier
3106 bssid - BSS identifier
3107 rssi - Received signal strength indication in dBm
3108 snr - Signal to noise ratio in dB
3109 ifIndex - Indicates the radio interface
3110 beaconPeriodTu - Interval between beacon frames
3111 timeStamp - Timestamp in the BSS
3112 localTime - Timestamp in the Access Point
3113 channelFrequency - Channel frequency
3114 capabilityInformation - Capabilities of the BSS.
3115 channelNumber - Channel number
3116 usability - Indicates the usability level.
3117 bssType - Type of BSS.
3118 informationElementsLength - Number of bytes of the information elements
3119 received as part of the beacon or probe
3120 response.
3121 informationElements - Points to the first byte of the IEs received
3122 as part of the beacon or probe response.
3123 The format of the IEs is as specified in the
3124 IEEE 802.11 specification.
3125 p2pDeviceRole - Role of the P2P device.
3126 Relevant only if bssType is
3127 CSR_WIFI_SME_BSS_TYPE_P2P
3128 deviceInfo - Union containing P2P device info which
3129 depends on p2pDeviceRole parameter.
3130 deviceInforeservedCli -
3131 deviceInfogroupInfo -
3132 deviceInforeservedNone -
3133 deviceInfostandalonedevInfo -
3134
3135*******************************************************************************/
3136typedef struct
3137{
3138 CsrWifiSsid ssid;
3139 CsrWifiMacAddress bssid;
3140 s16 rssi;
3141 s16 snr;
3142 CsrWifiSmeRadioIF ifIndex;
3143 u16 beaconPeriodTu;
3144 CsrWifiSmeTsfTime timeStamp;
3145 CsrWifiSmeTsfTime localTime;
3146 u16 channelFrequency;
3147 u16 capabilityInformation;
3148 u8 channelNumber;
3149 CsrWifiSmeBasicUsability usability;
3150 CsrWifiSmeBssType bssType;
3151 u16 informationElementsLength;
3152 u8 *informationElements;
3153 CsrWifiSmeP2pRole p2pDeviceRole;
3154 union {
3155 CsrWifiSmeEmpty reservedCli;
3156 CsrWifiSmeP2pGroupInfo groupInfo;
3157 CsrWifiSmeEmpty reservedNone;
3158 CsrWifiSmeDeviceInfo standalonedevInfo;
3159 } deviceInfo;
3160} CsrWifiSmeScanResult;
3161
3162/*******************************************************************************
3163
3164 NAME
3165 CsrWifiSmeStaConfig
3166
3167 DESCRIPTION
3168 Station configuration options in the SME
3169
3170 MEMBERS
3171 connectionQualityRssiChangeTrigger - Sets the difference of RSSI
3172 measurements which triggers reports
3173 from the Firmware
3174 connectionQualitySnrChangeTrigger - Sets the difference of SNR measurements
3175 which triggers reports from the
3176 Firmware
3177 wmmModeMask - Mask containing one or more values from
3178 CsrWifiSmeWmmMode
3179 ifIndex - Indicates the band of frequencies used
3180 allowUnicastUseGroupCipher - If TRUE, it allows to use groupwise
3181 keys if no pairwise key is specified
3182 enableOpportunisticKeyCaching - If TRUE, enables the Opportunistic Key
3183 Caching feature
3184
3185*******************************************************************************/
3186typedef struct
3187{
3188 u8 connectionQualityRssiChangeTrigger;
3189 u8 connectionQualitySnrChangeTrigger;
3190 CsrWifiSmeWmmModeMask wmmModeMask;
3191 CsrWifiSmeRadioIF ifIndex;
3192 u8 allowUnicastUseGroupCipher;
3193 u8 enableOpportunisticKeyCaching;
3194} CsrWifiSmeStaConfig;
3195
3196/*******************************************************************************
3197
3198 NAME
3199 CsrWifiSmeWep128Keys
3200
3201 DESCRIPTION
3202 Structure holding WEP Authentication Type and WEP keys that can be used
3203 when using WEP128.
3204
3205 MEMBERS
3206 wepAuthType - Mask to select the WEP authentication type (Open or Shared)
3207 selectedWepKey - Index to one of the four keys below indicating the
3208 currently used WEP key. Mapping From SME/User -> firmware.
3209 Key 1 -> Index 0. Key 2 -> Index 1. key 3 -> Index 2. Key
3210 4-> Index 3.
3211 key1 - Value for key number 1.
3212 key2 - Value for key number 2.
3213 key3 - Value for key number 3.
3214 key4 - Value for key number 4.
3215
3216*******************************************************************************/
3217typedef struct
3218{
3219 CsrWifiSmeWepAuthMode wepAuthType;
3220 u8 selectedWepKey;
3221 u8 key1[13];
3222 u8 key2[13];
3223 u8 key3[13];
3224 u8 key4[13];
3225} CsrWifiSmeWep128Keys;
3226
3227/*******************************************************************************
3228
3229 NAME
3230 CsrWifiSmeWep64Keys
3231
3232 DESCRIPTION
3233 Structure holding WEP Authentication Type and WEP keys that can be used
3234 when using WEP64.
3235
3236 MEMBERS
3237 wepAuthType - Mask to select the WEP authentication type (Open or Shared)
3238 selectedWepKey - Index to one of the four keys below indicating the
3239 currently used WEP key. Mapping From SME/User -> firmware.
3240 Key 1 -> Index 0. Key 2 -> Index 1. key 3 -> Index 2. Key
3241 4-> Index 3.
3242 key1 - Value for key number 1.
3243 key2 - Value for key number 2.
3244 key3 - Value for key number 3.
3245 key4 - Value for key number 4.
3246
3247*******************************************************************************/
3248typedef struct
3249{
3250 CsrWifiSmeWepAuthMode wepAuthType;
3251 u8 selectedWepKey;
3252 u8 key1[5];
3253 u8 key2[5];
3254 u8 key3[5];
3255 u8 key4[5];
3256} CsrWifiSmeWep64Keys;
3257
3258/*******************************************************************************
3259
3260 NAME
3261 CsrWifiSmeWepAuth
3262
3263 DESCRIPTION
3264 WEP authentication parameter structure
3265
3266 MEMBERS
3267 wepKeyType - WEP key try (128 bit or 64 bit)
3268 wepCredentials - Union containing credentials which depends on
3269 wepKeyType parameter.
3270 wepCredentialswep128Key -
3271 wepCredentialswep64Key -
3272
3273*******************************************************************************/
3274typedef struct
3275{
3276 CsrWifiSmeWepCredentialType wepKeyType;
3277 union {
3278 CsrWifiSmeWep128Keys wep128Key;
3279 CsrWifiSmeWep64Keys wep64Key;
3280 } wepCredentials;
3281} CsrWifiSmeWepAuth;
3282
3283/*******************************************************************************
3284
3285 NAME
3286 CsrWifiSmeWpsConfig
3287
3288 DESCRIPTION
3289 Structure holding AP WPS Config data.
3290
3291 MEMBERS
3292 wpsVersion - wpsVersion should be 0x10 for WPS1.0h or 0x20 for
3293 WSC2.0
3294 uuid - uuid.
3295 deviceName - Device name upto 32 characters without '\0'.
3296 deviceNameLength - deviceNameLen.
3297 manufacturer - manufacturer: CSR
3298 manufacturerLength - manufacturerLen.
3299 modelName - modelName Unifi
3300 modelNameLength - modelNameLen.
3301 modelNumber - modelNumber
3302 modelNumberLength - modelNumberLen.
3303 serialNumber - serialNumber
3304 primDeviceType - Primary WPS device type
3305 secondaryDeviceTypeCount - Number of secondary device types
3306 secondaryDeviceType - list of secondary WPS device types
3307 configMethods - Supported WPS config methods
3308 rfBands - RfBands.
3309 osVersion - Os version on which the device is running
3310
3311*******************************************************************************/
3312typedef struct
3313{
3314 u8 wpsVersion;
3315 u8 uuid[16];
3316 u8 deviceName[32];
3317 u8 deviceNameLength;
3318 u8 manufacturer[64];
3319 u8 manufacturerLength;
3320 u8 modelName[32];
3321 u8 modelNameLength;
3322 u8 modelNumber[32];
3323 u8 modelNumberLength;
3324 u8 serialNumber[32];
3325 CsrWifiSmeWpsDeviceType primDeviceType;
3326 u8 secondaryDeviceTypeCount;
3327 CsrWifiSmeWpsDeviceType *secondaryDeviceType;
3328 CsrWifiSmeWpsConfigTypeMask configMethods;
3329 u8 rfBands;
3330 u8 osVersion[4];
3331} CsrWifiSmeWpsConfig;
3332
3333
3334/* Downstream */
3335#define CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST (0x0000)
3336
3337#define CSR_WIFI_SME_ACTIVATE_REQ ((CsrWifiSmePrim) (0x0000 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3338#define CSR_WIFI_SME_ADHOC_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0001 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3339#define CSR_WIFI_SME_ADHOC_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0002 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3340#define CSR_WIFI_SME_BLACKLIST_REQ ((CsrWifiSmePrim) (0x0003 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3341#define CSR_WIFI_SME_CALIBRATION_DATA_GET_REQ ((CsrWifiSmePrim) (0x0004 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3342#define CSR_WIFI_SME_CALIBRATION_DATA_SET_REQ ((CsrWifiSmePrim) (0x0005 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3343#define CSR_WIFI_SME_CCX_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0006 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3344#define CSR_WIFI_SME_CCX_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0007 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3345#define CSR_WIFI_SME_COEX_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0008 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3346#define CSR_WIFI_SME_COEX_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0009 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3347#define CSR_WIFI_SME_COEX_INFO_GET_REQ ((CsrWifiSmePrim) (0x000A + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3348#define CSR_WIFI_SME_CONNECT_REQ ((CsrWifiSmePrim) (0x000B + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3349#define CSR_WIFI_SME_CONNECTION_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x000C + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3350#define CSR_WIFI_SME_CONNECTION_INFO_GET_REQ ((CsrWifiSmePrim) (0x000D + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3351#define CSR_WIFI_SME_CONNECTION_STATS_GET_REQ ((CsrWifiSmePrim) (0x000E + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3352#define CSR_WIFI_SME_DEACTIVATE_REQ ((CsrWifiSmePrim) (0x000F + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3353#define CSR_WIFI_SME_DISCONNECT_REQ ((CsrWifiSmePrim) (0x0010 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3354#define CSR_WIFI_SME_EVENT_MASK_SET_REQ ((CsrWifiSmePrim) (0x0011 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3355#define CSR_WIFI_SME_HOST_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0012 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3356#define CSR_WIFI_SME_HOST_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0013 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3357#define CSR_WIFI_SME_KEY_REQ ((CsrWifiSmePrim) (0x0014 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3358#define CSR_WIFI_SME_LINK_QUALITY_GET_REQ ((CsrWifiSmePrim) (0x0015 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3359#define CSR_WIFI_SME_MIB_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0016 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3360#define CSR_WIFI_SME_MIB_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0017 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3361#define CSR_WIFI_SME_MIB_GET_NEXT_REQ ((CsrWifiSmePrim) (0x0018 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3362#define CSR_WIFI_SME_MIB_GET_REQ ((CsrWifiSmePrim) (0x0019 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3363#define CSR_WIFI_SME_MIB_SET_REQ ((CsrWifiSmePrim) (0x001A + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3364#define CSR_WIFI_SME_MULTICAST_ADDRESS_REQ ((CsrWifiSmePrim) (0x001B + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3365#define CSR_WIFI_SME_PACKET_FILTER_SET_REQ ((CsrWifiSmePrim) (0x001C + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3366#define CSR_WIFI_SME_PERMANENT_MAC_ADDRESS_GET_REQ ((CsrWifiSmePrim) (0x001D + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3367#define CSR_WIFI_SME_PMKID_REQ ((CsrWifiSmePrim) (0x001E + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3368#define CSR_WIFI_SME_POWER_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x001F + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3369#define CSR_WIFI_SME_POWER_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0020 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3370#define CSR_WIFI_SME_REGULATORY_DOMAIN_INFO_GET_REQ ((CsrWifiSmePrim) (0x0021 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3371#define CSR_WIFI_SME_ROAMING_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0022 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3372#define CSR_WIFI_SME_ROAMING_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0023 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3373#define CSR_WIFI_SME_SCAN_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0024 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3374#define CSR_WIFI_SME_SCAN_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0025 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3375#define CSR_WIFI_SME_SCAN_FULL_REQ ((CsrWifiSmePrim) (0x0026 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3376#define CSR_WIFI_SME_SCAN_RESULTS_FLUSH_REQ ((CsrWifiSmePrim) (0x0027 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3377#define CSR_WIFI_SME_SCAN_RESULTS_GET_REQ ((CsrWifiSmePrim) (0x0028 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3378#define CSR_WIFI_SME_SME_STA_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0029 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3379#define CSR_WIFI_SME_SME_STA_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x002A + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3380#define CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_REQ ((CsrWifiSmePrim) (0x002B + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3381#define CSR_WIFI_SME_TSPEC_REQ ((CsrWifiSmePrim) (0x002C + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3382#define CSR_WIFI_SME_VERSIONS_GET_REQ ((CsrWifiSmePrim) (0x002D + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3383#define CSR_WIFI_SME_WIFI_FLIGHTMODE_REQ ((CsrWifiSmePrim) (0x002E + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3384#define CSR_WIFI_SME_WIFI_OFF_REQ ((CsrWifiSmePrim) (0x002F + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3385#define CSR_WIFI_SME_WIFI_ON_REQ ((CsrWifiSmePrim) (0x0030 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3386#define CSR_WIFI_SME_CLOAKED_SSIDS_SET_REQ ((CsrWifiSmePrim) (0x0031 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3387#define CSR_WIFI_SME_CLOAKED_SSIDS_GET_REQ ((CsrWifiSmePrim) (0x0032 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3388#define CSR_WIFI_SME_SME_COMMON_CONFIG_GET_REQ ((CsrWifiSmePrim) (0x0033 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3389#define CSR_WIFI_SME_SME_COMMON_CONFIG_SET_REQ ((CsrWifiSmePrim) (0x0034 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3390#define CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_REQ ((CsrWifiSmePrim) (0x0035 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3391#define CSR_WIFI_SME_WPS_CONFIGURATION_REQ ((CsrWifiSmePrim) (0x0036 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3392#define CSR_WIFI_SME_SET_REQ ((CsrWifiSmePrim) (0x0037 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST))
3393
3394
3395#define CSR_WIFI_SME_PRIM_DOWNSTREAM_HIGHEST (0x0037 + CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)
3396
3397/* Upstream */
3398#define CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM)
3399
3400#define CSR_WIFI_SME_ACTIVATE_CFM ((CsrWifiSmePrim)(0x0000 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3401#define CSR_WIFI_SME_ADHOC_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x0001 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3402#define CSR_WIFI_SME_ADHOC_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x0002 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3403#define CSR_WIFI_SME_ASSOCIATION_COMPLETE_IND ((CsrWifiSmePrim)(0x0003 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3404#define CSR_WIFI_SME_ASSOCIATION_START_IND ((CsrWifiSmePrim)(0x0004 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3405#define CSR_WIFI_SME_BLACKLIST_CFM ((CsrWifiSmePrim)(0x0005 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3406#define CSR_WIFI_SME_CALIBRATION_DATA_GET_CFM ((CsrWifiSmePrim)(0x0006 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3407#define CSR_WIFI_SME_CALIBRATION_DATA_SET_CFM ((CsrWifiSmePrim)(0x0007 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3408#define CSR_WIFI_SME_CCX_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x0008 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3409#define CSR_WIFI_SME_CCX_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x0009 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3410#define CSR_WIFI_SME_COEX_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x000A + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3411#define CSR_WIFI_SME_COEX_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x000B + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3412#define CSR_WIFI_SME_COEX_INFO_GET_CFM ((CsrWifiSmePrim)(0x000C + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3413#define CSR_WIFI_SME_CONNECT_CFM ((CsrWifiSmePrim)(0x000D + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3414#define CSR_WIFI_SME_CONNECTION_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x000E + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3415#define CSR_WIFI_SME_CONNECTION_INFO_GET_CFM ((CsrWifiSmePrim)(0x000F + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3416#define CSR_WIFI_SME_CONNECTION_QUALITY_IND ((CsrWifiSmePrim)(0x0010 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3417#define CSR_WIFI_SME_CONNECTION_STATS_GET_CFM ((CsrWifiSmePrim)(0x0011 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3418#define CSR_WIFI_SME_DEACTIVATE_CFM ((CsrWifiSmePrim)(0x0012 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3419#define CSR_WIFI_SME_DISCONNECT_CFM ((CsrWifiSmePrim)(0x0013 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3420#define CSR_WIFI_SME_EVENT_MASK_SET_CFM ((CsrWifiSmePrim)(0x0014 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3421#define CSR_WIFI_SME_HOST_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x0015 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3422#define CSR_WIFI_SME_HOST_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x0016 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3423#define CSR_WIFI_SME_IBSS_STATION_IND ((CsrWifiSmePrim)(0x0017 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3424#define CSR_WIFI_SME_KEY_CFM ((CsrWifiSmePrim)(0x0018 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3425#define CSR_WIFI_SME_LINK_QUALITY_GET_CFM ((CsrWifiSmePrim)(0x0019 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3426#define CSR_WIFI_SME_MEDIA_STATUS_IND ((CsrWifiSmePrim)(0x001A + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3427#define CSR_WIFI_SME_MIB_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x001B + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3428#define CSR_WIFI_SME_MIB_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x001C + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3429#define CSR_WIFI_SME_MIB_GET_CFM ((CsrWifiSmePrim)(0x001D + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3430#define CSR_WIFI_SME_MIB_GET_NEXT_CFM ((CsrWifiSmePrim)(0x001E + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3431#define CSR_WIFI_SME_MIB_SET_CFM ((CsrWifiSmePrim)(0x001F + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3432#define CSR_WIFI_SME_MIC_FAILURE_IND ((CsrWifiSmePrim)(0x0020 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3433#define CSR_WIFI_SME_MULTICAST_ADDRESS_CFM ((CsrWifiSmePrim)(0x0021 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3434#define CSR_WIFI_SME_PACKET_FILTER_SET_CFM ((CsrWifiSmePrim)(0x0022 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3435#define CSR_WIFI_SME_PERMANENT_MAC_ADDRESS_GET_CFM ((CsrWifiSmePrim)(0x0023 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3436#define CSR_WIFI_SME_PMKID_CANDIDATE_LIST_IND ((CsrWifiSmePrim)(0x0024 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3437#define CSR_WIFI_SME_PMKID_CFM ((CsrWifiSmePrim)(0x0025 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3438#define CSR_WIFI_SME_POWER_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x0026 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3439#define CSR_WIFI_SME_POWER_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x0027 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3440#define CSR_WIFI_SME_REGULATORY_DOMAIN_INFO_GET_CFM ((CsrWifiSmePrim)(0x0028 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3441#define CSR_WIFI_SME_ROAM_COMPLETE_IND ((CsrWifiSmePrim)(0x0029 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3442#define CSR_WIFI_SME_ROAM_START_IND ((CsrWifiSmePrim)(0x002A + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3443#define CSR_WIFI_SME_ROAMING_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x002B + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3444#define CSR_WIFI_SME_ROAMING_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x002C + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3445#define CSR_WIFI_SME_SCAN_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x002D + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3446#define CSR_WIFI_SME_SCAN_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x002E + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3447#define CSR_WIFI_SME_SCAN_FULL_CFM ((CsrWifiSmePrim)(0x002F + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3448#define CSR_WIFI_SME_SCAN_RESULT_IND ((CsrWifiSmePrim)(0x0030 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3449#define CSR_WIFI_SME_SCAN_RESULTS_FLUSH_CFM ((CsrWifiSmePrim)(0x0031 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3450#define CSR_WIFI_SME_SCAN_RESULTS_GET_CFM ((CsrWifiSmePrim)(0x0032 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3451#define CSR_WIFI_SME_SME_STA_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x0033 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3452#define CSR_WIFI_SME_SME_STA_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x0034 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3453#define CSR_WIFI_SME_STATION_MAC_ADDRESS_GET_CFM ((CsrWifiSmePrim)(0x0035 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3454#define CSR_WIFI_SME_TSPEC_IND ((CsrWifiSmePrim)(0x0036 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3455#define CSR_WIFI_SME_TSPEC_CFM ((CsrWifiSmePrim)(0x0037 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3456#define CSR_WIFI_SME_VERSIONS_GET_CFM ((CsrWifiSmePrim)(0x0038 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3457#define CSR_WIFI_SME_WIFI_FLIGHTMODE_CFM ((CsrWifiSmePrim)(0x0039 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3458#define CSR_WIFI_SME_WIFI_OFF_IND ((CsrWifiSmePrim)(0x003A + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3459#define CSR_WIFI_SME_WIFI_OFF_CFM ((CsrWifiSmePrim)(0x003B + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3460#define CSR_WIFI_SME_WIFI_ON_CFM ((CsrWifiSmePrim)(0x003C + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3461#define CSR_WIFI_SME_CLOAKED_SSIDS_SET_CFM ((CsrWifiSmePrim)(0x003D + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3462#define CSR_WIFI_SME_CLOAKED_SSIDS_GET_CFM ((CsrWifiSmePrim)(0x003E + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3463#define CSR_WIFI_SME_WIFI_ON_IND ((CsrWifiSmePrim)(0x003F + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3464#define CSR_WIFI_SME_SME_COMMON_CONFIG_GET_CFM ((CsrWifiSmePrim)(0x0040 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3465#define CSR_WIFI_SME_SME_COMMON_CONFIG_SET_CFM ((CsrWifiSmePrim)(0x0041 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3466#define CSR_WIFI_SME_INTERFACE_CAPABILITY_GET_CFM ((CsrWifiSmePrim)(0x0042 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3467#define CSR_WIFI_SME_ERROR_IND ((CsrWifiSmePrim)(0x0043 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3468#define CSR_WIFI_SME_INFO_IND ((CsrWifiSmePrim)(0x0044 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3469#define CSR_WIFI_SME_CORE_DUMP_IND ((CsrWifiSmePrim)(0x0045 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3470#define CSR_WIFI_SME_AMP_STATUS_CHANGE_IND ((CsrWifiSmePrim)(0x0046 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3471#define CSR_WIFI_SME_WPS_CONFIGURATION_CFM ((CsrWifiSmePrim)(0x0047 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST))
3472
3473#define CSR_WIFI_SME_PRIM_UPSTREAM_HIGHEST (0x0047 + CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)
3474
3475#define CSR_WIFI_SME_PRIM_DOWNSTREAM_COUNT (CSR_WIFI_SME_PRIM_DOWNSTREAM_HIGHEST + 1 - CSR_WIFI_SME_PRIM_DOWNSTREAM_LOWEST)
3476#define CSR_WIFI_SME_PRIM_UPSTREAM_COUNT (CSR_WIFI_SME_PRIM_UPSTREAM_HIGHEST + 1 - CSR_WIFI_SME_PRIM_UPSTREAM_LOWEST)
3477
3478/*******************************************************************************
3479
3480 NAME
3481 CsrWifiSmeActivateReq
3482
3483 DESCRIPTION
3484 The WMA sends this primitive to activate the SME.
3485 The WMA must activate the SME before it can send any other primitive.
3486
3487 MEMBERS
3488 common - Common header for use with the CsrWifiFsm Module
3489
3490*******************************************************************************/
3491typedef struct
3492{
3493 CsrWifiFsmEvent common;
3494} CsrWifiSmeActivateReq;
3495
3496/*******************************************************************************
3497
3498 NAME
3499 CsrWifiSmeAdhocConfigGetReq
3500
3501 DESCRIPTION
3502 This primitive gets the value of the adHocConfig parameter.
3503
3504 MEMBERS
3505 common - Common header for use with the CsrWifiFsm Module
3506
3507*******************************************************************************/
3508typedef struct
3509{
3510 CsrWifiFsmEvent common;
3511} CsrWifiSmeAdhocConfigGetReq;
3512
3513/*******************************************************************************
3514
3515 NAME
3516 CsrWifiSmeAdhocConfigSetReq
3517
3518 DESCRIPTION
3519 This primitive sets the value of the adHocConfig parameter.
3520
3521 MEMBERS
3522 common - Common header for use with the CsrWifiFsm Module
3523 adHocConfig - Sets the values to use when starting an ad hoc network.
3524
3525*******************************************************************************/
3526typedef struct
3527{
3528 CsrWifiFsmEvent common;
3529 CsrWifiSmeAdHocConfig adHocConfig;
3530} CsrWifiSmeAdhocConfigSetReq;
3531
3532/*******************************************************************************
3533
3534 NAME
3535 CsrWifiSmeBlacklistReq
3536
3537 DESCRIPTION
3538 The wireless manager application should call this primitive to notify the
3539 driver of any networks that should not be connected to. The interface
3540 allows the wireless manager application to query, add, remove, and flush
3541 the BSSIDs that the driver may not connect or roam to.
3542 When this primitive adds to the black list the BSSID to which the SME is
3543 currently connected, the SME will try to roam, if applicable, to another
3544 BSSID in the same ESS; if the roaming procedure fails, the SME will
3545 disconnect.
3546
3547 MEMBERS
3548 common - Common header for use with the CsrWifiFsm Module
3549 interfaceTag - Interface Identifier; unique identifier of an interface
3550 action - The value of the CsrWifiSmeListAction parameter instructs
3551 the driver to modify or provide the list of blacklisted
3552 networks.
3553 setAddressCount - Number of BSSIDs sent with this primitive
3554 setAddresses - Pointer to the list of BBSIDs sent with the primitive, set
3555 to NULL if none is sent.
3556
3557*******************************************************************************/
3558typedef struct
3559{
3560 CsrWifiFsmEvent common;
3561 u16 interfaceTag;
3562 CsrWifiSmeListAction action;
3563 u8 setAddressCount;
3564 CsrWifiMacAddress *setAddresses;
3565} CsrWifiSmeBlacklistReq;
3566
3567/*******************************************************************************
3568
3569 NAME
3570 CsrWifiSmeCalibrationDataGetReq
3571
3572 DESCRIPTION
3573 This primitive retrieves the Wi-Fi radio calibration data.
3574
3575 MEMBERS
3576 common - Common header for use with the CsrWifiFsm Module
3577
3578*******************************************************************************/
3579typedef struct
3580{
3581 CsrWifiFsmEvent common;
3582} CsrWifiSmeCalibrationDataGetReq;
3583
3584/*******************************************************************************
3585
3586 NAME
3587 CsrWifiSmeCalibrationDataSetReq
3588
3589 DESCRIPTION
3590 This primitive sets the Wi-Fi radio calibration data.
3591 The usage of the primitive with proper calibration data will avoid
3592 time-consuming configuration after power-up.
3593
3594 MEMBERS
3595 common - Common header for use with the CsrWifiFsm Module
3596 calibrationDataLength - Number of bytes in the buffer pointed by
3597 calibrationData
3598 calibrationData - Pointer to a buffer of length calibrationDataLength
3599 containing the calibration data
3600
3601*******************************************************************************/
3602typedef struct
3603{
3604 CsrWifiFsmEvent common;
3605 u16 calibrationDataLength;
3606 u8 *calibrationData;
3607} CsrWifiSmeCalibrationDataSetReq;
3608
3609/*******************************************************************************
3610
3611 NAME
3612 CsrWifiSmeCcxConfigGetReq
3613
3614 DESCRIPTION
3615 This primitive gets the value of the CcxConfig parameter.
3616 CURRENTLY NOT SUPPORTED.
3617
3618 MEMBERS
3619 common - Common header for use with the CsrWifiFsm Module
3620 interfaceTag - Interface Identifier; unique identifier of an interface
3621
3622*******************************************************************************/
3623typedef struct
3624{
3625 CsrWifiFsmEvent common;
3626 u16 interfaceTag;
3627} CsrWifiSmeCcxConfigGetReq;
3628
3629/*******************************************************************************
3630
3631 NAME
3632 CsrWifiSmeCcxConfigSetReq
3633
3634 DESCRIPTION
3635 This primitive sets the value of the CcxConfig parameter.
3636 CURRENTLY NOT SUPPORTED.
3637
3638 MEMBERS
3639 common - Common header for use with the CsrWifiFsm Module
3640 interfaceTag - Interface Identifier; unique identifier of an interface
3641 ccxConfig - Currently not supported
3642
3643*******************************************************************************/
3644typedef struct
3645{
3646 CsrWifiFsmEvent common;
3647 u16 interfaceTag;
3648 CsrWifiSmeCcxConfig ccxConfig;
3649} CsrWifiSmeCcxConfigSetReq;
3650
3651/*******************************************************************************
3652
3653 NAME
3654 CsrWifiSmeCoexConfigGetReq
3655
3656 DESCRIPTION
3657 This primitive gets the value of the CoexConfig parameter.
3658
3659 MEMBERS
3660 common - Common header for use with the CsrWifiFsm Module
3661
3662*******************************************************************************/
3663typedef struct
3664{
3665 CsrWifiFsmEvent common;
3666} CsrWifiSmeCoexConfigGetReq;
3667
3668/*******************************************************************************
3669
3670 NAME
3671 CsrWifiSmeCoexConfigSetReq
3672
3673 DESCRIPTION
3674 This primitive sets the value of the CoexConfig parameter.
3675
3676 MEMBERS
3677 common - Common header for use with the CsrWifiFsm Module
3678 coexConfig - Configures the coexistence behaviour
3679
3680*******************************************************************************/
3681typedef struct
3682{
3683 CsrWifiFsmEvent common;
3684 CsrWifiSmeCoexConfig coexConfig;
3685} CsrWifiSmeCoexConfigSetReq;
3686
3687/*******************************************************************************
3688
3689 NAME
3690 CsrWifiSmeCoexInfoGetReq
3691
3692 DESCRIPTION
3693 This primitive gets the value of the CoexInfo parameter.
3694
3695 MEMBERS
3696 common - Common header for use with the CsrWifiFsm Module
3697
3698*******************************************************************************/
3699typedef struct
3700{
3701 CsrWifiFsmEvent common;
3702} CsrWifiSmeCoexInfoGetReq;
3703
3704/*******************************************************************************
3705
3706 NAME
3707 CsrWifiSmeConnectReq
3708
3709 DESCRIPTION
3710 The wireless manager application calls this primitive to start the
3711 process of joining an 802.11 wireless network or to start an ad hoc
3712 network.
3713 The structure pointed by connectionConfig contains parameters describing
3714 the network to join or, in case of an ad hoc network, to host or join.
3715 The SME will select a network, perform the IEEE 802.11 Join, Authenticate
3716 and Associate exchanges.
3717 The SME selects the networks from the current scan list that match both
3718 the SSID and BSSID, however either or both of these may be the wildcard
3719 value. Using this rule, the following operations are possible:
3720 * To connect to a network by name, specify the SSID and set the BSSID to
3721 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF. If there are two or more networks visible,
3722 the SME will select the one with the strongest signal.
3723 * To connect to a specific network, specify the BSSID. The SSID is
3724 optional, but if given it must match the SSID of the network. An empty
3725 SSID may be specified by setting the SSID length to zero. Please note
3726 that if the BSSID is specified (i.e. not equal to 0xFF 0xFF 0xFF 0xFF
3727 0xFF 0xFF), the SME will not attempt to roam if signal conditions become
3728 poor, even if there is an alternative AP with an SSID that matches the
3729 current network SSID.
3730 * To connect to any network matching the other parameters (i.e. security,
3731 etc), set the SSID length to zero and set the BSSID to 0xFF 0xFF 0xFF
3732 0xFF 0xFF 0xFF. In this case, the SME will order all available networks
3733 by their signal strengths and will iterate through this list until it
3734 successfully connects.
3735 NOTE: Specifying the BSSID will restrict the selection to one specific
3736 network. If SSID and BSSID are given, they must both match the network
3737 for it to be selected. To select a network based on the SSID only, the
3738 wireless manager application must set the BSSID to 0xFF 0xFF 0xFF 0xFF
3739 0xFF 0xFF.
3740 The SME will try to connect to each network that matches the provided
3741 parameters, one by one, until it succeeds or has tried unsuccessfully
3742 with all the matching networks.
3743 If there is no network that matches the parameters and the request allows
3744 to host an ad hoc network, the SME will advertise a new ad hoc network
3745 instead.
3746 If the SME cannot connect, it will notify the failure in the confirm.
3747
3748 MEMBERS
3749 common - Common header for use with the CsrWifiFsm Module
3750 interfaceTag - Interface Identifier; unique identifier of an interface
3751 connectionConfig - Describes the candidate network to join or to host.
3752
3753*******************************************************************************/
3754typedef struct
3755{
3756 CsrWifiFsmEvent common;
3757 u16 interfaceTag;
3758 CsrWifiSmeConnectionConfig connectionConfig;
3759} CsrWifiSmeConnectReq;
3760
3761/*******************************************************************************
3762
3763 NAME
3764 CsrWifiSmeConnectionConfigGetReq
3765
3766 DESCRIPTION
3767 This primitive gets the value of the ConnectionConfig parameter.
3768
3769 MEMBERS
3770 common - Common header for use with the CsrWifiFsm Module
3771 interfaceTag - Interface Identifier; unique identifier of an interface
3772
3773*******************************************************************************/
3774typedef struct
3775{
3776 CsrWifiFsmEvent common;
3777 u16 interfaceTag;
3778} CsrWifiSmeConnectionConfigGetReq;
3779
3780/*******************************************************************************
3781
3782 NAME
3783 CsrWifiSmeConnectionInfoGetReq
3784
3785 DESCRIPTION
3786 This primitive gets the value of the ConnectionInfo parameter.
3787
3788 MEMBERS
3789 common - Common header for use with the CsrWifiFsm Module
3790 interfaceTag - Interface Identifier; unique identifier of an interface
3791
3792*******************************************************************************/
3793typedef struct
3794{
3795 CsrWifiFsmEvent common;
3796 u16 interfaceTag;
3797} CsrWifiSmeConnectionInfoGetReq;
3798
3799/*******************************************************************************
3800
3801 NAME
3802 CsrWifiSmeConnectionStatsGetReq
3803
3804 DESCRIPTION
3805 This primitive gets the value of the ConnectionStats parameter.
3806
3807 MEMBERS
3808 common - Common header for use with the CsrWifiFsm Module
3809 interfaceTag - Interface Identifier; unique identifier of an interface
3810
3811*******************************************************************************/
3812typedef struct
3813{
3814 CsrWifiFsmEvent common;
3815 u16 interfaceTag;
3816} CsrWifiSmeConnectionStatsGetReq;
3817
3818/*******************************************************************************
3819
3820 NAME
3821 CsrWifiSmeDeactivateReq
3822
3823 DESCRIPTION
3824 The WMA sends this primitive to deactivate the SME.
3825
3826 MEMBERS
3827 common - Common header for use with the CsrWifiFsm Module
3828
3829*******************************************************************************/
3830typedef struct
3831{
3832 CsrWifiFsmEvent common;
3833} CsrWifiSmeDeactivateReq;
3834
3835/*******************************************************************************
3836
3837 NAME
3838 CsrWifiSmeDisconnectReq
3839
3840 DESCRIPTION
3841 The wireless manager application may disconnect from the current network
3842 by calling this primitive
3843
3844 MEMBERS
3845 common - Common header for use with the CsrWifiFsm Module
3846 interfaceTag - Interface Identifier; unique identifier of an interface
3847
3848*******************************************************************************/
3849typedef struct
3850{
3851 CsrWifiFsmEvent common;
3852 u16 interfaceTag;
3853} CsrWifiSmeDisconnectReq;
3854
3855/*******************************************************************************
3856
3857 NAME
3858 CsrWifiSmeEventMaskSetReq
3859
3860 DESCRIPTION
3861 The wireless manager application may register with the SME to receive
3862 notification of interesting events. Indications will be sent only if the
3863 wireless manager explicitly registers to be notified of that event.
3864 indMask is a bit mask of values defined in CsrWifiSmeIndicationsMask.
3865
3866 MEMBERS
3867 common - Common header for use with the CsrWifiFsm Module
3868 indMask - Set mask with values from CsrWifiSmeIndications
3869
3870*******************************************************************************/
3871typedef struct
3872{
3873 CsrWifiFsmEvent common;
3874 CsrWifiSmeIndicationsMask indMask;
3875} CsrWifiSmeEventMaskSetReq;
3876
3877/*******************************************************************************
3878
3879 NAME
3880 CsrWifiSmeHostConfigGetReq
3881
3882 DESCRIPTION
3883 This primitive gets the value of the hostConfig parameter.
3884
3885 MEMBERS
3886 common - Common header for use with the CsrWifiFsm Module
3887 interfaceTag - Interface Identifier; unique identifier of an interface
3888
3889*******************************************************************************/
3890typedef struct
3891{
3892 CsrWifiFsmEvent common;
3893 u16 interfaceTag;
3894} CsrWifiSmeHostConfigGetReq;
3895
3896/*******************************************************************************
3897
3898 NAME
3899 CsrWifiSmeHostConfigSetReq
3900
3901 DESCRIPTION
3902 This primitive sets the value of the hostConfig parameter.
3903
3904 MEMBERS
3905 common - Common header for use with the CsrWifiFsm Module
3906 interfaceTag - Interface Identifier; unique identifier of an interface
3907 hostConfig - Communicates a change of host power state (for example, on
3908 mains power, on battery power etc) and of the periodicity of
3909 traffic data
3910
3911*******************************************************************************/
3912typedef struct
3913{
3914 CsrWifiFsmEvent common;
3915 u16 interfaceTag;
3916 CsrWifiSmeHostConfig hostConfig;
3917} CsrWifiSmeHostConfigSetReq;
3918
3919/*******************************************************************************
3920
3921 NAME
3922 CsrWifiSmeKeyReq
3923
3924 DESCRIPTION
3925 The wireless manager application calls this primitive to add or remove
3926 keys that the chip should use for encryption of data.
3927 The interface allows the wireless manager application to add and remove
3928 keys according to the specified action.
3929
3930 MEMBERS
3931 common - Common header for use with the CsrWifiFsm Module
3932 interfaceTag - Interface Identifier; unique identifier of an interface
3933 action - The value of the CsrWifiSmeListAction parameter instructs the
3934 driver to modify or provide the list of keys.
3935 CSR_WIFI_SME_LIST_ACTION_GET is not supported here.
3936 key - Key to be added or removed
3937
3938*******************************************************************************/
3939typedef struct
3940{
3941 CsrWifiFsmEvent common;
3942 u16 interfaceTag;
3943 CsrWifiSmeListAction action;
3944 CsrWifiSmeKey key;
3945} CsrWifiSmeKeyReq;
3946
3947/*******************************************************************************
3948
3949 NAME
3950 CsrWifiSmeLinkQualityGetReq
3951
3952 DESCRIPTION
3953 This primitive gets the value of the LinkQuality parameter.
3954
3955 MEMBERS
3956 common - Common header for use with the CsrWifiFsm Module
3957 interfaceTag - Interface Identifier; unique identifier of an interface
3958
3959*******************************************************************************/
3960typedef struct
3961{
3962 CsrWifiFsmEvent common;
3963 u16 interfaceTag;
3964} CsrWifiSmeLinkQualityGetReq;
3965
3966/*******************************************************************************
3967
3968 NAME
3969 CsrWifiSmeMibConfigGetReq
3970
3971 DESCRIPTION
3972 This primitive gets the value of the MibConfig parameter.
3973
3974 MEMBERS
3975 common - Common header for use with the CsrWifiFsm Module
3976
3977*******************************************************************************/
3978typedef struct
3979{
3980 CsrWifiFsmEvent common;
3981} CsrWifiSmeMibConfigGetReq;
3982
3983/*******************************************************************************
3984
3985 NAME
3986 CsrWifiSmeMibConfigSetReq
3987
3988 DESCRIPTION
3989 This primitive sets the value of the MibConfig parameter.
3990
3991 MEMBERS
3992 common - Common header for use with the CsrWifiFsm Module
3993 mibConfig - Conveys the desired value of various IEEE 802.11 attributes as
3994 currently configured
3995
3996*******************************************************************************/
3997typedef struct
3998{
3999 CsrWifiFsmEvent common;
4000 CsrWifiSmeMibConfig mibConfig;
4001} CsrWifiSmeMibConfigSetReq;
4002
4003/*******************************************************************************
4004
4005 NAME
4006 CsrWifiSmeMibGetNextReq
4007
4008 DESCRIPTION
4009 To read a sequence of MIB parameters, for example a table, call this
4010 primitive to find the name of the next MIB variable
4011
4012 MEMBERS
4013 common - Common header for use with the CsrWifiFsm Module
4014 mibAttributeLength - Length of mibAttribute
4015 mibAttribute - Points to a VarBind or VarBindList containing the
4016 name(s) of the MIB variable(s) to search from.
4017
4018*******************************************************************************/
4019typedef struct
4020{
4021 CsrWifiFsmEvent common;
4022 u16 mibAttributeLength;
4023 u8 *mibAttribute;
4024} CsrWifiSmeMibGetNextReq;
4025
4026/*******************************************************************************
4027
4028 NAME
4029 CsrWifiSmeMibGetReq
4030
4031 DESCRIPTION
4032 The wireless manager application calls this primitive to retrieve one or
4033 more MIB variables.
4034
4035 MEMBERS
4036 common - Common header for use with the CsrWifiFsm Module
4037 mibAttributeLength - Length of mibAttribute
4038 mibAttribute - Points to the VarBind or VarBindList containing the
4039 names of the MIB variables to be retrieved
4040
4041*******************************************************************************/
4042typedef struct
4043{
4044 CsrWifiFsmEvent common;
4045 u16 mibAttributeLength;
4046 u8 *mibAttribute;
4047} CsrWifiSmeMibGetReq;
4048
4049/*******************************************************************************
4050
4051 NAME
4052 CsrWifiSmeMibSetReq
4053
4054 DESCRIPTION
4055 The SME provides raw access to the MIB on the chip, which may be used by
4056 some configuration or diagnostic utilities, but is not normally needed by
4057 the wireless manager application.
4058 The MIB access functions use BER encoded names (OID) of the MIB
4059 parameters and BER encoded values, as described in the chip Host
4060 Interface Protocol Specification.
4061 The MIB parameters are described in 'Wi-Fi 5.0.0 Management Information
4062 Base Reference Guide'.
4063 The wireless manager application calls this primitive to set one or more
4064 MIB variables
4065
4066 MEMBERS
4067 common - Common header for use with the CsrWifiFsm Module
4068 mibAttributeLength - Length of mibAttribute
4069 mibAttribute - Points to the VarBind or VarBindList containing the
4070 names and values of the MIB variables to set
4071
4072*******************************************************************************/
4073typedef struct
4074{
4075 CsrWifiFsmEvent common;
4076 u16 mibAttributeLength;
4077 u8 *mibAttribute;
4078} CsrWifiSmeMibSetReq;
4079
4080/*******************************************************************************
4081
4082 NAME
4083 CsrWifiSmeMulticastAddressReq
4084
4085 DESCRIPTION
4086 The wireless manager application calls this primitive to specify the
4087 multicast addresses which the chip should recognise. The interface allows
4088 the wireless manager application to query, add, remove and flush the
4089 multicast addresses for the network interface according to the specified
4090 action.
4091
4092 MEMBERS
4093 common - Common header for use with the CsrWifiFsm Module
4094 interfaceTag - Interface Identifier; unique identifier of an interface
4095 action - The value of the CsrWifiSmeListAction parameter
4096 instructs the driver to modify or provide the list of
4097 MAC addresses.
4098 setAddressesCount - Number of MAC addresses sent with the primitive
4099 setAddresses - Pointer to the list of MAC Addresses sent with the
4100 primitive, set to NULL if none is sent.
4101
4102*******************************************************************************/
4103typedef struct
4104{
4105 CsrWifiFsmEvent common;
4106 u16 interfaceTag;
4107 CsrWifiSmeListAction action;
4108 u8 setAddressesCount;
4109 CsrWifiMacAddress *setAddresses;
4110} CsrWifiSmeMulticastAddressReq;
4111
4112/*******************************************************************************
4113
4114 NAME
4115 CsrWifiSmePacketFilterSetReq
4116
4117 DESCRIPTION
4118 The wireless manager application should call this primitive to enable or
4119 disable filtering of broadcast packets: uninteresting broadcast packets
4120 will be dropped by the Wi-Fi chip, instead of passing them up to the
4121 host.
4122 This has the advantage of saving power in the host application processor
4123 as it removes the need to process unwanted packets.
4124 All broadcast packets are filtered according to the filter and the filter
4125 mode provided, except ARP packets, which are filtered using
4126 arpFilterAddress.
4127 Filters are not cumulative: only the parameters specified in the most
4128 recent successful request are significant.
4129 For more information, see 'UniFi Firmware API Specification'.
4130
4131 MEMBERS
4132 common - Common header for use with the CsrWifiFsm Module
4133 interfaceTag - Interface Identifier; unique identifier of an interface
4134 filterLength - Length of the filter in bytes.
4135 filterLength=0 disables the filter previously set
4136 filter - Points to the first byte of the filter provided, if any.
4137 This shall include zero or more instance of the
4138 information elements of one of these types
4139 * Traffic Classification (TCLAS) elements
4140 * WMM-SA TCLAS elements
4141 mode - Specifies whether the filter selects or excludes packets
4142 matching the filter
4143 arpFilterAddress - IPv4 address to be used for filtering the ARP packets.
4144 * If the specified address is the IPv4 broadcast address
4145 (255.255.255.255), all ARP packets are reported to the
4146 host,
4147 * If the specified address is NOT the IPv4 broadcast
4148 address, only ARP packets with the specified address in
4149 the Source or Target Protocol Address fields are reported
4150 to the host
4151
4152*******************************************************************************/
4153typedef struct
4154{
4155 CsrWifiFsmEvent common;
4156 u16 interfaceTag;
4157 u16 filterLength;
4158 u8 *filter;
4159 CsrWifiSmePacketFilterMode mode;
4160 CsrWifiIp4Address arpFilterAddress;
4161} CsrWifiSmePacketFilterSetReq;
4162
4163/*******************************************************************************
4164
4165 NAME
4166 CsrWifiSmePermanentMacAddressGetReq
4167
4168 DESCRIPTION
4169 This primitive retrieves the MAC address stored in EEPROM
4170
4171 MEMBERS
4172 common - Common header for use with the CsrWifiFsm Module
4173
4174*******************************************************************************/
4175typedef struct
4176{
4177 CsrWifiFsmEvent common;
4178} CsrWifiSmePermanentMacAddressGetReq;
4179
4180/*******************************************************************************
4181
4182 NAME
4183 CsrWifiSmePmkidReq
4184
4185 DESCRIPTION
4186 The wireless manager application calls this primitive to request an
4187 operation on the SME PMKID list.
4188 The action argument specifies the operation to perform.
4189 When the connection is complete, the wireless manager application may
4190 then send and receive EAPOL packets to complete WPA or WPA2
4191 authentication if appropriate.
4192 The wireless manager application can then pass the resulting encryption
4193 keys using this primitive.
4194
4195 MEMBERS
4196 common - Common header for use with the CsrWifiFsm Module
4197 interfaceTag - Interface Identifier; unique identifier of an interface
4198 action - The value of the CsrWifiSmeListAction parameter instructs
4199 the driver to modify or provide the list of PMKIDs.
4200 setPmkidsCount - Number of PMKIDs sent with the primitive
4201 setPmkids - Pointer to the list of PMKIDs sent with the primitive, set
4202 to NULL if none is sent.
4203
4204*******************************************************************************/
4205typedef struct
4206{
4207 CsrWifiFsmEvent common;
4208 u16 interfaceTag;
4209 CsrWifiSmeListAction action;
4210 u8 setPmkidsCount;
4211 CsrWifiSmePmkid *setPmkids;
4212} CsrWifiSmePmkidReq;
4213
4214/*******************************************************************************
4215
4216 NAME
4217 CsrWifiSmePowerConfigGetReq
4218
4219 DESCRIPTION
4220 This primitive gets the value of the PowerConfig parameter.
4221
4222 MEMBERS
4223 common - Common header for use with the CsrWifiFsm Module
4224
4225*******************************************************************************/
4226typedef struct
4227{
4228 CsrWifiFsmEvent common;
4229} CsrWifiSmePowerConfigGetReq;
4230
4231/*******************************************************************************
4232
4233 NAME
4234 CsrWifiSmePowerConfigSetReq
4235
4236 DESCRIPTION
4237 This primitive sets the value of the PowerConfig parameter.
4238
4239 MEMBERS
4240 common - Common header for use with the CsrWifiFsm Module
4241 powerConfig - Power saving configuration
4242
4243*******************************************************************************/
4244typedef struct
4245{
4246 CsrWifiFsmEvent common;
4247 CsrWifiSmePowerConfig powerConfig;
4248} CsrWifiSmePowerConfigSetReq;
4249
4250/*******************************************************************************
4251
4252 NAME
4253 CsrWifiSmeRegulatoryDomainInfoGetReq
4254
4255 DESCRIPTION
4256 This primitive gets the value of the RegulatoryDomainInfo parameter.
4257
4258 MEMBERS
4259 common - Common header for use with the CsrWifiFsm Module
4260
4261*******************************************************************************/
4262typedef struct
4263{
4264 CsrWifiFsmEvent common;
4265} CsrWifiSmeRegulatoryDomainInfoGetReq;
4266
4267/*******************************************************************************
4268
4269 NAME
4270 CsrWifiSmeRoamingConfigGetReq
4271
4272 DESCRIPTION
4273 This primitive gets the value of the RoamingConfig parameter.
4274
4275 MEMBERS
4276 common - Common header for use with the CsrWifiFsm Module
4277 interfaceTag - Interface Identifier; unique identifier of an interface
4278
4279*******************************************************************************/
4280typedef struct
4281{
4282 CsrWifiFsmEvent common;
4283 u16 interfaceTag;
4284} CsrWifiSmeRoamingConfigGetReq;
4285
4286/*******************************************************************************
4287
4288 NAME
4289 CsrWifiSmeRoamingConfigSetReq
4290
4291 DESCRIPTION
4292 This primitive sets the value of the RoamingConfig parameter.
4293
4294 MEMBERS
4295 common - Common header for use with the CsrWifiFsm Module
4296 interfaceTag - Interface Identifier; unique identifier of an interface
4297 roamingConfig - Desired roaming behaviour values
4298
4299*******************************************************************************/
4300typedef struct
4301{
4302 CsrWifiFsmEvent common;
4303 u16 interfaceTag;
4304 CsrWifiSmeRoamingConfig roamingConfig;
4305} CsrWifiSmeRoamingConfigSetReq;
4306
4307/*******************************************************************************
4308
4309 NAME
4310 CsrWifiSmeScanConfigGetReq
4311
4312 DESCRIPTION
4313 This primitive gets the value of the ScanConfig parameter.
4314
4315 MEMBERS
4316 common - Common header for use with the CsrWifiFsm Module
4317
4318*******************************************************************************/
4319typedef struct
4320{
4321 CsrWifiFsmEvent common;
4322} CsrWifiSmeScanConfigGetReq;
4323
4324/*******************************************************************************
4325
4326 NAME
4327 CsrWifiSmeScanConfigSetReq
4328
4329 DESCRIPTION
4330 This primitive sets the value of the ScanConfig parameter.
4331 The SME normally configures the firmware to perform autonomous scanning
4332 without involving the host.
4333 The firmware passes beacon / probe response or indicates loss of beacon
4334 on certain changes of state, for example:
4335 * A new AP is seen for the first time
4336 * An AP is no longer visible
4337 * The signal strength of an AP changes by more than a certain amount, as
4338 configured by the thresholds in the scanConfig parameter
4339 In addition to the autonomous scan, the wireless manager application may
4340 request a scan at any time using CSR_WIFI_SME_SCAN_FULL_REQ.
4341
4342 MEMBERS
4343 common - Common header for use with the CsrWifiFsm Module
4344 scanConfig - Reports the configuration for the autonomous scanning behaviour
4345 of the firmware
4346
4347*******************************************************************************/
4348typedef struct
4349{
4350 CsrWifiFsmEvent common;
4351 CsrWifiSmeScanConfig scanConfig;
4352} CsrWifiSmeScanConfigSetReq;
4353
4354/*******************************************************************************
4355
4356 NAME
4357 CsrWifiSmeScanFullReq
4358
4359 DESCRIPTION
4360 The wireless manager application should call this primitive to request a
4361 full scan.
4362 Channels are scanned actively or passively according to the requirement
4363 set by regulatory domain.
4364 If the SME receives this primitive while a full scan is going on, the new
4365 request is buffered and it will be served after the current full scan is
4366 completed.
4367
4368 MEMBERS
4369 common - Common header for use with the CsrWifiFsm Module
4370 ssidCount - Number of SSIDs provided.
4371 If it is 0, the SME will attempt to detect any network
4372 ssid - Points to the first SSID provided, if any.
4373 bssid - BSS identifier.
4374 If it is equal to FF-FF-FF-FF-FF, the SME will listen for
4375 messages from any BSS.
4376 If it is different from FF-FF-FF-FF-FF and any SSID is
4377 provided, one SSID must match the network of the BSS.
4378 forceScan - Forces the scan even if the SME is in a state which would
4379 normally prevent it (e.g. autonomous scan is running).
4380 bssType - Type of BSS to scan for
4381 scanType - Type of scan to perform
4382 channelListCount - Number of channels provided.
4383 If it is 0, the SME will initiate a scan of all the
4384 supported channels that are permitted by the current
4385 regulatory domain.
4386 channelList - Points to the first channel , or NULL if channelListCount
4387 is zero.
4388 probeIeLength - Length of the information element in bytes to be sent
4389 with the probe message.
4390 probeIe - Points to the first byte of the information element to be
4391 sent with the probe message.
4392
4393*******************************************************************************/
4394typedef struct
4395{
4396 CsrWifiFsmEvent common;
4397 u8 ssidCount;
4398 CsrWifiSsid *ssid;
4399 CsrWifiMacAddress bssid;
4400 u8 forceScan;
4401 CsrWifiSmeBssType bssType;
4402 CsrWifiSmeScanType scanType;
4403 u16 channelListCount;
4404 u8 *channelList;
4405 u16 probeIeLength;
4406 u8 *probeIe;
4407} CsrWifiSmeScanFullReq;
4408
4409/*******************************************************************************
4410
4411 NAME
4412 CsrWifiSmeScanResultsFlushReq
4413
4414 DESCRIPTION
4415 The Wireless Manager calls this primitive to ask the SME to delete all
4416 scan results from its cache, except for the scan result of any currently
4417 connected network.
4418 As scan results are received by the SME from the firmware, they are
4419 cached in the SME memory.
4420 Any time the Wireless Manager requests scan results, they are returned
4421 from the SME internal cache.
4422 For some applications it may be desirable to clear this cache prior to
4423 requesting that a scan be performed; this will ensure that the cache then
4424 only contains the networks detected in the most recent scan.
4425
4426 MEMBERS
4427 common - Common header for use with the CsrWifiFsm Module
4428
4429*******************************************************************************/
4430typedef struct
4431{
4432 CsrWifiFsmEvent common;
4433} CsrWifiSmeScanResultsFlushReq;
4434
4435/*******************************************************************************
4436
4437 NAME
4438 CsrWifiSmeScanResultsGetReq
4439
4440 DESCRIPTION
4441 The wireless manager application calls this primitive to retrieve the
4442 current set of scan results, either after receiving a successful
4443 CSR_WIFI_SME_SCAN_FULL_CFM, or to get autonomous scan results.
4444
4445 MEMBERS
4446 common - Common header for use with the CsrWifiFsm Module
4447
4448*******************************************************************************/
4449typedef struct
4450{
4451 CsrWifiFsmEvent common;
4452} CsrWifiSmeScanResultsGetReq;
4453
4454/*******************************************************************************
4455
4456 NAME
4457 CsrWifiSmeSmeStaConfigGetReq
4458
4459 DESCRIPTION
4460 This primitive gets the value of the SmeStaConfig parameter.
4461
4462 MEMBERS
4463 common - Common header for use with the CsrWifiFsm Module
4464 interfaceTag - Interface Identifier; unique identifier of an interface
4465
4466*******************************************************************************/
4467typedef struct
4468{
4469 CsrWifiFsmEvent common;
4470 u16 interfaceTag;
4471} CsrWifiSmeSmeStaConfigGetReq;
4472
4473/*******************************************************************************
4474
4475 NAME
4476 CsrWifiSmeSmeStaConfigSetReq
4477
4478 DESCRIPTION
4479 This primitive sets the value of the SmeConfig parameter.
4480
4481 MEMBERS
4482 common - Common header for use with the CsrWifiFsm Module
4483 interfaceTag - Interface Identifier; unique identifier of an interface
4484 smeConfig - SME Station Parameters to be set
4485
4486*******************************************************************************/
4487typedef struct
4488{
4489 CsrWifiFsmEvent common;
4490 u16 interfaceTag;
4491 CsrWifiSmeStaConfig smeConfig;
4492} CsrWifiSmeSmeStaConfigSetReq;
4493
4494/*******************************************************************************
4495
4496 NAME
4497 CsrWifiSmeStationMacAddressGetReq
4498
4499 DESCRIPTION
4500 This primitives is used to retrieve the current MAC address used by the
4501 station.
4502
4503 MEMBERS
4504 common - Common header for use with the CsrWifiFsm Module
4505
4506*******************************************************************************/
4507typedef struct
4508{
4509 CsrWifiFsmEvent common;
4510} CsrWifiSmeStationMacAddressGetReq;
4511
4512/*******************************************************************************
4513
4514 NAME
4515 CsrWifiSmeTspecReq
4516
4517 DESCRIPTION
4518 The wireless manager application should call this primitive to use the
4519 TSPEC feature.
4520 The chip supports the use of TSPECs and TCLAS for the use of IEEE
4521 802.11/WMM Quality of Service features.
4522 The API allows the wireless manager application to supply a correctly
4523 formatted TSPEC and TCLAS pair to the driver.
4524 After performing basic validation, the driver negotiates the installation
4525 of the TSPEC with the AP as defined by the 802.11 specification.
4526 The driver retains all TSPEC and TCLAS pairs until they are specifically
4527 removed.
4528 It is not compulsory for a TSPEC to have a TCLAS (NULL is used to
4529 indicate that no TCLAS is supplied), while a TCLASS always require a
4530 TSPEC.
4531 The format of the TSPEC element is specified in 'WMM (including WMM Power
4532 Save) Specification - Version 1.1' and 'ANSI/IEEE Std 802.11-REVmb/D3.0'.
4533 For more information, see 'UniFi Configuring WMM and WMM-PS'.
4534
4535 MEMBERS
4536 common - Common header for use with the CsrWifiFsm Module
4537 interfaceTag - Interface Identifier; unique identifier of an interface
4538 action - Specifies the action to be carried out on the list of TSPECs.
4539 CSR_WIFI_SME_LIST_ACTION_FLUSH is not applicable here.
4540 transactionId - Unique Transaction ID for the TSPEC, as assigned by the
4541 driver
4542 strict - If it set to false, allows the SME to perform automatic
4543 TSPEC negotiation
4544 ctrlMask - Additional TSPEC configuration for CCX.
4545 Set mask with values from CsrWifiSmeTspecCtrl.
4546 CURRENTLY NOT SUPPORTED
4547 tspecLength - Length of the TSPEC.
4548 tspec - Points to the first byte of the TSPEC
4549 tclasLength - Length of the TCLAS.
4550 If it is equal to 0, no TCLASS is provided for the TSPEC
4551 tclas - Points to the first byte of the TCLAS, if any.
4552
4553*******************************************************************************/
4554typedef struct
4555{
4556 CsrWifiFsmEvent common;
4557 u16 interfaceTag;
4558 CsrWifiSmeListAction action;
4559 u32 transactionId;
4560 u8 strict;
4561 CsrWifiSmeTspecCtrlMask ctrlMask;
4562 u16 tspecLength;
4563 u8 *tspec;
4564 u16 tclasLength;
4565 u8 *tclas;
4566} CsrWifiSmeTspecReq;
4567
4568/*******************************************************************************
4569
4570 NAME
4571 CsrWifiSmeVersionsGetReq
4572
4573 DESCRIPTION
4574 This primitive gets the value of the Versions parameter.
4575
4576 MEMBERS
4577 common - Common header for use with the CsrWifiFsm Module
4578
4579*******************************************************************************/
4580typedef struct
4581{
4582 CsrWifiFsmEvent common;
4583} CsrWifiSmeVersionsGetReq;
4584
4585/*******************************************************************************
4586
4587 NAME
4588 CsrWifiSmeWifiFlightmodeReq
4589
4590 DESCRIPTION
4591 The wireless manager application may call this primitive on boot-up of
4592 the platform to ensure that the chip is placed in a mode that prevents
4593 any emission of RF energy.
4594 This primitive is an alternative to CSR_WIFI_SME_WIFI_ON_REQ.
4595 As in CSR_WIFI_SME_WIFI_ON_REQ, it causes the download of the patch file
4596 (if any) and the programming of the initial MIB settings (if supplied by
4597 the WMA), but it also ensures that the chip is left in its lowest
4598 possible power-mode with the radio subsystems disabled.
4599 This feature is useful on platforms where power cannot be removed from
4600 the chip (leaving the chip not initialised will cause it to consume more
4601 power so calling this function ensures that the chip is initialised into
4602 a low power mode but without entering a state where it could emit any RF
4603 energy).
4604 NOTE: this primitive does not cause the Wi-Fi to change state: Wi-Fi
4605 stays conceptually off. Configuration primitives can be sent after
4606 CSR_WIFI_SME_WIFI_FLIGHTMODE_REQ and the configuration will be maintained.
4607 Requests that require the state of the Wi-Fi to be ON will return
4608 CSR_WIFI_SME_STATUS_WIFI_OFF in their confirms.
4609
4610 MEMBERS
4611 common - Common header for use with the CsrWifiFsm Module
4612 address - Optionally specifies a station MAC address.
4613 In normal use, the manager should set the address to 0xFF
4614 0xFF 0xFF 0xFF 0xFF 0xFF, which will cause the chip to use
4615 the MAC address in the MIB.
4616 mibFilesCount - Number of provided data blocks with initial MIB values
4617 mibFiles - Points to the first data block with initial MIB values.
4618 These data blocks are typically the contents of the provided
4619 files ufmib.dat and localmib.dat, available from the host
4620 file system, if they exist.
4621 These files typically contain radio tuning and calibration
4622 values.
4623 More values can be created using the Host Tools.
4624
4625*******************************************************************************/
4626typedef struct
4627{
4628 CsrWifiFsmEvent common;
4629 CsrWifiMacAddress address;
4630 u16 mibFilesCount;
4631 CsrWifiSmeDataBlock *mibFiles;
4632} CsrWifiSmeWifiFlightmodeReq;
4633
4634/*******************************************************************************
4635
4636 NAME
4637 CsrWifiSmeWifiOffReq
4638
4639 DESCRIPTION
4640 The wireless manager application calls this primitive to turn off the
4641 chip, thus saving power when Wi-Fi is not in use.
4642
4643 MEMBERS
4644 common - Common header for use with the CsrWifiFsm Module
4645
4646*******************************************************************************/
4647typedef struct
4648{
4649 CsrWifiFsmEvent common;
4650} CsrWifiSmeWifiOffReq;
4651
4652/*******************************************************************************
4653
4654 NAME
4655 CsrWifiSmeWifiOnReq
4656
4657 DESCRIPTION
4658 The wireless manager application calls this primitive to turn on the
4659 Wi-Fi chip.
4660 If the Wi-Fi chip is currently off, the SME turns the Wi-Fi chip on,
4661 downloads the patch file (if any), and programs the initial MIB settings
4662 (if supplied by the WMA).
4663 The patch file is not provided with the SME API; its downloading is
4664 automatic and handled internally by the system.
4665 The MIB settings, when provided, override the default values that the
4666 firmware loads from EEPROM.
4667 If the Wi-Fi chip is already on, the SME takes no action and returns a
4668 successful status in the confirm.
4669
4670 MEMBERS
4671 common - Common header for use with the CsrWifiFsm Module
4672 address - Optionally specifies a station MAC address.
4673 In normal use, the manager should set the address to 0xFF
4674 0xFF 0xFF 0xFF 0xFF 0xFF, which will cause the chip to use
4675 the MAC address in the MIB
4676 mibFilesCount - Number of provided data blocks with initial MIB values
4677 mibFiles - Points to the first data block with initial MIB values.
4678 These data blocks are typically the contents of the provided
4679 files ufmib.dat and localmib.dat, available from the host
4680 file system, if they exist.
4681 These files typically contain radio tuning and calibration
4682 values.
4683 More values can be created using the Host Tools.
4684
4685*******************************************************************************/
4686typedef struct
4687{
4688 CsrWifiFsmEvent common;
4689 CsrWifiMacAddress address;
4690 u16 mibFilesCount;
4691 CsrWifiSmeDataBlock *mibFiles;
4692} CsrWifiSmeWifiOnReq;
4693
4694/*******************************************************************************
4695
4696 NAME
4697 CsrWifiSmeCloakedSsidsSetReq
4698
4699 DESCRIPTION
4700 This primitive sets the list of cloaked SSIDs for which the WMA possesses
4701 profiles.
4702 When the driver detects a cloaked AP, the SME will explicitly scan for it
4703 using the list of cloaked SSIDs provided it, and, if the scan succeeds,
4704 it will report the AP to the WMA either via CSR_WIFI_SME_SCAN_RESULT_IND
4705 (if registered) or via CSR_WIFI_SCAN_RESULT_GET_CFM.
4706
4707 MEMBERS
4708 common - Common header for use with the CsrWifiFsm Module
4709 cloakedSsids - Sets the list of cloaked SSIDs
4710
4711*******************************************************************************/
4712typedef struct
4713{
4714 CsrWifiFsmEvent common;
4715 CsrWifiSmeCloakedSsidConfig cloakedSsids;
4716} CsrWifiSmeCloakedSsidsSetReq;
4717
4718/*******************************************************************************
4719
4720 NAME
4721 CsrWifiSmeCloakedSsidsGetReq
4722
4723 DESCRIPTION
4724 This primitive gets the value of the CloakedSsids parameter.
4725
4726 MEMBERS
4727 common - Common header for use with the CsrWifiFsm Module
4728
4729*******************************************************************************/
4730typedef struct
4731{
4732 CsrWifiFsmEvent common;
4733} CsrWifiSmeCloakedSsidsGetReq;
4734
4735/*******************************************************************************
4736
4737 NAME
4738 CsrWifiSmeSmeCommonConfigGetReq
4739
4740 DESCRIPTION
4741 This primitive gets the value of the Sme common parameter.
4742
4743 MEMBERS
4744 common - Common header for use with the CsrWifiFsm Module
4745
4746*******************************************************************************/
4747typedef struct
4748{
4749 CsrWifiFsmEvent common;
4750} CsrWifiSmeSmeCommonConfigGetReq;
4751
4752/*******************************************************************************
4753
4754 NAME
4755 CsrWifiSmeSmeCommonConfigSetReq
4756
4757 DESCRIPTION
4758 This primitive sets the value of the Sme common.
4759
4760 MEMBERS
4761 common - Common header for use with the CsrWifiFsm Module
4762 deviceConfig - Configuration options in the SME
4763
4764*******************************************************************************/
4765typedef struct
4766{
4767 CsrWifiFsmEvent common;
4768 CsrWifiSmeDeviceConfig deviceConfig;
4769} CsrWifiSmeSmeCommonConfigSetReq;
4770
4771/*******************************************************************************
4772
4773 NAME
4774 CsrWifiSmeInterfaceCapabilityGetReq
4775
4776 DESCRIPTION
4777 The Wireless Manager calls this primitive to ask the SME for the
4778 capabilities of the supported interfaces
4779
4780 MEMBERS
4781 common - Common header for use with the CsrWifiFsm Module
4782
4783*******************************************************************************/
4784typedef struct
4785{
4786 CsrWifiFsmEvent common;
4787} CsrWifiSmeInterfaceCapabilityGetReq;
4788
4789/*******************************************************************************
4790
4791 NAME
4792 CsrWifiSmeWpsConfigurationReq
4793
4794 DESCRIPTION
4795 This primitive passes the WPS information for the device to SME. This may
4796 be accepted only if no interface is active.
4797
4798 MEMBERS
4799 common - Common header for use with the CsrWifiFsm Module
4800 wpsConfig - WPS config.
4801
4802*******************************************************************************/
4803typedef struct
4804{
4805 CsrWifiFsmEvent common;
4806 CsrWifiSmeWpsConfig wpsConfig;
4807} CsrWifiSmeWpsConfigurationReq;
4808
4809/*******************************************************************************
4810
4811 NAME
4812 CsrWifiSmeSetReq
4813
4814 DESCRIPTION
4815 Used to pass custom data to the SME. Format is the same as 802.11 Info
4816 Elements => | Id | Length | Data
4817 1) Cmanr Test Mode "Id:0 Length:1 Data:0x00 = OFF 0x01 = ON" "0x00 0x01
4818 (0x00|0x01)"
4819
4820 MEMBERS
4821 common - Common header for use with the CsrWifiFsm Module
4822 dataLength - Number of bytes in the buffer pointed to by 'data'
4823 data - Pointer to the buffer containing 'dataLength' bytes
4824
4825*******************************************************************************/
4826typedef struct
4827{
4828 CsrWifiFsmEvent common;
4829 u32 dataLength;
4830 u8 *data;
4831} CsrWifiSmeSetReq;
4832
4833/*******************************************************************************
4834
4835 NAME
4836 CsrWifiSmeActivateCfm
4837
4838 DESCRIPTION
4839 The SME sends this primitive when the activation is complete.
4840
4841 MEMBERS
4842 common - Common header for use with the CsrWifiFsm Module
4843 status - Reports the result of the request
4844
4845*******************************************************************************/
4846typedef struct
4847{
4848 CsrWifiFsmEvent common;
4849 CsrResult status;
4850} CsrWifiSmeActivateCfm;
4851
4852/*******************************************************************************
4853
4854 NAME
4855 CsrWifiSmeAdhocConfigGetCfm
4856
4857 DESCRIPTION
4858 This primitive reports the result of the request.
4859
4860 MEMBERS
4861 common - Common header for use with the CsrWifiFsm Module
4862 status - Reports the result of the request
4863 adHocConfig - Contains the values used when starting an Ad-hoc (IBSS)
4864 connection.
4865
4866*******************************************************************************/
4867typedef struct
4868{
4869 CsrWifiFsmEvent common;
4870 CsrResult status;
4871 CsrWifiSmeAdHocConfig adHocConfig;
4872} CsrWifiSmeAdhocConfigGetCfm;
4873
4874/*******************************************************************************
4875
4876 NAME
4877 CsrWifiSmeAdhocConfigSetCfm
4878
4879 DESCRIPTION
4880 This primitive reports the result of the request.
4881
4882 MEMBERS
4883 common - Common header for use with the CsrWifiFsm Module
4884 status - Reports the result of the request
4885
4886*******************************************************************************/
4887typedef struct
4888{
4889 CsrWifiFsmEvent common;
4890 CsrResult status;
4891} CsrWifiSmeAdhocConfigSetCfm;
4892
4893/*******************************************************************************
4894
4895 NAME
4896 CsrWifiSmeAssociationCompleteInd
4897
4898 DESCRIPTION
4899 The SME will send this primitive to all the tasks that have registered to
4900 receive it whenever it completes an attempt to associate with an AP. If
4901 the association was successful, status will be set to
4902 CSR_WIFI_SME_STATUS_SUCCESS, otherwise status and deauthReason shall be
4903 set to appropriate error codes.
4904
4905 MEMBERS
4906 common - Common header for use with the CsrWifiFsm Module
4907 interfaceTag - Interface Identifier; unique identifier of an interface
4908 status - Reports the result of the association procedure
4909 connectionInfo - This parameter is relevant only if result is
4910 CSR_WIFI_SME_STATUS_SUCCESS:
4911 it points to the connection information for the new network
4912 deauthReason - This parameter is relevant only if result is not
4913 CSR_WIFI_SME_STATUS_SUCCESS:
4914 if the AP deauthorised the station, it gives the reason of
4915 the deauthorization
4916
4917*******************************************************************************/
4918typedef struct
4919{
4920 CsrWifiFsmEvent common;
4921 u16 interfaceTag;
4922 CsrResult status;
4923 CsrWifiSmeConnectionInfo connectionInfo;
4924 CsrWifiSmeIEEE80211Reason deauthReason;
4925} CsrWifiSmeAssociationCompleteInd;
4926
4927/*******************************************************************************
4928
4929 NAME
4930 CsrWifiSmeAssociationStartInd
4931
4932 DESCRIPTION
4933 The SME will send this primitive to all the tasks that have registered to
4934 receive it whenever it begins an attempt to associate with an AP.
4935
4936 MEMBERS
4937 common - Common header for use with the CsrWifiFsm Module
4938 interfaceTag - Interface Identifier; unique identifier of an interface
4939 address - BSSID of the associating network
4940 ssid - Service Set identifier of the associating network
4941
4942*******************************************************************************/
4943typedef struct
4944{
4945 CsrWifiFsmEvent common;
4946 u16 interfaceTag;
4947 CsrWifiMacAddress address;
4948 CsrWifiSsid ssid;
4949} CsrWifiSmeAssociationStartInd;
4950
4951/*******************************************************************************
4952
4953 NAME
4954 CsrWifiSmeBlacklistCfm
4955
4956 DESCRIPTION
4957 The SME will call this primitive when the action on the blacklist has
4958 completed. For a GET action, this primitive also reports the list of
4959 BBSIDs in the blacklist.
4960
4961 MEMBERS
4962 common - Common header for use with the CsrWifiFsm Module
4963 interfaceTag - Interface Identifier; unique identifier of an interface
4964 status - Reports the result of the request
4965 action - Action in the request
4966 getAddressCount - This parameter is only relevant if action is
4967 CSR_WIFI_SME_LIST_ACTION_GET:
4968 number of BSSIDs sent with this primitive
4969 getAddresses - Pointer to the list of BBSIDs sent with the primitive, set
4970 to NULL if none is sent.
4971
4972*******************************************************************************/
4973typedef struct
4974{
4975 CsrWifiFsmEvent common;
4976 u16 interfaceTag;
4977 CsrResult status;
4978 CsrWifiSmeListAction action;
4979 u8 getAddressCount;
4980 CsrWifiMacAddress *getAddresses;
4981} CsrWifiSmeBlacklistCfm;
4982
4983/*******************************************************************************
4984
4985 NAME
4986 CsrWifiSmeCalibrationDataGetCfm
4987
4988 DESCRIPTION
4989 This primitive reports the result of the request.
4990
4991 MEMBERS
4992 common - Common header for use with the CsrWifiFsm Module
4993 status - Reports the result of the request
4994 calibrationDataLength - Number of bytes in the buffer pointed by
4995 calibrationData
4996 calibrationData - Pointer to a buffer of length calibrationDataLength
4997 containing the calibration data
4998
4999*******************************************************************************/
5000typedef struct
5001{
5002 CsrWifiFsmEvent common;
5003 CsrResult status;
5004 u16 calibrationDataLength;
5005 u8 *calibrationData;
5006} CsrWifiSmeCalibrationDataGetCfm;
5007
5008/*******************************************************************************
5009
5010 NAME
5011 CsrWifiSmeCalibrationDataSetCfm
5012
5013 DESCRIPTION
5014 This primitive reports the result of the request.
5015
5016 MEMBERS
5017 common - Common header for use with the CsrWifiFsm Module
5018 status - Reports the result of the request
5019
5020*******************************************************************************/
5021typedef struct
5022{
5023 CsrWifiFsmEvent common;
5024 CsrResult status;
5025} CsrWifiSmeCalibrationDataSetCfm;
5026
5027/*******************************************************************************
5028
5029 NAME
5030 CsrWifiSmeCcxConfigGetCfm
5031
5032 DESCRIPTION
5033 This primitive reports the result of the request.
5034
5035 MEMBERS
5036 common - Common header for use with the CsrWifiFsm Module
5037 interfaceTag - Interface Identifier; unique identifier of an interface
5038 status - Reports the result of the request
5039 ccxConfig - Currently not supported
5040
5041*******************************************************************************/
5042typedef struct
5043{
5044 CsrWifiFsmEvent common;
5045 u16 interfaceTag;
5046 CsrResult status;
5047 CsrWifiSmeCcxConfig ccxConfig;
5048} CsrWifiSmeCcxConfigGetCfm;
5049
5050/*******************************************************************************
5051
5052 NAME
5053 CsrWifiSmeCcxConfigSetCfm
5054
5055 DESCRIPTION
5056 This primitive reports the result of the request.
5057
5058 MEMBERS
5059 common - Common header for use with the CsrWifiFsm Module
5060 interfaceTag - Interface Identifier; unique identifier of an interface
5061 status - Reports the result of the request
5062
5063*******************************************************************************/
5064typedef struct
5065{
5066 CsrWifiFsmEvent common;
5067 u16 interfaceTag;
5068 CsrResult status;
5069} CsrWifiSmeCcxConfigSetCfm;
5070
5071/*******************************************************************************
5072
5073 NAME
5074 CsrWifiSmeCoexConfigGetCfm
5075
5076 DESCRIPTION
5077 This primitive reports the result of the request.
5078
5079 MEMBERS
5080 common - Common header for use with the CsrWifiFsm Module
5081 status - Reports the result of the request
5082 coexConfig - Reports the parameters used to configure the coexistence
5083 behaviour
5084
5085*******************************************************************************/
5086typedef struct
5087{
5088 CsrWifiFsmEvent common;
5089 CsrResult status;
5090 CsrWifiSmeCoexConfig coexConfig;
5091} CsrWifiSmeCoexConfigGetCfm;
5092
5093/*******************************************************************************
5094
5095 NAME
5096 CsrWifiSmeCoexConfigSetCfm
5097
5098 DESCRIPTION
5099 This primitive reports the result of the request.
5100
5101 MEMBERS
5102 common - Common header for use with the CsrWifiFsm Module
5103 status - Reports the result of the request
5104
5105*******************************************************************************/
5106typedef struct
5107{
5108 CsrWifiFsmEvent common;
5109 CsrResult status;
5110} CsrWifiSmeCoexConfigSetCfm;
5111
5112/*******************************************************************************
5113
5114 NAME
5115 CsrWifiSmeCoexInfoGetCfm
5116
5117 DESCRIPTION
5118 This primitive reports the result of the request.
5119
5120 MEMBERS
5121 common - Common header for use with the CsrWifiFsm Module
5122 status - Reports the result of the request
5123 coexInfo - Reports information and state related to coexistence.
5124
5125*******************************************************************************/
5126typedef struct
5127{
5128 CsrWifiFsmEvent common;
5129 CsrResult status;
5130 CsrWifiSmeCoexInfo coexInfo;
5131} CsrWifiSmeCoexInfoGetCfm;
5132
5133/*******************************************************************************
5134
5135 NAME
5136 CsrWifiSmeConnectCfm
5137
5138 DESCRIPTION
5139 The SME calls this primitive when the connection exchange is complete or
5140 all connection attempts fail.
5141
5142 MEMBERS
5143 common - Common header for use with the CsrWifiFsm Module
5144 interfaceTag - Interface Identifier; unique identifier of an interface
5145 status - Reports the result of the request.
5146 CSR_WIFI_SME_STATUS_NOT_FOUND: all attempts by the SME to
5147 locate the requested AP failed
5148
5149*******************************************************************************/
5150typedef struct
5151{
5152 CsrWifiFsmEvent common;
5153 u16 interfaceTag;
5154 CsrResult status;
5155} CsrWifiSmeConnectCfm;
5156
5157/*******************************************************************************
5158
5159 NAME
5160 CsrWifiSmeConnectionConfigGetCfm
5161
5162 DESCRIPTION
5163 This primitive reports the result of the request.
5164
5165 MEMBERS
5166 common - Common header for use with the CsrWifiFsm Module
5167 interfaceTag - Interface Identifier; unique identifier of an interface
5168 status - Reports the result of the request
5169 connectionConfig - Parameters used by the SME for selecting a network
5170
5171*******************************************************************************/
5172typedef struct
5173{
5174 CsrWifiFsmEvent common;
5175 u16 interfaceTag;
5176 CsrResult status;
5177 CsrWifiSmeConnectionConfig connectionConfig;
5178} CsrWifiSmeConnectionConfigGetCfm;
5179
5180/*******************************************************************************
5181
5182 NAME
5183 CsrWifiSmeConnectionInfoGetCfm
5184
5185 DESCRIPTION
5186 This primitive reports the result of the request.
5187
5188 MEMBERS
5189 common - Common header for use with the CsrWifiFsm Module
5190 interfaceTag - Interface Identifier; unique identifier of an interface
5191 status - Reports the result of the request
5192 connectionInfo - Information about the current connection
5193
5194*******************************************************************************/
5195typedef struct
5196{
5197 CsrWifiFsmEvent common;
5198 u16 interfaceTag;
5199 CsrResult status;
5200 CsrWifiSmeConnectionInfo connectionInfo;
5201} CsrWifiSmeConnectionInfoGetCfm;
5202
5203/*******************************************************************************
5204
5205 NAME
5206 CsrWifiSmeConnectionQualityInd
5207
5208 DESCRIPTION
5209 The SME sends this primitive to all the tasks that have registered to
5210 receive it whenever the value of the current connection quality
5211 parameters change by more than a certain configurable amount.
5212 The wireless manager application may configure the trigger thresholds for
5213 this indication using the field in smeConfig parameter of
5214 CSR_WIFI_SME_SME_CONFIG_SET_REQ.
5215 Connection quality messages can be suppressed by setting both thresholds
5216 to zero.
5217
5218 MEMBERS
5219 common - Common header for use with the CsrWifiFsm Module
5220 interfaceTag - Interface Identifier; unique identifier of an interface
5221 linkQuality - Indicates the quality of the link
5222
5223*******************************************************************************/
5224typedef struct
5225{
5226 CsrWifiFsmEvent common;
5227 u16 interfaceTag;
5228 CsrWifiSmeLinkQuality linkQuality;
5229} CsrWifiSmeConnectionQualityInd;
5230
5231/*******************************************************************************
5232
5233 NAME
5234 CsrWifiSmeConnectionStatsGetCfm
5235
5236 DESCRIPTION
5237 This primitive reports the result of the request.
5238
5239 MEMBERS
5240 common - Common header for use with the CsrWifiFsm Module
5241 interfaceTag - Interface Identifier; unique identifier of an interface
5242 status - Reports the result of the request
5243 connectionStats - Statistics for current connection.
5244
5245*******************************************************************************/
5246typedef struct
5247{
5248 CsrWifiFsmEvent common;
5249 u16 interfaceTag;
5250 CsrResult status;
5251 CsrWifiSmeConnectionStats connectionStats;
5252} CsrWifiSmeConnectionStatsGetCfm;
5253
5254/*******************************************************************************
5255
5256 NAME
5257 CsrWifiSmeDeactivateCfm
5258
5259 DESCRIPTION
5260 The SME sends this primitive when the deactivation is complete.
5261 The WMA cannot send any more primitives until it actives the SME again
5262 sending another CSR_WIFI_SME_ACTIVATE_REQ.
5263
5264 MEMBERS
5265 common - Common header for use with the CsrWifiFsm Module
5266 status - Reports the result of the request
5267
5268*******************************************************************************/
5269typedef struct
5270{
5271 CsrWifiFsmEvent common;
5272 CsrResult status;
5273} CsrWifiSmeDeactivateCfm;
5274
5275/*******************************************************************************
5276
5277 NAME
5278 CsrWifiSmeDisconnectCfm
5279
5280 DESCRIPTION
5281 On reception of CSR_WIFI_SME_DISCONNECT_REQ the SME will perform a
5282 disconnect operation, sending a CsrWifiSmeMediaStatusInd with
5283 CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED and then call this primitive when
5284 disconnection is complete.
5285
5286 MEMBERS
5287 common - Common header for use with the CsrWifiFsm Module
5288 interfaceTag - Interface Identifier; unique identifier of an interface
5289 status - Reports the result of the request
5290
5291*******************************************************************************/
5292typedef struct
5293{
5294 CsrWifiFsmEvent common;
5295 u16 interfaceTag;
5296 CsrResult status;
5297} CsrWifiSmeDisconnectCfm;
5298
5299/*******************************************************************************
5300
5301 NAME
5302 CsrWifiSmeEventMaskSetCfm
5303
5304 DESCRIPTION
5305 The SME calls the primitive to report the result of the request
5306 primitive.
5307
5308 MEMBERS
5309 common - Common header for use with the CsrWifiFsm Module
5310 status - Reports the result of the request
5311
5312*******************************************************************************/
5313typedef struct
5314{
5315 CsrWifiFsmEvent common;
5316 CsrResult status;
5317} CsrWifiSmeEventMaskSetCfm;
5318
5319/*******************************************************************************
5320
5321 NAME
5322 CsrWifiSmeHostConfigGetCfm
5323
5324 DESCRIPTION
5325 This primitive reports the result of the request.
5326
5327 MEMBERS
5328 common - Common header for use with the CsrWifiFsm Module
5329 interfaceTag - Interface Identifier; unique identifier of an interface
5330 status - Reports the result of the request
5331 hostConfig - Current host power state.
5332
5333*******************************************************************************/
5334typedef struct
5335{
5336 CsrWifiFsmEvent common;
5337 u16 interfaceTag;
5338 CsrResult status;
5339 CsrWifiSmeHostConfig hostConfig;
5340} CsrWifiSmeHostConfigGetCfm;
5341
5342/*******************************************************************************
5343
5344 NAME
5345 CsrWifiSmeHostConfigSetCfm
5346
5347 DESCRIPTION
5348 This primitive reports the result of the request.
5349
5350 MEMBERS
5351 common - Common header for use with the CsrWifiFsm Module
5352 interfaceTag - Interface Identifier; unique identifier of an interface
5353 status - Reports the result of the request
5354
5355*******************************************************************************/
5356typedef struct
5357{
5358 CsrWifiFsmEvent common;
5359 u16 interfaceTag;
5360 CsrResult status;
5361} CsrWifiSmeHostConfigSetCfm;
5362
5363/*******************************************************************************
5364
5365 NAME
5366 CsrWifiSmeIbssStationInd
5367
5368 DESCRIPTION
5369 The SME will send this primitive to indicate that a station has joined or
5370 left the ad-hoc network.
5371
5372 MEMBERS
5373 common - Common header for use with the CsrWifiFsm Module
5374 address - MAC address of the station that has joined or left
5375 isconnected - TRUE if the station joined, FALSE if the station left
5376
5377*******************************************************************************/
5378typedef struct
5379{
5380 CsrWifiFsmEvent common;
5381 CsrWifiMacAddress address;
5382 u8 isconnected;
5383} CsrWifiSmeIbssStationInd;
5384
5385/*******************************************************************************
5386
5387 NAME
5388 CsrWifiSmeKeyCfm
5389
5390 DESCRIPTION
5391 The SME calls the primitive to report the result of the request
5392 primitive.
5393
5394 MEMBERS
5395 common - Common header for use with the CsrWifiFsm Module
5396 interfaceTag - Interface Identifier; unique identifier of an interface
5397 status - Reports the result of the request
5398 action - Action in the request
5399 keyType - Type of the key added/deleted
5400 peerMacAddress - Peer MAC Address of the key added/deleted
5401
5402*******************************************************************************/
5403typedef struct
5404{
5405 CsrWifiFsmEvent common;
5406 u16 interfaceTag;
5407 CsrResult status;
5408 CsrWifiSmeListAction action;
5409 CsrWifiSmeKeyType keyType;
5410 CsrWifiMacAddress peerMacAddress;
5411} CsrWifiSmeKeyCfm;
5412
5413/*******************************************************************************
5414
5415 NAME
5416 CsrWifiSmeLinkQualityGetCfm
5417
5418 DESCRIPTION
5419 This primitive reports the result of the request.
5420
5421 MEMBERS
5422 common - Common header for use with the CsrWifiFsm Module
5423 interfaceTag - Interface Identifier; unique identifier of an interface
5424 status - Reports the result of the request
5425 linkQuality - Indicates the quality of the link
5426
5427*******************************************************************************/
5428typedef struct
5429{
5430 CsrWifiFsmEvent common;
5431 u16 interfaceTag;
5432 CsrResult status;
5433 CsrWifiSmeLinkQuality linkQuality;
5434} CsrWifiSmeLinkQualityGetCfm;
5435
5436/*******************************************************************************
5437
5438 NAME
5439 CsrWifiSmeMediaStatusInd
5440
5441 DESCRIPTION
5442 The SME sends this primitive to all the tasks that have registered to
5443 receive it when a network connection is established, lost or has moved to
5444 another AP.
5445
5446 MEMBERS
5447 common - Common header for use with the CsrWifiFsm Module
5448 interfaceTag - Interface Identifier; unique identifier of an interface
5449 mediaStatus - Indicates the media status
5450 connectionInfo - This parameter is relevant only if the mediaStatus is
5451 CSR_WIFI_SME_MEDIA_STATUS_CONNECTED:
5452 it points to the connection information for the new network
5453 disassocReason - This parameter is relevant only if the mediaStatus is
5454 CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED:
5455 if a disassociation has occurred it gives the reason of the
5456 disassociation
5457 deauthReason - This parameter is relevant only if the mediaStatus is
5458 CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED:
5459 if a deauthentication has occurred it gives the reason of
5460 the deauthentication
5461
5462*******************************************************************************/
5463typedef struct
5464{
5465 CsrWifiFsmEvent common;
5466 u16 interfaceTag;
5467 CsrWifiSmeMediaStatus mediaStatus;
5468 CsrWifiSmeConnectionInfo connectionInfo;
5469 CsrWifiSmeIEEE80211Reason disassocReason;
5470 CsrWifiSmeIEEE80211Reason deauthReason;
5471} CsrWifiSmeMediaStatusInd;
5472
5473/*******************************************************************************
5474
5475 NAME
5476 CsrWifiSmeMibConfigGetCfm
5477
5478 DESCRIPTION
5479 This primitive reports the result of the request.
5480
5481 MEMBERS
5482 common - Common header for use with the CsrWifiFsm Module
5483 status - Reports the result of the request
5484 mibConfig - Reports various IEEE 802.11 attributes as currently configured
5485
5486*******************************************************************************/
5487typedef struct
5488{
5489 CsrWifiFsmEvent common;
5490 CsrResult status;
5491 CsrWifiSmeMibConfig mibConfig;
5492} CsrWifiSmeMibConfigGetCfm;
5493
5494/*******************************************************************************
5495
5496 NAME
5497 CsrWifiSmeMibConfigSetCfm
5498
5499 DESCRIPTION
5500 This primitive reports the result of the request.
5501
5502 MEMBERS
5503 common - Common header for use with the CsrWifiFsm Module
5504 status - Reports the result of the request
5505
5506*******************************************************************************/
5507typedef struct
5508{
5509 CsrWifiFsmEvent common;
5510 CsrResult status;
5511} CsrWifiSmeMibConfigSetCfm;
5512
5513/*******************************************************************************
5514
5515 NAME
5516 CsrWifiSmeMibGetCfm
5517
5518 DESCRIPTION
5519 The SME calls this primitive to return the requested MIB variable values.
5520
5521 MEMBERS
5522 common - Common header for use with the CsrWifiFsm Module
5523 status - Reports the result of the request
5524 mibAttributeLength - Length of mibAttribute
5525 mibAttribute - Points to the VarBind or VarBindList containing the
5526 names and values of the MIB variables requested
5527
5528*******************************************************************************/
5529typedef struct
5530{
5531 CsrWifiFsmEvent common;
5532 CsrResult status;
5533 u16 mibAttributeLength;
5534 u8 *mibAttribute;
5535} CsrWifiSmeMibGetCfm;
5536
5537/*******************************************************************************
5538
5539 NAME
5540 CsrWifiSmeMibGetNextCfm
5541
5542 DESCRIPTION
5543 The SME calls this primitive to return the requested MIB name(s).
5544 The wireless manager application can then read the value of the MIB
5545 variable using CSR_WIFI_SME_MIB_GET_REQ, using the names provided.
5546
5547 MEMBERS
5548 common - Common header for use with the CsrWifiFsm Module
5549 status - Reports the result of the request
5550 mibAttributeLength - Length of mibAttribute
5551 mibAttribute - Points to a VarBind or VarBindList containing the
5552 name(s) of the MIB variable(s) lexicographically
5553 following the name(s) given in the request
5554
5555*******************************************************************************/
5556typedef struct
5557{
5558 CsrWifiFsmEvent common;
5559 CsrResult status;
5560 u16 mibAttributeLength;
5561 u8 *mibAttribute;
5562} CsrWifiSmeMibGetNextCfm;
5563
5564/*******************************************************************************
5565
5566 NAME
5567 CsrWifiSmeMibSetCfm
5568
5569 DESCRIPTION
5570 The SME calls the primitive to report the result of the set primitive.
5571
5572 MEMBERS
5573 common - Common header for use with the CsrWifiFsm Module
5574 status - Reports the result of the request
5575
5576*******************************************************************************/
5577typedef struct
5578{
5579 CsrWifiFsmEvent common;
5580 CsrResult status;
5581} CsrWifiSmeMibSetCfm;
5582
5583/*******************************************************************************
5584
5585 NAME
5586 CsrWifiSmeMicFailureInd
5587
5588 DESCRIPTION
5589 The SME sends this primitive to all the tasks that have registered to
5590 receive it whenever the chip firmware reports a MIC failure.
5591
5592 MEMBERS
5593 common - Common header for use with the CsrWifiFsm Module
5594 interfaceTag - Interface Identifier; unique identifier of an interface
5595 secondFailure - TRUE if this indication is for a second failure in 60
5596 seconds
5597 count - The number of MIC failure events since the connection was
5598 established
5599 address - MAC address of the transmitter that caused the MIC failure
5600 keyType - Type of key for which the failure occurred
5601
5602*******************************************************************************/
5603typedef struct
5604{
5605 CsrWifiFsmEvent common;
5606 u16 interfaceTag;
5607 u8 secondFailure;
5608 u16 count;
5609 CsrWifiMacAddress address;
5610 CsrWifiSmeKeyType keyType;
5611} CsrWifiSmeMicFailureInd;
5612
5613/*******************************************************************************
5614
5615 NAME
5616 CsrWifiSmeMulticastAddressCfm
5617
5618 DESCRIPTION
5619 The SME will call this primitive when the operation is complete. For a
5620 GET action, this primitive reports the current list of MAC addresses.
5621
5622 MEMBERS
5623 common - Common header for use with the CsrWifiFsm Module
5624 interfaceTag - Interface Identifier; unique identifier of an interface
5625 status - Reports the result of the request
5626 action - Action in the request
5627 getAddressesCount - This parameter is only relevant if action is
5628 CSR_WIFI_SME_LIST_ACTION_GET:
5629 number of MAC addresses sent with the primitive
5630 getAddresses - Pointer to the list of MAC Addresses sent with the
5631 primitive, set to NULL if none is sent.
5632
5633*******************************************************************************/
5634typedef struct
5635{
5636 CsrWifiFsmEvent common;
5637 u16 interfaceTag;
5638 CsrResult status;
5639 CsrWifiSmeListAction action;
5640 u8 getAddressesCount;
5641 CsrWifiMacAddress *getAddresses;
5642} CsrWifiSmeMulticastAddressCfm;
5643
5644/*******************************************************************************
5645
5646 NAME
5647 CsrWifiSmePacketFilterSetCfm
5648
5649 DESCRIPTION
5650 The SME calls the primitive to report the result of the set primitive.
5651
5652 MEMBERS
5653 common - Common header for use with the CsrWifiFsm Module
5654 interfaceTag - Interface Identifier; unique identifier of an interface
5655 status - Reports the result of the request
5656
5657*******************************************************************************/
5658typedef struct
5659{
5660 CsrWifiFsmEvent common;
5661 u16 interfaceTag;
5662 CsrResult status;
5663} CsrWifiSmePacketFilterSetCfm;
5664
5665/*******************************************************************************
5666
5667 NAME
5668 CsrWifiSmePermanentMacAddressGetCfm
5669
5670 DESCRIPTION
5671 This primitive reports the result of the request.
5672
5673 MEMBERS
5674 common - Common header for use with the CsrWifiFsm Module
5675 status - Reports the result of the request
5676 permanentMacAddress - MAC address stored in the EEPROM
5677
5678*******************************************************************************/
5679typedef struct
5680{
5681 CsrWifiFsmEvent common;
5682 CsrResult status;
5683 CsrWifiMacAddress permanentMacAddress;
5684} CsrWifiSmePermanentMacAddressGetCfm;
5685
5686/*******************************************************************************
5687
5688 NAME
5689 CsrWifiSmePmkidCandidateListInd
5690
5691 DESCRIPTION
5692 The SME will send this primitive to all the tasks that have registered to
5693 receive it when a new network supporting preauthentication and/or PMK
5694 caching is seen.
5695
5696 MEMBERS
5697 common - Common header for use with the CsrWifiFsm Module
5698 interfaceTag - Interface Identifier; unique identifier of an
5699 interface
5700 pmkidCandidatesCount - Number of PMKID candidates provided
5701 pmkidCandidates - Points to the first PMKID candidate
5702
5703*******************************************************************************/
5704typedef struct
5705{
5706 CsrWifiFsmEvent common;
5707 u16 interfaceTag;
5708 u8 pmkidCandidatesCount;
5709 CsrWifiSmePmkidCandidate *pmkidCandidates;
5710} CsrWifiSmePmkidCandidateListInd;
5711
5712/*******************************************************************************
5713
5714 NAME
5715 CsrWifiSmePmkidCfm
5716
5717 DESCRIPTION
5718 The SME will call this primitive when the operation is complete. For a
5719 GET action, this primitive reports the current list of PMKIDs
5720
5721 MEMBERS
5722 common - Common header for use with the CsrWifiFsm Module
5723 interfaceTag - Interface Identifier; unique identifier of an interface
5724 status - Reports the result of the request
5725 action - Action in the request
5726 getPmkidsCount - This parameter is only relevant if action is
5727 CSR_WIFI_SME_LIST_ACTION_GET:
5728 number of PMKIDs sent with the primitive
5729 getPmkids - Pointer to the list of PMKIDs sent with the primitive, set
5730 to NULL if none is sent.
5731
5732*******************************************************************************/
5733typedef struct
5734{
5735 CsrWifiFsmEvent common;
5736 u16 interfaceTag;
5737 CsrResult status;
5738 CsrWifiSmeListAction action;
5739 u8 getPmkidsCount;
5740 CsrWifiSmePmkid *getPmkids;
5741} CsrWifiSmePmkidCfm;
5742
5743/*******************************************************************************
5744
5745 NAME
5746 CsrWifiSmePowerConfigGetCfm
5747
5748 DESCRIPTION
5749 This primitive reports the result of the request.
5750
5751 MEMBERS
5752 common - Common header for use with the CsrWifiFsm Module
5753 status - Reports the result of the request
5754 powerConfig - Returns the current parameters for the power configuration of
5755 the firmware
5756
5757*******************************************************************************/
5758typedef struct
5759{
5760 CsrWifiFsmEvent common;
5761 CsrResult status;
5762 CsrWifiSmePowerConfig powerConfig;
5763} CsrWifiSmePowerConfigGetCfm;
5764
5765/*******************************************************************************
5766
5767 NAME
5768 CsrWifiSmePowerConfigSetCfm
5769
5770 DESCRIPTION
5771 This primitive reports the result of the request.
5772
5773 MEMBERS
5774 common - Common header for use with the CsrWifiFsm Module
5775 status - Reports the result of the request
5776
5777*******************************************************************************/
5778typedef struct
5779{
5780 CsrWifiFsmEvent common;
5781 CsrResult status;
5782} CsrWifiSmePowerConfigSetCfm;
5783
5784/*******************************************************************************
5785
5786 NAME
5787 CsrWifiSmeRegulatoryDomainInfoGetCfm
5788
5789 DESCRIPTION
5790 This primitive reports the result of the request.
5791
5792 MEMBERS
5793 common - Common header for use with the CsrWifiFsm Module
5794 status - Reports the result of the request
5795 regDomInfo - Reports information and state related to regulatory domain
5796 operation.
5797
5798*******************************************************************************/
5799typedef struct
5800{
5801 CsrWifiFsmEvent common;
5802 CsrResult status;
5803 CsrWifiSmeRegulatoryDomainInfo regDomInfo;
5804} CsrWifiSmeRegulatoryDomainInfoGetCfm;
5805
5806/*******************************************************************************
5807
5808 NAME
5809 CsrWifiSmeRoamCompleteInd
5810
5811 DESCRIPTION
5812 The SME will send this primitive to all the tasks that have registered to
5813 receive it whenever it completes an attempt to roam to an AP. If the roam
5814 attempt was successful, status will be set to CSR_WIFI_SME_SUCCESS,
5815 otherwise it shall be set to the appropriate error code.
5816
5817 MEMBERS
5818 common - Common header for use with the CsrWifiFsm Module
5819 interfaceTag - Interface Identifier; unique identifier of an interface
5820 status - Reports the result of the roaming procedure
5821
5822*******************************************************************************/
5823typedef struct
5824{
5825 CsrWifiFsmEvent common;
5826 u16 interfaceTag;
5827 CsrResult status;
5828} CsrWifiSmeRoamCompleteInd;
5829
5830/*******************************************************************************
5831
5832 NAME
5833 CsrWifiSmeRoamStartInd
5834
5835 DESCRIPTION
5836 The SME will send this primitive to all the tasks that have registered to
5837 receive it whenever it begins an attempt to roam to an AP.
5838 If the wireless manager application connect request specified the SSID
5839 and the BSSID was set to the broadcast address (0xFF 0xFF 0xFF 0xFF 0xFF
5840 0xFF), the SME monitors the signal quality and maintains a list of
5841 candidates to roam to. When the signal quality of the current connection
5842 falls below a threshold, and there is a candidate with better quality,
5843 the SME will attempt to the candidate AP.
5844 If the roaming procedure succeeds, the SME will also issue a Media
5845 Connect indication to inform the wireless manager application of the
5846 change.
5847 NOTE: to prevent the SME from initiating roaming the WMA must specify the
5848 BSSID in the connection request; this forces the SME to connect only to
5849 that AP.
5850 The wireless manager application can obtain statistics for roaming
5851 purposes using CSR_WIFI_SME_CONNECTION_QUALITY_IND and
5852 CSR_WIFI_SME_CONNECTION_STATS_GET_REQ.
5853 When the wireless manager application wishes to roam to another AP, it
5854 must issue a connection request specifying the BSSID of the desired AP.
5855
5856 MEMBERS
5857 common - Common header for use with the CsrWifiFsm Module
5858 interfaceTag - Interface Identifier; unique identifier of an interface
5859 roamReason - Indicates the reason for starting the roaming procedure
5860 reason80211 - Indicates the reason for deauthentication or disassociation
5861
5862*******************************************************************************/
5863typedef struct
5864{
5865 CsrWifiFsmEvent common;
5866 u16 interfaceTag;
5867 CsrWifiSmeRoamReason roamReason;
5868 CsrWifiSmeIEEE80211Reason reason80211;
5869} CsrWifiSmeRoamStartInd;
5870
5871/*******************************************************************************
5872
5873 NAME
5874 CsrWifiSmeRoamingConfigGetCfm
5875
5876 DESCRIPTION
5877 This primitive reports the result of the request.
5878
5879 MEMBERS
5880 common - Common header for use with the CsrWifiFsm Module
5881 interfaceTag - Interface Identifier; unique identifier of an interface
5882 status - Reports the result of the request
5883 roamingConfig - Reports the roaming behaviour of the driver and firmware
5884
5885*******************************************************************************/
5886typedef struct
5887{
5888 CsrWifiFsmEvent common;
5889 u16 interfaceTag;
5890 CsrResult status;
5891 CsrWifiSmeRoamingConfig roamingConfig;
5892} CsrWifiSmeRoamingConfigGetCfm;
5893
5894/*******************************************************************************
5895
5896 NAME
5897 CsrWifiSmeRoamingConfigSetCfm
5898
5899 DESCRIPTION
5900 This primitive sets the value of the RoamingConfig parameter.
5901
5902 MEMBERS
5903 common - Common header for use with the CsrWifiFsm Module
5904 interfaceTag - Interface Identifier; unique identifier of an interface
5905 status - Reports the result of the request
5906
5907*******************************************************************************/
5908typedef struct
5909{
5910 CsrWifiFsmEvent common;
5911 u16 interfaceTag;
5912 CsrResult status;
5913} CsrWifiSmeRoamingConfigSetCfm;
5914
5915/*******************************************************************************
5916
5917 NAME
5918 CsrWifiSmeScanConfigGetCfm
5919
5920 DESCRIPTION
5921 This primitive reports the result of the request.
5922
5923 MEMBERS
5924 common - Common header for use with the CsrWifiFsm Module
5925 status - Reports the result of the request
5926 scanConfig - Returns the current parameters for the autonomous scanning
5927 behaviour of the firmware
5928
5929*******************************************************************************/
5930typedef struct
5931{
5932 CsrWifiFsmEvent common;
5933 CsrResult status;
5934 CsrWifiSmeScanConfig scanConfig;
5935} CsrWifiSmeScanConfigGetCfm;
5936
5937/*******************************************************************************
5938
5939 NAME
5940 CsrWifiSmeScanConfigSetCfm
5941
5942 DESCRIPTION
5943 This primitive reports the result of the request.
5944
5945 MEMBERS
5946 common - Common header for use with the CsrWifiFsm Module
5947 status - Reports the result of the request
5948
5949*******************************************************************************/
5950typedef struct
5951{
5952 CsrWifiFsmEvent common;
5953 CsrResult status;
5954} CsrWifiSmeScanConfigSetCfm;
5955
5956/*******************************************************************************
5957
5958 NAME
5959 CsrWifiSmeScanFullCfm
5960
5961 DESCRIPTION
5962 The SME calls this primitive when the results from the scan are
5963 available.
5964
5965 MEMBERS
5966 common - Common header for use with the CsrWifiFsm Module
5967 status - Reports the result of the request
5968
5969*******************************************************************************/
5970typedef struct
5971{
5972 CsrWifiFsmEvent common;
5973 CsrResult status;
5974} CsrWifiSmeScanFullCfm;
5975
5976/*******************************************************************************
5977
5978 NAME
5979 CsrWifiSmeScanResultInd
5980
5981 DESCRIPTION
5982 The SME sends this primitive to all the tasks that have registered to
5983 receive it whenever a scan indication is received from the firmware.
5984
5985 MEMBERS
5986 common - Common header for use with the CsrWifiFsm Module
5987 result - Points to a buffer containing a scan result.
5988
5989*******************************************************************************/
5990typedef struct
5991{
5992 CsrWifiFsmEvent common;
5993 CsrWifiSmeScanResult result;
5994} CsrWifiSmeScanResultInd;
5995
5996/*******************************************************************************
5997
5998 NAME
5999 CsrWifiSmeScanResultsFlushCfm
6000
6001 DESCRIPTION
6002 The SME will call this primitive when the cache has been cleared.
6003
6004 MEMBERS
6005 common - Common header for use with the CsrWifiFsm Module
6006 status - Reports the result of the request
6007
6008*******************************************************************************/
6009typedef struct
6010{
6011 CsrWifiFsmEvent common;
6012 CsrResult status;
6013} CsrWifiSmeScanResultsFlushCfm;
6014
6015/*******************************************************************************
6016
6017 NAME
6018 CsrWifiSmeScanResultsGetCfm
6019
6020 DESCRIPTION
6021 The SME sends this primitive to provide the current set of scan results.
6022
6023 MEMBERS
6024 common - Common header for use with the CsrWifiFsm Module
6025 status - Reports the result of the request
6026 scanResultsCount - Number of scan results
6027 scanResults - Points to a buffer containing an array of
6028 CsrWifiSmeScanResult structures.
6029
6030*******************************************************************************/
6031typedef struct
6032{
6033 CsrWifiFsmEvent common;
6034 CsrResult status;
6035 u16 scanResultsCount;
6036 CsrWifiSmeScanResult *scanResults;
6037} CsrWifiSmeScanResultsGetCfm;
6038
6039/*******************************************************************************
6040
6041 NAME
6042 CsrWifiSmeSmeStaConfigGetCfm
6043
6044 DESCRIPTION
6045 This primitive reports the result of the request.
6046
6047 MEMBERS
6048 common - Common header for use with the CsrWifiFsm Module
6049 interfaceTag - Interface Identifier; unique identifier of an interface
6050 status - Reports the result of the request
6051 smeConfig - Current SME Station Parameters
6052
6053*******************************************************************************/
6054typedef struct
6055{
6056 CsrWifiFsmEvent common;
6057 u16 interfaceTag;
6058 CsrResult status;
6059 CsrWifiSmeStaConfig smeConfig;
6060} CsrWifiSmeSmeStaConfigGetCfm;
6061
6062/*******************************************************************************
6063
6064 NAME
6065 CsrWifiSmeSmeStaConfigSetCfm
6066
6067 DESCRIPTION
6068 This primitive reports the result of the request.
6069
6070 MEMBERS
6071 common - Common header for use with the CsrWifiFsm Module
6072 interfaceTag - Interface Identifier; unique identifier of an interface
6073 status - Reports the result of the request
6074
6075*******************************************************************************/
6076typedef struct
6077{
6078 CsrWifiFsmEvent common;
6079 u16 interfaceTag;
6080 CsrResult status;
6081} CsrWifiSmeSmeStaConfigSetCfm;
6082
6083/*******************************************************************************
6084
6085 NAME
6086 CsrWifiSmeStationMacAddressGetCfm
6087
6088 DESCRIPTION
6089 This primitive reports the result of the request.
6090
6091 MEMBERS
6092 common - Common header for use with the CsrWifiFsm Module
6093 status - Reports the result of the request
6094 stationMacAddress - Current MAC address of the station.
6095
6096*******************************************************************************/
6097typedef struct
6098{
6099 CsrWifiFsmEvent common;
6100 CsrResult status;
6101 CsrWifiMacAddress stationMacAddress[2];
6102} CsrWifiSmeStationMacAddressGetCfm;
6103
6104/*******************************************************************************
6105
6106 NAME
6107 CsrWifiSmeTspecInd
6108
6109 DESCRIPTION
6110 The SME will send this primitive to all the task that have registered to
6111 receive it when a status change in the TSPEC occurs.
6112
6113 MEMBERS
6114 common - Common header for use with the CsrWifiFsm Module
6115 interfaceTag - Interface Identifier; unique identifier of an interface
6116 transactionId - Unique Transaction ID for the TSPEC, as assigned by the
6117 driver
6118 tspecResultCode - Specifies the TSPEC operation requested by the peer
6119 station
6120 tspecLength - Length of the TSPEC.
6121 tspec - Points to the first byte of the TSPEC
6122
6123*******************************************************************************/
6124typedef struct
6125{
6126 CsrWifiFsmEvent common;
6127 u16 interfaceTag;
6128 u32 transactionId;
6129 CsrWifiSmeTspecResultCode tspecResultCode;
6130 u16 tspecLength;
6131 u8 *tspec;
6132} CsrWifiSmeTspecInd;
6133
6134/*******************************************************************************
6135
6136 NAME
6137 CsrWifiSmeTspecCfm
6138
6139 DESCRIPTION
6140 The SME calls the primitive to report the result of the TSpec primitive
6141 request.
6142
6143 MEMBERS
6144 common - Common header for use with the CsrWifiFsm Module
6145 interfaceTag - Interface Identifier; unique identifier of an interface
6146 status - Reports the result of the request
6147 transactionId - Unique Transaction ID for the TSPEC, as assigned by the
6148 driver
6149 tspecResultCode - Specifies the result of the negotiated TSPEC operation
6150 tspecLength - Length of the TSPEC.
6151 tspec - Points to the first byte of the TSPEC
6152
6153*******************************************************************************/
6154typedef struct
6155{
6156 CsrWifiFsmEvent common;
6157 u16 interfaceTag;
6158 CsrResult status;
6159 u32 transactionId;
6160 CsrWifiSmeTspecResultCode tspecResultCode;
6161 u16 tspecLength;
6162 u8 *tspec;
6163} CsrWifiSmeTspecCfm;
6164
6165/*******************************************************************************
6166
6167 NAME
6168 CsrWifiSmeVersionsGetCfm
6169
6170 DESCRIPTION
6171 This primitive reports the result of the request.
6172
6173 MEMBERS
6174 common - Common header for use with the CsrWifiFsm Module
6175 status - Reports the result of the request
6176 versions - Version IDs of the product
6177
6178*******************************************************************************/
6179typedef struct
6180{
6181 CsrWifiFsmEvent common;
6182 CsrResult status;
6183 CsrWifiSmeVersions versions;
6184} CsrWifiSmeVersionsGetCfm;
6185
6186/*******************************************************************************
6187
6188 NAME
6189 CsrWifiSmeWifiFlightmodeCfm
6190
6191 DESCRIPTION
6192 The SME calls this primitive when the chip is initialised for low power
6193 mode and with the radio subsystem disabled. To leave flight mode, and
6194 enable Wi-Fi, the wireless manager application should call
6195 CSR_WIFI_SME_WIFI_ON_REQ.
6196
6197 MEMBERS
6198 common - Common header for use with the CsrWifiFsm Module
6199 status - Reports the result of the request
6200
6201*******************************************************************************/
6202typedef struct
6203{
6204 CsrWifiFsmEvent common;
6205 CsrResult status;
6206} CsrWifiSmeWifiFlightmodeCfm;
6207
6208/*******************************************************************************
6209
6210 NAME
6211 CsrWifiSmeWifiOffInd
6212
6213 DESCRIPTION
6214 The SME sends this primitive to all the tasks that have registered to
6215 receive it to report that the chip has been turned off.
6216
6217 MEMBERS
6218 common - Common header for use with the CsrWifiFsm Module
6219 reason - Indicates the reason why the Wi-Fi has been switched off.
6220
6221*******************************************************************************/
6222typedef struct
6223{
6224 CsrWifiFsmEvent common;
6225 CsrWifiSmeControlIndication reason;
6226} CsrWifiSmeWifiOffInd;
6227
6228/*******************************************************************************
6229
6230 NAME
6231 CsrWifiSmeWifiOffCfm
6232
6233 DESCRIPTION
6234 After receiving CSR_WIFI_SME_WIFI_OFF_REQ, if the chip is connected to a
6235 network, the SME will perform a disconnect operation, will send a
6236 CSR_WIFI_SME_MEDIA_STATUS_IND with
6237 CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED, and then will call
6238 CSR_WIFI_SME_WIFI_OFF_CFM when the chip is off.
6239
6240 MEMBERS
6241 common - Common header for use with the CsrWifiFsm Module
6242 status - Reports the result of the request
6243
6244*******************************************************************************/
6245typedef struct
6246{
6247 CsrWifiFsmEvent common;
6248 CsrResult status;
6249} CsrWifiSmeWifiOffCfm;
6250
6251/*******************************************************************************
6252
6253 NAME
6254 CsrWifiSmeWifiOnCfm
6255
6256 DESCRIPTION
6257 The SME sends this primitive to the task that has sent the request once
6258 the chip has been initialised and is available for use.
6259
6260 MEMBERS
6261 common - Common header for use with the CsrWifiFsm Module
6262 status - Reports the result of the request
6263
6264*******************************************************************************/
6265typedef struct
6266{
6267 CsrWifiFsmEvent common;
6268 CsrResult status;
6269} CsrWifiSmeWifiOnCfm;
6270
6271/*******************************************************************************
6272
6273 NAME
6274 CsrWifiSmeCloakedSsidsSetCfm
6275
6276 DESCRIPTION
6277 This primitive reports the result of the request.
6278
6279 MEMBERS
6280 common - Common header for use with the CsrWifiFsm Module
6281 status - Reports the result of the request
6282
6283*******************************************************************************/
6284typedef struct
6285{
6286 CsrWifiFsmEvent common;
6287 CsrResult status;
6288} CsrWifiSmeCloakedSsidsSetCfm;
6289
6290/*******************************************************************************
6291
6292 NAME
6293 CsrWifiSmeCloakedSsidsGetCfm
6294
6295 DESCRIPTION
6296 This primitive reports the result of the request.
6297
6298 MEMBERS
6299 common - Common header for use with the CsrWifiFsm Module
6300 status - Reports the result of the request
6301 cloakedSsids - Reports list of cloaked SSIDs that are explicitly scanned for
6302 by the driver
6303
6304*******************************************************************************/
6305typedef struct
6306{
6307 CsrWifiFsmEvent common;
6308 CsrResult status;
6309 CsrWifiSmeCloakedSsidConfig cloakedSsids;
6310} CsrWifiSmeCloakedSsidsGetCfm;
6311
6312/*******************************************************************************
6313
6314 NAME
6315 CsrWifiSmeWifiOnInd
6316
6317 DESCRIPTION
6318 The SME sends this primitive to all tasks that have registered to receive
6319 it once the chip becomes available and ready to use.
6320
6321 MEMBERS
6322 common - Common header for use with the CsrWifiFsm Module
6323 address - Current MAC address
6324
6325*******************************************************************************/
6326typedef struct
6327{
6328 CsrWifiFsmEvent common;
6329 CsrWifiMacAddress address;
6330} CsrWifiSmeWifiOnInd;
6331
6332/*******************************************************************************
6333
6334 NAME
6335 CsrWifiSmeSmeCommonConfigGetCfm
6336
6337 DESCRIPTION
6338 This primitive reports the result of the request.
6339
6340 MEMBERS
6341 common - Common header for use with the CsrWifiFsm Module
6342 status - Reports the result of the request
6343 deviceConfig - Configuration options in the SME
6344
6345*******************************************************************************/
6346typedef struct
6347{
6348 CsrWifiFsmEvent common;
6349 CsrResult status;
6350 CsrWifiSmeDeviceConfig deviceConfig;
6351} CsrWifiSmeSmeCommonConfigGetCfm;
6352
6353/*******************************************************************************
6354
6355 NAME
6356 CsrWifiSmeSmeCommonConfigSetCfm
6357
6358 DESCRIPTION
6359 Reports the result of the request
6360
6361 MEMBERS
6362 common - Common header for use with the CsrWifiFsm Module
6363 status - Reports the result of the request
6364
6365*******************************************************************************/
6366typedef struct
6367{
6368 CsrWifiFsmEvent common;
6369 CsrResult status;
6370} CsrWifiSmeSmeCommonConfigSetCfm;
6371
6372/*******************************************************************************
6373
6374 NAME
6375 CsrWifiSmeInterfaceCapabilityGetCfm
6376
6377 DESCRIPTION
6378 This primitive reports the result of the request.
6379
6380 MEMBERS
6381 common - Common header for use with the CsrWifiFsm Module
6382 status - Result of the request
6383 numInterfaces - Number of the interfaces supported
6384 capBitmap - Points to the list of capabilities bitmaps provided for each
6385 interface.
6386 The bits represent the following capabilities:
6387 -bits 7 to 4-Reserved
6388 -bit 3-AMP
6389 -bit 2-P2P
6390 -bit 1-AP
6391 -bit 0-STA
6392
6393*******************************************************************************/
6394typedef struct
6395{
6396 CsrWifiFsmEvent common;
6397 CsrResult status;
6398 u16 numInterfaces;
6399 u8 capBitmap[2];
6400} CsrWifiSmeInterfaceCapabilityGetCfm;
6401
6402/*******************************************************************************
6403
6404 NAME
6405 CsrWifiSmeErrorInd
6406
6407 DESCRIPTION
6408 Important error message indicating a error of some importance
6409
6410 MEMBERS
6411 common - Common header for use with the CsrWifiFsm Module
6412 errorMessage - Contains the error message.
6413
6414*******************************************************************************/
6415typedef struct
6416{
6417 CsrWifiFsmEvent common;
6418 char *errorMessage;
6419} CsrWifiSmeErrorInd;
6420
6421/*******************************************************************************
6422
6423 NAME
6424 CsrWifiSmeInfoInd
6425
6426 DESCRIPTION
6427 Message indicating a some info about current activity. Mostly of interest
6428 in testing but may be useful in the field.
6429
6430 MEMBERS
6431 common - Common header for use with the CsrWifiFsm Module
6432 infoMessage - Contains the message.
6433
6434*******************************************************************************/
6435typedef struct
6436{
6437 CsrWifiFsmEvent common;
6438 char *infoMessage;
6439} CsrWifiSmeInfoInd;
6440
6441/*******************************************************************************
6442
6443 NAME
6444 CsrWifiSmeCoreDumpInd
6445
6446 DESCRIPTION
6447 The SME will send this primitive to all the tasks that have registered to
6448 receive Wi-Fi Chip core dump data.
6449 The core dump data may be fragmented and sent using more than one
6450 indication.
6451 To indicate that all the data has been sent, the last indication contains
6452 a 'length' of 0 and 'data' of NULL.
6453
6454 MEMBERS
6455 common - Common header for use with the CsrWifiFsm Module
6456 dataLength - Number of bytes in the buffer pointed to by 'data'
6457 data - Pointer to the buffer containing 'dataLength' bytes of core
6458 dump data
6459
6460*******************************************************************************/
6461typedef struct
6462{
6463 CsrWifiFsmEvent common;
6464 u32 dataLength;
6465 u8 *data;
6466} CsrWifiSmeCoreDumpInd;
6467
6468/*******************************************************************************
6469
6470 NAME
6471 CsrWifiSmeAmpStatusChangeInd
6472
6473 DESCRIPTION
6474 Indication of change to AMP activity.
6475
6476 MEMBERS
6477 common - Common header for use with the CsrWifiFsm Module
6478 interfaceTag - Interface on which the AMP activity changed.
6479 ampStatus - The new status of AMP activity.Range: {AMP_ACTIVE,
6480 AMP_INACTIVE}.
6481
6482*******************************************************************************/
6483typedef struct
6484{
6485 CsrWifiFsmEvent common;
6486 u16 interfaceTag;
6487 CsrWifiSmeAmpStatus ampStatus;
6488} CsrWifiSmeAmpStatusChangeInd;
6489
6490/*******************************************************************************
6491
6492 NAME
6493 CsrWifiSmeWpsConfigurationCfm
6494
6495 DESCRIPTION
6496 Confirm.
6497
6498 MEMBERS
6499 common - Common header for use with the CsrWifiFsm Module
6500 status - Status of the request.
6501
6502*******************************************************************************/
6503typedef struct
6504{
6505 CsrWifiFsmEvent common;
6506 CsrResult status;
6507} CsrWifiSmeWpsConfigurationCfm;
6508
6509#endif /* CSR_WIFI_SME_PRIM_H__ */
6510
diff --git a/drivers/staging/csr/csr_wifi_sme_sef.c b/drivers/staging/csr/csr_wifi_sme_sef.c
deleted file mode 100644
index cf32254335c4..000000000000
--- a/drivers/staging/csr/csr_wifi_sme_sef.c
+++ /dev/null
@@ -1,85 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2010
4 Confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9 *****************************************************************************/
10#include "csr_wifi_sme_sef.h"
11
12const CsrWifiSmeStateHandlerType CsrWifiSmeUpstreamStateHandlers[CSR_WIFI_SME_PRIM_UPSTREAM_COUNT] =
13{
14 /* 0x8000 */ CsrWifiSmeActivateCfmHandler,
15 /* 0x8001 */ CsrWifiSmeAdhocConfigGetCfmHandler,
16 /* 0x8002 */ CsrWifiSmeAdhocConfigSetCfmHandler,
17 /* 0x8003 */ CsrWifiSmeAssociationCompleteIndHandler,
18 /* 0x8004 */ CsrWifiSmeAssociationStartIndHandler,
19 /* 0x8005 */ CsrWifiSmeBlacklistCfmHandler,
20 /* 0x8006 */ CsrWifiSmeCalibrationDataGetCfmHandler,
21 /* 0x8007 */ CsrWifiSmeCalibrationDataSetCfmHandler,
22 /* 0x8008 */ CsrWifiSmeCcxConfigGetCfmHandler,
23 /* 0x8009 */ CsrWifiSmeCcxConfigSetCfmHandler,
24 /* 0x800A */ CsrWifiSmeCoexConfigGetCfmHandler,
25 /* 0x800B */ CsrWifiSmeCoexConfigSetCfmHandler,
26 /* 0x800C */ CsrWifiSmeCoexInfoGetCfmHandler,
27 /* 0x800D */ CsrWifiSmeConnectCfmHandler,
28 /* 0x800E */ CsrWifiSmeConnectionConfigGetCfmHandler,
29 /* 0x800F */ CsrWifiSmeConnectionInfoGetCfmHandler,
30 /* 0x8010 */ CsrWifiSmeConnectionQualityIndHandler,
31 /* 0x8011 */ CsrWifiSmeConnectionStatsGetCfmHandler,
32 /* 0x8012 */ CsrWifiSmeDeactivateCfmHandler,
33 /* 0x8013 */ CsrWifiSmeDisconnectCfmHandler,
34 /* 0x8014 */ CsrWifiSmeEventMaskSetCfmHandler,
35 /* 0x8015 */ CsrWifiSmeHostConfigGetCfmHandler,
36 /* 0x8016 */ CsrWifiSmeHostConfigSetCfmHandler,
37 /* 0x8017 */ CsrWifiSmeIbssStationIndHandler,
38 /* 0x8018 */ CsrWifiSmeKeyCfmHandler,
39 /* 0x8019 */ CsrWifiSmeLinkQualityGetCfmHandler,
40 /* 0x801A */ CsrWifiSmeMediaStatusIndHandler,
41 /* 0x801B */ CsrWifiSmeMibConfigGetCfmHandler,
42 /* 0x801C */ CsrWifiSmeMibConfigSetCfmHandler,
43 /* 0x801D */ CsrWifiSmeMibGetCfmHandler,
44 /* 0x801E */ CsrWifiSmeMibGetNextCfmHandler,
45 /* 0x801F */ CsrWifiSmeMibSetCfmHandler,
46 /* 0x8020 */ CsrWifiSmeMicFailureIndHandler,
47 /* 0x8021 */ CsrWifiSmeMulticastAddressCfmHandler,
48 /* 0x8022 */ CsrWifiSmePacketFilterSetCfmHandler,
49 /* 0x8023 */ CsrWifiSmePermanentMacAddressGetCfmHandler,
50 /* 0x8024 */ CsrWifiSmePmkidCandidateListIndHandler,
51 /* 0x8025 */ CsrWifiSmePmkidCfmHandler,
52 /* 0x8026 */ CsrWifiSmePowerConfigGetCfmHandler,
53 /* 0x8027 */ CsrWifiSmePowerConfigSetCfmHandler,
54 /* 0x8028 */ CsrWifiSmeRegulatoryDomainInfoGetCfmHandler,
55 /* 0x8029 */ CsrWifiSmeRoamCompleteIndHandler,
56 /* 0x802A */ CsrWifiSmeRoamStartIndHandler,
57 /* 0x802B */ CsrWifiSmeRoamingConfigGetCfmHandler,
58 /* 0x802C */ CsrWifiSmeRoamingConfigSetCfmHandler,
59 /* 0x802D */ CsrWifiSmeScanConfigGetCfmHandler,
60 /* 0x802E */ CsrWifiSmeScanConfigSetCfmHandler,
61 /* 0x802F */ CsrWifiSmeScanFullCfmHandler,
62 /* 0x8030 */ CsrWifiSmeScanResultIndHandler,
63 /* 0x8031 */ CsrWifiSmeScanResultsFlushCfmHandler,
64 /* 0x8032 */ CsrWifiSmeScanResultsGetCfmHandler,
65 /* 0x8033 */ CsrWifiSmeSmeStaConfigGetCfmHandler,
66 /* 0x8034 */ CsrWifiSmeSmeStaConfigSetCfmHandler,
67 /* 0x8035 */ CsrWifiSmeStationMacAddressGetCfmHandler,
68 /* 0x8036 */ CsrWifiSmeTspecIndHandler,
69 /* 0x8037 */ CsrWifiSmeTspecCfmHandler,
70 /* 0x8038 */ CsrWifiSmeVersionsGetCfmHandler,
71 /* 0x8039 */ CsrWifiSmeWifiFlightmodeCfmHandler,
72 /* 0x803A */ CsrWifiSmeWifiOffIndHandler,
73 /* 0x803B */ CsrWifiSmeWifiOffCfmHandler,
74 /* 0x803C */ CsrWifiSmeWifiOnCfmHandler,
75 /* 0x803D */ CsrWifiSmeCloakedSsidsSetCfmHandler,
76 /* 0x803E */ CsrWifiSmeCloakedSsidsGetCfmHandler,
77 /* 0x803F */ CsrWifiSmeWifiOnIndHandler,
78 /* 0x8040 */ CsrWifiSmeSmeCommonConfigGetCfmHandler,
79 /* 0x8041 */ CsrWifiSmeSmeCommonConfigSetCfmHandler,
80 /* 0x8042 */ CsrWifiSmeGetInterfaceCapabilityCfmHandler,
81 /* 0x8043 */ CsrWifiSmeErrorIndHandler,
82 /* 0x8044 */ CsrWifiSmeInfoIndHandler,
83 /* 0x8045 */ CsrWifiSmeCoreDumpIndHandler,
84 /* 0x8046 */ CsrWifiSmeAmpStatusChangeIndHandler,
85};
diff --git a/drivers/staging/csr/csr_wifi_sme_sef.h b/drivers/staging/csr/csr_wifi_sme_sef.h
deleted file mode 100644
index 78b88c067236..000000000000
--- a/drivers/staging/csr/csr_wifi_sme_sef.h
+++ /dev/null
@@ -1,142 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2010
4 Confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10#ifndef CSR_WIFI_ROUTER_SEF_CSR_WIFI_SME_H__
11#define CSR_WIFI_ROUTER_SEF_CSR_WIFI_SME_H__
12
13#include "csr_wifi_sme_prim.h"
14
15typedef void (*CsrWifiSmeStateHandlerType)(void *drvpriv, CsrWifiFsmEvent *msg);
16
17extern const CsrWifiSmeStateHandlerType
18 CsrWifiSmeUpstreamStateHandlers[CSR_WIFI_SME_PRIM_UPSTREAM_COUNT];
19
20
21extern void CsrWifiSmeActivateCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg);
22extern void CsrWifiSmeAdhocConfigGetCfmHandler(void *drvpriv,
23 CsrWifiFsmEvent *msg);
24extern void CsrWifiSmeAdhocConfigSetCfmHandler(void *drvpriv,
25 CsrWifiFsmEvent *msg);
26extern void CsrWifiSmeAssociationCompleteIndHandler(void *drvpriv,
27 CsrWifiFsmEvent *msg);
28extern void CsrWifiSmeAssociationStartIndHandler(void *drvpriv,
29 CsrWifiFsmEvent *msg);
30extern void CsrWifiSmeBlacklistCfmHandler(void *drvpriv,
31 CsrWifiFsmEvent *msg);
32extern void CsrWifiSmeCalibrationDataGetCfmHandler(void *drvpriv,
33 CsrWifiFsmEvent *msg);
34extern void CsrWifiSmeCalibrationDataSetCfmHandler(void *drvpriv,
35 CsrWifiFsmEvent *msg);
36extern void CsrWifiSmeCcxConfigGetCfmHandler(void *drvpriv,
37 CsrWifiFsmEvent *msg);
38extern void CsrWifiSmeCcxConfigSetCfmHandler(void *drvpriv,
39 CsrWifiFsmEvent *msg);
40extern void CsrWifiSmeCoexConfigGetCfmHandler(void *drvpriv,
41 CsrWifiFsmEvent *msg);
42extern void CsrWifiSmeCoexConfigSetCfmHandler(void *drvpriv,
43 CsrWifiFsmEvent *msg);
44extern void CsrWifiSmeCoexInfoGetCfmHandler(void *drvpriv,
45 CsrWifiFsmEvent *msg);
46extern void CsrWifiSmeConnectCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg);
47extern void CsrWifiSmeConnectionConfigGetCfmHandler(void *drvpriv,
48 CsrWifiFsmEvent *msg);
49extern void CsrWifiSmeConnectionInfoGetCfmHandler(void *drvpriv,
50 CsrWifiFsmEvent *msg);
51extern void CsrWifiSmeConnectionQualityIndHandler(void *drvpriv,
52 CsrWifiFsmEvent *msg);
53extern void CsrWifiSmeConnectionStatsGetCfmHandler(void *drvpriv,
54 CsrWifiFsmEvent *msg);
55extern void CsrWifiSmeDeactivateCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg);
56extern void CsrWifiSmeDisconnectCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg);
57extern void CsrWifiSmeEventMaskSetCfmHandler(void *drvpriv,
58 CsrWifiFsmEvent *msg);
59extern void CsrWifiSmeHostConfigGetCfmHandler(void *drvpriv,
60 CsrWifiFsmEvent *msg);
61extern void CsrWifiSmeHostConfigSetCfmHandler(void *drvpriv,
62 CsrWifiFsmEvent *msg);
63extern void CsrWifiSmeIbssStationIndHandler(void *drvpriv,
64 CsrWifiFsmEvent *msg);
65extern void CsrWifiSmeKeyCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg);
66extern void CsrWifiSmeLinkQualityGetCfmHandler(void *drvpriv,
67 CsrWifiFsmEvent *msg);
68extern void CsrWifiSmeMediaStatusIndHandler(void *drvpriv,
69 CsrWifiFsmEvent *msg);
70extern void CsrWifiSmeMibConfigGetCfmHandler(void *drvpriv,
71 CsrWifiFsmEvent *msg);
72extern void CsrWifiSmeMibConfigSetCfmHandler(void *drvpriv,
73 CsrWifiFsmEvent *msg);
74extern void CsrWifiSmeMibGetCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg);
75extern void CsrWifiSmeMibGetNextCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg);
76extern void CsrWifiSmeMibSetCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg);
77extern void CsrWifiSmeMicFailureIndHandler(void *drvpriv, CsrWifiFsmEvent *msg);
78extern void CsrWifiSmeMulticastAddressCfmHandler(void *drvpriv,
79 CsrWifiFsmEvent *msg);
80extern void CsrWifiSmePacketFilterSetCfmHandler(void *drvpriv,
81 CsrWifiFsmEvent *msg);
82extern void CsrWifiSmePermanentMacAddressGetCfmHandler(void *drvpriv,
83 CsrWifiFsmEvent *msg);
84extern void CsrWifiSmePmkidCandidateListIndHandler(void *drvpriv,
85 CsrWifiFsmEvent *msg);
86extern void CsrWifiSmePmkidCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg);
87extern void CsrWifiSmePowerConfigGetCfmHandler(void *drvpriv,
88 CsrWifiFsmEvent *msg);
89extern void CsrWifiSmePowerConfigSetCfmHandler(void *drvpriv,
90 CsrWifiFsmEvent *msg);
91extern void CsrWifiSmeRegulatoryDomainInfoGetCfmHandler(void *drvpriv,
92 CsrWifiFsmEvent *msg);
93extern void CsrWifiSmeRoamCompleteIndHandler(void *drvpriv,
94 CsrWifiFsmEvent *msg);
95extern void CsrWifiSmeRoamStartIndHandler(void *drvpriv, CsrWifiFsmEvent *msg);
96extern void CsrWifiSmeRoamingConfigGetCfmHandler(void *drvpriv,
97 CsrWifiFsmEvent *msg);
98extern void CsrWifiSmeRoamingConfigSetCfmHandler(void *drvpriv,
99 CsrWifiFsmEvent *msg);
100extern void CsrWifiSmeScanConfigGetCfmHandler(void *drvpriv,
101 CsrWifiFsmEvent *msg);
102extern void CsrWifiSmeScanConfigSetCfmHandler(void *drvpriv,
103 CsrWifiFsmEvent *msg);
104extern void CsrWifiSmeScanFullCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg);
105extern void CsrWifiSmeScanResultIndHandler(void *drvpriv, CsrWifiFsmEvent *msg);
106extern void CsrWifiSmeScanResultsFlushCfmHandler(void *drvpriv,
107 CsrWifiFsmEvent *msg);
108extern void CsrWifiSmeScanResultsGetCfmHandler(void *drvpriv,
109 CsrWifiFsmEvent *msg);
110extern void CsrWifiSmeSmeStaConfigGetCfmHandler(void *drvpriv,
111 CsrWifiFsmEvent *msg);
112extern void CsrWifiSmeSmeStaConfigSetCfmHandler(void *drvpriv,
113 CsrWifiFsmEvent *msg);
114extern void CsrWifiSmeStationMacAddressGetCfmHandler(void *drvpriv,
115 CsrWifiFsmEvent *msg);
116extern void CsrWifiSmeTspecIndHandler(void *drvpriv, CsrWifiFsmEvent *msg);
117extern void CsrWifiSmeTspecCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg);
118extern void CsrWifiSmeVersionsGetCfmHandler(void *drvpriv,
119 CsrWifiFsmEvent *msg);
120extern void CsrWifiSmeWifiFlightmodeCfmHandler(void *drvpriv,
121 CsrWifiFsmEvent *msg);
122extern void CsrWifiSmeWifiOffIndHandler(void *drvpriv, CsrWifiFsmEvent *msg);
123extern void CsrWifiSmeWifiOffCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg);
124extern void CsrWifiSmeWifiOnCfmHandler(void *drvpriv, CsrWifiFsmEvent *msg);
125extern void CsrWifiSmeCloakedSsidsSetCfmHandler(void *drvpriv,
126 CsrWifiFsmEvent *msg);
127extern void CsrWifiSmeCloakedSsidsGetCfmHandler(void *drvpriv,
128 CsrWifiFsmEvent *msg);
129extern void CsrWifiSmeWifiOnIndHandler(void *drvpriv, CsrWifiFsmEvent *msg);
130extern void CsrWifiSmeSmeCommonConfigGetCfmHandler(void *drvpriv,
131 CsrWifiFsmEvent *msg);
132extern void CsrWifiSmeSmeCommonConfigSetCfmHandler(void *drvpriv,
133 CsrWifiFsmEvent *msg);
134extern void CsrWifiSmeGetInterfaceCapabilityCfmHandler(void *drvpriv,
135 CsrWifiFsmEvent *msg);
136extern void CsrWifiSmeErrorIndHandler(void *drvpriv, CsrWifiFsmEvent *msg);
137extern void CsrWifiSmeInfoIndHandler(void *drvpriv, CsrWifiFsmEvent *msg);
138extern void CsrWifiSmeCoreDumpIndHandler(void *drvpriv, CsrWifiFsmEvent *msg);
139extern void CsrWifiSmeAmpStatusChangeIndHandler(void *drvpriv,
140 CsrWifiFsmEvent *msg);
141
142#endif /* CSR_WIFI_ROUTER_SEF_CSR_WIFI_SME_H__ */
diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.c b/drivers/staging/csr/csr_wifi_sme_serialize.c
deleted file mode 100644
index 7d7e1d8b5ed3..000000000000
--- a/drivers/staging/csr/csr_wifi_sme_serialize.c
+++ /dev/null
@@ -1,5809 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12#include <linux/string.h>
13#include <linux/slab.h>
14#include "csr_msgconv.h"
15#include "csr_wifi_sme_prim.h"
16#include "csr_wifi_sme_serialize.h"
17
18void CsrWifiSmePfree(void *ptr)
19{
20 kfree(ptr);
21}
22
23
24size_t CsrWifiSmeAdhocConfigSetReqSizeof(void *msg)
25{
26 size_t bufferSize = 2;
27
28 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */
29 bufferSize += 2; /* u16 primitive->adHocConfig.atimWindowTu */
30 bufferSize += 2; /* u16 primitive->adHocConfig.beaconPeriodTu */
31 bufferSize += 2; /* u16 primitive->adHocConfig.joinOnlyAttempts */
32 bufferSize += 2; /* u16 primitive->adHocConfig.joinAttemptIntervalMs */
33 return bufferSize;
34}
35
36
37u8* CsrWifiSmeAdhocConfigSetReqSer(u8 *ptr, size_t *len, void *msg)
38{
39 CsrWifiSmeAdhocConfigSetReq *primitive = (CsrWifiSmeAdhocConfigSetReq *)msg;
40 *len = 0;
41 CsrUint16Ser(ptr, len, primitive->common.type);
42 CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.atimWindowTu);
43 CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.beaconPeriodTu);
44 CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.joinOnlyAttempts);
45 CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.joinAttemptIntervalMs);
46 return(ptr);
47}
48
49
50void* CsrWifiSmeAdhocConfigSetReqDes(u8 *buffer, size_t length)
51{
52 CsrWifiSmeAdhocConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeAdhocConfigSetReq), GFP_KERNEL);
53 size_t offset;
54 offset = 0;
55
56 CsrUint16Des(&primitive->common.type, buffer, &offset);
57 CsrUint16Des((u16 *) &primitive->adHocConfig.atimWindowTu, buffer, &offset);
58 CsrUint16Des((u16 *) &primitive->adHocConfig.beaconPeriodTu, buffer, &offset);
59 CsrUint16Des((u16 *) &primitive->adHocConfig.joinOnlyAttempts, buffer, &offset);
60 CsrUint16Des((u16 *) &primitive->adHocConfig.joinAttemptIntervalMs, buffer, &offset);
61
62 return primitive;
63}
64
65
66size_t CsrWifiSmeBlacklistReqSizeof(void *msg)
67{
68 CsrWifiSmeBlacklistReq *primitive = (CsrWifiSmeBlacklistReq *) msg;
69 size_t bufferSize = 2;
70
71 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */
72 bufferSize += 2; /* u16 primitive->interfaceTag */
73 bufferSize += 1; /* CsrWifiSmeListAction primitive->action */
74 bufferSize += 1; /* u8 primitive->setAddressCount */
75 {
76 u16 i1;
77 for (i1 = 0; i1 < primitive->setAddressCount; i1++)
78 {
79 bufferSize += 6; /* u8 primitive->setAddresses[i1].a[6] */
80 }
81 }
82 return bufferSize;
83}
84
85
86u8* CsrWifiSmeBlacklistReqSer(u8 *ptr, size_t *len, void *msg)
87{
88 CsrWifiSmeBlacklistReq *primitive = (CsrWifiSmeBlacklistReq *)msg;
89 *len = 0;
90 CsrUint16Ser(ptr, len, primitive->common.type);
91 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
92 CsrUint8Ser(ptr, len, (u8) primitive->action);
93 CsrUint8Ser(ptr, len, (u8) primitive->setAddressCount);
94 {
95 u16 i1;
96 for (i1 = 0; i1 < primitive->setAddressCount; i1++)
97 {
98 CsrMemCpySer(ptr, len, (const void *) primitive->setAddresses[i1].a, ((u16) (6)));
99 }
100 }
101 return(ptr);
102}
103
104
105void* CsrWifiSmeBlacklistReqDes(u8 *buffer, size_t length)
106{
107 CsrWifiSmeBlacklistReq *primitive = kmalloc(sizeof(CsrWifiSmeBlacklistReq), GFP_KERNEL);
108 size_t offset;
109 offset = 0;
110
111 CsrUint16Des(&primitive->common.type, buffer, &offset);
112 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
113 CsrUint8Des((u8 *) &primitive->action, buffer, &offset);
114 CsrUint8Des((u8 *) &primitive->setAddressCount, buffer, &offset);
115 primitive->setAddresses = NULL;
116 if (primitive->setAddressCount)
117 {
118 primitive->setAddresses = kmalloc(sizeof(CsrWifiMacAddress) * primitive->setAddressCount, GFP_KERNEL);
119 }
120 {
121 u16 i1;
122 for (i1 = 0; i1 < primitive->setAddressCount; i1++)
123 {
124 CsrMemCpyDes(primitive->setAddresses[i1].a, buffer, &offset, ((u16) (6)));
125 }
126 }
127
128 return primitive;
129}
130
131
132void CsrWifiSmeBlacklistReqSerFree(void *voidPrimitivePointer)
133{
134 CsrWifiSmeBlacklistReq *primitive = (CsrWifiSmeBlacklistReq *) voidPrimitivePointer;
135 kfree(primitive->setAddresses);
136 kfree(primitive);
137}
138
139
140size_t CsrWifiSmeCalibrationDataSetReqSizeof(void *msg)
141{
142 CsrWifiSmeCalibrationDataSetReq *primitive = (CsrWifiSmeCalibrationDataSetReq *) msg;
143 size_t bufferSize = 2;
144
145 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */
146 bufferSize += 2; /* u16 primitive->calibrationDataLength */
147 bufferSize += primitive->calibrationDataLength; /* u8 primitive->calibrationData */
148 return bufferSize;
149}
150
151
152u8* CsrWifiSmeCalibrationDataSetReqSer(u8 *ptr, size_t *len, void *msg)
153{
154 CsrWifiSmeCalibrationDataSetReq *primitive = (CsrWifiSmeCalibrationDataSetReq *)msg;
155 *len = 0;
156 CsrUint16Ser(ptr, len, primitive->common.type);
157 CsrUint16Ser(ptr, len, (u16) primitive->calibrationDataLength);
158 if (primitive->calibrationDataLength)
159 {
160 CsrMemCpySer(ptr, len, (const void *) primitive->calibrationData, ((u16) (primitive->calibrationDataLength)));
161 }
162 return(ptr);
163}
164
165
166void* CsrWifiSmeCalibrationDataSetReqDes(u8 *buffer, size_t length)
167{
168 CsrWifiSmeCalibrationDataSetReq *primitive = kmalloc(sizeof(CsrWifiSmeCalibrationDataSetReq), GFP_KERNEL);
169 size_t offset;
170 offset = 0;
171
172 CsrUint16Des(&primitive->common.type, buffer, &offset);
173 CsrUint16Des((u16 *) &primitive->calibrationDataLength, buffer, &offset);
174 if (primitive->calibrationDataLength)
175 {
176 primitive->calibrationData = kmalloc(primitive->calibrationDataLength, GFP_KERNEL);
177 CsrMemCpyDes(primitive->calibrationData, buffer, &offset, ((u16) (primitive->calibrationDataLength)));
178 }
179 else
180 {
181 primitive->calibrationData = NULL;
182 }
183
184 return primitive;
185}
186
187
188void CsrWifiSmeCalibrationDataSetReqSerFree(void *voidPrimitivePointer)
189{
190 CsrWifiSmeCalibrationDataSetReq *primitive = (CsrWifiSmeCalibrationDataSetReq *) voidPrimitivePointer;
191 kfree(primitive->calibrationData);
192 kfree(primitive);
193}
194
195
196size_t CsrWifiSmeCcxConfigSetReqSizeof(void *msg)
197{
198 size_t bufferSize = 2;
199
200 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */
201 bufferSize += 2; /* u16 primitive->interfaceTag */
202 bufferSize += 1; /* u8 primitive->ccxConfig.keepAliveTimeMs */
203 bufferSize += 1; /* u8 primitive->ccxConfig.apRoamingEnabled */
204 bufferSize += 1; /* u8 primitive->ccxConfig.measurementsMask */
205 bufferSize += 1; /* u8 primitive->ccxConfig.ccxRadioMgtEnabled */
206 return bufferSize;
207}
208
209
210u8* CsrWifiSmeCcxConfigSetReqSer(u8 *ptr, size_t *len, void *msg)
211{
212 CsrWifiSmeCcxConfigSetReq *primitive = (CsrWifiSmeCcxConfigSetReq *)msg;
213 *len = 0;
214 CsrUint16Ser(ptr, len, primitive->common.type);
215 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
216 CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.keepAliveTimeMs);
217 CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.apRoamingEnabled);
218 CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.measurementsMask);
219 CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.ccxRadioMgtEnabled);
220 return(ptr);
221}
222
223
224void* CsrWifiSmeCcxConfigSetReqDes(u8 *buffer, size_t length)
225{
226 CsrWifiSmeCcxConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeCcxConfigSetReq), GFP_KERNEL);
227 size_t offset;
228 offset = 0;
229
230 CsrUint16Des(&primitive->common.type, buffer, &offset);
231 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
232 CsrUint8Des((u8 *) &primitive->ccxConfig.keepAliveTimeMs, buffer, &offset);
233 CsrUint8Des((u8 *) &primitive->ccxConfig.apRoamingEnabled, buffer, &offset);
234 CsrUint8Des((u8 *) &primitive->ccxConfig.measurementsMask, buffer, &offset);
235 CsrUint8Des((u8 *) &primitive->ccxConfig.ccxRadioMgtEnabled, buffer, &offset);
236
237 return primitive;
238}
239
240
241size_t CsrWifiSmeCoexConfigSetReqSizeof(void *msg)
242{
243 size_t bufferSize = 2;
244
245 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 29) */
246 bufferSize += 1; /* u8 primitive->coexConfig.coexEnableSchemeManagement */
247 bufferSize += 1; /* u8 primitive->coexConfig.coexPeriodicWakeHost */
248 bufferSize += 2; /* u16 primitive->coexConfig.coexTrafficBurstyLatencyMs */
249 bufferSize += 2; /* u16 primitive->coexConfig.coexTrafficContinuousLatencyMs */
250 bufferSize += 2; /* u16 primitive->coexConfig.coexObexBlackoutDurationMs */
251 bufferSize += 2; /* u16 primitive->coexConfig.coexObexBlackoutPeriodMs */
252 bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpBrBlackoutDurationMs */
253 bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpBrBlackoutPeriodMs */
254 bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpEdrBlackoutDurationMs */
255 bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs */
256 bufferSize += 2; /* u16 primitive->coexConfig.coexPagingBlackoutDurationMs */
257 bufferSize += 2; /* u16 primitive->coexConfig.coexPagingBlackoutPeriodMs */
258 bufferSize += 2; /* u16 primitive->coexConfig.coexInquiryBlackoutDurationMs */
259 bufferSize += 2; /* u16 primitive->coexConfig.coexInquiryBlackoutPeriodMs */
260 return bufferSize;
261}
262
263
264u8* CsrWifiSmeCoexConfigSetReqSer(u8 *ptr, size_t *len, void *msg)
265{
266 CsrWifiSmeCoexConfigSetReq *primitive = (CsrWifiSmeCoexConfigSetReq *)msg;
267 *len = 0;
268 CsrUint16Ser(ptr, len, primitive->common.type);
269 CsrUint8Ser(ptr, len, (u8) primitive->coexConfig.coexEnableSchemeManagement);
270 CsrUint8Ser(ptr, len, (u8) primitive->coexConfig.coexPeriodicWakeHost);
271 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexTrafficBurstyLatencyMs);
272 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexTrafficContinuousLatencyMs);
273 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexObexBlackoutDurationMs);
274 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexObexBlackoutPeriodMs);
275 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpBrBlackoutDurationMs);
276 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpBrBlackoutPeriodMs);
277 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpEdrBlackoutDurationMs);
278 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs);
279 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexPagingBlackoutDurationMs);
280 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexPagingBlackoutPeriodMs);
281 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexInquiryBlackoutDurationMs);
282 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexInquiryBlackoutPeriodMs);
283 return(ptr);
284}
285
286
287void* CsrWifiSmeCoexConfigSetReqDes(u8 *buffer, size_t length)
288{
289 CsrWifiSmeCoexConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeCoexConfigSetReq), GFP_KERNEL);
290 size_t offset;
291 offset = 0;
292
293 CsrUint16Des(&primitive->common.type, buffer, &offset);
294 CsrUint8Des((u8 *) &primitive->coexConfig.coexEnableSchemeManagement, buffer, &offset);
295 CsrUint8Des((u8 *) &primitive->coexConfig.coexPeriodicWakeHost, buffer, &offset);
296 CsrUint16Des((u16 *) &primitive->coexConfig.coexTrafficBurstyLatencyMs, buffer, &offset);
297 CsrUint16Des((u16 *) &primitive->coexConfig.coexTrafficContinuousLatencyMs, buffer, &offset);
298 CsrUint16Des((u16 *) &primitive->coexConfig.coexObexBlackoutDurationMs, buffer, &offset);
299 CsrUint16Des((u16 *) &primitive->coexConfig.coexObexBlackoutPeriodMs, buffer, &offset);
300 CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpBrBlackoutDurationMs, buffer, &offset);
301 CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpBrBlackoutPeriodMs, buffer, &offset);
302 CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpEdrBlackoutDurationMs, buffer, &offset);
303 CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs, buffer, &offset);
304 CsrUint16Des((u16 *) &primitive->coexConfig.coexPagingBlackoutDurationMs, buffer, &offset);
305 CsrUint16Des((u16 *) &primitive->coexConfig.coexPagingBlackoutPeriodMs, buffer, &offset);
306 CsrUint16Des((u16 *) &primitive->coexConfig.coexInquiryBlackoutDurationMs, buffer, &offset);
307 CsrUint16Des((u16 *) &primitive->coexConfig.coexInquiryBlackoutPeriodMs, buffer, &offset);
308
309 return primitive;
310}
311
312
313size_t CsrWifiSmeConnectReqSizeof(void *msg)
314{
315 CsrWifiSmeConnectReq *primitive = (CsrWifiSmeConnectReq *) msg;
316 size_t bufferSize = 2;
317
318 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 57) */
319 bufferSize += 2; /* u16 primitive->interfaceTag */
320 bufferSize += 32; /* u8 primitive->connectionConfig.ssid.ssid[32] */
321 bufferSize += 1; /* u8 primitive->connectionConfig.ssid.length */
322 bufferSize += 6; /* u8 primitive->connectionConfig.bssid.a[6] */
323 bufferSize += 1; /* CsrWifiSmeBssType primitive->connectionConfig.bssType */
324 bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionConfig.ifIndex */
325 bufferSize += 1; /* CsrWifiSme80211PrivacyMode primitive->connectionConfig.privacyMode */
326 bufferSize += 2; /* CsrWifiSmeAuthModeMask primitive->connectionConfig.authModeMask */
327 bufferSize += 2; /* CsrWifiSmeEncryptionMask primitive->connectionConfig.encryptionModeMask */
328 bufferSize += 2; /* u16 primitive->connectionConfig.mlmeAssociateReqInformationElementsLength */
329 bufferSize += primitive->connectionConfig.mlmeAssociateReqInformationElementsLength; /* u8 primitive->connectionConfig.mlmeAssociateReqInformationElements */
330 bufferSize += 1; /* CsrWifiSmeWmmQosInfoMask primitive->connectionConfig.wmmQosInfo */
331 bufferSize += 1; /* u8 primitive->connectionConfig.adhocJoinOnly */
332 bufferSize += 1; /* u8 primitive->connectionConfig.adhocChannel */
333 return bufferSize;
334}
335
336
337u8* CsrWifiSmeConnectReqSer(u8 *ptr, size_t *len, void *msg)
338{
339 CsrWifiSmeConnectReq *primitive = (CsrWifiSmeConnectReq *)msg;
340 *len = 0;
341 CsrUint16Ser(ptr, len, primitive->common.type);
342 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
343 CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.ssid.ssid, ((u16) (32)));
344 CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.ssid.length);
345 CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.bssid.a, ((u16) (6)));
346 CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.bssType);
347 CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.ifIndex);
348 CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.privacyMode);
349 CsrUint16Ser(ptr, len, (u16) primitive->connectionConfig.authModeMask);
350 CsrUint16Ser(ptr, len, (u16) primitive->connectionConfig.encryptionModeMask);
351 CsrUint16Ser(ptr, len, (u16) primitive->connectionConfig.mlmeAssociateReqInformationElementsLength);
352 if (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength)
353 {
354 CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.mlmeAssociateReqInformationElements, ((u16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength)));
355 }
356 CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.wmmQosInfo);
357 CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.adhocJoinOnly);
358 CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.adhocChannel);
359 return(ptr);
360}
361
362
363void* CsrWifiSmeConnectReqDes(u8 *buffer, size_t length)
364{
365 CsrWifiSmeConnectReq *primitive = kmalloc(sizeof(CsrWifiSmeConnectReq), GFP_KERNEL);
366 size_t offset;
367 offset = 0;
368
369 CsrUint16Des(&primitive->common.type, buffer, &offset);
370 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
371 CsrMemCpyDes(primitive->connectionConfig.ssid.ssid, buffer, &offset, ((u16) (32)));
372 CsrUint8Des((u8 *) &primitive->connectionConfig.ssid.length, buffer, &offset);
373 CsrMemCpyDes(primitive->connectionConfig.bssid.a, buffer, &offset, ((u16) (6)));
374 CsrUint8Des((u8 *) &primitive->connectionConfig.bssType, buffer, &offset);
375 CsrUint8Des((u8 *) &primitive->connectionConfig.ifIndex, buffer, &offset);
376 CsrUint8Des((u8 *) &primitive->connectionConfig.privacyMode, buffer, &offset);
377 CsrUint16Des((u16 *) &primitive->connectionConfig.authModeMask, buffer, &offset);
378 CsrUint16Des((u16 *) &primitive->connectionConfig.encryptionModeMask, buffer, &offset);
379 CsrUint16Des((u16 *) &primitive->connectionConfig.mlmeAssociateReqInformationElementsLength, buffer, &offset);
380 if (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength)
381 {
382 primitive->connectionConfig.mlmeAssociateReqInformationElements = kmalloc(primitive->connectionConfig.mlmeAssociateReqInformationElementsLength, GFP_KERNEL);
383 CsrMemCpyDes(primitive->connectionConfig.mlmeAssociateReqInformationElements, buffer, &offset, ((u16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength)));
384 }
385 else
386 {
387 primitive->connectionConfig.mlmeAssociateReqInformationElements = NULL;
388 }
389 CsrUint8Des((u8 *) &primitive->connectionConfig.wmmQosInfo, buffer, &offset);
390 CsrUint8Des((u8 *) &primitive->connectionConfig.adhocJoinOnly, buffer, &offset);
391 CsrUint8Des((u8 *) &primitive->connectionConfig.adhocChannel, buffer, &offset);
392
393 return primitive;
394}
395
396
397void CsrWifiSmeConnectReqSerFree(void *voidPrimitivePointer)
398{
399 CsrWifiSmeConnectReq *primitive = (CsrWifiSmeConnectReq *) voidPrimitivePointer;
400 kfree(primitive->connectionConfig.mlmeAssociateReqInformationElements);
401 kfree(primitive);
402}
403
404
405size_t CsrWifiSmeHostConfigSetReqSizeof(void *msg)
406{
407 size_t bufferSize = 2;
408
409 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */
410 bufferSize += 2; /* u16 primitive->interfaceTag */
411 bufferSize += 1; /* CsrWifiSmeHostPowerMode primitive->hostConfig.powerMode */
412 bufferSize += 2; /* u16 primitive->hostConfig.applicationDataPeriodMs */
413 return bufferSize;
414}
415
416
417u8* CsrWifiSmeHostConfigSetReqSer(u8 *ptr, size_t *len, void *msg)
418{
419 CsrWifiSmeHostConfigSetReq *primitive = (CsrWifiSmeHostConfigSetReq *)msg;
420 *len = 0;
421 CsrUint16Ser(ptr, len, primitive->common.type);
422 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
423 CsrUint8Ser(ptr, len, (u8) primitive->hostConfig.powerMode);
424 CsrUint16Ser(ptr, len, (u16) primitive->hostConfig.applicationDataPeriodMs);
425 return(ptr);
426}
427
428
429void* CsrWifiSmeHostConfigSetReqDes(u8 *buffer, size_t length)
430{
431 CsrWifiSmeHostConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeHostConfigSetReq), GFP_KERNEL);
432 size_t offset;
433 offset = 0;
434
435 CsrUint16Des(&primitive->common.type, buffer, &offset);
436 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
437 CsrUint8Des((u8 *) &primitive->hostConfig.powerMode, buffer, &offset);
438 CsrUint16Des((u16 *) &primitive->hostConfig.applicationDataPeriodMs, buffer, &offset);
439
440 return primitive;
441}
442
443
444size_t CsrWifiSmeKeyReqSizeof(void *msg)
445{
446 size_t bufferSize = 2;
447
448 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 65) */
449 bufferSize += 2; /* u16 primitive->interfaceTag */
450 bufferSize += 1; /* CsrWifiSmeListAction primitive->action */
451 bufferSize += 1; /* CsrWifiSmeKeyType primitive->key.keyType */
452 bufferSize += 1; /* u8 primitive->key.keyIndex */
453 bufferSize += 1; /* u8 primitive->key.wepTxKey */
454 {
455 u16 i2;
456 for (i2 = 0; i2 < 8; i2++)
457 {
458 bufferSize += 2; /* u16 primitive->key.keyRsc[8] */
459 }
460 }
461 bufferSize += 1; /* u8 primitive->key.authenticator */
462 bufferSize += 6; /* u8 primitive->key.address.a[6] */
463 bufferSize += 1; /* u8 primitive->key.keyLength */
464 bufferSize += 32; /* u8 primitive->key.key[32] */
465 return bufferSize;
466}
467
468
469u8* CsrWifiSmeKeyReqSer(u8 *ptr, size_t *len, void *msg)
470{
471 CsrWifiSmeKeyReq *primitive = (CsrWifiSmeKeyReq *)msg;
472 *len = 0;
473 CsrUint16Ser(ptr, len, primitive->common.type);
474 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
475 CsrUint8Ser(ptr, len, (u8) primitive->action);
476 CsrUint8Ser(ptr, len, (u8) primitive->key.keyType);
477 CsrUint8Ser(ptr, len, (u8) primitive->key.keyIndex);
478 CsrUint8Ser(ptr, len, (u8) primitive->key.wepTxKey);
479 {
480 u16 i2;
481 for (i2 = 0; i2 < 8; i2++)
482 {
483 CsrUint16Ser(ptr, len, (u16) primitive->key.keyRsc[i2]);
484 }
485 }
486 CsrUint8Ser(ptr, len, (u8) primitive->key.authenticator);
487 CsrMemCpySer(ptr, len, (const void *) primitive->key.address.a, ((u16) (6)));
488 CsrUint8Ser(ptr, len, (u8) primitive->key.keyLength);
489 CsrMemCpySer(ptr, len, (const void *) primitive->key.key, ((u16) (32)));
490 return(ptr);
491}
492
493
494void* CsrWifiSmeKeyReqDes(u8 *buffer, size_t length)
495{
496 CsrWifiSmeKeyReq *primitive = kmalloc(sizeof(CsrWifiSmeKeyReq), GFP_KERNEL);
497 size_t offset;
498 offset = 0;
499
500 CsrUint16Des(&primitive->common.type, buffer, &offset);
501 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
502 CsrUint8Des((u8 *) &primitive->action, buffer, &offset);
503 CsrUint8Des((u8 *) &primitive->key.keyType, buffer, &offset);
504 CsrUint8Des((u8 *) &primitive->key.keyIndex, buffer, &offset);
505 CsrUint8Des((u8 *) &primitive->key.wepTxKey, buffer, &offset);
506 {
507 u16 i2;
508 for (i2 = 0; i2 < 8; i2++)
509 {
510 CsrUint16Des((u16 *) &primitive->key.keyRsc[i2], buffer, &offset);
511 }
512 }
513 CsrUint8Des((u8 *) &primitive->key.authenticator, buffer, &offset);
514 CsrMemCpyDes(primitive->key.address.a, buffer, &offset, ((u16) (6)));
515 CsrUint8Des((u8 *) &primitive->key.keyLength, buffer, &offset);
516 CsrMemCpyDes(primitive->key.key, buffer, &offset, ((u16) (32)));
517
518 return primitive;
519}
520
521
522size_t CsrWifiSmeMibConfigSetReqSizeof(void *msg)
523{
524 size_t bufferSize = 2;
525
526 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */
527 bufferSize += 1; /* u8 primitive->mibConfig.unifiFixMaxTxDataRate */
528 bufferSize += 1; /* u8 primitive->mibConfig.unifiFixTxDataRate */
529 bufferSize += 2; /* u16 primitive->mibConfig.dot11RtsThreshold */
530 bufferSize += 2; /* u16 primitive->mibConfig.dot11FragmentationThreshold */
531 bufferSize += 2; /* u16 primitive->mibConfig.dot11CurrentTxPowerLevel */
532 return bufferSize;
533}
534
535
536u8* CsrWifiSmeMibConfigSetReqSer(u8 *ptr, size_t *len, void *msg)
537{
538 CsrWifiSmeMibConfigSetReq *primitive = (CsrWifiSmeMibConfigSetReq *)msg;
539 *len = 0;
540 CsrUint16Ser(ptr, len, primitive->common.type);
541 CsrUint8Ser(ptr, len, (u8) primitive->mibConfig.unifiFixMaxTxDataRate);
542 CsrUint8Ser(ptr, len, (u8) primitive->mibConfig.unifiFixTxDataRate);
543 CsrUint16Ser(ptr, len, (u16) primitive->mibConfig.dot11RtsThreshold);
544 CsrUint16Ser(ptr, len, (u16) primitive->mibConfig.dot11FragmentationThreshold);
545 CsrUint16Ser(ptr, len, (u16) primitive->mibConfig.dot11CurrentTxPowerLevel);
546 return(ptr);
547}
548
549
550void* CsrWifiSmeMibConfigSetReqDes(u8 *buffer, size_t length)
551{
552 CsrWifiSmeMibConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeMibConfigSetReq), GFP_KERNEL);
553 size_t offset;
554 offset = 0;
555
556 CsrUint16Des(&primitive->common.type, buffer, &offset);
557 CsrUint8Des((u8 *) &primitive->mibConfig.unifiFixMaxTxDataRate, buffer, &offset);
558 CsrUint8Des((u8 *) &primitive->mibConfig.unifiFixTxDataRate, buffer, &offset);
559 CsrUint16Des((u16 *) &primitive->mibConfig.dot11RtsThreshold, buffer, &offset);
560 CsrUint16Des((u16 *) &primitive->mibConfig.dot11FragmentationThreshold, buffer, &offset);
561 CsrUint16Des((u16 *) &primitive->mibConfig.dot11CurrentTxPowerLevel, buffer, &offset);
562
563 return primitive;
564}
565
566
567size_t CsrWifiSmeMibGetNextReqSizeof(void *msg)
568{
569 CsrWifiSmeMibGetNextReq *primitive = (CsrWifiSmeMibGetNextReq *) msg;
570 size_t bufferSize = 2;
571
572 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */
573 bufferSize += 2; /* u16 primitive->mibAttributeLength */
574 bufferSize += primitive->mibAttributeLength; /* u8 primitive->mibAttribute */
575 return bufferSize;
576}
577
578
579u8* CsrWifiSmeMibGetNextReqSer(u8 *ptr, size_t *len, void *msg)
580{
581 CsrWifiSmeMibGetNextReq *primitive = (CsrWifiSmeMibGetNextReq *)msg;
582 *len = 0;
583 CsrUint16Ser(ptr, len, primitive->common.type);
584 CsrUint16Ser(ptr, len, (u16) primitive->mibAttributeLength);
585 if (primitive->mibAttributeLength)
586 {
587 CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((u16) (primitive->mibAttributeLength)));
588 }
589 return(ptr);
590}
591
592
593void* CsrWifiSmeMibGetNextReqDes(u8 *buffer, size_t length)
594{
595 CsrWifiSmeMibGetNextReq *primitive = kmalloc(sizeof(CsrWifiSmeMibGetNextReq), GFP_KERNEL);
596 size_t offset;
597 offset = 0;
598
599 CsrUint16Des(&primitive->common.type, buffer, &offset);
600 CsrUint16Des((u16 *) &primitive->mibAttributeLength, buffer, &offset);
601 if (primitive->mibAttributeLength)
602 {
603 primitive->mibAttribute = kmalloc(primitive->mibAttributeLength, GFP_KERNEL);
604 CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((u16) (primitive->mibAttributeLength)));
605 }
606 else
607 {
608 primitive->mibAttribute = NULL;
609 }
610
611 return primitive;
612}
613
614
615void CsrWifiSmeMibGetNextReqSerFree(void *voidPrimitivePointer)
616{
617 CsrWifiSmeMibGetNextReq *primitive = (CsrWifiSmeMibGetNextReq *) voidPrimitivePointer;
618 kfree(primitive->mibAttribute);
619 kfree(primitive);
620}
621
622
623size_t CsrWifiSmeMibGetReqSizeof(void *msg)
624{
625 CsrWifiSmeMibGetReq *primitive = (CsrWifiSmeMibGetReq *) msg;
626 size_t bufferSize = 2;
627
628 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */
629 bufferSize += 2; /* u16 primitive->mibAttributeLength */
630 bufferSize += primitive->mibAttributeLength; /* u8 primitive->mibAttribute */
631 return bufferSize;
632}
633
634
635u8* CsrWifiSmeMibGetReqSer(u8 *ptr, size_t *len, void *msg)
636{
637 CsrWifiSmeMibGetReq *primitive = (CsrWifiSmeMibGetReq *)msg;
638 *len = 0;
639 CsrUint16Ser(ptr, len, primitive->common.type);
640 CsrUint16Ser(ptr, len, (u16) primitive->mibAttributeLength);
641 if (primitive->mibAttributeLength)
642 {
643 CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((u16) (primitive->mibAttributeLength)));
644 }
645 return(ptr);
646}
647
648
649void* CsrWifiSmeMibGetReqDes(u8 *buffer, size_t length)
650{
651 CsrWifiSmeMibGetReq *primitive = kmalloc(sizeof(CsrWifiSmeMibGetReq), GFP_KERNEL);
652 size_t offset;
653 offset = 0;
654
655 CsrUint16Des(&primitive->common.type, buffer, &offset);
656 CsrUint16Des((u16 *) &primitive->mibAttributeLength, buffer, &offset);
657 if (primitive->mibAttributeLength)
658 {
659 primitive->mibAttribute = kmalloc(primitive->mibAttributeLength, GFP_KERNEL);
660 CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((u16) (primitive->mibAttributeLength)));
661 }
662 else
663 {
664 primitive->mibAttribute = NULL;
665 }
666
667 return primitive;
668}
669
670
671void CsrWifiSmeMibGetReqSerFree(void *voidPrimitivePointer)
672{
673 CsrWifiSmeMibGetReq *primitive = (CsrWifiSmeMibGetReq *) voidPrimitivePointer;
674 kfree(primitive->mibAttribute);
675 kfree(primitive);
676}
677
678
679size_t CsrWifiSmeMibSetReqSizeof(void *msg)
680{
681 CsrWifiSmeMibSetReq *primitive = (CsrWifiSmeMibSetReq *) msg;
682 size_t bufferSize = 2;
683
684 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 6) */
685 bufferSize += 2; /* u16 primitive->mibAttributeLength */
686 bufferSize += primitive->mibAttributeLength; /* u8 primitive->mibAttribute */
687 return bufferSize;
688}
689
690
691u8* CsrWifiSmeMibSetReqSer(u8 *ptr, size_t *len, void *msg)
692{
693 CsrWifiSmeMibSetReq *primitive = (CsrWifiSmeMibSetReq *)msg;
694 *len = 0;
695 CsrUint16Ser(ptr, len, primitive->common.type);
696 CsrUint16Ser(ptr, len, (u16) primitive->mibAttributeLength);
697 if (primitive->mibAttributeLength)
698 {
699 CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((u16) (primitive->mibAttributeLength)));
700 }
701 return(ptr);
702}
703
704
705void* CsrWifiSmeMibSetReqDes(u8 *buffer, size_t length)
706{
707 CsrWifiSmeMibSetReq *primitive = kmalloc(sizeof(CsrWifiSmeMibSetReq), GFP_KERNEL);
708 size_t offset;
709 offset = 0;
710
711 CsrUint16Des(&primitive->common.type, buffer, &offset);
712 CsrUint16Des((u16 *) &primitive->mibAttributeLength, buffer, &offset);
713 if (primitive->mibAttributeLength)
714 {
715 primitive->mibAttribute = kmalloc(primitive->mibAttributeLength, GFP_KERNEL);
716 CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((u16) (primitive->mibAttributeLength)));
717 }
718 else
719 {
720 primitive->mibAttribute = NULL;
721 }
722
723 return primitive;
724}
725
726
727void CsrWifiSmeMibSetReqSerFree(void *voidPrimitivePointer)
728{
729 CsrWifiSmeMibSetReq *primitive = (CsrWifiSmeMibSetReq *) voidPrimitivePointer;
730 kfree(primitive->mibAttribute);
731 kfree(primitive);
732}
733
734
735size_t CsrWifiSmeMulticastAddressReqSizeof(void *msg)
736{
737 CsrWifiSmeMulticastAddressReq *primitive = (CsrWifiSmeMulticastAddressReq *) msg;
738 size_t bufferSize = 2;
739
740 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */
741 bufferSize += 2; /* u16 primitive->interfaceTag */
742 bufferSize += 1; /* CsrWifiSmeListAction primitive->action */
743 bufferSize += 1; /* u8 primitive->setAddressesCount */
744 {
745 u16 i1;
746 for (i1 = 0; i1 < primitive->setAddressesCount; i1++)
747 {
748 bufferSize += 6; /* u8 primitive->setAddresses[i1].a[6] */
749 }
750 }
751 return bufferSize;
752}
753
754
755u8* CsrWifiSmeMulticastAddressReqSer(u8 *ptr, size_t *len, void *msg)
756{
757 CsrWifiSmeMulticastAddressReq *primitive = (CsrWifiSmeMulticastAddressReq *)msg;
758 *len = 0;
759 CsrUint16Ser(ptr, len, primitive->common.type);
760 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
761 CsrUint8Ser(ptr, len, (u8) primitive->action);
762 CsrUint8Ser(ptr, len, (u8) primitive->setAddressesCount);
763 {
764 u16 i1;
765 for (i1 = 0; i1 < primitive->setAddressesCount; i1++)
766 {
767 CsrMemCpySer(ptr, len, (const void *) primitive->setAddresses[i1].a, ((u16) (6)));
768 }
769 }
770 return(ptr);
771}
772
773
774void* CsrWifiSmeMulticastAddressReqDes(u8 *buffer, size_t length)
775{
776 CsrWifiSmeMulticastAddressReq *primitive = kmalloc(sizeof(CsrWifiSmeMulticastAddressReq), GFP_KERNEL);
777 size_t offset;
778 offset = 0;
779
780 CsrUint16Des(&primitive->common.type, buffer, &offset);
781 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
782 CsrUint8Des((u8 *) &primitive->action, buffer, &offset);
783 CsrUint8Des((u8 *) &primitive->setAddressesCount, buffer, &offset);
784 primitive->setAddresses = NULL;
785 if (primitive->setAddressesCount)
786 {
787 primitive->setAddresses = kmalloc(sizeof(CsrWifiMacAddress) * primitive->setAddressesCount, GFP_KERNEL);
788 }
789 {
790 u16 i1;
791 for (i1 = 0; i1 < primitive->setAddressesCount; i1++)
792 {
793 CsrMemCpyDes(primitive->setAddresses[i1].a, buffer, &offset, ((u16) (6)));
794 }
795 }
796
797 return primitive;
798}
799
800
801void CsrWifiSmeMulticastAddressReqSerFree(void *voidPrimitivePointer)
802{
803 CsrWifiSmeMulticastAddressReq *primitive = (CsrWifiSmeMulticastAddressReq *) voidPrimitivePointer;
804 kfree(primitive->setAddresses);
805 kfree(primitive);
806}
807
808
809size_t CsrWifiSmePacketFilterSetReqSizeof(void *msg)
810{
811 CsrWifiSmePacketFilterSetReq *primitive = (CsrWifiSmePacketFilterSetReq *) msg;
812 size_t bufferSize = 2;
813
814 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */
815 bufferSize += 2; /* u16 primitive->interfaceTag */
816 bufferSize += 2; /* u16 primitive->filterLength */
817 bufferSize += primitive->filterLength; /* u8 primitive->filter */
818 bufferSize += 1; /* CsrWifiSmePacketFilterMode primitive->mode */
819 bufferSize += 4; /* u8 primitive->arpFilterAddress.a[4] */
820 return bufferSize;
821}
822
823
824u8* CsrWifiSmePacketFilterSetReqSer(u8 *ptr, size_t *len, void *msg)
825{
826 CsrWifiSmePacketFilterSetReq *primitive = (CsrWifiSmePacketFilterSetReq *)msg;
827 *len = 0;
828 CsrUint16Ser(ptr, len, primitive->common.type);
829 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
830 CsrUint16Ser(ptr, len, (u16) primitive->filterLength);
831 if (primitive->filterLength)
832 {
833 CsrMemCpySer(ptr, len, (const void *) primitive->filter, ((u16) (primitive->filterLength)));
834 }
835 CsrUint8Ser(ptr, len, (u8) primitive->mode);
836 CsrMemCpySer(ptr, len, (const void *) primitive->arpFilterAddress.a, ((u16) (4)));
837 return(ptr);
838}
839
840
841void* CsrWifiSmePacketFilterSetReqDes(u8 *buffer, size_t length)
842{
843 CsrWifiSmePacketFilterSetReq *primitive = kmalloc(sizeof(CsrWifiSmePacketFilterSetReq), GFP_KERNEL);
844 size_t offset;
845 offset = 0;
846
847 CsrUint16Des(&primitive->common.type, buffer, &offset);
848 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
849 CsrUint16Des((u16 *) &primitive->filterLength, buffer, &offset);
850 if (primitive->filterLength)
851 {
852 primitive->filter = kmalloc(primitive->filterLength, GFP_KERNEL);
853 CsrMemCpyDes(primitive->filter, buffer, &offset, ((u16) (primitive->filterLength)));
854 }
855 else
856 {
857 primitive->filter = NULL;
858 }
859 CsrUint8Des((u8 *) &primitive->mode, buffer, &offset);
860 CsrMemCpyDes(primitive->arpFilterAddress.a, buffer, &offset, ((u16) (4)));
861
862 return primitive;
863}
864
865
866void CsrWifiSmePacketFilterSetReqSerFree(void *voidPrimitivePointer)
867{
868 CsrWifiSmePacketFilterSetReq *primitive = (CsrWifiSmePacketFilterSetReq *) voidPrimitivePointer;
869 kfree(primitive->filter);
870 kfree(primitive);
871}
872
873
874size_t CsrWifiSmePmkidReqSizeof(void *msg)
875{
876 CsrWifiSmePmkidReq *primitive = (CsrWifiSmePmkidReq *) msg;
877 size_t bufferSize = 2;
878
879 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 29) */
880 bufferSize += 2; /* u16 primitive->interfaceTag */
881 bufferSize += 1; /* CsrWifiSmeListAction primitive->action */
882 bufferSize += 1; /* u8 primitive->setPmkidsCount */
883 {
884 u16 i1;
885 for (i1 = 0; i1 < primitive->setPmkidsCount; i1++)
886 {
887 bufferSize += 6; /* u8 primitive->setPmkids[i1].bssid.a[6] */
888 bufferSize += 16; /* u8 primitive->setPmkids[i1].pmkid[16] */
889 }
890 }
891 return bufferSize;
892}
893
894
895u8* CsrWifiSmePmkidReqSer(u8 *ptr, size_t *len, void *msg)
896{
897 CsrWifiSmePmkidReq *primitive = (CsrWifiSmePmkidReq *)msg;
898 *len = 0;
899 CsrUint16Ser(ptr, len, primitive->common.type);
900 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
901 CsrUint8Ser(ptr, len, (u8) primitive->action);
902 CsrUint8Ser(ptr, len, (u8) primitive->setPmkidsCount);
903 {
904 u16 i1;
905 for (i1 = 0; i1 < primitive->setPmkidsCount; i1++)
906 {
907 CsrMemCpySer(ptr, len, (const void *) primitive->setPmkids[i1].bssid.a, ((u16) (6)));
908 CsrMemCpySer(ptr, len, (const void *) primitive->setPmkids[i1].pmkid, ((u16) (16)));
909 }
910 }
911 return(ptr);
912}
913
914
915void* CsrWifiSmePmkidReqDes(u8 *buffer, size_t length)
916{
917 CsrWifiSmePmkidReq *primitive = kmalloc(sizeof(CsrWifiSmePmkidReq), GFP_KERNEL);
918 size_t offset;
919 offset = 0;
920
921 CsrUint16Des(&primitive->common.type, buffer, &offset);
922 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
923 CsrUint8Des((u8 *) &primitive->action, buffer, &offset);
924 CsrUint8Des((u8 *) &primitive->setPmkidsCount, buffer, &offset);
925 primitive->setPmkids = NULL;
926 if (primitive->setPmkidsCount)
927 {
928 primitive->setPmkids = kmalloc(sizeof(CsrWifiSmePmkid) * primitive->setPmkidsCount, GFP_KERNEL);
929 }
930 {
931 u16 i1;
932 for (i1 = 0; i1 < primitive->setPmkidsCount; i1++)
933 {
934 CsrMemCpyDes(primitive->setPmkids[i1].bssid.a, buffer, &offset, ((u16) (6)));
935 CsrMemCpyDes(primitive->setPmkids[i1].pmkid, buffer, &offset, ((u16) (16)));
936 }
937 }
938
939 return primitive;
940}
941
942
943void CsrWifiSmePmkidReqSerFree(void *voidPrimitivePointer)
944{
945 CsrWifiSmePmkidReq *primitive = (CsrWifiSmePmkidReq *) voidPrimitivePointer;
946 kfree(primitive->setPmkids);
947 kfree(primitive);
948}
949
950
951size_t CsrWifiSmePowerConfigSetReqSizeof(void *msg)
952{
953 size_t bufferSize = 2;
954
955 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */
956 bufferSize += 1; /* CsrWifiSmePowerSaveLevel primitive->powerConfig.powerSaveLevel */
957 bufferSize += 2; /* u16 primitive->powerConfig.listenIntervalTu */
958 bufferSize += 1; /* u8 primitive->powerConfig.rxDtims */
959 bufferSize += 1; /* CsrWifiSmeD3AutoScanMode primitive->powerConfig.d3AutoScanMode */
960 bufferSize += 1; /* u8 primitive->powerConfig.clientTrafficWindow */
961 bufferSize += 1; /* u8 primitive->powerConfig.opportunisticPowerSave */
962 bufferSize += 1; /* u8 primitive->powerConfig.noticeOfAbsence */
963 return bufferSize;
964}
965
966
967u8* CsrWifiSmePowerConfigSetReqSer(u8 *ptr, size_t *len, void *msg)
968{
969 CsrWifiSmePowerConfigSetReq *primitive = (CsrWifiSmePowerConfigSetReq *)msg;
970 *len = 0;
971 CsrUint16Ser(ptr, len, primitive->common.type);
972 CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.powerSaveLevel);
973 CsrUint16Ser(ptr, len, (u16) primitive->powerConfig.listenIntervalTu);
974 CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.rxDtims);
975 CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.d3AutoScanMode);
976 CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.clientTrafficWindow);
977 CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.opportunisticPowerSave);
978 CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.noticeOfAbsence);
979 return(ptr);
980}
981
982
983void* CsrWifiSmePowerConfigSetReqDes(u8 *buffer, size_t length)
984{
985 CsrWifiSmePowerConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmePowerConfigSetReq), GFP_KERNEL);
986 size_t offset;
987 offset = 0;
988
989 CsrUint16Des(&primitive->common.type, buffer, &offset);
990 CsrUint8Des((u8 *) &primitive->powerConfig.powerSaveLevel, buffer, &offset);
991 CsrUint16Des((u16 *) &primitive->powerConfig.listenIntervalTu, buffer, &offset);
992 CsrUint8Des((u8 *) &primitive->powerConfig.rxDtims, buffer, &offset);
993 CsrUint8Des((u8 *) &primitive->powerConfig.d3AutoScanMode, buffer, &offset);
994 CsrUint8Des((u8 *) &primitive->powerConfig.clientTrafficWindow, buffer, &offset);
995 CsrUint8Des((u8 *) &primitive->powerConfig.opportunisticPowerSave, buffer, &offset);
996 CsrUint8Des((u8 *) &primitive->powerConfig.noticeOfAbsence, buffer, &offset);
997
998 return primitive;
999}
1000
1001
1002size_t CsrWifiSmeRoamingConfigSetReqSizeof(void *msg)
1003{
1004 size_t bufferSize = 2;
1005
1006 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 70) */
1007 bufferSize += 2; /* u16 primitive->interfaceTag */
1008 {
1009 u16 i2;
1010 for (i2 = 0; i2 < 3; i2++)
1011 {
1012 bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].rssiHighThreshold */
1013 bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].rssiLowThreshold */
1014 bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].snrHighThreshold */
1015 bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].snrLowThreshold */
1016 }
1017 }
1018 bufferSize += 1; /* u8 primitive->roamingConfig.disableSmoothRoaming */
1019 bufferSize += 1; /* u8 primitive->roamingConfig.disableRoamScans */
1020 bufferSize += 1; /* u8 primitive->roamingConfig.reconnectLimit */
1021 bufferSize += 2; /* u16 primitive->roamingConfig.reconnectLimitIntervalMs */
1022 {
1023 u16 i2;
1024 for (i2 = 0; i2 < 3; i2++)
1025 {
1026 bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].intervalSeconds */
1027 bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].validitySeconds */
1028 bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu */
1029 bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu */
1030 bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu */
1031 bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu */
1032 }
1033 }
1034 return bufferSize;
1035}
1036
1037
1038u8* CsrWifiSmeRoamingConfigSetReqSer(u8 *ptr, size_t *len, void *msg)
1039{
1040 CsrWifiSmeRoamingConfigSetReq *primitive = (CsrWifiSmeRoamingConfigSetReq *)msg;
1041 *len = 0;
1042 CsrUint16Ser(ptr, len, primitive->common.type);
1043 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
1044 {
1045 u16 i2;
1046 for (i2 = 0; i2 < 3; i2++)
1047 {
1048 CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].rssiHighThreshold);
1049 CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].rssiLowThreshold);
1050 CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].snrHighThreshold);
1051 CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].snrLowThreshold);
1052 }
1053 }
1054 CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.disableSmoothRoaming);
1055 CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.disableRoamScans);
1056 CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.reconnectLimit);
1057 CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.reconnectLimitIntervalMs);
1058 {
1059 u16 i2;
1060 for (i2 = 0; i2 < 3; i2++)
1061 {
1062 CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].intervalSeconds);
1063 CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].validitySeconds);
1064 CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu);
1065 CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu);
1066 CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu);
1067 CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu);
1068 }
1069 }
1070 return(ptr);
1071}
1072
1073
1074void* CsrWifiSmeRoamingConfigSetReqDes(u8 *buffer, size_t length)
1075{
1076 CsrWifiSmeRoamingConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeRoamingConfigSetReq), GFP_KERNEL);
1077 size_t offset;
1078 offset = 0;
1079
1080 CsrUint16Des(&primitive->common.type, buffer, &offset);
1081 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
1082 {
1083 u16 i2;
1084 for (i2 = 0; i2 < 3; i2++)
1085 {
1086 CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].rssiHighThreshold, buffer, &offset);
1087 CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].rssiLowThreshold, buffer, &offset);
1088 CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].snrHighThreshold, buffer, &offset);
1089 CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].snrLowThreshold, buffer, &offset);
1090 }
1091 }
1092 CsrUint8Des((u8 *) &primitive->roamingConfig.disableSmoothRoaming, buffer, &offset);
1093 CsrUint8Des((u8 *) &primitive->roamingConfig.disableRoamScans, buffer, &offset);
1094 CsrUint8Des((u8 *) &primitive->roamingConfig.reconnectLimit, buffer, &offset);
1095 CsrUint16Des((u16 *) &primitive->roamingConfig.reconnectLimitIntervalMs, buffer, &offset);
1096 {
1097 u16 i2;
1098 for (i2 = 0; i2 < 3; i2++)
1099 {
1100 CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].intervalSeconds, buffer, &offset);
1101 CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].validitySeconds, buffer, &offset);
1102 CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu, buffer, &offset);
1103 CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu, buffer, &offset);
1104 CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu, buffer, &offset);
1105 CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu, buffer, &offset);
1106 }
1107 }
1108
1109 return primitive;
1110}
1111
1112
1113size_t CsrWifiSmeScanConfigSetReqSizeof(void *msg)
1114{
1115 CsrWifiSmeScanConfigSetReq *primitive = (CsrWifiSmeScanConfigSetReq *) msg;
1116 size_t bufferSize = 2;
1117
1118 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 63) */
1119 {
1120 u16 i2;
1121 for (i2 = 0; i2 < 4; i2++)
1122 {
1123 bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].intervalSeconds */
1124 bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].validitySeconds */
1125 bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu */
1126 bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu */
1127 bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu */
1128 bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu */
1129 }
1130 }
1131 bufferSize += 1; /* u8 primitive->scanConfig.disableAutonomousScans */
1132 bufferSize += 2; /* u16 primitive->scanConfig.maxResults */
1133 bufferSize += 1; /* s8 primitive->scanConfig.highRssiThreshold */
1134 bufferSize += 1; /* s8 primitive->scanConfig.lowRssiThreshold */
1135 bufferSize += 1; /* s8 primitive->scanConfig.deltaRssiThreshold */
1136 bufferSize += 1; /* s8 primitive->scanConfig.highSnrThreshold */
1137 bufferSize += 1; /* s8 primitive->scanConfig.lowSnrThreshold */
1138 bufferSize += 1; /* s8 primitive->scanConfig.deltaSnrThreshold */
1139 bufferSize += 2; /* u16 primitive->scanConfig.passiveChannelListCount */
1140 bufferSize += primitive->scanConfig.passiveChannelListCount; /* u8 primitive->scanConfig.passiveChannelList */
1141 return bufferSize;
1142}
1143
1144
1145u8* CsrWifiSmeScanConfigSetReqSer(u8 *ptr, size_t *len, void *msg)
1146{
1147 CsrWifiSmeScanConfigSetReq *primitive = (CsrWifiSmeScanConfigSetReq *)msg;
1148 *len = 0;
1149 CsrUint16Ser(ptr, len, primitive->common.type);
1150 {
1151 u16 i2;
1152 for (i2 = 0; i2 < 4; i2++)
1153 {
1154 CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].intervalSeconds);
1155 CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].validitySeconds);
1156 CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu);
1157 CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu);
1158 CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu);
1159 CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu);
1160 }
1161 }
1162 CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.disableAutonomousScans);
1163 CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.maxResults);
1164 CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.highRssiThreshold);
1165 CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.lowRssiThreshold);
1166 CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.deltaRssiThreshold);
1167 CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.highSnrThreshold);
1168 CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.lowSnrThreshold);
1169 CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.deltaSnrThreshold);
1170 CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.passiveChannelListCount);
1171 if (primitive->scanConfig.passiveChannelListCount)
1172 {
1173 CsrMemCpySer(ptr, len, (const void *) primitive->scanConfig.passiveChannelList, ((u16) (primitive->scanConfig.passiveChannelListCount)));
1174 }
1175 return(ptr);
1176}
1177
1178
1179void* CsrWifiSmeScanConfigSetReqDes(u8 *buffer, size_t length)
1180{
1181 CsrWifiSmeScanConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeScanConfigSetReq), GFP_KERNEL);
1182 size_t offset;
1183 offset = 0;
1184
1185 CsrUint16Des(&primitive->common.type, buffer, &offset);
1186 {
1187 u16 i2;
1188 for (i2 = 0; i2 < 4; i2++)
1189 {
1190 CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].intervalSeconds, buffer, &offset);
1191 CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].validitySeconds, buffer, &offset);
1192 CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu, buffer, &offset);
1193 CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu, buffer, &offset);
1194 CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu, buffer, &offset);
1195 CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu, buffer, &offset);
1196 }
1197 }
1198 CsrUint8Des((u8 *) &primitive->scanConfig.disableAutonomousScans, buffer, &offset);
1199 CsrUint16Des((u16 *) &primitive->scanConfig.maxResults, buffer, &offset);
1200 CsrUint8Des((u8 *) &primitive->scanConfig.highRssiThreshold, buffer, &offset);
1201 CsrUint8Des((u8 *) &primitive->scanConfig.lowRssiThreshold, buffer, &offset);
1202 CsrUint8Des((u8 *) &primitive->scanConfig.deltaRssiThreshold, buffer, &offset);
1203 CsrUint8Des((u8 *) &primitive->scanConfig.highSnrThreshold, buffer, &offset);
1204 CsrUint8Des((u8 *) &primitive->scanConfig.lowSnrThreshold, buffer, &offset);
1205 CsrUint8Des((u8 *) &primitive->scanConfig.deltaSnrThreshold, buffer, &offset);
1206 CsrUint16Des((u16 *) &primitive->scanConfig.passiveChannelListCount, buffer, &offset);
1207 if (primitive->scanConfig.passiveChannelListCount)
1208 {
1209 primitive->scanConfig.passiveChannelList = kmalloc(primitive->scanConfig.passiveChannelListCount, GFP_KERNEL);
1210 CsrMemCpyDes(primitive->scanConfig.passiveChannelList, buffer, &offset, ((u16) (primitive->scanConfig.passiveChannelListCount)));
1211 }
1212 else
1213 {
1214 primitive->scanConfig.passiveChannelList = NULL;
1215 }
1216
1217 return primitive;
1218}
1219
1220
1221void CsrWifiSmeScanConfigSetReqSerFree(void *voidPrimitivePointer)
1222{
1223 CsrWifiSmeScanConfigSetReq *primitive = (CsrWifiSmeScanConfigSetReq *) voidPrimitivePointer;
1224 kfree(primitive->scanConfig.passiveChannelList);
1225 kfree(primitive);
1226}
1227
1228
1229size_t CsrWifiSmeScanFullReqSizeof(void *msg)
1230{
1231 CsrWifiSmeScanFullReq *primitive = (CsrWifiSmeScanFullReq *) msg;
1232 size_t bufferSize = 2;
1233
1234 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 52) */
1235 bufferSize += 1; /* u8 primitive->ssidCount */
1236 {
1237 u16 i1;
1238 for (i1 = 0; i1 < primitive->ssidCount; i1++)
1239 {
1240 bufferSize += 32; /* u8 primitive->ssid[i1].ssid[32] */
1241 bufferSize += 1; /* u8 primitive->ssid[i1].length */
1242 }
1243 }
1244 bufferSize += 6; /* u8 primitive->bssid.a[6] */
1245 bufferSize += 1; /* u8 primitive->forceScan */
1246 bufferSize += 1; /* CsrWifiSmeBssType primitive->bssType */
1247 bufferSize += 1; /* CsrWifiSmeScanType primitive->scanType */
1248 bufferSize += 2; /* u16 primitive->channelListCount */
1249 bufferSize += primitive->channelListCount; /* u8 primitive->channelList */
1250 bufferSize += 2; /* u16 primitive->probeIeLength */
1251 bufferSize += primitive->probeIeLength; /* u8 primitive->probeIe */
1252 return bufferSize;
1253}
1254
1255
1256u8* CsrWifiSmeScanFullReqSer(u8 *ptr, size_t *len, void *msg)
1257{
1258 CsrWifiSmeScanFullReq *primitive = (CsrWifiSmeScanFullReq *)msg;
1259 *len = 0;
1260 CsrUint16Ser(ptr, len, primitive->common.type);
1261 CsrUint8Ser(ptr, len, (u8) primitive->ssidCount);
1262 {
1263 u16 i1;
1264 for (i1 = 0; i1 < primitive->ssidCount; i1++)
1265 {
1266 CsrMemCpySer(ptr, len, (const void *) primitive->ssid[i1].ssid, ((u16) (32)));
1267 CsrUint8Ser(ptr, len, (u8) primitive->ssid[i1].length);
1268 }
1269 }
1270 CsrMemCpySer(ptr, len, (const void *) primitive->bssid.a, ((u16) (6)));
1271 CsrUint8Ser(ptr, len, (u8) primitive->forceScan);
1272 CsrUint8Ser(ptr, len, (u8) primitive->bssType);
1273 CsrUint8Ser(ptr, len, (u8) primitive->scanType);
1274 CsrUint16Ser(ptr, len, (u16) primitive->channelListCount);
1275 if (primitive->channelListCount)
1276 {
1277 CsrMemCpySer(ptr, len, (const void *) primitive->channelList, ((u16) (primitive->channelListCount)));
1278 }
1279 CsrUint16Ser(ptr, len, (u16) primitive->probeIeLength);
1280 if (primitive->probeIeLength)
1281 {
1282 CsrMemCpySer(ptr, len, (const void *) primitive->probeIe, ((u16) (primitive->probeIeLength)));
1283 }
1284 return(ptr);
1285}
1286
1287
1288void* CsrWifiSmeScanFullReqDes(u8 *buffer, size_t length)
1289{
1290 CsrWifiSmeScanFullReq *primitive = kmalloc(sizeof(CsrWifiSmeScanFullReq), GFP_KERNEL);
1291 size_t offset;
1292 offset = 0;
1293
1294 CsrUint16Des(&primitive->common.type, buffer, &offset);
1295 CsrUint8Des((u8 *) &primitive->ssidCount, buffer, &offset);
1296 primitive->ssid = NULL;
1297 if (primitive->ssidCount)
1298 {
1299 primitive->ssid = kmalloc(sizeof(CsrWifiSsid) * primitive->ssidCount, GFP_KERNEL);
1300 }
1301 {
1302 u16 i1;
1303 for (i1 = 0; i1 < primitive->ssidCount; i1++)
1304 {
1305 CsrMemCpyDes(primitive->ssid[i1].ssid, buffer, &offset, ((u16) (32)));
1306 CsrUint8Des((u8 *) &primitive->ssid[i1].length, buffer, &offset);
1307 }
1308 }
1309 CsrMemCpyDes(primitive->bssid.a, buffer, &offset, ((u16) (6)));
1310 CsrUint8Des((u8 *) &primitive->forceScan, buffer, &offset);
1311 CsrUint8Des((u8 *) &primitive->bssType, buffer, &offset);
1312 CsrUint8Des((u8 *) &primitive->scanType, buffer, &offset);
1313 CsrUint16Des((u16 *) &primitive->channelListCount, buffer, &offset);
1314 if (primitive->channelListCount)
1315 {
1316 primitive->channelList = kmalloc(primitive->channelListCount, GFP_KERNEL);
1317 CsrMemCpyDes(primitive->channelList, buffer, &offset, ((u16) (primitive->channelListCount)));
1318 }
1319 else
1320 {
1321 primitive->channelList = NULL;
1322 }
1323 CsrUint16Des((u16 *) &primitive->probeIeLength, buffer, &offset);
1324 if (primitive->probeIeLength)
1325 {
1326 primitive->probeIe = kmalloc(primitive->probeIeLength, GFP_KERNEL);
1327 CsrMemCpyDes(primitive->probeIe, buffer, &offset, ((u16) (primitive->probeIeLength)));
1328 }
1329 else
1330 {
1331 primitive->probeIe = NULL;
1332 }
1333
1334 return primitive;
1335}
1336
1337
1338void CsrWifiSmeScanFullReqSerFree(void *voidPrimitivePointer)
1339{
1340 CsrWifiSmeScanFullReq *primitive = (CsrWifiSmeScanFullReq *) voidPrimitivePointer;
1341 kfree(primitive->ssid);
1342 kfree(primitive->channelList);
1343 kfree(primitive->probeIe);
1344 kfree(primitive);
1345}
1346
1347
1348size_t CsrWifiSmeSmeStaConfigSetReqSizeof(void *msg)
1349{
1350 size_t bufferSize = 2;
1351
1352 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */
1353 bufferSize += 2; /* u16 primitive->interfaceTag */
1354 bufferSize += 1; /* u8 primitive->smeConfig.connectionQualityRssiChangeTrigger */
1355 bufferSize += 1; /* u8 primitive->smeConfig.connectionQualitySnrChangeTrigger */
1356 bufferSize += 1; /* CsrWifiSmeWmmModeMask primitive->smeConfig.wmmModeMask */
1357 bufferSize += 1; /* CsrWifiSmeRadioIF primitive->smeConfig.ifIndex */
1358 bufferSize += 1; /* u8 primitive->smeConfig.allowUnicastUseGroupCipher */
1359 bufferSize += 1; /* u8 primitive->smeConfig.enableOpportunisticKeyCaching */
1360 return bufferSize;
1361}
1362
1363
1364u8* CsrWifiSmeSmeStaConfigSetReqSer(u8 *ptr, size_t *len, void *msg)
1365{
1366 CsrWifiSmeSmeStaConfigSetReq *primitive = (CsrWifiSmeSmeStaConfigSetReq *)msg;
1367 *len = 0;
1368 CsrUint16Ser(ptr, len, primitive->common.type);
1369 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
1370 CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.connectionQualityRssiChangeTrigger);
1371 CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.connectionQualitySnrChangeTrigger);
1372 CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.wmmModeMask);
1373 CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.ifIndex);
1374 CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.allowUnicastUseGroupCipher);
1375 CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.enableOpportunisticKeyCaching);
1376 return(ptr);
1377}
1378
1379
1380void* CsrWifiSmeSmeStaConfigSetReqDes(u8 *buffer, size_t length)
1381{
1382 CsrWifiSmeSmeStaConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeSmeStaConfigSetReq), GFP_KERNEL);
1383 size_t offset;
1384 offset = 0;
1385
1386 CsrUint16Des(&primitive->common.type, buffer, &offset);
1387 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
1388 CsrUint8Des((u8 *) &primitive->smeConfig.connectionQualityRssiChangeTrigger, buffer, &offset);
1389 CsrUint8Des((u8 *) &primitive->smeConfig.connectionQualitySnrChangeTrigger, buffer, &offset);
1390 CsrUint8Des((u8 *) &primitive->smeConfig.wmmModeMask, buffer, &offset);
1391 CsrUint8Des((u8 *) &primitive->smeConfig.ifIndex, buffer, &offset);
1392 CsrUint8Des((u8 *) &primitive->smeConfig.allowUnicastUseGroupCipher, buffer, &offset);
1393 CsrUint8Des((u8 *) &primitive->smeConfig.enableOpportunisticKeyCaching, buffer, &offset);
1394
1395 return primitive;
1396}
1397
1398
1399size_t CsrWifiSmeTspecReqSizeof(void *msg)
1400{
1401 CsrWifiSmeTspecReq *primitive = (CsrWifiSmeTspecReq *) msg;
1402 size_t bufferSize = 2;
1403
1404 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 18) */
1405 bufferSize += 2; /* u16 primitive->interfaceTag */
1406 bufferSize += 1; /* CsrWifiSmeListAction primitive->action */
1407 bufferSize += 4; /* u32 primitive->transactionId */
1408 bufferSize += 1; /* u8 primitive->strict */
1409 bufferSize += 1; /* CsrWifiSmeTspecCtrlMask primitive->ctrlMask */
1410 bufferSize += 2; /* u16 primitive->tspecLength */
1411 bufferSize += primitive->tspecLength; /* u8 primitive->tspec */
1412 bufferSize += 2; /* u16 primitive->tclasLength */
1413 bufferSize += primitive->tclasLength; /* u8 primitive->tclas */
1414 return bufferSize;
1415}
1416
1417
1418u8* CsrWifiSmeTspecReqSer(u8 *ptr, size_t *len, void *msg)
1419{
1420 CsrWifiSmeTspecReq *primitive = (CsrWifiSmeTspecReq *)msg;
1421 *len = 0;
1422 CsrUint16Ser(ptr, len, primitive->common.type);
1423 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
1424 CsrUint8Ser(ptr, len, (u8) primitive->action);
1425 CsrUint32Ser(ptr, len, (u32) primitive->transactionId);
1426 CsrUint8Ser(ptr, len, (u8) primitive->strict);
1427 CsrUint8Ser(ptr, len, (u8) primitive->ctrlMask);
1428 CsrUint16Ser(ptr, len, (u16) primitive->tspecLength);
1429 if (primitive->tspecLength)
1430 {
1431 CsrMemCpySer(ptr, len, (const void *) primitive->tspec, ((u16) (primitive->tspecLength)));
1432 }
1433 CsrUint16Ser(ptr, len, (u16) primitive->tclasLength);
1434 if (primitive->tclasLength)
1435 {
1436 CsrMemCpySer(ptr, len, (const void *) primitive->tclas, ((u16) (primitive->tclasLength)));
1437 }
1438 return(ptr);
1439}
1440
1441
1442void* CsrWifiSmeTspecReqDes(u8 *buffer, size_t length)
1443{
1444 CsrWifiSmeTspecReq *primitive = kmalloc(sizeof(CsrWifiSmeTspecReq), GFP_KERNEL);
1445 size_t offset;
1446 offset = 0;
1447
1448 CsrUint16Des(&primitive->common.type, buffer, &offset);
1449 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
1450 CsrUint8Des((u8 *) &primitive->action, buffer, &offset);
1451 CsrUint32Des((u32 *) &primitive->transactionId, buffer, &offset);
1452 CsrUint8Des((u8 *) &primitive->strict, buffer, &offset);
1453 CsrUint8Des((u8 *) &primitive->ctrlMask, buffer, &offset);
1454 CsrUint16Des((u16 *) &primitive->tspecLength, buffer, &offset);
1455 if (primitive->tspecLength)
1456 {
1457 primitive->tspec = kmalloc(primitive->tspecLength, GFP_KERNEL);
1458 CsrMemCpyDes(primitive->tspec, buffer, &offset, ((u16) (primitive->tspecLength)));
1459 }
1460 else
1461 {
1462 primitive->tspec = NULL;
1463 }
1464 CsrUint16Des((u16 *) &primitive->tclasLength, buffer, &offset);
1465 if (primitive->tclasLength)
1466 {
1467 primitive->tclas = kmalloc(primitive->tclasLength, GFP_KERNEL);
1468 CsrMemCpyDes(primitive->tclas, buffer, &offset, ((u16) (primitive->tclasLength)));
1469 }
1470 else
1471 {
1472 primitive->tclas = NULL;
1473 }
1474
1475 return primitive;
1476}
1477
1478
1479void CsrWifiSmeTspecReqSerFree(void *voidPrimitivePointer)
1480{
1481 CsrWifiSmeTspecReq *primitive = (CsrWifiSmeTspecReq *) voidPrimitivePointer;
1482 kfree(primitive->tspec);
1483 kfree(primitive->tclas);
1484 kfree(primitive);
1485}
1486
1487
1488size_t CsrWifiSmeWifiFlightmodeReqSizeof(void *msg)
1489{
1490 CsrWifiSmeWifiFlightmodeReq *primitive = (CsrWifiSmeWifiFlightmodeReq *) msg;
1491 size_t bufferSize = 2;
1492
1493 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */
1494 bufferSize += 6; /* u8 primitive->address.a[6] */
1495 bufferSize += 2; /* u16 primitive->mibFilesCount */
1496 {
1497 u16 i1;
1498 for (i1 = 0; i1 < primitive->mibFilesCount; i1++)
1499 {
1500 bufferSize += 2; /* u16 primitive->mibFiles[i1].length */
1501 bufferSize += primitive->mibFiles[i1].length; /* u8 primitive->mibFiles[i1].data */
1502 }
1503 }
1504 return bufferSize;
1505}
1506
1507
1508u8* CsrWifiSmeWifiFlightmodeReqSer(u8 *ptr, size_t *len, void *msg)
1509{
1510 CsrWifiSmeWifiFlightmodeReq *primitive = (CsrWifiSmeWifiFlightmodeReq *)msg;
1511 *len = 0;
1512 CsrUint16Ser(ptr, len, primitive->common.type);
1513 CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((u16) (6)));
1514 CsrUint16Ser(ptr, len, (u16) primitive->mibFilesCount);
1515 {
1516 u16 i1;
1517 for (i1 = 0; i1 < primitive->mibFilesCount; i1++)
1518 {
1519 CsrUint16Ser(ptr, len, (u16) primitive->mibFiles[i1].length);
1520 if (primitive->mibFiles[i1].length)
1521 {
1522 CsrMemCpySer(ptr, len, (const void *) primitive->mibFiles[i1].data, ((u16) (primitive->mibFiles[i1].length)));
1523 }
1524 }
1525 }
1526 return(ptr);
1527}
1528
1529
1530void* CsrWifiSmeWifiFlightmodeReqDes(u8 *buffer, size_t length)
1531{
1532 CsrWifiSmeWifiFlightmodeReq *primitive = kmalloc(sizeof(CsrWifiSmeWifiFlightmodeReq), GFP_KERNEL);
1533 size_t offset;
1534 offset = 0;
1535
1536 CsrUint16Des(&primitive->common.type, buffer, &offset);
1537 CsrMemCpyDes(primitive->address.a, buffer, &offset, ((u16) (6)));
1538 CsrUint16Des((u16 *) &primitive->mibFilesCount, buffer, &offset);
1539 primitive->mibFiles = NULL;
1540 if (primitive->mibFilesCount)
1541 {
1542 primitive->mibFiles = kmalloc(sizeof(CsrWifiSmeDataBlock) * primitive->mibFilesCount, GFP_KERNEL);
1543 }
1544 {
1545 u16 i1;
1546 for (i1 = 0; i1 < primitive->mibFilesCount; i1++)
1547 {
1548 CsrUint16Des((u16 *) &primitive->mibFiles[i1].length, buffer, &offset);
1549 if (primitive->mibFiles[i1].length)
1550 {
1551 primitive->mibFiles[i1].data = kmalloc(primitive->mibFiles[i1].length, GFP_KERNEL);
1552 CsrMemCpyDes(primitive->mibFiles[i1].data, buffer, &offset, ((u16) (primitive->mibFiles[i1].length)));
1553 }
1554 else
1555 {
1556 primitive->mibFiles[i1].data = NULL;
1557 }
1558 }
1559 }
1560
1561 return primitive;
1562}
1563
1564
1565void CsrWifiSmeWifiFlightmodeReqSerFree(void *voidPrimitivePointer)
1566{
1567 CsrWifiSmeWifiFlightmodeReq *primitive = (CsrWifiSmeWifiFlightmodeReq *) voidPrimitivePointer;
1568 {
1569 u16 i1;
1570 for (i1 = 0; i1 < primitive->mibFilesCount; i1++)
1571 {
1572 kfree(primitive->mibFiles[i1].data);
1573 }
1574 }
1575 kfree(primitive->mibFiles);
1576 kfree(primitive);
1577}
1578
1579
1580size_t CsrWifiSmeWifiOnReqSizeof(void *msg)
1581{
1582 CsrWifiSmeWifiOnReq *primitive = (CsrWifiSmeWifiOnReq *) msg;
1583 size_t bufferSize = 2;
1584
1585 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 14) */
1586 bufferSize += 6; /* u8 primitive->address.a[6] */
1587 bufferSize += 2; /* u16 primitive->mibFilesCount */
1588 {
1589 u16 i1;
1590 for (i1 = 0; i1 < primitive->mibFilesCount; i1++)
1591 {
1592 bufferSize += 2; /* u16 primitive->mibFiles[i1].length */
1593 bufferSize += primitive->mibFiles[i1].length; /* u8 primitive->mibFiles[i1].data */
1594 }
1595 }
1596 return bufferSize;
1597}
1598
1599
1600u8* CsrWifiSmeWifiOnReqSer(u8 *ptr, size_t *len, void *msg)
1601{
1602 CsrWifiSmeWifiOnReq *primitive = (CsrWifiSmeWifiOnReq *)msg;
1603 *len = 0;
1604 CsrUint16Ser(ptr, len, primitive->common.type);
1605 CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((u16) (6)));
1606 CsrUint16Ser(ptr, len, (u16) primitive->mibFilesCount);
1607 {
1608 u16 i1;
1609 for (i1 = 0; i1 < primitive->mibFilesCount; i1++)
1610 {
1611 CsrUint16Ser(ptr, len, (u16) primitive->mibFiles[i1].length);
1612 if (primitive->mibFiles[i1].length)
1613 {
1614 CsrMemCpySer(ptr, len, (const void *) primitive->mibFiles[i1].data, ((u16) (primitive->mibFiles[i1].length)));
1615 }
1616 }
1617 }
1618 return(ptr);
1619}
1620
1621
1622void* CsrWifiSmeWifiOnReqDes(u8 *buffer, size_t length)
1623{
1624 CsrWifiSmeWifiOnReq *primitive = kmalloc(sizeof(CsrWifiSmeWifiOnReq), GFP_KERNEL);
1625 size_t offset;
1626 offset = 0;
1627
1628 CsrUint16Des(&primitive->common.type, buffer, &offset);
1629 CsrMemCpyDes(primitive->address.a, buffer, &offset, ((u16) (6)));
1630 CsrUint16Des((u16 *) &primitive->mibFilesCount, buffer, &offset);
1631 primitive->mibFiles = NULL;
1632 if (primitive->mibFilesCount)
1633 {
1634 primitive->mibFiles = kmalloc(sizeof(CsrWifiSmeDataBlock) * primitive->mibFilesCount, GFP_KERNEL);
1635 }
1636 {
1637 u16 i1;
1638 for (i1 = 0; i1 < primitive->mibFilesCount; i1++)
1639 {
1640 CsrUint16Des((u16 *) &primitive->mibFiles[i1].length, buffer, &offset);
1641 if (primitive->mibFiles[i1].length)
1642 {
1643 primitive->mibFiles[i1].data = kmalloc(primitive->mibFiles[i1].length, GFP_KERNEL);
1644 CsrMemCpyDes(primitive->mibFiles[i1].data, buffer, &offset, ((u16) (primitive->mibFiles[i1].length)));
1645 }
1646 else
1647 {
1648 primitive->mibFiles[i1].data = NULL;
1649 }
1650 }
1651 }
1652
1653 return primitive;
1654}
1655
1656
1657void CsrWifiSmeWifiOnReqSerFree(void *voidPrimitivePointer)
1658{
1659 CsrWifiSmeWifiOnReq *primitive = (CsrWifiSmeWifiOnReq *) voidPrimitivePointer;
1660 {
1661 u16 i1;
1662 for (i1 = 0; i1 < primitive->mibFilesCount; i1++)
1663 {
1664 kfree(primitive->mibFiles[i1].data);
1665 }
1666 }
1667 kfree(primitive->mibFiles);
1668 kfree(primitive);
1669}
1670
1671
1672size_t CsrWifiSmeCloakedSsidsSetReqSizeof(void *msg)
1673{
1674 CsrWifiSmeCloakedSsidsSetReq *primitive = (CsrWifiSmeCloakedSsidsSetReq *) msg;
1675 size_t bufferSize = 2;
1676
1677 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 37) */
1678 bufferSize += 1; /* u8 primitive->cloakedSsids.cloakedSsidsCount */
1679 {
1680 u16 i2;
1681 for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++)
1682 {
1683 bufferSize += 32; /* u8 primitive->cloakedSsids.cloakedSsids[i2].ssid[32] */
1684 bufferSize += 1; /* u8 primitive->cloakedSsids.cloakedSsids[i2].length */
1685 }
1686 }
1687 return bufferSize;
1688}
1689
1690
1691u8* CsrWifiSmeCloakedSsidsSetReqSer(u8 *ptr, size_t *len, void *msg)
1692{
1693 CsrWifiSmeCloakedSsidsSetReq *primitive = (CsrWifiSmeCloakedSsidsSetReq *)msg;
1694 *len = 0;
1695 CsrUint16Ser(ptr, len, primitive->common.type);
1696 CsrUint8Ser(ptr, len, (u8) primitive->cloakedSsids.cloakedSsidsCount);
1697 {
1698 u16 i2;
1699 for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++)
1700 {
1701 CsrMemCpySer(ptr, len, (const void *) primitive->cloakedSsids.cloakedSsids[i2].ssid, ((u16) (32)));
1702 CsrUint8Ser(ptr, len, (u8) primitive->cloakedSsids.cloakedSsids[i2].length);
1703 }
1704 }
1705 return(ptr);
1706}
1707
1708
1709void* CsrWifiSmeCloakedSsidsSetReqDes(u8 *buffer, size_t length)
1710{
1711 CsrWifiSmeCloakedSsidsSetReq *primitive = kmalloc(sizeof(CsrWifiSmeCloakedSsidsSetReq), GFP_KERNEL);
1712 size_t offset;
1713 offset = 0;
1714
1715 CsrUint16Des(&primitive->common.type, buffer, &offset);
1716 CsrUint8Des((u8 *) &primitive->cloakedSsids.cloakedSsidsCount, buffer, &offset);
1717 primitive->cloakedSsids.cloakedSsids = NULL;
1718 if (primitive->cloakedSsids.cloakedSsidsCount)
1719 {
1720 primitive->cloakedSsids.cloakedSsids = kmalloc(sizeof(CsrWifiSsid) * primitive->cloakedSsids.cloakedSsidsCount, GFP_KERNEL);
1721 }
1722 {
1723 u16 i2;
1724 for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++)
1725 {
1726 CsrMemCpyDes(primitive->cloakedSsids.cloakedSsids[i2].ssid, buffer, &offset, ((u16) (32)));
1727 CsrUint8Des((u8 *) &primitive->cloakedSsids.cloakedSsids[i2].length, buffer, &offset);
1728 }
1729 }
1730
1731 return primitive;
1732}
1733
1734
1735void CsrWifiSmeCloakedSsidsSetReqSerFree(void *voidPrimitivePointer)
1736{
1737 CsrWifiSmeCloakedSsidsSetReq *primitive = (CsrWifiSmeCloakedSsidsSetReq *) voidPrimitivePointer;
1738 kfree(primitive->cloakedSsids.cloakedSsids);
1739 kfree(primitive);
1740}
1741
1742
1743size_t CsrWifiSmeSmeCommonConfigSetReqSizeof(void *msg)
1744{
1745 size_t bufferSize = 2;
1746
1747 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */
1748 bufferSize += 1; /* CsrWifiSme80211dTrustLevel primitive->deviceConfig.trustLevel */
1749 bufferSize += 2; /* u8 primitive->deviceConfig.countryCode[2] */
1750 bufferSize += 1; /* CsrWifiSmeFirmwareDriverInterface primitive->deviceConfig.firmwareDriverInterface */
1751 bufferSize += 1; /* u8 primitive->deviceConfig.enableStrictDraftN */
1752 return bufferSize;
1753}
1754
1755
1756u8* CsrWifiSmeSmeCommonConfigSetReqSer(u8 *ptr, size_t *len, void *msg)
1757{
1758 CsrWifiSmeSmeCommonConfigSetReq *primitive = (CsrWifiSmeSmeCommonConfigSetReq *)msg;
1759 *len = 0;
1760 CsrUint16Ser(ptr, len, primitive->common.type);
1761 CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.trustLevel);
1762 CsrMemCpySer(ptr, len, (const void *) primitive->deviceConfig.countryCode, ((u16) (2)));
1763 CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.firmwareDriverInterface);
1764 CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.enableStrictDraftN);
1765 return(ptr);
1766}
1767
1768
1769void* CsrWifiSmeSmeCommonConfigSetReqDes(u8 *buffer, size_t length)
1770{
1771 CsrWifiSmeSmeCommonConfigSetReq *primitive = kmalloc(sizeof(CsrWifiSmeSmeCommonConfigSetReq), GFP_KERNEL);
1772 size_t offset;
1773 offset = 0;
1774
1775 CsrUint16Des(&primitive->common.type, buffer, &offset);
1776 CsrUint8Des((u8 *) &primitive->deviceConfig.trustLevel, buffer, &offset);
1777 CsrMemCpyDes(primitive->deviceConfig.countryCode, buffer, &offset, ((u16) (2)));
1778 CsrUint8Des((u8 *) &primitive->deviceConfig.firmwareDriverInterface, buffer, &offset);
1779 CsrUint8Des((u8 *) &primitive->deviceConfig.enableStrictDraftN, buffer, &offset);
1780
1781 return primitive;
1782}
1783
1784
1785size_t CsrWifiSmeWpsConfigurationReqSizeof(void *msg)
1786{
1787 CsrWifiSmeWpsConfigurationReq *primitive = (CsrWifiSmeWpsConfigurationReq *) msg;
1788 size_t bufferSize = 2;
1789
1790 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 240) */
1791 bufferSize += 1; /* u8 primitive->wpsConfig.wpsVersion */
1792 bufferSize += 16; /* u8 primitive->wpsConfig.uuid[16] */
1793 bufferSize += 32; /* u8 primitive->wpsConfig.deviceName[32] */
1794 bufferSize += 1; /* u8 primitive->wpsConfig.deviceNameLength */
1795 bufferSize += 64; /* u8 primitive->wpsConfig.manufacturer[64] */
1796 bufferSize += 1; /* u8 primitive->wpsConfig.manufacturerLength */
1797 bufferSize += 32; /* u8 primitive->wpsConfig.modelName[32] */
1798 bufferSize += 1; /* u8 primitive->wpsConfig.modelNameLength */
1799 bufferSize += 32; /* u8 primitive->wpsConfig.modelNumber[32] */
1800 bufferSize += 1; /* u8 primitive->wpsConfig.modelNumberLength */
1801 bufferSize += 32; /* u8 primitive->wpsConfig.serialNumber[32] */
1802 bufferSize += 8; /* u8 primitive->wpsConfig.primDeviceType.deviceDetails[8] */
1803 bufferSize += 1; /* u8 primitive->wpsConfig.secondaryDeviceTypeCount */
1804 {
1805 u16 i2;
1806 for (i2 = 0; i2 < primitive->wpsConfig.secondaryDeviceTypeCount; i2++)
1807 {
1808 bufferSize += 8; /* u8 primitive->wpsConfig.secondaryDeviceType[i2].deviceDetails[8] */
1809 }
1810 }
1811 bufferSize += 2; /* CsrWifiSmeWpsConfigTypeMask primitive->wpsConfig.configMethods */
1812 bufferSize += 1; /* u8 primitive->wpsConfig.rfBands */
1813 bufferSize += 4; /* u8 primitive->wpsConfig.osVersion[4] */
1814 return bufferSize;
1815}
1816
1817
1818u8* CsrWifiSmeWpsConfigurationReqSer(u8 *ptr, size_t *len, void *msg)
1819{
1820 CsrWifiSmeWpsConfigurationReq *primitive = (CsrWifiSmeWpsConfigurationReq *)msg;
1821 *len = 0;
1822 CsrUint16Ser(ptr, len, primitive->common.type);
1823 CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.wpsVersion);
1824 CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.uuid, ((u16) (16)));
1825 CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.deviceName, ((u16) (32)));
1826 CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.deviceNameLength);
1827 CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.manufacturer, ((u16) (64)));
1828 CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.manufacturerLength);
1829 CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.modelName, ((u16) (32)));
1830 CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.modelNameLength);
1831 CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.modelNumber, ((u16) (32)));
1832 CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.modelNumberLength);
1833 CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.serialNumber, ((u16) (32)));
1834 CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.primDeviceType.deviceDetails, ((u16) (8)));
1835 CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.secondaryDeviceTypeCount);
1836 {
1837 u16 i2;
1838 for (i2 = 0; i2 < primitive->wpsConfig.secondaryDeviceTypeCount; i2++)
1839 {
1840 CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.secondaryDeviceType[i2].deviceDetails, ((u16) (8)));
1841 }
1842 }
1843 CsrUint16Ser(ptr, len, (u16) primitive->wpsConfig.configMethods);
1844 CsrUint8Ser(ptr, len, (u8) primitive->wpsConfig.rfBands);
1845 CsrMemCpySer(ptr, len, (const void *) primitive->wpsConfig.osVersion, ((u16) (4)));
1846 return(ptr);
1847}
1848
1849
1850void* CsrWifiSmeWpsConfigurationReqDes(u8 *buffer, size_t length)
1851{
1852 CsrWifiSmeWpsConfigurationReq *primitive = kmalloc(sizeof(CsrWifiSmeWpsConfigurationReq), GFP_KERNEL);
1853 size_t offset;
1854 offset = 0;
1855
1856 CsrUint16Des(&primitive->common.type, buffer, &offset);
1857 CsrUint8Des((u8 *) &primitive->wpsConfig.wpsVersion, buffer, &offset);
1858 CsrMemCpyDes(primitive->wpsConfig.uuid, buffer, &offset, ((u16) (16)));
1859 CsrMemCpyDes(primitive->wpsConfig.deviceName, buffer, &offset, ((u16) (32)));
1860 CsrUint8Des((u8 *) &primitive->wpsConfig.deviceNameLength, buffer, &offset);
1861 CsrMemCpyDes(primitive->wpsConfig.manufacturer, buffer, &offset, ((u16) (64)));
1862 CsrUint8Des((u8 *) &primitive->wpsConfig.manufacturerLength, buffer, &offset);
1863 CsrMemCpyDes(primitive->wpsConfig.modelName, buffer, &offset, ((u16) (32)));
1864 CsrUint8Des((u8 *) &primitive->wpsConfig.modelNameLength, buffer, &offset);
1865 CsrMemCpyDes(primitive->wpsConfig.modelNumber, buffer, &offset, ((u16) (32)));
1866 CsrUint8Des((u8 *) &primitive->wpsConfig.modelNumberLength, buffer, &offset);
1867 CsrMemCpyDes(primitive->wpsConfig.serialNumber, buffer, &offset, ((u16) (32)));
1868 CsrMemCpyDes(primitive->wpsConfig.primDeviceType.deviceDetails, buffer, &offset, ((u16) (8)));
1869 CsrUint8Des((u8 *) &primitive->wpsConfig.secondaryDeviceTypeCount, buffer, &offset);
1870 primitive->wpsConfig.secondaryDeviceType = NULL;
1871 if (primitive->wpsConfig.secondaryDeviceTypeCount)
1872 {
1873 primitive->wpsConfig.secondaryDeviceType = kmalloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->wpsConfig.secondaryDeviceTypeCount, GFP_KERNEL);
1874 }
1875 {
1876 u16 i2;
1877 for (i2 = 0; i2 < primitive->wpsConfig.secondaryDeviceTypeCount; i2++)
1878 {
1879 CsrMemCpyDes(primitive->wpsConfig.secondaryDeviceType[i2].deviceDetails, buffer, &offset, ((u16) (8)));
1880 }
1881 }
1882 CsrUint16Des((u16 *) &primitive->wpsConfig.configMethods, buffer, &offset);
1883 CsrUint8Des((u8 *) &primitive->wpsConfig.rfBands, buffer, &offset);
1884 CsrMemCpyDes(primitive->wpsConfig.osVersion, buffer, &offset, ((u16) (4)));
1885
1886 return primitive;
1887}
1888
1889
1890void CsrWifiSmeWpsConfigurationReqSerFree(void *voidPrimitivePointer)
1891{
1892 CsrWifiSmeWpsConfigurationReq *primitive = (CsrWifiSmeWpsConfigurationReq *) voidPrimitivePointer;
1893 kfree(primitive->wpsConfig.secondaryDeviceType);
1894 kfree(primitive);
1895}
1896
1897
1898size_t CsrWifiSmeSetReqSizeof(void *msg)
1899{
1900 CsrWifiSmeSetReq *primitive = (CsrWifiSmeSetReq *) msg;
1901 size_t bufferSize = 2;
1902
1903 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */
1904 bufferSize += 4; /* u32 primitive->dataLength */
1905 bufferSize += primitive->dataLength; /* u8 primitive->data */
1906 return bufferSize;
1907}
1908
1909
1910u8* CsrWifiSmeSetReqSer(u8 *ptr, size_t *len, void *msg)
1911{
1912 CsrWifiSmeSetReq *primitive = (CsrWifiSmeSetReq *)msg;
1913 *len = 0;
1914 CsrUint16Ser(ptr, len, primitive->common.type);
1915 CsrUint32Ser(ptr, len, (u32) primitive->dataLength);
1916 if (primitive->dataLength)
1917 {
1918 CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength)));
1919 }
1920 return(ptr);
1921}
1922
1923
1924void* CsrWifiSmeSetReqDes(u8 *buffer, size_t length)
1925{
1926 CsrWifiSmeSetReq *primitive = kmalloc(sizeof(CsrWifiSmeSetReq), GFP_KERNEL);
1927 size_t offset;
1928 offset = 0;
1929
1930 CsrUint16Des(&primitive->common.type, buffer, &offset);
1931 CsrUint32Des((u32 *) &primitive->dataLength, buffer, &offset);
1932 if (primitive->dataLength)
1933 {
1934 primitive->data = kmalloc(primitive->dataLength, GFP_KERNEL);
1935 CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength)));
1936 }
1937 else
1938 {
1939 primitive->data = NULL;
1940 }
1941
1942 return primitive;
1943}
1944
1945
1946void CsrWifiSmeSetReqSerFree(void *voidPrimitivePointer)
1947{
1948 CsrWifiSmeSetReq *primitive = (CsrWifiSmeSetReq *) voidPrimitivePointer;
1949 kfree(primitive->data);
1950 kfree(primitive);
1951}
1952
1953
1954size_t CsrWifiSmeAdhocConfigGetCfmSizeof(void *msg)
1955{
1956 size_t bufferSize = 2;
1957
1958 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */
1959 bufferSize += 2; /* CsrResult primitive->status */
1960 bufferSize += 2; /* u16 primitive->adHocConfig.atimWindowTu */
1961 bufferSize += 2; /* u16 primitive->adHocConfig.beaconPeriodTu */
1962 bufferSize += 2; /* u16 primitive->adHocConfig.joinOnlyAttempts */
1963 bufferSize += 2; /* u16 primitive->adHocConfig.joinAttemptIntervalMs */
1964 return bufferSize;
1965}
1966
1967
1968u8* CsrWifiSmeAdhocConfigGetCfmSer(u8 *ptr, size_t *len, void *msg)
1969{
1970 CsrWifiSmeAdhocConfigGetCfm *primitive = (CsrWifiSmeAdhocConfigGetCfm *)msg;
1971 *len = 0;
1972 CsrUint16Ser(ptr, len, primitive->common.type);
1973 CsrUint16Ser(ptr, len, (u16) primitive->status);
1974 CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.atimWindowTu);
1975 CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.beaconPeriodTu);
1976 CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.joinOnlyAttempts);
1977 CsrUint16Ser(ptr, len, (u16) primitive->adHocConfig.joinAttemptIntervalMs);
1978 return(ptr);
1979}
1980
1981
1982void* CsrWifiSmeAdhocConfigGetCfmDes(u8 *buffer, size_t length)
1983{
1984 CsrWifiSmeAdhocConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeAdhocConfigGetCfm), GFP_KERNEL);
1985 size_t offset;
1986 offset = 0;
1987
1988 CsrUint16Des(&primitive->common.type, buffer, &offset);
1989 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
1990 CsrUint16Des((u16 *) &primitive->adHocConfig.atimWindowTu, buffer, &offset);
1991 CsrUint16Des((u16 *) &primitive->adHocConfig.beaconPeriodTu, buffer, &offset);
1992 CsrUint16Des((u16 *) &primitive->adHocConfig.joinOnlyAttempts, buffer, &offset);
1993 CsrUint16Des((u16 *) &primitive->adHocConfig.joinAttemptIntervalMs, buffer, &offset);
1994
1995 return primitive;
1996}
1997
1998
1999size_t CsrWifiSmeAssociationCompleteIndSizeof(void *msg)
2000{
2001 CsrWifiSmeAssociationCompleteInd *primitive = (CsrWifiSmeAssociationCompleteInd *) msg;
2002 size_t bufferSize = 2;
2003
2004 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 98) */
2005 bufferSize += 2; /* u16 primitive->interfaceTag */
2006 bufferSize += 2; /* CsrResult primitive->status */
2007 bufferSize += 32; /* u8 primitive->connectionInfo.ssid.ssid[32] */
2008 bufferSize += 1; /* u8 primitive->connectionInfo.ssid.length */
2009 bufferSize += 6; /* u8 primitive->connectionInfo.bssid.a[6] */
2010 bufferSize += 1; /* CsrWifiSme80211NetworkType primitive->connectionInfo.networkType80211 */
2011 bufferSize += 1; /* u8 primitive->connectionInfo.channelNumber */
2012 bufferSize += 2; /* u16 primitive->connectionInfo.channelFrequency */
2013 bufferSize += 2; /* CsrWifiSmeAuthMode primitive->connectionInfo.authMode */
2014 bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.pairwiseCipher */
2015 bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.groupCipher */
2016 bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionInfo.ifIndex */
2017 bufferSize += 2; /* u16 primitive->connectionInfo.atimWindowTu */
2018 bufferSize += 2; /* u16 primitive->connectionInfo.beaconPeriodTu */
2019 bufferSize += 1; /* u8 primitive->connectionInfo.reassociation */
2020 bufferSize += 2; /* u16 primitive->connectionInfo.beaconFrameLength */
2021 bufferSize += primitive->connectionInfo.beaconFrameLength; /* u8 primitive->connectionInfo.beaconFrame */
2022 bufferSize += 2; /* u16 primitive->connectionInfo.associationReqFrameLength */
2023 bufferSize += primitive->connectionInfo.associationReqFrameLength; /* u8 primitive->connectionInfo.associationReqFrame */
2024 bufferSize += 2; /* u16 primitive->connectionInfo.associationRspFrameLength */
2025 bufferSize += primitive->connectionInfo.associationRspFrameLength; /* u8 primitive->connectionInfo.associationRspFrame */
2026 bufferSize += 2; /* u16 primitive->connectionInfo.assocScanInfoElementsLength */
2027 bufferSize += primitive->connectionInfo.assocScanInfoElementsLength; /* u8 primitive->connectionInfo.assocScanInfoElements */
2028 bufferSize += 2; /* u16 primitive->connectionInfo.assocReqCapabilities */
2029 bufferSize += 2; /* u16 primitive->connectionInfo.assocReqListenIntervalTu */
2030 bufferSize += 6; /* u8 primitive->connectionInfo.assocReqApAddress.a[6] */
2031 bufferSize += 2; /* u16 primitive->connectionInfo.assocReqInfoElementsLength */
2032 bufferSize += primitive->connectionInfo.assocReqInfoElementsLength; /* u8 primitive->connectionInfo.assocReqInfoElements */
2033 bufferSize += 2; /* CsrWifiSmeIEEE80211Result primitive->connectionInfo.assocRspResult */
2034 bufferSize += 2; /* u16 primitive->connectionInfo.assocRspCapabilityInfo */
2035 bufferSize += 2; /* u16 primitive->connectionInfo.assocRspAssociationId */
2036 bufferSize += 2; /* u16 primitive->connectionInfo.assocRspInfoElementsLength */
2037 bufferSize += primitive->connectionInfo.assocRspInfoElementsLength; /* u8 primitive->connectionInfo.assocRspInfoElements */
2038 bufferSize += 2; /* CsrWifiSmeIEEE80211Reason primitive->deauthReason */
2039 return bufferSize;
2040}
2041
2042
2043u8* CsrWifiSmeAssociationCompleteIndSer(u8 *ptr, size_t *len, void *msg)
2044{
2045 CsrWifiSmeAssociationCompleteInd *primitive = (CsrWifiSmeAssociationCompleteInd *)msg;
2046 *len = 0;
2047 CsrUint16Ser(ptr, len, primitive->common.type);
2048 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
2049 CsrUint16Ser(ptr, len, (u16) primitive->status);
2050 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.ssid.ssid, ((u16) (32)));
2051 CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ssid.length);
2052 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.bssid.a, ((u16) (6)));
2053 CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.networkType80211);
2054 CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.channelNumber);
2055 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.channelFrequency);
2056 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.authMode);
2057 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.pairwiseCipher);
2058 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.groupCipher);
2059 CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ifIndex);
2060 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.atimWindowTu);
2061 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.beaconPeriodTu);
2062 CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.reassociation);
2063 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.beaconFrameLength);
2064 if (primitive->connectionInfo.beaconFrameLength)
2065 {
2066 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.beaconFrame, ((u16) (primitive->connectionInfo.beaconFrameLength)));
2067 }
2068 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.associationReqFrameLength);
2069 if (primitive->connectionInfo.associationReqFrameLength)
2070 {
2071 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationReqFrame, ((u16) (primitive->connectionInfo.associationReqFrameLength)));
2072 }
2073 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.associationRspFrameLength);
2074 if (primitive->connectionInfo.associationRspFrameLength)
2075 {
2076 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationRspFrame, ((u16) (primitive->connectionInfo.associationRspFrameLength)));
2077 }
2078 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocScanInfoElementsLength);
2079 if (primitive->connectionInfo.assocScanInfoElementsLength)
2080 {
2081 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocScanInfoElements, ((u16) (primitive->connectionInfo.assocScanInfoElementsLength)));
2082 }
2083 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqCapabilities);
2084 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqListenIntervalTu);
2085 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqApAddress.a, ((u16) (6)));
2086 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqInfoElementsLength);
2087 if (primitive->connectionInfo.assocReqInfoElementsLength)
2088 {
2089 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqInfoElements, ((u16) (primitive->connectionInfo.assocReqInfoElementsLength)));
2090 }
2091 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspResult);
2092 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspCapabilityInfo);
2093 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspAssociationId);
2094 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspInfoElementsLength);
2095 if (primitive->connectionInfo.assocRspInfoElementsLength)
2096 {
2097 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocRspInfoElements, ((u16) (primitive->connectionInfo.assocRspInfoElementsLength)));
2098 }
2099 CsrUint16Ser(ptr, len, (u16) primitive->deauthReason);
2100 return(ptr);
2101}
2102
2103
2104void* CsrWifiSmeAssociationCompleteIndDes(u8 *buffer, size_t length)
2105{
2106 CsrWifiSmeAssociationCompleteInd *primitive = kmalloc(sizeof(CsrWifiSmeAssociationCompleteInd), GFP_KERNEL);
2107 size_t offset;
2108 offset = 0;
2109
2110 CsrUint16Des(&primitive->common.type, buffer, &offset);
2111 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
2112 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
2113 CsrMemCpyDes(primitive->connectionInfo.ssid.ssid, buffer, &offset, ((u16) (32)));
2114 CsrUint8Des((u8 *) &primitive->connectionInfo.ssid.length, buffer, &offset);
2115 CsrMemCpyDes(primitive->connectionInfo.bssid.a, buffer, &offset, ((u16) (6)));
2116 CsrUint8Des((u8 *) &primitive->connectionInfo.networkType80211, buffer, &offset);
2117 CsrUint8Des((u8 *) &primitive->connectionInfo.channelNumber, buffer, &offset);
2118 CsrUint16Des((u16 *) &primitive->connectionInfo.channelFrequency, buffer, &offset);
2119 CsrUint16Des((u16 *) &primitive->connectionInfo.authMode, buffer, &offset);
2120 CsrUint16Des((u16 *) &primitive->connectionInfo.pairwiseCipher, buffer, &offset);
2121 CsrUint16Des((u16 *) &primitive->connectionInfo.groupCipher, buffer, &offset);
2122 CsrUint8Des((u8 *) &primitive->connectionInfo.ifIndex, buffer, &offset);
2123 CsrUint16Des((u16 *) &primitive->connectionInfo.atimWindowTu, buffer, &offset);
2124 CsrUint16Des((u16 *) &primitive->connectionInfo.beaconPeriodTu, buffer, &offset);
2125 CsrUint8Des((u8 *) &primitive->connectionInfo.reassociation, buffer, &offset);
2126 CsrUint16Des((u16 *) &primitive->connectionInfo.beaconFrameLength, buffer, &offset);
2127 if (primitive->connectionInfo.beaconFrameLength)
2128 {
2129 primitive->connectionInfo.beaconFrame = kmalloc(primitive->connectionInfo.beaconFrameLength, GFP_KERNEL);
2130 CsrMemCpyDes(primitive->connectionInfo.beaconFrame, buffer, &offset, ((u16) (primitive->connectionInfo.beaconFrameLength)));
2131 }
2132 else
2133 {
2134 primitive->connectionInfo.beaconFrame = NULL;
2135 }
2136 CsrUint16Des((u16 *) &primitive->connectionInfo.associationReqFrameLength, buffer, &offset);
2137 if (primitive->connectionInfo.associationReqFrameLength)
2138 {
2139 primitive->connectionInfo.associationReqFrame = kmalloc(primitive->connectionInfo.associationReqFrameLength, GFP_KERNEL);
2140 CsrMemCpyDes(primitive->connectionInfo.associationReqFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationReqFrameLength)));
2141 }
2142 else
2143 {
2144 primitive->connectionInfo.associationReqFrame = NULL;
2145 }
2146 CsrUint16Des((u16 *) &primitive->connectionInfo.associationRspFrameLength, buffer, &offset);
2147 if (primitive->connectionInfo.associationRspFrameLength)
2148 {
2149 primitive->connectionInfo.associationRspFrame = kmalloc(primitive->connectionInfo.associationRspFrameLength, GFP_KERNEL);
2150 CsrMemCpyDes(primitive->connectionInfo.associationRspFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationRspFrameLength)));
2151 }
2152 else
2153 {
2154 primitive->connectionInfo.associationRspFrame = NULL;
2155 }
2156 CsrUint16Des((u16 *) &primitive->connectionInfo.assocScanInfoElementsLength, buffer, &offset);
2157 if (primitive->connectionInfo.assocScanInfoElementsLength)
2158 {
2159 primitive->connectionInfo.assocScanInfoElements = kmalloc(primitive->connectionInfo.assocScanInfoElementsLength, GFP_KERNEL);
2160 CsrMemCpyDes(primitive->connectionInfo.assocScanInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocScanInfoElementsLength)));
2161 }
2162 else
2163 {
2164 primitive->connectionInfo.assocScanInfoElements = NULL;
2165 }
2166 CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqCapabilities, buffer, &offset);
2167 CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqListenIntervalTu, buffer, &offset);
2168 CsrMemCpyDes(primitive->connectionInfo.assocReqApAddress.a, buffer, &offset, ((u16) (6)));
2169 CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqInfoElementsLength, buffer, &offset);
2170 if (primitive->connectionInfo.assocReqInfoElementsLength)
2171 {
2172 primitive->connectionInfo.assocReqInfoElements = kmalloc(primitive->connectionInfo.assocReqInfoElementsLength, GFP_KERNEL);
2173 CsrMemCpyDes(primitive->connectionInfo.assocReqInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocReqInfoElementsLength)));
2174 }
2175 else
2176 {
2177 primitive->connectionInfo.assocReqInfoElements = NULL;
2178 }
2179 CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspResult, buffer, &offset);
2180 CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspCapabilityInfo, buffer, &offset);
2181 CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspAssociationId, buffer, &offset);
2182 CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspInfoElementsLength, buffer, &offset);
2183 if (primitive->connectionInfo.assocRspInfoElementsLength)
2184 {
2185 primitive->connectionInfo.assocRspInfoElements = kmalloc(primitive->connectionInfo.assocRspInfoElementsLength, GFP_KERNEL);
2186 CsrMemCpyDes(primitive->connectionInfo.assocRspInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocRspInfoElementsLength)));
2187 }
2188 else
2189 {
2190 primitive->connectionInfo.assocRspInfoElements = NULL;
2191 }
2192 CsrUint16Des((u16 *) &primitive->deauthReason, buffer, &offset);
2193
2194 return primitive;
2195}
2196
2197
2198void CsrWifiSmeAssociationCompleteIndSerFree(void *voidPrimitivePointer)
2199{
2200 CsrWifiSmeAssociationCompleteInd *primitive = (CsrWifiSmeAssociationCompleteInd *) voidPrimitivePointer;
2201 kfree(primitive->connectionInfo.beaconFrame);
2202 kfree(primitive->connectionInfo.associationReqFrame);
2203 kfree(primitive->connectionInfo.associationRspFrame);
2204 kfree(primitive->connectionInfo.assocScanInfoElements);
2205 kfree(primitive->connectionInfo.assocReqInfoElements);
2206 kfree(primitive->connectionInfo.assocRspInfoElements);
2207 kfree(primitive);
2208}
2209
2210
2211size_t CsrWifiSmeAssociationStartIndSizeof(void *msg)
2212{
2213 size_t bufferSize = 2;
2214
2215 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 44) */
2216 bufferSize += 2; /* u16 primitive->interfaceTag */
2217 bufferSize += 6; /* u8 primitive->address.a[6] */
2218 bufferSize += 32; /* u8 primitive->ssid.ssid[32] */
2219 bufferSize += 1; /* u8 primitive->ssid.length */
2220 return bufferSize;
2221}
2222
2223
2224u8* CsrWifiSmeAssociationStartIndSer(u8 *ptr, size_t *len, void *msg)
2225{
2226 CsrWifiSmeAssociationStartInd *primitive = (CsrWifiSmeAssociationStartInd *)msg;
2227 *len = 0;
2228 CsrUint16Ser(ptr, len, primitive->common.type);
2229 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
2230 CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((u16) (6)));
2231 CsrMemCpySer(ptr, len, (const void *) primitive->ssid.ssid, ((u16) (32)));
2232 CsrUint8Ser(ptr, len, (u8) primitive->ssid.length);
2233 return(ptr);
2234}
2235
2236
2237void* CsrWifiSmeAssociationStartIndDes(u8 *buffer, size_t length)
2238{
2239 CsrWifiSmeAssociationStartInd *primitive = kmalloc(sizeof(CsrWifiSmeAssociationStartInd), GFP_KERNEL);
2240 size_t offset;
2241 offset = 0;
2242
2243 CsrUint16Des(&primitive->common.type, buffer, &offset);
2244 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
2245 CsrMemCpyDes(primitive->address.a, buffer, &offset, ((u16) (6)));
2246 CsrMemCpyDes(primitive->ssid.ssid, buffer, &offset, ((u16) (32)));
2247 CsrUint8Des((u8 *) &primitive->ssid.length, buffer, &offset);
2248
2249 return primitive;
2250}
2251
2252
2253size_t CsrWifiSmeBlacklistCfmSizeof(void *msg)
2254{
2255 CsrWifiSmeBlacklistCfm *primitive = (CsrWifiSmeBlacklistCfm *) msg;
2256 size_t bufferSize = 2;
2257
2258 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */
2259 bufferSize += 2; /* u16 primitive->interfaceTag */
2260 bufferSize += 2; /* CsrResult primitive->status */
2261 bufferSize += 1; /* CsrWifiSmeListAction primitive->action */
2262 bufferSize += 1; /* u8 primitive->getAddressCount */
2263 {
2264 u16 i1;
2265 for (i1 = 0; i1 < primitive->getAddressCount; i1++)
2266 {
2267 bufferSize += 6; /* u8 primitive->getAddresses[i1].a[6] */
2268 }
2269 }
2270 return bufferSize;
2271}
2272
2273
2274u8* CsrWifiSmeBlacklistCfmSer(u8 *ptr, size_t *len, void *msg)
2275{
2276 CsrWifiSmeBlacklistCfm *primitive = (CsrWifiSmeBlacklistCfm *)msg;
2277 *len = 0;
2278 CsrUint16Ser(ptr, len, primitive->common.type);
2279 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
2280 CsrUint16Ser(ptr, len, (u16) primitive->status);
2281 CsrUint8Ser(ptr, len, (u8) primitive->action);
2282 CsrUint8Ser(ptr, len, (u8) primitive->getAddressCount);
2283 {
2284 u16 i1;
2285 for (i1 = 0; i1 < primitive->getAddressCount; i1++)
2286 {
2287 CsrMemCpySer(ptr, len, (const void *) primitive->getAddresses[i1].a, ((u16) (6)));
2288 }
2289 }
2290 return(ptr);
2291}
2292
2293
2294void* CsrWifiSmeBlacklistCfmDes(u8 *buffer, size_t length)
2295{
2296 CsrWifiSmeBlacklistCfm *primitive = kmalloc(sizeof(CsrWifiSmeBlacklistCfm), GFP_KERNEL);
2297 size_t offset;
2298 offset = 0;
2299
2300 CsrUint16Des(&primitive->common.type, buffer, &offset);
2301 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
2302 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
2303 CsrUint8Des((u8 *) &primitive->action, buffer, &offset);
2304 CsrUint8Des((u8 *) &primitive->getAddressCount, buffer, &offset);
2305 primitive->getAddresses = NULL;
2306 if (primitive->getAddressCount)
2307 {
2308 primitive->getAddresses = kmalloc(sizeof(CsrWifiMacAddress) * primitive->getAddressCount, GFP_KERNEL);
2309 }
2310 {
2311 u16 i1;
2312 for (i1 = 0; i1 < primitive->getAddressCount; i1++)
2313 {
2314 CsrMemCpyDes(primitive->getAddresses[i1].a, buffer, &offset, ((u16) (6)));
2315 }
2316 }
2317
2318 return primitive;
2319}
2320
2321
2322void CsrWifiSmeBlacklistCfmSerFree(void *voidPrimitivePointer)
2323{
2324 CsrWifiSmeBlacklistCfm *primitive = (CsrWifiSmeBlacklistCfm *) voidPrimitivePointer;
2325 kfree(primitive->getAddresses);
2326 kfree(primitive);
2327}
2328
2329
2330size_t CsrWifiSmeCalibrationDataGetCfmSizeof(void *msg)
2331{
2332 CsrWifiSmeCalibrationDataGetCfm *primitive = (CsrWifiSmeCalibrationDataGetCfm *) msg;
2333 size_t bufferSize = 2;
2334
2335 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */
2336 bufferSize += 2; /* CsrResult primitive->status */
2337 bufferSize += 2; /* u16 primitive->calibrationDataLength */
2338 bufferSize += primitive->calibrationDataLength; /* u8 primitive->calibrationData */
2339 return bufferSize;
2340}
2341
2342
2343u8* CsrWifiSmeCalibrationDataGetCfmSer(u8 *ptr, size_t *len, void *msg)
2344{
2345 CsrWifiSmeCalibrationDataGetCfm *primitive = (CsrWifiSmeCalibrationDataGetCfm *)msg;
2346 *len = 0;
2347 CsrUint16Ser(ptr, len, primitive->common.type);
2348 CsrUint16Ser(ptr, len, (u16) primitive->status);
2349 CsrUint16Ser(ptr, len, (u16) primitive->calibrationDataLength);
2350 if (primitive->calibrationDataLength)
2351 {
2352 CsrMemCpySer(ptr, len, (const void *) primitive->calibrationData, ((u16) (primitive->calibrationDataLength)));
2353 }
2354 return(ptr);
2355}
2356
2357
2358void* CsrWifiSmeCalibrationDataGetCfmDes(u8 *buffer, size_t length)
2359{
2360 CsrWifiSmeCalibrationDataGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeCalibrationDataGetCfm), GFP_KERNEL);
2361 size_t offset;
2362 offset = 0;
2363
2364 CsrUint16Des(&primitive->common.type, buffer, &offset);
2365 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
2366 CsrUint16Des((u16 *) &primitive->calibrationDataLength, buffer, &offset);
2367 if (primitive->calibrationDataLength)
2368 {
2369 primitive->calibrationData = kmalloc(primitive->calibrationDataLength, GFP_KERNEL);
2370 CsrMemCpyDes(primitive->calibrationData, buffer, &offset, ((u16) (primitive->calibrationDataLength)));
2371 }
2372 else
2373 {
2374 primitive->calibrationData = NULL;
2375 }
2376
2377 return primitive;
2378}
2379
2380
2381void CsrWifiSmeCalibrationDataGetCfmSerFree(void *voidPrimitivePointer)
2382{
2383 CsrWifiSmeCalibrationDataGetCfm *primitive = (CsrWifiSmeCalibrationDataGetCfm *) voidPrimitivePointer;
2384 kfree(primitive->calibrationData);
2385 kfree(primitive);
2386}
2387
2388
2389size_t CsrWifiSmeCcxConfigGetCfmSizeof(void *msg)
2390{
2391 size_t bufferSize = 2;
2392
2393 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */
2394 bufferSize += 2; /* u16 primitive->interfaceTag */
2395 bufferSize += 2; /* CsrResult primitive->status */
2396 bufferSize += 1; /* u8 primitive->ccxConfig.keepAliveTimeMs */
2397 bufferSize += 1; /* u8 primitive->ccxConfig.apRoamingEnabled */
2398 bufferSize += 1; /* u8 primitive->ccxConfig.measurementsMask */
2399 bufferSize += 1; /* u8 primitive->ccxConfig.ccxRadioMgtEnabled */
2400 return bufferSize;
2401}
2402
2403
2404u8* CsrWifiSmeCcxConfigGetCfmSer(u8 *ptr, size_t *len, void *msg)
2405{
2406 CsrWifiSmeCcxConfigGetCfm *primitive = (CsrWifiSmeCcxConfigGetCfm *)msg;
2407 *len = 0;
2408 CsrUint16Ser(ptr, len, primitive->common.type);
2409 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
2410 CsrUint16Ser(ptr, len, (u16) primitive->status);
2411 CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.keepAliveTimeMs);
2412 CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.apRoamingEnabled);
2413 CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.measurementsMask);
2414 CsrUint8Ser(ptr, len, (u8) primitive->ccxConfig.ccxRadioMgtEnabled);
2415 return(ptr);
2416}
2417
2418
2419void* CsrWifiSmeCcxConfigGetCfmDes(u8 *buffer, size_t length)
2420{
2421 CsrWifiSmeCcxConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeCcxConfigGetCfm), GFP_KERNEL);
2422 size_t offset;
2423 offset = 0;
2424
2425 CsrUint16Des(&primitive->common.type, buffer, &offset);
2426 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
2427 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
2428 CsrUint8Des((u8 *) &primitive->ccxConfig.keepAliveTimeMs, buffer, &offset);
2429 CsrUint8Des((u8 *) &primitive->ccxConfig.apRoamingEnabled, buffer, &offset);
2430 CsrUint8Des((u8 *) &primitive->ccxConfig.measurementsMask, buffer, &offset);
2431 CsrUint8Des((u8 *) &primitive->ccxConfig.ccxRadioMgtEnabled, buffer, &offset);
2432
2433 return primitive;
2434}
2435
2436
2437size_t CsrWifiSmeCcxConfigSetCfmSizeof(void *msg)
2438{
2439 size_t bufferSize = 2;
2440
2441 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */
2442 bufferSize += 2; /* u16 primitive->interfaceTag */
2443 bufferSize += 2; /* CsrResult primitive->status */
2444 return bufferSize;
2445}
2446
2447
2448u8* CsrWifiSmeCcxConfigSetCfmSer(u8 *ptr, size_t *len, void *msg)
2449{
2450 CsrWifiSmeCcxConfigSetCfm *primitive = (CsrWifiSmeCcxConfigSetCfm *)msg;
2451 *len = 0;
2452 CsrUint16Ser(ptr, len, primitive->common.type);
2453 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
2454 CsrUint16Ser(ptr, len, (u16) primitive->status);
2455 return(ptr);
2456}
2457
2458
2459void* CsrWifiSmeCcxConfigSetCfmDes(u8 *buffer, size_t length)
2460{
2461 CsrWifiSmeCcxConfigSetCfm *primitive = kmalloc(sizeof(CsrWifiSmeCcxConfigSetCfm), GFP_KERNEL);
2462 size_t offset;
2463 offset = 0;
2464
2465 CsrUint16Des(&primitive->common.type, buffer, &offset);
2466 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
2467 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
2468
2469 return primitive;
2470}
2471
2472
2473size_t CsrWifiSmeCoexConfigGetCfmSizeof(void *msg)
2474{
2475 size_t bufferSize = 2;
2476
2477 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 31) */
2478 bufferSize += 2; /* CsrResult primitive->status */
2479 bufferSize += 1; /* u8 primitive->coexConfig.coexEnableSchemeManagement */
2480 bufferSize += 1; /* u8 primitive->coexConfig.coexPeriodicWakeHost */
2481 bufferSize += 2; /* u16 primitive->coexConfig.coexTrafficBurstyLatencyMs */
2482 bufferSize += 2; /* u16 primitive->coexConfig.coexTrafficContinuousLatencyMs */
2483 bufferSize += 2; /* u16 primitive->coexConfig.coexObexBlackoutDurationMs */
2484 bufferSize += 2; /* u16 primitive->coexConfig.coexObexBlackoutPeriodMs */
2485 bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpBrBlackoutDurationMs */
2486 bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpBrBlackoutPeriodMs */
2487 bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpEdrBlackoutDurationMs */
2488 bufferSize += 2; /* u16 primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs */
2489 bufferSize += 2; /* u16 primitive->coexConfig.coexPagingBlackoutDurationMs */
2490 bufferSize += 2; /* u16 primitive->coexConfig.coexPagingBlackoutPeriodMs */
2491 bufferSize += 2; /* u16 primitive->coexConfig.coexInquiryBlackoutDurationMs */
2492 bufferSize += 2; /* u16 primitive->coexConfig.coexInquiryBlackoutPeriodMs */
2493 return bufferSize;
2494}
2495
2496
2497u8* CsrWifiSmeCoexConfigGetCfmSer(u8 *ptr, size_t *len, void *msg)
2498{
2499 CsrWifiSmeCoexConfigGetCfm *primitive = (CsrWifiSmeCoexConfigGetCfm *)msg;
2500 *len = 0;
2501 CsrUint16Ser(ptr, len, primitive->common.type);
2502 CsrUint16Ser(ptr, len, (u16) primitive->status);
2503 CsrUint8Ser(ptr, len, (u8) primitive->coexConfig.coexEnableSchemeManagement);
2504 CsrUint8Ser(ptr, len, (u8) primitive->coexConfig.coexPeriodicWakeHost);
2505 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexTrafficBurstyLatencyMs);
2506 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexTrafficContinuousLatencyMs);
2507 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexObexBlackoutDurationMs);
2508 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexObexBlackoutPeriodMs);
2509 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpBrBlackoutDurationMs);
2510 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpBrBlackoutPeriodMs);
2511 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpEdrBlackoutDurationMs);
2512 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs);
2513 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexPagingBlackoutDurationMs);
2514 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexPagingBlackoutPeriodMs);
2515 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexInquiryBlackoutDurationMs);
2516 CsrUint16Ser(ptr, len, (u16) primitive->coexConfig.coexInquiryBlackoutPeriodMs);
2517 return(ptr);
2518}
2519
2520
2521void* CsrWifiSmeCoexConfigGetCfmDes(u8 *buffer, size_t length)
2522{
2523 CsrWifiSmeCoexConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeCoexConfigGetCfm), GFP_KERNEL);
2524 size_t offset;
2525 offset = 0;
2526
2527 CsrUint16Des(&primitive->common.type, buffer, &offset);
2528 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
2529 CsrUint8Des((u8 *) &primitive->coexConfig.coexEnableSchemeManagement, buffer, &offset);
2530 CsrUint8Des((u8 *) &primitive->coexConfig.coexPeriodicWakeHost, buffer, &offset);
2531 CsrUint16Des((u16 *) &primitive->coexConfig.coexTrafficBurstyLatencyMs, buffer, &offset);
2532 CsrUint16Des((u16 *) &primitive->coexConfig.coexTrafficContinuousLatencyMs, buffer, &offset);
2533 CsrUint16Des((u16 *) &primitive->coexConfig.coexObexBlackoutDurationMs, buffer, &offset);
2534 CsrUint16Des((u16 *) &primitive->coexConfig.coexObexBlackoutPeriodMs, buffer, &offset);
2535 CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpBrBlackoutDurationMs, buffer, &offset);
2536 CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpBrBlackoutPeriodMs, buffer, &offset);
2537 CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpEdrBlackoutDurationMs, buffer, &offset);
2538 CsrUint16Des((u16 *) &primitive->coexConfig.coexA2dpEdrBlackoutPeriodMs, buffer, &offset);
2539 CsrUint16Des((u16 *) &primitive->coexConfig.coexPagingBlackoutDurationMs, buffer, &offset);
2540 CsrUint16Des((u16 *) &primitive->coexConfig.coexPagingBlackoutPeriodMs, buffer, &offset);
2541 CsrUint16Des((u16 *) &primitive->coexConfig.coexInquiryBlackoutDurationMs, buffer, &offset);
2542 CsrUint16Des((u16 *) &primitive->coexConfig.coexInquiryBlackoutPeriodMs, buffer, &offset);
2543
2544 return primitive;
2545}
2546
2547
2548size_t CsrWifiSmeCoexInfoGetCfmSizeof(void *msg)
2549{
2550 size_t bufferSize = 2;
2551
2552 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 24) */
2553 bufferSize += 2; /* CsrResult primitive->status */
2554 bufferSize += 1; /* u8 primitive->coexInfo.hasTrafficData */
2555 bufferSize += 1; /* CsrWifiSmeTrafficType primitive->coexInfo.currentTrafficType */
2556 bufferSize += 2; /* u16 primitive->coexInfo.currentPeriodMs */
2557 bufferSize += 1; /* CsrWifiSmePowerSaveLevel primitive->coexInfo.currentPowerSave */
2558 bufferSize += 2; /* u16 primitive->coexInfo.currentCoexPeriodMs */
2559 bufferSize += 2; /* u16 primitive->coexInfo.currentCoexLatencyMs */
2560 bufferSize += 1; /* u8 primitive->coexInfo.hasBtDevice */
2561 bufferSize += 4; /* u32 primitive->coexInfo.currentBlackoutDurationUs */
2562 bufferSize += 4; /* u32 primitive->coexInfo.currentBlackoutPeriodUs */
2563 bufferSize += 1; /* CsrWifiSmeCoexScheme primitive->coexInfo.currentCoexScheme */
2564 return bufferSize;
2565}
2566
2567
2568u8* CsrWifiSmeCoexInfoGetCfmSer(u8 *ptr, size_t *len, void *msg)
2569{
2570 CsrWifiSmeCoexInfoGetCfm *primitive = (CsrWifiSmeCoexInfoGetCfm *)msg;
2571 *len = 0;
2572 CsrUint16Ser(ptr, len, primitive->common.type);
2573 CsrUint16Ser(ptr, len, (u16) primitive->status);
2574 CsrUint8Ser(ptr, len, (u8) primitive->coexInfo.hasTrafficData);
2575 CsrUint8Ser(ptr, len, (u8) primitive->coexInfo.currentTrafficType);
2576 CsrUint16Ser(ptr, len, (u16) primitive->coexInfo.currentPeriodMs);
2577 CsrUint8Ser(ptr, len, (u8) primitive->coexInfo.currentPowerSave);
2578 CsrUint16Ser(ptr, len, (u16) primitive->coexInfo.currentCoexPeriodMs);
2579 CsrUint16Ser(ptr, len, (u16) primitive->coexInfo.currentCoexLatencyMs);
2580 CsrUint8Ser(ptr, len, (u8) primitive->coexInfo.hasBtDevice);
2581 CsrUint32Ser(ptr, len, (u32) primitive->coexInfo.currentBlackoutDurationUs);
2582 CsrUint32Ser(ptr, len, (u32) primitive->coexInfo.currentBlackoutPeriodUs);
2583 CsrUint8Ser(ptr, len, (u8) primitive->coexInfo.currentCoexScheme);
2584 return(ptr);
2585}
2586
2587
2588void* CsrWifiSmeCoexInfoGetCfmDes(u8 *buffer, size_t length)
2589{
2590 CsrWifiSmeCoexInfoGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeCoexInfoGetCfm), GFP_KERNEL);
2591 size_t offset;
2592 offset = 0;
2593
2594 CsrUint16Des(&primitive->common.type, buffer, &offset);
2595 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
2596 CsrUint8Des((u8 *) &primitive->coexInfo.hasTrafficData, buffer, &offset);
2597 CsrUint8Des((u8 *) &primitive->coexInfo.currentTrafficType, buffer, &offset);
2598 CsrUint16Des((u16 *) &primitive->coexInfo.currentPeriodMs, buffer, &offset);
2599 CsrUint8Des((u8 *) &primitive->coexInfo.currentPowerSave, buffer, &offset);
2600 CsrUint16Des((u16 *) &primitive->coexInfo.currentCoexPeriodMs, buffer, &offset);
2601 CsrUint16Des((u16 *) &primitive->coexInfo.currentCoexLatencyMs, buffer, &offset);
2602 CsrUint8Des((u8 *) &primitive->coexInfo.hasBtDevice, buffer, &offset);
2603 CsrUint32Des((u32 *) &primitive->coexInfo.currentBlackoutDurationUs, buffer, &offset);
2604 CsrUint32Des((u32 *) &primitive->coexInfo.currentBlackoutPeriodUs, buffer, &offset);
2605 CsrUint8Des((u8 *) &primitive->coexInfo.currentCoexScheme, buffer, &offset);
2606
2607 return primitive;
2608}
2609
2610
2611size_t CsrWifiSmeConnectCfmSizeof(void *msg)
2612{
2613 size_t bufferSize = 2;
2614
2615 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */
2616 bufferSize += 2; /* u16 primitive->interfaceTag */
2617 bufferSize += 2; /* CsrResult primitive->status */
2618 return bufferSize;
2619}
2620
2621
2622u8* CsrWifiSmeConnectCfmSer(u8 *ptr, size_t *len, void *msg)
2623{
2624 CsrWifiSmeConnectCfm *primitive = (CsrWifiSmeConnectCfm *)msg;
2625 *len = 0;
2626 CsrUint16Ser(ptr, len, primitive->common.type);
2627 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
2628 CsrUint16Ser(ptr, len, (u16) primitive->status);
2629 return(ptr);
2630}
2631
2632
2633void* CsrWifiSmeConnectCfmDes(u8 *buffer, size_t length)
2634{
2635 CsrWifiSmeConnectCfm *primitive = kmalloc(sizeof(CsrWifiSmeConnectCfm), GFP_KERNEL);
2636 size_t offset;
2637 offset = 0;
2638
2639 CsrUint16Des(&primitive->common.type, buffer, &offset);
2640 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
2641 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
2642
2643 return primitive;
2644}
2645
2646
2647size_t CsrWifiSmeConnectionConfigGetCfmSizeof(void *msg)
2648{
2649 CsrWifiSmeConnectionConfigGetCfm *primitive = (CsrWifiSmeConnectionConfigGetCfm *) msg;
2650 size_t bufferSize = 2;
2651
2652 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 59) */
2653 bufferSize += 2; /* u16 primitive->interfaceTag */
2654 bufferSize += 2; /* CsrResult primitive->status */
2655 bufferSize += 32; /* u8 primitive->connectionConfig.ssid.ssid[32] */
2656 bufferSize += 1; /* u8 primitive->connectionConfig.ssid.length */
2657 bufferSize += 6; /* u8 primitive->connectionConfig.bssid.a[6] */
2658 bufferSize += 1; /* CsrWifiSmeBssType primitive->connectionConfig.bssType */
2659 bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionConfig.ifIndex */
2660 bufferSize += 1; /* CsrWifiSme80211PrivacyMode primitive->connectionConfig.privacyMode */
2661 bufferSize += 2; /* CsrWifiSmeAuthModeMask primitive->connectionConfig.authModeMask */
2662 bufferSize += 2; /* CsrWifiSmeEncryptionMask primitive->connectionConfig.encryptionModeMask */
2663 bufferSize += 2; /* u16 primitive->connectionConfig.mlmeAssociateReqInformationElementsLength */
2664 bufferSize += primitive->connectionConfig.mlmeAssociateReqInformationElementsLength; /* u8 primitive->connectionConfig.mlmeAssociateReqInformationElements */
2665 bufferSize += 1; /* CsrWifiSmeWmmQosInfoMask primitive->connectionConfig.wmmQosInfo */
2666 bufferSize += 1; /* u8 primitive->connectionConfig.adhocJoinOnly */
2667 bufferSize += 1; /* u8 primitive->connectionConfig.adhocChannel */
2668 return bufferSize;
2669}
2670
2671
2672u8* CsrWifiSmeConnectionConfigGetCfmSer(u8 *ptr, size_t *len, void *msg)
2673{
2674 CsrWifiSmeConnectionConfigGetCfm *primitive = (CsrWifiSmeConnectionConfigGetCfm *)msg;
2675 *len = 0;
2676 CsrUint16Ser(ptr, len, primitive->common.type);
2677 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
2678 CsrUint16Ser(ptr, len, (u16) primitive->status);
2679 CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.ssid.ssid, ((u16) (32)));
2680 CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.ssid.length);
2681 CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.bssid.a, ((u16) (6)));
2682 CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.bssType);
2683 CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.ifIndex);
2684 CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.privacyMode);
2685 CsrUint16Ser(ptr, len, (u16) primitive->connectionConfig.authModeMask);
2686 CsrUint16Ser(ptr, len, (u16) primitive->connectionConfig.encryptionModeMask);
2687 CsrUint16Ser(ptr, len, (u16) primitive->connectionConfig.mlmeAssociateReqInformationElementsLength);
2688 if (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength)
2689 {
2690 CsrMemCpySer(ptr, len, (const void *) primitive->connectionConfig.mlmeAssociateReqInformationElements, ((u16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength)));
2691 }
2692 CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.wmmQosInfo);
2693 CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.adhocJoinOnly);
2694 CsrUint8Ser(ptr, len, (u8) primitive->connectionConfig.adhocChannel);
2695 return(ptr);
2696}
2697
2698
2699void* CsrWifiSmeConnectionConfigGetCfmDes(u8 *buffer, size_t length)
2700{
2701 CsrWifiSmeConnectionConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeConnectionConfigGetCfm), GFP_KERNEL);
2702 size_t offset;
2703 offset = 0;
2704
2705 CsrUint16Des(&primitive->common.type, buffer, &offset);
2706 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
2707 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
2708 CsrMemCpyDes(primitive->connectionConfig.ssid.ssid, buffer, &offset, ((u16) (32)));
2709 CsrUint8Des((u8 *) &primitive->connectionConfig.ssid.length, buffer, &offset);
2710 CsrMemCpyDes(primitive->connectionConfig.bssid.a, buffer, &offset, ((u16) (6)));
2711 CsrUint8Des((u8 *) &primitive->connectionConfig.bssType, buffer, &offset);
2712 CsrUint8Des((u8 *) &primitive->connectionConfig.ifIndex, buffer, &offset);
2713 CsrUint8Des((u8 *) &primitive->connectionConfig.privacyMode, buffer, &offset);
2714 CsrUint16Des((u16 *) &primitive->connectionConfig.authModeMask, buffer, &offset);
2715 CsrUint16Des((u16 *) &primitive->connectionConfig.encryptionModeMask, buffer, &offset);
2716 CsrUint16Des((u16 *) &primitive->connectionConfig.mlmeAssociateReqInformationElementsLength, buffer, &offset);
2717 if (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength)
2718 {
2719 primitive->connectionConfig.mlmeAssociateReqInformationElements = kmalloc(primitive->connectionConfig.mlmeAssociateReqInformationElementsLength, GFP_KERNEL);
2720 CsrMemCpyDes(primitive->connectionConfig.mlmeAssociateReqInformationElements, buffer, &offset, ((u16) (primitive->connectionConfig.mlmeAssociateReqInformationElementsLength)));
2721 }
2722 else
2723 {
2724 primitive->connectionConfig.mlmeAssociateReqInformationElements = NULL;
2725 }
2726 CsrUint8Des((u8 *) &primitive->connectionConfig.wmmQosInfo, buffer, &offset);
2727 CsrUint8Des((u8 *) &primitive->connectionConfig.adhocJoinOnly, buffer, &offset);
2728 CsrUint8Des((u8 *) &primitive->connectionConfig.adhocChannel, buffer, &offset);
2729
2730 return primitive;
2731}
2732
2733
2734void CsrWifiSmeConnectionConfigGetCfmSerFree(void *voidPrimitivePointer)
2735{
2736 CsrWifiSmeConnectionConfigGetCfm *primitive = (CsrWifiSmeConnectionConfigGetCfm *) voidPrimitivePointer;
2737 kfree(primitive->connectionConfig.mlmeAssociateReqInformationElements);
2738 kfree(primitive);
2739}
2740
2741
2742size_t CsrWifiSmeConnectionInfoGetCfmSizeof(void *msg)
2743{
2744 CsrWifiSmeConnectionInfoGetCfm *primitive = (CsrWifiSmeConnectionInfoGetCfm *) msg;
2745 size_t bufferSize = 2;
2746
2747 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 96) */
2748 bufferSize += 2; /* u16 primitive->interfaceTag */
2749 bufferSize += 2; /* CsrResult primitive->status */
2750 bufferSize += 32; /* u8 primitive->connectionInfo.ssid.ssid[32] */
2751 bufferSize += 1; /* u8 primitive->connectionInfo.ssid.length */
2752 bufferSize += 6; /* u8 primitive->connectionInfo.bssid.a[6] */
2753 bufferSize += 1; /* CsrWifiSme80211NetworkType primitive->connectionInfo.networkType80211 */
2754 bufferSize += 1; /* u8 primitive->connectionInfo.channelNumber */
2755 bufferSize += 2; /* u16 primitive->connectionInfo.channelFrequency */
2756 bufferSize += 2; /* CsrWifiSmeAuthMode primitive->connectionInfo.authMode */
2757 bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.pairwiseCipher */
2758 bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.groupCipher */
2759 bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionInfo.ifIndex */
2760 bufferSize += 2; /* u16 primitive->connectionInfo.atimWindowTu */
2761 bufferSize += 2; /* u16 primitive->connectionInfo.beaconPeriodTu */
2762 bufferSize += 1; /* u8 primitive->connectionInfo.reassociation */
2763 bufferSize += 2; /* u16 primitive->connectionInfo.beaconFrameLength */
2764 bufferSize += primitive->connectionInfo.beaconFrameLength; /* u8 primitive->connectionInfo.beaconFrame */
2765 bufferSize += 2; /* u16 primitive->connectionInfo.associationReqFrameLength */
2766 bufferSize += primitive->connectionInfo.associationReqFrameLength; /* u8 primitive->connectionInfo.associationReqFrame */
2767 bufferSize += 2; /* u16 primitive->connectionInfo.associationRspFrameLength */
2768 bufferSize += primitive->connectionInfo.associationRspFrameLength; /* u8 primitive->connectionInfo.associationRspFrame */
2769 bufferSize += 2; /* u16 primitive->connectionInfo.assocScanInfoElementsLength */
2770 bufferSize += primitive->connectionInfo.assocScanInfoElementsLength; /* u8 primitive->connectionInfo.assocScanInfoElements */
2771 bufferSize += 2; /* u16 primitive->connectionInfo.assocReqCapabilities */
2772 bufferSize += 2; /* u16 primitive->connectionInfo.assocReqListenIntervalTu */
2773 bufferSize += 6; /* u8 primitive->connectionInfo.assocReqApAddress.a[6] */
2774 bufferSize += 2; /* u16 primitive->connectionInfo.assocReqInfoElementsLength */
2775 bufferSize += primitive->connectionInfo.assocReqInfoElementsLength; /* u8 primitive->connectionInfo.assocReqInfoElements */
2776 bufferSize += 2; /* CsrWifiSmeIEEE80211Result primitive->connectionInfo.assocRspResult */
2777 bufferSize += 2; /* u16 primitive->connectionInfo.assocRspCapabilityInfo */
2778 bufferSize += 2; /* u16 primitive->connectionInfo.assocRspAssociationId */
2779 bufferSize += 2; /* u16 primitive->connectionInfo.assocRspInfoElementsLength */
2780 bufferSize += primitive->connectionInfo.assocRspInfoElementsLength; /* u8 primitive->connectionInfo.assocRspInfoElements */
2781 return bufferSize;
2782}
2783
2784
2785u8* CsrWifiSmeConnectionInfoGetCfmSer(u8 *ptr, size_t *len, void *msg)
2786{
2787 CsrWifiSmeConnectionInfoGetCfm *primitive = (CsrWifiSmeConnectionInfoGetCfm *)msg;
2788 *len = 0;
2789 CsrUint16Ser(ptr, len, primitive->common.type);
2790 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
2791 CsrUint16Ser(ptr, len, (u16) primitive->status);
2792 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.ssid.ssid, ((u16) (32)));
2793 CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ssid.length);
2794 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.bssid.a, ((u16) (6)));
2795 CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.networkType80211);
2796 CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.channelNumber);
2797 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.channelFrequency);
2798 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.authMode);
2799 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.pairwiseCipher);
2800 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.groupCipher);
2801 CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ifIndex);
2802 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.atimWindowTu);
2803 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.beaconPeriodTu);
2804 CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.reassociation);
2805 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.beaconFrameLength);
2806 if (primitive->connectionInfo.beaconFrameLength)
2807 {
2808 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.beaconFrame, ((u16) (primitive->connectionInfo.beaconFrameLength)));
2809 }
2810 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.associationReqFrameLength);
2811 if (primitive->connectionInfo.associationReqFrameLength)
2812 {
2813 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationReqFrame, ((u16) (primitive->connectionInfo.associationReqFrameLength)));
2814 }
2815 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.associationRspFrameLength);
2816 if (primitive->connectionInfo.associationRspFrameLength)
2817 {
2818 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationRspFrame, ((u16) (primitive->connectionInfo.associationRspFrameLength)));
2819 }
2820 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocScanInfoElementsLength);
2821 if (primitive->connectionInfo.assocScanInfoElementsLength)
2822 {
2823 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocScanInfoElements, ((u16) (primitive->connectionInfo.assocScanInfoElementsLength)));
2824 }
2825 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqCapabilities);
2826 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqListenIntervalTu);
2827 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqApAddress.a, ((u16) (6)));
2828 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqInfoElementsLength);
2829 if (primitive->connectionInfo.assocReqInfoElementsLength)
2830 {
2831 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqInfoElements, ((u16) (primitive->connectionInfo.assocReqInfoElementsLength)));
2832 }
2833 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspResult);
2834 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspCapabilityInfo);
2835 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspAssociationId);
2836 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspInfoElementsLength);
2837 if (primitive->connectionInfo.assocRspInfoElementsLength)
2838 {
2839 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocRspInfoElements, ((u16) (primitive->connectionInfo.assocRspInfoElementsLength)));
2840 }
2841 return(ptr);
2842}
2843
2844
2845void* CsrWifiSmeConnectionInfoGetCfmDes(u8 *buffer, size_t length)
2846{
2847 CsrWifiSmeConnectionInfoGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeConnectionInfoGetCfm), GFP_KERNEL);
2848 size_t offset;
2849 offset = 0;
2850
2851 CsrUint16Des(&primitive->common.type, buffer, &offset);
2852 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
2853 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
2854 CsrMemCpyDes(primitive->connectionInfo.ssid.ssid, buffer, &offset, ((u16) (32)));
2855 CsrUint8Des((u8 *) &primitive->connectionInfo.ssid.length, buffer, &offset);
2856 CsrMemCpyDes(primitive->connectionInfo.bssid.a, buffer, &offset, ((u16) (6)));
2857 CsrUint8Des((u8 *) &primitive->connectionInfo.networkType80211, buffer, &offset);
2858 CsrUint8Des((u8 *) &primitive->connectionInfo.channelNumber, buffer, &offset);
2859 CsrUint16Des((u16 *) &primitive->connectionInfo.channelFrequency, buffer, &offset);
2860 CsrUint16Des((u16 *) &primitive->connectionInfo.authMode, buffer, &offset);
2861 CsrUint16Des((u16 *) &primitive->connectionInfo.pairwiseCipher, buffer, &offset);
2862 CsrUint16Des((u16 *) &primitive->connectionInfo.groupCipher, buffer, &offset);
2863 CsrUint8Des((u8 *) &primitive->connectionInfo.ifIndex, buffer, &offset);
2864 CsrUint16Des((u16 *) &primitive->connectionInfo.atimWindowTu, buffer, &offset);
2865 CsrUint16Des((u16 *) &primitive->connectionInfo.beaconPeriodTu, buffer, &offset);
2866 CsrUint8Des((u8 *) &primitive->connectionInfo.reassociation, buffer, &offset);
2867 CsrUint16Des((u16 *) &primitive->connectionInfo.beaconFrameLength, buffer, &offset);
2868 if (primitive->connectionInfo.beaconFrameLength)
2869 {
2870 primitive->connectionInfo.beaconFrame = kmalloc(primitive->connectionInfo.beaconFrameLength, GFP_KERNEL);
2871 CsrMemCpyDes(primitive->connectionInfo.beaconFrame, buffer, &offset, ((u16) (primitive->connectionInfo.beaconFrameLength)));
2872 }
2873 else
2874 {
2875 primitive->connectionInfo.beaconFrame = NULL;
2876 }
2877 CsrUint16Des((u16 *) &primitive->connectionInfo.associationReqFrameLength, buffer, &offset);
2878 if (primitive->connectionInfo.associationReqFrameLength)
2879 {
2880 primitive->connectionInfo.associationReqFrame = kmalloc(primitive->connectionInfo.associationReqFrameLength, GFP_KERNEL);
2881 CsrMemCpyDes(primitive->connectionInfo.associationReqFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationReqFrameLength)));
2882 }
2883 else
2884 {
2885 primitive->connectionInfo.associationReqFrame = NULL;
2886 }
2887 CsrUint16Des((u16 *) &primitive->connectionInfo.associationRspFrameLength, buffer, &offset);
2888 if (primitive->connectionInfo.associationRspFrameLength)
2889 {
2890 primitive->connectionInfo.associationRspFrame = kmalloc(primitive->connectionInfo.associationRspFrameLength, GFP_KERNEL);
2891 CsrMemCpyDes(primitive->connectionInfo.associationRspFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationRspFrameLength)));
2892 }
2893 else
2894 {
2895 primitive->connectionInfo.associationRspFrame = NULL;
2896 }
2897 CsrUint16Des((u16 *) &primitive->connectionInfo.assocScanInfoElementsLength, buffer, &offset);
2898 if (primitive->connectionInfo.assocScanInfoElementsLength)
2899 {
2900 primitive->connectionInfo.assocScanInfoElements = kmalloc(primitive->connectionInfo.assocScanInfoElementsLength, GFP_KERNEL);
2901 CsrMemCpyDes(primitive->connectionInfo.assocScanInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocScanInfoElementsLength)));
2902 }
2903 else
2904 {
2905 primitive->connectionInfo.assocScanInfoElements = NULL;
2906 }
2907 CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqCapabilities, buffer, &offset);
2908 CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqListenIntervalTu, buffer, &offset);
2909 CsrMemCpyDes(primitive->connectionInfo.assocReqApAddress.a, buffer, &offset, ((u16) (6)));
2910 CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqInfoElementsLength, buffer, &offset);
2911 if (primitive->connectionInfo.assocReqInfoElementsLength)
2912 {
2913 primitive->connectionInfo.assocReqInfoElements = kmalloc(primitive->connectionInfo.assocReqInfoElementsLength, GFP_KERNEL);
2914 CsrMemCpyDes(primitive->connectionInfo.assocReqInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocReqInfoElementsLength)));
2915 }
2916 else
2917 {
2918 primitive->connectionInfo.assocReqInfoElements = NULL;
2919 }
2920 CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspResult, buffer, &offset);
2921 CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspCapabilityInfo, buffer, &offset);
2922 CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspAssociationId, buffer, &offset);
2923 CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspInfoElementsLength, buffer, &offset);
2924 if (primitive->connectionInfo.assocRspInfoElementsLength)
2925 {
2926 primitive->connectionInfo.assocRspInfoElements = kmalloc(primitive->connectionInfo.assocRspInfoElementsLength, GFP_KERNEL);
2927 CsrMemCpyDes(primitive->connectionInfo.assocRspInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocRspInfoElementsLength)));
2928 }
2929 else
2930 {
2931 primitive->connectionInfo.assocRspInfoElements = NULL;
2932 }
2933
2934 return primitive;
2935}
2936
2937
2938void CsrWifiSmeConnectionInfoGetCfmSerFree(void *voidPrimitivePointer)
2939{
2940 CsrWifiSmeConnectionInfoGetCfm *primitive = (CsrWifiSmeConnectionInfoGetCfm *) voidPrimitivePointer;
2941 kfree(primitive->connectionInfo.beaconFrame);
2942 kfree(primitive->connectionInfo.associationReqFrame);
2943 kfree(primitive->connectionInfo.associationRspFrame);
2944 kfree(primitive->connectionInfo.assocScanInfoElements);
2945 kfree(primitive->connectionInfo.assocReqInfoElements);
2946 kfree(primitive->connectionInfo.assocRspInfoElements);
2947 kfree(primitive);
2948}
2949
2950
2951size_t CsrWifiSmeConnectionQualityIndSizeof(void *msg)
2952{
2953 size_t bufferSize = 2;
2954
2955 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */
2956 bufferSize += 2; /* u16 primitive->interfaceTag */
2957 bufferSize += 2; /* s16 primitive->linkQuality.unifiRssi */
2958 bufferSize += 2; /* s16 primitive->linkQuality.unifiSnr */
2959 return bufferSize;
2960}
2961
2962
2963u8* CsrWifiSmeConnectionQualityIndSer(u8 *ptr, size_t *len, void *msg)
2964{
2965 CsrWifiSmeConnectionQualityInd *primitive = (CsrWifiSmeConnectionQualityInd *)msg;
2966 *len = 0;
2967 CsrUint16Ser(ptr, len, primitive->common.type);
2968 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
2969 CsrUint16Ser(ptr, len, (u16) primitive->linkQuality.unifiRssi);
2970 CsrUint16Ser(ptr, len, (u16) primitive->linkQuality.unifiSnr);
2971 return(ptr);
2972}
2973
2974
2975void* CsrWifiSmeConnectionQualityIndDes(u8 *buffer, size_t length)
2976{
2977 CsrWifiSmeConnectionQualityInd *primitive = kmalloc(sizeof(CsrWifiSmeConnectionQualityInd), GFP_KERNEL);
2978 size_t offset;
2979 offset = 0;
2980
2981 CsrUint16Des(&primitive->common.type, buffer, &offset);
2982 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
2983 CsrUint16Des((u16 *) &primitive->linkQuality.unifiRssi, buffer, &offset);
2984 CsrUint16Des((u16 *) &primitive->linkQuality.unifiSnr, buffer, &offset);
2985
2986 return primitive;
2987}
2988
2989
2990size_t CsrWifiSmeConnectionStatsGetCfmSizeof(void *msg)
2991{
2992 size_t bufferSize = 2;
2993
2994 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 101) */
2995 bufferSize += 2; /* u16 primitive->interfaceTag */
2996 bufferSize += 2; /* CsrResult primitive->status */
2997 bufferSize += 1; /* u8 primitive->connectionStats.unifiTxDataRate */
2998 bufferSize += 1; /* u8 primitive->connectionStats.unifiRxDataRate */
2999 bufferSize += 4; /* u32 primitive->connectionStats.dot11RetryCount */
3000 bufferSize += 4; /* u32 primitive->connectionStats.dot11MultipleRetryCount */
3001 bufferSize += 4; /* u32 primitive->connectionStats.dot11AckFailureCount */
3002 bufferSize += 4; /* u32 primitive->connectionStats.dot11FrameDuplicateCount */
3003 bufferSize += 4; /* u32 primitive->connectionStats.dot11FcsErrorCount */
3004 bufferSize += 4; /* u32 primitive->connectionStats.dot11RtsSuccessCount */
3005 bufferSize += 4; /* u32 primitive->connectionStats.dot11RtsFailureCount */
3006 bufferSize += 4; /* u32 primitive->connectionStats.dot11FailedCount */
3007 bufferSize += 4; /* u32 primitive->connectionStats.dot11TransmittedFragmentCount */
3008 bufferSize += 4; /* u32 primitive->connectionStats.dot11TransmittedFrameCount */
3009 bufferSize += 4; /* u32 primitive->connectionStats.dot11WepExcludedCount */
3010 bufferSize += 4; /* u32 primitive->connectionStats.dot11WepIcvErrorCount */
3011 bufferSize += 4; /* u32 primitive->connectionStats.dot11WepUndecryptableCount */
3012 bufferSize += 4; /* u32 primitive->connectionStats.dot11MulticastReceivedFrameCount */
3013 bufferSize += 4; /* u32 primitive->connectionStats.dot11MulticastTransmittedFrameCount */
3014 bufferSize += 4; /* u32 primitive->connectionStats.dot11ReceivedFragmentCount */
3015 bufferSize += 4; /* u32 primitive->connectionStats.dot11Rsna4WayHandshakeFailures */
3016 bufferSize += 4; /* u32 primitive->connectionStats.dot11RsnaTkipCounterMeasuresInvoked */
3017 bufferSize += 4; /* u32 primitive->connectionStats.dot11RsnaStatsTkipLocalMicFailures */
3018 bufferSize += 4; /* u32 primitive->connectionStats.dot11RsnaStatsTkipReplays */
3019 bufferSize += 4; /* u32 primitive->connectionStats.dot11RsnaStatsTkipIcvErrors */
3020 bufferSize += 4; /* u32 primitive->connectionStats.dot11RsnaStatsCcmpReplays */
3021 bufferSize += 4; /* u32 primitive->connectionStats.dot11RsnaStatsCcmpDecryptErrors */
3022 return bufferSize;
3023}
3024
3025
3026u8* CsrWifiSmeConnectionStatsGetCfmSer(u8 *ptr, size_t *len, void *msg)
3027{
3028 CsrWifiSmeConnectionStatsGetCfm *primitive = (CsrWifiSmeConnectionStatsGetCfm *)msg;
3029 *len = 0;
3030 CsrUint16Ser(ptr, len, primitive->common.type);
3031 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
3032 CsrUint16Ser(ptr, len, (u16) primitive->status);
3033 CsrUint8Ser(ptr, len, (u8) primitive->connectionStats.unifiTxDataRate);
3034 CsrUint8Ser(ptr, len, (u8) primitive->connectionStats.unifiRxDataRate);
3035 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RetryCount);
3036 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11MultipleRetryCount);
3037 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11AckFailureCount);
3038 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11FrameDuplicateCount);
3039 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11FcsErrorCount);
3040 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RtsSuccessCount);
3041 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RtsFailureCount);
3042 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11FailedCount);
3043 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11TransmittedFragmentCount);
3044 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11TransmittedFrameCount);
3045 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11WepExcludedCount);
3046 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11WepIcvErrorCount);
3047 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11WepUndecryptableCount);
3048 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11MulticastReceivedFrameCount);
3049 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11MulticastTransmittedFrameCount);
3050 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11ReceivedFragmentCount);
3051 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11Rsna4WayHandshakeFailures);
3052 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RsnaTkipCounterMeasuresInvoked);
3053 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RsnaStatsTkipLocalMicFailures);
3054 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RsnaStatsTkipReplays);
3055 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RsnaStatsTkipIcvErrors);
3056 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RsnaStatsCcmpReplays);
3057 CsrUint32Ser(ptr, len, (u32) primitive->connectionStats.dot11RsnaStatsCcmpDecryptErrors);
3058 return(ptr);
3059}
3060
3061
3062void* CsrWifiSmeConnectionStatsGetCfmDes(u8 *buffer, size_t length)
3063{
3064 CsrWifiSmeConnectionStatsGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeConnectionStatsGetCfm), GFP_KERNEL);
3065 size_t offset;
3066 offset = 0;
3067
3068 CsrUint16Des(&primitive->common.type, buffer, &offset);
3069 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
3070 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
3071 CsrUint8Des((u8 *) &primitive->connectionStats.unifiTxDataRate, buffer, &offset);
3072 CsrUint8Des((u8 *) &primitive->connectionStats.unifiRxDataRate, buffer, &offset);
3073 CsrUint32Des((u32 *) &primitive->connectionStats.dot11RetryCount, buffer, &offset);
3074 CsrUint32Des((u32 *) &primitive->connectionStats.dot11MultipleRetryCount, buffer, &offset);
3075 CsrUint32Des((u32 *) &primitive->connectionStats.dot11AckFailureCount, buffer, &offset);
3076 CsrUint32Des((u32 *) &primitive->connectionStats.dot11FrameDuplicateCount, buffer, &offset);
3077 CsrUint32Des((u32 *) &primitive->connectionStats.dot11FcsErrorCount, buffer, &offset);
3078 CsrUint32Des((u32 *) &primitive->connectionStats.dot11RtsSuccessCount, buffer, &offset);
3079 CsrUint32Des((u32 *) &primitive->connectionStats.dot11RtsFailureCount, buffer, &offset);
3080 CsrUint32Des((u32 *) &primitive->connectionStats.dot11FailedCount, buffer, &offset);
3081 CsrUint32Des((u32 *) &primitive->connectionStats.dot11TransmittedFragmentCount, buffer, &offset);
3082 CsrUint32Des((u32 *) &primitive->connectionStats.dot11TransmittedFrameCount, buffer, &offset);
3083 CsrUint32Des((u32 *) &primitive->connectionStats.dot11WepExcludedCount, buffer, &offset);
3084 CsrUint32Des((u32 *) &primitive->connectionStats.dot11WepIcvErrorCount, buffer, &offset);
3085 CsrUint32Des((u32 *) &primitive->connectionStats.dot11WepUndecryptableCount, buffer, &offset);
3086 CsrUint32Des((u32 *) &primitive->connectionStats.dot11MulticastReceivedFrameCount, buffer, &offset);
3087 CsrUint32Des((u32 *) &primitive->connectionStats.dot11MulticastTransmittedFrameCount, buffer, &offset);
3088 CsrUint32Des((u32 *) &primitive->connectionStats.dot11ReceivedFragmentCount, buffer, &offset);
3089 CsrUint32Des((u32 *) &primitive->connectionStats.dot11Rsna4WayHandshakeFailures, buffer, &offset);
3090 CsrUint32Des((u32 *) &primitive->connectionStats.dot11RsnaTkipCounterMeasuresInvoked, buffer, &offset);
3091 CsrUint32Des((u32 *) &primitive->connectionStats.dot11RsnaStatsTkipLocalMicFailures, buffer, &offset);
3092 CsrUint32Des((u32 *) &primitive->connectionStats.dot11RsnaStatsTkipReplays, buffer, &offset);
3093 CsrUint32Des((u32 *) &primitive->connectionStats.dot11RsnaStatsTkipIcvErrors, buffer, &offset);
3094 CsrUint32Des((u32 *) &primitive->connectionStats.dot11RsnaStatsCcmpReplays, buffer, &offset);
3095 CsrUint32Des((u32 *) &primitive->connectionStats.dot11RsnaStatsCcmpDecryptErrors, buffer, &offset);
3096
3097 return primitive;
3098}
3099
3100
3101size_t CsrWifiSmeDisconnectCfmSizeof(void *msg)
3102{
3103 size_t bufferSize = 2;
3104
3105 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */
3106 bufferSize += 2; /* u16 primitive->interfaceTag */
3107 bufferSize += 2; /* CsrResult primitive->status */
3108 return bufferSize;
3109}
3110
3111
3112u8* CsrWifiSmeDisconnectCfmSer(u8 *ptr, size_t *len, void *msg)
3113{
3114 CsrWifiSmeDisconnectCfm *primitive = (CsrWifiSmeDisconnectCfm *)msg;
3115 *len = 0;
3116 CsrUint16Ser(ptr, len, primitive->common.type);
3117 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
3118 CsrUint16Ser(ptr, len, (u16) primitive->status);
3119 return(ptr);
3120}
3121
3122
3123void* CsrWifiSmeDisconnectCfmDes(u8 *buffer, size_t length)
3124{
3125 CsrWifiSmeDisconnectCfm *primitive = kmalloc(sizeof(CsrWifiSmeDisconnectCfm), GFP_KERNEL);
3126 size_t offset;
3127 offset = 0;
3128
3129 CsrUint16Des(&primitive->common.type, buffer, &offset);
3130 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
3131 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
3132
3133 return primitive;
3134}
3135
3136
3137size_t CsrWifiSmeHostConfigGetCfmSizeof(void *msg)
3138{
3139 size_t bufferSize = 2;
3140
3141 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */
3142 bufferSize += 2; /* u16 primitive->interfaceTag */
3143 bufferSize += 2; /* CsrResult primitive->status */
3144 bufferSize += 1; /* CsrWifiSmeHostPowerMode primitive->hostConfig.powerMode */
3145 bufferSize += 2; /* u16 primitive->hostConfig.applicationDataPeriodMs */
3146 return bufferSize;
3147}
3148
3149
3150u8* CsrWifiSmeHostConfigGetCfmSer(u8 *ptr, size_t *len, void *msg)
3151{
3152 CsrWifiSmeHostConfigGetCfm *primitive = (CsrWifiSmeHostConfigGetCfm *)msg;
3153 *len = 0;
3154 CsrUint16Ser(ptr, len, primitive->common.type);
3155 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
3156 CsrUint16Ser(ptr, len, (u16) primitive->status);
3157 CsrUint8Ser(ptr, len, (u8) primitive->hostConfig.powerMode);
3158 CsrUint16Ser(ptr, len, (u16) primitive->hostConfig.applicationDataPeriodMs);
3159 return(ptr);
3160}
3161
3162
3163void* CsrWifiSmeHostConfigGetCfmDes(u8 *buffer, size_t length)
3164{
3165 CsrWifiSmeHostConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeHostConfigGetCfm), GFP_KERNEL);
3166 size_t offset;
3167 offset = 0;
3168
3169 CsrUint16Des(&primitive->common.type, buffer, &offset);
3170 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
3171 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
3172 CsrUint8Des((u8 *) &primitive->hostConfig.powerMode, buffer, &offset);
3173 CsrUint16Des((u16 *) &primitive->hostConfig.applicationDataPeriodMs, buffer, &offset);
3174
3175 return primitive;
3176}
3177
3178
3179size_t CsrWifiSmeHostConfigSetCfmSizeof(void *msg)
3180{
3181 size_t bufferSize = 2;
3182
3183 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */
3184 bufferSize += 2; /* u16 primitive->interfaceTag */
3185 bufferSize += 2; /* CsrResult primitive->status */
3186 return bufferSize;
3187}
3188
3189
3190u8* CsrWifiSmeHostConfigSetCfmSer(u8 *ptr, size_t *len, void *msg)
3191{
3192 CsrWifiSmeHostConfigSetCfm *primitive = (CsrWifiSmeHostConfigSetCfm *)msg;
3193 *len = 0;
3194 CsrUint16Ser(ptr, len, primitive->common.type);
3195 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
3196 CsrUint16Ser(ptr, len, (u16) primitive->status);
3197 return(ptr);
3198}
3199
3200
3201void* CsrWifiSmeHostConfigSetCfmDes(u8 *buffer, size_t length)
3202{
3203 CsrWifiSmeHostConfigSetCfm *primitive = kmalloc(sizeof(CsrWifiSmeHostConfigSetCfm), GFP_KERNEL);
3204 size_t offset;
3205 offset = 0;
3206
3207 CsrUint16Des(&primitive->common.type, buffer, &offset);
3208 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
3209 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
3210
3211 return primitive;
3212}
3213
3214
3215size_t CsrWifiSmeIbssStationIndSizeof(void *msg)
3216{
3217 size_t bufferSize = 2;
3218
3219 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */
3220 bufferSize += 6; /* u8 primitive->address.a[6] */
3221 bufferSize += 1; /* u8 primitive->isconnected */
3222 return bufferSize;
3223}
3224
3225
3226u8* CsrWifiSmeIbssStationIndSer(u8 *ptr, size_t *len, void *msg)
3227{
3228 CsrWifiSmeIbssStationInd *primitive = (CsrWifiSmeIbssStationInd *)msg;
3229 *len = 0;
3230 CsrUint16Ser(ptr, len, primitive->common.type);
3231 CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((u16) (6)));
3232 CsrUint8Ser(ptr, len, (u8) primitive->isconnected);
3233 return(ptr);
3234}
3235
3236
3237void* CsrWifiSmeIbssStationIndDes(u8 *buffer, size_t length)
3238{
3239 CsrWifiSmeIbssStationInd *primitive = kmalloc(sizeof(CsrWifiSmeIbssStationInd), GFP_KERNEL);
3240 size_t offset;
3241 offset = 0;
3242
3243 CsrUint16Des(&primitive->common.type, buffer, &offset);
3244 CsrMemCpyDes(primitive->address.a, buffer, &offset, ((u16) (6)));
3245 CsrUint8Des((u8 *) &primitive->isconnected, buffer, &offset);
3246
3247 return primitive;
3248}
3249
3250
3251size_t CsrWifiSmeKeyCfmSizeof(void *msg)
3252{
3253 size_t bufferSize = 2;
3254
3255 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */
3256 bufferSize += 2; /* u16 primitive->interfaceTag */
3257 bufferSize += 2; /* CsrResult primitive->status */
3258 bufferSize += 1; /* CsrWifiSmeListAction primitive->action */
3259 bufferSize += 1; /* CsrWifiSmeKeyType primitive->keyType */
3260 bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */
3261 return bufferSize;
3262}
3263
3264
3265u8* CsrWifiSmeKeyCfmSer(u8 *ptr, size_t *len, void *msg)
3266{
3267 CsrWifiSmeKeyCfm *primitive = (CsrWifiSmeKeyCfm *)msg;
3268 *len = 0;
3269 CsrUint16Ser(ptr, len, primitive->common.type);
3270 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
3271 CsrUint16Ser(ptr, len, (u16) primitive->status);
3272 CsrUint8Ser(ptr, len, (u8) primitive->action);
3273 CsrUint8Ser(ptr, len, (u8) primitive->keyType);
3274 CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6)));
3275 return(ptr);
3276}
3277
3278
3279void* CsrWifiSmeKeyCfmDes(u8 *buffer, size_t length)
3280{
3281 CsrWifiSmeKeyCfm *primitive = kmalloc(sizeof(CsrWifiSmeKeyCfm), GFP_KERNEL);
3282 size_t offset;
3283 offset = 0;
3284
3285 CsrUint16Des(&primitive->common.type, buffer, &offset);
3286 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
3287 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
3288 CsrUint8Des((u8 *) &primitive->action, buffer, &offset);
3289 CsrUint8Des((u8 *) &primitive->keyType, buffer, &offset);
3290 CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6)));
3291
3292 return primitive;
3293}
3294
3295
3296size_t CsrWifiSmeLinkQualityGetCfmSizeof(void *msg)
3297{
3298 size_t bufferSize = 2;
3299
3300 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */
3301 bufferSize += 2; /* u16 primitive->interfaceTag */
3302 bufferSize += 2; /* CsrResult primitive->status */
3303 bufferSize += 2; /* s16 primitive->linkQuality.unifiRssi */
3304 bufferSize += 2; /* s16 primitive->linkQuality.unifiSnr */
3305 return bufferSize;
3306}
3307
3308
3309u8* CsrWifiSmeLinkQualityGetCfmSer(u8 *ptr, size_t *len, void *msg)
3310{
3311 CsrWifiSmeLinkQualityGetCfm *primitive = (CsrWifiSmeLinkQualityGetCfm *)msg;
3312 *len = 0;
3313 CsrUint16Ser(ptr, len, primitive->common.type);
3314 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
3315 CsrUint16Ser(ptr, len, (u16) primitive->status);
3316 CsrUint16Ser(ptr, len, (u16) primitive->linkQuality.unifiRssi);
3317 CsrUint16Ser(ptr, len, (u16) primitive->linkQuality.unifiSnr);
3318 return(ptr);
3319}
3320
3321
3322void* CsrWifiSmeLinkQualityGetCfmDes(u8 *buffer, size_t length)
3323{
3324 CsrWifiSmeLinkQualityGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeLinkQualityGetCfm), GFP_KERNEL);
3325 size_t offset;
3326 offset = 0;
3327
3328 CsrUint16Des(&primitive->common.type, buffer, &offset);
3329 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
3330 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
3331 CsrUint16Des((u16 *) &primitive->linkQuality.unifiRssi, buffer, &offset);
3332 CsrUint16Des((u16 *) &primitive->linkQuality.unifiSnr, buffer, &offset);
3333
3334 return primitive;
3335}
3336
3337
3338size_t CsrWifiSmeMediaStatusIndSizeof(void *msg)
3339{
3340 CsrWifiSmeMediaStatusInd *primitive = (CsrWifiSmeMediaStatusInd *) msg;
3341 size_t bufferSize = 2;
3342
3343 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 99) */
3344 bufferSize += 2; /* u16 primitive->interfaceTag */
3345 bufferSize += 1; /* CsrWifiSmeMediaStatus primitive->mediaStatus */
3346 bufferSize += 32; /* u8 primitive->connectionInfo.ssid.ssid[32] */
3347 bufferSize += 1; /* u8 primitive->connectionInfo.ssid.length */
3348 bufferSize += 6; /* u8 primitive->connectionInfo.bssid.a[6] */
3349 bufferSize += 1; /* CsrWifiSme80211NetworkType primitive->connectionInfo.networkType80211 */
3350 bufferSize += 1; /* u8 primitive->connectionInfo.channelNumber */
3351 bufferSize += 2; /* u16 primitive->connectionInfo.channelFrequency */
3352 bufferSize += 2; /* CsrWifiSmeAuthMode primitive->connectionInfo.authMode */
3353 bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.pairwiseCipher */
3354 bufferSize += 2; /* CsrWifiSmeEncryption primitive->connectionInfo.groupCipher */
3355 bufferSize += 1; /* CsrWifiSmeRadioIF primitive->connectionInfo.ifIndex */
3356 bufferSize += 2; /* u16 primitive->connectionInfo.atimWindowTu */
3357 bufferSize += 2; /* u16 primitive->connectionInfo.beaconPeriodTu */
3358 bufferSize += 1; /* u8 primitive->connectionInfo.reassociation */
3359 bufferSize += 2; /* u16 primitive->connectionInfo.beaconFrameLength */
3360 bufferSize += primitive->connectionInfo.beaconFrameLength; /* u8 primitive->connectionInfo.beaconFrame */
3361 bufferSize += 2; /* u16 primitive->connectionInfo.associationReqFrameLength */
3362 bufferSize += primitive->connectionInfo.associationReqFrameLength; /* u8 primitive->connectionInfo.associationReqFrame */
3363 bufferSize += 2; /* u16 primitive->connectionInfo.associationRspFrameLength */
3364 bufferSize += primitive->connectionInfo.associationRspFrameLength; /* u8 primitive->connectionInfo.associationRspFrame */
3365 bufferSize += 2; /* u16 primitive->connectionInfo.assocScanInfoElementsLength */
3366 bufferSize += primitive->connectionInfo.assocScanInfoElementsLength; /* u8 primitive->connectionInfo.assocScanInfoElements */
3367 bufferSize += 2; /* u16 primitive->connectionInfo.assocReqCapabilities */
3368 bufferSize += 2; /* u16 primitive->connectionInfo.assocReqListenIntervalTu */
3369 bufferSize += 6; /* u8 primitive->connectionInfo.assocReqApAddress.a[6] */
3370 bufferSize += 2; /* u16 primitive->connectionInfo.assocReqInfoElementsLength */
3371 bufferSize += primitive->connectionInfo.assocReqInfoElementsLength; /* u8 primitive->connectionInfo.assocReqInfoElements */
3372 bufferSize += 2; /* CsrWifiSmeIEEE80211Result primitive->connectionInfo.assocRspResult */
3373 bufferSize += 2; /* u16 primitive->connectionInfo.assocRspCapabilityInfo */
3374 bufferSize += 2; /* u16 primitive->connectionInfo.assocRspAssociationId */
3375 bufferSize += 2; /* u16 primitive->connectionInfo.assocRspInfoElementsLength */
3376 bufferSize += primitive->connectionInfo.assocRspInfoElementsLength; /* u8 primitive->connectionInfo.assocRspInfoElements */
3377 bufferSize += 2; /* CsrWifiSmeIEEE80211Reason primitive->disassocReason */
3378 bufferSize += 2; /* CsrWifiSmeIEEE80211Reason primitive->deauthReason */
3379 return bufferSize;
3380}
3381
3382
3383u8* CsrWifiSmeMediaStatusIndSer(u8 *ptr, size_t *len, void *msg)
3384{
3385 CsrWifiSmeMediaStatusInd *primitive = (CsrWifiSmeMediaStatusInd *)msg;
3386 *len = 0;
3387 CsrUint16Ser(ptr, len, primitive->common.type);
3388 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
3389 CsrUint8Ser(ptr, len, (u8) primitive->mediaStatus);
3390 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.ssid.ssid, ((u16) (32)));
3391 CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ssid.length);
3392 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.bssid.a, ((u16) (6)));
3393 CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.networkType80211);
3394 CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.channelNumber);
3395 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.channelFrequency);
3396 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.authMode);
3397 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.pairwiseCipher);
3398 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.groupCipher);
3399 CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.ifIndex);
3400 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.atimWindowTu);
3401 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.beaconPeriodTu);
3402 CsrUint8Ser(ptr, len, (u8) primitive->connectionInfo.reassociation);
3403 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.beaconFrameLength);
3404 if (primitive->connectionInfo.beaconFrameLength)
3405 {
3406 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.beaconFrame, ((u16) (primitive->connectionInfo.beaconFrameLength)));
3407 }
3408 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.associationReqFrameLength);
3409 if (primitive->connectionInfo.associationReqFrameLength)
3410 {
3411 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationReqFrame, ((u16) (primitive->connectionInfo.associationReqFrameLength)));
3412 }
3413 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.associationRspFrameLength);
3414 if (primitive->connectionInfo.associationRspFrameLength)
3415 {
3416 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.associationRspFrame, ((u16) (primitive->connectionInfo.associationRspFrameLength)));
3417 }
3418 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocScanInfoElementsLength);
3419 if (primitive->connectionInfo.assocScanInfoElementsLength)
3420 {
3421 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocScanInfoElements, ((u16) (primitive->connectionInfo.assocScanInfoElementsLength)));
3422 }
3423 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqCapabilities);
3424 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqListenIntervalTu);
3425 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqApAddress.a, ((u16) (6)));
3426 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocReqInfoElementsLength);
3427 if (primitive->connectionInfo.assocReqInfoElementsLength)
3428 {
3429 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocReqInfoElements, ((u16) (primitive->connectionInfo.assocReqInfoElementsLength)));
3430 }
3431 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspResult);
3432 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspCapabilityInfo);
3433 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspAssociationId);
3434 CsrUint16Ser(ptr, len, (u16) primitive->connectionInfo.assocRspInfoElementsLength);
3435 if (primitive->connectionInfo.assocRspInfoElementsLength)
3436 {
3437 CsrMemCpySer(ptr, len, (const void *) primitive->connectionInfo.assocRspInfoElements, ((u16) (primitive->connectionInfo.assocRspInfoElementsLength)));
3438 }
3439 CsrUint16Ser(ptr, len, (u16) primitive->disassocReason);
3440 CsrUint16Ser(ptr, len, (u16) primitive->deauthReason);
3441 return(ptr);
3442}
3443
3444
3445void* CsrWifiSmeMediaStatusIndDes(u8 *buffer, size_t length)
3446{
3447 CsrWifiSmeMediaStatusInd *primitive = kmalloc(sizeof(CsrWifiSmeMediaStatusInd), GFP_KERNEL);
3448 size_t offset;
3449 offset = 0;
3450
3451 CsrUint16Des(&primitive->common.type, buffer, &offset);
3452 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
3453 CsrUint8Des((u8 *) &primitive->mediaStatus, buffer, &offset);
3454 CsrMemCpyDes(primitive->connectionInfo.ssid.ssid, buffer, &offset, ((u16) (32)));
3455 CsrUint8Des((u8 *) &primitive->connectionInfo.ssid.length, buffer, &offset);
3456 CsrMemCpyDes(primitive->connectionInfo.bssid.a, buffer, &offset, ((u16) (6)));
3457 CsrUint8Des((u8 *) &primitive->connectionInfo.networkType80211, buffer, &offset);
3458 CsrUint8Des((u8 *) &primitive->connectionInfo.channelNumber, buffer, &offset);
3459 CsrUint16Des((u16 *) &primitive->connectionInfo.channelFrequency, buffer, &offset);
3460 CsrUint16Des((u16 *) &primitive->connectionInfo.authMode, buffer, &offset);
3461 CsrUint16Des((u16 *) &primitive->connectionInfo.pairwiseCipher, buffer, &offset);
3462 CsrUint16Des((u16 *) &primitive->connectionInfo.groupCipher, buffer, &offset);
3463 CsrUint8Des((u8 *) &primitive->connectionInfo.ifIndex, buffer, &offset);
3464 CsrUint16Des((u16 *) &primitive->connectionInfo.atimWindowTu, buffer, &offset);
3465 CsrUint16Des((u16 *) &primitive->connectionInfo.beaconPeriodTu, buffer, &offset);
3466 CsrUint8Des((u8 *) &primitive->connectionInfo.reassociation, buffer, &offset);
3467 CsrUint16Des((u16 *) &primitive->connectionInfo.beaconFrameLength, buffer, &offset);
3468 if (primitive->connectionInfo.beaconFrameLength)
3469 {
3470 primitive->connectionInfo.beaconFrame = kmalloc(primitive->connectionInfo.beaconFrameLength, GFP_KERNEL);
3471 CsrMemCpyDes(primitive->connectionInfo.beaconFrame, buffer, &offset, ((u16) (primitive->connectionInfo.beaconFrameLength)));
3472 }
3473 else
3474 {
3475 primitive->connectionInfo.beaconFrame = NULL;
3476 }
3477 CsrUint16Des((u16 *) &primitive->connectionInfo.associationReqFrameLength, buffer, &offset);
3478 if (primitive->connectionInfo.associationReqFrameLength)
3479 {
3480 primitive->connectionInfo.associationReqFrame = kmalloc(primitive->connectionInfo.associationReqFrameLength, GFP_KERNEL);
3481 CsrMemCpyDes(primitive->connectionInfo.associationReqFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationReqFrameLength)));
3482 }
3483 else
3484 {
3485 primitive->connectionInfo.associationReqFrame = NULL;
3486 }
3487 CsrUint16Des((u16 *) &primitive->connectionInfo.associationRspFrameLength, buffer, &offset);
3488 if (primitive->connectionInfo.associationRspFrameLength)
3489 {
3490 primitive->connectionInfo.associationRspFrame = kmalloc(primitive->connectionInfo.associationRspFrameLength, GFP_KERNEL);
3491 CsrMemCpyDes(primitive->connectionInfo.associationRspFrame, buffer, &offset, ((u16) (primitive->connectionInfo.associationRspFrameLength)));
3492 }
3493 else
3494 {
3495 primitive->connectionInfo.associationRspFrame = NULL;
3496 }
3497 CsrUint16Des((u16 *) &primitive->connectionInfo.assocScanInfoElementsLength, buffer, &offset);
3498 if (primitive->connectionInfo.assocScanInfoElementsLength)
3499 {
3500 primitive->connectionInfo.assocScanInfoElements = kmalloc(primitive->connectionInfo.assocScanInfoElementsLength, GFP_KERNEL);
3501 CsrMemCpyDes(primitive->connectionInfo.assocScanInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocScanInfoElementsLength)));
3502 }
3503 else
3504 {
3505 primitive->connectionInfo.assocScanInfoElements = NULL;
3506 }
3507 CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqCapabilities, buffer, &offset);
3508 CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqListenIntervalTu, buffer, &offset);
3509 CsrMemCpyDes(primitive->connectionInfo.assocReqApAddress.a, buffer, &offset, ((u16) (6)));
3510 CsrUint16Des((u16 *) &primitive->connectionInfo.assocReqInfoElementsLength, buffer, &offset);
3511 if (primitive->connectionInfo.assocReqInfoElementsLength)
3512 {
3513 primitive->connectionInfo.assocReqInfoElements = kmalloc(primitive->connectionInfo.assocReqInfoElementsLength, GFP_KERNEL);
3514 CsrMemCpyDes(primitive->connectionInfo.assocReqInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocReqInfoElementsLength)));
3515 }
3516 else
3517 {
3518 primitive->connectionInfo.assocReqInfoElements = NULL;
3519 }
3520 CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspResult, buffer, &offset);
3521 CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspCapabilityInfo, buffer, &offset);
3522 CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspAssociationId, buffer, &offset);
3523 CsrUint16Des((u16 *) &primitive->connectionInfo.assocRspInfoElementsLength, buffer, &offset);
3524 if (primitive->connectionInfo.assocRspInfoElementsLength)
3525 {
3526 primitive->connectionInfo.assocRspInfoElements = kmalloc(primitive->connectionInfo.assocRspInfoElementsLength, GFP_KERNEL);
3527 CsrMemCpyDes(primitive->connectionInfo.assocRspInfoElements, buffer, &offset, ((u16) (primitive->connectionInfo.assocRspInfoElementsLength)));
3528 }
3529 else
3530 {
3531 primitive->connectionInfo.assocRspInfoElements = NULL;
3532 }
3533 CsrUint16Des((u16 *) &primitive->disassocReason, buffer, &offset);
3534 CsrUint16Des((u16 *) &primitive->deauthReason, buffer, &offset);
3535
3536 return primitive;
3537}
3538
3539
3540void CsrWifiSmeMediaStatusIndSerFree(void *voidPrimitivePointer)
3541{
3542 CsrWifiSmeMediaStatusInd *primitive = (CsrWifiSmeMediaStatusInd *) voidPrimitivePointer;
3543 kfree(primitive->connectionInfo.beaconFrame);
3544 kfree(primitive->connectionInfo.associationReqFrame);
3545 kfree(primitive->connectionInfo.associationRspFrame);
3546 kfree(primitive->connectionInfo.assocScanInfoElements);
3547 kfree(primitive->connectionInfo.assocReqInfoElements);
3548 kfree(primitive->connectionInfo.assocRspInfoElements);
3549 kfree(primitive);
3550}
3551
3552
3553size_t CsrWifiSmeMibConfigGetCfmSizeof(void *msg)
3554{
3555 size_t bufferSize = 2;
3556
3557 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */
3558 bufferSize += 2; /* CsrResult primitive->status */
3559 bufferSize += 1; /* u8 primitive->mibConfig.unifiFixMaxTxDataRate */
3560 bufferSize += 1; /* u8 primitive->mibConfig.unifiFixTxDataRate */
3561 bufferSize += 2; /* u16 primitive->mibConfig.dot11RtsThreshold */
3562 bufferSize += 2; /* u16 primitive->mibConfig.dot11FragmentationThreshold */
3563 bufferSize += 2; /* u16 primitive->mibConfig.dot11CurrentTxPowerLevel */
3564 return bufferSize;
3565}
3566
3567
3568u8* CsrWifiSmeMibConfigGetCfmSer(u8 *ptr, size_t *len, void *msg)
3569{
3570 CsrWifiSmeMibConfigGetCfm *primitive = (CsrWifiSmeMibConfigGetCfm *)msg;
3571 *len = 0;
3572 CsrUint16Ser(ptr, len, primitive->common.type);
3573 CsrUint16Ser(ptr, len, (u16) primitive->status);
3574 CsrUint8Ser(ptr, len, (u8) primitive->mibConfig.unifiFixMaxTxDataRate);
3575 CsrUint8Ser(ptr, len, (u8) primitive->mibConfig.unifiFixTxDataRate);
3576 CsrUint16Ser(ptr, len, (u16) primitive->mibConfig.dot11RtsThreshold);
3577 CsrUint16Ser(ptr, len, (u16) primitive->mibConfig.dot11FragmentationThreshold);
3578 CsrUint16Ser(ptr, len, (u16) primitive->mibConfig.dot11CurrentTxPowerLevel);
3579 return(ptr);
3580}
3581
3582
3583void* CsrWifiSmeMibConfigGetCfmDes(u8 *buffer, size_t length)
3584{
3585 CsrWifiSmeMibConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeMibConfigGetCfm), GFP_KERNEL);
3586 size_t offset;
3587 offset = 0;
3588
3589 CsrUint16Des(&primitive->common.type, buffer, &offset);
3590 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
3591 CsrUint8Des((u8 *) &primitive->mibConfig.unifiFixMaxTxDataRate, buffer, &offset);
3592 CsrUint8Des((u8 *) &primitive->mibConfig.unifiFixTxDataRate, buffer, &offset);
3593 CsrUint16Des((u16 *) &primitive->mibConfig.dot11RtsThreshold, buffer, &offset);
3594 CsrUint16Des((u16 *) &primitive->mibConfig.dot11FragmentationThreshold, buffer, &offset);
3595 CsrUint16Des((u16 *) &primitive->mibConfig.dot11CurrentTxPowerLevel, buffer, &offset);
3596
3597 return primitive;
3598}
3599
3600
3601size_t CsrWifiSmeMibGetCfmSizeof(void *msg)
3602{
3603 CsrWifiSmeMibGetCfm *primitive = (CsrWifiSmeMibGetCfm *) msg;
3604 size_t bufferSize = 2;
3605
3606 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */
3607 bufferSize += 2; /* CsrResult primitive->status */
3608 bufferSize += 2; /* u16 primitive->mibAttributeLength */
3609 bufferSize += primitive->mibAttributeLength; /* u8 primitive->mibAttribute */
3610 return bufferSize;
3611}
3612
3613
3614u8* CsrWifiSmeMibGetCfmSer(u8 *ptr, size_t *len, void *msg)
3615{
3616 CsrWifiSmeMibGetCfm *primitive = (CsrWifiSmeMibGetCfm *)msg;
3617 *len = 0;
3618 CsrUint16Ser(ptr, len, primitive->common.type);
3619 CsrUint16Ser(ptr, len, (u16) primitive->status);
3620 CsrUint16Ser(ptr, len, (u16) primitive->mibAttributeLength);
3621 if (primitive->mibAttributeLength)
3622 {
3623 CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((u16) (primitive->mibAttributeLength)));
3624 }
3625 return(ptr);
3626}
3627
3628
3629void* CsrWifiSmeMibGetCfmDes(u8 *buffer, size_t length)
3630{
3631 CsrWifiSmeMibGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeMibGetCfm), GFP_KERNEL);
3632 size_t offset;
3633 offset = 0;
3634
3635 CsrUint16Des(&primitive->common.type, buffer, &offset);
3636 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
3637 CsrUint16Des((u16 *) &primitive->mibAttributeLength, buffer, &offset);
3638 if (primitive->mibAttributeLength)
3639 {
3640 primitive->mibAttribute = kmalloc(primitive->mibAttributeLength, GFP_KERNEL);
3641 CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((u16) (primitive->mibAttributeLength)));
3642 }
3643 else
3644 {
3645 primitive->mibAttribute = NULL;
3646 }
3647
3648 return primitive;
3649}
3650
3651
3652void CsrWifiSmeMibGetCfmSerFree(void *voidPrimitivePointer)
3653{
3654 CsrWifiSmeMibGetCfm *primitive = (CsrWifiSmeMibGetCfm *) voidPrimitivePointer;
3655 kfree(primitive->mibAttribute);
3656 kfree(primitive);
3657}
3658
3659
3660size_t CsrWifiSmeMibGetNextCfmSizeof(void *msg)
3661{
3662 CsrWifiSmeMibGetNextCfm *primitive = (CsrWifiSmeMibGetNextCfm *) msg;
3663 size_t bufferSize = 2;
3664
3665 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */
3666 bufferSize += 2; /* CsrResult primitive->status */
3667 bufferSize += 2; /* u16 primitive->mibAttributeLength */
3668 bufferSize += primitive->mibAttributeLength; /* u8 primitive->mibAttribute */
3669 return bufferSize;
3670}
3671
3672
3673u8* CsrWifiSmeMibGetNextCfmSer(u8 *ptr, size_t *len, void *msg)
3674{
3675 CsrWifiSmeMibGetNextCfm *primitive = (CsrWifiSmeMibGetNextCfm *)msg;
3676 *len = 0;
3677 CsrUint16Ser(ptr, len, primitive->common.type);
3678 CsrUint16Ser(ptr, len, (u16) primitive->status);
3679 CsrUint16Ser(ptr, len, (u16) primitive->mibAttributeLength);
3680 if (primitive->mibAttributeLength)
3681 {
3682 CsrMemCpySer(ptr, len, (const void *) primitive->mibAttribute, ((u16) (primitive->mibAttributeLength)));
3683 }
3684 return(ptr);
3685}
3686
3687
3688void* CsrWifiSmeMibGetNextCfmDes(u8 *buffer, size_t length)
3689{
3690 CsrWifiSmeMibGetNextCfm *primitive = kmalloc(sizeof(CsrWifiSmeMibGetNextCfm), GFP_KERNEL);
3691 size_t offset;
3692 offset = 0;
3693
3694 CsrUint16Des(&primitive->common.type, buffer, &offset);
3695 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
3696 CsrUint16Des((u16 *) &primitive->mibAttributeLength, buffer, &offset);
3697 if (primitive->mibAttributeLength)
3698 {
3699 primitive->mibAttribute = kmalloc(primitive->mibAttributeLength, GFP_KERNEL);
3700 CsrMemCpyDes(primitive->mibAttribute, buffer, &offset, ((u16) (primitive->mibAttributeLength)));
3701 }
3702 else
3703 {
3704 primitive->mibAttribute = NULL;
3705 }
3706
3707 return primitive;
3708}
3709
3710
3711void CsrWifiSmeMibGetNextCfmSerFree(void *voidPrimitivePointer)
3712{
3713 CsrWifiSmeMibGetNextCfm *primitive = (CsrWifiSmeMibGetNextCfm *) voidPrimitivePointer;
3714 kfree(primitive->mibAttribute);
3715 kfree(primitive);
3716}
3717
3718
3719size_t CsrWifiSmeMicFailureIndSizeof(void *msg)
3720{
3721 size_t bufferSize = 2;
3722
3723 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */
3724 bufferSize += 2; /* u16 primitive->interfaceTag */
3725 bufferSize += 1; /* u8 primitive->secondFailure */
3726 bufferSize += 2; /* u16 primitive->count */
3727 bufferSize += 6; /* u8 primitive->address.a[6] */
3728 bufferSize += 1; /* CsrWifiSmeKeyType primitive->keyType */
3729 return bufferSize;
3730}
3731
3732
3733u8* CsrWifiSmeMicFailureIndSer(u8 *ptr, size_t *len, void *msg)
3734{
3735 CsrWifiSmeMicFailureInd *primitive = (CsrWifiSmeMicFailureInd *)msg;
3736 *len = 0;
3737 CsrUint16Ser(ptr, len, primitive->common.type);
3738 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
3739 CsrUint8Ser(ptr, len, (u8) primitive->secondFailure);
3740 CsrUint16Ser(ptr, len, (u16) primitive->count);
3741 CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((u16) (6)));
3742 CsrUint8Ser(ptr, len, (u8) primitive->keyType);
3743 return(ptr);
3744}
3745
3746
3747void* CsrWifiSmeMicFailureIndDes(u8 *buffer, size_t length)
3748{
3749 CsrWifiSmeMicFailureInd *primitive = kmalloc(sizeof(CsrWifiSmeMicFailureInd), GFP_KERNEL);
3750 size_t offset;
3751 offset = 0;
3752
3753 CsrUint16Des(&primitive->common.type, buffer, &offset);
3754 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
3755 CsrUint8Des((u8 *) &primitive->secondFailure, buffer, &offset);
3756 CsrUint16Des((u16 *) &primitive->count, buffer, &offset);
3757 CsrMemCpyDes(primitive->address.a, buffer, &offset, ((u16) (6)));
3758 CsrUint8Des((u8 *) &primitive->keyType, buffer, &offset);
3759
3760 return primitive;
3761}
3762
3763
3764size_t CsrWifiSmeMulticastAddressCfmSizeof(void *msg)
3765{
3766 CsrWifiSmeMulticastAddressCfm *primitive = (CsrWifiSmeMulticastAddressCfm *) msg;
3767 size_t bufferSize = 2;
3768
3769 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */
3770 bufferSize += 2; /* u16 primitive->interfaceTag */
3771 bufferSize += 2; /* CsrResult primitive->status */
3772 bufferSize += 1; /* CsrWifiSmeListAction primitive->action */
3773 bufferSize += 1; /* u8 primitive->getAddressesCount */
3774 {
3775 u16 i1;
3776 for (i1 = 0; i1 < primitive->getAddressesCount; i1++)
3777 {
3778 bufferSize += 6; /* u8 primitive->getAddresses[i1].a[6] */
3779 }
3780 }
3781 return bufferSize;
3782}
3783
3784
3785u8* CsrWifiSmeMulticastAddressCfmSer(u8 *ptr, size_t *len, void *msg)
3786{
3787 CsrWifiSmeMulticastAddressCfm *primitive = (CsrWifiSmeMulticastAddressCfm *)msg;
3788 *len = 0;
3789 CsrUint16Ser(ptr, len, primitive->common.type);
3790 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
3791 CsrUint16Ser(ptr, len, (u16) primitive->status);
3792 CsrUint8Ser(ptr, len, (u8) primitive->action);
3793 CsrUint8Ser(ptr, len, (u8) primitive->getAddressesCount);
3794 {
3795 u16 i1;
3796 for (i1 = 0; i1 < primitive->getAddressesCount; i1++)
3797 {
3798 CsrMemCpySer(ptr, len, (const void *) primitive->getAddresses[i1].a, ((u16) (6)));
3799 }
3800 }
3801 return(ptr);
3802}
3803
3804
3805void* CsrWifiSmeMulticastAddressCfmDes(u8 *buffer, size_t length)
3806{
3807 CsrWifiSmeMulticastAddressCfm *primitive = kmalloc(sizeof(CsrWifiSmeMulticastAddressCfm), GFP_KERNEL);
3808 size_t offset;
3809 offset = 0;
3810
3811 CsrUint16Des(&primitive->common.type, buffer, &offset);
3812 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
3813 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
3814 CsrUint8Des((u8 *) &primitive->action, buffer, &offset);
3815 CsrUint8Des((u8 *) &primitive->getAddressesCount, buffer, &offset);
3816 primitive->getAddresses = NULL;
3817 if (primitive->getAddressesCount)
3818 {
3819 primitive->getAddresses = kmalloc(sizeof(CsrWifiMacAddress) * primitive->getAddressesCount, GFP_KERNEL);
3820 }
3821 {
3822 u16 i1;
3823 for (i1 = 0; i1 < primitive->getAddressesCount; i1++)
3824 {
3825 CsrMemCpyDes(primitive->getAddresses[i1].a, buffer, &offset, ((u16) (6)));
3826 }
3827 }
3828
3829 return primitive;
3830}
3831
3832
3833void CsrWifiSmeMulticastAddressCfmSerFree(void *voidPrimitivePointer)
3834{
3835 CsrWifiSmeMulticastAddressCfm *primitive = (CsrWifiSmeMulticastAddressCfm *) voidPrimitivePointer;
3836 kfree(primitive->getAddresses);
3837 kfree(primitive);
3838}
3839
3840
3841size_t CsrWifiSmePacketFilterSetCfmSizeof(void *msg)
3842{
3843 size_t bufferSize = 2;
3844
3845 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */
3846 bufferSize += 2; /* u16 primitive->interfaceTag */
3847 bufferSize += 2; /* CsrResult primitive->status */
3848 return bufferSize;
3849}
3850
3851
3852u8* CsrWifiSmePacketFilterSetCfmSer(u8 *ptr, size_t *len, void *msg)
3853{
3854 CsrWifiSmePacketFilterSetCfm *primitive = (CsrWifiSmePacketFilterSetCfm *)msg;
3855 *len = 0;
3856 CsrUint16Ser(ptr, len, primitive->common.type);
3857 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
3858 CsrUint16Ser(ptr, len, (u16) primitive->status);
3859 return(ptr);
3860}
3861
3862
3863void* CsrWifiSmePacketFilterSetCfmDes(u8 *buffer, size_t length)
3864{
3865 CsrWifiSmePacketFilterSetCfm *primitive = kmalloc(sizeof(CsrWifiSmePacketFilterSetCfm), GFP_KERNEL);
3866 size_t offset;
3867 offset = 0;
3868
3869 CsrUint16Des(&primitive->common.type, buffer, &offset);
3870 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
3871 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
3872
3873 return primitive;
3874}
3875
3876
3877size_t CsrWifiSmePermanentMacAddressGetCfmSizeof(void *msg)
3878{
3879 size_t bufferSize = 2;
3880
3881 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 11) */
3882 bufferSize += 2; /* CsrResult primitive->status */
3883 bufferSize += 6; /* u8 primitive->permanentMacAddress.a[6] */
3884 return bufferSize;
3885}
3886
3887
3888u8* CsrWifiSmePermanentMacAddressGetCfmSer(u8 *ptr, size_t *len, void *msg)
3889{
3890 CsrWifiSmePermanentMacAddressGetCfm *primitive = (CsrWifiSmePermanentMacAddressGetCfm *)msg;
3891 *len = 0;
3892 CsrUint16Ser(ptr, len, primitive->common.type);
3893 CsrUint16Ser(ptr, len, (u16) primitive->status);
3894 CsrMemCpySer(ptr, len, (const void *) primitive->permanentMacAddress.a, ((u16) (6)));
3895 return(ptr);
3896}
3897
3898
3899void* CsrWifiSmePermanentMacAddressGetCfmDes(u8 *buffer, size_t length)
3900{
3901 CsrWifiSmePermanentMacAddressGetCfm *primitive = kmalloc(sizeof(CsrWifiSmePermanentMacAddressGetCfm), GFP_KERNEL);
3902 size_t offset;
3903 offset = 0;
3904
3905 CsrUint16Des(&primitive->common.type, buffer, &offset);
3906 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
3907 CsrMemCpyDes(primitive->permanentMacAddress.a, buffer, &offset, ((u16) (6)));
3908
3909 return primitive;
3910}
3911
3912
3913size_t CsrWifiSmePmkidCandidateListIndSizeof(void *msg)
3914{
3915 CsrWifiSmePmkidCandidateListInd *primitive = (CsrWifiSmePmkidCandidateListInd *) msg;
3916 size_t bufferSize = 2;
3917
3918 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */
3919 bufferSize += 2; /* u16 primitive->interfaceTag */
3920 bufferSize += 1; /* u8 primitive->pmkidCandidatesCount */
3921 {
3922 u16 i1;
3923 for (i1 = 0; i1 < primitive->pmkidCandidatesCount; i1++)
3924 {
3925 bufferSize += 6; /* u8 primitive->pmkidCandidates[i1].bssid.a[6] */
3926 bufferSize += 1; /* u8 primitive->pmkidCandidates[i1].preAuthAllowed */
3927 }
3928 }
3929 return bufferSize;
3930}
3931
3932
3933u8* CsrWifiSmePmkidCandidateListIndSer(u8 *ptr, size_t *len, void *msg)
3934{
3935 CsrWifiSmePmkidCandidateListInd *primitive = (CsrWifiSmePmkidCandidateListInd *)msg;
3936 *len = 0;
3937 CsrUint16Ser(ptr, len, primitive->common.type);
3938 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
3939 CsrUint8Ser(ptr, len, (u8) primitive->pmkidCandidatesCount);
3940 {
3941 u16 i1;
3942 for (i1 = 0; i1 < primitive->pmkidCandidatesCount; i1++)
3943 {
3944 CsrMemCpySer(ptr, len, (const void *) primitive->pmkidCandidates[i1].bssid.a, ((u16) (6)));
3945 CsrUint8Ser(ptr, len, (u8) primitive->pmkidCandidates[i1].preAuthAllowed);
3946 }
3947 }
3948 return(ptr);
3949}
3950
3951
3952void* CsrWifiSmePmkidCandidateListIndDes(u8 *buffer, size_t length)
3953{
3954 CsrWifiSmePmkidCandidateListInd *primitive = kmalloc(sizeof(CsrWifiSmePmkidCandidateListInd), GFP_KERNEL);
3955 size_t offset;
3956 offset = 0;
3957
3958 CsrUint16Des(&primitive->common.type, buffer, &offset);
3959 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
3960 CsrUint8Des((u8 *) &primitive->pmkidCandidatesCount, buffer, &offset);
3961 primitive->pmkidCandidates = NULL;
3962 if (primitive->pmkidCandidatesCount)
3963 {
3964 primitive->pmkidCandidates = kmalloc(sizeof(CsrWifiSmePmkidCandidate) * primitive->pmkidCandidatesCount, GFP_KERNEL);
3965 }
3966 {
3967 u16 i1;
3968 for (i1 = 0; i1 < primitive->pmkidCandidatesCount; i1++)
3969 {
3970 CsrMemCpyDes(primitive->pmkidCandidates[i1].bssid.a, buffer, &offset, ((u16) (6)));
3971 CsrUint8Des((u8 *) &primitive->pmkidCandidates[i1].preAuthAllowed, buffer, &offset);
3972 }
3973 }
3974
3975 return primitive;
3976}
3977
3978
3979void CsrWifiSmePmkidCandidateListIndSerFree(void *voidPrimitivePointer)
3980{
3981 CsrWifiSmePmkidCandidateListInd *primitive = (CsrWifiSmePmkidCandidateListInd *) voidPrimitivePointer;
3982 kfree(primitive->pmkidCandidates);
3983 kfree(primitive);
3984}
3985
3986
3987size_t CsrWifiSmePmkidCfmSizeof(void *msg)
3988{
3989 CsrWifiSmePmkidCfm *primitive = (CsrWifiSmePmkidCfm *) msg;
3990 size_t bufferSize = 2;
3991
3992 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 31) */
3993 bufferSize += 2; /* u16 primitive->interfaceTag */
3994 bufferSize += 2; /* CsrResult primitive->status */
3995 bufferSize += 1; /* CsrWifiSmeListAction primitive->action */
3996 bufferSize += 1; /* u8 primitive->getPmkidsCount */
3997 {
3998 u16 i1;
3999 for (i1 = 0; i1 < primitive->getPmkidsCount; i1++)
4000 {
4001 bufferSize += 6; /* u8 primitive->getPmkids[i1].bssid.a[6] */
4002 bufferSize += 16; /* u8 primitive->getPmkids[i1].pmkid[16] */
4003 }
4004 }
4005 return bufferSize;
4006}
4007
4008
4009u8* CsrWifiSmePmkidCfmSer(u8 *ptr, size_t *len, void *msg)
4010{
4011 CsrWifiSmePmkidCfm *primitive = (CsrWifiSmePmkidCfm *)msg;
4012 *len = 0;
4013 CsrUint16Ser(ptr, len, primitive->common.type);
4014 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
4015 CsrUint16Ser(ptr, len, (u16) primitive->status);
4016 CsrUint8Ser(ptr, len, (u8) primitive->action);
4017 CsrUint8Ser(ptr, len, (u8) primitive->getPmkidsCount);
4018 {
4019 u16 i1;
4020 for (i1 = 0; i1 < primitive->getPmkidsCount; i1++)
4021 {
4022 CsrMemCpySer(ptr, len, (const void *) primitive->getPmkids[i1].bssid.a, ((u16) (6)));
4023 CsrMemCpySer(ptr, len, (const void *) primitive->getPmkids[i1].pmkid, ((u16) (16)));
4024 }
4025 }
4026 return(ptr);
4027}
4028
4029
4030void* CsrWifiSmePmkidCfmDes(u8 *buffer, size_t length)
4031{
4032 CsrWifiSmePmkidCfm *primitive = kmalloc(sizeof(CsrWifiSmePmkidCfm), GFP_KERNEL);
4033 size_t offset;
4034 offset = 0;
4035
4036 CsrUint16Des(&primitive->common.type, buffer, &offset);
4037 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
4038 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
4039 CsrUint8Des((u8 *) &primitive->action, buffer, &offset);
4040 CsrUint8Des((u8 *) &primitive->getPmkidsCount, buffer, &offset);
4041 primitive->getPmkids = NULL;
4042 if (primitive->getPmkidsCount)
4043 {
4044 primitive->getPmkids = kmalloc(sizeof(CsrWifiSmePmkid) * primitive->getPmkidsCount, GFP_KERNEL);
4045 }
4046 {
4047 u16 i1;
4048 for (i1 = 0; i1 < primitive->getPmkidsCount; i1++)
4049 {
4050 CsrMemCpyDes(primitive->getPmkids[i1].bssid.a, buffer, &offset, ((u16) (6)));
4051 CsrMemCpyDes(primitive->getPmkids[i1].pmkid, buffer, &offset, ((u16) (16)));
4052 }
4053 }
4054
4055 return primitive;
4056}
4057
4058
4059void CsrWifiSmePmkidCfmSerFree(void *voidPrimitivePointer)
4060{
4061 CsrWifiSmePmkidCfm *primitive = (CsrWifiSmePmkidCfm *) voidPrimitivePointer;
4062 kfree(primitive->getPmkids);
4063 kfree(primitive);
4064}
4065
4066
4067size_t CsrWifiSmePowerConfigGetCfmSizeof(void *msg)
4068{
4069 size_t bufferSize = 2;
4070
4071 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */
4072 bufferSize += 2; /* CsrResult primitive->status */
4073 bufferSize += 1; /* CsrWifiSmePowerSaveLevel primitive->powerConfig.powerSaveLevel */
4074 bufferSize += 2; /* u16 primitive->powerConfig.listenIntervalTu */
4075 bufferSize += 1; /* u8 primitive->powerConfig.rxDtims */
4076 bufferSize += 1; /* CsrWifiSmeD3AutoScanMode primitive->powerConfig.d3AutoScanMode */
4077 bufferSize += 1; /* u8 primitive->powerConfig.clientTrafficWindow */
4078 bufferSize += 1; /* u8 primitive->powerConfig.opportunisticPowerSave */
4079 bufferSize += 1; /* u8 primitive->powerConfig.noticeOfAbsence */
4080 return bufferSize;
4081}
4082
4083
4084u8* CsrWifiSmePowerConfigGetCfmSer(u8 *ptr, size_t *len, void *msg)
4085{
4086 CsrWifiSmePowerConfigGetCfm *primitive = (CsrWifiSmePowerConfigGetCfm *)msg;
4087 *len = 0;
4088 CsrUint16Ser(ptr, len, primitive->common.type);
4089 CsrUint16Ser(ptr, len, (u16) primitive->status);
4090 CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.powerSaveLevel);
4091 CsrUint16Ser(ptr, len, (u16) primitive->powerConfig.listenIntervalTu);
4092 CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.rxDtims);
4093 CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.d3AutoScanMode);
4094 CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.clientTrafficWindow);
4095 CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.opportunisticPowerSave);
4096 CsrUint8Ser(ptr, len, (u8) primitive->powerConfig.noticeOfAbsence);
4097 return(ptr);
4098}
4099
4100
4101void* CsrWifiSmePowerConfigGetCfmDes(u8 *buffer, size_t length)
4102{
4103 CsrWifiSmePowerConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmePowerConfigGetCfm), GFP_KERNEL);
4104 size_t offset;
4105 offset = 0;
4106
4107 CsrUint16Des(&primitive->common.type, buffer, &offset);
4108 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
4109 CsrUint8Des((u8 *) &primitive->powerConfig.powerSaveLevel, buffer, &offset);
4110 CsrUint16Des((u16 *) &primitive->powerConfig.listenIntervalTu, buffer, &offset);
4111 CsrUint8Des((u8 *) &primitive->powerConfig.rxDtims, buffer, &offset);
4112 CsrUint8Des((u8 *) &primitive->powerConfig.d3AutoScanMode, buffer, &offset);
4113 CsrUint8Des((u8 *) &primitive->powerConfig.clientTrafficWindow, buffer, &offset);
4114 CsrUint8Des((u8 *) &primitive->powerConfig.opportunisticPowerSave, buffer, &offset);
4115 CsrUint8Des((u8 *) &primitive->powerConfig.noticeOfAbsence, buffer, &offset);
4116
4117 return primitive;
4118}
4119
4120
4121size_t CsrWifiSmeRegulatoryDomainInfoGetCfmSizeof(void *msg)
4122{
4123 size_t bufferSize = 2;
4124
4125 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */
4126 bufferSize += 2; /* CsrResult primitive->status */
4127 bufferSize += 1; /* u8 primitive->regDomInfo.dot11MultiDomainCapabilityImplemented */
4128 bufferSize += 1; /* u8 primitive->regDomInfo.dot11MultiDomainCapabilityEnabled */
4129 bufferSize += 1; /* CsrWifiSmeRegulatoryDomain primitive->regDomInfo.currentRegulatoryDomain */
4130 bufferSize += 2; /* u8 primitive->regDomInfo.currentCountryCode[2] */
4131 return bufferSize;
4132}
4133
4134
4135u8* CsrWifiSmeRegulatoryDomainInfoGetCfmSer(u8 *ptr, size_t *len, void *msg)
4136{
4137 CsrWifiSmeRegulatoryDomainInfoGetCfm *primitive = (CsrWifiSmeRegulatoryDomainInfoGetCfm *)msg;
4138 *len = 0;
4139 CsrUint16Ser(ptr, len, primitive->common.type);
4140 CsrUint16Ser(ptr, len, (u16) primitive->status);
4141 CsrUint8Ser(ptr, len, (u8) primitive->regDomInfo.dot11MultiDomainCapabilityImplemented);
4142 CsrUint8Ser(ptr, len, (u8) primitive->regDomInfo.dot11MultiDomainCapabilityEnabled);
4143 CsrUint8Ser(ptr, len, (u8) primitive->regDomInfo.currentRegulatoryDomain);
4144 CsrMemCpySer(ptr, len, (const void *) primitive->regDomInfo.currentCountryCode, ((u16) (2)));
4145 return(ptr);
4146}
4147
4148
4149void* CsrWifiSmeRegulatoryDomainInfoGetCfmDes(u8 *buffer, size_t length)
4150{
4151 CsrWifiSmeRegulatoryDomainInfoGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeRegulatoryDomainInfoGetCfm), GFP_KERNEL);
4152 size_t offset;
4153 offset = 0;
4154
4155 CsrUint16Des(&primitive->common.type, buffer, &offset);
4156 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
4157 CsrUint8Des((u8 *) &primitive->regDomInfo.dot11MultiDomainCapabilityImplemented, buffer, &offset);
4158 CsrUint8Des((u8 *) &primitive->regDomInfo.dot11MultiDomainCapabilityEnabled, buffer, &offset);
4159 CsrUint8Des((u8 *) &primitive->regDomInfo.currentRegulatoryDomain, buffer, &offset);
4160 CsrMemCpyDes(primitive->regDomInfo.currentCountryCode, buffer, &offset, ((u16) (2)));
4161
4162 return primitive;
4163}
4164
4165
4166size_t CsrWifiSmeRoamCompleteIndSizeof(void *msg)
4167{
4168 size_t bufferSize = 2;
4169
4170 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */
4171 bufferSize += 2; /* u16 primitive->interfaceTag */
4172 bufferSize += 2; /* CsrResult primitive->status */
4173 return bufferSize;
4174}
4175
4176
4177u8* CsrWifiSmeRoamCompleteIndSer(u8 *ptr, size_t *len, void *msg)
4178{
4179 CsrWifiSmeRoamCompleteInd *primitive = (CsrWifiSmeRoamCompleteInd *)msg;
4180 *len = 0;
4181 CsrUint16Ser(ptr, len, primitive->common.type);
4182 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
4183 CsrUint16Ser(ptr, len, (u16) primitive->status);
4184 return(ptr);
4185}
4186
4187
4188void* CsrWifiSmeRoamCompleteIndDes(u8 *buffer, size_t length)
4189{
4190 CsrWifiSmeRoamCompleteInd *primitive = kmalloc(sizeof(CsrWifiSmeRoamCompleteInd), GFP_KERNEL);
4191 size_t offset;
4192 offset = 0;
4193
4194 CsrUint16Des(&primitive->common.type, buffer, &offset);
4195 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
4196 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
4197
4198 return primitive;
4199}
4200
4201
4202size_t CsrWifiSmeRoamStartIndSizeof(void *msg)
4203{
4204 size_t bufferSize = 2;
4205
4206 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */
4207 bufferSize += 2; /* u16 primitive->interfaceTag */
4208 bufferSize += 1; /* CsrWifiSmeRoamReason primitive->roamReason */
4209 bufferSize += 2; /* CsrWifiSmeIEEE80211Reason primitive->reason80211 */
4210 return bufferSize;
4211}
4212
4213
4214u8* CsrWifiSmeRoamStartIndSer(u8 *ptr, size_t *len, void *msg)
4215{
4216 CsrWifiSmeRoamStartInd *primitive = (CsrWifiSmeRoamStartInd *)msg;
4217 *len = 0;
4218 CsrUint16Ser(ptr, len, primitive->common.type);
4219 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
4220 CsrUint8Ser(ptr, len, (u8) primitive->roamReason);
4221 CsrUint16Ser(ptr, len, (u16) primitive->reason80211);
4222 return(ptr);
4223}
4224
4225
4226void* CsrWifiSmeRoamStartIndDes(u8 *buffer, size_t length)
4227{
4228 CsrWifiSmeRoamStartInd *primitive = kmalloc(sizeof(CsrWifiSmeRoamStartInd), GFP_KERNEL);
4229 size_t offset;
4230 offset = 0;
4231
4232 CsrUint16Des(&primitive->common.type, buffer, &offset);
4233 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
4234 CsrUint8Des((u8 *) &primitive->roamReason, buffer, &offset);
4235 CsrUint16Des((u16 *) &primitive->reason80211, buffer, &offset);
4236
4237 return primitive;
4238}
4239
4240
4241size_t CsrWifiSmeRoamingConfigGetCfmSizeof(void *msg)
4242{
4243 size_t bufferSize = 2;
4244
4245 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 72) */
4246 bufferSize += 2; /* u16 primitive->interfaceTag */
4247 bufferSize += 2; /* CsrResult primitive->status */
4248 {
4249 u16 i2;
4250 for (i2 = 0; i2 < 3; i2++)
4251 {
4252 bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].rssiHighThreshold */
4253 bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].rssiLowThreshold */
4254 bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].snrHighThreshold */
4255 bufferSize += 2; /* s16 primitive->roamingConfig.roamingBands[i2].snrLowThreshold */
4256 }
4257 }
4258 bufferSize += 1; /* u8 primitive->roamingConfig.disableSmoothRoaming */
4259 bufferSize += 1; /* u8 primitive->roamingConfig.disableRoamScans */
4260 bufferSize += 1; /* u8 primitive->roamingConfig.reconnectLimit */
4261 bufferSize += 2; /* u16 primitive->roamingConfig.reconnectLimitIntervalMs */
4262 {
4263 u16 i2;
4264 for (i2 = 0; i2 < 3; i2++)
4265 {
4266 bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].intervalSeconds */
4267 bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].validitySeconds */
4268 bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu */
4269 bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu */
4270 bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu */
4271 bufferSize += 2; /* u16 primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu */
4272 }
4273 }
4274 return bufferSize;
4275}
4276
4277
4278u8* CsrWifiSmeRoamingConfigGetCfmSer(u8 *ptr, size_t *len, void *msg)
4279{
4280 CsrWifiSmeRoamingConfigGetCfm *primitive = (CsrWifiSmeRoamingConfigGetCfm *)msg;
4281 *len = 0;
4282 CsrUint16Ser(ptr, len, primitive->common.type);
4283 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
4284 CsrUint16Ser(ptr, len, (u16) primitive->status);
4285 {
4286 u16 i2;
4287 for (i2 = 0; i2 < 3; i2++)
4288 {
4289 CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].rssiHighThreshold);
4290 CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].rssiLowThreshold);
4291 CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].snrHighThreshold);
4292 CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamingBands[i2].snrLowThreshold);
4293 }
4294 }
4295 CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.disableSmoothRoaming);
4296 CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.disableRoamScans);
4297 CsrUint8Ser(ptr, len, (u8) primitive->roamingConfig.reconnectLimit);
4298 CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.reconnectLimitIntervalMs);
4299 {
4300 u16 i2;
4301 for (i2 = 0; i2 < 3; i2++)
4302 {
4303 CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].intervalSeconds);
4304 CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].validitySeconds);
4305 CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu);
4306 CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu);
4307 CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu);
4308 CsrUint16Ser(ptr, len, (u16) primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu);
4309 }
4310 }
4311 return(ptr);
4312}
4313
4314
4315void* CsrWifiSmeRoamingConfigGetCfmDes(u8 *buffer, size_t length)
4316{
4317 CsrWifiSmeRoamingConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeRoamingConfigGetCfm), GFP_KERNEL);
4318 size_t offset;
4319 offset = 0;
4320
4321 CsrUint16Des(&primitive->common.type, buffer, &offset);
4322 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
4323 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
4324 {
4325 u16 i2;
4326 for (i2 = 0; i2 < 3; i2++)
4327 {
4328 CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].rssiHighThreshold, buffer, &offset);
4329 CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].rssiLowThreshold, buffer, &offset);
4330 CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].snrHighThreshold, buffer, &offset);
4331 CsrUint16Des((u16 *) &primitive->roamingConfig.roamingBands[i2].snrLowThreshold, buffer, &offset);
4332 }
4333 }
4334 CsrUint8Des((u8 *) &primitive->roamingConfig.disableSmoothRoaming, buffer, &offset);
4335 CsrUint8Des((u8 *) &primitive->roamingConfig.disableRoamScans, buffer, &offset);
4336 CsrUint8Des((u8 *) &primitive->roamingConfig.reconnectLimit, buffer, &offset);
4337 CsrUint16Des((u16 *) &primitive->roamingConfig.reconnectLimitIntervalMs, buffer, &offset);
4338 {
4339 u16 i2;
4340 for (i2 = 0; i2 < 3; i2++)
4341 {
4342 CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].intervalSeconds, buffer, &offset);
4343 CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].validitySeconds, buffer, &offset);
4344 CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].minActiveChannelTimeTu, buffer, &offset);
4345 CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].maxActiveChannelTimeTu, buffer, &offset);
4346 CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].minPassiveChannelTimeTu, buffer, &offset);
4347 CsrUint16Des((u16 *) &primitive->roamingConfig.roamScanCfg[i2].maxPassiveChannelTimeTu, buffer, &offset);
4348 }
4349 }
4350
4351 return primitive;
4352}
4353
4354
4355size_t CsrWifiSmeRoamingConfigSetCfmSizeof(void *msg)
4356{
4357 size_t bufferSize = 2;
4358
4359 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */
4360 bufferSize += 2; /* u16 primitive->interfaceTag */
4361 bufferSize += 2; /* CsrResult primitive->status */
4362 return bufferSize;
4363}
4364
4365
4366u8* CsrWifiSmeRoamingConfigSetCfmSer(u8 *ptr, size_t *len, void *msg)
4367{
4368 CsrWifiSmeRoamingConfigSetCfm *primitive = (CsrWifiSmeRoamingConfigSetCfm *)msg;
4369 *len = 0;
4370 CsrUint16Ser(ptr, len, primitive->common.type);
4371 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
4372 CsrUint16Ser(ptr, len, (u16) primitive->status);
4373 return(ptr);
4374}
4375
4376
4377void* CsrWifiSmeRoamingConfigSetCfmDes(u8 *buffer, size_t length)
4378{
4379 CsrWifiSmeRoamingConfigSetCfm *primitive = kmalloc(sizeof(CsrWifiSmeRoamingConfigSetCfm), GFP_KERNEL);
4380 size_t offset;
4381 offset = 0;
4382
4383 CsrUint16Des(&primitive->common.type, buffer, &offset);
4384 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
4385 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
4386
4387 return primitive;
4388}
4389
4390
4391size_t CsrWifiSmeScanConfigGetCfmSizeof(void *msg)
4392{
4393 CsrWifiSmeScanConfigGetCfm *primitive = (CsrWifiSmeScanConfigGetCfm *) msg;
4394 size_t bufferSize = 2;
4395
4396 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 65) */
4397 bufferSize += 2; /* CsrResult primitive->status */
4398 {
4399 u16 i2;
4400 for (i2 = 0; i2 < 4; i2++)
4401 {
4402 bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].intervalSeconds */
4403 bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].validitySeconds */
4404 bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu */
4405 bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu */
4406 bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu */
4407 bufferSize += 2; /* u16 primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu */
4408 }
4409 }
4410 bufferSize += 1; /* u8 primitive->scanConfig.disableAutonomousScans */
4411 bufferSize += 2; /* u16 primitive->scanConfig.maxResults */
4412 bufferSize += 1; /* s8 primitive->scanConfig.highRssiThreshold */
4413 bufferSize += 1; /* s8 primitive->scanConfig.lowRssiThreshold */
4414 bufferSize += 1; /* s8 primitive->scanConfig.deltaRssiThreshold */
4415 bufferSize += 1; /* s8 primitive->scanConfig.highSnrThreshold */
4416 bufferSize += 1; /* s8 primitive->scanConfig.lowSnrThreshold */
4417 bufferSize += 1; /* s8 primitive->scanConfig.deltaSnrThreshold */
4418 bufferSize += 2; /* u16 primitive->scanConfig.passiveChannelListCount */
4419 bufferSize += primitive->scanConfig.passiveChannelListCount; /* u8 primitive->scanConfig.passiveChannelList */
4420 return bufferSize;
4421}
4422
4423
4424u8* CsrWifiSmeScanConfigGetCfmSer(u8 *ptr, size_t *len, void *msg)
4425{
4426 CsrWifiSmeScanConfigGetCfm *primitive = (CsrWifiSmeScanConfigGetCfm *)msg;
4427 *len = 0;
4428 CsrUint16Ser(ptr, len, primitive->common.type);
4429 CsrUint16Ser(ptr, len, (u16) primitive->status);
4430 {
4431 u16 i2;
4432 for (i2 = 0; i2 < 4; i2++)
4433 {
4434 CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].intervalSeconds);
4435 CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].validitySeconds);
4436 CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu);
4437 CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu);
4438 CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu);
4439 CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu);
4440 }
4441 }
4442 CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.disableAutonomousScans);
4443 CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.maxResults);
4444 CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.highRssiThreshold);
4445 CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.lowRssiThreshold);
4446 CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.deltaRssiThreshold);
4447 CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.highSnrThreshold);
4448 CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.lowSnrThreshold);
4449 CsrUint8Ser(ptr, len, (u8) primitive->scanConfig.deltaSnrThreshold);
4450 CsrUint16Ser(ptr, len, (u16) primitive->scanConfig.passiveChannelListCount);
4451 if (primitive->scanConfig.passiveChannelListCount)
4452 {
4453 CsrMemCpySer(ptr, len, (const void *) primitive->scanConfig.passiveChannelList, ((u16) (primitive->scanConfig.passiveChannelListCount)));
4454 }
4455 return(ptr);
4456}
4457
4458
4459void* CsrWifiSmeScanConfigGetCfmDes(u8 *buffer, size_t length)
4460{
4461 CsrWifiSmeScanConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeScanConfigGetCfm), GFP_KERNEL);
4462 size_t offset;
4463 offset = 0;
4464
4465 CsrUint16Des(&primitive->common.type, buffer, &offset);
4466 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
4467 {
4468 u16 i2;
4469 for (i2 = 0; i2 < 4; i2++)
4470 {
4471 CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].intervalSeconds, buffer, &offset);
4472 CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].validitySeconds, buffer, &offset);
4473 CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].minActiveChannelTimeTu, buffer, &offset);
4474 CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].maxActiveChannelTimeTu, buffer, &offset);
4475 CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].minPassiveChannelTimeTu, buffer, &offset);
4476 CsrUint16Des((u16 *) &primitive->scanConfig.scanCfg[i2].maxPassiveChannelTimeTu, buffer, &offset);
4477 }
4478 }
4479 CsrUint8Des((u8 *) &primitive->scanConfig.disableAutonomousScans, buffer, &offset);
4480 CsrUint16Des((u16 *) &primitive->scanConfig.maxResults, buffer, &offset);
4481 CsrUint8Des((u8 *) &primitive->scanConfig.highRssiThreshold, buffer, &offset);
4482 CsrUint8Des((u8 *) &primitive->scanConfig.lowRssiThreshold, buffer, &offset);
4483 CsrUint8Des((u8 *) &primitive->scanConfig.deltaRssiThreshold, buffer, &offset);
4484 CsrUint8Des((u8 *) &primitive->scanConfig.highSnrThreshold, buffer, &offset);
4485 CsrUint8Des((u8 *) &primitive->scanConfig.lowSnrThreshold, buffer, &offset);
4486 CsrUint8Des((u8 *) &primitive->scanConfig.deltaSnrThreshold, buffer, &offset);
4487 CsrUint16Des((u16 *) &primitive->scanConfig.passiveChannelListCount, buffer, &offset);
4488 if (primitive->scanConfig.passiveChannelListCount)
4489 {
4490 primitive->scanConfig.passiveChannelList = kmalloc(primitive->scanConfig.passiveChannelListCount, GFP_KERNEL);
4491 CsrMemCpyDes(primitive->scanConfig.passiveChannelList, buffer, &offset, ((u16) (primitive->scanConfig.passiveChannelListCount)));
4492 }
4493 else
4494 {
4495 primitive->scanConfig.passiveChannelList = NULL;
4496 }
4497
4498 return primitive;
4499}
4500
4501
4502void CsrWifiSmeScanConfigGetCfmSerFree(void *voidPrimitivePointer)
4503{
4504 CsrWifiSmeScanConfigGetCfm *primitive = (CsrWifiSmeScanConfigGetCfm *) voidPrimitivePointer;
4505 kfree(primitive->scanConfig.passiveChannelList);
4506 kfree(primitive);
4507}
4508
4509
4510size_t CsrWifiSmeScanResultIndSizeof(void *msg)
4511{
4512 CsrWifiSmeScanResultInd *primitive = (CsrWifiSmeScanResultInd *) msg;
4513 size_t bufferSize = 2;
4514
4515 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 149) */
4516 bufferSize += 32; /* u8 primitive->result.ssid.ssid[32] */
4517 bufferSize += 1; /* u8 primitive->result.ssid.length */
4518 bufferSize += 6; /* u8 primitive->result.bssid.a[6] */
4519 bufferSize += 2; /* s16 primitive->result.rssi */
4520 bufferSize += 2; /* s16 primitive->result.snr */
4521 bufferSize += 1; /* CsrWifiSmeRadioIF primitive->result.ifIndex */
4522 bufferSize += 2; /* u16 primitive->result.beaconPeriodTu */
4523 bufferSize += 8; /* u8 primitive->result.timeStamp.data[8] */
4524 bufferSize += 8; /* u8 primitive->result.localTime.data[8] */
4525 bufferSize += 2; /* u16 primitive->result.channelFrequency */
4526 bufferSize += 2; /* u16 primitive->result.capabilityInformation */
4527 bufferSize += 1; /* u8 primitive->result.channelNumber */
4528 bufferSize += 1; /* CsrWifiSmeBasicUsability primitive->result.usability */
4529 bufferSize += 1; /* CsrWifiSmeBssType primitive->result.bssType */
4530 bufferSize += 2; /* u16 primitive->result.informationElementsLength */
4531 bufferSize += primitive->result.informationElementsLength; /* u8 primitive->result.informationElements */
4532 bufferSize += 1; /* CsrWifiSmeP2pRole primitive->result.p2pDeviceRole */
4533 switch (primitive->result.p2pDeviceRole)
4534 {
4535 case CSR_WIFI_SME_P2P_ROLE_CLI:
4536 bufferSize += 1; /* u8 primitive->result.deviceInfo.reservedCli.empty */
4537 break;
4538 case CSR_WIFI_SME_P2P_ROLE_GO:
4539 bufferSize += 1; /* CsrWifiSmeP2pGroupCapabilityMask primitive->result.deviceInfo.groupInfo.groupCapability */
4540 bufferSize += 6; /* u8 primitive->result.deviceInfo.groupInfo.p2pDeviceAddress.a[6] */
4541 bufferSize += 1; /* u8 primitive->result.deviceInfo.groupInfo.p2pClientInfoCount */
4542 {
4543 u16 i4;
4544 for (i4 = 0; i4 < primitive->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++)
4545 {
4546 bufferSize += 6; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a[6] */
4547 bufferSize += 6; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a[6] */
4548 bufferSize += 2; /* CsrWifiSmeWpsConfigTypeMask primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods */
4549 bufferSize += 1; /* CsrWifiSmeP2pCapabilityMask primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap */
4550 bufferSize += 8; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails[8] */
4551 bufferSize += 1; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount */
4552 {
4553 u16 i6;
4554 for (i6 = 0; i6 < primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++)
4555 {
4556 bufferSize += 8; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails[8] */
4557 }
4558 }
4559 bufferSize += 32; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName[32] */
4560 bufferSize += 1; /* u8 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength */
4561 }
4562 }
4563 break;
4564 case CSR_WIFI_SME_P2P_ROLE_NONE:
4565 bufferSize += 1; /* u8 primitive->result.deviceInfo.reservedNone.empty */
4566 break;
4567 case CSR_WIFI_SME_P2P_ROLE_STANDALONE:
4568 bufferSize += 6; /* u8 primitive->result.deviceInfo.standalonedevInfo.deviceAddress.a[6] */
4569 bufferSize += 2; /* CsrWifiSmeWpsConfigTypeMask primitive->result.deviceInfo.standalonedevInfo.configMethods */
4570 bufferSize += 1; /* CsrWifiSmeP2pCapabilityMask primitive->result.deviceInfo.standalonedevInfo.p2PDeviceCap */
4571 bufferSize += 8; /* u8 primitive->result.deviceInfo.standalonedevInfo.primDeviceType.deviceDetails[8] */
4572 bufferSize += 1; /* u8 primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount */
4573 {
4574 u16 i4;
4575 for (i4 = 0; i4 < primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++)
4576 {
4577 bufferSize += 8; /* u8 primitive->result.deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails[8] */
4578 }
4579 }
4580 bufferSize += 32; /* u8 primitive->result.deviceInfo.standalonedevInfo.deviceName[32] */
4581 bufferSize += 1; /* u8 primitive->result.deviceInfo.standalonedevInfo.deviceNameLength */
4582 break;
4583 default:
4584 break;
4585 }
4586 return bufferSize;
4587}
4588
4589
4590u8* CsrWifiSmeScanResultIndSer(u8 *ptr, size_t *len, void *msg)
4591{
4592 CsrWifiSmeScanResultInd *primitive = (CsrWifiSmeScanResultInd *)msg;
4593 *len = 0;
4594 CsrUint16Ser(ptr, len, primitive->common.type);
4595 CsrMemCpySer(ptr, len, (const void *) primitive->result.ssid.ssid, ((u16) (32)));
4596 CsrUint8Ser(ptr, len, (u8) primitive->result.ssid.length);
4597 CsrMemCpySer(ptr, len, (const void *) primitive->result.bssid.a, ((u16) (6)));
4598 CsrUint16Ser(ptr, len, (u16) primitive->result.rssi);
4599 CsrUint16Ser(ptr, len, (u16) primitive->result.snr);
4600 CsrUint8Ser(ptr, len, (u8) primitive->result.ifIndex);
4601 CsrUint16Ser(ptr, len, (u16) primitive->result.beaconPeriodTu);
4602 CsrMemCpySer(ptr, len, (const void *) primitive->result.timeStamp.data, ((u16) (8)));
4603 CsrMemCpySer(ptr, len, (const void *) primitive->result.localTime.data, ((u16) (8)));
4604 CsrUint16Ser(ptr, len, (u16) primitive->result.channelFrequency);
4605 CsrUint16Ser(ptr, len, (u16) primitive->result.capabilityInformation);
4606 CsrUint8Ser(ptr, len, (u8) primitive->result.channelNumber);
4607 CsrUint8Ser(ptr, len, (u8) primitive->result.usability);
4608 CsrUint8Ser(ptr, len, (u8) primitive->result.bssType);
4609 CsrUint16Ser(ptr, len, (u16) primitive->result.informationElementsLength);
4610 if (primitive->result.informationElementsLength)
4611 {
4612 CsrMemCpySer(ptr, len, (const void *) primitive->result.informationElements, ((u16) (primitive->result.informationElementsLength)));
4613 }
4614 CsrUint8Ser(ptr, len, (u8) primitive->result.p2pDeviceRole);
4615 switch (primitive->result.p2pDeviceRole)
4616 {
4617 case CSR_WIFI_SME_P2P_ROLE_CLI:
4618 CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.reservedCli.empty);
4619 break;
4620 case CSR_WIFI_SME_P2P_ROLE_GO:
4621 CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.groupInfo.groupCapability);
4622 CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2pDeviceAddress.a, ((u16) (6)));
4623 CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.groupInfo.p2pClientInfoCount);
4624 {
4625 u16 i4;
4626 for (i4 = 0; i4 < primitive->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++)
4627 {
4628 CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, ((u16) (6)));
4629 CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, ((u16) (6)));
4630 CsrUint16Ser(ptr, len, (u16) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods);
4631 CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap);
4632 CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, ((u16) (8)));
4633 CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount);
4634 {
4635 u16 i6;
4636 for (i6 = 0; i6 < primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++)
4637 {
4638 CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails, ((u16) (8)));
4639 }
4640 }
4641 CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, ((u16) (32)));
4642 CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength);
4643 }
4644 }
4645 break;
4646 case CSR_WIFI_SME_P2P_ROLE_NONE:
4647 CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.reservedNone.empty);
4648 break;
4649 case CSR_WIFI_SME_P2P_ROLE_STANDALONE:
4650 CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.deviceAddress.a, ((u16) (6)));
4651 CsrUint16Ser(ptr, len, (u16) primitive->result.deviceInfo.standalonedevInfo.configMethods);
4652 CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.standalonedevInfo.p2PDeviceCap);
4653 CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, ((u16) (8)));
4654 CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount);
4655 {
4656 u16 i4;
4657 for (i4 = 0; i4 < primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++)
4658 {
4659 CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails, ((u16) (8)));
4660 }
4661 }
4662 CsrMemCpySer(ptr, len, (const void *) primitive->result.deviceInfo.standalonedevInfo.deviceName, ((u16) (32)));
4663 CsrUint8Ser(ptr, len, (u8) primitive->result.deviceInfo.standalonedevInfo.deviceNameLength);
4664 break;
4665 default:
4666 break;
4667 }
4668 return(ptr);
4669}
4670
4671
4672void* CsrWifiSmeScanResultIndDes(u8 *buffer, size_t length)
4673{
4674 CsrWifiSmeScanResultInd *primitive = kmalloc(sizeof(CsrWifiSmeScanResultInd), GFP_KERNEL);
4675 size_t offset;
4676 offset = 0;
4677
4678 CsrUint16Des(&primitive->common.type, buffer, &offset);
4679 CsrMemCpyDes(primitive->result.ssid.ssid, buffer, &offset, ((u16) (32)));
4680 CsrUint8Des((u8 *) &primitive->result.ssid.length, buffer, &offset);
4681 CsrMemCpyDes(primitive->result.bssid.a, buffer, &offset, ((u16) (6)));
4682 CsrUint16Des((u16 *) &primitive->result.rssi, buffer, &offset);
4683 CsrUint16Des((u16 *) &primitive->result.snr, buffer, &offset);
4684 CsrUint8Des((u8 *) &primitive->result.ifIndex, buffer, &offset);
4685 CsrUint16Des((u16 *) &primitive->result.beaconPeriodTu, buffer, &offset);
4686 CsrMemCpyDes(primitive->result.timeStamp.data, buffer, &offset, ((u16) (8)));
4687 CsrMemCpyDes(primitive->result.localTime.data, buffer, &offset, ((u16) (8)));
4688 CsrUint16Des((u16 *) &primitive->result.channelFrequency, buffer, &offset);
4689 CsrUint16Des((u16 *) &primitive->result.capabilityInformation, buffer, &offset);
4690 CsrUint8Des((u8 *) &primitive->result.channelNumber, buffer, &offset);
4691 CsrUint8Des((u8 *) &primitive->result.usability, buffer, &offset);
4692 CsrUint8Des((u8 *) &primitive->result.bssType, buffer, &offset);
4693 CsrUint16Des((u16 *) &primitive->result.informationElementsLength, buffer, &offset);
4694 if (primitive->result.informationElementsLength)
4695 {
4696 primitive->result.informationElements = kmalloc(primitive->result.informationElementsLength, GFP_KERNEL);
4697 CsrMemCpyDes(primitive->result.informationElements, buffer, &offset, ((u16) (primitive->result.informationElementsLength)));
4698 }
4699 else
4700 {
4701 primitive->result.informationElements = NULL;
4702 }
4703 CsrUint8Des((u8 *) &primitive->result.p2pDeviceRole, buffer, &offset);
4704 switch (primitive->result.p2pDeviceRole)
4705 {
4706 case CSR_WIFI_SME_P2P_ROLE_CLI:
4707 CsrUint8Des((u8 *) &primitive->result.deviceInfo.reservedCli.empty, buffer, &offset);
4708 break;
4709 case CSR_WIFI_SME_P2P_ROLE_GO:
4710 CsrUint8Des((u8 *) &primitive->result.deviceInfo.groupInfo.groupCapability, buffer, &offset);
4711 CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2pDeviceAddress.a, buffer, &offset, ((u16) (6)));
4712 CsrUint8Des((u8 *) &primitive->result.deviceInfo.groupInfo.p2pClientInfoCount, buffer, &offset);
4713 primitive->result.deviceInfo.groupInfo.p2PClientInfo = NULL;
4714 if (primitive->result.deviceInfo.groupInfo.p2pClientInfoCount)
4715 {
4716 primitive->result.deviceInfo.groupInfo.p2PClientInfo = kmalloc(sizeof(CsrWifiSmeP2pClientInfoType) * primitive->result.deviceInfo.groupInfo.p2pClientInfoCount, GFP_KERNEL);
4717 }
4718 {
4719 u16 i4;
4720 for (i4 = 0; i4 < primitive->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++)
4721 {
4722 CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, buffer, &offset, ((u16) (6)));
4723 CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, buffer, &offset, ((u16) (6)));
4724 CsrUint16Des((u16 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods, buffer, &offset);
4725 CsrUint8Des((u8 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap, buffer, &offset);
4726 CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, buffer, &offset, ((u16) (8)));
4727 CsrUint8Des((u8 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount, buffer, &offset);
4728 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL;
4729 if (primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount)
4730 {
4731 primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = kmalloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount, GFP_KERNEL);
4732 }
4733 {
4734 u16 i6;
4735 for (i6 = 0; i6 < primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++)
4736 {
4737 CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails, buffer, &offset, ((u16) (8)));
4738 }
4739 }
4740 CsrMemCpyDes(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, buffer, &offset, ((u16) (32)));
4741 CsrUint8Des((u8 *) &primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength, buffer, &offset);
4742 }
4743 }
4744 break;
4745 case CSR_WIFI_SME_P2P_ROLE_NONE:
4746 CsrUint8Des((u8 *) &primitive->result.deviceInfo.reservedNone.empty, buffer, &offset);
4747 break;
4748 case CSR_WIFI_SME_P2P_ROLE_STANDALONE:
4749 CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.deviceAddress.a, buffer, &offset, ((u16) (6)));
4750 CsrUint16Des((u16 *) &primitive->result.deviceInfo.standalonedevInfo.configMethods, buffer, &offset);
4751 CsrUint8Des((u8 *) &primitive->result.deviceInfo.standalonedevInfo.p2PDeviceCap, buffer, &offset);
4752 CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, buffer, &offset, ((u16) (8)));
4753 CsrUint8Des((u8 *) &primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount, buffer, &offset);
4754 primitive->result.deviceInfo.standalonedevInfo.secDeviceType = NULL;
4755 if (primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount)
4756 {
4757 primitive->result.deviceInfo.standalonedevInfo.secDeviceType = kmalloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount, GFP_KERNEL);
4758 }
4759 {
4760 u16 i4;
4761 for (i4 = 0; i4 < primitive->result.deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++)
4762 {
4763 CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails, buffer, &offset, ((u16) (8)));
4764 }
4765 }
4766 CsrMemCpyDes(primitive->result.deviceInfo.standalonedevInfo.deviceName, buffer, &offset, ((u16) (32)));
4767 CsrUint8Des((u8 *) &primitive->result.deviceInfo.standalonedevInfo.deviceNameLength, buffer, &offset);
4768 break;
4769 default:
4770 break;
4771 }
4772
4773 return primitive;
4774}
4775
4776
4777void CsrWifiSmeScanResultIndSerFree(void *voidPrimitivePointer)
4778{
4779 CsrWifiSmeScanResultInd *primitive = (CsrWifiSmeScanResultInd *) voidPrimitivePointer;
4780 kfree(primitive->result.informationElements);
4781 switch (primitive->result.p2pDeviceRole)
4782 {
4783 case CSR_WIFI_SME_P2P_ROLE_GO:
4784 {
4785 u16 i4;
4786 for (i4 = 0; i4 < primitive->result.deviceInfo.groupInfo.p2pClientInfoCount; i4++)
4787 {
4788 kfree(primitive->result.deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType);
4789 }
4790 }
4791 kfree(primitive->result.deviceInfo.groupInfo.p2PClientInfo);
4792 break;
4793 case CSR_WIFI_SME_P2P_ROLE_STANDALONE:
4794 kfree(primitive->result.deviceInfo.standalonedevInfo.secDeviceType);
4795 break;
4796 default:
4797 break;
4798 }
4799 kfree(primitive);
4800}
4801
4802
4803size_t CsrWifiSmeScanResultsGetCfmSizeof(void *msg)
4804{
4805 CsrWifiSmeScanResultsGetCfm *primitive = (CsrWifiSmeScanResultsGetCfm *) msg;
4806 size_t bufferSize = 2;
4807
4808 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 153) */
4809 bufferSize += 2; /* CsrResult primitive->status */
4810 bufferSize += 2; /* u16 primitive->scanResultsCount */
4811 {
4812 u16 i1;
4813 for (i1 = 0; i1 < primitive->scanResultsCount; i1++)
4814 {
4815 bufferSize += 32; /* u8 primitive->scanResults[i1].ssid.ssid[32] */
4816 bufferSize += 1; /* u8 primitive->scanResults[i1].ssid.length */
4817 bufferSize += 6; /* u8 primitive->scanResults[i1].bssid.a[6] */
4818 bufferSize += 2; /* s16 primitive->scanResults[i1].rssi */
4819 bufferSize += 2; /* s16 primitive->scanResults[i1].snr */
4820 bufferSize += 1; /* CsrWifiSmeRadioIF primitive->scanResults[i1].ifIndex */
4821 bufferSize += 2; /* u16 primitive->scanResults[i1].beaconPeriodTu */
4822 bufferSize += 8; /* u8 primitive->scanResults[i1].timeStamp.data[8] */
4823 bufferSize += 8; /* u8 primitive->scanResults[i1].localTime.data[8] */
4824 bufferSize += 2; /* u16 primitive->scanResults[i1].channelFrequency */
4825 bufferSize += 2; /* u16 primitive->scanResults[i1].capabilityInformation */
4826 bufferSize += 1; /* u8 primitive->scanResults[i1].channelNumber */
4827 bufferSize += 1; /* CsrWifiSmeBasicUsability primitive->scanResults[i1].usability */
4828 bufferSize += 1; /* CsrWifiSmeBssType primitive->scanResults[i1].bssType */
4829 bufferSize += 2; /* u16 primitive->scanResults[i1].informationElementsLength */
4830 bufferSize += primitive->scanResults[i1].informationElementsLength; /* u8 primitive->scanResults[i1].informationElements */
4831 bufferSize += 1; /* CsrWifiSmeP2pRole primitive->scanResults[i1].p2pDeviceRole */
4832 switch (primitive->scanResults[i1].p2pDeviceRole)
4833 {
4834 case CSR_WIFI_SME_P2P_ROLE_CLI:
4835 bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.reservedCli.empty */
4836 break;
4837 case CSR_WIFI_SME_P2P_ROLE_GO:
4838 bufferSize += 1; /* CsrWifiSmeP2pGroupCapabilityMask primitive->scanResults[i1].deviceInfo.groupInfo.groupCapability */
4839 bufferSize += 6; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2pDeviceAddress.a[6] */
4840 bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount */
4841 {
4842 u16 i4;
4843 for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++)
4844 {
4845 bufferSize += 6; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a[6] */
4846 bufferSize += 6; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a[6] */
4847 bufferSize += 2; /* CsrWifiSmeWpsConfigTypeMask primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods */
4848 bufferSize += 1; /* CsrWifiSmeP2pCapabilityMask primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap */
4849 bufferSize += 8; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails[8] */
4850 bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount */
4851 {
4852 u16 i6;
4853 for (i6 = 0; i6 < primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++)
4854 {
4855 bufferSize += 8; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails[8] */
4856 }
4857 }
4858 bufferSize += 32; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName[32] */
4859 bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength */
4860 }
4861 }
4862 break;
4863 case CSR_WIFI_SME_P2P_ROLE_NONE:
4864 bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.reservedNone.empty */
4865 break;
4866 case CSR_WIFI_SME_P2P_ROLE_STANDALONE:
4867 bufferSize += 6; /* u8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceAddress.a[6] */
4868 bufferSize += 2; /* CsrWifiSmeWpsConfigTypeMask primitive->scanResults[i1].deviceInfo.standalonedevInfo.configMethods */
4869 bufferSize += 1; /* CsrWifiSmeP2pCapabilityMask primitive->scanResults[i1].deviceInfo.standalonedevInfo.p2PDeviceCap */
4870 bufferSize += 8; /* u8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.primDeviceType.deviceDetails[8] */
4871 bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount */
4872 {
4873 u16 i4;
4874 for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++)
4875 {
4876 bufferSize += 8; /* u8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails[8] */
4877 }
4878 }
4879 bufferSize += 32; /* u8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceName[32] */
4880 bufferSize += 1; /* u8 primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceNameLength */
4881 break;
4882 default:
4883 break;
4884 }
4885 }
4886 }
4887 return bufferSize;
4888}
4889
4890
4891u8* CsrWifiSmeScanResultsGetCfmSer(u8 *ptr, size_t *len, void *msg)
4892{
4893 CsrWifiSmeScanResultsGetCfm *primitive = (CsrWifiSmeScanResultsGetCfm *)msg;
4894 *len = 0;
4895 CsrUint16Ser(ptr, len, primitive->common.type);
4896 CsrUint16Ser(ptr, len, (u16) primitive->status);
4897 CsrUint16Ser(ptr, len, (u16) primitive->scanResultsCount);
4898 {
4899 u16 i1;
4900 for (i1 = 0; i1 < primitive->scanResultsCount; i1++)
4901 {
4902 CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].ssid.ssid, ((u16) (32)));
4903 CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].ssid.length);
4904 CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].bssid.a, ((u16) (6)));
4905 CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].rssi);
4906 CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].snr);
4907 CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].ifIndex);
4908 CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].beaconPeriodTu);
4909 CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].timeStamp.data, ((u16) (8)));
4910 CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].localTime.data, ((u16) (8)));
4911 CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].channelFrequency);
4912 CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].capabilityInformation);
4913 CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].channelNumber);
4914 CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].usability);
4915 CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].bssType);
4916 CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].informationElementsLength);
4917 if (primitive->scanResults[i1].informationElementsLength)
4918 {
4919 CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].informationElements, ((u16) (primitive->scanResults[i1].informationElementsLength)));
4920 }
4921 CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].p2pDeviceRole);
4922 switch (primitive->scanResults[i1].p2pDeviceRole)
4923 {
4924 case CSR_WIFI_SME_P2P_ROLE_CLI:
4925 CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.reservedCli.empty);
4926 break;
4927 case CSR_WIFI_SME_P2P_ROLE_GO:
4928 CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.groupInfo.groupCapability);
4929 CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2pDeviceAddress.a, ((u16) (6)));
4930 CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount);
4931 {
4932 u16 i4;
4933 for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++)
4934 {
4935 CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, ((u16) (6)));
4936 CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, ((u16) (6)));
4937 CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods);
4938 CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap);
4939 CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, ((u16) (8)));
4940 CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount);
4941 {
4942 u16 i6;
4943 for (i6 = 0; i6 < primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++)
4944 {
4945 CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails, ((u16) (8)));
4946 }
4947 }
4948 CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, ((u16) (32)));
4949 CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength);
4950 }
4951 }
4952 break;
4953 case CSR_WIFI_SME_P2P_ROLE_NONE:
4954 CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.reservedNone.empty);
4955 break;
4956 case CSR_WIFI_SME_P2P_ROLE_STANDALONE:
4957 CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceAddress.a, ((u16) (6)));
4958 CsrUint16Ser(ptr, len, (u16) primitive->scanResults[i1].deviceInfo.standalonedevInfo.configMethods);
4959 CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.standalonedevInfo.p2PDeviceCap);
4960 CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, ((u16) (8)));
4961 CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount);
4962 {
4963 u16 i4;
4964 for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++)
4965 {
4966 CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails, ((u16) (8)));
4967 }
4968 }
4969 CsrMemCpySer(ptr, len, (const void *) primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceName, ((u16) (32)));
4970 CsrUint8Ser(ptr, len, (u8) primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceNameLength);
4971 break;
4972 default:
4973 break;
4974 }
4975 }
4976 }
4977 return(ptr);
4978}
4979
4980
4981void* CsrWifiSmeScanResultsGetCfmDes(u8 *buffer, size_t length)
4982{
4983 CsrWifiSmeScanResultsGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeScanResultsGetCfm), GFP_KERNEL);
4984 size_t offset;
4985 offset = 0;
4986
4987 CsrUint16Des(&primitive->common.type, buffer, &offset);
4988 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
4989 CsrUint16Des((u16 *) &primitive->scanResultsCount, buffer, &offset);
4990 primitive->scanResults = NULL;
4991 if (primitive->scanResultsCount)
4992 {
4993 primitive->scanResults = kmalloc(sizeof(CsrWifiSmeScanResult) * primitive->scanResultsCount, GFP_KERNEL);
4994 }
4995 {
4996 u16 i1;
4997 for (i1 = 0; i1 < primitive->scanResultsCount; i1++)
4998 {
4999 CsrMemCpyDes(primitive->scanResults[i1].ssid.ssid, buffer, &offset, ((u16) (32)));
5000 CsrUint8Des((u8 *) &primitive->scanResults[i1].ssid.length, buffer, &offset);
5001 CsrMemCpyDes(primitive->scanResults[i1].bssid.a, buffer, &offset, ((u16) (6)));
5002 CsrUint16Des((u16 *) &primitive->scanResults[i1].rssi, buffer, &offset);
5003 CsrUint16Des((u16 *) &primitive->scanResults[i1].snr, buffer, &offset);
5004 CsrUint8Des((u8 *) &primitive->scanResults[i1].ifIndex, buffer, &offset);
5005 CsrUint16Des((u16 *) &primitive->scanResults[i1].beaconPeriodTu, buffer, &offset);
5006 CsrMemCpyDes(primitive->scanResults[i1].timeStamp.data, buffer, &offset, ((u16) (8)));
5007 CsrMemCpyDes(primitive->scanResults[i1].localTime.data, buffer, &offset, ((u16) (8)));
5008 CsrUint16Des((u16 *) &primitive->scanResults[i1].channelFrequency, buffer, &offset);
5009 CsrUint16Des((u16 *) &primitive->scanResults[i1].capabilityInformation, buffer, &offset);
5010 CsrUint8Des((u8 *) &primitive->scanResults[i1].channelNumber, buffer, &offset);
5011 CsrUint8Des((u8 *) &primitive->scanResults[i1].usability, buffer, &offset);
5012 CsrUint8Des((u8 *) &primitive->scanResults[i1].bssType, buffer, &offset);
5013 CsrUint16Des((u16 *) &primitive->scanResults[i1].informationElementsLength, buffer, &offset);
5014 if (primitive->scanResults[i1].informationElementsLength)
5015 {
5016 primitive->scanResults[i1].informationElements = kmalloc(primitive->scanResults[i1].informationElementsLength, GFP_KERNEL);
5017 CsrMemCpyDes(primitive->scanResults[i1].informationElements, buffer, &offset, ((u16) (primitive->scanResults[i1].informationElementsLength)));
5018 }
5019 else
5020 {
5021 primitive->scanResults[i1].informationElements = NULL;
5022 }
5023 CsrUint8Des((u8 *) &primitive->scanResults[i1].p2pDeviceRole, buffer, &offset);
5024 switch (primitive->scanResults[i1].p2pDeviceRole)
5025 {
5026 case CSR_WIFI_SME_P2P_ROLE_CLI:
5027 CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.reservedCli.empty, buffer, &offset);
5028 break;
5029 case CSR_WIFI_SME_P2P_ROLE_GO:
5030 CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.groupCapability, buffer, &offset);
5031 CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2pDeviceAddress.a, buffer, &offset, ((u16) (6)));
5032 CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount, buffer, &offset);
5033 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo = NULL;
5034 if (primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount)
5035 {
5036 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo = kmalloc(sizeof(CsrWifiSmeP2pClientInfoType) * primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount, GFP_KERNEL);
5037 }
5038 {
5039 u16 i4;
5040 for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++)
5041 {
5042 CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].p2PClientInterfaceAddress.a, buffer, &offset, ((u16) (6)));
5043 CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceAddress.a, buffer, &offset, ((u16) (6)));
5044 CsrUint16Des((u16 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.configMethods, buffer, &offset);
5045 CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.p2PDeviceCap, buffer, &offset);
5046 CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.primDeviceType.deviceDetails, buffer, &offset, ((u16) (8)));
5047 CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount, buffer, &offset);
5048 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = NULL;
5049 if (primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount)
5050 {
5051 primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType = kmalloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount, GFP_KERNEL);
5052 }
5053 {
5054 u16 i6;
5055 for (i6 = 0; i6 < primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secondaryDeviceTypeCount; i6++)
5056 {
5057 CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType[i6].deviceDetails, buffer, &offset, ((u16) (8)));
5058 }
5059 }
5060 CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceName, buffer, &offset, ((u16) (32)));
5061 CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.deviceNameLength, buffer, &offset);
5062 }
5063 }
5064 break;
5065 case CSR_WIFI_SME_P2P_ROLE_NONE:
5066 CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.reservedNone.empty, buffer, &offset);
5067 break;
5068 case CSR_WIFI_SME_P2P_ROLE_STANDALONE:
5069 CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceAddress.a, buffer, &offset, ((u16) (6)));
5070 CsrUint16Des((u16 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.configMethods, buffer, &offset);
5071 CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.p2PDeviceCap, buffer, &offset);
5072 CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.primDeviceType.deviceDetails, buffer, &offset, ((u16) (8)));
5073 CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount, buffer, &offset);
5074 primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType = NULL;
5075 if (primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount)
5076 {
5077 primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType = kmalloc(sizeof(CsrWifiSmeWpsDeviceType) * primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount, GFP_KERNEL);
5078 }
5079 {
5080 u16 i4;
5081 for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.standalonedevInfo.secondaryDeviceTypeCount; i4++)
5082 {
5083 CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType[i4].deviceDetails, buffer, &offset, ((u16) (8)));
5084 }
5085 }
5086 CsrMemCpyDes(primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceName, buffer, &offset, ((u16) (32)));
5087 CsrUint8Des((u8 *) &primitive->scanResults[i1].deviceInfo.standalonedevInfo.deviceNameLength, buffer, &offset);
5088 break;
5089 default:
5090 break;
5091 }
5092 }
5093 }
5094
5095 return primitive;
5096}
5097
5098
5099void CsrWifiSmeScanResultsGetCfmSerFree(void *voidPrimitivePointer)
5100{
5101 CsrWifiSmeScanResultsGetCfm *primitive = (CsrWifiSmeScanResultsGetCfm *) voidPrimitivePointer;
5102 {
5103 u16 i1;
5104 for (i1 = 0; i1 < primitive->scanResultsCount; i1++)
5105 {
5106 kfree(primitive->scanResults[i1].informationElements);
5107 switch (primitive->scanResults[i1].p2pDeviceRole)
5108 {
5109 case CSR_WIFI_SME_P2P_ROLE_GO:
5110 {
5111 u16 i4;
5112 for (i4 = 0; i4 < primitive->scanResults[i1].deviceInfo.groupInfo.p2pClientInfoCount; i4++)
5113 {
5114 kfree(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo[i4].clientDeviceInfo.secDeviceType);
5115 }
5116 }
5117 kfree(primitive->scanResults[i1].deviceInfo.groupInfo.p2PClientInfo);
5118 break;
5119 case CSR_WIFI_SME_P2P_ROLE_STANDALONE:
5120 kfree(primitive->scanResults[i1].deviceInfo.standalonedevInfo.secDeviceType);
5121 break;
5122 default:
5123 break;
5124 }
5125 }
5126 }
5127 kfree(primitive->scanResults);
5128 kfree(primitive);
5129}
5130
5131
5132size_t CsrWifiSmeSmeStaConfigGetCfmSizeof(void *msg)
5133{
5134 size_t bufferSize = 2;
5135
5136 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */
5137 bufferSize += 2; /* u16 primitive->interfaceTag */
5138 bufferSize += 2; /* CsrResult primitive->status */
5139 bufferSize += 1; /* u8 primitive->smeConfig.connectionQualityRssiChangeTrigger */
5140 bufferSize += 1; /* u8 primitive->smeConfig.connectionQualitySnrChangeTrigger */
5141 bufferSize += 1; /* CsrWifiSmeWmmModeMask primitive->smeConfig.wmmModeMask */
5142 bufferSize += 1; /* CsrWifiSmeRadioIF primitive->smeConfig.ifIndex */
5143 bufferSize += 1; /* u8 primitive->smeConfig.allowUnicastUseGroupCipher */
5144 bufferSize += 1; /* u8 primitive->smeConfig.enableOpportunisticKeyCaching */
5145 return bufferSize;
5146}
5147
5148
5149u8* CsrWifiSmeSmeStaConfigGetCfmSer(u8 *ptr, size_t *len, void *msg)
5150{
5151 CsrWifiSmeSmeStaConfigGetCfm *primitive = (CsrWifiSmeSmeStaConfigGetCfm *)msg;
5152 *len = 0;
5153 CsrUint16Ser(ptr, len, primitive->common.type);
5154 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
5155 CsrUint16Ser(ptr, len, (u16) primitive->status);
5156 CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.connectionQualityRssiChangeTrigger);
5157 CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.connectionQualitySnrChangeTrigger);
5158 CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.wmmModeMask);
5159 CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.ifIndex);
5160 CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.allowUnicastUseGroupCipher);
5161 CsrUint8Ser(ptr, len, (u8) primitive->smeConfig.enableOpportunisticKeyCaching);
5162 return(ptr);
5163}
5164
5165
5166void* CsrWifiSmeSmeStaConfigGetCfmDes(u8 *buffer, size_t length)
5167{
5168 CsrWifiSmeSmeStaConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeSmeStaConfigGetCfm), GFP_KERNEL);
5169 size_t offset;
5170 offset = 0;
5171
5172 CsrUint16Des(&primitive->common.type, buffer, &offset);
5173 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
5174 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
5175 CsrUint8Des((u8 *) &primitive->smeConfig.connectionQualityRssiChangeTrigger, buffer, &offset);
5176 CsrUint8Des((u8 *) &primitive->smeConfig.connectionQualitySnrChangeTrigger, buffer, &offset);
5177 CsrUint8Des((u8 *) &primitive->smeConfig.wmmModeMask, buffer, &offset);
5178 CsrUint8Des((u8 *) &primitive->smeConfig.ifIndex, buffer, &offset);
5179 CsrUint8Des((u8 *) &primitive->smeConfig.allowUnicastUseGroupCipher, buffer, &offset);
5180 CsrUint8Des((u8 *) &primitive->smeConfig.enableOpportunisticKeyCaching, buffer, &offset);
5181
5182 return primitive;
5183}
5184
5185
5186size_t CsrWifiSmeSmeStaConfigSetCfmSizeof(void *msg)
5187{
5188 size_t bufferSize = 2;
5189
5190 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */
5191 bufferSize += 2; /* u16 primitive->interfaceTag */
5192 bufferSize += 2; /* CsrResult primitive->status */
5193 return bufferSize;
5194}
5195
5196
5197u8* CsrWifiSmeSmeStaConfigSetCfmSer(u8 *ptr, size_t *len, void *msg)
5198{
5199 CsrWifiSmeSmeStaConfigSetCfm *primitive = (CsrWifiSmeSmeStaConfigSetCfm *)msg;
5200 *len = 0;
5201 CsrUint16Ser(ptr, len, primitive->common.type);
5202 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
5203 CsrUint16Ser(ptr, len, (u16) primitive->status);
5204 return(ptr);
5205}
5206
5207
5208void* CsrWifiSmeSmeStaConfigSetCfmDes(u8 *buffer, size_t length)
5209{
5210 CsrWifiSmeSmeStaConfigSetCfm *primitive = kmalloc(sizeof(CsrWifiSmeSmeStaConfigSetCfm), GFP_KERNEL);
5211 size_t offset;
5212 offset = 0;
5213
5214 CsrUint16Des(&primitive->common.type, buffer, &offset);
5215 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
5216 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
5217
5218 return primitive;
5219}
5220
5221
5222size_t CsrWifiSmeStationMacAddressGetCfmSizeof(void *msg)
5223{
5224 size_t bufferSize = 2;
5225
5226 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */
5227 bufferSize += 2; /* CsrResult primitive->status */
5228 {
5229 u16 i1;
5230 for (i1 = 0; i1 < 2; i1++)
5231 {
5232 bufferSize += 6; /* u8 primitive->stationMacAddress[i1].a[6] */
5233 }
5234 }
5235 return bufferSize;
5236}
5237
5238
5239u8* CsrWifiSmeStationMacAddressGetCfmSer(u8 *ptr, size_t *len, void *msg)
5240{
5241 CsrWifiSmeStationMacAddressGetCfm *primitive = (CsrWifiSmeStationMacAddressGetCfm *)msg;
5242 *len = 0;
5243 CsrUint16Ser(ptr, len, primitive->common.type);
5244 CsrUint16Ser(ptr, len, (u16) primitive->status);
5245 {
5246 u16 i1;
5247 for (i1 = 0; i1 < 2; i1++)
5248 {
5249 CsrMemCpySer(ptr, len, (const void *) primitive->stationMacAddress[i1].a, ((u16) (6)));
5250 }
5251 }
5252 return(ptr);
5253}
5254
5255
5256void* CsrWifiSmeStationMacAddressGetCfmDes(u8 *buffer, size_t length)
5257{
5258 CsrWifiSmeStationMacAddressGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeStationMacAddressGetCfm), GFP_KERNEL);
5259 size_t offset;
5260 offset = 0;
5261
5262 CsrUint16Des(&primitive->common.type, buffer, &offset);
5263 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
5264 {
5265 u16 i1;
5266 for (i1 = 0; i1 < 2; i1++)
5267 {
5268 CsrMemCpyDes(primitive->stationMacAddress[i1].a, buffer, &offset, ((u16) (6)));
5269 }
5270 }
5271
5272 return primitive;
5273}
5274
5275
5276size_t CsrWifiSmeTspecIndSizeof(void *msg)
5277{
5278 CsrWifiSmeTspecInd *primitive = (CsrWifiSmeTspecInd *) msg;
5279 size_t bufferSize = 2;
5280
5281 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */
5282 bufferSize += 2; /* u16 primitive->interfaceTag */
5283 bufferSize += 4; /* u32 primitive->transactionId */
5284 bufferSize += 1; /* CsrWifiSmeTspecResultCode primitive->tspecResultCode */
5285 bufferSize += 2; /* u16 primitive->tspecLength */
5286 bufferSize += primitive->tspecLength; /* u8 primitive->tspec */
5287 return bufferSize;
5288}
5289
5290
5291u8* CsrWifiSmeTspecIndSer(u8 *ptr, size_t *len, void *msg)
5292{
5293 CsrWifiSmeTspecInd *primitive = (CsrWifiSmeTspecInd *)msg;
5294 *len = 0;
5295 CsrUint16Ser(ptr, len, primitive->common.type);
5296 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
5297 CsrUint32Ser(ptr, len, (u32) primitive->transactionId);
5298 CsrUint8Ser(ptr, len, (u8) primitive->tspecResultCode);
5299 CsrUint16Ser(ptr, len, (u16) primitive->tspecLength);
5300 if (primitive->tspecLength)
5301 {
5302 CsrMemCpySer(ptr, len, (const void *) primitive->tspec, ((u16) (primitive->tspecLength)));
5303 }
5304 return(ptr);
5305}
5306
5307
5308void* CsrWifiSmeTspecIndDes(u8 *buffer, size_t length)
5309{
5310 CsrWifiSmeTspecInd *primitive = kmalloc(sizeof(CsrWifiSmeTspecInd), GFP_KERNEL);
5311 size_t offset;
5312 offset = 0;
5313
5314 CsrUint16Des(&primitive->common.type, buffer, &offset);
5315 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
5316 CsrUint32Des((u32 *) &primitive->transactionId, buffer, &offset);
5317 CsrUint8Des((u8 *) &primitive->tspecResultCode, buffer, &offset);
5318 CsrUint16Des((u16 *) &primitive->tspecLength, buffer, &offset);
5319 if (primitive->tspecLength)
5320 {
5321 primitive->tspec = kmalloc(primitive->tspecLength, GFP_KERNEL);
5322 CsrMemCpyDes(primitive->tspec, buffer, &offset, ((u16) (primitive->tspecLength)));
5323 }
5324 else
5325 {
5326 primitive->tspec = NULL;
5327 }
5328
5329 return primitive;
5330}
5331
5332
5333void CsrWifiSmeTspecIndSerFree(void *voidPrimitivePointer)
5334{
5335 CsrWifiSmeTspecInd *primitive = (CsrWifiSmeTspecInd *) voidPrimitivePointer;
5336 kfree(primitive->tspec);
5337 kfree(primitive);
5338}
5339
5340
5341size_t CsrWifiSmeTspecCfmSizeof(void *msg)
5342{
5343 CsrWifiSmeTspecCfm *primitive = (CsrWifiSmeTspecCfm *) msg;
5344 size_t bufferSize = 2;
5345
5346 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 15) */
5347 bufferSize += 2; /* u16 primitive->interfaceTag */
5348 bufferSize += 2; /* CsrResult primitive->status */
5349 bufferSize += 4; /* u32 primitive->transactionId */
5350 bufferSize += 1; /* CsrWifiSmeTspecResultCode primitive->tspecResultCode */
5351 bufferSize += 2; /* u16 primitive->tspecLength */
5352 bufferSize += primitive->tspecLength; /* u8 primitive->tspec */
5353 return bufferSize;
5354}
5355
5356
5357u8* CsrWifiSmeTspecCfmSer(u8 *ptr, size_t *len, void *msg)
5358{
5359 CsrWifiSmeTspecCfm *primitive = (CsrWifiSmeTspecCfm *)msg;
5360 *len = 0;
5361 CsrUint16Ser(ptr, len, primitive->common.type);
5362 CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
5363 CsrUint16Ser(ptr, len, (u16) primitive->status);
5364 CsrUint32Ser(ptr, len, (u32) primitive->transactionId);
5365 CsrUint8Ser(ptr, len, (u8) primitive->tspecResultCode);
5366 CsrUint16Ser(ptr, len, (u16) primitive->tspecLength);
5367 if (primitive->tspecLength)
5368 {
5369 CsrMemCpySer(ptr, len, (const void *) primitive->tspec, ((u16) (primitive->tspecLength)));
5370 }
5371 return(ptr);
5372}
5373
5374
5375void* CsrWifiSmeTspecCfmDes(u8 *buffer, size_t length)
5376{
5377 CsrWifiSmeTspecCfm *primitive = kmalloc(sizeof(CsrWifiSmeTspecCfm), GFP_KERNEL);
5378 size_t offset;
5379 offset = 0;
5380
5381 CsrUint16Des(&primitive->common.type, buffer, &offset);
5382 CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
5383 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
5384 CsrUint32Des((u32 *) &primitive->transactionId, buffer, &offset);
5385 CsrUint8Des((u8 *) &primitive->tspecResultCode, buffer, &offset);
5386 CsrUint16Des((u16 *) &primitive->tspecLength, buffer, &offset);
5387 if (primitive->tspecLength)
5388 {
5389 primitive->tspec = kmalloc(primitive->tspecLength, GFP_KERNEL);
5390 CsrMemCpyDes(primitive->tspec, buffer, &offset, ((u16) (primitive->tspecLength)));
5391 }
5392 else
5393 {
5394 primitive->tspec = NULL;
5395 }
5396
5397 return primitive;
5398}
5399
5400
5401void CsrWifiSmeTspecCfmSerFree(void *voidPrimitivePointer)
5402{
5403 CsrWifiSmeTspecCfm *primitive = (CsrWifiSmeTspecCfm *) voidPrimitivePointer;
5404 kfree(primitive->tspec);
5405 kfree(primitive);
5406}
5407
5408
5409size_t CsrWifiSmeVersionsGetCfmSizeof(void *msg)
5410{
5411 CsrWifiSmeVersionsGetCfm *primitive = (CsrWifiSmeVersionsGetCfm *) msg;
5412 size_t bufferSize = 2;
5413
5414 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 33) */
5415 bufferSize += 2; /* CsrResult primitive->status */
5416 bufferSize += 4; /* u32 primitive->versions.chipId */
5417 bufferSize += 4; /* u32 primitive->versions.chipVersion */
5418 bufferSize += 4; /* u32 primitive->versions.firmwareBuild */
5419 bufferSize += 4; /* u32 primitive->versions.firmwarePatch */
5420 bufferSize += 4; /* u32 primitive->versions.firmwareHip */
5421 bufferSize += (primitive->versions.routerBuild ? strlen(primitive->versions.routerBuild) : 0) + 1; /* char* primitive->versions.routerBuild (0 byte len + 1 for NULL Term) */
5422 bufferSize += 4; /* u32 primitive->versions.routerHip */
5423 bufferSize += (primitive->versions.smeBuild ? strlen(primitive->versions.smeBuild) : 0) + 1; /* char* primitive->versions.smeBuild (0 byte len + 1 for NULL Term) */
5424 bufferSize += 4; /* u32 primitive->versions.smeHip */
5425 return bufferSize;
5426}
5427
5428
5429u8* CsrWifiSmeVersionsGetCfmSer(u8 *ptr, size_t *len, void *msg)
5430{
5431 CsrWifiSmeVersionsGetCfm *primitive = (CsrWifiSmeVersionsGetCfm *)msg;
5432 *len = 0;
5433 CsrUint16Ser(ptr, len, primitive->common.type);
5434 CsrUint16Ser(ptr, len, (u16) primitive->status);
5435 CsrUint32Ser(ptr, len, (u32) primitive->versions.chipId);
5436 CsrUint32Ser(ptr, len, (u32) primitive->versions.chipVersion);
5437 CsrUint32Ser(ptr, len, (u32) primitive->versions.firmwareBuild);
5438 CsrUint32Ser(ptr, len, (u32) primitive->versions.firmwarePatch);
5439 CsrUint32Ser(ptr, len, (u32) primitive->versions.firmwareHip);
5440 CsrCharStringSer(ptr, len, primitive->versions.routerBuild);
5441 CsrUint32Ser(ptr, len, (u32) primitive->versions.routerHip);
5442 CsrCharStringSer(ptr, len, primitive->versions.smeBuild);
5443 CsrUint32Ser(ptr, len, (u32) primitive->versions.smeHip);
5444 return(ptr);
5445}
5446
5447
5448void* CsrWifiSmeVersionsGetCfmDes(u8 *buffer, size_t length)
5449{
5450 CsrWifiSmeVersionsGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeVersionsGetCfm), GFP_KERNEL);
5451 size_t offset;
5452 offset = 0;
5453
5454 CsrUint16Des(&primitive->common.type, buffer, &offset);
5455 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
5456 CsrUint32Des((u32 *) &primitive->versions.chipId, buffer, &offset);
5457 CsrUint32Des((u32 *) &primitive->versions.chipVersion, buffer, &offset);
5458 CsrUint32Des((u32 *) &primitive->versions.firmwareBuild, buffer, &offset);
5459 CsrUint32Des((u32 *) &primitive->versions.firmwarePatch, buffer, &offset);
5460 CsrUint32Des((u32 *) &primitive->versions.firmwareHip, buffer, &offset);
5461 CsrCharStringDes(&primitive->versions.routerBuild, buffer, &offset);
5462 CsrUint32Des((u32 *) &primitive->versions.routerHip, buffer, &offset);
5463 CsrCharStringDes(&primitive->versions.smeBuild, buffer, &offset);
5464 CsrUint32Des((u32 *) &primitive->versions.smeHip, buffer, &offset);
5465
5466 return primitive;
5467}
5468
5469
5470void CsrWifiSmeVersionsGetCfmSerFree(void *voidPrimitivePointer)
5471{
5472 CsrWifiSmeVersionsGetCfm *primitive = (CsrWifiSmeVersionsGetCfm *) voidPrimitivePointer;
5473 kfree(primitive->versions.routerBuild);
5474 kfree(primitive->versions.smeBuild);
5475 kfree(primitive);
5476}
5477
5478
5479size_t CsrWifiSmeCloakedSsidsGetCfmSizeof(void *msg)
5480{
5481 CsrWifiSmeCloakedSsidsGetCfm *primitive = (CsrWifiSmeCloakedSsidsGetCfm *) msg;
5482 size_t bufferSize = 2;
5483
5484 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 39) */
5485 bufferSize += 2; /* CsrResult primitive->status */
5486 bufferSize += 1; /* u8 primitive->cloakedSsids.cloakedSsidsCount */
5487 {
5488 u16 i2;
5489 for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++)
5490 {
5491 bufferSize += 32; /* u8 primitive->cloakedSsids.cloakedSsids[i2].ssid[32] */
5492 bufferSize += 1; /* u8 primitive->cloakedSsids.cloakedSsids[i2].length */
5493 }
5494 }
5495 return bufferSize;
5496}
5497
5498
5499u8* CsrWifiSmeCloakedSsidsGetCfmSer(u8 *ptr, size_t *len, void *msg)
5500{
5501 CsrWifiSmeCloakedSsidsGetCfm *primitive = (CsrWifiSmeCloakedSsidsGetCfm *)msg;
5502 *len = 0;
5503 CsrUint16Ser(ptr, len, primitive->common.type);
5504 CsrUint16Ser(ptr, len, (u16) primitive->status);
5505 CsrUint8Ser(ptr, len, (u8) primitive->cloakedSsids.cloakedSsidsCount);
5506 {
5507 u16 i2;
5508 for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++)
5509 {
5510 CsrMemCpySer(ptr, len, (const void *) primitive->cloakedSsids.cloakedSsids[i2].ssid, ((u16) (32)));
5511 CsrUint8Ser(ptr, len, (u8) primitive->cloakedSsids.cloakedSsids[i2].length);
5512 }
5513 }
5514 return(ptr);
5515}
5516
5517
5518void* CsrWifiSmeCloakedSsidsGetCfmDes(u8 *buffer, size_t length)
5519{
5520 CsrWifiSmeCloakedSsidsGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeCloakedSsidsGetCfm), GFP_KERNEL);
5521 size_t offset;
5522 offset = 0;
5523
5524 CsrUint16Des(&primitive->common.type, buffer, &offset);
5525 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
5526 CsrUint8Des((u8 *) &primitive->cloakedSsids.cloakedSsidsCount, buffer, &offset);
5527 primitive->cloakedSsids.cloakedSsids = NULL;
5528 if (primitive->cloakedSsids.cloakedSsidsCount)
5529 {
5530 primitive->cloakedSsids.cloakedSsids = kmalloc(sizeof(CsrWifiSsid) * primitive->cloakedSsids.cloakedSsidsCount, GFP_KERNEL);
5531 }
5532 {
5533 u16 i2;
5534 for (i2 = 0; i2 < primitive->cloakedSsids.cloakedSsidsCount; i2++)
5535 {
5536 CsrMemCpyDes(primitive->cloakedSsids.cloakedSsids[i2].ssid, buffer, &offset, ((u16) (32)));
5537 CsrUint8Des((u8 *) &primitive->cloakedSsids.cloakedSsids[i2].length, buffer, &offset);
5538 }
5539 }
5540
5541 return primitive;
5542}
5543
5544
5545void CsrWifiSmeCloakedSsidsGetCfmSerFree(void *voidPrimitivePointer)
5546{
5547 CsrWifiSmeCloakedSsidsGetCfm *primitive = (CsrWifiSmeCloakedSsidsGetCfm *) voidPrimitivePointer;
5548 kfree(primitive->cloakedSsids.cloakedSsids);
5549 kfree(primitive);
5550}
5551
5552
5553size_t CsrWifiSmeWifiOnIndSizeof(void *msg)
5554{
5555 size_t bufferSize = 2;
5556
5557 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */
5558 bufferSize += 6; /* u8 primitive->address.a[6] */
5559 return bufferSize;
5560}
5561
5562
5563u8* CsrWifiSmeWifiOnIndSer(u8 *ptr, size_t *len, void *msg)
5564{
5565 CsrWifiSmeWifiOnInd *primitive = (CsrWifiSmeWifiOnInd *)msg;
5566 *len = 0;
5567 CsrUint16Ser(ptr, len, primitive->common.type);
5568 CsrMemCpySer(ptr, len, (const void *) primitive->address.a, ((u16) (6)));
5569 return(ptr);
5570}
5571
5572
5573void* CsrWifiSmeWifiOnIndDes(u8 *buffer, size_t length)
5574{
5575 CsrWifiSmeWifiOnInd *primitive = kmalloc(sizeof(CsrWifiSmeWifiOnInd), GFP_KERNEL);
5576 size_t offset;
5577 offset = 0;
5578
5579 CsrUint16Des(&primitive->common.type, buffer, &offset);
5580 CsrMemCpyDes(primitive->address.a, buffer, &offset, ((u16) (6)));
5581
5582 return primitive;
5583}
5584
5585
5586size_t CsrWifiSmeSmeCommonConfigGetCfmSizeof(void *msg)
5587{
5588 size_t bufferSize = 2;
5589
5590 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */
5591 bufferSize += 2; /* CsrResult primitive->status */
5592 bufferSize += 1; /* CsrWifiSme80211dTrustLevel primitive->deviceConfig.trustLevel */
5593 bufferSize += 2; /* u8 primitive->deviceConfig.countryCode[2] */
5594 bufferSize += 1; /* CsrWifiSmeFirmwareDriverInterface primitive->deviceConfig.firmwareDriverInterface */
5595 bufferSize += 1; /* u8 primitive->deviceConfig.enableStrictDraftN */
5596 return bufferSize;
5597}
5598
5599
5600u8* CsrWifiSmeSmeCommonConfigGetCfmSer(u8 *ptr, size_t *len, void *msg)
5601{
5602 CsrWifiSmeSmeCommonConfigGetCfm *primitive = (CsrWifiSmeSmeCommonConfigGetCfm *)msg;
5603 *len = 0;
5604 CsrUint16Ser(ptr, len, primitive->common.type);
5605 CsrUint16Ser(ptr, len, (u16) primitive->status);
5606 CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.trustLevel);
5607 CsrMemCpySer(ptr, len, (const void *) primitive->deviceConfig.countryCode, ((u16) (2)));
5608 CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.firmwareDriverInterface);
5609 CsrUint8Ser(ptr, len, (u8) primitive->deviceConfig.enableStrictDraftN);
5610 return(ptr);
5611}
5612
5613
5614void* CsrWifiSmeSmeCommonConfigGetCfmDes(u8 *buffer, size_t length)
5615{
5616 CsrWifiSmeSmeCommonConfigGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeSmeCommonConfigGetCfm), GFP_KERNEL);
5617 size_t offset;
5618 offset = 0;
5619
5620 CsrUint16Des(&primitive->common.type, buffer, &offset);
5621 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
5622 CsrUint8Des((u8 *) &primitive->deviceConfig.trustLevel, buffer, &offset);
5623 CsrMemCpyDes(primitive->deviceConfig.countryCode, buffer, &offset, ((u16) (2)));
5624 CsrUint8Des((u8 *) &primitive->deviceConfig.firmwareDriverInterface, buffer, &offset);
5625 CsrUint8Des((u8 *) &primitive->deviceConfig.enableStrictDraftN, buffer, &offset);
5626
5627 return primitive;
5628}
5629
5630
5631size_t CsrWifiSmeInterfaceCapabilityGetCfmSizeof(void *msg)
5632{
5633 size_t bufferSize = 2;
5634
5635 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 9) */
5636 bufferSize += 2; /* CsrResult primitive->status */
5637 bufferSize += 2; /* u16 primitive->numInterfaces */
5638 bufferSize += 2; /* u8 primitive->capBitmap[2] */
5639 return bufferSize;
5640}
5641
5642
5643u8* CsrWifiSmeInterfaceCapabilityGetCfmSer(u8 *ptr, size_t *len, void *msg)
5644{
5645 CsrWifiSmeInterfaceCapabilityGetCfm *primitive = (CsrWifiSmeInterfaceCapabilityGetCfm *)msg;
5646 *len = 0;
5647 CsrUint16Ser(ptr, len, primitive->common.type);
5648 CsrUint16Ser(ptr, len, (u16) primitive->status);
5649 CsrUint16Ser(ptr, len, (u16) primitive->numInterfaces);
5650 CsrMemCpySer(ptr, len, (const void *) primitive->capBitmap, ((u16) (2)));
5651 return(ptr);
5652}
5653
5654
5655void* CsrWifiSmeInterfaceCapabilityGetCfmDes(u8 *buffer, size_t length)
5656{
5657 CsrWifiSmeInterfaceCapabilityGetCfm *primitive = kmalloc(sizeof(CsrWifiSmeInterfaceCapabilityGetCfm), GFP_KERNEL);
5658 size_t offset;
5659 offset = 0;
5660
5661 CsrUint16Des(&primitive->common.type, buffer, &offset);
5662 CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
5663 CsrUint16Des((u16 *) &primitive->numInterfaces, buffer, &offset);
5664 CsrMemCpyDes(primitive->capBitmap, buffer, &offset, ((u16) (2)));
5665
5666 return primitive;
5667}
5668
5669
5670size_t CsrWifiSmeErrorIndSizeof(void *msg)
5671{
5672 CsrWifiSmeErrorInd *primitive = (CsrWifiSmeErrorInd *) msg;
5673 size_t bufferSize = 2;
5674
5675 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 3) */
5676 bufferSize += (primitive->errorMessage ? strlen(primitive->errorMessage) : 0) + 1; /* char* primitive->errorMessage (0 byte len + 1 for NULL Term) */
5677 return bufferSize;
5678}
5679
5680
5681u8* CsrWifiSmeErrorIndSer(u8 *ptr, size_t *len, void *msg)
5682{
5683 CsrWifiSmeErrorInd *primitive = (CsrWifiSmeErrorInd *)msg;
5684 *len = 0;
5685 CsrUint16Ser(ptr, len, primitive->common.type);
5686 CsrCharStringSer(ptr, len, primitive->errorMessage);
5687 return(ptr);
5688}
5689
5690
5691void* CsrWifiSmeErrorIndDes(u8 *buffer, size_t length)
5692{
5693 CsrWifiSmeErrorInd *primitive = kmalloc(sizeof(CsrWifiSmeErrorInd), GFP_KERNEL);
5694 size_t offset;
5695 offset = 0;
5696
5697 CsrUint16Des(&primitive->common.type, buffer, &offset);
5698 CsrCharStringDes(&primitive->errorMessage, buffer, &offset);
5699
5700 return primitive;
5701}
5702
5703
5704void CsrWifiSmeErrorIndSerFree(void *voidPrimitivePointer)
5705{
5706 CsrWifiSmeErrorInd *primitive = (CsrWifiSmeErrorInd *) voidPrimitivePointer;
5707 kfree(primitive->errorMessage);
5708 kfree(primitive);
5709}
5710
5711
5712size_t CsrWifiSmeInfoIndSizeof(void *msg)
5713{
5714 CsrWifiSmeInfoInd *primitive = (CsrWifiSmeInfoInd *) msg;
5715 size_t bufferSize = 2;
5716
5717 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 3) */
5718 bufferSize += (primitive->infoMessage ? strlen(primitive->infoMessage) : 0) + 1; /* char* primitive->infoMessage (0 byte len + 1 for NULL Term) */
5719 return bufferSize;
5720}
5721
5722
5723u8* CsrWifiSmeInfoIndSer(u8 *ptr, size_t *len, void *msg)
5724{
5725 CsrWifiSmeInfoInd *primitive = (CsrWifiSmeInfoInd *)msg;
5726 *len = 0;
5727 CsrUint16Ser(ptr, len, primitive->common.type);
5728 CsrCharStringSer(ptr, len, primitive->infoMessage);
5729 return(ptr);
5730}
5731
5732
5733void* CsrWifiSmeInfoIndDes(u8 *buffer, size_t length)
5734{
5735 CsrWifiSmeInfoInd *primitive = kmalloc(sizeof(CsrWifiSmeInfoInd), GFP_KERNEL);
5736 size_t offset;
5737 offset = 0;
5738
5739 CsrUint16Des(&primitive->common.type, buffer, &offset);
5740 CsrCharStringDes(&primitive->infoMessage, buffer, &offset);
5741
5742 return primitive;
5743}
5744
5745
5746void CsrWifiSmeInfoIndSerFree(void *voidPrimitivePointer)
5747{
5748 CsrWifiSmeInfoInd *primitive = (CsrWifiSmeInfoInd *) voidPrimitivePointer;
5749 kfree(primitive->infoMessage);
5750 kfree(primitive);
5751}
5752
5753
5754size_t CsrWifiSmeCoreDumpIndSizeof(void *msg)
5755{
5756 CsrWifiSmeCoreDumpInd *primitive = (CsrWifiSmeCoreDumpInd *) msg;
5757 size_t bufferSize = 2;
5758
5759 /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */
5760 bufferSize += 4; /* u32 primitive->dataLength */
5761 bufferSize += primitive->dataLength; /* u8 primitive->data */
5762 return bufferSize;
5763}
5764
5765
5766u8* CsrWifiSmeCoreDumpIndSer(u8 *ptr, size_t *len, void *msg)
5767{
5768 CsrWifiSmeCoreDumpInd *primitive = (CsrWifiSmeCoreDumpInd *)msg;
5769 *len = 0;
5770 CsrUint16Ser(ptr, len, primitive->common.type);
5771 CsrUint32Ser(ptr, len, (u32) primitive->dataLength);
5772 if (primitive->dataLength)
5773 {
5774 CsrMemCpySer(ptr, len, (const void *) primitive->data, ((u16) (primitive->dataLength)));
5775 }
5776 return(ptr);
5777}
5778
5779
5780void* CsrWifiSmeCoreDumpIndDes(u8 *buffer, size_t length)
5781{
5782 CsrWifiSmeCoreDumpInd *primitive = kmalloc(sizeof(CsrWifiSmeCoreDumpInd), GFP_KERNEL);
5783 size_t offset;
5784 offset = 0;
5785
5786 CsrUint16Des(&primitive->common.type, buffer, &offset);
5787 CsrUint32Des((u32 *) &primitive->dataLength, buffer, &offset);
5788 if (primitive->dataLength)
5789 {
5790 primitive->data = kmalloc(primitive->dataLength, GFP_KERNEL);
5791 CsrMemCpyDes(primitive->data, buffer, &offset, ((u16) (primitive->dataLength)));
5792 }
5793 else
5794 {
5795 primitive->data = NULL;
5796 }
5797
5798 return primitive;
5799}
5800
5801
5802void CsrWifiSmeCoreDumpIndSerFree(void *voidPrimitivePointer)
5803{
5804 CsrWifiSmeCoreDumpInd *primitive = (CsrWifiSmeCoreDumpInd *) voidPrimitivePointer;
5805 kfree(primitive->data);
5806 kfree(primitive);
5807}
5808
5809
diff --git a/drivers/staging/csr/csr_wifi_sme_serialize.h b/drivers/staging/csr/csr_wifi_sme_serialize.h
deleted file mode 100644
index f8526269b203..000000000000
--- a/drivers/staging/csr/csr_wifi_sme_serialize.h
+++ /dev/null
@@ -1,666 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2012
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_SME_SERIALIZE_H__
14#define CSR_WIFI_SME_SERIALIZE_H__
15
16#include "csr_wifi_msgconv.h"
17#include "csr_wifi_sme_prim.h"
18
19extern void CsrWifiSmePfree(void *ptr);
20
21#define CsrWifiSmeActivateReqSer CsrWifiEventSer
22#define CsrWifiSmeActivateReqDes CsrWifiEventDes
23#define CsrWifiSmeActivateReqSizeof CsrWifiEventSizeof
24#define CsrWifiSmeActivateReqSerFree CsrWifiSmePfree
25
26#define CsrWifiSmeAdhocConfigGetReqSer CsrWifiEventSer
27#define CsrWifiSmeAdhocConfigGetReqDes CsrWifiEventDes
28#define CsrWifiSmeAdhocConfigGetReqSizeof CsrWifiEventSizeof
29#define CsrWifiSmeAdhocConfigGetReqSerFree CsrWifiSmePfree
30
31extern u8 *CsrWifiSmeAdhocConfigSetReqSer(u8 *ptr, size_t *len, void *msg);
32extern void *CsrWifiSmeAdhocConfigSetReqDes(u8 *buffer, size_t len);
33extern size_t CsrWifiSmeAdhocConfigSetReqSizeof(void *msg);
34#define CsrWifiSmeAdhocConfigSetReqSerFree CsrWifiSmePfree
35
36extern u8 *CsrWifiSmeBlacklistReqSer(u8 *ptr, size_t *len, void *msg);
37extern void *CsrWifiSmeBlacklistReqDes(u8 *buffer, size_t len);
38extern size_t CsrWifiSmeBlacklistReqSizeof(void *msg);
39extern void CsrWifiSmeBlacklistReqSerFree(void *msg);
40
41#define CsrWifiSmeCalibrationDataGetReqSer CsrWifiEventSer
42#define CsrWifiSmeCalibrationDataGetReqDes CsrWifiEventDes
43#define CsrWifiSmeCalibrationDataGetReqSizeof CsrWifiEventSizeof
44#define CsrWifiSmeCalibrationDataGetReqSerFree CsrWifiSmePfree
45
46extern u8 *CsrWifiSmeCalibrationDataSetReqSer(u8 *ptr, size_t *len, void *msg);
47extern void *CsrWifiSmeCalibrationDataSetReqDes(u8 *buffer, size_t len);
48extern size_t CsrWifiSmeCalibrationDataSetReqSizeof(void *msg);
49extern void CsrWifiSmeCalibrationDataSetReqSerFree(void *msg);
50
51#define CsrWifiSmeCcxConfigGetReqSer CsrWifiEventCsrUint16Ser
52#define CsrWifiSmeCcxConfigGetReqDes CsrWifiEventCsrUint16Des
53#define CsrWifiSmeCcxConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof
54#define CsrWifiSmeCcxConfigGetReqSerFree CsrWifiSmePfree
55
56extern u8 *CsrWifiSmeCcxConfigSetReqSer(u8 *ptr, size_t *len, void *msg);
57extern void *CsrWifiSmeCcxConfigSetReqDes(u8 *buffer, size_t len);
58extern size_t CsrWifiSmeCcxConfigSetReqSizeof(void *msg);
59#define CsrWifiSmeCcxConfigSetReqSerFree CsrWifiSmePfree
60
61#define CsrWifiSmeCoexConfigGetReqSer CsrWifiEventSer
62#define CsrWifiSmeCoexConfigGetReqDes CsrWifiEventDes
63#define CsrWifiSmeCoexConfigGetReqSizeof CsrWifiEventSizeof
64#define CsrWifiSmeCoexConfigGetReqSerFree CsrWifiSmePfree
65
66extern u8 *CsrWifiSmeCoexConfigSetReqSer(u8 *ptr, size_t *len, void *msg);
67extern void *CsrWifiSmeCoexConfigSetReqDes(u8 *buffer, size_t len);
68extern size_t CsrWifiSmeCoexConfigSetReqSizeof(void *msg);
69#define CsrWifiSmeCoexConfigSetReqSerFree CsrWifiSmePfree
70
71#define CsrWifiSmeCoexInfoGetReqSer CsrWifiEventSer
72#define CsrWifiSmeCoexInfoGetReqDes CsrWifiEventDes
73#define CsrWifiSmeCoexInfoGetReqSizeof CsrWifiEventSizeof
74#define CsrWifiSmeCoexInfoGetReqSerFree CsrWifiSmePfree
75
76extern u8 *CsrWifiSmeConnectReqSer(u8 *ptr, size_t *len, void *msg);
77extern void *CsrWifiSmeConnectReqDes(u8 *buffer, size_t len);
78extern size_t CsrWifiSmeConnectReqSizeof(void *msg);
79extern void CsrWifiSmeConnectReqSerFree(void *msg);
80
81#define CsrWifiSmeConnectionConfigGetReqSer CsrWifiEventCsrUint16Ser
82#define CsrWifiSmeConnectionConfigGetReqDes CsrWifiEventCsrUint16Des
83#define CsrWifiSmeConnectionConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof
84#define CsrWifiSmeConnectionConfigGetReqSerFree CsrWifiSmePfree
85
86#define CsrWifiSmeConnectionInfoGetReqSer CsrWifiEventCsrUint16Ser
87#define CsrWifiSmeConnectionInfoGetReqDes CsrWifiEventCsrUint16Des
88#define CsrWifiSmeConnectionInfoGetReqSizeof CsrWifiEventCsrUint16Sizeof
89#define CsrWifiSmeConnectionInfoGetReqSerFree CsrWifiSmePfree
90
91#define CsrWifiSmeConnectionStatsGetReqSer CsrWifiEventCsrUint16Ser
92#define CsrWifiSmeConnectionStatsGetReqDes CsrWifiEventCsrUint16Des
93#define CsrWifiSmeConnectionStatsGetReqSizeof CsrWifiEventCsrUint16Sizeof
94#define CsrWifiSmeConnectionStatsGetReqSerFree CsrWifiSmePfree
95
96#define CsrWifiSmeDeactivateReqSer CsrWifiEventSer
97#define CsrWifiSmeDeactivateReqDes CsrWifiEventDes
98#define CsrWifiSmeDeactivateReqSizeof CsrWifiEventSizeof
99#define CsrWifiSmeDeactivateReqSerFree CsrWifiSmePfree
100
101#define CsrWifiSmeDisconnectReqSer CsrWifiEventCsrUint16Ser
102#define CsrWifiSmeDisconnectReqDes CsrWifiEventCsrUint16Des
103#define CsrWifiSmeDisconnectReqSizeof CsrWifiEventCsrUint16Sizeof
104#define CsrWifiSmeDisconnectReqSerFree CsrWifiSmePfree
105
106#define CsrWifiSmeEventMaskSetReqSer CsrWifiEventCsrUint32Ser
107#define CsrWifiSmeEventMaskSetReqDes CsrWifiEventCsrUint32Des
108#define CsrWifiSmeEventMaskSetReqSizeof CsrWifiEventCsrUint32Sizeof
109#define CsrWifiSmeEventMaskSetReqSerFree CsrWifiSmePfree
110
111#define CsrWifiSmeHostConfigGetReqSer CsrWifiEventCsrUint16Ser
112#define CsrWifiSmeHostConfigGetReqDes CsrWifiEventCsrUint16Des
113#define CsrWifiSmeHostConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof
114#define CsrWifiSmeHostConfigGetReqSerFree CsrWifiSmePfree
115
116extern u8 *CsrWifiSmeHostConfigSetReqSer(u8 *ptr, size_t *len, void *msg);
117extern void *CsrWifiSmeHostConfigSetReqDes(u8 *buffer, size_t len);
118extern size_t CsrWifiSmeHostConfigSetReqSizeof(void *msg);
119#define CsrWifiSmeHostConfigSetReqSerFree CsrWifiSmePfree
120
121extern u8 *CsrWifiSmeKeyReqSer(u8 *ptr, size_t *len, void *msg);
122extern void *CsrWifiSmeKeyReqDes(u8 *buffer, size_t len);
123extern size_t CsrWifiSmeKeyReqSizeof(void *msg);
124#define CsrWifiSmeKeyReqSerFree CsrWifiSmePfree
125
126#define CsrWifiSmeLinkQualityGetReqSer CsrWifiEventCsrUint16Ser
127#define CsrWifiSmeLinkQualityGetReqDes CsrWifiEventCsrUint16Des
128#define CsrWifiSmeLinkQualityGetReqSizeof CsrWifiEventCsrUint16Sizeof
129#define CsrWifiSmeLinkQualityGetReqSerFree CsrWifiSmePfree
130
131#define CsrWifiSmeMibConfigGetReqSer CsrWifiEventSer
132#define CsrWifiSmeMibConfigGetReqDes CsrWifiEventDes
133#define CsrWifiSmeMibConfigGetReqSizeof CsrWifiEventSizeof
134#define CsrWifiSmeMibConfigGetReqSerFree CsrWifiSmePfree
135
136extern u8 *CsrWifiSmeMibConfigSetReqSer(u8 *ptr, size_t *len, void *msg);
137extern void *CsrWifiSmeMibConfigSetReqDes(u8 *buffer, size_t len);
138extern size_t CsrWifiSmeMibConfigSetReqSizeof(void *msg);
139#define CsrWifiSmeMibConfigSetReqSerFree CsrWifiSmePfree
140
141extern u8 *CsrWifiSmeMibGetNextReqSer(u8 *ptr, size_t *len, void *msg);
142extern void *CsrWifiSmeMibGetNextReqDes(u8 *buffer, size_t len);
143extern size_t CsrWifiSmeMibGetNextReqSizeof(void *msg);
144extern void CsrWifiSmeMibGetNextReqSerFree(void *msg);
145
146extern u8 *CsrWifiSmeMibGetReqSer(u8 *ptr, size_t *len, void *msg);
147extern void *CsrWifiSmeMibGetReqDes(u8 *buffer, size_t len);
148extern size_t CsrWifiSmeMibGetReqSizeof(void *msg);
149extern void CsrWifiSmeMibGetReqSerFree(void *msg);
150
151extern u8 *CsrWifiSmeMibSetReqSer(u8 *ptr, size_t *len, void *msg);
152extern void *CsrWifiSmeMibSetReqDes(u8 *buffer, size_t len);
153extern size_t CsrWifiSmeMibSetReqSizeof(void *msg);
154extern void CsrWifiSmeMibSetReqSerFree(void *msg);
155
156extern u8 *CsrWifiSmeMulticastAddressReqSer(u8 *ptr, size_t *len, void *msg);
157extern void *CsrWifiSmeMulticastAddressReqDes(u8 *buffer, size_t len);
158extern size_t CsrWifiSmeMulticastAddressReqSizeof(void *msg);
159extern void CsrWifiSmeMulticastAddressReqSerFree(void *msg);
160
161extern u8 *CsrWifiSmePacketFilterSetReqSer(u8 *ptr, size_t *len, void *msg);
162extern void *CsrWifiSmePacketFilterSetReqDes(u8 *buffer, size_t len);
163extern size_t CsrWifiSmePacketFilterSetReqSizeof(void *msg);
164extern void CsrWifiSmePacketFilterSetReqSerFree(void *msg);
165
166#define CsrWifiSmePermanentMacAddressGetReqSer CsrWifiEventSer
167#define CsrWifiSmePermanentMacAddressGetReqDes CsrWifiEventDes
168#define CsrWifiSmePermanentMacAddressGetReqSizeof CsrWifiEventSizeof
169#define CsrWifiSmePermanentMacAddressGetReqSerFree CsrWifiSmePfree
170
171extern u8 *CsrWifiSmePmkidReqSer(u8 *ptr, size_t *len, void *msg);
172extern void *CsrWifiSmePmkidReqDes(u8 *buffer, size_t len);
173extern size_t CsrWifiSmePmkidReqSizeof(void *msg);
174extern void CsrWifiSmePmkidReqSerFree(void *msg);
175
176#define CsrWifiSmePowerConfigGetReqSer CsrWifiEventSer
177#define CsrWifiSmePowerConfigGetReqDes CsrWifiEventDes
178#define CsrWifiSmePowerConfigGetReqSizeof CsrWifiEventSizeof
179#define CsrWifiSmePowerConfigGetReqSerFree CsrWifiSmePfree
180
181extern u8 *CsrWifiSmePowerConfigSetReqSer(u8 *ptr, size_t *len, void *msg);
182extern void *CsrWifiSmePowerConfigSetReqDes(u8 *buffer, size_t len);
183extern size_t CsrWifiSmePowerConfigSetReqSizeof(void *msg);
184#define CsrWifiSmePowerConfigSetReqSerFree CsrWifiSmePfree
185
186#define CsrWifiSmeRegulatoryDomainInfoGetReqSer CsrWifiEventSer
187#define CsrWifiSmeRegulatoryDomainInfoGetReqDes CsrWifiEventDes
188#define CsrWifiSmeRegulatoryDomainInfoGetReqSizeof CsrWifiEventSizeof
189#define CsrWifiSmeRegulatoryDomainInfoGetReqSerFree CsrWifiSmePfree
190
191#define CsrWifiSmeRoamingConfigGetReqSer CsrWifiEventCsrUint16Ser
192#define CsrWifiSmeRoamingConfigGetReqDes CsrWifiEventCsrUint16Des
193#define CsrWifiSmeRoamingConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof
194#define CsrWifiSmeRoamingConfigGetReqSerFree CsrWifiSmePfree
195
196extern u8 *CsrWifiSmeRoamingConfigSetReqSer(u8 *ptr, size_t *len, void *msg);
197extern void *CsrWifiSmeRoamingConfigSetReqDes(u8 *buffer, size_t len);
198extern size_t CsrWifiSmeRoamingConfigSetReqSizeof(void *msg);
199#define CsrWifiSmeRoamingConfigSetReqSerFree CsrWifiSmePfree
200
201#define CsrWifiSmeScanConfigGetReqSer CsrWifiEventSer
202#define CsrWifiSmeScanConfigGetReqDes CsrWifiEventDes
203#define CsrWifiSmeScanConfigGetReqSizeof CsrWifiEventSizeof
204#define CsrWifiSmeScanConfigGetReqSerFree CsrWifiSmePfree
205
206extern u8 *CsrWifiSmeScanConfigSetReqSer(u8 *ptr, size_t *len, void *msg);
207extern void *CsrWifiSmeScanConfigSetReqDes(u8 *buffer, size_t len);
208extern size_t CsrWifiSmeScanConfigSetReqSizeof(void *msg);
209extern void CsrWifiSmeScanConfigSetReqSerFree(void *msg);
210
211extern u8 *CsrWifiSmeScanFullReqSer(u8 *ptr, size_t *len, void *msg);
212extern void *CsrWifiSmeScanFullReqDes(u8 *buffer, size_t len);
213extern size_t CsrWifiSmeScanFullReqSizeof(void *msg);
214extern void CsrWifiSmeScanFullReqSerFree(void *msg);
215
216#define CsrWifiSmeScanResultsFlushReqSer CsrWifiEventSer
217#define CsrWifiSmeScanResultsFlushReqDes CsrWifiEventDes
218#define CsrWifiSmeScanResultsFlushReqSizeof CsrWifiEventSizeof
219#define CsrWifiSmeScanResultsFlushReqSerFree CsrWifiSmePfree
220
221#define CsrWifiSmeScanResultsGetReqSer CsrWifiEventSer
222#define CsrWifiSmeScanResultsGetReqDes CsrWifiEventDes
223#define CsrWifiSmeScanResultsGetReqSizeof CsrWifiEventSizeof
224#define CsrWifiSmeScanResultsGetReqSerFree CsrWifiSmePfree
225
226#define CsrWifiSmeSmeStaConfigGetReqSer CsrWifiEventCsrUint16Ser
227#define CsrWifiSmeSmeStaConfigGetReqDes CsrWifiEventCsrUint16Des
228#define CsrWifiSmeSmeStaConfigGetReqSizeof CsrWifiEventCsrUint16Sizeof
229#define CsrWifiSmeSmeStaConfigGetReqSerFree CsrWifiSmePfree
230
231extern u8 *CsrWifiSmeSmeStaConfigSetReqSer(u8 *ptr, size_t *len, void *msg);
232extern void *CsrWifiSmeSmeStaConfigSetReqDes(u8 *buffer, size_t len);
233extern size_t CsrWifiSmeSmeStaConfigSetReqSizeof(void *msg);
234#define CsrWifiSmeSmeStaConfigSetReqSerFree CsrWifiSmePfree
235
236#define CsrWifiSmeStationMacAddressGetReqSer CsrWifiEventSer
237#define CsrWifiSmeStationMacAddressGetReqDes CsrWifiEventDes
238#define CsrWifiSmeStationMacAddressGetReqSizeof CsrWifiEventSizeof
239#define CsrWifiSmeStationMacAddressGetReqSerFree CsrWifiSmePfree
240
241extern u8 *CsrWifiSmeTspecReqSer(u8 *ptr, size_t *len, void *msg);
242extern void *CsrWifiSmeTspecReqDes(u8 *buffer, size_t len);
243extern size_t CsrWifiSmeTspecReqSizeof(void *msg);
244extern void CsrWifiSmeTspecReqSerFree(void *msg);
245
246#define CsrWifiSmeVersionsGetReqSer CsrWifiEventSer
247#define CsrWifiSmeVersionsGetReqDes CsrWifiEventDes
248#define CsrWifiSmeVersionsGetReqSizeof CsrWifiEventSizeof
249#define CsrWifiSmeVersionsGetReqSerFree CsrWifiSmePfree
250
251extern u8 *CsrWifiSmeWifiFlightmodeReqSer(u8 *ptr, size_t *len, void *msg);
252extern void *CsrWifiSmeWifiFlightmodeReqDes(u8 *buffer, size_t len);
253extern size_t CsrWifiSmeWifiFlightmodeReqSizeof(void *msg);
254extern void CsrWifiSmeWifiFlightmodeReqSerFree(void *msg);
255
256#define CsrWifiSmeWifiOffReqSer CsrWifiEventSer
257#define CsrWifiSmeWifiOffReqDes CsrWifiEventDes
258#define CsrWifiSmeWifiOffReqSizeof CsrWifiEventSizeof
259#define CsrWifiSmeWifiOffReqSerFree CsrWifiSmePfree
260
261extern u8 *CsrWifiSmeWifiOnReqSer(u8 *ptr, size_t *len, void *msg);
262extern void *CsrWifiSmeWifiOnReqDes(u8 *buffer, size_t len);
263extern size_t CsrWifiSmeWifiOnReqSizeof(void *msg);
264extern void CsrWifiSmeWifiOnReqSerFree(void *msg);
265
266extern u8 *CsrWifiSmeCloakedSsidsSetReqSer(u8 *ptr, size_t *len, void *msg);
267extern void *CsrWifiSmeCloakedSsidsSetReqDes(u8 *buffer, size_t len);
268extern size_t CsrWifiSmeCloakedSsidsSetReqSizeof(void *msg);
269extern void CsrWifiSmeCloakedSsidsSetReqSerFree(void *msg);
270
271#define CsrWifiSmeCloakedSsidsGetReqSer CsrWifiEventSer
272#define CsrWifiSmeCloakedSsidsGetReqDes CsrWifiEventDes
273#define CsrWifiSmeCloakedSsidsGetReqSizeof CsrWifiEventSizeof
274#define CsrWifiSmeCloakedSsidsGetReqSerFree CsrWifiSmePfree
275
276#define CsrWifiSmeSmeCommonConfigGetReqSer CsrWifiEventSer
277#define CsrWifiSmeSmeCommonConfigGetReqDes CsrWifiEventDes
278#define CsrWifiSmeSmeCommonConfigGetReqSizeof CsrWifiEventSizeof
279#define CsrWifiSmeSmeCommonConfigGetReqSerFree CsrWifiSmePfree
280
281extern u8 *CsrWifiSmeSmeCommonConfigSetReqSer(u8 *ptr, size_t *len, void *msg);
282extern void *CsrWifiSmeSmeCommonConfigSetReqDes(u8 *buffer, size_t len);
283extern size_t CsrWifiSmeSmeCommonConfigSetReqSizeof(void *msg);
284#define CsrWifiSmeSmeCommonConfigSetReqSerFree CsrWifiSmePfree
285
286#define CsrWifiSmeInterfaceCapabilityGetReqSer CsrWifiEventSer
287#define CsrWifiSmeInterfaceCapabilityGetReqDes CsrWifiEventDes
288#define CsrWifiSmeInterfaceCapabilityGetReqSizeof CsrWifiEventSizeof
289#define CsrWifiSmeInterfaceCapabilityGetReqSerFree CsrWifiSmePfree
290
291extern u8 *CsrWifiSmeWpsConfigurationReqSer(u8 *ptr, size_t *len, void *msg);
292extern void *CsrWifiSmeWpsConfigurationReqDes(u8 *buffer, size_t len);
293extern size_t CsrWifiSmeWpsConfigurationReqSizeof(void *msg);
294extern void CsrWifiSmeWpsConfigurationReqSerFree(void *msg);
295
296extern u8 *CsrWifiSmeSetReqSer(u8 *ptr, size_t *len, void *msg);
297extern void *CsrWifiSmeSetReqDes(u8 *buffer, size_t len);
298extern size_t CsrWifiSmeSetReqSizeof(void *msg);
299extern void CsrWifiSmeSetReqSerFree(void *msg);
300
301#define CsrWifiSmeActivateCfmSer CsrWifiEventCsrUint16Ser
302#define CsrWifiSmeActivateCfmDes CsrWifiEventCsrUint16Des
303#define CsrWifiSmeActivateCfmSizeof CsrWifiEventCsrUint16Sizeof
304#define CsrWifiSmeActivateCfmSerFree CsrWifiSmePfree
305
306extern u8 *CsrWifiSmeAdhocConfigGetCfmSer(u8 *ptr, size_t *len, void *msg);
307extern void *CsrWifiSmeAdhocConfigGetCfmDes(u8 *buffer, size_t len);
308extern size_t CsrWifiSmeAdhocConfigGetCfmSizeof(void *msg);
309#define CsrWifiSmeAdhocConfigGetCfmSerFree CsrWifiSmePfree
310
311#define CsrWifiSmeAdhocConfigSetCfmSer CsrWifiEventCsrUint16Ser
312#define CsrWifiSmeAdhocConfigSetCfmDes CsrWifiEventCsrUint16Des
313#define CsrWifiSmeAdhocConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof
314#define CsrWifiSmeAdhocConfigSetCfmSerFree CsrWifiSmePfree
315
316extern u8 *CsrWifiSmeAssociationCompleteIndSer(u8 *ptr, size_t *len, void *msg);
317extern void *CsrWifiSmeAssociationCompleteIndDes(u8 *buffer, size_t len);
318extern size_t CsrWifiSmeAssociationCompleteIndSizeof(void *msg);
319extern void CsrWifiSmeAssociationCompleteIndSerFree(void *msg);
320
321extern u8 *CsrWifiSmeAssociationStartIndSer(u8 *ptr, size_t *len, void *msg);
322extern void *CsrWifiSmeAssociationStartIndDes(u8 *buffer, size_t len);
323extern size_t CsrWifiSmeAssociationStartIndSizeof(void *msg);
324#define CsrWifiSmeAssociationStartIndSerFree CsrWifiSmePfree
325
326extern u8 *CsrWifiSmeBlacklistCfmSer(u8 *ptr, size_t *len, void *msg);
327extern void *CsrWifiSmeBlacklistCfmDes(u8 *buffer, size_t len);
328extern size_t CsrWifiSmeBlacklistCfmSizeof(void *msg);
329extern void CsrWifiSmeBlacklistCfmSerFree(void *msg);
330
331extern u8 *CsrWifiSmeCalibrationDataGetCfmSer(u8 *ptr, size_t *len, void *msg);
332extern void *CsrWifiSmeCalibrationDataGetCfmDes(u8 *buffer, size_t len);
333extern size_t CsrWifiSmeCalibrationDataGetCfmSizeof(void *msg);
334extern void CsrWifiSmeCalibrationDataGetCfmSerFree(void *msg);
335
336#define CsrWifiSmeCalibrationDataSetCfmSer CsrWifiEventCsrUint16Ser
337#define CsrWifiSmeCalibrationDataSetCfmDes CsrWifiEventCsrUint16Des
338#define CsrWifiSmeCalibrationDataSetCfmSizeof CsrWifiEventCsrUint16Sizeof
339#define CsrWifiSmeCalibrationDataSetCfmSerFree CsrWifiSmePfree
340
341extern u8 *CsrWifiSmeCcxConfigGetCfmSer(u8 *ptr, size_t *len, void *msg);
342extern void *CsrWifiSmeCcxConfigGetCfmDes(u8 *buffer, size_t len);
343extern size_t CsrWifiSmeCcxConfigGetCfmSizeof(void *msg);
344#define CsrWifiSmeCcxConfigGetCfmSerFree CsrWifiSmePfree
345
346extern u8 *CsrWifiSmeCcxConfigSetCfmSer(u8 *ptr, size_t *len, void *msg);
347extern void *CsrWifiSmeCcxConfigSetCfmDes(u8 *buffer, size_t len);
348extern size_t CsrWifiSmeCcxConfigSetCfmSizeof(void *msg);
349#define CsrWifiSmeCcxConfigSetCfmSerFree CsrWifiSmePfree
350
351extern u8 *CsrWifiSmeCoexConfigGetCfmSer(u8 *ptr, size_t *len, void *msg);
352extern void *CsrWifiSmeCoexConfigGetCfmDes(u8 *buffer, size_t len);
353extern size_t CsrWifiSmeCoexConfigGetCfmSizeof(void *msg);
354#define CsrWifiSmeCoexConfigGetCfmSerFree CsrWifiSmePfree
355
356#define CsrWifiSmeCoexConfigSetCfmSer CsrWifiEventCsrUint16Ser
357#define CsrWifiSmeCoexConfigSetCfmDes CsrWifiEventCsrUint16Des
358#define CsrWifiSmeCoexConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof
359#define CsrWifiSmeCoexConfigSetCfmSerFree CsrWifiSmePfree
360
361extern u8 *CsrWifiSmeCoexInfoGetCfmSer(u8 *ptr, size_t *len, void *msg);
362extern void *CsrWifiSmeCoexInfoGetCfmDes(u8 *buffer, size_t len);
363extern size_t CsrWifiSmeCoexInfoGetCfmSizeof(void *msg);
364#define CsrWifiSmeCoexInfoGetCfmSerFree CsrWifiSmePfree
365
366extern u8 *CsrWifiSmeConnectCfmSer(u8 *ptr, size_t *len, void *msg);
367extern void *CsrWifiSmeConnectCfmDes(u8 *buffer, size_t len);
368extern size_t CsrWifiSmeConnectCfmSizeof(void *msg);
369#define CsrWifiSmeConnectCfmSerFree CsrWifiSmePfree
370
371extern u8 *CsrWifiSmeConnectionConfigGetCfmSer(u8 *ptr, size_t *len, void *msg);
372extern void *CsrWifiSmeConnectionConfigGetCfmDes(u8 *buffer, size_t len);
373extern size_t CsrWifiSmeConnectionConfigGetCfmSizeof(void *msg);
374extern void CsrWifiSmeConnectionConfigGetCfmSerFree(void *msg);
375
376extern u8 *CsrWifiSmeConnectionInfoGetCfmSer(u8 *ptr, size_t *len, void *msg);
377extern void *CsrWifiSmeConnectionInfoGetCfmDes(u8 *buffer, size_t len);
378extern size_t CsrWifiSmeConnectionInfoGetCfmSizeof(void *msg);
379extern void CsrWifiSmeConnectionInfoGetCfmSerFree(void *msg);
380
381extern u8 *CsrWifiSmeConnectionQualityIndSer(u8 *ptr, size_t *len, void *msg);
382extern void *CsrWifiSmeConnectionQualityIndDes(u8 *buffer, size_t len);
383extern size_t CsrWifiSmeConnectionQualityIndSizeof(void *msg);
384#define CsrWifiSmeConnectionQualityIndSerFree CsrWifiSmePfree
385
386extern u8 *CsrWifiSmeConnectionStatsGetCfmSer(u8 *ptr, size_t *len, void *msg);
387extern void *CsrWifiSmeConnectionStatsGetCfmDes(u8 *buffer, size_t len);
388extern size_t CsrWifiSmeConnectionStatsGetCfmSizeof(void *msg);
389#define CsrWifiSmeConnectionStatsGetCfmSerFree CsrWifiSmePfree
390
391#define CsrWifiSmeDeactivateCfmSer CsrWifiEventCsrUint16Ser
392#define CsrWifiSmeDeactivateCfmDes CsrWifiEventCsrUint16Des
393#define CsrWifiSmeDeactivateCfmSizeof CsrWifiEventCsrUint16Sizeof
394#define CsrWifiSmeDeactivateCfmSerFree CsrWifiSmePfree
395
396extern u8 *CsrWifiSmeDisconnectCfmSer(u8 *ptr, size_t *len, void *msg);
397extern void *CsrWifiSmeDisconnectCfmDes(u8 *buffer, size_t len);
398extern size_t CsrWifiSmeDisconnectCfmSizeof(void *msg);
399#define CsrWifiSmeDisconnectCfmSerFree CsrWifiSmePfree
400
401#define CsrWifiSmeEventMaskSetCfmSer CsrWifiEventCsrUint16Ser
402#define CsrWifiSmeEventMaskSetCfmDes CsrWifiEventCsrUint16Des
403#define CsrWifiSmeEventMaskSetCfmSizeof CsrWifiEventCsrUint16Sizeof
404#define CsrWifiSmeEventMaskSetCfmSerFree CsrWifiSmePfree
405
406extern u8 *CsrWifiSmeHostConfigGetCfmSer(u8 *ptr, size_t *len, void *msg);
407extern void *CsrWifiSmeHostConfigGetCfmDes(u8 *buffer, size_t len);
408extern size_t CsrWifiSmeHostConfigGetCfmSizeof(void *msg);
409#define CsrWifiSmeHostConfigGetCfmSerFree CsrWifiSmePfree
410
411extern u8 *CsrWifiSmeHostConfigSetCfmSer(u8 *ptr, size_t *len, void *msg);
412extern void *CsrWifiSmeHostConfigSetCfmDes(u8 *buffer, size_t len);
413extern size_t CsrWifiSmeHostConfigSetCfmSizeof(void *msg);
414#define CsrWifiSmeHostConfigSetCfmSerFree CsrWifiSmePfree
415
416extern u8 *CsrWifiSmeIbssStationIndSer(u8 *ptr, size_t *len, void *msg);
417extern void *CsrWifiSmeIbssStationIndDes(u8 *buffer, size_t len);
418extern size_t CsrWifiSmeIbssStationIndSizeof(void *msg);
419#define CsrWifiSmeIbssStationIndSerFree CsrWifiSmePfree
420
421extern u8 *CsrWifiSmeKeyCfmSer(u8 *ptr, size_t *len, void *msg);
422extern void *CsrWifiSmeKeyCfmDes(u8 *buffer, size_t len);
423extern size_t CsrWifiSmeKeyCfmSizeof(void *msg);
424#define CsrWifiSmeKeyCfmSerFree CsrWifiSmePfree
425
426extern u8 *CsrWifiSmeLinkQualityGetCfmSer(u8 *ptr, size_t *len, void *msg);
427extern void *CsrWifiSmeLinkQualityGetCfmDes(u8 *buffer, size_t len);
428extern size_t CsrWifiSmeLinkQualityGetCfmSizeof(void *msg);
429#define CsrWifiSmeLinkQualityGetCfmSerFree CsrWifiSmePfree
430
431extern u8 *CsrWifiSmeMediaStatusIndSer(u8 *ptr, size_t *len, void *msg);
432extern void *CsrWifiSmeMediaStatusIndDes(u8 *buffer, size_t len);
433extern size_t CsrWifiSmeMediaStatusIndSizeof(void *msg);
434extern void CsrWifiSmeMediaStatusIndSerFree(void *msg);
435
436extern u8 *CsrWifiSmeMibConfigGetCfmSer(u8 *ptr, size_t *len, void *msg);
437extern void *CsrWifiSmeMibConfigGetCfmDes(u8 *buffer, size_t len);
438extern size_t CsrWifiSmeMibConfigGetCfmSizeof(void *msg);
439#define CsrWifiSmeMibConfigGetCfmSerFree CsrWifiSmePfree
440
441#define CsrWifiSmeMibConfigSetCfmSer CsrWifiEventCsrUint16Ser
442#define CsrWifiSmeMibConfigSetCfmDes CsrWifiEventCsrUint16Des
443#define CsrWifiSmeMibConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof
444#define CsrWifiSmeMibConfigSetCfmSerFree CsrWifiSmePfree
445
446extern u8 *CsrWifiSmeMibGetCfmSer(u8 *ptr, size_t *len, void *msg);
447extern void *CsrWifiSmeMibGetCfmDes(u8 *buffer, size_t len);
448extern size_t CsrWifiSmeMibGetCfmSizeof(void *msg);
449extern void CsrWifiSmeMibGetCfmSerFree(void *msg);
450
451extern u8 *CsrWifiSmeMibGetNextCfmSer(u8 *ptr, size_t *len, void *msg);
452extern void *CsrWifiSmeMibGetNextCfmDes(u8 *buffer, size_t len);
453extern size_t CsrWifiSmeMibGetNextCfmSizeof(void *msg);
454extern void CsrWifiSmeMibGetNextCfmSerFree(void *msg);
455
456#define CsrWifiSmeMibSetCfmSer CsrWifiEventCsrUint16Ser
457#define CsrWifiSmeMibSetCfmDes CsrWifiEventCsrUint16Des
458#define CsrWifiSmeMibSetCfmSizeof CsrWifiEventCsrUint16Sizeof
459#define CsrWifiSmeMibSetCfmSerFree CsrWifiSmePfree
460
461extern u8 *CsrWifiSmeMicFailureIndSer(u8 *ptr, size_t *len, void *msg);
462extern void *CsrWifiSmeMicFailureIndDes(u8 *buffer, size_t len);
463extern size_t CsrWifiSmeMicFailureIndSizeof(void *msg);
464#define CsrWifiSmeMicFailureIndSerFree CsrWifiSmePfree
465
466extern u8 *CsrWifiSmeMulticastAddressCfmSer(u8 *ptr, size_t *len, void *msg);
467extern void *CsrWifiSmeMulticastAddressCfmDes(u8 *buffer, size_t len);
468extern size_t CsrWifiSmeMulticastAddressCfmSizeof(void *msg);
469extern void CsrWifiSmeMulticastAddressCfmSerFree(void *msg);
470
471extern u8 *CsrWifiSmePacketFilterSetCfmSer(u8 *ptr, size_t *len, void *msg);
472extern void *CsrWifiSmePacketFilterSetCfmDes(u8 *buffer, size_t len);
473extern size_t CsrWifiSmePacketFilterSetCfmSizeof(void *msg);
474#define CsrWifiSmePacketFilterSetCfmSerFree CsrWifiSmePfree
475
476extern u8 *CsrWifiSmePermanentMacAddressGetCfmSer(u8 *ptr, size_t *len,
477 void *msg);
478extern void *CsrWifiSmePermanentMacAddressGetCfmDes(u8 *buffer, size_t len);
479extern size_t CsrWifiSmePermanentMacAddressGetCfmSizeof(void *msg);
480#define CsrWifiSmePermanentMacAddressGetCfmSerFree CsrWifiSmePfree
481
482extern u8 *CsrWifiSmePmkidCandidateListIndSer(u8 *ptr, size_t *len, void *msg);
483extern void *CsrWifiSmePmkidCandidateListIndDes(u8 *buffer, size_t len);
484extern size_t CsrWifiSmePmkidCandidateListIndSizeof(void *msg);
485extern void CsrWifiSmePmkidCandidateListIndSerFree(void *msg);
486
487extern u8 *CsrWifiSmePmkidCfmSer(u8 *ptr, size_t *len, void *msg);
488extern void *CsrWifiSmePmkidCfmDes(u8 *buffer, size_t len);
489extern size_t CsrWifiSmePmkidCfmSizeof(void *msg);
490extern void CsrWifiSmePmkidCfmSerFree(void *msg);
491
492extern u8 *CsrWifiSmePowerConfigGetCfmSer(u8 *ptr, size_t *len, void *msg);
493extern void *CsrWifiSmePowerConfigGetCfmDes(u8 *buffer, size_t len);
494extern size_t CsrWifiSmePowerConfigGetCfmSizeof(void *msg);
495#define CsrWifiSmePowerConfigGetCfmSerFree CsrWifiSmePfree
496
497#define CsrWifiSmePowerConfigSetCfmSer CsrWifiEventCsrUint16Ser
498#define CsrWifiSmePowerConfigSetCfmDes CsrWifiEventCsrUint16Des
499#define CsrWifiSmePowerConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof
500#define CsrWifiSmePowerConfigSetCfmSerFree CsrWifiSmePfree
501
502extern u8 *CsrWifiSmeRegulatoryDomainInfoGetCfmSer(u8 *ptr, size_t *len,
503 void *msg);
504extern void *CsrWifiSmeRegulatoryDomainInfoGetCfmDes(u8 *buffer, size_t len);
505extern size_t CsrWifiSmeRegulatoryDomainInfoGetCfmSizeof(void *msg);
506#define CsrWifiSmeRegulatoryDomainInfoGetCfmSerFree CsrWifiSmePfree
507
508extern u8 *CsrWifiSmeRoamCompleteIndSer(u8 *ptr, size_t *len, void *msg);
509extern void *CsrWifiSmeRoamCompleteIndDes(u8 *buffer, size_t len);
510extern size_t CsrWifiSmeRoamCompleteIndSizeof(void *msg);
511#define CsrWifiSmeRoamCompleteIndSerFree CsrWifiSmePfree
512
513extern u8 *CsrWifiSmeRoamStartIndSer(u8 *ptr, size_t *len, void *msg);
514extern void *CsrWifiSmeRoamStartIndDes(u8 *buffer, size_t len);
515extern size_t CsrWifiSmeRoamStartIndSizeof(void *msg);
516#define CsrWifiSmeRoamStartIndSerFree CsrWifiSmePfree
517
518extern u8 *CsrWifiSmeRoamingConfigGetCfmSer(u8 *ptr, size_t *len, void *msg);
519extern void *CsrWifiSmeRoamingConfigGetCfmDes(u8 *buffer, size_t len);
520extern size_t CsrWifiSmeRoamingConfigGetCfmSizeof(void *msg);
521#define CsrWifiSmeRoamingConfigGetCfmSerFree CsrWifiSmePfree
522
523extern u8 *CsrWifiSmeRoamingConfigSetCfmSer(u8 *ptr, size_t *len, void *msg);
524extern void *CsrWifiSmeRoamingConfigSetCfmDes(u8 *buffer, size_t len);
525extern size_t CsrWifiSmeRoamingConfigSetCfmSizeof(void *msg);
526#define CsrWifiSmeRoamingConfigSetCfmSerFree CsrWifiSmePfree
527
528extern u8 *CsrWifiSmeScanConfigGetCfmSer(u8 *ptr, size_t *len, void *msg);
529extern void *CsrWifiSmeScanConfigGetCfmDes(u8 *buffer, size_t len);
530extern size_t CsrWifiSmeScanConfigGetCfmSizeof(void *msg);
531extern void CsrWifiSmeScanConfigGetCfmSerFree(void *msg);
532
533#define CsrWifiSmeScanConfigSetCfmSer CsrWifiEventCsrUint16Ser
534#define CsrWifiSmeScanConfigSetCfmDes CsrWifiEventCsrUint16Des
535#define CsrWifiSmeScanConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof
536#define CsrWifiSmeScanConfigSetCfmSerFree CsrWifiSmePfree
537
538#define CsrWifiSmeScanFullCfmSer CsrWifiEventCsrUint16Ser
539#define CsrWifiSmeScanFullCfmDes CsrWifiEventCsrUint16Des
540#define CsrWifiSmeScanFullCfmSizeof CsrWifiEventCsrUint16Sizeof
541#define CsrWifiSmeScanFullCfmSerFree CsrWifiSmePfree
542
543extern u8 *CsrWifiSmeScanResultIndSer(u8 *ptr, size_t *len, void *msg);
544extern void *CsrWifiSmeScanResultIndDes(u8 *buffer, size_t len);
545extern size_t CsrWifiSmeScanResultIndSizeof(void *msg);
546extern void CsrWifiSmeScanResultIndSerFree(void *msg);
547
548#define CsrWifiSmeScanResultsFlushCfmSer CsrWifiEventCsrUint16Ser
549#define CsrWifiSmeScanResultsFlushCfmDes CsrWifiEventCsrUint16Des
550#define CsrWifiSmeScanResultsFlushCfmSizeof CsrWifiEventCsrUint16Sizeof
551#define CsrWifiSmeScanResultsFlushCfmSerFree CsrWifiSmePfree
552
553extern u8 *CsrWifiSmeScanResultsGetCfmSer(u8 *ptr, size_t *len, void *msg);
554extern void *CsrWifiSmeScanResultsGetCfmDes(u8 *buffer, size_t len);
555extern size_t CsrWifiSmeScanResultsGetCfmSizeof(void *msg);
556extern void CsrWifiSmeScanResultsGetCfmSerFree(void *msg);
557
558extern u8 *CsrWifiSmeSmeStaConfigGetCfmSer(u8 *ptr, size_t *len, void *msg);
559extern void *CsrWifiSmeSmeStaConfigGetCfmDes(u8 *buffer, size_t len);
560extern size_t CsrWifiSmeSmeStaConfigGetCfmSizeof(void *msg);
561#define CsrWifiSmeSmeStaConfigGetCfmSerFree CsrWifiSmePfree
562
563extern u8 *CsrWifiSmeSmeStaConfigSetCfmSer(u8 *ptr, size_t *len, void *msg);
564extern void *CsrWifiSmeSmeStaConfigSetCfmDes(u8 *buffer, size_t len);
565extern size_t CsrWifiSmeSmeStaConfigSetCfmSizeof(void *msg);
566#define CsrWifiSmeSmeStaConfigSetCfmSerFree CsrWifiSmePfree
567
568extern u8 *CsrWifiSmeStationMacAddressGetCfmSer(u8 *ptr, size_t *len,
569 void *msg);
570extern void *CsrWifiSmeStationMacAddressGetCfmDes(u8 *buffer, size_t len);
571extern size_t CsrWifiSmeStationMacAddressGetCfmSizeof(void *msg);
572#define CsrWifiSmeStationMacAddressGetCfmSerFree CsrWifiSmePfree
573
574extern u8 *CsrWifiSmeTspecIndSer(u8 *ptr, size_t *len, void *msg);
575extern void *CsrWifiSmeTspecIndDes(u8 *buffer, size_t len);
576extern size_t CsrWifiSmeTspecIndSizeof(void *msg);
577extern void CsrWifiSmeTspecIndSerFree(void *msg);
578
579extern u8 *CsrWifiSmeTspecCfmSer(u8 *ptr, size_t *len, void *msg);
580extern void *CsrWifiSmeTspecCfmDes(u8 *buffer, size_t len);
581extern size_t CsrWifiSmeTspecCfmSizeof(void *msg);
582extern void CsrWifiSmeTspecCfmSerFree(void *msg);
583
584extern u8 *CsrWifiSmeVersionsGetCfmSer(u8 *ptr, size_t *len, void *msg);
585extern void *CsrWifiSmeVersionsGetCfmDes(u8 *buffer, size_t len);
586extern size_t CsrWifiSmeVersionsGetCfmSizeof(void *msg);
587extern void CsrWifiSmeVersionsGetCfmSerFree(void *msg);
588
589#define CsrWifiSmeWifiFlightmodeCfmSer CsrWifiEventCsrUint16Ser
590#define CsrWifiSmeWifiFlightmodeCfmDes CsrWifiEventCsrUint16Des
591#define CsrWifiSmeWifiFlightmodeCfmSizeof CsrWifiEventCsrUint16Sizeof
592#define CsrWifiSmeWifiFlightmodeCfmSerFree CsrWifiSmePfree
593
594#define CsrWifiSmeWifiOffIndSer CsrWifiEventCsrUint8Ser
595#define CsrWifiSmeWifiOffIndDes CsrWifiEventCsrUint8Des
596#define CsrWifiSmeWifiOffIndSizeof CsrWifiEventCsrUint8Sizeof
597#define CsrWifiSmeWifiOffIndSerFree CsrWifiSmePfree
598
599#define CsrWifiSmeWifiOffCfmSer CsrWifiEventCsrUint16Ser
600#define CsrWifiSmeWifiOffCfmDes CsrWifiEventCsrUint16Des
601#define CsrWifiSmeWifiOffCfmSizeof CsrWifiEventCsrUint16Sizeof
602#define CsrWifiSmeWifiOffCfmSerFree CsrWifiSmePfree
603
604#define CsrWifiSmeWifiOnCfmSer CsrWifiEventCsrUint16Ser
605#define CsrWifiSmeWifiOnCfmDes CsrWifiEventCsrUint16Des
606#define CsrWifiSmeWifiOnCfmSizeof CsrWifiEventCsrUint16Sizeof
607#define CsrWifiSmeWifiOnCfmSerFree CsrWifiSmePfree
608
609#define CsrWifiSmeCloakedSsidsSetCfmSer CsrWifiEventCsrUint16Ser
610#define CsrWifiSmeCloakedSsidsSetCfmDes CsrWifiEventCsrUint16Des
611#define CsrWifiSmeCloakedSsidsSetCfmSizeof CsrWifiEventCsrUint16Sizeof
612#define CsrWifiSmeCloakedSsidsSetCfmSerFree CsrWifiSmePfree
613
614extern u8 *CsrWifiSmeCloakedSsidsGetCfmSer(u8 *ptr, size_t *len, void *msg);
615extern void *CsrWifiSmeCloakedSsidsGetCfmDes(u8 *buffer, size_t len);
616extern size_t CsrWifiSmeCloakedSsidsGetCfmSizeof(void *msg);
617extern void CsrWifiSmeCloakedSsidsGetCfmSerFree(void *msg);
618
619extern u8 *CsrWifiSmeWifiOnIndSer(u8 *ptr, size_t *len, void *msg);
620extern void *CsrWifiSmeWifiOnIndDes(u8 *buffer, size_t len);
621extern size_t CsrWifiSmeWifiOnIndSizeof(void *msg);
622#define CsrWifiSmeWifiOnIndSerFree CsrWifiSmePfree
623
624extern u8 *CsrWifiSmeSmeCommonConfigGetCfmSer(u8 *ptr, size_t *len, void *msg);
625extern void *CsrWifiSmeSmeCommonConfigGetCfmDes(u8 *buffer, size_t len);
626extern size_t CsrWifiSmeSmeCommonConfigGetCfmSizeof(void *msg);
627#define CsrWifiSmeSmeCommonConfigGetCfmSerFree CsrWifiSmePfree
628
629#define CsrWifiSmeSmeCommonConfigSetCfmSer CsrWifiEventCsrUint16Ser
630#define CsrWifiSmeSmeCommonConfigSetCfmDes CsrWifiEventCsrUint16Des
631#define CsrWifiSmeSmeCommonConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof
632#define CsrWifiSmeSmeCommonConfigSetCfmSerFree CsrWifiSmePfree
633
634extern u8 *CsrWifiSmeInterfaceCapabilityGetCfmSer(u8 *ptr, size_t *len,
635 void *msg);
636extern void *CsrWifiSmeInterfaceCapabilityGetCfmDes(u8 *buffer, size_t len);
637extern size_t CsrWifiSmeInterfaceCapabilityGetCfmSizeof(void *msg);
638#define CsrWifiSmeInterfaceCapabilityGetCfmSerFree CsrWifiSmePfree
639
640extern u8 *CsrWifiSmeErrorIndSer(u8 *ptr, size_t *len, void *msg);
641extern void *CsrWifiSmeErrorIndDes(u8 *buffer, size_t len);
642extern size_t CsrWifiSmeErrorIndSizeof(void *msg);
643extern void CsrWifiSmeErrorIndSerFree(void *msg);
644
645extern u8 *CsrWifiSmeInfoIndSer(u8 *ptr, size_t *len, void *msg);
646extern void *CsrWifiSmeInfoIndDes(u8 *buffer, size_t len);
647extern size_t CsrWifiSmeInfoIndSizeof(void *msg);
648extern void CsrWifiSmeInfoIndSerFree(void *msg);
649
650extern u8 *CsrWifiSmeCoreDumpIndSer(u8 *ptr, size_t *len, void *msg);
651extern void *CsrWifiSmeCoreDumpIndDes(u8 *buffer, size_t len);
652extern size_t CsrWifiSmeCoreDumpIndSizeof(void *msg);
653extern void CsrWifiSmeCoreDumpIndSerFree(void *msg);
654
655#define CsrWifiSmeAmpStatusChangeIndSer CsrWifiEventCsrUint16CsrUint8Ser
656#define CsrWifiSmeAmpStatusChangeIndDes CsrWifiEventCsrUint16CsrUint8Des
657#define CsrWifiSmeAmpStatusChangeIndSizeof CsrWifiEventCsrUint16CsrUint8Sizeof
658#define CsrWifiSmeAmpStatusChangeIndSerFree CsrWifiSmePfree
659
660#define CsrWifiSmeWpsConfigurationCfmSer CsrWifiEventCsrUint16Ser
661#define CsrWifiSmeWpsConfigurationCfmDes CsrWifiEventCsrUint16Des
662#define CsrWifiSmeWpsConfigurationCfmSizeof CsrWifiEventCsrUint16Sizeof
663#define CsrWifiSmeWpsConfigurationCfmSerFree CsrWifiSmePfree
664
665#endif /* CSR_WIFI_SME_SERIALIZE_H__ */
666
diff --git a/drivers/staging/csr/csr_wifi_sme_task.h b/drivers/staging/csr/csr_wifi_sme_task.h
deleted file mode 100644
index 1e938c1fa964..000000000000
--- a/drivers/staging/csr/csr_wifi_sme_task.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12
13#ifndef CSR_WIFI_SME_TASK_H__
14#define CSR_WIFI_SME_TASK_H__
15
16#include "csr_sched.h"
17
18#define CSR_WIFI_SME_LOG_ID 0x1202FFFF
19extern CsrSchedQid CSR_WIFI_SME_IFACEQUEUE;
20void CsrWifiSmeInit(void **gash);
21void CsrWifiSmeDeinit(void **gash);
22void CsrWifiSmeHandler(void **gash);
23
24#endif /* CSR_WIFI_SME_TASK_H__ */
25
diff --git a/drivers/staging/csr/csr_wifi_vif_utils.h b/drivers/staging/csr/csr_wifi_vif_utils.h
deleted file mode 100644
index 8ff97888996d..000000000000
--- a/drivers/staging/csr/csr_wifi_vif_utils.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*****************************************************************************
2
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
5
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
8
9*****************************************************************************/
10
11#ifndef CSR_WIFI_VIF_UTILS_H
12#define CSR_WIFI_VIF_UTILS_H
13
14/* STANDARD INCLUDES ********************************************************/
15
16/* PROJECT INCLUDES *********************************************************/
17/* including this file for CsrWifiInterfaceMode*/
18#include "csr_wifi_private_common.h"
19
20/* MACROS *******************************************************************/
21
22/* Common macros for NME and SME to be used temporarily until SoftMAC changes are made */
23#define CSR_WIFI_NUM_INTERFACES (u8)0x1
24#define CSR_WIFI_INTERFACE_IN_USE (u16)0x0
25
26#endif /* CSR_WIFI_VIF_UTILS_H */
27
diff --git a/drivers/staging/csr/data_tx.c b/drivers/staging/csr/data_tx.c
deleted file mode 100644
index 9e3d8b8ab02c..000000000000
--- a/drivers/staging/csr/data_tx.c
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * ---------------------------------------------------------------------------
3 * FILE: data_tx.c
4 *
5 * PURPOSE:
6 * This file provides functions to send data requests to the UniFi.
7 *
8 * Copyright (C) 2007-2009 by Cambridge Silicon Radio Ltd.
9 *
10 * Refer to LICENSE.txt included with this source code for details on
11 * the license terms.
12 *
13 * ---------------------------------------------------------------------------
14 */
15#include "csr_wifi_hip_unifi.h"
16#include "unifi_priv.h"
17
18int
19uf_verify_m4(unifi_priv_t *priv, const unsigned char *packet, unsigned int length)
20{
21 const unsigned char *p = packet;
22 u16 keyinfo;
23
24
25 if (length < (4 + 5 + 8 + 32 + 16 + 8 + 8 + 16 + 1 + 8))
26 return 1;
27
28 p += 8;
29 keyinfo = p[5] << 8 | p[6]; /* big-endian */
30 if (
31 (p[0] == 1 || p[0] == 2) /* protocol version 802.1X-2001 (WPA) or -2004 (WPA2) */ &&
32 p[1] == 3 /* EAPOL-Key */ &&
33 /* don't bother checking p[2] p[3] (hh ll, packet body length) */
34 (p[4] == 254 || p[4] == 2) /* descriptor type P802.1i-D3.0 (WPA) or 802.11i-2004 (WPA2) */ &&
35 ((keyinfo & 0x0007) == 1 || (keyinfo & 0x0007) == 2) /* key descriptor version */ &&
36 (keyinfo & ~0x0207U) == 0x0108 && /* key info for 4/4 or 4/2 -- ignore key desc version and sec bit (since varies in WPA 4/4) */
37 (p[4 + 5 + 8 + 32 + 16 + 8 + 8 + 16 + 0] == 0 && /* key data length (2 octets) 0 for 4/4 only */
38 p[4 + 5 + 8 + 32 + 16 + 8 + 8 + 16 + 1] == 0)
39 ) {
40 unifi_trace(priv, UDBG1, "uf_verify_m4: M4 detected\n");
41 return 0;
42 } else {
43 return 1;
44 }
45}
46
47/*
48 * ---------------------------------------------------------------------------
49 *
50 * Data transport signals.
51 *
52 * ---------------------------------------------------------------------------
53 */
54
diff --git a/drivers/staging/csr/drv.c b/drivers/staging/csr/drv.c
deleted file mode 100644
index 92898de921f5..000000000000
--- a/drivers/staging/csr/drv.c
+++ /dev/null
@@ -1,2193 +0,0 @@
1/*
2 * ---------------------------------------------------------------------------
3 * FILE: drv.c
4 *
5 * PURPOSE:
6 * Conventional device interface for debugging/monitoring of the
7 * driver and h/w using unicli. This interface is also being used
8 * by the SME linux implementation and the helper apps.
9 *
10 * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd.
11 *
12 * Refer to LICENSE.txt included with this source code for details on
13 * the license terms.
14 *
15 * ---------------------------------------------------------------------------
16 */
17
18/*
19 * Porting Notes:
20 * Part of this file contains an example for how to glue the OS layer
21 * with the HIP core lib, the SDIO glue layer, and the SME.
22 *
23 * When the unifi_sdio.ko modules loads, the linux kernel calls unifi_load().
24 * unifi_load() calls uf_sdio_load() which is exported by the SDIO glue
25 * layer. uf_sdio_load() registers this driver with the underlying SDIO driver.
26 * When a card is detected, the SDIO glue layer calls register_unifi_sdio()
27 * to pass the SDIO function context and ask the OS layer to initialise
28 * the card. register_unifi_sdio() allocates all the private data of the OS
29 * layer and calls uf_run_unifihelper() to start the SME. The SME calls
30 * unifi_sys_wifi_on_req() which uses the HIP core lib to initialise the card.
31 */
32
33#include <linux/init.h>
34#include <linux/slab.h>
35#include <linux/poll.h>
36#include <asm/uaccess.h>
37#include <linux/jiffies.h>
38#include <linux/version.h>
39
40#include "csr_wifi_hip_unifiversion.h"
41#include "unifi_priv.h"
42#include "csr_wifi_hip_conversions.h"
43#include "unifi_native.h"
44
45/* Module parameter variables */
46int buswidth = 0; /* 0 means use default, values 1,4 */
47int sdio_clock = 50000; /* kHz */
48int unifi_debug = 0;
49/* fw_init prevents f/w initialisation on error. */
50int fw_init[MAX_UNIFI_DEVS] = {-1, -1};
51int use_5g = 0;
52int led_mask = 0; /* 0x0c00 for dev-pc-1503c, dev-pc-1528a */
53int disable_hw_reset = 0;
54int disable_power_control = 0;
55int enable_wol = UNIFI_WOL_OFF; /* 0 for none, 1 for SDIO IRQ, 2 for PIO */
56#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT)
57int tl_80211d = (int)CSR_WIFI_SME_80211D_TRUST_LEVEL_MIB;
58#endif
59int sdio_block_size = -1; /* Override SDIO block size */
60int sdio_byte_mode = 0; /* 0 for block mode + padding, 1 for byte mode */
61int coredump_max = CSR_WIFI_HIP_NUM_COREDUMP_BUFFERS;
62int run_bh_once = -1; /* Set for scheduled interrupt mode, -1 = default */
63int bh_priority = -1;
64#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
65#define UNIFI_LOG_HIP_SIGNALS_FILTER_BULKDATA (1 << 1)
66#define UNIFI_LOG_HIP_SIGNALS_FILTER_TIMESTAMP (1 << 2)
67int log_hip_signals = 0;
68#endif
69
70MODULE_DESCRIPTION("CSR UniFi (SDIO)");
71
72module_param(buswidth, int, S_IRUGO|S_IWUSR);
73module_param(sdio_clock, int, S_IRUGO|S_IWUSR);
74module_param(unifi_debug, int, S_IRUGO|S_IWUSR);
75module_param_array(fw_init, int, NULL, S_IRUGO|S_IWUSR);
76module_param(use_5g, int, S_IRUGO|S_IWUSR);
77module_param(led_mask, int, S_IRUGO|S_IWUSR);
78module_param(disable_hw_reset, int, S_IRUGO|S_IWUSR);
79module_param(disable_power_control, int, S_IRUGO|S_IWUSR);
80module_param(enable_wol, int, S_IRUGO|S_IWUSR);
81#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT)
82module_param(tl_80211d, int, S_IRUGO|S_IWUSR);
83#endif
84module_param(sdio_block_size, int, S_IRUGO|S_IWUSR);
85module_param(sdio_byte_mode, int, S_IRUGO|S_IWUSR);
86module_param(coredump_max, int, S_IRUGO|S_IWUSR);
87module_param(run_bh_once, int, S_IRUGO|S_IWUSR);
88module_param(bh_priority, int, S_IRUGO|S_IWUSR);
89#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
90module_param(log_hip_signals, int, S_IRUGO|S_IWUSR);
91#endif
92
93MODULE_PARM_DESC(buswidth, "SDIO bus width (0=default), set 1 for 1-bit or 4 for 4-bit mode");
94MODULE_PARM_DESC(sdio_clock, "SDIO bus frequency in kHz, (default = 50 MHz)");
95MODULE_PARM_DESC(unifi_debug, "Diagnostic reporting level");
96MODULE_PARM_DESC(fw_init, "Set to 0 to prevent f/w initialization on error");
97MODULE_PARM_DESC(use_5g, "Use the 5G (802.11a) radio band");
98MODULE_PARM_DESC(led_mask, "LED mask flags");
99MODULE_PARM_DESC(disable_hw_reset, "Set to 1 to disable hardware reset");
100MODULE_PARM_DESC(disable_power_control, "Set to 1 to disable SDIO power control");
101MODULE_PARM_DESC(enable_wol, "Enable wake-on-wlan function 0=off, 1=SDIO, 2=PIO");
102#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT)
103MODULE_PARM_DESC(tl_80211d, "802.11d Trust Level (1-6, default = 5)");
104#endif
105MODULE_PARM_DESC(sdio_block_size, "Set to override SDIO block size");
106MODULE_PARM_DESC(sdio_byte_mode, "Set to 1 for byte mode SDIO");
107MODULE_PARM_DESC(coredump_max, "Number of chip mini-coredump buffers to allocate");
108MODULE_PARM_DESC(run_bh_once, "Run BH only when firmware interrupts");
109MODULE_PARM_DESC(bh_priority, "Modify the BH thread priority");
110#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
111MODULE_PARM_DESC(log_hip_signals, "Set to 1 to enable HIP signal offline logging");
112#endif
113
114
115/* Callback for event logging to UDI clients */
116static void udi_log_event(ul_client_t *client,
117 const u8 *signal, int signal_len,
118 const bulk_data_param_t *bulkdata,
119 int dir);
120
121static void udi_set_log_filter(ul_client_t *pcli,
122 unifiio_filter_t *udi_filter);
123
124
125/* Mutex to protect access to priv->sme_cli */
126DEFINE_SEMAPHORE(udi_mutex);
127
128s32 CsrHipResultToStatus(CsrResult csrResult)
129{
130 s32 r = -EIO;
131
132 switch (csrResult)
133 {
134 case CSR_RESULT_SUCCESS:
135 r = 0;
136 break;
137 case CSR_WIFI_HIP_RESULT_RANGE:
138 r = -ERANGE;
139 break;
140 case CSR_WIFI_HIP_RESULT_NO_DEVICE:
141 r = -ENODEV;
142 break;
143 case CSR_WIFI_HIP_RESULT_INVALID_VALUE:
144 r = -EINVAL;
145 break;
146 case CSR_WIFI_HIP_RESULT_NOT_FOUND:
147 r = -ENOENT;
148 break;
149 case CSR_WIFI_HIP_RESULT_NO_SPACE:
150 r = -ENOSPC;
151 break;
152 case CSR_WIFI_HIP_RESULT_NO_MEMORY:
153 r = -ENOMEM;
154 break;
155 case CSR_RESULT_FAILURE:
156 r = -EIO;
157 break;
158 default:
159 /*unifi_warning(card->ospriv, "CsrHipResultToStatus: Unrecognised csrResult error code: %d\n", csrResult);*/
160 r = -EIO;
161 }
162 return r;
163}
164
165
166static const char*
167trace_putest_cmdid(unifi_putest_command_t putest_cmd)
168{
169 switch (putest_cmd) {
170 case UNIFI_PUTEST_START:
171 return "START";
172 case UNIFI_PUTEST_STOP:
173 return "STOP";
174 case UNIFI_PUTEST_SET_SDIO_CLOCK:
175 return "SET CLOCK";
176 case UNIFI_PUTEST_CMD52_READ:
177 return "CMD52R";
178 case UNIFI_PUTEST_CMD52_BLOCK_READ:
179 return "CMD52BR";
180 case UNIFI_PUTEST_CMD52_WRITE:
181 return "CMD52W";
182 case UNIFI_PUTEST_DL_FW:
183 return "D/L FW";
184 case UNIFI_PUTEST_DL_FW_BUFF:
185 return "D/L FW BUFFER";
186 case UNIFI_PUTEST_COREDUMP_PREPARE:
187 return "PREPARE COREDUMP";
188 case UNIFI_PUTEST_GP_READ16:
189 return "GP16R";
190 case UNIFI_PUTEST_GP_WRITE16:
191 return "GP16W";
192 default:
193 return "ERROR: unrecognised command";
194 }
195 }
196
197#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
198int uf_register_hip_offline_debug(unifi_priv_t *priv)
199{
200 ul_client_t *udi_cli;
201 int i;
202
203 udi_cli = ul_register_client(priv, CLI_USING_WIRE_FORMAT, udi_log_event);
204 if (udi_cli == NULL) {
205 /* Too many clients already using this device */
206 unifi_error(priv, "Too many UDI clients already open\n");
207 return -ENOSPC;
208 }
209 unifi_trace(priv, UDBG1, "Offline HIP client is registered\n");
210
211 down(&priv->udi_logging_mutex);
212 udi_cli->event_hook = udi_log_event;
213 unifi_set_udi_hook(priv->card, logging_handler);
214 /* Log all signals by default */
215 for (i = 0; i < SIG_FILTER_SIZE; i++) {
216 udi_cli->signal_filter[i] = 0xFFFF;
217 }
218 priv->logging_client = udi_cli;
219 up(&priv->udi_logging_mutex);
220
221 return 0;
222}
223
224int uf_unregister_hip_offline_debug(unifi_priv_t *priv)
225{
226 ul_client_t *udi_cli = priv->logging_client;
227 if (udi_cli == NULL)
228 {
229 unifi_error(priv, "Unknown HIP client unregister request\n");
230 return -ERANGE;
231 }
232
233 unifi_trace(priv, UDBG1, "Offline HIP client is unregistered\n");
234
235 down(&priv->udi_logging_mutex);
236 priv->logging_client = NULL;
237 udi_cli->event_hook = NULL;
238 up(&priv->udi_logging_mutex);
239
240 ul_deregister_client(udi_cli);
241
242 return 0;
243}
244#endif
245
246
247/*
248 * ---------------------------------------------------------------------------
249 * unifi_open
250 * unifi_release
251 *
252 * Open and release entry points for the UniFi debug driver.
253 *
254 * Arguments:
255 * Normal linux driver args.
256 *
257 * Returns:
258 * Linux error code.
259 * ---------------------------------------------------------------------------
260 */
261static int
262unifi_open(struct inode *inode, struct file *file)
263{
264 int devno;
265 unifi_priv_t *priv;
266 ul_client_t *udi_cli;
267
268 devno = MINOR(inode->i_rdev) >> 1;
269
270 /*
271 * Increase the ref_count for the char device clients.
272 * Make sure you call uf_put_instance() to decreace it if
273 * unifi_open returns an error.
274 */
275 priv = uf_get_instance(devno);
276 if (priv == NULL) {
277 unifi_error(NULL, "unifi_open: No device present\n");
278 return -ENODEV;
279 }
280
281 /* Register this instance in the client's list. */
282 /* The minor number determines the nature of the client (Unicli or SME). */
283 if (MINOR(inode->i_rdev) & 0x1) {
284 udi_cli = ul_register_client(priv, CLI_USING_WIRE_FORMAT, udi_log_event);
285 if (udi_cli == NULL) {
286 /* Too many clients already using this device */
287 unifi_error(priv, "Too many clients already open\n");
288 uf_put_instance(devno);
289 return -ENOSPC;
290 }
291 unifi_trace(priv, UDBG1, "Client is registered to /dev/unifiudi%d\n", devno);
292 } else {
293 /*
294 * Even-numbered device nodes are the control application.
295 * This is the userspace helper containing SME or
296 * unifi_manager.
297 */
298
299 down(&udi_mutex);
300
301#ifdef CSR_SME_USERSPACE
302 /* Check if a config client is already attached */
303 if (priv->sme_cli) {
304 up(&udi_mutex);
305 uf_put_instance(devno);
306
307 unifi_info(priv, "There is already a configuration client using the character device\n");
308 return -EBUSY;
309 }
310#endif /* CSR_SME_USERSPACE */
311
312#ifdef CSR_SUPPORT_SME
313 udi_cli = ul_register_client(priv,
314 CLI_USING_WIRE_FORMAT | CLI_SME_USERSPACE,
315 sme_log_event);
316#else
317 /* Config client for native driver */
318 udi_cli = ul_register_client(priv,
319 0,
320 sme_native_log_event);
321#endif
322 if (udi_cli == NULL) {
323 /* Too many clients already using this device */
324 up(&udi_mutex);
325 uf_put_instance(devno);
326
327 unifi_error(priv, "Too many clients already open\n");
328 return -ENOSPC;
329 }
330
331 /*
332 * Fill-in the pointer to the configuration client.
333 * This is the SME userspace helper or unifi_manager.
334 * Not used in the SME embedded version.
335 */
336 unifi_trace(priv, UDBG1, "SME client (id:%d s:0x%X) is registered\n",
337 udi_cli->client_id, udi_cli->sender_id);
338 /* Store the SME UniFi Linux Client */
339 if (priv->sme_cli == NULL) {
340 priv->sme_cli = udi_cli;
341 }
342
343 up(&udi_mutex);
344 }
345
346
347 /*
348 * Store the pointer to the client.
349 * All char driver's entry points will pass this pointer.
350 */
351 file->private_data = udi_cli;
352
353 return 0;
354} /* unifi_open() */
355
356
357static int
358unifi_release(struct inode *inode, struct file *filp)
359{
360 ul_client_t *udi_cli = (void*)filp->private_data;
361 int devno;
362 unifi_priv_t *priv;
363
364 priv = uf_find_instance(udi_cli->instance);
365 if (!priv) {
366 unifi_error(priv, "unifi_close: instance for device not found\n");
367 return -ENODEV;
368 }
369
370 devno = MINOR(inode->i_rdev) >> 1;
371
372 /* Even device nodes are the config client (i.e. SME or unifi_manager) */
373 if ((MINOR(inode->i_rdev) & 0x1) == 0) {
374
375 if (priv->sme_cli != udi_cli) {
376 unifi_notice(priv, "Surprise closing config device: not the sme client\n");
377 }
378 unifi_notice(priv, "SME client close (unifi%d)\n", devno);
379
380 /*
381 * Clear sme_cli before calling unifi_sys_... so it doesn't try to
382 * queue a reply to the (now gone) SME.
383 */
384 down(&udi_mutex);
385 priv->sme_cli = NULL;
386 up(&udi_mutex);
387
388#ifdef CSR_SME_USERSPACE
389 /* Power-down when config client closes */
390 {
391 CsrWifiRouterCtrlWifiOffReq req = {{CSR_WIFI_ROUTER_CTRL_HIP_REQ, 0, 0, 0, NULL}};
392 CsrWifiRouterCtrlWifiOffReqHandler(priv, &req.common);
393 }
394
395 uf_sme_deinit(priv);
396
397 /* It is possible that a blocking SME request was made from another process
398 * which did not get read by the SME before the WifiOffReq.
399 * So check for a pending request which will go unanswered and cancel
400 * the wait for event. As only one blocking request can be in progress at
401 * a time, up to one event should be completed.
402 */
403 uf_sme_cancel_request(priv, 0);
404
405#endif /* CSR_SME_USERSPACE */
406 } else {
407
408 unifi_trace(priv, UDBG2, "UDI client close (unifiudi%d)\n", devno);
409
410 /* If the pointer matches the logging client, stop logging. */
411 down(&priv->udi_logging_mutex);
412 if (udi_cli == priv->logging_client) {
413 priv->logging_client = NULL;
414 }
415 up(&priv->udi_logging_mutex);
416
417 if (udi_cli == priv->amp_client) {
418 priv->amp_client = NULL;
419 }
420 }
421
422 /* Deregister this instance from the client's list. */
423 ul_deregister_client(udi_cli);
424
425 uf_put_instance(devno);
426
427 return 0;
428} /* unifi_release() */
429
430
431
432/*
433 * ---------------------------------------------------------------------------
434 * unifi_read
435 *
436 * The read() driver entry point.
437 *
438 * Arguments:
439 * filp The file descriptor returned by unifi_open()
440 * p The user space buffer to copy the read data
441 * len The size of the p buffer
442 * poff
443 *
444 * Returns:
445 * number of bytes read or an error code on failure
446 * ---------------------------------------------------------------------------
447 */
448static ssize_t
449unifi_read(struct file *filp, char *p, size_t len, loff_t *poff)
450{
451 ul_client_t *pcli = (void*)filp->private_data;
452 unifi_priv_t *priv;
453 udi_log_t *logptr = NULL;
454 udi_msg_t *msgptr;
455 struct list_head *l;
456 int msglen;
457
458 priv = uf_find_instance(pcli->instance);
459 if (!priv) {
460 unifi_error(priv, "invalid priv\n");
461 return -ENODEV;
462 }
463
464 if (!pcli->udi_enabled) {
465 unifi_error(priv, "unifi_read: unknown client.");
466 return -EINVAL;
467 }
468
469 if (list_empty(&pcli->udi_log)) {
470 if (filp->f_flags & O_NONBLOCK) {
471 /* Non-blocking - just return if the udi_log is empty */
472 return 0;
473 } else {
474 /* Blocking - wait on the UDI wait queue */
475 if (wait_event_interruptible(pcli->udi_wq,
476 !list_empty(&pcli->udi_log)))
477 {
478 unifi_error(priv, "unifi_read: wait_event_interruptible failed.");
479 return -ERESTARTSYS;
480 }
481 }
482 }
483
484 /* Read entry from list head and remove it from the list */
485 if (down_interruptible(&pcli->udi_sem)) {
486 return -ERESTARTSYS;
487 }
488 l = pcli->udi_log.next;
489 list_del(l);
490 up(&pcli->udi_sem);
491
492 /* Get a pointer to whole struct */
493 logptr = list_entry(l, udi_log_t, q);
494 if (logptr == NULL) {
495 unifi_error(priv, "unifi_read: failed to get event.\n");
496 return -EINVAL;
497 }
498
499 /* Get the real message */
500 msgptr = &logptr->msg;
501 msglen = msgptr->length;
502 if (msglen > len) {
503 printk(KERN_WARNING "truncated read to %d actual msg len is %lu\n", msglen, (long unsigned int)len);
504 msglen = len;
505 }
506
507 /* and pass it to the client (SME or Unicli). */
508 if (copy_to_user(p, msgptr, msglen))
509 {
510 printk(KERN_ERR "Failed to copy UDI log to user\n");
511 kfree(logptr);
512 return -EFAULT;
513 }
514
515 /* It is our resposibility to free the message buffer. */
516 kfree(logptr);
517
518 return msglen;
519
520} /* unifi_read() */
521
522
523
524/*
525 * ---------------------------------------------------------------------------
526 * udi_send_signal_unpacked
527 *
528 * Sends an unpacked signal to UniFi.
529 *
530 * Arguments:
531 * priv Pointer to private context struct
532 * data Pointer to request structure and data to send
533 * data_len Length of data in data pointer.
534 *
535 * Returns:
536 * Number of bytes written, error otherwise.
537 *
538 * Notes:
539 * All clients that use this function to send a signal to the unifi
540 * must use the host formatted structures.
541 * ---------------------------------------------------------------------------
542 */
543static int
544udi_send_signal_unpacked(unifi_priv_t *priv, unsigned char* data, uint data_len)
545{
546 CSR_SIGNAL *sigptr = (CSR_SIGNAL*)data;
547 CSR_DATAREF *datarefptr;
548 bulk_data_param_t bulk_data;
549 uint signal_size, i;
550 uint bulk_data_offset = 0;
551 int bytecount, r;
552 CsrResult csrResult;
553
554 /* Number of bytes in the signal */
555 signal_size = SigGetSize(sigptr);
556 if (!signal_size || (signal_size > data_len)) {
557 unifi_error(priv, "unifi_sme_mlme_req - Invalid signal 0x%x size should be %d bytes\n",
558 sigptr->SignalPrimitiveHeader.SignalId,
559 signal_size);
560 return -EINVAL;
561 }
562 bytecount = signal_size;
563
564 /* Get a pointer to the information of the first data reference */
565 datarefptr = (CSR_DATAREF*)&sigptr->u;
566
567 /* Initialize the offset in the data buffer, bulk data is right after the signal. */
568 bulk_data_offset = signal_size;
569
570 /* store the references and the size of the bulk data to the bulkdata structure */
571 for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) {
572 /* the length of the bulk data is in the signal */
573 if ((datarefptr+i)->DataLength) {
574 void *dest;
575
576 csrResult = unifi_net_data_malloc(priv, &bulk_data.d[i], (datarefptr+i)->DataLength);
577 if (csrResult != CSR_RESULT_SUCCESS) {
578 unifi_error(priv, "udi_send_signal_unpacked: failed to allocate request_data.\n");
579 return -EIO;
580 }
581
582 dest = (void*)bulk_data.d[i].os_data_ptr;
583 memcpy(dest, data + bulk_data_offset, bulk_data.d[i].data_length);
584 } else {
585 bulk_data.d[i].data_length = 0;
586 }
587
588 bytecount += bulk_data.d[i].data_length;
589 /* advance the offset, to point the next bulk data */
590 bulk_data_offset += bulk_data.d[i].data_length;
591 }
592
593
594 unifi_trace(priv, UDBG3, "SME Send: signal 0x%.4X\n", sigptr->SignalPrimitiveHeader.SignalId);
595
596 /* Send the signal. */
597 r = ul_send_signal_unpacked(priv, sigptr, &bulk_data);
598 if (r < 0) {
599 unifi_error(priv, "udi_send_signal_unpacked: send failed (%d)\n", r);
600 for(i=0;i<UNIFI_MAX_DATA_REFERENCES;i++) {
601 if(bulk_data.d[i].data_length != 0) {
602 unifi_net_data_free(priv, &bulk_data.d[i]);
603 }
604 }
605 return -EIO;
606 }
607
608 return bytecount;
609} /* udi_send_signal_unpacked() */
610
611
612
613/*
614 * ---------------------------------------------------------------------------
615 * udi_send_signal_raw
616 *
617 * Sends a packed signal to UniFi.
618 *
619 * Arguments:
620 * priv Pointer to private context struct
621 * buf Pointer to request structure and data to send
622 * buflen Length of data in data pointer.
623 *
624 * Returns:
625 * Number of bytes written, error otherwise.
626 *
627 * Notes:
628 * All clients that use this function to send a signal to the unifi
629 * must use the wire formatted structures.
630 * ---------------------------------------------------------------------------
631 */
632static int
633udi_send_signal_raw(unifi_priv_t *priv, unsigned char *buf, int buflen)
634{
635 int signal_size;
636 int sig_id;
637 bulk_data_param_t data_ptrs;
638 int i, r;
639 unsigned int num_data_refs;
640 int bytecount;
641 CsrResult csrResult;
642
643 /*
644 * The signal is the first thing in buf, the signal id is the
645 * first 16 bits of the signal.
646 */
647 /* Number of bytes in the signal */
648 sig_id = GET_SIGNAL_ID(buf);
649 signal_size = buflen;
650 signal_size -= GET_PACKED_DATAREF_LEN(buf, 0);
651 signal_size -= GET_PACKED_DATAREF_LEN(buf, 1);
652 if ((signal_size <= 0) || (signal_size > buflen)) {
653 unifi_error(priv, "udi_send_signal_raw - Couldn't find length of signal 0x%x\n",
654 sig_id);
655 return -EINVAL;
656 }
657 unifi_trace(priv, UDBG2, "udi_send_signal_raw: signal 0x%.4X len:%d\n",
658 sig_id, signal_size);
659 /* Zero the data ref arrays */
660 memset(&data_ptrs, 0, sizeof(data_ptrs));
661
662 /*
663 * Find the number of associated bulk data packets. Scan through
664 * the data refs to check that we have enough data and pick out
665 * pointers to appended bulk data.
666 */
667 num_data_refs = 0;
668 bytecount = signal_size;
669
670 for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; ++i)
671 {
672 unsigned int len = GET_PACKED_DATAREF_LEN(buf, i);
673 unifi_trace(priv, UDBG3, "udi_send_signal_raw: data_ref length = %d\n", len);
674
675 if (len != 0) {
676 void *dest;
677
678 csrResult = unifi_net_data_malloc(priv, &data_ptrs.d[i], len);
679 if (csrResult != CSR_RESULT_SUCCESS) {
680 unifi_error(priv, "udi_send_signal_raw: failed to allocate request_data.\n");
681 return -EIO;
682 }
683
684 dest = (void*)data_ptrs.d[i].os_data_ptr;
685 memcpy(dest, buf + bytecount, len);
686
687 bytecount += len;
688 num_data_refs++;
689 }
690 data_ptrs.d[i].data_length = len;
691 }
692
693 unifi_trace(priv, UDBG3, "Queueing signal 0x%.4X from UDI with %u data refs\n",
694 sig_id,
695 num_data_refs);
696
697 if (bytecount > buflen) {
698 unifi_error(priv, "udi_send_signal_raw: Not enough data (%d instead of %d)\n", buflen, bytecount);
699 return -EINVAL;
700 }
701
702 /* Send the signal calling the function that uses the wire-formatted signals. */
703 r = ul_send_signal_raw(priv, buf, signal_size, &data_ptrs);
704 if (r < 0) {
705 unifi_error(priv, "udi_send_signal_raw: send failed (%d)\n", r);
706 return -EIO;
707 }
708
709#ifdef CSR_NATIVE_LINUX
710 if (sig_id == CSR_MLME_POWERMGT_REQUEST_ID) {
711 int power_mode = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((buf +
712 SIZEOF_SIGNAL_HEADER + (UNIFI_MAX_DATA_REFERENCES*SIZEOF_DATAREF)));
713#ifdef CSR_SUPPORT_WEXT
714 /* Overide the wext power mode to the new value */
715 priv->wext_conf.power_mode = power_mode;
716#endif
717 /* Configure deep sleep signaling */
718 if (power_mode || (priv->interfacePriv[0]->connected == UnifiNotConnected)) {
719 csrResult = unifi_configure_low_power_mode(priv->card,
720 UNIFI_LOW_POWER_ENABLED,
721 UNIFI_PERIODIC_WAKE_HOST_DISABLED);
722 } else {
723 csrResult = unifi_configure_low_power_mode(priv->card,
724 UNIFI_LOW_POWER_DISABLED,
725 UNIFI_PERIODIC_WAKE_HOST_DISABLED);
726 }
727 }
728#endif
729
730 return bytecount;
731} /* udi_send_signal_raw */
732
733/*
734 * ---------------------------------------------------------------------------
735 * unifi_write
736 *
737 * The write() driver entry point.
738 * A UniFi Debug Interface client such as unicli can write a signal
739 * plus bulk data to the driver for sending to the UniFi chip.
740 *
741 * Only one signal may be sent per write operation.
742 *
743 * Arguments:
744 * filp The file descriptor returned by unifi_open()
745 * p The user space buffer to get the data from
746 * len The size of the p buffer
747 * poff
748 *
749 * Returns:
750 * number of bytes written or an error code on failure
751 * ---------------------------------------------------------------------------
752 */
753static ssize_t
754unifi_write(struct file *filp, const char *p, size_t len, loff_t *poff)
755{
756 ul_client_t *pcli = (ul_client_t*)filp->private_data;
757 unifi_priv_t *priv;
758 unsigned char *buf;
759 unsigned char *bufptr;
760 int remaining;
761 int bytes_written;
762 int r;
763 bulk_data_param_t bulkdata;
764 CsrResult csrResult;
765
766 priv = uf_find_instance(pcli->instance);
767 if (!priv) {
768 unifi_error(priv, "invalid priv\n");
769 return -ENODEV;
770 }
771
772 unifi_trace(priv, UDBG5, "unifi_write: len = %d\n", len);
773
774 if (!pcli->udi_enabled) {
775 unifi_error(priv, "udi disabled\n");
776 return -EINVAL;
777 }
778
779 /*
780 * AMP client sends only one signal at a time, so we can use
781 * unifi_net_data_malloc to save the extra copy.
782 */
783 if (pcli == priv->amp_client) {
784 int signal_size;
785 int sig_id;
786 unsigned char *signal_buf;
787 char *user_data_buf;
788
789 csrResult = unifi_net_data_malloc(priv, &bulkdata.d[0], len);
790 if (csrResult != CSR_RESULT_SUCCESS) {
791 unifi_error(priv, "unifi_write: failed to allocate request_data.\n");
792 return -ENOMEM;
793 }
794
795 user_data_buf = (char*)bulkdata.d[0].os_data_ptr;
796
797 /* Get the data from the AMP client. */
798 if (copy_from_user((void*)user_data_buf, p, len)) {
799 unifi_error(priv, "unifi_write: copy from user failed\n");
800 unifi_net_data_free(priv, &bulkdata.d[0]);
801 return -EFAULT;
802 }
803
804 bulkdata.d[1].os_data_ptr = NULL;
805 bulkdata.d[1].data_length = 0;
806
807 /* Number of bytes in the signal */
808 sig_id = GET_SIGNAL_ID(bulkdata.d[0].os_data_ptr);
809 signal_size = len;
810 signal_size -= GET_PACKED_DATAREF_LEN(bulkdata.d[0].os_data_ptr, 0);
811 signal_size -= GET_PACKED_DATAREF_LEN(bulkdata.d[0].os_data_ptr, 1);
812 if ((signal_size <= 0) || (signal_size > len)) {
813 unifi_error(priv, "unifi_write - Couldn't find length of signal 0x%x\n",
814 sig_id);
815 unifi_net_data_free(priv, &bulkdata.d[0]);
816 return -EINVAL;
817 }
818
819 unifi_trace(priv, UDBG2, "unifi_write: signal 0x%.4X len:%d\n",
820 sig_id, signal_size);
821
822 /* Allocate a buffer for the signal */
823 signal_buf = kmemdup(bulkdata.d[0].os_data_ptr, signal_size,
824 GFP_KERNEL);
825 if (!signal_buf) {
826 unifi_net_data_free(priv, &bulkdata.d[0]);
827 return -ENOMEM;
828 }
829
830 /* Get the signal from the os_data_ptr */
831 signal_buf[5] = (pcli->sender_id >> 8) & 0xff;
832
833 if (signal_size < len) {
834 /* Remove the signal from the os_data_ptr */
835 bulkdata.d[0].data_length -= signal_size;
836 bulkdata.d[0].os_data_ptr += signal_size;
837 } else {
838 bulkdata.d[0].data_length = 0;
839 bulkdata.d[0].os_data_ptr = NULL;
840 }
841
842 /* Send the signal calling the function that uses the wire-formatted signals. */
843 r = ul_send_signal_raw(priv, signal_buf, signal_size, &bulkdata);
844 if (r < 0) {
845 unifi_error(priv, "unifi_write: send failed (%d)\n", r);
846 if (bulkdata.d[0].os_data_ptr != NULL) {
847 unifi_net_data_free(priv, &bulkdata.d[0]);
848 }
849 }
850
851 /* Free the signal buffer and return */
852 kfree(signal_buf);
853 return len;
854 }
855
856 buf = kmalloc(len, GFP_KERNEL);
857 if (!buf) {
858 return -ENOMEM;
859 }
860
861 /* Get the data from the client (SME or Unicli). */
862 if (copy_from_user((void*)buf, p, len)) {
863 unifi_error(priv, "copy from user failed\n");
864 kfree(buf);
865 return -EFAULT;
866 }
867
868 /*
869 * In SME userspace build read() contains a SYS or MGT message.
870 * Note that even though the SME sends one signal at a time, we can not
871 * use unifi_net_data_malloc because in the early stages, before having
872 * initialised the core, it will fail since the I/O block size is unknown.
873 */
874#ifdef CSR_SME_USERSPACE
875 if (pcli->configuration & CLI_SME_USERSPACE) {
876 CsrWifiRouterTransportRecv(priv, buf, len);
877 kfree(buf);
878 return len;
879 }
880#endif
881
882 /* ul_send_signal_raw will do a sanity check of len against signal content */
883
884 /*
885 * udi_send_signal_raw() and udi_send_signal_unpacked() return the number of bytes consumed.
886 * A write call can pass multiple signal concatenated together.
887 */
888 bytes_written = 0;
889 remaining = len;
890 bufptr = buf;
891 while (remaining > 0)
892 {
893 int r;
894
895 /*
896 * Set the SenderProcessId.
897 * The SignalPrimitiveHeader is the first 3 16-bit words of the signal,
898 * the SenderProcessId is bytes 4,5.
899 * The MSB of the sender ID needs to be set to the client ID.
900 * The LSB is controlled by the SME.
901 */
902 bufptr[5] = (pcli->sender_id >> 8) & 0xff;
903
904 /* use the appropriate interface, depending on the clients' configuration */
905 if (pcli->configuration & CLI_USING_WIRE_FORMAT) {
906 unifi_trace(priv, UDBG1, "unifi_write: call udi_send_signal().\n");
907 r = udi_send_signal_raw(priv, bufptr, remaining);
908 } else {
909 r = udi_send_signal_unpacked(priv, bufptr, remaining);
910 }
911 if (r < 0) {
912 /* Set the return value to the error code */
913 unifi_error(priv, "unifi_write: (udi or sme)_send_signal() returns %d\n", r);
914 bytes_written = r;
915 break;
916 }
917 bufptr += r;
918 remaining -= r;
919 bytes_written += r;
920 }
921
922 kfree(buf);
923
924 return bytes_written;
925} /* unifi_write() */
926
927
928static const char* build_type_to_string(unsigned char build_type)
929{
930 switch (build_type)
931 {
932 case UNIFI_BUILD_NME: return "NME";
933 case UNIFI_BUILD_WEXT: return "WEXT";
934 case UNIFI_BUILD_AP: return "AP";
935 }
936 return "unknown";
937}
938
939
940/*
941 * ----------------------------------------------------------------
942 * unifi_ioctl
943 *
944 * Ioctl handler for unifi driver.
945 *
946 * Arguments:
947 * inodep Pointer to inode structure.
948 * filp Pointer to file structure.
949 * cmd Ioctl cmd passed by user.
950 * arg Ioctl arg passed by user.
951 *
952 * Returns:
953 * 0 on success, -ve error code on error.
954 * ----------------------------------------------------------------
955 */
956static long
957unifi_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
958{
959 ul_client_t *pcli = (ul_client_t*)filp->private_data;
960 unifi_priv_t *priv;
961 struct net_device *dev;
962 int r = 0;
963 int int_param, i;
964 u8* buf;
965 CsrResult csrResult;
966#if (defined CSR_SUPPORT_SME)
967 unifi_cfg_command_t cfg_cmd;
968#if (defined CSR_SUPPORT_WEXT)
969 CsrWifiSmeCoexConfig coex_config;
970 unsigned char uchar_param;
971 unsigned char varbind[MAX_VARBIND_LENGTH];
972 int vblen;
973#endif
974#endif
975 unifi_putest_command_t putest_cmd;
976
977 priv = uf_find_instance(pcli->instance);
978 if (!priv) {
979 unifi_error(priv, "ioctl error: unknown instance=%d\n", pcli->instance);
980 r = -ENODEV;
981 goto out;
982 }
983 unifi_trace(priv, UDBG5, "unifi_ioctl: cmd=0x%X, arg=0x%lX\n", cmd, arg);
984
985 switch (cmd) {
986
987 case UNIFI_GET_UDI_ENABLE:
988 unifi_trace(priv, UDBG4, "UniFi Get UDI Enable\n");
989
990 down(&priv->udi_logging_mutex);
991 int_param = (priv->logging_client == NULL) ? 0 : 1;
992 up(&priv->udi_logging_mutex);
993
994 if (put_user(int_param, (int*)arg))
995 {
996 unifi_error(priv, "UNIFI_GET_UDI_ENABLE: Failed to copy to user\n");
997 r = -EFAULT;
998 goto out;
999 }
1000 break;
1001
1002 case UNIFI_SET_UDI_ENABLE:
1003 unifi_trace(priv, UDBG4, "UniFi Set UDI Enable\n");
1004 if (get_user(int_param, (int*)arg))
1005 {
1006 unifi_error(priv, "UNIFI_SET_UDI_ENABLE: Failed to copy from user\n");
1007 r = -EFAULT;
1008 goto out;
1009 }
1010
1011#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
1012 if (log_hip_signals) {
1013 unifi_error(priv, "omnicli cannot be used when log_hip_signals is used\n");
1014 r = -EFAULT;
1015 goto out;
1016 }
1017#endif
1018
1019 down(&priv->udi_logging_mutex);
1020 if (int_param) {
1021 pcli->event_hook = udi_log_event;
1022 unifi_set_udi_hook(priv->card, logging_handler);
1023 /* Log all signals by default */
1024 for (i = 0; i < SIG_FILTER_SIZE; i++) {
1025 pcli->signal_filter[i] = 0xFFFF;
1026 }
1027 priv->logging_client = pcli;
1028
1029 } else {
1030 priv->logging_client = NULL;
1031 pcli->event_hook = NULL;
1032 }
1033 up(&priv->udi_logging_mutex);
1034
1035 break;
1036
1037 case UNIFI_SET_MIB:
1038 unifi_trace(priv, UDBG4, "UniFi Set MIB\n");
1039#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT)
1040 /* Read first 2 bytes and check length */
1041 if (copy_from_user((void*)varbind, (void*)arg, 2)) {
1042 unifi_error(priv,
1043 "UNIFI_SET_MIB: Failed to copy in varbind header\n");
1044 r = -EFAULT;
1045 goto out;
1046 }
1047 vblen = varbind[1];
1048 if ((vblen + 2) > MAX_VARBIND_LENGTH) {
1049 unifi_error(priv,
1050 "UNIFI_SET_MIB: Varbind too long (%d, limit %d)\n",
1051 (vblen+2), MAX_VARBIND_LENGTH);
1052 r = -EINVAL;
1053 goto out;
1054 }
1055 /* Read rest of varbind */
1056 if (copy_from_user((void*)(varbind+2), (void*)(arg+2), vblen)) {
1057 unifi_error(priv, "UNIFI_SET_MIB: Failed to copy in varbind\n");
1058 r = -EFAULT;
1059 goto out;
1060 }
1061
1062 /* send to SME */
1063 vblen += 2;
1064 r = sme_mgt_mib_set(priv, varbind, vblen);
1065 if (r) {
1066 goto out;
1067 }
1068#else
1069 unifi_notice(priv, "UNIFI_SET_MIB: Unsupported.\n");
1070#endif /* CSR_SUPPORT_WEXT */
1071 break;
1072
1073 case UNIFI_GET_MIB:
1074 unifi_trace(priv, UDBG4, "UniFi Get MIB\n");
1075#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT)
1076 /* Read first 2 bytes and check length */
1077 if (copy_from_user((void*)varbind, (void*)arg, 2)) {
1078 unifi_error(priv, "UNIFI_GET_MIB: Failed to copy in varbind header\n");
1079 r = -EFAULT;
1080 goto out;
1081 }
1082 vblen = varbind[1];
1083 if ((vblen+2) > MAX_VARBIND_LENGTH) {
1084 unifi_error(priv, "UNIFI_GET_MIB: Varbind too long (%d, limit %d)\n",
1085 (vblen+2), MAX_VARBIND_LENGTH);
1086 r = -EINVAL;
1087 goto out;
1088 }
1089 /* Read rest of varbind */
1090 if (copy_from_user((void*)(varbind+2), (void*)(arg+2), vblen)) {
1091 unifi_error(priv, "UNIFI_GET_MIB: Failed to copy in varbind\n");
1092 r = -EFAULT;
1093 goto out;
1094 }
1095
1096 vblen += 2;
1097 r = sme_mgt_mib_get(priv, varbind, &vblen);
1098 if (r) {
1099 goto out;
1100 }
1101 /* copy out varbind */
1102 if (vblen > MAX_VARBIND_LENGTH) {
1103 unifi_error(priv,
1104 "UNIFI_GET_MIB: Varbind result too long (%d, limit %d)\n",
1105 vblen, MAX_VARBIND_LENGTH);
1106 r = -EINVAL;
1107 goto out;
1108 }
1109 if (copy_to_user((void*)arg, varbind, vblen)) {
1110 r = -EFAULT;
1111 goto out;
1112 }
1113#else
1114 unifi_notice(priv, "UNIFI_GET_MIB: Unsupported.\n");
1115#endif /* CSR_SUPPORT_WEXT */
1116 break;
1117
1118 case UNIFI_CFG:
1119#if (defined CSR_SUPPORT_SME)
1120 if (get_user(cfg_cmd, (unifi_cfg_command_t*)arg))
1121 {
1122 unifi_error(priv, "UNIFI_CFG: Failed to get the command\n");
1123 r = -EFAULT;
1124 goto out;
1125 }
1126
1127 unifi_trace(priv, UDBG1, "UNIFI_CFG: Command is %d (t=%u) sz=%d\n",
1128 cfg_cmd, jiffies_to_msecs(jiffies), sizeof(unifi_cfg_command_t));
1129 switch (cfg_cmd) {
1130 case UNIFI_CFG_POWER:
1131 r = unifi_cfg_power(priv, (unsigned char*)arg);
1132 break;
1133 case UNIFI_CFG_POWERSAVE:
1134 r = unifi_cfg_power_save(priv, (unsigned char*)arg);
1135 break;
1136 case UNIFI_CFG_POWERSUPPLY:
1137 r = unifi_cfg_power_supply(priv, (unsigned char*)arg);
1138 break;
1139 case UNIFI_CFG_FILTER:
1140 r = unifi_cfg_packet_filters(priv, (unsigned char*)arg);
1141 break;
1142 case UNIFI_CFG_GET:
1143 r = unifi_cfg_get_info(priv, (unsigned char*)arg);
1144 break;
1145 case UNIFI_CFG_WMM_QOSINFO:
1146 r = unifi_cfg_wmm_qos_info(priv, (unsigned char*)arg);
1147 break;
1148 case UNIFI_CFG_WMM_ADDTS:
1149 r = unifi_cfg_wmm_addts(priv, (unsigned char*)arg);
1150 break;
1151 case UNIFI_CFG_WMM_DELTS:
1152 r = unifi_cfg_wmm_delts(priv, (unsigned char*)arg);
1153 break;
1154 case UNIFI_CFG_STRICT_DRAFT_N:
1155 r = unifi_cfg_strict_draft_n(priv, (unsigned char*)arg);
1156 break;
1157 case UNIFI_CFG_ENABLE_OKC:
1158 r = unifi_cfg_enable_okc(priv, (unsigned char*)arg);
1159 break;
1160#ifdef CSR_SUPPORT_SME
1161 case UNIFI_CFG_CORE_DUMP:
1162 CsrWifiRouterCtrlWifiOffIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, CSR_WIFI_SME_CONTROL_INDICATION_ERROR);
1163 unifi_trace(priv, UDBG2, "UNIFI_CFG_CORE_DUMP: sent wifi off indication\n");
1164 break;
1165#endif
1166#ifdef CSR_SUPPORT_WEXT_AP
1167 case UNIFI_CFG_SET_AP_CONFIG:
1168 r= unifi_cfg_set_ap_config(priv, (unsigned char*)arg);
1169 break;
1170#endif
1171 default:
1172 unifi_error(priv, "UNIFI_CFG: Unknown Command (%d)\n", cfg_cmd);
1173 r = -EINVAL;
1174 goto out;
1175 }
1176#endif
1177
1178 break;
1179
1180 case UNIFI_PUTEST:
1181 if (get_user(putest_cmd, (unifi_putest_command_t*)arg))
1182 {
1183 unifi_error(priv, "UNIFI_PUTEST: Failed to get the command\n");
1184 r = -EFAULT;
1185 goto out;
1186 }
1187
1188 unifi_trace(priv, UDBG1, "UNIFI_PUTEST: Command is %s\n",
1189 trace_putest_cmdid(putest_cmd));
1190 switch (putest_cmd) {
1191 case UNIFI_PUTEST_START:
1192 r = unifi_putest_start(priv, (unsigned char*)arg);
1193 break;
1194 case UNIFI_PUTEST_STOP:
1195 r = unifi_putest_stop(priv, (unsigned char*)arg);
1196 break;
1197 case UNIFI_PUTEST_SET_SDIO_CLOCK:
1198 r = unifi_putest_set_sdio_clock(priv, (unsigned char*)arg);
1199 break;
1200 case UNIFI_PUTEST_CMD52_READ:
1201 r = unifi_putest_cmd52_read(priv, (unsigned char*)arg);
1202 break;
1203 case UNIFI_PUTEST_CMD52_BLOCK_READ:
1204 r = unifi_putest_cmd52_block_read(priv, (unsigned char*)arg);
1205 break;
1206 case UNIFI_PUTEST_CMD52_WRITE:
1207 r = unifi_putest_cmd52_write(priv, (unsigned char*)arg);
1208 break;
1209 case UNIFI_PUTEST_DL_FW:
1210 r = unifi_putest_dl_fw(priv, (unsigned char*)arg);
1211 break;
1212 case UNIFI_PUTEST_DL_FW_BUFF:
1213 r = unifi_putest_dl_fw_buff(priv, (unsigned char*)arg);
1214 break;
1215 case UNIFI_PUTEST_COREDUMP_PREPARE:
1216 r = unifi_putest_coredump_prepare(priv, (unsigned char*)arg);
1217 break;
1218 case UNIFI_PUTEST_GP_READ16:
1219 r = unifi_putest_gp_read16(priv, (unsigned char*)arg);
1220 break;
1221 case UNIFI_PUTEST_GP_WRITE16:
1222 r = unifi_putest_gp_write16(priv, (unsigned char*)arg);
1223 break;
1224 default:
1225 unifi_error(priv, "UNIFI_PUTEST: Unknown Command (%d)\n", putest_cmd);
1226 r = -EINVAL;
1227 goto out;
1228 }
1229
1230 break;
1231 case UNIFI_BUILD_TYPE:
1232 unifi_trace(priv, UDBG2, "UNIFI_BUILD_TYPE userspace=%s\n", build_type_to_string(*(unsigned char*)arg));
1233#ifndef CSR_SUPPORT_WEXT_AP
1234 if (UNIFI_BUILD_AP == *(unsigned char*)arg)
1235 {
1236 unifi_error(priv, "Userspace has AP support, which is incompatible\n");
1237 }
1238#endif
1239
1240#ifndef CSR_SUPPORT_WEXT
1241 if (UNIFI_BUILD_WEXT == *(unsigned char*)arg)
1242 {
1243 unifi_error(priv, "Userspace has WEXT support, which is incompatible\n");
1244 }
1245#endif
1246 break;
1247 case UNIFI_INIT_HW:
1248 unifi_trace(priv, UDBG2, "UNIFI_INIT_HW.\n");
1249 priv->init_progress = UNIFI_INIT_NONE;
1250
1251#if defined(CSR_SUPPORT_WEXT) || defined (CSR_NATIVE_LINUX)
1252 /* At this point we are ready to start the SME. */
1253 r = sme_mgt_wifi_on(priv);
1254 if (r) {
1255 goto out;
1256 }
1257#endif
1258
1259 break;
1260
1261 case UNIFI_INIT_NETDEV:
1262 {
1263 /* get the proper interfaceTagId */
1264 u16 interfaceTag=0;
1265 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
1266
1267 dev = priv->netdev[interfaceTag];
1268 unifi_trace(priv, UDBG2, "UNIFI_INIT_NETDEV.\n");
1269
1270 if (copy_from_user((void*)dev->dev_addr, (void*)arg, 6)) {
1271 r = -EFAULT;
1272 goto out;
1273 }
1274
1275 /* Attach the network device to the stack */
1276 if (!interfacePriv->netdev_registered)
1277 {
1278 r = uf_register_netdev(priv, interfaceTag);
1279 if (r) {
1280 unifi_error(priv, "Failed to register the network device.\n");
1281 goto out;
1282 }
1283 }
1284
1285 /* Apply scheduled interrupt mode, if requested by module param */
1286 if (run_bh_once != -1) {
1287 unifi_set_interrupt_mode(priv->card, (u32)run_bh_once);
1288 }
1289
1290 priv->init_progress = UNIFI_INIT_COMPLETED;
1291
1292 /* Firmware initialisation is complete, so let the SDIO bus
1293 * clock be raised when convienent to the core.
1294 */
1295 unifi_request_max_sdio_clock(priv->card);
1296
1297#ifdef CSR_SUPPORT_WEXT
1298 /* Notify the Android wpa_supplicant that we are ready */
1299 wext_send_started_event(priv);
1300#endif
1301
1302 unifi_info(priv, "UniFi ready\n");
1303
1304#ifdef ANDROID_BUILD
1305 /* Release the wakelock */
1306 unifi_trace(priv, UDBG1, "netdev_init: release wake lock\n");
1307 wake_unlock(&unifi_sdio_wake_lock);
1308#endif
1309#ifdef CSR_NATIVE_SOFTMAC /* For softmac dev, force-enable the network interface rather than wait for a connected-ind */
1310 {
1311 struct net_device *dev = priv->netdev[interfaceTag];
1312#ifdef CSR_SUPPORT_WEXT
1313 interfacePriv->wait_netdev_change = TRUE;
1314#endif
1315 netif_carrier_on(dev);
1316 }
1317#endif
1318 }
1319 break;
1320 case UNIFI_GET_INIT_STATUS:
1321 unifi_trace(priv, UDBG2, "UNIFI_GET_INIT_STATUS.\n");
1322 if (put_user(priv->init_progress, (int*)arg))
1323 {
1324 printk(KERN_ERR "UNIFI_GET_INIT_STATUS: Failed to copy to user\n");
1325 r = -EFAULT;
1326 goto out;
1327 }
1328 break;
1329
1330 case UNIFI_KICK:
1331 unifi_trace(priv, UDBG4, "Kick UniFi\n");
1332 unifi_sdio_interrupt_handler(priv->card);
1333 break;
1334
1335 case UNIFI_SET_DEBUG:
1336 unifi_debug = arg;
1337 unifi_trace(priv, UDBG4, "unifi_debug set to %d\n", unifi_debug);
1338 break;
1339
1340 case UNIFI_SET_TRACE:
1341 /* no longer supported */
1342 r = -EINVAL;
1343 break;
1344
1345
1346 case UNIFI_SET_UDI_LOG_MASK:
1347 {
1348 unifiio_filter_t udi_filter;
1349 uint16_t *sig_ids_addr;
1350#define UF_MAX_SIG_IDS 128 /* Impose a sensible limit */
1351
1352 if (copy_from_user((void*)(&udi_filter), (void*)arg, sizeof(udi_filter))) {
1353 r = -EFAULT;
1354 goto out;
1355 }
1356 if ((udi_filter.action < UfSigFil_AllOn) ||
1357 (udi_filter.action > UfSigFil_SelectOff))
1358 {
1359 printk(KERN_WARNING
1360 "UNIFI_SET_UDI_LOG_MASK: Bad action value: %d\n",
1361 udi_filter.action);
1362 r = -EINVAL;
1363 goto out;
1364 }
1365 /* No signal list for "All" actions */
1366 if ((udi_filter.action == UfSigFil_AllOn) ||
1367 (udi_filter.action == UfSigFil_AllOff))
1368 {
1369 udi_filter.num_sig_ids = 0;
1370 }
1371
1372 if (udi_filter.num_sig_ids > UF_MAX_SIG_IDS) {
1373 printk(KERN_WARNING
1374 "UNIFI_SET_UDI_LOG_MASK: too many signal ids (%d, max %d)\n",
1375 udi_filter.num_sig_ids, UF_MAX_SIG_IDS);
1376 r = -EINVAL;
1377 goto out;
1378 }
1379
1380 /* Copy in signal id list if given */
1381 if (udi_filter.num_sig_ids > 0) {
1382 /* Preserve userspace address of sig_ids array */
1383 sig_ids_addr = udi_filter.sig_ids;
1384 /* Allocate kernel memory for sig_ids and copy to it */
1385 udi_filter.sig_ids =
1386 kmalloc(udi_filter.num_sig_ids * sizeof(uint16_t), GFP_KERNEL);
1387 if (!udi_filter.sig_ids) {
1388 r = -ENOMEM;
1389 goto out;
1390 }
1391 if (copy_from_user((void*)udi_filter.sig_ids,
1392 (void*)sig_ids_addr,
1393 udi_filter.num_sig_ids * sizeof(uint16_t)))
1394 {
1395 kfree(udi_filter.sig_ids);
1396 r = -EFAULT;
1397 goto out;
1398 }
1399 }
1400
1401 udi_set_log_filter(pcli, &udi_filter);
1402
1403 if (udi_filter.num_sig_ids > 0) {
1404 kfree(udi_filter.sig_ids);
1405 }
1406 }
1407 break;
1408
1409 case UNIFI_SET_AMP_ENABLE:
1410 unifi_trace(priv, UDBG4, "UniFi Set AMP Enable\n");
1411 if (get_user(int_param, (int*)arg))
1412 {
1413 unifi_error(priv, "UNIFI_SET_AMP_ENABLE: Failed to copy from user\n");
1414 r = -EFAULT;
1415 goto out;
1416 }
1417
1418 if (int_param) {
1419 priv->amp_client = pcli;
1420 } else {
1421 priv->amp_client = NULL;
1422 }
1423
1424 int_param = 0;
1425 buf = (u8*)&int_param;
1426 buf[0] = UNIFI_SOFT_COMMAND_Q_LENGTH - 1;
1427 buf[1] = UNIFI_SOFT_TRAFFIC_Q_LENGTH - 1;
1428 if (copy_to_user((void*)arg, &int_param, sizeof(int))) {
1429 r = -EFAULT;
1430 goto out;
1431 }
1432 break;
1433
1434 case UNIFI_SET_UDI_SNAP_MASK:
1435 {
1436 unifiio_snap_filter_t snap_filter;
1437
1438 if (copy_from_user((void*)(&snap_filter), (void*)arg, sizeof(snap_filter))) {
1439 r = -EFAULT;
1440 goto out;
1441 }
1442
1443 if (pcli->snap_filter.count) {
1444 pcli->snap_filter.count = 0;
1445 kfree(pcli->snap_filter.protocols);
1446 }
1447
1448 if (snap_filter.count == 0) {
1449 break;
1450 }
1451
1452 pcli->snap_filter.protocols = kmalloc(snap_filter.count * sizeof(u16), GFP_KERNEL);
1453 if (!pcli->snap_filter.protocols) {
1454 r = -ENOMEM;
1455 goto out;
1456 }
1457 if (copy_from_user((void*)pcli->snap_filter.protocols,
1458 (void*)snap_filter.protocols,
1459 snap_filter.count * sizeof(u16)))
1460 {
1461 kfree(pcli->snap_filter.protocols);
1462 r = -EFAULT;
1463 goto out;
1464 }
1465
1466 pcli->snap_filter.count = snap_filter.count;
1467
1468 }
1469 break;
1470
1471 case UNIFI_SME_PRESENT:
1472 {
1473 u8 ind;
1474 unifi_trace(priv, UDBG4, "UniFi SME Present IOCTL.\n");
1475 if (copy_from_user((void*)(&int_param), (void*)arg, sizeof(int)))
1476 {
1477 printk(KERN_ERR "UNIFI_SME_PRESENT: Failed to copy from user\n");
1478 r = -EFAULT;
1479 goto out;
1480 }
1481
1482 priv->sme_is_present = int_param;
1483 if (priv->sme_is_present == 1) {
1484 ind = CONFIG_SME_PRESENT;
1485 } else {
1486 ind = CONFIG_SME_NOT_PRESENT;
1487 }
1488 /* Send an indication to the helper app. */
1489 ul_log_config_ind(priv, &ind, sizeof(u8));
1490 }
1491 break;
1492
1493 case UNIFI_CFG_PERIOD_TRAFFIC:
1494 {
1495#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT)
1496 CsrWifiSmeCoexConfig coexConfig;
1497#endif /* CSR_SUPPORT_SME && CSR_SUPPORT_WEXT */
1498 unifi_trace(priv, UDBG4, "UniFi Configure Periodic Traffic.\n");
1499#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT)
1500 if (copy_from_user((void*)(&uchar_param), (void*)arg, sizeof(unsigned char))) {
1501 unifi_error(priv, "UNIFI_CFG_PERIOD_TRAFFIC: Failed to copy from user\n");
1502 r = -EFAULT;
1503 goto out;
1504 }
1505
1506 if (uchar_param == 0) {
1507 r = sme_mgt_coex_config_get(priv, &coexConfig);
1508 if (r) {
1509 unifi_error(priv, "UNIFI_CFG_PERIOD_TRAFFIC: Get unifi_CoexInfoValue failed.\n");
1510 goto out;
1511 }
1512 if (copy_to_user((void*)(arg + 1),
1513 (void*)&coexConfig,
1514 sizeof(CsrWifiSmeCoexConfig))) {
1515 r = -EFAULT;
1516 goto out;
1517 }
1518 goto out;
1519 }
1520
1521 if (copy_from_user((void*)(&coex_config), (void*)(arg + 1), sizeof(CsrWifiSmeCoexConfig)))
1522 {
1523 unifi_error(priv, "UNIFI_CFG_PERIOD_TRAFFIC: Failed to copy from user\n");
1524 r = -EFAULT;
1525 goto out;
1526 }
1527
1528 coexConfig = coex_config;
1529 r = sme_mgt_coex_config_set(priv, &coexConfig);
1530 if (r) {
1531 unifi_error(priv, "UNIFI_CFG_PERIOD_TRAFFIC: Set unifi_CoexInfoValue failed.\n");
1532 goto out;
1533 }
1534
1535#endif /* CSR_SUPPORT_SME && CSR_SUPPORT_WEXT */
1536 break;
1537 }
1538 case UNIFI_CFG_UAPSD_TRAFFIC:
1539 unifi_trace(priv, UDBG4, "UniFi Configure U-APSD Mask.\n");
1540#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT)
1541 if (copy_from_user((void*)(&uchar_param), (void*)arg, sizeof(unsigned char))) {
1542 unifi_error(priv, "UNIFI_CFG_UAPSD_TRAFFIC: Failed to copy from user\n");
1543 r = -EFAULT;
1544 goto out;
1545 }
1546 unifi_trace(priv, UDBG4, "New U-APSD Mask: 0x%x\n", uchar_param);
1547#endif /* CSR_SUPPORT_SME && CSR_SUPPORT_WEXT */
1548 break;
1549
1550#ifndef UNIFI_DISABLE_COREDUMP
1551 case UNIFI_COREDUMP_GET_REG:
1552 unifi_trace(priv, UDBG4, "Mini-coredump data request\n");
1553 {
1554 unifiio_coredump_req_t dump_req; /* Public OS layer structure */
1555 unifi_coredump_req_t priv_req; /* Private HIP structure */
1556
1557 if (copy_from_user((void*)(&dump_req), (void*)arg, sizeof(dump_req))) {
1558 r = -EFAULT;
1559 goto out;
1560 }
1561 memset(&priv_req, 0, sizeof(priv_req));
1562 priv_req.index = dump_req.index;
1563 priv_req.offset = dump_req.offset;
1564
1565 /* Convert OS-layer's XAP memory space ID to HIP's ID in case they differ */
1566 switch (dump_req.space) {
1567 case UNIFIIO_COREDUMP_MAC_REG: priv_req.space = UNIFI_COREDUMP_MAC_REG; break;
1568 case UNIFIIO_COREDUMP_PHY_REG: priv_req.space = UNIFI_COREDUMP_PHY_REG; break;
1569 case UNIFIIO_COREDUMP_SH_DMEM: priv_req.space = UNIFI_COREDUMP_SH_DMEM; break;
1570 case UNIFIIO_COREDUMP_MAC_DMEM: priv_req.space = UNIFI_COREDUMP_MAC_DMEM; break;
1571 case UNIFIIO_COREDUMP_PHY_DMEM: priv_req.space = UNIFI_COREDUMP_PHY_DMEM; break;
1572 case UNIFIIO_COREDUMP_TRIGGER_MAGIC: priv_req.space = UNIFI_COREDUMP_TRIGGER_MAGIC; break;
1573 default:
1574 r = -EINVAL;
1575 goto out;
1576 }
1577
1578 if (priv_req.space == UNIFI_COREDUMP_TRIGGER_MAGIC) {
1579 /* Force a coredump grab now */
1580 unifi_trace(priv, UDBG2, "UNIFI_COREDUMP_GET_REG: Force capture\n");
1581 csrResult = unifi_coredump_capture(priv->card, &priv_req);
1582 r = CsrHipResultToStatus(csrResult);
1583 unifi_trace(priv, UDBG5, "UNIFI_COREDUMP_GET_REG: status %d\n", r);
1584 } else {
1585 /* Retrieve the appropriate register entry */
1586 csrResult = unifi_coredump_get_value(priv->card, &priv_req);
1587 r = CsrHipResultToStatus(csrResult);
1588 if (r) {
1589 unifi_trace(priv, UDBG5, "UNIFI_COREDUMP_GET_REG: Status %d\n", r);
1590 goto out;
1591 }
1592 /* Update the OS-layer structure with values returned in the private */
1593 dump_req.value = priv_req.value;
1594 dump_req.timestamp = priv_req.timestamp;
1595 dump_req.requestor = priv_req.requestor;
1596 dump_req.serial = priv_req.serial;
1597 dump_req.chip_ver = priv_req.chip_ver;
1598 dump_req.fw_ver = priv_req.fw_ver;
1599 dump_req.drv_build = 0;
1600
1601 unifi_trace(priv, UDBG6,
1602 "Dump: %d (seq %d): V:0x%04x (%d) @0x%02x:%04x = 0x%04x\n",
1603 dump_req.index, dump_req.serial,
1604 dump_req.chip_ver, dump_req.drv_build,
1605 dump_req.space, dump_req.offset, dump_req.value);
1606 }
1607 if (copy_to_user((void*)arg, (void*)&dump_req, sizeof(dump_req))) {
1608 r = -EFAULT;
1609 goto out;
1610 }
1611 }
1612 break;
1613#endif
1614 default:
1615 r = -EINVAL;
1616 }
1617
1618out:
1619 return (long)r;
1620} /* unifi_ioctl() */
1621
1622
1623
1624static unsigned int
1625unifi_poll(struct file *filp, poll_table *wait)
1626{
1627 ul_client_t *pcli = (ul_client_t*)filp->private_data;
1628 unsigned int mask = 0;
1629 int ready;
1630
1631 ready = !list_empty(&pcli->udi_log);
1632
1633 poll_wait(filp, &pcli->udi_wq, wait);
1634
1635 if (ready) {
1636 mask |= POLLIN | POLLRDNORM; /* readable */
1637 }
1638
1639 return mask;
1640} /* unifi_poll() */
1641
1642
1643
1644/*
1645 * ---------------------------------------------------------------------------
1646 * udi_set_log_filter
1647 *
1648 * Configure the bit mask that determines which signal primitives are
1649 * passed to the logging process.
1650 *
1651 * Arguments:
1652 * pcli Pointer to the client to configure.
1653 * udi_filter Pointer to a unifiio_filter_t containing instructions.
1654 *
1655 * Returns:
1656 * None.
1657 *
1658 * Notes:
1659 * SigGetFilterPos() returns a 32-bit value that contains an index and a
1660 * mask for accessing a signal_filter array. The top 16 bits specify an
1661 * index into a signal_filter, the bottom 16 bits specify a mask to
1662 * apply.
1663 * ---------------------------------------------------------------------------
1664 */
1665static void
1666udi_set_log_filter(ul_client_t *pcli, unifiio_filter_t *udi_filter)
1667{
1668 u32 filter_pos;
1669 int i;
1670
1671 if (udi_filter->action == UfSigFil_AllOn)
1672 {
1673 for (i = 0; i < SIG_FILTER_SIZE; i++) {
1674 pcli->signal_filter[i] = 0xFFFF;
1675 }
1676 }
1677 else if (udi_filter->action == UfSigFil_AllOff)
1678 {
1679 for (i = 0; i < SIG_FILTER_SIZE; i++) {
1680 pcli->signal_filter[i] = 0;
1681 }
1682 }
1683 else if (udi_filter->action == UfSigFil_SelectOn)
1684 {
1685 for (i = 0; i < udi_filter->num_sig_ids; i++) {
1686 filter_pos = SigGetFilterPos(udi_filter->sig_ids[i]);
1687 if (filter_pos == 0xFFFFFFFF)
1688 {
1689 printk(KERN_WARNING
1690 "Unrecognised signal id (0x%X) specifed in logging filter\n",
1691 udi_filter->sig_ids[i]);
1692 } else {
1693 pcli->signal_filter[filter_pos >> 16] |= (filter_pos & 0xFFFF);
1694 }
1695 }
1696 }
1697 else if (udi_filter->action == UfSigFil_SelectOff)
1698 {
1699 for (i = 0; i < udi_filter->num_sig_ids; i++) {
1700 filter_pos = SigGetFilterPos(udi_filter->sig_ids[i]);
1701 if (filter_pos == 0xFFFFFFFF)
1702 {
1703 printk(KERN_WARNING
1704 "Unrecognised signal id (0x%X) specifed in logging filter\n",
1705 udi_filter->sig_ids[i]);
1706 } else {
1707 pcli->signal_filter[filter_pos >> 16] &= ~(filter_pos & 0xFFFF);
1708 }
1709 }
1710 }
1711
1712} /* udi_set_log_filter() */
1713
1714
1715/*
1716 * ---------------------------------------------------------------------------
1717 * udi_log_event
1718 *
1719 * Callback function to be registered as the UDI hook callback.
1720 * Copies the signal content into a new udi_log_t struct and adds
1721 * it to the read queue for this UDI client.
1722 *
1723 * Arguments:
1724 * pcli A pointer to the client instance.
1725 * signal Pointer to the received signal.
1726 * signal_len Size of the signal structure in bytes.
1727 * bulkdata Pointers to any associated bulk data.
1728 * dir Direction of the signal. Zero means from host,
1729 * non-zero means to host.
1730 *
1731 * Returns:
1732 * None.
1733 * ---------------------------------------------------------------------------
1734 */
1735void
1736udi_log_event(ul_client_t *pcli,
1737 const u8 *signal, int signal_len,
1738 const bulk_data_param_t *bulkdata,
1739 int dir)
1740{
1741 udi_log_t *logptr;
1742 u8 *p;
1743 int i;
1744 int total_len;
1745 udi_msg_t *msgptr;
1746 u32 filter_pos;
1747#ifdef OMNICLI_LINUX_EXTRA_LOG
1748 static volatile unsigned int printk_cpu = UINT_MAX;
1749 unsigned long long t;
1750 unsigned long nanosec_rem;
1751 unsigned long n_1000;
1752#endif
1753
1754 /* Just a sanity check */
1755 if ((signal == NULL) || (signal_len <= 0)) {
1756 return;
1757 }
1758
1759#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
1760 /* When HIP offline signal logging is enabled, omnicli cannot run */
1761 if (log_hip_signals)
1762 {
1763 /* Add timestamp */
1764 if (log_hip_signals & UNIFI_LOG_HIP_SIGNALS_FILTER_TIMESTAMP)
1765 {
1766 int timestamp = jiffies_to_msecs(jiffies);
1767 unifi_debug_log_to_buf("T:");
1768 unifi_debug_log_to_buf("%04X%04X ", *(((u16*)&timestamp) + 1),
1769 *(u16*)&timestamp);
1770 }
1771
1772 /* Add signal */
1773 unifi_debug_log_to_buf("S%s:%04X R:%04X D:%04X ",
1774 dir ? "T" : "F",
1775 *(u16*)signal,
1776 *(u16*)(signal + 2),
1777 *(u16*)(signal + 4));
1778 unifi_debug_hex_to_buf(signal + 6, signal_len - 6);
1779
1780 /* Add bulk data (assume 1 bulk data per signal) */
1781 if ((log_hip_signals & UNIFI_LOG_HIP_SIGNALS_FILTER_BULKDATA) &&
1782 (bulkdata->d[0].data_length > 0))
1783 {
1784 unifi_debug_log_to_buf("\nD:");
1785 unifi_debug_hex_to_buf(bulkdata->d[0].os_data_ptr, bulkdata->d[0].data_length);
1786 }
1787 unifi_debug_log_to_buf("\n");
1788
1789 return;
1790 }
1791#endif
1792
1793#ifdef CSR_NATIVE_LINUX
1794 uf_native_process_udi_signal(pcli, signal, signal_len, bulkdata, dir);
1795#endif
1796
1797 /*
1798 * Apply the logging filter - only report signals that have their
1799 * bit set in the filter mask.
1800 */
1801 filter_pos = SigGetFilterPos(GET_SIGNAL_ID(signal));
1802
1803 if ((filter_pos != 0xFFFFFFFF) &&
1804 ((pcli->signal_filter[filter_pos >> 16] & (filter_pos & 0xFFFF)) == 0))
1805 {
1806 /* Signal is not wanted by client */
1807 return;
1808 }
1809
1810
1811 /* Calculate the buffer we need to store signal plus bulk data */
1812 total_len = signal_len;
1813 for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) {
1814 total_len += bulkdata->d[i].data_length;
1815 }
1816
1817 /* Allocate log structure plus actual signal. */
1818 logptr = kmalloc(sizeof(udi_log_t) + total_len, GFP_KERNEL);
1819
1820 if (logptr == NULL) {
1821 printk(KERN_ERR
1822 "Failed to allocate %lu bytes for a UDI log record\n",
1823 (long unsigned int)(sizeof(udi_log_t) + total_len));
1824 return;
1825 }
1826
1827 /* Fill in udi_log struct */
1828 INIT_LIST_HEAD(&logptr->q);
1829 msgptr = &logptr->msg;
1830 msgptr->length = sizeof(udi_msg_t) + total_len;
1831#ifdef OMNICLI_LINUX_EXTRA_LOG
1832 t = cpu_clock(printk_cpu);
1833 nanosec_rem = do_div(t, 1000000000);
1834 n_1000 = nanosec_rem/1000;
1835 msgptr->timestamp = (t <<10 ) | ((unsigned long)(n_1000 >> 10) & 0x3ff);
1836#else
1837 msgptr->timestamp = jiffies_to_msecs(jiffies);
1838#endif
1839 msgptr->direction = dir;
1840 msgptr->signal_length = signal_len;
1841
1842 /* Copy signal and bulk data to the log */
1843 p = (u8 *)(msgptr + 1);
1844 memcpy(p, signal, signal_len);
1845 p += signal_len;
1846
1847 /* Append any bulk data */
1848 for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) {
1849 int len = bulkdata->d[i].data_length;
1850
1851 /*
1852 * Len here might not be the same as the length in the bulk data slot.
1853 * The slot length will always be even, but len could be odd.
1854 */
1855 if (len > 0) {
1856 if (bulkdata->d[i].os_data_ptr) {
1857 memcpy(p, bulkdata->d[i].os_data_ptr, len);
1858 } else {
1859 memset(p, 0, len);
1860 }
1861 p += len;
1862 }
1863 }
1864
1865 /* Add to tail of log queue */
1866 if (down_interruptible(&pcli->udi_sem)) {
1867 printk(KERN_WARNING "udi_log_event_q: Failed to get udi sem\n");
1868 kfree(logptr);
1869 return;
1870 }
1871 list_add_tail(&logptr->q, &pcli->udi_log);
1872 up(&pcli->udi_sem);
1873
1874 /* Wake any waiting user process */
1875 wake_up_interruptible(&pcli->udi_wq);
1876
1877} /* udi_log_event() */
1878
1879#ifdef CSR_SME_USERSPACE
1880int
1881uf_sme_queue_message(unifi_priv_t *priv, u8 *buffer, int length)
1882{
1883 udi_log_t *logptr;
1884 udi_msg_t *msgptr;
1885 u8 *p;
1886
1887 /* Just a sanity check */
1888 if ((buffer == NULL) || (length <= 0)) {
1889 return -EINVAL;
1890 }
1891
1892 /* Allocate log structure plus actual signal. */
1893 logptr = kmalloc(sizeof(udi_log_t) + length, GFP_ATOMIC);
1894 if (logptr == NULL) {
1895 unifi_error(priv, "Failed to allocate %d bytes for an SME message\n",
1896 sizeof(udi_log_t) + length);
1897 kfree(buffer);
1898 return -ENOMEM;
1899 }
1900
1901 /* Fill in udi_log struct */
1902 INIT_LIST_HEAD(&logptr->q);
1903 msgptr = &logptr->msg;
1904 msgptr->length = sizeof(udi_msg_t) + length;
1905 msgptr->signal_length = length;
1906
1907 /* Copy signal and bulk data to the log */
1908 p = (u8 *)(msgptr + 1);
1909 memcpy(p, buffer, length);
1910
1911 /* Add to tail of log queue */
1912 down(&udi_mutex);
1913 if (priv->sme_cli == NULL) {
1914 kfree(logptr);
1915 kfree(buffer);
1916 up(&udi_mutex);
1917 unifi_info(priv, "Message for the SME dropped, SME has gone away\n");
1918 return 0;
1919 }
1920
1921 down(&priv->sme_cli->udi_sem);
1922 list_add_tail(&logptr->q, &priv->sme_cli->udi_log);
1923 up(&priv->sme_cli->udi_sem);
1924
1925 /* Wake any waiting user process */
1926 wake_up_interruptible(&priv->sme_cli->udi_wq);
1927 up(&udi_mutex);
1928
1929 /* It is our responsibility to free the buffer allocated in build_packed_*() */
1930 kfree(buffer);
1931
1932 return 0;
1933
1934} /* uf_sme_queue_message() */
1935#endif
1936
1937/*
1938 ****************************************************************************
1939 *
1940 * Driver instantiation
1941 *
1942 ****************************************************************************
1943 */
1944static const struct file_operations unifi_fops = {
1945 .owner = THIS_MODULE,
1946 .open = unifi_open,
1947 .release = unifi_release,
1948 .read = unifi_read,
1949 .write = unifi_write,
1950 .unlocked_ioctl = unifi_ioctl,
1951 .poll = unifi_poll,
1952};
1953
1954static dev_t unifi_first_devno;
1955static struct class *unifi_class;
1956
1957
1958int uf_create_device_nodes(unifi_priv_t *priv, int bus_id)
1959{
1960 dev_t devno;
1961 int r;
1962
1963 cdev_init(&priv->unifi_cdev, &unifi_fops);
1964
1965 /* cdev_init() should set the cdev owner, but it does not */
1966 priv->unifi_cdev.owner = THIS_MODULE;
1967
1968 devno = MKDEV(MAJOR(unifi_first_devno),
1969 MINOR(unifi_first_devno) + (bus_id * 2));
1970 r = cdev_add(&priv->unifi_cdev, devno, 1);
1971 if (r) {
1972 return r;
1973 }
1974
1975#ifdef SDIO_EXPORTS_STRUCT_DEVICE
1976 if (!device_create(unifi_class, priv->unifi_device,
1977 devno, priv, "unifi%d", bus_id)) {
1978#else
1979 priv->unifi_device = device_create(unifi_class, NULL,
1980 devno, priv, "unifi%d", bus_id);
1981 if (priv->unifi_device == NULL) {
1982#endif /* SDIO_EXPORTS_STRUCT_DEVICE */
1983
1984 cdev_del(&priv->unifi_cdev);
1985 return -EINVAL;
1986 }
1987
1988 cdev_init(&priv->unifiudi_cdev, &unifi_fops);
1989
1990 /* cdev_init() should set the cdev owner, but it does not */
1991 priv->unifiudi_cdev.owner = THIS_MODULE;
1992
1993 devno = MKDEV(MAJOR(unifi_first_devno),
1994 MINOR(unifi_first_devno) + (bus_id * 2) + 1);
1995 r = cdev_add(&priv->unifiudi_cdev, devno, 1);
1996 if (r) {
1997 device_destroy(unifi_class, priv->unifi_cdev.dev);
1998 cdev_del(&priv->unifi_cdev);
1999 return r;
2000 }
2001
2002 if (!device_create(unifi_class,
2003#ifdef SDIO_EXPORTS_STRUCT_DEVICE
2004 priv->unifi_device,
2005#else
2006 NULL,
2007#endif /* SDIO_EXPORTS_STRUCT_DEVICE */
2008 devno, priv, "unifiudi%d", bus_id)) {
2009 device_destroy(unifi_class, priv->unifi_cdev.dev);
2010 cdev_del(&priv->unifiudi_cdev);
2011 cdev_del(&priv->unifi_cdev);
2012 return -EINVAL;
2013 }
2014
2015 return 0;
2016}
2017
2018
2019void uf_destroy_device_nodes(unifi_priv_t *priv)
2020{
2021 device_destroy(unifi_class, priv->unifiudi_cdev.dev);
2022 device_destroy(unifi_class, priv->unifi_cdev.dev);
2023 cdev_del(&priv->unifiudi_cdev);
2024 cdev_del(&priv->unifi_cdev);
2025}
2026
2027
2028
2029/*
2030 * ----------------------------------------------------------------
2031 * uf_create_debug_device
2032 *
2033 * Allocates device numbers for unifi character device nodes
2034 * and creates a unifi class in sysfs
2035 *
2036 * Arguments:
2037 * fops Pointer to the char device operations structure.
2038 *
2039 * Returns:
2040 * 0 on success, -ve error code on error.
2041 * ----------------------------------------------------------------
2042 */
2043static int
2044uf_create_debug_device(const struct file_operations *fops)
2045{
2046 int ret;
2047
2048 /* Allocate two device numbers for each device. */
2049 ret = alloc_chrdev_region(&unifi_first_devno, 0, MAX_UNIFI_DEVS*2, UNIFI_NAME);
2050 if (ret) {
2051 unifi_error(NULL, "Failed to add alloc dev numbers: %d\n", ret);
2052 return ret;
2053 }
2054
2055 /* Create a UniFi class */
2056 unifi_class = class_create(THIS_MODULE, UNIFI_NAME);
2057 if (IS_ERR(unifi_class)) {
2058 unifi_error(NULL, "Failed to create UniFi class\n");
2059
2060 /* Release device numbers */
2061 unregister_chrdev_region(unifi_first_devno, MAX_UNIFI_DEVS*2);
2062 unifi_first_devno = 0;
2063 return -EINVAL;
2064 }
2065
2066 return 0;
2067} /* uf_create_debug_device() */
2068
2069
2070/*
2071 * ----------------------------------------------------------------
2072 * uf_remove_debug_device
2073 *
2074 * Destroys the unifi class and releases the allocated
2075 * device numbers for unifi character device nodes.
2076 *
2077 * Arguments:
2078 *
2079 * Returns:
2080 * ----------------------------------------------------------------
2081 */
2082static void
2083uf_remove_debug_device(void)
2084{
2085 /* Destroy the UniFi class */
2086 class_destroy(unifi_class);
2087
2088 /* Release device numbers */
2089 unregister_chrdev_region(unifi_first_devno, MAX_UNIFI_DEVS*2);
2090 unifi_first_devno = 0;
2091
2092} /* uf_remove_debug_device() */
2093
2094
2095/*
2096 * ---------------------------------------------------------------------------
2097 *
2098 * Module loading.
2099 *
2100 * ---------------------------------------------------------------------------
2101 */
2102int __init
2103unifi_load(void)
2104{
2105 int r;
2106
2107 printk("UniFi SDIO Driver: %s %s %s\n",
2108 CSR_WIFI_VERSION,
2109 __DATE__, __TIME__);
2110
2111#ifdef CSR_SME_USERSPACE
2112#ifdef CSR_SUPPORT_WEXT
2113 printk("CSR SME with WEXT support\n");
2114#else
2115 printk("CSR SME no WEXT support\n");
2116#endif /* CSR_SUPPORT_WEXT */
2117#endif /* CSR_SME_USERSPACE */
2118
2119#ifdef CSR_NATIVE_LINUX
2120#ifdef CSR_SUPPORT_WEXT
2121#error WEXT unsupported in the native driver
2122#endif
2123 printk("CSR native no WEXT support\n");
2124#endif
2125#ifdef CSR_WIFI_SPLIT_PATCH
2126 printk("Split patch support\n");
2127#endif
2128 printk("Kernel %d.%d.%d\n",
2129 ((LINUX_VERSION_CODE) >> 16) & 0xff,
2130 ((LINUX_VERSION_CODE) >> 8) & 0xff,
2131 (LINUX_VERSION_CODE) & 0xff);
2132 /*
2133 * Instantiate the /dev/unifi* device nodes.
2134 * We must do this before registering with the SDIO driver because it
2135 * will immediately call the "insert" callback if the card is
2136 * already present.
2137 */
2138 r = uf_create_debug_device(&unifi_fops);
2139 if (r) {
2140 return r;
2141 }
2142
2143 /* Now register with the SDIO driver */
2144 r = uf_sdio_load();
2145 if (r) {
2146 uf_remove_debug_device();
2147 return r;
2148 }
2149
2150 if (sdio_block_size > -1) {
2151 unifi_info(NULL, "sdio_block_size %d\n", sdio_block_size);
2152 }
2153
2154 if (sdio_byte_mode) {
2155 unifi_info(NULL, "sdio_byte_mode\n");
2156 }
2157
2158 if (disable_power_control) {
2159 unifi_info(NULL, "disable_power_control\n");
2160 }
2161
2162 if (disable_hw_reset) {
2163 unifi_info(NULL, "disable_hw_reset\n");
2164 }
2165
2166 if (enable_wol) {
2167 unifi_info(NULL, "enable_wol %d\n", enable_wol);
2168 }
2169
2170 if (run_bh_once != -1) {
2171 unifi_info(NULL, "run_bh_once %d\n", run_bh_once);
2172 }
2173
2174 return 0;
2175} /* unifi_load() */
2176
2177
2178void __exit
2179unifi_unload(void)
2180{
2181 /* The SDIO remove hook will call unifi_disconnect(). */
2182 uf_sdio_unload();
2183
2184 uf_remove_debug_device();
2185
2186} /* unifi_unload() */
2187
2188module_init(unifi_load);
2189module_exit(unifi_unload);
2190
2191MODULE_DESCRIPTION("UniFi Device driver");
2192MODULE_AUTHOR("Cambridge Silicon Radio Ltd.");
2193MODULE_LICENSE("GPL and additional rights");
diff --git a/drivers/staging/csr/firmware.c b/drivers/staging/csr/firmware.c
deleted file mode 100644
index b42a4d6a0c36..000000000000
--- a/drivers/staging/csr/firmware.c
+++ /dev/null
@@ -1,396 +0,0 @@
1/*
2 * ---------------------------------------------------------------------------
3 * FILE: firmware.c
4 *
5 * PURPOSE:
6 * Implements the f/w related HIP core lib API.
7 * It is part of the porting exercise in Linux.
8 *
9 * Also, it contains example code for reading the loader and f/w files
10 * from the userspace and starting the SME in Linux.
11 *
12 * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd.
13 *
14 * Refer to LICENSE.txt included with this source code for details on
15 * the license terms.
16 *
17 * ---------------------------------------------------------------------------
18 */
19#include <linux/kmod.h>
20#include <linux/vmalloc.h>
21#include <linux/firmware.h>
22#include <asm/uaccess.h>
23#include "csr_wifi_hip_unifi.h"
24#include "csr_wifi_hip_unifi_udi.h"
25#include "unifiio.h"
26#include "unifi_priv.h"
27
28/*
29 * ---------------------------------------------------------------------------
30 *
31 * F/W download. Part of the HIP core API
32 *
33 * ---------------------------------------------------------------------------
34 */
35
36
37/*
38 * ---------------------------------------------------------------------------
39 * unifi_fw_read_start
40 *
41 * Returns a structure to be passed in unifi_fw_read().
42 * This structure is an OS specific description of the f/w file.
43 * In the linux implementation it is a buffer with the f/w and its' length.
44 * The HIP driver calls this functions to request for the loader or
45 * the firmware file.
46 * The structure pointer can be freed when unifi_fw_read_stop() is called.
47 *
48 * Arguments:
49 * ospriv Pointer to driver context.
50 * is_fw Type of firmware to retrieve
51 * info Versions information. Can be used to determine
52 * the appropriate f/w file to load.
53 *
54 * Returns:
55 * O on success, non-zero otherwise.
56 *
57 * ---------------------------------------------------------------------------
58 */
59void*
60unifi_fw_read_start(void *ospriv, s8 is_fw, const card_info_t *info)
61{
62 unifi_priv_t *priv = (unifi_priv_t*)ospriv;
63 CSR_UNUSED(info);
64
65 if (is_fw == UNIFI_FW_STA) {
66 /* F/w may have been released after a previous successful download. */
67 if (priv->fw_sta.dl_data == NULL) {
68 unifi_trace(priv, UDBG2, "Attempt reload of sta f/w\n");
69 uf_request_firmware_files(priv, UNIFI_FW_STA);
70 }
71 /* Set up callback struct for readfunc() */
72 if (priv->fw_sta.dl_data != NULL) {
73 return &priv->fw_sta;
74 }
75
76 } else {
77 unifi_error(priv, "downloading firmware... unknown request: %d\n", is_fw);
78 }
79
80 return NULL;
81} /* unifi_fw_read_start() */
82
83
84
85/*
86 * ---------------------------------------------------------------------------
87 * unifi_fw_read_stop
88 *
89 * Called when the HIP driver has finished using the loader or
90 * the firmware file.
91 * The firmware buffer may be released now.
92 *
93 * Arguments:
94 * ospriv Pointer to driver context.
95 * dlpriv The pointer returned by unifi_fw_read_start()
96 *
97 * ---------------------------------------------------------------------------
98 */
99void
100unifi_fw_read_stop(void *ospriv, void *dlpriv)
101{
102 unifi_priv_t *priv = (unifi_priv_t*)ospriv;
103 struct dlpriv *dl_struct = (struct dlpriv *)dlpriv;
104
105 if (dl_struct != NULL) {
106 if (dl_struct->dl_data != NULL) {
107 unifi_trace(priv, UDBG2, "Release f/w buffer %p, %d bytes\n",
108 dl_struct->dl_data, dl_struct->dl_len);
109 }
110 uf_release_firmware(priv, dl_struct);
111 }
112
113} /* unifi_fw_read_stop() */
114
115
116/*
117 * ---------------------------------------------------------------------------
118 * unifi_fw_open_buffer
119 *
120 * Returns a handle for a buffer dynamically allocated by the driver,
121 * e.g. into which a firmware file may have been converted from another format
122 * which is the case with some production test images.
123 *
124 * The handle may then be used by unifi_fw_read() to access the contents of
125 * the buffer.
126 *
127 * Arguments:
128 * ospriv Pointer to driver context.
129 * fwbuf Buffer containing firmware image
130 * len Length of buffer in bytes
131 *
132 * Returns
133 * Handle for buffer, or NULL on error
134 * ---------------------------------------------------------------------------
135 */
136void *
137unifi_fw_open_buffer(void *ospriv, void *fwbuf, u32 len)
138{
139 unifi_priv_t *priv = (unifi_priv_t*)ospriv;
140
141 if (fwbuf == NULL) {
142 return NULL;
143 }
144 priv->fw_conv.dl_data = fwbuf;
145 priv->fw_conv.dl_len = len;
146 priv->fw_conv.fw_desc = NULL; /* No OS f/w resource is associated */
147
148 return &priv->fw_conv;
149}
150
151/*
152 * ---------------------------------------------------------------------------
153 * unifi_fw_close_buffer
154 *
155 * Releases any handle for a buffer dynamically allocated by the driver,
156 * e.g. into which a firmware file may have been converted from another format
157 * which is the case with some production test images.
158 *
159 *
160 * Arguments:
161 * ospriv Pointer to driver context.
162 * fwbuf Buffer containing firmware image
163 *
164 * Returns
165 * Handle for buffer, or NULL on error
166 * ---------------------------------------------------------------------------
167 */
168void unifi_fw_close_buffer(void *ospriv, void *fwbuf)
169{
170}
171
172/*
173 * ---------------------------------------------------------------------------
174 * unifi_fw_read
175 *
176 * The HIP driver calls this function to ask for a part of the loader or
177 * the firmware file.
178 *
179 * Arguments:
180 * ospriv Pointer to driver context.
181 * arg The pointer returned by unifi_fw_read_start().
182 * offset The offset in the file to return from.
183 * buf A buffer to store the requested data.
184 * len The size of the buf and the size of the requested data.
185 *
186 * Returns
187 * The number of bytes read from the firmware image, or -ve on error
188 * ---------------------------------------------------------------------------
189 */
190s32
191unifi_fw_read(void *ospriv, void *arg, u32 offset, void *buf, u32 len)
192{
193 const struct dlpriv *dlpriv = arg;
194
195 if (offset >= dlpriv->dl_len) {
196 /* at end of file */
197 return 0;
198 }
199
200 if ((offset + len) > dlpriv->dl_len) {
201 /* attempt to read past end of file */
202 return -1;
203 }
204
205 memcpy(buf, dlpriv->dl_data+offset, len);
206
207 return len;
208
209} /* unifi_fw_read() */
210
211
212
213
214#define UNIFIHELPER_INIT_MODE_SMEUSER 2
215#define UNIFIHELPER_INIT_MODE_NATIVE 1
216
217/*
218 * ---------------------------------------------------------------------------
219 * uf_run_unifihelper
220 *
221 * Ask userspace to send us firmware for download by running
222 * '/usr/sbin/unififw'.
223 * The same script starts the SME userspace application.
224 * Derived from net_run_sbin_hotplug().
225 *
226 * Arguments:
227 * priv Pointer to OS private struct.
228 *
229 * Returns:
230 * None.
231 * ---------------------------------------------------------------------------
232 */
233int
234uf_run_unifihelper(unifi_priv_t *priv)
235{
236#ifdef ANDROID_BUILD
237 char *prog = "/system/bin/unififw";
238#else
239 char *prog = "/usr/sbin/unififw";
240#endif /* ANDROID_BUILD */
241
242 char *argv[6], *envp[4];
243 char inst_str[8];
244 char init_mode[8];
245 int i, r;
246
247#if (defined CSR_SME_USERSPACE) && (!defined CSR_SUPPORT_WEXT)
248 unifi_trace(priv, UDBG1, "SME userspace build: run unifi_helper manually\n");
249 return 0;
250#endif
251
252 unifi_trace(priv, UDBG1, "starting %s\n", prog);
253
254 snprintf(inst_str, 8, "%d", priv->instance);
255#if (defined CSR_SME_USERSPACE)
256 snprintf(init_mode, 8, "%d", UNIFIHELPER_INIT_MODE_SMEUSER);
257#else
258 snprintf(init_mode, 8, "%d", UNIFIHELPER_INIT_MODE_NATIVE);
259#endif /* CSR_SME_USERSPACE */
260
261 i = 0;
262 argv[i++] = prog;
263 argv[i++] = inst_str;
264 argv[i++] = init_mode;
265 argv[i++] = 0;
266 argv[i] = 0;
267 /* Don't add more args without making argv bigger */
268
269 /* minimal command environment */
270 i = 0;
271 envp[i++] = "HOME=/";
272 envp[i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
273 envp[i] = 0;
274 /* Don't add more without making envp bigger */
275
276 unifi_trace(priv, UDBG2, "running %s %s %s\n", argv[0], argv[1], argv[2]);
277
278 r = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC);
279
280 return r;
281} /* uf_run_unifihelper() */
282
283#ifdef CSR_WIFI_SPLIT_PATCH
284static u8 is_ap_mode(unifi_priv_t *priv)
285{
286 if (priv == NULL || priv->interfacePriv[0] == NULL)
287 {
288 return FALSE;
289 }
290
291 /* Test for mode requiring AP patch */
292 return(CSR_WIFI_HIP_IS_AP_FW(priv->interfacePriv[0]->interfaceMode));
293}
294#endif
295
296/*
297 * ---------------------------------------------------------------------------
298 * uf_request_firmware_files
299 *
300 * Get the firmware files from userspace.
301 *
302 * Arguments:
303 * priv Pointer to OS private struct.
304 * is_fw type of firmware to load (UNIFI_FW_STA/LOADER)
305 *
306 * Returns:
307 * None.
308 * ---------------------------------------------------------------------------
309 */
310int uf_request_firmware_files(unifi_priv_t *priv, int is_fw)
311{
312 /* uses the default method to get the firmware */
313 const struct firmware *fw_entry;
314 int postfix;
315#define UNIFI_MAX_FW_PATH_LEN 32
316 char fw_name[UNIFI_MAX_FW_PATH_LEN];
317 int r;
318
319#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT)
320 if (priv->mib_data.length) {
321 vfree(priv->mib_data.data);
322 priv->mib_data.data = NULL;
323 priv->mib_data.length = 0;
324 }
325#endif /* CSR_SUPPORT_SME && CSR_SUPPORT_WEXT*/
326
327 postfix = priv->instance;
328
329 if (is_fw == UNIFI_FW_STA) {
330 /* Free kernel buffer and reload */
331 uf_release_firmware(priv, &priv->fw_sta);
332#ifdef CSR_WIFI_SPLIT_PATCH
333 scnprintf(fw_name, UNIFI_MAX_FW_PATH_LEN, "unifi-sdio-%d/%s",
334 postfix, (is_ap_mode(priv) ? "ap.xbv" : "staonly.xbv") );
335#else
336 scnprintf(fw_name, UNIFI_MAX_FW_PATH_LEN, "unifi-sdio-%d/%s",
337 postfix, "sta.xbv" );
338#endif
339 r = request_firmware(&fw_entry, fw_name, priv->unifi_device);
340 if (r == 0) {
341 priv->fw_sta.dl_data = fw_entry->data;
342 priv->fw_sta.dl_len = fw_entry->size;
343 priv->fw_sta.fw_desc = (void *)fw_entry;
344 } else {
345 unifi_trace(priv, UDBG2, "Firmware file not available\n");
346 }
347 }
348
349 return 0;
350
351} /* uf_request_firmware_files() */
352
353/*
354 * ---------------------------------------------------------------------------
355 * uf_release_firmware_files
356 *
357 * Release all buffers used to store firmware files
358 *
359 * Arguments:
360 * priv Pointer to OS private struct.
361 *
362 * Returns:
363 * None.
364 * ---------------------------------------------------------------------------
365 */
366int uf_release_firmware_files(unifi_priv_t *priv)
367{
368 uf_release_firmware(priv, &priv->fw_sta);
369
370 return 0;
371}
372
373/*
374 * ---------------------------------------------------------------------------
375 * uf_release_firmware
376 *
377 * Release specific buffer used to store firmware
378 *
379 * Arguments:
380 * priv Pointer to OS private struct.
381 * to_free Pointer to specific buffer to release
382 *
383 * Returns:
384 * None.
385 * ---------------------------------------------------------------------------
386 */
387int uf_release_firmware(unifi_priv_t *priv, struct dlpriv *to_free)
388{
389 if (to_free != NULL) {
390 release_firmware((const struct firmware *)to_free->fw_desc);
391 to_free->fw_desc = NULL;
392 to_free->dl_data = NULL;
393 to_free->dl_len = 0;
394 }
395 return 0;
396}
diff --git a/drivers/staging/csr/inet.c b/drivers/staging/csr/inet.c
deleted file mode 100644
index b3ef818fef35..000000000000
--- a/drivers/staging/csr/inet.c
+++ /dev/null
@@ -1,104 +0,0 @@
1/*
2 * ---------------------------------------------------------------------------
3 * FILE: inet.c
4 *
5 * PURPOSE:
6 * Routines related to IP address changes.
7 * Optional part of the porting exercise. It uses system network
8 * handlers to obtain the UniFi IP address and pass it to the SME
9 * using the unifi_sys_ip_configured_ind().
10 *
11 * Copyright (C) 2008-2009 Cambridge Silicon Radio Ltd.
12 *
13 * Refer to LICENSE.txt included with this source code for details on
14 * the license terms.
15 *
16 * ---------------------------------------------------------------------------
17 */
18#include <linux/inetdevice.h>
19#include <linux/notifier.h>
20
21#include "unifi_priv.h"
22#include "csr_wifi_hip_conversions.h"
23
24/*
25 * The inet notifier is global and not per-netdev. To avoid having a
26 * notifier registered when there are no unifi devices present, it's
27 * registered after the first unifi network device is registered, and
28 * unregistered when the last unifi network device is unregistered.
29 */
30
31static atomic_t inet_notif_refs = ATOMIC_INIT(0);
32
33static int uf_inetaddr_event(struct notifier_block *notif, unsigned long event, void *ifa)
34{
35 struct net_device *ndev;
36 unifi_priv_t *priv;
37 struct in_ifaddr *if_addr;
38 netInterface_priv_t *InterfacePriv = (netInterface_priv_t *)NULL;
39
40 if (!ifa || !((struct in_ifaddr *)ifa)->ifa_dev) {
41 unifi_trace(NULL, UDBG1, "uf_inetaddr_event (%lu) ifa=%p\n", event, ifa);
42 return NOTIFY_DONE;
43 }
44
45 ndev = ((struct in_ifaddr *)ifa)->ifa_dev->dev;
46 InterfacePriv = (netInterface_priv_t*) netdev_priv(ndev);
47
48 /* As the notifier is global, the call may be for a non-UniFi netdev.
49 * Therefore check the netdev_priv to make sure it's a known UniFi one.
50 */
51 if (uf_find_netdev_priv(InterfacePriv) == -1) {
52 unifi_trace(NULL, UDBG1, "uf_inetaddr_event (%lu) ndev=%p, other netdev_priv=%p\n",
53 event, ndev, InterfacePriv);
54 return NOTIFY_DONE;
55 }
56
57 if (!InterfacePriv->privPtr) {
58 unifi_error(NULL, "uf_inetaddr_event null priv (%lu) ndev=%p, InterfacePriv=%p\n",
59 event, ndev, InterfacePriv);
60 return NOTIFY_DONE;
61 }
62
63 priv = InterfacePriv->privPtr;
64 if_addr = (struct in_ifaddr *)ifa;
65
66 /* If this event is for a UniFi device, notify the SME that an IP
67 * address has been added or removed. */
68 if (uf_find_priv(priv) != -1) {
69 switch (event) {
70 case NETDEV_UP:
71 unifi_info(priv, "IP address assigned for %s\n", priv->netdev[InterfacePriv->InterfaceTag]->name);
72 priv->sta_ip_address = if_addr->ifa_address;
73#ifdef CSR_SUPPORT_WEXT
74 sme_mgt_packet_filter_set(priv);
75#endif
76 break;
77 case NETDEV_DOWN:
78 unifi_info(priv, "IP address removed for %s\n", priv->netdev[InterfacePriv->InterfaceTag]->name);
79 priv->sta_ip_address = 0xFFFFFFFF;
80#ifdef CSR_SUPPORT_WEXT
81 sme_mgt_packet_filter_set(priv);
82#endif
83 break;
84 }
85 }
86
87 return NOTIFY_DONE;
88}
89
90static struct notifier_block uf_inetaddr_notifier = {
91 .notifier_call = uf_inetaddr_event,
92};
93
94void uf_register_inet_notifier(void)
95{
96 if (atomic_inc_return(&inet_notif_refs) == 1)
97 register_inetaddr_notifier(&uf_inetaddr_notifier);
98}
99
100void uf_unregister_inet_notifier(void)
101{
102 if (atomic_dec_return(&inet_notif_refs) == 0)
103 unregister_inetaddr_notifier(&uf_inetaddr_notifier);
104}
diff --git a/drivers/staging/csr/init_hw.c b/drivers/staging/csr/init_hw.c
deleted file mode 100644
index 3b8a4babf9a6..000000000000
--- a/drivers/staging/csr/init_hw.c
+++ /dev/null
@@ -1,108 +0,0 @@
1/*
2 * ---------------------------------------------------------------------------
3 * FILE: init_hw.c
4 *
5 * PURPOSE:
6 * Use the HIP core lib to initialise the UniFi chip.
7 * It is part of the porting exercise in Linux.
8 *
9 * Copyright (C) 2009 by Cambridge Silicon Radio Ltd.
10 *
11 * Refer to LICENSE.txt included with this source code for details on
12 * the license terms.
13 *
14 * ---------------------------------------------------------------------------
15 */
16#include "csr_wifi_hip_unifi.h"
17#include "unifi_priv.h"
18
19
20#define MAX_INIT_ATTEMPTS 4
21
22extern int led_mask;
23
24
25/*
26 * ---------------------------------------------------------------------------
27 * uf_init_hw
28 *
29 * Resets hardware, downloads and initialises f/w.
30 * This function demonstrates how to use the HIP core lib API
31 * to implement the SME unifi_sys_wifi_on_req() part of the SYS API.
32 *
33 * In a simple implementation, all this function needs to do is call
34 * unifi_init_card() and then unifi_card_info().
35 * In the Linux implementation, it will retry to initialise UniFi or
36 * try to debug the reasons if unifi_init_card() returns an error.
37 *
38 * Arguments:
39 * ospriv Pointer to OS driver structure for the device.
40 *
41 * Returns:
42 * O on success, non-zero otherwise.
43 *
44 * ---------------------------------------------------------------------------
45 */
46int
47uf_init_hw(unifi_priv_t *priv)
48{
49 int attempts = 0;
50 int priv_instance;
51 CsrResult csrResult = CSR_RESULT_FAILURE;
52
53 priv_instance = uf_find_priv(priv);
54 if (priv_instance == -1) {
55 unifi_warning(priv, "uf_init_hw: Unknown priv instance, will use fw_init[0]\n");
56 priv_instance = 0;
57 }
58
59 while (1) {
60 if (attempts > MAX_INIT_ATTEMPTS) {
61 unifi_error(priv, "Failed to initialise UniFi after %d attempts, "
62 "giving up.\n",
63 attempts);
64 break;
65 }
66 attempts++;
67
68 unifi_info(priv, "Initialising UniFi, attempt %d\n", attempts);
69
70 if (fw_init[priv_instance] > 0) {
71 unifi_notice(priv, "f/w init prevented by module parameter\n");
72 break;
73 } else if (fw_init[priv_instance] == 0) {
74 fw_init[priv_instance] ++;
75 }
76
77 /*
78 * Initialise driver core. This will perform a reset of UniFi
79 * internals, but not the SDIO CCCR.
80 */
81 CsrSdioClaim(priv->sdio);
82 csrResult = unifi_init_card(priv->card, led_mask);
83 CsrSdioRelease(priv->sdio);
84
85 if (csrResult == CSR_WIFI_HIP_RESULT_NO_DEVICE) {
86 return CsrHipResultToStatus(csrResult);
87 }
88 if (csrResult == CSR_WIFI_HIP_RESULT_NOT_FOUND) {
89 unifi_error(priv, "Firmware file required, but not found.\n");
90 return CsrHipResultToStatus(csrResult);
91 }
92 if (csrResult != CSR_RESULT_SUCCESS) {
93 /* failed. Reset h/w and try again */
94 unifi_error(priv, "Failed to initialise UniFi chip.\n");
95 continue;
96 }
97
98 /* Get the version information from the lib_hip */
99 unifi_card_info(priv->card, &priv->card_info);
100
101 return CsrHipResultToStatus(csrResult);
102 }
103
104 return CsrHipResultToStatus(csrResult);
105
106} /* uf_init_hw */
107
108
diff --git a/drivers/staging/csr/io.c b/drivers/staging/csr/io.c
deleted file mode 100644
index f903022b4079..000000000000
--- a/drivers/staging/csr/io.c
+++ /dev/null
@@ -1,1098 +0,0 @@
1/*
2 * ---------------------------------------------------------------------------
3 * FILE: io.c
4 *
5 * PURPOSE:
6 * This file contains routines that the SDIO driver can call when a
7 * UniFi card is first inserted (or detected) and removed.
8 *
9 * When used with sdioemb, the udev scripts (at least on Ubuntu) don't
10 * recognise a UniFi being added to the system. This is because sdioemb
11 * does not register itself as a device_driver, it uses it's own code
12 * to handle insert and remove.
13 * To have Ubuntu recognise UniFi, edit /etc/udev/rules.d/85-ifupdown.rules
14 * to change this line:
15 * SUBSYSTEM=="net", DRIVERS=="?*", GOTO="net_start"
16 * to these:
17 * #SUBSYSTEM=="net", DRIVERS=="?*", GOTO="net_start"
18 * SUBSYSTEM=="net", GOTO="net_start"
19 *
20 * Then you can add a stanza to /etc/network/interfaces like this:
21 * auto eth1
22 * iface eth1 inet dhcp
23 * wpa-conf /etc/wpa_supplicant.conf
24 * This will then automatically associate when a car dis inserted.
25 *
26 * Copyright (C) 2006-2009 by Cambridge Silicon Radio Ltd.
27 *
28 * Refer to LICENSE.txt included with this source code for details on
29 * the license terms.
30 *
31 * ---------------------------------------------------------------------------
32 */
33#include <linux/proc_fs.h>
34#include <linux/seq_file.h>
35
36#include "csr_wifi_hip_unifi.h"
37#include "csr_wifi_hip_unifiversion.h"
38#include "csr_wifi_hip_unifi_udi.h" /* for unifi_print_status() */
39#include "unifiio.h"
40#include "unifi_priv.h"
41
42/*
43 * Array of pointers to context structs for unifi devices that are present.
44 * The index in the array corresponds to the wlan interface number
45 * (if "wlan*" is used). If "eth*" is used, the eth* numbers are allocated
46 * after any Ethernet cards.
47 *
48 * The Arasan PCI-SDIO controller card supported by this driver has 2 slots,
49 * hence a max of 2 devices.
50 */
51static unifi_priv_t *Unifi_instances[MAX_UNIFI_DEVS];
52
53/* Array of pointers to netdev objects used by the UniFi driver, as there
54 * are now many per instance. This is used to determine which netdev events
55 * are for UniFi as opposed to other net interfaces.
56 */
57static netInterface_priv_t *Unifi_netdev_instances[MAX_UNIFI_DEVS * CSR_WIFI_NUM_INTERFACES];
58
59/*
60 * Array to hold the status of each unifi device in each slot.
61 * We only process an insert event when In_use[] for the slot is
62 * UNIFI_DEV_NOT_IN_USE. Otherwise, it means that the slot is in use or
63 * we are in the middle of a cleanup (the action on unplug).
64 */
65#define UNIFI_DEV_NOT_IN_USE 0
66#define UNIFI_DEV_IN_USE 1
67#define UNIFI_DEV_CLEANUP 2
68static int In_use[MAX_UNIFI_DEVS];
69/*
70 * Mutex to prevent UDI clients to open the character device before the priv
71 * is created and initialised.
72 */
73DEFINE_SEMAPHORE(Unifi_instance_mutex);
74/*
75 * When the device is removed, unregister waits on Unifi_cleanup_wq
76 * until all the UDI clients release the character device.
77 */
78DECLARE_WAIT_QUEUE_HEAD(Unifi_cleanup_wq);
79
80#ifdef CONFIG_PROC_FS
81/*
82 * seq_file wrappers for procfile show routines.
83 */
84static int uf_proc_show(struct seq_file *m, void *v);
85
86#define UNIFI_DEBUG_TXT_BUFFER (8 * 1024)
87
88static int uf_proc_open(struct inode *inode, struct file *file)
89{
90 return single_open_size(file, uf_proc_show, PDE_DATA(inode),
91 UNIFI_DEBUG_TXT_BUFFER);
92}
93
94static const struct file_operations uf_proc_fops = {
95 .open = uf_proc_open,
96 .read = seq_read,
97 .llseek = seq_lseek,
98 .release = single_release,
99};
100
101#endif /* CONFIG_PROC_FS */
102
103#ifdef CSR_WIFI_RX_PATH_SPLIT
104
105static CsrResult signal_buffer_init(unifi_priv_t * priv, int size)
106{
107 int i;
108
109 priv->rxSignalBuffer.writePointer =
110 priv->rxSignalBuffer.readPointer = 0;
111 priv->rxSignalBuffer.size = size;
112 /* Allocating Memory for Signal primitive pointer */
113 for(i=0; i<size; i++)
114 {
115 priv->rxSignalBuffer.rx_buff[i].sig_len=0;
116 priv->rxSignalBuffer.rx_buff[i].bufptr = kmalloc(UNIFI_PACKED_SIGBUF_SIZE, GFP_KERNEL);
117 if (priv->rxSignalBuffer.rx_buff[i].bufptr == NULL)
118 {
119 int j;
120 unifi_error(priv, "signal_buffer_init:Failed to Allocate shared memory for T-H signals \n");
121 for(j=0;j<i;j++)
122 {
123 priv->rxSignalBuffer.rx_buff[j].sig_len=0;
124 kfree(priv->rxSignalBuffer.rx_buff[j].bufptr);
125 priv->rxSignalBuffer.rx_buff[j].bufptr = NULL;
126 }
127 return -1;
128 }
129 }
130 return 0;
131}
132
133
134static void signal_buffer_free(unifi_priv_t * priv, int size)
135{
136 int i;
137
138 for(i=0; i<size; i++)
139 {
140 priv->rxSignalBuffer.rx_buff[i].sig_len=0;
141 kfree(priv->rxSignalBuffer.rx_buff[i].bufptr);
142 priv->rxSignalBuffer.rx_buff[i].bufptr = NULL;
143 }
144}
145#endif
146/*
147 * ---------------------------------------------------------------------------
148 * uf_register_netdev
149 *
150 * Registers the network interface, installes the qdisc,
151 * and registers the inet handler.
152 * In the porting exercise, register the driver to the network
153 * stack if necessary.
154 *
155 * Arguments:
156 * priv Pointer to driver context.
157 *
158 * Returns:
159 * O on success, non-zero otherwise.
160 *
161 * Notes:
162 * We will only unregister when the card is ejected, so we must
163 * only do it once.
164 * ---------------------------------------------------------------------------
165 */
166int
167uf_register_netdev(unifi_priv_t *priv, int interfaceTag)
168{
169 int r;
170 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
171
172 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
173 unifi_error(priv, "uf_register_netdev bad interfaceTag\n");
174 return -EINVAL;
175 }
176
177 /*
178 * Allocates a device number and registers device with the network
179 * stack.
180 */
181 unifi_trace(priv, UDBG5, "uf_register_netdev: netdev %d - 0x%p\n",
182 interfaceTag, priv->netdev[interfaceTag]);
183 r = register_netdev(priv->netdev[interfaceTag]);
184 if (r) {
185 unifi_error(priv, "Failed to register net device\n");
186 return -EINVAL;
187 }
188
189 /* The device is registed */
190 interfacePriv->netdev_registered = 1;
191
192#ifdef CSR_SUPPORT_SME
193 /*
194 * Register the inet handler; it notifies us for changes in the IP address.
195 */
196 uf_register_inet_notifier();
197#endif /* CSR_SUPPORT_SME */
198
199 unifi_notice(priv, "unifi%d is %s\n",
200 priv->instance, priv->netdev[interfaceTag]->name);
201
202 return 0;
203} /* uf_register_netdev */
204
205
206/*
207 * ---------------------------------------------------------------------------
208 * uf_unregister_netdev
209 *
210 * Unregisters the network interface and the inet handler.
211 *
212 * Arguments:
213 * priv Pointer to driver context.
214 *
215 * Returns:
216 * None.
217 *
218 * ---------------------------------------------------------------------------
219 */
220void
221uf_unregister_netdev(unifi_priv_t *priv)
222{
223 int i=0;
224
225#ifdef CSR_SUPPORT_SME
226 /* Unregister the inet handler... */
227 uf_unregister_inet_notifier();
228#endif /* CSR_SUPPORT_SME */
229
230 for (i=0; i<CSR_WIFI_NUM_INTERFACES; i++) {
231 netInterface_priv_t *interfacePriv = priv->interfacePriv[i];
232 if (interfacePriv->netdev_registered) {
233 unifi_trace(priv, UDBG5,
234 "uf_unregister_netdev: netdev %d - 0x%p\n",
235 i, priv->netdev[i]);
236
237 /* ... and the netdev */
238 unregister_netdev(priv->netdev[i]);
239 interfacePriv->netdev_registered = 0;
240 }
241
242 interfacePriv->interfaceMode = 0;
243
244 /* Enable all queues by default */
245 interfacePriv->queueEnabled[0] = 1;
246 interfacePriv->queueEnabled[1] = 1;
247 interfacePriv->queueEnabled[2] = 1;
248 interfacePriv->queueEnabled[3] = 1;
249 }
250
251 priv->totalInterfaceCount = 0;
252} /* uf_unregister_netdev() */
253
254
255/*
256 * ---------------------------------------------------------------------------
257 * register_unifi_sdio
258 *
259 * This function is called from the Probe (or equivalent) method of
260 * the SDIO driver when a UniFi card is detected.
261 * We allocate the Linux net_device struct, initialise the HIP core
262 * lib, create the char device nodes and start the userspace helper
263 * to initialise the device.
264 *
265 * Arguments:
266 * sdio_dev Pointer to SDIO context handle to use for all
267 * SDIO ops.
268 * bus_id A small number indicating the SDIO card position on the
269 * bus. Typically this is the slot number, e.g. 0, 1 etc.
270 * Valid values are 0 to MAX_UNIFI_DEVS-1.
271 * dev Pointer to kernel device manager struct.
272 *
273 * Returns:
274 * Pointer to the unifi instance, or NULL on error.
275 * ---------------------------------------------------------------------------
276 */
277static unifi_priv_t *
278register_unifi_sdio(CsrSdioFunction *sdio_dev, int bus_id, struct device *dev)
279{
280 unifi_priv_t *priv = NULL;
281 int r = -1;
282 CsrResult csrResult;
283
284 if ((bus_id < 0) || (bus_id >= MAX_UNIFI_DEVS)) {
285 unifi_error(priv, "register_unifi_sdio: invalid device %d\n",
286 bus_id);
287 return NULL;
288 }
289
290 down(&Unifi_instance_mutex);
291
292 if (In_use[bus_id] != UNIFI_DEV_NOT_IN_USE) {
293 unifi_error(priv, "register_unifi_sdio: device %d is already in use\n",
294 bus_id);
295 goto failed0;
296 }
297
298
299 /* Allocate device private and net_device structs */
300 priv = uf_alloc_netdevice(sdio_dev, bus_id);
301 if (priv == NULL) {
302 unifi_error(priv, "Failed to allocate driver private\n");
303 goto failed0;
304 }
305
306 priv->unifi_device = dev;
307
308 SET_NETDEV_DEV(priv->netdev[0], dev);
309
310 /* We are not ready to send data yet. */
311 netif_carrier_off(priv->netdev[0]);
312
313 /* Allocate driver context. */
314 priv->card = unifi_alloc_card(priv->sdio, priv);
315 if (priv->card == NULL) {
316 unifi_error(priv, "Failed to allocate UniFi driver card struct.\n");
317 goto failed1;
318 }
319
320 if (Unifi_instances[bus_id]) {
321 unifi_error(priv, "Internal error: instance for slot %d is already taken\n",
322 bus_id);
323 }
324 Unifi_instances[bus_id] = priv;
325 In_use[bus_id] = UNIFI_DEV_IN_USE;
326
327 /* Save the netdev_priv for use by the netdev event callback mechanism */
328 Unifi_netdev_instances[bus_id * CSR_WIFI_NUM_INTERFACES] = netdev_priv(priv->netdev[0]);
329
330 /* Initialise the mini-coredump capture buffers */
331 csrResult = unifi_coredump_init(priv->card, (u16)coredump_max);
332 if (csrResult != CSR_RESULT_SUCCESS) {
333 unifi_error(priv, "Couldn't allocate mini-coredump buffers\n");
334 }
335
336 /* Create the character device nodes */
337 r = uf_create_device_nodes(priv, bus_id);
338 if (r) {
339 goto failed1;
340 }
341
342 /*
343 * We use the slot number as unifi device index.
344 */
345 scnprintf(priv->proc_entry_name, 64, "driver/unifi%d", priv->instance);
346 /*
347 * The following complex casting is in place in order to eliminate 64-bit compilation warning
348 * "cast to/from pointer from/to integer of different size"
349 */
350 if (!proc_create_data(priv->proc_entry_name, 0, NULL,
351 &uf_proc_fops, (void *)(long)priv->instance))
352 {
353 unifi_error(priv, "unifi: can't create /proc/driver/unifi\n");
354 }
355
356 /* Allocate the net_device for interfaces other than 0. */
357 {
358 int i;
359 priv->totalInterfaceCount =0;
360
361 for(i=1;i<CSR_WIFI_NUM_INTERFACES;i++)
362 {
363 if( !uf_alloc_netdevice_for_other_interfaces(priv, i) )
364 {
365 /* error occured while allocating the net_device for interface[i]. The net_device are
366 * allocated for the interfaces with id<i. Dont worry, all the allocated net_device will
367 * be releasing chen the control goes to the label failed0.
368 */
369 unifi_error(priv, "Failed to allocate driver private for interface[%d]\n", i);
370 goto failed0;
371 }
372 else
373 {
374 SET_NETDEV_DEV(priv->netdev[i], dev);
375
376 /* We are not ready to send data yet. */
377 netif_carrier_off(priv->netdev[i]);
378
379 /* Save the netdev_priv for use by the netdev event callback mechanism */
380 Unifi_netdev_instances[bus_id * CSR_WIFI_NUM_INTERFACES + i] = netdev_priv(priv->netdev[i]);
381 }
382 }
383
384 for(i=0;i<CSR_WIFI_NUM_INTERFACES;i++)
385 {
386 netInterface_priv_t *interfacePriv = priv->interfacePriv[i];
387 interfacePriv->netdev_registered=0;
388 }
389 }
390
391#ifdef CSR_WIFI_RX_PATH_SPLIT
392 if (signal_buffer_init(priv, CSR_WIFI_RX_SIGNAL_BUFFER_SIZE))
393 {
394 unifi_error(priv, "Failed to allocate shared memory for T-H signals\n");
395 goto failed2;
396 }
397 priv->rx_workqueue = create_singlethread_workqueue("rx_workq");
398 if (priv->rx_workqueue == NULL) {
399 unifi_error(priv, "create_singlethread_workqueue failed \n");
400 goto failed3;
401 }
402 INIT_WORK(&priv->rx_work_struct, rx_wq_handler);
403#endif
404
405#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
406 if (log_hip_signals)
407 {
408 uf_register_hip_offline_debug(priv);
409 }
410#endif
411
412 /* Initialise the SME related threads and parameters */
413 r = uf_sme_init(priv);
414 if (r) {
415 unifi_error(priv, "SME initialisation failed.\n");
416 goto failed4;
417 }
418
419 /*
420 * Run the userspace helper program (unififw) to perform
421 * the device initialisation.
422 */
423 unifi_trace(priv, UDBG1, "run UniFi helper app...\n");
424 r = uf_run_unifihelper(priv);
425 if (r) {
426 unifi_notice(priv, "unable to run UniFi helper app\n");
427 /* Not a fatal error. */
428 }
429
430 up(&Unifi_instance_mutex);
431
432 return priv;
433
434failed4:
435#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
436if (log_hip_signals)
437{
438 uf_unregister_hip_offline_debug(priv);
439}
440#endif
441#ifdef CSR_WIFI_RX_PATH_SPLIT
442 flush_workqueue(priv->rx_workqueue);
443 destroy_workqueue(priv->rx_workqueue);
444failed3:
445 signal_buffer_free(priv, CSR_WIFI_RX_SIGNAL_BUFFER_SIZE);
446failed2:
447#endif
448 /* Remove the device nodes */
449 uf_destroy_device_nodes(priv);
450failed1:
451 /* Deregister priv->netdev_client */
452 ul_deregister_client(priv->netdev_client);
453
454failed0:
455 if (priv && priv->card) {
456 unifi_coredump_free(priv->card);
457 unifi_free_card(priv->card);
458 }
459 if (priv) {
460 uf_free_netdevice(priv);
461 }
462
463 up(&Unifi_instance_mutex);
464
465 return NULL;
466} /* register_unifi_sdio() */
467
468
469/*
470 * ---------------------------------------------------------------------------
471 * ask_unifi_sdio_cleanup
472 *
473 * We can not free our private context, until all the char device
474 * clients have closed the file handles. unregister_unifi_sdio() which
475 * is called when a card is removed, waits on Unifi_cleanup_wq until
476 * the reference count becomes zero. It is time to wake it up now.
477 *
478 * Arguments:
479 * priv Pointer to driver context.
480 *
481 * Returns:
482 * None.
483 * ---------------------------------------------------------------------------
484 */
485static void
486ask_unifi_sdio_cleanup(unifi_priv_t *priv)
487{
488
489 /*
490 * Now clear the flag that says the old instance is in use.
491 * This is used to prevent a new instance being started before old
492 * one has finshed closing down, for example if bounce makes the card
493 * appear to be ejected and re-inserted quickly.
494 */
495 In_use[priv->instance] = UNIFI_DEV_CLEANUP;
496
497 unifi_trace(NULL, UDBG5, "ask_unifi_sdio_cleanup: wake up cleanup workqueue.\n");
498 wake_up(&Unifi_cleanup_wq);
499
500} /* ask_unifi_sdio_cleanup() */
501
502
503/*
504 * ---------------------------------------------------------------------------
505 * cleanup_unifi_sdio
506 *
507 * Release any resources owned by a unifi instance.
508 *
509 * Arguments:
510 * priv Pointer to the instance to free.
511 *
512 * Returns:
513 * None.
514 * ---------------------------------------------------------------------------
515 */
516static void
517cleanup_unifi_sdio(unifi_priv_t *priv)
518{
519 int priv_instance;
520 int i;
521 static const CsrWifiMacAddress broadcast_address = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}};
522
523 /* Remove the device nodes */
524 uf_destroy_device_nodes(priv);
525
526 /* Mark this device as gone away by NULLing the entry in Unifi_instances */
527 Unifi_instances[priv->instance] = NULL;
528
529 unifi_trace(priv, UDBG5, "cleanup_unifi_sdio: remove_proc_entry\n");
530 /*
531 * Free the children of priv before unifi_free_netdevice() frees
532 * the priv struct
533 */
534 remove_proc_entry(priv->proc_entry_name, 0);
535
536
537 /* Unregister netdev as a client. */
538 if (priv->netdev_client) {
539 unifi_trace(priv, UDBG2, "Netdev client (id:%d s:0x%X) is unregistered\n",
540 priv->netdev_client->client_id, priv->netdev_client->sender_id);
541 ul_deregister_client(priv->netdev_client);
542 }
543
544 /* Destroy the SME related threads and parameters */
545 uf_sme_deinit(priv);
546
547#ifdef CSR_SME_USERSPACE
548 priv->smepriv = NULL;
549#endif
550
551#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
552 if (log_hip_signals)
553 {
554 uf_unregister_hip_offline_debug(priv);
555 }
556#endif
557
558 /* Free any packets left in the Rx queues */
559 for(i=0;i<CSR_WIFI_NUM_INTERFACES;i++)
560 {
561 uf_free_pending_rx_packets(priv, UF_UNCONTROLLED_PORT_Q, broadcast_address, i);
562 uf_free_pending_rx_packets(priv, UF_CONTROLLED_PORT_Q, broadcast_address, i);
563 }
564 /*
565 * We need to free the resources held by the core, which include tx skbs,
566 * otherwise we can not call unregister_netdev().
567 */
568 if (priv->card) {
569 unifi_trace(priv, UDBG5, "cleanup_unifi_sdio: free card\n");
570 unifi_coredump_free(priv->card);
571 unifi_free_card(priv->card);
572 priv->card = NULL;
573 }
574
575 /*
576 * Unregister the network device.
577 * We can not unregister the netdev before we release
578 * all pending packets in the core.
579 */
580 uf_unregister_netdev(priv);
581 priv->totalInterfaceCount = 0;
582
583 /* Clear the table of registered netdev_priv's */
584 for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) {
585 Unifi_netdev_instances[priv->instance * CSR_WIFI_NUM_INTERFACES + i] = NULL;
586 }
587
588 unifi_trace(priv, UDBG5, "cleanup_unifi_sdio: uf_free_netdevice\n");
589 /*
590 * When uf_free_netdevice() returns, the priv is invalid
591 * so we need to remember the instance to clear the global flag later.
592 */
593 priv_instance = priv->instance;
594
595#ifdef CSR_WIFI_RX_PATH_SPLIT
596 flush_workqueue(priv->rx_workqueue);
597 destroy_workqueue(priv->rx_workqueue);
598 signal_buffer_free(priv, CSR_WIFI_RX_SIGNAL_BUFFER_SIZE);
599#endif
600
601 /* Priv is freed as part of the net_device */
602 uf_free_netdevice(priv);
603
604 /*
605 * Now clear the flag that says the old instance is in use.
606 * This is used to prevent a new instance being started before old
607 * one has finshed closing down, for example if bounce makes the card
608 * appear to be ejected and re-inserted quickly.
609 */
610 In_use[priv_instance] = UNIFI_DEV_NOT_IN_USE;
611
612 unifi_trace(NULL, UDBG5, "cleanup_unifi_sdio: DONE.\n");
613
614} /* cleanup_unifi_sdio() */
615
616
617/*
618 * ---------------------------------------------------------------------------
619 * unregister_unifi_sdio
620 *
621 * Call from SDIO driver when it detects that UniFi has been removed.
622 *
623 * Arguments:
624 * bus_id Number of the card that was ejected.
625 *
626 * Returns:
627 * None.
628 * ---------------------------------------------------------------------------
629 */
630static void
631unregister_unifi_sdio(int bus_id)
632{
633 unifi_priv_t *priv;
634 int interfaceTag=0;
635 u8 reason = CONFIG_IND_EXIT;
636
637 if ((bus_id < 0) || (bus_id >= MAX_UNIFI_DEVS)) {
638 unifi_error(NULL, "unregister_unifi_sdio: invalid device %d\n",
639 bus_id);
640 return;
641 }
642
643 priv = Unifi_instances[bus_id];
644 if (priv == NULL) {
645 unifi_error(priv, "unregister_unifi_sdio: device %d is not registered\n",
646 bus_id);
647 return;
648 }
649
650 /* Stop the network traffic before freeing the core. */
651 for(interfaceTag=0;interfaceTag<priv->totalInterfaceCount;interfaceTag++)
652 {
653 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
654 if(interfacePriv->netdev_registered)
655 {
656 netif_carrier_off(priv->netdev[interfaceTag]);
657 netif_tx_stop_all_queues(priv->netdev[interfaceTag]);
658 }
659 }
660
661#ifdef CSR_NATIVE_LINUX
662 /*
663 * If the unifi thread was started, signal it to stop. This
664 * should cause any userspace processes with open unifi device to
665 * close them.
666 */
667 uf_stop_thread(priv, &priv->bh_thread);
668
669 /* Unregister the interrupt handler */
670 if (csr_sdio_linux_remove_irq(priv->sdio)) {
671 unifi_notice(priv,
672 "csr_sdio_linux_remove_irq failed to talk to card.\n");
673 }
674
675 /* Ensure no MLME functions are waiting on a the mlme_event semaphore. */
676 uf_abort_mlme(priv);
677#endif /* CSR_NATIVE_LINUX */
678
679 ul_log_config_ind(priv, &reason, sizeof(u8));
680
681 /* Deregister the UDI hook from the core. */
682 unifi_remove_udi_hook(priv->card, logging_handler);
683
684 uf_put_instance(bus_id);
685
686 /*
687 * Wait until the device is cleaned up. i.e., when all userspace
688 * processes have closed any open unifi devices.
689 */
690 wait_event(Unifi_cleanup_wq, In_use[bus_id] == UNIFI_DEV_CLEANUP);
691 unifi_trace(NULL, UDBG5, "Received clean up event\n");
692
693 /* Now we can free the private context and the char device nodes */
694 cleanup_unifi_sdio(priv);
695
696} /* unregister_unifi_sdio() */
697
698
699/*
700 * ---------------------------------------------------------------------------
701 * uf_find_instance
702 *
703 * Find the context structure for a given UniFi device instance.
704 *
705 * Arguments:
706 * inst The instance number to look for.
707 *
708 * Returns:
709 * None.
710 * ---------------------------------------------------------------------------
711 */
712unifi_priv_t *
713uf_find_instance(int inst)
714{
715 if ((inst < 0) || (inst >= MAX_UNIFI_DEVS)) {
716 return NULL;
717 }
718 return Unifi_instances[inst];
719} /* uf_find_instance() */
720
721
722/*
723 * ---------------------------------------------------------------------------
724 * uf_find_priv
725 *
726 * Find the device instance for a given context structure.
727 *
728 * Arguments:
729 * priv The context structure pointer to look for.
730 *
731 * Returns:
732 * index of instance, -1 otherwise.
733 * ---------------------------------------------------------------------------
734 */
735int
736uf_find_priv(unifi_priv_t *priv)
737{
738 int inst;
739
740 if (!priv) {
741 return -1;
742 }
743
744 for (inst = 0; inst < MAX_UNIFI_DEVS; inst++) {
745 if (Unifi_instances[inst] == priv) {
746 return inst;
747 }
748 }
749
750 return -1;
751} /* uf_find_priv() */
752
753/*
754 * ---------------------------------------------------------------------------
755 * uf_find_netdev_priv
756 *
757 * Find the device instance for a given netdev context structure.
758 *
759 * Arguments:
760 * priv The context structure pointer to look for.
761 *
762 * Returns:
763 * index of instance, -1 otherwise.
764 * ---------------------------------------------------------------------------
765 */
766int
767uf_find_netdev_priv(netInterface_priv_t *priv)
768{
769 int inst;
770
771 if (!priv) {
772 return -1;
773 }
774
775 for (inst = 0; inst < MAX_UNIFI_DEVS * CSR_WIFI_NUM_INTERFACES; inst++) {
776 if (Unifi_netdev_instances[inst] == priv) {
777 return inst;
778 }
779 }
780
781 return -1;
782} /* uf_find_netdev_priv() */
783
784/*
785 * ---------------------------------------------------------------------------
786 * uf_get_instance
787 *
788 * Find the context structure for a given UniFi device instance
789 * and increment the reference count.
790 *
791 * Arguments:
792 * inst The instance number to look for.
793 *
794 * Returns:
795 * Pointer to the instance or NULL if no instance exists.
796 * ---------------------------------------------------------------------------
797 */
798unifi_priv_t *
799uf_get_instance(int inst)
800{
801 unifi_priv_t *priv;
802
803 down(&Unifi_instance_mutex);
804
805 priv = uf_find_instance(inst);
806 if (priv) {
807 priv->ref_count++;
808 }
809
810 up(&Unifi_instance_mutex);
811
812 return priv;
813}
814
815/*
816 * ---------------------------------------------------------------------------
817 * uf_put_instance
818 *
819 * Decrement the context reference count, freeing resources and
820 * shutting down the driver when the count reaches zero.
821 *
822 * Arguments:
823 * inst The instance number to look for.
824 *
825 * Returns:
826 * Pointer to the instance or NULL if no instance exists.
827 * ---------------------------------------------------------------------------
828 */
829void
830uf_put_instance(int inst)
831{
832 unifi_priv_t *priv;
833
834 down(&Unifi_instance_mutex);
835
836 priv = uf_find_instance(inst);
837 if (priv) {
838 priv->ref_count--;
839 if (priv->ref_count == 0) {
840 ask_unifi_sdio_cleanup(priv);
841 }
842 }
843
844 up(&Unifi_instance_mutex);
845}
846
847
848/*
849 * ---------------------------------------------------------------------------
850 * uf_proc_show
851 *
852 * Read method for driver node in /proc/driver/unifi0
853 *
854 * Arguments:
855 * page
856 * start
857 * offset
858 * count
859 * eof
860 * data
861 *
862 * Returns:
863 * None.
864 * ---------------------------------------------------------------------------
865 */
866#ifdef CONFIG_PROC_FS
867static int uf_proc_show(struct seq_file *m, void *v)
868{
869 unifi_priv_t *priv;
870 int i;
871
872 /*
873 * The following complex casting is in place in order to eliminate
874 * 64-bit compilation warning "cast to/from pointer from/to integer of
875 * different size"
876 */
877 priv = uf_find_instance((long)m->private);
878 if (!priv)
879 return 0;
880
881 seq_printf(m, "UniFi SDIO Driver: %s %s %s\n",
882 CSR_WIFI_VERSION, __DATE__, __TIME__);
883#ifdef CSR_SME_USERSPACE
884 seq_puts(m, "SME: CSR userspace ");
885#ifdef CSR_SUPPORT_WEXT
886 seq_puts(m, "with WEXT support\n");
887#else
888 seq_putc(m, '\n');
889#endif /* CSR_SUPPORT_WEXT */
890#endif /* CSR_SME_USERSPACE */
891#ifdef CSR_NATIVE_LINUX
892 seq_puts(m, "SME: native\n");
893#endif
894
895#ifdef CSR_SUPPORT_SME
896 seq_printf(m, "Firmware (ROM) build:%u, Patch:%u\n",
897 priv->card_info.fw_build,
898 priv->sme_versions.firmwarePatch);
899#endif
900
901 unifi_print_status(priv->card, m);
902
903 seq_printf(m, "Last dbg str: %s\n", priv->last_debug_string);
904
905 seq_puts(m, "Last dbg16:");
906 for (i = 0; i < 8; i++)
907 seq_printf(m, " %04X", priv->last_debug_word16[i]);
908 seq_putc(m, '\n');
909 seq_puts(m, " ");
910 for (; i < 16; i++)
911 seq_printf(m, " %04X", priv->last_debug_word16[i]);
912 seq_putc(m, '\n');
913 return 0;
914}
915#endif
916
917
918
919
920static void
921uf_lx_suspend(CsrSdioFunction *sdio_ctx)
922{
923 unifi_priv_t *priv = sdio_ctx->driverData;
924 unifi_suspend(priv);
925
926 CsrSdioSuspendAcknowledge(sdio_ctx, CSR_RESULT_SUCCESS);
927}
928
929static void
930uf_lx_resume(CsrSdioFunction *sdio_ctx)
931{
932 unifi_priv_t *priv = sdio_ctx->driverData;
933 unifi_resume(priv);
934
935 CsrSdioResumeAcknowledge(sdio_ctx, CSR_RESULT_SUCCESS);
936}
937
938static int active_slot = MAX_UNIFI_DEVS;
939static struct device *os_devices[MAX_UNIFI_DEVS];
940
941void
942uf_add_os_device(int bus_id, struct device *os_device)
943{
944 if ((bus_id < 0) || (bus_id >= MAX_UNIFI_DEVS)) {
945 unifi_error(NULL, "uf_add_os_device: invalid device %d\n",
946 bus_id);
947 return;
948 }
949
950 active_slot = bus_id;
951 os_devices[bus_id] = os_device;
952} /* uf_add_os_device() */
953
954void
955uf_remove_os_device(int bus_id)
956{
957 if ((bus_id < 0) || (bus_id >= MAX_UNIFI_DEVS)) {
958 unifi_error(NULL, "uf_remove_os_device: invalid device %d\n",
959 bus_id);
960 return;
961 }
962
963 active_slot = bus_id;
964 os_devices[bus_id] = NULL;
965} /* uf_remove_os_device() */
966
967static void
968uf_sdio_inserted(CsrSdioFunction *sdio_ctx)
969{
970 unifi_priv_t *priv;
971
972 unifi_trace(NULL, UDBG5, "uf_sdio_inserted(0x%p), slot_id=%d, dev=%p\n",
973 sdio_ctx, active_slot, os_devices[active_slot]);
974
975 priv = register_unifi_sdio(sdio_ctx, active_slot, os_devices[active_slot]);
976 if (priv == NULL) {
977 CsrSdioInsertedAcknowledge(sdio_ctx, CSR_RESULT_FAILURE);
978 return;
979 }
980
981 sdio_ctx->driverData = priv;
982
983 CsrSdioInsertedAcknowledge(sdio_ctx, CSR_RESULT_SUCCESS);
984} /* uf_sdio_inserted() */
985
986
987static void
988uf_sdio_removed(CsrSdioFunction *sdio_ctx)
989{
990 unregister_unifi_sdio(active_slot);
991 CsrSdioRemovedAcknowledge(sdio_ctx);
992} /* uf_sdio_removed() */
993
994
995static void
996uf_sdio_dsr_handler(CsrSdioFunction *sdio_ctx)
997{
998 unifi_priv_t *priv = sdio_ctx->driverData;
999
1000 unifi_sdio_interrupt_handler(priv->card);
1001} /* uf_sdio_dsr_handler() */
1002
1003/*
1004 * ---------------------------------------------------------------------------
1005 * uf_sdio_int_handler
1006 *
1007 * Interrupt callback function for SDIO interrupts.
1008 * This is called in kernel context (i.e. not interrupt context).
1009 * We retrieve the unifi context pointer and call the main UniFi
1010 * interrupt handler.
1011 *
1012 * Arguments:
1013 * fdev SDIO context pointer
1014 *
1015 * Returns:
1016 * None.
1017 * ---------------------------------------------------------------------------
1018 */
1019static CsrSdioInterruptDsrCallback
1020uf_sdio_int_handler(CsrSdioFunction *sdio_ctx)
1021{
1022 return uf_sdio_dsr_handler;
1023} /* uf_sdio_int_handler() */
1024
1025
1026
1027
1028static CsrSdioFunctionId unifi_ids[] =
1029{
1030 {
1031 .manfId = SDIO_MANF_ID_CSR,
1032 .cardId = SDIO_CARD_ID_UNIFI_3,
1033 .sdioFunction = SDIO_WLAN_FUNC_ID_UNIFI_3,
1034 .sdioInterface = CSR_SDIO_ANY_SDIO_INTERFACE,
1035 },
1036 {
1037 .manfId = SDIO_MANF_ID_CSR,
1038 .cardId = SDIO_CARD_ID_UNIFI_4,
1039 .sdioFunction = SDIO_WLAN_FUNC_ID_UNIFI_4,
1040 .sdioInterface = CSR_SDIO_ANY_SDIO_INTERFACE,
1041 }
1042};
1043
1044
1045/*
1046 * Structure to register with the glue layer.
1047 */
1048static CsrSdioFunctionDriver unifi_sdioFunction_drv =
1049{
1050 .inserted = uf_sdio_inserted,
1051 .removed = uf_sdio_removed,
1052 .intr = uf_sdio_int_handler,
1053 .suspend = uf_lx_suspend,
1054 .resume = uf_lx_resume,
1055
1056 .ids = unifi_ids,
1057 .idsCount = sizeof(unifi_ids) / sizeof(unifi_ids[0])
1058};
1059
1060
1061/*
1062 * ---------------------------------------------------------------------------
1063 * uf_sdio_load
1064 * uf_sdio_unload
1065 *
1066 * These functions are called from the main module load and unload
1067 * functions. They perform the appropriate operations for the monolithic
1068 * driver.
1069 *
1070 * Arguments:
1071 * None.
1072 *
1073 * Returns:
1074 * None.
1075 * ---------------------------------------------------------------------------
1076 */
1077int __init
1078uf_sdio_load(void)
1079{
1080 CsrResult csrResult;
1081
1082 csrResult = CsrSdioFunctionDriverRegister(&unifi_sdioFunction_drv);
1083 if (csrResult != CSR_RESULT_SUCCESS) {
1084 unifi_error(NULL, "Failed to register UniFi SDIO driver: csrResult=%d\n", csrResult);
1085 return -EIO;
1086 }
1087
1088 return 0;
1089} /* uf_sdio_load() */
1090
1091
1092
1093void __exit
1094uf_sdio_unload(void)
1095{
1096 CsrSdioFunctionDriverUnregister(&unifi_sdioFunction_drv);
1097} /* uf_sdio_unload() */
1098
diff --git a/drivers/staging/csr/mlme.c b/drivers/staging/csr/mlme.c
deleted file mode 100644
index 861d6b7687c7..000000000000
--- a/drivers/staging/csr/mlme.c
+++ /dev/null
@@ -1,433 +0,0 @@
1/*
2 * ---------------------------------------------------------------------------
3 * FILE: mlme.c
4 *
5 * PURPOSE:
6 * This file provides functions to send MLME requests to the UniFi.
7 *
8 * Copyright (C) 2007-2008 by Cambridge Silicon Radio Ltd.
9 *
10 * Refer to LICENSE.txt included with this source code for details on
11 * the license terms.
12 *
13 * ---------------------------------------------------------------------------
14 */
15#include "csr_wifi_hip_unifi.h"
16#include "unifi_priv.h"
17
18/*
19 * ---------------------------------------------------------------------------
20 * unifi_mlme_wait_for_reply
21 *
22 * Wait for a reply after sending a signal.
23 *
24 * Arguments:
25 * priv Pointer to device private context struct
26 * ul_client Pointer to linux client
27 * sig_reply_id ID of the expected reply (defined in sigs.h).
28 * timeout timeout in ms
29 *
30 * Returns:
31 * 0 on success, -ve POSIX code on error.
32 *
33 * Notes:
34 * This function waits for a specific (sig_reply_id) signal from UniFi.
35 * It also match the sequence number of the received (cfm) signal, with
36 * the latest sequence number of the signal (req) we have sent.
37 * These two number match be equal.
38 * Should only be used for waiting xxx.cfm signals and only after
39 * we have sent the matching xxx.req signal to UniFi.
40 * If no response is received within the expected time (timeout), we assume
41 * that the UniFi is busy and return an error.
42 * If the wait is aborted by a kernel signal arriving, we stop waiting.
43 * If a response from UniFi is not what we expected, we discard it and
44 * wait again. This could be a response from an aborted request. If we
45 * see several bad responses we assume we have lost synchronisation with
46 * UniFi.
47 * ---------------------------------------------------------------------------
48 */
49static int
50unifi_mlme_wait_for_reply(unifi_priv_t *priv, ul_client_t *pcli, int sig_reply_id, int timeout)
51{
52 int retries = 0;
53 long r;
54 long t = timeout;
55 unsigned int sent_seq_no;
56
57 /* Convert t in ms to jiffies */
58 t = msecs_to_jiffies(t);
59
60 do {
61 /* Wait for the confirm or timeout. */
62 r = wait_event_interruptible_timeout(pcli->udi_wq,
63 (pcli->wake_up_wq_id) || (priv->io_aborted == 1),
64 t);
65 /* Check for general i/o error */
66 if (priv->io_aborted) {
67 unifi_error(priv, "MLME operation aborted\n");
68 return -EIO;
69 }
70
71 /*
72 * If r=0 the request has timed-out.
73 * If r>0 the request has completed successfully.
74 * If r=-ERESTARTSYS an event (kill signal) has interrupted the wait_event.
75 */
76 if ((r == 0) && (pcli->wake_up_wq_id == 0)) {
77 unifi_error(priv, "mlme_wait: timed-out waiting for 0x%.4X, after %lu msec.\n",
78 sig_reply_id, jiffies_to_msecs(t));
79 pcli->wake_up_wq_id = 0;
80 return -ETIMEDOUT;
81 } else if (r == -ERESTARTSYS) {
82 unifi_error(priv, "mlme_wait: waiting for 0x%.4X was aborted.\n", sig_reply_id);
83 pcli->wake_up_wq_id = 0;
84 return -EINTR;
85 } else {
86 /* Get the sequence number of the signal that we previously set. */
87 if (pcli->seq_no != 0) {
88 sent_seq_no = pcli->seq_no - 1;
89 } else {
90 sent_seq_no = 0x0F;
91 }
92
93 unifi_trace(priv, UDBG5, "Received 0x%.4X, seq: (r:%d, s:%d)\n",
94 pcli->wake_up_wq_id,
95 pcli->wake_seq_no, sent_seq_no);
96
97 /* The two sequence ids must match. */
98 if (pcli->wake_seq_no == sent_seq_no) {
99 /* and the signal ids must match. */
100 if (sig_reply_id == pcli->wake_up_wq_id) {
101 /* Found the expected signal */
102 break;
103 } else {
104 /* This should never happen ... */
105 unifi_error(priv, "mlme_wait: mismatching signal id (0x%.4X - exp 0x%.4X) (seq %d)\n",
106 pcli->wake_up_wq_id,
107 sig_reply_id,
108 pcli->wake_seq_no);
109 pcli->wake_up_wq_id = 0;
110 return -EIO;
111 }
112 }
113 /* Wait for the next signal. */
114 pcli->wake_up_wq_id = 0;
115
116 retries ++;
117 if (retries >= 3) {
118 unifi_error(priv, "mlme_wait: confirm wait retries exhausted (0x%.4X - exp 0x%.4X)\n",
119 pcli->wake_up_wq_id,
120 sig_reply_id);
121 pcli->wake_up_wq_id = 0;
122 return -EIO;
123 }
124 }
125 } while (1);
126
127 pcli->wake_up_wq_id = 0;
128
129 return 0;
130} /* unifi_mlme_wait_for_reply() */
131
132
133/*
134 * ---------------------------------------------------------------------------
135 * unifi_mlme_blocking_request
136 *
137 * Send a MLME request signal to UniFi.
138 *
139 * Arguments:
140 * priv Pointer to device private context struct
141 * pcli Pointer to context of calling process
142 * sig Pointer to the signal to send
143 * data_ptrs Pointer to the bulk data of the signal
144 * timeout The request's timeout.
145 *
146 * Returns:
147 * 0 on success, 802.11 result code on error.
148 * ---------------------------------------------------------------------------
149 */
150int
151unifi_mlme_blocking_request(unifi_priv_t *priv, ul_client_t *pcli,
152 CSR_SIGNAL *sig, bulk_data_param_t *data_ptrs,
153 int timeout)
154{
155 int r;
156
157 if (sig->SignalPrimitiveHeader.SignalId == 0) {
158 unifi_error(priv, "unifi_mlme_blocking_request: Invalid Signal Id (0x%x)\n",
159 sig->SignalPrimitiveHeader.SignalId);
160 return -EINVAL;
161 }
162
163 down(&priv->mlme_blocking_mutex);
164
165 sig->SignalPrimitiveHeader.ReceiverProcessId = 0;
166 sig->SignalPrimitiveHeader.SenderProcessId = pcli->sender_id | pcli->seq_no;
167
168 unifi_trace(priv, UDBG2, "Send client=%d, S:0x%04X, sig 0x%.4X\n",
169 pcli->client_id,
170 sig->SignalPrimitiveHeader.SenderProcessId,
171 sig->SignalPrimitiveHeader.SignalId);
172 /* Send the signal to UniFi */
173 r = ul_send_signal_unpacked(priv, sig, data_ptrs);
174 if (r) {
175 up(&priv->mlme_blocking_mutex);
176 unifi_error(priv, "Error queueing MLME REQUEST signal\n");
177 return r;
178 }
179
180 unifi_trace(priv, UDBG5, "Send 0x%.4X, seq = %d\n",
181 sig->SignalPrimitiveHeader.SignalId, pcli->seq_no);
182
183 /*
184 * Advance the sequence number of the last sent signal, only
185 * if the signal has been successfully set.
186 */
187 pcli->seq_no++;
188 if (pcli->seq_no > 0x0F) {
189 pcli->seq_no = 0;
190 }
191
192 r = unifi_mlme_wait_for_reply(priv, pcli, (sig->SignalPrimitiveHeader.SignalId + 1), timeout);
193 up(&priv->mlme_blocking_mutex);
194
195 if (r) {
196 unifi_error(priv, "Error waiting for MLME CONFIRM signal\n");
197 return r;
198 }
199
200 return 0;
201} /* unifi_mlme_blocking_request() */
202
203
204/*
205 * ---------------------------------------------------------------------------
206 * unifi_mlme_copy_reply_and_wakeup_client
207 *
208 * Copy the reply signal from UniFi to the client's structure
209 * and wake up the waiting client.
210 *
211 * Arguments:
212 * None.
213 *
214 * Returns:
215 * None.
216 * ---------------------------------------------------------------------------
217 */
218void
219unifi_mlme_copy_reply_and_wakeup_client(ul_client_t *pcli,
220 CSR_SIGNAL *signal, int signal_len,
221 const bulk_data_param_t *bulkdata)
222{
223 int i;
224
225 /* Copy the signal to the reply */
226 memcpy(pcli->reply_signal, signal, signal_len);
227
228 /* Get the sequence number of the signal that woke us up. */
229 pcli->wake_seq_no = pcli->reply_signal->SignalPrimitiveHeader.ReceiverProcessId & 0x0F;
230
231 /* Append any bulk data */
232 for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) {
233 if (bulkdata->d[i].data_length > 0) {
234 if (bulkdata->d[i].os_data_ptr) {
235 memcpy(pcli->reply_bulkdata[i]->ptr, bulkdata->d[i].os_data_ptr, bulkdata->d[i].data_length);
236 pcli->reply_bulkdata[i]->length = bulkdata->d[i].data_length;
237 } else {
238 pcli->reply_bulkdata[i]->length = 0;
239 }
240 }
241 }
242
243 /* Wake the requesting MLME function. */
244 pcli->wake_up_wq_id = pcli->reply_signal->SignalPrimitiveHeader.SignalId;
245 wake_up_interruptible(&pcli->udi_wq);
246
247} /* unifi_mlme_copy_reply_and_wakeup_client() */
248
249
250/*
251 * ---------------------------------------------------------------------------
252 * uf_abort_mlme
253 *
254 * Abort any MLME operation in progress.
255 * This is used in the error recovery mechanism.
256 *
257 * Arguments:
258 * priv Pointer to driver context.
259 *
260 * Returns:
261 * 0 on success.
262 * ---------------------------------------------------------------------------
263 */
264int
265uf_abort_mlme(unifi_priv_t *priv)
266{
267 ul_client_t *ul_cli;
268
269 /* Ensure no MLME functions are waiting on a the mlme_event semaphore. */
270 priv->io_aborted = 1;
271
272 ul_cli = priv->netdev_client;
273 if (ul_cli) {
274 wake_up_interruptible(&ul_cli->udi_wq);
275 }
276
277 ul_cli = priv->wext_client;
278 if (ul_cli) {
279 wake_up_interruptible(&ul_cli->udi_wq);
280 }
281
282 return 0;
283} /* uf_abort_mlme() */
284
285
286
287/*
288 * ---------------------------------------------------------------------------
289 *
290 * Human-readable decoding of Reason and Result codes.
291 *
292 * ---------------------------------------------------------------------------
293 */
294
295struct mlme_code {
296 const char *name;
297 int id;
298};
299
300static const struct mlme_code Result_codes[] = {
301 { "Success", 0x0000 },
302 { "Unspecified Failure", 0x0001 },
303 /* (Reserved) 0x0002 - 0x0009 */
304 { "Refused Capabilities Mismatch", 0x000A },
305 /* (Reserved) 0x000B */
306 { "Refused External Reason", 0x000C },
307 /* (Reserved) 0x000D - 0x0010 */
308 { "Refused AP Out Of Memory", 0x0011 },
309 { "Refused Basic Rates Mismatch", 0x0012 },
310 /* (Reserved) 0x0013 - 0x001F */
311 { "Failure", 0x0020 },
312 /* (Reserved) 0x0021 - 0x0024 */
313 { "Refused Reason Unspecified", 0x0025 },
314 { "Invalid Parameters", 0x0026 },
315 { "Rejected With Suggested Changes", 0x0027 },
316 /* (Reserved) 0x0028 - 0x002E */
317 { "Rejected For Delay Period", 0x002F },
318 { "Not Allowed", 0x0030 },
319 { "Not Present", 0x0031 },
320 { "Not QSTA", 0x0032 },
321 /* (Reserved) 0x0033 - 0x7FFF */
322 { "Timeout", 0x8000 },
323 { "Too Many Simultaneous Requests", 0x8001 },
324 { "BSS Already Started Or Joined", 0x8002 },
325 { "Not Supported", 0x8003 },
326 { "Transmission Failure", 0x8004 },
327 { "Refused Not Authenticated", 0x8005 },
328 { "Reset Required Before Start", 0x8006 },
329 { "LM Info Unavailable", 0x8007 },
330 { NULL, -1 }
331};
332
333static const struct mlme_code Reason_codes[] = {
334 /* (Reserved) 0x0000 */
335 { "Unspecified Reason", 0x0001 },
336 { "Authentication Not Valid", 0x0002 },
337 { "Deauthenticated Leave BSS", 0x0003 },
338 { "Disassociated Inactivity", 0x0004 },
339 { "AP Overload", 0x0005 },
340 { "Class2 Frame Error", 0x0006 },
341 { "Class3 Frame Error", 0x0007 },
342 { "Disassociated Leave BSS", 0x0008 },
343 { "Association Not Authenticated", 0x0009 },
344 { "Disassociated Power Capability", 0x000A },
345 { "Disassociated Supported Channels", 0x000B },
346 /* (Reserved) 0x000C */
347 { "Invalid Information Element", 0x000D },
348 { "Michael MIC Failure", 0x000E },
349 { "Fourway Handshake Timeout", 0x000F },
350 { "Group Key Update Timeout", 0x0010 },
351 { "Handshake Element Different", 0x0011 },
352 { "Invalid Group Cipher", 0x0012 },
353 { "Invalid Pairwise Cipher", 0x0013 },
354 { "Invalid AKMP", 0x0014 },
355 { "Unsupported RSN IE Version", 0x0015 },
356 { "Invalid RSN IE Capabilities", 0x0016 },
357 { "Dot1X Auth Failed", 0x0017 },
358 { "Cipher Rejected By Policy", 0x0018 },
359 /* (Reserved) 0x0019 - 0x001F */
360 { "QoS Unspecified Reason", 0x0020 },
361 { "QoS Insufficient Bandwidth", 0x0021 },
362 { "QoS Excessive Not Ack", 0x0022 },
363 { "QoS TXOP Limit Exceeded", 0x0023 },
364 { "QSTA Leaving", 0x0024 },
365 { "End TS, End DLS, End BA", 0x0025 },
366 { "Unknown TS, Unknown DLS, Unknown BA", 0x0026 },
367 { "Timeout", 0x0027 },
368 /* (Reserved) 0x0028 - 0x002C */
369 { "STAKey Mismatch", 0x002D },
370 { NULL, -1 }
371};
372
373
374static const char *
375lookup_something(const struct mlme_code *n, int id)
376{
377 for (; n->name; n++) {
378 if (n->id == id) {
379 return n->name;
380 }
381 }
382
383 /* not found */
384 return NULL;
385} /* lookup_something() */
386
387
388const char *
389lookup_result_code(int result)
390{
391 static char fallback[16];
392 const char *str;
393
394 str = lookup_something(Result_codes, result);
395
396 if (str == NULL) {
397 snprintf(fallback, 16, "%d", result);
398 str = fallback;
399 }
400
401 return str;
402} /* lookup_result_code() */
403
404
405/*
406 * ---------------------------------------------------------------------------
407 * lookup_reason
408 *
409 * Return a description string for a WiFi MLME ReasonCode.
410 *
411 * Arguments:
412 * reason The ReasonCode to interpret.
413 *
414 * Returns:
415 * Pointer to description string.
416 * ---------------------------------------------------------------------------
417 */
418const char *
419lookup_reason_code(int reason)
420{
421 static char fallback[16];
422 const char *str;
423
424 str = lookup_something(Reason_codes, reason);
425
426 if (str == NULL) {
427 snprintf(fallback, 16, "%d", reason);
428 str = fallback;
429 }
430
431 return str;
432} /* lookup_reason_code() */
433
diff --git a/drivers/staging/csr/monitor.c b/drivers/staging/csr/monitor.c
deleted file mode 100644
index e11f6cba8266..000000000000
--- a/drivers/staging/csr/monitor.c
+++ /dev/null
@@ -1,384 +0,0 @@
1/*
2 * ---------------------------------------------------------------------------
3 * FILE: monitor.c
4 *
5 * Copyright (C) 2006-2008 by Cambridge Silicon Radio Ltd.
6 *
7 * Refer to LICENSE.txt included with this source code for details on
8 * the license terms.
9 *
10 * ---------------------------------------------------------------------------
11 */
12
13#include "unifi_priv.h"
14
15#ifdef UNIFI_SNIFF_ARPHRD
16
17
18#if (UNIFI_SNIFF_ARPHRD == ARPHRD_IEEE80211_RADIOTAP)
19#include <net/ieee80211_radiotap.h>
20#endif
21
22#ifndef ETH_P_80211_RAW
23#define ETH_P_80211_RAW ETH_P_ALL
24#endif
25
26/*
27 * ---------------------------------------------------------------------------
28 * uf_start_sniff
29 *
30 * Start UniFi capture in SNIFF mode, i.e capture everything it hears.
31 *
32 * Arguments:
33 * priv Pointer to device private context struct
34 *
35 * Returns:
36 * 0 on success or kernel error code
37 * ---------------------------------------------------------------------------
38 */
39int
40uf_start_sniff(unifi_priv_t *priv)
41{
42 ul_client_t *pcli = priv->wext_client;
43 CSR_SIGNAL signal;
44 CSR_MLME_SNIFFJOIN_REQUEST *req = &signal.u.MlmeSniffjoinRequest;
45 int timeout = 1000;
46 int r;
47
48 req->Ifindex = priv->if_index;
49 req->Channel = priv->wext_conf.channel;
50 req->ChannelStartingFactor = 0;
51
52 signal.SignalPrimitiveHeader.SignalId = CSR_MLME_SNIFFJOIN_REQUEST_ID;
53
54 r = unifi_mlme_blocking_request(priv, pcli, &signal, NULL, timeout);
55 if (r < 0) {
56 unifi_error(priv, "failed to send SNIFFJOIN request, error %d\n", r);
57 return r;
58 }
59
60 r = pcli->reply_signal->u.MlmeSniffjoinConfirm.Resultcode;
61 if (r) {
62 unifi_notice(priv, "SNIFFJOIN request was rejected with result 0x%X (%s)\n",
63 r, lookup_result_code(r));
64 return -EIO;
65 }
66
67 return 0;
68} /* uf_start_sniff() */
69
70
71
72/*
73 * ---------------------------------------------------------------------------
74 * netrx_radiotap
75 *
76 * Reformat a UniFi SNIFFDATA signal into a radiotap packet.
77 *
78 * Arguments:
79 * priv OS private context pointer.
80 * ind Pointer to a MA_UNITDATA_INDICATION or
81 * DS_UNITDATA_INDICATION indication structure.
82 *
83 * Notes:
84 * Radiotap header values are all little-endian, UniFi signals will have
85 * been converted to host-endian.
86 * ---------------------------------------------------------------------------
87 */
88#if (UNIFI_SNIFF_ARPHRD == ARPHRD_IEEE80211_RADIOTAP)
89static void
90netrx_radiotap(unifi_priv_t *priv,
91 const CSR_MA_SNIFFDATA_INDICATION *ind,
92 struct sk_buff *skb_orig)
93{
94 struct net_device *dev = priv->netdev;
95 struct sk_buff *skb = NULL;
96 unsigned char *ptr;
97 unsigned char *base;
98 int ind_data_len = skb_orig->len - 2 - ETH_HLEN;
99 struct unifi_rx_radiotap_header {
100 struct ieee80211_radiotap_header rt_hdr;
101 /* IEEE80211_RADIOTAP_TSFT */
102 u64 rt_tsft;
103 /* IEEE80211_RADIOTAP_FLAGS */
104 u8 rt_flags;
105 /* IEEE80211_RADIOTAP_RATE */
106 u8 rt_rate;
107 /* IEEE80211_RADIOTAP_CHANNEL */
108 u16 rt_chan;
109 u16 rt_chan_flags;
110 /* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */
111 u8 rt_dbm_antsignal;
112 /* IEEE80211_RADIOTAP_DBM_ANTNOISE */
113 u8 rt_dbm_antnoise;
114 /* IEEE80211_RADIOTAP_ANTENNA */
115 u8 rt_antenna;
116
117 /* pad to 4-byte boundary */
118 u8 pad[3];
119 } __attribute__((__packed__));
120
121 struct unifi_rx_radiotap_header *unifi_rt;
122 int signal, noise, snr;
123
124 if (ind_data_len <= 0) {
125 unifi_error(priv, "Invalid length in CSR_MA_SNIFFDATA_INDICATION.\n");
126 return;
127 }
128
129 /*
130 * Allocate a SKB for the received data packet, including radiotap
131 * header.
132 */
133 skb = dev_alloc_skb(ind_data_len + sizeof(struct unifi_rx_radiotap_header) + 4);
134 if (! skb) {
135 unifi_error(priv, "alloc_skb failed.\n");
136 priv->stats.rx_errors++;
137 return;
138 }
139
140 base = skb->data;
141
142 /* Reserve the radiotap header at the front of skb */
143 unifi_rt = (struct unifi_rx_radiotap_header *)
144 skb_put(skb, sizeof(struct unifi_rx_radiotap_header));
145
146 /* Copy in the 802.11 frame */
147 ptr = skb_put(skb, ind_data_len);
148 memcpy(ptr, skb_orig->data, ind_data_len);
149
150 unifi_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION;
151 unifi_rt->rt_hdr.it_pad = 0; /* always good to zero */
152 unifi_rt->rt_hdr.it_len = sizeof(struct unifi_rx_radiotap_header);
153
154 /* Big bitfield of all the fields we provide in radiotap */
155 unifi_rt->rt_hdr.it_present = 0
156 | (1 << IEEE80211_RADIOTAP_TSFT)
157 | (1 << IEEE80211_RADIOTAP_FLAGS)
158 | (1 << IEEE80211_RADIOTAP_RATE)
159 | (1 << IEEE80211_RADIOTAP_CHANNEL)
160 | (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL)
161 | (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE)
162 | (1 << IEEE80211_RADIOTAP_ANTENNA)
163 ;
164
165
166 /* No flags to set */
167 unifi_rt->rt_tsft = (((u64)ind->Timestamp.x[7]) | (((u64)ind->Timestamp.x[6]) << 8) |
168 (((u64)ind->Timestamp.x[5]) << 16) | (((u64)ind->Timestamp.x[4]) << 24) |
169 (((u64)ind->Timestamp.x[3]) << 32) | (((u64)ind->Timestamp.x[2]) << 40) |
170 (((u64)ind->Timestamp.x[1]) << 48) | (((u64)ind->Timestamp.x[0]) << 56));
171
172 unifi_rt->rt_flags = 0;
173
174 unifi_rt->rt_rate = ind->Rate;
175
176 unifi_rt->rt_chan = cpu_to_le16(ieee80211chan2mhz(priv->wext_conf.channel));
177 unifi_rt->rt_chan_flags = 0;
178
179 /* Convert signal to dBm */
180 signal = (s16)unifi2host_16(ind->Rssi); /* in dBm */
181 snr = (s16)unifi2host_16(ind->Snr); /* in dB */
182 noise = signal - snr;
183
184 unifi_rt->rt_dbm_antsignal = signal;
185 unifi_rt->rt_dbm_antnoise = noise;
186
187 unifi_rt->rt_antenna = ind->AntennaId;
188
189
190 skb->dev = dev;
191 skb_reset_mac_header(skb);
192 skb->pkt_type = PACKET_OTHERHOST;
193 skb->protocol = __constant_htons(ETH_P_80211_RAW);
194 memset(skb->cb, 0, sizeof(skb->cb));
195
196 /* Pass up to Linux network stack */
197 netif_rx_ni(skb);
198
199 dev->last_rx = jiffies;
200
201 /* Bump the rx stats */
202 priv->stats.rx_packets++;
203 priv->stats.rx_bytes += ind_data_len;
204
205} /* netrx_radiotap() */
206#endif /* RADIOTAP */
207
208
209/*
210 * ---------------------------------------------------------------------------
211 * netrx_prism
212 *
213 * Reformat a UniFi SNIFFDATA signal into a Prism format sniff packet.
214 *
215 * Arguments:
216 * priv OS private context pointer.
217 * ind Pointer to a MA_UNITDATA_INDICATION or
218 * DS_UNITDATA_INDICATION indication structure.
219 *
220 * Notes:
221 * Radiotap header values are all little-endian, UniFi signals will have
222 * been converted to host-endian.
223 * ---------------------------------------------------------------------------
224 */
225#if (UNIFI_SNIFF_ARPHRD == ARPHRD_IEEE80211_PRISM)
226static void
227netrx_prism(unifi_priv_t *priv,
228 const CSR_MA_SNIFFDATA_INDICATION *ind,
229 struct sk_buff *skb_orig)
230{
231 struct net_device *dev = priv->netdev;
232 struct sk_buff *skb = NULL;
233 unsigned char *ptr;
234 unsigned char *base;
235 int ind_data_len = skb_orig->len - 2 - ETH_HLEN;
236#define WLANCAP_MAGIC_COOKIE_V1 0x80211001
237 struct avs_header_v1 {
238 uint32 version;
239 uint32 length;
240 uint64 mactime;
241 uint64 hosttime;
242 uint32 phytype;
243 uint32 channel;
244 uint32 datarate;
245 uint32 antenna;
246 uint32 priority;
247 uint32 ssi_type;
248 int32 ssi_signal;
249 int32 ssi_noise;
250 uint32 preamble;
251 uint32 encoding;
252 } *avs;
253 int signal, noise, snr;
254
255 if (ind_data_len <= 0) {
256 unifi_error(priv, "Invalid length in CSR_MA_SNIFFDATA_INDICATION.\n");
257 return;
258 }
259
260 /*
261 * Allocate a SKB for the received data packet, including radiotap
262 * header.
263 */
264 skb = dev_alloc_skb(ind_data_len + sizeof(struct avs_header_v1) + 4);
265 if (! skb) {
266 unifi_error(priv, "alloc_skb failed.\n");
267 priv->stats.rx_errors++;
268 return;
269 }
270
271 base = skb->data;
272
273 /* Reserve the radiotap header at the front of skb */
274 avs = (struct avs_header_v1 *)skb_put(skb, sizeof(struct avs_header_v1));
275
276 /* Copy in the 802.11 frame */
277 ptr = skb_put(skb, ind_data_len);
278 memcpy(ptr, skb_orig->data, ind_data_len);
279
280 /* Convert signal to dBm */
281 signal = 0x10000 - ((s16)unifi2host_16(ind->Rssi)); /* in dBm */
282 snr = (s16)unifi2host_16(ind->Snr); /* in dB */
283 noise = signal - snr;
284
285 avs->version = htonl(WLANCAP_MAGIC_COOKIE_V1);
286 avs->length = htonl(sizeof(struct avs_header_v1));
287 avs->mactime = __cpu_to_be64(ind->Timestamp);
288 avs->hosttime = __cpu_to_be64(jiffies);
289 avs->phytype = htonl(9); /* dss_ofdm_dot11_g */
290 avs->channel = htonl(priv->wext_conf.channel);
291 avs->datarate = htonl(ind->Rate * 5);
292 avs->antenna = htonl(ind->Antenna);
293 avs->priority = htonl(0); /* unknown */
294 avs->ssi_type = htonl(2); /* dBm */
295 avs->ssi_signal = htonl(signal);
296 avs->ssi_noise = htonl(noise);
297 avs->preamble = htonl(0); /* unknown */
298 avs->encoding = htonl(0); /* unknown */
299
300
301 skb->dev = dev;
302 skb->mac.raw = skb->data;
303 skb->pkt_type = PACKET_OTHERHOST;
304 skb->protocol = __constant_htons(ETH_P_80211_RAW);
305 memset(skb->cb, 0, sizeof(skb->cb));
306
307 /* Pass up to Linux network stack */
308 netif_rx_ni(skb);
309
310 dev->last_rx = jiffies;
311
312 /* Bump the rx stats */
313 priv->stats.rx_packets++;
314 priv->stats.rx_bytes += ind_data_len;
315
316} /* netrx_prism() */
317#endif /* PRISM */
318
319
320/*
321 * ---------------------------------------------------------------------------
322 * ma_sniffdata_ind
323 *
324 * Reformat a UniFi SNIFFDATA signal into a network
325 *
326 * Arguments:
327 * ospriv OS private context pointer.
328 * ind Pointer to a MA_UNITDATA_INDICATION or
329 * DS_UNITDATA_INDICATION indication structure.
330 * bulkdata Pointer to a bulk data structure, describing
331 * the data received.
332 *
333 * Notes:
334 * Radiotap header values are all little-endian, UniFi signals will have
335 * been converted to host-endian.
336 * ---------------------------------------------------------------------------
337 */
338void
339ma_sniffdata_ind(void *ospriv,
340 const CSR_MA_SNIFFDATA_INDICATION *ind,
341 const bulk_data_param_t *bulkdata)
342{
343 unifi_priv_t *priv = ospriv;
344 struct net_device *dev = priv->netdev;
345 struct sk_buff *skb = (struct sk_buff*)bulkdata->d[0].os_net_buf_ptr;
346
347 if (bulkdata->d[0].data_length == 0) {
348 unifi_warning(priv, "rx: MA-SNIFFDATA indication with zero bulk data\n");
349 return;
350 }
351
352 skb->len = bulkdata->d[0].data_length;
353
354 /* We only process data packets if the interface is open */
355 if (unlikely(!netif_running(dev))) {
356 priv->stats.rx_dropped++;
357 priv->wext_conf.wireless_stats.discard.misc++;
358 dev_kfree_skb(skb);
359 return;
360 }
361
362 if (ind->ReceptionStatus) {
363 priv->stats.rx_dropped++;
364 priv->wext_conf.wireless_stats.discard.misc++;
365 printk(KERN_INFO "unifi: Dropping corrupt sniff packet\n");
366 dev_kfree_skb(skb);
367 return;
368 }
369
370#if (UNIFI_SNIFF_ARPHRD == ARPHRD_IEEE80211_PRISM)
371 netrx_prism(priv, ind, skb);
372#endif /* PRISM */
373
374#if (UNIFI_SNIFF_ARPHRD == ARPHRD_IEEE80211_RADIOTAP)
375 netrx_radiotap(priv, ind, skb);
376#endif /* RADIOTAP */
377
378 dev_kfree_skb(skb);
379
380} /* ma_sniffdata_ind() */
381
382
383#endif /* UNIFI_SNIFF_ARPHRD */
384
diff --git a/drivers/staging/csr/netdev.c b/drivers/staging/csr/netdev.c
deleted file mode 100644
index 9c716c162c24..000000000000
--- a/drivers/staging/csr/netdev.c
+++ /dev/null
@@ -1,3307 +0,0 @@
1/*
2 * ---------------------------------------------------------------------------
3 * FILE: netdev.c
4 *
5 * PURPOSE:
6 * This file provides the upper edge interface to the linux netdevice
7 * and wireless extensions.
8 * It is part of the porting exercise.
9 *
10 * Copyright (C) 2005-2010 by Cambridge Silicon Radio Ltd.
11 *
12 * Refer to LICENSE.txt included with this source code for details on
13 * the license terms.
14 *
15 * ---------------------------------------------------------------------------
16 */
17
18/*
19 * Porting Notes:
20 * This file implements the data plane of the UniFi linux driver.
21 *
22 * All the Tx packets are passed to the HIP core lib, using the
23 * unifi_send_signal() API. For EAPOL packets use the MLME-EAPOL.req
24 * signal, for all other use the MLME-UNITDATA.req. The unifi_send_signal()
25 * expects the wire-formatted (packed) signal. For convenience, in the OS
26 * layer we only use the native (unpacked) signal structures. The HIP core lib
27 * provides the write_pack() helper function to convert to the packed signal.
28 * The packet is stored in the bulk data of the signal. We do not need to
29 * allocate new memory to store the packet, because unifi_net_data_malloc()
30 * is implemented to return a skb, which is the format of packet in Linux.
31 * The HIP core lib frees the bulk data buffers, so we do not need to do
32 * this in the OS layer.
33 *
34 * All the Rx packets are MLME-UNITDATA.ind signals, passed by the HIP core lib
35 * in unifi_receive_event(). We do not need to allocate an skb and copy the
36 * received packet because the HIP core lib has stored in memory allocated by
37 * unifi_net_data_malloc(). Also, we can perform the 802.11 to Ethernet
38 * translation in-place because we allocate the extra memory allocated in
39 * unifi_net_data_malloc().
40 *
41 * If possible, the porting exercise should appropriately implement
42 * unifi_net_data_malloc() and unifi_net_data_free() to save copies between
43 * network and driver buffers.
44 */
45
46#include <linux/types.h>
47#include <linux/etherdevice.h>
48#include <linux/mutex.h>
49#include <linux/semaphore.h>
50#include <linux/vmalloc.h>
51#include "csr_wifi_hip_unifi.h"
52#include "csr_wifi_hip_conversions.h"
53#include "unifi_priv.h"
54#include <net/pkt_sched.h>
55
56
57/* Wext handler is supported only if CSR_SUPPORT_WEXT is defined */
58#ifdef CSR_SUPPORT_WEXT
59extern struct iw_handler_def unifi_iw_handler_def;
60#endif /* CSR_SUPPORT_WEXT */
61static void check_ba_frame_age_timeout( unifi_priv_t *priv,
62 netInterface_priv_t *interfacePriv,
63 ba_session_rx_struct *ba_session);
64static void process_ba_frame(unifi_priv_t *priv,
65 netInterface_priv_t *interfacePriv,
66 ba_session_rx_struct *ba_session,
67 frame_desc_struct *frame_desc);
68static void process_ba_complete(unifi_priv_t *priv, netInterface_priv_t *interfacePriv);
69static void process_ma_packet_error_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata);
70static void process_amsdu(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata);
71static int uf_net_open(struct net_device *dev);
72static int uf_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
73static int uf_net_stop(struct net_device *dev);
74static struct net_device_stats *uf_net_get_stats(struct net_device *dev);
75static u16 uf_net_select_queue(struct net_device *dev, struct sk_buff *skb);
76static netdev_tx_t uf_net_xmit(struct sk_buff *skb, struct net_device *dev);
77static void uf_set_multicast_list(struct net_device *dev);
78
79
80typedef int (*tx_signal_handler)(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr *ehdr, CSR_PRIORITY priority);
81
82#ifdef CONFIG_NET_SCHED
83/*
84 * Queueing Discipline Interface
85 * Only used if kernel is configured with CONFIG_NET_SCHED
86 */
87
88/*
89 * The driver uses the qdisc interface to buffer and control all
90 * outgoing traffic. We create a root qdisc, register our qdisc operations
91 * and later we create two subsidiary pfifo queues for the uncontrolled
92 * and controlled ports.
93 *
94 * The network stack delivers all outgoing packets in our enqueue handler.
95 * There, we classify the packet and decide whether to store it or drop it
96 * (if the controlled port state is set to "discard").
97 * If the packet is enqueued, the network stack call our dequeue handler.
98 * There, we decide whether we can send the packet, delay it or drop it
99 * (the controlled port configuration might have changed meanwhile).
100 * If a packet is dequeued, then the network stack calls our hard_start_xmit
101 * handler where finally we send the packet.
102 *
103 * If the hard_start_xmit handler fails to send the packet, we return
104 * NETDEV_TX_BUSY and the network stack call our requeue handler where
105 * we put the packet back in the same queue in came from.
106 *
107 */
108
109struct uf_sched_data
110{
111 /* Traffic Classifier TBD */
112 struct tcf_proto *filter_list;
113 /* Our two queues */
114 struct Qdisc *queues[UNIFI_TRAFFIC_Q_MAX];
115};
116
117struct uf_tx_packet_data {
118 /* Queue the packet is stored in */
119 unifi_TrafficQueue queue;
120 /* QoS Priority determined when enqueing packet */
121 CSR_PRIORITY priority;
122 /* Debug */
123 unsigned long host_tag;
124};
125
126#endif /* CONFIG_NET_SCHED */
127
128static const struct net_device_ops uf_netdev_ops =
129{
130 .ndo_open = uf_net_open,
131 .ndo_stop = uf_net_stop,
132 .ndo_start_xmit = uf_net_xmit,
133 .ndo_do_ioctl = uf_net_ioctl,
134 .ndo_get_stats = uf_net_get_stats, /* called by /proc/net/dev */
135 .ndo_set_rx_mode = uf_set_multicast_list,
136 .ndo_select_queue = uf_net_select_queue,
137};
138
139static u8 oui_rfc1042[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
140static u8 oui_8021h[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
141
142
143/* Callback for event logging to blocking clients */
144static void netdev_mlme_event_handler(ul_client_t *client,
145 const u8 *sig_packed, int sig_len,
146 const bulk_data_param_t *bulkdata,
147 int dir);
148
149#ifdef CSR_SUPPORT_WEXT
150/* Declare netdev_notifier block which will contain the state change
151 * handler callback function
152 */
153static struct notifier_block uf_netdev_notifier;
154#endif
155
156/*
157 * ---------------------------------------------------------------------------
158 * uf_alloc_netdevice
159 *
160 * Allocate memory for the net_device and device private structs
161 * for this interface.
162 * Fill in the fields, but don't register the interface yet.
163 * We need to configure the UniFi first.
164 *
165 * Arguments:
166 * sdio_dev Pointer to SDIO context handle to use for all
167 * SDIO ops.
168 * bus_id A small number indicating the SDIO card position on the
169 * bus. Typically this is the slot number, e.g. 0, 1 etc.
170 * Valid values are 0 to MAX_UNIFI_DEVS-1.
171 *
172 * Returns:
173 * Pointer to device private struct.
174 *
175 * Notes:
176 * The net_device and device private structs are allocated together
177 * and should be freed by freeing the net_device pointer.
178 * ---------------------------------------------------------------------------
179 */
180unifi_priv_t *
181uf_alloc_netdevice(CsrSdioFunction *sdio_dev, int bus_id)
182{
183 struct net_device *dev;
184 unifi_priv_t *priv;
185 netInterface_priv_t *interfacePriv;
186#ifdef CSR_SUPPORT_WEXT
187 int rc;
188#endif
189 unsigned char i; /* loop index */
190
191 /*
192 * Allocate netdevice struct, assign name template and
193 * setup as an ethernet device.
194 * The net_device and private structs are zeroed. Ether_setup() then
195 * sets up ethernet handlers and values.
196 * The RedHat 9 redhat-config-network tool doesn't recognise wlan* devices,
197 * so use "eth*" (like other wireless extns drivers).
198 */
199 dev = alloc_etherdev_mq(sizeof(unifi_priv_t) + sizeof(netInterface_priv_t), UNIFI_TRAFFIC_Q_MAX);
200
201 if (dev == NULL) {
202 return NULL;
203 }
204
205 /* Set up back pointer from priv to netdev */
206 interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
207 priv = (unifi_priv_t *)(interfacePriv + 1);
208 interfacePriv->privPtr = priv;
209 interfacePriv->InterfaceTag = 0;
210
211
212 /* Initialize all supported netdev interface to be NULL */
213 for(i=0; i<CSR_WIFI_NUM_INTERFACES; i++) {
214 priv->netdev[i] = NULL;
215 priv->interfacePriv[i] = NULL;
216 }
217 priv->netdev[0] = dev;
218 priv->interfacePriv[0] = interfacePriv;
219
220 /* Setup / override net_device fields */
221 dev->netdev_ops = &uf_netdev_ops;
222
223#ifdef CSR_SUPPORT_WEXT
224 dev->wireless_handlers = &unifi_iw_handler_def;
225#if IW_HANDLER_VERSION < 6
226 dev->get_wireless_stats = unifi_get_wireless_stats;
227#endif /* IW_HANDLER_VERSION */
228#endif /* CSR_SUPPORT_WEXT */
229
230 /* This gives us enough headroom to add the 802.11 header */
231 dev->needed_headroom = 32;
232
233 /* Use bus_id as instance number */
234 priv->instance = bus_id;
235 /* Store SDIO pointer to pass in the core */
236 priv->sdio = sdio_dev;
237
238 sdio_dev->driverData = (void*)priv;
239 /* Consider UniFi to be uninitialised */
240 priv->init_progress = UNIFI_INIT_NONE;
241
242 priv->prev_queue = 0;
243
244 /*
245 * Initialise the clients structure array.
246 * We do not need protection around ul_init_clients() because
247 * the character device can not be used until uf_alloc_netdevice()
248 * returns and Unifi_instances[bus_id]=priv is set, since unifi_open()
249 * will return -ENODEV.
250 */
251 ul_init_clients(priv);
252
253 /*
254 * Register a new ul client to send the multicast list signals.
255 * Note: priv->instance must be set before calling this.
256 */
257 priv->netdev_client = ul_register_client(priv,
258 0,
259 netdev_mlme_event_handler);
260 if (priv->netdev_client == NULL) {
261 unifi_error(priv,
262 "Failed to register a unifi client for background netdev processing\n");
263 free_netdev(priv->netdev[0]);
264 return NULL;
265 }
266 unifi_trace(priv, UDBG2, "Netdev %p client (id:%d s:0x%X) is registered\n",
267 dev, priv->netdev_client->client_id, priv->netdev_client->sender_id);
268
269 priv->sta_wmm_capabilities = 0;
270
271#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_SUPPORT_SME))
272 priv->wapi_multicast_filter = 0;
273 priv->wapi_unicast_filter = 0;
274 priv->wapi_unicast_queued_pkt_filter = 0;
275#ifdef CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND
276 priv->isWapiConnection = FALSE;
277#endif
278#endif
279
280 /* Enable all queues by default */
281 interfacePriv->queueEnabled[0] = 1;
282 interfacePriv->queueEnabled[1] = 1;
283 interfacePriv->queueEnabled[2] = 1;
284 interfacePriv->queueEnabled[3] = 1;
285
286#ifdef CSR_SUPPORT_SME
287 priv->allPeerDozing = 0;
288#endif
289 /*
290 * Initialise the OS private struct.
291 */
292 /*
293 * Instead of deciding in advance to use 11bg or 11a, we could do a more
294 * clever scan on both radios.
295 */
296 if (use_5g) {
297 priv->if_index = CSR_INDEX_5G;
298 unifi_info(priv, "Using the 802.11a radio\n");
299 } else {
300 priv->if_index = CSR_INDEX_2G4;
301 }
302
303 /* Initialise bh thread structure */
304 priv->bh_thread.thread_task = NULL;
305 priv->bh_thread.block_thread = 1;
306 init_waitqueue_head(&priv->bh_thread.wakeup_q);
307 priv->bh_thread.wakeup_flag = 0;
308 sprintf(priv->bh_thread.name, "uf_bh_thread");
309
310 /* reset the connected state for the interface */
311 interfacePriv->connected = UnifiConnectedUnknown; /* -1 unknown, 0 no, 1 yes */
312
313#ifdef USE_DRIVER_LOCK
314 sema_init(&priv->lock, 1);
315#endif /* USE_DRIVER_LOCK */
316
317 spin_lock_init(&priv->send_signal_lock);
318
319 spin_lock_init(&priv->m4_lock);
320 sema_init(&priv->ba_mutex, 1);
321
322#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION))
323 spin_lock_init(&priv->wapi_lock);
324#endif
325
326#ifdef CSR_SUPPORT_SME
327 spin_lock_init(&priv->staRecord_lock);
328 spin_lock_init(&priv->tx_q_lock);
329#endif
330
331 /* Create the Traffic Analysis workqueue */
332 priv->unifi_workqueue = create_singlethread_workqueue("unifi_workq");
333 if (priv->unifi_workqueue == NULL) {
334 /* Deregister priv->netdev_client */
335 ul_deregister_client(priv->netdev_client);
336 free_netdev(priv->netdev[0]);
337 return NULL;
338 }
339
340#ifdef CSR_SUPPORT_SME
341 /* Create the Multicast Addresses list work structure */
342 INIT_WORK(&priv->multicast_list_task, uf_multicast_list_wq);
343
344 /* Create m4 buffering work structure */
345 INIT_WORK(&interfacePriv->send_m4_ready_task, uf_send_m4_ready_wq);
346
347#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION))
348 /* Create work structure to buffer the WAPI data packets to be sent to SME for encryption */
349 INIT_WORK(&interfacePriv->send_pkt_to_encrypt, uf_send_pkt_to_encrypt);
350#endif
351#endif
352
353 priv->ref_count = 1;
354
355 priv->amp_client = NULL;
356 priv->coredump_mode = 0;
357 priv->ptest_mode = 0;
358 priv->wol_suspend = FALSE;
359 INIT_LIST_HEAD(&interfacePriv->rx_uncontrolled_list);
360 INIT_LIST_HEAD(&interfacePriv->rx_controlled_list);
361 sema_init(&priv->rx_q_sem, 1);
362
363#ifdef CSR_SUPPORT_WEXT
364 interfacePriv->netdev_callback_registered = FALSE;
365 interfacePriv->wait_netdev_change = FALSE;
366 /* Register callback for netdevice state changes */
367 if ((rc = register_netdevice_notifier(&uf_netdev_notifier)) == 0) {
368 interfacePriv->netdev_callback_registered = TRUE;
369 }
370 else {
371 unifi_warning(priv, "Failed to register netdevice notifier : %d %p\n", rc, dev);
372 }
373#endif /* CSR_SUPPORT_WEXT */
374
375#ifdef CSR_WIFI_SPLIT_PATCH
376 /* set it to some invalid value */
377 priv->pending_mode_set.common.destination = 0xaaaa;
378#endif
379
380 return priv;
381} /* uf_alloc_netdevice() */
382
383/*
384 *---------------------------------------------------------------------------
385 * uf_alloc_netdevice_for_other_interfaces
386 *
387 * Allocate memory for the net_device and device private structs
388 * for this interface.
389 * Fill in the fields, but don't register the interface yet.
390 * We need to configure the UniFi first.
391 *
392 * Arguments:
393 * interfaceTag Interface number.
394 * sdio_dev Pointer to SDIO context handle to use for all
395 * SDIO ops.
396 * bus_id A small number indicating the SDIO card position on the
397 * bus. Typically this is the slot number, e.g. 0, 1 etc.
398 * Valid values are 0 to MAX_UNIFI_DEVS-1.
399 *
400 * Returns:
401 * Pointer to device private struct.
402 *
403 * Notes:
404 * The device private structure contains the interfaceTag and pointer to the unifi_priv
405 * structure created allocated by net_device od interface0.
406 * The net_device and device private structs are allocated together
407 * and should be freed by freeing the net_device pointer.
408 * ---------------------------------------------------------------------------
409 */
410u8
411uf_alloc_netdevice_for_other_interfaces(unifi_priv_t *priv, u16 interfaceTag)
412{
413 struct net_device *dev;
414 netInterface_priv_t *interfacePriv;
415
416 /*
417 * Allocate netdevice struct, assign name template and
418 * setup as an ethernet device.
419 * The net_device and private structs are zeroed. Ether_setup() then
420 * sets up ethernet handlers and values.
421 * The RedHat 9 redhat-config-network tool doesn't recognise wlan* devices,
422 * so use "eth*" (like other wireless extns drivers).
423 */
424 dev = alloc_etherdev_mq(sizeof(netInterface_priv_t), 1);
425 if (dev == NULL) {
426 return FALSE;
427 }
428
429 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
430 unifi_error(priv, "uf_alloc_netdevice_for_other_interfaces bad interfaceTag\n");
431 return FALSE;
432 }
433
434 /* Set up back pointer from priv to netdev */
435 interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
436 interfacePriv->privPtr = priv;
437 interfacePriv->InterfaceTag = interfaceTag;
438 priv->netdev[interfaceTag] = dev;
439 priv->interfacePriv[interfacePriv->InterfaceTag] = interfacePriv;
440
441 /* reset the connected state for the interface */
442 interfacePriv->connected = UnifiConnectedUnknown; /* -1 unknown, 0 no, 1 yes */
443 INIT_LIST_HEAD(&interfacePriv->rx_uncontrolled_list);
444 INIT_LIST_HEAD(&interfacePriv->rx_controlled_list);
445
446 /* Setup / override net_device fields */
447 dev->netdev_ops = &uf_netdev_ops;
448
449#ifdef CSR_SUPPORT_WEXT
450 dev->wireless_handlers = &unifi_iw_handler_def;
451#if IW_HANDLER_VERSION < 6
452 dev->get_wireless_stats = unifi_get_wireless_stats;
453#endif /* IW_HANDLER_VERSION */
454#endif /* CSR_SUPPORT_WEXT */
455 return TRUE;
456} /* uf_alloc_netdevice() */
457
458
459
460/*
461 * ---------------------------------------------------------------------------
462 * uf_free_netdevice
463 *
464 * Unregister the network device and free the memory allocated for it.
465 * NB This includes the memory for the priv struct.
466 *
467 * Arguments:
468 * priv Device private pointer.
469 *
470 * Returns:
471 * None.
472 * ---------------------------------------------------------------------------
473 */
474int
475uf_free_netdevice(unifi_priv_t *priv)
476{
477 int i;
478 unsigned long flags;
479
480 unifi_trace(priv, UDBG1, "uf_free_netdevice\n");
481
482 if (!priv) {
483 return -EINVAL;
484 }
485
486 /*
487 * Free any buffers used for holding firmware
488 */
489 uf_release_firmware_files(priv);
490
491#if (defined CSR_SUPPORT_SME) && (defined CSR_SUPPORT_WEXT)
492 if (priv->connection_config.mlmeAssociateReqInformationElements) {
493 kfree(priv->connection_config.mlmeAssociateReqInformationElements);
494 }
495 priv->connection_config.mlmeAssociateReqInformationElements = NULL;
496 priv->connection_config.mlmeAssociateReqInformationElementsLength = 0;
497
498 if (priv->mib_data.length) {
499 vfree(priv->mib_data.data);
500 }
501 priv->mib_data.data = NULL;
502 priv->mib_data.length = 0;
503
504#endif /* CSR_SUPPORT_SME && CSR_SUPPORT_WEXT*/
505
506 /* Free any bulkdata buffers allocated for M4 caching */
507 spin_lock_irqsave(&priv->m4_lock, flags);
508 for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) {
509 netInterface_priv_t *interfacePriv = priv->interfacePriv[i];
510 if (interfacePriv->m4_bulk_data.data_length > 0) {
511 unifi_trace(priv, UDBG5, "uf_free_netdevice: free M4 bulkdata %d\n", i);
512 unifi_net_data_free(priv, &interfacePriv->m4_bulk_data);
513 }
514 }
515 spin_unlock_irqrestore(&priv->m4_lock, flags);
516
517#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION))
518 /* Free any bulkdata buffers allocated for M4 caching */
519 spin_lock_irqsave(&priv->wapi_lock, flags);
520 for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) {
521 netInterface_priv_t *interfacePriv = priv->interfacePriv[i];
522 if (interfacePriv->wapi_unicast_bulk_data.data_length > 0) {
523 unifi_trace(priv, UDBG5, "uf_free_netdevice: free WAPI PKT bulk data %d\n", i);
524 unifi_net_data_free(priv, &interfacePriv->wapi_unicast_bulk_data);
525 }
526 }
527 spin_unlock_irqrestore(&priv->wapi_lock, flags);
528#endif
529
530#ifdef CSR_SUPPORT_WEXT
531 /* Unregister callback for netdevice state changes */
532 unregister_netdevice_notifier(&uf_netdev_notifier);
533#endif /* CSR_SUPPORT_WEXT */
534
535#ifdef CSR_SUPPORT_SME
536 /* Cancel work items and destroy the workqueue */
537 cancel_work_sync(&priv->multicast_list_task);
538#endif
539/* Destroy the workqueues. */
540 flush_workqueue(priv->unifi_workqueue);
541 destroy_workqueue(priv->unifi_workqueue);
542
543 /* Free up netdev in reverse order: priv is allocated with netdev[0].
544 * So, netdev[0] should be freed after all other netdevs are freed up
545 */
546 for (i=CSR_WIFI_NUM_INTERFACES-1; i>=0; i--) {
547 /*Free the netdev struct and priv, which are all one lump*/
548 if (priv->netdev[i]) {
549 unifi_error(priv, "uf_free_netdevice: netdev %d %p\n", i, priv->netdev[i]);
550 free_netdev(priv->netdev[i]);
551 }
552 }
553
554 return 0;
555} /* uf_free_netdevice() */
556
557
558/*
559 * ---------------------------------------------------------------------------
560 * uf_net_open
561 *
562 * Called when userland does "ifconfig wlan0 up".
563 *
564 * Arguments:
565 * dev Device pointer.
566 *
567 * Returns:
568 * None.
569 * ---------------------------------------------------------------------------
570 */
571static int
572uf_net_open(struct net_device *dev)
573{
574 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
575 unifi_priv_t *priv = interfacePriv->privPtr;
576
577 /* If we haven't finished UniFi initialisation, we can't start */
578 if (priv->init_progress != UNIFI_INIT_COMPLETED) {
579 unifi_warning(priv, "%s: unifi not ready, failing net_open\n", __FUNCTION__);
580 return -EINVAL;
581 }
582
583#if (defined CSR_NATIVE_LINUX) && (defined UNIFI_SNIFF_ARPHRD) && defined(CSR_SUPPORT_WEXT)
584 /*
585 * To sniff, the user must do "iwconfig mode monitor", which sets
586 * priv->wext_conf.mode to IW_MODE_MONITOR.
587 * Then he/she must do "ifconfig ethn up", which calls this fn.
588 * There is no point in starting the sniff with SNIFFJOIN until
589 * this point.
590 */
591 if (priv->wext_conf.mode == IW_MODE_MONITOR) {
592 int err;
593 err = uf_start_sniff(priv);
594 if (err) {
595 return err;
596 }
597 netif_carrier_on(dev);
598 }
599#endif
600
601#ifdef CSR_SUPPORT_WEXT
602 if (interfacePriv->wait_netdev_change) {
603 unifi_trace(priv, UDBG1, "%s: Waiting for NETDEV_CHANGE, assume connected\n",
604 __FUNCTION__);
605 interfacePriv->connected = UnifiConnected;
606 interfacePriv->wait_netdev_change = FALSE;
607 }
608#endif
609
610 netif_tx_start_all_queues(dev);
611
612 return 0;
613} /* uf_net_open() */
614
615
616static int
617uf_net_stop(struct net_device *dev)
618{
619#if defined(CSR_NATIVE_LINUX) && defined(UNIFI_SNIFF_ARPHRD) && defined(CSR_SUPPORT_WEXT)
620 netInterface_priv_t *interfacePriv = (netInterface_priv_t*)netdev_priv(dev);
621 unifi_priv_t *priv = interfacePriv->privPtr;
622
623 /* Stop sniffing if in Monitor mode */
624 if (priv->wext_conf.mode == IW_MODE_MONITOR) {
625 if (priv->card) {
626 int err;
627 err = unifi_reset_state(priv, dev->dev_addr, 1);
628 if (err) {
629 return err;
630 }
631 }
632 }
633#endif
634
635 netif_tx_stop_all_queues(dev);
636
637 return 0;
638} /* uf_net_stop() */
639
640
641/* This is called after the WE handlers */
642static int
643uf_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
644{
645 int rc;
646
647 rc = -EOPNOTSUPP;
648
649 return rc;
650} /* uf_net_ioctl() */
651
652
653
654static struct net_device_stats *
655uf_net_get_stats(struct net_device *dev)
656{
657 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
658
659 return &interfacePriv->stats;
660} /* uf_net_get_stats() */
661
662static CSR_PRIORITY uf_get_packet_priority(unifi_priv_t *priv, netInterface_priv_t *interfacePriv, struct sk_buff *skb, const int proto)
663{
664 CSR_PRIORITY priority = CSR_CONTENTION;
665
666 priority = (CSR_PRIORITY) (skb->priority >> 5);
667
668 if (priority == CSR_QOS_UP0) { /* 0 */
669
670 unifi_trace(priv, UDBG5, "uf_get_packet_priority: proto = 0x%.4X\n", proto);
671
672 switch (proto) {
673 case 0x0800: /* IPv4 */
674 case 0x814C: /* SNMP */
675 case 0x880C: /* GSMP */
676 priority = (CSR_PRIORITY) (skb->data[1 + ETH_HLEN] >> 5);
677 break;
678
679 case 0x8100: /* VLAN */
680 priority = (CSR_PRIORITY) (skb->data[0 + ETH_HLEN] >> 5);
681 break;
682
683 case 0x86DD: /* IPv6 */
684 priority = (CSR_PRIORITY) ((skb->data[0 + ETH_HLEN] & 0x0E) >> 1);
685 break;
686
687 default:
688 priority = CSR_QOS_UP0;
689 break;
690 }
691 }
692
693 /* Check if we are allowed to transmit on this AC. Because of ACM we may have to downgrade to a lower
694 * priority */
695 if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_STA ||
696 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI) {
697 unifi_TrafficQueue queue;
698
699 /* Keep trying lower priorities until we find a queue
700 * Priority to queue mapping is 1,2 - BK, 0,3 - BE, 4,5 - VI, 6,7 - VO */
701 queue = unifi_frame_priority_to_queue(priority);
702
703 while (queue > UNIFI_TRAFFIC_Q_BK && !interfacePriv->queueEnabled[queue]) {
704 queue--;
705 priority = unifi_get_default_downgrade_priority(queue);
706 }
707 }
708
709 unifi_trace(priv, UDBG5, "Packet priority = %d\n", priority);
710
711 return priority;
712}
713
714/*
715 */
716/*
717 * ---------------------------------------------------------------------------
718 * get_packet_priority
719 *
720 * Arguments:
721 * priv private data area of functional driver
722 * skb socket buffer
723 * ehdr ethernet header to fetch protocol
724 * interfacePriv For accessing station record database
725 *
726 *
727 * Returns:
728 * CSR_PRIORITY.
729 * ---------------------------------------------------------------------------
730 */
731CSR_PRIORITY
732get_packet_priority(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr *ehdr, netInterface_priv_t *interfacePriv)
733{
734 CSR_PRIORITY priority = CSR_CONTENTION;
735 const int proto = ntohs(ehdr->h_proto);
736
737 u8 interfaceMode = interfacePriv->interfaceMode;
738
739 /* Priority Mapping for all the Modes */
740 switch(interfaceMode)
741 {
742 case CSR_WIFI_ROUTER_CTRL_MODE_STA:
743 case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI:
744 unifi_trace(priv, UDBG4, "mode is STA \n");
745 if ((priv->sta_wmm_capabilities & QOS_CAPABILITY_WMM_ENABLED) == 1) {
746 priority = uf_get_packet_priority(priv, interfacePriv, skb, proto);
747 } else {
748 priority = CSR_CONTENTION;
749 }
750 break;
751#ifdef CSR_SUPPORT_SME
752 case CSR_WIFI_ROUTER_CTRL_MODE_AP:
753 case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO:
754 case CSR_WIFI_ROUTER_CTRL_MODE_IBSS:
755 {
756 CsrWifiRouterCtrlStaInfo_t * dstStaInfo =
757 CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, ehdr->h_dest, interfacePriv->InterfaceTag);
758 unifi_trace(priv, UDBG4, "mode is AP \n");
759 if (!(ehdr->h_dest[0] & 0x01) && dstStaInfo && dstStaInfo->wmmOrQosEnabled) {
760 /* If packet is not Broadcast/multicast */
761 priority = uf_get_packet_priority(priv, interfacePriv, skb, proto);
762 } else {
763 /* Since packet destination is not QSTA, set priority to CSR_CONTENTION */
764 unifi_trace(priv, UDBG4, "Destination is not QSTA or BroadCast/Multicast\n");
765 priority = CSR_CONTENTION;
766 }
767 }
768 break;
769#endif
770 default:
771 unifi_trace(priv, UDBG3, " mode unknown in %s func, mode=%x\n", __FUNCTION__, interfaceMode);
772 }
773 unifi_trace(priv, UDBG5, "priority = %x\n", priority);
774
775 return priority;
776}
777
778/*
779 * ---------------------------------------------------------------------------
780 * uf_net_select_queue
781 *
782 * Called by the kernel to select which queue to put the packet in
783 *
784 * Arguments:
785 * dev Device pointer
786 * skb Packet
787 *
788 * Returns:
789 * Queue index
790 * ---------------------------------------------------------------------------
791 */
792static u16
793uf_net_select_queue(struct net_device *dev, struct sk_buff *skb)
794{
795 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
796 unifi_priv_t *priv = (unifi_priv_t *)interfacePriv->privPtr;
797 struct ethhdr ehdr;
798 unifi_TrafficQueue queue;
799 int proto;
800 CSR_PRIORITY priority;
801
802 memcpy(&ehdr, skb->data, ETH_HLEN);
803 proto = ntohs(ehdr.h_proto);
804
805 /* 802.1x - apply controlled/uncontrolled port rules */
806 if ((proto != ETH_P_PAE)
807#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
808 && (proto != ETH_P_WAI)
809#endif
810 ) {
811 /* queues 0 - 3 */
812 priority = get_packet_priority(priv, skb, &ehdr, interfacePriv);
813 queue = unifi_frame_priority_to_queue(priority);
814 } else {
815 /* queue 4 */
816 queue = UNIFI_TRAFFIC_Q_EAPOL;
817 }
818
819
820 return (u16)queue;
821} /* uf_net_select_queue() */
822
823int
824skb_add_llc_snap(struct net_device *dev, struct sk_buff *skb, int proto)
825{
826 llc_snap_hdr_t *snap;
827 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
828 unifi_priv_t *priv = interfacePriv->privPtr;
829 int headroom;
830
831 /* get the headroom available in skb */
832 headroom = skb_headroom(skb);
833 /* step 1: classify ether frame, DIX or 802.3? */
834
835 if (proto < 0x600) {
836 /* codes <= 1500 reserved for 802.3 lengths */
837 /* it's 802.3, pass ether payload unchanged, */
838 unifi_trace(priv, UDBG3, "802.3 len: %d\n", skb->len);
839
840 /* leave off any PAD octets. */
841 skb_trim(skb, proto);
842 } else if (proto == ETH_P_8021Q) {
843
844 /* Store the VLAN SNAP (should be 87-65). */
845 u16 vlan_snap = *(u16*)skb->data;
846 /* check for headroom availability before skb_push 14 = (4 + 10) */
847 if (headroom < 14) {
848 unifi_trace(priv, UDBG3, "cant append vlan snap: debug\n");
849 return -1;
850 }
851 /* Add AA-AA-03-00-00-00 */
852 snap = (llc_snap_hdr_t *)skb_push(skb, 4);
853 snap->dsap = snap->ssap = 0xAA;
854 snap->ctrl = 0x03;
855 memcpy(snap->oui, oui_rfc1042, P80211_OUI_LEN);
856
857 /* Add AA-AA-03-00-00-00 */
858 snap = (llc_snap_hdr_t *)skb_push(skb, 10);
859 snap->dsap = snap->ssap = 0xAA;
860 snap->ctrl = 0x03;
861 memcpy(snap->oui, oui_rfc1042, P80211_OUI_LEN);
862
863 /* Add the VLAN specific information */
864 snap->protocol = htons(proto);
865 *(u16*)(snap + 1) = vlan_snap;
866
867 } else
868 {
869 /* it's DIXII, time for some conversion */
870 unifi_trace(priv, UDBG3, "DIXII len: %d\n", skb->len);
871
872 /* check for headroom availability before skb_push */
873 if (headroom < sizeof(llc_snap_hdr_t)) {
874 unifi_trace(priv, UDBG3, "cant append snap: debug\n");
875 return -1;
876 }
877 /* tack on SNAP */
878 snap = (llc_snap_hdr_t *)skb_push(skb, sizeof(llc_snap_hdr_t));
879 snap->dsap = snap->ssap = 0xAA;
880 snap->ctrl = 0x03;
881 /* Use the appropriate OUI. */
882 if ((proto == ETH_P_AARP) || (proto == ETH_P_IPX)) {
883 memcpy(snap->oui, oui_8021h, P80211_OUI_LEN);
884 } else {
885 memcpy(snap->oui, oui_rfc1042, P80211_OUI_LEN);
886 }
887 snap->protocol = htons(proto);
888 }
889
890 return 0;
891} /* skb_add_llc_snap() */
892
893#ifdef CSR_SUPPORT_SME
894static int
895_identify_sme_ma_pkt_ind(unifi_priv_t *priv,
896 const s8 *oui, u16 protocol,
897 const CSR_SIGNAL *signal,
898 bulk_data_param_t *bulkdata,
899 const unsigned char *daddr,
900 const unsigned char *saddr)
901{
902 CSR_MA_PACKET_INDICATION *pkt_ind = (CSR_MA_PACKET_INDICATION*)&signal->u.MaPacketIndication;
903 int r;
904 u8 i;
905
906 unifi_trace(priv, UDBG5,
907 "_identify_sme_ma_pkt_ind -->\n");
908 for (i = 0; i < MAX_MA_UNIDATA_IND_FILTERS; i++) {
909 if (priv->sme_unidata_ind_filters[i].in_use) {
910 if (!memcmp(oui, priv->sme_unidata_ind_filters[i].oui, 3) &&
911 (protocol == priv->sme_unidata_ind_filters[i].protocol)) {
912
913 /* Send to client */
914 if (priv->sme_cli) {
915 /*
916 * Pass the packet to the SME, using unifi_sys_ma_unitdata_ind().
917 * The frame needs to be converted according to the encapsulation.
918 */
919 unifi_trace(priv, UDBG1,
920 "_identify_sme_ma_pkt_ind: handle=%d, encap=%d, proto=%x\n",
921 i, priv->sme_unidata_ind_filters[i].encapsulation,
922 priv->sme_unidata_ind_filters[i].protocol);
923 if (priv->sme_unidata_ind_filters[i].encapsulation == CSR_WIFI_ROUTER_ENCAPSULATION_ETHERNET) {
924 struct sk_buff *skb;
925 /* The translation is performed on skb... */
926 skb = (struct sk_buff*)bulkdata->d[0].os_net_buf_ptr;
927 skb->len = bulkdata->d[0].data_length;
928
929 unifi_trace(priv, UDBG1,
930 "_identify_sme_ma_pkt_ind: skb_80211_to_ether -->\n");
931 r = skb_80211_to_ether(priv, skb, daddr, saddr,
932 signal, bulkdata);
933 unifi_trace(priv, UDBG1,
934 "_identify_sme_ma_pkt_ind: skb_80211_to_ether <--\n");
935 if (r) {
936 return -EINVAL;
937 }
938
939 /* ... but we indicate buffer and length */
940 bulkdata->d[0].os_data_ptr = skb->data;
941 bulkdata->d[0].data_length = skb->len;
942 } else {
943 /* Add the MAC addresses before the SNAP */
944 bulkdata->d[0].os_data_ptr -= 2*ETH_ALEN;
945 bulkdata->d[0].data_length += 2*ETH_ALEN;
946 memcpy((void*)bulkdata->d[0].os_data_ptr, daddr, ETH_ALEN);
947 memcpy((void*)bulkdata->d[0].os_data_ptr + ETH_ALEN, saddr, ETH_ALEN);
948 }
949
950 unifi_trace(priv, UDBG1,
951 "_identify_sme_ma_pkt_ind: unifi_sys_ma_pkt_ind -->\n");
952 CsrWifiRouterMaPacketIndSend(priv->sme_unidata_ind_filters[i].appHandle,
953 (pkt_ind->VirtualInterfaceIdentifier & 0xff),
954 i,
955 pkt_ind->ReceptionStatus,
956 bulkdata->d[0].data_length,
957 (u8*)bulkdata->d[0].os_data_ptr,
958 NULL,
959 pkt_ind->Rssi,
960 pkt_ind->Snr,
961 pkt_ind->ReceivedRate);
962
963
964 unifi_trace(priv, UDBG1,
965 "_identify_sme_ma_pkt_ind: unifi_sys_ma_pkt_ind <--\n");
966 }
967
968 return 1;
969 }
970 }
971 }
972
973 return -1;
974}
975#endif /* CSR_SUPPORT_SME */
976
977/*
978 * ---------------------------------------------------------------------------
979 * skb_80211_to_ether
980 *
981 * Make sure the received frame is in Ethernet (802.3) form.
982 * De-encapsulates SNAP if necessary, adds a ethernet header.
983 * The source buffer should not contain an 802.11 MAC header
984 *
985 * Arguments:
986 * payload Pointer to packet data received from UniFi.
987 * payload_length Number of bytes of data received from UniFi.
988 * daddr Destination MAC address.
989 * saddr Source MAC address.
990 *
991 * Returns:
992 * 0 on success, -1 if the packet is bad and should be dropped,
993 * 1 if the packet was forwarded to the SME or AMP client.
994 * ---------------------------------------------------------------------------
995 */
996int
997skb_80211_to_ether(unifi_priv_t *priv, struct sk_buff *skb,
998 const unsigned char *daddr, const unsigned char *saddr,
999 const CSR_SIGNAL *signal,
1000 bulk_data_param_t *bulkdata)
1001{
1002 unsigned char *payload;
1003 int payload_length;
1004 struct ethhdr *eth;
1005 llc_snap_hdr_t *snap;
1006 int headroom;
1007#define UF_VLAN_LLC_HEADER_SIZE 18
1008 static const u8 vlan_inner_snap[] = { 0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00 };
1009#if defined(CSR_NATIVE_SOFTMAC) && defined(CSR_SUPPORT_SME)
1010 const CSR_MA_PACKET_INDICATION *pkt_ind = &signal->u.MaPacketIndication;
1011#endif
1012
1013 if(skb== NULL || daddr == NULL || saddr == NULL){
1014 unifi_error(priv, "skb_80211_to_ether: PBC fail\n");
1015 return 1;
1016 }
1017
1018 payload = skb->data;
1019 payload_length = skb->len;
1020
1021 snap = (llc_snap_hdr_t *)payload;
1022 eth = (struct ethhdr *)payload;
1023
1024 /* get the skb headroom size */
1025 headroom = skb_headroom(skb);
1026
1027 /*
1028 * Test for the various encodings
1029 */
1030 if ((payload_length >= sizeof(llc_snap_hdr_t)) &&
1031 (snap->dsap == 0xAA) &&
1032 (snap->ssap == 0xAA) &&
1033 (snap->ctrl == 0x03) &&
1034 (snap->oui[0] == 0) &&
1035 (snap->oui[1] == 0) &&
1036 ((snap->oui[2] == 0) || (snap->oui[2] == 0xF8)))
1037 {
1038 /* AppleTalk AARP (2) or IPX SNAP */
1039 if ((snap->oui[2] == 0) &&
1040 ((ntohs(snap->protocol) == ETH_P_AARP) || (ntohs(snap->protocol) == ETH_P_IPX)))
1041 {
1042 u16 len;
1043
1044 unifi_trace(priv, UDBG3, "%s len: %d\n",
1045 (ntohs(snap->protocol) == ETH_P_AARP) ? "ETH_P_AARP" : "ETH_P_IPX",
1046 payload_length);
1047
1048 /* check for headroom availability before skb_push */
1049 if (headroom < (2 * ETH_ALEN + 2)) {
1050 unifi_warning(priv, "headroom not available to skb_push ether header\n");
1051 return -1;
1052 }
1053
1054 /* Add 802.3 header and leave full payload */
1055 len = htons(skb->len);
1056 memcpy(skb_push(skb, 2), &len, 2);
1057 memcpy(skb_push(skb, ETH_ALEN), saddr, ETH_ALEN);
1058 memcpy(skb_push(skb, ETH_ALEN), daddr, ETH_ALEN);
1059
1060 return 0;
1061 }
1062 /* VLAN-tagged IP */
1063 if ((snap->oui[2] == 0) && (ntohs(snap->protocol) == ETH_P_8021Q))
1064 {
1065 /*
1066 * The translation doesn't change the packet length, so is done in-place.
1067 *
1068 * Example header (from Std 802.11-2007 Annex M):
1069 * AA-AA-03-00-00-00-81-00-87-65-AA-AA-03-00-00-00-08-06
1070 * -------SNAP-------p1-p1-ll-ll-------SNAP--------p2-p2
1071 * dd-dd-dd-dd-dd-dd-aa-aa-aa-aa-aa-aa-p1-p1-ll-ll-p2-p2
1072 * dd-dd-dd-dd-dd-dd-aa-aa-aa-aa-aa-aa-81-00-87-65-08-06
1073 */
1074 u16 vlan_snap;
1075
1076 if (payload_length < UF_VLAN_LLC_HEADER_SIZE) {
1077 unifi_warning(priv, "VLAN SNAP header too short: %d bytes\n", payload_length);
1078 return -1;
1079 }
1080
1081 if (memcmp(payload + 10, vlan_inner_snap, 6)) {
1082 unifi_warning(priv, "VLAN malformatted SNAP header.\n");
1083 return -1;
1084 }
1085
1086 unifi_trace(priv, UDBG3, "VLAN SNAP: %02x-%02x\n", payload[8], payload[9]);
1087 unifi_trace(priv, UDBG3, "VLAN len: %d\n", payload_length);
1088
1089 /* Create the 802.3 header */
1090
1091 vlan_snap = *((u16*)(payload + 8));
1092
1093 /* Create LLC header without byte-swapping */
1094 eth->h_proto = snap->protocol;
1095
1096 memcpy(eth->h_dest, daddr, ETH_ALEN);
1097 memcpy(eth->h_source, saddr, ETH_ALEN);
1098 *(u16*)(eth + 1) = vlan_snap;
1099 return 0;
1100 }
1101
1102 /* it's a SNAP + RFC1042 frame */
1103 unifi_trace(priv, UDBG3, "SNAP+RFC1042 len: %d\n", payload_length);
1104
1105 /* chop SNAP+llc header from skb. */
1106 skb_pull(skb, sizeof(llc_snap_hdr_t));
1107
1108 /* Since skb_pull called above to chop snap+llc, no need to check for headroom
1109 * availability before skb_push
1110 */
1111 /* create 802.3 header at beginning of skb. */
1112 eth = (struct ethhdr *)skb_push(skb, ETH_HLEN);
1113 memcpy(eth->h_dest, daddr, ETH_ALEN);
1114 memcpy(eth->h_source, saddr, ETH_ALEN);
1115 /* Copy protocol field without byte-swapping */
1116 eth->h_proto = snap->protocol;
1117 } else {
1118 u16 len;
1119
1120 /* check for headroom availability before skb_push */
1121 if (headroom < (2 * ETH_ALEN + 2)) {
1122 unifi_warning(priv, "headroom not available to skb_push ether header\n");
1123 return -1;
1124 }
1125 /* Add 802.3 header and leave full payload */
1126 len = htons(skb->len);
1127 memcpy(skb_push(skb, 2), &len, 2);
1128 memcpy(skb_push(skb, ETH_ALEN), saddr, ETH_ALEN);
1129 memcpy(skb_push(skb, ETH_ALEN), daddr, ETH_ALEN);
1130
1131 return 1;
1132 }
1133
1134 return 0;
1135} /* skb_80211_to_ether() */
1136
1137
1138static CsrWifiRouterCtrlPortAction verify_port(unifi_priv_t *priv, unsigned char *address, int queue, u16 interfaceTag)
1139{
1140#ifdef CSR_NATIVE_LINUX
1141#ifdef CSR_SUPPORT_WEXT
1142 if (queue == UF_CONTROLLED_PORT_Q) {
1143 return priv->wext_conf.block_controlled_port;
1144 } else {
1145 return CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN;
1146 }
1147#else
1148 return CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN; /* default to open for softmac dev */
1149#endif
1150#else
1151 return uf_sme_port_state(priv, address, queue, interfaceTag);
1152#endif
1153}
1154
1155/*
1156 * ---------------------------------------------------------------------------
1157 * prepare_and_add_macheader
1158 *
1159 *
1160 * These functions adds mac header for packet from netdev
1161 * to UniFi for transmission.
1162 * EAP protocol packets are also appended with Mac header &
1163 * sent using send_ma_pkt_request().
1164 *
1165 * Arguments:
1166 * priv Pointer to device private context struct
1167 * skb Socket buffer containing data packet to transmit
1168 * newSkb Socket buffer containing data packet + Mac header if no sufficient headroom in skb
1169 * serviceClass to append QOS control header in Mac header
1170 * bulkdata if newSkb allocated then bulkdata updated to send to unifi
1171 * interfaceTag the interfaceID on which activity going on
1172 * daddr destination address
1173 * saddr source address
1174 * protection protection bit set in framce control of mac header
1175 *
1176 * Returns:
1177 * Zero on success or error code.
1178 * ---------------------------------------------------------------------------
1179 */
1180
1181int prepare_and_add_macheader(unifi_priv_t *priv, struct sk_buff *skb, struct sk_buff *newSkb,
1182 CSR_PRIORITY priority,
1183 bulk_data_param_t *bulkdata,
1184 u16 interfaceTag,
1185 const u8 *daddr,
1186 const u8 *saddr,
1187 u8 protection)
1188{
1189 u16 fc = 0;
1190 u8 qc = 0;
1191 u8 macHeaderLengthInBytes = MAC_HEADER_SIZE, *bufPtr = NULL;
1192 bulk_data_param_t data_ptrs;
1193 CsrResult csrResult;
1194 int headroom =0;
1195 u8 direction = 0;
1196 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
1197 u8 *addressOne;
1198 u8 bQosNull = false;
1199
1200 if (skb == NULL) {
1201 unifi_error(priv, "prepare_and_add_macheader: Invalid SKB reference\n");
1202 return -1;
1203 }
1204
1205 /* add a MAC header refer: 7.1.3.1 Frame Control field in P802.11REVmb.book */
1206 if (priority != CSR_CONTENTION) {
1207 /* EAPOL packets don't go as QOS_DATA */
1208 if (priority == CSR_MANAGEMENT) {
1209 fc |= cpu_to_le16(IEEE802_11_FC_TYPE_DATA);
1210 } else {
1211 /* Qos Control Field */
1212 macHeaderLengthInBytes += QOS_CONTROL_HEADER_SIZE;
1213
1214 if (skb->len) {
1215
1216 fc |= cpu_to_le16(IEEE802_11_FC_TYPE_QOS_DATA);
1217 } else {
1218 fc |= cpu_to_le16(IEEE802_11_FC_TYPE_QOS_NULL);
1219 bQosNull = true;
1220 }
1221 }
1222 } else {
1223 if(skb->len == 0) {
1224 fc |= cpu_to_le16(IEEE802_11_FC_TYPE_NULL);
1225 } else {
1226 fc |= cpu_to_le16(IEEE802_11_FC_TYPE_DATA);
1227 }
1228 }
1229
1230 switch (interfacePriv->interfaceMode)
1231 {
1232 case CSR_WIFI_ROUTER_CTRL_MODE_STA:
1233 case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI:
1234 direction = 2;
1235 fc |= cpu_to_le16(IEEE802_11_FC_TO_DS_MASK);
1236 break;
1237 case CSR_WIFI_ROUTER_CTRL_MODE_IBSS:
1238 direction = 0;
1239 break;
1240 case CSR_WIFI_ROUTER_CTRL_MODE_AP:
1241 case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO:
1242 direction = 1;
1243 fc |= cpu_to_le16(IEEE802_11_FC_FROM_DS_MASK);
1244 break;
1245 case CSR_WIFI_ROUTER_CTRL_MODE_AMP:
1246 if (priority == CSR_MANAGEMENT ) {
1247
1248 direction = 2;
1249 fc |= cpu_to_le16(IEEE802_11_FC_TO_DS_MASK);
1250 } else {
1251 /* Data frames have to use WDS 4 address frames */
1252 direction = 3;
1253 fc |= cpu_to_le16(IEEE802_11_FC_TO_DS_MASK | IEEE802_11_FC_FROM_DS_MASK);
1254 macHeaderLengthInBytes += 6;
1255 }
1256 break;
1257 default:
1258 unifi_warning(priv, "prepare_and_add_macheader: Unknown mode %d\n",
1259 interfacePriv->interfaceMode);
1260 }
1261
1262
1263 /* If Sta is QOS & HTC is supported then need to set 'order' bit */
1264 /* We don't support HT Control for now */
1265
1266 if(protection) {
1267 fc |= cpu_to_le16(IEEE802_11_FC_PROTECTED_MASK);
1268 }
1269
1270 /* check the skb headroom before pushing mac header */
1271 headroom = skb_headroom(skb);
1272
1273 if (headroom < macHeaderLengthInBytes) {
1274 unifi_trace(priv, UDBG5,
1275 "prepare_and_add_macheader: Allocate headroom extra %d bytes\n",
1276 macHeaderLengthInBytes);
1277
1278 csrResult = unifi_net_data_malloc(priv, &data_ptrs.d[0], skb->len + macHeaderLengthInBytes);
1279
1280 if (csrResult != CSR_RESULT_SUCCESS) {
1281 unifi_error(priv, " failed to allocate request_data. in %s func\n", __FUNCTION__);
1282 return -1;
1283 }
1284 newSkb = (struct sk_buff *)(data_ptrs.d[0].os_net_buf_ptr);
1285 newSkb->len = skb->len + macHeaderLengthInBytes;
1286
1287 memcpy((void*)data_ptrs.d[0].os_data_ptr + macHeaderLengthInBytes,
1288 skb->data, skb->len);
1289
1290 bulkdata->d[0].os_data_ptr = newSkb->data;
1291 bulkdata->d[0].os_net_buf_ptr = (unsigned char*)newSkb;
1292 bulkdata->d[0].data_length = newSkb->len;
1293
1294 bufPtr = (u8*)data_ptrs.d[0].os_data_ptr;
1295
1296 /* The old skb will not be used again */
1297 kfree_skb(skb);
1298 } else {
1299
1300 /* headroom has sufficient size, so will get proper pointer */
1301 bufPtr = (u8*)skb_push(skb, macHeaderLengthInBytes);
1302 bulkdata->d[0].os_data_ptr = skb->data;
1303 bulkdata->d[0].os_net_buf_ptr = (unsigned char*)skb;
1304 bulkdata->d[0].data_length = skb->len;
1305 }
1306
1307 /* Frame the actual MAC header */
1308
1309 memset(bufPtr, 0, macHeaderLengthInBytes);
1310
1311 /* copy frameControl field */
1312 memcpy(bufPtr, &fc, sizeof(fc));
1313 bufPtr += sizeof(fc);
1314 macHeaderLengthInBytes -= sizeof(fc);
1315
1316 /* Duration/ID field which is 2 bytes */
1317 bufPtr += 2;
1318 macHeaderLengthInBytes -= 2;
1319
1320 switch(direction)
1321 {
1322 case 0:
1323 /* Its an Ad-Hoc no need to route it through AP */
1324 /* Address1: MAC address of the destination from eth header */
1325 memcpy(bufPtr, daddr, ETH_ALEN);
1326 bufPtr += ETH_ALEN;
1327 macHeaderLengthInBytes -= ETH_ALEN;
1328
1329 /* Address2: MAC address of the source */
1330 memcpy(bufPtr, saddr, ETH_ALEN);
1331 bufPtr += ETH_ALEN;
1332 macHeaderLengthInBytes -= ETH_ALEN;
1333
1334 /* Address3: the BSSID (locally generated in AdHoc (creators Bssid)) */
1335 memcpy(bufPtr, &interfacePriv->bssid, ETH_ALEN);
1336 bufPtr += ETH_ALEN;
1337 macHeaderLengthInBytes -= ETH_ALEN;
1338 break;
1339 case 1:
1340 /* Address1: MAC address of the actual destination */
1341 memcpy(bufPtr, daddr, ETH_ALEN);
1342 bufPtr += ETH_ALEN;
1343 macHeaderLengthInBytes -= ETH_ALEN;
1344 /* Address2: The MAC address of the AP */
1345 memcpy(bufPtr, &interfacePriv->bssid, ETH_ALEN);
1346 bufPtr += ETH_ALEN;
1347 macHeaderLengthInBytes -= ETH_ALEN;
1348
1349 /* Address3: MAC address of the source from eth header */
1350 memcpy(bufPtr, saddr, ETH_ALEN);
1351 bufPtr += ETH_ALEN;
1352 macHeaderLengthInBytes -= ETH_ALEN;
1353 break;
1354 case 2:
1355 /* Address1: To AP is the MAC address of the AP to which its associated */
1356 memcpy(bufPtr, &interfacePriv->bssid, ETH_ALEN);
1357 bufPtr += ETH_ALEN;
1358 macHeaderLengthInBytes -= ETH_ALEN;
1359
1360 /* Address2: MAC address of the source from eth header */
1361 memcpy(bufPtr, saddr, ETH_ALEN);
1362 bufPtr += ETH_ALEN;
1363 macHeaderLengthInBytes -= ETH_ALEN;
1364
1365 /* Address3: MAC address of the actual destination on the distribution system */
1366 memcpy(bufPtr, daddr, ETH_ALEN);
1367 bufPtr += ETH_ALEN;
1368 macHeaderLengthInBytes -= ETH_ALEN;
1369 break;
1370 case 3:
1371 memcpy(bufPtr, &interfacePriv->bssid, ETH_ALEN);
1372 bufPtr += ETH_ALEN;
1373 macHeaderLengthInBytes -= ETH_ALEN;
1374
1375 /* Address2: MAC address of the source from eth header */
1376 memcpy(bufPtr, saddr, ETH_ALEN);
1377 bufPtr += ETH_ALEN;
1378 macHeaderLengthInBytes -= ETH_ALEN;
1379
1380 /* Address3: MAC address of the actual destination on the distribution system */
1381 memcpy(bufPtr, daddr, ETH_ALEN);
1382 bufPtr += ETH_ALEN;
1383 macHeaderLengthInBytes -= ETH_ALEN;
1384 break;
1385 default:
1386 unifi_error(priv, "Unknown direction =%d : Not handled now\n", direction);
1387 return -1;
1388 }
1389 /* 2 bytes of frame control field, appended by firmware */
1390 bufPtr += 2;
1391 macHeaderLengthInBytes -= 2;
1392
1393 if (3 == direction) {
1394 /* Address4: MAC address of the source */
1395 memcpy(bufPtr, saddr, ETH_ALEN);
1396 bufPtr += ETH_ALEN;
1397 macHeaderLengthInBytes -= ETH_ALEN;
1398 }
1399
1400 /* IF Qos Data or Qos Null Data then set QosControl field */
1401 if ((priority != CSR_CONTENTION) && (macHeaderLengthInBytes >= QOS_CONTROL_HEADER_SIZE)) {
1402
1403 if (priority > 7) {
1404 unifi_trace(priv, UDBG1, "data packets priority is more than 7, priority = %x\n", priority);
1405 qc |= 7;
1406 } else {
1407 qc |= priority;
1408 }
1409 /*assigning address1
1410 * Address1 offset taken fromm bufPtr(currently bufPtr pointing to Qos contorl) variable in reverse direction
1411 * Address4 don't exit
1412 */
1413
1414 addressOne = bufPtr- ADDRESS_ONE_OFFSET;
1415
1416 if (addressOne[0] & 0x1) {
1417 /* multicast/broadcast frames, no acknowledgement needed */
1418 qc |= 1 << 5;
1419 }
1420 /* non-AP mode only for now */
1421 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_STA ||
1422 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_IBSS ||
1423 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI) {
1424 /* In case of STA and IBSS case eosp and txop limit is 0. */
1425 } else {
1426 if(bQosNull) {
1427 qc |= 1 << 4;
1428 }
1429 }
1430
1431 /* append Qos control field to mac header */
1432 bufPtr[0] = qc;
1433 /* txop limit is 0 */
1434 bufPtr[1] = 0;
1435 macHeaderLengthInBytes -= QOS_CONTROL_HEADER_SIZE;
1436 }
1437 if (macHeaderLengthInBytes) {
1438 unifi_warning(priv, " Mac header not appended properly\n");
1439 return -1;
1440 }
1441 return 0;
1442}
1443
1444/*
1445 * ---------------------------------------------------------------------------
1446 * send_ma_pkt_request
1447 *
1448 * These functions send a data packet to UniFi for transmission.
1449 * EAP protocol packets are also sent as send_ma_pkt_request().
1450 *
1451 * Arguments:
1452 * priv Pointer to device private context struct
1453 * skb Socket buffer containing data packet to transmit
1454 * ehdr Pointer to Ethernet header within skb.
1455 *
1456 * Returns:
1457 * Zero on success or error code.
1458 * ---------------------------------------------------------------------------
1459 */
1460
1461static int
1462send_ma_pkt_request(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr *ehdr, CSR_PRIORITY priority)
1463{
1464 int r;
1465 u16 i;
1466 u8 eapolStore = FALSE;
1467 struct sk_buff *newSkb = NULL;
1468 bulk_data_param_t bulkdata;
1469 const int proto = ntohs(ehdr->h_proto);
1470 u16 interfaceTag;
1471 CsrWifiMacAddress peerAddress;
1472 CSR_TRANSMISSION_CONTROL transmissionControl = CSR_NO_CONFIRM_REQUIRED;
1473 s8 protection;
1474 netInterface_priv_t *interfacePriv = NULL;
1475 CSR_RATE TransmitRate = (CSR_RATE)0;
1476
1477 unifi_trace(priv, UDBG5, "entering send_ma_pkt_request\n");
1478
1479 /* Get the interface Tag by means of source Mac address */
1480 for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) {
1481 if (!memcmp(priv->netdev[i]->dev_addr, ehdr->h_source, ETH_ALEN)) {
1482 interfaceTag = i;
1483 interfacePriv = priv->interfacePriv[interfaceTag];
1484 break;
1485 }
1486 }
1487
1488 if (interfacePriv == NULL) {
1489 /* No match found - error */
1490 interfaceTag = 0;
1491 interfacePriv = priv->interfacePriv[interfaceTag];
1492 unifi_warning(priv, "Mac address not matching ... debugging needed\n");
1493 interfacePriv->stats.tx_dropped++;
1494 kfree_skb(skb);
1495 return -1;
1496 }
1497
1498 /* Add a SNAP header if necessary */
1499 if (skb_add_llc_snap(priv->netdev[interfaceTag], skb, proto) != 0) {
1500 /* convert failed */
1501 unifi_error(priv, "skb_add_llc_snap failed.\n");
1502 kfree_skb(skb);
1503 return -1;
1504 }
1505
1506 bulkdata.d[0].os_data_ptr = skb->data;
1507 bulkdata.d[0].os_net_buf_ptr = (unsigned char*)skb;
1508 bulkdata.d[0].net_buf_length = bulkdata.d[0].data_length = skb->len;
1509 bulkdata.d[1].os_data_ptr = NULL;
1510 bulkdata.d[1].os_net_buf_ptr = NULL;
1511 bulkdata.d[1].net_buf_length = bulkdata.d[1].data_length = 0;
1512
1513#ifdef CSR_SUPPORT_SME
1514 /* Notify the TA module for the Tx frame for non AP/P2PGO mode*/
1515 if ((interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_AP) &&
1516 (interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_P2PGO)) {
1517 unifi_ta_sample(priv->card, CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX,
1518 &bulkdata.d[0], ehdr->h_source,
1519 priv->netdev[interfaceTag]->dev_addr,
1520 jiffies_to_msecs(jiffies),
1521 0); /* rate is unknown on tx */
1522 }
1523#endif /* CSR_SUPPORT_SME */
1524
1525 if ((proto == ETH_P_PAE)
1526#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
1527 || (proto == ETH_P_WAI)
1528#endif
1529 )
1530 {
1531 /* check for m4 detection */
1532 if (0 == uf_verify_m4(priv, bulkdata.d[0].os_data_ptr, bulkdata.d[0].data_length)) {
1533 eapolStore = TRUE;
1534 }
1535 }
1536
1537#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
1538 if (proto == ETH_P_WAI)
1539 {
1540 protection = 0; /*WAI packets always sent unencrypted*/
1541 }
1542 else
1543 {
1544#endif
1545#ifdef CSR_SUPPORT_SME
1546 if ((protection = uf_get_protection_bit_from_interfacemode(priv, interfaceTag, ehdr->h_dest)) < 0) {
1547 unifi_warning(priv, "unicast address, but destination not in station record database\n");
1548 unifi_net_data_free(priv, &bulkdata.d[0]);
1549 return -1;
1550 }
1551#else
1552 protection = 0;
1553#endif
1554#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
1555 }
1556#endif
1557
1558 /* append Mac header for Eapol as well as data packet */
1559 if (prepare_and_add_macheader(priv, skb, newSkb, priority, &bulkdata, interfaceTag, ehdr->h_dest, ehdr->h_source, protection)) {
1560 unifi_error(priv, "failed to create MAC header\n");
1561 unifi_net_data_free(priv, &bulkdata.d[0]);
1562 return -1;
1563 }
1564
1565 /* RA address must contain the immediate destination MAC address that is similar to
1566 * the Address 1 field of 802.11 Mac header here 4 is: (sizeof(framecontrol) + sizeof (durationID))
1567 * which is address 1 field
1568 */
1569 memcpy(peerAddress.a, ((u8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN);
1570
1571 unifi_trace(priv, UDBG5, "RA[0]=%x, RA[1]=%x, RA[2]=%x, RA[3]=%x, RA[4]=%x, RA[5]=%x\n",
1572 peerAddress.a[0], peerAddress.a[1], peerAddress.a[2], peerAddress.a[3],
1573 peerAddress.a[4], peerAddress.a[5]);
1574
1575
1576 if ((proto == ETH_P_PAE)
1577#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
1578 || (proto == ETH_P_WAI)
1579#endif
1580 )
1581 {
1582 CSR_SIGNAL signal;
1583 CSR_MA_PACKET_REQUEST *req = &signal.u.MaPacketRequest;
1584
1585 /* initialize signal to zero */
1586 memset(&signal, 0, sizeof(CSR_SIGNAL));
1587
1588 /* Frame MA_PACKET request */
1589 signal.SignalPrimitiveHeader.SignalId = CSR_MA_PACKET_REQUEST_ID;
1590 signal.SignalPrimitiveHeader.ReceiverProcessId = 0;
1591 signal.SignalPrimitiveHeader.SenderProcessId = priv->netdev_client->sender_id;
1592
1593 transmissionControl = req->TransmissionControl = 0;
1594#ifdef CSR_SUPPORT_SME
1595 if (eapolStore)
1596 {
1597 netInterface_priv_t *netpriv = (netInterface_priv_t *)netdev_priv(priv->netdev[interfaceTag]);
1598
1599 /* Fill the MA-PACKET.req */
1600
1601 req->Priority = priority;
1602 unifi_trace(priv, UDBG3, "Tx Frame with Priority: %x\n", req->Priority);
1603
1604 /* rate selected by firmware */
1605 req->TransmitRate = 0;
1606 req->HostTag = CSR_WIFI_EAPOL_M4_HOST_TAG;
1607 /* RA address matching with address 1 of Mac header */
1608 memcpy(req->Ra.x, ((u8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN);
1609
1610 spin_lock(&priv->m4_lock);
1611 /* Store the M4-PACKET.req for later */
1612 interfacePriv->m4_signal = signal;
1613 interfacePriv->m4_bulk_data.net_buf_length = bulkdata.d[0].net_buf_length;
1614 interfacePriv->m4_bulk_data.data_length = bulkdata.d[0].data_length;
1615 interfacePriv->m4_bulk_data.os_data_ptr = bulkdata.d[0].os_data_ptr;
1616 interfacePriv->m4_bulk_data.os_net_buf_ptr = bulkdata.d[0].os_net_buf_ptr;
1617 spin_unlock(&priv->m4_lock);
1618
1619 /* Signal the workqueue to call CsrWifiRouterCtrlM4ReadyToSendIndSend().
1620 * It cannot be called directly from the tx path because it
1621 * does a non-atomic kmalloc via the framework's CsrPmemAlloc().
1622 */
1623 queue_work(priv->unifi_workqueue, &netpriv->send_m4_ready_task);
1624
1625 return 0;
1626 }
1627#endif
1628 }/*EAPOL or WAI packet*/
1629
1630#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION))
1631 if ((CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) && \
1632 (priv->wapi_unicast_filter) && \
1633 (proto != ETH_P_PAE) && \
1634 (proto != ETH_P_WAI) && \
1635 (skb->len > 0))
1636 {
1637 CSR_SIGNAL signal;
1638 CSR_MA_PACKET_REQUEST *req = &signal.u.MaPacketRequest;
1639 netInterface_priv_t *netpriv = (netInterface_priv_t *)netdev_priv(priv->netdev[interfaceTag]);
1640
1641 unifi_trace(priv, UDBG4, "send_ma_pkt_request() - WAPI unicast data packet when USKID = 1 \n");
1642
1643 /* initialize signal to zero */
1644 memset(&signal, 0, sizeof(CSR_SIGNAL));
1645 /* Frame MA_PACKET request */
1646 signal.SignalPrimitiveHeader.SignalId = CSR_MA_PACKET_REQUEST_ID;
1647 signal.SignalPrimitiveHeader.ReceiverProcessId = 0;
1648 signal.SignalPrimitiveHeader.SenderProcessId = priv->netdev_client->sender_id;
1649
1650 /* Fill the MA-PACKET.req */
1651 req->TransmissionControl = 0;
1652 req->Priority = priority;
1653 unifi_trace(priv, UDBG3, "Tx Frame with Priority: %x\n", req->Priority);
1654 req->TransmitRate = (CSR_RATE) 0; /* rate selected by firmware */
1655 req->HostTag = 0xffffffff; /* Ask for a new HostTag */
1656 /* RA address matching with address 1 of Mac header */
1657 memcpy(req->Ra.x, ((u8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN);
1658
1659 /* Store the M4-PACKET.req for later */
1660 spin_lock(&priv->wapi_lock);
1661 interfacePriv->wapi_unicast_ma_pkt_sig = signal;
1662 interfacePriv->wapi_unicast_bulk_data.net_buf_length = bulkdata.d[0].net_buf_length;
1663 interfacePriv->wapi_unicast_bulk_data.data_length = bulkdata.d[0].data_length;
1664 interfacePriv->wapi_unicast_bulk_data.os_data_ptr = bulkdata.d[0].os_data_ptr;
1665 interfacePriv->wapi_unicast_bulk_data.os_net_buf_ptr = bulkdata.d[0].os_net_buf_ptr;
1666 spin_unlock(&priv->wapi_lock);
1667
1668 /* Signal the workqueue to call CsrWifiRouterCtrlWapiUnicastTxEncryptIndSend().
1669 * It cannot be called directly from the tx path because it
1670 * does a non-atomic kmalloc via the framework's CsrPmemAlloc().
1671 */
1672 queue_work(priv->unifi_workqueue, &netpriv->send_pkt_to_encrypt);
1673
1674 return 0;
1675 }
1676#endif
1677
1678 if(priv->cmanrTestMode)
1679 {
1680 TransmitRate = priv->cmanrTestModeTransmitRate;
1681 unifi_trace(priv, UDBG2, "send_ma_pkt_request: cmanrTestModeTransmitRate = %d TransmitRate=%d\n",
1682 priv->cmanrTestModeTransmitRate,
1683 TransmitRate
1684 );
1685 }
1686
1687 /* Send UniFi msg */
1688 /* Here hostTag is been sent as 0xffffffff, its been appended properly while framing MA-Packet request in pdu_processing.c file */
1689 r = uf_process_ma_packet_req(priv,
1690 peerAddress.a,
1691 0xffffffff, /* Ask for a new HostTag */
1692 interfaceTag,
1693 transmissionControl,
1694 TransmitRate,
1695 priority,
1696 priv->netdev_client->sender_id,
1697 &bulkdata);
1698
1699 if (r) {
1700 unifi_trace(priv, UDBG1, "(HIP validation failure) r = %x\n", r);
1701 unifi_net_data_free(priv, &bulkdata.d[0]);
1702 return -1;
1703 }
1704
1705 unifi_trace(priv, UDBG3, "leaving send_ma_pkt_request, UNITDATA result code = %d\n", r);
1706
1707 return r;
1708} /* send_ma_pkt_request() */
1709
1710/*
1711 * ---------------------------------------------------------------------------
1712 * uf_net_xmit
1713 *
1714 * This function is called by the higher level stack to transmit an
1715 * ethernet packet.
1716 *
1717 * Arguments:
1718 * skb Ethernet packet to send.
1719 * dev Pointer to the linux net device.
1720 *
1721 * Returns:
1722 * 0 on success (packet was consumed, not necessarily transmitted)
1723 * 1 if packet was requeued
1724 * -1 on error
1725 *
1726 *
1727 * Notes:
1728 * The controlled port is handled in the qdisc dequeue handler.
1729 * ---------------------------------------------------------------------------
1730 */
1731static netdev_tx_t
1732uf_net_xmit(struct sk_buff *skb, struct net_device *dev)
1733{
1734 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
1735 unifi_priv_t *priv = interfacePriv->privPtr;
1736 struct ethhdr ehdr;
1737 int proto, port;
1738 int result;
1739 static tx_signal_handler tx_handler;
1740 CSR_PRIORITY priority;
1741 CsrWifiRouterCtrlPortAction port_action;
1742
1743 unifi_trace(priv, UDBG5, "unifi_net_xmit: skb = %x\n", skb);
1744
1745 memcpy(&ehdr, skb->data, ETH_HLEN);
1746 proto = ntohs(ehdr.h_proto);
1747 priority = get_packet_priority(priv, skb, &ehdr, interfacePriv);
1748
1749 /* All frames are sent as MA-PACKET.req (EAPOL also) */
1750 tx_handler = send_ma_pkt_request;
1751
1752 /* 802.1x - apply controlled/uncontrolled port rules */
1753 if ((proto != ETH_P_PAE)
1754#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
1755 && (proto != ETH_P_WAI)
1756#endif
1757 ) {
1758 port = UF_CONTROLLED_PORT_Q;
1759 } else {
1760 /* queue 4 */
1761 port = UF_UNCONTROLLED_PORT_Q;
1762 }
1763
1764 /* Uncontrolled port rules apply */
1765 port_action = verify_port(priv
1766 , (((CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode)||(CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI== interfacePriv->interfaceMode))? interfacePriv->bssid.a: ehdr.h_dest)
1767 , port
1768 , interfacePriv->InterfaceTag);
1769
1770 if (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN) {
1771 unifi_trace(priv, UDBG5,
1772 "uf_net_xmit: %s controlled port open\n",
1773 port ? "" : "un");
1774 /* Remove the ethernet header */
1775 skb_pull(skb, ETH_HLEN);
1776 result = tx_handler(priv, skb, &ehdr, priority);
1777 } else {
1778
1779 /* Discard the packet if necessary */
1780 unifi_trace(priv, UDBG2,
1781 "uf_net_xmit: %s controlled port %s\n",
1782 port ? "" : "un", port_action==CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_BLOCK ? "blocked" : "closed");
1783 interfacePriv->stats.tx_dropped++;
1784 kfree_skb(skb);
1785
1786 return NETDEV_TX_OK;
1787 }
1788
1789 if (result == NETDEV_TX_OK) {
1790#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION))
1791 /* Don't update the tx stats when the pkt is to be sent for sw encryption*/
1792 if (!((CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) &&
1793 (priv->wapi_unicast_filter == 1)))
1794 {
1795 dev->trans_start = jiffies;
1796 /* Should really count tx stats in the UNITDATA.status signal but
1797 * that doesn't have the length.
1798 */
1799 interfacePriv->stats.tx_packets++;
1800 /* count only the packet payload */
1801 interfacePriv->stats.tx_bytes += skb->len;
1802
1803 }
1804#else
1805 dev->trans_start = jiffies;
1806
1807 /*
1808 * Should really count tx stats in the UNITDATA.status signal but
1809 * that doesn't have the length.
1810 */
1811 interfacePriv->stats.tx_packets++;
1812 /* count only the packet payload */
1813 interfacePriv->stats.tx_bytes += skb->len;
1814#endif
1815 } else if (result < 0) {
1816
1817 /* Failed to send: fh queue was full, and the skb was discarded.
1818 * Return OK to indicate that the buffer was consumed, to stop the
1819 * kernel re-transmitting the freed buffer.
1820 */
1821 interfacePriv->stats.tx_dropped++;
1822 unifi_trace(priv, UDBG1, "unifi_net_xmit: (Packet Drop), dropped count = %x\n", interfacePriv->stats.tx_dropped);
1823 result = NETDEV_TX_OK;
1824 }
1825
1826 /* The skb will have been freed by send_XXX_request() */
1827
1828 return result;
1829} /* uf_net_xmit() */
1830
1831/*
1832 * ---------------------------------------------------------------------------
1833 * unifi_pause_xmit
1834 * unifi_restart_xmit
1835 *
1836 * These functions are called from the UniFi core to control the flow
1837 * of packets from the upper layers.
1838 * unifi_pause_xmit() is called when the internal queue is full and
1839 * should take action to stop unifi_ma_unitdata() being called.
1840 * When the queue has drained, unifi_restart_xmit() will be called to
1841 * re-enable the flow of packets for transmission.
1842 *
1843 * Arguments:
1844 * ospriv OS private context pointer.
1845 *
1846 * Returns:
1847 * unifi_pause_xmit() is called from interrupt context.
1848 * ---------------------------------------------------------------------------
1849 */
1850void
1851unifi_pause_xmit(void *ospriv, unifi_TrafficQueue queue)
1852{
1853 unifi_priv_t *priv = ospriv;
1854 int i; /* used as a loop counter */
1855
1856 unifi_trace(priv, UDBG2, "Stopping queue %d\n", queue);
1857
1858 for(i=0;i<CSR_WIFI_NUM_INTERFACES;i++)
1859 {
1860 if (netif_running(priv->netdev[i]))
1861 {
1862 netif_stop_subqueue(priv->netdev[i], (u16)queue);
1863 }
1864 }
1865
1866#ifdef CSR_SUPPORT_SME
1867 if(queue<=3) {
1868 routerStartBuffering(priv, queue);
1869 unifi_trace(priv, UDBG2, "Start buffering %d\n", queue);
1870 } else {
1871 routerStartBuffering(priv, 0);
1872 unifi_error(priv, "Start buffering %d defaulting to 0\n", queue);
1873 }
1874#endif
1875
1876} /* unifi_pause_xmit() */
1877
1878void
1879unifi_restart_xmit(void *ospriv, unifi_TrafficQueue queue)
1880{
1881 unifi_priv_t *priv = ospriv;
1882 int i=0; /* used as a loop counter */
1883
1884 unifi_trace(priv, UDBG2, "Waking queue %d\n", queue);
1885
1886 for(i=0;i<CSR_WIFI_NUM_INTERFACES;i++)
1887 {
1888 if (netif_running(priv->netdev[i]))
1889 {
1890 netif_wake_subqueue(priv->netdev[i], (u16)queue);
1891 }
1892 }
1893
1894#ifdef CSR_SUPPORT_SME
1895 if(queue <=3) {
1896 routerStopBuffering(priv, queue);
1897 uf_send_buffered_frames(priv, queue);
1898 } else {
1899 routerStopBuffering(priv, 0);
1900 uf_send_buffered_frames(priv, 0);
1901 }
1902#endif
1903} /* unifi_restart_xmit() */
1904
1905
1906static void
1907indicate_rx_skb(unifi_priv_t *priv, u16 ifTag, u8* dst_a, u8* src_a, struct sk_buff *skb, CSR_SIGNAL *signal,
1908 bulk_data_param_t *bulkdata)
1909{
1910 int r, sr = 0;
1911 struct net_device *dev;
1912
1913#ifdef CSR_SUPPORT_SME
1914 llc_snap_hdr_t *snap;
1915
1916 snap = (llc_snap_hdr_t *)skb->data;
1917
1918 sr = _identify_sme_ma_pkt_ind(priv,
1919 snap->oui, ntohs(snap->protocol),
1920 signal,
1921 bulkdata,
1922 dst_a, src_a );
1923#endif
1924
1925 /*
1926 * Decapsulate any SNAP header and
1927 * prepend an ethernet header so that the skb manipulation and ARP
1928 * stuff works.
1929 */
1930 r = skb_80211_to_ether(priv, skb, dst_a, src_a,
1931 signal, bulkdata);
1932 if (r == -1) {
1933 /* Drop the packet and return */
1934 priv->interfacePriv[ifTag]->stats.rx_errors++;
1935 priv->interfacePriv[ifTag]->stats.rx_frame_errors++;
1936 unifi_net_data_free(priv, &bulkdata->d[0]);
1937 unifi_notice(priv, "indicate_rx_skb: Discard unknown frame.\n");
1938 return;
1939 }
1940
1941 /* Handle the case where packet is sent up through the subscription
1942 * API but should not be given to the network stack (AMP PAL case)
1943 * LLC header is different from WiFi and the packet has been subscribed for
1944 */
1945 if (r == 1 && sr == 1) {
1946 unifi_net_data_free(priv, &bulkdata->d[0]);
1947 unifi_trace(priv, UDBG5, "indicate_rx_skb: Data given to subscription"
1948 "API, not being given to kernel\n");
1949 return;
1950 }
1951
1952 dev = priv->netdev[ifTag];
1953 /* Now we look like a regular ethernet frame */
1954 /* Fill in SKB meta data */
1955 skb->dev = dev;
1956 skb->protocol = eth_type_trans(skb, dev);
1957 skb->ip_summed = CHECKSUM_UNNECESSARY;
1958
1959 /* Test for an overlength frame */
1960 if (skb->len > (dev->mtu + ETH_HLEN)) {
1961 /* A bogus length ethfrm has been encap'd. */
1962 /* Is someone trying an oflow attack? */
1963 unifi_error(priv, "%s: oversize frame (%d > %d)\n",
1964 dev->name,
1965 skb->len, dev->mtu + ETH_HLEN);
1966
1967 /* Drop the packet and return */
1968 priv->interfacePriv[ifTag]->stats.rx_errors++;
1969 priv->interfacePriv[ifTag]->stats.rx_length_errors++;
1970 unifi_net_data_free(priv, &bulkdata->d[0]);
1971 return;
1972 }
1973
1974
1975 if(priv->cmanrTestMode)
1976 {
1977 const CSR_MA_PACKET_INDICATION *pkt_ind = &signal->u.MaPacketIndication;
1978 priv->cmanrTestModeTransmitRate = pkt_ind->ReceivedRate;
1979 unifi_trace(priv, UDBG2, "indicate_rx_skb: cmanrTestModeTransmitRate=%d\n", priv->cmanrTestModeTransmitRate);
1980 }
1981
1982 /* Pass SKB up the stack */
1983#ifdef CSR_WIFI_USE_NETIF_RX
1984 netif_rx(skb);
1985#else
1986 netif_rx_ni(skb);
1987#endif
1988
1989 if (dev != NULL) {
1990 dev->last_rx = jiffies;
1991 }
1992
1993 /* Bump rx stats */
1994 priv->interfacePriv[ifTag]->stats.rx_packets++;
1995 priv->interfacePriv[ifTag]->stats.rx_bytes += bulkdata->d[0].data_length;
1996
1997 return;
1998}
1999
2000void
2001uf_process_rx_pending_queue(unifi_priv_t *priv, int queue,
2002 CsrWifiMacAddress source_address,
2003 int indicate, u16 interfaceTag)
2004{
2005 rx_buffered_packets_t *rx_q_item;
2006 struct list_head *rx_list;
2007 struct list_head *n;
2008 struct list_head *l_h;
2009 static const CsrWifiMacAddress broadcast_address = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}};
2010 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
2011
2012 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
2013 unifi_error(priv, "uf_process_rx_pending_queue bad interfaceTag\n");
2014 return;
2015 }
2016
2017 if (queue == UF_CONTROLLED_PORT_Q) {
2018 rx_list = &interfacePriv->rx_controlled_list;
2019 } else {
2020 rx_list = &interfacePriv->rx_uncontrolled_list;
2021 }
2022
2023 down(&priv->rx_q_sem);
2024 list_for_each_safe(l_h, n, rx_list) {
2025 rx_q_item = list_entry(l_h, rx_buffered_packets_t, q);
2026
2027 /* Validate against the source address */
2028 if (memcmp(broadcast_address.a, source_address.a, ETH_ALEN) &&
2029 memcmp(rx_q_item->sa.a, source_address.a, ETH_ALEN)) {
2030
2031 unifi_trace(priv, UDBG2,
2032 "uf_process_rx_pending_queue: Skipping sa=%02X%02X%02X%02X%02X%02X skb=%p, bulkdata=%p\n",
2033 rx_q_item->sa.a[0], rx_q_item->sa.a[1],
2034 rx_q_item->sa.a[2], rx_q_item->sa.a[3],
2035 rx_q_item->sa.a[4], rx_q_item->sa.a[5],
2036 rx_q_item->skb, &rx_q_item->bulkdata.d[0]);
2037 continue;
2038 }
2039
2040 list_del(l_h);
2041
2042
2043 unifi_trace(priv, UDBG2,
2044 "uf_process_rx_pending_queue: Was Blocked skb=%p, bulkdata=%p\n",
2045 rx_q_item->skb, &rx_q_item->bulkdata);
2046
2047 if (indicate) {
2048 indicate_rx_skb(priv, interfaceTag, rx_q_item->da.a, rx_q_item->sa.a, rx_q_item->skb, &rx_q_item->signal, &rx_q_item->bulkdata);
2049 } else {
2050 interfacePriv->stats.rx_dropped++;
2051 unifi_net_data_free(priv, &rx_q_item->bulkdata.d[0]);
2052 }
2053
2054 /* It is our resposibility to free the Rx structure object. */
2055 kfree(rx_q_item);
2056 }
2057 up(&priv->rx_q_sem);
2058}
2059
2060/*
2061 * ---------------------------------------------------------------------------
2062 * uf_resume_data_plane
2063 *
2064 * Is called when the (un)controlled port is set to open,
2065 * to notify the network stack to schedule for transmission
2066 * any packets queued in the qdisk while port was closed and
2067 * indicated to the stack any packets buffered in the Rx queues.
2068 *
2069 * Arguments:
2070 * priv Pointer to device private struct
2071 *
2072 * Returns:
2073 * ---------------------------------------------------------------------------
2074 */
2075void
2076uf_resume_data_plane(unifi_priv_t *priv, int queue,
2077 CsrWifiMacAddress peer_address,
2078 u16 interfaceTag)
2079{
2080#ifdef CSR_SUPPORT_WEXT
2081 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
2082#endif
2083
2084 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
2085 unifi_error(priv, "uf_resume_data_plane bad interfaceTag\n");
2086 return;
2087 }
2088
2089 unifi_trace(priv, UDBG2, "Resuming netif\n");
2090
2091 /*
2092 * If we are waiting for the net device to enter the up state, don't
2093 * process the rx queue yet as it will be done by the callback when
2094 * the device is ready.
2095 */
2096#ifdef CSR_SUPPORT_WEXT
2097 if (!interfacePriv->wait_netdev_change)
2098#endif
2099 {
2100#ifdef CONFIG_NET_SCHED
2101 if (netif_running(priv->netdev[interfaceTag])) {
2102 netif_tx_schedule_all(priv->netdev[interfaceTag]);
2103 }
2104#endif
2105 uf_process_rx_pending_queue(priv, queue, peer_address, 1, interfaceTag);
2106 }
2107} /* uf_resume_data_plane() */
2108
2109
2110void uf_free_pending_rx_packets(unifi_priv_t *priv, int queue, CsrWifiMacAddress peer_address, u16 interfaceTag)
2111{
2112 uf_process_rx_pending_queue(priv, queue, peer_address, 0, interfaceTag);
2113
2114} /* uf_free_pending_rx_packets() */
2115
2116
2117/*
2118 * ---------------------------------------------------------------------------
2119 * unifi_rx
2120 *
2121 * Reformat a UniFi data received packet into a p80211 packet and
2122 * pass it up the protocol stack.
2123 *
2124 * Arguments:
2125 * None.
2126 *
2127 * Returns:
2128 * None.
2129 * ---------------------------------------------------------------------------
2130 */
2131static void
2132unifi_rx(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata)
2133{
2134 u16 interfaceTag;
2135 bulk_data_desc_t *pData;
2136 const CSR_MA_PACKET_INDICATION *pkt_ind = &signal->u.MaPacketIndication;
2137 struct sk_buff *skb;
2138 CsrWifiRouterCtrlPortAction port_action;
2139 u8 dataFrameType;
2140 int proto;
2141 int queue;
2142
2143 u8 da[ETH_ALEN], sa[ETH_ALEN];
2144 u8 toDs, fromDs, frameType, macHeaderLengthInBytes = MAC_HEADER_SIZE;
2145 u16 frameControl;
2146 netInterface_priv_t *interfacePriv;
2147 struct ethhdr ehdr;
2148
2149 interfaceTag = (pkt_ind->VirtualInterfaceIdentifier & 0xff);
2150 interfacePriv = priv->interfacePriv[interfaceTag];
2151
2152 /* Sanity check that the VIF refers to a sensible interface */
2153 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES)
2154 {
2155 unifi_error(priv, "%s: MA-PACKET indication with bad interfaceTag %d\n", __FUNCTION__, interfaceTag);
2156 unifi_net_data_free(priv, &bulkdata->d[0]);
2157 return;
2158 }
2159
2160 /* Sanity check that the VIF refers to an allocated netdev */
2161 if (!interfacePriv->netdev_registered)
2162 {
2163 unifi_error(priv, "%s: MA-PACKET indication with unallocated interfaceTag %d\n", __FUNCTION__, interfaceTag);
2164 unifi_net_data_free(priv, &bulkdata->d[0]);
2165 return;
2166 }
2167
2168 if (bulkdata->d[0].data_length == 0) {
2169 unifi_warning(priv, "%s: MA-PACKET indication with zero bulk data\n", __FUNCTION__);
2170 unifi_net_data_free(priv, &bulkdata->d[0]);
2171 return;
2172 }
2173
2174
2175 skb = (struct sk_buff*)bulkdata->d[0].os_net_buf_ptr;
2176 skb->len = bulkdata->d[0].data_length;
2177
2178 /* Point to the addresses */
2179 toDs = (skb->data[1] & 0x01) ? 1 : 0;
2180 fromDs = (skb->data[1] & 0x02) ? 1 : 0;
2181
2182 memcpy(da, (skb->data+4+toDs*12), ETH_ALEN);/* Address1 or 3 */
2183 memcpy(sa, (skb->data+10+fromDs*(6+toDs*8)), ETH_ALEN); /* Address2, 3 or 4 */
2184
2185
2186 pData = &bulkdata->d[0];
2187 frameControl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(pData->os_data_ptr);
2188 frameType = ((frameControl & 0x000C) >> 2);
2189
2190 dataFrameType =((frameControl & 0x00f0) >> 4);
2191 unifi_trace(priv, UDBG6,
2192 "%s: Receive Data Frame Type %d \n", __FUNCTION__, dataFrameType);
2193
2194 switch(dataFrameType)
2195 {
2196 case QOS_DATA:
2197 case QOS_DATA_NULL:
2198 /* If both are set then the Address4 exists (only for AP) */
2199 if (fromDs && toDs)
2200 {
2201 /* 6 is the size of Address4 field */
2202 macHeaderLengthInBytes += (QOS_CONTROL_HEADER_SIZE + 6);
2203 }
2204 else
2205 {
2206 macHeaderLengthInBytes += QOS_CONTROL_HEADER_SIZE;
2207 }
2208
2209 /* If order bit set then HT control field is the part of MAC header */
2210 if (frameControl & FRAME_CONTROL_ORDER_BIT)
2211 macHeaderLengthInBytes += HT_CONTROL_HEADER_SIZE;
2212 break;
2213 default:
2214 if (fromDs && toDs)
2215 macHeaderLengthInBytes += 6;
2216 }
2217
2218 /* Prepare the ethernet header from snap header of skb data */
2219 switch(dataFrameType)
2220 {
2221 case DATA_NULL:
2222 case QOS_DATA_NULL:
2223 /* This is for only queue info fetching, EAPOL wont come as
2224 * null data so the proto is initialized as zero
2225 */
2226 proto = 0x0;
2227 break;
2228 default:
2229 {
2230 llc_snap_hdr_t *snap;
2231 /* Fetch a snap header to find protocol (for IPV4/IPV6 packets
2232 * the snap header fetching offset is same)
2233 */
2234 snap = (llc_snap_hdr_t *) (skb->data + macHeaderLengthInBytes);
2235
2236 /* prepare the ethernet header from the snap header & addresses */
2237 ehdr.h_proto = snap->protocol;
2238 memcpy(ehdr.h_dest, da, ETH_ALEN);
2239 memcpy(ehdr.h_source, sa, ETH_ALEN);
2240 }
2241 proto = ntohs(ehdr.h_proto);
2242 }
2243 unifi_trace(priv, UDBG3, "in unifi_rx protocol from snap header = 0x%x\n", proto);
2244
2245 if ((proto != ETH_P_PAE)
2246#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
2247 && (proto != ETH_P_WAI)
2248#endif
2249 ) {
2250 queue = UF_CONTROLLED_PORT_Q;
2251 } else {
2252 queue = UF_UNCONTROLLED_PORT_Q;
2253 }
2254
2255 port_action = verify_port(priv, (unsigned char*)sa, queue, interfaceTag);
2256 unifi_trace(priv, UDBG3, "in unifi_rx port action is = 0x%x & queue = %x\n", port_action, queue);
2257
2258#ifdef CSR_SUPPORT_SME
2259 /* Notify the TA module for the Rx frame for non P2PGO and AP cases*/
2260 if((interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_AP) &&
2261 (interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_P2PGO))
2262 {
2263 /* Remove MAC header of length(macHeaderLengthInBytes) before sampling */
2264 skb_pull(skb, macHeaderLengthInBytes);
2265 pData->os_data_ptr = skb->data;
2266 pData->data_length -= macHeaderLengthInBytes;
2267
2268 if (pData->data_length) {
2269 unifi_ta_sample(priv->card, CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_RX,
2270 &bulkdata->d[0],
2271 sa, priv->netdev[interfaceTag]->dev_addr,
2272 jiffies_to_msecs(jiffies),
2273 pkt_ind->ReceivedRate);
2274 }
2275 } else {
2276
2277 /* AP/P2PGO specific handling here */
2278 CsrWifiRouterCtrlStaInfo_t * srcStaInfo =
2279 CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, sa, interfaceTag);
2280
2281 /* Defensive check only; Source address is already checked in
2282 process_ma_packet_ind and we should have a valid source address here */
2283
2284 if(srcStaInfo == NULL) {
2285 CsrWifiMacAddress peerMacAddress;
2286 /* Unknown data PDU */
2287 memcpy(peerMacAddress.a, sa, ETH_ALEN);
2288 unifi_trace(priv, UDBG1, "%s: Unexpected frame from peer = %x:%x:%x:%x:%x:%x\n", __FUNCTION__,
2289 sa[0], sa[1], sa[2], sa[3], sa[4], sa[5]);
2290 CsrWifiRouterCtrlUnexpectedFrameIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, peerMacAddress);
2291 unifi_net_data_free(priv, &bulkdata->d[0]);
2292 return;
2293 }
2294
2295 /* For AP GO mode, don't store the PDUs */
2296 if (port_action != CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN) {
2297 /* Drop the packet and return */
2298 CsrWifiMacAddress peerMacAddress;
2299 memcpy(peerMacAddress.a, sa, ETH_ALEN);
2300 unifi_trace(priv, UDBG3, "%s: Port is not open: unexpected frame from peer = %x:%x:%x:%x:%x:%x\n",
2301 __FUNCTION__, sa[0], sa[1], sa[2], sa[3], sa[4], sa[5]);
2302
2303 CsrWifiRouterCtrlUnexpectedFrameIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, peerMacAddress);
2304 interfacePriv->stats.rx_dropped++;
2305 unifi_net_data_free(priv, &bulkdata->d[0]);
2306 unifi_notice(priv, "%s: Dropping packet, proto=0x%04x, %s port\n", __FUNCTION__,
2307 proto, queue ? "Controlled" : "Un-controlled");
2308 return;
2309 }
2310
2311 /* Qos NULL/Data NULL are freed here and not processed further */
2312 if((dataFrameType == QOS_DATA_NULL) || (dataFrameType == DATA_NULL)){
2313 unifi_trace(priv, UDBG5, "%s: Null Frame Received and Freed\n", __FUNCTION__);
2314 unifi_net_data_free(priv, &bulkdata->d[0]);
2315 return;
2316 }
2317
2318 /* Now we have done with MAC header so proceed with the real data part*/
2319 /* This function takes care of appropriate routing for AP/P2PGO case*/
2320 /* the function hadnles following things
2321 2. Routing the PDU to appropriate location
2322 3. Error case handling
2323 */
2324 if(!(uf_ap_process_data_pdu(priv, skb, &ehdr, srcStaInfo,
2325 signal,
2326 bulkdata,
2327 macHeaderLengthInBytes)))
2328 {
2329 return;
2330 }
2331 unifi_trace(priv, UDBG5, "unifi_rx: no specific AP handling process as normal frame, MAC Header len %d\n", macHeaderLengthInBytes);
2332 /* Remove the MAC header for subsequent conversion */
2333 skb_pull(skb, macHeaderLengthInBytes);
2334 pData->os_data_ptr = skb->data;
2335 pData->data_length -= macHeaderLengthInBytes;
2336 pData->os_net_buf_ptr = (unsigned char*)skb;
2337 pData->net_buf_length = skb->len;
2338 }
2339#endif /* CSR_SUPPORT_SME */
2340
2341
2342 /* Now that the MAC header is removed, null-data frames have zero length
2343 * and can be dropped
2344 */
2345 if (pData->data_length == 0) {
2346 if (((frameControl & 0x00f0) >> 4) != QOS_DATA_NULL &&
2347 ((frameControl & 0x00f0) >> 4) != DATA_NULL) {
2348 unifi_trace(priv, UDBG1, "Zero length frame, but not null-data %04x\n", frameControl);
2349 }
2350 unifi_net_data_free(priv, &bulkdata->d[0]);
2351 return;
2352 }
2353
2354 if (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD) {
2355 /* Drop the packet and return */
2356 interfacePriv->stats.rx_dropped++;
2357 unifi_net_data_free(priv, &bulkdata->d[0]);
2358 unifi_notice(priv, "%s: Dropping packet, proto=0x%04x, %s port\n",
2359 __FUNCTION__, proto, queue ? "controlled" : "uncontrolled");
2360 return;
2361 } else if ( (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_BLOCK) ||
2362 (interfacePriv->connected != UnifiConnected) ) {
2363
2364 /* Buffer the packet into the Rx queues */
2365 rx_buffered_packets_t *rx_q_item;
2366 struct list_head *rx_list;
2367
2368 rx_q_item = kmalloc(sizeof(rx_buffered_packets_t),
2369 GFP_KERNEL);
2370 if (rx_q_item == NULL) {
2371 unifi_error(priv, "%s: Failed to allocate %d bytes for rx packet record\n",
2372 __FUNCTION__, sizeof(rx_buffered_packets_t));
2373 interfacePriv->stats.rx_dropped++;
2374 unifi_net_data_free(priv, &bulkdata->d[0]);
2375 return;
2376 }
2377
2378 INIT_LIST_HEAD(&rx_q_item->q);
2379 rx_q_item->bulkdata = *bulkdata;
2380 rx_q_item->skb = skb;
2381 rx_q_item->signal = *signal;
2382 memcpy(rx_q_item->sa.a, sa, ETH_ALEN);
2383 memcpy(rx_q_item->da.a, da, ETH_ALEN);
2384 unifi_trace(priv, UDBG2, "%s: Blocked skb=%p, bulkdata=%p\n",
2385 __FUNCTION__, rx_q_item->skb, &rx_q_item->bulkdata);
2386
2387 if (queue == UF_CONTROLLED_PORT_Q) {
2388 rx_list = &interfacePriv->rx_controlled_list;
2389 } else {
2390 rx_list = &interfacePriv->rx_uncontrolled_list;
2391 }
2392
2393 /* Add to tail of packets queue */
2394 down(&priv->rx_q_sem);
2395 list_add_tail(&rx_q_item->q, rx_list);
2396 up(&priv->rx_q_sem);
2397
2398 return;
2399
2400 }
2401
2402 indicate_rx_skb(priv, interfaceTag, da, sa, skb, signal, bulkdata);
2403
2404} /* unifi_rx() */
2405
2406static void process_ma_packet_cfm(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata)
2407{
2408 u16 interfaceTag;
2409 const CSR_MA_PACKET_CONFIRM *pkt_cfm = &signal->u.MaPacketConfirm;
2410 netInterface_priv_t *interfacePriv;
2411
2412 interfaceTag = (pkt_cfm->VirtualInterfaceIdentifier & 0xff);
2413 interfacePriv = priv->interfacePriv[interfaceTag];
2414
2415 /* Sanity check that the VIF refers to a sensible interface */
2416 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES)
2417 {
2418 unifi_error(priv, "%s: MA-PACKET confirm with bad interfaceTag %d\n", __FUNCTION__, interfaceTag);
2419 return;
2420 }
2421#ifdef CSR_SUPPORT_SME
2422 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
2423 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
2424
2425 uf_process_ma_pkt_cfm_for_ap(priv, interfaceTag, pkt_cfm);
2426 } else if (interfacePriv->m4_sent && (pkt_cfm->HostTag == interfacePriv->m4_hostTag)) {
2427 /* Check if this is a confirm for EAPOL M4 frame and we need to send transmistted ind*/
2428 CsrResult result = pkt_cfm->TransmissionStatus == CSR_TX_SUCCESSFUL?CSR_RESULT_SUCCESS:CSR_RESULT_FAILURE;
2429 CsrWifiMacAddress peerMacAddress;
2430 memcpy(peerMacAddress.a, interfacePriv->m4_signal.u.MaPacketRequest.Ra.x, ETH_ALEN);
2431
2432 unifi_trace(priv, UDBG1, "%s: Sending M4 Transmit CFM\n", __FUNCTION__);
2433 CsrWifiRouterCtrlM4TransmittedIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0,
2434 interfaceTag,
2435 peerMacAddress,
2436 result);
2437 interfacePriv->m4_sent = FALSE;
2438 interfacePriv->m4_hostTag = 0xffffffff;
2439 }
2440#endif
2441 return;
2442}
2443
2444
2445/*
2446 * ---------------------------------------------------------------------------
2447 * unifi_rx
2448 *
2449 * Reformat a UniFi data received packet into a p80211 packet and
2450 * pass it up the protocol stack.
2451 *
2452 * Arguments:
2453 * None.
2454 *
2455 * Returns:
2456 * None.
2457 * ---------------------------------------------------------------------------
2458 */
2459static void process_ma_packet_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata)
2460{
2461 u16 interfaceTag;
2462 bulk_data_desc_t *pData;
2463 CSR_MA_PACKET_INDICATION *pkt_ind = (CSR_MA_PACKET_INDICATION*)&signal->u.MaPacketIndication;
2464 struct sk_buff *skb;
2465 u16 frameControl;
2466 netInterface_priv_t *interfacePriv;
2467 u8 da[ETH_ALEN], sa[ETH_ALEN];
2468 u8 *bssid = NULL, *ba_addr = NULL;
2469 u8 toDs, fromDs, frameType;
2470 u8 i =0;
2471
2472#ifdef CSR_SUPPORT_SME
2473 u8 dataFrameType = 0;
2474 u8 powerSaveChanged = FALSE;
2475 u8 pmBit = 0;
2476 CsrWifiRouterCtrlStaInfo_t *srcStaInfo = NULL;
2477 u16 qosControl;
2478
2479#endif
2480
2481 interfaceTag = (pkt_ind->VirtualInterfaceIdentifier & 0xff);
2482 interfacePriv = priv->interfacePriv[interfaceTag];
2483
2484
2485 /* Sanity check that the VIF refers to a sensible interface */
2486 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES)
2487 {
2488 unifi_error(priv, "%s: MA-PACKET indication with bad interfaceTag %d\n", __FUNCTION__, interfaceTag);
2489 unifi_net_data_free(priv, &bulkdata->d[0]);
2490 return;
2491 }
2492
2493 /* Sanity check that the VIF refers to an allocated netdev */
2494 if (!interfacePriv->netdev_registered)
2495 {
2496 unifi_error(priv, "%s: MA-PACKET indication with unallocated interfaceTag %d\n", __FUNCTION__, interfaceTag);
2497 unifi_net_data_free(priv, &bulkdata->d[0]);
2498 return;
2499 }
2500
2501 if (bulkdata->d[0].data_length == 0) {
2502 unifi_warning(priv, "%s: MA-PACKET indication with zero bulk data\n", __FUNCTION__);
2503 unifi_net_data_free(priv, &bulkdata->d[0]);
2504 return;
2505 }
2506 /* For monitor mode we need to pass this indication to the registered application
2507 handle this separately*/
2508 /* MIC failure is already taken care of so no need to send the PDUs which are not successfully received in non-monitor mode*/
2509 if(pkt_ind->ReceptionStatus != CSR_RX_SUCCESS)
2510 {
2511 unifi_warning(priv, "%s: MA-PACKET indication with status = %d\n", __FUNCTION__, pkt_ind->ReceptionStatus);
2512 unifi_net_data_free(priv, &bulkdata->d[0]);
2513 return;
2514 }
2515
2516
2517 skb = (struct sk_buff*)bulkdata->d[0].os_net_buf_ptr;
2518 skb->len = bulkdata->d[0].data_length;
2519
2520 /* Point to the addresses */
2521 toDs = (skb->data[1] & 0x01) ? 1 : 0;
2522 fromDs = (skb->data[1] & 0x02) ? 1 : 0;
2523
2524 memcpy(da, (skb->data+4+toDs*12), ETH_ALEN);/* Address1 or 3 */
2525 memcpy(sa, (skb->data+10+fromDs*(6+toDs*8)), ETH_ALEN); /* Address2, 3 or 4 */
2526
2527 /* Find the BSSID, which will be used to match the BA session */
2528 if (toDs && fromDs)
2529 {
2530 unifi_trace(priv, UDBG6, "4 address frame - don't try to find BSSID\n");
2531 bssid = NULL;
2532 }
2533 else
2534 {
2535 bssid = (u8 *) (skb->data + 4 + 12 - (fromDs * 6) - (toDs * 12));
2536 }
2537
2538 pData = &bulkdata->d[0];
2539 frameControl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(pData->os_data_ptr);
2540 frameType = ((frameControl & 0x000C) >> 2);
2541
2542 unifi_trace(priv, UDBG3, "Rx Frame Type: %d sn: %d\n", frameType,
2543 (le16_to_cpu(*((u16*)(bulkdata->d[0].os_data_ptr + IEEE802_11_SEQUENCE_CONTROL_OFFSET))) >> 4) & 0xfff);
2544 if(frameType == IEEE802_11_FRAMETYPE_CONTROL){
2545#ifdef CSR_SUPPORT_SME
2546 unifi_trace(priv, UDBG6, "%s: Received Control Frame\n", __FUNCTION__);
2547
2548 if((frameControl & 0x00f0) == 0x00A0){
2549 /* This is a PS-POLL request */
2550 u8 pmBit = (frameControl & 0x1000)?0x01:0x00;
2551 unifi_trace(priv, UDBG6, "%s: Received PS-POLL Frame\n", __FUNCTION__);
2552
2553 uf_process_ps_poll(priv, sa, da, pmBit, interfaceTag);
2554 }
2555 else {
2556 unifi_warning(priv, "%s: Non PS-POLL control frame is received\n", __FUNCTION__);
2557 }
2558#endif
2559 unifi_net_data_free(priv, &bulkdata->d[0]);
2560 return;
2561 }
2562 if(frameType != IEEE802_11_FRAMETYPE_DATA) {
2563 unifi_warning(priv, "%s: Non control Non Data frame is received\n", __FUNCTION__);
2564 unifi_net_data_free(priv, &bulkdata->d[0]);
2565 return;
2566 }
2567
2568#ifdef CSR_SUPPORT_SME
2569 if((interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP) ||
2570 (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO)){
2571
2572 srcStaInfo = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, sa, interfaceTag);
2573
2574 if(srcStaInfo == NULL) {
2575 CsrWifiMacAddress peerMacAddress;
2576 /* Unknown data PDU */
2577 memcpy(peerMacAddress.a, sa, ETH_ALEN);
2578 unifi_trace(priv, UDBG1, "%s: Unexpected frame from peer = %x:%x:%x:%x:%x:%x\n", __FUNCTION__,
2579 sa[0], sa[1], sa[2], sa[3], sa[4], sa[5]);
2580 CsrWifiRouterCtrlUnexpectedFrameIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, peerMacAddress);
2581 unifi_net_data_free(priv, &bulkdata->d[0]);
2582 return;
2583 }
2584
2585 /*
2586 verify power management bit here so as to ensure host and unifi are always
2587 in sync with power management status of peer.
2588
2589 If we do it later, it may so happen we have stored the frame in BA re-ordering
2590 buffer and hence host and unifi are out of sync for power management status
2591 */
2592
2593 pmBit = (frameControl & 0x1000)?0x01:0x00;
2594 powerSaveChanged = uf_process_pm_bit_for_peer(priv, srcStaInfo, pmBit, interfaceTag);
2595
2596 /* Update station last activity time */
2597 srcStaInfo->activity_flag = TRUE;
2598
2599 /* For Qos Frame if PM bit is toggled to indicate the change in power save state then it shall not be
2600 considered as Trigger Frame. Enter only if WMM STA and peer is in Power save */
2601
2602 dataFrameType = ((frameControl & 0x00f0) >> 4);
2603
2604 if((powerSaveChanged == FALSE)&&(srcStaInfo->wmmOrQosEnabled == TRUE)&&
2605 (srcStaInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE)){
2606
2607 if((dataFrameType == QOS_DATA) || (dataFrameType == QOS_DATA_NULL)){
2608
2609 /*
2610 * QoS control field is offset from frame control by 2 (frame control)
2611 * + 2 (duration/ID) + 2 (sequence control) + 3*ETH_ALEN or 4*ETH_ALEN
2612 */
2613 if((frameControl & IEEE802_11_FC_TO_DS_MASK) && (frameControl & IEEE802_11_FC_FROM_DS_MASK)){
2614 qosControl= CSR_GET_UINT16_FROM_LITTLE_ENDIAN(pData->os_data_ptr + 30);
2615 }
2616 else{
2617 qosControl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(pData->os_data_ptr + 24);
2618 }
2619 unifi_trace(priv, UDBG5, "%s: Check if U-APSD operations are triggered for qosControl: 0x%x\n", __FUNCTION__, qosControl);
2620 uf_process_wmm_deliver_ac_uapsd(priv, srcStaInfo, qosControl, interfaceTag);
2621 }
2622 }
2623 }
2624
2625#endif
2626
2627 if( ((frameControl & 0x00f0) >> 4) == QOS_DATA) {
2628 u8 *qos_control_ptr = (u8*)bulkdata->d[0].os_data_ptr + (((frameControl & IEEE802_11_FC_TO_DS_MASK) && (frameControl & IEEE802_11_FC_FROM_DS_MASK))?30: 24);
2629 int tID = *qos_control_ptr & IEEE802_11_QC_TID_MASK; /* using ls octet of qos control */
2630 ba_session_rx_struct *ba_session;
2631 u8 ba_session_idx = 0;
2632 /* Get the BA originator address */
2633 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
2634 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO){
2635 ba_addr = sa;
2636 }else{
2637 ba_addr = bssid;
2638 }
2639
2640 down(&priv->ba_mutex);
2641 for (ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX; ba_session_idx++){
2642 ba_session = interfacePriv->ba_session_rx[ba_session_idx];
2643 if (ba_session){
2644 unifi_trace(priv, UDBG6, "found ba_session=0x%x ba_session_idx=%d", ba_session, ba_session_idx);
2645 if ((!memcmp(ba_session->macAddress.a, ba_addr, ETH_ALEN)) && (ba_session->tID == tID)){
2646 frame_desc_struct frame_desc;
2647 frame_desc.bulkdata = *bulkdata;
2648 frame_desc.signal = *signal;
2649 frame_desc.sn = (le16_to_cpu(*((u16*)(bulkdata->d[0].os_data_ptr + IEEE802_11_SEQUENCE_CONTROL_OFFSET))) >> 4) & 0xfff;
2650 frame_desc.active = TRUE;
2651 unifi_trace(priv, UDBG6, "%s: calling process_ba_frame (session=%d)\n", __FUNCTION__, ba_session_idx);
2652 process_ba_frame(priv, interfacePriv, ba_session, &frame_desc);
2653 up(&priv->ba_mutex);
2654 process_ba_complete(priv, interfacePriv);
2655 break;
2656 }
2657 }
2658 }
2659 if (ba_session_idx == MAX_SUPPORTED_BA_SESSIONS_RX){
2660 up(&priv->ba_mutex);
2661 unifi_trace(priv, UDBG6, "%s: calling process_amsdu()", __FUNCTION__);
2662 process_amsdu(priv, signal, bulkdata);
2663 }
2664 } else {
2665 unifi_trace(priv, UDBG6, "calling unifi_rx()");
2666 unifi_rx(priv, signal, bulkdata);
2667 }
2668
2669 /* check if the frames in reorder buffer has aged, the check
2670 * is done after receive processing so that if the missing frame
2671 * has arrived in this receive process, then it is handled cleanly.
2672 *
2673 * And also this code here takes care that timeout check is made for all
2674 * the receive indications
2675 */
2676 down(&priv->ba_mutex);
2677 for (i=0; i < MAX_SUPPORTED_BA_SESSIONS_RX; i++){
2678 ba_session_rx_struct *ba_session;
2679 ba_session = interfacePriv->ba_session_rx[i];
2680 if (ba_session){
2681 check_ba_frame_age_timeout(priv, interfacePriv, ba_session);
2682 }
2683 }
2684 up(&priv->ba_mutex);
2685 process_ba_complete(priv, interfacePriv);
2686
2687}
2688/*
2689 * ---------------------------------------------------------------------------
2690 * uf_set_multicast_list
2691 *
2692 * This function is called by the higher level stack to set
2693 * a list of multicast rx addresses.
2694 *
2695 * Arguments:
2696 * dev Network Device pointer.
2697 *
2698 * Returns:
2699 * None.
2700 *
2701 * Notes:
2702 * ---------------------------------------------------------------------------
2703 */
2704
2705static void
2706uf_set_multicast_list(struct net_device *dev)
2707{
2708 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
2709 unifi_priv_t *priv = interfacePriv->privPtr;
2710
2711#ifdef CSR_NATIVE_LINUX
2712 unifi_trace(priv, UDBG3, "uf_set_multicast_list unsupported\n");
2713 return;
2714#else
2715
2716 u8 *mc_list = interfacePriv->mc_list;
2717 struct netdev_hw_addr *mc_addr;
2718 int mc_addr_count;
2719
2720 if (priv->init_progress != UNIFI_INIT_COMPLETED) {
2721 return;
2722 }
2723
2724 mc_addr_count = netdev_mc_count(dev);
2725
2726 unifi_trace(priv, UDBG3,
2727 "uf_set_multicast_list (count=%d)\n", mc_addr_count);
2728
2729
2730 /* Not enough space? */
2731 if (mc_addr_count > UNIFI_MAX_MULTICAST_ADDRESSES) {
2732 return;
2733 }
2734
2735 /* Store the list to be processed by the work item. */
2736 interfacePriv->mc_list_count = mc_addr_count;
2737 netdev_hw_addr_list_for_each(mc_addr, &dev->mc) {
2738 memcpy(mc_list, mc_addr->addr, ETH_ALEN);
2739 mc_list += ETH_ALEN;
2740 }
2741
2742 /* Send a message to the workqueue */
2743 queue_work(priv->unifi_workqueue, &priv->multicast_list_task);
2744#endif
2745
2746} /* uf_set_multicast_list() */
2747
2748/*
2749 * ---------------------------------------------------------------------------
2750 * netdev_mlme_event_handler
2751 *
2752 * Callback function to be used as the udi_event_callback when registering
2753 * as a netdev client.
2754 * To use it, a client specifies this function as the udi_event_callback
2755 * to ul_register_client(). The signal dispatcher in
2756 * unifi_receive_event() will call this function to deliver a signal.
2757 *
2758 * Arguments:
2759 * pcli Pointer to the client instance.
2760 * signal Pointer to the received signal.
2761 * signal_len Size of the signal structure in bytes.
2762 * bulkdata Pointer to structure containing any associated bulk data.
2763 * dir Direction of the signal. Zero means from host,
2764 * non-zero means to host.
2765 *
2766 * Returns:
2767 * None.
2768 * ---------------------------------------------------------------------------
2769 */
2770static void
2771netdev_mlme_event_handler(ul_client_t *pcli, const u8 *sig_packed, int sig_len,
2772 const bulk_data_param_t *bulkdata_o, int dir)
2773{
2774 CSR_SIGNAL signal;
2775 unifi_priv_t *priv = uf_find_instance(pcli->instance);
2776 int id, r;
2777 bulk_data_param_t bulkdata;
2778
2779 /* Just a sanity check */
2780 if (sig_packed == NULL) {
2781 return;
2782 }
2783
2784 /*
2785 * This copy is to silence a compiler warning about discarding the
2786 * const qualifier.
2787 */
2788 bulkdata = *bulkdata_o;
2789
2790 /* Get the unpacked signal */
2791 r = read_unpack_signal(sig_packed, &signal);
2792 if (r) {
2793 /*
2794 * The CSR_MLME_CONNECTED_INDICATION_ID has a receiverID=0 so will
2795 * fall through this case. It is safe to ignore this signal.
2796 */
2797 unifi_trace(priv, UDBG1,
2798 "Netdev - Received unknown signal 0x%.4X.\n",
2799 CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sig_packed));
2800 return;
2801 }
2802
2803 id = signal.SignalPrimitiveHeader.SignalId;
2804 unifi_trace(priv, UDBG3, "Netdev - Process signal 0x%.4X\n", id);
2805
2806 /*
2807 * Take the appropriate action for the signal.
2808 */
2809 switch (id) {
2810 case CSR_MA_PACKET_ERROR_INDICATION_ID:
2811 process_ma_packet_error_ind(priv, &signal, &bulkdata);
2812 break;
2813 case CSR_MA_PACKET_INDICATION_ID:
2814 process_ma_packet_ind(priv, &signal, &bulkdata);
2815 break;
2816 case CSR_MA_PACKET_CONFIRM_ID:
2817 process_ma_packet_cfm(priv, &signal, &bulkdata);
2818 break;
2819#ifdef CSR_SUPPORT_SME
2820 case CSR_MLME_SET_TIM_CONFIRM_ID:
2821 /* Handle TIM confirms from FW & set the station record's TIM state appropriately,
2822 * In case of failures, tries with max_retransmit limit
2823 */
2824 uf_handle_tim_cfm(priv, &signal.u.MlmeSetTimConfirm, signal.SignalPrimitiveHeader.ReceiverProcessId);
2825 break;
2826#endif
2827 case CSR_DEBUG_STRING_INDICATION_ID:
2828 debug_string_indication(priv, bulkdata.d[0].os_data_ptr, bulkdata.d[0].data_length);
2829 break;
2830
2831 case CSR_DEBUG_WORD16_INDICATION_ID:
2832 debug_word16_indication(priv, &signal);
2833 break;
2834
2835 case CSR_DEBUG_GENERIC_CONFIRM_ID:
2836 case CSR_DEBUG_GENERIC_INDICATION_ID:
2837 debug_generic_indication(priv, &signal);
2838 break;
2839 default:
2840 break;
2841 }
2842
2843} /* netdev_mlme_event_handler() */
2844
2845
2846/*
2847 * ---------------------------------------------------------------------------
2848 * uf_net_get_name
2849 *
2850 * Retrieve the name (e.g. eth1) associated with this network device
2851 *
2852 * Arguments:
2853 * dev Pointer to the network device.
2854 * name Buffer to write name
2855 * len Size of buffer in bytes
2856 *
2857 * Returns:
2858 * None
2859 *
2860 * Notes:
2861 * ---------------------------------------------------------------------------
2862 */
2863void uf_net_get_name(struct net_device *dev, char *name, int len)
2864{
2865 *name = '\0';
2866 if (dev) {
2867 strlcpy(name, dev->name, (len > IFNAMSIZ) ? IFNAMSIZ : len);
2868 }
2869
2870} /* uf_net_get_name */
2871
2872#ifdef CSR_SUPPORT_WEXT
2873
2874/*
2875 * ---------------------------------------------------------------------------
2876 * uf_netdev_event
2877 *
2878 * Callback function to handle netdev state changes
2879 *
2880 * Arguments:
2881 * notif Pointer to a notifier_block.
2882 * event Event prompting notification
2883 * ptr net_device pointer
2884 *
2885 * Returns:
2886 * None
2887 *
2888 * Notes:
2889 * The event handler is global, and may occur on non-UniFi netdevs.
2890 * ---------------------------------------------------------------------------
2891 */
2892static int
2893uf_netdev_event(struct notifier_block *notif, unsigned long event, void* ptr) {
2894 struct net_device *netdev = netdev_notifier_info_to_dev(ptr);
2895 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(netdev);
2896 unifi_priv_t *priv = NULL;
2897 static const CsrWifiMacAddress broadcast_address = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}};
2898
2899 /* Check that the event is for a UniFi netdev. If it's not, the netdev_priv
2900 * structure is not safe to use.
2901 */
2902 if (uf_find_netdev_priv(interfacePriv) == -1) {
2903 unifi_trace(NULL, UDBG1, "uf_netdev_event: ignore e=%d, ptr=%p, priv=%p %s\n",
2904 event, ptr, interfacePriv, netdev->name);
2905 return 0;
2906 }
2907
2908 switch(event) {
2909 case NETDEV_CHANGE:
2910 priv = interfacePriv->privPtr;
2911 unifi_trace(priv, UDBG1, "NETDEV_CHANGE: %p %s %s waiting for it\n",
2912 ptr,
2913 netdev->name,
2914 interfacePriv->wait_netdev_change ? "" : "not");
2915
2916 if (interfacePriv->wait_netdev_change) {
2917 netif_tx_wake_all_queues(priv->netdev[interfacePriv->InterfaceTag]);
2918 interfacePriv->connected = UnifiConnected;
2919 interfacePriv->wait_netdev_change = FALSE;
2920 /* Note: passing the broadcast address here will allow anyone to attempt to join our adhoc network */
2921 uf_process_rx_pending_queue(priv, UF_UNCONTROLLED_PORT_Q, broadcast_address, 1, interfacePriv->InterfaceTag);
2922 uf_process_rx_pending_queue(priv, UF_CONTROLLED_PORT_Q, broadcast_address, 1, interfacePriv->InterfaceTag);
2923 }
2924 break;
2925
2926 default:
2927 break;
2928 }
2929 return 0;
2930}
2931
2932static struct notifier_block uf_netdev_notifier = {
2933 .notifier_call = uf_netdev_event,
2934};
2935#endif /* CSR_SUPPORT_WEXT */
2936
2937
2938static void
2939 process_amsdu(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata)
2940{
2941 u32 offset;
2942 u32 length = bulkdata->d[0].data_length;
2943 u32 subframe_length, subframe_body_length, dot11_hdr_size;
2944 u8 *ptr;
2945 bulk_data_param_t subframe_bulkdata;
2946 u8 *dot11_hdr_ptr = (u8*)bulkdata->d[0].os_data_ptr;
2947 CsrResult csrResult;
2948 u16 frameControl;
2949 u8 *qos_control_ptr;
2950
2951 frameControl = le16_to_cpu(*((u16*)dot11_hdr_ptr));
2952 qos_control_ptr = dot11_hdr_ptr + (((frameControl & IEEE802_11_FC_TO_DS_MASK) && (frameControl & IEEE802_11_FC_FROM_DS_MASK))?30: 24);
2953 if(!(*qos_control_ptr & IEEE802_11_QC_A_MSDU_PRESENT)) {
2954 unifi_trace(priv, UDBG6, "%s: calling unifi_rx()", __FUNCTION__);
2955 unifi_rx(priv, signal, bulkdata);
2956 return;
2957 }
2958 *qos_control_ptr &= ~(IEEE802_11_QC_A_MSDU_PRESENT);
2959
2960 ptr = qos_control_ptr + 2;
2961 offset = dot11_hdr_size = ptr - dot11_hdr_ptr;
2962
2963 while(length > (offset + sizeof(struct ethhdr) + sizeof(llc_snap_hdr_t))) {
2964 subframe_body_length = ntohs(((struct ethhdr*)ptr)->h_proto);
2965 if(subframe_body_length > IEEE802_11_MAX_DATA_LEN) {
2966 unifi_error(priv, "%s: bad subframe_body_length = %d\n", __FUNCTION__, subframe_body_length);
2967 break;
2968 }
2969 subframe_length = sizeof(struct ethhdr) + subframe_body_length;
2970 memset(&subframe_bulkdata, 0, sizeof(bulk_data_param_t));
2971
2972 csrResult = unifi_net_data_malloc(priv, &subframe_bulkdata.d[0], dot11_hdr_size + subframe_body_length);
2973
2974 if (csrResult != CSR_RESULT_SUCCESS) {
2975 unifi_error(priv, "%s: unifi_net_data_malloc failed\n", __FUNCTION__);
2976 break;
2977 }
2978
2979 memcpy((u8*)subframe_bulkdata.d[0].os_data_ptr, dot11_hdr_ptr, dot11_hdr_size);
2980
2981
2982 /* When to DS=0 and from DS=0, address 3 will already have BSSID so no need to re-program */
2983 if ((frameControl & IEEE802_11_FC_TO_DS_MASK) && !(frameControl & IEEE802_11_FC_FROM_DS_MASK)){
2984 memcpy((u8*)subframe_bulkdata.d[0].os_data_ptr + IEEE802_11_ADDR3_OFFSET, ((struct ethhdr*)ptr)->h_dest, ETH_ALEN);
2985 }
2986 else if (!(frameControl & IEEE802_11_FC_TO_DS_MASK) && (frameControl & IEEE802_11_FC_FROM_DS_MASK)){
2987 memcpy((u8*)subframe_bulkdata.d[0].os_data_ptr + IEEE802_11_ADDR3_OFFSET,
2988 ((struct ethhdr*)ptr)->h_source,
2989 ETH_ALEN);
2990 }
2991
2992 memcpy((u8*)subframe_bulkdata.d[0].os_data_ptr + dot11_hdr_size,
2993 ptr + sizeof(struct ethhdr),
2994 subframe_body_length);
2995 unifi_trace(priv, UDBG6, "%s: calling unifi_rx. length = %d subframe_length = %d\n", __FUNCTION__, length, subframe_length);
2996 unifi_rx(priv, signal, &subframe_bulkdata);
2997
2998 subframe_length = (subframe_length + 3)&(~0x3);
2999 ptr += subframe_length;
3000 offset += subframe_length;
3001 }
3002 unifi_net_data_free(priv, &bulkdata->d[0]);
3003}
3004
3005
3006#define SN_TO_INDEX(__ba_session, __sn) (((__sn - __ba_session->start_sn) & 0xFFF) % __ba_session->wind_size)
3007
3008
3009#define ADVANCE_EXPECTED_SN(__ba_session) \
3010{ \
3011 __ba_session->expected_sn++; \
3012 __ba_session->expected_sn &= 0xFFF; \
3013}
3014
3015#define FREE_BUFFER_SLOT(__ba_session, __index) \
3016{ \
3017 __ba_session->occupied_slots--; \
3018 __ba_session->buffer[__index].active = FALSE; \
3019 ADVANCE_EXPECTED_SN(__ba_session); \
3020}
3021
3022static void add_frame_to_ba_complete(unifi_priv_t *priv,
3023 netInterface_priv_t *interfacePriv,
3024 frame_desc_struct *frame_desc)
3025{
3026 interfacePriv->ba_complete[interfacePriv->ba_complete_index] = *frame_desc;
3027 interfacePriv->ba_complete_index++;
3028}
3029
3030
3031static void update_expected_sn(unifi_priv_t *priv,
3032 netInterface_priv_t *interfacePriv,
3033 ba_session_rx_struct *ba_session,
3034 u16 sn)
3035{
3036 int i, j;
3037 u16 gap;
3038
3039 gap = (sn - ba_session->expected_sn) & 0xFFF;
3040 unifi_trace(priv, UDBG6, "%s: process the frames up to new_expected_sn = %d gap = %d\n", __FUNCTION__, sn, gap);
3041 for(j = 0; j < gap && j < ba_session->wind_size; j++) {
3042 i = SN_TO_INDEX(ba_session, ba_session->expected_sn);
3043 unifi_trace(priv, UDBG6, "%s: process the slot index = %d\n", __FUNCTION__, i);
3044 if(ba_session->buffer[i].active) {
3045 add_frame_to_ba_complete(priv, interfacePriv, &ba_session->buffer[i]);
3046 unifi_trace(priv, UDBG6, "%s: process the frame at index = %d expected_sn = %d\n", __FUNCTION__, i, ba_session->expected_sn);
3047 FREE_BUFFER_SLOT(ba_session, i);
3048 } else {
3049 unifi_trace(priv, UDBG6, "%s: empty slot at index = %d\n", __FUNCTION__, i);
3050 ADVANCE_EXPECTED_SN(ba_session);
3051 }
3052 }
3053 ba_session->expected_sn = sn;
3054}
3055
3056
3057static void complete_ready_sequence(unifi_priv_t *priv,
3058 netInterface_priv_t *interfacePriv,
3059 ba_session_rx_struct *ba_session)
3060{
3061 int i;
3062
3063 i = SN_TO_INDEX(ba_session, ba_session->expected_sn);
3064 while (ba_session->buffer[i].active) {
3065 add_frame_to_ba_complete(priv, interfacePriv, &ba_session->buffer[i]);
3066 unifi_trace(priv, UDBG6, "%s: completed stored frame(expected_sn=%d) at i = %d\n", __FUNCTION__, ba_session->expected_sn, i);
3067 FREE_BUFFER_SLOT(ba_session, i);
3068 i = SN_TO_INDEX(ba_session, ba_session->expected_sn);
3069 }
3070}
3071
3072
3073void scroll_ba_window(unifi_priv_t *priv,
3074 netInterface_priv_t *interfacePriv,
3075 ba_session_rx_struct *ba_session,
3076 u16 sn)
3077{
3078 if(((sn - ba_session->expected_sn) & 0xFFF) <= 2048) {
3079 update_expected_sn(priv, interfacePriv, ba_session, sn);
3080 complete_ready_sequence(priv, interfacePriv, ba_session);
3081 }
3082}
3083
3084
3085static int consume_frame_or_get_buffer_index(unifi_priv_t *priv,
3086 netInterface_priv_t *interfacePriv,
3087 ba_session_rx_struct *ba_session,
3088 u16 sn,
3089 frame_desc_struct *frame_desc) {
3090 int i;
3091 u16 sn_temp;
3092
3093 if(((sn - ba_session->expected_sn) & 0xFFF) <= 2048) {
3094
3095 /* once we are in BA window, set the flag for BA trigger */
3096 if(!ba_session->trigger_ba_after_ssn){
3097 ba_session->trigger_ba_after_ssn = TRUE;
3098 }
3099
3100 sn_temp = ba_session->expected_sn + ba_session->wind_size;
3101 unifi_trace(priv, UDBG6, "%s: new frame: sn=%d\n", __FUNCTION__, sn);
3102 if(!(((sn - sn_temp) & 0xFFF) > 2048)) {
3103 u16 new_expected_sn;
3104 unifi_trace(priv, UDBG6, "%s: frame is out of window\n", __FUNCTION__);
3105 sn_temp = (sn - ba_session->wind_size) & 0xFFF;
3106 new_expected_sn = (sn_temp + 1) & 0xFFF;
3107 update_expected_sn(priv, interfacePriv, ba_session, new_expected_sn);
3108 }
3109 i = -1;
3110 if (sn == ba_session->expected_sn) {
3111 unifi_trace(priv, UDBG6, "%s: sn = ba_session->expected_sn = %d\n", __FUNCTION__, sn);
3112 ADVANCE_EXPECTED_SN(ba_session);
3113 add_frame_to_ba_complete(priv, interfacePriv, frame_desc);
3114 } else {
3115 i = SN_TO_INDEX(ba_session, sn);
3116 unifi_trace(priv, UDBG6, "%s: sn(%d) != ba_session->expected_sn(%d), i = %d\n", __FUNCTION__, sn, ba_session->expected_sn, i);
3117 if (ba_session->buffer[i].active) {
3118 unifi_trace(priv, UDBG6, "%s: free frame at i = %d\n", __FUNCTION__, i);
3119 i = -1;
3120 unifi_net_data_free(priv, &frame_desc->bulkdata.d[0]);
3121 }
3122 }
3123 } else {
3124 i = -1;
3125 if(!ba_session->trigger_ba_after_ssn){
3126 unifi_trace(priv, UDBG6, "%s: frame before ssn, pass it up: sn=%d\n", __FUNCTION__, sn);
3127 add_frame_to_ba_complete(priv, interfacePriv, frame_desc);
3128 }else{
3129 unifi_trace(priv, UDBG6, "%s: old frame, drop: sn=%d, expected_sn=%d\n", __FUNCTION__, sn, ba_session->expected_sn);
3130 unifi_net_data_free(priv, &frame_desc->bulkdata.d[0]);
3131 }
3132 }
3133 return i;
3134}
3135
3136
3137
3138static void process_ba_frame(unifi_priv_t *priv,
3139 netInterface_priv_t *interfacePriv,
3140 ba_session_rx_struct *ba_session,
3141 frame_desc_struct *frame_desc)
3142{
3143 int i;
3144 u16 sn = frame_desc->sn;
3145
3146 if (ba_session->timeout) {
3147 mod_timer(&ba_session->timer, (jiffies + usecs_to_jiffies((ba_session->timeout) * 1024)));
3148 }
3149 unifi_trace(priv, UDBG6, "%s: got frame(sn=%d)\n", __FUNCTION__, sn);
3150
3151 i = consume_frame_or_get_buffer_index(priv, interfacePriv, ba_session, sn, frame_desc);
3152 if(i >= 0) {
3153 unifi_trace(priv, UDBG6, "%s: store frame(sn=%d) at i = %d\n", __FUNCTION__, sn, i);
3154 ba_session->buffer[i] = *frame_desc;
3155 ba_session->buffer[i].recv_time = CsrTimeGet(NULL);
3156 ba_session->occupied_slots++;
3157 } else {
3158 unifi_trace(priv, UDBG6, "%s: frame consumed - sn = %d\n", __FUNCTION__, sn);
3159 }
3160 complete_ready_sequence(priv, interfacePriv, ba_session);
3161}
3162
3163
3164static void process_ba_complete(unifi_priv_t *priv, netInterface_priv_t *interfacePriv)
3165{
3166 frame_desc_struct *frame_desc;
3167 u8 i;
3168
3169 for(i = 0; i < interfacePriv->ba_complete_index; i++) {
3170 frame_desc = &interfacePriv->ba_complete[i];
3171 unifi_trace(priv, UDBG6, "%s: calling process_amsdu()\n", __FUNCTION__);
3172 process_amsdu(priv, &frame_desc->signal, &frame_desc->bulkdata);
3173 }
3174 interfacePriv->ba_complete_index = 0;
3175
3176}
3177
3178
3179/* Check if the frames in BA reoder buffer has aged and
3180 * if so release the frames to upper processes and move
3181 * the window
3182 */
3183static void check_ba_frame_age_timeout( unifi_priv_t *priv,
3184 netInterface_priv_t *interfacePriv,
3185 ba_session_rx_struct *ba_session)
3186{
3187 u32 now;
3188 u32 age;
3189 u8 i, j;
3190 u16 sn_temp;
3191
3192 /* gap is started at 1 because we have buffered frames and
3193 * hence a minimum gap of 1 exists
3194 */
3195 u8 gap=1;
3196
3197 now = CsrTimeGet(NULL);
3198
3199 if (ba_session->occupied_slots)
3200 {
3201 /* expected sequence has not arrived so start searching from next
3202 * sequence number until a frame is available and determine the gap.
3203 * Check if the frame available has timedout, if so advance the
3204 * expected sequence number and release the frames
3205 */
3206 sn_temp = (ba_session->expected_sn + 1) & 0xFFF;
3207
3208 for(j = 0; j < ba_session->wind_size; j++)
3209 {
3210 i = SN_TO_INDEX(ba_session, sn_temp);
3211
3212 if(ba_session->buffer[i].active)
3213 {
3214 unifi_trace(priv, UDBG6, "check age at slot index = %d sn = %d recv_time = %u now = %u\n",
3215 i,
3216 ba_session->buffer[i].sn,
3217 ba_session->buffer[i].recv_time,
3218 now);
3219
3220 if (ba_session->buffer[i].recv_time > now)
3221 {
3222 /* timer wrap */
3223 age = CsrTimeAdd((u32)CsrTimeSub(CSR_SCHED_TIME_MAX, ba_session->buffer[i].recv_time), now);
3224 }
3225 else
3226 {
3227 age = (u32)CsrTimeSub(now, ba_session->buffer[i].recv_time);
3228 }
3229
3230 if (age >= CSR_WIFI_BA_MPDU_FRAME_AGE_TIMEOUT)
3231 {
3232 unifi_trace(priv, UDBG2, "release the frame at index = %d gap = %d expected_sn = %d sn = %d\n",
3233 i,
3234 gap,
3235 ba_session->expected_sn,
3236 ba_session->buffer[i].sn);
3237
3238 /* if it has timedout don't wait for missing frames, move the window */
3239 while (gap--)
3240 {
3241 ADVANCE_EXPECTED_SN(ba_session);
3242 }
3243 add_frame_to_ba_complete(priv, interfacePriv, &ba_session->buffer[i]);
3244 FREE_BUFFER_SLOT(ba_session, i);
3245 complete_ready_sequence(priv, interfacePriv, ba_session);
3246 }
3247 break;
3248
3249 }
3250 else
3251 {
3252 /* advance temp sequence number and frame gap */
3253 sn_temp = (sn_temp + 1) & 0xFFF;
3254 gap++;
3255 }
3256 }
3257 }
3258}
3259
3260
3261static void process_ma_packet_error_ind(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata)
3262{
3263 u16 interfaceTag;
3264 const CSR_MA_PACKET_ERROR_INDICATION *pkt_err_ind = &signal->u.MaPacketErrorIndication;
3265 netInterface_priv_t *interfacePriv;
3266 ba_session_rx_struct *ba_session;
3267 u8 ba_session_idx = 0;
3268 CSR_PRIORITY UserPriority;
3269 CSR_SEQUENCE_NUMBER sn;
3270
3271 interfaceTag = (pkt_err_ind->VirtualInterfaceIdentifier & 0xff);
3272
3273
3274 /* Sanity check that the VIF refers to a sensible interface */
3275 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES)
3276 {
3277 unifi_error(priv, "%s: MaPacketErrorIndication indication with bad interfaceTag %d\n", __FUNCTION__, interfaceTag);
3278 return;
3279 }
3280
3281 interfacePriv = priv->interfacePriv[interfaceTag];
3282 UserPriority = pkt_err_ind->UserPriority;
3283 if(UserPriority > 15) {
3284 unifi_error(priv, "%s: MaPacketErrorIndication indication with bad UserPriority=%d\n", __FUNCTION__, UserPriority);
3285 }
3286 sn = pkt_err_ind->SequenceNumber;
3287
3288 down(&priv->ba_mutex);
3289 /* To find the right ba_session loop through the BA sessions, compare MAC address and tID */
3290 for (ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX; ba_session_idx++){
3291 ba_session = interfacePriv->ba_session_rx[ba_session_idx];
3292 if (ba_session){
3293 if ((!memcmp(ba_session->macAddress.a, pkt_err_ind->PeerQstaAddress.x, ETH_ALEN)) && (ba_session->tID == UserPriority)){
3294 if (ba_session->timeout) {
3295 mod_timer(&ba_session->timer, (jiffies + usecs_to_jiffies((ba_session->timeout) * 1024)));
3296 }
3297 scroll_ba_window(priv, interfacePriv, ba_session, sn);
3298 break;
3299 }
3300 }
3301 }
3302
3303 up(&priv->ba_mutex);
3304 process_ba_complete(priv, interfacePriv);
3305}
3306
3307
diff --git a/drivers/staging/csr/os.c b/drivers/staging/csr/os.c
deleted file mode 100644
index 37ec59df3581..000000000000
--- a/drivers/staging/csr/os.c
+++ /dev/null
@@ -1,477 +0,0 @@
1/*
2 * ---------------------------------------------------------------------------
3 * FILE: os.c
4 *
5 * PURPOSE:
6 * Routines to fulfil the OS-abstraction for the HIP lib.
7 * It is part of the porting exercise.
8 *
9 * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd.
10 *
11 * Refer to LICENSE.txt included with this source code for details on
12 * the license terms.
13 *
14 * ---------------------------------------------------------------------------
15 */
16
17/**
18 * The HIP lib OS abstraction consists of the implementation
19 * of the functions in this file. It is part of the porting exercise.
20 */
21
22#include "unifi_priv.h"
23
24
25/*
26 * ---------------------------------------------------------------------------
27 * unifi_net_data_malloc
28 *
29 * Allocate an OS specific net data buffer of "size" bytes.
30 * The bulk_data_slot.os_data_ptr must be initialised to point
31 * to the buffer allocated. The bulk_data_slot.length must be
32 * initialised to the requested size, zero otherwise.
33 * The bulk_data_slot.os_net_buf_ptr can be initialised to
34 * an OS specific pointer to be used in the unifi_net_data_free().
35 *
36 *
37 * Arguments:
38 * ospriv Pointer to device private context struct.
39 * bulk_data_slot Pointer to the bulk data structure to initialise.
40 * size Size of the buffer to be allocated.
41 *
42 * Returns:
43 * CSR_RESULT_SUCCESS on success, CSR_RESULT_FAILURE otherwise.
44 * ---------------------------------------------------------------------------
45 */
46CsrResult
47unifi_net_data_malloc(void *ospriv, bulk_data_desc_t *bulk_data_slot, unsigned int size)
48{
49 struct sk_buff *skb;
50 unifi_priv_t *priv = (unifi_priv_t*)ospriv;
51 int rounded_length;
52
53 if (priv->card_info.sdio_block_size == 0) {
54 unifi_error(priv, "unifi_net_data_malloc: Invalid SDIO block size\n");
55 return CSR_RESULT_FAILURE;
56 }
57
58 rounded_length = (size + priv->card_info.sdio_block_size - 1) & ~(priv->card_info.sdio_block_size - 1);
59
60 /*
61 * (ETH_HLEN + 2) bytes tailroom for header manipulation
62 * CSR_WIFI_ALIGN_BYTES bytes headroom for alignment manipulation
63 */
64 skb = dev_alloc_skb(rounded_length + 2 + ETH_HLEN + CSR_WIFI_ALIGN_BYTES);
65 if (! skb) {
66 unifi_error(ospriv, "alloc_skb failed.\n");
67 bulk_data_slot->os_net_buf_ptr = NULL;
68 bulk_data_slot->net_buf_length = 0;
69 bulk_data_slot->os_data_ptr = NULL;
70 bulk_data_slot->data_length = 0;
71 return CSR_RESULT_FAILURE;
72 }
73
74 bulk_data_slot->os_net_buf_ptr = (const unsigned char*)skb;
75 bulk_data_slot->net_buf_length = rounded_length + 2 + ETH_HLEN + CSR_WIFI_ALIGN_BYTES;
76 bulk_data_slot->os_data_ptr = (const void*)skb->data;
77 bulk_data_slot->data_length = size;
78
79 return CSR_RESULT_SUCCESS;
80} /* unifi_net_data_malloc() */
81
82/*
83 * ---------------------------------------------------------------------------
84 * unifi_net_data_free
85 *
86 * Free an OS specific net data buffer.
87 * The bulk_data_slot.length must be initialised to 0.
88 *
89 *
90 * Arguments:
91 * ospriv Pointer to device private context struct.
92 * bulk_data_slot Pointer to the bulk data structure that
93 * holds the data to be freed.
94 *
95 * Returns:
96 * None.
97 * ---------------------------------------------------------------------------
98 */
99void
100unifi_net_data_free(void *ospriv, bulk_data_desc_t *bulk_data_slot)
101{
102 struct sk_buff *skb;
103 CSR_UNUSED(ospriv);
104
105 skb = (struct sk_buff *)bulk_data_slot->os_net_buf_ptr;
106 dev_kfree_skb(skb);
107
108 bulk_data_slot->net_buf_length = 0;
109 bulk_data_slot->data_length = 0;
110 bulk_data_slot->os_data_ptr = bulk_data_slot->os_net_buf_ptr = NULL;
111
112} /* unifi_net_data_free() */
113
114
115/*
116* ---------------------------------------------------------------------------
117* unifi_net_dma_align
118*
119* DMA align an OS specific net data buffer.
120* The buffer must be empty.
121*
122*
123* Arguments:
124* ospriv Pointer to device private context struct.
125* bulk_data_slot Pointer to the bulk data structure that
126* holds the data to be aligned.
127*
128* Returns:
129* None.
130* ---------------------------------------------------------------------------
131*/
132CsrResult
133unifi_net_dma_align(void *ospriv, bulk_data_desc_t *bulk_data_slot)
134{
135 struct sk_buff *skb;
136 unsigned long buf_address;
137 int offset;
138 unifi_priv_t *priv = (unifi_priv_t*)ospriv;
139
140 if ((bulk_data_slot == NULL) || (CSR_WIFI_ALIGN_BYTES == 0)) {
141 return CSR_RESULT_SUCCESS;
142 }
143
144 if ((bulk_data_slot->os_data_ptr == NULL) || (bulk_data_slot->data_length == 0)) {
145 return CSR_RESULT_SUCCESS;
146 }
147
148 buf_address = (unsigned long)(bulk_data_slot->os_data_ptr) & (CSR_WIFI_ALIGN_BYTES - 1);
149
150 unifi_trace(priv, UDBG5,
151 "unifi_net_dma_align: Allign buffer (0x%p) by %d bytes\n",
152 bulk_data_slot->os_data_ptr, buf_address);
153
154 offset = CSR_WIFI_ALIGN_BYTES - buf_address;
155 if (offset < 0) {
156 unifi_error(priv, "unifi_net_dma_align: Failed (offset=%d)\n", offset);
157 return CSR_RESULT_FAILURE;
158 }
159
160 skb = (struct sk_buff*)(bulk_data_slot->os_net_buf_ptr);
161 skb_reserve(skb, offset);
162 bulk_data_slot->os_net_buf_ptr = (const unsigned char*)skb;
163 bulk_data_slot->os_data_ptr = (const void*)(skb->data);
164
165 return CSR_RESULT_SUCCESS;
166
167} /* unifi_net_dma_align() */
168
169#ifdef ANDROID_TIMESTAMP
170static volatile unsigned int printk_cpu = UINT_MAX;
171char tbuf[30];
172
173char* print_time(void )
174{
175 unsigned long long t;
176 unsigned long nanosec_rem;
177
178 t = cpu_clock(printk_cpu);
179 nanosec_rem = do_div(t, 1000000000);
180 sprintf(tbuf, "[%5lu.%06lu] ",
181 (unsigned long) t,
182 nanosec_rem / 1000);
183
184 return tbuf;
185}
186#endif
187
188
189/* Module parameters */
190extern int unifi_debug;
191
192#ifdef UNIFI_DEBUG
193#define DEBUG_BUFFER_SIZE 120
194
195#define FORMAT_TRACE(_s, _len, _args, _fmt) \
196 do { \
197 va_start(_args, _fmt); \
198 _len += vsnprintf(&(_s)[_len], \
199 (DEBUG_BUFFER_SIZE - _len), \
200 _fmt, _args); \
201 va_end(_args); \
202 if (_len >= DEBUG_BUFFER_SIZE) { \
203 (_s)[DEBUG_BUFFER_SIZE - 2] = '\n'; \
204 (_s)[DEBUG_BUFFER_SIZE - 1] = 0; \
205 } \
206 } while (0)
207
208void
209unifi_error(void* ospriv, const char *fmt, ...)
210{
211 unifi_priv_t *priv = (unifi_priv_t*) ospriv;
212 char s[DEBUG_BUFFER_SIZE];
213 va_list args;
214 unsigned int len;
215#ifdef ANDROID_TIMESTAMP
216 if (priv != NULL) {
217 len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "%s unifi%d: ", print_time(), priv->instance);
218 } else {
219 len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "%s unifi: ", print_time());
220 }
221#else
222 if (priv != NULL) {
223 len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "unifi%d: ", priv->instance);
224 } else {
225 len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "unifi: ");
226 }
227#endif /* ANDROID_TIMESTAMP */
228 FORMAT_TRACE(s, len, args, fmt);
229
230 printk("%s", s);
231}
232
233void
234unifi_warning(void* ospriv, const char *fmt, ...)
235{
236 unifi_priv_t *priv = (unifi_priv_t*) ospriv;
237 char s[DEBUG_BUFFER_SIZE];
238 va_list args;
239 unsigned int len;
240
241#ifdef ANDROID_TIMESTAMP
242 if (priv != NULL) {
243 len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_WARNING "%s unifi%d: ", print_time(), priv->instance);
244 } else {
245 len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_WARNING "%s unifi: ", print_time());
246 }
247#else
248 if (priv != NULL) {
249 len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_WARNING "unifi%d: ", priv->instance);
250 } else {
251 len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_WARNING "unifi: ");
252 }
253#endif /* ANDROID_TIMESTAMP */
254
255 FORMAT_TRACE(s, len, args, fmt);
256
257 printk("%s", s);
258}
259
260
261void
262unifi_notice(void* ospriv, const char *fmt, ...)
263{
264 unifi_priv_t *priv = (unifi_priv_t*) ospriv;
265 char s[DEBUG_BUFFER_SIZE];
266 va_list args;
267 unsigned int len;
268
269#ifdef ANDROID_TIMESTAMP
270 if (priv != NULL) {
271 len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_NOTICE "%s unifi%d: ", print_time(), priv->instance);
272 } else {
273 len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_NOTICE "%s unifi: ", print_time());
274 }
275#else
276 if (priv != NULL) {
277 len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_NOTICE "unifi%d: ", priv->instance);
278 } else {
279 len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_NOTICE "unifi: ");
280 }
281#endif /* ANDROID_TIMESTAMP */
282
283 FORMAT_TRACE(s, len, args, fmt);
284
285 printk("%s", s);
286}
287
288
289void
290unifi_info(void* ospriv, const char *fmt, ...)
291{
292 unifi_priv_t *priv = (unifi_priv_t*) ospriv;
293 char s[DEBUG_BUFFER_SIZE];
294 va_list args;
295 unsigned int len;
296
297#ifdef ANDROID_TIMESTAMP
298 if (priv != NULL) {
299 len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_INFO "%s unifi%d: ", print_time(), priv->instance);
300 } else {
301 len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_INFO "%s unifi: ", print_time());
302 }
303#else
304 if (priv != NULL) {
305 len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_INFO "unifi%d: ", priv->instance);
306 } else {
307 len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_INFO "unifi: ");
308 }
309#endif /* ANDROID_TIMESTAMP */
310
311 FORMAT_TRACE(s, len, args, fmt);
312
313 printk("%s", s);
314}
315
316/* debugging */
317void
318unifi_trace(void* ospriv, int level, const char *fmt, ...)
319{
320 unifi_priv_t *priv = (unifi_priv_t*) ospriv;
321 char s[DEBUG_BUFFER_SIZE];
322 va_list args;
323 unsigned int len;
324
325 if (unifi_debug >= level) {
326#ifdef ANDROID_TIMESTAMP
327 if (priv != NULL) {
328 len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "%s unifi%d: ", print_time(), priv->instance);
329 } else {
330 len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "%s unifi: ", print_time());
331 }
332#else
333 if (priv != NULL) {
334 len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "unifi%d: ", priv->instance);
335 } else {
336 len = snprintf(s, DEBUG_BUFFER_SIZE, KERN_ERR "unifi: ");
337 }
338#endif /* ANDROID_TIMESTAMP */
339
340 FORMAT_TRACE(s, len, args, fmt);
341
342 printk("%s", s);
343 }
344}
345
346#else
347
348void
349unifi_error_nop(void* ospriv, const char *fmt, ...)
350{
351}
352
353void
354unifi_trace_nop(void* ospriv, int level, const char *fmt, ...)
355{
356}
357
358#endif /* UNIFI_DEBUG */
359
360
361/*
362 * ---------------------------------------------------------------------------
363 *
364 * Debugging support.
365 *
366 * ---------------------------------------------------------------------------
367 */
368
369#ifdef UNIFI_DEBUG
370
371/* Memory dump with level filter controlled by unifi_debug */
372void
373unifi_dump(void *ospriv, int level, const char *msg, void *mem, u16 len)
374{
375 unifi_priv_t *priv = (unifi_priv_t*) ospriv;
376
377 if (unifi_debug >= level) {
378#ifdef ANDROID_TIMESTAMP
379 if (priv != NULL) {
380 printk(KERN_ERR "%s unifi%d: --- dump: %s ---\n", print_time(), priv->instance, msg ? msg : "");
381 } else {
382 printk(KERN_ERR "%s unifi: --- dump: %s ---\n", print_time(), msg ? msg : "");
383 }
384#else
385 if (priv != NULL) {
386 printk(KERN_ERR "unifi%d: --- dump: %s ---\n", priv->instance, msg ? msg : "");
387 } else {
388 printk(KERN_ERR "unifi: --- dump: %s ---\n", msg ? msg : "");
389 }
390#endif /* ANDROID_TIMESTAMP */
391 dump(mem, len);
392
393 if (priv != NULL) {
394 printk(KERN_ERR "unifi%d: --- end of dump ---\n", priv->instance);
395 } else {
396 printk(KERN_ERR "unifi: --- end of dump ---\n");
397 }
398 }
399}
400
401/* Memory dump that appears all the time, use sparingly */
402void
403dump(void *mem, u16 len)
404{
405 int i, col = 0;
406 unsigned char *pdata = (unsigned char *)mem;
407#ifdef ANDROID_TIMESTAMP
408 printk("timestamp %s \n", print_time());
409#endif /* ANDROID_TIMESTAMP */
410 if (mem == NULL) {
411 printk("(null dump)\n");
412 return;
413 }
414 for (i = 0; i < len; i++) {
415 if (col == 0)
416 printk("0x%02X: ", i);
417
418 printk(" %02X", pdata[i]);
419
420 if (++col == 16) {
421 printk("\n");
422 col = 0;
423 }
424 }
425 if (col)
426 printk("\n");
427} /* dump() */
428
429
430void
431dump16(void *mem, u16 len)
432{
433 int i, col=0;
434 unsigned short *p = (unsigned short *)mem;
435#ifdef ANDROID_TIMESTAMP
436 printk("timestamp %s \n", print_time());
437#endif /* ANDROID_TIMESTAMP */
438 for (i = 0; i < len; i+=2) {
439 if (col == 0)
440 printk("0x%02X: ", i);
441
442 printk(" %04X", *p++);
443
444 if (++col == 8) {
445 printk("\n");
446 col = 0;
447 }
448 }
449 if (col)
450 printk("\n");
451}
452
453
454#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
455void
456dump_str(void *mem, u16 len)
457{
458 int i;
459 unsigned char *pdata = (unsigned char *)mem;
460#ifdef ANDROID_TIMESTAMP
461 printk("timestamp %s \n", print_time());
462#endif /* ANDROID_TIMESTAMP */
463 for (i = 0; i < len; i++) {
464 printk("%c", pdata[i]);
465 }
466 printk("\n");
467
468} /* dump_str() */
469#endif /* CSR_ONLY_NOTES */
470
471
472#endif /* UNIFI_DEBUG */
473
474
475/* ---------------------------------------------------------------------------
476 * - End -
477 * ------------------------------------------------------------------------- */
diff --git a/drivers/staging/csr/putest.c b/drivers/staging/csr/putest.c
deleted file mode 100644
index 5613cf0e16b0..000000000000
--- a/drivers/staging/csr/putest.c
+++ /dev/null
@@ -1,685 +0,0 @@
1/*
2 * ***************************************************************************
3 * FILE: putest.c
4 *
5 * PURPOSE: putest related functions.
6 *
7 * Copyright (C) 2008-2009 by Cambridge Silicon Radio Ltd.
8 *
9 * Refer to LICENSE.txt included with this source code for details on
10 * the license terms.
11 *
12 * ***************************************************************************
13 */
14
15#include <linux/vmalloc.h>
16#include <linux/firmware.h>
17
18#include "unifi_priv.h"
19#include "csr_wifi_hip_chiphelper.h"
20
21#define UNIFI_PROC_BOTH 3
22
23
24int unifi_putest_cmd52_read(unifi_priv_t *priv, unsigned char *arg)
25{
26 struct unifi_putest_cmd52 cmd52_params;
27 u8 *arg_pos;
28 unsigned int cmd_param_size;
29 int r;
30 CsrResult csrResult;
31 unsigned char ret_buffer[32];
32 u8 *ret_buffer_pos;
33 u8 retries;
34
35 arg_pos = (u8*)(((unifi_putest_command_t*)arg) + 1);
36 if (get_user(cmd_param_size, (int*)arg_pos)) {
37 unifi_error(priv,
38 "unifi_putest_cmd52_read: Failed to get the argument\n");
39 return -EFAULT;
40 }
41
42 if (cmd_param_size != sizeof(struct unifi_putest_cmd52)) {
43 unifi_error(priv,
44 "unifi_putest_cmd52_read: cmd52 struct mismatch\n");
45 return -EINVAL;
46 }
47
48 arg_pos += sizeof(unsigned int);
49 if (copy_from_user(&cmd52_params,
50 (void*)arg_pos,
51 sizeof(struct unifi_putest_cmd52))) {
52 unifi_error(priv,
53 "unifi_putest_cmd52_read: Failed to get the cmd52 params\n");
54 return -EFAULT;
55 }
56
57 unifi_trace(priv, UDBG2, "cmd52r: func=%d addr=0x%x ",
58 cmd52_params.funcnum, cmd52_params.addr);
59
60 retries = 3;
61 CsrSdioClaim(priv->sdio);
62 do {
63 if (cmd52_params.funcnum == 0) {
64 csrResult = CsrSdioF0Read8(priv->sdio, cmd52_params.addr, &cmd52_params.data);
65 } else {
66 csrResult = CsrSdioRead8(priv->sdio, cmd52_params.addr, &cmd52_params.data);
67 }
68 } while (--retries && ((csrResult == CSR_SDIO_RESULT_CRC_ERROR) || (csrResult == CSR_SDIO_RESULT_TIMEOUT)));
69 CsrSdioRelease(priv->sdio);
70
71 if (csrResult != CSR_RESULT_SUCCESS) {
72 unifi_error(priv,
73 "\nunifi_putest_cmd52_read: Read8() failed (csrResult=0x%x)\n", csrResult);
74 return -EFAULT;
75 }
76 unifi_trace(priv, UDBG2, "data=%d\n", cmd52_params.data);
77
78 /* Copy the info to the out buffer */
79 *(unifi_putest_command_t*)ret_buffer = UNIFI_PUTEST_CMD52_READ;
80 ret_buffer_pos = (u8*)(((unifi_putest_command_t*)ret_buffer) + 1);
81 *(unsigned int*)ret_buffer_pos = sizeof(struct unifi_putest_cmd52);
82 ret_buffer_pos += sizeof(unsigned int);
83 memcpy(ret_buffer_pos, &cmd52_params, sizeof(struct unifi_putest_cmd52));
84 ret_buffer_pos += sizeof(struct unifi_putest_cmd52);
85
86 r = copy_to_user((void*)arg,
87 ret_buffer,
88 ret_buffer_pos - ret_buffer);
89 if (r) {
90 unifi_error(priv,
91 "unifi_putest_cmd52_read: Failed to return the data\n");
92 return -EFAULT;
93 }
94
95 return 0;
96}
97
98
99int unifi_putest_cmd52_write(unifi_priv_t *priv, unsigned char *arg)
100{
101 struct unifi_putest_cmd52 cmd52_params;
102 u8 *arg_pos;
103 unsigned int cmd_param_size;
104 CsrResult csrResult;
105 u8 retries;
106
107 arg_pos = (u8*)(((unifi_putest_command_t*)arg) + 1);
108 if (get_user(cmd_param_size, (int*)arg_pos)) {
109 unifi_error(priv,
110 "unifi_putest_cmd52_write: Failed to get the argument\n");
111 return -EFAULT;
112 }
113
114 if (cmd_param_size != sizeof(struct unifi_putest_cmd52)) {
115 unifi_error(priv,
116 "unifi_putest_cmd52_write: cmd52 struct mismatch\n");
117 return -EINVAL;
118 }
119
120 arg_pos += sizeof(unsigned int);
121 if (copy_from_user(&cmd52_params,
122 (void*)(arg_pos),
123 sizeof(struct unifi_putest_cmd52))) {
124 unifi_error(priv,
125 "unifi_putest_cmd52_write: Failed to get the cmd52 params\n");
126 return -EFAULT;
127 }
128
129 unifi_trace(priv, UDBG2, "cmd52w: func=%d addr=0x%x data=%d\n",
130 cmd52_params.funcnum, cmd52_params.addr, cmd52_params.data);
131
132 retries = 3;
133 CsrSdioClaim(priv->sdio);
134 do {
135 if (cmd52_params.funcnum == 0) {
136 csrResult = CsrSdioF0Write8(priv->sdio, cmd52_params.addr, cmd52_params.data);
137 } else {
138 csrResult = CsrSdioWrite8(priv->sdio, cmd52_params.addr, cmd52_params.data);
139 }
140 } while (--retries && ((csrResult == CSR_SDIO_RESULT_CRC_ERROR) || (csrResult == CSR_SDIO_RESULT_TIMEOUT)));
141 CsrSdioRelease(priv->sdio);
142
143 if (csrResult != CSR_RESULT_SUCCESS) {
144 unifi_error(priv,
145 "unifi_putest_cmd52_write: Write8() failed (csrResult=0x%x)\n", csrResult);
146 return -EFAULT;
147 }
148
149 return 0;
150}
151
152int unifi_putest_gp_read16(unifi_priv_t *priv, unsigned char *arg)
153{
154 struct unifi_putest_gp_rw16 gp_r16_params;
155 u8 *arg_pos;
156 unsigned int cmd_param_size;
157 int r;
158 CsrResult csrResult;
159 unsigned char ret_buffer[32];
160 u8 *ret_buffer_pos;
161
162 arg_pos = (u8*)(((unifi_putest_command_t*)arg) + 1);
163 if (get_user(cmd_param_size, (int*)arg_pos)) {
164 unifi_error(priv,
165 "unifi_putest_gp_read16: Failed to get the argument\n");
166 return -EFAULT;
167 }
168
169 if (cmd_param_size != sizeof(struct unifi_putest_gp_rw16)) {
170 unifi_error(priv,
171 "unifi_putest_gp_read16: struct mismatch\n");
172 return -EINVAL;
173 }
174
175 arg_pos += sizeof(unsigned int);
176 if (copy_from_user(&gp_r16_params,
177 (void*)arg_pos,
178 sizeof(struct unifi_putest_gp_rw16))) {
179 unifi_error(priv,
180 "unifi_putest_gp_read16: Failed to get the params\n");
181 return -EFAULT;
182 }
183 CsrSdioClaim(priv->sdio);
184 csrResult = unifi_card_read16(priv->card, gp_r16_params.addr, &gp_r16_params.data);
185 CsrSdioRelease(priv->sdio);
186 if (csrResult != CSR_RESULT_SUCCESS) {
187 unifi_error(priv,
188 "unifi_putest_gp_read16: unifi_card_read16() GP=0x%x failed (csrResult=0x%x)\n", gp_r16_params.addr, csrResult);
189 return -EFAULT;
190 }
191
192 unifi_trace(priv, UDBG2, "gp_r16: GP=0x%08x, data=0x%04x\n", gp_r16_params.addr, gp_r16_params.data);
193
194 /* Copy the info to the out buffer */
195 *(unifi_putest_command_t*)ret_buffer = UNIFI_PUTEST_GP_READ16;
196 ret_buffer_pos = (u8*)(((unifi_putest_command_t*)ret_buffer) + 1);
197 *(unsigned int*)ret_buffer_pos = sizeof(struct unifi_putest_gp_rw16);
198 ret_buffer_pos += sizeof(unsigned int);
199 memcpy(ret_buffer_pos, &gp_r16_params, sizeof(struct unifi_putest_gp_rw16));
200 ret_buffer_pos += sizeof(struct unifi_putest_gp_rw16);
201
202 r = copy_to_user((void*)arg,
203 ret_buffer,
204 ret_buffer_pos - ret_buffer);
205 if (r) {
206 unifi_error(priv,
207 "unifi_putest_gp_read16: Failed to return the data\n");
208 return -EFAULT;
209 }
210
211 return 0;
212}
213
214int unifi_putest_gp_write16(unifi_priv_t *priv, unsigned char *arg)
215{
216 struct unifi_putest_gp_rw16 gp_w16_params;
217 u8 *arg_pos;
218 unsigned int cmd_param_size;
219 CsrResult csrResult;
220
221 arg_pos = (u8*)(((unifi_putest_command_t*)arg) + 1);
222 if (get_user(cmd_param_size, (int*)arg_pos)) {
223 unifi_error(priv,
224 "unifi_putest_gp_write16: Failed to get the argument\n");
225 return -EFAULT;
226 }
227
228 if (cmd_param_size != sizeof(struct unifi_putest_gp_rw16)) {
229 unifi_error(priv,
230 "unifi_putest_gp_write16: struct mismatch\n");
231 return -EINVAL;
232 }
233
234 arg_pos += sizeof(unsigned int);
235 if (copy_from_user(&gp_w16_params,
236 (void*)(arg_pos),
237 sizeof(struct unifi_putest_gp_rw16))) {
238 unifi_error(priv,
239 "unifi_putest_gp_write16: Failed to get the params\n");
240 return -EFAULT;
241 }
242
243 unifi_trace(priv, UDBG2, "gp_w16: GP=0x%08x, data=0x%04x\n", gp_w16_params.addr, gp_w16_params.data);
244 CsrSdioClaim(priv->sdio);
245 csrResult = unifi_card_write16(priv->card, gp_w16_params.addr, gp_w16_params.data);
246 CsrSdioRelease(priv->sdio);
247 if (csrResult != CSR_RESULT_SUCCESS) {
248 unifi_error(priv,
249 "unifi_putest_gp_write16: unifi_card_write16() GP=%x failed (csrResult=0x%x)\n", gp_w16_params.addr, csrResult);
250 return -EFAULT;
251 }
252
253 return 0;
254}
255
256int unifi_putest_set_sdio_clock(unifi_priv_t *priv, unsigned char *arg)
257{
258 int sdio_clock_speed;
259 CsrResult csrResult;
260
261 if (get_user(sdio_clock_speed, (int*)(((unifi_putest_command_t*)arg) + 1))) {
262 unifi_error(priv,
263 "unifi_putest_set_sdio_clock: Failed to get the argument\n");
264 return -EFAULT;
265 }
266
267 unifi_trace(priv, UDBG2, "set sdio clock: %d KHz\n", sdio_clock_speed);
268
269 CsrSdioClaim(priv->sdio);
270 csrResult = CsrSdioMaxBusClockFrequencySet(priv->sdio, sdio_clock_speed * 1000);
271 CsrSdioRelease(priv->sdio);
272 if (csrResult != CSR_RESULT_SUCCESS) {
273 unifi_error(priv,
274 "unifi_putest_set_sdio_clock: Set clock failed (csrResult=0x%x)\n", csrResult);
275 return -EFAULT;
276 }
277
278 return 0;
279}
280
281
282int unifi_putest_start(unifi_priv_t *priv, unsigned char *arg)
283{
284 int r;
285 CsrResult csrResult;
286 int already_in_test = priv->ptest_mode;
287
288 /* Ensure that sme_sys_suspend() doesn't power down the chip because:
289 * 1) Power is needed anyway for ptest.
290 * 2) The app code uses the START ioctl as a reset, so it gets called
291 * multiple times. If the app stops the XAPs, but the power_down/up
292 * sequence doesn't actually power down the chip, there can be problems
293 * resetting, because part of the power_up sequence disables function 1
294 */
295 priv->ptest_mode = 1;
296
297 /* Suspend the SME and UniFi */
298 if (priv->sme_cli) {
299 r = sme_sys_suspend(priv);
300 if (r) {
301 unifi_error(priv,
302 "unifi_putest_start: failed to suspend UniFi\n");
303 return r;
304 }
305 }
306
307 /* Application may have stopped the XAPs, but they are needed for reset */
308 if (already_in_test) {
309 CsrSdioClaim(priv->sdio);
310 csrResult = unifi_start_processors(priv->card);
311 CsrSdioRelease(priv->sdio);
312 if (csrResult != CSR_RESULT_SUCCESS) {
313 unifi_error(priv, "Failed to start XAPs. Hard reset required.\n");
314 }
315 } else {
316 /* Ensure chip is powered for the case where there's no unifi_helper */
317 CsrSdioClaim(priv->sdio);
318 csrResult = CsrSdioPowerOn(priv->sdio);
319 CsrSdioRelease(priv->sdio);
320 if (csrResult != CSR_RESULT_SUCCESS) {
321 unifi_error(priv, "CsrSdioPowerOn csrResult = %d\n", csrResult);
322 }
323 }
324 CsrSdioClaim(priv->sdio);
325 csrResult = unifi_init(priv->card);
326 CsrSdioRelease(priv->sdio);
327 if (csrResult != CSR_RESULT_SUCCESS) {
328 unifi_error(priv,
329 "unifi_putest_start: failed to init UniFi\n");
330 return CsrHipResultToStatus(csrResult);
331 }
332
333 return 0;
334}
335
336
337int unifi_putest_stop(unifi_priv_t *priv, unsigned char *arg)
338{
339 int r = 0;
340 CsrResult csrResult;
341
342 /* Application may have stopped the XAPs, but they are needed for reset */
343 CsrSdioClaim(priv->sdio);
344 csrResult = unifi_start_processors(priv->card);
345 CsrSdioRelease(priv->sdio);
346 if (csrResult != CSR_RESULT_SUCCESS) {
347 unifi_error(priv, "Failed to start XAPs. Hard reset required.\n");
348 }
349
350 /* PUTEST_STOP is also used to resume the XAPs after SME coredump.
351 * Don't power off the chip, leave that to the normal wifi-off which is
352 * about to carry on. No need to resume the SME either, as it wasn't suspended.
353 */
354 if (priv->coredump_mode) {
355 priv->coredump_mode = 0;
356 return 0;
357 }
358
359 /* At this point function 1 is enabled and the XAPs are running, so it is
360 * safe to let the card power down. Power is restored later, asynchronously,
361 * during the wifi_on requested by the SME.
362 */
363 CsrSdioClaim(priv->sdio);
364 CsrSdioPowerOff(priv->sdio);
365 CsrSdioRelease(priv->sdio);
366
367 /* Resume the SME and UniFi */
368 if (priv->sme_cli) {
369 r = sme_sys_resume(priv);
370 if (r) {
371 unifi_error(priv,
372 "unifi_putest_stop: failed to resume SME\n");
373 }
374 }
375 priv->ptest_mode = 0;
376
377 return r;
378}
379
380
381int unifi_putest_dl_fw(unifi_priv_t *priv, unsigned char *arg)
382{
383#define UF_PUTEST_MAX_FW_FILE_NAME 16
384#define UNIFI_MAX_FW_PATH_LEN 32
385 unsigned int fw_name_length;
386 unsigned char fw_name[UF_PUTEST_MAX_FW_FILE_NAME+1];
387 unsigned char *name_buffer;
388 int postfix;
389 char fw_path[UNIFI_MAX_FW_PATH_LEN];
390 const struct firmware *fw_entry;
391 struct dlpriv temp_fw_sta;
392 int r;
393 CsrResult csrResult;
394
395 /* Get the f/w file name length */
396 if (get_user(fw_name_length, (unsigned int*)(((unifi_putest_command_t*)arg) + 1))) {
397 unifi_error(priv,
398 "unifi_putest_dl_fw: Failed to get the length argument\n");
399 return -EFAULT;
400 }
401
402 unifi_trace(priv, UDBG2, "unifi_putest_dl_fw: file name size = %d\n", fw_name_length);
403
404 /* Sanity check for the f/w file name length */
405 if (fw_name_length > UF_PUTEST_MAX_FW_FILE_NAME) {
406 unifi_error(priv,
407 "unifi_putest_dl_fw: F/W file name is too long\n");
408 return -EINVAL;
409 }
410
411 /* Get the f/w file name */
412 name_buffer = ((unsigned char*)arg) + sizeof(unifi_putest_command_t) + sizeof(unsigned int);
413 if (copy_from_user(fw_name, (void*)name_buffer, fw_name_length)) {
414 unifi_error(priv, "unifi_putest_dl_fw: Failed to get the file name\n");
415 return -EFAULT;
416 }
417 fw_name[fw_name_length] = '\0';
418 unifi_trace(priv, UDBG2, "unifi_putest_dl_fw: file = %s\n", fw_name);
419
420 /* Keep the existing f/w to a temp, we need to restore it later */
421 temp_fw_sta = priv->fw_sta;
422
423 /* Get the putest f/w */
424 postfix = priv->instance;
425 scnprintf(fw_path, UNIFI_MAX_FW_PATH_LEN, "unifi-sdio-%d/%s",
426 postfix, fw_name);
427 r = request_firmware(&fw_entry, fw_path, priv->unifi_device);
428 if (r == 0) {
429 priv->fw_sta.fw_desc = (void *)fw_entry;
430 priv->fw_sta.dl_data = fw_entry->data;
431 priv->fw_sta.dl_len = fw_entry->size;
432 } else {
433 unifi_error(priv, "Firmware file not available\n");
434 return -EINVAL;
435 }
436
437 /* Application may have stopped the XAPs, but they are needed for reset */
438 CsrSdioClaim(priv->sdio);
439 csrResult = unifi_start_processors(priv->card);
440 CsrSdioRelease(priv->sdio);
441 if (csrResult != CSR_RESULT_SUCCESS) {
442 unifi_error(priv, "Failed to start XAPs. Hard reset required.\n");
443 }
444
445 /* Download the f/w. On UF6xxx this will cause the f/w file to convert
446 * into patch format and download via the ROM boot loader
447 */
448 CsrSdioClaim(priv->sdio);
449 csrResult = unifi_download(priv->card, 0x0c00);
450 CsrSdioRelease(priv->sdio);
451 if (csrResult != CSR_RESULT_SUCCESS) {
452 unifi_error(priv,
453 "unifi_putest_dl_fw: failed to download the f/w\n");
454 goto free_fw;
455 }
456
457 /* Free the putest f/w... */
458free_fw:
459 uf_release_firmware(priv, &priv->fw_sta);
460 /* ... and restore the original f/w */
461 priv->fw_sta = temp_fw_sta;
462
463 return CsrHipResultToStatus(csrResult);
464}
465
466
467int unifi_putest_dl_fw_buff(unifi_priv_t *priv, unsigned char *arg)
468{
469 unsigned int fw_length;
470 unsigned char *fw_buf = NULL;
471 unsigned char *fw_user_ptr;
472 struct dlpriv temp_fw_sta;
473 CsrResult csrResult;
474
475 /* Get the f/w buffer length */
476 if (get_user(fw_length, (unsigned int*)(((unifi_putest_command_t*)arg) + 1))) {
477 unifi_error(priv,
478 "unifi_putest_dl_fw_buff: Failed to get the length arg\n");
479 return -EFAULT;
480 }
481
482 unifi_trace(priv, UDBG2, "unifi_putest_dl_fw_buff: size = %d\n", fw_length);
483
484 /* Sanity check for the buffer length */
485 if (fw_length == 0 || fw_length > 0xfffffff) {
486 unifi_error(priv,
487 "unifi_putest_dl_fw_buff: buffer length bad %u\n", fw_length);
488 return -EINVAL;
489 }
490
491 /* Buffer for kernel copy of the f/w image */
492 fw_buf = kmalloc(fw_length, GFP_KERNEL);
493 if (!fw_buf) {
494 unifi_error(priv, "unifi_putest_dl_fw_buff: malloc fail\n");
495 return -ENOMEM;
496 }
497
498 /* Get the f/w image */
499 fw_user_ptr = ((unsigned char*)arg) + sizeof(unifi_putest_command_t) + sizeof(unsigned int);
500 if (copy_from_user(fw_buf, (void*)fw_user_ptr, fw_length)) {
501 unifi_error(priv, "unifi_putest_dl_fw_buff: Failed to get the buffer\n");
502 kfree(fw_buf);
503 return -EFAULT;
504 }
505
506 /* Save the existing f/w to a temp, we need to restore it later */
507 temp_fw_sta = priv->fw_sta;
508
509 /* Setting fw_desc NULL indicates to the core that no f/w file was loaded
510 * via the kernel request_firmware() mechanism. This indicates to the core
511 * that it shouldn't call release_firmware() after the download is done.
512 */
513 priv->fw_sta.fw_desc = NULL; /* No OS f/w resource */
514 priv->fw_sta.dl_data = fw_buf;
515 priv->fw_sta.dl_len = fw_length;
516
517 /* Application may have stopped the XAPs, but they are needed for reset */
518 CsrSdioClaim(priv->sdio);
519 csrResult = unifi_start_processors(priv->card);
520 CsrSdioRelease(priv->sdio);
521 if (csrResult != CSR_RESULT_SUCCESS) {
522 unifi_error(priv, "Failed to start XAPs. Hard reset required.\n");
523 }
524
525 /* Download the f/w. On UF6xxx this will cause the f/w file to convert
526 * into patch format and download via the ROM boot loader
527 */
528 CsrSdioClaim(priv->sdio);
529 csrResult = unifi_download(priv->card, 0x0c00);
530 CsrSdioRelease(priv->sdio);
531 if (csrResult != CSR_RESULT_SUCCESS) {
532 unifi_error(priv,
533 "unifi_putest_dl_fw_buff: failed to download the f/w\n");
534 goto free_fw;
535 }
536
537free_fw:
538 /* Finished with the putest f/w, so restore the station f/w */
539 priv->fw_sta = temp_fw_sta;
540 kfree(fw_buf);
541
542 return CsrHipResultToStatus(csrResult);
543}
544
545
546int unifi_putest_coredump_prepare(unifi_priv_t *priv, unsigned char *arg)
547{
548 u16 data_u16;
549 s32 i;
550 CsrResult r;
551
552 unifi_info(priv, "Preparing for SDIO coredump\n");
553#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE)
554 unifi_debug_buf_dump();
555#endif
556
557 /* Sanity check that userspace hasn't called a PUTEST_START, because that
558 * would have reset UniFi, potentially power cycling it and losing context
559 */
560 if (priv->ptest_mode) {
561 unifi_error(priv, "PUTEST_START shouldn't be used before a coredump\n");
562 }
563
564 /* Flag that the userspace has requested coredump. Even if this preparation
565 * fails, the SME will call PUTEST_STOP to tidy up.
566 */
567 priv->coredump_mode = 1;
568
569 for (i = 0; i < 3; i++) {
570 CsrSdioClaim(priv->sdio);
571 r = CsrSdioRead16(priv->sdio, CHIP_HELPER_UNIFI_GBL_CHIP_VERSION*2, &data_u16);
572 CsrSdioRelease(priv->sdio);
573 if (r != CSR_RESULT_SUCCESS) {
574 unifi_info(priv, "Failed to read chip version! Try %d\n", i);
575
576 /* First try, re-enable function which may have been disabled by f/w panic */
577 if (i == 0) {
578 unifi_info(priv, "Try function enable\n");
579 CsrSdioClaim(priv->sdio);
580 r = CsrSdioFunctionEnable(priv->sdio);
581 CsrSdioRelease(priv->sdio);
582 if (r != CSR_RESULT_SUCCESS) {
583 unifi_error(priv, "CsrSdioFunctionEnable failed %d\n", r);
584 }
585 continue;
586 }
587
588 /* Subsequent tries, reset */
589
590 /* Set clock speed low */
591 CsrSdioClaim(priv->sdio);
592 r = CsrSdioMaxBusClockFrequencySet(priv->sdio, UNIFI_SDIO_CLOCK_SAFE_HZ);
593 CsrSdioRelease(priv->sdio);
594 if (r != CSR_RESULT_SUCCESS) {
595 unifi_error(priv, "CsrSdioMaxBusClockFrequencySet() failed %d\n", r);
596 }
597
598 /* Card software reset */
599 CsrSdioClaim(priv->sdio);
600 r = unifi_card_hard_reset(priv->card);
601 CsrSdioRelease(priv->sdio);
602 if (r != CSR_RESULT_SUCCESS) {
603 unifi_error(priv, "unifi_card_hard_reset() failed %d\n", r);
604 }
605 } else {
606 unifi_info(priv, "Read chip version of 0x%04x\n", data_u16);
607 break;
608 }
609 }
610
611 if (r != CSR_RESULT_SUCCESS) {
612 unifi_error(priv, "Failed to prepare chip\n");
613 return -EIO;
614 }
615
616 /* Stop the XAPs for coredump. The PUTEST_STOP must be called, e.g. at
617 * Raw SDIO deinit, to resume them.
618 */
619 CsrSdioClaim(priv->sdio);
620 r = unifi_card_stop_processor(priv->card, UNIFI_PROC_BOTH);
621 CsrSdioRelease(priv->sdio);
622 if (r != CSR_RESULT_SUCCESS) {
623 unifi_error(priv, "Failed to stop processors\n");
624 }
625
626 return 0;
627}
628
629int unifi_putest_cmd52_block_read(unifi_priv_t *priv, unsigned char *arg)
630{
631 struct unifi_putest_block_cmd52_r block_cmd52;
632 u8 *arg_pos;
633 unsigned int cmd_param_size;
634 CsrResult r;
635 u8 *block_local_buffer;
636
637 arg_pos = (u8*)(((unifi_putest_command_t*)arg) + 1);
638 if (get_user(cmd_param_size, (int*)arg_pos)) {
639 unifi_error(priv,
640 "cmd52r_block: Failed to get the argument\n");
641 return -EFAULT;
642 }
643
644 if (cmd_param_size != sizeof(struct unifi_putest_block_cmd52_r)) {
645 unifi_error(priv,
646 "cmd52r_block: cmd52 struct mismatch\n");
647 return -EINVAL;
648 }
649
650 arg_pos += sizeof(unsigned int);
651 if (copy_from_user(&block_cmd52,
652 (void*)arg_pos,
653 sizeof(struct unifi_putest_block_cmd52_r))) {
654 unifi_error(priv,
655 "cmd52r_block: Failed to get the cmd52 params\n");
656 return -EFAULT;
657 }
658
659 unifi_trace(priv, UDBG2, "cmd52r_block: func=%d addr=0x%x len=0x%x ",
660 block_cmd52.funcnum, block_cmd52.addr, block_cmd52.length);
661
662 block_local_buffer = vmalloc(block_cmd52.length);
663 if (block_local_buffer == NULL) {
664 unifi_error(priv, "cmd52r_block: Failed to allocate buffer\n");
665 return -ENOMEM;
666 }
667
668 CsrSdioClaim(priv->sdio);
669 r = unifi_card_readn(priv->card, block_cmd52.addr, block_local_buffer, block_cmd52.length);
670 CsrSdioRelease(priv->sdio);
671 if (r != CSR_RESULT_SUCCESS) {
672 unifi_error(priv, "cmd52r_block: unifi_readn failed\n");
673 return -EIO;
674 }
675
676 if (copy_to_user((void*)block_cmd52.data,
677 block_local_buffer,
678 block_cmd52.length)) {
679 unifi_error(priv,
680 "cmd52r_block: Failed to return the data\n");
681 return -EFAULT;
682 }
683
684 return 0;
685}
diff --git a/drivers/staging/csr/sdio_events.c b/drivers/staging/csr/sdio_events.c
deleted file mode 100644
index 2a80b9eb0200..000000000000
--- a/drivers/staging/csr/sdio_events.c
+++ /dev/null
@@ -1,134 +0,0 @@
1/*
2 * ---------------------------------------------------------------------------
3 * FILE: sdio_events.c
4 *
5 * PURPOSE:
6 * Process the events received by the SDIO glue layer.
7 * Optional part of the porting exercise.
8 *
9 * Copyright (C) 2009 by Cambridge Silicon Radio Ltd.
10 *
11 * Refer to LICENSE.txt included with this source code for details on
12 * the license terms.
13 *
14 * ---------------------------------------------------------------------------
15 */
16#include "unifi_priv.h"
17
18
19/*
20 * Porting Notes:
21 * There are two ways to support the suspend/resume system events in a driver.
22 * In some operating systems these events are delivered to the OS driver
23 * directly from the system. In this case, the OS driver needs to pass these
24 * events to the API described in the CSR SDIO Abstration API document.
25 * In Linux, and other embedded operating systems, the suspend/resume events
26 * come from the SDIO driver. In this case, simply get these events in the
27 * SDIO glue layer and notify the OS layer.
28 *
29 * In either case, typically, the events are processed by the SME.
30 * Use the unifi_sys_suspend_ind() and unifi_sys_resume_ind() to pass
31 * the events to the SME.
32 */
33
34/*
35 * ---------------------------------------------------------------------------
36 * unifi_suspend
37 *
38 * Handles a suspend request from the SDIO driver.
39 *
40 * Arguments:
41 * ospriv Pointer to OS driver context.
42 *
43 * ---------------------------------------------------------------------------
44 */
45void unifi_suspend(void *ospriv)
46{
47 unifi_priv_t *priv = ospriv;
48 int interfaceTag=0;
49
50 /* For powered suspend, tell the resume's wifi_on() not to reinit UniFi */
51 priv->wol_suspend = (enable_wol == UNIFI_WOL_OFF) ? FALSE : TRUE;
52
53 unifi_trace(priv, UDBG1, "unifi_suspend: wol_suspend %d, enable_wol %d",
54 priv->wol_suspend, enable_wol );
55
56 /* Stop network traffic. */
57 /* need to stop all the netdevices*/
58 for( interfaceTag=0;interfaceTag<CSR_WIFI_NUM_INTERFACES;interfaceTag++)
59 {
60 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
61 if (interfacePriv->netdev_registered == 1)
62 {
63 if( priv->wol_suspend ) {
64 unifi_trace(priv, UDBG1, "unifi_suspend: Don't netif_carrier_off");
65 } else {
66 unifi_trace(priv, UDBG1, "unifi_suspend: netif_carrier_off");
67 netif_carrier_off(priv->netdev[interfaceTag]);
68 }
69 netif_tx_stop_all_queues(priv->netdev[interfaceTag]);
70 }
71 }
72
73 unifi_trace(priv, UDBG1, "unifi_suspend: suspend SME");
74
75 sme_sys_suspend(priv);
76
77} /* unifi_suspend() */
78
79
80/*
81 * ---------------------------------------------------------------------------
82 * unifi_resume
83 *
84 * Handles a resume request from the SDIO driver.
85 *
86 * Arguments:
87 * ospriv Pointer to OS driver context.
88 *
89 * ---------------------------------------------------------------------------
90 */
91void unifi_resume(void *ospriv)
92{
93 unifi_priv_t *priv = ospriv;
94 int interfaceTag=0;
95 int r;
96 int wol = priv->wol_suspend;
97
98 unifi_trace(priv, UDBG1, "unifi_resume: resume SME, enable_wol=%d", enable_wol);
99
100 /* The resume causes wifi-on which will re-enable the BH and reinstall the ISR */
101 r = sme_sys_resume(priv);
102 if (r) {
103 unifi_error(priv, "Failed to resume UniFi\n");
104 }
105
106 /* Resume the network interfaces. For the cold resume case, this will
107 * happen upon reconnection.
108 */
109 if (wol) {
110 unifi_trace(priv, UDBG1, "unifi_resume: try to enable carrier");
111
112 /* need to start all the netdevices*/
113 for( interfaceTag=0;interfaceTag<CSR_WIFI_NUM_INTERFACES;interfaceTag++) {
114 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
115
116 unifi_trace(priv, UDBG1, "unifi_resume: interfaceTag %d netdev_registered %d mode %d\n",
117 interfaceTag, interfacePriv->netdev_registered, interfacePriv->interfaceMode);
118
119 if (interfacePriv->netdev_registered == 1)
120 {
121 netif_carrier_on(priv->netdev[interfaceTag]);
122 netif_tx_start_all_queues(priv->netdev[interfaceTag]);
123 }
124 }
125
126 /* Kick the BH thread (with reason=host) to poll for data that may have
127 * arrived during a powered suspend. This caters for the case where the SME
128 * doesn't interact with the chip (e.g install autonomous scans) during resume.
129 */
130 unifi_send_signal(priv->card, NULL, 0, NULL);
131 }
132
133} /* unifi_resume() */
134
diff --git a/drivers/staging/csr/sdio_mmc.c b/drivers/staging/csr/sdio_mmc.c
deleted file mode 100644
index 2b503c23efae..000000000000
--- a/drivers/staging/csr/sdio_mmc.c
+++ /dev/null
@@ -1,1288 +0,0 @@
1/*
2 * ---------------------------------------------------------------------------
3 *
4 * FILE: sdio_mmc.c
5 *
6 * PURPOSE: SDIO driver interface for generic MMC stack.
7 *
8 * Copyright (C) 2008-2009 by Cambridge Silicon Radio Ltd.
9 *
10 * ---------------------------------------------------------------------------
11 */
12#include <linux/module.h>
13#include <linux/init.h>
14#include <linux/kernel.h>
15#include <linux/mutex.h>
16#include <linux/gfp.h>
17#include <linux/mmc/core.h>
18#include <linux/mmc/card.h>
19#include <linux/mmc/host.h>
20#include <linux/mmc/sdio_func.h>
21#include <linux/mmc/sdio_ids.h>
22#include <linux/mmc/sdio.h>
23#include <linux/suspend.h>
24
25#include "unifi_priv.h"
26
27#ifdef ANDROID_BUILD
28struct wake_lock unifi_sdio_wake_lock; /* wakelock to prevent suspend while resuming */
29#endif
30
31static CsrSdioFunctionDriver *sdio_func_drv;
32
33#ifdef CONFIG_PM
34static int uf_sdio_mmc_power_event(struct notifier_block *this, unsigned long event, void *ptr);
35#endif
36
37/*
38 * We need to keep track of the power on/off because we can not call
39 * mmc_power_restore_host() when the card is already powered.
40 * Even then, we need to patch the MMC driver to add a power_restore handler
41 * in the mmc_sdio_ops structure. If the MMC driver before 2.6.37 is not patched,
42 * mmc_power_save_host() and mmc_power_restore_host() are no-ops in the kernel,
43 * returning immediately (at least on x86).
44 */
45static int card_is_powered = 1;
46
47/* MMC uses ENOMEDIUM to indicate card gone away */
48
49static CsrResult
50ConvertSdioToCsrSdioResult(int r)
51{
52 CsrResult csrResult = CSR_RESULT_FAILURE;
53
54 switch (r) {
55 case 0:
56 csrResult = CSR_RESULT_SUCCESS;
57 break;
58 case -EIO:
59 case -EILSEQ:
60 csrResult = CSR_SDIO_RESULT_CRC_ERROR;
61 break;
62 /* Timeout errors */
63 case -ETIMEDOUT:
64 case -EBUSY:
65 csrResult = CSR_SDIO_RESULT_TIMEOUT;
66 break;
67 case -ENODEV:
68 case -ENOMEDIUM:
69 csrResult = CSR_SDIO_RESULT_NO_DEVICE;
70 break;
71 case -EINVAL:
72 csrResult = CSR_SDIO_RESULT_INVALID_VALUE;
73 break;
74 case -ENOMEM:
75 case -ENOSYS:
76 case -ERANGE:
77 case -ENXIO:
78 csrResult = CSR_RESULT_FAILURE;
79 break;
80 default:
81 unifi_warning(NULL, "Unrecognised SDIO error code: %d\n", r);
82 break;
83 }
84
85 return csrResult;
86}
87
88
89static int
90csr_io_rw_direct(struct mmc_card *card, int write, uint8_t fn,
91 uint32_t addr, uint8_t in, uint8_t* out)
92{
93 struct mmc_command cmd;
94 int err;
95
96 BUG_ON(!card);
97 BUG_ON(fn > 7);
98
99 memset(&cmd, 0, sizeof(struct mmc_command));
100
101 cmd.opcode = SD_IO_RW_DIRECT;
102 cmd.arg = write ? 0x80000000 : 0x00000000;
103 cmd.arg |= fn << 28;
104 cmd.arg |= (write && out) ? 0x08000000 : 0x00000000;
105 cmd.arg |= addr << 9;
106 cmd.arg |= in;
107 cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_AC;
108
109 err = mmc_wait_for_cmd(card->host, &cmd, 0);
110 if (err)
111 return err;
112
113 /* this function is not exported, so we will need to sort it out here
114 * for now, lets hard code it to sdio */
115 if (0) {
116 /* old arg (mmc_host_is_spi(card->host)) { */
117 /* host driver already reported errors */
118 } else {
119 if (cmd.resp[0] & R5_ERROR) {
120 printk(KERN_ERR "%s: r5 error 0x%02x\n",
121 __FUNCTION__, cmd.resp[0]);
122 return -EIO;
123 }
124 if (cmd.resp[0] & R5_FUNCTION_NUMBER)
125 return -EINVAL;
126 if (cmd.resp[0] & R5_OUT_OF_RANGE)
127 return -ERANGE;
128 }
129
130 if (out) {
131 if (0) { /* old argument (mmc_host_is_spi(card->host)) */
132 *out = (cmd.resp[0] >> 8) & 0xFF;
133 }
134 else {
135 *out = cmd.resp[0] & 0xFF;
136 }
137 }
138
139 return CSR_RESULT_SUCCESS;
140}
141
142
143CsrResult
144CsrSdioRead8(CsrSdioFunction *function, u32 address, u8 *data)
145{
146 struct sdio_func *func = (struct sdio_func *)function->priv;
147 int err = 0;
148
149 _sdio_claim_host(func);
150 *data = sdio_readb(func, address, &err);
151 _sdio_release_host(func);
152
153 if (err) {
154 return ConvertSdioToCsrSdioResult(err);
155 }
156
157 return CSR_RESULT_SUCCESS;
158} /* CsrSdioRead8() */
159
160CsrResult
161CsrSdioWrite8(CsrSdioFunction *function, u32 address, u8 data)
162{
163 struct sdio_func *func = (struct sdio_func *)function->priv;
164 int err = 0;
165
166 _sdio_claim_host(func);
167 sdio_writeb(func, data, address, &err);
168 _sdio_release_host(func);
169
170 if (err) {
171 return ConvertSdioToCsrSdioResult(err);
172 }
173
174 return CSR_RESULT_SUCCESS;
175} /* CsrSdioWrite8() */
176
177CsrResult
178CsrSdioRead16(CsrSdioFunction *function, u32 address, u16 *data)
179{
180 struct sdio_func *func = (struct sdio_func *)function->priv;
181 int err;
182 uint8_t b0, b1;
183
184 _sdio_claim_host(func);
185 b0 = sdio_readb(func, address, &err);
186 if (err) {
187 _sdio_release_host(func);
188 return ConvertSdioToCsrSdioResult(err);
189 }
190
191 b1 = sdio_readb(func, address+1, &err);
192 if (err) {
193 _sdio_release_host(func);
194 return ConvertSdioToCsrSdioResult(err);
195 }
196 _sdio_release_host(func);
197
198 *data = ((uint16_t)b1 << 8) | b0;
199
200 return CSR_RESULT_SUCCESS;
201} /* CsrSdioRead16() */
202
203
204CsrResult
205CsrSdioWrite16(CsrSdioFunction *function, u32 address, u16 data)
206{
207 struct sdio_func *func = (struct sdio_func *)function->priv;
208 int err;
209 uint8_t b0, b1;
210
211 _sdio_claim_host(func);
212 b1 = (data >> 8) & 0xFF;
213 sdio_writeb(func, b1, address+1, &err);
214 if (err) {
215 _sdio_release_host(func);
216 return ConvertSdioToCsrSdioResult(err);
217 }
218
219 b0 = data & 0xFF;
220 sdio_writeb(func, b0, address, &err);
221 if (err) {
222 _sdio_release_host(func);
223 return ConvertSdioToCsrSdioResult(err);
224 }
225
226 _sdio_release_host(func);
227 return CSR_RESULT_SUCCESS;
228} /* CsrSdioWrite16() */
229
230
231CsrResult
232CsrSdioF0Read8(CsrSdioFunction *function, u32 address, u8 *data)
233{
234 struct sdio_func *func = (struct sdio_func *)function->priv;
235 int err = 0;
236
237 _sdio_claim_host(func);
238#ifdef MMC_QUIRK_LENIENT_FN0
239 *data = sdio_f0_readb(func, address, &err);
240#else
241 err = csr_io_rw_direct(func->card, 0, 0, address, 0, data);
242#endif
243 _sdio_release_host(func);
244
245 if (err) {
246 return ConvertSdioToCsrSdioResult(err);
247 }
248
249 return CSR_RESULT_SUCCESS;
250} /* CsrSdioF0Read8() */
251
252CsrResult
253CsrSdioF0Write8(CsrSdioFunction *function, u32 address, u8 data)
254{
255 struct sdio_func *func = (struct sdio_func *)function->priv;
256 int err = 0;
257
258 _sdio_claim_host(func);
259#ifdef MMC_QUIRK_LENIENT_FN0
260 sdio_f0_writeb(func, data, address, &err);
261#else
262 err = csr_io_rw_direct(func->card, 1, 0, address, data, NULL);
263#endif
264 _sdio_release_host(func);
265
266 if (err) {
267 return ConvertSdioToCsrSdioResult(err);
268 }
269
270 return CSR_RESULT_SUCCESS;
271} /* CsrSdioF0Write8() */
272
273
274CsrResult
275CsrSdioRead(CsrSdioFunction *function, u32 address, void *data, u32 length)
276{
277 struct sdio_func *func = (struct sdio_func *)function->priv;
278 int err;
279
280 _sdio_claim_host(func);
281 err = sdio_readsb(func, data, address, length);
282 _sdio_release_host(func);
283
284 if (err) {
285 return ConvertSdioToCsrSdioResult(err);
286 }
287
288 return CSR_RESULT_SUCCESS;
289} /* CsrSdioRead() */
290
291CsrResult
292CsrSdioWrite(CsrSdioFunction *function, u32 address, const void *data, u32 length)
293{
294 struct sdio_func *func = (struct sdio_func *)function->priv;
295 int err;
296
297 _sdio_claim_host(func);
298 err = sdio_writesb(func, address, (void*)data, length);
299 _sdio_release_host(func);
300
301 if (err) {
302 return ConvertSdioToCsrSdioResult(err);
303 }
304
305 return CSR_RESULT_SUCCESS;
306} /* CsrSdioWrite() */
307
308
309static int
310csr_sdio_enable_hs(struct mmc_card *card)
311{
312 int ret;
313 u8 speed;
314
315 if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED)) {
316 /* We've asked for HS clock rates, but controller doesn't
317 * claim to support it. We should limit the clock
318 * to 25MHz via module parameter.
319 */
320 printk(KERN_INFO "unifi: request HS but not MMC_CAP_SD_HIGHSPEED");
321 return 0;
322 }
323
324 if (!card->cccr.high_speed)
325 return 0;
326
327#if 1
328 ret = csr_io_rw_direct(card, 0, 0, SDIO_CCCR_SPEED, 0, &speed);
329 if (ret)
330 return ret;
331
332 speed |= SDIO_SPEED_EHS;
333#else
334 /* Optimisation: Eliminate read by always assuming SHS and that reserved bits can be zero */
335 speed = SDIO_SPEED_EHS | SDIO_SPEED_SHS;
336#endif
337
338 ret = csr_io_rw_direct(card, 1, 0, SDIO_CCCR_SPEED, speed, NULL);
339 if (ret)
340 return ret;
341
342 mmc_card_set_highspeed(card);
343 card->host->ios.timing = MMC_TIMING_SD_HS;
344 card->host->ops->set_ios(card->host, &card->host->ios);
345
346 return 0;
347}
348
349static int
350csr_sdio_disable_hs(struct mmc_card *card)
351{
352 int ret;
353 u8 speed;
354
355 if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED))
356 return 0;
357
358 if (!card->cccr.high_speed)
359 return 0;
360#if 1
361 ret = csr_io_rw_direct(card, 0, 0, SDIO_CCCR_SPEED, 0, &speed);
362 if (ret)
363 return ret;
364
365 speed &= ~SDIO_SPEED_EHS;
366#else
367 /* Optimisation: Eliminate read by always assuming SHS and that reserved bits can be zero */
368 speed = SDIO_SPEED_SHS; /* clear SDIO_SPEED_EHS */
369#endif
370
371 ret = csr_io_rw_direct(card, 1, 0, SDIO_CCCR_SPEED, speed, NULL);
372 if (ret)
373 return ret;
374
375 card->state &= ~MMC_STATE_HIGHSPEED;
376 card->host->ios.timing = MMC_TIMING_LEGACY;
377 card->host->ops->set_ios(card->host, &card->host->ios);
378
379 return 0;
380}
381
382
383/*
384 * ---------------------------------------------------------------------------
385 * CsrSdioMaxBusClockFrequencySet
386 *
387 * Set the maximum SDIO bus clock speed to use.
388 *
389 * Arguments:
390 * sdio SDIO context pointer
391 * maxFrequency maximum clock speed in Hz
392 *
393 * Returns:
394 * an error code.
395 * ---------------------------------------------------------------------------
396 */
397CsrResult
398CsrSdioMaxBusClockFrequencySet(CsrSdioFunction *function, u32 maxFrequency)
399{
400 struct sdio_func *func = (struct sdio_func *)function->priv;
401 struct mmc_host *host = func->card->host;
402 struct mmc_ios *ios = &host->ios;
403 unsigned int max_hz;
404 int err;
405 u32 max_khz = maxFrequency/1000;
406
407 if (!max_khz || max_khz > sdio_clock) {
408 max_khz = sdio_clock;
409 }
410
411 _sdio_claim_host(func);
412 max_hz = 1000 * max_khz;
413 if (max_hz > host->f_max) {
414 max_hz = host->f_max;
415 }
416
417 if (max_hz > 25000000) {
418 err = csr_sdio_enable_hs(func->card);
419 } else {
420 err = csr_sdio_disable_hs(func->card);
421 }
422 if (err) {
423 printk(KERN_ERR "SDIO warning: Failed to configure SDIO clock mode\n");
424 _sdio_release_host(func);
425 return CSR_RESULT_SUCCESS;
426 }
427
428 ios->clock = max_hz;
429 host->ops->set_ios(host, ios);
430
431 _sdio_release_host(func);
432
433 return CSR_RESULT_SUCCESS;
434} /* CsrSdioMaxBusClockFrequencySet() */
435
436
437/*
438 * ---------------------------------------------------------------------------
439 * CsrSdioInterruptEnable
440 * CsrSdioInterruptDisable
441 *
442 * Enable or disable the SDIO interrupt.
443 * The driver disables the SDIO interrupt until the i/o thread can
444 * process it.
445 * The SDIO interrupt can be disabled by modifying the SDIO_INT_ENABLE
446 * register in the Card Common Control Register block, but this requires
447 * two CMD52 operations. A better solution is to mask the interrupt at
448 * the host controller.
449 *
450 * Arguments:
451 * sdio SDIO context pointer
452 *
453 * Returns:
454 * Zero on success or a UniFi driver error code.
455 *
456 * ---------------------------------------------------------------------------
457 */
458CsrResult
459CsrSdioInterruptEnable(CsrSdioFunction *function)
460{
461 struct sdio_func *func = (struct sdio_func *)function->priv;
462 int err = 0;
463
464#ifdef CSR_CONFIG_MMC_INT_BYPASS_KSOFTIRQD
465 sdio_unblock_card_irq(func);
466#else
467 _sdio_claim_host(func);
468 /* Write the Int Enable in CCCR block */
469#ifdef MMC_QUIRK_LENIENT_FN0
470 sdio_f0_writeb(func, 0x3, SDIO_CCCR_IENx, &err);
471#else
472 err = csr_io_rw_direct(func->card, 1, 0, SDIO_CCCR_IENx, 0x03, NULL);
473#endif
474 _sdio_release_host(func);
475
476 if (err) {
477 printk(KERN_ERR "unifi: %s: error %d writing IENx\n", __FUNCTION__, err);
478 return ConvertSdioToCsrSdioResult(err);
479 }
480#endif
481 return CSR_RESULT_SUCCESS;
482} /* CsrSdioInterruptEnable() */
483
484CsrResult
485CsrSdioInterruptDisable(CsrSdioFunction *function)
486{
487 struct sdio_func *func = (struct sdio_func *)function->priv;
488 int err = 0;
489
490#ifdef CSR_CONFIG_MMC_INT_BYPASS_KSOFTIRQD
491 sdio_block_card_irq(func);
492#else
493 _sdio_claim_host(func);
494 /* Write the Int Enable in CCCR block */
495#ifdef MMC_QUIRK_LENIENT_FN0
496 sdio_f0_writeb(func, 0, SDIO_CCCR_IENx, &err);
497#else
498 err = csr_io_rw_direct(func->card, 1, 0, SDIO_CCCR_IENx, 0x00, NULL);
499#endif
500 _sdio_release_host(func);
501
502 if (err) {
503 printk(KERN_ERR "unifi: %s: error %d writing IENx\n", __FUNCTION__, err);
504 return ConvertSdioToCsrSdioResult(err);
505 }
506#endif
507 return CSR_RESULT_SUCCESS;
508} /* CsrSdioInterruptDisable() */
509
510
511void CsrSdioInterruptAcknowledge(CsrSdioFunction *function)
512{
513}
514
515
516/*
517 * ---------------------------------------------------------------------------
518 * CsrSdioFunctionEnable
519 *
520 * Enable i/o on function 1.
521 *
522 * Arguments:
523 * sdio SDIO context pointer
524 *
525 * Returns:
526 * UniFi driver error code.
527 * ---------------------------------------------------------------------------
528 */
529CsrResult
530CsrSdioFunctionEnable(CsrSdioFunction *function)
531{
532 struct sdio_func *func = (struct sdio_func *)function->priv;
533 int err;
534
535 /* Enable UniFi function 1 (the 802.11 part). */
536 _sdio_claim_host(func);
537 err = sdio_enable_func(func);
538 _sdio_release_host(func);
539 if (err) {
540 unifi_error(NULL, "Failed to enable SDIO function %d\n", func->num);
541 }
542
543 return ConvertSdioToCsrSdioResult(err);
544} /* CsrSdioFunctionEnable() */
545
546
547/*
548 * ---------------------------------------------------------------------------
549 * CsrSdioFunctionDisable
550 *
551 * Enable i/o on function 1.
552 *
553 * Arguments:
554 * sdio SDIO context pointer
555 *
556 * Returns:
557 * UniFi driver error code.
558 * ---------------------------------------------------------------------------
559 */
560CsrResult
561CsrSdioFunctionDisable(CsrSdioFunction *function)
562{
563 struct sdio_func *func = (struct sdio_func *)function->priv;
564 int err;
565
566 /* Disable UniFi function 1 (the 802.11 part). */
567 _sdio_claim_host(func);
568 err = sdio_disable_func(func);
569 _sdio_release_host(func);
570 if (err) {
571 unifi_error(NULL, "Failed to disable SDIO function %d\n", func->num);
572 }
573
574 return ConvertSdioToCsrSdioResult(err);
575} /* CsrSdioFunctionDisable() */
576
577
578/*
579 * ---------------------------------------------------------------------------
580 * CsrSdioFunctionActive
581 *
582 * No-op as the bus goes to an active state at the start of every
583 * command.
584 *
585 * Arguments:
586 * sdio SDIO context pointer
587 * ---------------------------------------------------------------------------
588 */
589void
590CsrSdioFunctionActive(CsrSdioFunction *function)
591{
592} /* CsrSdioFunctionActive() */
593
594/*
595 * ---------------------------------------------------------------------------
596 * CsrSdioFunctionIdle
597 *
598 * Set the function as idle.
599 *
600 * Arguments:
601 * sdio SDIO context pointer
602 * ---------------------------------------------------------------------------
603 */
604void
605CsrSdioFunctionIdle(CsrSdioFunction *function)
606{
607} /* CsrSdioFunctionIdle() */
608
609
610/*
611 * ---------------------------------------------------------------------------
612 * CsrSdioPowerOn
613 *
614 * Power on UniFi.
615 *
616 * Arguments:
617 * sdio SDIO context pointer
618 * ---------------------------------------------------------------------------
619 */
620CsrResult
621CsrSdioPowerOn(CsrSdioFunction *function)
622{
623 struct sdio_func *func = (struct sdio_func *)function->priv;
624 struct mmc_host *host = func->card->host;
625
626 _sdio_claim_host(func);
627 if (!card_is_powered) {
628 mmc_power_restore_host(host);
629 card_is_powered = 1;
630 } else {
631 printk(KERN_INFO "SDIO: Skip power on; card is already powered.\n");
632 }
633 _sdio_release_host(func);
634
635 return CSR_RESULT_SUCCESS;
636} /* CsrSdioPowerOn() */
637
638/*
639 * ---------------------------------------------------------------------------
640 * CsrSdioPowerOff
641 *
642 * Power off UniFi.
643 *
644 * Arguments:
645 * sdio SDIO context pointer
646 * ---------------------------------------------------------------------------
647 */
648void
649CsrSdioPowerOff(CsrSdioFunction *function)
650{
651 struct sdio_func *func = (struct sdio_func *)function->priv;
652 struct mmc_host *host = func->card->host;
653
654 _sdio_claim_host(func);
655 if (card_is_powered) {
656 mmc_power_save_host(host);
657 card_is_powered = 0;
658 } else {
659 printk(KERN_INFO "SDIO: Skip power off; card is already powered off.\n");
660 }
661 _sdio_release_host(func);
662} /* CsrSdioPowerOff() */
663
664
665static int
666sdio_set_block_size_ignore_first_error(struct sdio_func *func, unsigned blksz)
667{
668 int ret;
669
670 if (blksz > func->card->host->max_blk_size)
671 return -EINVAL;
672
673 if (blksz == 0) {
674 blksz = min(func->max_blksize, func->card->host->max_blk_size);
675 blksz = min(blksz, 512u);
676 }
677
678 /*
679 * Ignore -ERANGE (OUT_OF_RANGE in R5) on the first byte as
680 * the block size may be invalid until both bytes are written.
681 */
682 ret = csr_io_rw_direct(func->card, 1, 0,
683 SDIO_FBR_BASE(func->num) + SDIO_FBR_BLKSIZE,
684 blksz & 0xff, NULL);
685 if (ret && ret != -ERANGE)
686 return ret;
687 ret = csr_io_rw_direct(func->card, 1, 0,
688 SDIO_FBR_BASE(func->num) + SDIO_FBR_BLKSIZE + 1,
689 (blksz >> 8) & 0xff, NULL);
690 if (ret)
691 return ret;
692 func->cur_blksize = blksz;
693
694 return 0;
695}
696
697CsrResult
698CsrSdioBlockSizeSet(CsrSdioFunction *function, u16 blockSize)
699{
700 struct sdio_func *func = (struct sdio_func *)function->priv;
701 int r = 0;
702
703 /* Module parameter overrides */
704 if (sdio_block_size > -1) {
705 blockSize = sdio_block_size;
706 }
707
708 unifi_trace(NULL, UDBG1, "Set SDIO function block size to %d\n",
709 blockSize);
710
711 _sdio_claim_host(func);
712 r = sdio_set_block_size(func, blockSize);
713 _sdio_release_host(func);
714
715 /*
716 * The MMC driver for kernels prior to 2.6.32 may fail this request
717 * with -ERANGE. In this case use our workaround.
718 */
719 if (r == -ERANGE) {
720 _sdio_claim_host(func);
721 r = sdio_set_block_size_ignore_first_error(func, blockSize);
722 _sdio_release_host(func);
723 }
724 if (r) {
725 unifi_error(NULL, "Error %d setting block size\n", r);
726 }
727
728 /* Determine the achieved block size to pass to the core */
729 function->blockSize = func->cur_blksize;
730
731 return ConvertSdioToCsrSdioResult(r);
732} /* CsrSdioBlockSizeSet() */
733
734
735/*
736 * ---------------------------------------------------------------------------
737 * CsrSdioHardReset
738 *
739 * Hard Resets UniFi is possible.
740 *
741 * Arguments:
742 * sdio SDIO context pointer
743 * ---------------------------------------------------------------------------
744 */
745CsrResult
746CsrSdioHardReset(CsrSdioFunction *function)
747{
748 return CSR_RESULT_FAILURE;
749} /* CsrSdioHardReset() */
750
751
752
753/*
754 * ---------------------------------------------------------------------------
755 * uf_glue_sdio_int_handler
756 *
757 * Interrupt callback function for SDIO interrupts.
758 * This is called in kernel context (i.e. not interrupt context).
759 *
760 * Arguments:
761 * func SDIO context pointer
762 *
763 * Returns:
764 * None.
765 *
766 * Note: Called with host already claimed.
767 * ---------------------------------------------------------------------------
768 */
769static void
770uf_glue_sdio_int_handler(struct sdio_func *func)
771{
772 CsrSdioFunction *sdio_ctx;
773 CsrSdioInterruptDsrCallback func_dsr_callback;
774 int r;
775
776 sdio_ctx = sdio_get_drvdata(func);
777 if (!sdio_ctx) {
778 return;
779 }
780
781#ifndef CSR_CONFIG_MMC_INT_BYPASS_KSOFTIRQD
782 /*
783 * Normally, we are not allowed to do any SDIO commands here.
784 * However, this is called in a thread context and with the SDIO lock
785 * so we disable the interrupts here instead of trying to do complicated
786 * things with the SDIO lock.
787 */
788#ifdef MMC_QUIRK_LENIENT_FN0
789 sdio_f0_writeb(func, 0, SDIO_CCCR_IENx, &r);
790#else
791 r = csr_io_rw_direct(func->card, 1, 0, SDIO_CCCR_IENx, 0x00, NULL);
792#endif
793 if (r) {
794 printk(KERN_ERR "UniFi MMC Int handler: Failed to disable interrupts %d\n", r);
795 }
796#endif
797
798 /* If the function driver has registered a handler, call it */
799 if (sdio_func_drv && sdio_func_drv->intr) {
800
801 func_dsr_callback = sdio_func_drv->intr(sdio_ctx);
802
803 /* If interrupt handle returns a DSR handle, call it */
804 if (func_dsr_callback) {
805 func_dsr_callback(sdio_ctx);
806 }
807 }
808
809} /* uf_glue_sdio_int_handler() */
810
811
812
813/*
814 * ---------------------------------------------------------------------------
815 * csr_sdio_linux_remove_irq
816 *
817 * Unregister the interrupt handler.
818 * This means that the linux layer can not process interrupts any more.
819 *
820 * Arguments:
821 * sdio SDIO context pointer
822 *
823 * Returns:
824 * Status of the removal.
825 * ---------------------------------------------------------------------------
826 */
827int csr_sdio_linux_remove_irq(CsrSdioFunction *function)
828{
829 struct sdio_func *func = (struct sdio_func *)function->priv;
830 int r;
831
832 unifi_trace(NULL, UDBG1, "csr_sdio_linux_remove_irq\n");
833
834 sdio_claim_host(func);
835 r = sdio_release_irq(func);
836 sdio_release_host(func);
837
838 return r;
839
840} /* csr_sdio_linux_remove_irq() */
841
842
843/*
844 * ---------------------------------------------------------------------------
845 * csr_sdio_linux_install_irq
846 *
847 * Register the interrupt handler.
848 * This means that the linux layer can process interrupts.
849 *
850 * Arguments:
851 * sdio SDIO context pointer
852 *
853 * Returns:
854 * Status of the removal.
855 * ---------------------------------------------------------------------------
856 */
857int csr_sdio_linux_install_irq(CsrSdioFunction *function)
858{
859 struct sdio_func *func = (struct sdio_func *)function->priv;
860 int r;
861
862 unifi_trace(NULL, UDBG1, "csr_sdio_linux_install_irq\n");
863
864 /* Register our interrupt handle */
865 sdio_claim_host(func);
866 r = sdio_claim_irq(func, uf_glue_sdio_int_handler);
867 sdio_release_host(func);
868
869 /* If the interrupt was installed earlier, is fine */
870 if (r == -EBUSY)
871 r = 0;
872
873 return r;
874} /* csr_sdio_linux_install_irq() */
875
876#ifdef CONFIG_PM
877
878/*
879 * Power Management notifier
880 */
881struct uf_sdio_mmc_pm_notifier
882{
883 struct list_head list;
884
885 CsrSdioFunction *sdio_ctx;
886 struct notifier_block pm_notifier;
887};
888
889/* PM notifier list head */
890static struct uf_sdio_mmc_pm_notifier uf_sdio_mmc_pm_notifiers = {
891 .sdio_ctx = NULL,
892};
893
894/*
895 * ---------------------------------------------------------------------------
896 * uf_sdio_mmc_register_pm_notifier
897 * uf_sdio_mmc_unregister_pm_notifier
898 *
899 * Register/unregister for power management events. A list is used to
900 * allow multiple card instances to be supported.
901 *
902 * Arguments:
903 * sdio_ctx - CSR SDIO context to associate PM notifier to
904 *
905 * Returns:
906 * Register function returns NULL on error
907 * ---------------------------------------------------------------------------
908 */
909static struct uf_sdio_mmc_pm_notifier *
910uf_sdio_mmc_register_pm_notifier(CsrSdioFunction *sdio_ctx)
911{
912 /* Allocate notifier context for this card instance */
913 struct uf_sdio_mmc_pm_notifier *notifier_ctx = kmalloc(sizeof(struct uf_sdio_mmc_pm_notifier), GFP_KERNEL);
914
915 if (notifier_ctx)
916 {
917 notifier_ctx->sdio_ctx = sdio_ctx;
918 notifier_ctx->pm_notifier.notifier_call = uf_sdio_mmc_power_event;
919
920 list_add(&notifier_ctx->list, &uf_sdio_mmc_pm_notifiers.list);
921
922 if (register_pm_notifier(&notifier_ctx->pm_notifier)) {
923 printk(KERN_ERR "unifi: register_pm_notifier failed\n");
924 }
925 }
926
927 return notifier_ctx;
928}
929
930static void
931uf_sdio_mmc_unregister_pm_notifier(CsrSdioFunction *sdio_ctx)
932{
933 struct uf_sdio_mmc_pm_notifier *notifier_ctx;
934 struct list_head *node, *q;
935
936 list_for_each_safe(node, q, &uf_sdio_mmc_pm_notifiers.list) {
937 notifier_ctx = list_entry(node, struct uf_sdio_mmc_pm_notifier, list);
938
939 /* If it matches, unregister and free the notifier context */
940 if (notifier_ctx && notifier_ctx->sdio_ctx == sdio_ctx)
941 {
942 if (unregister_pm_notifier(&notifier_ctx->pm_notifier)) {
943 printk(KERN_ERR "unifi: unregister_pm_notifier failed\n");
944 }
945
946 /* Remove from list */
947 notifier_ctx->sdio_ctx = NULL;
948 list_del(node);
949 kfree(notifier_ctx);
950 }
951 }
952}
953
954/*
955 * ---------------------------------------------------------------------------
956 * uf_sdio_mmc_power_event
957 *
958 * Handler for power management events.
959 *
960 * We need to handle suspend/resume events while the userspace is unsuspended
961 * to allow the SME to run its suspend/resume state machines.
962 *
963 * Arguments:
964 * event event ID
965 *
966 * Returns:
967 * Status of the event handling
968 * ---------------------------------------------------------------------------
969 */
970static int
971uf_sdio_mmc_power_event(struct notifier_block *this, unsigned long event, void *ptr)
972{
973 struct uf_sdio_mmc_pm_notifier *notifier_ctx = container_of(this,
974 struct uf_sdio_mmc_pm_notifier,
975 pm_notifier);
976
977 /* Call the CSR SDIO function driver's suspend/resume method
978 * while the userspace is unsuspended.
979 */
980 switch (event) {
981 case PM_POST_HIBERNATION:
982 case PM_POST_SUSPEND:
983 printk(KERN_INFO "%s:%d resume\n", __FUNCTION__, __LINE__ );
984 if (sdio_func_drv && sdio_func_drv->resume) {
985 sdio_func_drv->resume(notifier_ctx->sdio_ctx);
986 }
987 break;
988
989 case PM_HIBERNATION_PREPARE:
990 case PM_SUSPEND_PREPARE:
991 printk(KERN_INFO "%s:%d suspend\n", __FUNCTION__, __LINE__ );
992 if (sdio_func_drv && sdio_func_drv->suspend) {
993 sdio_func_drv->suspend(notifier_ctx->sdio_ctx);
994 }
995 break;
996 }
997 return NOTIFY_DONE;
998}
999
1000#endif /* CONFIG_PM */
1001
1002/*
1003 * ---------------------------------------------------------------------------
1004 * uf_glue_sdio_probe
1005 *
1006 * Card insert callback.
1007 *
1008 * Arguments:
1009 * func Our (glue layer) context pointer.
1010 *
1011 * Returns:
1012 * UniFi driver error code.
1013 * ---------------------------------------------------------------------------
1014 */
1015static int
1016uf_glue_sdio_probe(struct sdio_func *func,
1017 const struct sdio_device_id *id)
1018{
1019 int instance;
1020 CsrSdioFunction *sdio_ctx;
1021
1022 /* First of all claim the SDIO driver */
1023 sdio_claim_host(func);
1024
1025 /* Assume that the card is already powered */
1026 card_is_powered = 1;
1027
1028 /* Assumes one card per host, which is true for SDIO */
1029 instance = func->card->host->index;
1030 printk("sdio bus_id: %16s - UniFi card 0x%X inserted\n",
1031 sdio_func_id(func), instance);
1032
1033 /* Allocate context */
1034 sdio_ctx = kmalloc(sizeof(CsrSdioFunction), GFP_KERNEL);
1035 if (sdio_ctx == NULL) {
1036 sdio_release_host(func);
1037 return -ENOMEM;
1038 }
1039
1040 /* Initialise the context */
1041 sdio_ctx->sdioId.manfId = func->vendor;
1042 sdio_ctx->sdioId.cardId = func->device;
1043 sdio_ctx->sdioId.sdioFunction = func->num;
1044 sdio_ctx->sdioId.sdioInterface = func->class;
1045 sdio_ctx->blockSize = func->cur_blksize;
1046 sdio_ctx->priv = (void *)func;
1047 sdio_ctx->features = 0;
1048
1049 /* Module parameter enables byte mode */
1050 if (sdio_byte_mode) {
1051 sdio_ctx->features |= CSR_SDIO_FEATURE_BYTE_MODE;
1052 }
1053
1054 if (func->card->host->caps & MMC_CAP_SD_HIGHSPEED) {
1055 unifi_trace(NULL, UDBG1, "MMC_CAP_SD_HIGHSPEED is available\n");
1056 }
1057
1058#ifdef MMC_QUIRK_LENIENT_FN0
1059 func->card->quirks |= MMC_QUIRK_LENIENT_FN0;
1060#endif
1061
1062 /* Pass context to the SDIO driver */
1063 sdio_set_drvdata(func, sdio_ctx);
1064
1065#ifdef CONFIG_PM
1066 /* Register to get PM events */
1067 if (uf_sdio_mmc_register_pm_notifier(sdio_ctx) == NULL) {
1068 unifi_error(NULL, "%s: Failed to register for PM events\n", __FUNCTION__);
1069 }
1070#endif
1071
1072 /* Register this device with the SDIO function driver */
1073 /* Call the main UniFi driver inserted handler */
1074 if (sdio_func_drv && sdio_func_drv->inserted) {
1075 uf_add_os_device(instance, &func->dev);
1076 sdio_func_drv->inserted(sdio_ctx);
1077 }
1078
1079 /* We have finished, so release the SDIO driver */
1080 sdio_release_host(func);
1081
1082#ifdef ANDROID_BUILD
1083 /* Take the wakelock */
1084 unifi_trace(NULL, UDBG1, "probe: take wake lock\n");
1085 wake_lock(&unifi_sdio_wake_lock);
1086#endif
1087
1088 return 0;
1089} /* uf_glue_sdio_probe() */
1090
1091
1092/*
1093 * ---------------------------------------------------------------------------
1094 * uf_glue_sdio_remove
1095 *
1096 * Card removal callback.
1097 *
1098 * Arguments:
1099 * func Our (glue layer) context pointer.
1100 *
1101 * Returns:
1102 * UniFi driver error code.
1103 * ---------------------------------------------------------------------------
1104 */
1105static void
1106uf_glue_sdio_remove(struct sdio_func *func)
1107{
1108 CsrSdioFunction *sdio_ctx;
1109
1110 sdio_ctx = sdio_get_drvdata(func);
1111 if (!sdio_ctx) {
1112 return;
1113 }
1114
1115 unifi_info(NULL, "UniFi card removed\n");
1116
1117 /* Clean up the SDIO function driver */
1118 if (sdio_func_drv && sdio_func_drv->removed) {
1119 uf_remove_os_device(func->card->host->index);
1120 sdio_func_drv->removed(sdio_ctx);
1121 }
1122
1123#ifdef CONFIG_PM
1124 /* Unregister for PM events */
1125 uf_sdio_mmc_unregister_pm_notifier(sdio_ctx);
1126#endif
1127
1128 kfree(sdio_ctx);
1129
1130} /* uf_glue_sdio_remove */
1131
1132
1133/*
1134 * SDIO ids *must* be statically declared, so we can't take
1135 * them from the list passed in csr_sdio_register_driver().
1136 */
1137static const struct sdio_device_id unifi_ids[] = {
1138 { SDIO_DEVICE(SDIO_MANF_ID_CSR, SDIO_CARD_ID_UNIFI_3) },
1139 { SDIO_DEVICE(SDIO_MANF_ID_CSR, SDIO_CARD_ID_UNIFI_4) },
1140 { /* end: all zeroes */ },
1141};
1142
1143MODULE_DEVICE_TABLE(sdio, unifi_ids);
1144
1145#ifdef CONFIG_PM
1146
1147/*
1148 * ---------------------------------------------------------------------------
1149 * uf_glue_sdio_suspend
1150 *
1151 * Card suspend callback. The userspace will already be suspended.
1152 *
1153 * Arguments:
1154 * dev The struct device owned by the MMC driver
1155 *
1156 * Returns:
1157 * None
1158 * ---------------------------------------------------------------------------
1159 */
1160static int
1161uf_glue_sdio_suspend(struct device *dev)
1162{
1163 unifi_trace(NULL, UDBG1, "uf_glue_sdio_suspend");
1164
1165 return 0;
1166} /* uf_glue_sdio_suspend */
1167
1168
1169/*
1170 * ---------------------------------------------------------------------------
1171 * uf_glue_sdio_resume
1172 *
1173 * Card resume callback. The userspace will still be suspended.
1174 *
1175 * Arguments:
1176 * dev The struct device owned by the MMC driver
1177 *
1178 * Returns:
1179 * None
1180 * ---------------------------------------------------------------------------
1181 */
1182static int
1183uf_glue_sdio_resume(struct device *dev)
1184{
1185 unifi_trace(NULL, UDBG1, "uf_glue_sdio_resume");
1186
1187#ifdef ANDROID_BUILD
1188 unifi_trace(NULL, UDBG1, "resume: take wakelock\n");
1189 wake_lock(&unifi_sdio_wake_lock);
1190#endif
1191
1192 return 0;
1193
1194} /* uf_glue_sdio_resume */
1195
1196static struct dev_pm_ops unifi_pm_ops = {
1197 .suspend = uf_glue_sdio_suspend,
1198 .resume = uf_glue_sdio_resume,
1199};
1200
1201#define UNIFI_PM_OPS (&unifi_pm_ops)
1202
1203#else
1204
1205#define UNIFI_PM_OPS NULL
1206
1207#endif /* CONFIG_PM */
1208
1209static struct sdio_driver unifi_driver = {
1210 .probe = uf_glue_sdio_probe,
1211 .remove = uf_glue_sdio_remove,
1212 .name = "unifi",
1213 .id_table = unifi_ids,
1214 .drv.pm = UNIFI_PM_OPS,
1215};
1216
1217
1218/*
1219 * ---------------------------------------------------------------------------
1220 * CsrSdioFunctionDriverRegister
1221 * CsrSdioFunctionDriverUnregister
1222 *
1223 * These functions are called from the main module load and unload
1224 * functions. They perform the appropriate operations for the
1225 * linux MMC/SDIO driver.
1226 *
1227 * Arguments:
1228 * sdio_drv Pointer to the function driver's SDIO structure.
1229 *
1230 * Returns:
1231 * None.
1232 * ---------------------------------------------------------------------------
1233 */
1234CsrResult
1235CsrSdioFunctionDriverRegister(CsrSdioFunctionDriver *sdio_drv)
1236{
1237 int r;
1238
1239 printk("UniFi: Using native Linux MMC driver for SDIO.\n");
1240
1241 if (sdio_func_drv) {
1242 unifi_error(NULL, "sdio_mmc: UniFi driver already registered\n");
1243 return CSR_SDIO_RESULT_INVALID_VALUE;
1244 }
1245
1246#ifdef ANDROID_BUILD
1247 wake_lock_init(&unifi_sdio_wake_lock, WAKE_LOCK_SUSPEND, "unifi_sdio_work");
1248#endif
1249
1250 /* Save the registered driver description */
1251 /*
1252 * FIXME:
1253 * Need a table here to handle a call to register for just one function.
1254 * mmc only allows us to register for the whole device
1255 */
1256 sdio_func_drv = sdio_drv;
1257
1258#ifdef CONFIG_PM
1259 /* Initialise PM notifier list */
1260 INIT_LIST_HEAD(&uf_sdio_mmc_pm_notifiers.list);
1261#endif
1262
1263 /* Register ourself with mmc_core */
1264 r = sdio_register_driver(&unifi_driver);
1265 if (r) {
1266 printk(KERN_ERR "unifi_sdio: Failed to register UniFi SDIO driver: %d\n", r);
1267 return ConvertSdioToCsrSdioResult(r);
1268 }
1269
1270 return CSR_RESULT_SUCCESS;
1271} /* CsrSdioFunctionDriverRegister() */
1272
1273
1274
1275void
1276CsrSdioFunctionDriverUnregister(CsrSdioFunctionDriver *sdio_drv)
1277{
1278 printk(KERN_INFO "UniFi: unregister from MMC sdio\n");
1279
1280#ifdef ANDROID_BUILD
1281 wake_lock_destroy(&unifi_sdio_wake_lock);
1282#endif
1283 sdio_unregister_driver(&unifi_driver);
1284
1285 sdio_func_drv = NULL;
1286
1287} /* CsrSdioFunctionDriverUnregister() */
1288
diff --git a/drivers/staging/csr/sdio_stubs.c b/drivers/staging/csr/sdio_stubs.c
deleted file mode 100644
index 839fae01d96c..000000000000
--- a/drivers/staging/csr/sdio_stubs.c
+++ /dev/null
@@ -1,82 +0,0 @@
1/*
2 * Stubs for some of the bottom edge functions.
3 *
4 * These stubs are optional functions in the bottom edge (SDIO driver
5 * interface) API that not all platforms or SDIO drivers may support.
6 *
7 * They're declared as weak symbols so they can be overridden by
8 * simply providing a non-weak declaration.
9 *
10 * Copyright (C) 2007-2008 by Cambridge Silicon Radio Ltd.
11 *
12 * Refer to LICENSE.txt included with this source code for details on
13 * the license terms.
14 *
15 */
16#include "csr_wifi_hip_unifi.h"
17
18void __attribute__((weak)) CsrSdioFunctionIdle(CsrSdioFunction *function)
19{
20}
21
22void __attribute__((weak)) CsrSdioFunctionActive(CsrSdioFunction *function)
23{
24}
25
26CsrResult __attribute__((weak)) CsrSdioPowerOn(CsrSdioFunction *function)
27{
28 return CSR_RESULT_SUCCESS;
29}
30
31void __attribute__((weak)) CsrSdioPowerOff(CsrSdioFunction *function)
32{
33}
34
35CsrResult __attribute__((weak)) CsrSdioHardReset(CsrSdioFunction *function)
36{
37 return CSR_SDIO_RESULT_NOT_RESET;
38}
39
40CsrResult __attribute__((weak)) CsrSdioBlockSizeSet(CsrSdioFunction *function,
41 u16 blockSize)
42{
43 return CSR_RESULT_SUCCESS;
44}
45
46CsrResult __attribute__((weak)) CsrSdioSuspend(CsrSdioFunction *function)
47{
48 return CSR_RESULT_SUCCESS;
49}
50
51CsrResult __attribute__((weak)) CsrSdioResume(CsrSdioFunction *function)
52{
53 return CSR_RESULT_SUCCESS;
54}
55
56int __attribute__((weak)) csr_sdio_linux_install_irq(CsrSdioFunction *function)
57{
58 return 0;
59}
60
61int __attribute__((weak)) csr_sdio_linux_remove_irq(CsrSdioFunction *function)
62{
63 return 0;
64}
65
66void __attribute__((weak)) CsrSdioInsertedAcknowledge(CsrSdioFunction *function, CsrResult result)
67{
68}
69
70void __attribute__((weak)) CsrSdioRemovedAcknowledge(CsrSdioFunction *function)
71{
72}
73
74void __attribute__((weak)) CsrSdioSuspendAcknowledge(CsrSdioFunction *function, CsrResult result)
75{
76}
77
78void __attribute__((weak)) CsrSdioResumeAcknowledge(CsrSdioFunction *function, CsrResult result)
79{
80}
81
82
diff --git a/drivers/staging/csr/sme_blocking.c b/drivers/staging/csr/sme_blocking.c
deleted file mode 100644
index 0c6e21636e7f..000000000000
--- a/drivers/staging/csr/sme_blocking.c
+++ /dev/null
@@ -1,1466 +0,0 @@
1/*
2 * ---------------------------------------------------------------------------
3 * FILE: sme_mgt_blocking.c
4 *
5 * PURPOSE:
6 * This file contains the driver specific implementation of
7 * the WEXT <==> SME MGT interface for all SME builds that support WEXT.
8 *
9 * Copyright (C) 2009 by Cambridge Silicon Radio Ltd.
10 *
11 * Refer to LICENSE.txt included with this source code for details on
12 * the license terms.
13 *
14 * ---------------------------------------------------------------------------
15 */
16
17#include "unifi_priv.h"
18
19
20/*
21 * This file also contains the implementation of the asynchronous
22 * requests to the SME.
23 *
24 * Before calling an asynchronous SME function, we call sme_init_request()
25 * which gets hold of the SME semaphore and updates the request status.
26 * The semaphore makes sure that there is only one pending request to
27 * the SME at a time.
28 *
29 * Now we are ready to call the SME function, but only if
30 * sme_init_request() has returned 0.
31 *
32 * When the SME function returns, we need to wait
33 * for the reply. This is done in sme_wait_for_reply().
34 * If the request times-out, the request status is set to SME_REQUEST_TIMEDOUT
35 * and the sme_wait_for_reply() returns.
36 *
37 * If the SME replies in time, we call sme_complete_request().
38 * There we change the request status to SME_REQUEST_RECEIVED. This will
39 * wake up the process waiting on sme_wait_for_reply().
40 * It is important that we copy the reply data in priv->sme_reply
41 * before calling sme_complete_request().
42 *
43 * Handling the wext requests, we need to block
44 * until the SME sends the response to our request.
45 * We use the sme_init_request() and sme_wait_for_reply()
46 * to implement this behavior in the following functions:
47 * sme_mgt_wifi_on()
48 * sme_mgt_wifi_off()
49 * sme_mgt_scan_full()
50 * sme_mgt_scan_results_get_async()
51 * sme_mgt_connect()
52 * unifi_mgt_media_status_ind()
53 * sme_mgt_disconnect()
54 * sme_mgt_pmkid()
55 * sme_mgt_key()
56 * sme_mgt_mib_get()
57 * sme_mgt_mib_set()
58 * sme_mgt_versions_get()
59 * sme_mgt_set_value()
60 * sme_mgt_get_value()
61 * sme_mgt_set_value_async()
62 * sme_mgt_get_value_async()
63 * sme_mgt_packet_filter_set()
64 * sme_mgt_tspec()
65 */
66
67
68/*
69 * Handling the suspend and resume system events, we need to block
70 * until the SME sends the response to our indication.
71 * We use the sme_init_request() and sme_wait_for_reply()
72 * to implement this behavior in the following functions:
73 * sme_sys_suspend()
74 * sme_sys_resume()
75 */
76
77#define UNIFI_SME_MGT_SHORT_TIMEOUT 10000
78#define UNIFI_SME_MGT_LONG_TIMEOUT 19000
79#define UNIFI_SME_SYS_LONG_TIMEOUT 10000
80
81#ifdef UNIFI_DEBUG
82# define sme_wait_for_reply(priv, t) _sme_wait_for_reply(priv, t, __func__)
83#else
84# define sme_wait_for_reply(priv, t) _sme_wait_for_reply(priv, t, NULL)
85#endif
86
87static int
88sme_init_request(unifi_priv_t *priv)
89{
90 if (priv == NULL) {
91 unifi_error(priv, "sme_init_request: Invalid priv\n");
92 return -EIO;
93 }
94
95 unifi_trace(priv, UDBG5, "sme_init_request: wait sem\n");
96
97 /* Grab the SME semaphore until the reply comes, or timeout */
98 if (down_interruptible(&priv->sme_sem)) {
99 unifi_error(priv, "sme_init_request: Failed to get SME semaphore\n");
100 return -EIO;
101 }
102 unifi_trace(priv, UDBG5, "sme_init_request: got sem: pending\n");
103
104 priv->sme_reply.request_status = SME_REQUEST_PENDING;
105
106 return 0;
107
108} /* sme_init_request() */
109
110
111void
112uf_sme_complete_request(unifi_priv_t *priv, CsrResult reply_status, const char *func)
113{
114 if (priv == NULL) {
115 unifi_error(priv, "sme_complete_request: Invalid priv\n");
116 return;
117 }
118
119 if (priv->sme_reply.request_status != SME_REQUEST_PENDING) {
120 unifi_notice(priv,
121 "sme_complete_request: request not pending %s (s:%d)\n",
122 (func ? func : ""), priv->sme_reply.request_status);
123 return;
124 }
125 unifi_trace(priv, UDBG5,
126 "sme_complete_request: completed %s (s:%d)\n",
127 (func ? func : ""), priv->sme_reply.request_status);
128
129 priv->sme_reply.request_status = SME_REQUEST_RECEIVED;
130 priv->sme_reply.reply_status = reply_status;
131
132 wake_up_interruptible(&priv->sme_request_wq);
133
134 return;
135}
136
137
138void
139uf_sme_cancel_request(unifi_priv_t *priv, CsrResult reply_status)
140{
141 /* Check for a blocking SME request in progress, and cancel the wait.
142 * This should be used when the character device is closed.
143 */
144
145 if (priv == NULL) {
146 unifi_error(priv, "sme_cancel_request: Invalid priv\n");
147 return;
148 }
149
150 /* If no request is pending, nothing to wake up */
151 if (priv->sme_reply.request_status != SME_REQUEST_PENDING) {
152 unifi_trace(priv, UDBG5,
153 "sme_cancel_request: no request was pending (s:%d)\n",
154 priv->sme_reply.request_status);
155 /* Nothing to do */
156 return;
157 }
158 unifi_trace(priv, UDBG5,
159 "sme_cancel_request: request cancelled (s:%d)\n",
160 priv->sme_reply.request_status);
161
162 /* Wake up the wait with an error status */
163 priv->sme_reply.request_status = SME_REQUEST_CANCELLED;
164 priv->sme_reply.reply_status = reply_status; /* unimportant since the CANCELLED state will fail the ioctl */
165
166 wake_up_interruptible(&priv->sme_request_wq);
167
168 return;
169}
170
171
172static int
173_sme_wait_for_reply(unifi_priv_t *priv,
174 unsigned long timeout, const char *func)
175{
176 long r;
177
178 unifi_trace(priv, UDBG5, "sme_wait_for_reply: %s sleep\n", func ? func : "");
179 r = wait_event_interruptible_timeout(priv->sme_request_wq,
180 (priv->sme_reply.request_status != SME_REQUEST_PENDING),
181 msecs_to_jiffies(timeout));
182 unifi_trace(priv, UDBG5, "sme_wait_for_reply: %s awake (%d)\n", func ? func : "", r);
183
184 if (r == -ERESTARTSYS) {
185 /* The thread was killed */
186 unifi_info(priv, "ERESTARTSYS in _sme_wait_for_reply\n");
187 up(&priv->sme_sem);
188 return r;
189 }
190 if (priv->sme_reply.request_status == SME_REQUEST_CANCELLED) {
191 unifi_trace(priv, UDBG5, "Cancelled waiting for SME to reply (%s s:%d, t:%d, r:%d)\n",
192 (func ? func : ""), priv->sme_reply.request_status, timeout, r);
193
194 /* Release the SME semaphore that was downed in sme_init_request() */
195 up(&priv->sme_sem);
196 return -EIO; /* fail the ioctl */
197 }
198 if ((r == 0) && (priv->sme_reply.request_status != SME_REQUEST_RECEIVED)) {
199 unifi_notice(priv, "Timeout waiting for SME to reply (%s s:%d, t:%d)\n",
200 (func ? func : ""), priv->sme_reply.request_status, timeout);
201
202 priv->sme_reply.request_status = SME_REQUEST_TIMEDOUT;
203
204 /* Release the SME semaphore that was downed in sme_init_request() */
205 up(&priv->sme_sem);
206
207 return -ETIMEDOUT;
208 }
209
210 unifi_trace(priv, UDBG5, "sme_wait_for_reply: %s received (%d)\n",
211 func ? func : "", r);
212
213 /* Release the SME semaphore that was downed in sme_init_request() */
214 up(&priv->sme_sem);
215
216 return 0;
217} /* sme_wait_for_reply() */
218
219
220
221
222#ifdef CSR_SUPPORT_WEXT
223int sme_mgt_wifi_on(unifi_priv_t *priv)
224{
225 u16 numElements;
226 CsrWifiSmeDataBlock* dataList;
227#ifdef CSR_SUPPORT_WEXT_AP
228 int r;
229#endif
230
231 if (priv->smepriv == NULL) {
232 unifi_error(priv, "sme_mgt_wifi_on: invalid smepriv\n");
233 return -EIO;
234 }
235
236 if (priv->mib_data.length) {
237 numElements = 1;
238 dataList = &priv->mib_data;
239 } else {
240 numElements = 0;
241 dataList = NULL;
242 }
243 /* Start the SME */
244#ifdef CSR_SUPPORT_WEXT_AP
245 r = sme_init_request(priv);
246 if (r) {
247 return -EIO;
248 }
249#endif
250 CsrWifiSmeWifiOnReqSend(0, priv->sta_mac_address, numElements, dataList);
251#ifdef CSR_SUPPORT_WEXT_AP
252 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_LONG_TIMEOUT);
253 unifi_trace(priv, UDBG4,
254 "sme_mgt_wifi_on: unifi_mgt_wifi_oo_req <-- (r=%d, status=%d)\n",
255 r, priv->sme_reply.reply_status);
256 return convert_sme_error(priv->sme_reply.reply_status);
257#else
258 return 0;
259#endif
260} /* sme_mgt_wifi_on() */
261
262
263int sme_mgt_wifi_off(unifi_priv_t *priv)
264{
265 int r;
266
267 if (priv->smepriv == NULL) {
268 unifi_error(priv, "sme_mgt_wifi_off: invalid smepriv\n");
269 return -EIO;
270 }
271
272 r = sme_init_request(priv);
273 if (r)
274 return -EIO;
275
276 /* Stop the SME */
277 CsrWifiSmeWifiOffReqSend(0);
278
279 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_LONG_TIMEOUT);
280 if (r)
281 return r;
282
283 unifi_trace(priv, UDBG4,
284 "sme_mgt_wifi_off: unifi_mgt_wifi_off_req <-- (r=%d, status=%d)\n",
285 r, priv->sme_reply.reply_status);
286 return convert_sme_error(priv->sme_reply.reply_status);
287
288} /* sme_mgt_wifi_off */
289
290int sme_mgt_key(unifi_priv_t *priv, CsrWifiSmeKey *sme_key,
291 CsrWifiSmeListAction action)
292{
293 int r;
294
295 if (priv->smepriv == NULL) {
296 unifi_error(priv, "sme_mgt_key: invalid smepriv\n");
297 return -EIO;
298 }
299
300 r = sme_init_request(priv);
301 if (r)
302 return -EIO;
303
304 CsrWifiSmeKeyReqSend(0, CSR_WIFI_INTERFACE_IN_USE, action, *sme_key);
305
306 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
307 if (r)
308 return r;
309
310 return convert_sme_error(priv->sme_reply.reply_status);
311}
312
313
314int sme_mgt_scan_full(unifi_priv_t *priv,
315 CsrWifiSsid *specific_ssid,
316 int num_channels,
317 unsigned char *channel_list)
318{
319 CsrWifiMacAddress bcastAddress = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }};
320 u8 is_active = (num_channels > 0) ? TRUE : FALSE;
321 int r;
322
323 if (priv->smepriv == NULL) {
324 unifi_error(priv, "sme_mgt_scan_full: invalid smepriv\n");
325 return -EIO;
326 }
327
328 unifi_trace(priv, UDBG4, "sme_mgt_scan_full: -->\n");
329
330 r = sme_init_request(priv);
331 if (r)
332 return -EIO;
333
334 /* If a channel list is provided, do an active scan */
335 if (is_active) {
336 unifi_trace(priv, UDBG1,
337 "channel list - num_channels: %d, active scan\n",
338 num_channels);
339 }
340
341 CsrWifiSmeScanFullReqSend(0,
342 specific_ssid->length?1:0, /* 0 or 1 SSIDS */
343 specific_ssid,
344 bcastAddress,
345 is_active,
346 CSR_WIFI_SME_BSS_TYPE_ANY_BSS,
347 CSR_WIFI_SME_SCAN_TYPE_ALL,
348 (u16)num_channels, channel_list,
349 0, NULL);
350
351 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_LONG_TIMEOUT);
352 if (r)
353 return r;
354
355 unifi_trace(priv, UDBG4, "sme_mgt_scan_full: <-- (status=%d)\n", priv->sme_reply.reply_status);
356 if (priv->sme_reply.reply_status == CSR_WIFI_RESULT_UNAVAILABLE)
357 return 0; /* initial scan already underway */
358 else
359 return convert_sme_error(priv->sme_reply.reply_status);
360}
361
362
363int sme_mgt_scan_results_get_async(unifi_priv_t *priv,
364 struct iw_request_info *info,
365 char *scan_results,
366 long scan_results_len)
367{
368 u16 scan_result_list_count;
369 CsrWifiSmeScanResult *scan_result_list;
370 CsrWifiSmeScanResult *scan_result;
371 int r;
372 int i;
373 char *current_ev = scan_results;
374
375 if (priv->smepriv == NULL) {
376 unifi_error(priv, "sme_mgt_scan_results_get_async: invalid smepriv\n");
377 return -EIO;
378 }
379
380 r = sme_init_request(priv);
381 if (r)
382 return -EIO;
383
384 CsrWifiSmeScanResultsGetReqSend(0);
385 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_LONG_TIMEOUT);
386 if (r)
387 return r;
388
389 scan_result_list_count = priv->sme_reply.reply_scan_results_count;
390 scan_result_list = priv->sme_reply.reply_scan_results;
391 unifi_trace(priv, UDBG2,
392 "scan_results: Scan returned %d, numElements=%d\n",
393 r, scan_result_list_count);
394
395 /* OK, now we have the scan results */
396 for (i = 0; i < scan_result_list_count; ++i) {
397 scan_result = &scan_result_list[i];
398
399 unifi_trace(priv, UDBG2, "Scan Result: %.*s\n",
400 scan_result->ssid.length,
401 scan_result->ssid.ssid);
402
403 r = unifi_translate_scan(priv->netdev[0], info,
404 current_ev,
405 scan_results + scan_results_len,
406 scan_result, i+1);
407
408 if (r < 0) {
409 kfree(scan_result_list);
410 priv->sme_reply.reply_scan_results_count = 0;
411 priv->sme_reply.reply_scan_results = NULL;
412 return r;
413 }
414
415 current_ev += r;
416 }
417
418 /*
419 * Free the scan results allocated in unifi_mgt_scan_results_get_cfm()
420 * and invalidate the reply_scan_results to avoid re-using
421 * the freed pointers.
422 */
423 kfree(scan_result_list);
424 priv->sme_reply.reply_scan_results_count = 0;
425 priv->sme_reply.reply_scan_results = NULL;
426
427 unifi_trace(priv, UDBG2,
428 "scan_results: Scan translated to %d bytes\n",
429 current_ev - scan_results);
430 return (current_ev - scan_results);
431}
432
433
434int sme_mgt_connect(unifi_priv_t *priv)
435{
436 int r;
437
438 if (priv->smepriv == NULL) {
439 unifi_error(priv, "sme_mgt_connect: invalid smepriv\n");
440 return -EIO;
441 }
442
443 unifi_trace(priv, UDBG2, "sme_mgt_connect: %.*s\n",
444 priv->connection_config.ssid.length,
445 priv->connection_config.ssid.ssid);
446
447 r = sme_init_request(priv);
448 if (r)
449 return -EIO;
450
451 CsrWifiSmeConnectReqSend(0, CSR_WIFI_INTERFACE_IN_USE, priv->connection_config);
452 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
453 if (r)
454 return r;
455
456 if (priv->sme_reply.reply_status)
457 unifi_trace(priv, UDBG1, "sme_mgt_connect: failed with SME status %d\n",
458 priv->sme_reply.reply_status);
459
460 return convert_sme_error(priv->sme_reply.reply_status);
461}
462
463
464int sme_mgt_disconnect(unifi_priv_t *priv)
465{
466 int r;
467
468 if (priv->smepriv == NULL) {
469 unifi_error(priv, "sme_mgt_disconnect: invalid smepriv\n");
470 return -EIO;
471 }
472
473 r = sme_init_request(priv);
474 if (r)
475 return -EIO;
476
477 CsrWifiSmeDisconnectReqSend(0, CSR_WIFI_INTERFACE_IN_USE);
478 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
479 if (r)
480 return r;
481
482 unifi_trace(priv, UDBG4, "sme_mgt_disconnect: <-- (status=%d)\n", priv->sme_reply.reply_status);
483 return convert_sme_error(priv->sme_reply.reply_status);
484}
485
486
487int sme_mgt_pmkid(unifi_priv_t *priv,
488 CsrWifiSmeListAction action,
489 CsrWifiSmePmkidList *pmkid_list)
490{
491 int r;
492
493 if (priv->smepriv == NULL) {
494 unifi_error(priv, "sme_mgt_pmkid: invalid smepriv\n");
495 return -EIO;
496 }
497
498 r = sme_init_request(priv);
499 if (r)
500 return -EIO;
501
502 CsrWifiSmePmkidReqSend(0, CSR_WIFI_INTERFACE_IN_USE, action,
503 pmkid_list->pmkidsCount, pmkid_list->pmkids);
504 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
505 if (r)
506 return r;
507
508 unifi_trace(priv, UDBG4, "sme_mgt_pmkid: <-- (status=%d)\n", priv->sme_reply.reply_status);
509 return convert_sme_error(priv->sme_reply.reply_status);
510}
511
512
513int sme_mgt_mib_get(unifi_priv_t *priv,
514 unsigned char *varbind, int *length)
515{
516 int r;
517
518 if (priv->smepriv == NULL) {
519 unifi_error(priv, "sme_mgt_mib_get: invalid smepriv\n");
520 return -EIO;
521 }
522
523 r = sme_init_request(priv);
524 if (r)
525 return -EIO;
526
527 priv->mib_cfm_buffer = varbind;
528 priv->mib_cfm_buffer_length = MAX_VARBIND_LENGTH;
529
530 CsrWifiSmeMibGetReqSend(0, *length, varbind);
531 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
532 if (r) {
533 priv->mib_cfm_buffer_length = 0;
534 priv->mib_cfm_buffer = NULL;
535 return r;
536 }
537
538 *length = priv->mib_cfm_buffer_length;
539
540 priv->mib_cfm_buffer_length = 0;
541 priv->mib_cfm_buffer = NULL;
542 unifi_trace(priv, UDBG4, "sme_mgt_mib_get: <-- (status=%d)\n", priv->sme_reply.reply_status);
543 return convert_sme_error(priv->sme_reply.reply_status);
544}
545
546int sme_mgt_mib_set(unifi_priv_t *priv,
547 unsigned char *varbind, int length)
548{
549 int r;
550
551 if (priv->smepriv == NULL) {
552 unifi_error(priv, "sme_mgt_mib_get: invalid smepriv\n");
553 return -EIO;
554 }
555
556 r = sme_init_request(priv);
557 if (r)
558 return -EIO;
559
560 CsrWifiSmeMibSetReqSend(0, length, varbind);
561 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
562 if (r)
563 return r;
564
565 unifi_trace(priv, UDBG4, "sme_mgt_mib_set: <-- (status=%d)\n", priv->sme_reply.reply_status);
566 return convert_sme_error(priv->sme_reply.reply_status);
567}
568
569#endif /* CSR_SUPPORT_WEXT */
570
571int sme_mgt_power_config_set(unifi_priv_t *priv, CsrWifiSmePowerConfig *powerConfig)
572{
573#ifdef CSR_SME_USERSPACE
574 int r;
575
576 if (priv->smepriv == NULL) {
577 unifi_error(priv, "sme_mgt_set_value_async: invalid smepriv\n");
578 return -EIO;
579 }
580
581 r = sme_init_request(priv);
582 if (r)
583 return -EIO;
584
585 CsrWifiSmePowerConfigSetReqSend(0, *powerConfig);
586
587 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
588 if (r)
589 return r;
590
591 unifi_trace(priv, UDBG4,
592 "sme_mgt_set_value_async: unifi_mgt_set_value_req <-- (r=%d status=%d)\n",
593 r, priv->sme_reply.reply_status);
594 return convert_sme_error(priv->sme_reply.reply_status);
595#else
596 CsrResult status;
597 if (priv->smepriv == NULL) {
598 unifi_error(priv, "sme_mgt_set_value: invalid smepriv\n");
599 return -EIO;
600 }
601 CsrWifiSmeMgtClaimSyncAccess(priv->smepriv);
602 status = CsrWifiSmeMgtPowerConfigSetReq(priv->smepriv, *powerConfig);
603 CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv);
604 return convert_sme_error(status);
605#endif
606}
607
608int sme_mgt_sme_config_set(unifi_priv_t *priv, CsrWifiSmeStaConfig *staConfig, CsrWifiSmeDeviceConfig *deviceConfig)
609{
610#ifdef CSR_SME_USERSPACE
611 int r;
612
613 if (priv->smepriv == NULL) {
614 unifi_error(priv, "sme_mgt_sme_config_set: invalid smepriv\n");
615 return -EIO;
616 }
617
618 r = sme_init_request(priv);
619 if (r)
620 return -EIO;
621
622 CsrWifiSmeSmeStaConfigSetReqSend(0, CSR_WIFI_INTERFACE_IN_USE, *staConfig);
623 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
624 if (r)
625 return r;
626
627 unifi_trace(priv, UDBG4,
628 "sme_mgt_sme_config_set: CsrWifiSmeSmeStaConfigSetReq <-- (r=%d status=%d)\n",
629 r, priv->sme_reply.reply_status);
630
631 r = sme_init_request(priv);
632 if (r)
633 return -EIO;
634
635 CsrWifiSmeSmeCommonConfigSetReqSend(0, *deviceConfig);
636 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
637 if (r)
638 return r;
639
640 unifi_trace(priv, UDBG4,
641 "sme_mgt_sme_config_set: CsrWifiSmeSmeCommonConfigSetReq <-- (r=%d status=%d)\n",
642 r, priv->sme_reply.reply_status);
643
644 return convert_sme_error(priv->sme_reply.reply_status);
645#else
646 CsrResult status;
647 if (priv->smepriv == NULL) {
648 unifi_error(priv, "sme_mgt_sme_config_set: invalid smepriv\n");
649 return -EIO;
650 }
651 CsrWifiSmeMgtClaimSyncAccess(priv->smepriv);
652 status = CsrWifiSmeMgtSmeConfigSetReq(priv->smepriv, *staConfig);
653 status = CsrWifiSmeMgtDeviceConfigSetReq(priv->smepriv, *deviceConfig);
654 CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv);
655 return convert_sme_error(status);
656#endif
657}
658
659#ifdef CSR_SUPPORT_WEXT
660
661int sme_mgt_mib_config_set(unifi_priv_t *priv, CsrWifiSmeMibConfig *mibConfig)
662{
663#ifdef CSR_SME_USERSPACE
664 int r;
665
666 if (priv->smepriv == NULL) {
667 unifi_error(priv, "sme_mgt_mib_config_set: invalid smepriv\n");
668 return -EIO;
669 }
670
671 r = sme_init_request(priv);
672 if (r)
673 return -EIO;
674
675 CsrWifiSmeMibConfigSetReqSend(0, *mibConfig);
676
677 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
678 if (r)
679 return r;
680
681 unifi_trace(priv, UDBG4,
682 "sme_mgt_mib_config_set: unifi_mgt_set_mib_config_req <-- (r=%d status=%d)\n",
683 r, priv->sme_reply.reply_status);
684 return convert_sme_error(priv->sme_reply.reply_status);
685#else
686 CsrResult status;
687 if (priv->smepriv == NULL) {
688 unifi_error(priv, "sme_mgt_mib_config_set: invalid smepriv\n");
689 return -EIO;
690 }
691 CsrWifiSmeMgtClaimSyncAccess(priv->smepriv);
692 status = CsrWifiSmeMgtMibConfigSetReq(priv->smepriv, *mibConfig);
693 CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv);
694 return convert_sme_error(status);
695#endif
696}
697
698int sme_mgt_coex_config_set(unifi_priv_t *priv, CsrWifiSmeCoexConfig *coexConfig)
699{
700#ifdef CSR_SME_USERSPACE
701 int r;
702
703 if (priv->smepriv == NULL) {
704 unifi_error(priv, "sme_mgt_coex_config_set: invalid smepriv\n");
705 return -EIO;
706 }
707
708 r = sme_init_request(priv);
709 if (r)
710 return -EIO;
711
712 CsrWifiSmeCoexConfigSetReqSend(0, *coexConfig);
713
714 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
715 if (r)
716 return r;
717
718 unifi_trace(priv, UDBG4,
719 "sme_mgt_coex_config_set: unifi_mgt_set_mib_config_req <-- (r=%d status=%d)\n",
720 r, priv->sme_reply.reply_status);
721 return convert_sme_error(priv->sme_reply.reply_status);
722#else
723 CsrResult status;
724 if (priv->smepriv == NULL) {
725 unifi_error(priv, "sme_mgt_coex_config_set: invalid smepriv\n");
726 return -EIO;
727 }
728 CsrWifiSmeMgtClaimSyncAccess(priv->smepriv);
729 status = CsrWifiSmeMgtCoexConfigSetReq(priv->smepriv, *coexConfig);
730 CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv);
731 return convert_sme_error(status);
732#endif
733}
734
735#endif /* CSR_SUPPORT_WEXT */
736
737int sme_mgt_host_config_set(unifi_priv_t *priv, CsrWifiSmeHostConfig *hostConfig)
738{
739#ifdef CSR_SME_USERSPACE
740 int r;
741
742 if (priv->smepriv == NULL) {
743 unifi_error(priv, "sme_mgt_host_config_set: invalid smepriv\n");
744 return -EIO;
745 }
746
747 r = sme_init_request(priv);
748 if (r)
749 return -EIO;
750
751 CsrWifiSmeHostConfigSetReqSend(0, CSR_WIFI_INTERFACE_IN_USE, *hostConfig);
752
753 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
754 if (r)
755 return r;
756
757 unifi_trace(priv, UDBG4,
758 "sme_mgt_host_config_set: unifi_mgt_set_host_config_req <-- (r=%d status=%d)\n",
759 r, priv->sme_reply.reply_status);
760 return convert_sme_error(priv->sme_reply.reply_status);
761#else
762 CsrResult status;
763 if (priv->smepriv == NULL) {
764 unifi_error(priv, "sme_mgt_host_config_set: invalid smepriv\n");
765 return -EIO;
766 }
767 CsrWifiSmeMgtClaimSyncAccess(priv->smepriv);
768 status = CsrWifiSmeMgtHostConfigSetReq(priv->smepriv, *hostConfig);
769 CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv);
770 return convert_sme_error(status);
771#endif
772}
773
774#ifdef CSR_SUPPORT_WEXT
775
776int sme_mgt_versions_get(unifi_priv_t *priv, CsrWifiSmeVersions *versions)
777{
778#ifdef CSR_SME_USERSPACE
779 int r;
780
781 if (priv->smepriv == NULL) {
782 unifi_error(priv, "sme_mgt_versions_get: invalid smepriv\n");
783 return -EIO;
784 }
785
786 unifi_trace(priv, UDBG4, "sme_mgt_versions_get: unifi_mgt_versions_get_req -->\n");
787 r = sme_init_request(priv);
788 if (r)
789 return -EIO;
790
791 CsrWifiSmeVersionsGetReqSend(0);
792
793 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
794 if (r)
795 return r;
796
797 /* store the reply */
798 if (versions != NULL) {
799 memcpy((unsigned char*)versions,
800 (unsigned char*)&priv->sme_reply.versions,
801 sizeof(CsrWifiSmeVersions));
802 }
803
804 unifi_trace(priv, UDBG4,
805 "sme_mgt_versions_get: unifi_mgt_versions_get_req <-- (r=%d status=%d)\n",
806 r, priv->sme_reply.reply_status);
807
808 return convert_sme_error(priv->sme_reply.reply_status);
809#else
810 CsrResult status;
811 CsrWifiSmeMgtClaimSyncAccess(priv->smepriv);
812 status = CsrWifiSmeMgtVersionsGetReq(priv->smepriv, versions);
813 CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv);
814 return convert_sme_error(status);
815#endif
816}
817
818#endif /* CSR_SUPPORT_WEXT */
819
820int sme_mgt_power_config_get(unifi_priv_t *priv, CsrWifiSmePowerConfig *powerConfig)
821{
822#ifdef CSR_SME_USERSPACE
823 int r;
824
825 if (priv->smepriv == NULL) {
826 unifi_error(priv, "sme_mgt_power_config_get: invalid smepriv\n");
827 return -EIO;
828 }
829
830 unifi_trace(priv, UDBG4, "sme_mgt_power_config_get: unifi_mgt_power_config_req -->\n");
831 r = sme_init_request(priv);
832 if (r)
833 return -EIO;
834
835 CsrWifiSmePowerConfigGetReqSend(0);
836
837 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
838 if (r)
839 return r;
840
841 /* store the reply */
842 if (powerConfig != NULL) {
843 memcpy((unsigned char*)powerConfig,
844 (unsigned char*)&priv->sme_reply.powerConfig,
845 sizeof(CsrWifiSmePowerConfig));
846 }
847
848 unifi_trace(priv, UDBG4,
849 "sme_mgt_get_versions: unifi_mgt_power_config_req <-- (r=%d status=%d)\n",
850 r, priv->sme_reply.reply_status);
851
852 return convert_sme_error(priv->sme_reply.reply_status);
853#else
854 CsrResult status;
855 CsrWifiSmeMgtClaimSyncAccess(priv->smepriv);
856 status = CsrWifiSmeMgtPowerConfigGetReq(priv->smepriv, powerConfig);
857 CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv);
858 return convert_sme_error(status);
859#endif
860}
861
862int sme_mgt_host_config_get(unifi_priv_t *priv, CsrWifiSmeHostConfig *hostConfig)
863{
864#ifdef CSR_SME_USERSPACE
865 int r;
866
867 if (priv->smepriv == NULL) {
868 unifi_error(priv, "sme_mgt_host_config_get: invalid smepriv\n");
869 return -EIO;
870 }
871
872 unifi_trace(priv, UDBG4, "sme_mgt_host_config_get: unifi_mgt_host_config_get_req -->\n");
873 r = sme_init_request(priv);
874 if (r)
875 return -EIO;
876
877 CsrWifiSmeHostConfigGetReqSend(0, CSR_WIFI_INTERFACE_IN_USE);
878
879 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
880 if (r)
881 return r;
882
883 /* store the reply */
884 if (hostConfig != NULL)
885 memcpy((unsigned char*)hostConfig,
886 (unsigned char*)&priv->sme_reply.hostConfig,
887 sizeof(CsrWifiSmeHostConfig));
888
889 unifi_trace(priv, UDBG4,
890 "sme_mgt_host_config_get: unifi_mgt_host_config_get_req <-- (r=%d status=%d)\n",
891 r, priv->sme_reply.reply_status);
892
893 return convert_sme_error(priv->sme_reply.reply_status);
894#else
895 CsrResult status;
896 CsrWifiSmeMgtClaimSyncAccess(priv->smepriv);
897 status = CsrWifiSmeMgtHostConfigGetReq(priv->smepriv, hostConfig);
898 CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv);
899 return convert_sme_error(status);
900#endif
901}
902
903int sme_mgt_sme_config_get(unifi_priv_t *priv, CsrWifiSmeStaConfig *staConfig, CsrWifiSmeDeviceConfig *deviceConfig)
904{
905#ifdef CSR_SME_USERSPACE
906 int r;
907
908 if (priv->smepriv == NULL) {
909 unifi_error(priv, "sme_mgt_sme_config_get: invalid smepriv\n");
910 return -EIO;
911 }
912
913 unifi_trace(priv, UDBG4, "sme_mgt_sme_config_get: unifi_mgt_sme_config_get_req -->\n");
914
915 /* Common device config */
916 r = sme_init_request(priv);
917 if (r)
918 return -EIO;
919
920 CsrWifiSmeSmeCommonConfigGetReqSend(0);
921 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
922 if (r)
923 return r;
924
925 /* store the reply */
926 if (deviceConfig != NULL)
927 memcpy((unsigned char*)deviceConfig,
928 (unsigned char*)&priv->sme_reply.deviceConfig,
929 sizeof(CsrWifiSmeDeviceConfig));
930
931 /* STA config */
932 r = sme_init_request(priv);
933 if (r)
934 return -EIO;
935
936 CsrWifiSmeSmeStaConfigGetReqSend(0, CSR_WIFI_INTERFACE_IN_USE);
937 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
938 if (r)
939 return r;
940
941 /* store the reply */
942 if (staConfig != NULL)
943 memcpy((unsigned char*)staConfig,
944 (unsigned char*)&priv->sme_reply.staConfig,
945 sizeof(CsrWifiSmeStaConfig));
946
947 unifi_trace(priv, UDBG4,
948 "sme_mgt_sme_config_get: unifi_mgt_sme_config_get_req <-- (r=%d status=%d)\n",
949 r, priv->sme_reply.reply_status);
950
951 return convert_sme_error(priv->sme_reply.reply_status);
952#else
953 CsrResult status;
954 CsrWifiSmeMgtClaimSyncAccess(priv->smepriv);
955 status = CsrWifiSmeMgtSmeConfigGetReq(priv->smepriv, staConfig);
956 status = CsrWifiSmeMgtDeviceConfigGetReq(priv->smepriv, deviceConfig);
957 CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv);
958 return convert_sme_error(status);
959#endif
960}
961
962int sme_mgt_coex_info_get(unifi_priv_t *priv, CsrWifiSmeCoexInfo *coexInfo)
963{
964#ifdef CSR_SME_USERSPACE
965 int r;
966
967 if (priv->smepriv == NULL) {
968 unifi_error(priv, "sme_mgt_coex_info_get: invalid smepriv\n");
969 return -EIO;
970 }
971
972 unifi_trace(priv, UDBG4, "sme_mgt_coex_info_get: unifi_mgt_coex_info_get_req -->\n");
973 r = sme_init_request(priv);
974 if (r)
975 return -EIO;
976
977 CsrWifiSmeCoexInfoGetReqSend(0);
978
979 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
980 if (r)
981 return r;
982
983 /* store the reply */
984 if (coexInfo != NULL)
985 memcpy((unsigned char*)coexInfo,
986 (unsigned char*)&priv->sme_reply.coexInfo,
987 sizeof(CsrWifiSmeCoexInfo));
988
989 unifi_trace(priv, UDBG4,
990 "sme_mgt_coex_info_get: unifi_mgt_coex_info_get_req <-- (r=%d status=%d)\n",
991 r, priv->sme_reply.reply_status);
992
993 return convert_sme_error(priv->sme_reply.reply_status);
994#else
995 CsrResult status;
996 CsrWifiSmeMgtClaimSyncAccess(priv->smepriv);
997 status = CsrWifiSmeMgtCoexInfoGetReq(priv->smepriv, coexInfo);
998 CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv);
999 return convert_sme_error(status);
1000#endif
1001}
1002
1003#ifdef CSR_SUPPORT_WEXT
1004
1005int sme_mgt_coex_config_get(unifi_priv_t *priv, CsrWifiSmeCoexConfig *coexConfig)
1006{
1007#ifdef CSR_SME_USERSPACE
1008 int r;
1009
1010 if (priv->smepriv == NULL) {
1011 unifi_error(priv, "sme_mgt_coex_config_get: invalid smepriv\n");
1012 return -EIO;
1013 }
1014
1015 unifi_trace(priv, UDBG4, "sme_mgt_coex_config_get: unifi_mgt_coex_config_get_req -->\n");
1016 r = sme_init_request(priv);
1017 if (r)
1018 return -EIO;
1019
1020 CsrWifiSmeCoexConfigGetReqSend(0);
1021
1022 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
1023 if (r)
1024 return r;
1025
1026 /* store the reply */
1027 if (coexConfig != NULL)
1028 memcpy((unsigned char*)coexConfig,
1029 (unsigned char*)&priv->sme_reply.coexConfig,
1030 sizeof(CsrWifiSmeCoexConfig));
1031
1032 unifi_trace(priv, UDBG4,
1033 "sme_mgt_coex_config_get: unifi_mgt_coex_config_get_req <-- (r=%d status=%d)\n",
1034 r, priv->sme_reply.reply_status);
1035
1036 return convert_sme_error(priv->sme_reply.reply_status);
1037#else
1038 CsrResult status;
1039 CsrWifiSmeMgtClaimSyncAccess(priv->smepriv);
1040 status = CsrWifiSmeMgtCoexConfigGetReq(priv->smepriv, coexConfig);
1041 CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv);
1042 return convert_sme_error(status);
1043#endif
1044}
1045
1046int sme_mgt_mib_config_get(unifi_priv_t *priv, CsrWifiSmeMibConfig *mibConfig)
1047{
1048#ifdef CSR_SME_USERSPACE
1049 int r;
1050
1051 if (priv->smepriv == NULL) {
1052 unifi_error(priv, "sme_mgt_mib_config_get: invalid smepriv\n");
1053 return -EIO;
1054 }
1055
1056 unifi_trace(priv, UDBG4, "sme_mgt_mib_config_get: unifi_mgt_mib_config_get_req -->\n");
1057 r = sme_init_request(priv);
1058 if (r)
1059 return -EIO;
1060
1061 CsrWifiSmeMibConfigGetReqSend(0);
1062
1063 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
1064 if (r)
1065 return r;
1066
1067 /* store the reply */
1068 if (mibConfig != NULL)
1069 memcpy((unsigned char*)mibConfig,
1070 (unsigned char*)&priv->sme_reply.mibConfig,
1071 sizeof(CsrWifiSmeMibConfig));
1072
1073 unifi_trace(priv, UDBG4,
1074 "sme_mgt_mib_config_get: unifi_mgt_mib_config_get_req <-- (r=%d status=%d)\n",
1075 r, priv->sme_reply.reply_status);
1076
1077 return convert_sme_error(priv->sme_reply.reply_status);
1078#else
1079 CsrResult status;
1080 CsrWifiSmeMgtClaimSyncAccess(priv->smepriv);
1081 status = CsrWifiSmeMgtMibConfigGetReq(priv->smepriv, mibConfig);
1082 CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv);
1083 return convert_sme_error(status);
1084#endif
1085}
1086
1087int sme_mgt_connection_info_get(unifi_priv_t *priv, CsrWifiSmeConnectionInfo *connectionInfo)
1088{
1089#ifdef CSR_SME_USERSPACE
1090 int r;
1091
1092 if (priv->smepriv == NULL) {
1093 unifi_error(priv, "sme_mgt_connection_info_get: invalid smepriv\n");
1094 return -EIO;
1095 }
1096
1097 unifi_trace(priv, UDBG4, "sme_mgt_connection_info_get: unifi_mgt_connection_info_get_req -->\n");
1098 r = sme_init_request(priv);
1099 if (r)
1100 return -EIO;
1101
1102 CsrWifiSmeConnectionInfoGetReqSend(0, CSR_WIFI_INTERFACE_IN_USE);
1103
1104 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
1105 if (r)
1106 return r;
1107
1108 /* store the reply */
1109 if (connectionInfo != NULL)
1110 memcpy((unsigned char*)connectionInfo,
1111 (unsigned char*)&priv->sme_reply.connectionInfo,
1112 sizeof(CsrWifiSmeConnectionInfo));
1113
1114 unifi_trace(priv, UDBG4,
1115 "sme_mgt_connection_info_get: unifi_mgt_connection_info_get_req <-- (r=%d status=%d)\n",
1116 r, priv->sme_reply.reply_status);
1117
1118 return convert_sme_error(priv->sme_reply.reply_status);
1119#else
1120 CsrResult status;
1121 CsrWifiSmeMgtClaimSyncAccess(priv->smepriv);
1122 status = CsrWifiSmeMgtConnectionInfoGetReq(priv->smepriv, connectionInfo);
1123 CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv);
1124 return convert_sme_error(status);
1125#endif
1126}
1127
1128int sme_mgt_connection_config_get(unifi_priv_t *priv, CsrWifiSmeConnectionConfig *connectionConfig)
1129{
1130#ifdef CSR_SME_USERSPACE
1131 int r;
1132
1133 if (priv->smepriv == NULL) {
1134 unifi_error(priv, "sme_mgt_connection_config_get: invalid smepriv\n");
1135 return -EIO;
1136 }
1137
1138 unifi_trace(priv, UDBG4, "sme_mgt_connection_config_get: unifi_mgt_connection_config_get_req -->\n");
1139 r = sme_init_request(priv);
1140 if (r)
1141 return -EIO;
1142
1143 CsrWifiSmeConnectionConfigGetReqSend(0, CSR_WIFI_INTERFACE_IN_USE);
1144
1145 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
1146 if (r)
1147 return r;
1148
1149 /* store the reply */
1150 if (connectionConfig != NULL)
1151 memcpy((unsigned char*)connectionConfig,
1152 (unsigned char*)&priv->sme_reply.connectionConfig,
1153 sizeof(CsrWifiSmeConnectionConfig));
1154
1155 unifi_trace(priv, UDBG4,
1156 "sme_mgt_connection_config_get: unifi_mgt_connection_config_get_req <-- (r=%d status=%d)\n",
1157 r, priv->sme_reply.reply_status);
1158
1159 return convert_sme_error(priv->sme_reply.reply_status);
1160#else
1161 CsrResult status;
1162 CsrWifiSmeMgtClaimSyncAccess(priv->smepriv);
1163 status = CsrWifiSmeMgtConnectionConfigGetReq(priv->smepriv, connectionConfig);
1164 CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv);
1165 return convert_sme_error(status);
1166#endif
1167}
1168
1169int sme_mgt_connection_stats_get(unifi_priv_t *priv, CsrWifiSmeConnectionStats *connectionStats)
1170{
1171#ifdef CSR_SME_USERSPACE
1172 int r;
1173
1174 if (priv->smepriv == NULL) {
1175 unifi_error(priv, "sme_mgt_connection_stats_get: invalid smepriv\n");
1176 return -EIO;
1177 }
1178
1179 unifi_trace(priv, UDBG4, "sme_mgt_connection_stats_get: unifi_mgt_connection_stats_get_req -->\n");
1180 r = sme_init_request(priv);
1181 if (r)
1182 return -EIO;
1183
1184 CsrWifiSmeConnectionStatsGetReqSend(0, CSR_WIFI_INTERFACE_IN_USE);
1185
1186 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
1187 if (r)
1188 return r;
1189
1190 /* store the reply */
1191 if (connectionStats != NULL)
1192 memcpy((unsigned char*)connectionStats,
1193 (unsigned char*)&priv->sme_reply.connectionStats,
1194 sizeof(CsrWifiSmeConnectionStats));
1195
1196 unifi_trace(priv, UDBG4,
1197 "sme_mgt_connection_stats_get: unifi_mgt_connection_stats_get_req <-- (r=%d status=%d)\n",
1198 r, priv->sme_reply.reply_status);
1199
1200 return convert_sme_error(priv->sme_reply.reply_status);
1201#else
1202 CsrResult status;
1203 CsrWifiSmeMgtClaimSyncAccess(priv->smepriv);
1204 status = CsrWifiSmeMgtConnectionStatsGetReq(priv->smepriv, connectionStats);
1205 CsrWifiSmeMgtReleaseSyncAccess(priv->smepriv);
1206 return convert_sme_error(status);
1207#endif
1208}
1209
1210#endif /* CSR_SUPPORT_WEXT */
1211
1212int sme_mgt_packet_filter_set(unifi_priv_t *priv)
1213{
1214 CsrWifiIp4Address ipAddress = {{0xFF, 0xFF, 0xFF, 0xFF }};
1215 if (priv->smepriv == NULL) {
1216 unifi_error(priv, "sme_mgt_packet_filter_set: invalid smepriv\n");
1217 return -EIO;
1218 }
1219 if (priv->packet_filters.arp_filter) {
1220 ipAddress.a[0] = (priv->sta_ip_address ) & 0xFF;
1221 ipAddress.a[1] = (priv->sta_ip_address >> 8) & 0xFF;
1222 ipAddress.a[2] = (priv->sta_ip_address >> 16) & 0xFF;
1223 ipAddress.a[3] = (priv->sta_ip_address >> 24) & 0xFF;
1224 }
1225
1226 unifi_trace(priv, UDBG5,
1227 "sme_mgt_packet_filter_set: IP address %d.%d.%d.%d\n",
1228 ipAddress.a[0], ipAddress.a[1],
1229 ipAddress.a[2], ipAddress.a[3]);
1230
1231 /* Doesn't block for a confirm */
1232 CsrWifiSmePacketFilterSetReqSend(0, CSR_WIFI_INTERFACE_IN_USE,
1233 priv->packet_filters.tclas_ies_length,
1234 priv->filter_tclas_ies,
1235 priv->packet_filters.filter_mode,
1236 ipAddress);
1237 return 0;
1238}
1239
1240int sme_mgt_tspec(unifi_priv_t *priv, CsrWifiSmeListAction action,
1241 u32 tid, CsrWifiSmeDataBlock *tspec, CsrWifiSmeDataBlock *tclas)
1242{
1243 int r;
1244
1245 if (priv->smepriv == NULL) {
1246 unifi_error(priv, "sme_mgt_tspec: invalid smepriv\n");
1247 return -EIO;
1248 }
1249
1250 r = sme_init_request(priv);
1251 if (r)
1252 return -EIO;
1253
1254 CsrWifiSmeTspecReqSend(0, CSR_WIFI_INTERFACE_IN_USE,
1255 action, tid, TRUE, 0,
1256 tspec->length, tspec->data,
1257 tclas->length, tclas->data);
1258 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
1259 if (r)
1260 return r;
1261
1262 unifi_trace(priv, UDBG4, "sme_mgt_tspec: <-- (status=%d)\n", priv->sme_reply.reply_status);
1263 return convert_sme_error(priv->sme_reply.reply_status);
1264}
1265
1266
1267
1268int sme_sys_suspend(unifi_priv_t *priv)
1269{
1270 int r;
1271 CsrResult csrResult;
1272
1273 if (priv->smepriv == NULL) {
1274 unifi_error(priv, "sme_sys_suspend: invalid smepriv\n");
1275 return -EIO;
1276 }
1277
1278 r = sme_init_request(priv);
1279 if (r)
1280 return -EIO;
1281
1282 /* Suspend the SME, which MAY cause it to power down UniFi */
1283 CsrWifiRouterCtrlSuspendIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, 0, priv->wol_suspend);
1284 r = sme_wait_for_reply(priv, UNIFI_SME_SYS_LONG_TIMEOUT);
1285 if (r) {
1286 /* No reply - forcibly power down in case the request wasn't processed */
1287 unifi_notice(priv,
1288 "suspend: SME did not reply %s, ",
1289 (priv->ptest_mode | priv->wol_suspend) ? "leave powered" : "power off UniFi anyway\n");
1290
1291 /* Leave power on for production test, though */
1292 if (!priv->ptest_mode) {
1293 /* Put UniFi to deep sleep, in case we can not power it off */
1294 CsrSdioClaim(priv->sdio);
1295 unifi_trace(priv, UDBG1, "Force deep sleep");
1296 csrResult = unifi_force_low_power_mode(priv->card);
1297
1298 /* For WOL, the UniFi must stay powered */
1299 if (!priv->wol_suspend) {
1300 unifi_trace(priv, UDBG1, "Power off\n");
1301 CsrSdioPowerOff(priv->sdio);
1302 }
1303 CsrSdioRelease(priv->sdio);
1304 }
1305 }
1306
1307 if (priv->wol_suspend) {
1308 unifi_trace(priv, UDBG1, "UniFi left powered for WOL\n");
1309
1310 /* Remove the IRQ, which also disables the card SDIO interrupt.
1311 * Disabling the card SDIO interrupt enables the PIO WOL source.
1312 * Removal of the of the handler ensures that in both SDIO and PIO cases
1313 * the card interrupt only wakes the host. The card will be polled
1314 * after resume to handle any pending data.
1315 */
1316 if (csr_sdio_linux_remove_irq(priv->sdio)) {
1317 unifi_notice(priv, "WOL csr_sdio_linux_remove_irq failed\n");
1318 }
1319
1320 if (enable_wol == UNIFI_WOL_SDIO) {
1321 /* Because csr_sdio_linux_remove_irq() disabled the card SDIO interrupt,
1322 * it must be left enabled to wake-on-SDIO.
1323 */
1324 unifi_trace(priv, UDBG1, "Enable card SDIO interrupt for SDIO WOL\n");
1325
1326 CsrSdioClaim(priv->sdio);
1327 csrResult = CsrSdioInterruptEnable(priv->sdio);
1328 CsrSdioRelease(priv->sdio);
1329
1330 if (csrResult != CSR_RESULT_SUCCESS) {
1331 unifi_error(priv, "WOL CsrSdioInterruptEnable failed %d\n", csrResult);
1332 }
1333 } else {
1334 unifi_trace(priv, UDBG1, "Disabled card SDIO interrupt for PIO WOL\n");
1335 }
1336
1337 /* Prevent the BH thread from running during the suspend.
1338 * Upon resume, sme_sys_resume() will trigger a wifi-on, this will cause
1339 * the BH thread to be re-enabled and reinstall the ISR.
1340 */
1341 priv->bh_thread.block_thread = 1;
1342
1343 unifi_trace(priv, UDBG1, "unifi_suspend: suspended BH");
1344 }
1345
1346 /* Consider UniFi to be uninitialised */
1347 priv->init_progress = UNIFI_INIT_NONE;
1348
1349 unifi_trace(priv, UDBG1, "sme_sys_suspend: <-- (r=%d status=%d)\n", r, priv->sme_reply.reply_status);
1350 return convert_sme_error(priv->sme_reply.reply_status);
1351}
1352
1353
1354int sme_sys_resume(unifi_priv_t *priv)
1355{
1356 int r;
1357
1358 unifi_trace(priv, UDBG1, "sme_sys_resume %s\n", priv->wol_suspend ? "warm" : "");
1359
1360 if (priv->smepriv == NULL) {
1361 unifi_error(priv, "sme_sys_resume: invalid smepriv\n");
1362 return -EIO;
1363 }
1364
1365 r = sme_init_request(priv);
1366 if (r)
1367 return -EIO;
1368
1369 CsrWifiRouterCtrlResumeIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, priv->wol_suspend);
1370
1371 r = sme_wait_for_reply(priv, UNIFI_SME_SYS_LONG_TIMEOUT);
1372 if (r)
1373 unifi_notice(priv,
1374 "resume: SME did not reply, return success anyway\n");
1375
1376 return 0;
1377}
1378
1379#ifdef CSR_SUPPORT_WEXT_AP
1380int sme_ap_stop(unifi_priv_t *priv, u16 interface_tag)
1381{
1382 int r;
1383
1384 if (priv->smepriv == NULL) {
1385 unifi_error(priv, "sme_ap_stop: invalid smepriv\n");
1386 return -EIO;
1387 }
1388
1389 r = sme_init_request(priv);
1390 if (r)
1391 return -EIO;
1392
1393 CsrWifiNmeApStopReqSend(0, interface_tag);
1394
1395 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
1396 if (r)
1397 return r;
1398
1399 unifi_trace(priv, UDBG4,
1400 "sme_ap_stop <-- (r=%d status=%d)\n",
1401 r, priv->sme_reply.reply_status);
1402 return convert_sme_error(priv->sme_reply.reply_status);
1403
1404}
1405
1406int sme_ap_start(unifi_priv_t *priv, u16 interface_tag,
1407 CsrWifiSmeApConfig_t * ap_config)
1408{
1409 int r;
1410 CsrWifiSmeApP2pGoConfig p2p_go_param;
1411 memset(&p2p_go_param, 0, sizeof(CsrWifiSmeApP2pGoConfig));
1412
1413 if (priv->smepriv == NULL) {
1414 unifi_error(priv, "sme_ap_start: invalid smepriv\n");
1415 return -EIO;
1416 }
1417
1418 r = sme_init_request(priv);
1419 if (r)
1420 return -EIO;
1421
1422 CsrWifiNmeApStartReqSend(0, interface_tag, CSR_WIFI_AP_TYPE_LEGACY, FALSE,
1423 ap_config->ssid, 1, ap_config->channel,
1424 ap_config->credentials, ap_config->max_connections,
1425 p2p_go_param, FALSE);
1426
1427 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
1428 if (r)
1429 return r;
1430
1431 unifi_trace(priv, UDBG4,
1432 "sme_ap_start <-- (r=%d status=%d)\n",
1433 r, priv->sme_reply.reply_status);
1434 return convert_sme_error(priv->sme_reply.reply_status);
1435}
1436
1437int sme_ap_config(unifi_priv_t *priv,
1438 CsrWifiSmeApMacConfig *ap_mac_config,
1439 CsrWifiNmeApConfig *group_security_config)
1440{
1441 int r;
1442 CsrWifiSmeApP2pGoConfig p2p_go_param;
1443 memset(&p2p_go_param, 0, sizeof(CsrWifiSmeApP2pGoConfig));
1444
1445 if (priv->smepriv == NULL) {
1446 unifi_error(priv, "sme_ap_config: invalid smepriv\n");
1447 return -EIO;
1448 }
1449
1450 r = sme_init_request(priv);
1451 if (r)
1452 return -EIO;
1453
1454 CsrWifiNmeApConfigSetReqSend(0, *group_security_config,
1455 *ap_mac_config);
1456
1457 r = sme_wait_for_reply(priv, UNIFI_SME_MGT_SHORT_TIMEOUT);
1458 if (r)
1459 return r;
1460
1461 unifi_trace(priv, UDBG4,
1462 "sme_ap_config <-- (r=%d status=%d)\n",
1463 r, priv->sme_reply.reply_status);
1464 return convert_sme_error(priv->sme_reply.reply_status);
1465}
1466#endif
diff --git a/drivers/staging/csr/sme_mgt.c b/drivers/staging/csr/sme_mgt.c
deleted file mode 100644
index 58d1b3b72932..000000000000
--- a/drivers/staging/csr/sme_mgt.c
+++ /dev/null
@@ -1,1012 +0,0 @@
1/*
2 * ---------------------------------------------------------------------------
3 * FILE: sme_mgt.c
4 *
5 * PURPOSE:
6 * This file contains the driver specific implementation of
7 * the SME MGT SAP.
8 * It is part of the porting exercise.
9 *
10 * Copyright (C) 2008-2009 by Cambridge Silicon Radio Ltd.
11 *
12 * Refer to LICENSE.txt included with this source code for details on
13 * the license terms.
14 *
15 * ---------------------------------------------------------------------------
16 */
17
18#include "csr_wifi_hip_unifiversion.h"
19#include "unifi_priv.h"
20#include "csr_wifi_hip_conversions.h"
21/*
22 * This file implements the SME MGT API. It contains the following functions:
23 * CsrWifiSmeWifiFlightmodeCfmSend()
24 * CsrWifiSmeWifiOnCfmSend()
25 * CsrWifiSmeWifiOffCfmSend()
26 * CsrWifiSmeWifiOffIndSend()
27 * CsrWifiSmeScanFullCfmSend()
28 * CsrWifiSmeScanResultsGetCfmSend()
29 * CsrWifiSmeScanResultIndSend()
30 * CsrWifiSmeScanResultsFlushCfmSend()
31 * CsrWifiSmeConnectCfmSend()
32 * CsrWifiSmeMediaStatusIndSend()
33 * CsrWifiSmeDisconnectCfmSend()
34 * CsrWifiSmeKeyCfmSend()
35 * CsrWifiSmeMulticastAddressCfmSend()
36 * CsrWifiSmeSetValueCfmSend()
37 * CsrWifiSmeGetValueCfmSend()
38 * CsrWifiSmeMicFailureIndSend()
39 * CsrWifiSmePmkidCfmSend()
40 * CsrWifiSmePmkidCandidateListIndSend()
41 * CsrWifiSmeMibSetCfmSend()
42 * CsrWifiSmeMibGetCfmSend()
43 * CsrWifiSmeMibGetNextCfmSend()
44 * CsrWifiSmeConnectionQualityIndSend()
45 * CsrWifiSmePacketFilterSetCfmSend()
46 * CsrWifiSmeTspecCfmSend()
47 * CsrWifiSmeTspecIndSend()
48 * CsrWifiSmeBlacklistCfmSend()
49 * CsrWifiSmeEventMaskSetCfmSend()
50 * CsrWifiSmeRoamStartIndSend()
51 * CsrWifiSmeRoamCompleteIndSend()
52 * CsrWifiSmeAssociationStartIndSend()
53 * CsrWifiSmeAssociationCompleteIndSend()
54 * CsrWifiSmeIbssStationIndSend()
55 */
56
57
58void CsrWifiSmeMicFailureIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
59{
60#ifdef CSR_SUPPORT_WEXT
61 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
62 CsrWifiSmeMicFailureInd* ind = (CsrWifiSmeMicFailureInd*)msg;
63
64 if (priv == NULL) {
65 unifi_error(NULL, "CsrWifiSmeMicFailureIndSend: invalid priv\n");
66 return;
67 }
68
69 unifi_trace(priv, UDBG1,
70 "CsrWifiSmeMicFailureIndSend: count=%d, KeyType=%d\n",
71 ind->count, ind->keyType);
72
73 wext_send_michaelmicfailure_event(priv, ind->count, ind->address, ind->keyType, ind->interfaceTag);
74#endif
75}
76
77
78void CsrWifiSmePmkidCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
79{
80#ifdef CSR_SUPPORT_WEXT
81 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
82 CsrWifiSmePmkidCfm* cfm = (CsrWifiSmePmkidCfm*)msg;
83
84 if (priv == NULL) {
85 unifi_error(NULL, "CsrWifiSmePmkidCfmSend: Invalid ospriv.\n");
86 return;
87 }
88
89 /*
90 * WEXT never does a GET operation the PMKIDs, so we don't need
91 * handle data returned in pmkids.
92 */
93
94 sme_complete_request(priv, cfm->status);
95#endif
96}
97
98
99void CsrWifiSmePmkidCandidateListIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
100{
101#ifdef CSR_SUPPORT_WEXT
102 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
103 CsrWifiSmePmkidCandidateListInd* ind = (CsrWifiSmePmkidCandidateListInd*)msg;
104 int i;
105
106 if (priv->smepriv == NULL) {
107 unifi_error(priv, "CsrWifiSmePmkidCandidateListIndSend: invalid smepriv\n");
108 return;
109 }
110
111 for (i = 0; i < ind->pmkidCandidatesCount; i++)
112 {
113 wext_send_pmkid_candidate_event(priv, ind->pmkidCandidates[i].bssid, ind->pmkidCandidates[i].preAuthAllowed, ind->interfaceTag);
114 }
115#endif
116}
117
118void CsrWifiSmeScanResultsFlushCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
119{
120}
121
122void CsrWifiSmeScanResultsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
123{
124#ifdef CSR_SUPPORT_WEXT
125 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
126 CsrWifiSmeScanResultsGetCfm* cfm = (CsrWifiSmeScanResultsGetCfm*)msg;
127 int bytesRequired = cfm->scanResultsCount * sizeof(CsrWifiSmeScanResult);
128 int i;
129 u8* current_buff;
130 CsrWifiSmeScanResult* scanCopy;
131
132 if (priv == NULL) {
133 unifi_error(NULL, "CsrWifiSmeScanResultsGetCfmSend: Invalid ospriv.\n");
134 return;
135 }
136
137 /* Calc the size of the buffer reuired */
138 for (i = 0; i < cfm->scanResultsCount; ++i) {
139 const CsrWifiSmeScanResult *scan_result = &cfm->scanResults[i];
140 bytesRequired += scan_result->informationElementsLength;
141 }
142
143 /* Take a Copy of the scan Results :-) */
144 scanCopy = kmalloc(bytesRequired, GFP_KERNEL);
145 memcpy(scanCopy, cfm->scanResults, sizeof(CsrWifiSmeScanResult) * cfm->scanResultsCount);
146
147 /* Take a Copy of the Info Elements AND update the scan result pointers */
148 current_buff = (u8*)&scanCopy[cfm->scanResultsCount];
149 for (i = 0; i < cfm->scanResultsCount; ++i)
150 {
151 CsrWifiSmeScanResult *scan_result = &scanCopy[i];
152 memcpy(current_buff, scan_result->informationElements, scan_result->informationElementsLength);
153 scan_result->informationElements = current_buff;
154 current_buff += scan_result->informationElementsLength;
155 }
156
157 priv->sme_reply.reply_scan_results_count = cfm->scanResultsCount;
158 priv->sme_reply.reply_scan_results = scanCopy;
159
160 sme_complete_request(priv, cfm->status);
161#endif
162}
163
164
165void CsrWifiSmeScanFullCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
166{
167#ifdef CSR_SUPPORT_WEXT
168 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
169 CsrWifiSmeScanFullCfm* cfm = (CsrWifiSmeScanFullCfm*)msg;
170
171 if (priv == NULL) {
172 unifi_error(NULL, "CsrWifiSmeScanFullCfmSend: Invalid ospriv.\n");
173 return;
174 }
175
176 sme_complete_request(priv, cfm->status);
177#endif
178}
179
180
181void CsrWifiSmeScanResultIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
182{
183
184}
185
186
187void CsrWifiSmeConnectCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
188{
189#ifdef CSR_SUPPORT_WEXT
190 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
191 CsrWifiSmeConnectCfm* cfm = (CsrWifiSmeConnectCfm*)msg;
192
193 if (priv == NULL) {
194 unifi_error(NULL, "CsrWifiSmeConnectCfmSend: Invalid ospriv.\n");
195 return;
196 }
197
198 sme_complete_request(priv, cfm->status);
199#endif
200}
201
202
203void CsrWifiSmeDisconnectCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
204{
205#ifdef CSR_SUPPORT_WEXT
206 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
207 CsrWifiSmeDisconnectCfm* cfm = (CsrWifiSmeDisconnectCfm*)msg;
208
209 if (priv == NULL) {
210 unifi_error(NULL, "CsrWifiSmeDisconnectCfmSend: Invalid ospriv.\n");
211 return;
212 }
213
214 sme_complete_request(priv, cfm->status);
215#endif
216}
217
218
219void CsrWifiSmeKeyCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
220{
221#ifdef CSR_SUPPORT_WEXT
222 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
223 CsrWifiSmeKeyCfm* cfm = (CsrWifiSmeKeyCfm*)msg;
224
225 if (priv == NULL) {
226 unifi_error(NULL, "CsrWifiSmeKeyCfmSend: Invalid ospriv.\n");
227 return;
228 }
229
230 sme_complete_request(priv, cfm->status);
231#endif
232}
233
234
235void CsrWifiSmeMulticastAddressCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
236{
237#ifdef CSR_SUPPORT_WEXT
238 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
239 CsrWifiSmeMulticastAddressCfm* cfm = (CsrWifiSmeMulticastAddressCfm*)msg;
240
241 if (priv == NULL) {
242 unifi_error(NULL, "CsrWifiSmeMulticastAddressCfmSend: Invalid ospriv.\n");
243 return;
244 }
245
246 sme_complete_request(priv, cfm->status);
247#endif
248}
249
250void CsrWifiSmeWifiFlightmodeCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
251{
252#ifdef CSR_SUPPORT_WEXT
253 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
254 CsrWifiSmeWifiFlightmodeCfm* cfm = (CsrWifiSmeWifiFlightmodeCfm*)msg;
255
256 if (priv == NULL) {
257 unifi_error(NULL, "CsrWifiSmeWifiFlightmodeCfmSend: Invalid ospriv.\n");
258 return;
259 }
260
261 sme_complete_request(priv, cfm->status);
262#endif
263}
264
265void CsrWifiSmeWifiOnCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
266{
267#ifdef CSR_SUPPORT_WEXT
268 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
269 CsrWifiSmeWifiOnCfm* cfm = (CsrWifiSmeWifiOnCfm*)msg;
270
271 if (priv == NULL) {
272 unifi_error(NULL, "CsrWifiSmeWifiOnCfmSend: Invalid ospriv.\n");
273 return;
274 }
275
276 unifi_trace(priv, UDBG4,
277 "CsrWifiSmeWifiOnCfmSend: wake up status %d\n", cfm->status);
278#ifdef CSR_SUPPORT_WEXT_AP
279 sme_complete_request(priv, cfm->status);
280#endif
281
282#endif
283}
284
285void CsrWifiSmeWifiOffCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
286{
287#ifdef CSR_SUPPORT_WEXT
288 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
289 CsrWifiSmeWifiOffCfm* cfm = (CsrWifiSmeWifiOffCfm*)msg;
290
291 if (priv == NULL) {
292 unifi_error(NULL, "CsrWifiSmeWifiOffCfmSend: Invalid ospriv.\n");
293 return;
294 }
295
296 sme_complete_request(priv, cfm->status);
297#endif
298}
299
300
301void CsrWifiSmeWifiOffIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
302{
303#ifdef CSR_SUPPORT_WEXT
304 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
305 CsrWifiSmeWifiOffInd* ind = (CsrWifiSmeWifiOffInd*)msg;
306
307 if (priv == NULL) {
308 unifi_error(NULL, "CsrWifiRouterCtrlStoppedReqSend: Invalid ospriv.\n");
309 return;
310 }
311
312 if (priv->smepriv == NULL) {
313 unifi_error(priv, "CsrWifiRouterCtrlStoppedReqSend: invalid smepriv\n");
314 return;
315 }
316
317 /*
318 * If the status indicates an error, the SME is in a stopped state.
319 * We need to start it again in order to reinitialise UniFi.
320 */
321 switch (ind->reason) {
322 case CSR_WIFI_SME_CONTROL_INDICATION_ERROR:
323 unifi_trace(priv, UDBG1,
324 "CsrWifiRouterCtrlStoppedReqSend: Restarting SME (ind:%d)\n",
325 ind->reason);
326
327 /* On error, restart the SME */
328 sme_mgt_wifi_on(priv);
329 break;
330 case CSR_WIFI_SME_CONTROL_INDICATION_EXIT:
331#ifdef CSR_SUPPORT_WEXT_AP
332 sme_complete_request(priv, 0);
333#endif
334 break;
335 default:
336 break;
337 }
338
339#endif
340}
341
342void CsrWifiSmeVersionsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
343{
344#ifdef CSR_SUPPORT_WEXT
345 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
346 CsrWifiSmeVersionsGetCfm* cfm = (CsrWifiSmeVersionsGetCfm*)msg;
347
348 if (priv == NULL) {
349 unifi_error(NULL, "CsrWifiSmeVersionsGetCfmSend: Invalid ospriv.\n");
350 return;
351 }
352
353 priv->sme_reply.versions = cfm->versions;
354 sme_complete_request(priv, cfm->status);
355#endif
356}
357
358void CsrWifiSmePowerConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
359{
360 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
361 CsrWifiSmePowerConfigGetCfm* cfm = (CsrWifiSmePowerConfigGetCfm*)msg;
362
363 if (priv == NULL) {
364 unifi_error(NULL, "CsrWifiSmePowerConfigGetCfmSend: Invalid ospriv.\n");
365 return;
366 }
367
368 priv->sme_reply.powerConfig = cfm->powerConfig;
369 sme_complete_request(priv, cfm->status);
370}
371
372void CsrWifiSmeHostConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
373{
374 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
375 CsrWifiSmeHostConfigGetCfm* cfm = (CsrWifiSmeHostConfigGetCfm*)msg;
376
377 if (priv == NULL) {
378 unifi_error(NULL, "CsrWifiSmeHostConfigGetCfmSend: Invalid ospriv.\n");
379 return;
380 }
381
382 priv->sme_reply.hostConfig = cfm->hostConfig;
383 sme_complete_request(priv, cfm->status);
384}
385
386void CsrWifiSmeCoexInfoGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
387{
388 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
389 CsrWifiSmeCoexInfoGetCfm* cfm = (CsrWifiSmeCoexInfoGetCfm*)msg;
390
391 if (priv == NULL) {
392 unifi_error(NULL, "CsrWifiSmeCoexInfoGetCfmSend: Invalid ospriv.\n");
393 return;
394 }
395
396 priv->sme_reply.coexInfo = cfm->coexInfo;
397 sme_complete_request(priv, cfm->status);
398}
399
400void CsrWifiSmeCoexConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
401{
402#ifdef CSR_SUPPORT_WEXT
403 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
404 CsrWifiSmeCoexConfigGetCfm* cfm = (CsrWifiSmeCoexConfigGetCfm*)msg;
405
406 if (priv == NULL) {
407 unifi_error(NULL, "CsrWifiSmeCoexConfigGetCfmSend: Invalid ospriv.\n");
408 return;
409 }
410
411 priv->sme_reply.coexConfig = cfm->coexConfig;
412 sme_complete_request(priv, cfm->status);
413#endif
414}
415
416void CsrWifiSmeMibConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
417{
418#ifdef CSR_SUPPORT_WEXT
419 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
420 CsrWifiSmeMibConfigGetCfm* cfm = (CsrWifiSmeMibConfigGetCfm*)msg;
421
422 if (priv == NULL) {
423 unifi_error(NULL, "CsrWifiSmeMibConfigGetCfmSend: Invalid ospriv.\n");
424 return;
425 }
426
427 priv->sme_reply.mibConfig = cfm->mibConfig;
428 sme_complete_request(priv, cfm->status);
429#endif
430}
431
432void CsrWifiSmeConnectionInfoGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
433{
434#ifdef CSR_SUPPORT_WEXT
435 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
436 CsrWifiSmeConnectionInfoGetCfm* cfm = (CsrWifiSmeConnectionInfoGetCfm*)msg;
437
438 if (priv == NULL) {
439 unifi_error(NULL, "CsrWifiSmeConnectionInfoGetCfmSend: Invalid ospriv.\n");
440 return;
441 }
442
443 priv->sme_reply.connectionInfo = cfm->connectionInfo;
444 sme_complete_request(priv, cfm->status);
445#endif
446}
447
448void CsrWifiSmeConnectionConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
449{
450#ifdef CSR_SUPPORT_WEXT
451 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
452 CsrWifiSmeConnectionConfigGetCfm* cfm = (CsrWifiSmeConnectionConfigGetCfm*)msg;
453
454 if (priv == NULL) {
455 unifi_error(NULL, "CsrWifiSmeConnectionConfigGetCfmSend: Invalid ospriv.\n");
456 return;
457 }
458
459 priv->sme_reply.connectionConfig = cfm->connectionConfig;
460 sme_complete_request(priv, cfm->status);
461#endif
462}
463
464void CsrWifiSmeConnectionStatsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
465{
466#ifdef CSR_SUPPORT_WEXT
467 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
468 CsrWifiSmeConnectionStatsGetCfm* cfm = (CsrWifiSmeConnectionStatsGetCfm*)msg;
469
470 if (priv == NULL) {
471 unifi_error(NULL, "CsrWifiSmeConnectionStatsGetCfmSend: Invalid ospriv.\n");
472 return;
473 }
474
475 priv->sme_reply.connectionStats = cfm->connectionStats;
476 sme_complete_request(priv, cfm->status);
477#endif
478}
479
480void CsrWifiSmeMibSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
481{
482#ifdef CSR_SUPPORT_WEXT
483 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
484 CsrWifiSmeMibSetCfm* cfm = (CsrWifiSmeMibSetCfm*)msg;
485
486 if (priv == NULL) {
487 unifi_error(NULL, "CsrWifiSmeMibSetCfmSend: Invalid ospriv.\n");
488 return;
489 }
490
491 sme_complete_request(priv, cfm->status);
492#endif
493}
494
495void CsrWifiSmeMibGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
496{
497#ifdef CSR_SUPPORT_WEXT
498 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
499 CsrWifiSmeMibGetCfm* cfm = (CsrWifiSmeMibGetCfm*)msg;
500
501 if (priv == NULL) {
502 unifi_error(NULL, "CsrWifiSmeMibGetCfmSend: Invalid ospriv.\n");
503 return;
504 }
505
506 if (cfm->mibAttribute == NULL) {
507 unifi_error(priv, "CsrWifiSmeMibGetCfmSend: Empty reply.\n");
508 sme_complete_request(priv, cfm->status);
509 return;
510 }
511
512 if ((priv->mib_cfm_buffer != NULL) &&
513 (priv->mib_cfm_buffer_length >= cfm->mibAttributeLength)) {
514 memcpy(priv->mib_cfm_buffer, cfm->mibAttribute, cfm->mibAttributeLength);
515 priv->mib_cfm_buffer_length = cfm->mibAttributeLength;
516 } else {
517 unifi_error(priv,
518 "CsrWifiSmeMibGetCfmSend: No room to store MIB data (have=%d need=%d).\n",
519 priv->mib_cfm_buffer_length, cfm->mibAttributeLength);
520 }
521
522 sme_complete_request(priv, cfm->status);
523#endif
524}
525
526void CsrWifiSmeMibGetNextCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
527{
528#ifdef CSR_SUPPORT_WEXT
529 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
530 CsrWifiSmeMibGetNextCfm* cfm = (CsrWifiSmeMibGetNextCfm*)msg;
531
532 if (priv == NULL) {
533 unifi_error(NULL, "CsrWifiSmeMibGetNextCfmSend: Invalid ospriv.\n");
534 return;
535 }
536
537 /* Need to copy MIB data */
538 sme_complete_request(priv, cfm->status);
539#endif
540}
541
542void CsrWifiSmeConnectionQualityIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
543{
544#ifdef CSR_SUPPORT_WEXT
545 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
546 CsrWifiSmeConnectionQualityInd* ind = (CsrWifiSmeConnectionQualityInd*)msg;
547 int signal, noise, snr;
548
549 if (priv == NULL) {
550 unifi_error(NULL, "CsrWifiSmeConnectionQualityIndSend: Invalid ospriv.\n");
551 return;
552 }
553
554 /*
555 * level and noise below are mapped into an unsigned 8 bit number,
556 * ranging from [-192; 63]. The way this is achieved is simply to
557 * add 0x100 onto the number if it is negative,
558 * once clipped to the correct range.
559 */
560 signal = ind->linkQuality.unifiRssi;
561 /* Clip range of snr */
562 snr = (ind->linkQuality.unifiSnr > 0) ? ind->linkQuality.unifiSnr : 0; /* In dB relative, from 0 - 255 */
563 snr = (snr < 255) ? snr : 255;
564 noise = signal - snr;
565
566 /* Clip range of signal */
567 signal = (signal < 63) ? signal : 63;
568 signal = (signal > -192) ? signal : -192;
569
570 /* Clip range of noise */
571 noise = (noise < 63) ? noise : 63;
572 noise = (noise > -192) ? noise : -192;
573
574 /* Make u8 */
575 signal = ( signal < 0 ) ? signal + 0x100 : signal;
576 noise = ( noise < 0 ) ? noise + 0x100 : noise;
577
578 priv->wext_wireless_stats.qual.level = (u8)signal; /* -192 : 63 */
579 priv->wext_wireless_stats.qual.noise = (u8)noise; /* -192 : 63 */
580 priv->wext_wireless_stats.qual.qual = snr; /* 0 : 255 */
581 priv->wext_wireless_stats.qual.updated = 0;
582
583#if WIRELESS_EXT > 16
584 priv->wext_wireless_stats.qual.updated |= IW_QUAL_LEVEL_UPDATED |
585 IW_QUAL_NOISE_UPDATED |
586 IW_QUAL_QUAL_UPDATED;
587#if WIRELESS_EXT > 18
588 priv->wext_wireless_stats.qual.updated |= IW_QUAL_DBM;
589#endif
590#endif
591#endif
592}
593
594void CsrWifiSmePacketFilterSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
595{
596 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
597
598 if (priv == NULL) {
599 unifi_error(NULL, "CsrWifiSmePacketFilterSetCfmSend: Invalid ospriv.\n");
600 return;
601 }
602
603 /* The packet filter set request does not block for a reply */
604}
605
606void CsrWifiSmeTspecCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
607{
608 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
609 CsrWifiSmeTspecCfm* cfm = (CsrWifiSmeTspecCfm*)msg;
610
611 if (priv == NULL) {
612 unifi_error(NULL, "CsrWifiSmeTspecCfmSend: Invalid ospriv.\n");
613 return;
614 }
615
616 sme_complete_request(priv, cfm->status);
617}
618
619void CsrWifiSmeTspecIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
620{
621}
622
623void CsrWifiSmeBlacklistCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
624{
625}
626
627void CsrWifiSmeEventMaskSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
628{
629}
630
631
632void CsrWifiSmeRoamStartIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
633{
634}
635
636void CsrWifiSmeRoamCompleteIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
637{
638 /* This is called when the association completes, before any 802.1x authentication */
639}
640
641void CsrWifiSmeAssociationStartIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
642{
643}
644
645void CsrWifiSmeAssociationCompleteIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
646{
647}
648
649void CsrWifiSmeIbssStationIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
650{
651}
652
653void CsrWifiSmeWifiOnIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
654{
655}
656
657void CsrWifiSmeRestrictedAccessEnableCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
658{
659}
660
661void CsrWifiSmeRestrictedAccessDisableCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
662{
663}
664
665
666void CsrWifiSmeAdhocConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
667{
668}
669
670void CsrWifiSmeAdhocConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
671{
672#ifdef CSR_SUPPORT_WEXT
673 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
674 CsrWifiSmeAdhocConfigSetCfm* cfm = (CsrWifiSmeAdhocConfigSetCfm*)msg;
675
676 if (priv == NULL) {
677 unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
678 return;
679 }
680
681 sme_complete_request(priv, cfm->status);
682#endif
683}
684
685void CsrWifiSmeCalibrationDataGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
686{
687}
688
689void CsrWifiSmeCalibrationDataSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
690{
691#ifdef CSR_SUPPORT_WEXT
692 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
693 CsrWifiSmeCalibrationDataSetCfm* cfm = (CsrWifiSmeCalibrationDataSetCfm*)msg;
694
695 if (priv == NULL) {
696 unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
697 return;
698 }
699
700 sme_complete_request(priv, cfm->status);
701#endif
702}
703
704void CsrWifiSmeCcxConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
705{
706}
707
708void CsrWifiSmeCcxConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
709{
710#ifdef CSR_SUPPORT_WEXT
711 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
712 CsrWifiSmeCcxConfigSetCfm* cfm = (CsrWifiSmeCcxConfigSetCfm*)msg;
713
714 if (priv == NULL) {
715 unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
716 return;
717 }
718
719 sme_complete_request(priv, cfm->status);
720#endif
721}
722
723void CsrWifiSmeCloakedSsidsGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
724{
725}
726
727void CsrWifiSmeCloakedSsidsSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
728{
729#ifdef CSR_SUPPORT_WEXT
730 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
731 CsrWifiSmeCloakedSsidsSetCfm* cfm = (CsrWifiSmeCloakedSsidsSetCfm*)msg;
732
733 if (priv == NULL) {
734 unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
735 return;
736 }
737
738 sme_complete_request(priv, cfm->status);
739#endif
740}
741
742
743void CsrWifiSmeCoexConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
744{
745#ifdef CSR_SUPPORT_WEXT
746 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
747 CsrWifiSmeCoexConfigSetCfm* cfm = (CsrWifiSmeCoexConfigSetCfm*)msg;
748
749 if (priv == NULL) {
750 unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
751 return;
752 }
753
754 sme_complete_request(priv, cfm->status);
755#endif
756}
757
758void CsrWifiSmeHostConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
759{
760 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
761 CsrWifiSmeHostConfigSetCfm* cfm = (CsrWifiSmeHostConfigSetCfm*)msg;
762
763 if (priv == NULL) {
764 unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
765 return;
766 }
767
768 sme_complete_request(priv, cfm->status);
769}
770
771void CsrWifiSmeLinkQualityGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
772{
773}
774
775
776void CsrWifiSmeMibConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
777{
778#ifdef CSR_SUPPORT_WEXT
779 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
780 CsrWifiSmeMibConfigSetCfm* cfm = (CsrWifiSmeMibConfigSetCfm*)msg;
781
782 if (priv == NULL) {
783 unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
784 return;
785 }
786
787 sme_complete_request(priv, cfm->status);
788#endif
789}
790
791void CsrWifiSmePermanentMacAddressGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
792{
793}
794
795void CsrWifiSmePowerConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
796{
797 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
798 CsrWifiSmePowerConfigSetCfm* cfm = (CsrWifiSmePowerConfigSetCfm*)msg;
799
800 if (priv == NULL) {
801 unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
802 return;
803 }
804
805 sme_complete_request(priv, cfm->status);
806}
807
808void CsrWifiSmeRegulatoryDomainInfoGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
809{
810}
811
812void CsrWifiSmeRoamingConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
813{
814}
815
816void CsrWifiSmeMediaStatusIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
817{
818#ifdef CSR_SUPPORT_WEXT
819 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
820 CsrWifiSmeMediaStatusInd* ind = (CsrWifiSmeMediaStatusInd*)msg;
821
822 if (priv->smepriv == NULL) {
823 unifi_error(priv, "CsrWifiSmeMediaStatusIndSend: invalid smepriv\n");
824 return;
825 }
826
827 if (ind->mediaStatus == CSR_WIFI_SME_MEDIA_STATUS_CONNECTED) {
828 /*
829 * Send wireless-extension event up to userland to announce
830 * connection.
831 */
832 wext_send_assoc_event(priv,
833 (unsigned char *)ind->connectionInfo.bssid.a,
834 (unsigned char *)ind->connectionInfo.assocReqInfoElements,
835 ind->connectionInfo.assocReqInfoElementsLength,
836 (unsigned char *)ind->connectionInfo.assocRspInfoElements,
837 ind->connectionInfo.assocRspInfoElementsLength,
838 (unsigned char *)ind->connectionInfo.assocScanInfoElements,
839 ind->connectionInfo.assocScanInfoElementsLength);
840
841 unifi_trace(priv, UDBG2, "CsrWifiSmeMediaStatusIndSend: IBSS=%pM\n",
842 ind->connectionInfo.bssid.a);
843
844 sme_mgt_packet_filter_set(priv);
845
846 } else {
847 /*
848 * Send wireless-extension event up to userland to announce
849 * connection lost to a BSS.
850 */
851 wext_send_disassoc_event(priv);
852 }
853#endif
854}
855
856void CsrWifiSmeRoamingConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
857{
858 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
859 CsrWifiSmeRoamingConfigSetCfm* cfm = (CsrWifiSmeRoamingConfigSetCfm*)msg;
860
861 if (priv == NULL) {
862 unifi_error(NULL, "CsrWifiSmeRoamingConfigSetCfmSend: Invalid ospriv.\n");
863 return;
864 }
865
866 sme_complete_request(priv, cfm->status);
867}
868
869void CsrWifiSmeScanConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
870{
871}
872
873void CsrWifiSmeScanConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
874{
875#ifdef CSR_SUPPORT_WEXT
876 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
877 CsrWifiSmeScanConfigSetCfm* cfm = (CsrWifiSmeScanConfigSetCfm*)msg;
878
879 if (priv == NULL) {
880 unifi_error(NULL, "CsrWifiSmeSmeConfigSetCfmSend: Invalid ospriv.\n");
881 return;
882 }
883
884 sme_complete_request(priv, cfm->status);
885#endif
886}
887
888void CsrWifiSmeStationMacAddressGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
889{
890}
891
892void CsrWifiSmeSmeCommonConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
893{
894 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
895 CsrWifiSmeSmeCommonConfigGetCfm* cfm = (CsrWifiSmeSmeCommonConfigGetCfm*)msg;
896
897 if (priv == NULL) {
898 unifi_error(NULL, "CsrWifiSmeSmeCommonConfigGetCfmSend: Invalid ospriv.\n");
899 return;
900 }
901
902 priv->sme_reply.deviceConfig = cfm->deviceConfig;
903 sme_complete_request(priv, cfm->status);
904}
905
906void CsrWifiSmeSmeStaConfigGetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
907{
908 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
909 CsrWifiSmeSmeStaConfigGetCfm* cfm = (CsrWifiSmeSmeStaConfigGetCfm*)msg;
910
911 if (priv == NULL) {
912 unifi_error(NULL, "CsrWifiSmeSmeStaConfigGetCfmSend: Invalid ospriv.\n");
913 return;
914 }
915
916 priv->sme_reply.staConfig = cfm->smeConfig;
917 sme_complete_request(priv, cfm->status);
918}
919
920void CsrWifiSmeSmeCommonConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
921{
922 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
923 CsrWifiSmeSmeCommonConfigSetCfm* cfm = (CsrWifiSmeSmeCommonConfigSetCfm*)msg;
924
925 if (priv == NULL) {
926 unifi_error(NULL, "CsrWifiSmeSmeCommonConfigGetCfmSend: Invalid ospriv.\n");
927 return;
928 }
929
930 sme_complete_request(priv, cfm->status);
931}
932
933void CsrWifiSmeSmeStaConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
934{
935 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
936 CsrWifiSmeSmeStaConfigSetCfm* cfm = (CsrWifiSmeSmeStaConfigSetCfm*)msg;
937
938 if (priv == NULL) {
939 unifi_error(NULL, "CsrWifiSmeSmeStaConfigGetCfmSend: Invalid ospriv.\n");
940 return;
941 }
942
943 sme_complete_request(priv, cfm->status);
944}
945
946void CsrWifiSmeGetInterfaceCapabilityCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
947{
948}
949
950void CsrWifiSmeErrorIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
951{
952}
953
954void CsrWifiSmeInfoIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
955{
956}
957
958void CsrWifiSmeCoreDumpIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
959{
960}
961void CsrWifiSmeAmpStatusChangeIndHandler(void* drvpriv, CsrWifiFsmEvent* msg)
962{
963}
964
965void CsrWifiSmeActivateCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
966{
967}
968void CsrWifiSmeDeactivateCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
969{
970}
971
972#ifdef CSR_SUPPORT_WEXT
973#ifdef CSR_SUPPORT_WEXT_AP
974void CsrWifiNmeApStartCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
975{
976 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
977 CsrWifiNmeApStartCfm* cfm = (CsrWifiNmeApStartCfm*)msg;
978
979 if (priv == NULL) {
980 unifi_error(NULL, "CsrWifiNmeApStartCfmSend: Invalid ospriv.\n");
981 return;
982 }
983
984 sme_complete_request(priv, cfm->status);
985}
986
987void CsrWifiNmeApStopCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
988{
989 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
990 CsrWifiNmeApStopCfm* cfm = (CsrWifiNmeApStopCfm*)msg;
991
992 if (priv == NULL) {
993 unifi_error(NULL, "CsrWifiNmeApStopCfmSend: Invalid ospriv.\n");
994 return;
995 }
996
997 sme_complete_request(priv, cfm->status);
998}
999
1000void CsrWifiNmeApConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg)
1001{
1002 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
1003 CsrWifiNmeApConfigSetCfm* cfm = (CsrWifiNmeApConfigSetCfm*)msg;
1004
1005 if (priv == NULL) {
1006 unifi_error(NULL, "CsrWifiNmeApConfigSetCfmSend: Invalid ospriv.\n");
1007 return;
1008 }
1009 sme_complete_request(priv, cfm->status);
1010}
1011#endif
1012#endif
diff --git a/drivers/staging/csr/sme_native.c b/drivers/staging/csr/sme_native.c
deleted file mode 100644
index d0b9be31e12c..000000000000
--- a/drivers/staging/csr/sme_native.c
+++ /dev/null
@@ -1,566 +0,0 @@
1/*
2 * ***************************************************************************
3 *
4 * FILE: sme_native.c
5 *
6 * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd.
7 *
8 * Refer to LICENSE.txt included with this source code for details on
9 * the license terms.
10 *
11 * ***************************************************************************
12 */
13
14#include <linux/netdevice.h>
15#include "unifi_priv.h"
16#include "csr_wifi_hip_unifi.h"
17#include "csr_wifi_hip_conversions.h"
18
19static const unsigned char wildcard_address[ETH_ALEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
20
21int
22uf_sme_init(unifi_priv_t *priv)
23{
24 sema_init(&priv->mlme_blocking_mutex, 1);
25
26#ifdef CSR_SUPPORT_WEXT
27 {
28 int r = uf_init_wext_interface(priv);
29 if (r != 0) {
30 return r;
31 }
32 }
33#endif
34
35 return 0;
36} /* uf_sme_init() */
37
38
39void
40uf_sme_deinit(unifi_priv_t *priv)
41{
42
43 /* Free memory allocated for the scan table */
44/* unifi_clear_scan_table(priv); */
45
46 /* Cancel any pending workqueue tasks */
47 flush_workqueue(priv->unifi_workqueue);
48
49#ifdef CSR_SUPPORT_WEXT
50 uf_deinit_wext_interface(priv);
51#endif
52
53} /* uf_sme_deinit() */
54
55
56int sme_mgt_wifi_on(unifi_priv_t *priv)
57{
58 int r, i;
59 s32 csrResult;
60
61 if (priv == NULL) {
62 return -EINVAL;
63 }
64 /* Initialize the interface mode to None */
65 for (i=0; i<CSR_WIFI_NUM_INTERFACES; i++) {
66 priv->interfacePriv[i]->interfaceMode = 0;
67 }
68
69 /* Set up interface mode so that get_packet_priority() can
70 * select the right QOS priority when WMM is enabled.
71 */
72 priv->interfacePriv[0]->interfaceMode = CSR_WIFI_ROUTER_CTRL_MODE_STA;
73
74 r = uf_request_firmware_files(priv, UNIFI_FW_STA);
75 if (r) {
76 unifi_error(priv, "sme_mgt_wifi_on: Failed to get f/w\n");
77 return r;
78 }
79
80 /*
81 * The request to initialise UniFi might come while UniFi is running.
82 * We need to block all I/O activity until the reset completes, otherwise
83 * an SDIO error might occur resulting an indication to the SME which
84 * makes it think that the initialisation has failed.
85 */
86 priv->bh_thread.block_thread = 1;
87
88 /* Power on UniFi */
89 CsrSdioClaim(priv->sdio);
90 csrResult = CsrSdioPowerOn(priv->sdio);
91 CsrSdioRelease(priv->sdio);
92 if(csrResult != CSR_RESULT_SUCCESS && csrResult != CSR_SDIO_RESULT_NOT_RESET) {
93 return -EIO;
94 }
95
96 if (csrResult == CSR_RESULT_SUCCESS) {
97 /* Initialise UniFi hardware */
98 r = uf_init_hw(priv);
99 if (r) {
100 return r;
101 }
102 }
103
104 /* Re-enable the I/O thread */
105 priv->bh_thread.block_thread = 0;
106
107 /* Disable deep sleep signalling during the firmware initialisation, to
108 * prevent the wakeup mechanism raising the SDIO clock beyond INIT before
109 * the first MLME-RESET.ind. It gets re-enabled at the CONNECTED.ind,
110 * immediately after the MLME-RESET.ind
111 */
112 csrResult = unifi_configure_low_power_mode(priv->card,
113 UNIFI_LOW_POWER_DISABLED,
114 UNIFI_PERIODIC_WAKE_HOST_DISABLED);
115 if (csrResult != CSR_RESULT_SUCCESS) {
116 unifi_warning(priv,
117 "sme_mgt_wifi_on: unifi_configure_low_power_mode() returned an error\n");
118 }
119
120
121 /* Start the I/O thread */
122 CsrSdioClaim(priv->sdio);
123 r = uf_init_bh(priv);
124 if (r) {
125 CsrSdioPowerOff(priv->sdio);
126 CsrSdioRelease(priv->sdio);
127 return r;
128 }
129 CsrSdioRelease(priv->sdio);
130
131 priv->init_progress = UNIFI_INIT_FW_DOWNLOADED;
132
133 return 0;
134}
135
136int
137sme_sys_suspend(unifi_priv_t *priv)
138{
139 const int interfaceNum = 0; /* FIXME */
140 CsrResult csrResult;
141
142 /* Abort any pending requests. */
143 uf_abort_mlme(priv);
144
145 /* Allow our mlme request to go through. */
146 priv->io_aborted = 0;
147
148 /* Send MLME-RESET.req to UniFi. */
149 unifi_reset_state(priv, priv->netdev[interfaceNum]->dev_addr, 0);
150
151 /* Stop the network traffic */
152 netif_carrier_off(priv->netdev[interfaceNum]);
153
154 /* Put UniFi to deep sleep */
155 CsrSdioClaim(priv->sdio);
156 csrResult = unifi_force_low_power_mode(priv->card);
157 CsrSdioRelease(priv->sdio);
158
159 return 0;
160} /* sme_sys_suspend() */
161
162
163int
164sme_sys_resume(unifi_priv_t *priv)
165{
166#ifdef CSR_SUPPORT_WEXT
167 /* Send disconnect event so clients will re-initialise connection. */
168 memset(priv->wext_conf.current_ssid, 0, UNIFI_MAX_SSID_LEN);
169 memset((void*)priv->wext_conf.current_bssid, 0, ETH_ALEN);
170 priv->wext_conf.capability = 0;
171 wext_send_disassoc_event(priv);
172#endif
173 return 0;
174} /* sme_sys_resume() */
175
176
177/*
178 * ---------------------------------------------------------------------------
179 * sme_native_log_event
180 *
181 * Callback function to be registered as the SME event callback.
182 * Copies the signal content into a new udi_log_t struct and adds
183 * it to the read queue for the SME client.
184 *
185 * Arguments:
186 * arg This is the value given to unifi_add_udi_hook, in
187 * this case a pointer to the client instance.
188 * signal Pointer to the received signal.
189 * signal_len Size of the signal structure in bytes.
190 * bulkdata Pointers to any associated bulk data.
191 * dir Direction of the signal. Zero means from host,
192 * non-zero means to host.
193 *
194 * Returns:
195 * None.
196 * ---------------------------------------------------------------------------
197 */
198void
199sme_native_log_event(ul_client_t *pcli,
200 const u8 *sig_packed, int sig_len,
201 const bulk_data_param_t *bulkdata,
202 int dir)
203{
204 unifi_priv_t *priv;
205 udi_log_t *logptr;
206 u8 *p;
207 int i, r;
208 int signal_len;
209 int total_len;
210 udi_msg_t *msgptr;
211 CSR_SIGNAL signal;
212 ul_client_t *client = pcli;
213
214 if (client == NULL) {
215 unifi_error(NULL, "sme_native_log_event: client has exited\n");
216 return;
217 }
218
219 priv = uf_find_instance(client->instance);
220 if (!priv) {
221 unifi_error(priv, "invalid priv\n");
222 return;
223 }
224
225 /* Just a sanity check */
226 if ((sig_packed == NULL) || (sig_len <= 0)) {
227 return;
228 }
229
230 /* Get the unpacked signal */
231 r = read_unpack_signal(sig_packed, &signal);
232 if (r == 0) {
233 signal_len = SigGetSize(&signal);
234 } else {
235 u16 receiver_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sig_packed) + sizeof(u16)) & 0xFF00;
236
237 /* The control indications are 1 byte, pass them to client. */
238 if (sig_len == 1) {
239 unifi_trace(priv, UDBG5,
240 "Control indication (0x%x) for native SME.\n",
241 *sig_packed);
242
243 *(u8*)&signal = *sig_packed;
244 signal_len = sig_len;
245 } else if (receiver_id == 0) {
246 /*
247 * Also "unknown" signals with a ReceiverId of 0 are passed to the client
248 * without unpacking. (This is a code size optimisation to allow signals
249 * that the driver not interested in to be dropped from the unpack code).
250 */
251 unifi_trace(priv, UDBG5,
252 "Signal 0x%.4X with ReceiverId 0 for native SME.\n",
253 CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sig_packed));
254
255 *(u8*)&signal = *sig_packed;
256 signal_len = sig_len;
257 } else {
258 unifi_error(priv,
259 "sme_native_log_event - Received unknown signal 0x%.4X.\n",
260 CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sig_packed));
261 return;
262 }
263 }
264
265 unifi_trace(priv, UDBG3, "sme_native_log_event: signal 0x%.4X for %d\n",
266 signal.SignalPrimitiveHeader.SignalId,
267 client->client_id);
268
269 total_len = signal_len;
270 /* Calculate the buffer we need to store signal plus bulk data */
271 for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) {
272 total_len += bulkdata->d[i].data_length;
273 }
274
275 /* Allocate log structure plus actual signal. */
276 logptr = kmalloc(sizeof(udi_log_t) + total_len, GFP_KERNEL);
277
278 if (logptr == NULL) {
279 unifi_error(priv,
280 "Failed to allocate %d bytes for a UDI log record\n",
281 sizeof(udi_log_t) + total_len);
282 return;
283 }
284
285 /* Fill in udi_log struct */
286 INIT_LIST_HEAD(&logptr->q);
287 msgptr = &logptr->msg;
288 msgptr->length = sizeof(udi_msg_t) + total_len;
289 msgptr->timestamp = jiffies_to_msecs(jiffies);
290 msgptr->direction = dir;
291 msgptr->signal_length = signal_len;
292
293 /* Copy signal and bulk data to the log */
294 p = (u8 *)(msgptr + 1);
295 memcpy(p, &signal, signal_len);
296 p += signal_len;
297
298 /* Append any bulk data */
299 for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) {
300 int len = bulkdata->d[i].data_length;
301
302 /*
303 * Len here might not be the same as the length in the bulk data slot.
304 * The slot length will always be even, but len could be odd.
305 */
306 if (len > 0) {
307 if (bulkdata->d[i].os_data_ptr) {
308 memcpy(p, bulkdata->d[i].os_data_ptr, len);
309 } else {
310 memset(p, 0, len);
311 }
312 p += len;
313 }
314 }
315
316 /* Add to tail of log queue */
317 down(&client->udi_sem);
318 list_add_tail(&logptr->q, &client->udi_log);
319 up(&client->udi_sem);
320
321 /* Wake any waiting user process */
322 wake_up_interruptible(&client->udi_wq);
323
324} /* sme_native_log_event() */
325
326
327/*
328 * ---------------------------------------------------------------------------
329 * unifi_ta_indicate_protocol
330 *
331 * Report that a packet of a particular type has been seen
332 *
333 * Arguments:
334 * drv_priv The device context pointer passed to ta_init.
335 * protocol The protocol type enum value.
336 * direction Whether the packet was a tx or rx.
337 * src_addr The source MAC address from the data packet.
338 *
339 * Returns:
340 * None.
341 *
342 * Notes:
343 * We defer the actual sending to a background workqueue,
344 * see uf_ta_ind_wq().
345 * ---------------------------------------------------------------------------
346 */
347void
348unifi_ta_indicate_protocol(void *ospriv,
349 CsrWifiRouterCtrlTrafficPacketType packet_type,
350 CsrWifiRouterCtrlProtocolDirection direction,
351 const CsrWifiMacAddress *src_addr)
352{
353
354} /* unifi_ta_indicate_protocol */
355
356/*
357 * ---------------------------------------------------------------------------
358 * unifi_ta_indicate_sampling
359 *
360 * Send the TA sampling information to the SME.
361 *
362 * Arguments:
363 * drv_priv The device context pointer passed to ta_init.
364 * stats The TA sampling data to send.
365 *
366 * Returns:
367 * None.
368 * ---------------------------------------------------------------------------
369 */
370void
371unifi_ta_indicate_sampling(void *ospriv, CsrWifiRouterCtrlTrafficStats *stats)
372{
373
374} /* unifi_ta_indicate_sampling() */
375
376
377void
378unifi_ta_indicate_l4stats(void *ospriv,
379 u32 rxTcpThroughput,
380 u32 txTcpThroughput,
381 u32 rxUdpThroughput,
382 u32 txUdpThroughput)
383{
384
385} /* unifi_ta_indicate_l4stats() */
386
387/*
388 * ---------------------------------------------------------------------------
389 * uf_native_process_udi_signal
390 *
391 * Process interesting signals from the UDI interface.
392 *
393 * Arguments:
394 * pcli A pointer to the client instance.
395 * signal Pointer to the received signal.
396 * signal_len Size of the signal structure in bytes.
397 * bulkdata Pointers to any associated bulk data.
398 * dir Direction of the signal. Zero means from host,
399 * non-zero means to host.
400 *
401 *
402 * Returns:
403 * None.
404 * ---------------------------------------------------------------------------
405 */
406void
407uf_native_process_udi_signal(ul_client_t *pcli,
408 const u8 *packed_signal, int packed_signal_len,
409 const bulk_data_param_t *bulkdata, int dir)
410{
411
412} /* uf_native_process_udi_signal() */
413
414
415/*
416 * ---------------------------------------------------------------------------
417 * sme_native_mlme_event_handler
418 *
419 * Callback function to be used as the udi_event_callback when registering
420 * as a client.
421 * This function implements a blocking request-reply interface for WEXT.
422 * To use it, a client specifies this function as the udi_event_callback
423 * to ul_register_client(). The signal dispatcher in
424 * unifi_receive_event() will call this function to deliver a signal.
425 *
426 * Arguments:
427 * pcli Pointer to the client instance.
428 * signal Pointer to the received signal.
429 * signal_len Size of the signal structure in bytes.
430 * bulkdata Pointer to structure containing any associated bulk data.
431 * dir Direction of the signal. Zero means from host,
432 * non-zero means to host.
433 *
434 * Returns:
435 * None.
436 * ---------------------------------------------------------------------------
437 */
438void
439sme_native_mlme_event_handler(ul_client_t *pcli,
440 const u8 *sig_packed, int sig_len,
441 const bulk_data_param_t *bulkdata,
442 int dir)
443{
444 CSR_SIGNAL signal;
445 int signal_len;
446 unifi_priv_t *priv = uf_find_instance(pcli->instance);
447 int id, r;
448
449 /* Just a sanity check */
450 if ((sig_packed == NULL) || (sig_len <= 0)) {
451 return;
452 }
453
454 /* Get the unpacked signal */
455 r = read_unpack_signal(sig_packed, &signal);
456 if (r == 0) {
457 signal_len = SigGetSize(&signal);
458 } else {
459 unifi_error(priv,
460 "sme_native_mlme_event_handler - Received unknown signal 0x%.4X.\n",
461 CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sig_packed));
462 return;
463 }
464
465 id = signal.SignalPrimitiveHeader.SignalId;
466 unifi_trace(priv, UDBG4, "wext - Process signal 0x%.4X\n", id);
467
468 /*
469 * Take the appropriate action for the signal.
470 */
471 switch (id) {
472 /*
473 * Confirm replies from UniFi.
474 * These all have zero or one CSR_DATAREF member. (FIXME: check this is still true for softmac)
475 */
476 case CSR_MA_PACKET_CONFIRM_ID:
477 case CSR_MLME_RESET_CONFIRM_ID:
478 case CSR_MLME_GET_CONFIRM_ID:
479 case CSR_MLME_SET_CONFIRM_ID:
480 case CSR_MLME_GET_NEXT_CONFIRM_ID:
481 case CSR_MLME_POWERMGT_CONFIRM_ID:
482 case CSR_MLME_SCAN_CONFIRM_ID:
483 case CSR_MLME_HL_SYNC_CONFIRM_ID:
484 case CSR_MLME_MEASURE_CONFIRM_ID:
485 case CSR_MLME_SETKEYS_CONFIRM_ID:
486 case CSR_MLME_DELETEKEYS_CONFIRM_ID:
487 case CSR_MLME_HL_SYNC_CANCEL_CONFIRM_ID:
488 case CSR_MLME_ADD_PERIODIC_CONFIRM_ID:
489 case CSR_MLME_DEL_PERIODIC_CONFIRM_ID:
490 case CSR_MLME_ADD_AUTONOMOUS_SCAN_CONFIRM_ID:
491 case CSR_MLME_DEL_AUTONOMOUS_SCAN_CONFIRM_ID:
492 case CSR_MLME_SET_PACKET_FILTER_CONFIRM_ID:
493 case CSR_MLME_STOP_MEASURE_CONFIRM_ID:
494 case CSR_MLME_PAUSE_AUTONOMOUS_SCAN_CONFIRM_ID:
495 case CSR_MLME_ADD_TRIGGERED_GET_CONFIRM_ID:
496 case CSR_MLME_DEL_TRIGGERED_GET_CONFIRM_ID:
497 case CSR_MLME_ADD_BLACKOUT_CONFIRM_ID:
498 case CSR_MLME_DEL_BLACKOUT_CONFIRM_ID:
499 case CSR_MLME_ADD_RX_TRIGGER_CONFIRM_ID:
500 case CSR_MLME_DEL_RX_TRIGGER_CONFIRM_ID:
501 case CSR_MLME_CONNECT_STATUS_CONFIRM_ID:
502 case CSR_MLME_MODIFY_BSS_PARAMETER_CONFIRM_ID:
503 case CSR_MLME_ADD_TEMPLATE_CONFIRM_ID:
504 case CSR_MLME_CONFIG_QUEUE_CONFIRM_ID:
505 case CSR_MLME_ADD_TSPEC_CONFIRM_ID:
506 case CSR_MLME_DEL_TSPEC_CONFIRM_ID:
507 case CSR_MLME_START_AGGREGATION_CONFIRM_ID:
508 case CSR_MLME_STOP_AGGREGATION_CONFIRM_ID:
509 case CSR_MLME_SM_START_CONFIRM_ID:
510 case CSR_MLME_LEAVE_CONFIRM_ID:
511 case CSR_MLME_SET_TIM_CONFIRM_ID:
512 case CSR_MLME_GET_KEY_SEQUENCE_CONFIRM_ID:
513 case CSR_MLME_SET_CHANNEL_CONFIRM_ID:
514 case CSR_MLME_ADD_MULTICAST_ADDRESS_CONFIRM_ID:
515 case CSR_DEBUG_GENERIC_CONFIRM_ID:
516 unifi_mlme_copy_reply_and_wakeup_client(pcli, &signal, signal_len, bulkdata);
517 break;
518
519 case CSR_MLME_CONNECTED_INDICATION_ID:
520 /* We currently ignore the connected-ind for softmac f/w development */
521 unifi_info(priv, "CSR_MLME_CONNECTED_INDICATION_ID ignored\n");
522 break;
523
524 default:
525 break;
526 }
527
528} /* sme_native_mlme_event_handler() */
529
530
531
532/*
533 * -------------------------------------------------------------------------
534 * unifi_reset_state
535 *
536 * Ensure that a MAC address has been set.
537 * Send the MLME-RESET signal.
538 * This must be called at least once before starting to do any
539 * network activities (e.g. scan, join etc).
540 *
541 * Arguments:
542 * priv Pointer to device private context struct
543 * macaddr Pointer to chip MAC address.
544 * If this is FF:FF:FF:FF:FF:FF it will be replaced
545 * with the MAC address from the chip.
546 * set_default_mib 1 if the f/w must reset the MIB to the default values
547 * 0 otherwise
548 *
549 * Returns:
550 * 0 on success, an error code otherwise.
551 * -------------------------------------------------------------------------
552 */
553int
554unifi_reset_state(unifi_priv_t *priv, unsigned char *macaddr,
555 unsigned char set_default_mib)
556{
557 int r = 0;
558
559#ifdef CSR_SUPPORT_WEXT
560 /* The reset clears any 802.11 association. */
561 priv->wext_conf.flag_associated = 0;
562#endif
563
564 return r;
565} /* unifi_reset_state() */
566
diff --git a/drivers/staging/csr/sme_sys.c b/drivers/staging/csr/sme_sys.c
deleted file mode 100644
index b5258d71d250..000000000000
--- a/drivers/staging/csr/sme_sys.c
+++ /dev/null
@@ -1,3260 +0,0 @@
1/*
2 * ---------------------------------------------------------------------------
3 * FILE: sme_sys.c
4 *
5 * PURPOSE:
6 * Driver specific implementation of the SME SYS SAP.
7 * It is part of the porting exercise.
8 *
9 * Copyright (C) 2008-2011 by Cambridge Silicon Radio Ltd.
10 *
11 * Refer to LICENSE.txt included with this source code for details on
12 * the license terms.
13 *
14 * ---------------------------------------------------------------------------
15 */
16
17#include "csr_wifi_hip_unifiversion.h"
18#include "unifi_priv.h"
19#include "csr_wifi_hip_conversions.h"
20#ifdef CSR_SUPPORT_WEXT_AP
21#include "csr_wifi_sme_sef.h"
22#endif
23
24/*
25 * This file implements the SME SYS API and contains the following functions:
26 * CsrWifiRouterCtrlMediaStatusReqHandler()
27 * CsrWifiRouterCtrlHipReqHandler()
28 * CsrWifiRouterCtrlPortConfigureReqHandler()
29 * CsrWifiRouterCtrlWifiOnReqHandler()
30 * CsrWifiRouterCtrlWifiOffReqHandler()
31 * CsrWifiRouterCtrlSuspendResHandler()
32 * CsrWifiRouterCtrlResumeResHandler()
33 * CsrWifiRouterCtrlQosControlReqHandler()
34 * CsrWifiRouterCtrlConfigurePowerModeReqHandler()
35 * CsrWifiRouterCtrlWifiOnResHandler()
36 * CsrWifiRouterCtrlWifiOffRspHandler()
37 * CsrWifiRouterCtrlMulticastAddressResHandler()
38 * CsrWifiRouterCtrlTrafficConfigReqHandler()
39 * CsrWifiRouterCtrlTrafficClassificationReqHandler()
40 * CsrWifiRouterCtrlTclasAddReqHandler()
41 * CsrWifiRouterCtrlTclasDelReqHandler()
42 * CsrWifiRouterCtrlSetModeReqHandler()
43 * CsrWifiRouterCtrlWapiMulticastFilterReqHandler()
44 * CsrWifiRouterCtrlWapiUnicastFilterReqHandler()
45 * CsrWifiRouterCtrlWapiUnicastTxPktReqHandler()
46 * CsrWifiRouterCtrlWapiRxPktReqHandler()
47 * CsrWifiRouterCtrlWapiFilterReqHandler()
48 */
49
50#ifdef CSR_SUPPORT_SME
51static void check_inactivity_timer_expire_func(unsigned long data);
52void uf_send_disconnected_ind_wq(struct work_struct *work);
53#endif
54
55void send_auto_ma_packet_confirm(unifi_priv_t *priv,
56 netInterface_priv_t *interfacePriv,
57 struct list_head *buffered_frames_list)
58{
59 tx_buffered_packets_t *buffered_frame_item = NULL;
60 struct list_head *listHead;
61 struct list_head *placeHolder;
62 int client_id;
63
64 CSR_SIGNAL unpacked_signal;
65 u8 sigbuf[UNIFI_PACKED_SIGBUF_SIZE];
66 u16 packed_siglen;
67
68
69 list_for_each_safe(listHead, placeHolder, buffered_frames_list)
70 {
71 buffered_frame_item = list_entry(listHead, tx_buffered_packets_t, q);
72
73 if(!buffered_frame_item) {
74 unifi_error(priv, "Entry should exist, otherwise it is a (BUG)\n");
75 continue;
76 }
77
78 if ((interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_NONE) &&
79 (priv->wifi_on_state == wifi_on_done))
80 {
81
82 unifi_warning(priv, "Send MA_PACKET_CONFIRM to SenderProcessId = %x for (HostTag = %x TransmissionControl = %x)\n",
83 (buffered_frame_item->leSenderProcessId),
84 buffered_frame_item->hostTag,
85 buffered_frame_item->transmissionControl);
86
87 client_id = buffered_frame_item->leSenderProcessId & 0xFF00;
88
89 if (client_id == priv->sme_cli->sender_id)
90 {
91 /* construct a MA-PACKET.confirm message for SME */
92 memset(&unpacked_signal, 0, sizeof(unpacked_signal));
93 unpacked_signal.SignalPrimitiveHeader.SignalId = CSR_MA_PACKET_CONFIRM_ID;
94 unpacked_signal.SignalPrimitiveHeader.ReceiverProcessId = buffered_frame_item->leSenderProcessId;
95 unpacked_signal.SignalPrimitiveHeader.SenderProcessId = CSR_WIFI_ROUTER_IFACEQUEUE;
96
97 unpacked_signal.u.MaPacketConfirm.VirtualInterfaceIdentifier = uf_get_vif_identifier(interfacePriv->interfaceMode,
98 interfacePriv->InterfaceTag);
99 unpacked_signal.u.MaPacketConfirm.TransmissionStatus = CSR_RESULT_FAILURE;
100 unpacked_signal.u.MaPacketConfirm.RetryCount = 0;
101 unpacked_signal.u.MaPacketConfirm.Rate = buffered_frame_item->rate;
102 unpacked_signal.u.MaPacketConfirm.HostTag = buffered_frame_item->hostTag;
103
104 write_pack(&unpacked_signal, sigbuf, &packed_siglen);
105 unifi_warning(priv, "MA_PACKET_CONFIRM for SME (0x%x, 0x%x, 0x%x, 0x%x)\n",
106 unpacked_signal.SignalPrimitiveHeader.ReceiverProcessId,
107 unpacked_signal.SignalPrimitiveHeader.SenderProcessId,
108 unpacked_signal.u.MaPacketConfirm.VirtualInterfaceIdentifier,
109 unpacked_signal.u.MaPacketConfirm.HostTag);
110
111 CsrWifiRouterCtrlHipIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,
112 packed_siglen,
113 (u8 *)sigbuf,
114 0, NULL,
115 0, NULL);
116 }
117 else if((buffered_frame_item->hostTag & 0x80000000))
118 {
119 /* construct a MA-PACKET.confirm message for NME */
120 unifi_warning(priv, "MA_PACKET_CONFIRM for NME (0x%x, 0x%x, 0x%x, 0x%x)\n",
121 buffered_frame_item->leSenderProcessId,
122 buffered_frame_item->interfaceTag,
123 buffered_frame_item->transmissionControl,
124 (buffered_frame_item->hostTag & 0x3FFFFFFF));
125
126 CsrWifiRouterMaPacketCfmSend((buffered_frame_item->leSenderProcessId & 0xFF),
127 buffered_frame_item->interfaceTag,
128 CSR_RESULT_FAILURE,
129 (buffered_frame_item->hostTag & 0x3FFFFFFF),
130 buffered_frame_item->rate);
131
132 }
133 else
134 {
135 unifi_warning(priv, "Buffered packet dropped without sending a confirm\n");
136 }
137
138 }
139
140 list_del(listHead);
141 kfree(buffered_frame_item);
142 buffered_frame_item = NULL;
143 }
144}
145
146void CsrWifiRouterCtrlMediaStatusReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
147{
148 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
149 CsrWifiRouterCtrlMediaStatusReq* req = (CsrWifiRouterCtrlMediaStatusReq*)msg;
150 netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag];
151 unsigned long flags;
152
153 if (priv->smepriv == NULL) {
154 unifi_error(priv, "CsrWifiRouterCtrlMediaStatusReqHandler: invalid smepriv\n");
155 return;
156 }
157 if (req->interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
158 unifi_error(priv, "CsrWifiRouterCtrlMediaStatusReqHandler: invalid interfaceTag\n");
159 return;
160 }
161 unifi_trace(priv, UDBG3, "CsrWifiRouterCtrlMediaStatusReqHandler: Mode = %d req->mediaStatus = %d\n", interfacePriv->interfaceMode, req->mediaStatus);
162 if (interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_AMP) {
163 bulk_data_desc_t bulk_data;
164
165 bulk_data.data_length = 0;
166
167 spin_lock_irqsave(&priv->m4_lock, flags);
168 if (interfacePriv->m4_bulk_data.data_length > 0) {
169 bulk_data = interfacePriv->m4_bulk_data;
170 interfacePriv->m4_bulk_data.net_buf_length = 0;
171 interfacePriv->m4_bulk_data.data_length = 0;
172 interfacePriv->m4_bulk_data.os_data_ptr = interfacePriv->m4_bulk_data.os_net_buf_ptr = NULL;
173 }
174 spin_unlock_irqrestore(&priv->m4_lock, flags);
175
176 if (bulk_data.data_length != 0) {
177 unifi_trace(priv, UDBG5, "CsrWifiRouterCtrlMediaStatusReqHandler: free M4\n");
178 unifi_net_data_free(priv, &bulk_data);
179 }
180
181 if ((req->mediaStatus == CSR_WIFI_SME_MEDIA_STATUS_CONNECTED) &&
182 (interfacePriv->connected != UnifiConnected)) {
183
184 switch(interfacePriv->interfaceMode){
185 case CSR_WIFI_ROUTER_CTRL_MODE_AP:
186 case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO:
187 interfacePriv->connected = UnifiConnected;
188 netif_carrier_on(priv->netdev[req->interfaceTag]);
189#ifdef CSR_SUPPORT_WEXT
190 wext_send_started_event(priv);
191#endif
192 unifi_trace(priv, UDBG1,
193 "CsrWifiRouterCtrlMediaStatusReqHandler: AP/P2PGO setting netif_carrier_on\n");
194 netif_tx_wake_all_queues(priv->netdev[req->interfaceTag]);
195 break;
196
197 default:
198#ifdef CSR_SUPPORT_WEXT
199 /* In the WEXT builds (sme and native), the userspace is not ready
200 * to process any EAPOL or WAPI packets, until it has been informed
201 * of the NETDEV_CHANGE.
202 */
203 if (interfacePriv->netdev_callback_registered && (interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI)) {
204 interfacePriv->wait_netdev_change = TRUE;
205 unifi_trace(priv, UDBG1,
206 "CsrWifiRouterCtrlMediaStatusReqHandler: waiting for NETDEV_CHANGE\n");
207 /*
208 * Carrier can go to on, only after wait_netdev_change is set to TRUE.
209 * Otherwise there can be a race in uf_netdev_event().
210 */
211 netif_carrier_on(priv->netdev[req->interfaceTag]);
212 unifi_trace(priv, UDBG1,
213 "CsrWifiRouterCtrlMediaStatusReqHandler: STA/P2PCLI setting netif_carrier_on\n");
214 }
215 else
216#endif
217 {
218 /* In the NME build, the userspace does not wait for the NETDEV_CHANGE
219 * so it is ready to process all the EAPOL or WAPI packets.
220 * At this point, we enable all the Tx queues, and we indicate any packets
221 * that are queued (and the respective port is opened).
222 */
223 static const CsrWifiMacAddress broadcast_address = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}};
224 interfacePriv->connected = UnifiConnected;
225 unifi_trace(priv, UDBG1,
226 "CsrWifiRouterMediaStatusReqHandler: UnifiConnected && netif_carrier_on\n");
227 netif_carrier_on(priv->netdev[req->interfaceTag]);
228 netif_tx_wake_all_queues(priv->netdev[req->interfaceTag]);
229 uf_process_rx_pending_queue(priv, UF_UNCONTROLLED_PORT_Q, broadcast_address, 1, interfacePriv->InterfaceTag);
230 uf_process_rx_pending_queue(priv, UF_CONTROLLED_PORT_Q, broadcast_address, 1, interfacePriv->InterfaceTag);
231 }
232 break;
233 }
234 }
235
236 if (req->mediaStatus == CSR_WIFI_SME_MEDIA_STATUS_DISCONNECTED) {
237#ifdef CSR_SUPPORT_WEXT
238 unifi_trace(priv, UDBG1,
239 "CsrWifiRouterMediaStatusReqHandler: cancel waiting for NETDEV_CHANGE\n");
240 interfacePriv->wait_netdev_change = FALSE;
241#endif
242 unifi_trace(priv, UDBG1,
243 "CsrWifiRouterMediaStatusReqHandler: setting netif_carrier_off\n");
244 netif_carrier_off(priv->netdev[req->interfaceTag]);
245#ifdef CSR_SUPPORT_WEXT
246 switch(interfacePriv->interfaceMode){
247 case CSR_WIFI_ROUTER_CTRL_MODE_AP:
248 case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO:
249 wext_send_started_event(priv);
250 break;
251 default:
252 break;
253 }
254#endif
255 interfacePriv->connected = UnifiNotConnected;
256 }
257 } else {
258 /* For AMP, just update the L2 connected flag */
259 if (req->mediaStatus == CSR_WIFI_SME_MEDIA_STATUS_CONNECTED) {
260 unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlMediaStatusReqHandler: AMP connected\n");
261 interfacePriv->connected = UnifiConnected;
262 } else {
263 unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlMediaStatusReqHandler: AMP disconnected\n");
264 interfacePriv->connected = UnifiNotConnected;
265 }
266 }
267}
268
269
270void CsrWifiRouterCtrlHipReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
271{
272 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
273 CsrWifiRouterCtrlHipReq* hipreq = (CsrWifiRouterCtrlHipReq*)msg;
274 bulk_data_param_t bulkdata;
275 u8 *signal_ptr;
276 int signal_length;
277 int r=0;
278 void *dest;
279 CsrResult csrResult;
280 CSR_SIGNAL *signal;
281 u16 interfaceTag = 0;
282 CSR_MA_PACKET_REQUEST *req;
283 netInterface_priv_t *interfacePriv;
284
285 if (priv == NULL) {
286 return;
287 }
288 if (priv->smepriv == NULL) {
289 unifi_error(priv, "CsrWifiRouterCtrlHipReqHandler: invalid smepriv\n");
290 return;
291 }
292 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
293 unifi_error(priv, "CsrWifiRouterCtrlHipReqHandler: invalid interfaceTag\n");
294 return;
295 }
296
297 interfacePriv = priv->interfacePriv[interfaceTag];
298
299 /* Initialize bulkdata to avoid os_net_buf is garbage */
300 memset(&bulkdata, 0, sizeof(bulk_data_param_t));
301
302 signal = (CSR_SIGNAL *)hipreq->mlmeCommand;
303
304 unifi_trace(priv, UDBG4, "CsrWifiRouterCtrlHipReqHandler: 0x04%X ---->\n",
305 *((u16*)hipreq->mlmeCommand));
306
307 /* Construct the signal. */
308 signal_ptr = (u8*)hipreq->mlmeCommand;
309 signal_length = hipreq->mlmeCommandLength;
310
311 /*
312 * The MSB of the sender ID needs to be set to the client ID.
313 * The LSB is controlled by the SME.
314 */
315 signal_ptr[5] = (priv->sme_cli->sender_id >> 8) & 0xff;
316
317 /* Allocate buffers for the bulk data. */
318 if (hipreq->dataRef1Length) {
319 csrResult = unifi_net_data_malloc(priv, &bulkdata.d[0], hipreq->dataRef1Length);
320 if (csrResult == CSR_RESULT_SUCCESS) {
321 dest = (void*)bulkdata.d[0].os_data_ptr;
322 memcpy(dest, hipreq->dataRef1, hipreq->dataRef1Length);
323 bulkdata.d[0].data_length = hipreq->dataRef1Length;
324 } else {
325 unifi_warning(priv, "signal not sent down, allocation failed in CsrWifiRouterCtrlHipReqHandler\n");
326 return;
327 }
328 } else {
329 bulkdata.d[0].os_data_ptr = NULL;
330 bulkdata.d[0].data_length = 0;
331 }
332 if (hipreq->dataRef2Length) {
333 csrResult = unifi_net_data_malloc(priv, &bulkdata.d[1], hipreq->dataRef2Length);
334 if (csrResult == CSR_RESULT_SUCCESS) {
335 dest = (void*)bulkdata.d[1].os_data_ptr;
336 memcpy(dest, hipreq->dataRef2, hipreq->dataRef2Length);
337 bulkdata.d[1].data_length = hipreq->dataRef2Length;
338 } else {
339 if (bulkdata.d[0].data_length)
340 {
341 unifi_net_data_free(priv, &bulkdata.d[0]);
342 }
343 unifi_warning(priv, "signal not sent down, allocation failed in CsrWifiRouterCtrlHipReqHandler\n");
344 return;
345 }
346 } else {
347 bulkdata.d[1].os_data_ptr = NULL;
348 bulkdata.d[1].data_length = 0;
349 }
350
351 unifi_trace(priv, UDBG3, "SME SEND: Signal 0x%.4X \n",
352 *((u16*)signal_ptr));
353 if (signal->SignalPrimitiveHeader.SignalId == CSR_MA_PACKET_REQUEST_ID)
354 {
355 CSR_SIGNAL unpacked_signal;
356 read_unpack_signal((u8 *) signal, &unpacked_signal);
357 req = &unpacked_signal.u.MaPacketRequest;
358 interfaceTag = req->VirtualInterfaceIdentifier & 0xff;
359 switch(interfacePriv->interfaceMode)
360 {
361 case CSR_WIFI_ROUTER_CTRL_MODE_NONE:
362 unifi_error(priv, "CsrWifiRouterCtrlHipReqHandler: invalid mode: NONE \n");
363 break;
364 default:
365 unifi_trace(priv, UDBG5, "mode is %x\n", interfacePriv->interfaceMode);
366 }
367 /* While sending ensure that first 2 bits b31 and b30 are 00. These are used for local routing*/
368 r = uf_process_ma_packet_req(priv, req->Ra.x, (req->HostTag & 0x3FFFFFFF), interfaceTag,
369 req->TransmissionControl, req->TransmitRate,
370 req->Priority, signal->SignalPrimitiveHeader.SenderProcessId,
371 &bulkdata);
372 if (r)
373 {
374 if (bulkdata.d[0].data_length)
375 {
376 unifi_net_data_free(priv, &bulkdata.d[0]);
377 }
378 if (bulkdata.d[1].data_length)
379 {
380 unifi_net_data_free(priv, &bulkdata.d[1]);
381 }
382 }
383 } else {
384 /* ul_send_signal_raw frees the bulk data if it fails */
385 r = ul_send_signal_raw(priv, signal_ptr, signal_length, &bulkdata);
386 }
387
388 if (r) {
389 unifi_error(priv,
390 "CsrWifiRouterCtrlHipReqHandler: Failed to send signal (0x%.4X - %u)\n",
391 *((u16*)signal_ptr), r);
392 CsrWifiRouterCtrlWifiOffIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, CSR_WIFI_SME_CONTROL_INDICATION_ERROR);
393 }
394
395 unifi_trace(priv, UDBG4, "CsrWifiRouterCtrlHipReqHandler: <----\n");
396}
397
398#ifdef CSR_WIFI_SEND_GRATUITOUS_ARP
399static void
400uf_send_gratuitous_arp(unifi_priv_t *priv, u16 interfaceTag)
401{
402 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
403 CSR_PRIORITY priority;
404 CSR_SIGNAL signal;
405 bulk_data_param_t bulkdata;
406 CsrResult csrResult;
407 struct sk_buff *skb, *newSkb = NULL;
408 s8 protection;
409 int r;
410 static const u8 arp_req[36] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00,
411 0x08, 0x06, 0x00, 0x01, 0x08, 0x00, 0x06, 0x04, 0x00, 0x01,
412 0x00, 0x02, 0x5f, 0x20, 0x2f, 0x02,
413 0xc0, 0xa8, 0x00, 0x02,
414 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
415 0xc0, 0xa8, 0x00, 0x02};
416
417 csrResult = unifi_net_data_malloc(priv, &bulkdata.d[0], sizeof(arp_req));
418 if (csrResult != CSR_RESULT_SUCCESS)
419 {
420 unifi_error(priv, "Failed to allocate bulk data in CsrWifiSmeRoamCompleteIndHandler()\n");
421 return;
422 }
423 skb = (struct sk_buff *)(bulkdata.d[0].os_net_buf_ptr);
424 skb->len = bulkdata.d[0].data_length;
425
426 memcpy(skb->data, arp_req, sizeof(arp_req));
427 /* add MAC and IP address */
428 memcpy(skb->data + 16, priv->netdev[interfaceTag]->dev_addr, ETH_ALEN);
429 skb->data[22] = (priv->sta_ip_address ) & 0xFF;
430 skb->data[23] = (priv->sta_ip_address >> 8) & 0xFF;
431 skb->data[24] = (priv->sta_ip_address >> 16) & 0xFF;
432 skb->data[25] = (priv->sta_ip_address >> 24) & 0xFF;
433 skb->data[32] = (priv->sta_ip_address ) & 0xFF;
434 skb->data[33] = (priv->sta_ip_address >> 8) & 0xFF;
435 skb->data[34] = (priv->sta_ip_address >> 16) & 0xFF;
436 skb->data[35] = (priv->sta_ip_address >> 24) & 0xFF;
437
438 bulkdata.d[1].os_data_ptr = NULL;
439 bulkdata.d[1].os_net_buf_ptr = NULL;
440 bulkdata.d[1].net_buf_length = bulkdata.d[1].data_length = 0;
441
442 if ((protection = uf_get_protection_bit_from_interfacemode(priv, interfaceTag, &arp_req[26])) < 0)
443 {
444 unifi_error(priv, "CsrWifiSmeRoamCompleteIndHandler: Failed to determine protection mode\n");
445 unifi_net_data_free(priv, &bulkdata.d[0]);
446 return;
447 }
448
449 if ((priv->sta_wmm_capabilities & QOS_CAPABILITY_WMM_ENABLED) == 1)
450 {
451 priority = CSR_QOS_UP0;
452 }
453 else
454 {
455 priority = CSR_CONTENTION;
456 }
457
458 if (prepare_and_add_macheader(priv, skb, newSkb, priority, &bulkdata,
459 interfaceTag, &arp_req[26],
460 priv->netdev[interfaceTag]->dev_addr, protection))
461 {
462 unifi_error(priv, "CsrWifiSmeRoamCompleteIndHandler: failed to create MAC header\n");
463 unifi_net_data_free(priv, &bulkdata.d[0]);
464 return;
465 }
466 bulkdata.d[0].os_data_ptr = skb->data;
467 bulkdata.d[0].os_net_buf_ptr = skb;
468 bulkdata.d[0].data_length = skb->len;
469
470 unifi_frame_ma_packet_req(priv, priority, 0, 0xffffffff, interfaceTag,
471 CSR_NO_CONFIRM_REQUIRED, priv->netdev_client->sender_id,
472 interfacePriv->bssid.a, &signal);
473
474 r = ul_send_signal_unpacked(priv, &signal, &bulkdata);
475 if (r)
476 {
477 unifi_error(priv, "CsrWifiSmeRoamCompleteIndHandler: failed to send QOS data null packet result: %d\n", r);
478 unifi_net_data_free(priv, &bulkdata.d[0]);
479 return;
480 }
481
482}
483#endif /* CSR_WIFI_SEND_GRATUITOUS_ARP */
484
485/*
486 * ---------------------------------------------------------------------------
487 * configure_data_port
488 *
489 * Store the new controlled port configuration.
490 *
491 * Arguments:
492 * priv Pointer to device private context struct
493 * port_cfg Pointer to the port configuration
494 *
495 * Returns:
496 * An unifi_ControlledPortAction value.
497 * ---------------------------------------------------------------------------
498 */
499static int
500configure_data_port(unifi_priv_t *priv,
501 CsrWifiRouterCtrlPortAction port_action,
502 const CsrWifiMacAddress *macAddress,
503 const int queue,
504 u16 interfaceTag)
505{
506 const u8 broadcast_mac_address[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
507 unifi_port_config_t *port;
508 netInterface_priv_t *interfacePriv;
509 int i;
510 const char* controlled_string; /* cosmetic "controlled"/"uncontrolled" for trace */
511
512 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
513 unifi_error(priv, "configure_data_port: bad interfaceTag\n");
514 return -EFAULT;
515 }
516
517 interfacePriv = priv->interfacePriv[interfaceTag];
518
519 if (queue == UF_CONTROLLED_PORT_Q) {
520 port = &interfacePriv->controlled_data_port;
521 controlled_string = "controlled";
522 } else {
523 port = &interfacePriv->uncontrolled_data_port;
524 controlled_string = "uncontrolled";
525 }
526
527 unifi_trace(priv, UDBG2,
528 "port config request %pM %s with port_action %d.\n",
529 macAddress->a, controlled_string, port_action);
530
531 /* If the new configuration has the broadcast MAC address or if we are in infrastructure mode then clear the list first and set port overide mode */
532 if ((CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode ||
533 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI) ||
534 !memcmp(macAddress->a, broadcast_mac_address, ETH_ALEN)) {
535
536 port->port_cfg[0].port_action = port_action;
537 port->port_cfg[0].mac_address = *macAddress;
538 port->port_cfg[0].in_use = TRUE;
539 port->entries_in_use = 1;
540 port->overide_action = UF_DATA_PORT_OVERIDE;
541
542 unifi_trace(priv, UDBG2, "%s port override on\n",
543 (queue == UF_CONTROLLED_PORT_Q) ? "Controlled" : "Uncontrolled");
544
545 /* Discard the remaining entries in the port config table */
546 for (i = 1; i < UNIFI_MAX_CONNECTIONS; i++) {
547 port->port_cfg[i].in_use = FALSE;
548 }
549
550 if (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN) {
551 unifi_trace(priv, UDBG1, "%s port broadcast set to open.\n",
552 (queue == UF_CONTROLLED_PORT_Q) ? "Controlled" : "Uncontrolled");
553
554 /*
555 * Ask stack to schedule for transmission any packets queued
556 * while controlled port was not open.
557 * Use netif_schedule() instead of netif_wake_queue() because
558 * transmission should be already enabled at this point. If it
559 * is not, probably the interface is down and should remain as is.
560 */
561 uf_resume_data_plane(priv, queue, *macAddress, interfaceTag);
562
563#ifdef CSR_WIFI_SEND_GRATUITOUS_ARP
564 if ((CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) &&
565 (queue == UF_CONTROLLED_PORT_Q) && (priv->sta_ip_address != 0xFFFFFFFF))
566 {
567 uf_send_gratuitous_arp(priv, interfaceTag);
568 }
569#endif
570 } else {
571 unifi_trace(priv, UDBG1, "%s port broadcast set to %s.\n",
572 (queue == UF_CONTROLLED_PORT_Q) ? "Controlled" : "Uncontrolled",
573 (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD) ? "discard": "closed");
574
575 /* If port is closed, discard all the pending Rx packets */
576 if (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD) {
577 uf_free_pending_rx_packets(priv, queue, *macAddress, interfaceTag);
578 }
579 }
580 } else {
581 /* store the new configuration, either in the entry with matching mac address (if already present),
582 * otherwise in a new entry
583 */
584
585 int found_entry_flag;
586 int first_free_slot = -1;
587
588 /* If leaving override mode, free the port entry used for override */
589 if (port->overide_action == UF_DATA_PORT_OVERIDE) {
590 port->port_cfg[0].in_use = FALSE;
591 port->entries_in_use = 0;
592 port->overide_action = UF_DATA_PORT_NOT_OVERIDE;
593
594 unifi_trace(priv, UDBG2, "%s port override off\n",
595 (queue == UF_CONTROLLED_PORT_Q) ? "Controlled" : "Uncontrolled");
596 }
597
598 found_entry_flag = 0;
599 for (i = 0; i < UNIFI_MAX_CONNECTIONS; i++) {
600 if (port->port_cfg[i].in_use) {
601 if (!memcmp(&port->port_cfg[i].mac_address.a, macAddress->a, ETH_ALEN)) {
602 /* We've seen this address before, reconfigure it */
603 port->port_cfg[i].port_action = port_action;
604 found_entry_flag = 1;
605 break;
606 }
607 } else if (first_free_slot == -1) {
608 /* Remember the first free slot on the way past so it can be claimed
609 * if this turns out to be a new MAC address (to save walking the list again).
610 */
611 first_free_slot = i;
612 }
613 }
614
615 /* At this point we found an existing entry and have updated it, or need to
616 * add a new entry. If all slots are allocated, give up and return an error.
617 */
618 if (!found_entry_flag) {
619 if (first_free_slot == -1) {
620 unifi_error(priv, "no free slot found in port config array (%d used)\n", port->entries_in_use);
621 return -EFAULT;
622 } else {
623 port->entries_in_use++;
624 }
625
626 unifi_trace(priv, UDBG3, "port config index assigned in config_data_port = %d\n", first_free_slot);
627 port->port_cfg[first_free_slot].in_use = TRUE;
628 port->port_cfg[first_free_slot].port_action = port_action;
629 port->port_cfg[first_free_slot].mac_address = *macAddress;
630 }
631
632 if (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN) {
633 /*
634 * Ask stack to schedule for transmission any packets queued
635 * while controlled port was not open.
636 * Use netif_schedule() instead of netif_wake_queue() because
637 * transmission should be already enabled at this point. If it
638 * is not, probably the interface is down and should remain as is.
639 */
640 uf_resume_data_plane(priv, queue, *macAddress, interfaceTag);
641 }
642
643 /*
644 * If port is closed, discard all the pending Rx packets
645 * coming from the peer station.
646 */
647 if (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD) {
648 uf_free_pending_rx_packets(priv, queue, *macAddress, interfaceTag);
649 }
650
651 unifi_trace(priv, UDBG2,
652 "port config %pM with port_action %d.\n",
653 macAddress->a, port_action);
654 }
655 return 0;
656} /* configure_data_port() */
657
658
659void CsrWifiRouterCtrlPortConfigureReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
660{
661 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
662 CsrWifiRouterCtrlPortConfigureReq* req = (CsrWifiRouterCtrlPortConfigureReq*)msg;
663 netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag];
664
665 unifi_trace(priv, UDBG3, "entering CsrWifiRouterCtrlPortConfigureReqHandler\n");
666 if (priv->smepriv == NULL) {
667 unifi_error(priv, "CsrWifiRouterCtrlPortConfigureReqHandler: invalid smepriv\n");
668 return;
669 }
670
671 /* To update the protection status of the peer/station */
672 switch(interfacePriv->interfaceMode)
673 {
674 case CSR_WIFI_ROUTER_CTRL_MODE_STA:
675 case CSR_WIFI_ROUTER_CTRL_MODE_AMP:
676 case CSR_WIFI_ROUTER_CTRL_MODE_IBSS:
677 case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI:
678 /* Since for Unifi as a station, the station record not maintained & interfaceID is
679 * only needed to update the peer protection status
680 */
681 interfacePriv->protect = req->setProtection;
682 break;
683 case CSR_WIFI_ROUTER_CTRL_MODE_AP:
684 case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO:
685 {
686 u8 i;
687 CsrWifiRouterCtrlStaInfo_t *staRecord;
688 /* Ifscontrolled port is open means, The peer has been added to station record
689 * so that the protection corresponding to the peer is valid in this req
690 */
691 if (req->controlledPortAction == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN) {
692 for(i =0; i < UNIFI_MAX_CONNECTIONS; i++) {
693 staRecord = (CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[i]);
694 if (staRecord) {
695 /* Find the matching station record & set the protection type */
696 if (!memcmp(req->macAddress.a, staRecord->peerMacAddress.a, ETH_ALEN)) {
697 staRecord->protection = req->setProtection;
698 break;
699 }
700 }
701 }
702 }
703 }
704 break;
705 default:
706 unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlPortConfigureReqHandler(0x%.4X) Uncaught mode %d\n",
707 msg->source, interfacePriv->interfaceMode);
708 }
709
710 configure_data_port(priv, req->uncontrolledPortAction, (const CsrWifiMacAddress *)&req->macAddress,
711 UF_UNCONTROLLED_PORT_Q, req->interfaceTag);
712 configure_data_port(priv, req->controlledPortAction, (const CsrWifiMacAddress *)&req->macAddress,
713 UF_CONTROLLED_PORT_Q, req->interfaceTag);
714
715 CsrWifiRouterCtrlPortConfigureCfmSend(msg->source, req->clientData, req->interfaceTag,
716 CSR_RESULT_SUCCESS, req->macAddress);
717 unifi_trace(priv, UDBG3, "leaving CsrWifiRouterCtrlPortConfigureReqHandler\n");
718}
719
720
721void CsrWifiRouterCtrlWifiOnReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
722{
723 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
724 CsrWifiRouterCtrlVersions versions;
725 CsrWifiRouterCtrlWifiOnReq* req = (CsrWifiRouterCtrlWifiOnReq*)msg;
726 int r, i;
727 CsrResult csrResult;
728
729 if (priv == NULL) {
730 return;
731 }
732 if( priv->wol_suspend ) {
733 unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWifiOnReqHandler: Don't reset mode\n");
734 } else {
735#ifdef ANDROID_BUILD
736 /* Take the wakelock while Wi-Fi On is in progress */
737 unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWifiOnReqHandler: take wake lock\n");
738 wake_lock(&unifi_sdio_wake_lock);
739#endif
740 for (i=0; i<CSR_WIFI_NUM_INTERFACES; i++) {
741 unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWifiOnReqHandler: Setting interface %d to NONE\n", i );
742
743 priv->interfacePriv[i]->interfaceMode = 0;
744 }
745 }
746 unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWifiOnReqHandler(0x%.4X) req->dataLength=%d req->data=0x%x\n", msg->source, req->dataLength, req->data);
747
748 if(req->dataLength==3 && req->data && req->data[0]==0 && req->data[1]==1 && req->data[2]==1)
749 {
750 priv->cmanrTestMode = TRUE;
751 unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWifiOnReqHandler: cmanrTestMode=%d\n", priv->cmanrTestMode);
752 }
753 else
754 {
755 priv->cmanrTestMode = FALSE;
756 }
757
758 /*
759 * The request to initialise UniFi might come while UniFi is running.
760 * We need to block all I/O activity until the reset completes, otherwise
761 * an SDIO error might occur resulting an indication to the SME which
762 * makes it think that the initialisation has failed.
763 */
764 priv->bh_thread.block_thread = 1;
765
766 /* Update the wifi_on state */
767 priv->wifi_on_state = wifi_on_in_progress;
768
769 /* If UniFi was unpowered, acquire the firmware for download to chip */
770 if (!priv->wol_suspend) {
771 r = uf_request_firmware_files(priv, UNIFI_FW_STA);
772 if (r) {
773 unifi_error(priv, "CsrWifiRouterCtrlWifiOnReqHandler: Failed to get f/w\n");
774 CsrWifiRouterCtrlWifiOnCfmSend(msg->source, req->clientData, CSR_RESULT_FAILURE);
775 return;
776 }
777 } else {
778 unifi_trace(priv, UDBG1, "Don't need firmware\n");
779 }
780
781 /* Power on UniFi (which may not necessarily have been off) */
782 CsrSdioClaim(priv->sdio);
783 csrResult = CsrSdioPowerOn(priv->sdio);
784 CsrSdioRelease(priv->sdio);
785 if (csrResult != CSR_RESULT_SUCCESS && csrResult != CSR_SDIO_RESULT_NOT_RESET) {
786 unifi_error(priv, "CsrWifiRouterCtrlWifiOnReqHandler: Failed to power on UniFi\n");
787 CsrWifiRouterCtrlWifiOnCfmSend(msg->source, req->clientData, CSR_RESULT_FAILURE);
788 return;
789 }
790
791 /* If CsrSdioPowerOn() returns CSR_RESULT_SUCCESS, it means that we need to initialise UniFi */
792 if (csrResult == CSR_RESULT_SUCCESS && !priv->wol_suspend) {
793 /* Initialise UniFi hardware */
794 r = uf_init_hw(priv);
795 if (r) {
796 unifi_error(priv, "CsrWifiRouterCtrlWifiOnReqHandler: Failed to initialise h/w, error %d\n", r);
797 CsrWifiRouterCtrlWifiOnCfmSend(msg->source, req->clientData, CSR_RESULT_FAILURE);
798 return;
799 }
800 } else {
801 unifi_trace(priv, UDBG1, "UniFi already initialised\n");
802 }
803
804 /* Completed handling of wake up from suspend with UniFi powered */
805 priv->wol_suspend = FALSE;
806
807 /* Re-enable the I/O thread */
808 priv->bh_thread.block_thread = 0;
809
810 /*
811 * Start the I/O thread. The thread might be already running.
812 * This fine, just carry on with the request.
813 */
814 r = uf_init_bh(priv);
815 if (r) {
816 CsrSdioClaim(priv->sdio);
817 CsrSdioPowerOff(priv->sdio);
818 CsrSdioRelease(priv->sdio);
819 CsrWifiRouterCtrlWifiOnCfmSend(msg->source, req->clientData, CSR_RESULT_FAILURE);
820 return;
821 }
822
823 /* Get the version information from the core */
824 unifi_card_info(priv->card, &priv->card_info);
825
826 /* Set the sme queue id */
827 priv->CSR_WIFI_SME_IFACEQUEUE = msg->source;
828 CSR_WIFI_SME_IFACEQUEUE = msg->source;
829
830
831 /* Copy to the unifiio_card_info structure. */
832 versions.chipId = priv->card_info.chip_id;
833 versions.chipVersion = priv->card_info.chip_version;
834 versions.firmwareBuild = priv->card_info.fw_build;
835 versions.firmwareHip = priv->card_info.fw_hip_version;
836 versions.routerBuild = (char*)CSR_WIFI_VERSION;
837 versions.routerHip = (UNIFI_HIP_MAJOR_VERSION << 8) | UNIFI_HIP_MINOR_VERSION;
838
839 CsrWifiRouterCtrlWifiOnIndSend(msg->source, 0, CSR_RESULT_SUCCESS, versions);
840
841 /* Update the wifi_on state */
842 priv->wifi_on_state = wifi_on_done;
843}
844
845
846/*
847 * wifi_off:
848 * Common code for CsrWifiRouterCtrlWifiOffReqHandler() and
849 * CsrWifiRouterCtrlWifiOffRspHandler().
850 */
851static void
852wifi_off(unifi_priv_t *priv)
853{
854 int power_off;
855 int priv_instance;
856 int i;
857 CsrResult csrResult;
858
859
860 /* Already off? */
861 if (priv->wifi_on_state == wifi_on_unspecified) {
862 unifi_trace(priv, UDBG1, "wifi_off already\n");
863 return;
864 }
865
866 unifi_trace(priv, UDBG1, "wifi_off\n");
867
868 /* Destroy the Traffic Analysis Module */
869 cancel_work_sync(&priv->ta_ind_work.task);
870 cancel_work_sync(&priv->ta_sample_ind_work.task);
871#ifdef CSR_SUPPORT_WEXT
872 cancel_work_sync(&priv->sme_config_task);
873 wext_send_disassoc_event(priv);
874#endif
875
876 /* Cancel pending M4 stuff */
877 for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) {
878 if (priv->netdev[i]) {
879 netInterface_priv_t *netpriv = (netInterface_priv_t *) netdev_priv(priv->netdev[i]);
880 cancel_work_sync(&netpriv->send_m4_ready_task);
881 }
882 }
883 flush_workqueue(priv->unifi_workqueue);
884
885 /* fw_init parameter can prevent power off UniFi, for debugging */
886 priv_instance = uf_find_priv(priv);
887 if (priv_instance == -1) {
888 unifi_warning(priv,
889 "CsrWifiRouterCtrlStopReqHandler: Unknown priv instance, will power off card.\n");
890 power_off = 1;
891 } else {
892 power_off = (fw_init[priv_instance] > 0) ? 0 : 1;
893 }
894
895 /* Production test mode requires power to the chip, too */
896 if (priv->ptest_mode) {
897 power_off = 0;
898 }
899
900 /* Stop the bh_thread */
901 uf_stop_thread(priv, &priv->bh_thread);
902
903 /* Read the f/w panic codes, if any. Protect against second wifi_off() call,
904 * which may happen if SME requests a wifi_off and closes the char device */
905 if (priv->init_progress != UNIFI_INIT_NONE) {
906 CsrSdioClaim(priv->sdio);
907 unifi_capture_panic(priv->card);
908 CsrSdioRelease(priv->sdio);
909 }
910
911 /* Unregister the interrupt handler */
912 if (csr_sdio_linux_remove_irq(priv->sdio)) {
913 unifi_notice(priv,
914 "csr_sdio_linux_remove_irq failed to talk to card.\n");
915 }
916
917 if (power_off) {
918 unifi_trace(priv, UDBG2,
919 "Force low power and try to power off\n");
920 /* Put UniFi to deep sleep, in case we can not power it off */
921 CsrSdioClaim(priv->sdio);
922 csrResult = unifi_force_low_power_mode(priv->card);
923 CsrSdioRelease(priv->sdio);
924
925 CsrSdioPowerOff(priv->sdio);
926 }
927
928 /* Consider UniFi to be uninitialised */
929 priv->init_progress = UNIFI_INIT_NONE;
930 priv->wifi_on_state = wifi_on_unspecified;
931
932
933} /* wifi_off() */
934
935
936void CsrWifiRouterCtrlWifiOffReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
937{
938 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
939 CsrWifiRouterCtrlWifiOffReq* req = (CsrWifiRouterCtrlWifiOffReq*)msg;
940 int i = 0;
941
942 if (priv == NULL) {
943 return;
944 }
945
946 unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWifiOffReqHandler(0x%.4X)\n", msg->source);
947
948 /* Stop the network traffic on all interfaces before freeing the core. */
949 for (i=0; i<CSR_WIFI_NUM_INTERFACES; i++) {
950 netInterface_priv_t *interfacePriv = priv->interfacePriv[i];
951 if (interfacePriv->netdev_registered == 1) {
952 netif_carrier_off(priv->netdev[i]);
953 netif_tx_stop_all_queues(priv->netdev[i]);
954 interfacePriv->connected = UnifiConnectedUnknown;
955 }
956 interfacePriv->interfaceMode = 0;
957
958 /* Enable all queues by default */
959 interfacePriv->queueEnabled[0] = 1;
960 interfacePriv->queueEnabled[1] = 1;
961 interfacePriv->queueEnabled[2] = 1;
962 interfacePriv->queueEnabled[3] = 1;
963 }
964 wifi_off(priv);
965
966 CsrWifiRouterCtrlWifiOffCfmSend(msg->source, req->clientData);
967
968 /* If this is called in response to closing the character device, the
969 * caller must use uf_sme_cancel_request() to terminate any pending SME
970 * blocking request or there will be a delay while the operation times out.
971 */
972}
973
974
975void CsrWifiRouterCtrlQosControlReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
976{
977 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
978 CsrWifiRouterCtrlQosControlReq* req = (CsrWifiRouterCtrlQosControlReq*)msg;
979 netInterface_priv_t *interfacePriv;
980
981 if (priv->smepriv == NULL) {
982 unifi_error(priv, "CsrWifiRouterCtrlQosControlReqHandler: invalid smepriv\n");
983 return;
984 }
985
986 unifi_trace(priv, UDBG4, "CsrWifiRouterCtrlQosControlReqHandler:scontrol = %d", req->control);
987
988 if (req->interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
989 unifi_error(priv, "CsrWifiRouterCtrlQosControlReqHandler: interfaceID >= CSR_WIFI_NUM_INTERFACES.\n");
990 return;
991 }
992 interfacePriv = priv->interfacePriv[req->interfaceTag];
993
994 if (req->control == CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_WMM_ON) {
995 priv->sta_wmm_capabilities |= QOS_CAPABILITY_WMM_ENABLED;
996 unifi_trace(priv, UDBG1, "WMM enabled\n");
997
998 unifi_trace(priv, UDBG1, "Queue Config %x\n", req->queueConfig);
999
1000 interfacePriv->queueEnabled[UNIFI_TRAFFIC_Q_BK] = (req->queueConfig & CSR_WIFI_ROUTER_CTRL_QUEUE_BK_ENABLE)?1:0;
1001 interfacePriv->queueEnabled[UNIFI_TRAFFIC_Q_BE] = (req->queueConfig & CSR_WIFI_ROUTER_CTRL_QUEUE_BE_ENABLE)?1:0;
1002 interfacePriv->queueEnabled[UNIFI_TRAFFIC_Q_VI] = (req->queueConfig & CSR_WIFI_ROUTER_CTRL_QUEUE_VI_ENABLE)?1:0;
1003 interfacePriv->queueEnabled[UNIFI_TRAFFIC_Q_VO] = (req->queueConfig & CSR_WIFI_ROUTER_CTRL_QUEUE_VO_ENABLE)?1:0;
1004
1005 } else {
1006 priv->sta_wmm_capabilities = 0;
1007 unifi_trace(priv, UDBG1, "WMM disabled\n");
1008 }
1009}
1010
1011
1012void CsrWifiRouterCtrlTclasAddReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
1013{
1014 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
1015 CsrWifiRouterCtrlTclasAddReq* req = (CsrWifiRouterCtrlTclasAddReq*)msg;
1016
1017 if (priv == NULL) {
1018 unifi_error(priv, "CsrWifiRouterCtrlTclasAddReqHandler: invalid smepriv\n");
1019 return;
1020 }
1021
1022 CsrWifiRouterCtrlTclasAddCfmSend(msg->source, req->clientData, req->interfaceTag , CSR_RESULT_SUCCESS);
1023}
1024
1025void CsrWifiRouterCtrlTclasDelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
1026{
1027 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
1028 CsrWifiRouterCtrlTclasDelReq* req = (CsrWifiRouterCtrlTclasDelReq*)msg;
1029
1030 if (priv == NULL) {
1031 unifi_error(priv, "CsrWifiRouterCtrlTclasDelReqHandler: invalid smepriv\n");
1032 return;
1033 }
1034
1035 CsrWifiRouterCtrlTclasDelCfmSend(msg->source, req->clientData, req->interfaceTag, CSR_RESULT_SUCCESS);
1036}
1037
1038
1039void CsrWifiRouterCtrlConfigurePowerModeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
1040{
1041 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
1042 CsrWifiRouterCtrlConfigurePowerModeReq* req = (CsrWifiRouterCtrlConfigurePowerModeReq*)msg;
1043 enum unifi_low_power_mode pm;
1044 CsrResult csrResult;
1045
1046 if (priv->smepriv == NULL) {
1047 unifi_error(priv, "CsrWifiRouterCtrlConfigurePowerModeReqHandler: invalid smepriv\n");
1048 return;
1049 }
1050
1051 if (req->mode == CSR_WIFI_ROUTER_CTRL_LOW_POWER_MODE_DISABLED) {
1052 pm = UNIFI_LOW_POWER_DISABLED;
1053 } else {
1054 pm = UNIFI_LOW_POWER_ENABLED;
1055 }
1056
1057 unifi_trace(priv, UDBG2,
1058 "CsrWifiRouterCtrlConfigurePowerModeReqHandler (mode=%d, wake=%d)\n",
1059 req->mode, req->wakeHost);
1060 csrResult = unifi_configure_low_power_mode(priv->card, pm,
1061 (req->wakeHost ? UNIFI_PERIODIC_WAKE_HOST_ENABLED : UNIFI_PERIODIC_WAKE_HOST_DISABLED));
1062}
1063
1064
1065void CsrWifiRouterCtrlWifiOnResHandler(void* drvpriv, CsrWifiFsmEvent* msg)
1066{
1067 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
1068 CsrWifiRouterCtrlWifiOnRes* res = (CsrWifiRouterCtrlWifiOnRes*)msg;
1069
1070 if (priv == NULL) {
1071 unifi_error(NULL, "CsrWifiRouterCtrlWifiOnResHandler: Invalid ospriv.\n");
1072 return;
1073 }
1074
1075 unifi_trace(priv, UDBG1,
1076 "CsrWifiRouterCtrlWifiOnResHandler: status %d (patch %u)\n", res->status, res->smeVersions.firmwarePatch);
1077
1078 if (res->smeVersions.firmwarePatch != 0) {
1079 unifi_info(priv, "Firmware patch %d\n", res->smeVersions.firmwarePatch);
1080 }
1081
1082 if (res->numInterfaceAddress > CSR_WIFI_NUM_INTERFACES) {
1083 unifi_error(priv, "WifiOnResHandler bad numInterfaceAddress %d\n", res->numInterfaceAddress);
1084 return;
1085 }
1086
1087 /* UniFi is now initialised, complete the init. */
1088 if (res->status == CSR_RESULT_SUCCESS)
1089 {
1090 int i; /* used as a loop counter */
1091 u32 intmode = CSR_WIFI_INTMODE_DEFAULT;
1092#ifdef CSR_WIFI_SPLIT_PATCH
1093 u8 switching_ap_fw = FALSE;
1094#endif
1095 /* Register the UniFi device with the OS network manager */
1096 unifi_trace(priv, UDBG3, "Card Init Completed Successfully\n");
1097
1098 /* Store the MAC address in the netdev */
1099 for(i=0;i<res->numInterfaceAddress;i++)
1100 {
1101 memcpy(priv->netdev[i]->dev_addr, res->stationMacAddress[i].a, ETH_ALEN);
1102 }
1103
1104 /* Copy version structure into the private versions field */
1105 priv->sme_versions = res->smeVersions;
1106
1107 unifi_trace(priv, UDBG2, "network interfaces count = %d\n",
1108 res->numInterfaceAddress);
1109
1110 /* Register the netdevs for each interface. */
1111 for(i=0;i<res->numInterfaceAddress;i++)
1112 {
1113 netInterface_priv_t *interfacePriv = priv->interfacePriv[i];
1114 if(!interfacePriv->netdev_registered)
1115 {
1116 int r;
1117 unifi_trace(priv, UDBG3, "registering net device %d\n", i);
1118 r = uf_register_netdev(priv, i);
1119 if (r)
1120 {
1121 /* unregister the net_device that are registered in the previous iterations */
1122 uf_unregister_netdev(priv);
1123 unifi_error(priv, "Failed to register the network device.\n");
1124 CsrWifiRouterCtrlWifiOnCfmSend(msg->source, res->clientData, CSR_RESULT_FAILURE);
1125 return;
1126 }
1127 }
1128#ifdef CSR_WIFI_SPLIT_PATCH
1129 else
1130 {
1131 /* If a netdev is already registered, we have received this WifiOnRes
1132 * in response to switching AP/STA firmware in a ModeSetReq.
1133 * Rememeber this in order to send a ModeSetCfm once
1134 */
1135 switching_ap_fw = TRUE;
1136 }
1137#endif
1138 }
1139 priv->totalInterfaceCount = res->numInterfaceAddress;
1140
1141 /* If the MIB has selected f/w scheduled interrupt mode, apply it now
1142 * but let module param override.
1143 */
1144 if (run_bh_once != -1) {
1145 intmode = (u32)run_bh_once;
1146 } else if (res->scheduledInterrupt) {
1147 intmode = CSR_WIFI_INTMODE_RUN_BH_ONCE;
1148 }
1149 unifi_set_interrupt_mode(priv->card, intmode);
1150
1151 priv->init_progress = UNIFI_INIT_COMPLETED;
1152
1153 /* Acknowledge the CsrWifiRouterCtrlWifiOnReq now */
1154 CsrWifiRouterCtrlWifiOnCfmSend(msg->source, res->clientData, CSR_RESULT_SUCCESS);
1155
1156#ifdef CSR_WIFI_SPLIT_PATCH
1157 if (switching_ap_fw && (priv->pending_mode_set.common.destination != 0xaaaa)) {
1158 unifi_info(priv, "Completed firmware reload with %s patch\n",
1159 CSR_WIFI_HIP_IS_AP_FW(priv->interfacePriv[0]->interfaceMode) ? "AP" : "STA");
1160
1161 /* Confirm the ModeSetReq that requested the AP/STA patch switch */
1162 CsrWifiRouterCtrlModeSetCfmSend(priv->pending_mode_set.common.source,
1163 priv->pending_mode_set.clientData,
1164 priv->pending_mode_set.interfaceTag,
1165 priv->pending_mode_set.mode,
1166 CSR_RESULT_SUCCESS);
1167 priv->pending_mode_set.common.destination = 0xaaaa;
1168 }
1169#endif
1170 unifi_info(priv, "UniFi ready\n");
1171
1172#ifdef ANDROID_BUILD
1173 /* Release the wakelock */
1174 unifi_trace(priv, UDBG1, "ready: release wake lock\n");
1175 wake_unlock(&unifi_sdio_wake_lock);
1176#endif
1177 /* Firmware initialisation is complete, so let the SDIO bus
1178 * clock be raised when convienent to the core.
1179 */
1180 unifi_request_max_sdio_clock(priv->card);
1181
1182#ifdef CSR_SUPPORT_WEXT
1183 /* Notify the Android wpa_supplicant that we are ready */
1184 wext_send_started_event(priv);
1185
1186 queue_work(priv->unifi_workqueue, &priv->sme_config_task);
1187#endif
1188
1189 } else {
1190 /* Acknowledge the CsrWifiRouterCtrlWifiOnReq now */
1191 CsrWifiRouterCtrlWifiOnCfmSend(msg->source, res->clientData, CSR_RESULT_FAILURE);
1192 }
1193}
1194
1195
1196void CsrWifiRouterCtrlWifiOffResHandler(void* drvpriv, CsrWifiFsmEvent* msg)
1197{
1198}
1199
1200
1201void CsrWifiRouterCtrlMulticastAddressResHandler(void* drvpriv, CsrWifiFsmEvent* msg)
1202{
1203}
1204
1205
1206void CsrWifiRouterMaPacketSubscribeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
1207{
1208 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
1209 CsrWifiRouterMaPacketSubscribeReq* req = (CsrWifiRouterMaPacketSubscribeReq*)msg;
1210 u8 i;
1211 CsrResult result;
1212
1213 if (priv == NULL) {
1214 unifi_error(priv, "CsrWifiRouterMaPacketSubscribeReqHandler: invalid priv\n");
1215 return;
1216 }
1217
1218 /* Look for an unused filter */
1219
1220 result = CSR_WIFI_RESULT_NO_ROOM;
1221 for (i = 0; i < MAX_MA_UNIDATA_IND_FILTERS; i++) {
1222
1223 if (!priv->sme_unidata_ind_filters[i].in_use) {
1224
1225 priv->sme_unidata_ind_filters[i].in_use = 1;
1226 priv->sme_unidata_ind_filters[i].appHandle = msg->source;
1227 priv->sme_unidata_ind_filters[i].encapsulation = req->encapsulation;
1228 priv->sme_unidata_ind_filters[i].protocol = req->protocol;
1229
1230 priv->sme_unidata_ind_filters[i].oui[2] = (u8) (req->oui & 0xFF);
1231 priv->sme_unidata_ind_filters[i].oui[1] = (u8) ((req->oui >> 8) & 0xFF);
1232 priv->sme_unidata_ind_filters[i].oui[0] = (u8) ((req->oui >> 16) & 0xFF);
1233
1234 result = CSR_RESULT_SUCCESS;
1235 break;
1236 }
1237 }
1238
1239 unifi_trace(priv, UDBG1,
1240 "subscribe_req: encap=%d, handle=%d, result=%d\n",
1241 req->encapsulation, i, result);
1242 CsrWifiRouterMaPacketSubscribeCfmSend(msg->source, req->interfaceTag, i, result, 0);
1243}
1244
1245
1246void CsrWifiRouterMaPacketUnsubscribeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
1247{
1248 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
1249 CsrWifiRouterMaPacketUnsubscribeReq* req = (CsrWifiRouterMaPacketUnsubscribeReq*)msg;
1250 CsrResult result;
1251
1252 if (priv == NULL) {
1253 unifi_error(priv, "CsrWifiRouterMaPacketUnsubscribeReqHandler: invalid priv\n");
1254 return;
1255 }
1256
1257 result = CSR_WIFI_RESULT_NOT_FOUND;
1258
1259 if (req->subscriptionHandle < MAX_MA_UNIDATA_IND_FILTERS) {
1260 if (priv->sme_unidata_ind_filters[req->subscriptionHandle].in_use) {
1261 priv->sme_unidata_ind_filters[req->subscriptionHandle].in_use = 0;
1262 result = CSR_RESULT_SUCCESS;
1263 } else {
1264 result = CSR_WIFI_RESULT_NOT_FOUND;
1265 }
1266 }
1267
1268 unifi_trace(priv, UDBG1,
1269 "unsubscribe_req: handle=%d, result=%d\n",
1270 req->subscriptionHandle, result);
1271 CsrWifiRouterMaPacketUnsubscribeCfmSend(msg->source, req->interfaceTag, result);
1272}
1273
1274
1275void CsrWifiRouterCtrlCapabilitiesReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
1276{
1277 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
1278 CsrWifiRouterCtrlCapabilitiesReq* req = (CsrWifiRouterCtrlCapabilitiesReq*)msg;
1279
1280 if (priv == NULL) {
1281 unifi_error(priv, "CsrWifiRouterCtrlCapabilitiesReqHandler: invalid priv\n");
1282 return;
1283 }
1284
1285 CsrWifiRouterCtrlCapabilitiesCfmSend(msg->source, req->clientData,
1286 UNIFI_SOFT_COMMAND_Q_LENGTH - 1,
1287 UNIFI_SOFT_TRAFFIC_Q_LENGTH - 1);
1288}
1289
1290
1291void CsrWifiRouterCtrlSuspendResHandler(void* drvpriv, CsrWifiFsmEvent* msg)
1292{
1293 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
1294 CsrWifiRouterCtrlSuspendRes* res = (CsrWifiRouterCtrlSuspendRes*)msg;
1295
1296 if (priv == NULL) {
1297 unifi_error(priv, "CsrWifiRouterCtrlSuspendResHandler: invalid priv\n");
1298 return;
1299 }
1300
1301 sme_complete_request(priv, res->status);
1302}
1303
1304
1305void CsrWifiRouterCtrlResumeResHandler(void* drvpriv, CsrWifiFsmEvent* msg)
1306{
1307 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
1308 CsrWifiRouterCtrlResumeRes* res = (CsrWifiRouterCtrlResumeRes*)msg;
1309
1310 if (priv == NULL) {
1311 unifi_error(priv, "CsrWifiRouterCtrlResumeResHandler: invalid priv\n");
1312 return;
1313 }
1314
1315 sme_complete_request(priv, res->status);
1316}
1317
1318
1319void CsrWifiRouterCtrlTrafficConfigReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
1320{
1321 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
1322 CsrWifiRouterCtrlTrafficConfigReq* req = (CsrWifiRouterCtrlTrafficConfigReq*)msg;
1323 CsrResult csrResult;
1324
1325 if (priv == NULL) {
1326 unifi_error(priv, "CsrWifiRouterCtrlTrafficConfigReqHandler: invalid smepriv\n");
1327 return;
1328 }
1329 if (req->trafficConfigType == CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_FILTER)
1330 {
1331 req->config.packetFilter |= CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM;
1332 }
1333 csrResult = unifi_ta_configure(priv->card, req->trafficConfigType, (const CsrWifiRouterCtrlTrafficConfig *)&req->config);
1334}
1335
1336void CsrWifiRouterCtrlTrafficClassificationReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
1337{
1338 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
1339 CsrWifiRouterCtrlTrafficClassificationReq* req = (CsrWifiRouterCtrlTrafficClassificationReq*)msg;
1340
1341 if (priv == NULL) {
1342 unifi_error(priv, "CsrWifiRouterCtrlTrafficClassificationReqHandler: invalid smepriv\n");
1343 return;
1344 }
1345
1346 unifi_ta_classification(priv->card, req->trafficType, req->period);
1347}
1348
1349static int
1350_sys_packet_req(unifi_priv_t *priv, const CSR_SIGNAL *signal,
1351 u8 subscriptionHandle,
1352 u16 frameLength, u8 *frame,
1353 int proto)
1354{
1355 int r;
1356 const sme_ma_unidata_ind_filter_t *subs;
1357 bulk_data_param_t bulkdata;
1358 CSR_MA_PACKET_REQUEST req = signal->u.MaPacketRequest;
1359 struct sk_buff *skb, *newSkb = NULL;
1360 CsrWifiMacAddress peerMacAddress;
1361 CsrResult csrResult;
1362 u16 interfaceTag = req.VirtualInterfaceIdentifier & 0xff;
1363 u8 eapolStore = FALSE;
1364 s8 protection = 0;
1365 netInterface_priv_t *interfacePriv;
1366 unsigned long flags;
1367
1368 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
1369 unifi_error(priv, "_sys_packet_req: interfaceID >= CSR_WIFI_NUM_INTERFACES.\n");
1370 return -EINVAL;
1371 }
1372 interfacePriv = priv->interfacePriv[interfaceTag];
1373 if (!priv->sme_unidata_ind_filters[subscriptionHandle].in_use) {
1374 unifi_error(priv, "_sys_packet_req: unknown subscription.\n");
1375 return -EINVAL;
1376 }
1377
1378 subs = &priv->sme_unidata_ind_filters[subscriptionHandle];
1379 unifi_trace(priv, UDBG1,
1380 "_sys_packet_req: handle=%d, subs=%p, encap=%d\n",
1381 subscriptionHandle, subs, subs->encapsulation);
1382
1383 csrResult = unifi_net_data_malloc(priv, &bulkdata.d[0], frameLength);
1384 if (csrResult != CSR_RESULT_SUCCESS) {
1385 unifi_error(priv, "_sys_packet_req: failed to allocate bulkdata.\n");
1386 return (int)CsrHipResultToStatus(csrResult);
1387 }
1388
1389 /* get the peer Mac address */
1390 memcpy(&peerMacAddress, frame, ETH_ALEN);
1391
1392 /* Determine if we need to add encapsulation header */
1393 if (subs->encapsulation == CSR_WIFI_ROUTER_ENCAPSULATION_ETHERNET) {
1394 memcpy((void*)bulkdata.d[0].os_data_ptr, frame, frameLength);
1395
1396 /* The translation is performed on the skb */
1397 skb = (struct sk_buff*)bulkdata.d[0].os_net_buf_ptr;
1398
1399 unifi_trace(priv, UDBG1,
1400 "_sys_packet_req: skb_add_llc_snap -->\n");
1401 r = skb_add_llc_snap(priv->netdev[interfaceTag], skb, proto);
1402 unifi_trace(priv, UDBG1,
1403 "_sys_packet_req: skb_add_llc_snap <--\n");
1404 if (r) {
1405 unifi_error(priv,
1406 "_sys_packet_req: failed to translate eth frame.\n");
1407 unifi_net_data_free(priv, &bulkdata.d[0]);
1408 return r;
1409 }
1410
1411 bulkdata.d[0].data_length = skb->len;
1412 } else {
1413 /* Crop the MAC addresses from the packet */
1414 memcpy((void*)bulkdata.d[0].os_data_ptr, frame + 2*ETH_ALEN, frameLength - 2*ETH_ALEN);
1415 bulkdata.d[0].data_length = frameLength - 2*ETH_ALEN;
1416 skb = (struct sk_buff*)bulkdata.d[0].os_net_buf_ptr;
1417 skb->len = bulkdata.d[0].data_length;
1418
1419 }
1420
1421 bulkdata.d[1].os_data_ptr = NULL;
1422 bulkdata.d[1].os_net_buf_ptr = NULL;
1423 bulkdata.d[1].data_length = 0;
1424
1425 /* check for m4 detection */
1426 if (0 == uf_verify_m4(priv, bulkdata.d[0].os_data_ptr, bulkdata.d[0].data_length)) {
1427 eapolStore = TRUE;
1428 }
1429
1430#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
1431 if (proto == ETH_P_WAI)
1432 {
1433 protection = 0; /*WAI packets always sent unencrypted*/
1434 }
1435 else
1436 {
1437#endif
1438
1439#ifdef CSR_SUPPORT_SME
1440 if ((protection = uf_get_protection_bit_from_interfacemode(priv, interfaceTag, peerMacAddress.a)) < 0) {
1441 unifi_error(priv, "unicast address, but destination not in station record database\n");
1442 unifi_net_data_free(priv, &bulkdata.d[0]);
1443 return -1;
1444 }
1445#else
1446 protection = 0;
1447#endif
1448
1449#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
1450 }
1451#endif
1452
1453 /* add Mac header */
1454 if (prepare_and_add_macheader(priv, skb, newSkb, req.Priority, &bulkdata, interfaceTag, frame, frame + ETH_ALEN, protection)) {
1455 unifi_error(priv, "failed to create MAC header\n");
1456 unifi_net_data_free(priv, &bulkdata.d[0]);
1457 return -1;
1458 }
1459
1460 if (eapolStore) {
1461 spin_lock_irqsave(&priv->m4_lock, flags);
1462 /* Store the EAPOL M4 packet for later */
1463 interfacePriv->m4_signal = *signal;
1464 interfacePriv->m4_bulk_data.net_buf_length = bulkdata.d[0].net_buf_length;
1465 interfacePriv->m4_bulk_data.data_length = bulkdata.d[0].data_length;
1466 interfacePriv->m4_bulk_data.os_data_ptr = bulkdata.d[0].os_data_ptr;
1467 interfacePriv->m4_bulk_data.os_net_buf_ptr = bulkdata.d[0].os_net_buf_ptr;
1468 spin_unlock_irqrestore(&priv->m4_lock, flags);
1469 /* Send a signal to SME */
1470 unifi_trace(priv, UDBG1, "_sys_packet_req: Sending CsrWifiRouterCtrlM4ReadyToSendInd\n");
1471 CsrWifiRouterCtrlM4ReadyToSendIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, peerMacAddress);
1472 return 0;
1473 }
1474
1475 /* Send the signal to UniFi */
1476 /* Set the B31 to 1 for local routing*/
1477 r= uf_process_ma_packet_req(priv, peerMacAddress.a, (req.HostTag | 0x80000000), interfaceTag, 0,
1478 (CSR_RATE)0, req.Priority, signal->SignalPrimitiveHeader.SenderProcessId, &bulkdata);
1479 if (r) {
1480 unifi_error(priv,
1481 "_sys_packet_req: failed to send signal.\n");
1482 unifi_net_data_free(priv, &bulkdata.d[0]);
1483 return r;
1484 }
1485 /* The final CsrWifiRouterMaPacketCfmSend() will called when the actual MA-PACKET.cfm is received from the chip */
1486
1487 return 0;
1488}
1489
1490void CsrWifiRouterMaPacketReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
1491{
1492 int r;
1493 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
1494 CsrWifiRouterMaPacketReq* mareq = (CsrWifiRouterMaPacketReq*)msg;
1495 llc_snap_hdr_t *snap;
1496 u16 snap_protocol;
1497 CSR_SIGNAL signal;
1498 CSR_MA_PACKET_REQUEST *req = &signal.u.MaPacketRequest;
1499 CsrWifiRouterCtrlPortAction controlPortaction;
1500 u8 *daddr, *saddr;
1501 u16 interfaceTag = mareq->interfaceTag & 0x00ff;
1502 int queue;
1503 netInterface_priv_t *interfacePriv;
1504
1505 if (!mareq->frame || !priv || !priv->smepriv)
1506 {
1507 unifi_error(priv, "CsrWifiRouterMaPacketReqHandler: invalid frame/priv/priv->smepriv\n");
1508 return;
1509 }
1510
1511 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
1512 unifi_error(priv, "CsrWifiRouterMaPacketReqHandler: interfaceID >= CSR_WIFI_NUM_INTERFACES.\n");
1513 return;
1514 }
1515
1516 interfacePriv = priv->interfacePriv[interfaceTag];
1517 /* get a pointer to dest & source Mac address */
1518 daddr = mareq->frame;
1519 saddr = (mareq->frame + ETH_ALEN);
1520 /* point to the proper position of frame, since frame has MAC header */
1521 snap = (llc_snap_hdr_t *) (mareq->frame + 2 * ETH_ALEN);
1522 snap_protocol = ntohs(snap->protocol);
1523 if((snap_protocol == ETH_P_PAE)
1524#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
1525 || (snap_protocol == ETH_P_WAI)
1526#endif
1527 )
1528 {
1529 queue = UF_UNCONTROLLED_PORT_Q;
1530 }
1531 else
1532 {
1533 queue = UF_CONTROLLED_PORT_Q;
1534 }
1535
1536 /* Controlled port restrictions apply to the packets */
1537 controlPortaction = uf_sme_port_state(priv, daddr, queue, interfaceTag);
1538 if (controlPortaction != CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN)
1539 {
1540 unifi_warning(priv, "CsrWifiRouterMaPacketReqHandler: (%s)controlled port is closed.\n", (queue == UF_CONTROLLED_PORT_Q)?"":"un");
1541 if(mareq->cfmRequested)
1542 {
1543 CsrWifiRouterMaPacketCfmSend(msg->source,
1544 interfaceTag,
1545 CSR_RESULT_FAILURE,
1546 mareq->hostTag, 0);
1547 }
1548 return;
1549 }
1550
1551 signal.SignalPrimitiveHeader.SignalId = CSR_MA_PACKET_REQUEST_ID;
1552 /* Store the appHandle in the LSB of the SenderId. */
1553 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(((priv->sme_cli->sender_id & 0xff00) | (unsigned int)msg->source),
1554 (u8*)&signal.SignalPrimitiveHeader.SenderProcessId);
1555 signal.SignalPrimitiveHeader.ReceiverProcessId = 0;
1556
1557 /* Fill in the MA-PACKET.req signal */
1558 memcpy(req->Ra.x, daddr, ETH_ALEN);
1559 req->Priority = mareq->priority;
1560 req->TransmitRate = 0; /* Let firmware select the rate*/
1561 req->VirtualInterfaceIdentifier = uf_get_vif_identifier(interfacePriv->interfaceMode, interfaceTag);
1562 req->HostTag = mareq->hostTag;
1563
1564 if(mareq->cfmRequested)
1565 req->TransmissionControl = 0;
1566 else
1567 req->TransmissionControl = CSR_NO_CONFIRM_REQUIRED;
1568
1569 r = _sys_packet_req(priv, &signal, mareq->subscriptionHandle,
1570 mareq->frameLength, mareq->frame, snap_protocol);
1571
1572 if (r && mareq->cfmRequested)
1573 {
1574 CsrWifiRouterMaPacketCfmSend(msg->source, interfaceTag,
1575 CSR_RESULT_FAILURE,
1576 mareq->hostTag, 0);
1577 }
1578 return;
1579}
1580
1581void CsrWifiRouterMaPacketCancelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
1582{
1583}
1584
1585void CsrWifiRouterCtrlM4TransmitReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
1586{
1587 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
1588 CsrWifiRouterCtrlM4TransmitReq* req = (CsrWifiRouterCtrlM4TransmitReq*)msg;
1589 int r;
1590 bulk_data_param_t bulkdata;
1591 netInterface_priv_t *interfacePriv;
1592 CSR_SIGNAL m4_signal;
1593 unsigned long flags;
1594
1595 if (priv == NULL) {
1596 unifi_error(priv, "CsrWifiRouterCtrlM4TransmitReqHandler: invalid smepriv\n");
1597 return;
1598 }
1599 if (req->interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
1600 unifi_error(priv, "M4TransmitReqHandler: interfaceTag >= CSR_WIFI_NUM_INTERFACES\n");
1601 return;
1602 }
1603
1604 interfacePriv = priv->interfacePriv[req->interfaceTag];
1605 spin_lock_irqsave(&priv->m4_lock, flags);
1606 if (interfacePriv->m4_bulk_data.data_length == 0) {
1607 spin_unlock_irqrestore(&priv->m4_lock, flags);
1608 unifi_error(priv, "CsrWifiRouterCtrlM4TransmitReqHandler: invalid buffer\n");
1609 return;
1610 }
1611
1612 memcpy(&bulkdata.d[0], &interfacePriv->m4_bulk_data, sizeof(bulk_data_desc_t));
1613
1614 interfacePriv->m4_bulk_data.net_buf_length = 0;
1615 interfacePriv->m4_bulk_data.data_length = 0;
1616 interfacePriv->m4_bulk_data.os_data_ptr = interfacePriv->m4_bulk_data.os_net_buf_ptr = NULL;
1617 m4_signal = interfacePriv->m4_signal;
1618 spin_unlock_irqrestore(&priv->m4_lock, flags);
1619
1620 bulkdata.d[1].os_data_ptr = NULL;
1621 bulkdata.d[1].data_length = 0;
1622
1623 interfacePriv->m4_sent = TRUE;
1624 m4_signal.u.MaPacketRequest.HostTag |= 0x80000000;
1625 /* Store the hostTag for later varification */
1626 interfacePriv->m4_hostTag = m4_signal.u.MaPacketRequest.HostTag;
1627 r = ul_send_signal_unpacked(priv, &m4_signal, &bulkdata);
1628 unifi_trace(priv, UDBG1,
1629 "CsrWifiRouterCtrlM4TransmitReqHandler: sent\n");
1630 if (r) {
1631 unifi_error(priv,
1632 "CsrWifiRouterCtrlM4TransmitReqHandler: failed to send signal.\n");
1633 unifi_net_data_free(priv, &bulkdata.d[0]);
1634 }
1635}
1636
1637/* reset the station records when the mode is set as CSR_WIFI_ROUTER_CTRL_MODE_NONE */
1638static void CsrWifiRouterCtrlResetStationRecordList(unifi_priv_t *priv, u16 interfaceTag)
1639{
1640 u8 i, j;
1641 CsrWifiRouterCtrlStaInfo_t *staInfo=NULL;
1642 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
1643 unsigned long lock_flags;
1644
1645 /* create a list for sending confirms of un-delivered packets */
1646 struct list_head send_cfm_list;
1647
1648 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
1649 unifi_error(priv, "CsrWifiRouterCtrlResetStationRecordList: bad interfaceTag\n");
1650 return;
1651 }
1652
1653 INIT_LIST_HEAD(&send_cfm_list);
1654
1655 /* Reset the station record to NULL if mode is NONE */
1656 for(i = 0; i < UNIFI_MAX_CONNECTIONS; i++) {
1657 if ((staInfo=interfacePriv->staInfo[i]) != NULL) {
1658 uf_prepare_send_cfm_list_for_queued_pkts(priv,
1659 &send_cfm_list,
1660 &(staInfo->mgtFrames));
1661 uf_flush_list(priv, &(staInfo->mgtFrames));
1662 for(j=0;j<MAX_ACCESS_CATOGORY;j++){
1663 uf_prepare_send_cfm_list_for_queued_pkts(priv,
1664 &send_cfm_list,
1665 &(staInfo->dataPdu[j]));
1666 uf_flush_list(priv, &(staInfo->dataPdu[j]));
1667 }
1668
1669 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
1670 /* Removing station record information from port config array */
1671 memset(staInfo->peerControlledPort, 0, sizeof(unifi_port_cfg_t));
1672 staInfo->peerControlledPort->port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD;
1673 staInfo->peerControlledPort->in_use = FALSE;
1674 interfacePriv->controlled_data_port.entries_in_use--;
1675
1676 memset(staInfo->peerUnControlledPort, 0, sizeof(unifi_port_cfg_t));
1677 staInfo->peerUnControlledPort->port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD;
1678 staInfo->peerUnControlledPort->in_use = FALSE;
1679 interfacePriv->uncontrolled_data_port.entries_in_use--;
1680
1681 kfree(interfacePriv->staInfo[i]);
1682 interfacePriv->staInfo[i] = NULL;
1683 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
1684 }
1685 }
1686 /* after the critical region process the list of frames that requested cfm
1687 * and send cfm to requestor one by one
1688 */
1689 send_auto_ma_packet_confirm(priv, interfacePriv, &send_cfm_list);
1690
1691#ifdef CSR_SUPPORT_SME
1692 /* Interface Independent, no of packet queued, incase of mode is None or AP set to 0 */
1693 switch(interfacePriv->interfaceMode)
1694 {
1695 case CSR_WIFI_ROUTER_CTRL_MODE_AP:
1696 case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO:
1697 case CSR_WIFI_ROUTER_CTRL_MODE_NONE:
1698 if (priv->noOfPktQueuedInDriver) {
1699 unifi_warning(priv, "After reset the noOfPktQueuedInDriver = %x\n", priv->noOfPktQueuedInDriver);
1700 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
1701 priv->noOfPktQueuedInDriver = 0;
1702 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
1703 }
1704 break;
1705 case CSR_WIFI_ROUTER_CTRL_MODE_IBSS:
1706 break;
1707 default:
1708 unifi_error(priv, "interfacemode is not correct in CsrWifiRouterCtrlResetStationRecordList: debug\n");
1709 }
1710#endif
1711
1712 if (((interfacePriv->controlled_data_port.entries_in_use != 0) || (interfacePriv->uncontrolled_data_port.entries_in_use != 0))
1713 && (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_NONE)) {
1714 /* Print in case if the value of entries goes to -ve/+ve (apart from 0)
1715 * we expect the entries should be zero here if mode is set as NONE
1716 */
1717 unifi_trace(priv, UDBG3, "In %s controlled port entries = %d, uncontrolled port entries = %d\n",
1718 __FUNCTION__, interfacePriv->controlled_data_port.entries_in_use,
1719 interfacePriv->uncontrolled_data_port.entries_in_use);
1720 }
1721}
1722
1723void CsrWifiRouterCtrlInterfaceReset(unifi_priv_t *priv, u16 interfaceTag)
1724{
1725 netInterface_priv_t *interfacePriv;
1726
1727 /* create a list for sending confirms of un-delivered packets */
1728 struct list_head send_cfm_list;
1729
1730 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
1731 unifi_error(priv, "CsrWifiRouterCtrlInterfaceReset: bad interfaceTag\n");
1732 return;
1733 }
1734
1735 interfacePriv = priv->interfacePriv[interfaceTag];
1736
1737 INIT_LIST_HEAD(&send_cfm_list);
1738
1739 /* Enable all queues by default */
1740 interfacePriv->queueEnabled[0] = 1;
1741 interfacePriv->queueEnabled[1] = 1;
1742 interfacePriv->queueEnabled[2] = 1;
1743 interfacePriv->queueEnabled[3] = 1;
1744
1745 uf_prepare_send_cfm_list_for_queued_pkts(priv,
1746 &send_cfm_list,
1747 &(interfacePriv->genericMgtFrames));
1748 uf_flush_list(priv, &(interfacePriv->genericMgtFrames));
1749
1750 uf_prepare_send_cfm_list_for_queued_pkts(priv,
1751 &send_cfm_list,
1752 &(interfacePriv->genericMulticastOrBroadCastMgtFrames));
1753 uf_flush_list(priv, &(interfacePriv->genericMulticastOrBroadCastMgtFrames));
1754
1755 uf_prepare_send_cfm_list_for_queued_pkts(priv,
1756 &send_cfm_list,
1757 &(interfacePriv->genericMulticastOrBroadCastFrames));
1758
1759 uf_flush_list(priv, &(interfacePriv->genericMulticastOrBroadCastFrames));
1760
1761 /* process the list of frames that requested cfm
1762 and send cfm to requestor one by one */
1763 send_auto_ma_packet_confirm(priv, interfacePriv, &send_cfm_list);
1764
1765 /* Reset the station record to NULL if mode is tried to set as NONE */
1766 switch(interfacePriv->interfaceMode)
1767 {
1768 case CSR_WIFI_ROUTER_CTRL_MODE_STA:
1769 case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI:
1770 case CSR_WIFI_ROUTER_CTRL_MODE_MONITOR:
1771 case CSR_WIFI_ROUTER_CTRL_MODE_AMP:
1772 /* station records not available in these modes */
1773 break;
1774 default:
1775 CsrWifiRouterCtrlResetStationRecordList(priv, interfaceTag);
1776 }
1777
1778 interfacePriv->num_stations_joined = 0;
1779 interfacePriv->sta_activity_check_enabled = FALSE;
1780}
1781
1782
1783void CsrWifiRouterCtrlModeSetReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
1784{
1785 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
1786 CsrWifiRouterCtrlModeSetReq* req = (CsrWifiRouterCtrlModeSetReq*)msg;
1787
1788 if (priv == NULL)
1789 {
1790 unifi_error(priv, "CsrWifiRouterCtrlModeSetReqHandler: invalid smepriv\n");
1791 return;
1792 }
1793
1794 if (req->interfaceTag < CSR_WIFI_NUM_INTERFACES)
1795 {
1796 netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag];
1797#ifdef CSR_WIFI_SPLIT_PATCH
1798 u8 old_mode = interfacePriv->interfaceMode;
1799#endif
1800 unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlModeSetReqHandler: interfacePriv->interfaceMode = %d\n",
1801 interfacePriv->interfaceMode);
1802
1803 interfacePriv->interfaceMode = req->mode;
1804
1805#ifdef CSR_WIFI_SPLIT_PATCH
1806 /* Detect a change in mode that requires a switch to/from the AP firmware patch.
1807 * This should only happen when transitioning in/out of AP modes.
1808 */
1809 if (CSR_WIFI_HIP_IS_AP_FW(req->mode) != CSR_WIFI_HIP_IS_AP_FW(old_mode))
1810 {
1811 CsrWifiRouterCtrlVersions versions;
1812 int r;
1813
1814#ifdef ANDROID_BUILD
1815 /* Take the wakelock while switching patch */
1816 unifi_trace(priv, UDBG1, "patch switch: take wake lock\n");
1817 wake_lock(&unifi_sdio_wake_lock);
1818#endif
1819 unifi_info(priv, "Resetting UniFi with %s patch\n", CSR_WIFI_HIP_IS_AP_FW(req->mode) ? "AP" : "STA");
1820
1821 r = uf_request_firmware_files(priv, UNIFI_FW_STA);
1822 if (r) {
1823 unifi_error(priv, "CsrWifiRouterCtrlModeSetReqHandler: Failed to get f/w\n");
1824 CsrWifiRouterCtrlModeSetCfmSend(msg->source, req->clientData, req->interfaceTag,
1825 req->mode, CSR_RESULT_FAILURE);
1826 return;
1827 }
1828
1829 /* Block the I/O thread */
1830 priv->bh_thread.block_thread = 1;
1831
1832 /* Reset and download the new patch */
1833 r = uf_init_hw(priv);
1834 if (r) {
1835 unifi_error(priv, "CsrWifiRouterCtrlWifiOnReqHandler: Failed to initialise h/w, error %d\n", r);
1836 CsrWifiRouterCtrlModeSetCfmSend(msg->source, req->clientData, req->interfaceTag,
1837 req->mode, CSR_RESULT_FAILURE);
1838 return;
1839 }
1840
1841 /* Re-enable the I/O thread */
1842 priv->bh_thread.block_thread = 0;
1843
1844 /* Get the version information from the core */
1845 unifi_card_info(priv->card, &priv->card_info);
1846
1847 /* Copy to the unifiio_card_info structure. */
1848 versions.chipId = priv->card_info.chip_id;
1849 versions.chipVersion = priv->card_info.chip_version;
1850 versions.firmwareBuild = priv->card_info.fw_build;
1851 versions.firmwareHip = priv->card_info.fw_hip_version;
1852 versions.routerBuild = (char*)CSR_WIFI_VERSION;
1853 versions.routerHip = (UNIFI_HIP_MAJOR_VERSION << 8) | UNIFI_HIP_MINOR_VERSION;
1854
1855 /* Now that new firmware is running, send a WifiOnInd to the NME. This will
1856 * cause it to retransfer the MIB.
1857 */
1858 CsrWifiRouterCtrlWifiOnIndSend(msg->source, 0, CSR_RESULT_SUCCESS, versions);
1859
1860 /* Store the request so we know where to send the ModeSetCfm */
1861 priv->pending_mode_set = *req;
1862 }
1863 else
1864#endif
1865 {
1866 /* No patch switch, confirm straightaway */
1867 CsrWifiRouterCtrlModeSetCfmSend(msg->source, req->clientData, req->interfaceTag,
1868 req->mode, CSR_RESULT_SUCCESS);
1869 }
1870
1871 interfacePriv->bssid = req->bssid;
1872 /* For modes other than AP/P2PGO, set below member FALSE */
1873 interfacePriv->intraBssEnabled = FALSE;
1874 /* Initialise the variable bcTimSet with a value
1875 * other then CSR_WIFI_TIM_SET or CSR_WIFI_TIM_RESET value
1876 */
1877 interfacePriv->bcTimSet = 0xFF;
1878 interfacePriv->bcTimSetReqPendingFlag = FALSE;
1879 /* Initialise the variable bcTimSetReqQueued with a value
1880 * other then CSR_WIFI_TIM_SET or CSR_WIFI_TIM_RESET value
1881 */
1882 interfacePriv->bcTimSetReqQueued =0xFF;
1883 CsrWifiRouterCtrlInterfaceReset(priv, req->interfaceTag);
1884
1885 if(req->mode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
1886 req->mode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
1887 interfacePriv->protect = req->protection;
1888 interfacePriv->dtimActive=FALSE;
1889 interfacePriv->multicastPduHostTag = 0xffffffff;
1890 /* For AP/P2PGO mode SME sending intraBssDistEnabled
1891 * i.e. for AP: intraBssDistEnabled = TRUE, for P2PGO
1892 * intraBssDistEnabled = TRUE/FALSE on requirement
1893 */
1894 interfacePriv->intraBssEnabled = req->intraBssDistEnabled;
1895 unifi_trace(priv, UDBG3, "CsrWifiRouterCtrlModeSetReqHandler: IntraBssDisEnabled = %d\n",
1896 req->intraBssDistEnabled);
1897 } else if (req->mode == CSR_WIFI_ROUTER_CTRL_MODE_NONE) {
1898 netif_carrier_off(priv->netdev[req->interfaceTag]);
1899 interfacePriv->connected = UnifiConnectedUnknown;
1900 }
1901 }
1902 else {
1903 unifi_error(priv, "CsrWifiRouterCtrlModeSetReqHandler: invalid interfaceTag :%d\n", req->interfaceTag);
1904 }
1905}
1906
1907void CsrWifiRouterMaPacketResHandler(void* drvpriv, CsrWifiFsmEvent* msg)
1908{
1909}
1910
1911/* delete the station record from the station record data base */
1912static int peer_delete_record(unifi_priv_t *priv, CsrWifiRouterCtrlPeerDelReq *req)
1913{
1914 u8 j;
1915 CsrWifiRouterCtrlStaInfo_t *staInfo = NULL;
1916 unifi_port_config_t *controlledPort;
1917 unifi_port_config_t *unControlledPort;
1918 netInterface_priv_t *interfacePriv;
1919
1920 u8 ba_session_idx = 0;
1921 ba_session_rx_struct *ba_session_rx = NULL;
1922 ba_session_tx_struct *ba_session_tx = NULL;
1923
1924 /* create a list for sending confirms of un-delivered packets */
1925 struct list_head send_cfm_list;
1926
1927 unsigned long lock_flags;
1928
1929 if ((req->peerRecordHandle >= UNIFI_MAX_CONNECTIONS) || (req->interfaceTag >= CSR_WIFI_NUM_INTERFACES)) {
1930 unifi_error(priv, "handle/interfaceTag is not proper, handle = %d, interfaceTag = %d\n", req->peerRecordHandle, req->interfaceTag);
1931 return CSR_RESULT_FAILURE;
1932 }
1933
1934 INIT_LIST_HEAD(&send_cfm_list);
1935
1936 interfacePriv = priv->interfacePriv[req->interfaceTag];
1937 /* remove the station record & make it NULL */
1938 if ((staInfo=interfacePriv->staInfo[req->peerRecordHandle])!=NULL) {
1939
1940 uf_prepare_send_cfm_list_for_queued_pkts(priv,
1941 &send_cfm_list,
1942 &(staInfo->mgtFrames));
1943
1944 uf_flush_list(priv, &(staInfo->mgtFrames));
1945 for(j=0;j<MAX_ACCESS_CATOGORY;j++){
1946 uf_prepare_send_cfm_list_for_queued_pkts(priv,
1947 &send_cfm_list,
1948 &(staInfo->dataPdu[j]));
1949 uf_flush_list(priv, &(staInfo->dataPdu[j]));
1950 }
1951
1952 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
1953 /* clear the port configure array info, for the corresponding peer entry */
1954 controlledPort = &interfacePriv->controlled_data_port;
1955 unControlledPort = &interfacePriv->uncontrolled_data_port;
1956
1957 unifi_trace(priv, UDBG1, "peer_delete_record: Peer found handle = %d, port in use: cont(%d), unCont(%d)\n",
1958 req->peerRecordHandle, controlledPort->entries_in_use, unControlledPort->entries_in_use);
1959
1960 memset(staInfo->peerControlledPort, 0, sizeof(unifi_port_cfg_t));
1961 staInfo->peerControlledPort->port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD;
1962 staInfo->peerControlledPort->in_use = FALSE;
1963 if (controlledPort->entries_in_use) {
1964 controlledPort->entries_in_use--;
1965 } else {
1966 unifi_warning(priv, "number of controlled port entries is zero, trying to decrement: debug\n");
1967 }
1968
1969 memset(staInfo->peerUnControlledPort, 0, sizeof(unifi_port_cfg_t));
1970 staInfo->peerUnControlledPort->port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD;
1971 staInfo->peerUnControlledPort->in_use = FALSE;
1972 if (unControlledPort->entries_in_use) {
1973 unControlledPort->entries_in_use--;
1974 } else {
1975 unifi_warning(priv, "number of uncontrolled port entries is zero, trying to decrement: debug\n");
1976 }
1977
1978 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
1979 /* update the TIM with zero */
1980 if (interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_IBSS &&
1981 staInfo->timSet == CSR_WIFI_TIM_SET) {
1982 unifi_trace(priv, UDBG3, "peer is deleted so TIM updated to 0, in firmware\n");
1983 update_tim(priv, staInfo->aid, 0, req->interfaceTag, req->peerRecordHandle);
1984 }
1985
1986
1987 /* Stop BA session if it is active, for this peer address all BA sessions
1988 (per tID per role) are closed */
1989
1990 down(&priv->ba_mutex);
1991 for(ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX; ba_session_idx++){
1992 ba_session_rx = priv->interfacePriv[req->interfaceTag]->ba_session_rx[ba_session_idx];
1993 if(ba_session_rx) {
1994 if(!memcmp(ba_session_rx->macAddress.a, staInfo->peerMacAddress.a, ETH_ALEN)){
1995 blockack_session_stop(priv,
1996 req->interfaceTag,
1997 CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT,
1998 ba_session_rx->tID,
1999 ba_session_rx->macAddress);
2000 }
2001 }
2002 }
2003
2004 for(ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_TX; ba_session_idx++){
2005 ba_session_tx = priv->interfacePriv[req->interfaceTag]->ba_session_tx[ba_session_idx];
2006 if(ba_session_tx) {
2007 if(!memcmp(ba_session_tx->macAddress.a, staInfo->peerMacAddress.a, ETH_ALEN)){
2008 blockack_session_stop(priv,
2009 req->interfaceTag,
2010 CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR,
2011 ba_session_tx->tID,
2012 ba_session_tx->macAddress);
2013 }
2014 }
2015 }
2016
2017 up(&priv->ba_mutex);
2018
2019#ifdef CSR_SUPPORT_SME
2020 unifi_trace(priv, UDBG1, "Canceling work queue for STA with AID: %d\n", staInfo->aid);
2021 cancel_work_sync(&staInfo->send_disconnected_ind_task);
2022#endif
2023
2024 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
2025#ifdef CSR_SUPPORT_SME
2026 interfacePriv->num_stations_joined--;
2027
2028 staInfo->nullDataHostTag = INVALID_HOST_TAG;
2029
2030 if ((interfacePriv->sta_activity_check_enabled) &&
2031 (interfacePriv->num_stations_joined < STA_INACTIVE_DETECTION_TRIGGER_THRESHOLD))
2032 {
2033 unifi_trace(priv, UDBG1, "STOPPING the Inactivity Timer (num of stations = %d)\n", interfacePriv->num_stations_joined);
2034 interfacePriv->sta_activity_check_enabled = FALSE;
2035 del_timer_sync(&interfacePriv->sta_activity_check_timer);
2036 }
2037#endif
2038
2039 /* Free the station record for corresponding peer */
2040 kfree(interfacePriv->staInfo[req->peerRecordHandle]);
2041 interfacePriv->staInfo[req->peerRecordHandle] = NULL;
2042 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
2043
2044 /* after the critical region process the list of frames that requested cfm
2045 and send cfm to requestor one by one */
2046 send_auto_ma_packet_confirm(priv, interfacePriv, &send_cfm_list);
2047
2048
2049 }
2050 else
2051 {
2052 unifi_trace(priv, UDBG3, " peer not found: Delete request Peer handle[%d]\n", req->peerRecordHandle);
2053 }
2054
2055 return CSR_RESULT_SUCCESS;
2056}
2057
2058void CsrWifiRouterCtrlPeerDelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
2059{
2060 CsrWifiRouterCtrlPeerDelReq* req = (CsrWifiRouterCtrlPeerDelReq*)msg;
2061 CsrResult status = CSR_RESULT_SUCCESS;
2062 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
2063 netInterface_priv_t *interfacePriv;
2064
2065 unifi_trace(priv, UDBG2, "entering CsrWifiRouterCtrlPeerDelReqHandler\n");
2066 if (priv == NULL)
2067 {
2068 unifi_error(priv, "CsrWifiRouterCtrlPeerDelReqHandler: invalid smepriv\n");
2069 return;
2070 }
2071
2072 if (req->interfaceTag >= CSR_WIFI_NUM_INTERFACES)
2073 {
2074 unifi_error(priv, "CsrWifiRouterCtrlPeerDelReqHandler: bad interfaceTag\n");
2075 return;
2076 }
2077
2078 interfacePriv = priv->interfacePriv[req->interfaceTag];
2079
2080 switch(interfacePriv->interfaceMode)
2081 {
2082 case CSR_WIFI_ROUTER_CTRL_MODE_AP:
2083 case CSR_WIFI_ROUTER_CTRL_MODE_IBSS:
2084 case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO:
2085 /* remove the station from station record data base */
2086 status = peer_delete_record(priv, req);
2087 break;
2088 case CSR_WIFI_ROUTER_CTRL_MODE_STA:
2089 case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI:
2090 default:
2091 /* No station record to maintain in these modes */
2092 break;
2093 }
2094
2095 CsrWifiRouterCtrlPeerDelCfmSend(msg->source, req->clientData, req->interfaceTag, status);
2096 unifi_trace(priv, UDBG2, "leaving CsrWifiRouterCtrlPeerDelReqHandler \n");
2097}
2098
2099/* Add the new station to the station record data base */
2100static int peer_add_new_record(unifi_priv_t *priv, CsrWifiRouterCtrlPeerAddReq *req, u32 *handle)
2101{
2102 u8 i, powerModeTemp = 0;
2103 u8 freeSlotFound = FALSE;
2104 CsrWifiRouterCtrlStaInfo_t *newRecord = NULL;
2105 netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag];
2106 u32 currentTime, currentTimeHi;
2107 unsigned long lock_flags;
2108
2109 if (req->interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
2110 unifi_error(priv, "peer_add_new_record: bad interfaceTag\n");
2111 return CSR_RESULT_FAILURE;
2112 }
2113
2114 currentTime = CsrTimeGet(&currentTimeHi);
2115
2116 for(i = 0; i < UNIFI_MAX_CONNECTIONS; i++) {
2117 if(interfacePriv->staInfo[i] == NULL) {
2118 /* Slot is empty, so can be used for station record */
2119 freeSlotFound = TRUE;
2120 *handle = i;
2121
2122 /* Allocate for the new station record , to avoid race condition would happen between ADD_PEER &
2123 * DEL_PEER the allocation made atomic memory rather than kernel memory
2124 */
2125 newRecord = kmalloc(sizeof(CsrWifiRouterCtrlStaInfo_t), GFP_ATOMIC);
2126 if (!newRecord) {
2127 unifi_error(priv, "failed to allocate the %d bytes of mem for station record\n",
2128 sizeof(CsrWifiRouterCtrlStaInfo_t));
2129 return CSR_RESULT_FAILURE;
2130 }
2131
2132 unifi_trace(priv, UDBG1, "peer_add_new_record: handle = %d AID = %d addr = %x:%x:%x:%x:%x:%x LI=%u\n",
2133 *handle, req->associationId, req->peerMacAddress.a[0], req->peerMacAddress.a[1], req->peerMacAddress.a[2],
2134 req->peerMacAddress.a[3], req->peerMacAddress.a[4], req->peerMacAddress.a[5],
2135 req->staInfo.listenIntervalInTus);
2136
2137 /* disable the preemption until station record updated */
2138 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
2139
2140 interfacePriv->staInfo[i] = newRecord;
2141 /* Initialize the record*/
2142 memset(newRecord, 0, sizeof(CsrWifiRouterCtrlStaInfo_t));
2143 /* update the station record */
2144 memcpy(newRecord->peerMacAddress.a, req->peerMacAddress.a, ETH_ALEN);
2145 newRecord->wmmOrQosEnabled = req->staInfo.wmmOrQosEnabled;
2146
2147 /* maxSpLength is bit map in qosInfo field, so converting accordingly */
2148 newRecord->maxSpLength = req->staInfo.maxSpLength * 2;
2149
2150 /*Max SP 0 mean any number of packets. since we buffer only 512
2151 packets we are hard coding this to zero for the moment */
2152
2153 if(newRecord->maxSpLength == 0)
2154 newRecord->maxSpLength=512;
2155
2156 newRecord->assignedHandle = i;
2157
2158 /* copy power save mode of all access catagory (Trigger/Delivery/both enabled/disabled) */
2159 powerModeTemp = (u8) ((req->staInfo.powersaveMode >> 4) & 0xff);
2160
2161 if(!(req->staInfo.powersaveMode & 0x0001))
2162 newRecord->powersaveMode[UNIFI_TRAFFIC_Q_BK]= CSR_WIFI_AC_LEGACY_POWER_SAVE;
2163 else
2164 newRecord->powersaveMode[UNIFI_TRAFFIC_Q_BK]= powerModeTemp & 0x03;
2165
2166 if(!(req->staInfo.powersaveMode & 0x0002))
2167 newRecord->powersaveMode[UNIFI_TRAFFIC_Q_BE]= CSR_WIFI_AC_LEGACY_POWER_SAVE;
2168 else
2169 newRecord->powersaveMode[UNIFI_TRAFFIC_Q_BE]= ((powerModeTemp & 0x0C)>> 2);
2170
2171 if(!(req->staInfo.powersaveMode & 0x0004))
2172 newRecord->powersaveMode[UNIFI_TRAFFIC_Q_VI]= CSR_WIFI_AC_LEGACY_POWER_SAVE;
2173 else
2174 newRecord->powersaveMode[UNIFI_TRAFFIC_Q_VI]= ((powerModeTemp & 0x30)>> 4);
2175
2176 if(!(req->staInfo.powersaveMode & 0x0008))
2177 newRecord->powersaveMode[UNIFI_TRAFFIC_Q_VO]= CSR_WIFI_AC_LEGACY_POWER_SAVE;
2178 else
2179 newRecord->powersaveMode[UNIFI_TRAFFIC_Q_VO]= ((powerModeTemp & 0xC0)>> 6);
2180
2181 {
2182 u8 k;
2183 for(k=0; k< MAX_ACCESS_CATOGORY ;k++)
2184 unifi_trace(priv, UDBG2, "peer_add_new_record: WMM : %d ,AC %d, powersaveMode %x \n",
2185 req->staInfo.wmmOrQosEnabled, k, newRecord->powersaveMode[k]);
2186 }
2187
2188 unifi_trace(priv, UDBG3, "newRecord->wmmOrQosEnabled : %d , MAX SP : %d\n",
2189 newRecord->wmmOrQosEnabled, newRecord->maxSpLength);
2190
2191 /* Initialize the mgtFrames & data Pdu list */
2192 {
2193 u8 j;
2194 INIT_LIST_HEAD(&newRecord->mgtFrames);
2195 for(j = 0; j < MAX_ACCESS_CATOGORY; j++) {
2196 INIT_LIST_HEAD(&newRecord->dataPdu[j]);
2197 }
2198 }
2199
2200 newRecord->lastActivity = currentTime;
2201 newRecord->activity_flag = TRUE;
2202
2203 /* enable the preemption as station record updated */
2204 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
2205
2206 /* First time port actions are set for the peer with below information */
2207 configure_data_port(priv, CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN, &newRecord->peerMacAddress,
2208 UF_UNCONTROLLED_PORT_Q, req->interfaceTag);
2209
2210 if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_IBSS) {
2211 configure_data_port(priv, CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN, &newRecord->peerMacAddress,
2212 UF_CONTROLLED_PORT_Q, req->interfaceTag);
2213 } else {
2214 configure_data_port(priv, CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD, &newRecord->peerMacAddress,
2215 UF_CONTROLLED_PORT_Q, req->interfaceTag);
2216 }
2217
2218
2219 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
2220 /* Port status must be already set before calling the Add Peer request */
2221 newRecord->peerControlledPort = uf_sme_port_config_handle(priv, newRecord->peerMacAddress.a,
2222 UF_CONTROLLED_PORT_Q, req->interfaceTag);
2223 newRecord->peerUnControlledPort = uf_sme_port_config_handle(priv, newRecord->peerMacAddress.a,
2224 UF_UNCONTROLLED_PORT_Q, req->interfaceTag);
2225
2226 if (!newRecord->peerControlledPort || !newRecord->peerUnControlledPort) {
2227 /* enable the preemption as station record failed to update */
2228 unifi_warning(priv, "Un/ControlledPort record not found in port configuration array index = %d\n", i);
2229 kfree(interfacePriv->staInfo[i]);
2230 interfacePriv->staInfo[i] = NULL;
2231 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
2232 return CSR_RESULT_FAILURE;
2233 }
2234
2235 newRecord->currentPeerState = CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE;
2236
2237 /* changes done during block ack handling */
2238 newRecord->txSuspend = FALSE;
2239
2240 /*U-APSD related data structure*/
2241 newRecord->timRequestPendingFlag = FALSE;
2242
2243 /* Initialise the variable updateTimReqQueued with a value
2244 * other then CSR_WIFI_TIM_SET or CSR_WIFI_TIM_RESET value
2245 */
2246 newRecord->updateTimReqQueued = 0xFF;
2247 newRecord->timSet = CSR_WIFI_TIM_RESET;
2248 newRecord->uapsdActive = FALSE;
2249 newRecord->noOfSpFramesSent =0;
2250 newRecord->triggerFramePriority = CSR_QOS_UP0;
2251
2252 /* The protection bit is updated once the port opens for corresponding peer in
2253 * routerPortConfigure request */
2254
2255 /* update the association ID */
2256 newRecord->aid = req->associationId;
2257
2258#ifdef CSR_SUPPORT_SME
2259 interfacePriv->num_stations_joined++;
2260 newRecord->interfacePriv = interfacePriv;
2261 newRecord->listenIntervalInTus = req->staInfo.listenIntervalInTus;
2262 newRecord->nullDataHostTag = INVALID_HOST_TAG;
2263
2264 INIT_WORK(&newRecord->send_disconnected_ind_task, uf_send_disconnected_ind_wq);
2265
2266 if(!(interfacePriv->sta_activity_check_enabled) &&
2267 (interfacePriv->num_stations_joined >= STA_INACTIVE_DETECTION_TRIGGER_THRESHOLD)){
2268 unifi_trace(priv, UDBG1,
2269 "peer_add_new_record: STARTING the Inactivity Timer (num of stations = %d)",
2270 interfacePriv->num_stations_joined);
2271
2272 interfacePriv->sta_activity_check_enabled = TRUE;
2273 interfacePriv->sta_activity_check_timer.function = check_inactivity_timer_expire_func;
2274 interfacePriv->sta_activity_check_timer.data = (unsigned long)interfacePriv;
2275
2276 init_timer(&interfacePriv->sta_activity_check_timer);
2277 mod_timer(&interfacePriv->sta_activity_check_timer,
2278 (jiffies + usecs_to_jiffies(STA_INACTIVE_DETECTION_TIMER_INTERVAL * 1000 * 1000)));
2279
2280 }
2281#endif
2282 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
2283 break;
2284 }
2285 }
2286
2287 if(!freeSlotFound) {
2288 unifi_error(priv, "Limited connectivity, Free slot not found for station record addition\n");
2289 return CSR_RESULT_FAILURE;
2290 }
2291 return CSR_RESULT_SUCCESS;
2292}
2293
2294#ifdef CSR_SUPPORT_SME
2295static void check_inactivity_timer_expire_func(unsigned long data)
2296{
2297 struct unifi_priv *priv;
2298 CsrWifiRouterCtrlStaInfo_t *sta_record = NULL;
2299 u8 i = 0;
2300 u32 now;
2301 u32 inactive_time;
2302 netInterface_priv_t *interfacePriv = (netInterface_priv_t *) data;
2303
2304 if (!interfacePriv)
2305 {
2306 return;
2307 }
2308
2309 priv = interfacePriv->privPtr;
2310
2311 if (interfacePriv->InterfaceTag >= CSR_WIFI_NUM_INTERFACES)
2312 {
2313 unifi_error(priv, "check_inactivity_timer_expire_func: Invalid interfaceTag\n");
2314 return;
2315 }
2316
2317 /* RUN Algorithm to check inactivity for each connected station */
2318 now = CsrTimeGet(NULL);
2319
2320 for(i = 0; i < UNIFI_MAX_CONNECTIONS; i++) {
2321 if(interfacePriv->staInfo[i] != NULL) {
2322 sta_record = interfacePriv->staInfo[i];
2323
2324 if (sta_record->activity_flag == TRUE){
2325 sta_record->activity_flag = FALSE;
2326 sta_record->lastActivity = now;
2327 continue;
2328 }
2329
2330 if (sta_record->lastActivity > now)
2331 {
2332 /* simple timer wrap (for 1 wrap) */
2333 inactive_time = CsrTimeAdd((u32)CsrTimeSub(CSR_SCHED_TIME_MAX, sta_record->lastActivity), now);
2334 }
2335 else
2336 {
2337 inactive_time = (u32)CsrTimeSub(now, sta_record->lastActivity);
2338 }
2339
2340 if (inactive_time >= STA_INACTIVE_TIMEOUT_VAL)
2341 {
2342 unifi_trace(priv, UDBG1, "STA is Inactive - AID = %d inactive_time = %d\n",
2343 sta_record->aid,
2344 inactive_time);
2345
2346 /* station is in-active, if it is in active mode send a null frame
2347 * and the station should acknowledge the null frame, if acknowledgement
2348 * is not received throw out the station.
2349 * If the station is in Power Save, update TIM for the station so
2350 * that it wakes up and register some activity through PS-Poll or
2351 * trigger frame.
2352 */
2353 if (sta_record->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE)
2354 {
2355 unifi_trace(priv, UDBG1, "STA power save state - Active, send a NULL frame to check if it is ALIVE\n");
2356 uf_send_nulldata ( priv,
2357 sta_record->interfacePriv->InterfaceTag,
2358 sta_record->peerMacAddress.a,
2359 CSR_CONTENTION,
2360 sta_record);
2361 }
2362 else if (sta_record->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE)
2363 {
2364 if((sta_record->timSet == CSR_WIFI_TIM_SET) ||
2365 (sta_record->timSet == CSR_WIFI_TIM_SETTING))
2366 {
2367 unifi_trace(priv, UDBG1, "STA power save state - PS, TIM is already SET\n");
2368
2369 /* If TIM is set and we do not have any activity for
2370 * more than 3 listen intervals then send a disconnected
2371 * indication to SME, to delete the station from station
2372 * record list.
2373 * The inactivity is already more than STA_INACTIVE_TIMEOUT_VAL
2374 * and this check ensures if the listen interval is a larger
2375 * value than STA_INACTIVE_TIMEOUT_VAL.
2376 */
2377 if (inactive_time > (3 * (sta_record->listenIntervalInTus * 1024)))
2378 {
2379 unifi_trace(priv, UDBG1, "STA is inactive for more than 3 listen intervals\n");
2380 queue_work( priv->unifi_workqueue,
2381 &sta_record->send_disconnected_ind_task);
2382 }
2383
2384 }
2385 else
2386 {
2387 unifi_trace(priv, UDBG1, "STA power save state - PS, update TIM to see if it is ALIVE\n");
2388 update_tim(priv,
2389 sta_record->aid,
2390 CSR_WIFI_TIM_SET,
2391 interfacePriv->InterfaceTag,
2392 sta_record->assignedHandle);
2393 }
2394 }
2395 }
2396 }
2397 }
2398
2399 /* re-run the timer interrupt */
2400 mod_timer(&interfacePriv->sta_activity_check_timer,
2401 (jiffies + usecs_to_jiffies(STA_INACTIVE_DETECTION_TIMER_INTERVAL * 1000 * 1000)));
2402
2403}
2404
2405
2406void uf_send_disconnected_ind_wq(struct work_struct *work)
2407{
2408
2409 CsrWifiRouterCtrlStaInfo_t *staInfo = container_of(work, CsrWifiRouterCtrlStaInfo_t, send_disconnected_ind_task);
2410 unifi_priv_t *priv;
2411 u16 interfaceTag;
2412 struct list_head send_cfm_list;
2413 u8 j;
2414
2415 if(!staInfo) {
2416 return;
2417 }
2418
2419 if(!staInfo->interfacePriv) {
2420 return;
2421 }
2422
2423 priv = staInfo->interfacePriv->privPtr;
2424 interfaceTag = staInfo->interfacePriv->InterfaceTag;
2425
2426 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
2427 unifi_error(priv, "uf_send_disconnected_ind_wq: invalid interfaceTag\n");
2428 return;
2429 }
2430
2431 /* The SME/NME may be waiting for confirmation for requested frames to this station.
2432 * So loop through buffered frames for this station and if confirmation is
2433 * requested, send auto confirmation with failure status. Also flush the frames so
2434 * that these are not processed again in PEER_DEL_REQ handler.
2435 */
2436 INIT_LIST_HEAD(&send_cfm_list);
2437
2438 uf_prepare_send_cfm_list_for_queued_pkts(priv,
2439 &send_cfm_list,
2440 &(staInfo->mgtFrames));
2441
2442 uf_flush_list(priv, &(staInfo->mgtFrames));
2443
2444 for(j = 0; j < MAX_ACCESS_CATOGORY; j++){
2445 uf_prepare_send_cfm_list_for_queued_pkts(priv,
2446 &send_cfm_list,
2447 &(staInfo->dataPdu[j]));
2448
2449 uf_flush_list(priv, &(staInfo->dataPdu[j]));
2450 }
2451
2452 send_auto_ma_packet_confirm(priv, staInfo->interfacePriv, &send_cfm_list);
2453
2454 unifi_warning(priv, "uf_send_disconnected_ind_wq: Router Disconnected IND Peer (%x-%x-%x-%x-%x-%x)\n",
2455 staInfo->peerMacAddress.a[0],
2456 staInfo->peerMacAddress.a[1],
2457 staInfo->peerMacAddress.a[2],
2458 staInfo->peerMacAddress.a[3],
2459 staInfo->peerMacAddress.a[4],
2460 staInfo->peerMacAddress.a[5]);
2461
2462 CsrWifiRouterCtrlConnectedIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,
2463 0,
2464 staInfo->interfacePriv->InterfaceTag,
2465 staInfo->peerMacAddress,
2466 CSR_WIFI_ROUTER_CTRL_PEER_DISCONNECTED);
2467
2468
2469 return;
2470}
2471
2472
2473#endif
2474void CsrWifiRouterCtrlPeerAddReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
2475{
2476 CsrWifiRouterCtrlPeerAddReq* req = (CsrWifiRouterCtrlPeerAddReq*)msg;
2477 CsrResult status = CSR_RESULT_SUCCESS;
2478 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
2479 u32 handle = 0;
2480 netInterface_priv_t *interfacePriv;
2481
2482 unifi_trace(priv, UDBG2, "entering CsrWifiRouterCtrlPeerAddReqHandler \n");
2483 if (priv == NULL)
2484 {
2485 unifi_error(priv, "CsrWifiRouterCtrlPeerAddReqHandler: invalid smepriv\n");
2486 return;
2487 }
2488
2489 if (req->interfaceTag >= CSR_WIFI_NUM_INTERFACES)
2490 {
2491 unifi_error(priv, "CsrWifiRouterCtrlPeerAddReqHandler: bad interfaceTag\n");
2492 return;
2493 }
2494
2495 interfacePriv = priv->interfacePriv[req->interfaceTag];
2496
2497 switch(interfacePriv->interfaceMode)
2498 {
2499 case CSR_WIFI_ROUTER_CTRL_MODE_AP:
2500 case CSR_WIFI_ROUTER_CTRL_MODE_IBSS:
2501 case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO:
2502 /* Add station record */
2503 status = peer_add_new_record(priv, req, &handle);
2504 break;
2505 case CSR_WIFI_ROUTER_CTRL_MODE_STA:
2506 case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI:
2507 default:
2508 /* No station record to maintain in these modes */
2509 break;
2510 }
2511
2512 CsrWifiRouterCtrlPeerAddCfmSend(msg->source, req->clientData, req->interfaceTag, req->peerMacAddress, handle, status);
2513 unifi_trace(priv, UDBG2, "leaving CsrWifiRouterCtrlPeerAddReqHandler \n");
2514}
2515
2516void CsrWifiRouterCtrlPeerUpdateReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
2517{
2518 CsrWifiRouterCtrlPeerUpdateReq* req = (CsrWifiRouterCtrlPeerUpdateReq*)msg;
2519 CsrResult status = CSR_RESULT_SUCCESS;
2520 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
2521
2522 unifi_trace(priv, UDBG2, "entering CsrWifiRouterCtrlPeerUpdateReqHandler \n");
2523 if (priv == NULL)
2524 {
2525 unifi_error(priv, "CsrWifiRouterCtrlPeerUpdateReqHandler: invalid smepriv\n");
2526 return;
2527 }
2528
2529 CsrWifiRouterCtrlPeerUpdateCfmSend(msg->source, req->clientData, req->interfaceTag, status);
2530 unifi_trace(priv, UDBG2, "leaving CsrWifiRouterCtrlPeerUpdateReqHandler \n");
2531}
2532
2533
2534 void CsrWifiRouterCtrlRawSdioDeinitialiseReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
2535{
2536 /* This will never be called as it is intercepted in the Userspace */
2537}
2538
2539void CsrWifiRouterCtrlRawSdioInitialiseReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
2540{
2541 /* This will never be called as it is intercepted in the Userspace */
2542}
2543
2544void
2545uf_send_ba_err_wq(struct work_struct *work)
2546{
2547 ba_session_rx_struct *ba_session = container_of(work, ba_session_rx_struct, send_ba_err_task);
2548 unifi_priv_t *priv;
2549
2550 if(!ba_session) {
2551 return;
2552 }
2553
2554 if(!ba_session->interfacePriv) {
2555 return;
2556 }
2557
2558 priv = ba_session->interfacePriv->privPtr;
2559
2560 if (ba_session->interfacePriv->InterfaceTag >= CSR_WIFI_NUM_INTERFACES) {
2561 unifi_error(priv, "%s: invalid interfaceTag\n", __FUNCTION__);
2562 return;
2563 }
2564
2565 unifi_warning(priv, "%s: Calling CsrWifiRouterCtrlBlockAckErrorIndSend(%d, %d, %d, %d, %x:%x:%x:%x:%x:%x, %d)\n",
2566 __FUNCTION__,
2567 priv->CSR_WIFI_SME_IFACEQUEUE,
2568 0,
2569 ba_session->interfacePriv->InterfaceTag,
2570 ba_session->tID,
2571 ba_session->macAddress.a[0],
2572 ba_session->macAddress.a[1],
2573 ba_session->macAddress.a[2],
2574 ba_session->macAddress.a[3],
2575 ba_session->macAddress.a[4],
2576 ba_session->macAddress.a[5],
2577 CSR_RESULT_SUCCESS
2578 );
2579 CsrWifiRouterCtrlBlockAckErrorIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,
2580 0,
2581 ba_session->interfacePriv->InterfaceTag,
2582 ba_session->tID,
2583 ba_session->macAddress,
2584 CSR_RESULT_SUCCESS);
2585}
2586
2587
2588static void ba_session_terminate_timer_func(unsigned long data)
2589{
2590 ba_session_rx_struct *ba_session = (ba_session_rx_struct*)data;
2591 struct unifi_priv *priv;
2592
2593 if(!ba_session) {
2594 return;
2595 }
2596
2597 if(!ba_session->interfacePriv) {
2598 return;
2599 }
2600
2601 priv = ba_session->interfacePriv->privPtr;
2602
2603 if (ba_session->interfacePriv->InterfaceTag >= CSR_WIFI_NUM_INTERFACES) {
2604 unifi_error(priv, "%s: invalid interfaceTag\n", __FUNCTION__);
2605 return;
2606 }
2607
2608 queue_work(priv->unifi_workqueue, &ba_session->send_ba_err_task);
2609}
2610
2611
2612u8 blockack_session_stop(unifi_priv_t *priv,
2613 u16 interfaceTag,
2614 CsrWifiRouterCtrlBlockAckRole role,
2615 u16 tID,
2616 CsrWifiMacAddress macAddress)
2617{
2618 netInterface_priv_t *interfacePriv;
2619 ba_session_rx_struct *ba_session_rx = NULL;
2620 ba_session_tx_struct *ba_session_tx = NULL;
2621 u8 ba_session_idx = 0;
2622 int i;
2623
2624 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
2625 unifi_error(priv, "%s: bad interfaceTag = %d\n", __FUNCTION__, interfaceTag);
2626 return FALSE;
2627 }
2628
2629 interfacePriv = priv->interfacePriv[interfaceTag];
2630
2631 if(!interfacePriv) {
2632 unifi_error(priv, "%s: bad interfacePriv\n", __FUNCTION__);
2633 return FALSE;
2634 }
2635
2636 if(tID > 15) {
2637 unifi_error(priv, "%s: bad tID = %d\n", __FUNCTION__, tID);
2638 return FALSE;
2639 }
2640
2641 if((role != CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR) &&
2642 (role != CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT)) {
2643 unifi_error(priv, "%s: bad role = %d\n", __FUNCTION__, role);
2644 return FALSE;
2645 }
2646
2647 unifi_warning(priv,
2648 "%s: stopping ba_session for peer = %pM role = %d tID = %d\n",
2649 __func__, macAddress.a, role, tID);
2650
2651 /* find out the appropriate ba session (/station /tid /role) for which stop is requested */
2652 if (role == CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT){
2653 for (ba_session_idx =0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX; ba_session_idx++){
2654
2655 ba_session_rx = interfacePriv->ba_session_rx[ba_session_idx];
2656
2657 if(ba_session_rx){
2658 if ((!memcmp(ba_session_rx->macAddress.a, macAddress.a, ETH_ALEN)) && (ba_session_rx->tID == tID)){
2659 break;
2660 }
2661 }
2662 }
2663
2664 if (!ba_session_rx || (ba_session_idx == MAX_SUPPORTED_BA_SESSIONS_RX)) {
2665 unifi_error(priv, "%s: bad ba_session for Rx [tID=%d]\n", __FUNCTION__, tID);
2666 return FALSE;
2667 }
2668
2669
2670 if(ba_session_rx->timeout) {
2671 del_timer_sync(&ba_session_rx->timer);
2672 }
2673 cancel_work_sync(&ba_session_rx->send_ba_err_task);
2674 for (i = 0; i < ba_session_rx->wind_size; i++) {
2675 if(ba_session_rx->buffer[i].active) {
2676 frame_desc_struct *frame_desc = &ba_session_rx->buffer[i];
2677 unifi_net_data_free(priv, &frame_desc->bulkdata.d[0]);
2678 }
2679 }
2680 kfree(ba_session_rx->buffer);
2681
2682 interfacePriv->ba_session_rx[ba_session_idx] = NULL;
2683 kfree(ba_session_rx);
2684 }else if (role == CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR){
2685 for (ba_session_idx =0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_TX; ba_session_idx++){
2686 ba_session_tx = interfacePriv->ba_session_tx[ba_session_idx];
2687 if(ba_session_tx){
2688 if ((!memcmp(ba_session_tx->macAddress.a, macAddress.a, ETH_ALEN)) && (ba_session_tx->tID == tID)){
2689 break;
2690 }
2691 }
2692 }
2693
2694 if (!ba_session_tx || (ba_session_idx == MAX_SUPPORTED_BA_SESSIONS_TX)) {
2695 unifi_error(priv, "%s: bad ba_session for Tx [tID=%d]\n", __FUNCTION__, tID);
2696 return FALSE;
2697 }
2698 interfacePriv->ba_session_tx[ba_session_idx] = NULL;
2699 kfree(ba_session_tx);
2700
2701 }
2702
2703 return TRUE;
2704}
2705
2706
2707void CsrWifiRouterCtrlBlockAckDisableReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
2708{
2709 CsrWifiRouterCtrlBlockAckDisableReq* req = (CsrWifiRouterCtrlBlockAckDisableReq*)msg;
2710 u8 r;
2711 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
2712
2713 unifi_trace(priv, UDBG6, "%s: in ok\n", __FUNCTION__);
2714
2715 down(&priv->ba_mutex);
2716 r = blockack_session_stop(priv,
2717 req->interfaceTag,
2718 req->role,
2719 req->trafficStreamID,
2720 req->macAddress);
2721 up(&priv->ba_mutex);
2722
2723 CsrWifiRouterCtrlBlockAckDisableCfmSend(msg->source,
2724 req->clientData,
2725 req->interfaceTag,
2726 r?CSR_RESULT_SUCCESS:CSR_RESULT_FAILURE);
2727
2728 unifi_trace(priv, UDBG6, "%s: out ok\n", __FUNCTION__);
2729}
2730
2731
2732u8 blockack_session_start(unifi_priv_t *priv,
2733 u16 interfaceTag,
2734 u16 tID,
2735 u16 timeout,
2736 CsrWifiRouterCtrlBlockAckRole role,
2737 u16 wind_size,
2738 u16 start_sn,
2739 CsrWifiMacAddress macAddress
2740 )
2741{
2742 netInterface_priv_t *interfacePriv;
2743 ba_session_rx_struct *ba_session_rx = NULL;
2744 ba_session_tx_struct *ba_session_tx = NULL;
2745 u8 ba_session_idx = 0;
2746
2747
2748 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
2749 unifi_error(priv, "%s: bad interfaceTag = %d\n", __FUNCTION__, interfaceTag);
2750 return FALSE;
2751 }
2752
2753 interfacePriv = priv->interfacePriv[interfaceTag];
2754
2755 if(!interfacePriv) {
2756 unifi_error(priv, "%s: bad interfacePriv\n", __FUNCTION__);
2757 return FALSE;
2758 }
2759
2760 if(tID > 15)
2761 {
2762 unifi_error(priv, "%s: bad tID=%d\n", __FUNCTION__, tID);
2763 return FALSE;
2764 }
2765
2766 if(wind_size > MAX_BA_WIND_SIZE) {
2767 unifi_error(priv, "%s: bad wind_size = %d\n", __FUNCTION__, wind_size);
2768 return FALSE;
2769 }
2770
2771 if(role != CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR &&
2772 role != CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT) {
2773 unifi_error(priv, "%s: bad role = %d\n", __FUNCTION__, role);
2774 return FALSE;
2775 }
2776
2777 unifi_warning(priv,
2778 "%s: ba session with peer= (%pM)\n", __func__,
2779 macAddress.a);
2780
2781 unifi_warning(priv, "%s: ba session for tID=%d timeout=%d role=%d wind_size=%d start_sn=%d\n", __FUNCTION__,
2782 tID,
2783 timeout,
2784 role,
2785 wind_size,
2786 start_sn);
2787
2788 /* Check if BA session exists for per station, per TID, per role or not.
2789 if BA session exists update parameters and if it does not exist
2790 create a new BA session */
2791 if (role == CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR){
2792 for (ba_session_idx =0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_TX; ba_session_idx++){
2793 ba_session_tx = interfacePriv->ba_session_tx[ba_session_idx];
2794 if (ba_session_tx) {
2795 if ((!memcmp(ba_session_tx->macAddress.a, macAddress.a, ETH_ALEN)) && (ba_session_tx->tID == tID)){
2796 unifi_warning(priv, "%s: ba_session for Tx already exists\n", __FUNCTION__);
2797 return TRUE;
2798 }
2799 }
2800 }
2801
2802 /* we have to create new ba_session_tx struct */
2803 ba_session_tx = NULL;
2804
2805 /* loop through until an empty BA session slot is there and save the session there */
2806 for (ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_TX ; ba_session_idx++){
2807 if (!(interfacePriv->ba_session_tx[ba_session_idx])){
2808 break;
2809 }
2810 }
2811 if (ba_session_idx == MAX_SUPPORTED_BA_SESSIONS_TX){
2812 unifi_error(priv, "%s: All ba_session used for Tx, NO free session available\n", __FUNCTION__);
2813 return FALSE;
2814 }
2815
2816 /* create and populate the new BA session structure */
2817 ba_session_tx = kzalloc(sizeof(ba_session_tx_struct), GFP_KERNEL);
2818 if (!ba_session_tx) {
2819 unifi_error(priv, "%s: kmalloc failed for ba_session_tx\n", __FUNCTION__);
2820 return FALSE;
2821 }
2822
2823 ba_session_tx->interfacePriv = interfacePriv;
2824 ba_session_tx->tID = tID;
2825 ba_session_tx->macAddress = macAddress;
2826
2827 interfacePriv->ba_session_tx[ba_session_idx] = ba_session_tx;
2828
2829 } else if (role == CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT){
2830
2831 for (ba_session_idx =0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX; ba_session_idx++){
2832 ba_session_rx = interfacePriv->ba_session_rx[ba_session_idx];
2833 if (ba_session_rx) {
2834 if ((!memcmp(ba_session_rx->macAddress.a, macAddress.a, ETH_ALEN)) && (ba_session_rx->tID == tID)){
2835 unifi_warning(priv, "%s: ba_session for Rx[tID = %d] already exists\n", __FUNCTION__, tID);
2836
2837 if(ba_session_rx->wind_size == wind_size &&
2838 ba_session_rx->timeout == timeout &&
2839 ba_session_rx->expected_sn == start_sn) {
2840 return TRUE;
2841 }
2842
2843 if(ba_session_rx->timeout) {
2844 del_timer_sync(&ba_session_rx->timer);
2845 ba_session_rx->timeout = 0;
2846 }
2847
2848 if(ba_session_rx->wind_size != wind_size) {
2849 blockack_session_stop(priv, interfaceTag, role, tID, macAddress);
2850 } else {
2851 if (timeout) {
2852 ba_session_rx->timeout = timeout;
2853 ba_session_rx->timer.function = ba_session_terminate_timer_func;
2854 ba_session_rx->timer.data = (unsigned long)ba_session_rx;
2855 init_timer(&ba_session_rx->timer);
2856 mod_timer(&ba_session_rx->timer, (jiffies + usecs_to_jiffies((ba_session_rx->timeout) * 1024)));
2857 }
2858 /*
2859 * The starting sequence number shall remain same if the BA
2860 * enable request is issued to update BA parameters only. If
2861 * it is not same, then we scroll our window to the new starting
2862 * sequence number. This could happen if the DELBA frame from
2863 * originator is lost and then we receive ADDBA frame with new SSN.
2864 */
2865 if(ba_session_rx->start_sn != start_sn) {
2866 scroll_ba_window(priv, interfacePriv, ba_session_rx, start_sn);
2867 }
2868 return TRUE;
2869 }
2870 }
2871 }
2872 }
2873
2874 /* we could have a valid BA session pointer here or un-initialized
2875 ba session pointer. but in any case we have to create a new session.
2876 so re-initialize the ba_session pointer */
2877 ba_session_rx = NULL;
2878
2879 /* loop through until an empty BA session slot is there and save the session there */
2880 for (ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX ; ba_session_idx++){
2881 if (!(interfacePriv->ba_session_rx[ba_session_idx])){
2882 break;
2883 }
2884 }
2885 if (ba_session_idx == MAX_SUPPORTED_BA_SESSIONS_RX){
2886 unifi_error(priv, "%s: All ba_session used for Rx, NO free session available\n", __FUNCTION__);
2887 return FALSE;
2888 }
2889
2890 /* It is observed that with some devices there is a race between
2891 * EAPOL exchanges and BA session establishment. This results in
2892 * some EAPOL authentication packets getting stuck in BA reorder
2893 * buffer and hence the conection cannot be established. To avoid
2894 * this we check here if the EAPOL authentication is complete and
2895 * if so then only allow the BA session to establish.
2896 *
2897 * It is verified that the peers normally re-establish
2898 * the BA session after the initial rejection.
2899 */
2900 if (CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN != uf_sme_port_state(priv, macAddress.a, UF_CONTROLLED_PORT_Q, interfacePriv->InterfaceTag))
2901 {
2902 unifi_warning(priv, "blockack_session_start: Controlled port not opened, Reject BA request\n");
2903 return FALSE;
2904 }
2905
2906 ba_session_rx = kzalloc(sizeof(ba_session_rx_struct), GFP_KERNEL);
2907 if (!ba_session_rx) {
2908 unifi_error(priv, "%s: kmalloc failed for ba_session_rx\n", __FUNCTION__);
2909 return FALSE;
2910 }
2911
2912 ba_session_rx->wind_size = wind_size;
2913 ba_session_rx->start_sn = ba_session_rx->expected_sn = start_sn;
2914 ba_session_rx->trigger_ba_after_ssn = FALSE;
2915
2916 ba_session_rx->buffer = kzalloc(ba_session_rx->wind_size*sizeof(frame_desc_struct), GFP_KERNEL);
2917 if (!ba_session_rx->buffer) {
2918 kfree(ba_session_rx);
2919 unifi_error(priv, "%s: kmalloc failed for buffer\n", __FUNCTION__);
2920 return FALSE;
2921 }
2922
2923 INIT_WORK(&ba_session_rx->send_ba_err_task, uf_send_ba_err_wq);
2924 if (timeout) {
2925 ba_session_rx->timeout = timeout;
2926 ba_session_rx->timer.function = ba_session_terminate_timer_func;
2927 ba_session_rx->timer.data = (unsigned long)ba_session_rx;
2928 init_timer(&ba_session_rx->timer);
2929 mod_timer(&ba_session_rx->timer, (jiffies + usecs_to_jiffies((ba_session_rx->timeout) * 1024)));
2930 }
2931
2932 ba_session_rx->interfacePriv = interfacePriv;
2933 ba_session_rx->tID = tID;
2934 ba_session_rx->macAddress = macAddress;
2935
2936 interfacePriv->ba_session_rx[ba_session_idx] = ba_session_rx;
2937 }
2938 return TRUE;
2939}
2940
2941void CsrWifiRouterCtrlBlockAckEnableReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
2942{
2943 CsrWifiRouterCtrlBlockAckEnableReq* req = (CsrWifiRouterCtrlBlockAckEnableReq*)msg;
2944 u8 r;
2945 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
2946
2947 unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__);
2948 down(&priv->ba_mutex);
2949 r = blockack_session_start(priv,
2950 req->interfaceTag,
2951 req->trafficStreamID,
2952 req->timeout,
2953 req->role,
2954 req->bufferSize,
2955 req->ssn,
2956 req->macAddress
2957 );
2958 up(&priv->ba_mutex);
2959
2960 CsrWifiRouterCtrlBlockAckEnableCfmSend(msg->source,
2961 req->clientData,
2962 req->interfaceTag,
2963 r?CSR_RESULT_SUCCESS:CSR_RESULT_FAILURE);
2964 unifi_trace(priv, UDBG6, "<<%s: r=%d\n", __FUNCTION__, r);
2965
2966}
2967
2968void CsrWifiRouterCtrlWapiMulticastFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
2969{
2970#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
2971
2972 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
2973 CsrWifiRouterCtrlWapiMulticastFilterReq* req = (CsrWifiRouterCtrlWapiMulticastFilterReq*)msg;
2974 netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag];
2975
2976 if (CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) {
2977
2978 unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__);
2979
2980 unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWapiMulticastFilterReq: req->status = %d\n", req->status);
2981
2982 /* status 1 - Filter on
2983 * status 0 - Filter off */
2984 priv->wapi_multicast_filter = req->status;
2985
2986 unifi_trace(priv, UDBG6, "<<%s\n", __FUNCTION__);
2987 } else {
2988
2989 unifi_warning(priv, "%s is NOT applicable for interface mode - %d\n", __FUNCTION__, interfacePriv->interfaceMode);
2990
2991 }
2992#elif defined(UNIFI_DEBUG)
2993 /*WAPI Disabled*/
2994 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
2995 unifi_error(priv, "CsrWifiRouterCtrlWapiMulticastFilterReqHandler: called when WAPI isn't enabled\n");
2996#endif
2997}
2998
2999void CsrWifiRouterCtrlWapiUnicastFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
3000{
3001#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
3002
3003 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
3004 CsrWifiRouterCtrlWapiUnicastFilterReq* req = (CsrWifiRouterCtrlWapiUnicastFilterReq*)msg;
3005 netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag];
3006
3007 if (CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) {
3008
3009 unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__);
3010
3011 unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWapiUnicastFilterReq: req->status= %d\n", req->status);
3012
3013 if ((priv->wapi_unicast_filter == 1) && (req->status == 0)) {
3014 /* When we have successfully re-associated and obtained a new unicast key with keyid = 0 */
3015 priv->wapi_unicast_queued_pkt_filter = 1;
3016 }
3017
3018 /* status 1 - Filter ON
3019 * status 0 - Filter OFF */
3020 priv->wapi_unicast_filter = req->status;
3021
3022 unifi_trace(priv, UDBG6, "<<%s\n", __FUNCTION__);
3023 } else {
3024
3025 unifi_warning(priv, "%s is NOT applicable for interface mode - %d\n", __FUNCTION__, interfacePriv->interfaceMode);
3026
3027 }
3028#elif defined(UNIFI_DEBUG)
3029 /*WAPI Disabled*/
3030 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
3031 unifi_error(priv, "CsrWifiRouterCtrlWapiUnicastFilterReqHandler: called when WAPI isn't enabled\n");
3032#endif
3033}
3034
3035void CsrWifiRouterCtrlWapiRxPktReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
3036{
3037#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
3038
3039 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
3040 CsrWifiRouterCtrlWapiRxPktReq* req = (CsrWifiRouterCtrlWapiRxPktReq*)msg;
3041 int client_id, receiver_id;
3042 bulk_data_param_t bulkdata;
3043 CsrResult res;
3044 ul_client_t *client;
3045 CSR_SIGNAL signal;
3046 CSR_MA_PACKET_INDICATION *pkt_ind;
3047 netInterface_priv_t *interfacePriv;
3048
3049 if (priv == NULL) {
3050 unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReq : invalid priv\n", __func__);
3051 return;
3052 }
3053
3054 if (priv->smepriv == NULL) {
3055 unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReq : invalid sme priv\n", __func__);
3056 return;
3057 }
3058
3059 interfacePriv = priv->interfacePriv[req->interfaceTag];
3060
3061 if (CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) {
3062
3063 unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__);
3064
3065
3066 if (req->dataLength == 0 || req->data == NULL) {
3067 unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReq: invalid request\n", __FUNCTION__);
3068 return;
3069 }
3070
3071 res = unifi_net_data_malloc(priv, &bulkdata.d[0], req->dataLength);
3072 if (res != CSR_RESULT_SUCCESS) {
3073 unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReq: Could not allocate net data\n", __FUNCTION__);
3074 return;
3075 }
3076
3077 /* This function is expected to be called only when the MIC has been verified by SME to be correct
3078 * So reset the reception status to rx_success */
3079 res = read_unpack_signal(req->signal, &signal);
3080 if (res) {
3081 unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReqHandler: Received unknown or corrupted signal.\n");
3082 return;
3083 }
3084 pkt_ind = (CSR_MA_PACKET_INDICATION*) (&((&signal)->u).MaPacketIndication);
3085 if (pkt_ind->ReceptionStatus != CSR_MICHAEL_MIC_ERROR) {
3086 unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReqHandler: Unknown signal with reception status = %d\n", pkt_ind->ReceptionStatus);
3087 return;
3088 } else {
3089 unifi_trace(priv, UDBG4, "CsrWifiRouterCtrlWapiRxPktReqHandler: MIC verified , RX_SUCCESS \n", __FUNCTION__);
3090 pkt_ind->ReceptionStatus = CSR_RX_SUCCESS;
3091 write_pack(&signal, req->signal, &(req->signalLength));
3092 }
3093
3094 memcpy((void*)bulkdata.d[0].os_data_ptr, req->data, req->dataLength);
3095
3096 receiver_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((req->signal) + sizeof(s16)) & 0xFFF0;
3097 client_id = (receiver_id & 0x0F00) >> UDI_SENDER_ID_SHIFT;
3098
3099 client = &priv->ul_clients[client_id];
3100
3101 if (client && client->event_hook) {
3102 unifi_trace(priv, UDBG3,
3103 "CsrWifiRouterCtrlWapiRxPktReq: "
3104 "Sending signal to client %d, (s:0x%X, r:0x%X) - Signal 0x%X \n",
3105 client->client_id, client->sender_id, receiver_id,
3106 CSR_GET_UINT16_FROM_LITTLE_ENDIAN(req->signal));
3107
3108 client->event_hook(client, req->signal, req->signalLength, &bulkdata, UDI_TO_HOST);
3109 } else {
3110 unifi_trace(priv, UDBG4, "No client to give the packet to\n");
3111 unifi_net_data_free(priv, &bulkdata.d[0]);
3112 }
3113
3114 unifi_trace(priv, UDBG6, "<<%s\n", __FUNCTION__);
3115 } else {
3116 unifi_warning(priv, "%s is NOT applicable for interface mode - %d\n", __FUNCTION__, interfacePriv->interfaceMode);
3117 }
3118#elif defined(UNIFI_DEBUG)
3119 /*WAPI Disabled*/
3120 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
3121 unifi_error(priv, "CsrWifiRouterCtrlWapiRxPktReqHandler: called when WAPI isn't enabled\n");
3122#endif
3123}
3124
3125void CsrWifiRouterCtrlWapiUnicastTxPktReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
3126{
3127#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION))
3128
3129 unifi_priv_t *priv = (unifi_priv_t*) drvpriv;
3130 CsrWifiRouterCtrlWapiUnicastTxPktReq *req = (CsrWifiRouterCtrlWapiUnicastTxPktReq*) msg;
3131 netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag];
3132 bulk_data_param_t bulkdata;
3133 u8 macHeaderLengthInBytes = MAC_HEADER_SIZE;
3134 /*KeyID, Reserved, PN, MIC*/
3135 u8 appendedCryptoFields = 1 + 1 + 16 + 16;
3136 CsrResult result;
3137 /* Retrieve the MA PACKET REQ fields from the Signal retained from send_ma_pkt_request() */
3138 CSR_MA_PACKET_REQUEST *storedSignalMAPktReq = &interfacePriv->wapi_unicast_ma_pkt_sig.u.MaPacketRequest;
3139
3140 if (CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) {
3141
3142 unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__);
3143
3144 if (priv == NULL) {
3145 unifi_error(priv, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler : invalid priv\n", __FUNCTION__);
3146 return;
3147 }
3148 if (priv->smepriv == NULL) {
3149 unifi_error(priv, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler : invalid sme priv\n", __FUNCTION__);
3150 return;
3151 }
3152 if (req->data == NULL) {
3153 unifi_error(priv, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler: invalid request\n", __FUNCTION__);
3154 return;
3155 } else {
3156 /* If it is QoS data (type = data subtype = QoS), frame header contains QoS control field */
3157 if ((req->data[0] & 0x88) == 0x88) {
3158 macHeaderLengthInBytes = macHeaderLengthInBytes + QOS_CONTROL_HEADER_SIZE;
3159 }
3160 }
3161 if ( !(req->dataLength>(macHeaderLengthInBytes+appendedCryptoFields)) ) {
3162 unifi_error(priv, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler: invalid dataLength\n", __FUNCTION__);
3163 return;
3164 }
3165
3166 /* Encrypted DATA Packet contained in (req->data)
3167 * -------------------------------------------------------------------
3168 * |MAC Header| KeyId | Reserved | PN | xxDataxx | xxMICxxx |
3169 * -------------------------------------------------------------------
3170 * (<-----Encrypted----->)
3171 * -------------------------------------------------------------------
3172 * |24/26(QoS)| 1 | 1 | 16 | x | 16 |
3173 * -------------------------------------------------------------------
3174 */
3175 result = unifi_net_data_malloc(priv, &bulkdata.d[0], req->dataLength);
3176 if (result != CSR_RESULT_SUCCESS) {
3177 unifi_error(priv, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler: Could not allocate net data\n", __FUNCTION__);
3178 return;
3179 }
3180 memcpy((void*)bulkdata.d[0].os_data_ptr, req->data, req->dataLength);
3181 bulkdata.d[0].data_length = req->dataLength;
3182 bulkdata.d[1].os_data_ptr = NULL;
3183 bulkdata.d[1].data_length = 0;
3184
3185 /* Send UniFi msg */
3186 /* Here hostTag is been sent as 0xffffffff, its been appended properly while framing MA-Packet request in pdu_processing.c file */
3187 result = uf_process_ma_packet_req(priv,
3188 storedSignalMAPktReq->Ra.x,
3189 storedSignalMAPktReq->HostTag,/* Ask for a new HostTag */
3190 req->interfaceTag,
3191 storedSignalMAPktReq->TransmissionControl,
3192 storedSignalMAPktReq->TransmitRate,
3193 storedSignalMAPktReq->Priority, /* Retained value */
3194 interfacePriv->wapi_unicast_ma_pkt_sig.SignalPrimitiveHeader.SenderProcessId, /*FIXME AP: VALIDATE ???*/
3195 &bulkdata);
3196
3197 if (result == NETDEV_TX_OK) {
3198 (priv->netdev[req->interfaceTag])->trans_start = jiffies;
3199 /* Should really count tx stats in the UNITDATA.status signal but
3200 * that doesn't have the length.
3201 */
3202 interfacePriv->stats.tx_packets++;
3203
3204 /* count only the packet payload */
3205 interfacePriv->stats.tx_bytes += req->dataLength - macHeaderLengthInBytes - appendedCryptoFields;
3206 unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler: (Packet Sent), sent count = %x\n", interfacePriv->stats.tx_packets);
3207 } else {
3208 /* Failed to send: fh queue was full, and the skb was discarded*/
3209 unifi_trace(priv, UDBG1, "(HIP validation failure) Result = %d\n", result);
3210 unifi_net_data_free(priv, &bulkdata.d[0]);
3211
3212 interfacePriv->stats.tx_dropped++;
3213 unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler: (Packet Drop), dropped count = %x\n", interfacePriv->stats.tx_dropped);
3214 }
3215
3216 unifi_trace(priv, UDBG6, "<<%s\n", __FUNCTION__);
3217
3218 } else {
3219
3220 unifi_warning(priv, "%s is NOT applicable for interface mode - %d\n", __FUNCTION__, interfacePriv->interfaceMode);
3221
3222 }
3223#elif defined(UNIFI_DEBUG)
3224 /*WAPI Disabled*/
3225 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
3226 unifi_error(priv, "CsrWifiRouterCtrlWapiUnicastTxPktReqHandler: called when WAPI SW ENCRYPTION isn't enabled\n");
3227#endif
3228}
3229
3230void CsrWifiRouterCtrlWapiFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg)
3231{
3232#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
3233
3234#ifdef CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND
3235 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
3236 CsrWifiRouterCtrlWapiFilterReq* req = (CsrWifiRouterCtrlWapiFilterReq*)msg;
3237 netInterface_priv_t *interfacePriv = priv->interfacePriv[req->interfaceTag];
3238
3239 if (CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) {
3240
3241 unifi_trace(priv, UDBG6, ">>%s\n", __FUNCTION__);
3242
3243 unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlWapiFilterReq: req->isWapiConnected [0/1] = %d \n", req->isWapiConnected);
3244
3245 priv->isWapiConnection = req->isWapiConnected;
3246
3247 unifi_trace(priv, UDBG6, "<<%s\n", __FUNCTION__);
3248 } else {
3249
3250 unifi_warning(priv, "%s is NOT applicable for interface mode - %d\n", __FUNCTION__, interfacePriv->interfaceMode);
3251
3252 }
3253#endif
3254
3255#elif defined(UNIFI_DEBUG)
3256 /*WAPI Disabled*/
3257 unifi_priv_t *priv = (unifi_priv_t*)drvpriv;
3258 unifi_error(priv, "CsrWifiRouterCtrlWapiFilterReq: called when WAPI isn't enabled\n");
3259#endif
3260}
diff --git a/drivers/staging/csr/sme_userspace.c b/drivers/staging/csr/sme_userspace.c
deleted file mode 100644
index b919b001ef7c..000000000000
--- a/drivers/staging/csr/sme_userspace.c
+++ /dev/null
@@ -1,315 +0,0 @@
1/*
2 *****************************************************************************
3 *
4 * FILE : sme_userspace.c
5 *
6 * PURPOSE : Support functions for userspace SME helper application.
7 *
8 *
9 * Copyright (C) 2008-2011 by Cambridge Silicon Radio Ltd.
10 *
11 * Refer to LICENSE.txt included with this source code for details on
12 * the license terms.
13 *
14 *****************************************************************************
15 */
16
17#include "unifi_priv.h"
18
19/*
20 * Fix Me..... These need to be the correct values...
21 * Dynamic from the user space.
22 */
23CsrSchedQid CSR_WIFI_ROUTER_IFACEQUEUE = 0xFFFF;
24CsrSchedQid CSR_WIFI_SME_IFACEQUEUE = 0xFFFF;
25#ifdef CSR_SUPPORT_WEXT_AP
26CsrSchedQid CSR_WIFI_NME_IFACEQUEUE = 0xFFFF;
27#endif
28int
29uf_sme_init(unifi_priv_t *priv)
30{
31 int i, j;
32
33 CsrWifiRouterTransportInit(priv);
34
35 priv->smepriv = priv;
36
37 init_waitqueue_head(&priv->sme_request_wq);
38
39 priv->filter_tclas_ies = NULL;
40 memset(&priv->packet_filters, 0, sizeof(uf_cfg_bcast_packet_filter_t));
41
42#ifdef CSR_SUPPORT_WEXT
43 priv->ignore_bssid_join = FALSE;
44 priv->mib_data.length = 0;
45
46 uf_sme_wext_set_defaults(priv);
47#endif /* CSR_SUPPORT_WEXT*/
48
49 priv->sta_ip_address = 0xFFFFFFFF;
50
51 priv->wifi_on_state = wifi_on_unspecified;
52
53 sema_init(&priv->sme_sem, 1);
54 memset(&priv->sme_reply, 0, sizeof(sme_reply_t));
55
56 priv->ta_ind_work.in_use = 0;
57 priv->ta_sample_ind_work.in_use = 0;
58
59 priv->CSR_WIFI_SME_IFACEQUEUE = 0xFFFF;
60
61 for (i = 0; i < MAX_MA_UNIDATA_IND_FILTERS; i++) {
62 priv->sme_unidata_ind_filters[i].in_use = 0;
63 }
64
65 /* Create a work queue item for Traffic Analysis indications to SME */
66 INIT_WORK(&priv->ta_ind_work.task, uf_ta_ind_wq);
67 INIT_WORK(&priv->ta_sample_ind_work.task, uf_ta_sample_ind_wq);
68#ifdef CSR_SUPPORT_WEXT
69 INIT_WORK(&priv->sme_config_task, uf_sme_config_wq);
70#endif
71
72 for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) {
73 netInterface_priv_t *interfacePriv = priv->interfacePriv[i];
74 interfacePriv->m4_sent = FALSE;
75 interfacePriv->m4_bulk_data.net_buf_length = 0;
76 interfacePriv->m4_bulk_data.data_length = 0;
77 interfacePriv->m4_bulk_data.os_data_ptr = interfacePriv->m4_bulk_data.os_net_buf_ptr = NULL;
78
79 memset(&interfacePriv->controlled_data_port, 0, sizeof(unifi_port_config_t));
80 interfacePriv->controlled_data_port.entries_in_use = 1;
81 interfacePriv->controlled_data_port.port_cfg[0].in_use = TRUE;
82 interfacePriv->controlled_data_port.port_cfg[0].port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD;
83 interfacePriv->controlled_data_port.overide_action = UF_DATA_PORT_OVERIDE;
84
85 memset(&interfacePriv->uncontrolled_data_port, 0, sizeof(unifi_port_config_t));
86 interfacePriv->uncontrolled_data_port.entries_in_use = 1;
87 interfacePriv->uncontrolled_data_port.port_cfg[0].in_use = TRUE;
88 interfacePriv->uncontrolled_data_port.port_cfg[0].port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD;
89 interfacePriv->uncontrolled_data_port.overide_action = UF_DATA_PORT_OVERIDE;
90
91 /* Mark the remainder of the port config table as unallocated */
92 for(j = 1; j < UNIFI_MAX_CONNECTIONS; j++) {
93 interfacePriv->controlled_data_port.port_cfg[j].in_use = FALSE;
94 interfacePriv->controlled_data_port.port_cfg[j].port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD;
95
96 interfacePriv->uncontrolled_data_port.port_cfg[j].in_use = FALSE;
97 interfacePriv->uncontrolled_data_port.port_cfg[j].port_action = CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD;
98 }
99
100 /* intializing the lists */
101 INIT_LIST_HEAD(&interfacePriv->genericMgtFrames);
102 INIT_LIST_HEAD(&interfacePriv->genericMulticastOrBroadCastMgtFrames);
103 INIT_LIST_HEAD(&interfacePriv->genericMulticastOrBroadCastFrames);
104
105 for(j = 0; j < UNIFI_MAX_CONNECTIONS; j++) {
106 interfacePriv->staInfo[j] = NULL;
107 }
108
109 interfacePriv->num_stations_joined = 0;
110 interfacePriv->sta_activity_check_enabled = FALSE;
111 }
112
113
114 return 0;
115} /* uf_sme_init() */
116
117
118void
119uf_sme_deinit(unifi_priv_t *priv)
120{
121 int i, j;
122 u8 ba_session_idx;
123 ba_session_rx_struct *ba_session_rx = NULL;
124 ba_session_tx_struct *ba_session_tx = NULL;
125 CsrWifiRouterCtrlStaInfo_t *staInfo = NULL;
126 netInterface_priv_t *interfacePriv = NULL;
127
128 /* Free any TCLASs previously allocated */
129 if (priv->packet_filters.tclas_ies_length) {
130 priv->packet_filters.tclas_ies_length = 0;
131 kfree(priv->filter_tclas_ies);
132 priv->filter_tclas_ies = NULL;
133 }
134
135 for (i = 0; i < MAX_MA_UNIDATA_IND_FILTERS; i++) {
136 priv->sme_unidata_ind_filters[i].in_use = 0;
137 }
138
139 /* Remove all the Peer database, before going down */
140 for (i = 0; i < CSR_WIFI_NUM_INTERFACES; i++) {
141 down(&priv->ba_mutex);
142 for(ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_RX; ba_session_idx++){
143 ba_session_rx = priv->interfacePriv[i]->ba_session_rx[ba_session_idx];
144 if(ba_session_rx) {
145 blockack_session_stop(priv,
146 i,
147 CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_RECIPIENT,
148 ba_session_rx->tID,
149 ba_session_rx->macAddress);
150 }
151 }
152 for(ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_TX; ba_session_idx++){
153 ba_session_tx = priv->interfacePriv[i]->ba_session_tx[ba_session_idx];
154 if(ba_session_tx) {
155 blockack_session_stop(priv,
156 i,
157 CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ORIGINATOR,
158 ba_session_tx->tID,
159 ba_session_tx->macAddress);
160 }
161 }
162
163 up(&priv->ba_mutex);
164 interfacePriv = priv->interfacePriv[i];
165 if(interfacePriv){
166 for(j = 0; j < UNIFI_MAX_CONNECTIONS; j++) {
167 if ((staInfo=interfacePriv->staInfo[j]) != NULL) {
168 /* Clear the STA activity parameters before freeing station Record */
169 unifi_trace(priv, UDBG1, "uf_sme_deinit: Canceling work queue for STA with AID: %d\n", staInfo->aid);
170 cancel_work_sync(&staInfo->send_disconnected_ind_task);
171 staInfo->nullDataHostTag = INVALID_HOST_TAG;
172 }
173 }
174 if (interfacePriv->sta_activity_check_enabled){
175 interfacePriv->sta_activity_check_enabled = FALSE;
176 del_timer_sync(&interfacePriv->sta_activity_check_timer);
177 }
178 }
179 CsrWifiRouterCtrlInterfaceReset(priv, i);
180 priv->interfacePriv[i]->interfaceMode = CSR_WIFI_ROUTER_CTRL_MODE_NONE;
181 }
182
183
184} /* uf_sme_deinit() */
185
186
187
188
189
190/*
191 * ---------------------------------------------------------------------------
192 * unifi_ta_indicate_protocol
193 *
194 * Report that a packet of a particular type has been seen
195 *
196 * Arguments:
197 * drv_priv The device context pointer passed to ta_init.
198 * protocol The protocol type enum value.
199 * direction Whether the packet was a tx or rx.
200 * src_addr The source MAC address from the data packet.
201 *
202 * Returns:
203 * None.
204 *
205 * Notes:
206 * We defer the actual sending to a background workqueue,
207 * see uf_ta_ind_wq().
208 * ---------------------------------------------------------------------------
209 */
210void
211unifi_ta_indicate_protocol(void *ospriv,
212 CsrWifiRouterCtrlTrafficPacketType packet_type,
213 CsrWifiRouterCtrlProtocolDirection direction,
214 const CsrWifiMacAddress *src_addr)
215{
216 unifi_priv_t *priv = (unifi_priv_t*)ospriv;
217
218 if (priv->ta_ind_work.in_use) {
219 unifi_warning(priv,
220 "unifi_ta_indicate_protocol: workqueue item still in use, not sending\n");
221 return;
222 }
223
224 if (CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_RX == direction)
225 {
226 u16 interfaceTag = 0;
227 CsrWifiRouterCtrlTrafficProtocolIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0,
228 interfaceTag,
229 packet_type,
230 direction,
231 *src_addr);
232 }
233 else
234 {
235 priv->ta_ind_work.packet_type = packet_type;
236 priv->ta_ind_work.direction = direction;
237 priv->ta_ind_work.src_addr = *src_addr;
238
239 queue_work(priv->unifi_workqueue, &priv->ta_ind_work.task);
240 }
241
242} /* unifi_ta_indicate_protocol() */
243
244
245/*
246 * ---------------------------------------------------------------------------
247 * unifi_ta_indicate_sampling
248 *
249 * Send the TA sampling information to the SME.
250 *
251 * Arguments:
252 * drv_priv The device context pointer passed to ta_init.
253 * stats The TA sampling data to send.
254 *
255 * Returns:
256 * None.
257 * ---------------------------------------------------------------------------
258 */
259void
260unifi_ta_indicate_sampling(void *ospriv, CsrWifiRouterCtrlTrafficStats *stats)
261{
262 unifi_priv_t *priv = (unifi_priv_t*)ospriv;
263
264 if (!priv) {
265 return;
266 }
267
268 if (priv->ta_sample_ind_work.in_use) {
269 unifi_warning(priv,
270 "unifi_ta_indicate_sampling: workqueue item still in use, not sending\n");
271 return;
272 }
273
274 priv->ta_sample_ind_work.stats = *stats;
275
276 queue_work(priv->unifi_workqueue, &priv->ta_sample_ind_work.task);
277
278} /* unifi_ta_indicate_sampling() */
279
280
281/*
282 * ---------------------------------------------------------------------------
283 * unifi_ta_indicate_l4stats
284 *
285 * Send the TA TCP/UDP throughput information to the driver.
286 *
287 * Arguments:
288 * drv_priv The device context pointer passed to ta_init.
289 * rxTcpThroughput TCP RX throughput in KiloBytes
290 * txTcpThroughput TCP TX throughput in KiloBytes
291 * rxUdpThroughput UDP RX throughput in KiloBytes
292 * txUdpThroughput UDP TX throughput in KiloBytes
293 *
294 * Returns:
295 * None.
296 * ---------------------------------------------------------------------------
297 */
298void
299unifi_ta_indicate_l4stats(void *ospriv,
300 u32 rxTcpThroughput,
301 u32 txTcpThroughput,
302 u32 rxUdpThroughput,
303 u32 txUdpThroughput)
304{
305 unifi_priv_t *priv = (unifi_priv_t*)ospriv;
306
307 if (!priv) {
308 return;
309 }
310 /* Save the info. The actual action will be taken in unifi_ta_indicate_sampling() */
311 priv->rxTcpThroughput = rxTcpThroughput;
312 priv->txTcpThroughput = txTcpThroughput;
313 priv->rxUdpThroughput = rxUdpThroughput;
314 priv->txUdpThroughput = txUdpThroughput;
315} /* unifi_ta_indicate_l4stats() */
diff --git a/drivers/staging/csr/sme_userspace.h b/drivers/staging/csr/sme_userspace.h
deleted file mode 100644
index ebe371c732b2..000000000000
--- a/drivers/staging/csr/sme_userspace.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * ***************************************************************************
3 * FILE: sme_userspace.h
4 *
5 * PURPOSE: SME related definitions.
6 *
7 * Copyright (C) 2007-2008 by Cambridge Silicon Radio Ltd.
8 *
9 * Refer to LICENSE.txt included with this source code for details on
10 * the license terms.
11 *
12 * ***************************************************************************
13 */
14#ifndef __LINUX_SME_USERSPACE_H__
15#define __LINUX_SME_USERSPACE_H__ 1
16
17#include <linux/kernel.h>
18
19int uf_sme_init(unifi_priv_t *priv);
20void uf_sme_deinit(unifi_priv_t *priv);
21int uf_sme_queue_message(unifi_priv_t *priv, u8 *buffer, int length);
22
23
24#include "csr_wifi_router_lib.h"
25#include "csr_wifi_router_sef.h"
26#include "csr_wifi_router_ctrl_lib.h"
27#include "csr_wifi_router_ctrl_sef.h"
28#include "csr_wifi_sme_task.h"
29#ifdef CSR_SUPPORT_WEXT_AP
30#include "csr_wifi_nme_ap_lib.h"
31#endif
32#include "csr_wifi_sme_lib.h"
33
34void CsrWifiRouterTransportInit(unifi_priv_t *priv);
35void CsrWifiRouterTransportRecv(unifi_priv_t *priv, u8 *buffer, size_t bufferLength);
36void CsrWifiRouterTransportDeInit(unifi_priv_t *priv);
37
38#endif /* __LINUX_SME_USERSPACE_H__ */
diff --git a/drivers/staging/csr/sme_wext.c b/drivers/staging/csr/sme_wext.c
deleted file mode 100644
index 84f11cb53596..000000000000
--- a/drivers/staging/csr/sme_wext.c
+++ /dev/null
@@ -1,3327 +0,0 @@
1/*
2 * ---------------------------------------------------------------------------
3 * FILE: sme_wext.c
4 *
5 * PURPOSE:
6 * Handlers for ioctls from iwconfig.
7 * These provide the control plane operations.
8 *
9 * Copyright (C) 2007-2009 by Cambridge Silicon Radio Ltd.
10 *
11 * Refer to LICENSE.txt included with this source code for details on
12 * the license terms.
13 *
14 * ---------------------------------------------------------------------------
15 */
16#include <linux/types.h>
17#include <linux/etherdevice.h>
18#include <linux/if_arp.h>
19#include <asm/uaccess.h>
20#include <linux/ctype.h>
21#include "unifi_priv.h"
22#include <linux/rtnetlink.h>
23
24#define CHECK_INITED(_priv) \
25 do { \
26 if (_priv->init_progress != UNIFI_INIT_COMPLETED) { \
27 unifi_trace(_priv, UDBG2, "%s unifi not ready, failing wext call\n", __FUNCTION__); \
28 return -ENODEV; \
29 } \
30 } while (0)
31
32/* Workaround for the wpa_supplicant hanging issue - disabled on Android */
33#ifndef ANDROID_BUILD
34#define CSR_WIFI_WEXT_HANG_WORKAROUND
35#endif
36
37#ifdef CSR_WIFI_WEXT_HANG_WORKAROUND
38# define UF_RTNL_LOCK() rtnl_lock()
39# define UF_RTNL_UNLOCK() rtnl_unlock()
40#else
41# define UF_RTNL_LOCK()
42# define UF_RTNL_UNLOCK()
43#endif
44
45
46/*
47 * ---------------------------------------------------------------------------
48 * Helper functions
49 * ---------------------------------------------------------------------------
50 */
51
52/*
53 * ---------------------------------------------------------------------------
54 * wext_freq_to_channel
55 * channel_to_mhz
56 *
57 * These functions convert between channel number and frequency.
58 *
59 * Arguments:
60 * ch Channel number, as defined in 802.11 specs
61 * m, e Mantissa and exponent as provided by wireless extension.
62 *
63 * Returns:
64 * channel or frequency (in MHz) value
65 * ---------------------------------------------------------------------------
66 */
67static int
68wext_freq_to_channel(int m, int e)
69{
70 int mhz;
71
72 mhz = m;
73 while (e < 6) {
74 mhz /= 10;
75 e++;
76 }
77 while (e > 6) {
78 mhz *= 10;
79 e--;
80 }
81
82 if (mhz >= 5000) {
83 return ((mhz - 5000) / 5);
84 }
85
86 if (mhz == 2482) {
87 return 14;
88 }
89
90 if (mhz >= 2407) {
91 return ((mhz - 2407) / 5);
92 }
93
94 return 0;
95} /* wext_freq_to_channel() */
96
97static int
98channel_to_mhz(int ch, int dot11a)
99{
100
101 if (ch == 0) return 0;
102 if (ch > 200) return 0;
103
104 /* 5G */
105 if (dot11a) {
106 return (5000 + (5 * ch));
107 }
108
109 /* 2.4G */
110 if (ch == 14) {
111 return 2484;
112 }
113
114 if ((ch < 14) && (ch > 0)) {
115 return (2407 + (5 * ch));
116 }
117
118 return 0;
119}
120#ifdef CSR_SUPPORT_WEXT_AP
121void uf_sme_wext_ap_set_defaults(unifi_priv_t *priv)
122{
123 memcpy(priv->ap_config.ssid.ssid, "defaultssid", sizeof("defaultssid"));
124
125 priv->ap_config.ssid.length = 8;
126 priv->ap_config.channel = 6;
127 priv->ap_config.if_index = 1;
128 priv->ap_config.credentials.authType = 0;
129 priv->ap_config.max_connections=8;
130
131 priv->group_sec_config.apGroupkeyTimeout = 0;
132 priv->group_sec_config.apStrictGtkRekey = 0;
133 priv->group_sec_config.apGmkTimeout = 0;
134 priv->group_sec_config.apResponseTimeout = 100; /* Default*/
135 priv->group_sec_config.apRetransLimit = 3; /* Default*/
136 /* Set default params even if they may not be used*/
137 /* Until Here*/
138
139 priv->ap_mac_config.preamble = CSR_WIFI_SME_USE_LONG_PREAMBLE;
140 priv->ap_mac_config.shortSlotTimeEnabled = FALSE;
141 priv->ap_mac_config.ctsProtectionType=CSR_WIFI_SME_CTS_PROTECTION_AUTOMATIC;
142
143 priv->ap_mac_config.wmmEnabled = TRUE;
144 priv->ap_mac_config.wmmApParams[0].cwMin=4;
145 priv->ap_mac_config.wmmApParams[0].cwMax=10;
146 priv->ap_mac_config.wmmApParams[0].aifs=3;
147 priv->ap_mac_config.wmmApParams[0].txopLimit=0;
148 priv->ap_mac_config.wmmApParams[0].admissionControlMandatory=FALSE;
149 priv->ap_mac_config.wmmApParams[1].cwMin=4;
150 priv->ap_mac_config.wmmApParams[1].cwMax=10;
151 priv->ap_mac_config.wmmApParams[1].aifs=7;
152 priv->ap_mac_config.wmmApParams[1].txopLimit=0;
153 priv->ap_mac_config.wmmApParams[1].admissionControlMandatory=FALSE;
154 priv->ap_mac_config.wmmApParams[2].cwMin=3;
155 priv->ap_mac_config.wmmApParams[2].cwMax=4;
156 priv->ap_mac_config.wmmApParams[2].aifs=1;
157 priv->ap_mac_config.wmmApParams[2].txopLimit=94;
158 priv->ap_mac_config.wmmApParams[2].admissionControlMandatory=FALSE;
159 priv->ap_mac_config.wmmApParams[3].cwMin=2;
160 priv->ap_mac_config.wmmApParams[3].cwMax=3;
161 priv->ap_mac_config.wmmApParams[3].aifs=1;
162 priv->ap_mac_config.wmmApParams[3].txopLimit=47;
163 priv->ap_mac_config.wmmApParams[3].admissionControlMandatory=FALSE;
164
165 priv->ap_mac_config.wmmApBcParams[0].cwMin=4;
166 priv->ap_mac_config.wmmApBcParams[0].cwMax=10;
167 priv->ap_mac_config.wmmApBcParams[0].aifs=3;
168 priv->ap_mac_config.wmmApBcParams[0].txopLimit=0;
169 priv->ap_mac_config.wmmApBcParams[0].admissionControlMandatory=FALSE;
170 priv->ap_mac_config.wmmApBcParams[1].cwMin=4;
171 priv->ap_mac_config.wmmApBcParams[1].cwMax=10;
172 priv->ap_mac_config.wmmApBcParams[1].aifs=7;
173 priv->ap_mac_config.wmmApBcParams[1].txopLimit=0;
174 priv->ap_mac_config.wmmApBcParams[1].admissionControlMandatory=FALSE;
175 priv->ap_mac_config.wmmApBcParams[2].cwMin=3;
176 priv->ap_mac_config.wmmApBcParams[2].cwMax=4;
177 priv->ap_mac_config.wmmApBcParams[2].aifs=2;
178 priv->ap_mac_config.wmmApBcParams[2].txopLimit=94;
179 priv->ap_mac_config.wmmApBcParams[2].admissionControlMandatory=FALSE;
180 priv->ap_mac_config.wmmApBcParams[3].cwMin=2;
181 priv->ap_mac_config.wmmApBcParams[3].cwMax=3;
182 priv->ap_mac_config.wmmApBcParams[3].aifs=2;
183 priv->ap_mac_config.wmmApBcParams[3].txopLimit=47;
184 priv->ap_mac_config.wmmApBcParams[3].admissionControlMandatory=FALSE;
185
186 priv->ap_mac_config.accessType=CSR_WIFI_AP_ACCESS_TYPE_NONE;
187 priv->ap_mac_config.macAddressListCount=0;
188 priv->ap_mac_config.macAddressList=NULL;
189
190 priv->ap_mac_config.apHtParams.rxStbc=1;
191 priv->ap_mac_config.apHtParams.rifsModeAllowed=TRUE;
192 priv->ap_mac_config.apHtParams.greenfieldSupported=FALSE;
193 priv->ap_mac_config.apHtParams.shortGi20MHz=TRUE;
194 priv->ap_mac_config.apHtParams.htProtection=0;
195 priv->ap_mac_config.apHtParams.dualCtsProtection=FALSE;
196
197 priv->ap_mac_config.phySupportedBitmap =
198 (CSR_WIFI_SME_AP_PHY_SUPPORT_B|CSR_WIFI_SME_AP_PHY_SUPPORT_G|CSR_WIFI_SME_AP_PHY_SUPPORT_N);
199 priv->ap_mac_config.beaconInterval= 100;
200 priv->ap_mac_config.dtimPeriod=3;
201 priv->ap_mac_config.maxListenInterval=0x00ff;/* Set it to a large value
202 to enable different types of
203 devices to join us */
204 priv->ap_mac_config.supportedRatesCount =
205 uf_configure_supported_rates(priv->ap_mac_config.supportedRates, priv->ap_mac_config.phySupportedBitmap);
206}
207#endif
208/*
209 * ---------------------------------------------------------------------------
210 * uf_sme_wext_set_defaults
211 *
212 * Set up power-on defaults for driver config.
213 *
214 * Note: The SME Management API *cannot* be used in this function.
215 *
216 * Arguments:
217 * priv Pointer to device private context struct
218 *
219 * Returns:
220 * None.
221 * ---------------------------------------------------------------------------
222 */
223void
224uf_sme_wext_set_defaults(unifi_priv_t *priv)
225{
226 memset(&priv->connection_config, 0, sizeof(CsrWifiSmeConnectionConfig));
227
228 priv->connection_config.bssType = CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE;
229 priv->connection_config.authModeMask = CSR_WIFI_SME_AUTH_MODE_80211_OPEN;
230 priv->connection_config.encryptionModeMask = CSR_WIFI_SME_ENCRYPTION_CIPHER_NONE;
231 priv->connection_config.privacyMode = CSR_WIFI_SME_80211_PRIVACY_MODE_DISABLED;
232 priv->connection_config.wmmQosInfo = 0xFF;
233 priv->connection_config.ifIndex = CSR_WIFI_SME_RADIO_IF_BOTH;
234 priv->connection_config.adhocJoinOnly = FALSE;
235 priv->connection_config.adhocChannel = 6;
236
237 priv->wep_tx_key_index = 0;
238
239 priv->wext_wireless_stats.qual.qual = 0;
240 priv->wext_wireless_stats.qual.level = 0;
241 priv->wext_wireless_stats.qual.noise = 0;
242 priv->wext_wireless_stats.qual.updated = 0x70;
243#ifdef CSR_SUPPORT_WEXT_AP
244 /* Initialize the default configuration for AP */
245 uf_sme_wext_ap_set_defaults(priv);
246#endif
247
248
249} /* uf_sme_wext_set_defaults() */
250
251
252/*
253 * ---------------------------------------------------------------------------
254 * WEXT methods
255 * ---------------------------------------------------------------------------
256 */
257
258/*
259 * ---------------------------------------------------------------------------
260 * unifi_giwname - handler for SIOCGIWNAME
261 * unifi_siwfreq - handler for SIOCSIWFREQ
262 * unifi_giwfreq - handler for SIOCGIWFREQ
263 * unifi_siwmode - handler for SIOCSIWMODE
264 * unifi_giwmode - handler for SIOCGIWMODE
265 * unifi_giwrange - handler for SIOCGIWRANGE
266 * unifi_siwap - handler for SIOCSIWAP
267 * unifi_giwap - handler for SIOCGIWAP
268 * unifi_siwscan - handler for SIOCSIWSCAN
269 * unifi_giwscan - handler for SIOCGIWSCAN
270 * unifi_siwessid - handler for SIOCSIWESSID
271 * unifi_giwessid - handler for SIOCGIWESSID
272 * unifi_siwencode - handler for SIOCSIWENCODE
273 * unifi_giwencode - handler for SIOCGIWENCODE
274 *
275 * Handler functions for IW extensions.
276 * These are registered via the unifi_iw_handler_def struct below
277 * and called by the generic IW driver support code.
278 * See include/net/iw_handler.h.
279 *
280 * Arguments:
281 * None.
282 *
283 * Returns:
284 * None.
285 * ---------------------------------------------------------------------------
286 */
287static int
288iwprivsdefs(struct net_device *dev, struct iw_request_info *info,
289 union iwreq_data *wrqu, char *extra)
290{
291 int r;
292 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
293 unifi_priv_t *priv = interfacePriv->privPtr;
294 CsrWifiSmeMibConfig mibConfig;
295 CsrWifiSmePowerConfig powerConfig;
296
297 unifi_trace(priv, UDBG1, "iwprivs80211defaults: reload defaults\n");
298
299 uf_sme_wext_set_defaults(priv);
300
301 /* Get, modify and set the MIB data */
302 r = sme_mgt_mib_config_get(priv, &mibConfig);
303 if (r) {
304 unifi_error(priv, "iwprivs80211defaults: Get CsrWifiSmeMibConfigValue failed.\n");
305 return r;
306 }
307 mibConfig.dot11RtsThreshold = 2347;
308 mibConfig.dot11FragmentationThreshold = 2346;
309 r = sme_mgt_mib_config_set(priv, &mibConfig);
310 if (r) {
311 unifi_error(priv, "iwprivs80211defaults: Set CsrWifiSmeMibConfigValue failed.\n");
312 return r;
313 }
314
315 powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW;
316 powerConfig.listenIntervalTu = 100;
317 powerConfig.rxDtims = 1;
318
319 r = sme_mgt_power_config_set(priv, &powerConfig);
320 if (r) {
321 unifi_error(priv, "iwprivs80211defaults: Set unifi_PowerConfigValue failed.\n");
322 return r;
323 }
324
325 return 0;
326} /* iwprivsdefs() */
327
328static int
329iwprivs80211ps(struct net_device *dev, struct iw_request_info *info,
330 union iwreq_data *wrqu, char *extra)
331{
332 int r = 0;
333 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
334 unifi_priv_t *priv = interfacePriv->privPtr;
335
336 int ps_mode = (int)(*extra);
337 CsrWifiSmePowerConfig powerConfig;
338
339 unifi_trace(priv, UDBG1, "iwprivs80211ps: power save mode = %d\n", ps_mode);
340
341 r = sme_mgt_power_config_get(priv, &powerConfig);
342 if (r) {
343 unifi_error(priv, "iwprivs80211ps: Get unifi_PowerConfigValue failed.\n");
344 return r;
345 }
346
347 switch (ps_mode) {
348 case CSR_PMM_ACTIVE_MODE:
349 powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW;
350 break;
351 case CSR_PMM_POWER_SAVE:
352 powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_HIGH;
353 break;
354 case CSR_PMM_FAST_POWER_SAVE:
355 powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_MED;
356 break;
357 default:
358 powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_AUTO;
359 break;
360 }
361
362 r = sme_mgt_power_config_set(priv, &powerConfig);
363 if (r) {
364 unifi_error(priv, "iwprivs80211ps: Set unifi_PowerConfigValue failed.\n");
365 }
366
367 return r;
368}
369
370static int
371iwprivg80211ps(struct net_device *dev, struct iw_request_info *info,
372 union iwreq_data *wrqu, char *extra)
373{
374 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
375 unifi_priv_t *priv = interfacePriv->privPtr;
376
377 CsrWifiSmePowerConfig powerConfig;
378 int r;
379
380 r = sme_mgt_power_config_get(priv, &powerConfig);
381 if (r) {
382 unifi_error(priv, "iwprivg80211ps: Get 802.11 power mode failed.\n");
383 return r;
384 }
385
386 switch (powerConfig.powerSaveLevel) {
387 case CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW:
388 snprintf(extra, IWPRIV_POWER_SAVE_MAX_STRING,
389 "Power save mode: %d (Active)",
390 powerConfig.powerSaveLevel);
391 break;
392 case CSR_WIFI_SME_POWER_SAVE_LEVEL_MED:
393 snprintf(extra, IWPRIV_POWER_SAVE_MAX_STRING,
394 "Power save mode: %d (Fast)",
395 powerConfig.powerSaveLevel);
396 break;
397 case CSR_WIFI_SME_POWER_SAVE_LEVEL_HIGH:
398 snprintf(extra, IWPRIV_POWER_SAVE_MAX_STRING,
399 "Power save mode: %d (Full)",
400 powerConfig.powerSaveLevel);
401 break;
402 case CSR_WIFI_SME_POWER_SAVE_LEVEL_AUTO:
403 snprintf(extra, IWPRIV_POWER_SAVE_MAX_STRING,
404 "Power save mode: %d (Auto)",
405 powerConfig.powerSaveLevel);
406 break;
407 default:
408 snprintf(extra, IWPRIV_POWER_SAVE_MAX_STRING,
409 "Power save mode: %d (Unknown)",
410 powerConfig.powerSaveLevel);
411 break;
412 }
413
414 wrqu->data.length = strlen(extra) + 1;
415
416 return 0;
417}
418
419static int
420iwprivssmedebug(struct net_device *dev, struct iw_request_info *info,
421 union iwreq_data *wrqu, char *extra)
422{
423 /* No longer supported on the API */
424#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE)
425 unifi_debug_buf_dump();
426#endif
427
428 return 0;
429}
430
431#ifdef CSR_SUPPORT_WEXT_AP
432#define PARAM_TYPE_INT 0
433#define PARAM_TYPE_STRING 1
434#define CSR_WIFI_MAX_SSID_LEN 32
435#define CSR_WIFI_MAX_SEC_LEN 16
436#define CSR_WIFI_MAX_KEY_LEN 65
437
438static int hex_look_up(char x)
439{
440 if(x>='0' && x<='9')
441 return (x-48);
442 if(x>= 'a' && x <= 'f')
443 return (x-87);
444 return -1;
445}
446
447static int power (int a, int b)
448{
449 int i;
450 int num =1;
451 for(i=0;i<b;i++)
452 num *=a;
453 return num;
454}
455
456static int decode_parameter_from_string(unifi_priv_t* priv, char **str_ptr,
457 const char *token, int param_type,
458 void *dst, int param_max_len)
459{
460 u8 int_str[7] = "0";
461 u32 param_str_len;
462 u8 *param_str_begin, *param_str_end;
463 u8 *orig_str = *str_ptr;
464
465 if (!strncmp(*str_ptr, token, strlen(token))) {
466 strsep(str_ptr, "=,");
467 param_str_begin = *str_ptr;
468 strsep(str_ptr, "=,");
469 if (*str_ptr == NULL) {
470 param_str_len = strlen(param_str_begin);
471 } else {
472 param_str_end = *str_ptr-1;
473 param_str_len = param_str_end - param_str_begin;
474 }
475 unifi_trace(priv, UDBG2, "'token:%s', len:%d, ", token, param_str_len);
476 if (param_str_len > param_max_len) {
477 unifi_notice(priv, "extracted param len:%d is > MAX:%d\n", param_str_len, param_max_len);
478 param_str_len = param_max_len;
479 }
480 switch (param_type) {
481 case PARAM_TYPE_INT:
482 {
483 u32 *pdst_int = dst, num =0;
484 int i, j=0;
485 if (param_str_len > sizeof(int_str)) {
486 param_str_len = sizeof(int_str);
487 }
488 memcpy(int_str, param_str_begin, param_str_len);
489 for(i = param_str_len; i>0;i--) {
490 if(int_str[i-1] >= '0' && int_str[i-1] <='9') {
491 num += ((int_str[i-1]-'0')*power(10, j));
492 j++;
493 } else {
494 unifi_error(priv, "decode_parameter_from_string:not a number %c\n", (int_str[i-1]));
495 return -1;
496 }
497 }
498 *pdst_int = num;
499 unifi_trace(priv, UDBG2, "decode_parameter_from_string:decoded int = %d\n", *pdst_int);
500 }
501 break;
502 default:
503 memcpy(dst, param_str_begin, param_str_len);
504 *((char *)dst + param_str_len) = 0;
505 unifi_trace(priv, UDBG2, "decode_parameter_from_string:decoded string = %s\n", (char *)dst);
506 break;
507 }
508 } else {
509 unifi_error(priv, "decode_parameter_from_string: Token:%s not found in %s \n", token, orig_str);
510 return -1;
511 }
512 return 0;
513}
514static int store_ap_advanced_config_from_string(unifi_priv_t *priv, char *param_str)
515{
516 char * str_ptr=param_str;
517 int ret = 0, tmp_var;
518 char phy_mode[6];
519 CsrWifiSmeApMacConfig * ap_mac_config = &priv->ap_mac_config;
520
521 /* Check for BI */
522 ret = decode_parameter_from_string(priv, &str_ptr, "BI=",
523 PARAM_TYPE_INT, &tmp_var, 5);
524 if(ret) {
525 unifi_error(priv, "store_ap_advanced_config_from_string: BI not found\n");
526 return -1;
527 }
528 ap_mac_config->beaconInterval = tmp_var;
529 ret = decode_parameter_from_string(priv, &str_ptr, "DTIM_PER=",
530 PARAM_TYPE_INT, &tmp_var, 5);
531 if(ret) {
532 unifi_error(priv, "store_ap_advanced_config_from_string: DTIM_PER not found\n");
533 return -1;
534 }
535 ap_mac_config->dtimPeriod = tmp_var;
536 ret = decode_parameter_from_string(priv, &str_ptr, "WMM=",
537 PARAM_TYPE_INT, &tmp_var, 5);
538 if(ret) {
539 unifi_error(priv, "store_ap_advanced_config_from_string: WMM not found\n");
540 return -1;
541 }
542 ap_mac_config->wmmEnabled = tmp_var;
543 ret = decode_parameter_from_string(priv, &str_ptr, "PHY=",
544 PARAM_TYPE_STRING, phy_mode, 5);
545 if(ret) {
546 unifi_error(priv, "store_ap_advanced_config_from_string: PHY not found\n");
547 } else {
548 if(strstr(phy_mode, "b")){
549 ap_mac_config->phySupportedBitmap = CSR_WIFI_SME_AP_PHY_SUPPORT_B;
550 }
551 if(strstr(phy_mode, "g")) {
552 ap_mac_config->phySupportedBitmap |= CSR_WIFI_SME_AP_PHY_SUPPORT_G;
553 }
554 if(strstr(phy_mode, "n")) {
555 ap_mac_config->phySupportedBitmap |= CSR_WIFI_SME_AP_PHY_SUPPORT_N;
556 }
557 ap_mac_config->supportedRatesCount =
558 uf_configure_supported_rates(ap_mac_config->supportedRates, ap_mac_config->phySupportedBitmap);
559 }
560 return ret;
561}
562
563static int store_ap_config_from_string( unifi_priv_t * priv, char *param_str)
564
565{
566 char *str_ptr = param_str;
567 char sub_cmd[16];
568 char sec[CSR_WIFI_MAX_SEC_LEN];
569 char key[CSR_WIFI_MAX_KEY_LEN];
570 int ret = 0, tmp_var;
571 CsrWifiSmeApConfig_t *ap_config = &priv->ap_config;
572 CsrWifiSmeApMacConfig * ap_mac_config = &priv->ap_mac_config;
573 memset(sub_cmd, 0, sizeof(sub_cmd));
574 if(!strstr(param_str, "END")) {
575 unifi_error(priv, "store_ap_config_from_string:Invalid config string:%s\n", param_str);
576 return -1;
577 }
578 if (decode_parameter_from_string(priv, &str_ptr, "ASCII_CMD=",
579 PARAM_TYPE_STRING, sub_cmd, 6) != 0) {
580 return -1;
581 }
582 if (strncmp(sub_cmd, "AP_CFG", 6)) {
583
584 if(!strncmp(sub_cmd , "ADVCFG", 6)) {
585 return store_ap_advanced_config_from_string(priv, str_ptr);
586 }
587 unifi_error(priv, "store_ap_config_from_string: sub_cmd:%s != 'AP_CFG or ADVCFG'!\n", sub_cmd);
588 return -1;
589 }
590 memset(ap_config, 0, sizeof(CsrWifiSmeApConfig_t));
591 ret = decode_parameter_from_string(priv, &str_ptr, "SSID=",
592 PARAM_TYPE_STRING, ap_config->ssid.ssid,
593 CSR_WIFI_MAX_SSID_LEN);
594 if(ret) {
595 unifi_error(priv, "store_ap_config_from_string: SSID not found\n");
596 return -1;
597 }
598 ap_config->ssid.length = strlen(ap_config->ssid.ssid);
599
600 ret = decode_parameter_from_string(priv, &str_ptr, "SEC=",
601 PARAM_TYPE_STRING, sec, CSR_WIFI_MAX_SEC_LEN);
602 if(ret) {
603 unifi_error(priv, "store_ap_config_from_string: SEC not found\n");
604 return -1;
605 }
606 ret = decode_parameter_from_string(priv, &str_ptr, "KEY=",
607 PARAM_TYPE_STRING, key, CSR_WIFI_MAX_KEY_LEN);
608 if(!strcasecmp(sec, "open")) {
609 unifi_trace(priv, UDBG2, "store_ap_config_from_string: security open");
610 ap_config->credentials.authType = CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM;
611 if(ret) {
612 unifi_notice(priv, "store_ap_config_from_string: KEY not found:fine with Open\n");
613 }
614 }
615 else if(!strcasecmp(sec, "wpa2-psk")) {
616 int i, j=0;
617 CsrWifiNmeApAuthPers *pers =
618 ((CsrWifiNmeApAuthPers *)&(ap_config->credentials.nmeAuthType.authTypePersonal));
619 u8 *psk = pers->authPers_credentials.psk.psk;
620
621 unifi_trace(priv, UDBG2, "store_ap_config_from_string: security WPA2");
622 if(ret) {
623 unifi_error(priv, "store_ap_config_from_string: KEY not found for WPA2\n");
624 return -1;
625 }
626 ap_config->credentials.authType = CSR_WIFI_SME_AP_AUTH_TYPE_PERSONAL;
627 pers->authSupport = CSR_WIFI_SME_RSN_AUTH_WPA2PSK;
628 pers->rsnCapabilities =0;
629 pers->wapiCapabilities =0;
630 pers->pskOrPassphrase=CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK;
631 pers->authPers_credentials.psk.encryptionMode =
632 (CSR_WIFI_NME_ENCRYPTION_CIPHER_PAIRWISE_CCMP |CSR_WIFI_NME_ENCRYPTION_CIPHER_GROUP_CCMP) ;
633 for(i=0;i<32;i++){
634 psk[i] = (16*hex_look_up(key[j]))+hex_look_up(key[j+1]);
635 j+=2;
636 }
637
638 } else {
639 unifi_notice(priv, "store_ap_config_from_string: Unknown security: Assuming Open");
640 ap_config->credentials.authType = CSR_WIFI_SME_AP_AUTH_TYPE_OPEN_SYSTEM;
641 return -1;
642 }
643 /* Get the decoded value in a temp int variable to ensure that other fields within the struct
644 which are of type other than int are not over written */
645 ret = decode_parameter_from_string(priv, &str_ptr, "CHANNEL=", PARAM_TYPE_INT, &tmp_var, 5);
646 if(ret)
647 return -1;
648 ap_config->channel = tmp_var;
649 ret = decode_parameter_from_string(priv, &str_ptr, "PREAMBLE=", PARAM_TYPE_INT, &tmp_var, 5);
650 if(ret)
651 return -1;
652 ap_mac_config->preamble = tmp_var;
653 ret = decode_parameter_from_string(priv, &str_ptr, "MAX_SCB=", PARAM_TYPE_INT, &tmp_var, 5);
654 ap_config->max_connections = tmp_var;
655 return ret;
656}
657
658static int
659iwprivsapstart(struct net_device *dev, struct iw_request_info *info,
660 union iwreq_data *wrqu, char *extra)
661{
662 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
663 unifi_priv_t *priv = interfacePriv->privPtr;
664 int r;
665
666 unifi_trace(priv, UDBG1, "iwprivsapstart\n" );
667 r = sme_ap_start(priv, interfacePriv->InterfaceTag, &priv->ap_config);
668 if(r) {
669 unifi_error(priv, "iwprivsapstart AP START failed : %d\n", -r);
670 }
671 return r;
672}
673
674static int
675iwprivsapconfig(struct net_device *dev, struct iw_request_info *info,
676 union iwreq_data *wrqu, char *extra)
677{
678 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
679 unifi_priv_t *priv = interfacePriv->privPtr;
680 char *cfg_str = NULL;
681 int r;
682
683 unifi_trace(priv, UDBG1, "iwprivsapconfig\n" );
684 if (wrqu->data.length != 0) {
685 char *str;
686 if (!(cfg_str = kmalloc(wrqu->data.length+1, GFP_KERNEL)))
687 {
688 return -ENOMEM;
689 }
690 if (copy_from_user(cfg_str, wrqu->data.pointer, wrqu->data.length)) {
691 kfree(cfg_str);
692 return -EFAULT;
693 }
694 cfg_str[wrqu->data.length] = 0;
695 unifi_trace(priv, UDBG2, "length:%d\n", wrqu->data.length);
696 unifi_trace(priv, UDBG2, "AP configuration string:%s\n", cfg_str);
697 str = cfg_str;
698 if ((r = store_ap_config_from_string(priv, str))) {
699 unifi_error(priv, "iwprivsapconfig:Failed to decode the string %d\n", r);
700 kfree(cfg_str);
701 return -EIO;
702
703 }
704 } else {
705 unifi_error(priv, "iwprivsapconfig argument length = 0 \n");
706 return -EIO;
707 }
708 r = sme_ap_config(priv, &priv->ap_mac_config, &priv->group_sec_config);
709 if(r) {
710 unifi_error(priv, "iwprivsapstop AP Config failed : %d\n", -r);
711 } else if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
712 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
713 unifi_trace(priv, UDBG1, "iwprivsapconfig: Starting the AP");
714 r = sme_ap_start(priv, interfacePriv->InterfaceTag, &priv->ap_config);
715 if(r) {
716 unifi_error(priv, "iwprivsapstart AP START failed : %d\n", -r);
717 }
718 }
719 kfree(cfg_str);
720 return r;
721}
722
723static int
724iwprivsapstop(struct net_device *dev, struct iw_request_info *info,
725 union iwreq_data *wrqu, char *extra)
726{
727 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
728 unifi_priv_t *priv = interfacePriv->privPtr;
729 int r;
730 u16 interface_tag = interfacePriv->InterfaceTag;
731
732 unifi_trace(priv, UDBG1, "iwprivsapstop\n" );
733 r = sme_ap_stop(priv, interface_tag);
734 if(r) {
735 unifi_error(priv, "iwprivsapstop AP STOP failed : %d\n", -r);
736 }
737 return r;
738}
739
740#ifdef ANDROID_BUILD
741static int
742iwprivsapfwreload(struct net_device *dev, struct iw_request_info *info,
743 union iwreq_data *wrqu, char *extra)
744{
745 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
746 unifi_priv_t *priv = interfacePriv->privPtr;
747
748 unifi_trace(priv, UDBG1, "iwprivsapfwreload\n" );
749 return 0;
750}
751
752static int
753iwprivsstackstart(struct net_device *dev, struct iw_request_info *info,
754 union iwreq_data *wrqu, char *extra)
755{
756 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
757 unifi_priv_t *priv = interfacePriv->privPtr;
758 unifi_trace(priv, UDBG1, "iwprivsstackstart\n" );
759 return 0;
760}
761
762static int
763iwprivsstackstop(struct net_device *dev, struct iw_request_info *info,
764 union iwreq_data *wrqu, char *extra)
765{
766 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
767 unifi_priv_t *priv = interfacePriv->privPtr;
768 int r = 0;
769 u16 interface_tag = interfacePriv->InterfaceTag;
770
771 unifi_trace(priv, UDBG1, "iwprivsstackstop\n" );
772
773 switch(interfacePriv->interfaceMode) {
774 case CSR_WIFI_ROUTER_CTRL_MODE_STA:
775 case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI:
776 case CSR_WIFI_ROUTER_CTRL_MODE_IBSS:
777 r = sme_mgt_disconnect(priv);
778 break;
779 case CSR_WIFI_ROUTER_CTRL_MODE_AP:
780 case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO:
781 r = sme_ap_stop(priv, interface_tag);
782 break;
783 default :
784 break;
785 }
786
787 if(r) {
788 unifi_error(priv, "iwprivsstackstop Stack stop failed : %d\n", -r);
789 }
790 return 0;
791}
792#endif /* ANDROID_BUILD */
793#endif /* CSR_SUPPORT_WEXT_AP */
794
795#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
796static int
797iwprivsconfwapi(struct net_device *dev, struct iw_request_info *info,
798 union iwreq_data *wrqu, char *extra)
799{
800 u8 enable;
801 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
802 unifi_priv_t *priv = interfacePriv->privPtr;
803
804 unifi_trace(priv, UDBG1, "iwprivsconfwapi\n" );
805
806 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
807 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
808 unifi_error(priv, "iwprivsconfwapi: not permitted in Mode %d\n",
809 interfacePriv->interfaceMode);
810 return -EPERM;
811 }
812
813 enable = *(u8*)(extra);
814
815 if (enable) {
816 priv->connection_config.authModeMask = CSR_WIFI_SME_AUTH_MODE_80211_OPEN;
817 priv->connection_config.authModeMask |= (CSR_WIFI_SME_AUTH_MODE_WAPI_WAIPSK | CSR_WIFI_SME_AUTH_MODE_WAPI_WAI);
818 priv->connection_config.encryptionModeMask |=
819 CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_SMS4 | CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_SMS4;
820 } else {
821 priv->connection_config.authModeMask &= ~(CSR_WIFI_SME_AUTH_MODE_WAPI_WAIPSK | CSR_WIFI_SME_AUTH_MODE_WAPI_WAI);
822 priv->connection_config.encryptionModeMask &=
823 ~(CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_SMS4 | CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_SMS4);
824 }
825
826 return 0;
827}
828
829static int
830iwprivswpikey(struct net_device *dev, struct iw_request_info *info,
831 union iwreq_data *wrqu, char *extra)
832{
833 int r = 0, i;
834 CsrWifiSmeKey key;
835 unifiio_wapi_key_t inKey;
836 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
837 unifi_priv_t *priv = interfacePriv->privPtr;
838
839 unifi_trace(priv, UDBG1, "iwprivswpikey\n" );
840
841 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
842 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
843 unifi_error(priv, "iwprivswpikey: not permitted in Mode %d\n",
844 interfacePriv->interfaceMode);
845 return -EPERM;
846 }
847
848 inKey = *(unifiio_wapi_key_t*)(extra);
849
850 if (inKey.unicastKey) {
851 key.keyType = CSR_WIFI_SME_KEY_TYPE_PAIRWISE;
852 } else {
853 key.keyType = CSR_WIFI_SME_KEY_TYPE_GROUP;
854 }
855
856 key.keyIndex = inKey.keyIndex;
857
858 /* memcpy(key.keyRsc, inKey.keyRsc, 16); */
859 for (i = 0; i < 16; i+= 2)
860 {
861 key.keyRsc[i/2] = inKey.keyRsc[i+1] << 8 | inKey.keyRsc[i];
862 }
863
864 memcpy(key.address.a, inKey.address, 6);
865 key.keyLength = 32;
866 memcpy(key.key, inKey.key, 32);
867 key.authenticator = 0;
868 key.wepTxKey = 0;
869
870 unifi_trace(priv, UDBG1, "keyType = %d, keyIndex = %d, wepTxKey = %d, keyRsc = %x:%x, auth = %d, address = %x:%x, "
871 "keylength = %d, key = %x:%x\n", key.keyType, key.keyIndex, key.wepTxKey,
872 key.keyRsc[0], key.keyRsc[7], key.authenticator,
873 key.address.a[0], key.address.a[5], key.keyLength, key.key[0],
874 key.key[15]);
875
876 r = sme_mgt_key(priv, &key, CSR_WIFI_SME_LIST_ACTION_ADD);
877 if (r) {
878 unifi_error(priv, "SETKEYS request was rejected with result %d\n", r);
879 return convert_sme_error(r);
880 }
881
882 return r;
883}
884#endif
885
886
887static int
888unifi_giwname(struct net_device *dev, struct iw_request_info *info,
889 union iwreq_data *wrqu, char *extra)
890{
891 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
892 unifi_priv_t *priv = interfacePriv->privPtr;
893 char *name = wrqu->name;
894 unifi_trace(priv, UDBG2, "unifi_giwname\n");
895
896 if (priv->if_index == CSR_INDEX_5G) {
897 strcpy(name, "IEEE 802.11-a");
898 } else {
899 strcpy(name, "IEEE 802.11-bgn");
900 }
901 return 0;
902} /* unifi_giwname() */
903
904
905static int
906unifi_siwfreq(struct net_device *dev, struct iw_request_info *info,
907 union iwreq_data *wrqu, char *extra)
908{
909 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
910 unifi_priv_t *priv = interfacePriv->privPtr;
911 struct iw_freq *freq = (struct iw_freq *)wrqu;
912
913 unifi_trace(priv, UDBG2, "unifi_siwfreq\n");
914
915 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
916 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
917 unifi_error(priv, "unifi_siwfreq: not permitted in Mode %d\n",
918 interfacePriv->interfaceMode);
919 return -EPERM;
920 }
921
922
923 /*
924 * Channel is stored in the connection configuration,
925 * and set later when ask for a connection.
926 */
927 if ((freq->e == 0) && (freq->m <= 1000)) {
928 priv->connection_config.adhocChannel = freq->m;
929 } else {
930 priv->connection_config.adhocChannel = wext_freq_to_channel(freq->m, freq->e);
931 }
932
933 return 0;
934} /* unifi_siwfreq() */
935
936
937static int
938unifi_giwfreq(struct net_device *dev, struct iw_request_info *info,
939 union iwreq_data *wrqu, char *extra)
940{
941 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
942 unifi_priv_t *priv = interfacePriv->privPtr;
943 struct iw_freq *freq = (struct iw_freq *)wrqu;
944 int err = 0;
945 CsrWifiSmeConnectionInfo connectionInfo;
946
947 unifi_trace(priv, UDBG2, "unifi_giwfreq\n");
948 CHECK_INITED(priv);
949
950 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
951 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
952 unifi_error(priv, "unifi_giwfreq: not permitted in Mode %d\n",
953 interfacePriv->interfaceMode);
954 return -EPERM;
955 }
956
957
958 UF_RTNL_UNLOCK();
959 err = sme_mgt_connection_info_get(priv, &connectionInfo);
960 UF_RTNL_LOCK();
961
962 freq->m = channel_to_mhz(connectionInfo.channelNumber,
963 (connectionInfo.networkType80211 == CSR_WIFI_SME_RADIO_IF_GHZ_5_0));
964 freq->e = 6;
965
966 return convert_sme_error(err);
967} /* unifi_giwfreq() */
968
969
970static int
971unifi_siwmode(struct net_device *dev, struct iw_request_info *info,
972 union iwreq_data *wrqu, char *extra)
973{
974 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
975 unifi_priv_t *priv = interfacePriv->privPtr;
976
977 unifi_trace(priv, UDBG2, "unifi_siwmode\n");
978
979 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
980 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
981 unifi_error(priv, "unifi_siwmode: not permitted in Mode %d\n",
982 interfacePriv->interfaceMode);
983 return -EPERM;
984 }
985
986
987 switch(wrqu->mode) {
988 case IW_MODE_ADHOC:
989 priv->connection_config.bssType = CSR_WIFI_SME_BSS_TYPE_ADHOC;
990 break;
991 case IW_MODE_INFRA:
992 priv->connection_config.bssType = CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE;
993 break;
994 case IW_MODE_AUTO:
995 priv->connection_config.bssType = CSR_WIFI_SME_BSS_TYPE_ANY_BSS;
996 break;
997 default:
998 unifi_notice(priv, "Unknown IW MODE value.\n");
999 }
1000
1001 /* Clear the SSID and BSSID configuration */
1002 priv->connection_config.ssid.length = 0;
1003 memset(priv->connection_config.bssid.a, 0xFF, ETH_ALEN);
1004
1005 return 0;
1006} /* unifi_siwmode() */
1007
1008
1009
1010static int
1011unifi_giwmode(struct net_device *dev, struct iw_request_info *info,
1012 union iwreq_data *wrqu, char *extra)
1013{
1014 int r = 0;
1015 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
1016 unifi_priv_t *priv = interfacePriv->privPtr;
1017 CsrWifiSmeConnectionConfig connectionConfig;
1018
1019 unifi_trace(priv, UDBG2, "unifi_giwmode\n");
1020 CHECK_INITED(priv);
1021
1022 unifi_trace(priv, UDBG2, "unifi_giwmode: Exisitng mode = 0x%x\n",
1023 interfacePriv->interfaceMode);
1024 switch(interfacePriv->interfaceMode) {
1025 case CSR_WIFI_ROUTER_CTRL_MODE_STA:
1026 case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI:
1027 wrqu->mode = IW_MODE_INFRA;
1028 break;
1029 case CSR_WIFI_ROUTER_CTRL_MODE_AP:
1030 case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO:
1031 wrqu->mode = IW_MODE_MASTER;
1032 break;
1033 case CSR_WIFI_ROUTER_CTRL_MODE_IBSS:
1034 wrqu->mode = IW_MODE_ADHOC;
1035 break;
1036 case CSR_WIFI_ROUTER_CTRL_MODE_P2P:
1037 case CSR_WIFI_ROUTER_CTRL_MODE_NONE:
1038 UF_RTNL_UNLOCK();
1039 r = sme_mgt_connection_config_get(priv, &connectionConfig);
1040 UF_RTNL_LOCK();
1041 if (r == 0) {
1042 switch(connectionConfig.bssType) {
1043 case CSR_WIFI_SME_BSS_TYPE_ADHOC:
1044 wrqu->mode = IW_MODE_ADHOC;
1045 break;
1046 case CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE:
1047 wrqu->mode = IW_MODE_INFRA;
1048 break;
1049 default:
1050 wrqu->mode = IW_MODE_AUTO;
1051 unifi_notice(priv, "Unknown IW MODE value.\n");
1052 }
1053 }
1054 break;
1055 default:
1056 wrqu->mode = IW_MODE_AUTO;
1057 unifi_notice(priv, "Unknown IW MODE value.\n");
1058
1059 }
1060 unifi_trace(priv, UDBG4, "unifi_giwmode: mode = 0x%x\n", wrqu->mode);
1061 return r;
1062} /* unifi_giwmode() */
1063
1064
1065
1066static int
1067unifi_giwrange(struct net_device *dev, struct iw_request_info *info,
1068 union iwreq_data *wrqu, char *extra)
1069{
1070 struct iw_point *dwrq = &wrqu->data;
1071 struct iw_range *range = (struct iw_range *) extra;
1072 int i;
1073
1074 unifi_trace(NULL, UDBG2, "unifi_giwrange\n");
1075
1076 dwrq->length = sizeof(struct iw_range);
1077 memset(range, 0, sizeof(*range));
1078 range->min_nwid = 0x0000;
1079 range->max_nwid = 0x0000;
1080
1081 /*
1082 * Don't report the frequency/channel table, then the channel
1083 * number returned elsewhere will be printed as a channel number.
1084 */
1085
1086 /* Ranges of values reported in quality structs */
1087 range->max_qual.qual = 40; /* Max expected qual value */
1088 range->max_qual.level = -120; /* Noise floor in dBm */
1089 range->max_qual.noise = -120; /* Noise floor in dBm */
1090
1091
1092 /* space for IW_MAX_BITRATES (8 up to WE15, 32 later) */
1093 i = 0;
1094#if WIRELESS_EXT > 15
1095 range->bitrate[i++] = 2 * 500000;
1096 range->bitrate[i++] = 4 * 500000;
1097 range->bitrate[i++] = 11 * 500000;
1098 range->bitrate[i++] = 22 * 500000;
1099 range->bitrate[i++] = 12 * 500000;
1100 range->bitrate[i++] = 18 * 500000;
1101 range->bitrate[i++] = 24 * 500000;
1102 range->bitrate[i++] = 36 * 500000;
1103 range->bitrate[i++] = 48 * 500000;
1104 range->bitrate[i++] = 72 * 500000;
1105 range->bitrate[i++] = 96 * 500000;
1106 range->bitrate[i++] = 108 * 500000;
1107#else
1108 range->bitrate[i++] = 2 * 500000;
1109 range->bitrate[i++] = 4 * 500000;
1110 range->bitrate[i++] = 11 * 500000;
1111 range->bitrate[i++] = 22 * 500000;
1112 range->bitrate[i++] = 24 * 500000;
1113 range->bitrate[i++] = 48 * 500000;
1114 range->bitrate[i++] = 96 * 500000;
1115 range->bitrate[i++] = 108 * 500000;
1116#endif /* WIRELESS_EXT < 16 */
1117 range->num_bitrates = i;
1118
1119 range->max_encoding_tokens = NUM_WEPKEYS;
1120 range->num_encoding_sizes = 2;
1121 range->encoding_size[0] = 5;
1122 range->encoding_size[1] = 13;
1123
1124 range->we_version_source = 20;
1125 range->we_version_compiled = WIRELESS_EXT;
1126
1127 /* Number of channels available in h/w */
1128 range->num_channels = 14;
1129 /* Number of entries in freq[] array */
1130 range->num_frequency = 14;
1131 for (i = 0; (i < range->num_frequency) && (i < IW_MAX_FREQUENCIES); i++) {
1132 int chan = i + 1;
1133 range->freq[i].i = chan;
1134 range->freq[i].m = channel_to_mhz(chan, 0);
1135 range->freq[i].e = 6;
1136 }
1137 if ((i+3) < IW_MAX_FREQUENCIES) {
1138 range->freq[i].i = 36;
1139 range->freq[i].m = channel_to_mhz(36, 1);
1140 range->freq[i].e = 6;
1141 range->freq[i+1].i = 40;
1142 range->freq[i+1].m = channel_to_mhz(40, 1);
1143 range->freq[i+1].e = 6;
1144 range->freq[i+2].i = 44;
1145 range->freq[i+2].m = channel_to_mhz(44, 1);
1146 range->freq[i+2].e = 6;
1147 range->freq[i+3].i = 48;
1148 range->freq[i+3].m = channel_to_mhz(48, 1);
1149 range->freq[i+3].e = 6;
1150 }
1151
1152#if WIRELESS_EXT > 16
1153 /* Event capability (kernel + driver) */
1154 range->event_capa[0] = (IW_EVENT_CAPA_K_0 |
1155 IW_EVENT_CAPA_MASK(SIOCGIWTHRSPY) |
1156 IW_EVENT_CAPA_MASK(SIOCGIWAP) |
1157 IW_EVENT_CAPA_MASK(SIOCGIWSCAN));
1158 range->event_capa[1] = IW_EVENT_CAPA_K_1;
1159 range->event_capa[4] = (IW_EVENT_CAPA_MASK(IWEVTXDROP) |
1160 IW_EVENT_CAPA_MASK(IWEVCUSTOM) |
1161 IW_EVENT_CAPA_MASK(IWEVREGISTERED) |
1162 IW_EVENT_CAPA_MASK(IWEVEXPIRED));
1163#endif /* WIRELESS_EXT > 16 */
1164
1165#if WIRELESS_EXT > 17
1166 range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
1167 IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
1168#endif /* WIRELESS_EXT > 17 */
1169
1170
1171 return 0;
1172} /* unifi_giwrange() */
1173
1174
1175static int
1176unifi_siwap(struct net_device *dev, struct iw_request_info *info,
1177 union iwreq_data *wrqu, char *extra)
1178{
1179 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
1180 unifi_priv_t *priv = interfacePriv->privPtr;
1181 int err = 0;
1182
1183 CHECK_INITED(priv);
1184
1185 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
1186 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
1187 unifi_error(priv, "unifi_siwap: not permitted in Mode %d\n",
1188 interfacePriv->interfaceMode);
1189 return -EPERM;
1190 }
1191
1192
1193 if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) {
1194 return -EINVAL;
1195 }
1196
1197 unifi_trace(priv, UDBG1, "unifi_siwap: asked for %pM\n",
1198 wrqu->ap_addr.sa_data);
1199
1200 if (is_zero_ether_addr(wrqu->ap_addr.sa_data)) {
1201 priv->ignore_bssid_join = FALSE;
1202 err = sme_mgt_disconnect(priv);
1203 if (err) {
1204 unifi_trace(priv, UDBG4, "unifi_siwap: Disconnect failed, status %d\n", err);
1205 }
1206 return 0;
1207 }
1208
1209 if (priv->ignore_bssid_join) {
1210 unifi_trace(priv, UDBG4, "unifi_siwap: ignoring second join\n");
1211 priv->ignore_bssid_join = FALSE;
1212 } else {
1213 memcpy(priv->connection_config.bssid.a, wrqu->ap_addr.sa_data, ETH_ALEN);
1214 unifi_trace(priv, UDBG1, "unifi_siwap: Joining %X:%X:%X:%X:%X:%X\n",
1215 priv->connection_config.bssid.a[0],
1216 priv->connection_config.bssid.a[1],
1217 priv->connection_config.bssid.a[2],
1218 priv->connection_config.bssid.a[3],
1219 priv->connection_config.bssid.a[4],
1220 priv->connection_config.bssid.a[5]);
1221 err = sme_mgt_connect(priv);
1222 if (err) {
1223 unifi_error(priv, "unifi_siwap: Join failed, status %d\n", err);
1224 return convert_sme_error(err);
1225 }
1226 }
1227
1228 return 0;
1229} /* unifi_siwap() */
1230
1231
1232static int
1233unifi_giwap(struct net_device *dev, struct iw_request_info *info,
1234 union iwreq_data *wrqu, char *extra)
1235{
1236 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
1237 unifi_priv_t *priv = interfacePriv->privPtr;
1238 CsrWifiSmeConnectionInfo connectionInfo;
1239 int r = 0;
1240 u8 *bssid;
1241
1242 CHECK_INITED(priv);
1243 unifi_trace(priv, UDBG2, "unifi_giwap\n");
1244
1245 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
1246 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
1247 unifi_error(priv, "iwprivswpikey: not permitted in Mode %d\n",
1248 interfacePriv->interfaceMode);
1249 return -EPERM;
1250 }
1251
1252 UF_RTNL_UNLOCK();
1253 r = sme_mgt_connection_info_get(priv, &connectionInfo);
1254 UF_RTNL_LOCK();
1255
1256 if (r == 0) {
1257 bssid = connectionInfo.bssid.a;
1258 wrqu->ap_addr.sa_family = ARPHRD_ETHER;
1259 unifi_trace(priv, UDBG4, "unifi_giwap: BSSID = %pM\n", bssid);
1260
1261 memcpy(wrqu->ap_addr.sa_data, bssid, ETH_ALEN);
1262 } else {
1263 memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
1264 }
1265
1266 return 0;
1267} /* unifi_giwap() */
1268
1269
1270static int
1271unifi_siwscan(struct net_device *dev, struct iw_request_info *info,
1272 union iwreq_data *wrqu, char *extra)
1273{
1274 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
1275 unifi_priv_t *priv = interfacePriv->privPtr;
1276 int r;
1277 CsrWifiSsid scan_ssid;
1278 unsigned char *channel_list = NULL;
1279 int chans_good = 0;
1280#if WIRELESS_EXT > 17
1281 struct iw_point *data = &wrqu->data;
1282 struct iw_scan_req *req = (struct iw_scan_req *) extra;
1283#endif
1284
1285 CHECK_INITED(priv);
1286
1287 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
1288 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
1289 unifi_error(priv, "unifi_siwscan: not permitted in Mode %d\n",
1290 interfacePriv->interfaceMode);
1291 return -EPERM;
1292 }
1293
1294
1295#if WIRELESS_EXT > 17
1296 /* Providing a valid channel list will force an active scan */
1297 if (req) {
1298 if ((req->num_channels > 0) && (req->num_channels < IW_MAX_FREQUENCIES)) {
1299 channel_list = kmalloc(req->num_channels, GFP_KERNEL);
1300 if (channel_list) {
1301 int i;
1302 for (i = 0; i < req->num_channels; i++) {
1303 /* Convert frequency to channel number */
1304 int ch = wext_freq_to_channel(req->channel_list[i].m,
1305 req->channel_list[i].e);
1306 if (ch) {
1307 channel_list[chans_good++] = ch;
1308 }
1309 }
1310 unifi_trace(priv, UDBG1,
1311 "SIWSCAN: Scanning %d channels\n", chans_good);
1312 } else {
1313 /* Fall back to scanning all */
1314 unifi_error(priv, "SIWSCAN: Can't alloc channel_list (%d)\n",
1315 req->num_channels);
1316 }
1317 }
1318 }
1319
1320 if (req && (data->flags & IW_SCAN_THIS_ESSID)) {
1321 memcpy(scan_ssid.ssid, req->essid, req->essid_len);
1322 scan_ssid.length = req->essid_len;
1323 unifi_trace(priv, UDBG1,
1324 "SIWSCAN: Scanning for %.*s\n",
1325 scan_ssid.length, scan_ssid.ssid);
1326 } else
1327#endif
1328 {
1329 unifi_trace(priv, UDBG1, "SIWSCAN: Scanning for all APs\n");
1330 scan_ssid.length = 0;
1331 }
1332
1333 r = sme_mgt_scan_full(priv, &scan_ssid, chans_good, channel_list);
1334 if (r) {
1335 unifi_error(priv, "SIWSCAN: Scan returned error %d\n", r);
1336 } else {
1337 unifi_trace(priv, UDBG1, "SIWSCAN: Scan done\n");
1338 wext_send_scan_results_event(priv);
1339 }
1340
1341 if (channel_list) {
1342 kfree(channel_list);
1343 }
1344
1345 return r;
1346
1347} /* unifi_siwscan() */
1348
1349
1350static const unsigned char *
1351unifi_find_info_element(int id, const unsigned char *info, int len)
1352{
1353 const unsigned char *ie = info;
1354
1355 while (len > 1)
1356 {
1357 int e_id, e_len;
1358 e_id = ie[0];
1359 e_len = ie[1];
1360
1361 /* Return if we find a match */
1362 if (e_id == id)
1363 {
1364 return ie;
1365 }
1366
1367 len -= (e_len + 2);
1368 ie += (e_len + 2);
1369 }
1370
1371 return NULL;
1372} /* unifi_find_info_element() */
1373
1374
1375/*
1376 * Translate scan data returned from the card to a card independent
1377 * format that the Wireless Tools will understand - Jean II
1378 */
1379int
1380unifi_translate_scan(struct net_device *dev,
1381 struct iw_request_info *info,
1382 char *current_ev, char *end_buf,
1383 CsrWifiSmeScanResult *scan_data,
1384 int scan_index)
1385{
1386 struct iw_event iwe; /* Temporary buffer */
1387 unsigned char *info_elems;
1388 int info_elem_len;
1389 const unsigned char *elem;
1390 u16 capabilities;
1391 int signal, noise, snr;
1392 char *start_buf = current_ev;
1393 char *current_val; /* For rates */
1394 int i, r;
1395
1396 info_elems = scan_data->informationElements;
1397 info_elem_len = scan_data->informationElementsLength;
1398
1399 if (!scan_data->informationElementsLength || !scan_data->informationElements) {
1400 unifi_error(NULL, "*** NULL SCAN IEs ***\n");
1401 return -EIO;
1402 }
1403
1404 /* get capinfo bits */
1405 capabilities = scan_data->capabilityInformation;
1406
1407 unifi_trace(NULL, UDBG5, "Capabilities: 0x%x\n", capabilities);
1408
1409 /* First entry *MUST* be the AP MAC address */
1410 memset(&iwe, 0, sizeof(iwe));
1411 iwe.cmd = SIOCGIWAP;
1412 iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
1413 memcpy(iwe.u.ap_addr.sa_data, scan_data->bssid.a, ETH_ALEN);
1414 iwe.len = IW_EV_ADDR_LEN;
1415 r = uf_iwe_stream_add_event(info, start_buf, end_buf, &iwe, IW_EV_ADDR_LEN);
1416 if (r < 0) {
1417 return r;
1418 }
1419 start_buf += r;
1420
1421 /* Other entries will be displayed in the order we give them */
1422
1423 /* Add the ESSID */
1424 /* find SSID in Info Elems */
1425 elem = unifi_find_info_element(IE_SSID_ID, info_elems, info_elem_len);
1426 if (elem) {
1427 int e_len = elem[1];
1428 const unsigned char *e_ptr = elem + 2;
1429 unsigned char buf[33];
1430
1431 memset(&iwe, 0, sizeof(iwe));
1432 iwe.cmd = SIOCGIWESSID;
1433 iwe.u.essid.length = e_len;
1434 if (iwe.u.essid.length > 32) {
1435 iwe.u.essid.length = 32;
1436 }
1437 iwe.u.essid.flags = scan_index;
1438 memcpy(buf, e_ptr, iwe.u.essid.length);
1439 buf[iwe.u.essid.length] = '\0';
1440 r = uf_iwe_stream_add_point(info, start_buf, end_buf, &iwe, buf);
1441 if (r < 0) {
1442 return r;
1443 }
1444 start_buf += r;
1445
1446 }
1447
1448 /* Add mode */
1449 memset(&iwe, 0, sizeof(iwe));
1450 iwe.cmd = SIOCGIWMODE;
1451 if (scan_data->bssType == CSR_WIFI_SME_BSS_TYPE_INFRASTRUCTURE) {
1452 iwe.u.mode = IW_MODE_INFRA;
1453 } else {
1454 iwe.u.mode = IW_MODE_ADHOC;
1455 }
1456 iwe.len = IW_EV_UINT_LEN;
1457 r = uf_iwe_stream_add_event(info, start_buf, end_buf, &iwe, IW_EV_UINT_LEN);
1458 if (r < 0) {
1459 return r;
1460 }
1461 start_buf += r;
1462
1463 /* Add frequency. iwlist will convert to channel using table given in giwrange */
1464 memset(&iwe, 0, sizeof(iwe));
1465 iwe.cmd = SIOCGIWFREQ;
1466 iwe.u.freq.m = scan_data->channelFrequency;
1467 iwe.u.freq.e = 6;
1468 r = uf_iwe_stream_add_event(info, start_buf, end_buf, &iwe, IW_EV_FREQ_LEN);
1469 if (r < 0) {
1470 return r;
1471 }
1472 start_buf += r;
1473
1474
1475 /* Add quality statistics */
1476 iwe.cmd = IWEVQUAL;
1477 /*
1478 * level and noise below are mapped into an unsigned 8 bit number,
1479 * ranging from [-192; 63]. The way this is achieved is simply to
1480 * add 0x100 onto the number if it is negative,
1481 * once clipped to the correct range.
1482 */
1483 signal = scan_data->rssi; /* This value is in dBm */
1484 /* Clip range of snr */
1485 snr = (scan_data->snr > 0) ? scan_data->snr : 0; /* In dB relative, from 0 - 255 */
1486 snr = (snr < 255) ? snr : 255;
1487 noise = signal - snr;
1488
1489 /* Clip range of signal */
1490 signal = (signal < 63) ? signal : 63;
1491 signal = (signal > -192) ? signal : -192;
1492
1493 /* Clip range of noise */
1494 noise = (noise < 63) ? noise : 63;
1495 noise = (noise > -192) ? noise : -192;
1496
1497 /* Make u8 */
1498 signal = ( signal < 0 ) ? signal + 0x100 : signal;
1499 noise = ( noise < 0 ) ? noise + 0x100 : noise;
1500
1501 iwe.u.qual.level = (u8)signal; /* -192 : 63 */
1502 iwe.u.qual.noise = (u8)noise; /* -192 : 63 */
1503 iwe.u.qual.qual = snr; /* 0 : 255 */
1504 iwe.u.qual.updated = 0;
1505#if WIRELESS_EXT > 16
1506 iwe.u.qual.updated |= IW_QUAL_LEVEL_UPDATED | IW_QUAL_NOISE_UPDATED |
1507 IW_QUAL_QUAL_UPDATED;
1508#if WIRELESS_EXT > 18
1509 iwe.u.qual.updated |= IW_QUAL_DBM;
1510#endif
1511#endif
1512 r = uf_iwe_stream_add_event(info, start_buf, end_buf, &iwe, IW_EV_QUAL_LEN);
1513 if (r < 0) {
1514 return r;
1515 }
1516 start_buf += r;
1517
1518 /* Add encryption capability */
1519 iwe.cmd = SIOCGIWENCODE;
1520 if (capabilities & SIG_CAP_PRIVACY) {
1521 iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
1522 } else {
1523 iwe.u.data.flags = IW_ENCODE_DISABLED;
1524 }
1525 iwe.u.data.length = 0;
1526 iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
1527 r = uf_iwe_stream_add_point(info, start_buf, end_buf, &iwe, "");
1528 if (r < 0) {
1529 return r;
1530 }
1531 start_buf += r;
1532
1533
1534 /*
1535 * Rate : stuffing multiple values in a single event require a bit
1536 * more of magic - Jean II
1537 */
1538 current_val = start_buf + IW_EV_LCP_LEN;
1539
1540 iwe.cmd = SIOCGIWRATE;
1541 /* Those two flags are ignored... */
1542 iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
1543
1544 elem = unifi_find_info_element(IE_SUPPORTED_RATES_ID,
1545 info_elems, info_elem_len);
1546 if (elem) {
1547 int e_len = elem[1];
1548 const unsigned char *e_ptr = elem + 2;
1549
1550 /*
1551 * Count how many rates we have.
1552 * Zero marks the end of the list, if the list is not truncated.
1553 */
1554 /* Max 8 values */
1555 for (i = 0; i < e_len; i++) {
1556 if (e_ptr[i] == 0) {
1557 break;
1558 }
1559 /* Bit rate given in 500 kb/s units (+ 0x80) */
1560 iwe.u.bitrate.value = ((e_ptr[i] & 0x7f) * 500000);
1561 /* Add new value to event */
1562 r = uf_iwe_stream_add_value(info, start_buf, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
1563 if (r < 0) {
1564 return r;
1565 }
1566 current_val +=r;
1567
1568 }
1569 }
1570 elem = unifi_find_info_element(IE_EXTENDED_SUPPORTED_RATES_ID,
1571 info_elems, info_elem_len);
1572 if (elem) {
1573 int e_len = elem[1];
1574 const unsigned char *e_ptr = elem + 2;
1575
1576 /*
1577 * Count how many rates we have.
1578 * Zero marks the end of the list, if the list is not truncated.
1579 */
1580 /* Max 8 values */
1581 for (i = 0; i < e_len; i++) {
1582 if (e_ptr[i] == 0) {
1583 break;
1584 }
1585 /* Bit rate given in 500 kb/s units (+ 0x80) */
1586 iwe.u.bitrate.value = ((e_ptr[i] & 0x7f) * 500000);
1587 /* Add new value to event */
1588 r = uf_iwe_stream_add_value(info, start_buf, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
1589 if (r < 0) {
1590 return r;
1591 }
1592 current_val +=r;
1593 }
1594 }
1595 /* Check if we added any rates event */
1596 if ((current_val - start_buf) > IW_EV_LCP_LEN) {
1597 start_buf = current_val;
1598 }
1599
1600
1601#if WIRELESS_EXT > 17
1602 memset(&iwe, 0, sizeof(iwe));
1603 iwe.cmd = IWEVGENIE;
1604 iwe.u.data.length = info_elem_len;
1605
1606 r = uf_iwe_stream_add_point(info, start_buf, end_buf, &iwe, info_elems);
1607 if (r < 0) {
1608 return r;
1609 }
1610
1611 start_buf += r;
1612#endif /* WE > 17 */
1613
1614 return (start_buf - current_ev);
1615} /* unifi_translate_scan() */
1616
1617
1618
1619static int
1620unifi_giwscan(struct net_device *dev, struct iw_request_info *info,
1621 union iwreq_data *wrqu, char *extra)
1622{
1623 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
1624 unifi_priv_t *priv = interfacePriv->privPtr;
1625 struct iw_point *dwrq = &wrqu->data;
1626 int r;
1627
1628 CHECK_INITED(priv);
1629
1630 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
1631 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
1632 unifi_error(priv, "unifi_giwscan: not permitted in Mode %d\n",
1633 interfacePriv->interfaceMode);
1634 return -EPERM;
1635 }
1636
1637
1638 unifi_trace(priv, UDBG1,
1639 "unifi_giwscan: buffer (%d bytes) \n",
1640 dwrq->length);
1641 UF_RTNL_UNLOCK();
1642 r = sme_mgt_scan_results_get_async(priv, info, extra, dwrq->length);
1643 UF_RTNL_LOCK();
1644 if (r < 0) {
1645 unifi_trace(priv, UDBG1,
1646 "unifi_giwscan: buffer (%d bytes) not big enough.\n",
1647 dwrq->length);
1648 return r;
1649 }
1650
1651 dwrq->length = r;
1652 dwrq->flags = 0;
1653
1654 return 0;
1655} /* unifi_giwscan() */
1656
1657
1658/*
1659 * ---------------------------------------------------------------------------
1660 * unifi_siwessid
1661 *
1662 * Request to join a network or start and AdHoc.
1663 *
1664 * Arguments:
1665 * dev Pointer to network device struct.
1666 * info Pointer to broken-out ioctl request.
1667 * data Pointer to argument data.
1668 * essid Pointer to string giving name of network to join
1669 * or start
1670 *
1671 * Returns:
1672 * 0 on success and everything complete
1673 * -EINPROGRESS to have the higher level call the commit method.
1674 * ---------------------------------------------------------------------------
1675 */
1676static int
1677unifi_siwessid(struct net_device *dev, struct iw_request_info *info,
1678 struct iw_point *data, char *essid)
1679{
1680 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
1681 unifi_priv_t *priv = interfacePriv->privPtr;
1682 int len;
1683 int err = 0;
1684
1685 CHECK_INITED(priv);
1686
1687 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
1688 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
1689 unifi_error(priv, "unifi_siwessid: not permitted in Mode %d\n",
1690 interfacePriv->interfaceMode);
1691 return -EPERM;
1692 }
1693
1694
1695 len = 0;
1696 if (data->flags & 1) {
1697 /* Limit length */
1698 len = data->length;
1699 if (len > UNIFI_MAX_SSID_LEN) {
1700 len = UNIFI_MAX_SSID_LEN;
1701 }
1702 }
1703
1704#ifdef UNIFI_DEBUG
1705 {
1706 char essid_str[UNIFI_MAX_SSID_LEN+1];
1707 int i;
1708
1709 for (i = 0; i < len; i++) {
1710 essid_str[i] = (isprint(essid[i]) ? essid[i] : '?');
1711 }
1712 essid_str[i] = '\0';
1713
1714 unifi_trace(priv, UDBG1, "unifi_siwessid: asked for '%*s' (%d)\n", len, essid_str, len);
1715 unifi_trace(priv, UDBG2, " with authModeMask = %d", priv->connection_config.authModeMask);
1716 }
1717#endif
1718
1719 memset(priv->connection_config.bssid.a, 0xFF, ETH_ALEN);
1720 if (len) {
1721 if (essid[len - 1] == 0) {
1722 len --;
1723 }
1724
1725 memcpy(priv->connection_config.ssid.ssid, essid, len);
1726 priv->connection_config.ssid.length = len;
1727
1728 } else {
1729 priv->connection_config.ssid.length = 0;
1730 }
1731
1732 UF_RTNL_UNLOCK();
1733 err = sme_mgt_connect(priv);
1734 UF_RTNL_LOCK();
1735 if (err) {
1736 unifi_error(priv, "unifi_siwessid: Join failed, status %d\n", err);
1737 return convert_sme_error(err);
1738 }
1739
1740 return 0;
1741} /* unifi_siwessid() */
1742
1743
1744static int
1745unifi_giwessid(struct net_device *dev, struct iw_request_info *info,
1746 union iwreq_data *wrqu, char *essid)
1747{
1748 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
1749 unifi_priv_t *priv = interfacePriv->privPtr;
1750 struct iw_point *data = &wrqu->essid;
1751 CsrWifiSmeConnectionInfo connectionInfo;
1752 int r = 0;
1753
1754 unifi_trace(priv, UDBG2, "unifi_giwessid\n");
1755 CHECK_INITED(priv);
1756
1757 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
1758 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
1759 unifi_error(priv, "unifi_giwessid: not permitted in Mode %d\n",
1760 interfacePriv->interfaceMode);
1761 return -EPERM;
1762 }
1763
1764 UF_RTNL_UNLOCK();
1765 r = sme_mgt_connection_info_get(priv, &connectionInfo);
1766 UF_RTNL_LOCK();
1767
1768 if (r == 0) {
1769 data->length = connectionInfo.ssid.length;
1770 strncpy(essid,
1771 connectionInfo.ssid.ssid,
1772 data->length);
1773 data->flags = 1; /* active */
1774
1775 unifi_trace(priv, UDBG2, "unifi_giwessid: %.*s\n",
1776 data->length, essid);
1777 }
1778
1779
1780 return 0;
1781} /* unifi_giwessid() */
1782
1783
1784static int
1785unifi_siwrate(struct net_device *dev, struct iw_request_info *info,
1786 union iwreq_data *wrqu, char *extra)
1787{
1788 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
1789 unifi_priv_t *priv = interfacePriv->privPtr;
1790 struct iw_param *args = &wrqu->bitrate;
1791 CsrWifiSmeMibConfig mibConfig;
1792 int r;
1793
1794 CHECK_INITED(priv);
1795 unifi_trace(priv, UDBG2, "unifi_siwrate\n");
1796
1797 /*
1798 * If args->fixed == 0, value is max rate or -1 for best
1799 * If args->fixed == 1, value is rate to set or -1 for best
1800 * args->disabled and args->flags are not used in SIOCSIWRATE
1801 */
1802
1803 /* Get, modify and set the MIB data */
1804 UF_RTNL_UNLOCK();
1805 r = sme_mgt_mib_config_get(priv, &mibConfig);
1806 UF_RTNL_LOCK();
1807 if (r) {
1808 unifi_error(priv, "unifi_siwrate: Get CsrWifiSmeMibConfigValue failed.\n");
1809 return r;
1810 }
1811
1812 /* Default to auto rate algorithm */
1813 /* in 500Kbit/s, 0 means auto */
1814 mibConfig.unifiFixTxDataRate = 0;
1815
1816 if (args->value != -1) {
1817 mibConfig.unifiFixTxDataRate = args->value / 500000;
1818 }
1819
1820 /* 1 means rate is a maximum, 2 means rate is a set value */
1821 if (args->fixed == 1) {
1822 mibConfig.unifiFixMaxTxDataRate = 0;
1823 } else {
1824 mibConfig.unifiFixMaxTxDataRate = 1;
1825 }
1826 UF_RTNL_UNLOCK();
1827 r = sme_mgt_mib_config_set(priv, &mibConfig);
1828 UF_RTNL_LOCK();
1829 if (r) {
1830 unifi_error(priv, "unifi_siwrate: Set CsrWifiSmeMibConfigValue failed.\n");
1831 return r;
1832 }
1833
1834
1835 return 0;
1836} /* unifi_siwrate() */
1837
1838
1839
1840static int
1841unifi_giwrate(struct net_device *dev, struct iw_request_info *info,
1842 union iwreq_data *wrqu, char *extra)
1843{
1844 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
1845 unifi_priv_t *priv = interfacePriv->privPtr;
1846 struct iw_param *args = &wrqu->bitrate;
1847 int r;
1848 int bitrate, flag;
1849 CsrWifiSmeMibConfig mibConfig;
1850 CsrWifiSmeConnectionStats connectionStats;
1851
1852 unifi_trace(priv, UDBG2, "unifi_giwrate\n");
1853 CHECK_INITED(priv);
1854
1855 flag = 0;
1856 bitrate = 0;
1857 UF_RTNL_UNLOCK();
1858 r = sme_mgt_mib_config_get(priv, &mibConfig);
1859 UF_RTNL_LOCK();
1860 if (r) {
1861 unifi_error(priv, "unifi_giwrate: Get CsrWifiSmeMibConfigValue failed.\n");
1862 return r;
1863 }
1864
1865 bitrate = mibConfig.unifiFixTxDataRate;
1866 flag = mibConfig.unifiFixMaxTxDataRate;
1867
1868 /* Used the value returned by the SME if MIB returns 0 */
1869 if (bitrate == 0) {
1870 UF_RTNL_UNLOCK();
1871 r = sme_mgt_connection_stats_get(priv, &connectionStats);
1872 UF_RTNL_LOCK();
1873 /* Ignore errors, we may be disconnected */
1874 if (r == 0) {
1875 bitrate = connectionStats.unifiTxDataRate;
1876 }
1877 }
1878
1879 args->value = bitrate * 500000;
1880 args->fixed = !flag;
1881
1882 return 0;
1883} /* unifi_giwrate() */
1884
1885
1886static int
1887unifi_siwrts(struct net_device *dev, struct iw_request_info *info,
1888 union iwreq_data *wrqu, char *extra)
1889{
1890 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
1891 unifi_priv_t *priv = interfacePriv->privPtr;
1892 int val = wrqu->rts.value;
1893 int r = 0;
1894 CsrWifiSmeMibConfig mibConfig;
1895
1896 unifi_trace(priv, UDBG2, "unifi_siwrts\n");
1897 CHECK_INITED(priv);
1898
1899 if (wrqu->rts.disabled) {
1900 val = 2347;
1901 }
1902
1903 if ( (val < 0) || (val > 2347) )
1904 {
1905 return -EINVAL;
1906 }
1907
1908 /* Get, modify and set the MIB data */
1909 UF_RTNL_UNLOCK();
1910 r = sme_mgt_mib_config_get(priv, &mibConfig);
1911 UF_RTNL_LOCK();
1912 if (r) {
1913 unifi_error(priv, "unifi_siwrts: Get CsrWifiSmeMibConfigValue failed.\n");
1914 return r;
1915 }
1916 mibConfig.dot11RtsThreshold = val;
1917 UF_RTNL_UNLOCK();
1918 r = sme_mgt_mib_config_set(priv, &mibConfig);
1919 UF_RTNL_LOCK();
1920 if (r) {
1921 unifi_error(priv, "unifi_siwrts: Set CsrWifiSmeMibConfigValue failed.\n");
1922 return r;
1923 }
1924
1925 return 0;
1926}
1927
1928
1929static int
1930unifi_giwrts(struct net_device *dev, struct iw_request_info *info,
1931 union iwreq_data *wrqu, char *extra)
1932{
1933 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
1934 unifi_priv_t *priv = interfacePriv->privPtr;
1935 int r;
1936 int rts_thresh;
1937 CsrWifiSmeMibConfig mibConfig;
1938
1939 unifi_trace(priv, UDBG2, "unifi_giwrts\n");
1940 CHECK_INITED(priv);
1941
1942 UF_RTNL_UNLOCK();
1943 r = sme_mgt_mib_config_get(priv, &mibConfig);
1944 UF_RTNL_LOCK();
1945 if (r) {
1946 unifi_error(priv, "unifi_giwrts: Get CsrWifiSmeMibConfigValue failed.\n");
1947 return r;
1948 }
1949
1950 rts_thresh = mibConfig.dot11RtsThreshold;
1951 if (rts_thresh > 2347) {
1952 rts_thresh = 2347;
1953 }
1954
1955 wrqu->rts.value = rts_thresh;
1956 wrqu->rts.disabled = (rts_thresh == 2347);
1957 wrqu->rts.fixed = 1;
1958
1959 return 0;
1960}
1961
1962
1963static int
1964unifi_siwfrag(struct net_device *dev, struct iw_request_info *info,
1965 union iwreq_data *wrqu, char *extra)
1966{
1967 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
1968 unifi_priv_t *priv = interfacePriv->privPtr;
1969 int val = wrqu->frag.value;
1970 int r = 0;
1971 CsrWifiSmeMibConfig mibConfig;
1972
1973 unifi_trace(priv, UDBG2, "unifi_siwfrag\n");
1974 CHECK_INITED(priv);
1975
1976 if (wrqu->frag.disabled)
1977 val = 2346;
1978
1979 if ( (val < 256) || (val > 2347) )
1980 return -EINVAL;
1981
1982 /* Get, modify and set the MIB data */
1983 UF_RTNL_UNLOCK();
1984 r = sme_mgt_mib_config_get(priv, &mibConfig);
1985 UF_RTNL_LOCK();
1986 if (r) {
1987 unifi_error(priv, "unifi_siwfrag: Get CsrWifiSmeMibConfigValue failed.\n");
1988 return r;
1989 }
1990 /* Fragmentation Threashold must be even */
1991 mibConfig.dot11FragmentationThreshold = (val & ~0x1);
1992 UF_RTNL_UNLOCK();
1993 r = sme_mgt_mib_config_set(priv, &mibConfig);
1994 UF_RTNL_LOCK();
1995 if (r) {
1996 unifi_error(priv, "unifi_siwfrag: Set CsrWifiSmeMibConfigValue failed.\n");
1997 return r;
1998 }
1999
2000 return 0;
2001}
2002
2003
2004static int
2005unifi_giwfrag(struct net_device *dev, struct iw_request_info *info,
2006 union iwreq_data *wrqu, char *extra)
2007{
2008 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
2009 unifi_priv_t *priv = interfacePriv->privPtr;
2010 int r;
2011 int frag_thresh;
2012 CsrWifiSmeMibConfig mibConfig;
2013
2014 unifi_trace(priv, UDBG2, "unifi_giwfrag\n");
2015 CHECK_INITED(priv);
2016
2017 UF_RTNL_UNLOCK();
2018 r = sme_mgt_mib_config_get(priv, &mibConfig);
2019 UF_RTNL_LOCK();
2020 if (r) {
2021 unifi_error(priv, "unifi_giwfrag: Get CsrWifiSmeMibConfigValue failed.\n");
2022 return r;
2023 }
2024
2025 frag_thresh = mibConfig.dot11FragmentationThreshold;
2026
2027 /* Build the return structure */
2028 wrqu->frag.value = frag_thresh;
2029 wrqu->frag.disabled = (frag_thresh >= 2346);
2030 wrqu->frag.fixed = 1;
2031
2032 return 0;
2033}
2034
2035
2036static int
2037unifi_siwencode(struct net_device *dev, struct iw_request_info *info,
2038 union iwreq_data *wrqu, char *extra)
2039{
2040 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
2041 unifi_priv_t *priv = interfacePriv->privPtr;
2042 struct iw_point *erq = &wrqu->encoding;
2043 int index;
2044 int rc = 0;
2045 int privacy = -1;
2046 CsrWifiSmeKey sme_key;
2047
2048 unifi_trace(priv, UDBG2, "unifi_siwencode\n");
2049
2050 CHECK_INITED(priv);
2051
2052 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
2053 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
2054 unifi_error(priv, "unifi_siwencode: not permitted in Mode %d\n",
2055 interfacePriv->interfaceMode);
2056 return -EPERM;
2057 }
2058
2059
2060 /*
2061 * Key index is encoded in the flags.
2062 * 0 - use current default,
2063 * 1-4 - if a key value is given set that key
2064 * if not use that key
2065 */
2066 index = (erq->flags & IW_ENCODE_INDEX); /* key number, 1-4 */
2067 if ((index < 0) || (index > 4)) {
2068 unifi_error(priv, "unifi_siwencode: Request to set an invalid key (index:%d)", index);
2069 return -EINVAL;
2070 }
2071
2072 /*
2073 * Basic checking: do we have a key to set ?
2074 * The IW_ENCODE_NOKEY flag is set when no key is present (only change flags),
2075 * but older versions rely on sending a key id 1-4.
2076 */
2077 if (erq->length > 0) {
2078
2079 /* Check the size of the key */
2080 if ((erq->length > LARGE_KEY_SIZE) || (erq->length < SMALL_KEY_SIZE)) {
2081 unifi_error(priv, "unifi_siwencode: Request to set an invalid key (length:%d)",
2082 erq->length);
2083 return -EINVAL;
2084 }
2085
2086 /* Check the index (none (i.e. 0) means use current) */
2087 if ((index < 1) || (index > 4)) {
2088 /* If we do not have a previous key, use 1 as default */
2089 if (!priv->wep_tx_key_index) {
2090 priv->wep_tx_key_index = 1;
2091 }
2092 index = priv->wep_tx_key_index;
2093 }
2094
2095 /* If we didn't have a key and a valid index is set, we want to remember it*/
2096 if (!priv->wep_tx_key_index) {
2097 priv->wep_tx_key_index = index;
2098 }
2099
2100 unifi_trace(priv, UDBG1, "Tx key Index is %d\n", priv->wep_tx_key_index);
2101
2102 privacy = 1;
2103
2104 /* Check if the key is not marked as invalid */
2105 if ((erq->flags & IW_ENCODE_NOKEY) == 0) {
2106
2107 unifi_trace(priv, UDBG1, "New %s key (len=%d, index=%d)\n",
2108 (priv->wep_tx_key_index == index) ? "tx" : "",
2109 erq->length, index);
2110
2111 sme_key.wepTxKey = (priv->wep_tx_key_index == index);
2112 if (priv->wep_tx_key_index == index) {
2113 sme_key.keyType = CSR_WIFI_SME_KEY_TYPE_PAIRWISE;
2114 } else {
2115 sme_key.keyType = CSR_WIFI_SME_KEY_TYPE_GROUP;
2116 }
2117 /* Key index is zero based in SME but 1 based in wext */
2118 sme_key.keyIndex = (index - 1);
2119 sme_key.keyLength = erq->length;
2120 sme_key.authenticator = 0;
2121 memset(sme_key.address.a, 0xFF, ETH_ALEN);
2122 memcpy(sme_key.key, extra, erq->length);
2123
2124 UF_RTNL_UNLOCK();
2125 rc = sme_mgt_key(priv, &sme_key, CSR_WIFI_SME_LIST_ACTION_ADD);
2126 UF_RTNL_LOCK();
2127 if (rc) {
2128 unifi_error(priv, "unifi_siwencode: Set key failed (%d)", rc);
2129 return convert_sme_error(rc);
2130 }
2131
2132 /* Store the key to be reported by the SIOCGIWENCODE handler */
2133 priv->wep_keys[index - 1].len = erq->length;
2134 memcpy(priv->wep_keys[index - 1].key, extra, erq->length);
2135 }
2136 } else {
2137 /*
2138 * No additional key data, so it must be a request to change the
2139 * active key.
2140 */
2141 if (index != 0) {
2142 unifi_trace(priv, UDBG1, "Tx key Index is %d\n", index - 1);
2143
2144 /* Store the index to be reported by the SIOCGIWENCODE handler */
2145 priv->wep_tx_key_index = index;
2146
2147 sme_key.wepTxKey = 1;
2148 sme_key.keyType = CSR_WIFI_SME_KEY_TYPE_PAIRWISE;
2149
2150 /* Key index is zero based in SME but 1 based in wext */
2151 sme_key.keyIndex = (index - 1);
2152 sme_key.keyLength = 0;
2153 sme_key.authenticator = 0;
2154 UF_RTNL_UNLOCK();
2155 rc = sme_mgt_key(priv, &sme_key, CSR_WIFI_SME_LIST_ACTION_ADD);
2156 UF_RTNL_LOCK();
2157 if (rc) {
2158 unifi_error(priv, "unifi_siwencode: Set key failed (%d)", rc);
2159 return convert_sme_error(rc);
2160 }
2161
2162 /* Turn on encryption */
2163 privacy = 1;
2164 }
2165 }
2166
2167 /* Read the flags */
2168 if (erq->flags & IW_ENCODE_DISABLED) {
2169 /* disable encryption */
2170 unifi_trace(priv, UDBG1, "disable WEP encryption\n");
2171 privacy = 0;
2172
2173 priv->wep_tx_key_index = 0;
2174
2175 unifi_trace(priv, UDBG1, "IW_ENCODE_DISABLED: CSR_WIFI_SME_AUTH_MODE_80211_OPEN\n");
2176 priv->connection_config.authModeMask = CSR_WIFI_SME_AUTH_MODE_80211_OPEN;
2177 }
2178
2179 if (erq->flags & IW_ENCODE_RESTRICTED) {
2180 /* Use shared key auth */
2181 unifi_trace(priv, UDBG1, "IW_ENCODE_RESTRICTED: CSR_WIFI_SME_AUTH_MODE_80211_SHARED\n");
2182 priv->connection_config.authModeMask = CSR_WIFI_SME_AUTH_MODE_80211_SHARED;
2183
2184 /* Turn on encryption */
2185 privacy = 1;
2186 }
2187 if (erq->flags & IW_ENCODE_OPEN) {
2188 unifi_trace(priv, UDBG1, "IW_ENCODE_OPEN: CSR_WIFI_SME_AUTH_MODE_80211_OPEN\n");
2189 priv->connection_config.authModeMask = CSR_WIFI_SME_AUTH_MODE_80211_OPEN;
2190 }
2191
2192 /* Commit the changes to flags if needed */
2193 if (privacy != -1) {
2194 priv->connection_config.privacyMode = privacy ? CSR_WIFI_SME_80211_PRIVACY_MODE_ENABLED : CSR_WIFI_SME_80211_PRIVACY_MODE_DISABLED;
2195 priv->connection_config.encryptionModeMask = privacy ? (CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP40 |
2196 CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP104 |
2197 CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP40 |
2198 CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP104) :
2199 CSR_WIFI_SME_ENCRYPTION_CIPHER_NONE;
2200 }
2201
2202 return convert_sme_error(rc);
2203
2204} /* unifi_siwencode() */
2205
2206
2207
2208static int
2209unifi_giwencode(struct net_device *dev, struct iw_request_info *info,
2210 union iwreq_data *wrqu, char *extra)
2211{
2212 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
2213 unifi_priv_t *priv = interfacePriv->privPtr;
2214 struct iw_point *erq = &wrqu->encoding;
2215
2216 unifi_trace(priv, UDBG2, "unifi_giwencode\n");
2217
2218 CHECK_INITED(priv);
2219
2220 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
2221 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
2222 unifi_error(priv, "unifi_giwencode: not permitted in Mode %d\n",
2223 interfacePriv->interfaceMode);
2224 return -EPERM;
2225 }
2226
2227
2228 if (priv->connection_config.authModeMask == CSR_WIFI_SME_AUTH_MODE_80211_SHARED) {
2229 erq->flags = IW_ENCODE_RESTRICTED;
2230 }
2231 else {
2232 if (priv->connection_config.privacyMode == CSR_WIFI_SME_80211_PRIVACY_MODE_DISABLED) {
2233 erq->flags = IW_ENCODE_DISABLED;
2234 } else {
2235 erq->flags = IW_ENCODE_OPEN;
2236 }
2237 }
2238
2239 erq->length = 0;
2240
2241 if (erq->flags != IW_ENCODE_DISABLED) {
2242 int index = priv->wep_tx_key_index;
2243
2244 if ((index > 0) && (index <= NUM_WEPKEYS)) {
2245 erq->flags |= (index & IW_ENCODE_INDEX);
2246 erq->length = priv->wep_keys[index - 1].len;
2247 memcpy(extra, priv->wep_keys[index - 1].key, erq->length);
2248 } else {
2249 unifi_notice(priv, "unifi_giwencode: Surprise, do not have a valid key index (%d)\n",
2250 index);
2251 }
2252 }
2253
2254 return 0;
2255} /* unifi_giwencode() */
2256
2257
2258static int
2259unifi_siwpower(struct net_device *dev, struct iw_request_info *info,
2260 union iwreq_data *wrqu, char *extra)
2261{
2262 struct iw_param *args = &wrqu->power;
2263 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
2264 unifi_priv_t *priv = interfacePriv->privPtr;
2265 int listen_interval, wake_for_dtim;
2266 int r = 0;
2267 CsrWifiSmePowerConfig powerConfig;
2268
2269 unifi_trace(priv, UDBG2, "unifi_siwpower\n");
2270
2271 CHECK_INITED(priv);
2272
2273 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
2274 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
2275 unifi_error(priv, "unifi_siwpower: not permitted in Mode %d\n",
2276 interfacePriv->interfaceMode);
2277 return -EPERM;
2278 }
2279
2280 UF_RTNL_UNLOCK();
2281 r = sme_mgt_power_config_get(priv, &powerConfig);
2282 UF_RTNL_LOCK();
2283 if (r) {
2284 unifi_error(priv, "unifi_siwpower: Get unifi_PowerConfigValue failed.\n");
2285 return r;
2286 }
2287
2288 listen_interval = -1;
2289 wake_for_dtim = -1;
2290 if (args->disabled) {
2291 powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW;
2292 }
2293 else
2294 {
2295 powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_HIGH;
2296
2297 switch (args->flags & IW_POWER_TYPE) {
2298 case 0:
2299 /* not specified */
2300 break;
2301 case IW_POWER_PERIOD:
2302 listen_interval = args->value / 1000;
2303 break;
2304 default:
2305 return -EINVAL;
2306 }
2307
2308 switch (args->flags & IW_POWER_MODE) {
2309 case 0:
2310 /* not specified */
2311 break;
2312 case IW_POWER_UNICAST_R:
2313 /* not interested in broadcast packets */
2314 wake_for_dtim = 0;
2315 break;
2316 case IW_POWER_ALL_R:
2317 /* yes, we are interested in broadcast packets */
2318 wake_for_dtim = 1;
2319 break;
2320 default:
2321 return -EINVAL;
2322 }
2323 }
2324
2325 if (listen_interval > 0) {
2326 powerConfig.listenIntervalTu = listen_interval;
2327 unifi_trace(priv, UDBG4, "unifi_siwpower: new Listen Interval = %d.\n",
2328 powerConfig.listenIntervalTu);
2329 }
2330
2331 if (wake_for_dtim >= 0) {
2332 powerConfig.rxDtims = wake_for_dtim;
2333 }
2334 UF_RTNL_UNLOCK();
2335 r = sme_mgt_power_config_set(priv, &powerConfig);
2336 UF_RTNL_LOCK();
2337 if (r) {
2338 unifi_error(priv, "unifi_siwpower: Set unifi_PowerConfigValue failed.\n");
2339 return r;
2340 }
2341
2342 return 0;
2343} /* unifi_siwpower() */
2344
2345
2346static int
2347unifi_giwpower(struct net_device *dev, struct iw_request_info *info,
2348 union iwreq_data *wrqu, char *extra)
2349{
2350 struct iw_param *args = &wrqu->power;
2351 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
2352 unifi_priv_t *priv = interfacePriv->privPtr;
2353 CsrWifiSmePowerConfig powerConfig;
2354 int r;
2355
2356 unifi_trace(priv, UDBG2, "unifi_giwpower\n");
2357
2358 CHECK_INITED(priv);
2359
2360 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
2361 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
2362 unifi_error(priv, "unifi_giwpower: not permitted in Mode %d\n",
2363 interfacePriv->interfaceMode);
2364 return -EPERM;
2365 }
2366
2367
2368 args->flags = 0;
2369 UF_RTNL_UNLOCK();
2370 r = sme_mgt_power_config_get(priv, &powerConfig);
2371 UF_RTNL_LOCK();
2372 if (r) {
2373 unifi_error(priv, "unifi_giwpower: Get unifi_PowerConfigValue failed.\n");
2374 return r;
2375 }
2376
2377 unifi_trace(priv, UDBG4, "unifi_giwpower: mode=%d\n",
2378 powerConfig.powerSaveLevel);
2379
2380 args->disabled = (powerConfig.powerSaveLevel == CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW);
2381 if (args->disabled) {
2382 args->flags = 0;
2383 return 0;
2384 }
2385
2386 args->value = powerConfig.listenIntervalTu * 1000;
2387 args->flags |= IW_POWER_PERIOD;
2388
2389 if (powerConfig.rxDtims) {
2390 args->flags |= IW_POWER_ALL_R;
2391 } else {
2392 args->flags |= IW_POWER_UNICAST_R;
2393 }
2394
2395 return 0;
2396} /* unifi_giwpower() */
2397
2398
2399/*
2400 * ---------------------------------------------------------------------------
2401 * unifi_siwcommit - handler for SIOCSIWCOMMIT
2402 *
2403 * Apply all the parameters that have been set.
2404 * In practice this means:
2405 * - do a scan
2406 * - join a network or start an AdHoc
2407 * - authenticate and associate.
2408 *
2409 * Arguments:
2410 * None.
2411 *
2412 * Returns:
2413 * None.
2414 * ---------------------------------------------------------------------------
2415 */
2416static int
2417unifi_siwcommit(struct net_device *dev, struct iw_request_info *info,
2418 union iwreq_data *wrqu, char *extra)
2419{
2420 return 0;
2421} /* unifi_siwcommit() */
2422
2423
2424
2425static int
2426unifi_siwmlme(struct net_device *dev, struct iw_request_info *info,
2427 union iwreq_data *wrqu, char *extra)
2428{
2429 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
2430 unifi_priv_t *priv = interfacePriv->privPtr;
2431 struct iw_mlme *mlme = (struct iw_mlme *)extra;
2432
2433 unifi_trace(priv, UDBG2, "unifi_siwmlme\n");
2434 CHECK_INITED(priv);
2435
2436 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
2437 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
2438 unifi_error(priv, "unifi_siwmlme: not permitted in Mode %d\n",
2439 interfacePriv->interfaceMode);
2440 return -EPERM;
2441 }
2442
2443
2444 switch (mlme->cmd) {
2445 case IW_MLME_DEAUTH:
2446 case IW_MLME_DISASSOC:
2447 UF_RTNL_UNLOCK();
2448 sme_mgt_disconnect(priv);
2449 UF_RTNL_LOCK();
2450 break;
2451 default:
2452 return -EOPNOTSUPP;
2453 }
2454
2455 return 0;
2456} /* unifi_siwmlme() */
2457
2458
2459/*
2460 * ---------------------------------------------------------------------------
2461 * unifi_siwgenie
2462 * unifi_giwgenie
2463 *
2464 * WPA : Generic IEEE 802.11 information element (e.g., for WPA/RSN/WMM).
2465 * Handlers for SIOCSIWGENIE, SIOCGIWGENIE - set/get generic IE
2466 *
2467 * The host program (e.g. wpa_supplicant) uses this call to set the
2468 * additional IEs to accompany the next (Associate?) request.
2469 *
2470 * Arguments:
2471 * None.
2472 *
2473 * Returns:
2474 * None.
2475 * Notes:
2476 * From wireless.h:
2477 * This ioctl uses struct iw_point and data buffer that includes IE id
2478 * and len fields. More than one IE may be included in the
2479 * request. Setting the generic IE to empty buffer (len=0) removes the
2480 * generic IE from the driver.
2481 * ---------------------------------------------------------------------------
2482 */
2483static int
2484unifi_siwgenie(struct net_device *dev, struct iw_request_info *info,
2485 union iwreq_data *wrqu, char *extra)
2486{
2487 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
2488 unifi_priv_t *priv = interfacePriv->privPtr;
2489 int len;
2490
2491 unifi_trace(priv, UDBG2, "unifi_siwgenie\n");
2492
2493 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
2494 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
2495 unifi_error(priv, "unifi_siwgenie: not permitted in Mode %d\n",
2496 interfacePriv->interfaceMode);
2497 return -EPERM;
2498 }
2499
2500
2501 if ( priv->connection_config.mlmeAssociateReqInformationElements) {
2502 kfree( priv->connection_config.mlmeAssociateReqInformationElements);
2503 }
2504 priv->connection_config.mlmeAssociateReqInformationElementsLength = 0;
2505 priv->connection_config.mlmeAssociateReqInformationElements = NULL;
2506
2507 len = wrqu->data.length;
2508 if (len == 0) {
2509 return 0;
2510 }
2511
2512 priv->connection_config.mlmeAssociateReqInformationElements = kmalloc(len, GFP_KERNEL);
2513 if (priv->connection_config.mlmeAssociateReqInformationElements == NULL) {
2514 return -ENOMEM;
2515 }
2516
2517 priv->connection_config.mlmeAssociateReqInformationElementsLength = len;
2518 memcpy( priv->connection_config.mlmeAssociateReqInformationElements, extra, len);
2519
2520 return 0;
2521} /* unifi_siwgenie() */
2522
2523
2524static int
2525unifi_giwgenie(struct net_device *dev, struct iw_request_info *info,
2526 union iwreq_data *wrqu, char *extra)
2527{
2528 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
2529 unifi_priv_t *priv = interfacePriv->privPtr;
2530 int len;
2531
2532 unifi_trace(priv, UDBG2, "unifi_giwgenie\n");
2533
2534 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
2535 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
2536 unifi_error(priv, "unifi_giwgenie: not permitted in Mode %d\n",
2537 interfacePriv->interfaceMode);
2538 return -EPERM;
2539 }
2540
2541
2542 len = priv->connection_config.mlmeAssociateReqInformationElementsLength;
2543
2544 if (len == 0) {
2545 wrqu->data.length = 0;
2546 return 0;
2547 }
2548
2549 if (wrqu->data.length < len) {
2550 return -E2BIG;
2551 }
2552
2553 wrqu->data.length = len;
2554 memcpy(extra, priv->connection_config.mlmeAssociateReqInformationElements, len);
2555
2556 return 0;
2557} /* unifi_giwgenie() */
2558
2559
2560/*
2561 * ---------------------------------------------------------------------------
2562 * unifi_siwauth
2563 * unifi_giwauth
2564 *
2565 * Handlers for SIOCSIWAUTH, SIOCGIWAUTH
2566 * Set/get various authentication parameters.
2567 *
2568 * Arguments:
2569 *
2570 *
2571 * Returns:
2572 * None.
2573 * ---------------------------------------------------------------------------
2574 */
2575static int
2576_unifi_siwauth(struct net_device *dev, struct iw_request_info *info,
2577 union iwreq_data *wrqu, char *extra)
2578{
2579 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
2580 unifi_priv_t *priv = interfacePriv->privPtr;
2581 CsrWifiSmeAuthModeMask new_auth;
2582
2583 unifi_trace(priv, UDBG2, "unifi_siwauth\n");
2584
2585 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
2586 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
2587 unifi_error(priv, "unifi_siwauth: not permitted in Mode %d\n",
2588 interfacePriv->interfaceMode);
2589 return -EPERM;
2590 }
2591
2592
2593 /*
2594 * This ioctl is safe to call even when UniFi is powered off.
2595 * wpa_supplicant calls it to test whether we support WPA.
2596 */
2597
2598 switch (wrqu->param.flags & IW_AUTH_INDEX) {
2599
2600 case IW_AUTH_WPA_ENABLED:
2601 unifi_trace(priv, UDBG1, "IW_AUTH_WPA_ENABLED: %d\n", wrqu->param.value);
2602
2603 if (wrqu->param.value == 0) {
2604 unifi_trace(priv, UDBG5, "IW_AUTH_WPA_ENABLED: CSR_WIFI_SME_AUTH_MODE_80211_OPEN\n");
2605 priv->connection_config.authModeMask = CSR_WIFI_SME_AUTH_MODE_80211_OPEN;
2606 }
2607 break;
2608
2609 case IW_AUTH_PRIVACY_INVOKED:
2610 unifi_trace(priv, UDBG1, "IW_AUTH_PRIVACY_INVOKED: %d\n", wrqu->param.value);
2611
2612 priv->connection_config.privacyMode = wrqu->param.value ? CSR_WIFI_SME_80211_PRIVACY_MODE_ENABLED : CSR_WIFI_SME_80211_PRIVACY_MODE_DISABLED;
2613 if (wrqu->param.value == CSR_WIFI_SME_80211_PRIVACY_MODE_DISABLED)
2614 {
2615 priv->connection_config.encryptionModeMask = CSR_WIFI_SME_ENCRYPTION_CIPHER_NONE;
2616 }
2617 break;
2618
2619 case IW_AUTH_80211_AUTH_ALG:
2620 /*
2621 IW_AUTH_ALG_OPEN_SYSTEM 0x00000001
2622 IW_AUTH_ALG_SHARED_KEY 0x00000002
2623 IW_AUTH_ALG_LEAP 0x00000004
2624 */
2625 new_auth = 0;
2626 if (wrqu->param.value & IW_AUTH_ALG_OPEN_SYSTEM) {
2627 unifi_trace(priv, UDBG1, "IW_AUTH_80211_AUTH_ALG: %d (IW_AUTH_ALG_OPEN_SYSTEM)\n", wrqu->param.value);
2628 new_auth |= CSR_WIFI_SME_AUTH_MODE_80211_OPEN;
2629 }
2630 if (wrqu->param.value & IW_AUTH_ALG_SHARED_KEY) {
2631 unifi_trace(priv, UDBG1, "IW_AUTH_80211_AUTH_ALG: %d (IW_AUTH_ALG_SHARED_KEY)\n", wrqu->param.value);
2632 new_auth |= CSR_WIFI_SME_AUTH_MODE_80211_SHARED;
2633 }
2634 if (wrqu->param.value & IW_AUTH_ALG_LEAP) {
2635 /* Initial exchanges using open-system to set EAP */
2636 unifi_trace(priv, UDBG1, "IW_AUTH_80211_AUTH_ALG: %d (IW_AUTH_ALG_LEAP)\n", wrqu->param.value);
2637 new_auth |= CSR_WIFI_SME_AUTH_MODE_8021X_OTHER1X;
2638 }
2639 if (new_auth == 0) {
2640 unifi_trace(priv, UDBG1, "IW_AUTH_80211_AUTH_ALG: invalid value %d\n",
2641 wrqu->param.value);
2642 return -EINVAL;
2643 } else {
2644 priv->connection_config.authModeMask = new_auth;
2645 }
2646 break;
2647
2648 case IW_AUTH_WPA_VERSION:
2649 unifi_trace(priv, UDBG1, "IW_AUTH_WPA_VERSION: %d\n", wrqu->param.value);
2650 priv->ignore_bssid_join = TRUE;
2651 /*
2652 IW_AUTH_WPA_VERSION_DISABLED 0x00000001
2653 IW_AUTH_WPA_VERSION_WPA 0x00000002
2654 IW_AUTH_WPA_VERSION_WPA2 0x00000004
2655 */
2656
2657 if (!(wrqu->param.value & IW_AUTH_WPA_VERSION_DISABLED)) {
2658
2659 priv->connection_config.authModeMask = CSR_WIFI_SME_AUTH_MODE_80211_OPEN;
2660
2661 if (wrqu->param.value & IW_AUTH_WPA_VERSION_WPA) {
2662 unifi_trace(priv, UDBG4, "IW_AUTH_WPA_VERSION: WPA, WPA-PSK\n");
2663 priv->connection_config.authModeMask |= (CSR_WIFI_SME_AUTH_MODE_8021X_WPA | CSR_WIFI_SME_AUTH_MODE_8021X_WPAPSK);
2664 }
2665 if (wrqu->param.value & IW_AUTH_WPA_VERSION_WPA2) {
2666 unifi_trace(priv, UDBG4, "IW_AUTH_WPA_VERSION: WPA2, WPA2-PSK\n");
2667 priv->connection_config.authModeMask |= (CSR_WIFI_SME_AUTH_MODE_8021X_WPA2 | CSR_WIFI_SME_AUTH_MODE_8021X_WPA2PSK);
2668 }
2669 }
2670 break;
2671
2672 case IW_AUTH_CIPHER_PAIRWISE:
2673 unifi_trace(priv, UDBG1, "IW_AUTH_CIPHER_PAIRWISE: %d\n", wrqu->param.value);
2674 /*
2675 * one of:
2676 IW_AUTH_CIPHER_NONE 0x00000001
2677 IW_AUTH_CIPHER_WEP40 0x00000002
2678 IW_AUTH_CIPHER_TKIP 0x00000004
2679 IW_AUTH_CIPHER_CCMP 0x00000008
2680 IW_AUTH_CIPHER_WEP104 0x00000010
2681 */
2682
2683 priv->connection_config.encryptionModeMask = CSR_WIFI_SME_ENCRYPTION_CIPHER_NONE;
2684
2685 if (wrqu->param.value & IW_AUTH_CIPHER_WEP40) {
2686 priv->connection_config.encryptionModeMask |=
2687 CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP40 | CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP40;
2688 }
2689 if (wrqu->param.value & IW_AUTH_CIPHER_WEP104) {
2690 priv->connection_config.encryptionModeMask |=
2691 CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_WEP104 | CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP104;
2692 }
2693 if (wrqu->param.value & IW_AUTH_CIPHER_TKIP) {
2694 priv->connection_config.encryptionModeMask |=
2695 CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_TKIP | CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_TKIP;
2696 }
2697 if (wrqu->param.value & IW_AUTH_CIPHER_CCMP) {
2698 priv->connection_config.encryptionModeMask |=
2699 CSR_WIFI_SME_ENCRYPTION_CIPHER_PAIRWISE_CCMP | CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_CCMP;
2700 }
2701
2702 break;
2703
2704 case IW_AUTH_CIPHER_GROUP:
2705 unifi_trace(priv, UDBG1, "IW_AUTH_CIPHER_GROUP: %d\n", wrqu->param.value);
2706 /*
2707 * Use the WPA version and the group cipher suite to set the permitted
2708 * group key in the MIB. f/w uses this value to validate WPA and RSN IEs
2709 * in the probe responses from the desired BSS(ID)
2710 */
2711
2712 priv->connection_config.encryptionModeMask &= ~(CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP40 |
2713 CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP104 |
2714 CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_TKIP |
2715 CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_CCMP);
2716 if (wrqu->param.value & IW_AUTH_CIPHER_WEP40) {
2717 priv->connection_config.encryptionModeMask |= CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP40;
2718 }
2719 if (wrqu->param.value & IW_AUTH_CIPHER_WEP104) {
2720 priv->connection_config.encryptionModeMask |= CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_WEP104;
2721 }
2722 if (wrqu->param.value & IW_AUTH_CIPHER_TKIP) {
2723 priv->connection_config.encryptionModeMask |= CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_TKIP;
2724 }
2725 if (wrqu->param.value & IW_AUTH_CIPHER_CCMP) {
2726 priv->connection_config.encryptionModeMask |= CSR_WIFI_SME_ENCRYPTION_CIPHER_GROUP_CCMP;
2727 }
2728
2729 break;
2730
2731 case IW_AUTH_KEY_MGMT:
2732 unifi_trace(priv, UDBG1, "IW_AUTH_KEY_MGMT: %d\n", wrqu->param.value);
2733 /*
2734 IW_AUTH_KEY_MGMT_802_1X 1
2735 IW_AUTH_KEY_MGMT_PSK 2
2736 */
2737 if (priv->connection_config.authModeMask & (CSR_WIFI_SME_AUTH_MODE_8021X_WPA | CSR_WIFI_SME_AUTH_MODE_8021X_WPAPSK)) {
2738 /* Check for explicitly set mode. */
2739 if (wrqu->param.value == IW_AUTH_KEY_MGMT_802_1X) {
2740 priv->connection_config.authModeMask &= ~CSR_WIFI_SME_AUTH_MODE_8021X_WPAPSK;
2741 }
2742 if (wrqu->param.value == IW_AUTH_KEY_MGMT_PSK) {
2743 priv->connection_config.authModeMask &= ~CSR_WIFI_SME_AUTH_MODE_8021X_WPA;
2744 }
2745 unifi_trace(priv, UDBG5, "IW_AUTH_KEY_MGMT: WPA: %d\n",
2746 priv->connection_config.authModeMask);
2747 }
2748 if (priv->connection_config.authModeMask & (CSR_WIFI_SME_AUTH_MODE_8021X_WPA2 | CSR_WIFI_SME_AUTH_MODE_8021X_WPA2PSK)) {
2749 /* Check for explicitly set mode. */
2750 if (wrqu->param.value == IW_AUTH_KEY_MGMT_802_1X) {
2751 priv->connection_config.authModeMask &= ~CSR_WIFI_SME_AUTH_MODE_8021X_WPA2PSK;
2752 }
2753 if (wrqu->param.value == IW_AUTH_KEY_MGMT_PSK) {
2754 priv->connection_config.authModeMask &= ~CSR_WIFI_SME_AUTH_MODE_8021X_WPA2;
2755 }
2756 unifi_trace(priv, UDBG5, "IW_AUTH_KEY_MGMT: WPA2: %d\n",
2757 priv->connection_config.authModeMask);
2758 }
2759
2760 break;
2761 case IW_AUTH_TKIP_COUNTERMEASURES:
2762 /*
2763 * Set to true at the start of the 60 second backup-off period
2764 * following 2 MichaelMIC failures within 60s.
2765 */
2766 unifi_trace(priv, UDBG1, "IW_AUTH_TKIP_COUNTERMEASURES: %d\n", wrqu->param.value);
2767 break;
2768
2769 case IW_AUTH_DROP_UNENCRYPTED:
2770 /*
2771 * Set to true on init.
2772 * Set to false just before associate if encryption will not be
2773 * required.
2774 *
2775 * Note this is not the same as the 802.1X controlled port
2776 */
2777 unifi_trace(priv, UDBG1, "IW_AUTH_DROP_UNENCRYPTED: %d\n", wrqu->param.value);
2778 break;
2779
2780 case IW_AUTH_RX_UNENCRYPTED_EAPOL:
2781 /*
2782 * This is set by wpa_supplicant to allow unencrypted EAPOL messages
2783 * even if pairwise keys are set when not using WPA. IEEE 802.1X
2784 * specifies that these frames are not encrypted, but WPA encrypts
2785 * them when pairwise keys are in use.
2786 * I think the UniFi f/w handles this decision for us.
2787 */
2788 unifi_trace(priv, UDBG1, "IW_AUTH_RX_UNENCRYPTED_EAPOL: %d\n", wrqu->param.value);
2789 break;
2790
2791 case IW_AUTH_ROAMING_CONTROL:
2792 unifi_trace(priv, UDBG1, "IW_AUTH_ROAMING_CONTROL: %d\n", wrqu->param.value);
2793 break;
2794
2795 default:
2796 unifi_trace(priv, UDBG1, "Unsupported auth param %d to 0x%X\n",
2797 wrqu->param.flags & IW_AUTH_INDEX,
2798 wrqu->param.value);
2799 return -EOPNOTSUPP;
2800 }
2801
2802 unifi_trace(priv, UDBG2, "authModeMask = %d", priv->connection_config.authModeMask);
2803
2804 return 0;
2805} /* _unifi_siwauth() */
2806
2807
2808static int
2809unifi_siwauth(struct net_device *dev, struct iw_request_info *info,
2810 union iwreq_data *wrqu, char *extra)
2811{
2812 int err = 0;
2813
2814 UF_RTNL_UNLOCK();
2815 err = _unifi_siwauth(dev, info, wrqu, extra);
2816 UF_RTNL_LOCK();
2817
2818 return err;
2819} /* unifi_siwauth() */
2820
2821
2822static int
2823unifi_giwauth(struct net_device *dev, struct iw_request_info *info,
2824 union iwreq_data *wrqu, char *extra)
2825{
2826 unifi_trace(NULL, UDBG2, "unifi_giwauth\n");
2827 return -EOPNOTSUPP;
2828} /* unifi_giwauth() */
2829
2830/*
2831 * ---------------------------------------------------------------------------
2832 * unifi_siwencodeext
2833 * unifi_giwencodeext
2834 *
2835 * Handlers for SIOCSIWENCODEEXT, SIOCGIWENCODEEXT - set/get
2836 * encoding token & mode
2837 *
2838 * Arguments:
2839 * None.
2840 *
2841 * Returns:
2842 * None.
2843 *
2844 * Notes:
2845 * For WPA/WPA2 we don't take note of the IW_ENCODE_EXT_SET_TX_KEY flag.
2846 * This flag means "use this key to encode transmissions"; we just
2847 * assume only one key will be set and that is the one to use.
2848 * ---------------------------------------------------------------------------
2849 */
2850static int
2851_unifi_siwencodeext(struct net_device *dev, struct iw_request_info *info,
2852 union iwreq_data *wrqu, char *extra)
2853{
2854 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
2855 unifi_priv_t *priv = interfacePriv->privPtr;
2856 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
2857 int r = 0;
2858 unsigned char *keydata;
2859 unsigned char tkip_key[32];
2860 int keyid;
2861 unsigned char *a = (unsigned char *)ext->addr.sa_data;
2862 CsrWifiSmeKey sme_key;
2863 CsrWifiSmeKeyType key_type;
2864
2865 CHECK_INITED(priv);
2866
2867 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
2868 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
2869 unifi_error(priv, "unifi_siwencodeext: not permitted in Mode %d\n",
2870 interfacePriv->interfaceMode);
2871 return -EPERM;
2872 }
2873
2874
2875 unifi_trace(priv, UDBG1, "siwencodeext: flags=0x%X, alg=%d, ext_flags=0x%X, len=%d, index=%d,\n",
2876 wrqu->encoding.flags, ext->alg, ext->ext_flags,
2877 ext->key_len, (wrqu->encoding.flags & IW_ENCODE_INDEX));
2878 unifi_trace(priv, UDBG3, " addr=%pM\n", a);
2879
2880 if ((ext->key_len == 0) && (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)) {
2881 /* This means use a different key (given by key_idx) for Tx. */
2882 /* NYI */
2883 unifi_trace(priv, UDBG1, KERN_ERR "unifi_siwencodeext: NYI should change tx key id here!!\n");
2884 return -ENOTSUPP;
2885 }
2886
2887 memset(&sme_key, 0, sizeof(sme_key));
2888
2889 keydata = (unsigned char *)(ext + 1);
2890 keyid = (wrqu->encoding.flags & IW_ENCODE_INDEX);
2891
2892 /*
2893 * Check for request to delete keys for an address.
2894 */
2895 /* Pick out request for no privacy. */
2896 if (ext->alg == IW_ENCODE_ALG_NONE) {
2897
2898 unifi_trace(priv, UDBG1, "Deleting %s key %d\n",
2899 (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) ? "GROUP" : "PAIRWISE",
2900 keyid);
2901
2902 if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
2903 sme_key.keyType = CSR_WIFI_SME_KEY_TYPE_GROUP;
2904 } else {
2905 sme_key.keyType = CSR_WIFI_SME_KEY_TYPE_PAIRWISE;
2906 }
2907 sme_key.keyIndex = (keyid - 1);
2908 sme_key.keyLength = 0;
2909 sme_key.authenticator = 0;
2910 memcpy(sme_key.address.a, a, ETH_ALEN);
2911 UF_RTNL_UNLOCK();
2912 r = sme_mgt_key(priv, &sme_key, CSR_WIFI_SME_LIST_ACTION_REMOVE);
2913 UF_RTNL_LOCK();
2914 if (r) {
2915 unifi_error(priv, "Delete key request was rejected with result %d\n", r);
2916 return convert_sme_error(r);
2917 }
2918
2919 return 0;
2920 }
2921
2922 /*
2923 * Request is to set a key, not delete
2924 */
2925
2926 /* Pick out WEP and use set_wep_key(). */
2927 if (ext->alg == IW_ENCODE_ALG_WEP) {
2928 /* WEP-40, WEP-104 */
2929
2930 /* Check for valid key length */
2931 if (!((ext->key_len == 5) || (ext->key_len == 13))) {
2932 unifi_trace(priv, UDBG1, KERN_ERR "Invalid length for WEP key: %d\n", ext->key_len);
2933 return -EINVAL;
2934 }
2935
2936 unifi_trace(priv, UDBG1, "Setting WEP key %d tx:%d\n",
2937 keyid, ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY);
2938
2939 if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
2940 sme_key.wepTxKey = TRUE;
2941 sme_key.keyType = CSR_WIFI_SME_KEY_TYPE_PAIRWISE;
2942 } else {
2943 sme_key.wepTxKey = FALSE;
2944 sme_key.keyType = CSR_WIFI_SME_KEY_TYPE_GROUP;
2945 }
2946 sme_key.keyIndex = (keyid - 1);
2947 sme_key.keyLength = ext->key_len;
2948 sme_key.authenticator = 0;
2949 memset(sme_key.address.a, 0xFF, ETH_ALEN);
2950 memcpy(sme_key.key, keydata, ext->key_len);
2951 UF_RTNL_UNLOCK();
2952 r = sme_mgt_key(priv, &sme_key, CSR_WIFI_SME_LIST_ACTION_ADD);
2953 UF_RTNL_LOCK();
2954 if (r) {
2955 unifi_error(priv, "siwencodeext: Set key failed (%d)", r);
2956 return convert_sme_error(r);
2957 }
2958
2959 return 0;
2960 }
2961
2962 /*
2963 *
2964 * If we reach here, we are dealing with a WPA/WPA2 key
2965 *
2966 */
2967 if (ext->key_len > 32) {
2968 return -EINVAL;
2969 }
2970
2971 /*
2972 * TKIP keys from wpa_supplicant need swapping.
2973 * What about other supplicants (when they come along)?
2974 */
2975 if ((ext->alg == IW_ENCODE_ALG_TKIP) && (ext->key_len == 32)) {
2976 memcpy(tkip_key, keydata, 16);
2977 memcpy(tkip_key + 16, keydata + 24, 8);
2978 memcpy(tkip_key + 24, keydata + 16, 8);
2979 keydata = tkip_key;
2980 }
2981
2982 key_type = (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) ?
2983 CSR_WIFI_SME_KEY_TYPE_GROUP : /* Group Key */
2984 CSR_WIFI_SME_KEY_TYPE_PAIRWISE; /* Pairwise Key */
2985
2986 sme_key.keyType = key_type;
2987 sme_key.keyIndex = (keyid - 1);
2988 sme_key.keyLength = ext->key_len;
2989 sme_key.authenticator = 0;
2990 memcpy(sme_key.address.a, ext->addr.sa_data, ETH_ALEN);
2991 if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) {
2992
2993 unifi_trace(priv, UDBG5, "RSC first 6 bytes = %*phC\n",
2994 6, ext->rx_seq);
2995
2996 /* memcpy((u8*)(&sme_key.keyRsc), ext->rx_seq, 8); */
2997 sme_key.keyRsc[0] = ext->rx_seq[1] << 8 | ext->rx_seq[0];
2998 sme_key.keyRsc[1] = ext->rx_seq[3] << 8 | ext->rx_seq[2];
2999 sme_key.keyRsc[2] = ext->rx_seq[5] << 8 | ext->rx_seq[4];
3000 sme_key.keyRsc[3] = ext->rx_seq[7] << 8 | ext->rx_seq[6];
3001
3002 }
3003
3004 memcpy(sme_key.key, keydata, ext->key_len);
3005 UF_RTNL_UNLOCK();
3006 r = sme_mgt_key(priv, &sme_key, CSR_WIFI_SME_LIST_ACTION_ADD);
3007 UF_RTNL_LOCK();
3008 if (r) {
3009 unifi_error(priv, "SETKEYS request was rejected with result %d\n", r);
3010 return convert_sme_error(r);
3011 }
3012
3013 return r;
3014} /* _unifi_siwencodeext() */
3015
3016
3017static int
3018unifi_siwencodeext(struct net_device *dev, struct iw_request_info *info,
3019 union iwreq_data *wrqu, char *extra)
3020{
3021 int err = 0;
3022
3023 err = _unifi_siwencodeext(dev, info, wrqu, extra);
3024
3025 return err;
3026} /* unifi_siwencodeext() */
3027
3028
3029static int
3030unifi_giwencodeext(struct net_device *dev, struct iw_request_info *info,
3031 union iwreq_data *wrqu, char *extra)
3032{
3033 return -EOPNOTSUPP;
3034} /* unifi_giwencodeext() */
3035
3036
3037/*
3038 * ---------------------------------------------------------------------------
3039 * unifi_siwpmksa
3040 *
3041 * SIOCSIWPMKSA - PMKSA cache operation
3042 * The caller passes a pmksa structure:
3043 * - cmd one of ADD, REMOVE, FLUSH
3044 * - bssid MAC address
3045 * - pmkid ID string (16 bytes)
3046 *
3047 * Arguments:
3048 * None.
3049 *
3050 * Returns:
3051 * None.
3052 *
3053 * Notes:
3054 * This is not needed since we provide a siwgenie method.
3055 * ---------------------------------------------------------------------------
3056 */
3057#define UNIFI_PMKID_KEY_SIZE 16
3058static int
3059unifi_siwpmksa(struct net_device *dev, struct iw_request_info *info,
3060 union iwreq_data *wrqu, char *extra)
3061{
3062 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
3063 unifi_priv_t *priv = interfacePriv->privPtr;
3064 struct iw_pmksa *pmksa = (struct iw_pmksa *)extra;
3065 CsrResult r = 0;
3066 CsrWifiSmePmkidList pmkid_list;
3067 CsrWifiSmePmkid pmkid;
3068 CsrWifiSmeListAction action;
3069
3070 CHECK_INITED(priv);
3071
3072 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
3073 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
3074 unifi_error(priv, "unifi_siwpmksa: not permitted in Mode %d\n",
3075 interfacePriv->interfaceMode);
3076 return -EPERM;
3077 }
3078
3079
3080 unifi_trace(priv, UDBG1, "SIWPMKSA: cmd %d, %pM\n", pmksa->cmd,
3081 pmksa->bssid.sa_data);
3082
3083 pmkid_list.pmkids = NULL;
3084 switch (pmksa->cmd) {
3085 case IW_PMKSA_ADD:
3086 pmkid_list.pmkids = &pmkid;
3087 action = CSR_WIFI_SME_LIST_ACTION_ADD;
3088 pmkid_list.pmkidsCount = 1;
3089 memcpy(pmkid.bssid.a, pmksa->bssid.sa_data, ETH_ALEN);
3090 memcpy(pmkid.pmkid, pmksa->pmkid, UNIFI_PMKID_KEY_SIZE);
3091 break;
3092 case IW_PMKSA_REMOVE:
3093 pmkid_list.pmkids = &pmkid;
3094 action = CSR_WIFI_SME_LIST_ACTION_REMOVE;
3095 pmkid_list.pmkidsCount = 1;
3096 memcpy(pmkid.bssid.a, pmksa->bssid.sa_data, ETH_ALEN);
3097 memcpy(pmkid.pmkid, pmksa->pmkid, UNIFI_PMKID_KEY_SIZE);
3098 break;
3099 case IW_PMKSA_FLUSH:
3100 /* Replace current PMKID's with an empty list */
3101 pmkid_list.pmkidsCount = 0;
3102 action = CSR_WIFI_SME_LIST_ACTION_FLUSH;
3103 break;
3104 default:
3105 unifi_notice(priv, "SIWPMKSA: Unknown command (0x%x)\n", pmksa->cmd);
3106 return -EINVAL;
3107 }
3108
3109 /* Set the Value the pmkid's will have 1 added OR 1 removed OR be cleared at this point */
3110 UF_RTNL_UNLOCK();
3111 r = sme_mgt_pmkid(priv, action, &pmkid_list);
3112 UF_RTNL_LOCK();
3113 if (r) {
3114 unifi_error(priv, "SIWPMKSA: Set PMKID's Failed.\n");
3115 }
3116
3117 return r;
3118
3119} /* unifi_siwpmksa() */
3120
3121
3122/*
3123 * ---------------------------------------------------------------------------
3124 * unifi_get_wireless_stats
3125 *
3126 * get_wireless_stats method for Linux wireless extensions.
3127 *
3128 * Arguments:
3129 * dev Pointer to associated netdevice.
3130 *
3131 * Returns:
3132 * Pointer to iw_statistics struct.
3133 * ---------------------------------------------------------------------------
3134 */
3135struct iw_statistics *
3136unifi_get_wireless_stats(struct net_device *dev)
3137{
3138 netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
3139 unifi_priv_t *priv = interfacePriv->privPtr;
3140
3141 if (priv->init_progress != UNIFI_INIT_COMPLETED) {
3142 return NULL;
3143 }
3144
3145 return &priv->wext_wireless_stats;
3146} /* unifi_get_wireless_stats() */
3147
3148
3149/*
3150 * Structures to export the Wireless Handlers
3151 */
3152
3153static const struct iw_priv_args unifi_private_args[] = {
3154 /*{ cmd, set_args, get_args, name } */
3155 { SIOCIWS80211POWERSAVEPRIV, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1,
3156 IW_PRIV_TYPE_NONE, "iwprivs80211ps" },
3157 { SIOCIWG80211POWERSAVEPRIV, IW_PRIV_TYPE_NONE,
3158 IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IWPRIV_POWER_SAVE_MAX_STRING, "iwprivg80211ps" },
3159 { SIOCIWS80211RELOADDEFAULTSPRIV, IW_PRIV_TYPE_NONE,
3160 IW_PRIV_TYPE_NONE, "iwprivsdefs" },
3161 { SIOCIWSSMEDEBUGPRIV, IW_PRIV_TYPE_CHAR | IWPRIV_SME_DEBUG_MAX_STRING, IW_PRIV_TYPE_NONE, "iwprivssmedebug" },
3162#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
3163 { SIOCIWSCONFWAPIPRIV, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1,
3164 IW_PRIV_TYPE_NONE, "iwprivsconfwapi" },
3165 { SIOCIWSWAPIKEYPRIV, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | sizeof(unifiio_wapi_key_t),
3166 IW_PRIV_TYPE_NONE, "iwprivswpikey" },
3167#endif
3168#ifdef CSR_SUPPORT_WEXT_AP
3169 { SIOCIWSAPCFGPRIV, IW_PRIV_TYPE_CHAR | 256, IW_PRIV_TYPE_NONE, "AP_SET_CFG" },
3170 { SIOCIWSAPSTARTPRIV, 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED|IWPRIV_SME_MAX_STRING, "AP_BSS_START" },
3171 { SIOCIWSAPSTOPPRIV, IW_PRIV_TYPE_CHAR |IW_PRIV_SIZE_FIXED|0,
3172 IW_PRIV_TYPE_CHAR |IW_PRIV_SIZE_FIXED|0, "AP_BSS_STOP" },
3173#ifdef ANDROID_BUILD
3174 { SIOCIWSFWRELOADPRIV, IW_PRIV_TYPE_CHAR |256,
3175 IW_PRIV_TYPE_CHAR |IW_PRIV_SIZE_FIXED|0, "WL_FW_RELOAD" },
3176 { SIOCIWSSTACKSTART, 0,
3177 IW_PRIV_TYPE_CHAR |IW_PRIV_SIZE_FIXED|IWPRIV_SME_MAX_STRING, "START" },
3178 { SIOCIWSSTACKSTOP, 0,
3179 IW_PRIV_TYPE_CHAR |IW_PRIV_SIZE_FIXED|IWPRIV_SME_MAX_STRING, "STOP" },
3180#endif /* ANDROID_BUILD */
3181#endif /* CSR_SUPPORT_WEXT_AP */
3182};
3183
3184static const iw_handler unifi_handler[] =
3185{
3186 (iw_handler) unifi_siwcommit, /* SIOCSIWCOMMIT */
3187 (iw_handler) unifi_giwname, /* SIOCGIWNAME */
3188 (iw_handler) NULL, /* SIOCSIWNWID */
3189 (iw_handler) NULL, /* SIOCGIWNWID */
3190 (iw_handler) unifi_siwfreq, /* SIOCSIWFREQ */
3191 (iw_handler) unifi_giwfreq, /* SIOCGIWFREQ */
3192 (iw_handler) unifi_siwmode, /* SIOCSIWMODE */
3193 (iw_handler) unifi_giwmode, /* SIOCGIWMODE */
3194 (iw_handler) NULL, /* SIOCSIWSENS */
3195 (iw_handler) NULL, /* SIOCGIWSENS */
3196 (iw_handler) NULL, /* SIOCSIWRANGE */
3197 (iw_handler) unifi_giwrange, /* SIOCGIWRANGE */
3198 (iw_handler) NULL, /* SIOCSIWPRIV */
3199 (iw_handler) NULL, /* SIOCGIWPRIV */
3200 (iw_handler) NULL, /* SIOCSIWSTATS */
3201 (iw_handler) NULL, /* SIOCGIWSTATS */
3202 (iw_handler) NULL, /* SIOCSIWSPY */
3203 (iw_handler) NULL, /* SIOCGIWSPY */
3204 (iw_handler) NULL, /* SIOCSIWTHRSPY */
3205 (iw_handler) NULL, /* SIOCGIWTHRSPY */
3206 (iw_handler) unifi_siwap, /* SIOCSIWAP */
3207 (iw_handler) unifi_giwap, /* SIOCGIWAP */
3208#if WIRELESS_EXT > 17
3209 /* WPA : IEEE 802.11 MLME requests */
3210 unifi_siwmlme, /* SIOCSIWMLME, request MLME operation */
3211#else
3212 (iw_handler) NULL, /* -- hole -- */
3213#endif
3214 (iw_handler) NULL, /* SIOCGIWAPLIST */
3215 (iw_handler) unifi_siwscan, /* SIOCSIWSCAN */
3216 (iw_handler) unifi_giwscan, /* SIOCGIWSCAN */
3217 (iw_handler) unifi_siwessid, /* SIOCSIWESSID */
3218 (iw_handler) unifi_giwessid, /* SIOCGIWESSID */
3219 (iw_handler) NULL, /* SIOCSIWNICKN */
3220 (iw_handler) NULL, /* SIOCGIWNICKN */
3221 (iw_handler) NULL, /* -- hole -- */
3222 (iw_handler) NULL, /* -- hole -- */
3223 unifi_siwrate, /* SIOCSIWRATE */
3224 unifi_giwrate, /* SIOCGIWRATE */
3225 unifi_siwrts, /* SIOCSIWRTS */
3226 unifi_giwrts, /* SIOCGIWRTS */
3227 unifi_siwfrag, /* SIOCSIWFRAG */
3228 unifi_giwfrag, /* SIOCGIWFRAG */
3229 (iw_handler) NULL, /* SIOCSIWTXPOW */
3230 (iw_handler) NULL, /* SIOCGIWTXPOW */
3231 (iw_handler) NULL, /* SIOCSIWRETRY */
3232 (iw_handler) NULL, /* SIOCGIWRETRY */
3233 unifi_siwencode, /* SIOCSIWENCODE */
3234 unifi_giwencode, /* SIOCGIWENCODE */
3235 unifi_siwpower, /* SIOCSIWPOWER */
3236 unifi_giwpower, /* SIOCGIWPOWER */
3237#if WIRELESS_EXT > 17
3238 (iw_handler) NULL, /* -- hole -- */
3239 (iw_handler) NULL, /* -- hole -- */
3240
3241 /* WPA : Generic IEEE 802.11 informatiom element (e.g., for WPA/RSN/WMM). */
3242 unifi_siwgenie, /* SIOCSIWGENIE */ /* set generic IE */
3243 unifi_giwgenie, /* SIOCGIWGENIE */ /* get generic IE */
3244
3245 /* WPA : Authentication mode parameters */
3246 unifi_siwauth, /* SIOCSIWAUTH */ /* set authentication mode params */
3247 unifi_giwauth, /* SIOCGIWAUTH */ /* get authentication mode params */
3248
3249 /* WPA : Extended version of encoding configuration */
3250 unifi_siwencodeext, /* SIOCSIWENCODEEXT */ /* set encoding token & mode */
3251 unifi_giwencodeext, /* SIOCGIWENCODEEXT */ /* get encoding token & mode */
3252
3253 /* WPA2 : PMKSA cache management */
3254 unifi_siwpmksa, /* SIOCSIWPMKSA */ /* PMKSA cache operation */
3255 (iw_handler) NULL, /* -- hole -- */
3256#endif /* WIRELESS_EXT > 17 */
3257};
3258
3259
3260static const iw_handler unifi_private_handler[] =
3261{
3262 iwprivs80211ps, /* SIOCIWFIRSTPRIV */
3263 iwprivg80211ps, /* SIOCIWFIRSTPRIV + 1 */
3264 iwprivsdefs, /* SIOCIWFIRSTPRIV + 2 */
3265 (iw_handler) NULL,
3266#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
3267 iwprivsconfwapi, /* SIOCIWFIRSTPRIV + 4 */
3268 (iw_handler) NULL, /* SIOCIWFIRSTPRIV + 5 */
3269 iwprivswpikey, /* SIOCIWFIRSTPRIV + 6 */
3270#else
3271 (iw_handler) NULL,
3272 (iw_handler) NULL,
3273 (iw_handler) NULL,
3274#endif
3275 (iw_handler) NULL,
3276 iwprivssmedebug, /* SIOCIWFIRSTPRIV + 8 */
3277#ifdef CSR_SUPPORT_WEXT_AP
3278 (iw_handler) NULL,
3279 iwprivsapconfig,
3280 (iw_handler) NULL,
3281 iwprivsapstart,
3282 (iw_handler) NULL,
3283 iwprivsapstop,
3284 (iw_handler) NULL,
3285#ifdef ANDROID_BUILD
3286 iwprivsapfwreload,
3287 (iw_handler) NULL,
3288 iwprivsstackstart,
3289 (iw_handler) NULL,
3290 iwprivsstackstop,
3291#else
3292 (iw_handler) NULL,
3293 (iw_handler) NULL,
3294 (iw_handler) NULL,
3295 (iw_handler) NULL,
3296 (iw_handler) NULL,
3297#endif /* ANDROID_BUILD */
3298#else
3299 (iw_handler) NULL,
3300 (iw_handler) NULL,
3301 (iw_handler) NULL,
3302 (iw_handler) NULL,
3303 (iw_handler) NULL,
3304 (iw_handler) NULL,
3305 (iw_handler) NULL,
3306 (iw_handler) NULL,
3307 (iw_handler) NULL,
3308 (iw_handler) NULL,
3309 (iw_handler) NULL,
3310 (iw_handler) NULL,
3311#endif /* CSR_SUPPORT_WEXT_AP */
3312};
3313
3314struct iw_handler_def unifi_iw_handler_def =
3315{
3316 .num_standard = sizeof(unifi_handler) / sizeof(iw_handler),
3317 .num_private = sizeof(unifi_private_handler) / sizeof(iw_handler),
3318 .num_private_args = sizeof(unifi_private_args) / sizeof(struct iw_priv_args),
3319 .standard = (iw_handler *) unifi_handler,
3320 .private = (iw_handler *) unifi_private_handler,
3321 .private_args = (struct iw_priv_args *) unifi_private_args,
3322#if IW_HANDLER_VERSION >= 6
3323 .get_wireless_stats = unifi_get_wireless_stats,
3324#endif
3325};
3326
3327
diff --git a/drivers/staging/csr/ul_int.c b/drivers/staging/csr/ul_int.c
deleted file mode 100644
index eb286e5f7467..000000000000
--- a/drivers/staging/csr/ul_int.c
+++ /dev/null
@@ -1,528 +0,0 @@
1/*
2 * ***************************************************************************
3 * FILE: ul_int.c
4 *
5 * PURPOSE:
6 * Manage list of client applications using UniFi.
7 *
8 * Copyright (C) 2006-2009 by Cambridge Silicon Radio Ltd.
9 *
10 * Refer to LICENSE.txt included with this source code for details on
11 * the license terms.
12 *
13 * ***************************************************************************
14 */
15#include "csr_wifi_hip_unifi.h"
16#include "csr_wifi_hip_conversions.h"
17#include "unifi_priv.h"
18#include "unifiio.h"
19#include "unifi_os.h"
20
21static void free_bulkdata_buffers(unifi_priv_t *priv, bulk_data_param_t *bulkdata);
22static void reset_driver_status(unifi_priv_t *priv);
23
24/*
25 * ---------------------------------------------------------------------------
26 * ul_init_clients
27 *
28 * Initialise the clients array to empty.
29 *
30 * Arguments:
31 * priv Pointer to device private context struct
32 *
33 * Returns:
34 * None.
35 *
36 * Notes:
37 * This function needs to be called before priv is stored in
38 * Unifi_instances[].
39 * ---------------------------------------------------------------------------
40 */
41void
42ul_init_clients(unifi_priv_t *priv)
43{
44 int id;
45 ul_client_t *ul_clients;
46
47 sema_init(&priv->udi_logging_mutex, 1);
48 priv->logging_client = NULL;
49
50 ul_clients = priv->ul_clients;
51
52 for (id = 0; id < MAX_UDI_CLIENTS; id++) {
53 memset(&ul_clients[id], 0, sizeof(ul_client_t));
54
55 ul_clients[id].client_id = id;
56 ul_clients[id].sender_id = UDI_SENDER_ID_BASE + (id << UDI_SENDER_ID_SHIFT);
57 ul_clients[id].instance = -1;
58 ul_clients[id].event_hook = NULL;
59
60 INIT_LIST_HEAD(&ul_clients[id].udi_log);
61 init_waitqueue_head(&ul_clients[id].udi_wq);
62 sema_init(&ul_clients[id].udi_sem, 1);
63
64 ul_clients[id].wake_up_wq_id = 0;
65 ul_clients[id].seq_no = 0;
66 ul_clients[id].wake_seq_no = 0;
67 ul_clients[id].snap_filter.count = 0;
68 }
69} /* ul_init_clients() */
70
71
72/*
73 * ---------------------------------------------------------------------------
74 * ul_register_client
75 *
76 * This function registers a new ul client.
77 *
78 * Arguments:
79 * priv Pointer to device private context struct
80 * configuration Special configuration for the client.
81 * udi_event_clbk Callback for receiving event from unifi.
82 *
83 * Returns:
84 * 0 if a new clients is registered, -1 otherwise.
85 * ---------------------------------------------------------------------------
86 */
87ul_client_t *
88ul_register_client(unifi_priv_t *priv, unsigned int configuration,
89 udi_event_t udi_event_clbk)
90{
91 unsigned char id, ref;
92 ul_client_t *ul_clients;
93
94 ul_clients = priv->ul_clients;
95
96 /* check for an unused entry */
97 for (id = 0; id < MAX_UDI_CLIENTS; id++) {
98 if (ul_clients[id].udi_enabled == 0) {
99 ul_clients[id].instance = priv->instance;
100 ul_clients[id].udi_enabled = 1;
101 ul_clients[id].configuration = configuration;
102
103 /* Allocate memory for the reply signal.. */
104 ul_clients[id].reply_signal = kmalloc(sizeof(CSR_SIGNAL), GFP_KERNEL);
105 if (ul_clients[id].reply_signal == NULL) {
106 unifi_error(priv, "Failed to allocate reply signal for client.\n");
107 return NULL;
108 }
109 /* .. and the bulk data of the reply signal. */
110 for (ref = 0; ref < UNIFI_MAX_DATA_REFERENCES; ref ++) {
111 ul_clients[id].reply_bulkdata[ref] = kmalloc(sizeof(bulk_data_t), GFP_KERNEL);
112 /* If allocation fails, free allocated memory. */
113 if (ul_clients[id].reply_bulkdata[ref] == NULL) {
114 for (; ref > 0; ref --) {
115 kfree(ul_clients[id].reply_bulkdata[ref - 1]);
116 }
117 kfree(ul_clients[id].reply_signal);
118 unifi_error(priv, "Failed to allocate bulk data buffers for client.\n");
119 return NULL;
120 }
121 }
122
123 /* Set the event callback. */
124 ul_clients[id].event_hook = udi_event_clbk;
125
126 unifi_trace(priv, UDBG2, "UDI %d (0x%x) registered. configuration = 0x%x\n",
127 id, &ul_clients[id], configuration);
128 return &ul_clients[id];
129 }
130 }
131 return NULL;
132} /* ul_register_client() */
133
134
135/*
136 * ---------------------------------------------------------------------------
137 * ul_deregister_client
138 *
139 * This function deregisters a blocking UDI client.
140 *
141 * Arguments:
142 * client Pointer to the client we deregister.
143 *
144 * Returns:
145 * 0 if a new clients is deregistered.
146 * ---------------------------------------------------------------------------
147 */
148int
149ul_deregister_client(ul_client_t *ul_client)
150{
151 struct list_head *pos, *n;
152 udi_log_t *logptr;
153 unifi_priv_t *priv = uf_find_instance(ul_client->instance);
154 int ref;
155
156 ul_client->instance = -1;
157 ul_client->event_hook = NULL;
158 ul_client->udi_enabled = 0;
159 unifi_trace(priv, UDBG5, "UDI (0x%x) deregistered.\n", ul_client);
160
161 /* Free memory allocated for the reply signal and its bulk data. */
162 kfree(ul_client->reply_signal);
163 for (ref = 0; ref < UNIFI_MAX_DATA_REFERENCES; ref ++) {
164 kfree(ul_client->reply_bulkdata[ref]);
165 }
166
167 if (ul_client->snap_filter.count) {
168 ul_client->snap_filter.count = 0;
169 kfree(ul_client->snap_filter.protocols);
170 }
171
172 /* Free anything pending on the udi_log list */
173 down(&ul_client->udi_sem);
174 list_for_each_safe(pos, n, &ul_client->udi_log)
175 {
176 logptr = list_entry(pos, udi_log_t, q);
177 list_del(pos);
178 kfree(logptr);
179 }
180 up(&ul_client->udi_sem);
181
182 return 0;
183} /* ul_deregister_client() */
184
185
186
187/*
188 * ---------------------------------------------------------------------------
189 * logging_handler
190 *
191 * This function is registered with the driver core.
192 * It is called every time a UniFi HIP Signal is sent. It iterates over
193 * the list of processes interested in receiving log events and
194 * delivers the events to them.
195 *
196 * Arguments:
197 * ospriv Pointer to driver's private data.
198 * sigdata Pointer to the packed signal buffer.
199 * signal_len Length of the packed signal.
200 * bulkdata Pointer to the signal's bulk data.
201 * dir Direction of the signal
202 * 0 = from-host
203 * 1 = to-host
204 *
205 * Returns:
206 * None.
207 * ---------------------------------------------------------------------------
208 */
209void
210logging_handler(void *ospriv,
211 u8 *sigdata, u32 signal_len,
212 const bulk_data_param_t *bulkdata,
213 enum udi_log_direction direction)
214{
215 unifi_priv_t *priv = (unifi_priv_t*)ospriv;
216 ul_client_t *client;
217 int dir;
218
219 dir = (direction == UDI_LOG_FROM_HOST) ? UDI_FROM_HOST : UDI_TO_HOST;
220
221 down(&priv->udi_logging_mutex);
222 client = priv->logging_client;
223 if (client != NULL) {
224 client->event_hook(client, sigdata, signal_len,
225 bulkdata, dir);
226 }
227 up(&priv->udi_logging_mutex);
228
229} /* logging_handler() */
230
231
232
233/*
234 * ---------------------------------------------------------------------------
235 * ul_log_config_ind
236 *
237 * This function uses the client's register callback
238 * to indicate configuration information e.g core errors.
239 *
240 * Arguments:
241 * priv Pointer to driver's private data.
242 * conf_param Pointer to the configuration data.
243 * len Length of the configuration data.
244 *
245 * Returns:
246 * None.
247 * ---------------------------------------------------------------------------
248 */
249void
250ul_log_config_ind(unifi_priv_t *priv, u8 *conf_param, int len)
251{
252#ifdef CSR_SUPPORT_SME
253 if (priv->smepriv == NULL)
254 {
255 return;
256 }
257 if ((CONFIG_IND_ERROR == (*conf_param)) && (priv->wifi_on_state == wifi_on_in_progress)) {
258 unifi_notice(priv, "ul_log_config_ind: wifi on in progress, suppress error\n");
259 } else {
260 /* wifi_off_ind (error or exit) */
261 CsrWifiRouterCtrlWifiOffIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, (CsrWifiRouterCtrlControlIndication)(*conf_param));
262 }
263#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
264 unifi_debug_buf_dump();
265#endif
266#else
267 bulk_data_param_t bulkdata;
268
269 /*
270 * If someone killed unifi_managed before the driver was unloaded
271 * the g_drvpriv pointer is going to be NULL. In this case it is
272 * safe to assume that there is no client to get the indication.
273 */
274 if (!priv) {
275 unifi_notice(NULL, "uf_sme_event_ind: NULL priv\n");
276 return;
277 }
278
279 /* Create a null bulkdata structure. */
280 bulkdata.d[0].data_length = 0;
281 bulkdata.d[1].data_length = 0;
282
283 sme_native_log_event(priv->sme_cli, conf_param, sizeof(u8),
284 &bulkdata, UDI_CONFIG_IND);
285
286#endif /* CSR_SUPPORT_SME */
287
288} /* ul_log_config_ind */
289
290
291/*
292 * ---------------------------------------------------------------------------
293 * free_bulkdata_buffers
294 *
295 * Free the bulkdata buffers e.g. after a failed unifi_send_signal().
296 *
297 * Arguments:
298 * priv Pointer to device private struct
299 * bulkdata Pointer to bulkdata parameter table
300 *
301 * Returns:
302 * None.
303 * ---------------------------------------------------------------------------
304 */
305static void
306free_bulkdata_buffers(unifi_priv_t *priv, bulk_data_param_t *bulkdata)
307{
308 int i;
309
310 if (bulkdata) {
311 for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; ++i) {
312 if (bulkdata->d[i].data_length != 0) {
313 unifi_net_data_free(priv, (bulk_data_desc_t *)(&bulkdata->d[i]));
314 /* data_length is now 0 */
315 }
316 }
317 }
318
319} /* free_bulkdata_buffers */
320
321static int
322_align_bulk_data_buffers(unifi_priv_t *priv, u8 *signal,
323 bulk_data_param_t *bulkdata)
324{
325 unsigned int i;
326
327 if ((bulkdata == NULL) || (CSR_WIFI_ALIGN_BYTES == 0)) {
328 return 0;
329 }
330
331 for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++)
332 {
333 struct sk_buff *skb;
334 /*
335 * The following complex casting is in place in order to eliminate 64-bit compilation warning
336 * "cast to/from pointer from/to integer of different size"
337 */
338 u32 align_offset = (u32)(long)(bulkdata->d[i].os_data_ptr) & (CSR_WIFI_ALIGN_BYTES-1);
339 if (align_offset)
340 {
341 skb = (struct sk_buff*)bulkdata->d[i].os_net_buf_ptr;
342 if (skb == NULL) {
343 unifi_warning(priv,
344 "_align_bulk_data_buffers: Align offset found (%d) but skb is NULL!\n",
345 align_offset);
346 return -EINVAL;
347 }
348 if (bulkdata->d[i].data_length == 0) {
349 unifi_warning(priv,
350 "_align_bulk_data_buffers: Align offset found (%d) but length is zero\n",
351 align_offset);
352 return CSR_RESULT_SUCCESS;
353 }
354 unifi_trace(priv, UDBG5,
355 "Align f-h buffer (0x%p) by %d bytes (skb->data: 0x%p)\n",
356 bulkdata->d[i].os_data_ptr, align_offset, skb->data);
357
358
359 /* Check if there is enough headroom... */
360 if (unlikely(skb_headroom(skb) < align_offset))
361 {
362 struct sk_buff *tmp = skb;
363
364 unifi_trace(priv, UDBG5, "Headroom not enough - realloc it\n");
365 skb = skb_realloc_headroom(skb, align_offset);
366 if (skb == NULL) {
367 unifi_error(priv,
368 "_align_bulk_data_buffers: skb_realloc_headroom failed - signal is dropped\n");
369 return -EFAULT;
370 }
371 /* Free the old bulk data only if allocation succeeds */
372 kfree_skb(tmp);
373 /* Bulkdata needs to point to the new skb */
374 bulkdata->d[i].os_net_buf_ptr = (const unsigned char*)skb;
375 bulkdata->d[i].os_data_ptr = (const void*)skb->data;
376 }
377 /* ... before pushing the data to the right alignment offset */
378 skb_push(skb, align_offset);
379
380 }
381 /* The direction bit is zero for the from-host */
382 signal[SIZEOF_SIGNAL_HEADER + (i * SIZEOF_DATAREF) + 1] = align_offset;
383
384 }
385 return 0;
386} /* _align_bulk_data_buffers() */
387
388
389/*
390 * ---------------------------------------------------------------------------
391 * ul_send_signal_unpacked
392 *
393 * This function sends a host formatted signal to unifi.
394 *
395 * Arguments:
396 * priv Pointer to driver's private data.
397 * sigptr Pointer to the signal.
398 * bulkdata Pointer to the signal's bulk data.
399 *
400 * Returns:
401 * O on success, error code otherwise.
402 *
403 * Notes:
404 * The signals have to be sent in the format described in the host interface
405 * specification, i.e wire formatted. Certain clients use the host formatted
406 * structures. The write_pack() transforms the host formatted signal
407 * into the wired formatted signal. The code is in the core, since the signals
408 * are defined therefore binded to the host interface specification.
409 * ---------------------------------------------------------------------------
410 */
411int
412ul_send_signal_unpacked(unifi_priv_t *priv, CSR_SIGNAL *sigptr,
413 bulk_data_param_t *bulkdata)
414{
415 u8 sigbuf[UNIFI_PACKED_SIGBUF_SIZE];
416 u16 packed_siglen;
417 CsrResult csrResult;
418 unsigned long lock_flags;
419 int r;
420
421
422 csrResult = write_pack(sigptr, sigbuf, &packed_siglen);
423 if (csrResult != CSR_RESULT_SUCCESS) {
424 unifi_error(priv, "Malformed HIP signal in ul_send_signal_unpacked()\n");
425 return CsrHipResultToStatus(csrResult);
426 }
427 r = _align_bulk_data_buffers(priv, sigbuf, (bulk_data_param_t*)bulkdata);
428 if (r) {
429 return r;
430 }
431
432 spin_lock_irqsave(&priv->send_signal_lock, lock_flags);
433 csrResult = unifi_send_signal(priv->card, sigbuf, packed_siglen, bulkdata);
434 if (csrResult != CSR_RESULT_SUCCESS) {
435 /* free_bulkdata_buffers(priv, (bulk_data_param_t *)bulkdata); */
436 spin_unlock_irqrestore(&priv->send_signal_lock, lock_flags);
437 return CsrHipResultToStatus(csrResult);
438 }
439 spin_unlock_irqrestore(&priv->send_signal_lock, lock_flags);
440
441 return 0;
442} /* ul_send_signal_unpacked() */
443
444
445/*
446 * ---------------------------------------------------------------------------
447 * reset_driver_status
448 *
449 * This function is called from ul_send_signal_raw() when it detects
450 * that the SME has sent a MLME-RESET request.
451 *
452 * Arguments:
453 * priv Pointer to device private struct
454 *
455 * Returns:
456 * None.
457 * ---------------------------------------------------------------------------
458 */
459static void
460reset_driver_status(unifi_priv_t *priv)
461{
462 priv->sta_wmm_capabilities = 0;
463#ifdef CSR_NATIVE_LINUX
464#ifdef CSR_SUPPORT_WEXT
465 priv->wext_conf.flag_associated = 0;
466 priv->wext_conf.block_controlled_port = CSR_WIFI_ROUTER_PORT_ACTION_8021X_PORT_OPEN;
467 priv->wext_conf.bss_wmm_capabilities = 0;
468 priv->wext_conf.disable_join_on_ssid_set = 0;
469#endif
470#endif
471} /* reset_driver_status() */
472
473
474/*
475 * ---------------------------------------------------------------------------
476 * ul_send_signal_raw
477 *
478 * This function sends a wire formatted data signal to unifi.
479 *
480 * Arguments:
481 * priv Pointer to driver's private data.
482 * sigptr Pointer to the signal.
483 * siglen Length of the signal.
484 * bulkdata Pointer to the signal's bulk data.
485 *
486 * Returns:
487 * O on success, error code otherwise.
488 * ---------------------------------------------------------------------------
489 */
490int
491ul_send_signal_raw(unifi_priv_t *priv, unsigned char *sigptr, int siglen,
492 bulk_data_param_t *bulkdata)
493{
494 CsrResult csrResult;
495 unsigned long lock_flags;
496 int r;
497
498 /*
499 * Make sure that the signal is updated with the bulk data
500 * alignment for DMA.
501 */
502 r = _align_bulk_data_buffers(priv, (u8*)sigptr, bulkdata);
503 if (r) {
504 return r;
505 }
506
507 spin_lock_irqsave(&priv->send_signal_lock, lock_flags);
508 csrResult = unifi_send_signal(priv->card, sigptr, siglen, bulkdata);
509 if (csrResult != CSR_RESULT_SUCCESS) {
510 free_bulkdata_buffers(priv, bulkdata);
511 spin_unlock_irqrestore(&priv->send_signal_lock, lock_flags);
512 return CsrHipResultToStatus(csrResult);
513 }
514 spin_unlock_irqrestore(&priv->send_signal_lock, lock_flags);
515
516 /*
517 * Since this is use by unicli, if we get an MLME reset request
518 * we need to initialize a few status parameters
519 * that the driver uses to make decisions.
520 */
521 if (GET_SIGNAL_ID(sigptr) == CSR_MLME_RESET_REQUEST_ID) {
522 reset_driver_status(priv);
523 }
524
525 return 0;
526} /* ul_send_signal_raw() */
527
528
diff --git a/drivers/staging/csr/unifi_clients.h b/drivers/staging/csr/unifi_clients.h
deleted file mode 100644
index df853e160ea5..000000000000
--- a/drivers/staging/csr/unifi_clients.h
+++ /dev/null
@@ -1,129 +0,0 @@
1/*
2 *****************************************************************************
3 *
4 * FILE : unifi_clients.h
5 *
6 * PURPOSE : Private header file for unifi clients.
7 *
8 * UDI = UniFi Debug Interface
9 *
10 * Copyright (C) 2005-2008 by Cambridge Silicon Radio Ltd.
11 *
12 * Refer to LICENSE.txt included with this source code for details on
13 * the license terms.
14 *
15 *****************************************************************************
16 */
17#ifndef __LINUX_UNIFI_CLIENTS_H__
18#define __LINUX_UNIFI_CLIENTS_H__ 1
19
20#include <linux/kernel.h>
21
22#define MAX_UDI_CLIENTS 8
23
24/* The start of the range of process ids allocated for ul clients */
25#define UDI_SENDER_ID_BASE 0xC000
26#define UDI_SENDER_ID_SHIFT 8
27
28
29/* Structure to hold a UDI logged signal */
30typedef struct {
31
32 /* List link structure */
33 struct list_head q;
34
35 /* The message that will be passed to the user app */
36 udi_msg_t msg;
37
38 /* Signal body and data follow */
39
40} udi_log_t;
41
42
43
44typedef struct ul_client ul_client_t;
45
46typedef void (*udi_event_t)(ul_client_t *client,
47 const u8 *sigdata, int signal_len,
48 const bulk_data_param_t *bulkdata,
49 int dir);
50
51void logging_handler(void *ospriv,
52 u8 *sigdata, u32 signal_len,
53 const bulk_data_param_t *bulkdata,
54 enum udi_log_direction direction);
55
56
57/*
58 * Structure describing a bulk data slot.
59 * The length field is used to indicate empty/occupied state.
60 */
61typedef struct _bulk_data
62{
63 unsigned char ptr[2000];
64 unsigned int length;
65} bulk_data_t;
66
67
68struct ul_client {
69 /* Index of this client in the ul_clients array. */
70 int client_id;
71
72 /* Index of UniFi device to which this client is attached. */
73 int instance;
74
75 /* Flag to say whether this client has been enabled. */
76 int udi_enabled;
77
78 /* Value to use in signal->SenderProcessId */
79 int sender_id;
80
81 /* Configuration flags, e.g blocking, logging, etc. */
82 unsigned int configuration;
83
84 udi_event_t event_hook;
85
86 /* A list to hold signals received from UniFi for reading by read() */
87 struct list_head udi_log;
88
89 /* Semaphore to protect the udi_log list */
90 struct semaphore udi_sem;
91
92 /*
93 * Linux waitqueue to support blocking read and poll.
94 * Logging clients should wait on udi_log. while
95 * blocking clients should wait on wake_up_wq.
96 */
97 wait_queue_head_t udi_wq;
98 CSR_SIGNAL* reply_signal;
99 bulk_data_t* reply_bulkdata[UNIFI_MAX_DATA_REFERENCES];
100
101 u16 signal_filter[SIG_FILTER_SIZE];
102
103
104 /* ------------------------------------------------------------------- */
105 /* Code below here is used by the sme_native configuration only */
106
107 /* Flag to wake up blocking clients waiting on udi_wq. */
108 int wake_up_wq_id;
109
110 /*
111 * A 0x00 - 0x0F mask to apply in signal->SenderProcessId.
112 * Every time we do a blocking mlme request we increase this value.
113 * The mlme_wait_for_reply() will wait for this sequence number.
114 * Only the MLME blocking functions update this field.
115 */
116 unsigned char seq_no;
117
118 /*
119 * A 0x00 - 0x0F counter, containing the sequence number of
120 * the signal that this client has last received.
121 * Only the MLME blocking functions update this field.
122 */
123 unsigned char wake_seq_no;
124
125 unifiio_snap_filter_t snap_filter;
126}; /* struct ul_client */
127
128
129#endif /* __LINUX_UNIFI_CLIENTS_H__ */
diff --git a/drivers/staging/csr/unifi_config.h b/drivers/staging/csr/unifi_config.h
deleted file mode 100644
index fe119707844a..000000000000
--- a/drivers/staging/csr/unifi_config.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * ---------------------------------------------------------------------------
3 *
4 * FILE: unifi_config.h
5 *
6 * PURPOSE:
7 * This header file provides parameters that configure the operation
8 * of the driver.
9 *
10 * Copyright (C) 2006-2008 by Cambridge Silicon Radio Ltd.
11 *
12 * Refer to LICENSE.txt included with this source code for details on
13 * the license terms.
14 *
15 * ---------------------------------------------------------------------------
16 */
17#ifndef __UNIFI_CONFIG_H__
18#define __UNIFI_CONFIG_H__ 1
19
20/*
21 * Override for the SDIO function block size on this host. When byte mode CMD53s
22 * are not used/supported by the SD host controller, transfers are padded up to
23 * the next block boundary. The 512-byte default on UF6xxx wastes too much space
24 * on the chip, so the block size is reduced to support this configuration.
25 */
26#define CSR_WIFI_HIP_SDIO_BLOCK_SIZE 64
27
28/* Define the number of mini-coredump buffers to allocate at startup. These are
29 * used to record chip status for the last n unexpected resets.
30 */
31#define CSR_WIFI_HIP_NUM_COREDUMP_BUFFERS 5
32
33
34#endif /* __UNIFI_CONFIG_H__ */
diff --git a/drivers/staging/csr/unifi_dbg.c b/drivers/staging/csr/unifi_dbg.c
deleted file mode 100644
index 38d57085a26a..000000000000
--- a/drivers/staging/csr/unifi_dbg.c
+++ /dev/null
@@ -1,110 +0,0 @@
1/*
2 * ***************************************************************************
3 * FILE: unifi_dbg.c
4 *
5 * PURPOSE:
6 * Handle debug signals received from UniFi.
7 *
8 * Copyright (C) 2007-2008 by Cambridge Silicon Radio Ltd.
9 *
10 * Refer to LICENSE.txt included with this source code for details on
11 * the license terms.
12 *
13 * ***************************************************************************
14 */
15#include "unifi_priv.h"
16
17/*
18 * ---------------------------------------------------------------------------
19 * debug_string_indication
20 * debug_word16_indication
21 *
22 * Handlers for debug indications.
23 *
24 * Arguments:
25 * priv Pointer to private context structure.
26 *
27 * Returns:
28 * None.
29 * ---------------------------------------------------------------------------
30 */
31void
32debug_string_indication(unifi_priv_t *priv, const unsigned char *extra, unsigned int extralen)
33{
34 const unsigned int maxlen = sizeof(priv->last_debug_string) - 1;
35
36 if (extralen > maxlen) {
37 extralen = maxlen;
38 }
39
40 strncpy(priv->last_debug_string, extra, extralen);
41
42 /* Make sure the string is terminated */
43 priv->last_debug_string[extralen] = '\0';
44
45 unifi_info(priv, "unifi debug: %s\n", priv->last_debug_string);
46
47} /* debug_string_indication() */
48
49
50
51void
52debug_word16_indication(unifi_priv_t *priv, const CSR_SIGNAL *sigptr)
53{
54 int i;
55
56 if (priv == NULL) {
57 unifi_info(priv, "Priv is NULL\n");
58 return;
59 }
60
61 for (i = 0; i < 16; i++) {
62 priv->last_debug_word16[i] =
63 sigptr->u.DebugWord16Indication.DebugWords[i];
64 }
65
66 if (priv->last_debug_word16[0] == 0xFA11) {
67 unsigned long ts;
68 ts = (priv->last_debug_word16[6] << 16) | priv->last_debug_word16[5];
69 unifi_info(priv, " %10lu: %s fault %04x, arg %04x (x%d)\n",
70 ts,
71 priv->last_debug_word16[3] == 0x8000 ? "MAC" :
72 priv->last_debug_word16[3] == 0x4000 ? "PHY" :
73 "???",
74 priv->last_debug_word16[1],
75 priv->last_debug_word16[2],
76 priv->last_debug_word16[4]);
77 }
78 else if (priv->last_debug_word16[0] != 0xDBAC)
79 /* suppress SDL Trace output (note: still available to unicli). */
80 {
81 unifi_info(priv, "unifi debug: %04X %04X %04X %04X %04X %04X %04X %04X\n",
82 priv->last_debug_word16[0], priv->last_debug_word16[1],
83 priv->last_debug_word16[2], priv->last_debug_word16[3],
84 priv->last_debug_word16[4], priv->last_debug_word16[5],
85 priv->last_debug_word16[6], priv->last_debug_word16[7]);
86 unifi_info(priv, " %04X %04X %04X %04X %04X %04X %04X %04X\n",
87 priv->last_debug_word16[8], priv->last_debug_word16[9],
88 priv->last_debug_word16[10], priv->last_debug_word16[11],
89 priv->last_debug_word16[12], priv->last_debug_word16[13],
90 priv->last_debug_word16[14], priv->last_debug_word16[15]);
91 }
92
93} /* debug_word16_indication() */
94
95
96void
97debug_generic_indication(unifi_priv_t *priv, const CSR_SIGNAL *sigptr)
98{
99 unifi_info(priv, "debug: %04X %04X %04X %04X %04X %04X %04X %04X\n",
100 sigptr->u.DebugGenericIndication.DebugWords[0],
101 sigptr->u.DebugGenericIndication.DebugWords[1],
102 sigptr->u.DebugGenericIndication.DebugWords[2],
103 sigptr->u.DebugGenericIndication.DebugWords[3],
104 sigptr->u.DebugGenericIndication.DebugWords[4],
105 sigptr->u.DebugGenericIndication.DebugWords[5],
106 sigptr->u.DebugGenericIndication.DebugWords[6],
107 sigptr->u.DebugGenericIndication.DebugWords[7]);
108
109} /* debug_generic_indication() */
110
diff --git a/drivers/staging/csr/unifi_event.c b/drivers/staging/csr/unifi_event.c
deleted file mode 100644
index 71fdb2180e3d..000000000000
--- a/drivers/staging/csr/unifi_event.c
+++ /dev/null
@@ -1,692 +0,0 @@
1/*
2 * ***************************************************************************
3 * FILE: unifi_event.c
4 *
5 * PURPOSE:
6 * Process the signals received by UniFi.
7 * It is part of the porting exercise.
8 *
9 * Copyright (C) 2009 by Cambridge Silicon Radio Ltd.
10 *
11 * Refer to LICENSE.txt included with this source code for details on
12 * the license terms.
13 *
14 * ***************************************************************************
15 */
16
17
18/*
19 * Porting notes:
20 * The implementation of unifi_receive_event() in Linux is fairly complicated.
21 * The linux driver support multiple userspace applications and several
22 * build configurations, so the received signals are processed by different
23 * processes and multiple times.
24 * In a simple implementation, this function needs to deliver:
25 * - The MLME-UNITDATA.ind signals to the Rx data plane and to the Traffic
26 * Analysis using unifi_ta_sample().
27 * - The MLME-UNITDATA-STATUS.ind signals to the Tx data plane.
28 * - All the other signals to the SME using unifi_sys_hip_ind().
29 */
30
31#include "csr_wifi_hip_unifi.h"
32#include "csr_wifi_hip_conversions.h"
33#include "unifi_priv.h"
34
35
36/*
37 * ---------------------------------------------------------------------------
38 * send_to_client
39 *
40 * Helper for unifi_receive_event.
41 *
42 * This function forwards a signal to one client.
43 *
44 * Arguments:
45 * priv Pointer to driver's private data.
46 * client Pointer to the client structure.
47 * receiver_id The reciever id of the signal.
48 * sigdata Pointer to the packed signal buffer.
49 * siglen Length of the packed signal.
50 * bulkdata Pointer to the signal's bulk data.
51 *
52 * Returns:
53 * None.
54 *
55 * ---------------------------------------------------------------------------
56 */
57static void send_to_client(unifi_priv_t *priv, ul_client_t *client,
58 int receiver_id,
59 unsigned char *sigdata, int siglen,
60 const bulk_data_param_t *bulkdata)
61{
62 if (client && client->event_hook) {
63 /*unifi_trace(priv, UDBG3,
64 "Receive: client %d, (s:0x%X, r:0x%X) - Signal 0x%.4X \n",
65 client->client_id, client->sender_id, receiver_id,
66 CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata));*/
67
68 client->event_hook(client, sigdata, siglen, bulkdata, UDI_TO_HOST);
69 }
70}
71
72/*
73 * ---------------------------------------------------------------------------
74 * process_pkt_data_ind
75 *
76 * Dispatcher for received signals.
77 *
78 * This function receives the 'to host' signals and forwards
79 * them to the unifi linux clients.
80 *
81 * Arguments:
82 * priv Context
83 * sigdata Pointer to the packed signal buffer(Its in form of MA-PACKET.ind).
84 * bulkdata Pointer to signal's bulkdata
85 * freeBulkData Pointer to a flag which gets set if the bulkdata needs to
86 * be freed after calling the logging handlers. If it is not
87 * set the bulkdata must be freed by the MLME handler or
88 * passed to the network stack.
89 * Returns:
90 * TRUE if the packet should be routed to the SME etc.
91 * FALSE if the packet is for the driver or network stack
92 * ---------------------------------------------------------------------------
93 */
94static u8 check_routing_pkt_data_ind(unifi_priv_t *priv,
95 u8 *sigdata,
96 const bulk_data_param_t* bulkdata,
97 u8 *freeBulkData,
98 netInterface_priv_t *interfacePriv)
99{
100 u16 frmCtrl, receptionStatus, frmCtrlSubType;
101 u8 *macHdrLocation;
102 u8 interfaceTag;
103 u8 isDataFrame;
104 u8 isProtocolVerInvalid = FALSE;
105 u8 isDataFrameSubTypeNoData = FALSE;
106
107#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
108 static const u8 wapiProtocolIdSNAPHeader[] = {0x88, 0xb4};
109 static const u8 wapiProtocolIdSNAPHeaderOffset = 6;
110 u8 *destAddr;
111 u8 *srcAddr;
112 u8 isWapiUnicastPkt = FALSE;
113
114#ifdef CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND
115 u16 qosControl;
116#endif
117
118 u8 llcSnapHeaderOffset = 0;
119
120 destAddr = (u8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR1_OFFSET;
121 srcAddr = (u8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR2_OFFSET;
122
123 /*Individual/Group bit - Bit 0 of first byte*/
124 isWapiUnicastPkt = (!(destAddr[0] & 0x01)) ? TRUE : FALSE;
125#endif
126
127#define CSR_WIFI_MA_PKT_IND_RECEPTION_STATUS_OFFSET sizeof(CSR_SIGNAL_PRIMITIVE_HEADER) + 22
128
129 *freeBulkData = FALSE;
130
131 /* Fetch the MAC header location from MA_PKT_IND packet */
132 macHdrLocation = (u8 *) bulkdata->d[0].os_data_ptr;
133 /* Fetch the Frame Control value from MAC header */
134 frmCtrl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(macHdrLocation);
135
136 /* Pull out interface tag from virtual interface identifier */
137 interfaceTag = (CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata + 14)) & 0xff;
138
139 /* check for MIC failure before processing the signal */
140 receptionStatus = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata + CSR_WIFI_MA_PKT_IND_RECEPTION_STATUS_OFFSET);
141
142 /* To discard any spurious MIC failures that could be reported by the firmware */
143 isDataFrame = ((frmCtrl & IEEE80211_FC_TYPE_MASK) == (IEEE802_11_FC_TYPE_DATA & IEEE80211_FC_TYPE_MASK)) ? TRUE : FALSE;
144 /* 0x00 is the only valid protocol version*/
145 isProtocolVerInvalid = (frmCtrl & IEEE80211_FC_PROTO_VERSION_MASK) ? TRUE : FALSE;
146 frmCtrlSubType = (frmCtrl & IEEE80211_FC_SUBTYPE_MASK) >> FRAME_CONTROL_SUBTYPE_FIELD_OFFSET;
147 /*Exclude the no data & reserved sub-types from MIC failure processing*/
148 isDataFrameSubTypeNoData = (((frmCtrlSubType>0x03)&&(frmCtrlSubType<0x08)) || (frmCtrlSubType>0x0B)) ? TRUE : FALSE;
149 if ((receptionStatus == CSR_MICHAEL_MIC_ERROR) &&
150 ((!isDataFrame) || isProtocolVerInvalid || (isDataFrame && isDataFrameSubTypeNoData))) {
151 /* Currently MIC errors are discarded for frames other than data frames. This might need changing when we start
152 * supporting 802.11w (Protected Management frames)
153 */
154 *freeBulkData = TRUE;
155 unifi_trace(priv, UDBG4, "Discarding this frame and ignoring the MIC failure as this is a garbage/non-data/no data frame\n");
156 return FALSE;
157 }
158
159#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
160
161 if (receptionStatus == CSR_MICHAEL_MIC_ERROR) {
162
163 if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_STA) {
164
165#ifdef CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND
166 if ((isDataFrame) &&
167 ((IEEE802_11_FC_TYPE_QOS_DATA & IEEE80211_FC_SUBTYPE_MASK) == (frmCtrl & IEEE80211_FC_SUBTYPE_MASK)) &&
168 (priv->isWapiConnection))
169 {
170 qosControl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(macHdrLocation + (((frmCtrl & IEEE802_11_FC_TO_DS_MASK) && (frmCtrl & IEEE802_11_FC_FROM_DS_MASK)) ? 30 : 24) );
171
172 unifi_trace(priv, UDBG4, "check_routing_pkt_data_ind() :: Value of the QoS control field - 0x%04x \n", qosControl);
173
174 if (qosControl & IEEE802_11_QC_NON_TID_BITS_MASK)
175 {
176 unifi_trace(priv, UDBG4, "Ignore the MIC failure and pass the MPDU to the stack when any of bits [4-15] is set in the QoS control field\n");
177
178 /*Exclude the MIC [16] and the PN [16] that are appended by the firmware*/
179 ((bulk_data_param_t*)bulkdata)->d[0].data_length = bulkdata->d[0].data_length - 32;
180
181 /*Clear the reception status of the signal (CSR_RX_SUCCESS)*/
182 *(sigdata + CSR_WIFI_MA_PKT_IND_RECEPTION_STATUS_OFFSET) = 0x00;
183 *(sigdata + CSR_WIFI_MA_PKT_IND_RECEPTION_STATUS_OFFSET+1) = 0x00;
184
185 *freeBulkData = FALSE;
186
187 return FALSE;
188 }
189 }
190#endif
191 /* If this MIC ERROR reported by the firmware is either for
192 * [1] a WAPI Multicast MPDU and the Multicast filter has NOT been set (It is set only when group key index (MSKID) = 1 in Group Rekeying) OR
193 * [2] a WAPI Unicast MPDU and either the CONTROL PORT is open or the WAPI Unicast filter or filter(s) is NOT set
194 * then report a MIC FAILURE indication to the SME.
195 */
196#ifndef CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION
197 if ((priv->wapi_multicast_filter == 0) || isWapiUnicastPkt) {
198#else
199 /*When SW encryption is enabled and USKID=1 (wapi_unicast_filter = 1), we are expected
200 *to receive MIC failure INDs for unicast MPDUs*/
201 if ( ((priv->wapi_multicast_filter == 0) && !isWapiUnicastPkt) ||
202 ((priv->wapi_unicast_filter == 0) && isWapiUnicastPkt) ) {
203#endif
204 /*Discard the frame*/
205 *freeBulkData = TRUE;
206 unifi_trace(priv, UDBG4, "Discarding the contents of the frame with MIC failure \n");
207
208 if (isWapiUnicastPkt &&
209 ((uf_sme_port_state(priv, srcAddr, UF_CONTROLLED_PORT_Q, interfaceTag) != CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN)||
210#ifndef CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION
211 (priv->wapi_unicast_filter) ||
212#endif
213 (priv->wapi_unicast_queued_pkt_filter))) {
214
215 /* Workaround to handle MIC failures reported by the firmware for encrypted packets from the AP
216 * while we are in the process of re-association induced by unsupported WAPI Unicast key index
217 * - Discard the packets with MIC failures "until" we have
218 * a. negotiated a key,
219 * b. opened the CONTROL PORT and
220 * c. the AP has started using the new key
221 */
222 unifi_trace(priv, UDBG4, "Ignoring the MIC failure as either a. CONTROL PORT isn't OPEN or b. Unicast filter is set or c. WAPI AP using old key for buffered pkts\n");
223
224 /*Ignore this MIC failure*/
225 return FALSE;
226
227 }/*WAPI re-key specific workaround*/
228
229 unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind - MIC FAILURE : interfaceTag %x Src Addr %x:%x:%x:%x:%x:%x\n",
230 interfaceTag, srcAddr[0], srcAddr[1], srcAddr[2], srcAddr[3], srcAddr[4], srcAddr[5]);
231 unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind - MIC FAILURE : Dest Addr %x:%x:%x:%x:%x:%x\n",
232 destAddr[0], destAddr[1], destAddr[2], destAddr[3], destAddr[4], destAddr[5]);
233 unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind - MIC FAILURE : Control Port State - 0x%.4X \n",
234 uf_sme_port_state(priv, srcAddr, UF_CONTROLLED_PORT_Q, interfaceTag));
235
236 unifi_error(priv, "MIC failure in %s\n", __FUNCTION__);
237
238 /*Report the MIC failure to the SME*/
239 return TRUE;
240 }
241 }/* STA mode */
242 else {
243 /* Its AP Mode . Just Return */
244 *freeBulkData = TRUE;
245 unifi_error(priv, "MIC failure in %s\n", __FUNCTION__);
246 return TRUE;
247 } /* AP mode */
248 }/* MIC error */
249#else
250 if (receptionStatus == CSR_MICHAEL_MIC_ERROR) {
251 *freeBulkData = TRUE;
252 unifi_error(priv, "MIC failure in %s\n", __FUNCTION__);
253 return TRUE;
254 }
255#endif /*CSR_WIFI_SECURITY_WAPI_ENABLE*/
256
257 unifi_trace(priv, UDBG4, "frmCtrl = 0x%04x %s\n",
258 frmCtrl,
259 (((frmCtrl & 0x000c)>>FRAME_CONTROL_TYPE_FIELD_OFFSET) == IEEE802_11_FRAMETYPE_MANAGEMENT) ?
260 "Mgt" : "Ctrl/Data");
261
262#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
263 /* To ignore MIC failures reported due to the WAPI AP using the old key for queued packets before
264 * starting to use the new key negotiated as part of unicast re-keying
265 */
266 if ((interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_STA)&&
267 isWapiUnicastPkt &&
268 (receptionStatus == CSR_RX_SUCCESS) &&
269 (priv->wapi_unicast_queued_pkt_filter==1)) {
270
271 unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind(): WAPI unicast pkt received when the (wapi_unicast_queued_pkt_filter) is set\n");
272
273 if (isDataFrame) {
274 switch(frmCtrl & IEEE80211_FC_SUBTYPE_MASK) {
275 case IEEE802_11_FC_TYPE_QOS_DATA & IEEE80211_FC_SUBTYPE_MASK:
276 llcSnapHeaderOffset = MAC_HEADER_SIZE + 2;
277 break;
278 case IEEE802_11_FC_TYPE_QOS_NULL & IEEE80211_FC_SUBTYPE_MASK:
279 case IEEE802_11_FC_TYPE_NULL & IEEE80211_FC_SUBTYPE_MASK:
280 break;
281 default:
282 llcSnapHeaderOffset = MAC_HEADER_SIZE;
283 }
284 }
285
286 if (llcSnapHeaderOffset > 0) {
287 /* QoS data or Data */
288 unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind(): SNAP header found & its offset %d\n", llcSnapHeaderOffset);
289 if (memcmp((u8 *)(bulkdata->d[0].os_data_ptr+llcSnapHeaderOffset+wapiProtocolIdSNAPHeaderOffset),
290 wapiProtocolIdSNAPHeader, sizeof(wapiProtocolIdSNAPHeader))) {
291
292 unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind(): This is a data & NOT a WAI protocol packet\n");
293 /* On the first unicast data pkt that is decrypted successfully after re-keying, reset the filter */
294 priv->wapi_unicast_queued_pkt_filter = 0;
295 unifi_trace(priv, UDBG4, "check_routing_pkt_data_ind(): WAPI AP has started using the new unicast key, no more MIC failures expected (reset filter)\n");
296 }
297 else {
298 unifi_trace(priv, UDBG6, "check_routing_pkt_data_ind(): WAPI - This is a WAI protocol packet\n");
299 }
300 }
301 }
302#endif
303
304
305 switch ((frmCtrl & 0x000c)>>FRAME_CONTROL_TYPE_FIELD_OFFSET) {
306 case IEEE802_11_FRAMETYPE_MANAGEMENT:
307 *freeBulkData = TRUE; /* Free (after SME handler copies it) */
308
309 /* In P2P device mode, filter the legacy AP beacons here */
310 if((interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2P)&&\
311 ((CSR_WIFI_80211_GET_FRAME_SUBTYPE(macHdrLocation)) == CSR_WIFI_80211_FRAME_SUBTYPE_BEACON)){
312
313 u8 *pSsid, *pSsidLen;
314 static u8 P2PWildCardSsid[CSR_WIFI_P2P_WILDCARD_SSID_LENGTH] = {'D', 'I', 'R', 'E', 'C', 'T', '-'};
315
316 pSsidLen = macHdrLocation + MAC_HEADER_SIZE + CSR_WIFI_BEACON_FIXED_LENGTH;
317 pSsid = pSsidLen + 2;
318
319 if(*(pSsidLen + 1) >= CSR_WIFI_P2P_WILDCARD_SSID_LENGTH){
320 if(memcmp(pSsid, P2PWildCardSsid, CSR_WIFI_P2P_WILDCARD_SSID_LENGTH) == 0){
321 unifi_trace(priv, UDBG6, "Received a P2P Beacon, pass it to SME\n");
322 return TRUE;
323 }
324 }
325 unifi_trace(priv, UDBG6, "Received a Legacy AP beacon in P2P mode, drop it\n");
326 return FALSE;
327 }
328 return TRUE; /* Route to SME */
329 case IEEE802_11_FRAMETYPE_DATA:
330 case IEEE802_11_FRAMETYPE_CONTROL:
331 *freeBulkData = FALSE; /* Network stack or MLME handler frees */
332 return FALSE;
333 default:
334 unifi_error(priv, "Unhandled frame type %04x\n", frmCtrl);
335 *freeBulkData = TRUE; /* Not interested, but must free it */
336 return FALSE;
337 }
338}
339
340/*
341 * ---------------------------------------------------------------------------
342 * unifi_process_receive_event
343 *
344 * Dispatcher for received signals.
345 *
346 * This function receives the 'to host' signals and forwards
347 * them to the unifi linux clients.
348 *
349 * Arguments:
350 * ospriv Pointer to driver's private data.
351 * sigdata Pointer to the packed signal buffer.
352 * siglen Length of the packed signal.
353 * bulkdata Pointer to the signal's bulk data.
354 *
355 * Returns:
356 * None.
357 *
358 * Notes:
359 * The signals are received in the format described in the host interface
360 * specification, i.e wire formatted. Certain clients use the same format
361 * to interpret them and other clients use the host formatted structures.
362 * Each client has to call read_unpack_signal() to transform the wire
363 * formatted signal into the host formatted signal, if necessary.
364 * The code is in the core, since the signals are defined therefore
365 * binded to the host interface specification.
366 * ---------------------------------------------------------------------------
367 */
368static void
369unifi_process_receive_event(void *ospriv,
370 u8 *sigdata, u32 siglen,
371 const bulk_data_param_t *bulkdata)
372{
373 unifi_priv_t *priv = (unifi_priv_t*)ospriv;
374 int i, receiver_id;
375 int client_id;
376 s16 signal_id;
377 u8 pktIndToSme = FALSE, freeBulkData = FALSE;
378
379 unifi_trace(priv, UDBG5, "unifi_process_receive_event: "
380 "%04x %04x %04x %04x %04x %04x %04x %04x (%d)\n",
381 CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*0) & 0xFFFF,
382 CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*1) & 0xFFFF,
383 CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*2) & 0xFFFF,
384 CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*3) & 0xFFFF,
385 CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*4) & 0xFFFF,
386 CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*5) & 0xFFFF,
387 CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*6) & 0xFFFF,
388 CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*7) & 0xFFFF,
389 siglen);
390
391 receiver_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)) & 0xFF00;
392 client_id = (receiver_id & 0x0F00) >> UDI_SENDER_ID_SHIFT;
393 signal_id = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata);
394
395
396
397 /* check for the type of frame received (checks for 802.11 management frames) */
398 if (signal_id == CSR_MA_PACKET_INDICATION_ID)
399 {
400#define CSR_MA_PACKET_INDICATION_INTERFACETAG_OFFSET 14
401 u8 interfaceTag;
402 netInterface_priv_t *interfacePriv;
403
404 /* Pull out interface tag from virtual interface identifier */
405 interfaceTag = (CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata + CSR_MA_PACKET_INDICATION_INTERFACETAG_OFFSET)) & 0xff;
406 interfacePriv = priv->interfacePriv[interfaceTag];
407
408 /* Update activity for this station in case of IBSS */
409#ifdef CSR_SUPPORT_SME
410 if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_IBSS)
411 {
412 u8 *saddr;
413 /* Fetch the source address from mac header */
414 saddr = (u8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR2_OFFSET;
415 unifi_trace(priv, UDBG5,
416 "Updating sta activity in IBSS interfaceTag %x Src Addr %x:%x:%x:%x:%x:%x\n",
417 interfaceTag, saddr[0], saddr[1], saddr[2], saddr[3], saddr[4], saddr[5]);
418
419 uf_update_sta_activity(priv, interfaceTag, saddr);
420 }
421#endif
422
423 pktIndToSme = check_routing_pkt_data_ind(priv, sigdata, bulkdata, &freeBulkData, interfacePriv);
424
425 unifi_trace(priv, UDBG6, "RX: packet entry point to driver from HIP,pkt to SME ?(%s) \n", (pktIndToSme)? "YES":"NO");
426
427 }
428
429 if (pktIndToSme)
430 {
431 /* Management MA_PACKET_IND for SME */
432 if(sigdata != NULL && bulkdata != NULL){
433 send_to_client(priv, priv->sme_cli, receiver_id, sigdata, siglen, bulkdata);
434 }
435 else{
436 unifi_error(priv, "unifi_receive_event2: sigdata or Bulkdata is NULL \n");
437 }
438#ifdef CSR_NATIVE_LINUX
439 send_to_client(priv, priv->wext_client,
440 receiver_id,
441 sigdata, siglen, bulkdata);
442#endif
443 }
444 else
445 {
446 /* Signals with ReceiverId==0 are also reported to SME / WEXT,
447 * unless they are data/control MA_PACKET_INDs or VIF_AVAILABILITY_INDs
448 */
449 if (!receiver_id) {
450 if(signal_id == CSR_MA_VIF_AVAILABILITY_INDICATION_ID) {
451 uf_process_ma_vif_availibility_ind(priv, sigdata, siglen);
452 }
453 else if (signal_id != CSR_MA_PACKET_INDICATION_ID) {
454 send_to_client(priv, priv->sme_cli, receiver_id, sigdata, siglen, bulkdata);
455#ifdef CSR_NATIVE_LINUX
456 send_to_client(priv, priv->wext_client,
457 receiver_id,
458 sigdata, siglen, bulkdata);
459#endif
460 }
461 else
462 {
463
464#if (defined(CSR_SUPPORT_SME) && defined(CSR_WIFI_SECURITY_WAPI_ENABLE))
465 #define CSR_MA_PACKET_INDICATION_RECEPTION_STATUS_OFFSET sizeof(CSR_SIGNAL_PRIMITIVE_HEADER) + 22
466 netInterface_priv_t *interfacePriv;
467 u8 interfaceTag;
468 u16 receptionStatus = CSR_RX_SUCCESS;
469
470 /* Pull out interface tag from virtual interface identifier */
471 interfaceTag = (CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata + CSR_MA_PACKET_INDICATION_INTERFACETAG_OFFSET)) & 0xff;
472 interfacePriv = priv->interfacePriv[interfaceTag];
473
474 /* check for MIC failure */
475 receptionStatus = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata + CSR_MA_PACKET_INDICATION_RECEPTION_STATUS_OFFSET);
476
477 /* Send a WAPI MPDU to SME for re-check MIC if the respective filter has been set*/
478 if ((!freeBulkData) &&
479 (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_STA) &&
480 (receptionStatus == CSR_MICHAEL_MIC_ERROR) &&
481 ((priv->wapi_multicast_filter == 1)
482#ifdef CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION
483 || (priv->wapi_unicast_filter == 1)
484#endif
485 ))
486 {
487 CSR_SIGNAL signal;
488 u8 *destAddr;
489 CsrResult res;
490 u16 interfaceTag = 0;
491 u8 isMcastPkt = TRUE;
492
493 unifi_trace(priv, UDBG6, "Received a WAPI data packet when the Unicast/Multicast filter is set\n");
494 res = read_unpack_signal(sigdata, &signal);
495 if (res) {
496 unifi_error(priv, "Received unknown or corrupted signal (0x%x).\n",
497 CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata));
498 return;
499 }
500
501 /* Check if the type of MPDU and the respective filter status*/
502 destAddr = (u8 *) bulkdata->d[0].os_data_ptr + MAC_HEADER_ADDR1_OFFSET;
503 isMcastPkt = (destAddr[0] & 0x01) ? TRUE : FALSE;
504 unifi_trace(priv, UDBG6,
505 "1.MPDU type: (%s), 2.Multicast filter: (%s), 3. Unicast filter: (%s)\n",
506 ((isMcastPkt) ? "Multiast":"Unicast"),
507 ((priv->wapi_multicast_filter) ? "Enabled":"Disabled"),
508 ((priv->wapi_unicast_filter) ? "Enabled":"Disabled"));
509
510 if (((isMcastPkt) && (priv->wapi_multicast_filter == 1))
511#ifdef CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION
512 || ((!isMcastPkt) && (priv->wapi_unicast_filter == 1))
513#endif
514 )
515 {
516 unifi_trace(priv, UDBG4, "Sending the WAPI MPDU for MIC check\n");
517 CsrWifiRouterCtrlWapiRxMicCheckIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, siglen, sigdata, bulkdata->d[0].data_length, (u8*)bulkdata->d[0].os_data_ptr);
518
519 for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) {
520 if (bulkdata->d[i].data_length != 0) {
521 unifi_net_data_free(priv, (void *)&bulkdata->d[i]);
522 }
523 }
524 return;
525 }
526 } /* CSR_MA_PACKET_INDICATION_ID */
527#endif /*CSR_SUPPORT_SME && CSR_WIFI_SECURITY_WAPI_ENABLE*/
528 }
529 }
530
531 /* calls the registered clients handler callback func.
532 * netdev_mlme_event_handler is one of the registered handler used to route
533 * data packet to network stack or AMP/EAPOL related data to SME
534 *
535 * The freeBulkData check ensures that, it has received a management frame and
536 * the frame needs to be freed here. So not to be passed to netdev handler
537 */
538 if(!freeBulkData){
539 if ((client_id < MAX_UDI_CLIENTS) &&
540 (&priv->ul_clients[client_id] != priv->logging_client)) {
541 unifi_trace(priv, UDBG6, "Call the registered clients handler callback func\n");
542 send_to_client(priv, &priv->ul_clients[client_id],
543 receiver_id,
544 sigdata, siglen, bulkdata);
545 }
546 }
547 }
548
549 /*
550 * Free bulk data buffers here unless it is a CSR_MA_PACKET_INDICATION
551 */
552 switch (signal_id)
553 {
554#ifdef UNIFI_SNIFF_ARPHRD
555 case CSR_MA_SNIFFDATA_INDICATION_ID:
556#endif
557 break;
558
559 case CSR_MA_PACKET_INDICATION_ID:
560 if (!freeBulkData)
561 {
562 break;
563 }
564 /* FALLS THROUGH... */
565 default:
566 for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) {
567 if (bulkdata->d[i].data_length != 0) {
568 unifi_net_data_free(priv, (void *)&bulkdata->d[i]);
569 }
570 }
571 }
572
573} /* unifi_process_receive_event() */
574
575
576#ifdef CSR_WIFI_RX_PATH_SPLIT
577static u8 signal_buffer_is_full(unifi_priv_t* priv)
578{
579 return (((priv->rxSignalBuffer.writePointer + 1)% priv->rxSignalBuffer.size) == (priv->rxSignalBuffer.readPointer));
580}
581
582void unifi_rx_queue_flush(void *ospriv)
583{
584 unifi_priv_t *priv = (unifi_priv_t*)ospriv;
585
586 unifi_trace(priv, UDBG4, "rx_wq_handler: RdPtr = %d WritePtr = %d\n",
587 priv->rxSignalBuffer.readPointer, priv->rxSignalBuffer.writePointer);
588 if(priv != NULL) {
589 u8 readPointer = priv->rxSignalBuffer.readPointer;
590 while (readPointer != priv->rxSignalBuffer.writePointer)
591 {
592 rx_buff_struct_t *buf = &priv->rxSignalBuffer.rx_buff[readPointer];
593 unifi_trace(priv, UDBG6, "rx_wq_handler: RdPtr = %d WritePtr = %d\n",
594 readPointer, priv->rxSignalBuffer.writePointer);
595 unifi_process_receive_event(priv, buf->bufptr, buf->sig_len, &buf->data_ptrs);
596 readPointer ++;
597 if(readPointer >= priv->rxSignalBuffer.size) {
598 readPointer = 0;
599 }
600 }
601 priv->rxSignalBuffer.readPointer = readPointer;
602 }
603}
604
605void rx_wq_handler(struct work_struct *work)
606{
607 unifi_priv_t *priv = container_of(work, unifi_priv_t, rx_work_struct);
608 unifi_rx_queue_flush(priv);
609}
610#endif
611
612
613
614/*
615 * ---------------------------------------------------------------------------
616 * unifi_receive_event
617 *
618 * Dispatcher for received signals.
619 *
620 * This function receives the 'to host' signals and forwards
621 * them to the unifi linux clients.
622 *
623 * Arguments:
624 * ospriv Pointer to driver's private data.
625 * sigdata Pointer to the packed signal buffer.
626 * siglen Length of the packed signal.
627 * bulkdata Pointer to the signal's bulk data.
628 *
629 * Returns:
630 * None.
631 *
632 * Notes:
633 * The signals are received in the format described in the host interface
634 * specification, i.e wire formatted. Certain clients use the same format
635 * to interpret them and other clients use the host formatted structures.
636 * Each client has to call read_unpack_signal() to transform the wire
637 * formatted signal into the host formatted signal, if necessary.
638 * The code is in the core, since the signals are defined therefore
639 * binded to the host interface specification.
640 * ---------------------------------------------------------------------------
641 */
642void
643unifi_receive_event(void *ospriv,
644 u8 *sigdata, u32 siglen,
645 const bulk_data_param_t *bulkdata)
646{
647#ifdef CSR_WIFI_RX_PATH_SPLIT
648 unifi_priv_t *priv = (unifi_priv_t*)ospriv;
649 u8 writePointer;
650 int i;
651 rx_buff_struct_t * rx_buff;
652
653 unifi_trace(priv, UDBG5, "unifi_receive_event: "
654 "%04x %04x %04x %04x %04x %04x %04x %04x (%d)\n",
655 CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*0) & 0xFFFF,
656 CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*1) & 0xFFFF,
657 CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*2) & 0xFFFF,
658 CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*3) & 0xFFFF,
659 CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*4) & 0xFFFF,
660 CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*5) & 0xFFFF,
661 CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*6) & 0xFFFF,
662 CSR_GET_UINT16_FROM_LITTLE_ENDIAN((sigdata) + sizeof(s16)*7) & 0xFFFF, siglen);
663 if(signal_buffer_is_full(priv)) {
664 unifi_error(priv, "TO HOST signal queue FULL dropping the PDU\n");
665 for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; i++) {
666 if (bulkdata->d[i].data_length != 0) {
667 unifi_net_data_free(priv, (void *)&bulkdata->d[i]);
668 }
669 }
670 return;
671 }
672 writePointer = priv->rxSignalBuffer.writePointer;
673 rx_buff = &priv->rxSignalBuffer.rx_buff[writePointer];
674 memcpy(rx_buff->bufptr, sigdata, siglen);
675 rx_buff->sig_len = siglen;
676 rx_buff->data_ptrs = *bulkdata;
677 writePointer++;
678 if(writePointer >= priv->rxSignalBuffer.size) {
679 writePointer =0;
680 }
681 unifi_trace(priv, UDBG4, "unifi_receive_event:writePtr = %d\n", priv->rxSignalBuffer.writePointer);
682 priv->rxSignalBuffer.writePointer = writePointer;
683
684#ifndef CSR_WIFI_RX_PATH_SPLIT_DONT_USE_WQ
685 queue_work(priv->rx_workqueue, &priv->rx_work_struct);
686#endif
687
688#else
689 unifi_process_receive_event(ospriv, sigdata, siglen, bulkdata);
690#endif
691} /* unifi_receive_event() */
692
diff --git a/drivers/staging/csr/unifi_native.h b/drivers/staging/csr/unifi_native.h
deleted file mode 100644
index a73b38e5e480..000000000000
--- a/drivers/staging/csr/unifi_native.h
+++ /dev/null
@@ -1,257 +0,0 @@
1/*
2 *****************************************************************************
3 *
4 * FILE : unifi_native.h
5 *
6 * PURPOSE : Private header file for unifi driver support to wireless extensions.
7 *
8 * UDI = UniFi Debug Interface
9 *
10 * Copyright (C) 2005-2008 by Cambridge Silicon Radio Ltd.
11 *
12 * Refer to LICENSE.txt included with this source code for details on
13 * the license terms.
14 *
15 *****************************************************************************
16 */
17#ifndef __LINUX_UNIFI_NATIVE_H__
18#define __LINUX_UNIFI_NATIVE_H__ 1
19
20#include <linux/kernel.h>
21#include <linux/if_arp.h>
22
23
24/*
25 * scan.c wext.c autojoin.c
26 */
27/* Structure to hold results of a scan */
28typedef struct scan_info {
29
30/* CSR_MLME_SCAN_INDICATION msi; */
31
32 unsigned char *info_elems;
33 int info_elem_length;
34
35} scan_info_t;
36
37
38#define IE_VECTOR_MAXLEN 1024
39
40#ifdef CSR_SUPPORT_WEXT
41/*
42 * Structre to hold the wireless network configuration info.
43 */
44struct wext_config {
45
46 /* Requested channel when setting up an adhoc network */
47 int channel;
48
49 /* wireless extns mode: IW_MODE_AUTO, ADHOC, INFRA, MASTER ... MONITOR */
50 int mode;
51
52 /* The capabilities of the currently joined network */
53 int capability;
54
55 /* The interval between beacons if we create an IBSS */
56 int beacon_period;
57
58 /*
59 * Power-save parameters
60 */
61 /* The listen interval to ask for in Associate req. */
62 int assoc_listen_interval;
63 /* Power-mode to put UniFi into */
64
65 unsigned char desired_ssid[UNIFI_MAX_SSID_LEN]; /* the last ESSID set by SIOCSIWESSID */
66 int power_mode;
67 /* Whether to wake for broadcast packets (using DTIM interval) */
68 int wakeup_for_dtims;
69
70 /* Currently selected WEP Key ID (0..3) */
71 int wep_key_id;
72
73 wep_key_t wep_keys[NUM_WEPKEYS];
74
75/* CSR_AUTHENTICATION_TYPE auth_type; */
76 int privacy;
77
78 u32 join_failure_timeout;
79 u32 auth_failure_timeout;
80 u32 assoc_failure_timeout;
81
82 unsigned char generic_ie[IE_VECTOR_MAXLEN];
83 int generic_ie_len;
84
85 struct iw_statistics wireless_stats;
86
87
88 /* the ESSID we are currently associated to */
89 unsigned char current_ssid[UNIFI_MAX_SSID_LEN];
90 /* the BSSID we are currently associated to */
91 unsigned char current_bssid[6];
92
93 /*
94 * IW_AUTH_WPA_VERSION_DISABLED 0x00000001
95 * IW_AUTH_WPA_VERSION_WPA 0x00000002
96 * IW_AUTH_WPA_VERSION_WPA2 0x00000004
97 */
98 unsigned char wpa_version;
99
100 /*
101 * cipher selection:
102 * IW_AUTH_CIPHER_NONE 0x00000001
103 * IW_AUTH_CIPHER_WEP40 0x00000002
104 * IW_AUTH_CIPHER_TKIP 0x00000004
105 * IW_AUTH_CIPHER_CCMP 0x00000008
106 * IW_AUTH_CIPHER_WEP104 0x00000010
107 */
108 unsigned char pairwise_cipher_used;
109 unsigned char group_cipher_used;
110
111 unsigned int frag_thresh;
112 unsigned int rts_thresh;
113
114 /* U-APSD value, send with Association Request to WMM Enabled APs */
115 unsigned char wmm_bss_uapsd_mask;
116 /* The WMM capabilities of the selected BSS */
117 unsigned int bss_wmm_capabilities;
118
119 /* Flag to prevent a join when the ssid is set */
120 int disable_join_on_ssid_set;
121
122 /* Scan info */
123#define UNIFI_MAX_SCANS 32
124 scan_info_t scan_list[UNIFI_MAX_SCANS];
125 int num_scan_info;
126
127 /* Flag on whether non-802.1x packets are allowed out */
128/* CsrWifiRouterPortAction block_controlled_port;*/
129
130 /* Flag on whether we have completed an authenticate/associate process */
131 unsigned int flag_associated : 1;
132}; /* struct wext_config */
133
134#endif /* CSR_SUPPORT_WEXT */
135
136
137/*
138 * wext.c
139 */
140/*int mlme_set_protection(unifi_priv_t *priv, unsigned char *addr,
141 CSR_PROTECT_TYPE prot, CSR_KEY_TYPE key_type);
142*/
143
144/*
145 * scan.c
146 */
147/*
148void unifi_scan_indication_handler(unifi_priv_t *priv,
149 const CSR_MLME_SCAN_INDICATION *msg,
150 const unsigned char *extra,
151 unsigned int len);
152*/
153void unifi_clear_scan_table(unifi_priv_t *priv);
154scan_info_t *unifi_get_scan_report(unifi_priv_t *priv, int index);
155
156
157/*
158 * Utility functions
159 */
160const unsigned char *unifi_find_info_element(int id,
161 const unsigned char *info,
162 int len);
163int unifi_add_info_element(unsigned char *info,
164 int ie_id,
165 const unsigned char *ie_data,
166 int ie_len);
167
168/*
169 * autojoin.c
170 */
171/* Higher level fns */
172int unifi_autojoin(unifi_priv_t *priv, const char *ssid);
173/*
174int unifi_do_scan(unifi_priv_t *priv, int scantype, CSR_BSS_TYPE bsstype,
175 const char *ssid, int ssid_len);
176*/
177int unifi_set_powermode(unifi_priv_t *priv);
178int unifi_join_ap(unifi_priv_t *priv, scan_info_t *si);
179int unifi_join_bss(unifi_priv_t *priv, unsigned char *macaddr);
180int unifi_leave(unifi_priv_t *priv);
181unsigned int unifi_get_wmm_bss_capabilities(unifi_priv_t *priv,
182 unsigned char *ie_vector,
183 int ie_len, int *ap_capabilities);
184
185/*
186 * Status and management.
187 */
188int uf_init_wext_interface(unifi_priv_t *priv);
189void uf_deinit_wext_interface(unifi_priv_t *priv);
190
191/*
192 * Function to reset UniFi's 802.11 state by sending MLME-RESET.req
193 */
194int unifi_reset_state(unifi_priv_t *priv, unsigned char *macaddr, unsigned char set_default_mib);
195
196
197/*
198 * mlme.c
199 */
200/* Abort an MLME operation - useful in error recovery */
201int uf_abort_mlme(unifi_priv_t *priv);
202
203int unifi_mlme_blocking_request(unifi_priv_t *priv, ul_client_t *pcli,
204 CSR_SIGNAL *sig, bulk_data_param_t *data_ptrs,
205 int timeout);
206void unifi_mlme_copy_reply_and_wakeup_client(ul_client_t *pcli,
207 CSR_SIGNAL *signal, int signal_len,
208 const bulk_data_param_t *bulkdata);
209
210/*
211 * Utility functions
212 */
213const char *lookup_reason_code(int reason);
214const char *lookup_result_code(int result);
215
216
217/*
218 * sme_native.c
219 */
220int uf_sme_init(unifi_priv_t *priv);
221void uf_sme_deinit(unifi_priv_t *priv);
222int sme_sys_suspend(unifi_priv_t *priv);
223int sme_sys_resume(unifi_priv_t *priv);
224int sme_mgt_wifi_on(unifi_priv_t *priv);
225
226/* Callback for event logging to SME clients (unifi_manager) */
227void sme_native_log_event(ul_client_t *client,
228 const u8 *sig_packed, int sig_len,
229 const bulk_data_param_t *bulkdata,
230 int dir);
231
232void sme_native_mlme_event_handler(ul_client_t *pcli,
233 const u8 *sig_packed, int sig_len,
234 const bulk_data_param_t *bulkdata,
235 int dir);
236
237/* Task to query statistics from the MIB */
238#define UF_SME_STATS_WQ_TIMEOUT 2000 /* in msecs */
239void uf_sme_stats_wq(struct work_struct *work);
240
241void uf_native_process_udi_signal(ul_client_t *pcli,
242 const u8 *packed_signal,
243 int packed_signal_len,
244 const bulk_data_param_t *bulkdata, int dir);
245#ifdef UNIFI_SNIFF_ARPHRD
246/*
247 * monitor.c
248 */
249int uf_start_sniff(unifi_priv_t *priv);
250/*
251void ma_sniffdata_ind(void *ospriv,
252 const CSR_MA_SNIFFDATA_INDICATION *ind,
253 const bulk_data_param_t *bulkdata);
254*/
255#endif /* ARPHRD_IEEE80211_PRISM */
256
257#endif /* __LINUX_UNIFI_NATIVE_H__ */
diff --git a/drivers/staging/csr/unifi_os.h b/drivers/staging/csr/unifi_os.h
deleted file mode 100644
index 56a26982070e..000000000000
--- a/drivers/staging/csr/unifi_os.h
+++ /dev/null
@@ -1,122 +0,0 @@
1/*
2 * ---------------------------------------------------------------------------
3 *
4 * FILE: os_linux/unifi_os.h
5 *
6 * PURPOSE:
7 * This header file provides the OS-dependent facilities for a linux
8 * environment.
9 *
10 * Copyright (C) 2005-2008 by Cambridge Silicon Radio Ltd.
11 *
12 * Refer to LICENSE.txt included with this source code for details on
13 * the license terms.
14 *
15 * ---------------------------------------------------------------------------
16 */
17#ifndef __UNIFI_OS_LINUX_H__
18#define __UNIFI_OS_LINUX_H__ 1
19
20#include <linux/kernel.h>
21#include <linux/time.h>
22#include <linux/list.h>
23#include <linux/delay.h>
24#include <linux/string.h>
25
26/*
27 * Needed for core/signals.c
28 */
29#include <stddef.h>
30
31
32/* Define INLINE directive*/
33#define INLINE inline
34
35/* Malloc and free */
36CsrResult unifi_net_data_malloc(void *ospriv, bulk_data_desc_t *bulk_data_slot, unsigned int size);
37void unifi_net_data_free(void *ospriv, bulk_data_desc_t *bulk_data_slot);
38#define CSR_WIFI_ALIGN_BYTES 4
39CsrResult unifi_net_dma_align(void *ospriv, bulk_data_desc_t *bulk_data_slot);
40
41/*
42 * Byte Order
43 * Note that __le*_to_cpu and __cpu_to_le* return an unsigned value!
44 */
45#ifdef __KERNEL__
46#define unifi2host_16(n) (__le16_to_cpu((n)))
47#define unifi2host_32(n) (__le32_to_cpu((n)))
48#define host2unifi_16(n) (__cpu_to_le16((n)))
49#define host2unifi_32(n) (__cpu_to_le32((n)))
50#endif
51
52/* Module parameters */
53extern int unifi_debug;
54
55/* debugging */
56#ifdef UNIFI_DEBUG
57/*
58 * unifi_debug is a verbosity level for debug messages
59 * UDBG0 msgs are always printed if UNIFI_DEBUG is defined
60 * UDBG1 msgs are printed if UNIFI_DEBUG is defined and unifi_debug > 0
61 * etc.
62 */
63
64#define ASSERT(cond) \
65 do { \
66 if (!(cond)) { \
67 printk("Assertion failed in %s at %s:%d: %s\n", \
68 __FUNCTION__, __FILE__, __LINE__, #cond); \
69 } \
70 } while (0)
71
72
73void unifi_dump(void *ospriv, int lvl, const char *msg, void *mem, u16 len);
74void dump(void *mem, u16 len);
75void dump16(void *mem, u16 len);
76#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
77void dump_str(void *mem, u16 len);
78#endif /* CSR_WIFI_HIP_DEBUG_OFFLINE */
79
80void unifi_error(void* ospriv, const char *fmt, ...);
81void unifi_warning(void* ospriv, const char *fmt, ...);
82void unifi_notice(void* ospriv, const char *fmt, ...);
83void unifi_info(void* ospriv, const char *fmt, ...);
84
85void unifi_trace(void* ospriv, int level, const char *fmt, ...);
86
87#else
88
89/* Stubs */
90
91#define ASSERT(cond)
92
93static inline void unifi_dump(void *ospriv, int lvl, const char *msg, void *mem, u16 len) {}
94static inline void dump(void *mem, u16 len) {}
95static inline void dump16(void *mem, u16 len) {}
96#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
97static inline void dump_str(void *mem, u16 len) {}
98#endif /* CSR_WIFI_HIP_DEBUG_OFFLINE */
99
100void unifi_error_nop(void* ospriv, const char *fmt, ...);
101void unifi_trace_nop(void* ospriv, int level, const char *fmt, ...);
102#define unifi_error if(1);else unifi_error_nop
103#define unifi_warning if(1);else unifi_error_nop
104#define unifi_notice if(1);else unifi_error_nop
105#define unifi_info if(1);else unifi_error_nop
106#define unifi_trace if(1);else unifi_trace_nop
107
108#endif /* UNIFI_DEBUG */
109
110
111/* Different levels of diagnostic detail... */
112#define UDBG0 0 /* always prints in debug build */
113#define UDBG1 1
114#define UDBG2 2
115#define UDBG3 3
116#define UDBG4 4
117#define UDBG5 5
118#define UDBG6 6
119#define UDBG7 7
120
121
122#endif /* __UNIFI_OS_LINUX_H__ */
diff --git a/drivers/staging/csr/unifi_pdu_processing.c b/drivers/staging/csr/unifi_pdu_processing.c
deleted file mode 100644
index 04fe9e2acf0e..000000000000
--- a/drivers/staging/csr/unifi_pdu_processing.c
+++ /dev/null
@@ -1,3729 +0,0 @@
1/*
2 * ---------------------------------------------------------------------------
3 * FILE: unifi_pdu_processing.c
4 *
5 * PURPOSE:
6 * This file provides the PDU handling functionality before it gets sent to unfi and after
7 * receiving a PDU from unifi
8 *
9 * Copyright (C) 2010 by Cambridge Silicon Radio Ltd.
10 *
11 * Refer to LICENSE.txt included with this source code for details on
12 * the license terms.
13 *
14 * ---------------------------------------------------------------------------
15 */
16
17#include <linux/types.h>
18#include <linux/etherdevice.h>
19#include <linux/vmalloc.h>
20
21#include "csr_wifi_hip_unifi.h"
22#include "csr_wifi_hip_conversions.h"
23#include "csr_time.h"
24#include "unifi_priv.h"
25#include <net/pkt_sched.h>
26
27#ifdef CSR_SUPPORT_SME
28static void _update_buffered_pkt_params_after_alignment(unifi_priv_t *priv, bulk_data_param_t *bulkdata,
29 tx_buffered_packets_t* buffered_pkt)
30{
31 struct sk_buff *skb ;
32 u32 align_offset;
33
34 if (priv == NULL || bulkdata == NULL || buffered_pkt == NULL){
35 return;
36 }
37
38 skb = (struct sk_buff*)bulkdata->d[0].os_net_buf_ptr;
39 align_offset = (u32)(long)(bulkdata->d[0].os_data_ptr) & (CSR_WIFI_ALIGN_BYTES-1);
40 if(align_offset){
41 skb_pull(skb, align_offset);
42 }
43
44 buffered_pkt->bulkdata.os_data_ptr = bulkdata->d[0].os_data_ptr;
45 buffered_pkt->bulkdata.data_length = bulkdata->d[0].data_length;
46 buffered_pkt->bulkdata.os_net_buf_ptr = bulkdata->d[0].os_net_buf_ptr;
47 buffered_pkt->bulkdata.net_buf_length = bulkdata->d[0].net_buf_length;
48}
49#endif
50
51void
52unifi_frame_ma_packet_req(unifi_priv_t *priv, CSR_PRIORITY priority,
53 CSR_RATE TransmitRate, CSR_CLIENT_TAG hostTag,
54 u16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl,
55 CSR_PROCESS_ID leSenderProcessId, u8 *peerMacAddress,
56 CSR_SIGNAL *signal)
57{
58
59 CSR_MA_PACKET_REQUEST *req = &signal->u.MaPacketRequest;
60 netInterface_priv_t *interfacePriv;
61 u8 ba_session_idx = 0;
62 ba_session_tx_struct *ba_session = NULL;
63 u8 *ba_addr = NULL;
64
65 interfacePriv = priv->interfacePriv[interfaceTag];
66
67 unifi_trace(priv, UDBG5,
68 "In unifi_frame_ma_packet_req, Frame for Peer: %pMF\n",
69 peerMacAddress);
70 signal->SignalPrimitiveHeader.SignalId = CSR_MA_PACKET_REQUEST_ID;
71 signal->SignalPrimitiveHeader.ReceiverProcessId = 0;
72 signal->SignalPrimitiveHeader.SenderProcessId = leSenderProcessId;
73
74 /* Fill the MA-PACKET.req */
75 req->Priority = priority;
76 unifi_trace(priv, UDBG3, "Tx Frame with Priority: 0x%x\n", req->Priority);
77
78 /* A value of 0 is used for auto selection of rates. But for P2P GO case
79 * for action frames the rate is governed by SME. Hence instead of 0,
80 * the rate is filled in with the value passed here
81 */
82 req->TransmitRate = TransmitRate;
83
84 /* packets from netdev then no confirm required but packets from
85 * Nme/Sme eapol data frames requires the confirmation
86 */
87 req->TransmissionControl = transmissionControl;
88 req->VirtualInterfaceIdentifier =
89 uf_get_vif_identifier(interfacePriv->interfaceMode, interfaceTag);
90 memcpy(req->Ra.x, peerMacAddress, ETH_ALEN);
91
92 if (hostTag == 0xffffffff) {
93 req->HostTag = interfacePriv->tag++;
94 req->HostTag |= 0x40000000;
95 unifi_trace(priv, UDBG3, "new host tag assigned = 0x%x\n", req->HostTag);
96 interfacePriv->tag &= 0x0fffffff;
97 } else {
98 req->HostTag = hostTag;
99 unifi_trace(priv, UDBG3, "host tag got from SME = 0x%x\n", req->HostTag);
100 }
101 /* check if BA session exists for the peer MAC address on same tID */
102 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
103 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO){
104 ba_addr = peerMacAddress;
105 }else{
106 ba_addr = interfacePriv->bssid.a;
107 }
108 for (ba_session_idx=0; ba_session_idx < MAX_SUPPORTED_BA_SESSIONS_TX; ba_session_idx++){
109 ba_session = interfacePriv->ba_session_tx[ba_session_idx];
110 if (ba_session){
111 if ((!memcmp(ba_session->macAddress.a, ba_addr, ETH_ALEN)) && (ba_session->tID == priority)){
112 req->TransmissionControl |= CSR_ALLOW_BA;
113 break;
114 }
115 }
116 }
117
118 unifi_trace(priv, UDBG5, "leaving unifi_frame_ma_packet_req\n");
119}
120
121#ifdef CSR_SUPPORT_SME
122
123#define TRANSMISSION_CONTROL_TRIGGER_MASK 0x0001
124#define TRANSMISSION_CONTROL_EOSP_MASK 0x0002
125
126static
127int frame_and_send_queued_pdu(unifi_priv_t* priv, tx_buffered_packets_t* buffered_pkt,
128 CsrWifiRouterCtrlStaInfo_t *staRecord, u8 moreData , u8 eosp)
129{
130
131 CSR_SIGNAL signal;
132 bulk_data_param_t bulkdata;
133 int result;
134 u8 toDs, fromDs, macHeaderLengthInBytes = MAC_HEADER_SIZE;
135 u8 *qc;
136 u16 *fc = (u16*)(buffered_pkt->bulkdata.os_data_ptr);
137 unsigned long lock_flags;
138 unifi_trace(priv, UDBG3, "frame_and_send_queued_pdu with moreData: %d , EOSP: %d\n", moreData, eosp);
139 unifi_frame_ma_packet_req(priv, buffered_pkt->priority, buffered_pkt->rate, buffered_pkt->hostTag,
140 buffered_pkt->interfaceTag, buffered_pkt->transmissionControl,
141 buffered_pkt->leSenderProcessId, buffered_pkt->peerMacAddress.a, &signal);
142 bulkdata.d[0].os_data_ptr = buffered_pkt->bulkdata.os_data_ptr;
143 bulkdata.d[0].data_length = buffered_pkt->bulkdata.data_length;
144 bulkdata.d[0].os_net_buf_ptr = buffered_pkt->bulkdata.os_net_buf_ptr;
145 bulkdata.d[0].net_buf_length = buffered_pkt->bulkdata.net_buf_length;
146 bulkdata.d[1].os_data_ptr = NULL;
147 bulkdata.d[1].data_length = 0;
148 bulkdata.d[1].os_net_buf_ptr =0;
149 bulkdata.d[1].net_buf_length =0;
150
151 if(moreData) {
152 *fc |= cpu_to_le16(IEEE802_11_FC_MOREDATA_MASK);
153 } else {
154 *fc &= cpu_to_le16(~IEEE802_11_FC_MOREDATA_MASK);
155 }
156
157 if((staRecord != NULL)&& (staRecord->wmmOrQosEnabled == TRUE))
158 {
159 unifi_trace(priv, UDBG3, "frame_and_send_queued_pdu WMM Enabled: %d \n", staRecord->wmmOrQosEnabled);
160
161 toDs = (*fc & cpu_to_le16(IEEE802_11_FC_TO_DS_MASK))?1 : 0;
162 fromDs = (*fc & cpu_to_le16(IEEE802_11_FC_FROM_DS_MASK))? 1: 0;
163
164 switch(le16_to_cpu(*fc) & IEEE80211_FC_SUBTYPE_MASK)
165 {
166 case IEEE802_11_FC_TYPE_QOS_DATA & IEEE80211_FC_SUBTYPE_MASK:
167 case IEEE802_11_FC_TYPE_QOS_NULL & IEEE80211_FC_SUBTYPE_MASK:
168 /* If both are set then the Address4 exists (only for AP) */
169 if (fromDs && toDs) {
170 /* 6 is the size of Address4 field */
171 macHeaderLengthInBytes += (QOS_CONTROL_HEADER_SIZE + 6);
172 } else {
173 macHeaderLengthInBytes += QOS_CONTROL_HEADER_SIZE;
174 }
175
176 /* If order bit set then HT control field is the part of MAC header */
177 if (*fc & cpu_to_le16(IEEE80211_FC_ORDER_MASK)) {
178 macHeaderLengthInBytes += HT_CONTROL_HEADER_SIZE;
179 qc = (u8*)(buffered_pkt->bulkdata.os_data_ptr + (macHeaderLengthInBytes-6));
180 } else {
181 qc = (u8*)(buffered_pkt->bulkdata.os_data_ptr + (macHeaderLengthInBytes-2));
182 }
183 *qc = eosp ? *qc | (1 << 4) : *qc & (~(1 << 4));
184 break;
185 default:
186 if (fromDs && toDs)
187 macHeaderLengthInBytes += 6;
188 }
189
190 }
191 result = ul_send_signal_unpacked(priv, &signal, &bulkdata);
192 if(result){
193 _update_buffered_pkt_params_after_alignment(priv, &bulkdata, buffered_pkt);
194 }
195
196 /* Decrement the packet counts queued in driver */
197 if (result != -ENOSPC) {
198 /* protect entire counter updation by disabling preemption */
199 if (!priv->noOfPktQueuedInDriver) {
200 unifi_error(priv, "packets queued in driver 0 still decrementing\n");
201 } else {
202 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
203 priv->noOfPktQueuedInDriver--;
204 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
205 }
206 /* Sta Record is available for all unicast (except genericMgt Frames) & in other case its NULL */
207 if (staRecord) {
208 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
209 if (!staRecord->noOfPktQueued) {
210 unifi_error(priv, "packets queued in driver per station is 0 still decrementing\n");
211 } else {
212 staRecord->noOfPktQueued--;
213 }
214 /* if the STA alive probe frame has failed then reset the saved host tag */
215 if (result){
216 if (staRecord->nullDataHostTag == buffered_pkt->hostTag){
217 staRecord->nullDataHostTag = INVALID_HOST_TAG;
218 }
219 }
220 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
221 }
222
223 }
224 return result;
225}
226#ifdef CSR_SUPPORT_SME
227static
228void set_eosp_transmit_ctrl(unifi_priv_t *priv, struct list_head *txList)
229{
230 /* dequeue the tx data packets from the appropriate queue */
231 tx_buffered_packets_t *tx_q_item = NULL;
232 struct list_head *listHead;
233 struct list_head *placeHolder;
234 unsigned long lock_flags;
235
236
237 unifi_trace(priv, UDBG5, "entering set_eosp_transmit_ctrl\n");
238 /* check for list empty */
239 if (list_empty(txList)) {
240 unifi_warning(priv, "In set_eosp_transmit_ctrl, the list is empty\n");
241 return;
242 }
243
244 /* return the last node , and modify it. */
245
246 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
247 list_for_each_prev_safe(listHead, placeHolder, txList) {
248 tx_q_item = list_entry(listHead, tx_buffered_packets_t, q);
249 tx_q_item->transmissionControl |= TRANSMISSION_CONTROL_EOSP_MASK;
250 tx_q_item->transmissionControl = (tx_q_item->transmissionControl & ~(CSR_NO_CONFIRM_REQUIRED));
251 unifi_trace(priv, UDBG1,
252 "set_eosp_transmit_ctrl Transmission Control = 0x%x hostTag = 0x%x \n", tx_q_item->transmissionControl, tx_q_item->hostTag);
253 unifi_trace(priv, UDBG3, "in set_eosp_transmit_ctrl no.of buffered frames %d\n", priv->noOfPktQueuedInDriver);
254 break;
255 }
256 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
257 unifi_trace(priv, UDBG1, "List Empty %d\n", list_empty(txList));
258 unifi_trace(priv, UDBG5, "leaving set_eosp_transmit_ctrl\n");
259 return;
260}
261
262static
263void send_vif_availibility_rsp(unifi_priv_t *priv, CSR_VIF_IDENTIFIER vif, CSR_RESULT_CODE resultCode)
264{
265 CSR_SIGNAL signal;
266 CSR_MA_VIF_AVAILABILITY_RESPONSE *rsp;
267 bulk_data_param_t *bulkdata = NULL;
268 int r;
269
270 unifi_trace(priv, UDBG3, "send_vif_availibility_rsp : invoked with resultCode = %d \n", resultCode);
271
272 memset(&signal, 0, sizeof(CSR_SIGNAL));
273 rsp = &signal.u.MaVifAvailabilityResponse;
274 rsp->VirtualInterfaceIdentifier = vif;
275 rsp->ResultCode = resultCode;
276 signal.SignalPrimitiveHeader.SignalId = CSR_MA_VIF_AVAILABILITY_RESPONSE_ID;
277 signal.SignalPrimitiveHeader.ReceiverProcessId = 0;
278 signal.SignalPrimitiveHeader.SenderProcessId = priv->netdev_client->sender_id;
279
280 /* Send the signal to UniFi */
281 r = ul_send_signal_unpacked(priv, &signal, bulkdata);
282 if(r) {
283 unifi_error(priv, "Availibility response sending failed %x status %d\n", vif, r);
284 }
285 else {
286 unifi_trace(priv, UDBG3, "send_vif_availibility_rsp : status = %d \n", r);
287 }
288}
289#endif
290
291static
292void verify_and_accomodate_tx_packet(unifi_priv_t *priv)
293{
294 tx_buffered_packets_t *tx_q_item;
295 unsigned long lock_flags;
296 struct list_head *listHead, *list;
297 struct list_head *placeHolder;
298 u8 i, j, eospFramedeleted=0;
299 u8 thresholdExcedeDueToBroadcast = TRUE;
300 /* it will be made it interface Specific in the future when multi interfaces are supported ,
301 right now interface 0 is considered */
302 netInterface_priv_t *interfacePriv = priv->interfacePriv[0];
303 CsrWifiRouterCtrlStaInfo_t *staInfo = NULL;
304
305 unifi_trace(priv, UDBG3, "entering verify_and_accomodate_tx_packet\n");
306
307 for(i = 0; i < UNIFI_MAX_CONNECTIONS; i++) {
308 staInfo = interfacePriv->staInfo[i];
309 if (staInfo && (staInfo->noOfPktQueued >= CSR_WIFI_DRIVER_MAX_PKT_QUEUING_THRESHOLD_PER_PEER)) {
310 /* remove the first(oldest) packet from the all the access catogory, since data
311 * packets for station record crossed the threshold limit (64 for AP supporting
312 * 8 peers)
313 */
314 unifi_trace(priv, UDBG3, "number of station pkts queued= %d for sta id = %d\n", staInfo->noOfPktQueued, staInfo->aid);
315 for(j = 0; j < MAX_ACCESS_CATOGORY; j++) {
316 list = &staInfo->dataPdu[j];
317 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
318 list_for_each_safe(listHead, placeHolder, list) {
319 tx_q_item = list_entry(listHead, tx_buffered_packets_t, q);
320 list_del(listHead);
321 thresholdExcedeDueToBroadcast = FALSE;
322 unifi_net_data_free(priv, &tx_q_item->bulkdata);
323 kfree(tx_q_item);
324 tx_q_item = NULL;
325 if (!priv->noOfPktQueuedInDriver) {
326 unifi_error(priv, "packets queued in driver 0 still decrementing in %s\n", __FUNCTION__);
327 } else {
328 /* protection provided by spinlock */
329 priv->noOfPktQueuedInDriver--;
330
331 }
332 /* Sta Record is available for all unicast (except genericMgt Frames) & in other case its NULL */
333 if (!staInfo->noOfPktQueued) {
334 unifi_error(priv, "packets queued in driver per station is 0 still decrementing in %s\n", __FUNCTION__);
335 } else {
336 spin_lock(&priv->staRecord_lock);
337 staInfo->noOfPktQueued--;
338 spin_unlock(&priv->staRecord_lock);
339 }
340 break;
341 }
342 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
343 }
344 }
345 }
346 if (thresholdExcedeDueToBroadcast && interfacePriv->noOfbroadcastPktQueued > CSR_WIFI_DRIVER_MINIMUM_BROADCAST_PKT_THRESHOLD ) {
347 /* Remove the packets from genericMulticastOrBroadCastFrames queue
348 * (the max packets in driver is reached due to broadcast/multicast frames)
349 */
350 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
351 list_for_each_safe(listHead, placeHolder, &interfacePriv->genericMulticastOrBroadCastFrames) {
352 tx_q_item = list_entry(listHead, tx_buffered_packets_t, q);
353 if(eospFramedeleted){
354 tx_q_item->transmissionControl |= TRANSMISSION_CONTROL_EOSP_MASK;
355 tx_q_item->transmissionControl = (tx_q_item->transmissionControl & ~(CSR_NO_CONFIRM_REQUIRED));
356 unifi_trace(priv, UDBG1, "updating eosp for next packet hostTag:= 0x%x ", tx_q_item->hostTag);
357 eospFramedeleted =0;
358 break;
359 }
360
361 if(tx_q_item->transmissionControl & TRANSMISSION_CONTROL_EOSP_MASK ){
362 eospFramedeleted = 1;
363 }
364 unifi_trace(priv, UDBG1, "freeing of multicast packets ToC = 0x%x hostTag = 0x%x \n", tx_q_item->transmissionControl, tx_q_item->hostTag);
365 list_del(listHead);
366 unifi_net_data_free(priv, &tx_q_item->bulkdata);
367 kfree(tx_q_item);
368 priv->noOfPktQueuedInDriver--;
369 spin_lock(&priv->staRecord_lock);
370 interfacePriv->noOfbroadcastPktQueued--;
371 spin_unlock(&priv->staRecord_lock);
372 if(!eospFramedeleted){
373 break;
374 }
375 }
376 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
377 }
378 unifi_trace(priv, UDBG3, "leaving verify_and_accomodate_tx_packet\n");
379}
380
381static
382CsrResult enque_tx_data_pdu(unifi_priv_t *priv, bulk_data_param_t *bulkdata,
383 struct list_head *list, CSR_SIGNAL *signal,
384 u8 requeueOnSamePos)
385{
386
387 /* queue the tx data packets on to appropriate queue */
388 CSR_MA_PACKET_REQUEST *req = &signal->u.MaPacketRequest;
389 tx_buffered_packets_t *tx_q_item;
390 unsigned long lock_flags;
391
392 unifi_trace(priv, UDBG5, "entering enque_tx_data_pdu\n");
393 if(!list) {
394 unifi_error(priv, "List is not specified\n");
395 return CSR_RESULT_FAILURE;
396 }
397
398 /* Removes aged packets & adds the incoming packet */
399 if (priv->noOfPktQueuedInDriver >= CSR_WIFI_DRIVER_SUPPORT_FOR_MAX_PKT_QUEUEING) {
400 unifi_trace(priv, UDBG3, "number of pkts queued= %d \n", priv->noOfPktQueuedInDriver);
401 verify_and_accomodate_tx_packet(priv);
402 }
403
404
405
406 tx_q_item = kmalloc(sizeof(tx_buffered_packets_t), GFP_ATOMIC);
407 if (tx_q_item == NULL) {
408 unifi_error(priv,
409 "Failed to allocate %d bytes for tx packet record\n",
410 sizeof(tx_buffered_packets_t));
411 return CSR_RESULT_FAILURE;
412 }
413
414 /* disable the preemption */
415 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
416 INIT_LIST_HEAD(&tx_q_item->q);
417 /* fill the tx_q structure members */
418 tx_q_item->bulkdata.os_data_ptr = bulkdata->d[0].os_data_ptr;
419 tx_q_item->bulkdata.data_length = bulkdata->d[0].data_length;
420 tx_q_item->bulkdata.os_net_buf_ptr = bulkdata->d[0].os_net_buf_ptr;
421 tx_q_item->bulkdata.net_buf_length = bulkdata->d[0].net_buf_length;
422 tx_q_item->interfaceTag = req->VirtualInterfaceIdentifier & 0xff;
423 tx_q_item->hostTag = req->HostTag;
424 tx_q_item->leSenderProcessId = signal->SignalPrimitiveHeader.SenderProcessId;
425 tx_q_item->transmissionControl = req->TransmissionControl;
426 tx_q_item->priority = req->Priority;
427 tx_q_item->rate = req->TransmitRate;
428 memcpy(tx_q_item->peerMacAddress.a, req->Ra.x, ETH_ALEN);
429
430
431
432 if (requeueOnSamePos) {
433 list_add(&tx_q_item->q, list);
434 } else {
435 list_add_tail(&tx_q_item->q, list);
436 }
437
438 /* Count of packet queued in driver */
439 priv->noOfPktQueuedInDriver++;
440 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
441 unifi_trace(priv, UDBG5, "leaving enque_tx_data_pdu\n");
442 return CSR_RESULT_SUCCESS;
443}
444
445#ifdef CSR_WIFI_REQUEUE_PACKET_TO_HAL
446CsrResult unifi_reque_ma_packet_request (void *ospriv, u32 host_tag,
447 u16 txStatus, bulk_data_desc_t *bulkDataDesc)
448{
449 CsrResult status = CSR_RESULT_SUCCESS;
450 unifi_priv_t *priv = (unifi_priv_t*)ospriv;
451 netInterface_priv_t *interfacePriv;
452 struct list_head *list = NULL;
453 CsrWifiRouterCtrlStaInfo_t *staRecord = NULL;
454 bulk_data_param_t bulkData;
455 CSR_SIGNAL signal;
456 CSR_PRIORITY priority = 0;
457 u16 interfaceTag = 0;
458 unifi_TrafficQueue priority_q;
459 u16 frameControl = 0, frameType = 0;
460 unsigned long lock_flags;
461
462 interfacePriv = priv->interfacePriv[interfaceTag];
463
464 /* If the current mode is not AP or P2PGO then just return failure
465 * to clear the hip slot
466 */
467 if(!((interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP) ||
468 (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO))) {
469 return CSR_RESULT_FAILURE;
470 }
471
472 unifi_trace(priv, UDBG6, "unifi_reque_ma_packet_request: host_tag = 0x%x\n", host_tag);
473
474 staRecord = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv,
475 (((u8 *) bulkDataDesc->os_data_ptr) + 4),
476 interfaceTag);
477 if (NULL == staRecord) {
478 unifi_trace(priv, UDBG5, "unifi_reque_ma_packet_request: Invalid STA record \n");
479 return CSR_RESULT_FAILURE;
480 }
481
482 /* Update TIM if MA-PACKET.cfm fails with status as Tx-retry-limit or No-BSS and then just return failure
483 * to clear the hip slot associated with the Packet
484 */
485 if (CSR_TX_RETRY_LIMIT == txStatus || CSR_TX_NO_BSS == txStatus) {
486 if (staRecord->timSet == CSR_WIFI_TIM_RESET || staRecord->timSet == CSR_WIFI_TIM_RESETTING)
487 {
488 unifi_trace(priv, UDBG2, "unifi_reque_ma_packet_request: CFM failed with Retry Limit or No BSS-->update TIM\n");
489 if (!staRecord->timRequestPendingFlag) {
490 update_tim(priv, staRecord->aid, 1, interfaceTag, staRecord->assignedHandle);
491 }
492 else {
493 /* Cache the TimSet value so that it will processed immidiatly after
494 * completing the current setTim Request
495 */
496 staRecord->updateTimReqQueued = 1;
497 unifi_trace(priv, UDBG6, "unifi_reque_ma_packet_request: One more UpdateTim Request(:%d)Queued for AID %x\n",
498 staRecord->updateTimReqQueued, staRecord->aid);
499 }
500 }
501 return CSR_RESULT_FAILURE;
502 }
503 else if ((CSR_TX_LIFETIME == txStatus) || (CSR_TX_BLOCK_ACK_TIMEOUT == txStatus) ||
504 (CSR_TX_FAIL_TRANSMISSION_VIF_INTERRUPTED == txStatus) ||
505 (CSR_TX_REJECTED_PEER_STATION_SLEEPING == txStatus) ||
506 (CSR_TX_REJECTED_DTIM_STARTED == txStatus)) {
507 /* Extract the Frame control and the frame type */
508 frameControl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(bulkDataDesc->os_data_ptr);
509 frameType = ((frameControl & IEEE80211_FC_TYPE_MASK) >> FRAME_CONTROL_TYPE_FIELD_OFFSET);
510
511 /* Mgmt frames will not be re-queued for Tx
512 * so just return failure to clear the hip slot
513 */
514 if (IEEE802_11_FRAMETYPE_MANAGEMENT == frameType) {
515 return CSR_RESULT_FAILURE;
516 }
517 else if (IEEE802_11_FRAMETYPE_DATA == frameType) {
518 /* QOS NULL and DATA NULL frames will not be re-queued for Tx
519 * so just return failure to clear the hip slot
520 */
521 if ((((frameControl & IEEE80211_FC_SUBTYPE_MASK) >> FRAME_CONTROL_SUBTYPE_FIELD_OFFSET) == QOS_DATA_NULL) ||
522 (((frameControl & IEEE80211_FC_SUBTYPE_MASK) >> FRAME_CONTROL_SUBTYPE_FIELD_OFFSET)== DATA_NULL )) {
523 return CSR_RESULT_FAILURE;
524 }
525 }
526
527 /* Extract the Packet priority */
528 if (TRUE == staRecord->wmmOrQosEnabled) {
529 u16 qosControl = 0;
530 u8 dataFrameType = 0;
531
532 dataFrameType =((frameControl & IEEE80211_FC_SUBTYPE_MASK) >> 4);
533
534 if (dataFrameType == QOS_DATA) {
535 /* QoS control field is offset from frame control by 2 (frame control)
536 * + 2 (duration/ID) + 2 (sequence control) + 3*ETH_ALEN or 4*ETH_ALEN
537 */
538 if((frameControl & IEEE802_11_FC_TO_DS_MASK) && (frameControl & IEEE802_11_FC_FROM_DS_MASK)) {
539 qosControl= CSR_GET_UINT16_FROM_LITTLE_ENDIAN(bulkDataDesc->os_data_ptr + 30);
540 }
541 else {
542 qosControl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(bulkDataDesc->os_data_ptr + 24);
543 }
544 }
545
546 priority = (CSR_PRIORITY)(qosControl & IEEE802_11_QC_TID_MASK);
547
548 if (priority < CSR_QOS_UP0 || priority > CSR_QOS_UP7) {
549 unifi_trace(priv, UDBG5, "unifi_reque_ma_packet_request: Invalid priority:%x \n", priority);
550 return CSR_RESULT_FAILURE;
551 }
552 }
553 else {
554 priority = CSR_CONTENTION;
555 }
556
557 /* Frame Bulk data to requeue it back to HAL Queues */
558 bulkData.d[0].os_data_ptr = bulkDataDesc->os_data_ptr;
559 bulkData.d[0].data_length = bulkDataDesc->data_length;
560 bulkData.d[0].os_net_buf_ptr = bulkDataDesc->os_net_buf_ptr;
561 bulkData.d[0].net_buf_length = bulkDataDesc->net_buf_length;
562
563 bulkData.d[1].os_data_ptr = NULL;
564 bulkData.d[1].os_net_buf_ptr = NULL;
565 bulkData.d[1].data_length = bulkData.d[1].net_buf_length = 0;
566
567 /* Initialize signal to zero */
568 memset(&signal, 0, sizeof(CSR_SIGNAL));
569
570 /* Frame MA Packet Req */
571 unifi_frame_ma_packet_req(priv, priority, 0, host_tag,
572 interfaceTag, CSR_NO_CONFIRM_REQUIRED,
573 priv->netdev_client->sender_id,
574 staRecord->peerMacAddress.a, &signal);
575
576 /* Find the Q-Priority */
577 priority_q = unifi_frame_priority_to_queue(priority);
578 list = &staRecord->dataPdu[priority_q];
579
580 /* Place the Packet on to HAL Queue */
581 status = enque_tx_data_pdu(priv, &bulkData, list, &signal, TRUE);
582
583 /* Update the Per-station queued packet counter */
584 if (!status) {
585 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
586 staRecord->noOfPktQueued++;
587 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
588 }
589 }
590 else {
591 /* Packet will not be re-queued for any of the other MA Packet Tx failure
592 * reasons so just return failure to clear the hip slot
593 */
594 return CSR_RESULT_FAILURE;
595 }
596
597 return status;
598}
599#endif
600
601static void is_all_ac_deliver_enabled_and_moredata(CsrWifiRouterCtrlStaInfo_t *staRecord, u8 *allDeliveryEnabled, u8 *dataAvailable)
602{
603 u8 i;
604 *allDeliveryEnabled = TRUE;
605 for (i = 0 ;i < MAX_ACCESS_CATOGORY; i++) {
606 if (!IS_DELIVERY_ENABLED(staRecord->powersaveMode[i])) {
607 /* One is is not Delivery Enabled */
608 *allDeliveryEnabled = FALSE;
609 break;
610 }
611 }
612 if (*allDeliveryEnabled) {
613 *dataAvailable = (!list_empty(&staRecord->dataPdu[0]) || !list_empty(&staRecord->dataPdu[1])
614 ||!list_empty(&staRecord->dataPdu[2]) ||!list_empty(&staRecord->dataPdu[3])
615 ||!list_empty(&staRecord->mgtFrames));
616 }
617}
618
619/*
620 * ---------------------------------------------------------------------------
621 * uf_handle_tim_cfm
622 *
623 *
624 * This function updates tim status in host depending confirm status from firmware
625 *
626 * Arguments:
627 * priv Pointer to device private context struct
628 * cfm CSR_MLME_SET_TIM_CONFIRM
629 * receiverProcessId SenderProcessID to fetch handle & timSet status
630 *
631 * ---------------------------------------------------------------------------
632 */
633void uf_handle_tim_cfm(unifi_priv_t *priv, CSR_MLME_SET_TIM_CONFIRM *cfm, u16 receiverProcessId)
634{
635 u8 handle = CSR_WIFI_GET_STATION_HANDLE_FROM_RECEIVER_ID(receiverProcessId);
636 u8 timSetStatus = CSR_WIFI_GET_TIMSET_STATE_FROM_RECEIVER_ID(receiverProcessId);
637 u16 interfaceTag = (cfm->VirtualInterfaceIdentifier & 0xff);
638 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
639 CsrWifiRouterCtrlStaInfo_t *staRecord = NULL;
640 /* This variable holds what TIM value we wanted to set in firmware */
641 u16 timSetValue = 0;
642 /* Irrespective of interface the count maintained */
643 static u8 retryCount = 0;
644 unsigned long lock_flags;
645 unifi_trace(priv, UDBG3, "entering %s, handle = %x, timSetStatus = %x\n", __FUNCTION__, handle, timSetStatus);
646
647 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
648 unifi_warning(priv, "bad interfaceTag = %x\n", interfaceTag);
649 return;
650 }
651
652 if ((handle != CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE) && (handle >= UNIFI_MAX_CONNECTIONS)) {
653 unifi_warning(priv, "bad station Handle = %x\n", handle);
654 return;
655 }
656
657 if (handle != CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE) {
658 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
659 if ((staRecord = ((CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[handle]))) == NULL) {
660 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
661 unifi_warning(priv, "uf_handle_tim_cfm: station record is NULL handle = %x\n", handle);
662 return;
663 }
664 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
665 }
666 switch(timSetStatus)
667 {
668 case CSR_WIFI_TIM_SETTING:
669 timSetValue = CSR_WIFI_TIM_SET;
670 break;
671 case CSR_WIFI_TIM_RESETTING:
672 timSetValue = CSR_WIFI_TIM_RESET;
673 break;
674 default:
675 unifi_warning(priv, "timSet state is %x: Debug\n", timSetStatus);
676 return;
677 }
678
679 /* check TIM confirm for success/failures */
680 switch(cfm->ResultCode)
681 {
682 case CSR_RC_SUCCESS:
683 if (handle != CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE) {
684 /* Unicast frame & station record available */
685 if (timSetStatus == staRecord->timSet) {
686 staRecord->timSet = timSetValue;
687 /* fh_cmd_q can also be full at some point of time!,
688 * resetting count as queue is cleaned by firmware at this point
689 */
690 retryCount = 0;
691 unifi_trace(priv, UDBG2, "tim (%s) successfully in firmware\n", (timSetValue)?"SET":"RESET");
692 } else {
693 unifi_trace(priv, UDBG3, "receiver processID = %x, success: request & confirm states are not matching in TIM cfm: Debug status = %x, staRecord->timSet = %x, handle = %x\n",
694 receiverProcessId, timSetStatus, staRecord->timSet, handle);
695 }
696
697 /* Reset TIM pending flag to send next TIM request */
698 staRecord->timRequestPendingFlag = FALSE;
699
700 /* Make sure that one more UpdateTim request is queued, if Queued its value
701 * should be CSR_WIFI_TIM_SET or CSR_WIFI_TIM_RESET
702 */
703 if (0xFF != staRecord->updateTimReqQueued)
704 {
705 /* Process the UpdateTim Request which is queued while previous UpdateTim was in progress */
706 if (staRecord->timSet != staRecord->updateTimReqQueued)
707 {
708 unifi_trace(priv, UDBG2, "uf_handle_tim_cfm : Processing Queued UpdateTimReq \n");
709
710 update_tim(priv, staRecord->aid, staRecord->updateTimReqQueued, interfaceTag, handle);
711
712 staRecord->updateTimReqQueued = 0xFF;
713 }
714 }
715 } else {
716
717 interfacePriv->bcTimSet = timSetValue;
718 /* fh_cmd_q can also be full at some point of time!,
719 * resetting count as queue is cleaned by firmware at this point
720 */
721 retryCount = 0;
722 unifi_trace(priv, UDBG3, "tim (%s) successfully for broadcast frame in firmware\n", (timSetValue)?"SET":"RESET");
723
724 /* Reset DTIM pending flag to send next DTIM request */
725 interfacePriv->bcTimSetReqPendingFlag = FALSE;
726
727 /* Make sure that one more UpdateDTim request is queued, if Queued its value
728 * should be CSR_WIFI_TIM_SET or CSR_WIFI_TIM_RESET
729 */
730 if (0xFF != interfacePriv->bcTimSetReqQueued)
731 {
732 /* Process the UpdateTim Request which is queued while previous UpdateTim was in progress */
733 if (interfacePriv->bcTimSet != interfacePriv->bcTimSetReqQueued)
734 {
735 unifi_trace(priv, UDBG2, "uf_handle_tim_cfm : Processing Queued UpdateDTimReq \n");
736
737 update_tim(priv, 0, interfacePriv->bcTimSetReqQueued, interfaceTag, 0xFFFFFFFF);
738
739 interfacePriv->bcTimSetReqQueued = 0xFF;
740 }
741 }
742
743 }
744 break;
745 case CSR_RC_INVALID_PARAMETERS:
746 case CSR_RC_INSUFFICIENT_RESOURCE:
747 /* check for max retry limit & send again
748 * MAX_RETRY_LIMIT is not maintained for each set of transactions..Its generic
749 * If failure crosses this Limit, we have to take a call to FIX
750 */
751 if (retryCount > UNIFI_MAX_RETRY_LIMIT) {
752 u8 moreData = FALSE;
753 retryCount = 0;
754 /* Because of continuos traffic in fh_cmd_q the tim set request is failing (exceeding retry limit)
755 * but if we didn't synchronize our timSet varible state with firmware then it can cause below issues
756 * cond 1. We want to SET tim in firmware if its fails & max retry limit reached
757 * -> If host set's the timSet to 1, we wont try to send(as max retry reached) update tim but
758 * firmware is not updated with queue(TIM) status so it wont set TIM in beacon finally host start piling
759 * up data & wont try to set tim in firmware (This can cause worser performance)
760 * cond 2. We want to reset tim in firmware it fails & reaches max retry limit
761 * -> If host sets the timSet to Zero, it wont try to set a TIM request unless we wont have any packets
762 * to be queued, so beacon unnecessarily advertizes the TIM
763 */
764
765 if(staRecord) {
766 if(!staRecord->wmmOrQosEnabled) {
767 moreData = (!list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]) ||
768 !list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]) ||
769 !list_empty(&staRecord->mgtFrames));
770 } else {
771 /* Peer is QSTA */
772 u8 allDeliveryEnabled = 0, dataAvailable = 0;
773 /* Check if all AC's are Delivery Enabled */
774 is_all_ac_deliver_enabled_and_moredata(staRecord, &allDeliveryEnabled, &dataAvailable);
775 /*check for more data in non-delivery enabled queues*/
776 moreData = (uf_is_more_data_for_non_delivery_ac(staRecord) || (allDeliveryEnabled && dataAvailable));
777
778 }
779 /* To avoid cond 1 & 2, check internal Queues status, if we have more Data then set RESET the timSet(0),
780 * so we are trying to be in sync with firmware & next packets before queuing atleast try to
781 * set TIM in firmware otherwise it SET timSet(1)
782 */
783 if (moreData) {
784 staRecord->timSet = CSR_WIFI_TIM_RESET;
785 } else {
786 staRecord->timSet = CSR_WIFI_TIM_SET;
787 }
788 } else {
789 /* Its a broadcast frames */
790 moreData = (!list_empty(&interfacePriv->genericMulticastOrBroadCastMgtFrames) ||
791 !list_empty(&interfacePriv->genericMulticastOrBroadCastFrames));
792 if (moreData) {
793 update_tim(priv, 0, CSR_WIFI_TIM_SET, interfaceTag, 0xFFFFFFFF);
794 } else {
795 update_tim(priv, 0, CSR_WIFI_TIM_RESET, interfaceTag, 0xFFFFFFFF);
796 }
797 }
798
799 unifi_error(priv, "no of error's for TIM setting crossed the Limit: verify\n");
800 return;
801 }
802 retryCount++;
803
804 if (handle != CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE) {
805 if (timSetStatus == staRecord->timSet) {
806 unifi_warning(priv, "tim request failed, retry for AID = %x\n", staRecord->aid);
807 update_tim(priv, staRecord->aid, timSetValue, interfaceTag, handle);
808 } else {
809 unifi_trace(priv, UDBG1, "failure: request & confirm states are not matching in TIM cfm: Debug status = %x, staRecord->timSet = %x\n",
810 timSetStatus, staRecord->timSet);
811 }
812 } else {
813 unifi_warning(priv, "tim request failed, retry for broadcast frames\n");
814 update_tim(priv, 0, timSetValue, interfaceTag, 0xFFFFFFFF);
815 }
816 break;
817 default:
818 unifi_warning(priv, "tim update request failed resultcode = %x\n", cfm->ResultCode);
819 }
820
821 unifi_trace(priv, UDBG2, "leaving %s\n", __FUNCTION__);
822}
823
824/*
825 * ---------------------------------------------------------------------------
826 * update_tim
827 *
828 *
829 * This function updates tim status in firmware for AID[1 to UNIFI_MAX_CONNECTIONS] or
830 * AID[0] for broadcast/multicast packets.
831 *
832 * NOTE: The LSB (least significant BYTE) of senderId while sending this MLME premitive
833 * has been modified(utilized) as below
834 *
835 * SenderID in signal's SignalPrimitiveHeader is 2 byte the lowe byte bitmap is below
836 *
837 * station handle(6 bits) timSet Status (2 bits)
838 * --------------------- ----------------------
839 * 0 0 0 0 0 0 | 0 0
840 *
841 * timSet Status can be one of below:
842 *
843 * CSR_WIFI_TIM_RESET
844 * CSR_WIFI_TIM_RESETTING
845 * CSR_WIFI_TIM_SET
846 * CSR_WIFI_TIM_SETTING
847 *
848 * Arguments:
849 * priv Pointer to device private context struct
850 * aid can be 1 t0 UNIFI_MAX_CONNECTIONS & 0 means multicast/broadcast
851 * setTim value SET(1) / RESET(0)
852 * interfaceTag the interfaceID on which activity going on
853 * handle from (0 <= handle < UNIFI_MAX_CONNECTIONS)
854 *
855 * ---------------------------------------------------------------------------
856 */
857void update_tim(unifi_priv_t * priv, u16 aid, u8 setTim, u16 interfaceTag, u32 handle)
858{
859 CSR_SIGNAL signal;
860 s32 r;
861 CSR_MLME_SET_TIM_REQUEST *req = &signal.u.MlmeSetTimRequest;
862 bulk_data_param_t *bulkdata = NULL;
863 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
864 u8 senderIdLsb = 0;
865 CsrWifiRouterCtrlStaInfo_t *staRecord = NULL;
866 u32 oldTimSetStatus = 0, timSetStatus = 0;
867
868 unifi_trace(priv, UDBG5, "entering the update_tim routine\n");
869
870
871 if (handle == 0xFFFFFFFF) {
872 handle &= CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE;
873 if (setTim == interfacePriv->bcTimSet)
874 {
875 unifi_trace(priv, UDBG3, "update_tim, Drop:Hdl=%x, timval=%d, globalTim=%d\n", handle, setTim, interfacePriv->bcTimSet);
876 return;
877 }
878 } else if ((handle != 0xFFFFFFFF) && (handle >= UNIFI_MAX_CONNECTIONS)) {
879 unifi_warning(priv, "bad station Handle = %x\n", handle);
880 return;
881 }
882
883 if (setTim) {
884 timSetStatus = CSR_WIFI_TIM_SETTING;
885 } else {
886 timSetStatus = CSR_WIFI_TIM_RESETTING;
887 }
888
889 if (handle != CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE) {
890 if ((staRecord = ((CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[handle]))) == NULL) {
891 unifi_warning(priv, "station record is NULL in update_tim: handle = %x :debug\n", handle);
892 return;
893 }
894 /* In case of signal sending failed, revert back to old state */
895 oldTimSetStatus = staRecord->timSet;
896 staRecord->timSet = timSetStatus;
897 }
898
899 /* pack senderID LSB */
900 senderIdLsb = CSR_WIFI_PACK_SENDER_ID_LSB_FOR_TIM_REQ(handle, timSetStatus);
901
902 /* initialize signal to zero */
903 memset(&signal, 0, sizeof(CSR_SIGNAL));
904
905 /* Frame the MLME-SET-TIM request */
906 signal.SignalPrimitiveHeader.SignalId = CSR_MLME_SET_TIM_REQUEST_ID;
907 signal.SignalPrimitiveHeader.ReceiverProcessId = 0;
908 CSR_COPY_UINT16_TO_LITTLE_ENDIAN(((priv->netdev_client->sender_id & 0xff00) | senderIdLsb),
909 (u8*)&signal.SignalPrimitiveHeader.SenderProcessId);
910
911 /* set The virtual interfaceIdentifier, aid, tim value */
912 req->VirtualInterfaceIdentifier = uf_get_vif_identifier(interfacePriv->interfaceMode, interfaceTag);
913 req->AssociationId = aid;
914 req->TimValue = setTim;
915
916
917 unifi_trace(priv, UDBG2, "update_tim:AID %x,senderIdLsb = 0x%x, handle = 0x%x, timSetStatus = %x, sender proceesID = %x \n",
918 aid, senderIdLsb, handle, timSetStatus, signal.SignalPrimitiveHeader.SenderProcessId);
919
920 /* Send the signal to UniFi */
921 r = ul_send_signal_unpacked(priv, &signal, bulkdata);
922 if (r) {
923 /* No need to free bulk data, as TIM request doesn't carries any data */
924 unifi_error(priv, "Error queueing CSR_MLME_SET_TIM_REQUEST signal\n");
925 if (staRecord) {
926 staRecord->timSet = oldTimSetStatus ;
927 }
928 else
929 {
930 /* MLME_SET_TIM.req sending failed here for AID0, so revert back our bcTimSet status */
931 interfacePriv->bcTimSet = !setTim;
932 }
933 }
934 else {
935 /* Update tim request pending flag and ensure no more TIM set requests are send
936 for the same station until TIM confirm is received */
937 if (staRecord) {
938 staRecord->timRequestPendingFlag = TRUE;
939 }
940 else
941 {
942 /* Update tim request (for AID 0) pending flag and ensure no more DTIM set requests are send
943 * for the same station until TIM confirm is received
944 */
945 interfacePriv->bcTimSetReqPendingFlag = TRUE;
946 }
947 }
948 unifi_trace(priv, UDBG5, "leaving the update_tim routine\n");
949}
950
951static
952void process_peer_active_transition(unifi_priv_t * priv,
953 CsrWifiRouterCtrlStaInfo_t *staRecord,
954 u16 interfaceTag)
955{
956 int r, i;
957 u8 spaceAvail[4] = {TRUE, TRUE, TRUE, TRUE};
958 tx_buffered_packets_t * buffered_pkt = NULL;
959 unsigned long lock_flags;
960 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
961
962 unifi_trace(priv, UDBG5, "entering process_peer_active_transition\n");
963
964 if(IS_DTIM_ACTIVE(interfacePriv->dtimActive, interfacePriv->multicastPduHostTag)) {
965 /* giving more priority to multicast packets so delaying unicast packets*/
966 unifi_trace(priv, UDBG2, "Multicast transmission is going on so resume unicast transmission after DTIM over\n");
967
968 /* As station is active now, even though AP is not able to send frames to it
969 * because of DTIM, it needs to reset the TIM here
970 */
971 if (!staRecord->timRequestPendingFlag){
972 if((staRecord->timSet == CSR_WIFI_TIM_SET) || (staRecord->timSet == CSR_WIFI_TIM_SETTING)){
973 update_tim(priv, staRecord->aid, 0, interfaceTag, staRecord->assignedHandle);
974 }
975 }
976 else
977 {
978 /* Cache the TimSet value so that it will processed immidiatly after
979 * completing the current setTim Request
980 */
981 staRecord->updateTimReqQueued = 0;
982 unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", staRecord->updateTimReqQueued,
983 staRecord->aid);
984 }
985 return;
986 }
987 while((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->mgtFrames))) {
988 buffered_pkt->transmissionControl &=
989 ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_EOSP_MASK);
990 if((r=frame_and_send_queued_pdu(priv, buffered_pkt, staRecord, 0, FALSE)) == -ENOSPC) {
991 unifi_trace(priv, UDBG2, "p_p_a_t:(ENOSPC) Mgt Frame queueing \n");
992 /* Enqueue at the head of the queue */
993 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
994 list_add(&buffered_pkt->q, &staRecord->mgtFrames);
995 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
996 priv->pausedStaHandle[3]=(u8)(staRecord->assignedHandle);
997 spaceAvail[3] = FALSE;
998 break;
999 } else {
1000 if(r){
1001 unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n");
1002 /* the PDU failed where we can't do any thing so free the storage */
1003 unifi_net_data_free(priv, &buffered_pkt->bulkdata);
1004 }
1005 kfree(buffered_pkt);
1006 }
1007 }
1008 if (!staRecord->timRequestPendingFlag) {
1009 if (staRecord->txSuspend) {
1010 if(staRecord->timSet == CSR_WIFI_TIM_SET) {
1011 update_tim(priv, staRecord->aid, 0, interfaceTag, staRecord->assignedHandle);
1012 }
1013 return;
1014 }
1015 }
1016 else
1017 {
1018 /* Cache the TimSet value so that it will processed immidiatly after
1019 * completing the current setTim Request
1020 */
1021 staRecord->updateTimReqQueued = 0;
1022 unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", staRecord->updateTimReqQueued,
1023 staRecord->aid);
1024 }
1025 for(i=3;i>=0;i--) {
1026 if(!spaceAvail[i])
1027 continue;
1028 unifi_trace(priv, UDBG6, "p_p_a_t:data pkt sending for AC %d \n", i);
1029 while((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->dataPdu[i]))) {
1030 buffered_pkt->transmissionControl &=
1031 ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_EOSP_MASK);
1032 if((r=frame_and_send_queued_pdu(priv, buffered_pkt, staRecord, 0, FALSE)) == -ENOSPC) {
1033 /* Clear the trigger bit transmission control*/
1034 /* Enqueue at the head of the queue */
1035 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
1036 list_add(&buffered_pkt->q, &staRecord->dataPdu[i]);
1037 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
1038 priv->pausedStaHandle[i]=(u8)(staRecord->assignedHandle);
1039 break;
1040 } else {
1041 if(r){
1042 unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n");
1043 /* the PDU failed where we can't do any thing so free the storage */
1044 unifi_net_data_free(priv, &buffered_pkt->bulkdata);
1045 }
1046 kfree(buffered_pkt);
1047 }
1048 }
1049 }
1050 if (!staRecord->timRequestPendingFlag){
1051 if((staRecord->timSet == CSR_WIFI_TIM_SET) || (staRecord->timSet == CSR_WIFI_TIM_SETTING)) {
1052 unifi_trace(priv, UDBG3, "p_p_a_t:resetting tim .....\n");
1053 update_tim(priv, staRecord->aid, 0, interfaceTag, staRecord->assignedHandle);
1054 }
1055 }
1056 else
1057 {
1058 /* Cache the TimSet value so that it will processed immidiatly after
1059 * completing the current setTim Request
1060 */
1061 staRecord->updateTimReqQueued = 0;
1062 unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", staRecord->updateTimReqQueued,
1063 staRecord->aid);
1064 }
1065 unifi_trace(priv, UDBG5, "leaving process_peer_active_transition\n");
1066}
1067
1068
1069
1070void uf_process_ma_pkt_cfm_for_ap(unifi_priv_t *priv, u16 interfaceTag, const CSR_MA_PACKET_CONFIRM *pkt_cfm)
1071{
1072 netInterface_priv_t *interfacePriv;
1073 u8 i;
1074 CsrWifiRouterCtrlStaInfo_t *staRecord = NULL;
1075 interfacePriv = priv->interfacePriv[interfaceTag];
1076
1077
1078 if(pkt_cfm->HostTag == interfacePriv->multicastPduHostTag) {
1079 unifi_trace(priv, UDBG2, "CFM for marked Multicast Tag = %x\n", interfacePriv->multicastPduHostTag);
1080 interfacePriv->multicastPduHostTag = 0xffffffff;
1081 resume_suspended_uapsd(priv, interfaceTag);
1082 resume_unicast_buffered_frames(priv, interfaceTag);
1083 if(list_empty(&interfacePriv->genericMulticastOrBroadCastMgtFrames) &&
1084 list_empty(&interfacePriv->genericMulticastOrBroadCastFrames)) {
1085 unifi_trace(priv, UDBG1, "Resetting multicastTIM");
1086 if (!interfacePriv->bcTimSetReqPendingFlag)
1087 {
1088 update_tim(priv, 0, CSR_WIFI_TIM_RESET, interfaceTag, 0xFFFFFFFF);
1089 }
1090 else
1091 {
1092 /* Cache the DTimSet value so that it will processed immidiatly after
1093 * completing the current setDTim Request
1094 */
1095 interfacePriv->bcTimSetReqQueued = CSR_WIFI_TIM_RESET;
1096 unifi_trace(priv, UDBG2, "uf_process_ma_pkt_cfm_for_ap : One more UpdateDTim Request(%d) Queued \n",
1097 interfacePriv->bcTimSetReqQueued);
1098 }
1099
1100 }
1101 return;
1102 }
1103
1104 /* Check if it is a Confirm for null data frame used
1105 * for probing station activity
1106 */
1107 for(i =0; i < UNIFI_MAX_CONNECTIONS; i++) {
1108 staRecord = (CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[i]);
1109 if (staRecord && (staRecord->nullDataHostTag == pkt_cfm->HostTag)) {
1110
1111 unifi_trace(priv, UDBG1, "CFM for Inactive probe Null frame (tag = %x, status = %d)\n",
1112 pkt_cfm->HostTag,
1113 pkt_cfm->TransmissionStatus
1114 );
1115 staRecord->nullDataHostTag = INVALID_HOST_TAG;
1116
1117 if(pkt_cfm->TransmissionStatus == CSR_TX_RETRY_LIMIT){
1118 u32 now;
1119 u32 inactive_time;
1120
1121 unifi_trace(priv, UDBG1, "Nulldata to probe STA ALIVE Failed with retry limit\n");
1122 /* Recheck if there is some activity after null data is sent.
1123 *
1124 * If still there is no activity then send a disconnected indication
1125 * to SME to delete the station record.
1126 */
1127 if (staRecord->activity_flag){
1128 return;
1129 }
1130 now = CsrTimeGet(NULL);
1131
1132 if (staRecord->lastActivity > now)
1133 {
1134 /* simple timer wrap (for 1 wrap) */
1135 inactive_time = CsrTimeAdd((u32)CsrTimeSub(CSR_SCHED_TIME_MAX, staRecord->lastActivity),
1136 now);
1137 }
1138 else
1139 {
1140 inactive_time = (u32)CsrTimeSub(now, staRecord->lastActivity);
1141 }
1142
1143 if (inactive_time >= STA_INACTIVE_TIMEOUT_VAL)
1144 {
1145 struct list_head send_cfm_list;
1146 u8 j;
1147
1148 /* The SME/NME may be waiting for confirmation for requested frames to this station.
1149 * Though this is --VERY UNLIKELY-- in case of station in active mode. But still as a
1150 * a defensive check, it loops through buffered frames for this station and if confirmation
1151 * is requested, send auto confirmation with failure status. Also flush the frames so
1152 * that these are not processed again in PEER_DEL_REQ handler.
1153 */
1154 INIT_LIST_HEAD(&send_cfm_list);
1155
1156 uf_prepare_send_cfm_list_for_queued_pkts(priv,
1157 &send_cfm_list,
1158 &(staRecord->mgtFrames));
1159
1160 uf_flush_list(priv, &(staRecord->mgtFrames));
1161
1162 for(j = 0; j < MAX_ACCESS_CATOGORY; j++){
1163 uf_prepare_send_cfm_list_for_queued_pkts(priv,
1164 &send_cfm_list,
1165 &(staRecord->dataPdu[j]));
1166
1167 uf_flush_list(priv, &(staRecord->dataPdu[j]));
1168 }
1169
1170 send_auto_ma_packet_confirm(priv, staRecord->interfacePriv, &send_cfm_list);
1171
1172
1173
1174 unifi_warning(priv, "uf_process_ma_pkt_cfm_for_ap: Router Disconnected IND Peer (%x-%x-%x-%x-%x-%x)\n",
1175 staRecord->peerMacAddress.a[0],
1176 staRecord->peerMacAddress.a[1],
1177 staRecord->peerMacAddress.a[2],
1178 staRecord->peerMacAddress.a[3],
1179 staRecord->peerMacAddress.a[4],
1180 staRecord->peerMacAddress.a[5]);
1181
1182 CsrWifiRouterCtrlConnectedIndSend(priv->CSR_WIFI_SME_IFACEQUEUE,
1183 0,
1184 staRecord->interfacePriv->InterfaceTag,
1185 staRecord->peerMacAddress,
1186 CSR_WIFI_ROUTER_CTRL_PEER_DISCONNECTED);
1187 }
1188
1189 }
1190 else if (pkt_cfm->TransmissionStatus == CSR_TX_SUCCESSFUL)
1191 {
1192 staRecord->activity_flag = TRUE;
1193 }
1194 }
1195 }
1196}
1197
1198#endif
1199u16 uf_get_vif_identifier (CsrWifiRouterCtrlMode mode, u16 tag)
1200{
1201 switch(mode)
1202 {
1203 case CSR_WIFI_ROUTER_CTRL_MODE_STA:
1204 case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI:
1205 return (0x02<<8|tag);
1206
1207 case CSR_WIFI_ROUTER_CTRL_MODE_AP:
1208 case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO:
1209 return (0x03<<8|tag);
1210
1211 case CSR_WIFI_ROUTER_CTRL_MODE_IBSS:
1212 return (0x01<<8|tag);
1213
1214 case CSR_WIFI_ROUTER_CTRL_MODE_MONITOR:
1215 return (0x04<<8|tag);
1216 case CSR_WIFI_ROUTER_CTRL_MODE_AMP:
1217 return (0x05<<8|tag);
1218 default:
1219 return tag;
1220 }
1221}
1222
1223#ifdef CSR_SUPPORT_SME
1224
1225/*
1226 * ---------------------------------------------------------------------------
1227 * update_macheader
1228 *
1229 *
1230 * These functions updates mac header for intra BSS packet
1231 * routing.
1232 * NOTE: This function always has to be called in rx context which
1233 * is in bh thread context since GFP_KERNEL is used. In soft IRQ/ Interrupt
1234 * context shouldn't be used
1235 *
1236 * Arguments:
1237 * priv Pointer to device private context struct
1238 * skb Socket buffer containing data packet to transmit
1239 * newSkb Socket buffer containing data packet + Mac header if no sufficient headroom in skb
1240 * priority to append QOS control header in Mac header
1241 * bulkdata if newSkb allocated then bulkdata updated to send to unifi
1242 * interfaceTag the interfaceID on which activity going on
1243 * macHeaderLengthInBytes no. of bytes of mac header in received frame
1244 * qosDestination used to append Qos control field
1245 *
1246 * Returns:
1247 * Zero on success or -1 on error.
1248 * ---------------------------------------------------------------------------
1249 */
1250
1251static int update_macheader(unifi_priv_t *priv, struct sk_buff *skb,
1252 struct sk_buff *newSkb, CSR_PRIORITY *priority,
1253 bulk_data_param_t *bulkdata, u16 interfaceTag,
1254 u8 macHeaderLengthInBytes,
1255 u8 qosDestination)
1256{
1257
1258 u16 *fc = NULL;
1259 u8 direction = 0, toDs, fromDs;
1260 u8 *bufPtr = NULL;
1261 u8 sa[ETH_ALEN], da[ETH_ALEN];
1262 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
1263 int headroom;
1264 u8 macHeaderBuf[IEEE802_11_DATA_FRAME_MAC_HEADER_SIZE] = {0};
1265
1266 unifi_trace(priv, UDBG5, "entering the update_macheader function\n");
1267
1268 /* temporary buffer for the Mac header storage */
1269 memcpy(macHeaderBuf, skb->data, macHeaderLengthInBytes);
1270
1271 /* remove the Macheader from the skb */
1272 skb_pull(skb, macHeaderLengthInBytes);
1273
1274 /* get the skb headroom for skb_push check */
1275 headroom = skb_headroom(skb);
1276
1277 /* pointer to frame control field */
1278 fc = (u16*) macHeaderBuf;
1279
1280 toDs = (*fc & cpu_to_le16(IEEE802_11_FC_TO_DS_MASK))?1 : 0;
1281 fromDs = (*fc & cpu_to_le16(IEEE802_11_FC_FROM_DS_MASK))? 1: 0;
1282 unifi_trace(priv, UDBG5, "In update_macheader function, fromDs = %x, toDs = %x\n", fromDs, toDs);
1283 direction = ((fromDs | (toDs << 1)) & 0x3);
1284
1285 /* Address1 or 3 from the macheader */
1286 memcpy(da, macHeaderBuf+4+toDs*12, ETH_ALEN);
1287 /* Address2, 3 or 4 from the mac header */
1288 memcpy(sa, macHeaderBuf+10+fromDs*(6+toDs*8), ETH_ALEN);
1289
1290 unifi_trace(priv, UDBG3, "update_macheader:direction = %x\n", direction);
1291 /* update the toDs, fromDs & address fields in Mac header */
1292 switch(direction)
1293 {
1294 case 2:
1295 /* toDs = 1 & fromDs = 0 , toAp when frames received from peer
1296 * while sending this packet to Destination the Mac header changed
1297 * as fromDs = 1 & toDs = 0, fromAp
1298 */
1299 *fc &= cpu_to_le16(~IEEE802_11_FC_TO_DS_MASK);
1300 *fc |= cpu_to_le16(IEEE802_11_FC_FROM_DS_MASK);
1301 /* Address1: MAC address of the actual destination (4 = 2+2) */
1302 memcpy(macHeaderBuf + 4, da, ETH_ALEN);
1303 /* Address2: The MAC address of the AP (10 = 2+2+6) */
1304 memcpy(macHeaderBuf + 10, &interfacePriv->bssid, ETH_ALEN);
1305 /* Address3: MAC address of the actual source from mac header (16 = 2+2+6+6) */
1306 memcpy(macHeaderBuf + 16, sa, ETH_ALEN);
1307 break;
1308 case 3:
1309 unifi_trace(priv, UDBG3, "when both the toDs & fromDS set, NOT SUPPORTED\n");
1310 break;
1311 default:
1312 unifi_trace(priv, UDBG3, "problem in decoding packet in update_macheader \n");
1313 return -1;
1314 }
1315
1316 /* frameType is Data always, Validation is done before calling this function */
1317
1318 /* check for the souce station type */
1319 switch(le16_to_cpu(*fc) & IEEE80211_FC_SUBTYPE_MASK)
1320 {
1321 case IEEE802_11_FC_TYPE_QOS_DATA & IEEE80211_FC_SUBTYPE_MASK:
1322 /* No need to modify the qos control field */
1323 if (!qosDestination) {
1324
1325 /* If source Sta is QOS enabled & if this bit set, then HTC is supported by
1326 * peer station & htc field present in macHeader
1327 */
1328 if (*fc & cpu_to_le16(IEEE80211_FC_ORDER_MASK)) {
1329 /* HT control field present in Mac header
1330 * 6 = sizeof(qosControl) + sizeof(htc)
1331 */
1332 macHeaderLengthInBytes -= 6;
1333 } else {
1334 macHeaderLengthInBytes -= 2;
1335 }
1336 /* Destination STA is non qos so change subtype to DATA */
1337 *fc &= cpu_to_le16(~IEEE80211_FC_SUBTYPE_MASK);
1338 *fc |= cpu_to_le16(IEEE802_11_FC_TYPE_DATA);
1339 /* remove the qos control field & HTC(if present). new macHeaderLengthInBytes is less than old
1340 * macHeaderLengthInBytes so no need to verify skb headroom
1341 */
1342 if (headroom < macHeaderLengthInBytes) {
1343 unifi_trace(priv, UDBG1, " sufficient headroom not there to push updated mac header \n");
1344 return -1;
1345 }
1346 bufPtr = (u8 *) skb_push(skb, macHeaderLengthInBytes);
1347
1348 /* update bulk data os_data_ptr */
1349 bulkdata->d[0].os_data_ptr = skb->data;
1350 bulkdata->d[0].os_net_buf_ptr = (unsigned char*)skb;
1351 bulkdata->d[0].data_length = skb->len;
1352
1353 } else {
1354 /* pointing to QOS control field */
1355 u8 qc;
1356 if (*fc & cpu_to_le16(IEEE80211_FC_ORDER_MASK)) {
1357 qc = *((u8*)(macHeaderBuf + (macHeaderLengthInBytes - 4 - 2)));
1358 } else {
1359 qc = *((u8*)(macHeaderBuf + (macHeaderLengthInBytes - 2)));
1360 }
1361
1362 if ((qc & IEEE802_11_QC_TID_MASK) > 7) {
1363 *priority = 7;
1364 } else {
1365 *priority = qc & IEEE802_11_QC_TID_MASK;
1366 }
1367
1368 unifi_trace(priv, UDBG1, "Incoming packet priority from QSTA is %x\n", *priority);
1369
1370 if (headroom < macHeaderLengthInBytes) {
1371 unifi_trace(priv, UDBG3, " sufficient headroom not there to push updated mac header \n");
1372 return -1;
1373 }
1374 bufPtr = (u8 *) skb_push(skb, macHeaderLengthInBytes);
1375 }
1376 break;
1377 default:
1378 {
1379 bulk_data_param_t data_ptrs;
1380 CsrResult csrResult;
1381 unifi_trace(priv, UDBG5, "normal Data packet, NO QOS \n");
1382
1383 if (qosDestination) {
1384 u8 qc = 0;
1385 unifi_trace(priv, UDBG3, "destination is QOS station \n");
1386
1387 /* Set Ma-Packet.req UP to UP0 */
1388 *priority = CSR_QOS_UP0;
1389
1390 /* prepare the qos control field */
1391 qc |= CSR_QOS_UP0;
1392 /* no Amsdu is in ap buffer so eosp is left 0 */
1393 if (da[0] & 0x1) {
1394 /* multicast/broadcast frames, no acknowledgement needed */
1395 qc |= 1 << 5;
1396 }
1397
1398 /* update new Mac header Length with 2 = sizeof(qos control) */
1399 macHeaderLengthInBytes += 2;
1400
1401 /* received DATA frame but destiantion is QOS station so update subtype to QOS*/
1402 *fc &= cpu_to_le16(~IEEE80211_FC_SUBTYPE_MASK);
1403 *fc |= cpu_to_le16(IEEE802_11_FC_TYPE_QOS_DATA);
1404
1405 /* appendQosControlOffset = macHeaderLengthInBytes - 2, since source sta is not QOS */
1406 macHeaderBuf[macHeaderLengthInBytes - 2] = qc;
1407 /* txopLimit is 0 */
1408 macHeaderBuf[macHeaderLengthInBytes - 1] = 0;
1409 if (headroom < macHeaderLengthInBytes) {
1410 csrResult = unifi_net_data_malloc(priv, &data_ptrs.d[0], skb->len + macHeaderLengthInBytes);
1411
1412 if (csrResult != CSR_RESULT_SUCCESS) {
1413 unifi_error(priv, " failed to allocate request_data. in update_macheader func\n");
1414 return -1;
1415 }
1416 newSkb = (struct sk_buff *)(data_ptrs.d[0].os_net_buf_ptr);
1417 newSkb->len = skb->len + macHeaderLengthInBytes;
1418
1419 memcpy((void*)data_ptrs.d[0].os_data_ptr + macHeaderLengthInBytes,
1420 skb->data, skb->len);
1421
1422 bulkdata->d[0].os_data_ptr = newSkb->data;
1423 bulkdata->d[0].os_net_buf_ptr = (unsigned char*)newSkb;
1424 bulkdata->d[0].data_length = newSkb->len;
1425
1426 bufPtr = (u8*)data_ptrs.d[0].os_data_ptr;
1427
1428 /* The old skb will not be used again */
1429 kfree_skb(skb);
1430 } else {
1431 /* skb headroom is sufficient to append Macheader */
1432 bufPtr = (u8*)skb_push(skb, macHeaderLengthInBytes);
1433 bulkdata->d[0].os_data_ptr = skb->data;
1434 bulkdata->d[0].os_net_buf_ptr = (unsigned char*)skb;
1435 bulkdata->d[0].data_length = skb->len;
1436 }
1437 } else {
1438 unifi_trace(priv, UDBG3, "destination is not a QSTA\n");
1439 if (headroom < macHeaderLengthInBytes) {
1440 csrResult = unifi_net_data_malloc(priv, &data_ptrs.d[0], skb->len + macHeaderLengthInBytes);
1441
1442 if (csrResult != CSR_RESULT_SUCCESS) {
1443 unifi_error(priv, " failed to allocate request_data. in update_macheader func\n");
1444 return -1;
1445 }
1446 newSkb = (struct sk_buff *)(data_ptrs.d[0].os_net_buf_ptr);
1447 newSkb->len = skb->len + macHeaderLengthInBytes;
1448
1449 memcpy((void*)data_ptrs.d[0].os_data_ptr + macHeaderLengthInBytes,
1450 skb->data, skb->len);
1451
1452 bulkdata->d[0].os_data_ptr = newSkb->data;
1453 bulkdata->d[0].os_net_buf_ptr = (unsigned char*)newSkb;
1454 bulkdata->d[0].data_length = newSkb->len;
1455
1456 bufPtr = (u8*)data_ptrs.d[0].os_data_ptr;
1457
1458 /* The old skb will not be used again */
1459 kfree_skb(skb);
1460 } else {
1461 /* skb headroom is sufficient to append Macheader */
1462 bufPtr = (u8*)skb_push(skb, macHeaderLengthInBytes);
1463 bulkdata->d[0].os_data_ptr = skb->data;
1464 bulkdata->d[0].os_net_buf_ptr = (unsigned char*)skb;
1465 bulkdata->d[0].data_length = skb->len;
1466 }
1467 }
1468 }
1469 }
1470
1471 /* prepare the complete skb, by pushing the MAC header to the beginning of the skb->data */
1472 unifi_trace(priv, UDBG5, "updated Mac Header: %d \n", macHeaderLengthInBytes);
1473 memcpy(bufPtr, macHeaderBuf, macHeaderLengthInBytes);
1474
1475 unifi_trace(priv, UDBG5, "leaving the update_macheader function\n");
1476 return 0;
1477}
1478/*
1479 * ---------------------------------------------------------------------------
1480 * uf_ap_process_data_pdu
1481 *
1482 *
1483 * Takes care of intra BSS admission control & routing packets within BSS
1484 *
1485 * Arguments:
1486 * priv Pointer to device private context struct
1487 * skb Socket buffer containing data packet to transmit
1488 * ehdr ethernet header to fetch priority of packet
1489 * srcStaInfo source stations record for connection verification
1490 * packed_signal
1491 * signal_len
1492 * signal MA-PACKET.indication signal
1493 * bulkdata if newSkb allocated then bulkdata updated to send to unifi
1494 * macHeaderLengthInBytes no. of bytes of mac header in received frame
1495 *
1496 * Returns:
1497 * Zero on success(ap processing complete) or -1 if packet also have to be sent to NETDEV.
1498 * ---------------------------------------------------------------------------
1499 */
1500int
1501uf_ap_process_data_pdu(unifi_priv_t *priv, struct sk_buff *skb,
1502 struct ethhdr *ehdr, CsrWifiRouterCtrlStaInfo_t * srcStaInfo,
1503 const CSR_SIGNAL *signal,
1504 bulk_data_param_t *bulkdata,
1505 u8 macHeaderLengthInBytes)
1506{
1507 const CSR_MA_PACKET_INDICATION *ind = &(signal->u.MaPacketIndication);
1508 u16 interfaceTag = (ind->VirtualInterfaceIdentifier & 0x00ff);
1509 struct sk_buff *newSkb = NULL;
1510 /* pointer to skb or private skb created using skb_copy() */
1511 struct sk_buff *skbPtr = skb;
1512 u8 sendToNetdev = FALSE;
1513 u8 qosDestination = FALSE;
1514 CSR_PRIORITY priority = CSR_CONTENTION;
1515 CsrWifiRouterCtrlStaInfo_t *dstStaInfo = NULL;
1516 netInterface_priv_t *interfacePriv;
1517
1518 unifi_trace(priv, UDBG5, "entering uf_ap_process_data_pdu %d\n", macHeaderLengthInBytes);
1519 /* InterfaceTag validation from MA_PACKET.indication */
1520 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
1521 unifi_trace(priv, UDBG1, "Interface Tag is Invalid in uf_ap_process_data_pdu\n");
1522 unifi_net_data_free(priv, &bulkdata->d[0]);
1523 return 0;
1524 }
1525 interfacePriv = priv->interfacePriv[interfaceTag];
1526
1527 if((interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) &&
1528 (interfacePriv->intraBssEnabled == FALSE)) {
1529 unifi_trace(priv, UDBG2, "uf_ap_process_data_pdu:P2P GO intrabssEnabled?= %d\n", interfacePriv->intraBssEnabled);
1530
1531 /*In P2P GO case, if intraBSS distribution Disabled then don't do IntraBSS routing */
1532 /* If destination in our BSS then drop otherwise give packet to netdev */
1533 dstStaInfo = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, ehdr->h_dest, interfaceTag);
1534 if (dstStaInfo) {
1535 unifi_net_data_free(priv, &bulkdata->d[0]);
1536 return 0;
1537 }
1538 /* May be associated P2PCLI trying to send the packets on backbone (Netdev) */
1539 return -1;
1540 }
1541
1542 if(!memcmp(ehdr->h_dest, interfacePriv->bssid.a, ETH_ALEN)) {
1543 /* This packet will be given to the TCP/IP stack since this packet is for us(AP)
1544 * No routing needed */
1545 unifi_trace(priv, UDBG4, "destination address is csr_ap\n");
1546 return -1;
1547 }
1548
1549 /* fetch the destination record from station record database */
1550 dstStaInfo = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, ehdr->h_dest, interfaceTag);
1551
1552 /* AP mode processing, & if packet is unicast */
1553 if(!dstStaInfo) {
1554 if (!(ehdr->h_dest[0] & 0x1)) {
1555 /* destination not in station record & its a unicast packet, so pass the packet to network stack */
1556 unifi_trace(priv, UDBG3, "unicast frame & destination record not exist, send to netdev proto = %x\n", htons(skb->protocol));
1557 return -1;
1558 } else {
1559 /* packet is multicast/broadcast */
1560 /* copy the skb to skbPtr, send skb to netdev & skbPtr to multicast/broad cast list */
1561 unifi_trace(priv, UDBG5, "skb_copy, in uf_ap_process_data_pdu, protocol = %x\n", htons(skb->protocol));
1562 skbPtr = skb_copy(skb, GFP_KERNEL);
1563 if(skbPtr == NULL) {
1564 /* We don't have memory to don't send the frame in BSS*/
1565 unifi_notice(priv, "broacast/multicast frame can't be sent in BSS No memeory: proto = %x\n", htons(skb->protocol));
1566 return -1;
1567 }
1568 sendToNetdev = TRUE;
1569 }
1570 } else {
1571
1572 /* validate the Peer & Destination Station record */
1573 if (uf_process_station_records_for_sending_data(priv, interfaceTag, srcStaInfo, dstStaInfo)) {
1574 unifi_notice(priv, "uf_ap_process_data_pdu: station record validation failed \n");
1575 interfacePriv->stats.rx_errors++;
1576 unifi_net_data_free(priv, &bulkdata->d[0]);
1577 return 0;
1578 }
1579 }
1580
1581 /* BroadCast packet received and it's been sent as non QOS packets.
1582 * Since WMM spec not mandates broadcast/multicast to be sent as QOS data only,
1583 * if all Peers are QSTA
1584 */
1585 if(sendToNetdev) {
1586 /* BroadCast packet and it's been sent as non QOS packets */
1587 qosDestination = FALSE;
1588 } else if(dstStaInfo && (dstStaInfo->wmmOrQosEnabled == TRUE)) {
1589 qosDestination = TRUE;
1590 }
1591
1592 unifi_trace(priv, UDBG3, "uf_ap_process_data_pdu QoS destination = %s\n", (qosDestination)? "TRUE": "FALSE");
1593
1594 /* packet is allowed to send to unifi, update the Mac header */
1595 if (update_macheader(priv, skbPtr, newSkb, &priority, bulkdata, interfaceTag, macHeaderLengthInBytes, qosDestination)) {
1596 interfacePriv->stats.rx_errors++;
1597 unifi_notice(priv, "(Packet Drop) failed to update the Mac header in uf_ap_process_data_pdu\n");
1598 if (sendToNetdev) {
1599 /* Free's the skb_copy(skbPtr) data since packet processing failed */
1600 bulkdata->d[0].os_data_ptr = skbPtr->data;
1601 bulkdata->d[0].os_net_buf_ptr = (unsigned char*)skbPtr;
1602 bulkdata->d[0].data_length = skbPtr->len;
1603 unifi_net_data_free(priv, &bulkdata->d[0]);
1604 }
1605 return -1;
1606 }
1607
1608 unifi_trace(priv, UDBG3, "Mac Header updated...calling uf_process_ma_packet_req \n");
1609
1610 /* Packet is ready to send to unifi ,transmissionControl = 0x0004, confirmation is not needed for data packets */
1611 if (uf_process_ma_packet_req(priv, ehdr->h_dest, 0xffffffff, interfaceTag, CSR_NO_CONFIRM_REQUIRED, (CSR_RATE)0, priority, priv->netdev_client->sender_id, bulkdata)) {
1612 if (sendToNetdev) {
1613 unifi_trace(priv, UDBG1, "In uf_ap_process_data_pdu, (Packet Drop) uf_process_ma_packet_req failed. freeing skb_copy data (original data sent to Netdev)\n");
1614 /* Free's the skb_copy(skbPtr) data since packet processing failed */
1615 bulkdata->d[0].os_data_ptr = skbPtr->data;
1616 bulkdata->d[0].os_net_buf_ptr = (unsigned char*)skbPtr;
1617 bulkdata->d[0].data_length = skbPtr->len;
1618 unifi_net_data_free(priv, &bulkdata->d[0]);
1619 } else {
1620 /* This free's the skb data */
1621 unifi_trace(priv, UDBG1, "In uf_ap_process_data_pdu, (Packet Drop). Unicast data so freeing original skb \n");
1622 unifi_net_data_free(priv, &bulkdata->d[0]);
1623 }
1624 }
1625 unifi_trace(priv, UDBG5, "leaving uf_ap_process_data_pdu\n");
1626
1627 if (sendToNetdev) {
1628 /* The packet is multicast/broadcast, so after AP processing packet has to
1629 * be sent to netdev, if peer port state is open
1630 */
1631 unifi_trace(priv, UDBG4, "Packet will be routed to NetDev\n");
1632 return -1;
1633 }
1634 /* Ap handled the packet & its a unicast packet, no need to send to netdev */
1635 return 0;
1636}
1637
1638#endif
1639
1640CsrResult uf_process_ma_packet_req(unifi_priv_t *priv,
1641 u8 *peerMacAddress,
1642 CSR_CLIENT_TAG hostTag,
1643 u16 interfaceTag,
1644 CSR_TRANSMISSION_CONTROL transmissionControl,
1645 CSR_RATE TransmitRate,
1646 CSR_PRIORITY priority,
1647 CSR_PROCESS_ID leSenderProcessId,
1648 bulk_data_param_t *bulkdata)
1649{
1650 CsrResult status = CSR_RESULT_SUCCESS;
1651 CSR_SIGNAL signal;
1652 int result;
1653#ifdef CSR_SUPPORT_SME
1654 CsrWifiRouterCtrlStaInfo_t *staRecord = NULL;
1655 const u8 *macHdrLocation = bulkdata->d[0].os_data_ptr;
1656 CsrWifiPacketType pktType;
1657 int frameType = 0;
1658 u8 queuePacketDozing = FALSE;
1659 u32 priority_q;
1660 u16 frmCtrl;
1661 struct list_head * list = NULL; /* List to which buffered PDUs are to be enqueued*/
1662 u8 setBcTim=FALSE;
1663 netInterface_priv_t *interfacePriv;
1664 u8 requeueOnSamePos = FALSE;
1665 u32 handle = 0xFFFFFFFF;
1666 unsigned long lock_flags;
1667
1668 unifi_trace(priv, UDBG5,
1669 "entering uf_process_ma_packet_req, peer: %pMF\n",
1670 peerMacAddress);
1671
1672 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
1673 unifi_error(priv, "interfaceTag >= CSR_WIFI_NUM_INTERFACES, interfacetag = %d\n", interfaceTag);
1674 return CSR_RESULT_FAILURE;
1675 }
1676 interfacePriv = priv->interfacePriv[interfaceTag];
1677
1678
1679 /* fetch the station record for corresponding peer mac address */
1680 if ((staRecord = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, peerMacAddress, interfaceTag))) {
1681 handle = staRecord->assignedHandle;
1682 }
1683
1684 /* Frame ma-packet.req, this is saved/transmitted depend on queue state */
1685 unifi_frame_ma_packet_req(priv, priority, TransmitRate, hostTag,
1686 interfaceTag, transmissionControl, leSenderProcessId,
1687 peerMacAddress, &signal);
1688
1689 /* Since it's common path between STA & AP mode, in case of STA packet
1690 * need not to be queued but in AP case we have to queue PDU's in
1691 * different scenarios
1692 */
1693 switch(interfacePriv->interfaceMode)
1694 {
1695 case CSR_WIFI_ROUTER_CTRL_MODE_AP:
1696 case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO:
1697 /* For this mode processing done below */
1698 break;
1699 default:
1700 /* In case of STA/IBSS/P2PCLI/AMP, no checks needed send the packet down & return */
1701 unifi_trace(priv, UDBG5, "In %s, interface mode is %x \n", __FUNCTION__, interfacePriv->interfaceMode);
1702 if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_NONE) {
1703 unifi_warning(priv, "In %s, interface mode NONE \n", __FUNCTION__);
1704 }
1705 if ((result = ul_send_signal_unpacked(priv, &signal, bulkdata))) {
1706 status = CSR_RESULT_FAILURE;
1707 }
1708 return status;
1709 }
1710
1711 /* -----Only AP/P2pGO mode handling falls below----- */
1712
1713 /* convert priority to queue */
1714 priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY) priority);
1715
1716 /* check the powersave status of the peer */
1717 if (staRecord && (staRecord->currentPeerState ==
1718 CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE)) {
1719 /* Peer is dozing & packet have to be delivered, so buffer the packet &
1720 * update the TIM
1721 */
1722 queuePacketDozing = TRUE;
1723 }
1724
1725 /* find the type of frame unicast or mulicast/broadcast */
1726 if (*peerMacAddress & 0x1) {
1727 /* Multicast/broadCast data are always triggered by vif_availability.ind
1728 * at the DTIM
1729 */
1730 pktType = CSR_WIFI_MULTICAST_PDU;
1731 } else {
1732 pktType = CSR_WIFI_UNICAST_PDU;
1733 }
1734
1735 /* Fetch the frame control field from mac header & check for frame type */
1736 frmCtrl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(macHdrLocation);
1737
1738 /* Processing done according to Frame/Packet type */
1739 frameType = ((frmCtrl & 0x000c) >> FRAME_CONTROL_TYPE_FIELD_OFFSET);
1740 switch(frameType)
1741 {
1742 case IEEE802_11_FRAMETYPE_MANAGEMENT:
1743
1744 switch(pktType)
1745 {
1746 case CSR_WIFI_UNICAST_PDU:
1747 unifi_trace(priv, UDBG5, "management unicast PDU in uf_process_ma_packet_req \n");
1748 /* push the packet in to the queue with appropriate mgt list */
1749 if (!staRecord) {
1750 /* push the packet to the unifi if list is empty (if packet lost how to re-enque) */
1751 if (list_empty(&interfacePriv->genericMgtFrames)) {
1752#ifdef CSR_SUPPORT_SME
1753 if(!(IS_DTIM_ACTIVE(interfacePriv->dtimActive, interfacePriv->multicastPduHostTag))) {
1754#endif
1755
1756 unifi_trace(priv, UDBG3, "genericMgtFrames list is empty uf_process_ma_packet_req \n");
1757 result = ul_send_signal_unpacked(priv, &signal, bulkdata);
1758 /* reque only on ENOSPC */
1759 if(result == -ENOSPC) {
1760 /* requeue the failed packet to genericMgtFrame with same position */
1761 unifi_trace(priv, UDBG1, "(ENOSPC) Sending genericMgtFrames Failed so buffering\n");
1762 list = &interfacePriv->genericMgtFrames;
1763 requeueOnSamePos = TRUE;
1764 }
1765#ifdef CSR_SUPPORT_SME
1766 }else{
1767 list = &interfacePriv->genericMgtFrames;
1768 unifi_trace(priv, UDBG3, "genericMgtFrames queue empty and dtim started\n hosttag is 0x%x,\n", signal.u.MaPacketRequest.HostTag);
1769 update_eosp_to_head_of_broadcast_list_head(priv, interfaceTag);
1770 }
1771#endif
1772 } else {
1773 /* Queue the packet to genericMgtFrame of unifi_priv_t data structure */
1774 list = &interfacePriv->genericMgtFrames;
1775 unifi_trace(priv, UDBG2, "genericMgtFrames queue not empty\n");
1776 }
1777 } else {
1778 /* check peer power state */
1779 if (queuePacketDozing || !list_empty(&staRecord->mgtFrames) || IS_DTIM_ACTIVE(interfacePriv->dtimActive, interfacePriv->multicastPduHostTag)) {
1780 /* peer is in dozing mode, so queue packet in mgt frame list of station record */
1781 /*if multicast traffic is going on, buffer the unicast packets*/
1782 list = &staRecord->mgtFrames;
1783
1784 unifi_trace(priv, UDBG1, "staRecord->MgtFrames list empty? = %s, handle = %d, queuePacketDozing = %d\n",
1785 (list_empty(&staRecord->mgtFrames))? "YES": "NO", staRecord->assignedHandle, queuePacketDozing);
1786 if(IS_DTIM_ACTIVE(interfacePriv->dtimActive, interfacePriv->multicastPduHostTag)){
1787 update_eosp_to_head_of_broadcast_list_head(priv, interfaceTag);
1788 }
1789
1790 } else {
1791 unifi_trace(priv, UDBG5, "staRecord->mgtFrames list is empty uf_process_ma_packet_req \n");
1792 result = ul_send_signal_unpacked(priv, &signal, bulkdata);
1793 if(result == -ENOSPC) {
1794 /* requeue the failed packet to staRecord->mgtFrames with same position */
1795 list = &staRecord->mgtFrames;
1796 requeueOnSamePos = TRUE;
1797 unifi_trace(priv, UDBG1, "(ENOSPC) Sending MgtFrames Failed handle = %d so buffering\n", staRecord->assignedHandle);
1798 priv->pausedStaHandle[0]=(u8)(staRecord->assignedHandle);
1799 } else if (result) {
1800 status = CSR_RESULT_FAILURE;
1801 }
1802 }
1803 }
1804 break;
1805 case CSR_WIFI_MULTICAST_PDU:
1806 unifi_trace(priv, UDBG5, "management multicast/broadcast PDU in uf_process_ma_packet_req 'QUEUE it' \n");
1807 /* Queue the packet to genericMulticastOrBroadCastMgtFrames of unifi_priv_t data structure
1808 * will be sent when we receive VIF AVAILABILITY from firmware as part of DTIM
1809 */
1810
1811 list = &interfacePriv->genericMulticastOrBroadCastMgtFrames;
1812 if((interfacePriv->interfaceMode != CSR_WIFI_ROUTER_CTRL_MODE_IBSS) &&
1813 (list_empty(&interfacePriv->genericMulticastOrBroadCastMgtFrames))) {
1814 setBcTim=TRUE;
1815 }
1816 break;
1817 default:
1818 unifi_error(priv, "condition never meets: packet type unrecognized\n");
1819 }
1820 break;
1821 case IEEE802_11_FRAMETYPE_DATA:
1822 switch(pktType)
1823 {
1824 case CSR_WIFI_UNICAST_PDU:
1825 unifi_trace(priv, UDBG5, "data unicast PDU in uf_process_ma_packet_req \n");
1826 /* check peer power state, list status & peer port status */
1827 if(!staRecord) {
1828 unifi_error(priv, "In %s unicast but staRecord = NULL\n", __FUNCTION__);
1829 return CSR_RESULT_FAILURE;
1830 } else if (queuePacketDozing || isRouterBufferEnabled(priv, priority_q)|| !list_empty(&staRecord->dataPdu[priority_q]) || IS_DTIM_ACTIVE(interfacePriv->dtimActive, interfacePriv->multicastPduHostTag)) {
1831 /* peer is in dozing mode, so queue packet in mgt frame list of station record */
1832 /* if multicast traffic is going on, buffet the unicast packets */
1833 unifi_trace(priv, UDBG2, "Enqueued to staRecord->dataPdu[%d] queuePacketDozing=%d,\
1834 Buffering enabled = %d \n", priority_q, queuePacketDozing, isRouterBufferEnabled(priv, priority_q));
1835 list = &staRecord->dataPdu[priority_q];
1836 } else {
1837 unifi_trace(priv, UDBG5, "staRecord->dataPdu[%d] list is empty uf_process_ma_packet_req \n", priority_q);
1838 /* Pdu allowed to send to unifi */
1839 result = ul_send_signal_unpacked(priv, &signal, bulkdata);
1840 if(result == -ENOSPC) {
1841 /* requeue the failed packet to staRecord->dataPdu[priority_q] with same position */
1842 unifi_trace(priv, UDBG1, "(ENOSPC) Sending Unicast DataPDU to queue %d Failed so buffering\n", priority_q);
1843 requeueOnSamePos = TRUE;
1844 list = &staRecord->dataPdu[priority_q];
1845 priv->pausedStaHandle[priority_q]=(u8)(staRecord->assignedHandle);
1846 if(!isRouterBufferEnabled(priv, priority_q)) {
1847 unifi_error(priv, "Buffering Not enabled for queue %d \n", priority_q);
1848 }
1849 } else if (result) {
1850 status = CSR_RESULT_FAILURE;
1851 }
1852 }
1853 break;
1854 case CSR_WIFI_MULTICAST_PDU:
1855 unifi_trace(priv, UDBG5, "data multicast/broadcast PDU in uf_process_ma_packet_req \n");
1856 /* Queue the packet to genericMulticastOrBroadCastFrames list of unifi_priv_t data structure
1857 * will be sent when we receive VIF AVAILABILITY from firmware as part of DTIM
1858 */
1859 list = &interfacePriv->genericMulticastOrBroadCastFrames;
1860 if(list_empty(&interfacePriv->genericMulticastOrBroadCastFrames)) {
1861 setBcTim = TRUE;
1862 }
1863 break;
1864 default:
1865 unifi_error(priv, "condition never meets: packet type un recognized\n");
1866 }
1867 break;
1868 default:
1869 unifi_error(priv, "unrecognized frame type\n");
1870 }
1871 if(list) {
1872 status = enque_tx_data_pdu(priv, bulkdata, list, &signal, requeueOnSamePos);
1873 /* Record no. of packet queued for each peer */
1874 if (staRecord && (pktType == CSR_WIFI_UNICAST_PDU) && (!status)) {
1875 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
1876 staRecord->noOfPktQueued++;
1877 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
1878 }
1879 else if ((pktType == CSR_WIFI_MULTICAST_PDU) && (!status))
1880 {
1881 /* If broadcast Tim is set && queuing is successful, then only update TIM */
1882 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
1883 interfacePriv->noOfbroadcastPktQueued++;
1884 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
1885 }
1886 }
1887 /* If broadcast Tim is set && queuing is successful, then only update TIM */
1888 if(setBcTim && !status) {
1889 unifi_trace(priv, UDBG3, "tim set due to broadcast pkt\n");
1890 if (!interfacePriv->bcTimSetReqPendingFlag)
1891 {
1892 update_tim(priv, 0, CSR_WIFI_TIM_SET, interfaceTag, handle);
1893 }
1894 else
1895 {
1896 /* Cache the TimSet value so that it will processed immidiatly after
1897 * completing the current setTim Request
1898 */
1899 interfacePriv->bcTimSetReqQueued = CSR_WIFI_TIM_SET;
1900 unifi_trace(priv, UDBG2, "uf_process_ma_packet_req : One more UpdateDTim Request(:%d) Queued \n",
1901 interfacePriv->bcTimSetReqQueued);
1902 }
1903 } else if(staRecord && staRecord->currentPeerState ==
1904 CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) {
1905 if(staRecord->timSet == CSR_WIFI_TIM_RESET || staRecord->timSet == CSR_WIFI_TIM_RESETTING) {
1906 if(!staRecord->wmmOrQosEnabled) {
1907 if(!list_empty(&staRecord->mgtFrames) ||
1908 !list_empty(&staRecord->dataPdu[3]) ||
1909 !list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION])) {
1910 unifi_trace(priv, UDBG3, "tim set due to unicast pkt & peer in powersave\n");
1911 if (!staRecord->timRequestPendingFlag){
1912 update_tim(priv, staRecord->aid, 1, interfaceTag, handle);
1913 }
1914 else
1915 {
1916 /* Cache the TimSet value so that it will processed immidiatly after
1917 * completing the current setTim Request
1918 */
1919 staRecord->updateTimReqQueued = 1;
1920 unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", staRecord->updateTimReqQueued,
1921 staRecord->aid);
1922 }
1923 }
1924 } else {
1925 /* Check for non delivery enable(i.e trigger enable), all delivery enable & legacy AC for TIM update in firmware */
1926 u8 allDeliveryEnabled = 0, dataAvailable = 0;
1927 /* Check if all AC's are Delivery Enabled */
1928 is_all_ac_deliver_enabled_and_moredata(staRecord, &allDeliveryEnabled, &dataAvailable);
1929 if (uf_is_more_data_for_non_delivery_ac(staRecord) || (allDeliveryEnabled && dataAvailable)
1930 || (!list_empty(&staRecord->mgtFrames))) {
1931 if (!staRecord->timRequestPendingFlag) {
1932 update_tim(priv, staRecord->aid, 1, interfaceTag, handle);
1933 }
1934 else
1935 {
1936 /* Cache the TimSet value so that it will processed immidiatly after
1937 * completing the current setTim Request
1938 */
1939 staRecord->updateTimReqQueued = 1;
1940 unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", staRecord->updateTimReqQueued,
1941 staRecord->aid);
1942 }
1943 }
1944 }
1945 }
1946 }
1947
1948 if((list) && (pktType == CSR_WIFI_UNICAST_PDU && !queuePacketDozing) && !(isRouterBufferEnabled(priv, priority_q)) && !(IS_DTIM_ACTIVE(interfacePriv->dtimActive, interfacePriv->multicastPduHostTag))) {
1949 unifi_trace(priv, UDBG2, "buffering cleared for queue = %d So resending buffered frames\n", priority_q);
1950 uf_send_buffered_frames(priv, priority_q);
1951 }
1952 unifi_trace(priv, UDBG5, "leaving uf_process_ma_packet_req \n");
1953 return status;
1954#else
1955#ifdef CSR_NATIVE_LINUX
1956 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
1957 unifi_error(priv, "interfaceTag >= CSR_WIFI_NUM_INTERFACES, interfacetag = %d\n", interfaceTag);
1958 return CSR_RESULT_FAILURE;
1959 }
1960 /* Frame ma-packet.req, this is saved/transmitted depend on queue state */
1961 unifi_frame_ma_packet_req(priv, priority, TransmitRate, hostTag, interfaceTag,
1962 transmissionControl, leSenderProcessId,
1963 peerMacAddress, &signal);
1964 result = ul_send_signal_unpacked(priv, &signal, bulkdata);
1965 if (result) {
1966 return CSR_RESULT_FAILURE;
1967 }
1968#endif
1969 return status;
1970#endif
1971}
1972
1973#ifdef CSR_SUPPORT_SME
1974s8 uf_get_protection_bit_from_interfacemode(unifi_priv_t *priv, u16 interfaceTag, const u8 *daddr)
1975{
1976 s8 protection = 0;
1977 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
1978
1979 switch(interfacePriv->interfaceMode)
1980 {
1981 case CSR_WIFI_ROUTER_CTRL_MODE_STA:
1982 case CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI:
1983 case CSR_WIFI_ROUTER_CTRL_MODE_AMP:
1984 case CSR_WIFI_ROUTER_CTRL_MODE_IBSS:
1985 protection = interfacePriv->protect;
1986 break;
1987 case CSR_WIFI_ROUTER_CTRL_MODE_AP:
1988 case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO:
1989 {
1990 CsrWifiRouterCtrlStaInfo_t *dstStaInfo = NULL;
1991 if (daddr[0] & 0x1) {
1992 unifi_trace(priv, UDBG3, "broadcast/multicast packet in send_ma_pkt_request\n");
1993 /* In this mode, the protect member of priv structure has an information of how
1994 * AP/P2PGO has started, & the member updated in set mode request for AP/P2PGO
1995 */
1996 protection = interfacePriv->protect;
1997 } else {
1998 /* fetch the destination record from station record database */
1999 dstStaInfo = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, daddr, interfaceTag);
2000 if (!dstStaInfo) {
2001 unifi_trace(priv, UDBG3, "peer not found in station record in send_ma_pkt_request\n");
2002 return -1;
2003 }
2004 protection = dstStaInfo->protection;
2005 }
2006 }
2007 break;
2008 default:
2009 unifi_trace(priv, UDBG2, "mode unknown in send_ma_pkt_request\n");
2010 }
2011 return protection;
2012}
2013#endif
2014#ifdef CSR_SUPPORT_SME
2015u8 send_multicast_frames(unifi_priv_t *priv, u16 interfaceTag)
2016{
2017 int r;
2018 tx_buffered_packets_t * buffered_pkt = NULL;
2019 u8 moreData = FALSE;
2020 u8 pduSent =0;
2021 unsigned long lock_flags;
2022 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
2023 u32 hostTag = 0xffffffff;
2024
2025 if(!isRouterBufferEnabled(priv, UNIFI_TRAFFIC_Q_VO)) {
2026 while((interfacePriv->dtimActive)&& (buffered_pkt=dequeue_tx_data_pdu(priv, &interfacePriv->genericMulticastOrBroadCastMgtFrames))) {
2027 buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK);
2028 moreData = (buffered_pkt->transmissionControl & TRANSMISSION_CONTROL_EOSP_MASK)?FALSE:TRUE;
2029
2030
2031 unifi_trace(priv, UDBG2, "DTIM Occurred for interface:sending Mgt packet %d\n", interfaceTag);
2032
2033 if((r=frame_and_send_queued_pdu(priv, buffered_pkt, NULL, moreData, FALSE)) == -ENOSPC) {
2034 unifi_trace(priv, UDBG1, "frame_and_send_queued_pdu failed with ENOSPC for host tag = %x\n", buffered_pkt->hostTag);
2035 /* Enqueue at the head of the queue */
2036 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
2037 list_add(&buffered_pkt->q, &interfacePriv->genericMulticastOrBroadCastMgtFrames);
2038 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
2039 break;
2040 } else {
2041 unifi_trace(priv, UDBG1, "send_multicast_frames: Send genericMulticastOrBroadCastMgtFrames (%x, %x)\n",
2042 buffered_pkt->hostTag,
2043 r);
2044 if(r) {
2045 unifi_net_data_free(priv, &buffered_pkt->bulkdata);
2046 }
2047 if(!moreData) {
2048
2049 interfacePriv->dtimActive = FALSE;
2050 if(!r) {
2051 hostTag = buffered_pkt->hostTag;
2052 pduSent++;
2053 } else {
2054 send_vif_availibility_rsp(priv, uf_get_vif_identifier(interfacePriv->interfaceMode, interfaceTag), CSR_RC_UNSPECIFIED_FAILURE);
2055 }
2056 }
2057 /* Buffered frame sent successfully */
2058 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
2059 interfacePriv->noOfbroadcastPktQueued--;
2060 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
2061 kfree(buffered_pkt);
2062 }
2063
2064 }
2065 }
2066 if(!isRouterBufferEnabled(priv, UNIFI_TRAFFIC_Q_CONTENTION)) {
2067 while((interfacePriv->dtimActive)&& (buffered_pkt=dequeue_tx_data_pdu(priv, &interfacePriv->genericMulticastOrBroadCastFrames))) {
2068 buffered_pkt->transmissionControl |= TRANSMISSION_CONTROL_TRIGGER_MASK;
2069 moreData = (buffered_pkt->transmissionControl & TRANSMISSION_CONTROL_EOSP_MASK)?FALSE:TRUE;
2070
2071
2072 if((r=frame_and_send_queued_pdu(priv, buffered_pkt, NULL, moreData, FALSE)) == -ENOSPC) {
2073 /* Clear the trigger bit transmission control*/
2074 buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK);
2075 /* Enqueue at the head of the queue */
2076 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
2077 list_add(&buffered_pkt->q, &interfacePriv->genericMulticastOrBroadCastFrames);
2078 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
2079 break;
2080 } else {
2081 if(r) {
2082 unifi_trace(priv, UDBG1, "send_multicast_frames: Send genericMulticastOrBroadCastFrame failed (%x, %x)\n",
2083 buffered_pkt->hostTag,
2084 r);
2085 unifi_net_data_free(priv, &buffered_pkt->bulkdata);
2086 }
2087 if(!moreData) {
2088 interfacePriv->dtimActive = FALSE;
2089 if(!r) {
2090 pduSent ++;
2091 hostTag = buffered_pkt->hostTag;
2092 } else {
2093 send_vif_availibility_rsp(priv, uf_get_vif_identifier(interfacePriv->interfaceMode, interfaceTag), CSR_RC_UNSPECIFIED_FAILURE);
2094 }
2095 }
2096 /* Buffered frame sent successfully */
2097 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
2098 interfacePriv->noOfbroadcastPktQueued--;
2099 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
2100 kfree(buffered_pkt);
2101 }
2102 }
2103 }
2104 if((interfacePriv->dtimActive == FALSE)) {
2105 /* Record the host Tag*/
2106 unifi_trace(priv, UDBG2, "send_multicast_frames: Recorded hostTag of EOSP packet: = 0x%x\n", hostTag);
2107 interfacePriv->multicastPduHostTag = hostTag;
2108 }
2109 return pduSent;
2110}
2111#endif
2112void uf_process_ma_vif_availibility_ind(unifi_priv_t *priv, u8 *sigdata,
2113 u32 siglen)
2114{
2115#ifdef CSR_SUPPORT_SME
2116 CSR_SIGNAL signal;
2117 CSR_MA_VIF_AVAILABILITY_INDICATION *ind;
2118 int r;
2119 u16 interfaceTag;
2120 u8 pduSent =0;
2121 CSR_RESULT_CODE resultCode = CSR_RC_SUCCESS;
2122 netInterface_priv_t *interfacePriv;
2123
2124 unifi_trace(priv, UDBG3,
2125 "uf_process_ma_vif_availibility_ind: Process signal 0x%.4X\n",
2126 *((u16*)sigdata));
2127
2128 r = read_unpack_signal(sigdata, &signal);
2129 if (r) {
2130 unifi_error(priv,
2131 "uf_process_ma_vif_availibility_ind: Received unknown signal 0x%.4X.\n",
2132 CSR_GET_UINT16_FROM_LITTLE_ENDIAN(sigdata));
2133 return;
2134 }
2135 ind = &signal.u.MaVifAvailabilityIndication;
2136 interfaceTag=ind->VirtualInterfaceIdentifier & 0xff;
2137
2138 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
2139 unifi_error(priv, "in vif_availability_ind interfaceTag is wrong\n");
2140 return;
2141 }
2142
2143 interfacePriv = priv->interfacePriv[interfaceTag];
2144
2145 if(ind->Multicast) {
2146 if(list_empty(&interfacePriv->genericMulticastOrBroadCastFrames) &&
2147 list_empty(&interfacePriv->genericMulticastOrBroadCastMgtFrames)) {
2148 /* This condition can occur because of a potential race where the
2149 TIM is not yet reset as host is waiting for confirm but it is sent
2150 by firmware and DTIM occurs*/
2151 unifi_notice(priv, "ma_vif_availibility_ind recevied for multicast but queues are empty%d\n", interfaceTag);
2152 send_vif_availibility_rsp(priv, ind->VirtualInterfaceIdentifier, CSR_RC_NO_BUFFERED_BROADCAST_MULTICAST_FRAMES);
2153 interfacePriv->dtimActive = FALSE;
2154 if(interfacePriv->multicastPduHostTag == 0xffffffff) {
2155 unifi_notice(priv, "ma_vif_availibility_ind recevied for multicast but queues are empty%d\n", interfaceTag);
2156 /* This may be an extra request in very rare race conditions but it is fine as it would atleast remove the potential lock up */
2157 if (!interfacePriv->bcTimSetReqPendingFlag)
2158 {
2159 update_tim(priv, 0, CSR_WIFI_TIM_RESET, interfaceTag, 0xFFFFFFFF);
2160 }
2161 else
2162 {
2163 /* Cache the TimSet value so that it will processed immidiatly after
2164 * completing the current setTim Request
2165 */
2166 interfacePriv->bcTimSetReqQueued = CSR_WIFI_TIM_RESET;
2167 unifi_trace(priv, UDBG2, "uf_process_ma_vif_availibility_ind : One more UpdateDTim Request(%d) Queued \n",
2168 interfacePriv->bcTimSetReqQueued);
2169 }
2170 }
2171 return;
2172 }
2173 if(interfacePriv->dtimActive) {
2174 unifi_trace(priv, UDBG2, "DTIM Occurred for already active DTIM interface %d\n", interfaceTag);
2175 return;
2176 } else {
2177 unifi_trace(priv, UDBG2, "DTIM Occurred for interface %d\n", interfaceTag);
2178 if(list_empty(&interfacePriv->genericMulticastOrBroadCastFrames)) {
2179 set_eosp_transmit_ctrl(priv, &interfacePriv->genericMulticastOrBroadCastMgtFrames);
2180 } else {
2181 set_eosp_transmit_ctrl(priv, &interfacePriv->genericMulticastOrBroadCastFrames);
2182 }
2183 }
2184 interfacePriv->dtimActive = TRUE;
2185 pduSent = send_multicast_frames(priv, interfaceTag);
2186 }
2187 else {
2188 unifi_error(priv, "Interface switching is not supported %d\n", interfaceTag);
2189 resultCode = CSR_RC_NOT_SUPPORTED;
2190 send_vif_availibility_rsp(priv, ind->VirtualInterfaceIdentifier, CSR_RC_NOT_SUPPORTED);
2191 }
2192#endif
2193}
2194#ifdef CSR_SUPPORT_SME
2195
2196#define GET_ACTIVE_INTERFACE_TAG(priv) 0
2197
2198static u8 uf_is_more_data_for_delivery_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t *staRecord)
2199{
2200 s8 i;
2201
2202 for(i=UNIFI_TRAFFIC_Q_VO; i >= UNIFI_TRAFFIC_Q_BK; i--)
2203 {
2204 if(((staRecord->powersaveMode[i]==CSR_WIFI_AC_DELIVERY_ONLY_ENABLE)
2205 ||(staRecord->powersaveMode[i]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED))
2206 &&(!list_empty(&staRecord->dataPdu[i]))) {
2207 unifi_trace(priv, UDBG2, "uf_is_more_data_for_delivery_ac: Data Available AC = %d\n", i);
2208 return TRUE;
2209 }
2210 }
2211
2212 unifi_trace(priv, UDBG2, "uf_is_more_data_for_delivery_ac: Data NOT Available \n");
2213 return FALSE;
2214}
2215
2216static u8 uf_is_more_data_for_usp_delivery(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t *staRecord, unifi_TrafficQueue queue)
2217{
2218 s8 i;
2219
2220 for(i = queue; i >= UNIFI_TRAFFIC_Q_BK; i--)
2221 {
2222 if(((staRecord->powersaveMode[i]==CSR_WIFI_AC_DELIVERY_ONLY_ENABLE)
2223 ||(staRecord->powersaveMode[i]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED))
2224 &&(!list_empty(&staRecord->dataPdu[i]))) {
2225 unifi_trace(priv, UDBG2, "uf_is_more_data_for_usp_delivery: Data Available AC = %d\n", i);
2226 return TRUE;
2227 }
2228 }
2229
2230 unifi_trace(priv, UDBG2, "uf_is_more_data_for_usp_delivery: Data NOT Available \n");
2231 return FALSE;
2232}
2233
2234/*
2235 * ---------------------------------------------------------------------------
2236 * uf_send_buffered_data_from_delivery_ac
2237 *
2238 * This function takes care of
2239 * -> Parsing the delivery enabled queue & sending frame down to HIP
2240 * -> Setting EOSP=1 when USP to be terminated
2241 * -> Depending on MAX SP length services the USP
2242 *
2243 * NOTE:This function always called from uf_handle_uspframes_delivery(), Dont
2244 * call this function from any other location in code
2245 *
2246 * Arguments:
2247 * priv Pointer to device private context struct
2248 * vif interface specific HIP vif instance
2249 * staInfo peer for which UAPSD to be scheduled
2250 * queue AC from which Data to be sent in USP
2251 * txList access category for processing list
2252 * ---------------------------------------------------------------------------
2253 */
2254void uf_send_buffered_data_from_delivery_ac(unifi_priv_t *priv,
2255 CsrWifiRouterCtrlStaInfo_t * staInfo,
2256 u8 queue,
2257 struct list_head *txList)
2258{
2259
2260 u16 interfaceTag = GET_ACTIVE_INTERFACE_TAG(priv);
2261 tx_buffered_packets_t * buffered_pkt = NULL;
2262 unsigned long lock_flags;
2263 u8 eosp=FALSE;
2264 s8 r =0;
2265 u8 moreData = FALSE;
2266 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
2267
2268 unifi_trace(priv, UDBG2, "++uf_send_buffered_data_from_delivery_ac, active=%x\n", staInfo->uapsdActive);
2269
2270 if (queue > UNIFI_TRAFFIC_Q_VO)
2271 {
2272 return;
2273 }
2274 while((buffered_pkt=dequeue_tx_data_pdu(priv, txList))) {
2275 if((IS_DTIM_ACTIVE(interfacePriv->dtimActive, interfacePriv->multicastPduHostTag))) {
2276 unifi_trace(priv, UDBG2, "uf_send_buffered_data_from_delivery_ac: DTIM Active, suspend UAPSD, staId: 0x%x\n",
2277 staInfo->aid);
2278
2279 /* Once resume called, the U-APSD delivery operation will resume */
2280 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
2281 staInfo->uspSuspend = TRUE;
2282 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
2283 /* re-queueing the packet as DTIM started */
2284 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
2285 list_add(&buffered_pkt->q, txList);
2286 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
2287 break;
2288 }
2289
2290 buffered_pkt->transmissionControl &=
2291 ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK);
2292
2293
2294 if((staInfo->wmmOrQosEnabled == TRUE)&&(staInfo->uapsdActive == TRUE)) {
2295
2296 buffered_pkt->transmissionControl = TRANSMISSION_CONTROL_TRIGGER_MASK;
2297
2298 /* Check All delivery enables Ac for more data, because caller of this
2299 * function not aware about last packet
2300 * (First check in moreData fetching helps in draining out Mgt frames Q)
2301 */
2302 moreData = (!list_empty(txList) || uf_is_more_data_for_usp_delivery(priv, staInfo, queue));
2303
2304 if(staInfo->noOfSpFramesSent == (staInfo->maxSpLength - 1)) {
2305 moreData = FALSE;
2306 }
2307
2308 if(moreData == FALSE) {
2309 eosp = TRUE;
2310 buffered_pkt->transmissionControl =
2311 (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK);
2312 }
2313 } else {
2314 /* Non QoS and non U-APSD */
2315 unifi_warning(priv, "uf_send_buffered_data_from_delivery_ac: non U-APSD !!! \n");
2316 }
2317
2318 unifi_trace(priv, UDBG2, "uf_send_buffered_data_from_delivery_ac : MoreData:%d, EOSP:%d\n", moreData, eosp);
2319
2320 if((r=frame_and_send_queued_pdu(priv, buffered_pkt, staInfo, moreData, eosp)) == -ENOSPC) {
2321
2322 unifi_trace(priv, UDBG2, "uf_send_buffered_data_from_delivery_ac: UASPD suspended, ENOSPC in hipQ=%x\n", queue);
2323
2324 /* Once resume called, the U-APSD delivery operation will resume */
2325 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
2326 staInfo->uspSuspend = TRUE;
2327 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
2328
2329 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
2330 list_add(&buffered_pkt->q, txList);
2331 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
2332 priv->pausedStaHandle[queue]=(u8)(staInfo->assignedHandle);
2333 break;
2334 } else {
2335 if(r){
2336 /* the PDU failed where we can't do any thing so free the storage */
2337 unifi_net_data_free(priv, &buffered_pkt->bulkdata);
2338 }
2339 kfree(buffered_pkt);
2340 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
2341 staInfo->noOfSpFramesSent++;
2342 if((!moreData) || (staInfo->noOfSpFramesSent == staInfo->maxSpLength)) {
2343 unifi_trace(priv, UDBG2, "uf_send_buffered_data_from_delivery_ac: Terminating USP\n");
2344 staInfo->uapsdActive = FALSE;
2345 staInfo->uspSuspend = FALSE;
2346 staInfo->noOfSpFramesSent = 0;
2347 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
2348 break;
2349 }
2350 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
2351 }
2352 }
2353 unifi_trace(priv, UDBG2, "--uf_send_buffered_data_from_delivery_ac, active=%x\n", staInfo->uapsdActive);
2354}
2355
2356void uf_send_buffered_data_from_ac(unifi_priv_t *priv,
2357 CsrWifiRouterCtrlStaInfo_t * staInfo,
2358 u8 queue,
2359 struct list_head *txList)
2360{
2361 tx_buffered_packets_t * buffered_pkt = NULL;
2362 unsigned long lock_flags;
2363 u8 eosp=FALSE;
2364 u8 moreData = FALSE;
2365 s8 r =0;
2366
2367 unifi_trace(priv, UDBG2, "uf_send_buffered_data_from_ac :\n");
2368
2369 while(!isRouterBufferEnabled(priv, queue) &&
2370 ((buffered_pkt=dequeue_tx_data_pdu(priv, txList))!=NULL)){
2371
2372 buffered_pkt->transmissionControl &=
2373 ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_EOSP_MASK);
2374
2375 unifi_trace(priv, UDBG3, "uf_send_buffered_data_from_ac : MoreData:%d, EOSP:%d\n", moreData, eosp);
2376
2377 if((r=frame_and_send_queued_pdu(priv, buffered_pkt, staInfo, moreData, eosp)) == -ENOSPC) {
2378 /* Enqueue at the head of the queue */
2379 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
2380 list_add(&buffered_pkt->q, txList);
2381 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
2382 if(staInfo != NULL){
2383 priv->pausedStaHandle[queue]=(u8)(staInfo->assignedHandle);
2384 }
2385 unifi_trace(priv, UDBG3, " uf_send_buffered_data_from_ac: PDU sending failed .. no space for queue %d \n", queue);
2386 } else {
2387 if(r){
2388 /* the PDU failed where we can't do any thing so free the storage */
2389 unifi_net_data_free(priv, &buffered_pkt->bulkdata);
2390 }
2391 kfree(buffered_pkt);
2392 }
2393 }
2394
2395}
2396
2397void uf_send_buffered_frames(unifi_priv_t *priv, unifi_TrafficQueue q)
2398{
2399 u16 interfaceTag = GET_ACTIVE_INTERFACE_TAG(priv);
2400 u32 startIndex=0, endIndex=0;
2401 CsrWifiRouterCtrlStaInfo_t * staInfo = NULL;
2402 u8 queue;
2403 u8 moreData = FALSE;
2404
2405 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
2406
2407 if(!((interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP) ||
2408 (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO)))
2409 return;
2410
2411 queue = (q<=3)?q:0;
2412
2413 if(interfacePriv->dtimActive) {
2414 /* this function updates dtimActive*/
2415 send_multicast_frames(priv, interfaceTag);
2416 if(!interfacePriv->dtimActive) {
2417 moreData = (!list_empty(&interfacePriv->genericMulticastOrBroadCastMgtFrames) ||
2418 !list_empty(&interfacePriv->genericMulticastOrBroadCastFrames));
2419 if(!moreData) {
2420 if (!interfacePriv->bcTimSetReqPendingFlag)
2421 {
2422 update_tim(priv, 0, CSR_WIFI_TIM_RESET, interfaceTag, 0XFFFFFFFF);
2423 }
2424 else
2425 {
2426 /* Cache the TimSet value so that it will processed immidiatly after
2427 * completing the current setTim Request
2428 */
2429 interfacePriv->bcTimSetReqQueued = CSR_WIFI_TIM_RESET;
2430 unifi_trace(priv, UDBG2, "uf_send_buffered_frames : One more UpdateDTim Request(%d) Queued \n",
2431 interfacePriv->bcTimSetReqQueued);
2432 }
2433 }
2434 } else {
2435 moreData = (!list_empty(&interfacePriv->genericMulticastOrBroadCastMgtFrames) ||
2436 !list_empty(&interfacePriv->genericMulticastOrBroadCastFrames));
2437 if(!moreData) {
2438 /* This should never happen but if it happens, we need a way out */
2439 unifi_error(priv, "ERROR: No More Data but DTIM is active sending Response\n");
2440 send_vif_availibility_rsp(priv, uf_get_vif_identifier(interfacePriv->interfaceMode, interfaceTag), CSR_RC_NO_BUFFERED_BROADCAST_MULTICAST_FRAMES);
2441 interfacePriv->dtimActive = FALSE;
2442 }
2443 }
2444 return;
2445 }
2446 if(priv->pausedStaHandle[queue] > 7) {
2447 priv->pausedStaHandle[queue] = 0;
2448 }
2449
2450 if(queue == UNIFI_TRAFFIC_Q_VO) {
2451
2452
2453 unifi_trace(priv, UDBG2, "uf_send_buffered_frames : trying mgt from queue=%d\n", queue);
2454 for(startIndex= 0; startIndex < UNIFI_MAX_CONNECTIONS;startIndex++) {
2455 staInfo = CsrWifiRouterCtrlGetStationRecordFromHandle(priv, startIndex, interfaceTag);
2456 if(!staInfo ) {
2457 continue;
2458 } else if((staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE)
2459 &&(staInfo->uapsdActive == FALSE) ) {
2460 continue;
2461 }
2462
2463 if((staInfo != NULL)&&(staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE)
2464 &&(staInfo->uapsdActive == FALSE)){
2465 /*Non-UAPSD case push the management frames out*/
2466 if(!list_empty(&staInfo->mgtFrames)){
2467 uf_send_buffered_data_from_ac(priv, staInfo, UNIFI_TRAFFIC_Q_VO, &staInfo->mgtFrames);
2468 }
2469 }
2470
2471 if(isRouterBufferEnabled(priv, queue)) {
2472 unifi_notice(priv, "uf_send_buffered_frames : No space Left for queue = %d\n", queue);
2473 break;
2474 }
2475 }
2476 /*push generic management frames out*/
2477 if(!list_empty(&interfacePriv->genericMgtFrames)) {
2478 unifi_trace(priv, UDBG2, "uf_send_buffered_frames : trying generic mgt from queue=%d\n", queue);
2479 uf_send_buffered_data_from_ac(priv, staInfo, UNIFI_TRAFFIC_Q_VO, &interfacePriv->genericMgtFrames);
2480 }
2481 }
2482
2483
2484 unifi_trace(priv, UDBG2, "uf_send_buffered_frames : Resume called for Queue=%d\n", queue);
2485 unifi_trace(priv, UDBG2, "uf_send_buffered_frames : start=%d end=%d\n", startIndex, endIndex);
2486
2487 startIndex = priv->pausedStaHandle[queue];
2488 endIndex = (startIndex + UNIFI_MAX_CONNECTIONS -1) % UNIFI_MAX_CONNECTIONS;
2489
2490 while(startIndex != endIndex) {
2491 staInfo = CsrWifiRouterCtrlGetStationRecordFromHandle(priv, startIndex, interfaceTag);
2492 if(!staInfo) {
2493 startIndex ++;
2494 if(startIndex >= UNIFI_MAX_CONNECTIONS) {
2495 startIndex = 0;
2496 }
2497 continue;
2498 } else if((staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE)
2499 &&(staInfo->uapsdActive == FALSE)) {
2500 startIndex ++;
2501 if(startIndex >= UNIFI_MAX_CONNECTIONS) {
2502 startIndex = 0;
2503 }
2504 continue;
2505 }
2506 /* Peer is active or U-APSD is active so send PDUs to the peer */
2507 unifi_trace(priv, UDBG2, "uf_send_buffered_frames : trying data from queue=%d\n", queue);
2508
2509
2510 if((staInfo != NULL)&&(staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE)
2511 &&(staInfo->uapsdActive == FALSE)) {
2512 if(!list_empty(&staInfo->dataPdu[queue])) {
2513
2514 /*Non-UAPSD case push the AC frames out*/
2515 uf_send_buffered_data_from_ac(priv, staInfo, queue, (&staInfo->dataPdu[queue]));
2516 }
2517 }
2518 startIndex ++;
2519 if(startIndex >= UNIFI_MAX_CONNECTIONS) {
2520 startIndex = 0;
2521 }
2522 }
2523 if(isRouterBufferEnabled(priv, queue)) {
2524 priv->pausedStaHandle[queue] = endIndex;
2525 } else {
2526 priv->pausedStaHandle[queue] = 0;
2527 }
2528
2529 /* U-APSD might have stopped because of ENOSPC in lib_hip (pause activity).
2530 * So restart it if U-APSD was active with any of the station
2531 */
2532 unifi_trace(priv, UDBG4, "csrWifiHipSendBufferedFrames: UAPSD Resume Q=%x\n", queue);
2533 resume_suspended_uapsd(priv, interfaceTag);
2534}
2535
2536
2537u8 uf_is_more_data_for_non_delivery_ac(CsrWifiRouterCtrlStaInfo_t *staRecord)
2538{
2539 u8 i;
2540
2541 for(i=0;i<=3;i++)
2542 {
2543 if(((staRecord->powersaveMode[i]==CSR_WIFI_AC_TRIGGER_ONLY_ENABLED)
2544 ||(staRecord->powersaveMode[i]==CSR_WIFI_AC_LEGACY_POWER_SAVE))
2545 &&(!list_empty(&staRecord->dataPdu[i]))){
2546
2547 return TRUE;
2548 }
2549 }
2550
2551 if(((staRecord->powersaveMode[UNIFI_TRAFFIC_Q_VO]==CSR_WIFI_AC_TRIGGER_ONLY_ENABLED)
2552 ||(staRecord->powersaveMode[UNIFI_TRAFFIC_Q_VO]==CSR_WIFI_AC_LEGACY_POWER_SAVE))
2553 &&(!list_empty(&staRecord->mgtFrames))){
2554
2555 return TRUE;
2556 }
2557
2558
2559
2560 return FALSE;
2561}
2562
2563
2564int uf_process_station_records_for_sending_data(unifi_priv_t *priv, u16 interfaceTag,
2565 CsrWifiRouterCtrlStaInfo_t *srcStaInfo,
2566 CsrWifiRouterCtrlStaInfo_t *dstStaInfo)
2567{
2568 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
2569
2570 unifi_trace(priv, UDBG5, "entering uf_process_station_records_for_sending_data\n");
2571
2572 if (srcStaInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_DISCONNECTED) {
2573 unifi_error(priv, "Peer State not connected AID = %x, handle = %x, control port state = %x\n",
2574 srcStaInfo->aid, srcStaInfo->assignedHandle, srcStaInfo->peerControlledPort->port_action);
2575 return -1;
2576 }
2577 switch (interfacePriv->interfaceMode)
2578 {
2579 case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO:
2580 case CSR_WIFI_ROUTER_CTRL_MODE_AP:
2581 unifi_trace(priv, UDBG5, "mode is AP/P2PGO\n");
2582 break;
2583 default:
2584 unifi_warning(priv, "mode is nor AP neither P2PGO, packet cant be xmit\n");
2585 return -1;
2586 }
2587
2588 switch(dstStaInfo->peerControlledPort->port_action)
2589 {
2590 case CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD:
2591 case CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_BLOCK:
2592 unifi_trace(priv, UDBG5, "destination port is closed/blocked, discarding the packet\n");
2593 return -1;
2594 default:
2595 unifi_trace(priv, UDBG5, "destination port state is open\n");
2596 }
2597
2598 /* port state is open, destination station record is valid, Power save state is
2599 * validated in uf_process_ma_packet_req function
2600 */
2601 unifi_trace(priv, UDBG5, "leaving uf_process_station_records_for_sending_data\n");
2602 return 0;
2603}
2604
2605
2606/*
2607 * ---------------------------------------------------------------------------
2608 * uf_handle_uspframes_delivery
2609 *
2610 * This function takes care of handling USP session for peer, when
2611 * -> trigger frame from peer
2612 * -> suspended USP to be processed (resumed)
2613 *
2614 * NOTE: uf_send_buffered_data_from_delivery_ac() always called from this function, Dont
2615 * make a direct call to uf_send_buffered_data_from_delivery_ac() from any other part of
2616 * code
2617 *
2618 * Arguments:
2619 * priv Pointer to device private context struct
2620 * staInfo peer for which UAPSD to be scheduled
2621 * interfaceTag virtual interface tag
2622 * ---------------------------------------------------------------------------
2623 */
2624static void uf_handle_uspframes_delivery(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t *staInfo, u16 interfaceTag)
2625{
2626
2627 s8 i;
2628 u8 allDeliveryEnabled = 0, dataAvailable = 0;
2629 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
2630 unsigned long lock_flags;
2631
2632 unifi_trace(priv, UDBG2, " ++ uf_handle_uspframes_delivery, uapsd active=%x, suspended?=%x\n",
2633 staInfo->uapsdActive, staInfo->uspSuspend);
2634
2635 /* Check for Buffered frames according to priority order & deliver it
2636 * 1. AC_VO delivery enable & Mgt frames available
2637 * 2. Process remaining Ac's from order AC_VO to AC_BK
2638 */
2639
2640 /* USP initiated by WMMPS enabled peer & SET the status flag to TRUE */
2641 if (!staInfo->uspSuspend && staInfo->uapsdActive)
2642 {
2643 unifi_notice(priv, "uf_handle_uspframes_delivery: U-APSD already active! STA=%x:%x:%x:%x:%x:%x\n",
2644 staInfo->peerMacAddress.a[0], staInfo->peerMacAddress.a[1],
2645 staInfo->peerMacAddress.a[2], staInfo->peerMacAddress.a[3],
2646 staInfo->peerMacAddress.a[4], staInfo->peerMacAddress.a[5]);
2647 return;
2648 }
2649
2650 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
2651 staInfo->uapsdActive = TRUE;
2652 staInfo->uspSuspend = FALSE;
2653 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
2654
2655 if(((staInfo->powersaveMode[UNIFI_TRAFFIC_Q_VO]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)||
2656 (staInfo->powersaveMode[UNIFI_TRAFFIC_Q_VO]==CSR_WIFI_AC_DELIVERY_ONLY_ENABLE))
2657 && (!list_empty(&staInfo->mgtFrames))) {
2658
2659 /* Management queue has data && UNIFI_TRAFFIC_Q_VO is delivery enable */
2660 unifi_trace(priv, UDBG4, "uf_handle_uspframes_delivery: Sending buffered management frames\n");
2661 uf_send_buffered_data_from_delivery_ac(priv, staInfo, UNIFI_TRAFFIC_Q_VO, &staInfo->mgtFrames);
2662 }
2663
2664 if (!uf_is_more_data_for_delivery_ac(priv, staInfo)) {
2665 /* All delivery enable AC's are empty, so QNULL to be sent to terminate the USP
2666 * NOTE: If we have sent Mgt frame also, we must send QNULL followed to terminate USP
2667 */
2668 if (!staInfo->uspSuspend) {
2669 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
2670 staInfo->uapsdActive = FALSE;
2671 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
2672
2673 unifi_trace(priv, UDBG2, "uf_handle_uspframes_delivery: sending QNull for trigger\n");
2674 uf_send_qos_null(priv, interfaceTag, staInfo->peerMacAddress.a, (CSR_PRIORITY) staInfo->triggerFramePriority, staInfo);
2675 staInfo->triggerFramePriority = CSR_QOS_UP0;
2676 } else {
2677 unifi_trace(priv, UDBG2, "uf_handle_uspframes_delivery: MgtQ xfer suspended\n");
2678 }
2679 } else {
2680 for(i = UNIFI_TRAFFIC_Q_VO; i >= UNIFI_TRAFFIC_Q_BK; i--) {
2681 if(((staInfo->powersaveMode[i]==CSR_WIFI_AC_DELIVERY_ONLY_ENABLE)
2682 ||(staInfo->powersaveMode[i]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED))
2683 && (!list_empty(&staInfo->dataPdu[i]))) {
2684 /* Deliver Data according to AC priority (from VO to BK) as part of USP */
2685 unifi_trace(priv, UDBG4, "uf_handle_uspframes_delivery: Buffered data frames from Queue (%d) for USP\n", i);
2686 uf_send_buffered_data_from_delivery_ac(priv, staInfo, i, &staInfo->dataPdu[i]);
2687 }
2688
2689 if ((!staInfo->uapsdActive) ||
2690 (staInfo->uspSuspend && IS_DTIM_ACTIVE(interfacePriv->dtimActive, interfacePriv->multicastPduHostTag))) {
2691 /* If DTIM active found on one AC, No need to parse the remaining AC's
2692 * as USP suspended. Break out of loop
2693 */
2694 unifi_trace(priv, UDBG2, "uf_handle_uspframes_delivery: suspend=%x, DTIM=%x, USP terminated=%s\n",
2695 staInfo->uspSuspend, IS_DTIM_ACTIVE(interfacePriv->dtimActive, interfacePriv->multicastPduHostTag),
2696 staInfo->uapsdActive?"NO":"YES");
2697 break;
2698 }
2699 }
2700 }
2701
2702 /* Depending on the USP status, update the TIM accordingly for delivery enabled AC only
2703 * (since we are not manipulating any Non-delivery list(AC))
2704 */
2705 is_all_ac_deliver_enabled_and_moredata(staInfo, &allDeliveryEnabled, &dataAvailable);
2706 if ((allDeliveryEnabled && !dataAvailable)) {
2707 if ((staInfo->timSet != CSR_WIFI_TIM_RESET) && (staInfo->timSet != CSR_WIFI_TIM_RESETTING)) {
2708 staInfo->updateTimReqQueued = (u8) CSR_WIFI_TIM_RESET;
2709 unifi_trace(priv, UDBG4, " --uf_handle_uspframes_delivery, UAPSD timset\n");
2710 if (!staInfo->timRequestPendingFlag) {
2711 update_tim(priv, staInfo->aid, 0, interfaceTag, staInfo->assignedHandle);
2712 }
2713 }
2714 }
2715 unifi_trace(priv, UDBG2, " --uf_handle_uspframes_delivery, uapsd active=%x, suspend?=%x\n",
2716 staInfo->uapsdActive, staInfo->uspSuspend);
2717}
2718
2719void uf_process_wmm_deliver_ac_uapsd(unifi_priv_t * priv,
2720 CsrWifiRouterCtrlStaInfo_t * srcStaInfo,
2721 u16 qosControl,
2722 u16 interfaceTag)
2723{
2724 CSR_PRIORITY priority;
2725 unifi_TrafficQueue priority_q;
2726 unsigned long lock_flags;
2727
2728 unifi_trace(priv, UDBG2, "++uf_process_wmm_deliver_ac_uapsd: uapsdactive?=%x\n", srcStaInfo->uapsdActive);
2729 /* If recceived Frames trigger Frame and Devlivery enabled AC has data
2730 * then transmit from High priorty delivery enabled AC
2731 */
2732 priority = (CSR_PRIORITY)(qosControl & IEEE802_11_QC_TID_MASK);
2733 priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY) priority);
2734
2735 if((srcStaInfo->powersaveMode[priority_q]==CSR_WIFI_AC_TRIGGER_ONLY_ENABLED)
2736 ||(srcStaInfo->powersaveMode[priority_q]==CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED)) {
2737 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
2738 srcStaInfo->triggerFramePriority = priority;
2739 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
2740 unifi_trace(priv, UDBG2, "uf_process_wmm_deliver_ac_uapsd: trigger frame, Begin U-APSD, triggerQ=%x\n", priority_q);
2741 uf_handle_uspframes_delivery(priv, srcStaInfo, interfaceTag);
2742 }
2743 unifi_trace(priv, UDBG2, "--uf_process_wmm_deliver_ac_uapsd: uapsdactive?=%x\n", srcStaInfo->uapsdActive);
2744}
2745
2746
2747void uf_send_qos_null(unifi_priv_t * priv, u16 interfaceTag, const u8 *da, CSR_PRIORITY priority, CsrWifiRouterCtrlStaInfo_t * srcStaInfo)
2748{
2749 bulk_data_param_t bulkdata;
2750 CsrResult csrResult;
2751 struct sk_buff *skb, *newSkb = NULL;
2752 CsrWifiMacAddress peerAddress;
2753 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
2754 CSR_TRANSMISSION_CONTROL transmissionControl = (TRANSMISSION_CONTROL_EOSP_MASK | TRANSMISSION_CONTROL_TRIGGER_MASK);
2755 int r;
2756 CSR_SIGNAL signal;
2757 u32 priority_q;
2758 CSR_RATE transmitRate = 0;
2759
2760
2761 /* Send a Null Frame to Peer,
2762 * 32= size of mac header */
2763 csrResult = unifi_net_data_malloc(priv, &bulkdata.d[0], MAC_HEADER_SIZE + QOS_CONTROL_HEADER_SIZE);
2764
2765 if (csrResult != CSR_RESULT_SUCCESS) {
2766 unifi_error(priv, " failed to allocate request_data. in uf_send_qos_null func\n");
2767 return ;
2768 }
2769 skb = (struct sk_buff *)(bulkdata.d[0].os_net_buf_ptr);
2770 skb->len = 0;
2771 bulkdata.d[0].os_data_ptr = skb->data;
2772 bulkdata.d[0].os_net_buf_ptr = (unsigned char*)skb;
2773 bulkdata.d[0].net_buf_length = bulkdata.d[0].data_length = skb->len;
2774 bulkdata.d[1].os_data_ptr = NULL;
2775 bulkdata.d[1].os_net_buf_ptr = NULL;
2776 bulkdata.d[1].net_buf_length = bulkdata.d[1].data_length = 0;
2777
2778 /* For null frames protection bit should not be set in MAC header, so passing value 0 below for protection field */
2779
2780 if (prepare_and_add_macheader(priv, skb, newSkb, priority, &bulkdata, interfaceTag, da, interfacePriv->bssid.a, 0)) {
2781 unifi_error(priv, "failed to create MAC header\n");
2782 unifi_net_data_free(priv, &bulkdata.d[0]);
2783 return;
2784 }
2785 memcpy(peerAddress.a, ((u8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN);
2786 /* convert priority to queue */
2787 priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY) priority);
2788
2789 /* Frame ma-packet.req, this is saved/transmitted depend on queue state
2790 * send the null frame at data rate of 1 Mb/s for AP or 6 Mb/s for P2PGO
2791 */
2792 switch (interfacePriv->interfaceMode)
2793 {
2794 case CSR_WIFI_ROUTER_CTRL_MODE_AP:
2795 transmitRate = 2;
2796 break;
2797 case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO:
2798 transmitRate = 12;
2799 break;
2800 default:
2801 transmitRate = 0;
2802 }
2803 unifi_frame_ma_packet_req(priv, priority, transmitRate, 0xffffffff, interfaceTag,
2804 transmissionControl, priv->netdev_client->sender_id,
2805 peerAddress.a, &signal);
2806
2807 r = ul_send_signal_unpacked(priv, &signal, &bulkdata);
2808 if(r) {
2809 unifi_error(priv, "failed to send QOS data null packet result: %d\n", r);
2810 unifi_net_data_free(priv, &bulkdata.d[0]);
2811 }
2812
2813 return;
2814
2815}
2816void uf_send_nulldata(unifi_priv_t * priv, u16 interfaceTag, const u8 *da, CSR_PRIORITY priority, CsrWifiRouterCtrlStaInfo_t * srcStaInfo)
2817{
2818 bulk_data_param_t bulkdata;
2819 CsrResult csrResult;
2820 struct sk_buff *skb, *newSkb = NULL;
2821 CsrWifiMacAddress peerAddress;
2822 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
2823 CSR_TRANSMISSION_CONTROL transmissionControl = 0;
2824 int r;
2825 CSR_SIGNAL signal;
2826 u32 priority_q;
2827 CSR_RATE transmitRate = 0;
2828 CSR_MA_PACKET_REQUEST *req = &signal.u.MaPacketRequest;
2829 unsigned long lock_flags;
2830
2831 /* Send a Null Frame to Peer, size = 24 for MAC header */
2832 csrResult = unifi_net_data_malloc(priv, &bulkdata.d[0], MAC_HEADER_SIZE);
2833
2834 if (csrResult != CSR_RESULT_SUCCESS) {
2835 unifi_error(priv, "uf_send_nulldata: Failed to allocate memory for NULL frame\n");
2836 return ;
2837 }
2838 skb = (struct sk_buff *)(bulkdata.d[0].os_net_buf_ptr);
2839 skb->len = 0;
2840 bulkdata.d[0].os_data_ptr = skb->data;
2841 bulkdata.d[0].os_net_buf_ptr = (unsigned char*)skb;
2842 bulkdata.d[0].net_buf_length = bulkdata.d[0].data_length = skb->len;
2843 bulkdata.d[1].os_data_ptr = NULL;
2844 bulkdata.d[1].os_net_buf_ptr = NULL;
2845 bulkdata.d[1].net_buf_length = bulkdata.d[1].data_length = 0;
2846
2847 /* For null frames protection bit should not be set in MAC header, so passing value 0 below for protection field */
2848 if (prepare_and_add_macheader(priv, skb, newSkb, priority, &bulkdata, interfaceTag, da, interfacePriv->bssid.a, 0)) {
2849 unifi_error(priv, "uf_send_nulldata: Failed to create MAC header\n");
2850 unifi_net_data_free(priv, &bulkdata.d[0]);
2851 return;
2852 }
2853 memcpy(peerAddress.a, ((u8 *) bulkdata.d[0].os_data_ptr) + 4, ETH_ALEN);
2854 /* convert priority to queue */
2855 priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY) priority);
2856 transmissionControl &= ~(CSR_NO_CONFIRM_REQUIRED);
2857
2858 /* Frame ma-packet.req, this is saved/transmitted depend on queue state
2859 * send the null frame at data rate of 1 Mb/s for AP or 6 Mb/s for P2PGO
2860 */
2861 switch (interfacePriv->interfaceMode)
2862 {
2863 case CSR_WIFI_ROUTER_CTRL_MODE_AP:
2864 transmitRate = 2;
2865 break;
2866 case CSR_WIFI_ROUTER_CTRL_MODE_P2PGO:
2867 transmitRate = 12;
2868 break;
2869 default:
2870 transmitRate = 0;
2871 }
2872 unifi_frame_ma_packet_req(priv, priority, transmitRate, INVALID_HOST_TAG, interfaceTag,
2873 transmissionControl, priv->netdev_client->sender_id,
2874 peerAddress.a, &signal);
2875
2876 /* Save host tag to check the status on reception of MA packet confirm */
2877 srcStaInfo->nullDataHostTag = req->HostTag;
2878 unifi_trace(priv, UDBG1, "uf_send_nulldata: STA AID = %d hostTag = %x\n", srcStaInfo->aid, req->HostTag);
2879
2880 r = ul_send_signal_unpacked(priv, &signal, &bulkdata);
2881
2882 if(r == -ENOSPC) {
2883 unifi_trace(priv, UDBG1, "uf_send_nulldata: ENOSPC Requeue the Null frame\n");
2884 enque_tx_data_pdu(priv, &bulkdata, &srcStaInfo->dataPdu[priority_q], &signal, 1);
2885 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
2886 srcStaInfo->noOfPktQueued++;
2887 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
2888
2889
2890 }
2891 if(r && r != -ENOSPC){
2892 unifi_error(priv, "uf_send_nulldata: Failed to send Null frame Error = %d\n", r);
2893 unifi_net_data_free(priv, &bulkdata.d[0]);
2894 srcStaInfo->nullDataHostTag = INVALID_HOST_TAG;
2895 }
2896
2897 return;
2898}
2899
2900u8 uf_check_broadcast_bssid(unifi_priv_t *priv, const bulk_data_param_t *bulkdata)
2901{
2902 u8 *bssid = NULL;
2903 static const CsrWifiMacAddress broadcast_address = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}};
2904 u8 toDs, fromDs;
2905
2906 toDs = (((bulkdata->d[0].os_data_ptr)[1]) & 0x01) ? 1 : 0;
2907 fromDs =(((bulkdata->d[0].os_data_ptr)[1]) & 0x02) ? 1 : 0;
2908
2909 if (toDs && fromDs)
2910 {
2911 unifi_trace(priv, UDBG6, "Address 4 present, Don't try to find BSSID\n");
2912 bssid = NULL;
2913 }
2914 else if((toDs == 0) && (fromDs ==0))
2915 {
2916 /* BSSID is Address 3 */
2917 bssid = (u8 *) (bulkdata->d[0].os_data_ptr + 4 + (2 * ETH_ALEN));
2918 }
2919 else if(toDs)
2920 {
2921 /* BSSID is Address 1 */
2922 bssid = (u8 *) (bulkdata->d[0].os_data_ptr + 4);
2923 }
2924 else if(fromDs)
2925 {
2926 /* BSSID is Address 2 */
2927 bssid = (u8 *) (bulkdata->d[0].os_data_ptr + 4 + ETH_ALEN);
2928 }
2929
2930 if (memcmp(broadcast_address.a, bssid, ETH_ALEN)== 0)
2931 {
2932 return TRUE;
2933 }
2934 else
2935 {
2936 return FALSE;
2937 }
2938}
2939
2940
2941u8 uf_process_pm_bit_for_peer(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t * srcStaInfo,
2942 u8 pmBit, u16 interfaceTag)
2943{
2944 u8 moreData = FALSE;
2945 u8 powerSaveChanged = FALSE;
2946 unsigned long lock_flags;
2947
2948 unifi_trace(priv, UDBG3, "entering uf_process_pm_bit_for_peer\n");
2949 if (pmBit) {
2950 priv->allPeerDozing |= (0x01 << (srcStaInfo->assignedHandle));
2951 } else {
2952 priv->allPeerDozing &= ~(0x01 << (srcStaInfo->assignedHandle));
2953 }
2954 if(pmBit) {
2955 if(srcStaInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE) {
2956
2957 /* disable the preemption */
2958 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
2959 srcStaInfo->currentPeerState =CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE;
2960 powerSaveChanged = TRUE;
2961 /* enable the preemption */
2962 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
2963 } else {
2964 return powerSaveChanged;
2965 }
2966 } else {
2967 if(srcStaInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE) {
2968 /* disable the preemption */
2969 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
2970 srcStaInfo->currentPeerState = CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE;
2971 powerSaveChanged = TRUE;
2972 /* enable the preemption */
2973 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
2974 }else {
2975 return powerSaveChanged;
2976 }
2977 }
2978
2979
2980 if(srcStaInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE) {
2981 unifi_trace(priv, UDBG3, "Peer with AID = %d is active now\n", srcStaInfo->aid);
2982 process_peer_active_transition(priv, srcStaInfo, interfaceTag);
2983 } else {
2984 unifi_trace(priv, UDBG3, "Peer with AID = %d is in PS Now\n", srcStaInfo->aid);
2985 /* Set TIM if needed */
2986 if(!srcStaInfo->wmmOrQosEnabled) {
2987 moreData = (!list_empty(&srcStaInfo->mgtFrames) ||
2988 !list_empty(&srcStaInfo->dataPdu[UNIFI_TRAFFIC_Q_VO])||
2989 !list_empty(&srcStaInfo->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]));
2990 if(moreData && (srcStaInfo->timSet == CSR_WIFI_TIM_RESET)) {
2991 unifi_trace(priv, UDBG3, "This condition should not occur\n");
2992 if (!srcStaInfo->timRequestPendingFlag){
2993 update_tim(priv, srcStaInfo->aid, 1, interfaceTag, srcStaInfo->assignedHandle);
2994 }
2995 else
2996 {
2997 /* Cache the TimSet value so that it will processed immidiatly after
2998 * completing the current setTim Request
2999 */
3000 srcStaInfo->updateTimReqQueued = 1;
3001 unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", srcStaInfo->updateTimReqQueued,
3002 srcStaInfo->aid);
3003 }
3004
3005 }
3006 } else {
3007 u8 allDeliveryEnabled = 0, dataAvailable = 0;
3008 unifi_trace(priv, UDBG5, "Qos in AP Mode\n");
3009 /* Check if all AC's are Delivery Enabled */
3010 is_all_ac_deliver_enabled_and_moredata(srcStaInfo, &allDeliveryEnabled, &dataAvailable);
3011 /*check for more data in non-delivery enabled queues*/
3012 moreData = (uf_is_more_data_for_non_delivery_ac(srcStaInfo) || (allDeliveryEnabled && dataAvailable));
3013
3014 if(moreData && (srcStaInfo->timSet == CSR_WIFI_TIM_RESET)) {
3015 if (!srcStaInfo->timRequestPendingFlag){
3016 update_tim(priv, srcStaInfo->aid, 1, interfaceTag, srcStaInfo->assignedHandle);
3017 }
3018 else
3019 {
3020 /* Cache the TimSet value so that it will processed immidiatly after
3021 * completing the current setTim Request
3022 */
3023 srcStaInfo->updateTimReqQueued = 1;
3024 unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", srcStaInfo->updateTimReqQueued,
3025 srcStaInfo->aid);
3026 }
3027 }
3028 }
3029 }
3030 unifi_trace(priv, UDBG3, "leaving uf_process_pm_bit_for_peer\n");
3031 return powerSaveChanged;
3032}
3033
3034
3035
3036void uf_process_ps_poll(unifi_priv_t *priv, u8* sa, u8* da, u8 pmBit, u16 interfaceTag)
3037{
3038 CsrWifiRouterCtrlStaInfo_t *staRecord =
3039 CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, sa, interfaceTag);
3040 tx_buffered_packets_t * buffered_pkt = NULL;
3041 CsrWifiMacAddress peerMacAddress;
3042 unsigned long lock_flags;
3043 s8 r =0;
3044 u8 moreData = FALSE;
3045 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
3046
3047 unifi_trace(priv, UDBG3, "entering uf_process_ps_poll\n");
3048 if(!staRecord) {
3049 memcpy(peerMacAddress.a, sa, ETH_ALEN);
3050 unifi_trace(priv, UDBG3, "In uf_process_ps_poll, sta record not found:unexpected frame addr = %x:%x:%x:%x:%x:%x\n",
3051 sa[0], sa[1], sa[2], sa[3], sa[4], sa[5]);
3052 CsrWifiRouterCtrlUnexpectedFrameIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, peerMacAddress);
3053 return;
3054 }
3055
3056 uf_process_pm_bit_for_peer(priv, staRecord, pmBit, interfaceTag);
3057
3058 /* Update station last activity time */
3059 staRecord->activity_flag = TRUE;
3060
3061 /* This should not change the PM bit as PS-POLL has PM bit always set */
3062 if(!pmBit) {
3063 unifi_notice (priv, " PM bit reset in PS-POLL\n");
3064 return;
3065 }
3066
3067 if(IS_DTIM_ACTIVE(interfacePriv->dtimActive, interfacePriv->multicastPduHostTag)) {
3068 /* giving more priority to multicast packets so dropping ps-poll*/
3069 unifi_notice (priv, " multicast transmission is going on so don't take action on PS-POLL\n");
3070 return;
3071 }
3072
3073 if(!staRecord->wmmOrQosEnabled) {
3074 if((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->mgtFrames))) {
3075 buffered_pkt->transmissionControl |= TRANSMISSION_CONTROL_TRIGGER_MASK;
3076 moreData = (!list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]) ||
3077 !list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]) ||
3078 !list_empty(&staRecord->mgtFrames));
3079
3080 buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK);
3081 if((r=frame_and_send_queued_pdu(priv, buffered_pkt, staRecord, moreData, FALSE)) == -ENOSPC) {
3082 /* Clear the trigger bit transmission control*/
3083 buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK);
3084 /* Enqueue at the head of the queue */
3085 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
3086 list_add(&buffered_pkt->q, &staRecord->mgtFrames);
3087 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
3088 unifi_trace(priv, UDBG1, "(ENOSPC) PS-POLL received : PDU sending failed \n");
3089 priv->pausedStaHandle[3]=(u8)(staRecord->assignedHandle);
3090 } else {
3091 if(r){
3092 unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n");
3093 /* the PDU failed where we can't do any thing so free the storage */
3094 unifi_net_data_free(priv, &buffered_pkt->bulkdata);
3095 }
3096 kfree(buffered_pkt);
3097 }
3098 } else if((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]))) {
3099 buffered_pkt->transmissionControl |= TRANSMISSION_CONTROL_TRIGGER_MASK;
3100 moreData = (!list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]) ||
3101 !list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]));
3102
3103 buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK);
3104 if((r=frame_and_send_queued_pdu(priv, buffered_pkt, staRecord, moreData, FALSE)) == -ENOSPC) {
3105 /* Clear the trigger bit transmission control*/
3106 buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK);
3107 /* Enqueue at the head of the queue */
3108 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
3109 list_add(&buffered_pkt->q, &staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]);
3110 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
3111 priv->pausedStaHandle[3]=(u8)(staRecord->assignedHandle);
3112 unifi_trace(priv, UDBG1, "(ENOSPC) PS-POLL received : PDU sending failed \n");
3113 } else {
3114 if(r){
3115 unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n");
3116 /* the PDU failed where we can't do any thing so free the storage */
3117 unifi_net_data_free(priv, &buffered_pkt->bulkdata);
3118 }
3119 kfree(buffered_pkt);
3120 }
3121 } else if((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]))) {
3122 buffered_pkt->transmissionControl |= TRANSMISSION_CONTROL_TRIGGER_MASK;
3123 moreData = !list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]);
3124
3125 buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK);
3126 if((r=frame_and_send_queued_pdu(priv, buffered_pkt, staRecord, moreData, FALSE)) == -ENOSPC) {
3127 /* Clear the trigger bit transmission control*/
3128 buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK);
3129 /* Enqueue at the head of the queue */
3130 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
3131 list_add(&buffered_pkt->q, &staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]);
3132 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
3133 priv->pausedStaHandle[0]=(u8)(staRecord->assignedHandle);
3134 unifi_trace(priv, UDBG1, "(ENOSPC) PS-POLL received : PDU sending failed \n");
3135 } else {
3136 if(r){
3137 unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n");
3138 /* the PDU failed where we can't do any thing so free the storage */
3139 unifi_net_data_free(priv, &buffered_pkt->bulkdata);
3140 }
3141 kfree(buffered_pkt);
3142 }
3143 } else {
3144 /* Actually since we have sent an ACK, there
3145 * there is no need to send a NULL frame*/
3146 }
3147 moreData = (!list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_VO]) ||
3148 !list_empty(&staRecord->dataPdu[UNIFI_TRAFFIC_Q_CONTENTION]) ||
3149 !list_empty(&staRecord->mgtFrames));
3150 if(!moreData && (staRecord->timSet == CSR_WIFI_TIM_SET)) {
3151 unifi_trace(priv, UDBG3, "more data = NULL, set tim to 0 in uf_process_ps_poll\n");
3152 if (!staRecord->timRequestPendingFlag){
3153 update_tim(priv, staRecord->aid, 0, interfaceTag, staRecord->assignedHandle);
3154 }
3155 else
3156 {
3157 /* Cache the TimSet value so that it will processed immidiatly after
3158 * completing the current setTim Request
3159 */
3160 staRecord->updateTimReqQueued = 0;
3161 unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", staRecord->updateTimReqQueued,
3162 staRecord->aid);
3163 }
3164 }
3165 } else {
3166
3167 u8 allDeliveryEnabled = 0, dataAvailable = 0;
3168 unifi_trace(priv, UDBG3, "Qos Support station.Processing PS-Poll\n");
3169
3170 /*Send Data From Management Frames*/
3171 /* Priority orders for delivering the buffered packets are
3172 * 1. Deliver the Management frames if there
3173 * 2. Other access category frames which are non deliver enable including UNIFI_TRAFFIC_Q_VO
3174 * priority is from VO->BK
3175 */
3176
3177 /* Check if all AC's are Delivery Enabled */
3178 is_all_ac_deliver_enabled_and_moredata(staRecord, &allDeliveryEnabled, &dataAvailable);
3179
3180 if (allDeliveryEnabled) {
3181 unifi_trace(priv, UDBG3, "uf_process_ps_poll: All ACs are delivery enable so Sending QOS Null in response of Ps-poll\n");
3182 uf_send_qos_null(priv, interfaceTag, sa, CSR_QOS_UP0, staRecord);
3183 return;
3184 }
3185
3186 if (!list_empty(&staRecord->mgtFrames)) {
3187 if ((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->mgtFrames))) {
3188 /* We dont have packets in non delivery enabled UNIFI_TRAFFIC_Q_VO, So we are looking in management
3189 * queue of the station record
3190 */
3191 moreData = uf_is_more_data_for_non_delivery_ac(staRecord);
3192 buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK);
3193
3194 /* Last parameter is EOSP & its false always for PS-POLL processing */
3195 if((r=frame_and_send_queued_pdu(priv, buffered_pkt, staRecord, moreData, FALSE)) == -ENOSPC) {
3196 /* Clear the trigger bit transmission control*/
3197 buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK);
3198 /* Enqueue at the head of the queue */
3199 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
3200 list_add(&buffered_pkt->q, &staRecord->mgtFrames);
3201 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
3202 priv->pausedStaHandle[0]=(u8)(staRecord->assignedHandle);
3203 unifi_trace(priv, UDBG1, "(ENOSPC) PS-POLL received : PDU sending failed \n");
3204 } else {
3205 if(r){
3206 unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n");
3207 /* the PDU failed where we can't do any thing so free the storage */
3208 unifi_net_data_free(priv, &buffered_pkt->bulkdata);
3209 }
3210 kfree(buffered_pkt);
3211 }
3212 } else {
3213 unifi_error(priv, "uf_process_ps_poll: Mgt frame list empty!! \n");
3214 }
3215
3216 } else {
3217 s8 i;
3218 /* We dont have buffered packet in mangement frame queue (1 failed), So proceed with condition 2
3219 * UNIFI_TRAFFIC_Q_VO -> VI -> BE -> BK
3220 */
3221 for(i= 3; i>=0; i--) {
3222 if (!IS_DELIVERY_ENABLED(staRecord->powersaveMode[i])) {
3223 /* Send One packet, if queue is NULL then continue */
3224 if((buffered_pkt=dequeue_tx_data_pdu(priv, &staRecord->dataPdu[i]))) {
3225 moreData = uf_is_more_data_for_non_delivery_ac(staRecord);
3226
3227 buffered_pkt->transmissionControl |= (TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK);
3228
3229 /* Last parameter is EOSP & its false always for PS-POLL processing */
3230 if((r=frame_and_send_queued_pdu(priv, buffered_pkt, staRecord, moreData, FALSE)) == -ENOSPC) {
3231 /* Clear the trigger bit transmission control*/
3232 buffered_pkt->transmissionControl &= ~(TRANSMISSION_CONTROL_TRIGGER_MASK | TRANSMISSION_CONTROL_EOSP_MASK);
3233 /* Enqueue at the head of the queue */
3234 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
3235 list_add(&buffered_pkt->q, &staRecord->dataPdu[i]);
3236 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
3237 priv->pausedStaHandle[0]=(u8)(staRecord->assignedHandle);
3238 unifi_trace(priv, UDBG1, "(ENOSPC) PS-POLL received : PDU sending failed \n");
3239 } else {
3240 if(r) {
3241 unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n");
3242 /* the PDU failed where we can't do any thing so free the storage */
3243 unifi_net_data_free(priv, &buffered_pkt->bulkdata);
3244 }
3245 kfree(buffered_pkt);
3246 }
3247 break;
3248 }
3249 }
3250 }
3251 }
3252 /* Check if all AC's are Delivery Enabled */
3253 is_all_ac_deliver_enabled_and_moredata(staRecord, &allDeliveryEnabled, &dataAvailable);
3254 /*check for more data in non-delivery enabled queues*/
3255 moreData = (uf_is_more_data_for_non_delivery_ac(staRecord) || (allDeliveryEnabled && dataAvailable));
3256 if(!moreData && (staRecord->timSet == CSR_WIFI_TIM_SET)) {
3257 unifi_trace(priv, UDBG3, "more data = NULL, set tim to 0 in uf_process_ps_poll\n");
3258 if (!staRecord->timRequestPendingFlag){
3259 update_tim(priv, staRecord->aid, 0, interfaceTag, staRecord->assignedHandle);
3260 }
3261 else
3262 {
3263 /* Cache the TimSet value so that it will processed immidiatly after
3264 * completing the current setTim Request
3265 */
3266 staRecord->updateTimReqQueued = 0;
3267 unifi_trace(priv, UDBG6, "update_tim : One more UpdateTim Request (Tim value:%d) Queued for AID %x\n", staRecord->updateTimReqQueued,
3268 staRecord->aid);
3269 }
3270
3271 }
3272 }
3273
3274 unifi_trace(priv, UDBG3, "leaving uf_process_ps_poll\n");
3275}
3276
3277
3278
3279void add_to_send_cfm_list(unifi_priv_t * priv,
3280 tx_buffered_packets_t *tx_q_item,
3281 struct list_head *frames_need_cfm_list)
3282{
3283 tx_buffered_packets_t *send_cfm_list_item = NULL;
3284
3285 send_cfm_list_item = kmalloc(sizeof(tx_buffered_packets_t), GFP_ATOMIC);
3286
3287 if(send_cfm_list_item == NULL){
3288 unifi_warning(priv, "%s: Failed to allocate memory for new list item \n");
3289 return;
3290 }
3291
3292 INIT_LIST_HEAD(&send_cfm_list_item->q);
3293
3294 send_cfm_list_item->hostTag = tx_q_item->hostTag;
3295 send_cfm_list_item->interfaceTag = tx_q_item->interfaceTag;
3296 send_cfm_list_item->transmissionControl = tx_q_item->transmissionControl;
3297 send_cfm_list_item->leSenderProcessId = tx_q_item->leSenderProcessId;
3298 send_cfm_list_item->rate = tx_q_item->rate;
3299 memcpy(send_cfm_list_item->peerMacAddress.a, tx_q_item->peerMacAddress.a, ETH_ALEN);
3300 send_cfm_list_item->priority = tx_q_item->priority;
3301
3302 list_add_tail(&send_cfm_list_item->q, frames_need_cfm_list);
3303}
3304
3305void uf_prepare_send_cfm_list_for_queued_pkts(unifi_priv_t * priv,
3306 struct list_head *frames_need_cfm_list,
3307 struct list_head * list)
3308{
3309 tx_buffered_packets_t *tx_q_item = NULL;
3310 struct list_head *listHead;
3311 struct list_head *placeHolder;
3312 unsigned long lock_flags;
3313
3314 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
3315
3316 /* Search through the list and if confirmation required for any frames,
3317 add it to the send_cfm list */
3318 list_for_each_safe(listHead, placeHolder, list) {
3319 tx_q_item = list_entry(listHead, tx_buffered_packets_t, q);
3320
3321 if(!tx_q_item) {
3322 unifi_error(priv, "Entry should exist, otherwise it is a (BUG)\n");
3323 continue;
3324 }
3325
3326 /* check if confirmation is requested and if the sender ID
3327 is not netdevice client then save the entry in the list for need cfms */
3328 if (!(tx_q_item->transmissionControl & CSR_NO_CONFIRM_REQUIRED) &&
3329 (tx_q_item->leSenderProcessId != priv->netdev_client->sender_id)){
3330 unifi_trace(priv, UDBG1, "%s: SenderProcessID=%x host tag=%x transmission control=%x\n",
3331 __FUNCTION__,
3332 tx_q_item->leSenderProcessId,
3333 tx_q_item->hostTag,
3334 tx_q_item->transmissionControl);
3335
3336 add_to_send_cfm_list(priv, tx_q_item, frames_need_cfm_list);
3337 }
3338 }
3339
3340 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
3341
3342}
3343
3344
3345
3346void uf_flush_list(unifi_priv_t * priv, struct list_head * list)
3347{
3348 tx_buffered_packets_t *tx_q_item;
3349 struct list_head *listHead;
3350 struct list_head *placeHolder;
3351 unsigned long lock_flags;
3352
3353 unifi_trace(priv, UDBG5, "entering the uf_flush_list \n");
3354
3355 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
3356 /* go through list, delete & free memory */
3357 list_for_each_safe(listHead, placeHolder, list) {
3358 tx_q_item = list_entry(listHead, tx_buffered_packets_t, q);
3359
3360 if(!tx_q_item) {
3361 unifi_error(priv, "entry should exists, otherwise crashes (bug)\n");
3362 }
3363 unifi_trace(priv, UDBG5,
3364 "proccess_tx: in uf_flush_list peerMacAddress=%02X%02X%02X%02X%02X%02X senderProcessId=%x\n",
3365 tx_q_item->peerMacAddress.a[0], tx_q_item->peerMacAddress.a[1],
3366 tx_q_item->peerMacAddress.a[2], tx_q_item->peerMacAddress.a[3],
3367 tx_q_item->peerMacAddress.a[4], tx_q_item->peerMacAddress.a[5],
3368 tx_q_item->leSenderProcessId);
3369
3370 list_del(listHead);
3371 /* free the allocated memory */
3372 unifi_net_data_free(priv, &tx_q_item->bulkdata);
3373 kfree(tx_q_item);
3374 tx_q_item = NULL;
3375 if (!priv->noOfPktQueuedInDriver) {
3376 unifi_error(priv, "packets queued in driver 0 still decrementing in %s\n", __FUNCTION__);
3377 } else {
3378 priv->noOfPktQueuedInDriver--;
3379 }
3380 }
3381 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
3382}
3383
3384tx_buffered_packets_t *dequeue_tx_data_pdu(unifi_priv_t *priv, struct list_head *txList)
3385{
3386 /* dequeue the tx data packets from the appropriate queue */
3387 tx_buffered_packets_t *tx_q_item = NULL;
3388 struct list_head *listHead;
3389 struct list_head *placeHolder;
3390 unsigned long lock_flags;
3391
3392 unifi_trace(priv, UDBG5, "entering dequeue_tx_data_pdu\n");
3393 /* check for list empty */
3394 if (list_empty(txList)) {
3395 unifi_trace(priv, UDBG5, "In dequeue_tx_data_pdu, the list is empty\n");
3396 return NULL;
3397 }
3398
3399 /* Verification, if packet count is negetive */
3400 if (priv->noOfPktQueuedInDriver == 0xFFFF) {
3401 unifi_warning(priv, "no packet available in queue: debug");
3402 return NULL;
3403 }
3404
3405 /* return first node after header, & delete from the list && atleast one item exist */
3406 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
3407 list_for_each_safe(listHead, placeHolder, txList) {
3408 tx_q_item = list_entry(listHead, tx_buffered_packets_t, q);
3409 list_del(listHead);
3410 break;
3411 }
3412 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
3413
3414 if (tx_q_item) {
3415 unifi_trace(priv, UDBG5,
3416 "proccess_tx: In dequeue_tx_data_pdu peerMacAddress=%02X%02X%02X%02X%02X%02X senderProcessId=%x\n",
3417 tx_q_item->peerMacAddress.a[0], tx_q_item->peerMacAddress.a[1],
3418 tx_q_item->peerMacAddress.a[2], tx_q_item->peerMacAddress.a[3],
3419 tx_q_item->peerMacAddress.a[4], tx_q_item->peerMacAddress.a[5],
3420 tx_q_item->leSenderProcessId);
3421 }
3422
3423 unifi_trace(priv, UDBG5, "leaving dequeue_tx_data_pdu\n");
3424 return tx_q_item;
3425}
3426/* generic function to get the station record handler */
3427CsrWifiRouterCtrlStaInfo_t *CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(unifi_priv_t *priv,
3428 const u8 *peerMacAddress,
3429 u16 interfaceTag)
3430{
3431 u8 i;
3432 netInterface_priv_t *interfacePriv;
3433 unsigned long lock_flags;
3434
3435 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
3436 unifi_error(priv, "interfaceTag is not proper, interfaceTag = %d\n", interfaceTag);
3437 return NULL;
3438 }
3439
3440 interfacePriv = priv->interfacePriv[interfaceTag];
3441
3442 /* disable the preemption until station record is fetched */
3443 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
3444
3445 for (i = 0; i < UNIFI_MAX_CONNECTIONS; i++) {
3446 if (interfacePriv->staInfo[i]!= NULL) {
3447 if (!memcmp(((CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[i]))->peerMacAddress.a, peerMacAddress, ETH_ALEN)) {
3448 /* enable the preemption as station record is fetched */
3449 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
3450 unifi_trace(priv, UDBG5, "peer entry found in station record\n");
3451 return ((CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[i]));
3452 }
3453 }
3454 }
3455 /* enable the preemption as station record is fetched */
3456 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
3457 unifi_trace(priv, UDBG5, "peer entry not found in station record\n");
3458 return NULL;
3459}
3460/* generic function to get the station record handler from the handle */
3461CsrWifiRouterCtrlStaInfo_t * CsrWifiRouterCtrlGetStationRecordFromHandle(unifi_priv_t *priv,
3462 u32 handle,
3463 u16 interfaceTag)
3464{
3465 netInterface_priv_t *interfacePriv;
3466
3467 if ((handle >= UNIFI_MAX_CONNECTIONS) || (interfaceTag >= CSR_WIFI_NUM_INTERFACES)) {
3468 unifi_error(priv, "handle/interfaceTag is not proper, handle = %d, interfaceTag = %d\n", handle, interfaceTag);
3469 return NULL;
3470 }
3471 interfacePriv = priv->interfacePriv[interfaceTag];
3472 return ((CsrWifiRouterCtrlStaInfo_t *) (interfacePriv->staInfo[handle]));
3473}
3474
3475/* Function to do inactivity */
3476void uf_check_inactivity(unifi_priv_t *priv, u16 interfaceTag, u32 currentTime)
3477{
3478 u32 i;
3479 CsrWifiRouterCtrlStaInfo_t *staInfo;
3480 u32 elapsedTime; /* Time in microseconds */
3481 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
3482 CsrWifiMacAddress peerMacAddress;
3483 unsigned long lock_flags;
3484
3485 if (interfacePriv == NULL) {
3486 unifi_trace(priv, UDBG3, "uf_check_inactivity: Interface priv is NULL \n");
3487 return;
3488 }
3489
3490 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
3491 /* Go through the list of stations to check for inactivity */
3492 for(i = 0; i < UNIFI_MAX_CONNECTIONS; i++) {
3493 staInfo = CsrWifiRouterCtrlGetStationRecordFromHandle(priv, i, interfaceTag);
3494 if(!staInfo ) {
3495 continue;
3496 }
3497
3498 unifi_trace(priv, UDBG3, "Running Inactivity handler Time %xus station's last activity %xus\n",
3499 currentTime, staInfo->lastActivity);
3500
3501
3502 elapsedTime = (currentTime >= staInfo->lastActivity)?
3503 (currentTime - staInfo->lastActivity):
3504 (~((u32)0) - staInfo->lastActivity + currentTime);
3505 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
3506
3507 if (elapsedTime > MAX_INACTIVITY_INTERVAL) {
3508 memcpy((u8*)&peerMacAddress, (u8*)&staInfo->peerMacAddress, sizeof(CsrWifiMacAddress));
3509
3510 /* Indicate inactivity for the station */
3511 unifi_trace(priv, UDBG3, "Station %x:%x:%x:%x:%x:%x inactive since %xus\n sending Inactive Ind\n",
3512 peerMacAddress.a[0], peerMacAddress.a[1],
3513 peerMacAddress.a[2], peerMacAddress.a[3],
3514 peerMacAddress.a[4], peerMacAddress.a[5],
3515 elapsedTime);
3516
3517 CsrWifiRouterCtrlStaInactiveIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, peerMacAddress);
3518 }
3519 }
3520
3521 interfacePriv->last_inactivity_check = currentTime;
3522}
3523
3524/* Function to update activity of a station */
3525void uf_update_sta_activity(unifi_priv_t *priv, u16 interfaceTag, const u8 *peerMacAddress)
3526{
3527 u32 elapsedTime, currentTime; /* Time in microseconds */
3528 u32 timeHi; /* Not used - Time in microseconds */
3529 CsrWifiRouterCtrlStaInfo_t *staInfo;
3530 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
3531 unsigned long lock_flags;
3532
3533 if (interfacePriv == NULL) {
3534 unifi_trace(priv, UDBG3, "uf_check_inactivity: Interface priv is NULL \n");
3535 return;
3536 }
3537
3538 currentTime = CsrTimeGet(&timeHi);
3539
3540
3541 staInfo = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, peerMacAddress, interfaceTag);
3542
3543 if (staInfo == NULL) {
3544 unifi_trace(priv, UDBG4, "Sta does not exist yet");
3545 return;
3546 }
3547
3548 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
3549 /* Update activity */
3550 staInfo->lastActivity = currentTime;
3551
3552 /* See if inactivity handler needs to be run
3553 * Here it is theoretically possible that the counter may have wrapped around. But
3554 * since we just want to know when to run the inactivity handler it does not really matter.
3555 * Especially since this is data path it makes sense in keeping it simple and avoiding
3556 * 64 bit handling */
3557 elapsedTime = (currentTime >= interfacePriv->last_inactivity_check)?
3558 (currentTime - interfacePriv->last_inactivity_check):
3559 (~((u32)0) - interfacePriv->last_inactivity_check + currentTime);
3560
3561 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
3562
3563 /* Check if it is time to run the inactivity handler */
3564 if (elapsedTime > INACTIVITY_CHECK_INTERVAL) {
3565 uf_check_inactivity(priv, interfaceTag, currentTime);
3566 }
3567}
3568void resume_unicast_buffered_frames(unifi_priv_t *priv, u16 interfaceTag)
3569{
3570
3571 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
3572 u8 i;
3573 int j;
3574 tx_buffered_packets_t * buffered_pkt = NULL;
3575 u8 hipslotFree[4] = {TRUE, TRUE, TRUE, TRUE};
3576 int r;
3577 unsigned long lock_flags;
3578
3579 while(!isRouterBufferEnabled(priv, 3) &&
3580 ((buffered_pkt=dequeue_tx_data_pdu(priv, &interfacePriv->genericMgtFrames))!=NULL)) {
3581 buffered_pkt->transmissionControl &=
3582 ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_EOSP_MASK);
3583 if((r=frame_and_send_queued_pdu(priv, buffered_pkt, NULL, 0, FALSE)) == -ENOSPC) {
3584 /* Enqueue at the head of the queue */
3585 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
3586 list_add(&buffered_pkt->q, &interfacePriv->genericMgtFrames);
3587 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
3588 hipslotFree[3]=FALSE;
3589 break;
3590 }else {
3591 if(r){
3592 unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n");
3593 /* the PDU failed where we can't do any thing so free the storage */
3594 unifi_net_data_free(priv, &buffered_pkt->bulkdata);
3595 }
3596 kfree(buffered_pkt);
3597 }
3598 }
3599 for(i = 0; i < UNIFI_MAX_CONNECTIONS; i++) {
3600 CsrWifiRouterCtrlStaInfo_t *staInfo = interfacePriv->staInfo[i];
3601 if(!hipslotFree[0] && !hipslotFree[1] && !hipslotFree[2] && !hipslotFree[3]) {
3602 unifi_trace(priv, UDBG3, "(ENOSPC) in resume_unicast_buffered_frames:: hip slots are full \n");
3603 break;
3604 }
3605 if (staInfo && (staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE)) {
3606 while((( TRUE == hipslotFree[3] ) && (buffered_pkt=dequeue_tx_data_pdu(priv, &staInfo->mgtFrames)))) {
3607 buffered_pkt->transmissionControl &=
3608 ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_EOSP_MASK);
3609 if((r=frame_and_send_queued_pdu(priv, buffered_pkt, staInfo, 0, FALSE)) == -ENOSPC) {
3610 unifi_trace(priv, UDBG3, "(ENOSPC) in resume_unicast_buffered_frames:: hip slots are full for voice queue\n");
3611 /* Enqueue at the head of the queue */
3612 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
3613 list_add(&buffered_pkt->q, &staInfo->mgtFrames);
3614 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
3615 priv->pausedStaHandle[3]=(u8)(staInfo->assignedHandle);
3616 hipslotFree[3] = FALSE;
3617 break;
3618 } else {
3619 if(r){
3620 unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n");
3621 /* the PDU failed where we can't do any thing so free the storage */
3622 unifi_net_data_free(priv, &buffered_pkt->bulkdata);
3623 }
3624 kfree(buffered_pkt);
3625 }
3626 }
3627
3628 for(j=3;j>=0;j--) {
3629 if(!hipslotFree[j])
3630 continue;
3631
3632 while((buffered_pkt=dequeue_tx_data_pdu(priv, &staInfo->dataPdu[j]))) {
3633 buffered_pkt->transmissionControl &=
3634 ~(TRANSMISSION_CONTROL_TRIGGER_MASK|TRANSMISSION_CONTROL_EOSP_MASK);
3635 if((r=frame_and_send_queued_pdu(priv, buffered_pkt, staInfo, 0, FALSE)) == -ENOSPC) {
3636 /* Enqueue at the head of the queue */
3637 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
3638 list_add(&buffered_pkt->q, &staInfo->dataPdu[j]);
3639 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
3640 priv->pausedStaHandle[j]=(u8)(staInfo->assignedHandle);
3641 hipslotFree[j]=FALSE;
3642 break;
3643 } else {
3644 if(r){
3645 unifi_trace (priv, UDBG1, " HIP validation failure : PDU sending failed \n");
3646 /* the PDU failed where we can't do any thing so free the storage */
3647 unifi_net_data_free(priv, &buffered_pkt->bulkdata);
3648 }
3649 kfree(buffered_pkt);
3650 }
3651 }
3652 }
3653 }
3654 }
3655}
3656void update_eosp_to_head_of_broadcast_list_head(unifi_priv_t *priv, u16 interfaceTag)
3657{
3658
3659 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
3660 unsigned long lock_flags;
3661 struct list_head *listHead;
3662 struct list_head *placeHolder;
3663 tx_buffered_packets_t *tx_q_item;
3664
3665 if (interfacePriv->noOfbroadcastPktQueued) {
3666
3667 /* Update the EOSP to the HEAD of b/c list
3668 * because we have received any mgmt packet so it should not hold for long time
3669 * peer may time out.
3670 */
3671 spin_lock_irqsave(&priv->tx_q_lock, lock_flags);
3672 list_for_each_safe(listHead, placeHolder, &interfacePriv->genericMulticastOrBroadCastFrames) {
3673 tx_q_item = list_entry(listHead, tx_buffered_packets_t, q);
3674 tx_q_item->transmissionControl |= TRANSMISSION_CONTROL_EOSP_MASK;
3675 tx_q_item->transmissionControl = (tx_q_item->transmissionControl & ~(CSR_NO_CONFIRM_REQUIRED));
3676 unifi_trace(priv, UDBG1, "updating eosp for list Head hostTag:= 0x%x ", tx_q_item->hostTag);
3677 break;
3678 }
3679 spin_unlock_irqrestore(&priv->tx_q_lock, lock_flags);
3680 }
3681}
3682
3683/*
3684 * ---------------------------------------------------------------------------
3685 * resume_suspended_uapsd
3686 *
3687 * This function takes care processing packets of Unscheduled Service Period,
3688 * which been suspended earlier due to DTIM/HIP ENOSPC scenarios
3689 *
3690 * Arguments:
3691 * priv Pointer to device private context struct
3692 * interfaceTag For which resume should happen
3693 * ---------------------------------------------------------------------------
3694 */
3695void resume_suspended_uapsd(unifi_priv_t* priv, u16 interfaceTag)
3696{
3697
3698 u8 startIndex;
3699 CsrWifiRouterCtrlStaInfo_t * staInfo = NULL;
3700 unsigned long lock_flags;
3701
3702 unifi_trace(priv, UDBG2, "++resume_suspended_uapsd: \n");
3703 for(startIndex= 0; startIndex < UNIFI_MAX_CONNECTIONS;startIndex++) {
3704 staInfo = CsrWifiRouterCtrlGetStationRecordFromHandle(priv, startIndex, interfaceTag);
3705
3706 if(!staInfo || !staInfo->wmmOrQosEnabled) {
3707 continue;
3708 } else if((staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_POWER_SAVE)
3709 &&staInfo->uapsdActive && staInfo->uspSuspend) {
3710 /* U-APSD Still active & previously suspended either ENOSPC of FH queues OR
3711 * due to DTIM activity
3712 */
3713 uf_handle_uspframes_delivery(priv, staInfo, interfaceTag);
3714 } else {
3715 unifi_trace(priv, UDBG2, "resume_suspended_uapsd: PS state=%x, uapsdActive?=%x, suspend?=%x\n",
3716 staInfo->currentPeerState, staInfo->uapsdActive, staInfo->uspSuspend);
3717 if (staInfo->currentPeerState == CSR_WIFI_ROUTER_CTRL_PEER_CONNECTED_ACTIVE)
3718 {
3719 spin_lock_irqsave(&priv->staRecord_lock, lock_flags);
3720 staInfo->uapsdActive = FALSE;
3721 staInfo->uspSuspend = FALSE;
3722 spin_unlock_irqrestore(&priv->staRecord_lock, lock_flags);
3723 }
3724 }
3725 }
3726 unifi_trace(priv, UDBG2, "--resume_suspended_uapsd:\n");
3727}
3728
3729#endif
diff --git a/drivers/staging/csr/unifi_priv.h b/drivers/staging/csr/unifi_priv.h
deleted file mode 100644
index 37302f3c2f6c..000000000000
--- a/drivers/staging/csr/unifi_priv.h
+++ /dev/null
@@ -1,1136 +0,0 @@
1/*
2 *****************************************************************************
3 *
4 * FILE : unifi_priv.h
5 *
6 * PURPOSE : Private header file for unifi driver.
7 *
8 * UDI = UniFi Debug Interface
9 *
10 * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd.
11 *
12 * Refer to LICENSE.txt included with this source code for details on
13 * the license terms.
14 *
15 *****************************************************************************
16 */
17#ifndef __LINUX_UNIFI_PRIV_H__
18#define __LINUX_UNIFI_PRIV_H__ 1
19
20#include <linux/module.h>
21#include <linux/string.h>
22#include <linux/errno.h>
23#include <linux/kernel.h>
24#include <linux/wait.h>
25#include <linux/sched.h>
26#include <linux/delay.h>
27#include <linux/netdevice.h>
28#include <linux/wireless.h>
29#include <linux/cdev.h>
30#include <linux/kthread.h>
31#include <linux/freezer.h>
32
33#ifdef CSR_WIFI_SUPPORT_MMC_DRIVER
34#include <linux/mmc/core.h>
35#include <linux/mmc/card.h>
36#include <linux/mmc/host.h>
37#include <linux/mmc/sdio_func.h>
38#include <linux/mmc/sdio_ids.h>
39#include <linux/mmc/sdio.h>
40#endif /* CSR_WIFI_SUPPORT_MMC_DRIVER */
41
42#include <linux/fs.h>
43
44#ifdef ANDROID_BUILD
45#include <linux/wakelock.h>
46#endif
47
48#include "csr_wifi_hip_unifi.h"
49#include "csr_wifi_hip_unifi_udi.h"
50#include "csr_wifi_router_lib.h"
51#include "unifiio.h"
52#ifndef CSR_WIFI_HIP_TA_DISABLE
53#include "csr_wifi_vif_utils.h"
54#endif
55
56/* Define the unifi_priv_t before include the unifi_native.h */
57struct unifi_priv;
58typedef struct unifi_priv unifi_priv_t;
59#ifdef CSR_SUPPORT_WEXT_AP
60struct CsrWifiSmeApConfig;
61typedef struct CsrWifiSmeApConfig CsrWifiSmeApConfig_t;
62#endif
63#ifdef CSR_SUPPORT_WEXT
64#include "unifi_wext.h"
65#endif
66
67#ifdef ANDROID_BUILD
68extern struct wake_lock unifi_sdio_wake_lock;
69#endif
70
71#include "unifi_clients.h"
72
73#ifdef CSR_NATIVE_LINUX
74#include "sme_native/unifi_native.h"
75#else
76#include "unifi_sme.h"
77#endif
78
79/* The device major number to use when registering the udi driver */
80#define UNIFI_NAME "unifi"
81/*
82 * MAX_UNIFI_DEVS defines the maximum number of UniFi devices that can be present.
83 * This number should be set to the number of SDIO slots supported by the SDIO
84 * host controller on the platform.
85 * Note: If MAX_UNIFI_DEVS value changes, fw_init[] needs to be corrected in drv.c
86 */
87#define MAX_UNIFI_DEVS 2
88
89/* 802.11 Mac header offsets */
90#define MAC_HEADER_SIZE 24
91#define QOS_CONTROL_HEADER_SIZE 2
92#define HT_CONTROL_HEADER_SIZE 4
93#define QOS_DATA 0x8
94#define QOS_DATA_NULL 0xc
95#define DATA_NULL 0x04
96#define FRAME_CONTROL_ORDER_BIT 0x8000
97#define FRAME_CONTROL_TYPE_FIELD_OFFSET 2
98#define FRAME_CONTROL_SUBTYPE_FIELD_OFFSET 4
99#define IEEE802_11_FRAMETYPE_DATA 0x02
100#define IEEE802_11_FRAMETYPE_CONTROL 0x01
101#define IEEE802_11_FRAMETYPE_MANAGEMENT 0x00
102#define IEEE802_11_FRAMETYPE_RESERVED 0x03
103
104/* octet offset from start of mac header for certain fields */
105#define IEEE802_11_ADDR3_OFFSET 16
106#define IEEE802_11_SEQUENCE_CONTROL_OFFSET 22
107#define IEEE802_11_MAX_DATA_LEN 2304
108
109/* frame control (FC) masks, for frame control as 16 bit integer */
110#define IEEE802_11_FC_TO_DS_MASK 0x100
111#define IEEE802_11_FC_FROM_DS_MASK 0x200
112#define IEEE802_11_FC_MOREDATA_MASK 0x2000
113#define IEEE802_11_FC_PROTECTED_MASK 0x4000
114#define IEEE80211_FC_ORDER_MASK 0x8000
115#define IEEE80211_FC_SUBTYPE_MASK 0x00f0
116#define IEEE80211_FC_TYPE_MASK 0x000c
117#define IEEE80211_FC_PROTO_VERSION_MASK 0x0003
118
119/* selected type and subtype combinations as in 7.1.3.1 table 1
120 For frame control as 16 bit integer, or for ls octet
121*/
122#define IEEE802_11_FC_TYPE_DATA 0x08
123#define IEEE802_11_FC_TYPE_NULL 0x48
124#define IEEE802_11_FC_TYPE_QOS_NULL 0xc8
125#define IEEE802_11_FC_TYPE_QOS_DATA 0x88
126
127#define IEEE802_11_FC_TYPE_DATA_SUBTYPE_RESERVED 0x0D
128
129/* qos control (QC) masks for qos control as 16 bit integer, or for ls octet */
130#define IEEE802_11_QC_TID_MASK 0x0f
131#define IEEE802_11_QC_A_MSDU_PRESENT 0x80
132
133#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND))
134#define IEEE802_11_QC_NON_TID_BITS_MASK 0xFFF0
135#endif
136
137#define CSR_WIFI_EAPOL_M4_HOST_TAG 0x50000000
138#define IEEE802_11_DATA_FRAME_MAC_HEADER_SIZE 36
139#define MAX_ACCESS_CATOGORY 4
140
141/* Time in us to check for inactivity of stations 5 mins */
142#define INACTIVITY_CHECK_INTERVAL 300000000
143/* Time in us before a station is flagged as inactive */
144#define MAX_INACTIVITY_INTERVAL 300000000
145
146
147/* Define for maximum BA session */
148#define MAX_SUPPORTED_BA_SESSIONS_TX 1
149#define MAX_SUPPORTED_BA_SESSIONS_RX 4
150
151#define MAX_BA_WIND_SIZE 64
152#define MAC_HEADER_ADDR1_OFFSET 4
153#define MAC_HEADER_ADDR2_OFFSET 10
154
155/* Define for age (in us) value for frames in MPDU reorder buffer */
156#define CSR_WIFI_BA_MPDU_FRAME_AGE_TIMEOUT 30000 /* 30 milli seconds */
157
158/* This macro used in prepare_and_add_macheader*/
159#define ADDRESS_ONE_OFFSET 20
160
161/* Defines for STA inactivity detection */
162#define STA_INACTIVE_DETECTION_TRIGGER_THRESHOLD 1 /* in number of stations */
163#define STA_INACTIVE_DETECTION_TIMER_INTERVAL 30 /* in seconds */
164#define STA_INACTIVE_TIMEOUT_VAL 120*1000*1000 /* 120 seconds */
165
166/* Test for modes requiring AP firmware patch */
167#define CSR_WIFI_HIP_IS_AP_FW(mode) ((((mode) == CSR_WIFI_ROUTER_CTRL_MODE_AP) || \
168 ((mode) == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO)) ? TRUE : FALSE)
169
170/* Defines used in beacon filtering in case of P2P */
171#define CSR_WIFI_P2P_WILDCARD_SSID_LENGTH 0x7
172#define CSR_WIFI_80211_FRAME_SUBTYPE_BEACON 0x8
173#define CSR_WIFI_BEACON_FIXED_LENGTH 12
174#define CSR_WIFI_FRAME_SUBTYPE_BIT_OFFSET 4
175#define CSR_WIFI_80211_FRAME_SUBTYPE_BIT_MASK ((u8)(0xF << CSR_WIFI_FRAME_SUBTYPE_BIT_OFFSET))
176
177#define CSR_WIFI_80211_GET_FRAME_SUBTYPE(frameBuffer) \
178 ((u8)(((u8 *)frameBuffer)[0] & CSR_WIFI_80211_FRAME_SUBTYPE_BIT_MASK) >> CSR_WIFI_FRAME_SUBTYPE_BIT_OFFSET)
179
180/* For M4 request received via netdev*/
181
182typedef u8 CsrWifiPacketType;
183#define CSR_WIFI_UNICAST_PDU ((CsrWifiPacketType) 0x00)
184#define CSR_WIFI_MULTICAST_PDU ((CsrWifiPacketType) 0x1)
185#define CSR_WIFI_BROADCAST_PDU ((CsrWifiPacketType) 0x2)
186
187#define PRIO_TO_NICE(prio) ((prio) - MAX_RT_PRIO - 20)
188
189/* Module parameter variables */
190extern int buswidth;
191extern int sdio_clock;
192extern int use_5g;
193extern int disable_hw_reset;
194extern int disable_power_control;
195extern int enable_wol;
196extern int sme_debug;
197extern int fw_init[MAX_UNIFI_DEVS];
198extern int tl_80211d;
199extern int sdio_byte_mode;
200extern int sdio_block_size;
201extern int coredump_max;
202extern int run_bh_once;
203extern int bh_priority;
204#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
205extern int log_hip_signals;
206#endif
207
208struct dlpriv {
209 const unsigned char *dl_data;
210 int dl_len;
211 void *fw_desc;
212};
213
214
215struct uf_thread {
216
217 struct task_struct *thread_task;
218
219 /* wait_queue for waking the unifi_thread kernel thread */
220 wait_queue_head_t wakeup_q;
221 unsigned int wakeup_flag;
222
223 /*
224 * Use it to block the I/O thread when
225 * an error occurs or UniFi is reinitialised.
226 */
227 int block_thread;
228
229 char name[16];
230 int prio;
231};
232
233/*
234 * Link list to hold the received packets for the period the port
235 * remains closed.
236 */
237typedef struct rx_buffered_packets {
238 /* List link structure */
239 struct list_head q;
240 /* Packet to indicate when the port reopens */
241 struct sk_buff *skb;
242 /* Bulkdata to free in case the port closes and need to discard the packet */
243 bulk_data_param_t bulkdata;
244 /* The source address of the packet */
245 CsrWifiMacAddress sa;
246 /* The destination address of the packet */
247 CsrWifiMacAddress da;
248 /* Corresponding signal */
249 CSR_SIGNAL signal;
250} rx_buffered_packets_t;
251
252
253typedef u8 CsrWifiAcPowersaveMode;
254#define CSR_WIFI_AC_TRIGGER_ONLY_ENABLED 0x00
255#define CSR_WIFI_AC_DELIVERY_ONLY_ENABLE 0X01
256#define CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED 0X03
257#define CSR_WIFI_AC_LEGACY_POWER_SAVE 0X02
258
259
260#define IS_DELIVERY_ENABLED(mode) (mode & CSR_WIFI_AC_DELIVERY_ONLY_ENABLE)? 1: 0
261#define IS_DELIVERY_AND_TRIGGER_ENABLED(mode) ((mode & CSR_WIFI_AC_DELIVERY_ONLY_ENABLE)||(mode & CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED))? 1: 0
262#define IS_DTIM_ACTIVE(flag, hostTag) ((flag == TRUE || hostTag != INVALID_HOST_TAG))
263#define INVALID_HOST_TAG 0xFFFFFFFF
264#define UNIFI_TRAFFIC_Q_CONTENTION UNIFI_TRAFFIC_Q_BE
265
266
267
268
269/* Queue to be used for contention priority */
270
271/*
272 * Link list to hold the tx packets for the period the peer
273 * powersave/free slots in unifi
274 */
275typedef struct tx_buffered_packets {
276 /* List link structure */
277 struct list_head q;
278 u16 interfaceTag;
279 CSR_CLIENT_TAG hostTag;
280 CSR_PROCESS_ID leSenderProcessId;
281 CSR_TRANSMISSION_CONTROL transmissionControl;
282 CSR_RATE rate;
283 /* Bulkdata to free in case the port closes and need to discard the packet */
284 bulk_data_desc_t bulkdata;
285 /* The source address of the packet */
286 CsrWifiMacAddress peerMacAddress;
287 CSR_PRIORITY priority;
288} tx_buffered_packets_t;
289
290/* station record has this data structure */
291typedef struct CsrWifiRouterCtrlStaInfo_t {
292
293 /* Sme sends these parameters */
294 CsrWifiMacAddress peerMacAddress;
295 u32 assignedHandle;
296 u8 wmmOrQosEnabled;
297 CsrWifiAcPowersaveMode powersaveMode[MAX_ACCESS_CATOGORY];
298 u16 maxSpLength;
299 u8 uapsdActive;
300 u16 noOfSpFramesSent;
301
302 /* Router/Driver database */
303#ifdef CSR_SUPPORT_SME
304 unifi_port_cfg_t *peerControlledPort;
305 unifi_port_cfg_t *peerUnControlledPort;
306
307 /* Inactivity feature parameters */
308 struct netInterface_priv *interfacePriv;
309 struct work_struct send_disconnected_ind_task;
310 u8 activity_flag;
311 u16 listenIntervalInTus;
312 CSR_CLIENT_TAG nullDataHostTag;
313
314 /* Activity timestamps for the station */
315 u32 lastActivity;
316
317 /* during m/c transmission sp suspended */
318 u8 uspSuspend;
319 CSR_PRIORITY triggerFramePriority;
320#endif
321 CsrWifiRouterCtrlPeerStatus currentPeerState;
322 struct list_head dataPdu[MAX_ACCESS_CATOGORY];
323 struct list_head mgtFrames;
324 u8 spStatus;
325 u8 prevFrmType;
326 u8 prevFrmAccessCatogory;
327 u8 protection;
328 u16 aid;
329 u8 txSuspend;
330 u8 timSet;
331 /* Dont change the value of below macro for SET & RESET */
332#define CSR_WIFI_TIM_RESET 0
333#define CSR_WIFI_TIM_SET 1
334#define CSR_WIFI_TIM_RESETTING 2
335#define CSR_WIFI_TIM_SETTING 3
336
337 u8 timRequestPendingFlag;
338 u8 updateTimReqQueued;
339 u16 noOfPktQueued;
340}CsrWifiRouterCtrlStaInfo_t;
341
342#ifdef CSR_SUPPORT_WEXT_AP
343struct CsrWifiSmeApConfig {
344 CsrWifiSsid ssid;
345 u16 channel;
346 CsrWifiNmeApCredentials credentials;
347 u8 max_connections;
348 u8 if_index;
349};
350#endif
351
352#ifdef CSR_WIFI_RX_PATH_SPLIT
353/* This is a test code and may be removed later*/
354#define CSR_WIFI_RX_SIGNAL_BUFFER_SIZE (60+1)
355
356typedef struct
357{
358 u8 *bufptr; /* Signal Primitive */
359 bulk_data_param_t data_ptrs; /* Bulk Data pointers */
360 u16 sig_len;
361}rx_buff_struct_t;
362
363typedef struct
364{
365 u8 writePointer; /**< write pointer */
366 u8 readPointer; /**< read pointer */
367 u8 size; /**< size of circular buffer */
368 rx_buff_struct_t rx_buff[CSR_WIFI_RX_SIGNAL_BUFFER_SIZE]; /**< Element of ciruclar buffer */
369} rxCircularBuffer_t;
370
371void rx_wq_handler(struct work_struct *work);
372#endif
373
374struct unifi_priv {
375
376 card_t *card;
377 CsrSdioFunction *sdio;
378
379 /* Index into Unifi_instances[] for this device. */
380 int instance;
381 /* Reference count for this instance */
382 int ref_count;
383
384 /* Firmware images */
385 struct dlpriv fw_sta;
386 struct dlpriv fw_conv; /* used for conversion of production test image */
387
388 /* Char device related structures */
389 struct cdev unifi_cdev;
390 struct cdev unifiudi_cdev;
391 struct device *unifi_device;
392
393 /* Which wireless interface to use (1 - 2.4GHz, 2 - 5GHz) */
394 CSR_IFINTERFACE if_index;
395
396 /* For multiple interface support */
397 struct net_device *netdev[CSR_WIFI_NUM_INTERFACES];
398 struct netInterface_priv *interfacePriv[CSR_WIFI_NUM_INTERFACES];
399
400 u8 totalInterfaceCount;
401
402 int prev_queue;
403
404 /* Name of node under /proc */
405 char proc_entry_name[64];
406
407 /*
408 * Flags:
409 * drop_unencrypted
410 * - Not used?
411 * netdev_registered
412 * - whether the netdev has been registered.
413 */
414 unsigned int drop_unencrypted : 1;
415
416 /* Our list of unifi linux clients. */
417 ul_client_t ul_clients[MAX_UDI_CLIENTS];
418
419 /* Mutex to protect using the logging hook after UDI client is gone */
420 struct semaphore udi_logging_mutex;
421 /* Pointer to the ul_clients[] array */
422 ul_client_t *logging_client;
423
424 /* A ul_client_t* used to send the netdev related MIB requests. */
425 ul_client_t *netdev_client;
426
427 /* The SME ul_client_t pointer. */
428 ul_client_t *sme_cli;
429
430 /* The AMP ul_client_t pointer. */
431 ul_client_t *amp_client;
432
433 /*
434 * Semaphore for locking the top-half to one user process.
435 * This is necessary to prevent multiple processes calling driver
436 * operations. This can happen because the network driver entry points
437 * can be called from multiple processes.
438 */
439#ifdef USE_DRIVER_LOCK
440 struct semaphore lock;
441#endif /* USE_DRIVER_LOCK */
442
443 /* Flag to say that an operation was aborted */
444 int io_aborted;
445
446 struct uf_thread bh_thread;
447
448#define UNIFI_INIT_NONE 0x00
449#define UNIFI_INIT_IN_PROGRESS 0x01
450#define UNIFI_INIT_FW_DOWNLOADED 0x02
451#define UNIFI_INIT_COMPLETED 0x04
452 unsigned char init_progress;
453
454 int sme_is_present;
455
456 /* The WMM features that UniFi uses in the current BSS */
457 unsigned int sta_wmm_capabilities;
458
459 /* Debug only */
460 char last_debug_string[256];
461 unsigned short last_debug_word16[16];
462
463#ifdef CSR_SUPPORT_SME
464 /* lock to protect the tx queues list */
465 spinlock_t tx_q_lock;
466 u8 allPeerDozing;
467 u8 pausedStaHandle[MAX_ACCESS_CATOGORY];
468 /* Max packet the driver can queue, irrespective of interface number */
469 u16 noOfPktQueuedInDriver;
470#define CSR_WIFI_DRIVER_SUPPORT_FOR_MAX_PKT_QUEUEING 512
471#define CSR_WIFI_DRIVER_MAX_PKT_QUEUING_THRESHOLD_PER_PEER 64
472#define CSR_WIFI_DRIVER_MINIMUM_BROADCAST_PKT_THRESHOLD 3
473
474 u8 routerBufferEnable[MAX_ACCESS_CATOGORY];
475 /* lock to protect stainfo members and priv members*/
476 spinlock_t staRecord_lock;
477#endif
478#ifdef CSR_NATIVE_LINUX
479#ifdef CSR_SUPPORT_WEXT
480 /* wireless config */
481 struct wext_config wext_conf;
482#endif
483
484 /* Mutex to protect the MLME blocking requests */
485 struct semaphore mlme_blocking_mutex;
486
487 /* The ul_client that provides the blocking API for WEXT calls */
488 ul_client_t *wext_client;
489
490#endif /* CSR_NATIVE_LINUX */
491
492#ifdef CSR_SUPPORT_SME
493 wait_queue_head_t sme_request_wq;
494 /* Semaphore to protect the SME blocking requests */
495 struct semaphore sme_sem;
496 /* Structure to hold the SME blocking requests data*/
497 sme_reply_t sme_reply;
498
499 /* Structure to hold a traffic protocol indication */
500 struct ta_ind {
501 struct work_struct task;
502 CsrWifiRouterCtrlTrafficPacketType packet_type;
503 CsrWifiRouterCtrlProtocolDirection direction;
504 CsrWifiMacAddress src_addr;
505 int in_use;
506 } ta_ind_work;
507
508 struct ta_sample_ind {
509 struct work_struct task;
510 CsrWifiRouterCtrlTrafficStats stats;
511 int in_use;
512 } ta_sample_ind_work;
513
514 __be32 sta_ip_address;
515 CsrWifiRouterCtrlSmeVersions sme_versions;
516
517 /*
518 * Flag to reflect state of unifi_sys_wifi_on_*() progress.
519 * This indicates whether we are in an "wifi on" state when we are
520 * allowed to indication errors with unifi_mgt_wifi_off_ind()
521 */
522 enum {
523 wifi_on_unspecified = -1,
524 wifi_on_in_progress = 0,
525 wifi_on_done = 1,
526 } wifi_on_state;
527
528 /* Userspace TaskId for the SME Set when a wifi on req is received */
529 CsrSchedQid CSR_WIFI_SME_IFACEQUEUE;
530
531 struct work_struct multicast_list_task;
532 /*
533 * The SME installs filters to ask for specific MA-UNITDATA.req
534 * to be passed to different SME components.
535 */
536#define MAX_MA_UNIDATA_IND_FILTERS 8
537 sme_ma_unidata_ind_filter_t sme_unidata_ind_filters[MAX_MA_UNIDATA_IND_FILTERS];
538
539/* UNIFI_CFG related parameters */
540 uf_cfg_bcast_packet_filter_t packet_filters;
541 unsigned char *filter_tclas_ies;
542 /* The structure that holds all the connection configuration. */
543 CsrWifiSmeConnectionConfig connection_config;
544#ifdef CSR_SUPPORT_WEXT
545
546 int ignore_bssid_join;
547 struct iw_statistics wext_wireless_stats;
548
549 /* The MIB and MAC address files contents, read from userspace */
550 CsrWifiSmeDataBlock mib_data;
551 CsrWifiMacAddress sta_mac_address;
552
553 int wep_tx_key_index;
554 wep_key_t wep_keys[NUM_WEPKEYS];
555
556
557#ifdef CSR_SUPPORT_WEXT_AP
558 CsrWifiSmeApMacConfig ap_mac_config;
559 CsrWifiNmeApConfig group_sec_config;
560 CsrWifiSmeApConfig_t ap_config;
561#endif
562 struct work_struct sme_config_task;
563
564#endif /* CSR_SUPPORT_WEXT */
565
566#endif /* CSR_SUPPORT_SME */
567
568#ifdef CSR_SME_USERSPACE
569 void *smepriv;
570#endif /* CSR_SME_USERSPACE */
571
572 card_info_t card_info;
573
574 /* Mutex to protect unifi_send_signal() */
575 spinlock_t send_signal_lock;
576
577
578 /*
579 * The workqueue to offload the TA run
580 * and the multicast addresses list set
581 */
582 struct workqueue_struct *unifi_workqueue;
583
584 unsigned char *mib_cfm_buffer;
585 unsigned int mib_cfm_buffer_length;
586
587 int ptest_mode; /* Set when in production test mode */
588 int coredump_mode; /* Set when SME has requested a coredump */
589 u8 wol_suspend; /* Set when suspending with UniFi powered */
590
591#define UF_UNCONTROLLED_PORT_Q 0
592#define UF_CONTROLLED_PORT_Q 1
593
594 /* Semaphore to protect the rx queues list */
595 struct semaphore rx_q_sem;
596
597 /* Spinlock to protect M4 data */
598 spinlock_t m4_lock;
599 /* Mutex to protect BA RX data */
600 struct semaphore ba_mutex;
601
602#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION))
603 /* Spinlock to protect the WAPI data */
604 spinlock_t wapi_lock;
605#endif
606
607 /* Array to indicate if a particular Tx queue is paused, this may not be
608 * required in a multiqueue implementation since we can directly stop kernel
609 * queues */
610 u8 tx_q_paused_flag[UNIFI_TRAFFIC_Q_MAX];
611
612#ifdef CSR_WIFI_RX_PATH_SPLIT
613 struct workqueue_struct *rx_workqueue;
614 struct work_struct rx_work_struct;
615 rxCircularBuffer_t rxSignalBuffer;
616
617#endif
618
619 u32 rxTcpThroughput;
620 u32 txTcpThroughput;
621 u32 rxUdpThroughput;
622 u32 txUdpThroughput;
623
624#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
625 /*Set if multicast KeyID = 1*/
626 u8 wapi_multicast_filter;
627 /*Set if unicast KeyID = 1*/
628 u8 wapi_unicast_filter;
629 u8 wapi_unicast_queued_pkt_filter;
630#ifdef CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND
631 u8 isWapiConnection;
632#endif
633#endif
634
635#ifdef CSR_WIFI_SPLIT_PATCH
636 CsrWifiRouterCtrlModeSetReq pending_mode_set;
637#endif
638
639 u8 cmanrTestMode;
640 CSR_RATE cmanrTestModeTransmitRate;
641
642};
643
644typedef struct {
645 u16 queue_length[4];
646 u8 os_queue_paused;
647} unifi_OsQosInfo;
648
649
650typedef struct {
651 u8 active;
652 bulk_data_param_t bulkdata;
653 CSR_SIGNAL signal;
654 u16 sn;
655 u32 recv_time;
656} frame_desc_struct;
657
658typedef struct {
659 frame_desc_struct *buffer;
660 u16 wind_size;
661 u16 occupied_slots;
662 struct timer_list timer;
663 u16 timeout;
664 u16 expected_sn;
665 u16 start_sn;
666 u8 trigger_ba_after_ssn;
667 struct netInterface_priv *interfacePriv;
668 u16 tID;
669 CsrWifiMacAddress macAddress;
670 struct work_struct send_ba_err_task;
671} ba_session_rx_struct;
672
673
674typedef struct {
675 struct netInterface_priv *interfacePriv;
676 u16 tID;
677 CsrWifiMacAddress macAddress;
678} ba_session_tx_struct;
679
680typedef struct netInterface_priv
681{
682 u16 InterfaceTag;
683 struct unifi_priv *privPtr;
684 ba_session_tx_struct *ba_session_tx[MAX_SUPPORTED_BA_SESSIONS_TX];
685 ba_session_rx_struct *ba_session_rx[MAX_SUPPORTED_BA_SESSIONS_RX];
686 frame_desc_struct ba_complete[MAX_BA_WIND_SIZE];
687 u8 ba_complete_index;
688 u8 queueEnabled[UNIFI_NO_OF_TX_QS];
689 struct work_struct send_m4_ready_task;
690#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
691 struct work_struct send_pkt_to_encrypt;
692#endif
693 struct net_device_stats stats;
694 u8 interfaceMode;
695 u8 protect;
696 CsrWifiMacAddress bssid;
697 /*
698 * Flag to reflect state of CONNECTED indication signal.
699 * This indicates whether we are "joined" an Access Point (i.e. have
700 * nominated an AP and are receiving beacons) but give no indication
701 * of whether we are authenticated and/or associated.
702 */
703 enum {
704 UnifiConnectedUnknown = -1,
705 UnifiNotConnected = 0,
706 UnifiConnected = 1,
707 } connected;
708#ifdef CSR_SUPPORT_WEXT
709 /* Tracks when we are waiting for a netdevice state change callback */
710 u8 wait_netdev_change;
711 /* True if we have successfully registered for netdev callbacks */
712 u8 netdev_callback_registered;
713#endif /* CSR_SUPPORT_WEXT */
714 unsigned int netdev_registered;
715#define UNIFI_MAX_MULTICAST_ADDRESSES 10
716 /* The multicast addresses list that the thread needs to set. */
717 u8 mc_list[UNIFI_MAX_MULTICAST_ADDRESSES*ETH_ALEN];
718 /* The multicast addresses count that the thread needs to set. */
719 int mc_list_count;
720 u32 tag;
721#ifdef CSR_SUPPORT_SME
722 /* (un)controlled port configuration */
723 unifi_port_config_t controlled_data_port;
724 unifi_port_config_t uncontrolled_data_port;
725
726 /* station record maintenance related data structures */
727 u8 num_stations_joined;
728 CsrWifiRouterCtrlStaInfo_t *(staInfo)[UNIFI_MAX_CONNECTIONS];
729 struct list_head genericMgtFrames;
730 struct list_head genericMulticastOrBroadCastFrames;
731 struct list_head genericMulticastOrBroadCastMgtFrames;
732
733 /* Timer for detecting station inactivity */
734 struct timer_list sta_activity_check_timer;
735 u8 sta_activity_check_enabled;
736
737 /* Timestamp when the last inactivity check was done */
738 u32 last_inactivity_check;
739
740 /*number of multicast or borad cast packets queued*/
741 u16 noOfbroadcastPktQueued;
742#endif
743 /* A list to hold the buffered uncontrolled port packets */
744 struct list_head rx_uncontrolled_list;
745 /* A list to hold the buffered controlled port packets */
746 struct list_head rx_controlled_list;
747 /* Buffered M4 signal to take care of WPA race condition */
748 CSR_SIGNAL m4_signal;
749 bulk_data_desc_t m4_bulk_data;
750
751#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION))
752 /* Buffered WAPI Unicast MA Packet Request for encryption in Sme */
753 CSR_SIGNAL wapi_unicast_ma_pkt_sig;
754 bulk_data_desc_t wapi_unicast_bulk_data;
755#endif
756
757 /* This should be removed and m4_hostTag should be used for checking*/
758 u8 m4_sent;
759 CSR_CLIENT_TAG m4_hostTag;
760 u8 dtimActive;
761 u8 intraBssEnabled;
762 u32 multicastPduHostTag; /* Used to set the tim after getting
763 a confirm for it */
764 u8 bcTimSet;
765 u8 bcTimSetReqPendingFlag;
766 u8 bcTimSetReqQueued;
767} netInterface_priv_t;
768
769#ifdef CSR_SUPPORT_SME
770#define routerStartBuffering(priv, queue) priv->routerBufferEnable[(queue)] = TRUE;
771#define routerStopBuffering(priv, queue) priv->routerBufferEnable[(queue)] = FALSE;
772#define isRouterBufferEnabled(priv, queue) priv->routerBufferEnable[(queue)]
773#endif
774
775#ifdef USE_DRIVER_LOCK
776#define LOCK_DRIVER(_p) down_interruptible(&(_p)->lock)
777#define UNLOCK_DRIVER(_p) up(&(_p)->lock)
778#else
779#define LOCK_DRIVER(_p) (void)(_p); /* as nothing */
780#define UNLOCK_DRIVER(_p) (void)(_p); /* as nothing */
781#endif /* USE_DRIVER_LOCK */
782
783s32 CsrHipResultToStatus(CsrResult csrResult);
784
785
786/*
787 * SDIO related functions and callbacks
788 */
789int uf_sdio_load(void);
790void uf_sdio_unload(void);
791unifi_priv_t *uf_find_instance(int inst);
792int uf_find_priv(unifi_priv_t *priv);
793int uf_find_netdev_priv(netInterface_priv_t *priv);
794unifi_priv_t *uf_get_instance(int inst);
795void uf_put_instance(int inst);
796int csr_sdio_linux_install_irq(CsrSdioFunction *sdio);
797int csr_sdio_linux_remove_irq(CsrSdioFunction *sdio);
798
799void uf_add_os_device(int bus_id, struct device *os_device);
800void uf_remove_os_device(int bus_id);
801
802
803
804/*
805 * Claim/release SDIO
806 *
807 * For multifunction cards, we cannot grub the SDIO lock around the unifi_bh()
808 * as this prevents other functions using SDIO.
809 * Since some of CSR SDIO API is used regardless of trying to lock unifi_bh()
810 * we have followed this scheme:
811 * 1. If a function needs protection only when CSR_WIFI_SINGLE_FUNCTION is defined
812 * then we call CsrSdioClaim/CsrSdioRelease().
813 * 2. If a function needs protection only when CSR_WIFI_SINGLE_FUNCTION is not defined
814 * then we call _sdio_claim_host/_sdio_claim_host(). Use of this should be restricted
815 * to the SDIO glue layer only (e.g. sdio_mmc.c).
816 * 3. If a function needs protection, regardless of the CSR_WIFI_SINGLE_FUNCTION
817 * then we call directly the sdio_claim_host/sdio_release_host().
818 * Use of this must be restricted to the SDIO glue layer only (e.g. sdio_mmc.c).
819 *
820 * Note: The _func and function pointers are _not_ the same.
821 * The former is the (struct sdio_func*) context, which restricts the use to the SDIO glue layer.
822 * The latter is the (CsrSdioFunction*) context, which allows calls from all layers.
823 */
824
825#ifdef CSR_WIFI_SUPPORT_MMC_DRIVER
826
827#ifdef CSR_WIFI_SINGLE_FUNCTION
828#define CsrSdioClaim(function) sdio_claim_host((function)->priv);
829#define CsrSdioRelease(function) sdio_release_host((function)->priv);
830
831#define _sdio_claim_host(_func)
832#define _sdio_release_host(_func)
833
834#else
835#define CsrSdioClaim(function)
836#define CsrSdioRelease(function)
837
838#define _sdio_claim_host(_func) sdio_claim_host(_func)
839#define _sdio_release_host(_func) sdio_release_host(_func)
840
841#endif /* CSR_WIFI_SINGLE_FUNCTION */
842
843#else
844#define _sdio_claim_host(_func)
845#define _sdio_release_host(_func)
846
847#define CsrSdioClaim(function)
848#define CsrSdioRelease(function)
849
850#endif /* CSR_WIFI_SUPPORT_MMC_DRIVER */
851
852
853/*
854 * Functions to allocate and free an ethernet device.
855 */
856unifi_priv_t *uf_alloc_netdevice(CsrSdioFunction *sdio_dev, int bus_id);
857int uf_free_netdevice(unifi_priv_t *priv);
858
859/* Allocating function for other interfaces */
860u8 uf_alloc_netdevice_for_other_interfaces(unifi_priv_t *priv, u16 interfaceTag);
861
862/*
863 * Firmware download related functions.
864 */
865int uf_run_unifihelper(unifi_priv_t *priv);
866int uf_request_firmware_files(unifi_priv_t *priv, int is_fw);
867int uf_release_firmware_files(unifi_priv_t *priv);
868int uf_release_firmware(unifi_priv_t *priv, struct dlpriv *to_free);
869
870/*
871 * Functions to create and delete the device nodes.
872 */
873int uf_create_device_nodes(unifi_priv_t *priv, int bus_id);
874void uf_destroy_device_nodes(unifi_priv_t *priv);
875
876/*
877 * Upper Edge Initialisation functions
878 */
879int uf_init_bh(unifi_priv_t *priv);
880int uf_init_hw(unifi_priv_t *priv);
881
882/* Thread related helper functions */
883int uf_start_thread(unifi_priv_t *priv, struct uf_thread *thread, int (*func)(void *));
884void uf_stop_thread(unifi_priv_t *priv, struct uf_thread *thread);
885void uf_wait_for_thread_to_stop(unifi_priv_t *priv, struct uf_thread *thread);
886
887
888/*
889 * Unifi Linux functions
890 */
891void ul_init_clients(unifi_priv_t *priv);
892
893/* Configuration flags */
894#define CLI_USING_WIRE_FORMAT 0x0002
895#define CLI_SME_USERSPACE 0x0020
896ul_client_t *ul_register_client(unifi_priv_t *priv,
897 unsigned int configuration,
898 udi_event_t udi_event_clbk);
899int ul_deregister_client(ul_client_t *pcli);
900
901int ul_send_signal_unpacked(unifi_priv_t *priv,
902 CSR_SIGNAL *sigptr,
903 bulk_data_param_t *bulkdata);
904int ul_send_signal_raw(unifi_priv_t *priv,
905 unsigned char *sigptr, int siglen,
906 bulk_data_param_t *bulkdata);
907
908void ul_log_config_ind(unifi_priv_t *priv, u8 *conf_param, int len);
909
910
911/*
912 * Data plane operations
913 */
914/*
915 * data_tx.c
916 */
917int uf_verify_m4(unifi_priv_t *priv, const unsigned char *packet,
918 unsigned int length);
919
920#ifdef CSR_SUPPORT_SME
921u8 uf_check_broadcast_bssid(unifi_priv_t *priv, const bulk_data_param_t *bulkdata);
922u8 uf_process_pm_bit_for_peer(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t * srcStaInfo, u8 pmBit, u16 interfaceTag);
923void uf_process_ps_poll(unifi_priv_t *priv, u8* sa, u8* da, u8 pmBit, u16 interfaceTag);
924int uf_ap_process_data_pdu(unifi_priv_t *priv, struct sk_buff *skb,
925 struct ethhdr *ehdr, CsrWifiRouterCtrlStaInfo_t * srcStaInfo,
926 const CSR_SIGNAL *signal,
927 bulk_data_param_t *bulkdata,
928 u8 macHeaderLengthInBytes);
929u8 uf_is_more_data_for_non_delivery_ac(CsrWifiRouterCtrlStaInfo_t *staRecord);
930void uf_process_wmm_deliver_ac_uapsd ( unifi_priv_t * priv,
931 CsrWifiRouterCtrlStaInfo_t * srcStaInfo,
932 u16 qosControl,
933 u16 interfaceTag);
934
935void uf_send_buffered_data_from_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo, u8 queue, struct list_head *txList);
936void uf_send_buffered_data_from_delivery_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo, u8 queue, struct list_head *txList);
937
938void uf_continue_uapsd(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo);
939void uf_send_qos_null(unifi_priv_t * priv, u16 interfaceTag, const u8 *da, CSR_PRIORITY priority, CsrWifiRouterCtrlStaInfo_t * srcStaInfo);
940void uf_send_nulldata(unifi_priv_t * priv, u16 interfaceTag, const u8 *da, CSR_PRIORITY priority, CsrWifiRouterCtrlStaInfo_t * srcStaInfo);
941
942
943
944#endif
945CsrResult uf_process_ma_packet_req(unifi_priv_t *priv, u8 *peerMacAddress, CSR_CLIENT_TAG hostTag, u16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl, CSR_RATE TransmitRate, CSR_PRIORITY priority, CSR_PROCESS_ID senderId, bulk_data_param_t *bulkdata);
946void uf_process_ma_vif_availibility_ind(unifi_priv_t *priv, u8 *sigdata, u32 siglen);
947#ifdef CSR_SUPPORT_SME
948void uf_send_buffered_frames(unifi_priv_t *priv, unifi_TrafficQueue queue);
949int uf_process_station_records_for_sending_data(unifi_priv_t *priv, u16 interfaceTag,
950 CsrWifiRouterCtrlStaInfo_t *srcStaInfo,
951 CsrWifiRouterCtrlStaInfo_t *dstStaInfo);
952void uf_prepare_send_cfm_list_for_queued_pkts(unifi_priv_t * priv,
953 struct list_head *frames_need_cfm_list,
954 struct list_head * list);
955void send_auto_ma_packet_confirm(unifi_priv_t *priv,
956 netInterface_priv_t *interfacePriv,
957 struct list_head *buffered_frames_list);
958void uf_flush_list(unifi_priv_t * priv, struct list_head * list);
959tx_buffered_packets_t *dequeue_tx_data_pdu(unifi_priv_t *priv, struct list_head *txList);
960void resume_unicast_buffered_frames(unifi_priv_t *priv, u16 interfaceTag);
961void update_eosp_to_head_of_broadcast_list_head(unifi_priv_t *priv, u16 interfaceTag);
962void resume_suspended_uapsd(unifi_priv_t* priv, u16 interfaceTag);
963#endif
964/*
965 * netdev.c
966 */
967
968#ifndef P80211_OUI_LEN
969#define P80211_OUI_LEN 3
970#endif
971typedef struct {
972 u8 dsap; /* always 0xAA */
973 u8 ssap; /* always 0xAA */
974 u8 ctrl; /* always 0x03 */
975 u8 oui[P80211_OUI_LEN]; /* organizational universal id */
976 u16 protocol;
977} __attribute__ ((packed)) llc_snap_hdr_t;
978int skb_add_llc_snap(struct net_device *dev, struct sk_buff *skb, int proto);
979int skb_80211_to_ether(unifi_priv_t *priv, struct sk_buff *skb,
980 const unsigned char *daddr, const unsigned char *saddr,
981 const CSR_SIGNAL *signal,
982 bulk_data_param_t *bulkdata);
983
984const char *result_code_str(int result);
985
986
987/* prepares & appends the Mac header for the payload */
988int prepare_and_add_macheader(unifi_priv_t *priv,
989 struct sk_buff *skb,
990 struct sk_buff *newSkb,
991 CSR_PRIORITY priority,
992 bulk_data_param_t *bulkdata,
993 u16 interfaceTag,
994 const u8 *daddr,
995 const u8 *saddr,
996 u8 protection);
997CSR_PRIORITY
998get_packet_priority(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr *ehdr, netInterface_priv_t *interfacePriv);
999
1000void
1001unifi_frame_ma_packet_req(unifi_priv_t *priv, CSR_PRIORITY priority,
1002 CSR_RATE TransmitRate, CSR_CLIENT_TAG hostTag,
1003 u16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl,
1004 CSR_PROCESS_ID leSenderProcessId, u8 *peerMacAddress,
1005 CSR_SIGNAL *signal);
1006
1007
1008/* Pack the LSB to include station handle & status of tim set */
1009#define CSR_WIFI_PACK_SENDER_ID_LSB_FOR_TIM_REQ(handle, timState) ((handle << 2) | timState)
1010/* get the station record handle from the sender ID */
1011#define CSR_WIFI_GET_STATION_HANDLE_FROM_RECEIVER_ID(receiverProcessId) (u8) ((receiverProcessId & 0xff) >> 2)
1012/* get the timSet status from the sender ID */
1013#define CSR_WIFI_GET_TIMSET_STATE_FROM_RECEIVER_ID(receiverProcessId) (u8) (receiverProcessId & 0x03)
1014
1015/* handle is 6 bits to accomodate in senderId LSB (only 64 station can be associated) */
1016#define CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE 0x3F
1017
1018void update_tim(unifi_priv_t * priv, u16 aid, u8 setTim, u16 interfaceTag, u32 handle);
1019void uf_handle_tim_cfm(unifi_priv_t *priv, CSR_MLME_SET_TIM_CONFIRM *cfm, u16 senderProcessId);
1020
1021/* Clear the Peer station Record, in case of wifioff/unexpected card removal */
1022void CsrWifiRouterCtrlInterfaceReset(unifi_priv_t *priv, u16 interfaceTag);
1023
1024void scroll_ba_window(unifi_priv_t *priv,
1025 netInterface_priv_t *interfacePriv,
1026 ba_session_rx_struct *ba_session,
1027 u16 sn);
1028
1029u8 blockack_session_stop(unifi_priv_t *priv,
1030 u16 interfaceTag,
1031 CsrWifiRouterCtrlBlockAckRole role,
1032 u16 tID,
1033 CsrWifiMacAddress macAddress);
1034#ifdef CSR_SUPPORT_SME
1035/* Fetch the protection information from interface Mode */
1036s8 uf_get_protection_bit_from_interfacemode(unifi_priv_t *priv, u16 interfaceTag, const u8 *daddr);
1037#endif
1038
1039/* Fetch the station record handler from data base for matching Mac address */
1040#ifdef CSR_SUPPORT_SME
1041CsrWifiRouterCtrlStaInfo_t *CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(unifi_priv_t *priv,
1042 const u8 *peerMacAddress,
1043 u16 interfaceTag);
1044
1045/* Fetch the station record handler from data base for matching handle */
1046CsrWifiRouterCtrlStaInfo_t * CsrWifiRouterCtrlGetStationRecordFromHandle(unifi_priv_t *priv,
1047 u32 handle,
1048 u16 interfaceTag);
1049
1050void uf_update_sta_activity(unifi_priv_t *priv, u16 interfaceTag, const u8 *peerMacAddress);
1051void uf_process_ma_pkt_cfm_for_ap(unifi_priv_t *priv, u16 interfaceTag, const CSR_MA_PACKET_CONFIRM *pkt_cfm);
1052#endif
1053
1054void uf_resume_data_plane(unifi_priv_t *priv, int queue,
1055 CsrWifiMacAddress peer_address,
1056 u16 interfaceTag);
1057void uf_free_pending_rx_packets(unifi_priv_t *priv, int queue,
1058 CsrWifiMacAddress peer_address, u16 interfaceTag);
1059
1060int uf_register_netdev(unifi_priv_t *priv, int numOfInterface);
1061void uf_unregister_netdev(unifi_priv_t *priv);
1062
1063void uf_net_get_name(struct net_device *dev, char *name, int len);
1064
1065void uf_send_queue_info(unifi_priv_t *priv);
1066u16 uf_get_vif_identifier(CsrWifiRouterCtrlMode mode, u16 tag);
1067
1068void uf_process_rx_pending_queue(unifi_priv_t *priv, int queue,
1069 CsrWifiMacAddress source_address,
1070 int indicate, u16 interfaceTag);
1071
1072#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
1073int uf_register_hip_offline_debug(unifi_priv_t *priv);
1074int uf_unregister_hip_offline_debug(unifi_priv_t *priv);
1075#endif
1076
1077/*
1078 * inet.c
1079 */
1080void uf_register_inet_notifier(void);
1081void uf_unregister_inet_notifier(void);
1082
1083
1084/*
1085 * Suspend / Resume handlers
1086 */
1087void unifi_resume(void *ospriv);
1088void unifi_suspend(void *ospriv);
1089
1090
1091#define QOS_CAPABILITY_WMM_ENABLED 0x0001
1092#define QOS_CAPABILITY_WMM_UAPSD 0x0002
1093#define QOS_CAPABILITY_ACM_BE_ENABLED 0x0010
1094#define QOS_CAPABILITY_ACM_BK_ENABLED 0x0020
1095#define QOS_CAPABILITY_ACM_VI_ENABLED 0x0040
1096#define QOS_CAPABILITY_ACM_VO_ENABLED 0x0080
1097#define QOS_CAPABILITY_TS_BE_ENABLED 0x0100
1098#define QOS_CAPABILITY_TS_BK_ENABLED 0x0200
1099#define QOS_CAPABILITY_TS_VI_ENABLED 0x0400
1100#define QOS_CAPABILITY_TS_VO_ENABLED 0x0800
1101
1102
1103/* EAPOL PDUS */
1104#ifndef ETH_P_PAE
1105#define ETH_P_PAE 0x888e
1106#endif
1107#ifndef ETH_P_WAI
1108#define ETH_P_WAI 0x88b4
1109#endif
1110/*
1111 * unifi_dbg.c
1112 */
1113void debug_string_indication(unifi_priv_t *priv,
1114 const unsigned char *extra,
1115 unsigned int extralen);
1116void debug_word16_indication(unifi_priv_t *priv, const CSR_SIGNAL *sigptr);
1117void debug_generic_indication(unifi_priv_t *priv, const CSR_SIGNAL *sigptr);
1118
1119
1120/*
1121 * putest.c
1122 */
1123int unifi_putest_start(unifi_priv_t *priv, unsigned char *arg);
1124int unifi_putest_cmd52_block_read(unifi_priv_t *priv, unsigned char *arg);
1125int unifi_putest_stop(unifi_priv_t *priv, unsigned char *arg);
1126int unifi_putest_set_sdio_clock(unifi_priv_t *priv, unsigned char *arg);
1127int unifi_putest_cmd52_read(unifi_priv_t *priv, unsigned char *arg);
1128int unifi_putest_coredump_prepare(unifi_priv_t *priv, unsigned char *arg);
1129int unifi_putest_cmd52_write(unifi_priv_t *priv, unsigned char *arg);
1130int unifi_putest_gp_read16(unifi_priv_t *priv, unsigned char *arg);
1131int unifi_putest_gp_write16(unifi_priv_t *priv, unsigned char *arg);
1132
1133int unifi_putest_dl_fw(unifi_priv_t *priv, unsigned char *arg);
1134int unifi_putest_dl_fw_buff(unifi_priv_t *priv, unsigned char *arg);
1135
1136#endif /* __LINUX_UNIFI_PRIV_H__ */
diff --git a/drivers/staging/csr/unifi_sme.c b/drivers/staging/csr/unifi_sme.c
deleted file mode 100644
index 50908822b3c8..000000000000
--- a/drivers/staging/csr/unifi_sme.c
+++ /dev/null
@@ -1,1225 +0,0 @@
1/*
2 * ***************************************************************************
3 * FILE: unifi_sme.c
4 *
5 * PURPOSE: SME related functions.
6 *
7 * Copyright (C) 2007-2009 by Cambridge Silicon Radio Ltd.
8 *
9 * Refer to LICENSE.txt included with this source code for details on
10 * the license terms.
11 *
12 * ***************************************************************************
13 */
14
15#include "unifi_priv.h"
16#include "csr_wifi_hip_unifi.h"
17#include "csr_wifi_hip_conversions.h"
18#include <linux/sched/rt.h>
19
20
21
22 int
23convert_sme_error(CsrResult error)
24{
25 switch (error) {
26 case CSR_RESULT_SUCCESS:
27 return 0;
28 case CSR_RESULT_FAILURE:
29 case CSR_WIFI_RESULT_NOT_FOUND:
30 case CSR_WIFI_RESULT_TIMED_OUT:
31 case CSR_WIFI_RESULT_CANCELLED:
32 case CSR_WIFI_RESULT_UNAVAILABLE:
33 return -EIO;
34 case CSR_WIFI_RESULT_NO_ROOM:
35 return -EBUSY;
36 case CSR_WIFI_RESULT_INVALID_PARAMETER:
37 return -EINVAL;
38 case CSR_WIFI_RESULT_UNSUPPORTED:
39 return -EOPNOTSUPP;
40 default:
41 return -EIO;
42 }
43}
44
45
46/*
47 * ---------------------------------------------------------------------------
48 * sme_log_event
49 *
50 * Callback function to be registered as the SME event callback.
51 * Copies the signal content into a new udi_log_t struct and adds
52 * it to the read queue for the SME client.
53 *
54 * Arguments:
55 * arg This is the value given to unifi_add_udi_hook, in
56 * this case a pointer to the client instance.
57 * signal Pointer to the received signal.
58 * signal_len Size of the signal structure in bytes.
59 * bulkdata Pointers to any associated bulk data.
60 * dir Direction of the signal. Zero means from host,
61 * non-zero means to host.
62 *
63 * Returns:
64 * None.
65 * ---------------------------------------------------------------------------
66 */
67 void
68sme_log_event(ul_client_t *pcli,
69 const u8 *signal, int signal_len,
70 const bulk_data_param_t *bulkdata,
71 int dir)
72{
73 unifi_priv_t *priv;
74 CSR_SIGNAL unpacked_signal;
75 CsrWifiSmeDataBlock mlmeCommand;
76 CsrWifiSmeDataBlock dataref1;
77 CsrWifiSmeDataBlock dataref2;
78 CsrResult result = CSR_RESULT_SUCCESS;
79 int r;
80
81 /* Just a sanity check */
82 if ((signal == NULL) || (signal_len <= 0)) {
83 return;
84 }
85
86 priv = uf_find_instance(pcli->instance);
87 if (!priv) {
88 unifi_error(priv, "sme_log_event: invalid priv\n");
89 return;
90 }
91
92 if (priv->smepriv == NULL) {
93 unifi_error(priv, "sme_log_event: invalid smepriv\n");
94 return;
95 }
96
97 unifi_trace(priv, UDBG3,
98 "sme_log_event: Process signal 0x%.4X\n",
99 CSR_GET_UINT16_FROM_LITTLE_ENDIAN(signal));
100
101
102 /* If the signal is known, then do any filtering required, otherwise it pass it to the SME. */
103 r = read_unpack_signal(signal, &unpacked_signal);
104 if (r == CSR_RESULT_SUCCESS) {
105 if ((unpacked_signal.SignalPrimitiveHeader.SignalId == CSR_DEBUG_STRING_INDICATION_ID) ||
106 (unpacked_signal.SignalPrimitiveHeader.SignalId == CSR_DEBUG_WORD16_INDICATION_ID))
107 {
108 return;
109 }
110 if (unpacked_signal.SignalPrimitiveHeader.SignalId == CSR_MA_PACKET_INDICATION_ID)
111 {
112 u16 frmCtrl;
113 u8 unicastPdu = TRUE;
114 u8 *macHdrLocation;
115 u8 *raddr = NULL, *taddr = NULL;
116 CsrWifiMacAddress peerMacAddress;
117 /* Check if we need to send CsrWifiRouterCtrlMicFailureInd*/
118 CSR_MA_PACKET_INDICATION *ind = &unpacked_signal.u.MaPacketIndication;
119
120 macHdrLocation = (u8 *) bulkdata->d[0].os_data_ptr;
121 /* Fetch the frame control value from mac header */
122 frmCtrl = CSR_GET_UINT16_FROM_LITTLE_ENDIAN(macHdrLocation);
123
124 /* Point to the addresses */
125 raddr = macHdrLocation + MAC_HEADER_ADDR1_OFFSET;
126 taddr = macHdrLocation + MAC_HEADER_ADDR2_OFFSET;
127
128 memcpy(peerMacAddress.a, taddr, ETH_ALEN);
129
130 if(ind->ReceptionStatus == CSR_MICHAEL_MIC_ERROR)
131 {
132 if (*raddr & 0x1)
133 unicastPdu = FALSE;
134
135 CsrWifiRouterCtrlMicFailureIndSend (priv->CSR_WIFI_SME_IFACEQUEUE, 0,
136 (ind->VirtualInterfaceIdentifier & 0xff), peerMacAddress,
137 unicastPdu);
138 return;
139 }
140 else
141 {
142 if(ind->ReceptionStatus == CSR_RX_SUCCESS)
143 {
144 u8 pmBit = (frmCtrl & 0x1000)?0x01:0x00;
145 u16 interfaceTag = (ind->VirtualInterfaceIdentifier & 0xff);
146 CsrWifiRouterCtrlStaInfo_t *srcStaInfo = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, taddr, interfaceTag);
147 if((srcStaInfo != NULL) && (uf_check_broadcast_bssid(priv, bulkdata)== FALSE))
148 {
149 uf_process_pm_bit_for_peer(priv, srcStaInfo, pmBit, interfaceTag);
150
151 /* Update station last activity flag */
152 srcStaInfo->activity_flag = TRUE;
153 }
154 }
155 }
156 }
157
158 if (unpacked_signal.SignalPrimitiveHeader.SignalId == CSR_MA_PACKET_CONFIRM_ID)
159 {
160 CSR_MA_PACKET_CONFIRM *cfm = &unpacked_signal.u.MaPacketConfirm;
161 u16 interfaceTag = (cfm->VirtualInterfaceIdentifier & 0xff);
162 netInterface_priv_t *interfacePriv;
163 CSR_MA_PACKET_REQUEST *req;
164 CsrWifiMacAddress peerMacAddress;
165
166 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES)
167 {
168 unifi_error(priv, "Bad MA_PACKET_CONFIRM interfaceTag %d\n", interfaceTag);
169 return;
170 }
171
172 unifi_trace(priv, UDBG1, "MA-PACKET Confirm (%x, %x)\n", cfm->HostTag, cfm->TransmissionStatus);
173
174 interfacePriv = priv->interfacePriv[interfaceTag];
175#ifdef CSR_SUPPORT_SME
176 if(interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_AP ||
177 interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO) {
178
179 if(cfm->HostTag == interfacePriv->multicastPduHostTag){
180 uf_process_ma_pkt_cfm_for_ap(priv, interfaceTag, cfm);
181 }
182 }
183#endif
184
185 req = &interfacePriv->m4_signal.u.MaPacketRequest;
186
187 if(cfm->HostTag & 0x80000000)
188 {
189 if (cfm->TransmissionStatus != CSR_TX_SUCCESSFUL)
190 {
191 result = CSR_RESULT_FAILURE;
192 }
193#ifdef CSR_SUPPORT_SME
194 memcpy(peerMacAddress.a, req->Ra.x, ETH_ALEN);
195 /* Check if this is a confirm for EAPOL M4 frame and we need to send transmistted ind*/
196 if (interfacePriv->m4_sent && (cfm->HostTag == interfacePriv->m4_hostTag))
197 {
198 unifi_trace(priv, UDBG1, "%s: Sending M4 Transmit CFM\n", __FUNCTION__);
199 CsrWifiRouterCtrlM4TransmittedIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0,
200 interfaceTag,
201 peerMacAddress,
202 result);
203 interfacePriv->m4_sent = FALSE;
204 interfacePriv->m4_hostTag = 0xffffffff;
205 }
206#endif
207 /* If EAPOL was requested via router APIs then send cfm else ignore*/
208 if((cfm->HostTag & 0x80000000) != CSR_WIFI_EAPOL_M4_HOST_TAG) {
209 CsrWifiRouterMaPacketCfmSend((u16)signal[2],
210 cfm->VirtualInterfaceIdentifier,
211 result,
212 (cfm->HostTag & 0x3fffffff), cfm->Rate);
213 } else {
214 unifi_trace(priv, UDBG1, "%s: M4 received from netdevice\n", __FUNCTION__);
215 }
216 return;
217 }
218 }
219 }
220
221 mlmeCommand.length = signal_len;
222 mlmeCommand.data = (u8*)signal;
223
224 dataref1.length = bulkdata->d[0].data_length;
225 if (dataref1.length > 0) {
226 dataref1.data = (u8 *) bulkdata->d[0].os_data_ptr;
227 } else
228 {
229 dataref1.data = NULL;
230 }
231
232 dataref2.length = bulkdata->d[1].data_length;
233 if (dataref2.length > 0) {
234 dataref2.data = (u8 *) bulkdata->d[1].os_data_ptr;
235 } else
236 {
237 dataref2.data = NULL;
238 }
239
240 CsrWifiRouterCtrlHipIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, mlmeCommand.length, mlmeCommand.data,
241 dataref1.length, dataref1.data,
242 dataref2.length, dataref2.data);
243
244} /* sme_log_event() */
245
246
247/*
248 * ---------------------------------------------------------------------------
249 * uf_sme_port_state
250 *
251 * Return the state of the controlled port.
252 *
253 * Arguments:
254 * priv Pointer to device private context struct
255 * address Pointer to the destination for tx or sender for rx address
256 * queue Controlled or uncontrolled queue
257 *
258 * Returns:
259 * An unifi_ControlledPortAction value.
260 * ---------------------------------------------------------------------------
261 */
262CsrWifiRouterCtrlPortAction
263uf_sme_port_state(unifi_priv_t *priv, unsigned char *address, int queue, u16 interfaceTag)
264{
265 int i;
266 unifi_port_config_t *port;
267 netInterface_priv_t *interfacePriv;
268
269 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
270 unifi_error(priv, "uf_sme_port_state: bad interfaceTag\n");
271 return CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD;
272 }
273
274 interfacePriv = priv->interfacePriv[interfaceTag];
275
276 if (queue == UF_CONTROLLED_PORT_Q) {
277 port = &interfacePriv->controlled_data_port;
278 } else {
279 port = &interfacePriv->uncontrolled_data_port;
280 }
281
282 if (!port->entries_in_use) {
283 unifi_trace(priv, UDBG5, "No port configurations, return Discard.\n");
284 return CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD;
285 }
286
287 /* If the port configuration is common for all destinations, return it. */
288 if (port->overide_action == UF_DATA_PORT_OVERIDE) {
289 unifi_trace(priv, UDBG5, "Single port configuration (%d).\n",
290 port->port_cfg[0].port_action);
291 return port->port_cfg[0].port_action;
292 }
293
294 unifi_trace(priv, UDBG5, "Multiple (%d) port configurations.\n", port->entries_in_use);
295
296 /* If multiple configurations exist.. */
297 for (i = 0; i < UNIFI_MAX_CONNECTIONS; i++) {
298 /* .. go through the list and match the destination address. */
299 if (port->port_cfg[i].in_use &&
300 memcmp(address, port->port_cfg[i].mac_address.a, ETH_ALEN) == 0) {
301 /* Return the desired action. */
302 return port->port_cfg[i].port_action;
303 }
304 }
305
306 /* Could not find any information, return Open. */
307 unifi_trace(priv, UDBG5, "port configuration not found, return Open.\n");
308 return CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN;
309} /* uf_sme_port_state() */
310
311/*
312 * ---------------------------------------------------------------------------
313 * uf_sme_port_config_handle
314 *
315 * Return the port config handle of the controlled/uncontrolled port.
316 *
317 * Arguments:
318 * priv Pointer to device private context struct
319 * address Pointer to the destination for tx or sender for rx address
320 * queue Controlled or uncontrolled queue
321 *
322 * Returns:
323 * An unifi_port_cfg_t* .
324 * ---------------------------------------------------------------------------
325 */
326unifi_port_cfg_t*
327uf_sme_port_config_handle(unifi_priv_t *priv, unsigned char *address, int queue, u16 interfaceTag)
328{
329 int i;
330 unifi_port_config_t *port;
331 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
332
333 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
334 unifi_error(priv, "uf_sme_port_config_handle: bad interfaceTag\n");
335 return NULL;
336 }
337
338 if (queue == UF_CONTROLLED_PORT_Q) {
339 port = &interfacePriv->controlled_data_port;
340 } else {
341 port = &interfacePriv->uncontrolled_data_port;
342 }
343
344 if (!port->entries_in_use) {
345 unifi_trace(priv, UDBG5, "No port configurations, return Discard.\n");
346 return NULL;
347 }
348
349 /* If the port configuration is common for all destinations, return it. */
350 if (port->overide_action == UF_DATA_PORT_OVERIDE) {
351 unifi_trace(priv, UDBG5, "Single port configuration (%d).\n",
352 port->port_cfg[0].port_action);
353 if (address) {
354 unifi_trace(priv, UDBG5, "addr[0] = %x, addr[1] = %x, addr[2] = %x, addr[3] = %x\n", address[0], address[1], address[2], address[3]);
355 }
356 return &port->port_cfg[0];
357 }
358
359 unifi_trace(priv, UDBG5, "Multiple port configurations.\n");
360
361 /* If multiple configurations exist.. */
362 for (i = 0; i < UNIFI_MAX_CONNECTIONS; i++) {
363 /* .. go through the list and match the destination address. */
364 if (port->port_cfg[i].in_use &&
365 memcmp(address, port->port_cfg[i].mac_address.a, ETH_ALEN) == 0) {
366 /* Return the desired action. */
367 return &port->port_cfg[i];
368 }
369 }
370
371 /* Could not find any information, return Open. */
372 unifi_trace(priv, UDBG5, "port configuration not found, returning NULL (debug).\n");
373 return NULL;
374} /* uf_sme_port_config_handle */
375
376void
377uf_multicast_list_wq(struct work_struct *work)
378{
379 unifi_priv_t *priv = container_of(work, unifi_priv_t,
380 multicast_list_task);
381 int i;
382 u16 interfaceTag = 0;
383 CsrWifiMacAddress* multicast_address_list = NULL;
384 int mc_count;
385 u8 *mc_list;
386 netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
387
388 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
389 unifi_error(priv, "uf_multicast_list_wq: bad interfaceTag\n");
390 return;
391 }
392
393 unifi_trace(priv, UDBG5,
394 "uf_multicast_list_wq: list count = %d\n",
395 interfacePriv->mc_list_count);
396
397 /* Flush the current list */
398 CsrWifiRouterCtrlMulticastAddressIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, CSR_WIFI_SME_LIST_ACTION_FLUSH, 0, NULL);
399
400 mc_count = interfacePriv->mc_list_count;
401 mc_list = interfacePriv->mc_list;
402 /*
403 * Allocate a new list, need to free it later
404 * in unifi_mgt_multicast_address_cfm().
405 */
406 multicast_address_list = kmalloc(mc_count * sizeof(CsrWifiMacAddress), GFP_KERNEL);
407
408 if (multicast_address_list == NULL) {
409 return;
410 }
411
412 for (i = 0; i < mc_count; i++) {
413 memcpy(multicast_address_list[i].a, mc_list, ETH_ALEN);
414 mc_list += ETH_ALEN;
415 }
416
417 if (priv->smepriv == NULL) {
418 kfree(multicast_address_list);
419 return;
420 }
421
422 CsrWifiRouterCtrlMulticastAddressIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0,
423 interfaceTag,
424 CSR_WIFI_SME_LIST_ACTION_ADD,
425 mc_count, multicast_address_list);
426
427 /* The SME will take a copy of the addreses*/
428 kfree(multicast_address_list);
429}
430
431
432int unifi_cfg_power(unifi_priv_t *priv, unsigned char *arg)
433{
434 unifi_cfg_power_t cfg_power;
435 int rc;
436 int wol;
437
438 if (get_user(cfg_power, (unifi_cfg_power_t*)(((unifi_cfg_command_t*)arg) + 1))) {
439 unifi_error(priv, "UNIFI_CFG: Failed to get the argument\n");
440 return -EFAULT;
441 }
442
443 switch (cfg_power) {
444 case UNIFI_CFG_POWER_OFF:
445 priv->wol_suspend = (enable_wol == UNIFI_WOL_OFF) ? FALSE : TRUE;
446 rc = sme_sys_suspend(priv);
447 if (rc) {
448 return rc;
449 }
450 break;
451 case UNIFI_CFG_POWER_ON:
452 wol = priv->wol_suspend;
453 rc = sme_sys_resume(priv);
454 if (rc) {
455 return rc;
456 }
457 if (wol) {
458 /* Kick the BH to ensure pending transfers are handled when
459 * a suspend happened with card powered.
460 */
461 unifi_send_signal(priv->card, NULL, 0, NULL);
462 }
463 break;
464 default:
465 unifi_error(priv, "WIFI POWER: Unknown value.\n");
466 return -EINVAL;
467 }
468
469 return 0;
470}
471
472
473int unifi_cfg_power_save(unifi_priv_t *priv, unsigned char *arg)
474{
475 unifi_cfg_powersave_t cfg_power_save;
476 CsrWifiSmePowerConfig powerConfig;
477 int rc;
478
479 if (get_user(cfg_power_save, (unifi_cfg_powersave_t*)(((unifi_cfg_command_t*)arg) + 1))) {
480 unifi_error(priv, "UNIFI_CFG: Failed to get the argument\n");
481 return -EFAULT;
482 }
483
484 /* Get the coex info from the SME */
485 rc = sme_mgt_power_config_get(priv, &powerConfig);
486 if (rc) {
487 unifi_error(priv, "UNIFI_CFG: Get unifi_PowerConfigValue failed.\n");
488 return rc;
489 }
490
491 switch (cfg_power_save) {
492 case UNIFI_CFG_POWERSAVE_NONE:
493 powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_LOW;
494 break;
495 case UNIFI_CFG_POWERSAVE_FAST:
496 powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_MED;
497 break;
498 case UNIFI_CFG_POWERSAVE_FULL:
499 powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_HIGH;
500 break;
501 case UNIFI_CFG_POWERSAVE_AUTO:
502 powerConfig.powerSaveLevel = CSR_WIFI_SME_POWER_SAVE_LEVEL_AUTO;
503 break;
504 default:
505 unifi_error(priv, "POWERSAVE: Unknown value.\n");
506 return -EINVAL;
507 }
508
509 rc = sme_mgt_power_config_set(priv, &powerConfig);
510
511 if (rc) {
512 unifi_error(priv, "UNIFI_CFG: Set unifi_PowerConfigValue failed.\n");
513 }
514
515 return rc;
516}
517
518
519int unifi_cfg_power_supply(unifi_priv_t *priv, unsigned char *arg)
520{
521 unifi_cfg_powersupply_t cfg_power_supply;
522 CsrWifiSmeHostConfig hostConfig;
523 int rc;
524
525 if (get_user(cfg_power_supply, (unifi_cfg_powersupply_t*)(((unifi_cfg_command_t*)arg) + 1))) {
526 unifi_error(priv, "UNIFI_CFG: Failed to get the argument\n");
527 return -EFAULT;
528 }
529
530 /* Get the coex info from the SME */
531 rc = sme_mgt_host_config_get(priv, &hostConfig);
532 if (rc) {
533 unifi_error(priv, "UNIFI_CFG: Get unifi_HostConfigValue failed.\n");
534 return rc;
535 }
536
537 switch (cfg_power_supply) {
538 case UNIFI_CFG_POWERSUPPLY_MAINS:
539 hostConfig.powerMode = CSR_WIFI_SME_HOST_POWER_MODE_ACTIVE;
540 break;
541 case UNIFI_CFG_POWERSUPPLY_BATTERIES:
542 hostConfig.powerMode = CSR_WIFI_SME_HOST_POWER_MODE_POWER_SAVE;
543 break;
544 default:
545 unifi_error(priv, "POWERSUPPLY: Unknown value.\n");
546 return -EINVAL;
547 }
548
549 rc = sme_mgt_host_config_set(priv, &hostConfig);
550 if (rc) {
551 unifi_error(priv, "UNIFI_CFG: Set unifi_HostConfigValue failed.\n");
552 }
553
554 return rc;
555}
556
557
558int unifi_cfg_packet_filters(unifi_priv_t *priv, unsigned char *arg)
559{
560 unsigned char *tclas_buffer;
561 unsigned int tclas_buffer_length;
562 tclas_t *dhcp_tclas;
563 int rc;
564
565 /* Free any TCLASs previously allocated */
566 if (priv->packet_filters.tclas_ies_length) {
567 kfree(priv->filter_tclas_ies);
568 priv->filter_tclas_ies = NULL;
569 }
570
571 tclas_buffer = ((unsigned char*)arg) + sizeof(unifi_cfg_command_t) + sizeof(unsigned int);
572 if (copy_from_user(&priv->packet_filters, (void*)tclas_buffer,
573 sizeof(uf_cfg_bcast_packet_filter_t))) {
574 unifi_error(priv, "UNIFI_CFG: Failed to get the filter struct\n");
575 return -EFAULT;
576 }
577
578 tclas_buffer_length = priv->packet_filters.tclas_ies_length;
579
580 /* Allocate TCLASs if necessary */
581 if (priv->packet_filters.dhcp_filter) {
582 priv->packet_filters.tclas_ies_length += sizeof(tclas_t);
583 }
584 if (priv->packet_filters.tclas_ies_length > 0) {
585 priv->filter_tclas_ies = kmalloc(priv->packet_filters.tclas_ies_length, GFP_KERNEL);
586 if (priv->filter_tclas_ies == NULL) {
587 return -ENOMEM;
588 }
589 if (tclas_buffer_length) {
590 tclas_buffer += sizeof(uf_cfg_bcast_packet_filter_t) - sizeof(unsigned char*);
591 if (copy_from_user(priv->filter_tclas_ies,
592 tclas_buffer,
593 tclas_buffer_length)) {
594 unifi_error(priv, "UNIFI_CFG: Failed to get the TCLAS buffer\n");
595 return -EFAULT;
596 }
597 }
598 }
599
600 if(priv->packet_filters.dhcp_filter)
601 {
602 /* Append the DHCP tclas IE */
603 dhcp_tclas = (tclas_t*)(priv->filter_tclas_ies + tclas_buffer_length);
604 memset(dhcp_tclas, 0, sizeof(tclas_t));
605 dhcp_tclas->element_id = 14;
606 dhcp_tclas->length = sizeof(tcpip_clsfr_t) + 1;
607 dhcp_tclas->user_priority = 0;
608 dhcp_tclas->tcp_ip_cls_fr.cls_fr_type = 1;
609 dhcp_tclas->tcp_ip_cls_fr.version = 4;
610 ((u8*)(&dhcp_tclas->tcp_ip_cls_fr.source_port))[0] = 0x00;
611 ((u8*)(&dhcp_tclas->tcp_ip_cls_fr.source_port))[1] = 0x44;
612 ((u8*)(&dhcp_tclas->tcp_ip_cls_fr.dest_port))[0] = 0x00;
613 ((u8*)(&dhcp_tclas->tcp_ip_cls_fr.dest_port))[1] = 0x43;
614 dhcp_tclas->tcp_ip_cls_fr.protocol = 0x11;
615 dhcp_tclas->tcp_ip_cls_fr.cls_fr_mask = 0x58; //bits: 3,4,6
616 }
617
618 rc = sme_mgt_packet_filter_set(priv);
619
620 return rc;
621}
622
623
624int unifi_cfg_wmm_qos_info(unifi_priv_t *priv, unsigned char *arg)
625{
626 u8 wmm_qos_info;
627 int rc = 0;
628
629 if (get_user(wmm_qos_info, (u8*)(((unifi_cfg_command_t*)arg) + 1))) {
630 unifi_error(priv, "UNIFI_CFG: Failed to get the argument\n");
631 return -EFAULT;
632 }
633
634 /* Store the value in the connection info */
635 priv->connection_config.wmmQosInfo = wmm_qos_info;
636
637 return rc;
638}
639
640
641int unifi_cfg_wmm_addts(unifi_priv_t *priv, unsigned char *arg)
642{
643 u32 addts_tid;
644 u8 addts_ie_length;
645 u8 *addts_ie;
646 u8 *addts_params;
647 CsrWifiSmeDataBlock tspec;
648 CsrWifiSmeDataBlock tclas;
649 int rc;
650
651 addts_params = (u8*)(((unifi_cfg_command_t*)arg) + 1);
652 if (get_user(addts_tid, (u32*)addts_params)) {
653 unifi_error(priv, "unifi_cfg_wmm_addts: Failed to get the argument\n");
654 return -EFAULT;
655 }
656
657 addts_params += sizeof(u32);
658 if (get_user(addts_ie_length, (u8*)addts_params)) {
659 unifi_error(priv, "unifi_cfg_wmm_addts: Failed to get the argument\n");
660 return -EFAULT;
661 }
662
663 unifi_trace(priv, UDBG4, "addts: tid = 0x%x ie_length = %d\n",
664 addts_tid, addts_ie_length);
665
666 addts_ie = kmalloc(addts_ie_length, GFP_KERNEL);
667 if (addts_ie == NULL) {
668 unifi_error(priv,
669 "unifi_cfg_wmm_addts: Failed to malloc %d bytes for addts_ie buffer\n",
670 addts_ie_length);
671 return -ENOMEM;
672 }
673
674 addts_params += sizeof(u8);
675 rc = copy_from_user(addts_ie, addts_params, addts_ie_length);
676 if (rc) {
677 unifi_error(priv, "unifi_cfg_wmm_addts: Failed to get the addts buffer\n");
678 kfree(addts_ie);
679 return -EFAULT;
680 }
681
682 tspec.data = addts_ie;
683 tspec.length = addts_ie_length;
684 tclas.data = NULL;
685 tclas.length = 0;
686
687 rc = sme_mgt_tspec(priv, CSR_WIFI_SME_LIST_ACTION_ADD, addts_tid,
688 &tspec, &tclas);
689
690 kfree(addts_ie);
691 return rc;
692}
693
694
695int unifi_cfg_wmm_delts(unifi_priv_t *priv, unsigned char *arg)
696{
697 u32 delts_tid;
698 u8 *delts_params;
699 CsrWifiSmeDataBlock tspec;
700 CsrWifiSmeDataBlock tclas;
701 int rc;
702
703 delts_params = (u8*)(((unifi_cfg_command_t*)arg) + 1);
704 if (get_user(delts_tid, (u32*)delts_params)) {
705 unifi_error(priv, "unifi_cfg_wmm_delts: Failed to get the argument\n");
706 return -EFAULT;
707 }
708
709 unifi_trace(priv, UDBG4, "delts: tid = 0x%x\n", delts_tid);
710
711 tspec.data = tclas.data = NULL;
712 tspec.length = tclas.length = 0;
713
714 rc = sme_mgt_tspec(priv, CSR_WIFI_SME_LIST_ACTION_REMOVE, delts_tid,
715 &tspec, &tclas);
716
717 return rc;
718}
719
720int unifi_cfg_strict_draft_n(unifi_priv_t *priv, unsigned char *arg)
721{
722 u8 strict_draft_n;
723 u8 *strict_draft_n_params;
724 int rc;
725
726 CsrWifiSmeStaConfig staConfig;
727 CsrWifiSmeDeviceConfig deviceConfig;
728
729 strict_draft_n_params = (u8*)(((unifi_cfg_command_t*)arg) + 1);
730 if (get_user(strict_draft_n, (u8*)strict_draft_n_params)) {
731 unifi_error(priv, "unifi_cfg_strict_draft_n: Failed to get the argument\n");
732 return -EFAULT;
733 }
734
735 unifi_trace(priv, UDBG4, "strict_draft_n: = %s\n", ((strict_draft_n) ? "yes":"no"));
736
737 rc = sme_mgt_sme_config_get(priv, &staConfig, &deviceConfig);
738
739 if (rc) {
740 unifi_warning(priv, "unifi_cfg_strict_draft_n: Get unifi_SMEConfigValue failed.\n");
741 return -EFAULT;
742 }
743
744 deviceConfig.enableStrictDraftN = strict_draft_n;
745
746 rc = sme_mgt_sme_config_set(priv, &staConfig, &deviceConfig);
747 if (rc) {
748 unifi_warning(priv, "unifi_cfg_strict_draft_n: Set unifi_SMEConfigValue failed.\n");
749 rc = -EFAULT;
750 }
751
752 return rc;
753}
754
755
756int unifi_cfg_enable_okc(unifi_priv_t *priv, unsigned char *arg)
757{
758 u8 enable_okc;
759 u8 *enable_okc_params;
760 int rc;
761
762 CsrWifiSmeStaConfig staConfig;
763 CsrWifiSmeDeviceConfig deviceConfig;
764
765 enable_okc_params = (u8*)(((unifi_cfg_command_t*)arg) + 1);
766 if (get_user(enable_okc, (u8*)enable_okc_params)) {
767 unifi_error(priv, "unifi_cfg_enable_okc: Failed to get the argument\n");
768 return -EFAULT;
769 }
770
771 unifi_trace(priv, UDBG4, "enable_okc: = %s\n", ((enable_okc) ? "yes":"no"));
772
773 rc = sme_mgt_sme_config_get(priv, &staConfig, &deviceConfig);
774 if (rc) {
775 unifi_warning(priv, "unifi_cfg_enable_okc: Get unifi_SMEConfigValue failed.\n");
776 return -EFAULT;
777 }
778
779 staConfig.enableOpportunisticKeyCaching = enable_okc;
780
781 rc = sme_mgt_sme_config_set(priv, &staConfig, &deviceConfig);
782 if (rc) {
783 unifi_warning(priv, "unifi_cfg_enable_okc: Set unifi_SMEConfigValue failed.\n");
784 rc = -EFAULT;
785 }
786
787 return rc;
788}
789
790
791int unifi_cfg_get_info(unifi_priv_t *priv, unsigned char *arg)
792{
793 unifi_cfg_get_t get_cmd;
794 char inst_name[IFNAMSIZ];
795 int rc;
796
797 if (get_user(get_cmd, (unifi_cfg_get_t*)(((unifi_cfg_command_t*)arg) + 1))) {
798 unifi_error(priv, "UNIFI_CFG: Failed to get the argument\n");
799 return -EFAULT;
800 }
801
802 switch (get_cmd) {
803 case UNIFI_CFG_GET_COEX:
804 {
805 CsrWifiSmeCoexInfo coexInfo;
806 /* Get the coex info from the SME */
807 rc = sme_mgt_coex_info_get(priv, &coexInfo);
808 if (rc) {
809 unifi_error(priv, "UNIFI_CFG: Get unifi_CoexInfoValue failed.\n");
810 return rc;
811 }
812
813 /* Copy the info to the out buffer */
814 if (copy_to_user((void*)arg,
815 &coexInfo,
816 sizeof(CsrWifiSmeCoexInfo))) {
817 unifi_error(priv, "UNIFI_CFG: Failed to copy the coex info\n");
818 return -EFAULT;
819 }
820 break;
821 }
822 case UNIFI_CFG_GET_POWER_MODE:
823 {
824 CsrWifiSmePowerConfig powerConfig;
825 rc = sme_mgt_power_config_get(priv, &powerConfig);
826 if (rc) {
827 unifi_error(priv, "UNIFI_CFG: Get unifi_PowerConfigValue failed.\n");
828 return rc;
829 }
830
831 /* Copy the info to the out buffer */
832 if (copy_to_user((void*)arg,
833 &powerConfig.powerSaveLevel,
834 sizeof(CsrWifiSmePowerSaveLevel))) {
835 unifi_error(priv, "UNIFI_CFG: Failed to copy the power save info\n");
836 return -EFAULT;
837 }
838 break;
839 }
840 case UNIFI_CFG_GET_POWER_SUPPLY:
841 {
842 CsrWifiSmeHostConfig hostConfig;
843 rc = sme_mgt_host_config_get(priv, &hostConfig);
844 if (rc) {
845 unifi_error(priv, "UNIFI_CFG: Get unifi_HostConfigValue failed.\n");
846 return rc;
847 }
848
849 /* Copy the info to the out buffer */
850 if (copy_to_user((void*)arg,
851 &hostConfig.powerMode,
852 sizeof(CsrWifiSmeHostPowerMode))) {
853 unifi_error(priv, "UNIFI_CFG: Failed to copy the host power mode\n");
854 return -EFAULT;
855 }
856 break;
857 }
858 case UNIFI_CFG_GET_VERSIONS:
859 break;
860 case UNIFI_CFG_GET_INSTANCE:
861 {
862 u16 InterfaceId=0;
863 uf_net_get_name(priv->netdev[InterfaceId], &inst_name[0], sizeof(inst_name));
864
865 /* Copy the info to the out buffer */
866 if (copy_to_user((void*)arg,
867 &inst_name[0],
868 sizeof(inst_name))) {
869 unifi_error(priv, "UNIFI_CFG: Failed to copy the instance name\n");
870 return -EFAULT;
871 }
872 }
873 break;
874
875 case UNIFI_CFG_GET_AP_CONFIG:
876 {
877#ifdef CSR_SUPPORT_WEXT_AP
878 uf_cfg_ap_config_t cfg_ap_config;
879
880 memset(&cfg_ap_config, 0, sizeof(cfg_ap_config));
881 cfg_ap_config.channel = priv->ap_config.channel;
882 cfg_ap_config.beaconInterval = priv->ap_mac_config.beaconInterval;
883 cfg_ap_config.wmmEnabled = priv->ap_mac_config.wmmEnabled;
884 cfg_ap_config.dtimPeriod = priv->ap_mac_config.dtimPeriod;
885 cfg_ap_config.phySupportedBitmap = priv->ap_mac_config.phySupportedBitmap;
886 if (copy_to_user((void*)arg,
887 &cfg_ap_config,
888 sizeof(uf_cfg_ap_config_t))) {
889 unifi_error(priv, "UNIFI_CFG: Failed to copy the AP configuration\n");
890 return -EFAULT;
891 }
892#else
893 return -EPERM;
894#endif
895 }
896 break;
897
898
899 default:
900 unifi_error(priv, "unifi_cfg_get_info: Unknown value.\n");
901 return -EINVAL;
902 }
903
904 return 0;
905}
906#ifdef CSR_SUPPORT_WEXT_AP
907int
908 uf_configure_supported_rates(u8 * supportedRates, u8 phySupportedBitmap)
909{
910 int i=0;
911 u8 b=FALSE, g = FALSE, n = FALSE;
912 b = phySupportedBitmap & CSR_WIFI_SME_AP_PHY_SUPPORT_B;
913 n = phySupportedBitmap & CSR_WIFI_SME_AP_PHY_SUPPORT_N;
914 g = phySupportedBitmap & CSR_WIFI_SME_AP_PHY_SUPPORT_G;
915 if(b || g) {
916 supportedRates[i++]=0x82;
917 supportedRates[i++]=0x84;
918 supportedRates[i++]=0x8b;
919 supportedRates[i++]=0x96;
920 } else if(n) {
921 /* For some strange reasons WiFi stack needs both b and g rates*/
922 supportedRates[i++]=0x02;
923 supportedRates[i++]=0x04;
924 supportedRates[i++]=0x0b;
925 supportedRates[i++]=0x16;
926 supportedRates[i++]=0x0c;
927 supportedRates[i++]=0x12;
928 supportedRates[i++]=0x18;
929 supportedRates[i++]=0x24;
930 supportedRates[i++]=0x30;
931 supportedRates[i++]=0x48;
932 supportedRates[i++]=0x60;
933 supportedRates[i++]=0x6c;
934 }
935 if(g) {
936 if(!b) {
937 supportedRates[i++]=0x8c;
938 supportedRates[i++]=0x98;
939 supportedRates[i++]=0xb0;
940 } else {
941 supportedRates[i++]=0x0c;
942 supportedRates[i++]=0x18;
943 supportedRates[i++]=0x30;
944 }
945 supportedRates[i++]=0x48;
946 supportedRates[i++]=0x12;
947 supportedRates[i++]=0x24;
948 supportedRates[i++]=0x60;
949 supportedRates[i++]=0x6c;
950 }
951 return i;
952}
953int unifi_cfg_set_ap_config(unifi_priv_t * priv, unsigned char* arg)
954{
955 uf_cfg_ap_config_t cfg_ap_config;
956 char *buffer;
957
958 buffer = ((unsigned char*)arg) + sizeof(unifi_cfg_command_t) + sizeof(unsigned int);
959 if (copy_from_user(&cfg_ap_config, (void*)buffer,
960 sizeof(uf_cfg_ap_config_t))) {
961 unifi_error(priv, "UNIFI_CFG: Failed to get the ap config struct\n");
962 return -EFAULT;
963 }
964 priv->ap_config.channel = cfg_ap_config.channel;
965 priv->ap_mac_config.dtimPeriod = cfg_ap_config.dtimPeriod;
966 priv->ap_mac_config.beaconInterval = cfg_ap_config.beaconInterval;
967 priv->group_sec_config.apGroupkeyTimeout = cfg_ap_config.groupkeyTimeout;
968 priv->group_sec_config.apStrictGtkRekey = cfg_ap_config.strictGtkRekeyEnabled;
969 priv->group_sec_config.apGmkTimeout = cfg_ap_config.gmkTimeout;
970 priv->group_sec_config.apResponseTimeout = cfg_ap_config.responseTimeout;
971 priv->group_sec_config.apRetransLimit = cfg_ap_config.retransLimit;
972
973 priv->ap_mac_config.shortSlotTimeEnabled = cfg_ap_config.shortSlotTimeEnabled;
974 priv->ap_mac_config.ctsProtectionType=cfg_ap_config.ctsProtectionType;
975
976 priv->ap_mac_config.wmmEnabled = cfg_ap_config.wmmEnabled;
977
978 priv->ap_mac_config.apHtParams.rxStbc=cfg_ap_config.rxStbc;
979 priv->ap_mac_config.apHtParams.rifsModeAllowed=cfg_ap_config.rifsModeAllowed;
980
981 priv->ap_mac_config.phySupportedBitmap = cfg_ap_config.phySupportedBitmap;
982 priv->ap_mac_config.maxListenInterval=cfg_ap_config.maxListenInterval;
983
984 priv->ap_mac_config.supportedRatesCount= uf_configure_supported_rates(priv->ap_mac_config.supportedRates, priv->ap_mac_config.phySupportedBitmap);
985
986 return 0;
987}
988
989#endif
990#ifdef CSR_SUPPORT_WEXT
991
992 void
993uf_sme_config_wq(struct work_struct *work)
994{
995 CsrWifiSmeStaConfig staConfig;
996 CsrWifiSmeDeviceConfig deviceConfig;
997 unifi_priv_t *priv = container_of(work, unifi_priv_t, sme_config_task);
998
999 /* Register to receive indications from the SME */
1000 CsrWifiSmeEventMaskSetReqSend(0,
1001 CSR_WIFI_SME_INDICATIONS_WIFIOFF | CSR_WIFI_SME_INDICATIONS_CONNECTIONQUALITY |
1002 CSR_WIFI_SME_INDICATIONS_MEDIASTATUS | CSR_WIFI_SME_INDICATIONS_MICFAILURE);
1003
1004 if (sme_mgt_sme_config_get(priv, &staConfig, &deviceConfig)) {
1005 unifi_warning(priv, "uf_sme_config_wq: Get unifi_SMEConfigValue failed.\n");
1006 return;
1007 }
1008
1009 if (priv->if_index == CSR_INDEX_5G) {
1010 staConfig.ifIndex = CSR_WIFI_SME_RADIO_IF_GHZ_5_0;
1011 } else {
1012 staConfig.ifIndex = CSR_WIFI_SME_RADIO_IF_GHZ_2_4;
1013 }
1014
1015 deviceConfig.trustLevel = (CsrWifiSme80211dTrustLevel)tl_80211d;
1016 if (sme_mgt_sme_config_set(priv, &staConfig, &deviceConfig)) {
1017 unifi_warning(priv,
1018 "SME config for 802.11d Trust Level and Radio Band failed.\n");
1019 return;
1020 }
1021
1022} /* uf_sme_config_wq() */
1023
1024#endif /* CSR_SUPPORT_WEXT */
1025
1026
1027/*
1028 * ---------------------------------------------------------------------------
1029 * uf_ta_ind_wq
1030 *
1031 * Deferred work queue function to send Traffic Analysis protocols
1032 * indications to the SME.
1033 * These are done in a deferred work queue for two reasons:
1034 * - the CsrWifiRouterCtrl...Send() functions are not safe for atomic context
1035 * - we want to load the main driver data path as lightly as possible
1036 *
1037 * The TA classifications already come from a workqueue.
1038 *
1039 * Arguments:
1040 * work Pointer to work queue item.
1041 *
1042 * Returns:
1043 * None.
1044 * ---------------------------------------------------------------------------
1045 */
1046 void
1047uf_ta_ind_wq(struct work_struct *work)
1048{
1049 struct ta_ind *ind = container_of(work, struct ta_ind, task);
1050 unifi_priv_t *priv = container_of(ind, unifi_priv_t, ta_ind_work);
1051 u16 interfaceTag = 0;
1052
1053
1054 CsrWifiRouterCtrlTrafficProtocolIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0,
1055 interfaceTag,
1056 ind->packet_type,
1057 ind->direction,
1058 ind->src_addr);
1059 ind->in_use = 0;
1060
1061} /* uf_ta_ind_wq() */
1062
1063
1064/*
1065 * ---------------------------------------------------------------------------
1066 * uf_ta_sample_ind_wq
1067 *
1068 * Deferred work queue function to send Traffic Analysis sample
1069 * indications to the SME.
1070 * These are done in a deferred work queue for two reasons:
1071 * - the CsrWifiRouterCtrl...Send() functions are not safe for atomic context
1072 * - we want to load the main driver data path as lightly as possible
1073 *
1074 * The TA classifications already come from a workqueue.
1075 *
1076 * Arguments:
1077 * work Pointer to work queue item.
1078 *
1079 * Returns:
1080 * None.
1081 * ---------------------------------------------------------------------------
1082 */
1083 void
1084uf_ta_sample_ind_wq(struct work_struct *work)
1085{
1086 struct ta_sample_ind *ind = container_of(work, struct ta_sample_ind, task);
1087 unifi_priv_t *priv = container_of(ind, unifi_priv_t, ta_sample_ind_work);
1088 u16 interfaceTag = 0;
1089
1090 unifi_trace(priv, UDBG5, "rxtcp %d txtcp %d rxudp %d txudp %d prio %d\n",
1091 priv->rxTcpThroughput,
1092 priv->txTcpThroughput,
1093 priv->rxUdpThroughput,
1094 priv->txUdpThroughput,
1095 priv->bh_thread.prio);
1096
1097 if(priv->rxTcpThroughput > 1000)
1098 {
1099 if (bh_priority == -1 && priv->bh_thread.prio != 1)
1100 {
1101 struct sched_param param;
1102 priv->bh_thread.prio = 1;
1103 unifi_trace(priv, UDBG1, "%s new thread (RT) priority = %d\n",
1104 priv->bh_thread.name, priv->bh_thread.prio);
1105 param.sched_priority = priv->bh_thread.prio;
1106 sched_setscheduler(priv->bh_thread.thread_task, SCHED_FIFO, &param);
1107 }
1108 } else
1109 {
1110 if (bh_priority == -1 && priv->bh_thread.prio != DEFAULT_PRIO)
1111 {
1112 struct sched_param param;
1113 param.sched_priority = 0;
1114 sched_setscheduler(priv->bh_thread.thread_task, SCHED_NORMAL, &param);
1115 priv->bh_thread.prio = DEFAULT_PRIO;
1116 unifi_trace(priv, UDBG1, "%s new thread priority = %d\n",
1117 priv->bh_thread.name, priv->bh_thread.prio);
1118 set_user_nice(priv->bh_thread.thread_task, PRIO_TO_NICE(priv->bh_thread.prio));
1119 }
1120 }
1121
1122 CsrWifiRouterCtrlTrafficSampleIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, ind->stats);
1123
1124 ind->in_use = 0;
1125
1126} /* uf_ta_sample_ind_wq() */
1127
1128
1129/*
1130 * ---------------------------------------------------------------------------
1131 * uf_send_m4_ready_wq
1132 *
1133 * Deferred work queue function to send M4 ReadyToSend inds to the SME.
1134 * These are done in a deferred work queue for two reasons:
1135 * - the CsrWifiRouterCtrl...Send() functions are not safe for atomic context
1136 * - we want to load the main driver data path as lightly as possible
1137 *
1138 * Arguments:
1139 * work Pointer to work queue item.
1140 *
1141 * Returns:
1142 * None.
1143 * ---------------------------------------------------------------------------
1144 */
1145void
1146uf_send_m4_ready_wq(struct work_struct *work)
1147{
1148 netInterface_priv_t *InterfacePriv = container_of(work, netInterface_priv_t, send_m4_ready_task);
1149 u16 iface = InterfacePriv->InterfaceTag;
1150 unifi_priv_t *priv = InterfacePriv->privPtr;
1151 CSR_MA_PACKET_REQUEST *req = &InterfacePriv->m4_signal.u.MaPacketRequest;
1152 CsrWifiMacAddress peer;
1153 unsigned long flags;
1154
1155 /* The peer address was stored in the signal */
1156 spin_lock_irqsave(&priv->m4_lock, flags);
1157 memcpy(peer.a, req->Ra.x, sizeof(peer.a));
1158 spin_unlock_irqrestore(&priv->m4_lock, flags);
1159
1160 /* Send a signal to SME */
1161 CsrWifiRouterCtrlM4ReadyToSendIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, iface, peer);
1162
1163 unifi_trace(priv, UDBG1, "M4ReadyToSendInd sent for peer %pMF\n",
1164 peer.a);
1165
1166} /* uf_send_m4_ready_wq() */
1167
1168#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION))
1169/*
1170 * ---------------------------------------------------------------------------
1171 * uf_send_pkt_to_encrypt
1172 *
1173 * Deferred work queue function to send the WAPI data pkts to SME when unicast KeyId = 1
1174 * These are done in a deferred work queue for two reasons:
1175 * - the CsrWifiRouterCtrl...Send() functions are not safe for atomic context
1176 * - we want to load the main driver data path as lightly as possible
1177 *
1178 * Arguments:
1179 * work Pointer to work queue item.
1180 *
1181 * Returns:
1182 * None.
1183 * ---------------------------------------------------------------------------
1184 */
1185void uf_send_pkt_to_encrypt(struct work_struct *work)
1186{
1187 netInterface_priv_t *interfacePriv = container_of(work, netInterface_priv_t, send_pkt_to_encrypt);
1188 u16 interfaceTag = interfacePriv->InterfaceTag;
1189 unifi_priv_t *priv = interfacePriv->privPtr;
1190
1191 u32 pktBulkDataLength;
1192 u8 *pktBulkData;
1193 unsigned long flags;
1194
1195 if (interfacePriv->interfaceMode == CSR_WIFI_ROUTER_CTRL_MODE_STA) {
1196
1197 pktBulkDataLength = interfacePriv->wapi_unicast_bulk_data.data_length;
1198
1199 if (pktBulkDataLength > 0) {
1200 pktBulkData = kmalloc(pktBulkDataLength, GFP_KERNEL);
1201 } else {
1202 unifi_error(priv, "uf_send_pkt_to_encrypt() : invalid buffer\n");
1203 return;
1204 }
1205
1206 spin_lock_irqsave(&priv->wapi_lock, flags);
1207 /* Copy over the MA PKT REQ bulk data */
1208 memcpy(pktBulkData, (u8*)interfacePriv->wapi_unicast_bulk_data.os_data_ptr, pktBulkDataLength);
1209 /* Free any bulk data buffers allocated for the WAPI Data pkt */
1210 unifi_net_data_free(priv, &interfacePriv->wapi_unicast_bulk_data);
1211 interfacePriv->wapi_unicast_bulk_data.net_buf_length = 0;
1212 interfacePriv->wapi_unicast_bulk_data.data_length = 0;
1213 interfacePriv->wapi_unicast_bulk_data.os_data_ptr = interfacePriv->wapi_unicast_bulk_data.os_net_buf_ptr = NULL;
1214 spin_unlock_irqrestore(&priv->wapi_lock, flags);
1215
1216 CsrWifiRouterCtrlWapiUnicastTxEncryptIndSend(priv->CSR_WIFI_SME_IFACEQUEUE, 0, interfaceTag, pktBulkDataLength, pktBulkData);
1217 unifi_trace(priv, UDBG1, "WapiUnicastTxEncryptInd sent to SME\n");
1218
1219 kfree(pktBulkData); /* Would have been copied over by the SME Handler */
1220
1221 } else {
1222 unifi_warning(priv, "uf_send_pkt_to_encrypt() is NOT applicable for interface mode - %d\n", interfacePriv->interfaceMode);
1223 }
1224}/* uf_send_pkt_to_encrypt() */
1225#endif
diff --git a/drivers/staging/csr/unifi_sme.h b/drivers/staging/csr/unifi_sme.h
deleted file mode 100644
index aff9aa178124..000000000000
--- a/drivers/staging/csr/unifi_sme.h
+++ /dev/null
@@ -1,245 +0,0 @@
1/*
2 * ***************************************************************************
3 * FILE: unifi_sme.h
4 *
5 * PURPOSE: SME related definitions.
6 *
7 * Copyright (C) 2007-2011 by Cambridge Silicon Radio Ltd.
8 *
9 * Refer to LICENSE.txt included with this source code for details on
10 * the license terms.
11 *
12 * ***************************************************************************
13 */
14#ifndef __LINUX_UNIFI_SME_H__
15#define __LINUX_UNIFI_SME_H__ 1
16
17#include <linux/kernel.h>
18
19#ifdef CSR_SME_USERSPACE
20#include "sme_userspace.h"
21#endif
22
23#include "csr_wifi_sme_lib.h"
24
25typedef int unifi_data_port_action;
26
27typedef struct unifi_port_cfg
28{
29 /* TRUE if this port entry is allocated */
30 u8 in_use;
31 CsrWifiRouterCtrlPortAction port_action;
32 CsrWifiMacAddress mac_address;
33} unifi_port_cfg_t;
34
35#define UNIFI_MAX_CONNECTIONS 8
36#define UNIFI_MAX_RETRY_LIMIT 5
37#define UF_DATA_PORT_NOT_OVERIDE 0
38#define UF_DATA_PORT_OVERIDE 1
39
40typedef struct unifi_port_config
41{
42 int entries_in_use;
43 int overide_action;
44 unifi_port_cfg_t port_cfg[UNIFI_MAX_CONNECTIONS];
45} unifi_port_config_t;
46
47
48enum sme_request_status {
49 SME_REQUEST_EMPTY,
50 SME_REQUEST_PENDING,
51 SME_REQUEST_RECEIVED,
52 SME_REQUEST_TIMEDOUT,
53 SME_REQUEST_CANCELLED,
54};
55
56/* Structure to hold a UDI logged signal */
57typedef struct {
58
59 /* The current status of the request */
60 enum sme_request_status request_status;
61
62 /* The status the SME has passed to us */
63 CsrResult reply_status;
64
65 /* SME's reply to a get request */
66 CsrWifiSmeVersions versions;
67 CsrWifiSmePowerConfig powerConfig;
68 CsrWifiSmeHostConfig hostConfig;
69 CsrWifiSmeStaConfig staConfig;
70 CsrWifiSmeDeviceConfig deviceConfig;
71 CsrWifiSmeCoexInfo coexInfo;
72 CsrWifiSmeCoexConfig coexConfig;
73 CsrWifiSmeMibConfig mibConfig;
74 CsrWifiSmeConnectionInfo connectionInfo;
75 CsrWifiSmeConnectionConfig connectionConfig;
76 CsrWifiSmeConnectionStats connectionStats;
77
78
79 /* SME's reply to a scan request */
80 u16 reply_scan_results_count;
81 CsrWifiSmeScanResult* reply_scan_results;
82
83} sme_reply_t;
84
85
86typedef struct {
87 u16 appHandle;
88 CsrWifiRouterEncapsulation encapsulation;
89 u16 protocol;
90 u8 oui[3];
91 u8 in_use;
92} sme_ma_unidata_ind_filter_t;
93
94
95CsrWifiRouterCtrlPortAction uf_sme_port_state(unifi_priv_t *priv,
96 unsigned char *address,
97 int queue,
98 u16 interfaceTag);
99unifi_port_cfg_t *uf_sme_port_config_handle(unifi_priv_t *priv,
100 unsigned char *address,
101 int queue,
102 u16 interfaceTag);
103
104
105
106/* Callback for event logging to SME clients */
107void sme_log_event(ul_client_t *client, const u8 *signal, int signal_len,
108 const bulk_data_param_t *bulkdata, int dir);
109
110/* The workqueue task to the set the multicast addresses list */
111void uf_multicast_list_wq(struct work_struct *work);
112
113/* The workqueue task to execute the TA module */
114void uf_ta_wq(struct work_struct *work);
115
116
117/*
118 * SME blocking helper functions
119 */
120#ifdef UNIFI_DEBUG
121# define sme_complete_request(priv, status) uf_sme_complete_request(priv, status, __func__)
122#else
123# define sme_complete_request(priv, status) uf_sme_complete_request(priv, status, NULL)
124#endif
125
126void uf_sme_complete_request(unifi_priv_t *priv, CsrResult reply_status, const char *func);
127void uf_sme_cancel_request(unifi_priv_t *priv, CsrResult reply_status);
128
129
130/*
131 * Blocking functions using the SME SYS API.
132 */
133int sme_sys_suspend(unifi_priv_t *priv);
134int sme_sys_resume(unifi_priv_t *priv);
135
136
137/*
138 * Traffic Analysis workqueue jobs
139 */
140void uf_ta_ind_wq(struct work_struct *work);
141void uf_ta_sample_ind_wq(struct work_struct *work);
142
143/*
144 * SME config workqueue job
145 */
146void uf_sme_config_wq(struct work_struct *work);
147
148/*
149 * To send M4 read to send IND
150 */
151void uf_send_m4_ready_wq(struct work_struct *work);
152
153#if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION))
154/*
155 * To send data pkt to Sme for encryption
156 */
157void uf_send_pkt_to_encrypt(struct work_struct *work);
158#endif
159
160int sme_mgt_power_config_set(unifi_priv_t *priv, CsrWifiSmePowerConfig *powerConfig);
161int sme_mgt_power_config_get(unifi_priv_t *priv, CsrWifiSmePowerConfig *powerConfig);
162int sme_mgt_host_config_set(unifi_priv_t *priv, CsrWifiSmeHostConfig *hostConfig);
163int sme_mgt_host_config_get(unifi_priv_t *priv, CsrWifiSmeHostConfig *hostConfig);
164int sme_mgt_sme_config_set(unifi_priv_t *priv, CsrWifiSmeStaConfig *staConfig, CsrWifiSmeDeviceConfig *deviceConfig);
165int sme_mgt_sme_config_get(unifi_priv_t *priv, CsrWifiSmeStaConfig *staConfig, CsrWifiSmeDeviceConfig *deviceConfig);
166int sme_mgt_coex_info_get(unifi_priv_t *priv, CsrWifiSmeCoexInfo *coexInfo);
167int sme_mgt_packet_filter_set(unifi_priv_t *priv);
168int sme_mgt_tspec(unifi_priv_t *priv, CsrWifiSmeListAction action,
169 u32 tid, CsrWifiSmeDataBlock *tspec, CsrWifiSmeDataBlock *tclas);
170
171#ifdef CSR_SUPPORT_WEXT
172/*
173 * Blocking functions using the SME MGT API.
174 */
175int sme_mgt_wifi_on(unifi_priv_t *priv);
176int sme_mgt_wifi_off(unifi_priv_t *priv);
177/*int sme_mgt_set_value_async(unifi_priv_t *priv, unifi_AppValue *app_value);
178int sme_mgt_get_value_async(unifi_priv_t *priv, unifi_AppValue *app_value);
179int sme_mgt_get_value(unifi_priv_t *priv, unifi_AppValue *app_value);
180int sme_mgt_set_value(unifi_priv_t *priv, unifi_AppValue *app_value);
181*/
182int sme_mgt_coex_config_set(unifi_priv_t *priv, CsrWifiSmeCoexConfig *coexConfig);
183int sme_mgt_coex_config_get(unifi_priv_t *priv, CsrWifiSmeCoexConfig *coexConfig);
184int sme_mgt_mib_config_set(unifi_priv_t *priv, CsrWifiSmeMibConfig *mibConfig);
185int sme_mgt_mib_config_get(unifi_priv_t *priv, CsrWifiSmeMibConfig *mibConfig);
186
187int sme_mgt_connection_info_set(unifi_priv_t *priv, CsrWifiSmeConnectionInfo *connectionInfo);
188int sme_mgt_connection_info_get(unifi_priv_t *priv, CsrWifiSmeConnectionInfo *connectionInfo);
189int sme_mgt_connection_config_set(unifi_priv_t *priv, CsrWifiSmeConnectionConfig *connectionConfig);
190int sme_mgt_connection_config_get(unifi_priv_t *priv, CsrWifiSmeConnectionConfig *connectionConfig);
191int sme_mgt_connection_stats_get(unifi_priv_t *priv, CsrWifiSmeConnectionStats *connectionStats);
192
193int sme_mgt_versions_get(unifi_priv_t *priv, CsrWifiSmeVersions *versions);
194
195
196int sme_mgt_scan_full(unifi_priv_t *priv, CsrWifiSsid *specific_ssid,
197 int num_channels, unsigned char *channel_list);
198int sme_mgt_scan_results_get_async(unifi_priv_t *priv,
199 struct iw_request_info *info,
200 char *scan_results,
201 long scan_results_len);
202int sme_mgt_disconnect(unifi_priv_t *priv);
203int sme_mgt_connect(unifi_priv_t *priv);
204int sme_mgt_key(unifi_priv_t *priv, CsrWifiSmeKey *sme_key,
205 CsrWifiSmeListAction action);
206int sme_mgt_pmkid(unifi_priv_t *priv, CsrWifiSmeListAction action,
207 CsrWifiSmePmkidList *pmkid_list);
208int sme_mgt_mib_get(unifi_priv_t *priv,
209 unsigned char *varbind, int *length);
210int sme_mgt_mib_set(unifi_priv_t *priv,
211 unsigned char *varbind, int length);
212#ifdef CSR_SUPPORT_WEXT_AP
213int sme_ap_start(unifi_priv_t *priv, u16 interface_tag, CsrWifiSmeApConfig_t *ap_config);
214int sme_ap_stop(unifi_priv_t *priv, u16 interface_tag);
215int sme_ap_config(unifi_priv_t *priv, CsrWifiSmeApMacConfig *ap_mac_config, CsrWifiNmeApConfig *group_security_config);
216int uf_configure_supported_rates(u8 * supportedRates, u8 phySupportedBitmap);
217#endif
218int unifi_translate_scan(struct net_device *dev,
219 struct iw_request_info *info,
220 char *current_ev, char *end_buf,
221 CsrWifiSmeScanResult *scan_data,
222 int scan_index);
223
224#endif /* CSR_SUPPORT_WEXT */
225
226int unifi_cfg_power(unifi_priv_t *priv, unsigned char *arg);
227int unifi_cfg_power_save(unifi_priv_t *priv, unsigned char *arg);
228int unifi_cfg_power_supply(unifi_priv_t *priv, unsigned char *arg);
229int unifi_cfg_packet_filters(unifi_priv_t *priv, unsigned char *arg);
230int unifi_cfg_wmm_qos_info(unifi_priv_t *priv, unsigned char *arg);
231int unifi_cfg_wmm_addts(unifi_priv_t *priv, unsigned char *arg);
232int unifi_cfg_wmm_delts(unifi_priv_t *priv, unsigned char *arg);
233int unifi_cfg_get_info(unifi_priv_t *priv, unsigned char *arg);
234int unifi_cfg_strict_draft_n(unifi_priv_t *priv, unsigned char *arg);
235int unifi_cfg_enable_okc(unifi_priv_t *priv, unsigned char *arg);
236#ifdef CSR_SUPPORT_WEXT_AP
237int unifi_cfg_set_ap_config(unifi_priv_t * priv, unsigned char* arg);
238#endif
239
240
241
242int convert_sme_error(CsrResult error);
243
244
245#endif /* __LINUX_UNIFI_SME_H__ */
diff --git a/drivers/staging/csr/unifi_wext.h b/drivers/staging/csr/unifi_wext.h
deleted file mode 100644
index beba089e2e35..000000000000
--- a/drivers/staging/csr/unifi_wext.h
+++ /dev/null
@@ -1,108 +0,0 @@
1/*
2 *****************************************************************************
3 *
4 * FILE : unifi_wext.h
5 *
6 * PURPOSE : Private header file for unifi driver support to wireless extensions.
7 *
8 * Copyright (C) 2005-2008 by Cambridge Silicon Radio Ltd.
9 *
10 * Refer to LICENSE.txt included with this source code for details on
11 * the license terms.
12 *
13*****************************************************************************
14 */
15#ifndef __LINUX_UNIFI_WEXT_H__
16#define __LINUX_UNIFI_WEXT_H__ 1
17
18#include <linux/kernel.h>
19#include <net/iw_handler.h>
20#include "csr_wifi_sme_prim.h"
21
22/*
23 * wext.c
24 */
25/* A few details needed for WEP (Wireless Equivalent Privacy) */
26#define UNIFI_MAX_KEY_SIZE 16
27#define NUM_WEPKEYS 4
28#define SMALL_KEY_SIZE 5
29#define LARGE_KEY_SIZE 13
30typedef struct wep_key_t {
31 int len;
32 unsigned char key[UNIFI_MAX_KEY_SIZE]; /* 40-bit and 104-bit keys */
33} wep_key_t;
34
35#define UNIFI_SCAN_ACTIVE 0
36#define UNIFI_SCAN_PASSIVE 1
37#define UNIFI_MAX_SSID_LEN 32
38
39#define MAX_WPA_IE_LEN 64
40#define MAX_RSN_IE_LEN 255
41
42/*
43 * Function to register in the netdev to report wireless stats.
44 */
45struct iw_statistics *unifi_get_wireless_stats(struct net_device *dev);
46
47void uf_sme_wext_set_defaults(unifi_priv_t *priv);
48
49
50/*
51 * wext_events.c
52 */
53/* Functions to generate Wireless Extension events */
54void wext_send_scan_results_event(unifi_priv_t *priv);
55void wext_send_assoc_event(unifi_priv_t *priv, unsigned char *bssid,
56 unsigned char *req_ie, int req_ie_len,
57 unsigned char *resp_ie, int resp_ie_len,
58 unsigned char *scan_ie, unsigned int scan_ie_len);
59void wext_send_disassoc_event(unifi_priv_t *priv);
60void wext_send_michaelmicfailure_event(unifi_priv_t *priv,
61 u16 count, CsrWifiMacAddress address,
62 CsrWifiSmeKeyType keyType, u16 interfaceTag);
63void wext_send_pmkid_candidate_event(unifi_priv_t *priv, CsrWifiMacAddress bssid, u8 preauth_allowed, u16 interfaceTag);
64void wext_send_started_event(unifi_priv_t *priv);
65
66
67static inline int
68uf_iwe_stream_add_point(struct iw_request_info *info, char *start, char *stop,
69 struct iw_event *piwe, char *extra)
70{
71 char *new_start;
72
73 new_start = iwe_stream_add_point(info, start, stop, piwe, extra);
74 if (unlikely(new_start == start))
75 return -E2BIG;
76
77 return (new_start - start);
78}
79
80
81static inline int
82uf_iwe_stream_add_event(struct iw_request_info *info, char *start, char *stop,
83 struct iw_event *piwe, int len)
84{
85 char *new_start;
86
87 new_start = iwe_stream_add_event(info, start, stop, piwe, len);
88 if (unlikely(new_start == start))
89 return -E2BIG;
90
91 return (new_start - start);
92}
93
94static inline int
95uf_iwe_stream_add_value(struct iw_request_info *info, char *stream, char *start,
96 char *stop, struct iw_event *piwe, int len)
97{
98 char *new_start;
99
100 new_start = iwe_stream_add_value(info, stream, start, stop, piwe, len);
101 if (unlikely(new_start == start))
102 return -E2BIG;
103
104 return (new_start - start);
105}
106
107
108#endif /* __LINUX_UNIFI_WEXT_H__ */
diff --git a/drivers/staging/csr/unifiio.h b/drivers/staging/csr/unifiio.h
deleted file mode 100644
index b9de0cb94e9a..000000000000
--- a/drivers/staging/csr/unifiio.h
+++ /dev/null
@@ -1,398 +0,0 @@
1/*
2 * ---------------------------------------------------------------------------
3 *
4 * FILE: unifiio.h
5 *
6 * Public definitions for the UniFi linux driver.
7 * This is mostly ioctl command values and structs.
8 *
9 * Include <sys/ioctl.h> or similar before this file
10 *
11 * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd.
12 *
13 * Refer to LICENSE.txt included with this source code for details on
14 * the license terms.
15 *
16 * ---------------------------------------------------------------------------
17 */
18#ifndef __UNIFIIO_H__
19#define __UNIFIIO_H__
20
21#include <linux/types.h>
22
23#define UNIFI_GET_UDI_ENABLE _IOR('u', 1, int)
24#define UNIFI_SET_UDI_ENABLE _IOW('u', 2, int)
25/* Values for UDI_ENABLE */
26#define UDI_ENABLE_DATA 0x1
27#define UDI_ENABLE_CONTROL 0x2
28
29/* MIB set/get. Arg is a pointer to a varbind */
30#define UNIFI_GET_MIB _IOWR('u', 3, unsigned char *)
31#define UNIFI_SET_MIB _IOW ('u', 4, unsigned char *)
32#define MAX_VARBIND_LENGTH 127
33
34/* Private IOCTLs */
35#define SIOCIWS80211POWERSAVEPRIV SIOCIWFIRSTPRIV
36#define SIOCIWG80211POWERSAVEPRIV SIOCIWFIRSTPRIV + 1
37#define SIOCIWS80211RELOADDEFAULTSPRIV SIOCIWFIRSTPRIV + 2
38#define SIOCIWSCONFWAPIPRIV SIOCIWFIRSTPRIV + 4
39#define SIOCIWSWAPIKEYPRIV SIOCIWFIRSTPRIV + 6
40#define SIOCIWSSMEDEBUGPRIV SIOCIWFIRSTPRIV + 8
41#define SIOCIWSAPCFGPRIV SIOCIWFIRSTPRIV + 10
42#define SIOCIWSAPSTARTPRIV SIOCIWFIRSTPRIV + 12
43#define SIOCIWSAPSTOPPRIV SIOCIWFIRSTPRIV + 14
44#define SIOCIWSFWRELOADPRIV SIOCIWFIRSTPRIV + 16
45#define SIOCIWSSTACKSTART SIOCIWFIRSTPRIV + 18
46#define SIOCIWSSTACKSTOP SIOCIWFIRSTPRIV + 20
47
48
49
50#define IWPRIV_POWER_SAVE_MAX_STRING 32
51#define IWPRIV_SME_DEBUG_MAX_STRING 32
52#define IWPRIV_SME_MAX_STRING 120
53
54
55/* Private configuration commands */
56#define UNIFI_CFG _IOWR('u', 5, unsigned char *)
57/*
58 * <------------------ Read/Write Buffer -------------------->
59 * _____________________________________________________________
60 * | Cmd | Arg | ... Buffer (opt) ... |
61 * -------------------------------------------------------------
62 * <-- uint --><-- uint --><----- unsigned char buffer ------>
63 *
64 * Cmd: A unifi_cfg_command_t command.
65 * Arg: Out:Length if Cmd==UNIFI_CFG_GET
66 * In:PowerOnOff if Cmd==UNIFI_CFG_POWER
67 * In:PowerMode if Cmd==UNIFI_CFG_POWERSAVE
68 * In:Length if Cmd==UNIFI_CFG_FILTER
69 * In:WMM Qos Info if Cmd==UNIFI_CFG_WMM_QOS_INFO
70 * Buffer: Out:Data if Cmd==UNIFI_CFG_GET
71 * NULL if Cmd==UNIFI_CFG_POWER
72 * NULL if Cmd==UNIFI_CFG_POWERSAVE
73 * In:Filters if Cmd==UNIFI_CFG_FILTER
74 *
75 * where Filters is a uf_cfg_bcast_packet_filter_t structure
76 * followed by 0 - n tclas_t structures. The length of the tclas_t
77 * structures is obtained by uf_cfg_bcast_packet_filter_t::tclas_ies_length.
78 */
79
80
81#define UNIFI_PUTEST _IOWR('u', 6, unsigned char *)
82/*
83 * <------------------ Read/Write Buffer -------------------->
84 * _____________________________________________________________
85 * | Cmd | Arg | ... Buffer (opt) ... |
86 * -------------------------------------------------------------
87 * <-- uint --><-- uint --><----- unsigned char buffer ------>
88 *
89 * Cmd: A unifi_putest_command_t command.
90 * Arg: N/A if Cmd==UNIFI_PUTEST_START
91 * N/A if Cmd==UNIFI_PUTEST_STOP
92 * In:int (Clock Speed) if Cmd==UNIFI_PUTEST_SET_SDIO_CLOCK
93 * In/Out:sizeof(unifi_putest_cmd52) if Cmd==UNIFI_PUTEST_CMD52_READ
94 * In:sizeof(unifi_putest_cmd52) if Cmd==UNIFI_PUTEST_CMD52_WRITE
95 * In:uint (f/w file name length) if Cmd==UNIFI_PUTEST_DL_FW
96 * Buffer: NULL if Cmd==UNIFI_PUTEST_START
97 * NULL if Cmd==UNIFI_PUTEST_STOP
98 * NULL if Cmd==UNIFI_PUTEST_SET_SDIO_CLOCK
99 * In/Out:unifi_putest_cmd52 if Cmd==UNIFI_PUTEST_CMD52_READ
100 * In:unifi_putest_cmd52 if Cmd==UNIFI_PUTEST_CMD52_WRITE
101 * In:f/w file name if Cmd==UNIFI_PUTEST_DL_FW
102 */
103
104#define UNIFI_BUILD_TYPE _IOWR('u', 7, unsigned char)
105#define UNIFI_BUILD_NME 1
106#define UNIFI_BUILD_WEXT 2
107#define UNIFI_BUILD_AP 3
108
109/* debugging */
110#define UNIFI_KICK _IO ('u', 0x10)
111#define UNIFI_SET_DEBUG _IO ('u', 0x11)
112#define UNIFI_SET_TRACE _IO ('u', 0x12)
113
114#define UNIFI_GET_INIT_STATUS _IOR ('u', 0x15, int)
115#define UNIFI_SET_UDI_LOG_MASK _IOR('u', 0x18, unifiio_filter_t)
116#define UNIFI_SET_UDI_SNAP_MASK _IOW('u', 0x1a, unifiio_snap_filter_t)
117#define UNIFI_SET_AMP_ENABLE _IOWR('u', 0x1b, int)
118
119#define UNIFI_INIT_HW _IOR ('u', 0x13, unsigned char)
120#define UNIFI_INIT_NETDEV _IOW ('u', 0x14, unsigned char[6])
121#define UNIFI_SME_PRESENT _IOW ('u', 0x19, int)
122
123#define UNIFI_CFG_PERIOD_TRAFFIC _IOW ('u', 0x21, unsigned char *)
124#define UNIFI_CFG_UAPSD_TRAFFIC _IOW ('u', 0x22, unsigned char)
125
126#define UNIFI_COREDUMP_GET_REG _IOWR('u', 0x23, unifiio_coredump_req_t)
127
128
129/*
130 * Following reset, f/w may only be downloaded using CMD52.
131 * This is slow, so there is a facility to download a secondary
132 * loader first which supports CMD53.
133 * If loader_len is > 0, then loader_data is assumed to point to
134 * a suitable secondary loader that can be used to download the
135 * main image.
136 *
137 * The driver will run the host protocol initialisation sequence
138 * after downloading the image.
139 *
140 * If both lengths are zero, then the f/w is assumed to have been
141 * booted from Flash and the host protocol initialisation sequence
142 * is run.
143 */
144typedef struct {
145
146 /* Number of bytes in the image */
147 int img_len;
148
149 /* Pointer to image data. */
150 unsigned char *img_data;
151
152
153 /* Number of bytes in the loader image */
154 int loader_len;
155
156 /* Pointer to loader image data. */
157 unsigned char *loader_data;
158
159} unifiio_img_t;
160
161
162/* Structure of data read from the unifi device. */
163typedef struct
164{
165 /* Length (in bytes) of entire structure including appended bulk data */
166 int length;
167
168 /* System time (in milliseconds) that signal was transferred */
169 int timestamp;
170
171 /* Direction in which signal was transferred. */
172 int direction;
173#define UDI_FROM_HOST 0
174#define UDI_TO_HOST 1
175#define UDI_CONFIG_IND 2
176
177 /* The length of the signal (in bytes) not including bulk data */
178 int signal_length;
179
180 /* Signal body follows, then any bulk data */
181
182} udi_msg_t;
183
184
185typedef enum
186{
187 UfSigFil_AllOn = 0, /* Log all signal IDs */
188 UfSigFil_AllOff = 1, /* Don't log any signal IDs */
189 UfSigFil_SelectOn = 2, /* Log these signal IDs */
190 UfSigFil_SelectOff = 3 /* Don't log these signal IDs */
191} uf_sigfilter_action_t;
192
193typedef struct {
194
195 /* Number of 16-bit ints in the sig_ids array */
196 int num_sig_ids;
197 /* The action to perform */
198 uf_sigfilter_action_t action;
199 /* List of signal IDs to pass or block */
200 unsigned short *sig_ids;
201
202} unifiio_filter_t;
203
204
205typedef struct {
206 /* Number of 16-bit ints in the protocols array */
207 u16 count;
208 /* List of protocol ids to pass */
209 u16 *protocols;
210} unifiio_snap_filter_t;
211
212
213
214typedef u8 unifi_putest_command_t;
215
216#define UNIFI_PUTEST_START 0
217#define UNIFI_PUTEST_STOP 1
218#define UNIFI_PUTEST_SET_SDIO_CLOCK 2
219#define UNIFI_PUTEST_CMD52_READ 3
220#define UNIFI_PUTEST_CMD52_WRITE 4
221#define UNIFI_PUTEST_DL_FW 5
222#define UNIFI_PUTEST_DL_FW_BUFF 6
223#define UNIFI_PUTEST_CMD52_BLOCK_READ 7
224#define UNIFI_PUTEST_COREDUMP_PREPARE 8
225#define UNIFI_PUTEST_GP_READ16 9
226#define UNIFI_PUTEST_GP_WRITE16 10
227
228
229struct unifi_putest_cmd52 {
230 int funcnum;
231 unsigned long addr;
232 unsigned char data;
233};
234
235
236struct unifi_putest_block_cmd52_r {
237 int funcnum;
238 unsigned long addr;
239 unsigned int length;
240 unsigned char *data;
241};
242
243struct unifi_putest_gp_rw16 {
244 unsigned long addr; /* generic address */
245 unsigned short data;
246};
247
248typedef enum unifi_cfg_command {
249 UNIFI_CFG_GET,
250 UNIFI_CFG_POWER,
251 UNIFI_CFG_POWERSAVE,
252 UNIFI_CFG_FILTER,
253 UNIFI_CFG_POWERSUPPLY,
254 UNIFI_CFG_WMM_QOSINFO,
255 UNIFI_CFG_WMM_ADDTS,
256 UNIFI_CFG_WMM_DELTS,
257 UNIFI_CFG_STRICT_DRAFT_N,
258 UNIFI_CFG_ENABLE_OKC,
259 UNIFI_CFG_SET_AP_CONFIG,
260 UNIFI_CFG_CORE_DUMP /* request to take a fw core dump */
261} unifi_cfg_command_t;
262
263typedef enum unifi_cfg_power {
264 UNIFI_CFG_POWER_UNSPECIFIED,
265 UNIFI_CFG_POWER_OFF,
266 UNIFI_CFG_POWER_ON
267} unifi_cfg_power_t;
268
269typedef enum unifi_cfg_powersupply {
270 UNIFI_CFG_POWERSUPPLY_UNSPECIFIED,
271 UNIFI_CFG_POWERSUPPLY_MAINS,
272 UNIFI_CFG_POWERSUPPLY_BATTERIES
273} unifi_cfg_powersupply_t;
274
275typedef enum unifi_cfg_powersave {
276 UNIFI_CFG_POWERSAVE_UNSPECIFIED,
277 UNIFI_CFG_POWERSAVE_NONE,
278 UNIFI_CFG_POWERSAVE_FAST,
279 UNIFI_CFG_POWERSAVE_FULL,
280 UNIFI_CFG_POWERSAVE_AUTO
281} unifi_cfg_powersave_t;
282
283typedef enum unifi_cfg_get {
284 UNIFI_CFG_GET_COEX,
285 UNIFI_CFG_GET_POWER_MODE,
286 UNIFI_CFG_GET_VERSIONS,
287 UNIFI_CFG_GET_POWER_SUPPLY,
288 UNIFI_CFG_GET_INSTANCE,
289 UNIFI_CFG_GET_AP_CONFIG
290} unifi_cfg_get_t;
291
292#define UNIFI_CFG_FILTER_NONE 0x0000
293#define UNIFI_CFG_FILTER_DHCP 0x0001
294#define UNIFI_CFG_FILTER_ARP 0x0002
295#define UNIFI_CFG_FILTER_NBNS 0x0004
296#define UNIFI_CFG_FILTER_NBDS 0x0008
297#define UNIFI_CFG_FILTER_CUPS 0x0010
298#define UNIFI_CFG_FILTER_ALL 0xFFFF
299
300
301typedef struct uf_cfg_bcast_packet_filter
302{
303 unsigned long filter_mode; //as defined by HIP protocol
304 unsigned char arp_filter;
305 unsigned char dhcp_filter;
306 unsigned long tclas_ies_length; // length of tclas_ies in bytes
307 unsigned char tclas_ies[1]; // variable length depending on above field
308} uf_cfg_bcast_packet_filter_t;
309
310typedef struct uf_cfg_ap_config
311{
312 u8 phySupportedBitmap;
313 u8 channel;
314 u16 beaconInterval;
315 u8 dtimPeriod;
316 u8 wmmEnabled;
317 u8 shortSlotTimeEnabled;
318 u16 groupkeyTimeout;
319 u8 strictGtkRekeyEnabled;
320 u16 gmkTimeout;
321 u16 responseTimeout;
322 u8 retransLimit;
323 u8 rxStbc;
324 u8 rifsModeAllowed;
325 u8 dualCtsProtection;
326 u8 ctsProtectionType;
327 u16 maxListenInterval;
328}uf_cfg_ap_config_t;
329
330typedef struct tcpic_clsfr
331{
332 __u8 cls_fr_type;
333 __u8 cls_fr_mask;
334 __u8 version;
335 __u8 source_ip_addr[4];
336 __u8 dest_ip_addr[4];
337 __u16 source_port;
338 __u16 dest_port;
339 __u8 dscp;
340 __u8 protocol;
341 __u8 reserved;
342} __attribute__ ((packed)) tcpip_clsfr_t;
343
344typedef struct tclas {
345 __u8 element_id;
346 __u8 length;
347 __u8 user_priority;
348 tcpip_clsfr_t tcp_ip_cls_fr;
349} __attribute__ ((packed)) tclas_t;
350
351
352#define CONFIG_IND_ERROR 0x01
353#define CONFIG_IND_EXIT 0x02
354#define CONFIG_SME_NOT_PRESENT 0x10
355#define CONFIG_SME_PRESENT 0x20
356
357/* WAPI Key */
358typedef struct
359{
360 u8 unicastKey;
361 /* If non zero, then unicast key otherwise group key */
362 u8 keyIndex;
363 u8 keyRsc[16];
364 u8 authenticator;
365 /* If non zero, then authenticator otherwise supplicant */
366 u8 address[6];
367 u8 key[32];
368} unifiio_wapi_key_t;
369
370/* Values describing XAP memory regions captured by the mini-coredump system */
371typedef enum unifiio_coredump_space {
372 UNIFIIO_COREDUMP_MAC_REG,
373 UNIFIIO_COREDUMP_PHY_REG,
374 UNIFIIO_COREDUMP_SH_DMEM,
375 UNIFIIO_COREDUMP_MAC_DMEM,
376 UNIFIIO_COREDUMP_PHY_DMEM,
377 UNIFIIO_COREDUMP_TRIGGER_MAGIC = 0xFEED
378} unifiio_coredump_space_t;
379
380/* Userspace tool uses this structure to retrieve a register value from a
381 * mini-coredump buffer previously saved by the HIP
382 */
383typedef struct unifiio_coredump_req {
384 /* From user */
385 int index; /* 0=newest, -1=oldest */
386 unsigned int offset; /* register offset in space */
387 unifiio_coredump_space_t space; /* memory space */
388 /* Filled by driver */
389 unsigned int drv_build; /* driver build id */
390 unsigned int chip_ver; /* chip version */
391 unsigned int fw_ver; /* firmware version */
392 int requestor; /* requestor: 0=auto dump, 1=manual */
393 unsigned int timestamp; /* time of capture by driver */
394 unsigned int serial; /* capture serial number */
395 int value; /* 16 bit register value, -ve for error */
396} unifiio_coredump_req_t; /* Core-dumped register value request */
397
398#endif /* __UNIFIIO_H__ */
diff --git a/drivers/staging/csr/wext_events.c b/drivers/staging/csr/wext_events.c
deleted file mode 100644
index 9860ea30da25..000000000000
--- a/drivers/staging/csr/wext_events.c
+++ /dev/null
@@ -1,283 +0,0 @@
1/*
2 * ---------------------------------------------------------------------------
3 * FILE: wext_events.c
4 *
5 * PURPOSE:
6 * Code to generate iwevents.
7 *
8 * Copyright (C) 2006-2008 by Cambridge Silicon Radio Ltd.
9 *
10 * Refer to LICENSE.txt included with this source code for details on
11 * the license terms.
12 *
13 * ---------------------------------------------------------------------------
14 */
15#include <linux/types.h>
16#include <linux/etherdevice.h>
17#include <linux/if_arp.h>
18#include "csr_wifi_hip_unifi.h"
19#include "unifi_priv.h"
20
21
22
23/*
24 * ---------------------------------------------------------------------------
25 * wext_send_assoc_event
26 *
27 * Send wireless-extension events up to userland to announce
28 * successful association with an AP.
29 *
30 * Arguments:
31 * priv Pointer to driver context.
32 * bssid MAC address of AP we associated with
33 * req_ie, req_ie_len IEs in the original request
34 * resp_ie, resp_ie_len IEs in the response
35 *
36 * Returns:
37 * None.
38 *
39 * Notes:
40 * This is sent on first successful association, and again if we
41 * roam to another AP.
42 * ---------------------------------------------------------------------------
43 */
44void
45wext_send_assoc_event(unifi_priv_t *priv, unsigned char *bssid,
46 unsigned char *req_ie, int req_ie_len,
47 unsigned char *resp_ie, int resp_ie_len,
48 unsigned char *scan_ie, unsigned int scan_ie_len)
49{
50#if WIRELESS_EXT > 17
51 union iwreq_data wrqu;
52
53 if (req_ie_len == 0) req_ie = NULL;
54 wrqu.data.length = req_ie_len;
55 wrqu.data.flags = 0;
56 wireless_send_event(priv->netdev[CSR_WIFI_INTERFACE_IN_USE], IWEVASSOCREQIE, &wrqu, req_ie);
57
58 if (resp_ie_len == 0) resp_ie = NULL;
59 wrqu.data.length = resp_ie_len;
60 wrqu.data.flags = 0;
61 wireless_send_event(priv->netdev[CSR_WIFI_INTERFACE_IN_USE], IWEVASSOCRESPIE, &wrqu, resp_ie);
62
63 if (scan_ie_len > 0) {
64 wrqu.data.length = scan_ie_len;
65 wrqu.data.flags = 0;
66 wireless_send_event(priv->netdev[CSR_WIFI_INTERFACE_IN_USE], IWEVGENIE, &wrqu, scan_ie);
67 }
68
69 memcpy(&wrqu.ap_addr.sa_data, bssid, ETH_ALEN);
70 wireless_send_event(priv->netdev[CSR_WIFI_INTERFACE_IN_USE], SIOCGIWAP, &wrqu, NULL);
71#endif
72} /* wext_send_assoc_event() */
73
74
75
76/*
77 * ---------------------------------------------------------------------------
78 * wext_send_disassoc_event
79 *
80 * Send a wireless-extension event up to userland to announce
81 * that we disassociated from an AP.
82 *
83 * Arguments:
84 * priv Pointer to driver context.
85 *
86 * Returns:
87 * None.
88 *
89 * Notes:
90 * The semantics of wpa_supplicant (the userland SME application) are
91 * that a SIOCGIWAP event with MAC address of all zero means
92 * disassociate.
93 * ---------------------------------------------------------------------------
94 */
95void
96wext_send_disassoc_event(unifi_priv_t *priv)
97{
98#if WIRELESS_EXT > 17
99 union iwreq_data wrqu;
100
101 memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
102 wireless_send_event(priv->netdev[CSR_WIFI_INTERFACE_IN_USE], SIOCGIWAP, &wrqu, NULL);
103#endif
104} /* wext_send_disassoc_event() */
105
106
107
108/*
109 * ---------------------------------------------------------------------------
110 * wext_send_scan_results_event
111 *
112 * Send wireless-extension events up to userland to announce
113 * completion of a scan.
114 *
115 * Arguments:
116 * priv Pointer to driver context.
117 *
118 * Returns:
119 * None.
120 *
121 * Notes:
122 * This doesn't actually report the results, they are retrieved
123 * using the SIOCGIWSCAN ioctl command.
124 * ---------------------------------------------------------------------------
125 */
126void
127wext_send_scan_results_event(unifi_priv_t *priv)
128{
129#if WIRELESS_EXT > 17
130 union iwreq_data wrqu;
131
132 wrqu.data.length = 0;
133 wrqu.data.flags = 0;
134 wireless_send_event(priv->netdev[CSR_WIFI_INTERFACE_IN_USE], SIOCGIWSCAN, &wrqu, NULL);
135
136#endif
137} /* wext_send_scan_results_event() */
138
139
140
141/*
142 * ---------------------------------------------------------------------------
143 * wext_send_michaelmicfailure_event
144 *
145 * Send wireless-extension events up to userland to announce
146 * completion of a scan.
147 *
148 * Arguments:
149 * priv Pointer to driver context.
150 * count, macaddr, key_type, key_idx, tsc
151 * Parameters from report from UniFi.
152 *
153 * Returns:
154 * None.
155 * ---------------------------------------------------------------------------
156 */
157#if WIRELESS_EXT >= 18
158static inline void
159_send_michaelmicfailure_event(struct net_device *dev,
160 int count, const unsigned char *macaddr,
161 int key_type, int key_idx,
162 unsigned char *tsc)
163{
164 union iwreq_data wrqu;
165 struct iw_michaelmicfailure mmf;
166
167 memset(&mmf, 0, sizeof(mmf));
168
169 mmf.flags = key_idx & IW_MICFAILURE_KEY_ID;
170 if (key_type == CSR_GROUP) {
171 mmf.flags |= IW_MICFAILURE_GROUP;
172 } else {
173 mmf.flags |= IW_MICFAILURE_PAIRWISE;
174 }
175 mmf.flags |= ((count << 5) & IW_MICFAILURE_COUNT);
176
177 mmf.src_addr.sa_family = ARPHRD_ETHER;
178 memcpy(mmf.src_addr.sa_data, macaddr, ETH_ALEN);
179
180 memcpy(mmf.tsc, tsc, IW_ENCODE_SEQ_MAX_SIZE);
181
182 memset(&wrqu, 0, sizeof(wrqu));
183 wrqu.data.length = sizeof(mmf);
184
185 wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *)&mmf);
186}
187#elif WIRELESS_EXT >= 15
188static inline void
189_send_michaelmicfailure_event(struct net_device *dev,
190 int count, const unsigned char *macaddr,
191 int key_type, int key_idx,
192 unsigned char *tsc)
193{
194 union iwreq_data wrqu;
195 char buf[128];
196
197 sprintf(buf,
198 "MLME-MICHAELMICFAILURE.indication(keyid=%d %scast addr=%pM)",
199 key_idx, (key_type == CSR_GROUP) ? "broad" : "uni", macaddr);
200 memset(&wrqu, 0, sizeof(wrqu));
201 wrqu.data.length = strlen(buf);
202 wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
203}
204#else /* WIRELESS_EXT >= 15 */
205static inline void
206_send_michaelmicfailure_event(struct net_device *dev,
207 int count, const unsigned char *macaddr,
208 int key_type, int key_idx,
209 unsigned char *tsc)
210{
211 /* Not supported before WEXT 15 */
212}
213#endif /* WIRELESS_EXT >= 15 */
214
215
216void
217wext_send_michaelmicfailure_event(unifi_priv_t *priv,
218 u16 count,
219 CsrWifiMacAddress address,
220 CsrWifiSmeKeyType keyType,
221 u16 interfaceTag)
222{
223 unsigned char tsc[8] = {0};
224
225 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
226 unifi_error(priv, "wext_send_michaelmicfailure_event bad interfaceTag\n");
227 return;
228 }
229
230 _send_michaelmicfailure_event(priv->netdev[interfaceTag],
231 count,
232 address.a,
233 keyType,
234 0,
235 tsc);
236} /* wext_send_michaelmicfailure_event() */
237
238void
239wext_send_pmkid_candidate_event(unifi_priv_t *priv, CsrWifiMacAddress bssid, u8 preauth_allowed, u16 interfaceTag)
240{
241#if WIRELESS_EXT > 17
242 union iwreq_data wrqu;
243 struct iw_pmkid_cand pmkid_cand;
244
245 if (interfaceTag >= CSR_WIFI_NUM_INTERFACES) {
246 unifi_error(priv, "wext_send_pmkid_candidate_event bad interfaceTag\n");
247 return;
248 }
249
250 memset(&pmkid_cand, 0, sizeof(pmkid_cand));
251
252 if (preauth_allowed) {
253 pmkid_cand.flags |= IW_PMKID_CAND_PREAUTH;
254 }
255 pmkid_cand.bssid.sa_family = ARPHRD_ETHER;
256 memcpy(pmkid_cand.bssid.sa_data, bssid.a, ETH_ALEN);
257 /* Used as priority, smaller the number higher the priority, not really used in our case */
258 pmkid_cand.index = 1;
259
260 memset(&wrqu, 0, sizeof(wrqu));
261 wrqu.data.length = sizeof(pmkid_cand);
262
263 wireless_send_event(priv->netdev[interfaceTag], IWEVPMKIDCAND, &wrqu, (char *)&pmkid_cand);
264#endif
265} /* wext_send_pmkid_candidate_event() */
266
267/*
268 * Send a custom WEXT event to say we have completed initialisation
269 * and are now ready for WEXT ioctls. Used by Android wpa_supplicant.
270 */
271void
272wext_send_started_event(unifi_priv_t *priv)
273{
274#if WIRELESS_EXT > 17
275 union iwreq_data wrqu;
276 char data[] = "STARTED";
277
278 wrqu.data.length = sizeof(data);
279 wrqu.data.flags = 0;
280 wireless_send_event(priv->netdev[CSR_WIFI_INTERFACE_IN_USE], IWEVCUSTOM, &wrqu, data);
281#endif
282} /* wext_send_started_event() */
283