iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* This file is provided under a dual BSD/GPLv2 license. When using or
|
|
|
|
* redistributing this file, you may do so under either license.
|
|
|
|
*
|
|
|
|
* GPL LICENSE SUMMARY
|
|
|
|
*
|
2011-12-27 19:21:32 +00:00
|
|
|
* Copyright(c) 2010 - 2012 Intel Corporation. All rights reserved.
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of version 2 of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
|
|
|
|
* USA
|
|
|
|
*
|
|
|
|
* The full GNU General Public License is included in this distribution
|
|
|
|
* in the file called LICENSE.GPL.
|
|
|
|
*
|
|
|
|
* Contact Information:
|
|
|
|
* Intel Linux Wireless <ilw@linux.intel.com>
|
|
|
|
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
|
|
|
|
*
|
|
|
|
* BSD LICENSE
|
|
|
|
*
|
2011-12-27 19:21:32 +00:00
|
|
|
* Copyright(c) 2010 - 2012 Intel Corporation. All rights reserved.
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* * Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
* * Neither the name Intel Corporation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
2011-09-06 16:31:19 +00:00
|
|
|
#include <linux/dma-mapping.h>
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
#include <net/net_namespace.h>
|
|
|
|
#include <linux/netdevice.h>
|
|
|
|
#include <net/cfg80211.h>
|
|
|
|
#include <net/mac80211.h>
|
|
|
|
#include <net/netlink.h>
|
|
|
|
|
|
|
|
#include "iwl-dev.h"
|
|
|
|
#include "iwl-core.h"
|
|
|
|
#include "iwl-debug.h"
|
|
|
|
#include "iwl-io.h"
|
|
|
|
#include "iwl-agn.h"
|
|
|
|
#include "iwl-testmode.h"
|
2011-07-08 15:46:16 +00:00
|
|
|
#include "iwl-trans.h"
|
2012-01-25 07:19:24 +00:00
|
|
|
#include "iwl-fh.h"
|
2012-03-06 21:31:06 +00:00
|
|
|
#include "iwl-prph.h"
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
|
2012-01-25 11:30:27 +00:00
|
|
|
|
|
|
|
/* Periphery registers absolute lower bound. This is used in order to
|
|
|
|
* differentiate registery access through HBUS_TARG_PRPH_* and
|
|
|
|
* HBUS_TARG_MEM_* accesses.
|
|
|
|
*/
|
|
|
|
#define IWL_TM_ABS_PRPH_START (0xA00000)
|
|
|
|
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
/* The TLVs used in the gnl message policy between the kernel module and
|
|
|
|
* user space application. iwl_testmode_gnl_msg_policy is to be carried
|
|
|
|
* through the NL80211_CMD_TESTMODE channel regulated by nl80211.
|
|
|
|
* See iwl-testmode.h
|
|
|
|
*/
|
|
|
|
static
|
|
|
|
struct nla_policy iwl_testmode_gnl_msg_policy[IWL_TM_ATTR_MAX] = {
|
|
|
|
[IWL_TM_ATTR_COMMAND] = { .type = NLA_U32, },
|
|
|
|
|
|
|
|
[IWL_TM_ATTR_UCODE_CMD_ID] = { .type = NLA_U8, },
|
|
|
|
[IWL_TM_ATTR_UCODE_CMD_DATA] = { .type = NLA_UNSPEC, },
|
|
|
|
|
|
|
|
[IWL_TM_ATTR_REG_OFFSET] = { .type = NLA_U32, },
|
|
|
|
[IWL_TM_ATTR_REG_VALUE8] = { .type = NLA_U8, },
|
|
|
|
[IWL_TM_ATTR_REG_VALUE32] = { .type = NLA_U32, },
|
|
|
|
|
|
|
|
[IWL_TM_ATTR_SYNC_RSP] = { .type = NLA_UNSPEC, },
|
|
|
|
[IWL_TM_ATTR_UCODE_RX_PKT] = { .type = NLA_UNSPEC, },
|
2011-05-06 17:21:28 +00:00
|
|
|
|
2011-05-04 01:05:12 +00:00
|
|
|
[IWL_TM_ATTR_EEPROM] = { .type = NLA_UNSPEC, },
|
|
|
|
|
2011-05-06 17:21:28 +00:00
|
|
|
[IWL_TM_ATTR_TRACE_ADDR] = { .type = NLA_UNSPEC, },
|
2011-05-31 15:03:02 +00:00
|
|
|
[IWL_TM_ATTR_TRACE_DUMP] = { .type = NLA_UNSPEC, },
|
2011-05-30 17:29:37 +00:00
|
|
|
[IWL_TM_ATTR_TRACE_SIZE] = { .type = NLA_U32, },
|
2011-05-06 17:21:28 +00:00
|
|
|
|
2011-05-04 01:05:13 +00:00
|
|
|
[IWL_TM_ATTR_FIXRATE] = { .type = NLA_U32, },
|
2011-05-30 17:29:37 +00:00
|
|
|
|
2011-07-08 15:46:26 +00:00
|
|
|
[IWL_TM_ATTR_UCODE_OWNER] = { .type = NLA_U8, },
|
2011-11-23 07:03:39 +00:00
|
|
|
|
2012-01-25 11:30:27 +00:00
|
|
|
[IWL_TM_ATTR_MEM_ADDR] = { .type = NLA_U32, },
|
|
|
|
[IWL_TM_ATTR_BUFFER_SIZE] = { .type = NLA_U32, },
|
|
|
|
[IWL_TM_ATTR_BUFFER_DUMP] = { .type = NLA_UNSPEC, },
|
2011-11-28 08:55:38 +00:00
|
|
|
|
|
|
|
[IWL_TM_ATTR_FW_VERSION] = { .type = NLA_U32, },
|
2011-12-01 09:12:50 +00:00
|
|
|
[IWL_TM_ATTR_DEVICE_ID] = { .type = NLA_U32, },
|
2011-12-24 04:12:12 +00:00
|
|
|
[IWL_TM_ATTR_FW_TYPE] = { .type = NLA_U32, },
|
|
|
|
[IWL_TM_ATTR_FW_INST_SIZE] = { .type = NLA_U32, },
|
|
|
|
[IWL_TM_ATTR_FW_DATA_SIZE] = { .type = NLA_U32, },
|
2012-03-07 17:52:29 +00:00
|
|
|
|
|
|
|
[IWL_TM_ATTR_ENABLE_NOTIFICATION] = {.type = NLA_FLAG, },
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* See the struct iwl_rx_packet in iwl-commands.h for the format of the
|
|
|
|
* received events from the device
|
|
|
|
*/
|
2012-03-05 19:24:39 +00:00
|
|
|
static inline int get_event_length(struct iwl_rx_cmd_buffer *rxb)
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
{
|
|
|
|
struct iwl_rx_packet *pkt = rxb_addr(rxb);
|
|
|
|
if (pkt)
|
|
|
|
return le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function multicasts the spontaneous messages from the device to the
|
|
|
|
* user space. It is invoked whenever there is a received messages
|
|
|
|
* from the device. This function is called within the ISR of the rx handlers
|
|
|
|
* in iwlagn driver.
|
|
|
|
*
|
|
|
|
* The parsing of the message content is left to the user space application,
|
|
|
|
* The message content is treated as unattacked raw data and is encapsulated
|
|
|
|
* with IWL_TM_ATTR_UCODE_RX_PKT multicasting to the user space.
|
|
|
|
*
|
|
|
|
* @priv: the instance of iwlwifi device
|
|
|
|
* @rxb: pointer to rx data content received by the ISR
|
|
|
|
*
|
|
|
|
* See the message policies and TLVs in iwl_testmode_gnl_msg_policy[].
|
|
|
|
* For the messages multicasting to the user application, the mandatory
|
|
|
|
* TLV fields are :
|
|
|
|
* IWL_TM_ATTR_COMMAND must be IWL_TM_CMD_DEV2APP_UCODE_RX_PKT
|
|
|
|
* IWL_TM_ATTR_UCODE_RX_PKT for carrying the message content
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void iwl_testmode_ucode_rx_pkt(struct iwl_priv *priv,
|
2012-03-05 19:24:39 +00:00
|
|
|
struct iwl_rx_cmd_buffer *rxb)
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
{
|
|
|
|
struct ieee80211_hw *hw = priv->hw;
|
|
|
|
struct sk_buff *skb;
|
|
|
|
void *data;
|
|
|
|
int length;
|
|
|
|
|
|
|
|
data = (void *)rxb_addr(rxb);
|
|
|
|
length = get_event_length(rxb);
|
|
|
|
|
|
|
|
if (!data || length == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
skb = cfg80211_testmode_alloc_event_skb(hw->wiphy, 20 + length,
|
|
|
|
GFP_ATOMIC);
|
|
|
|
if (skb == NULL) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv,
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
"Run out of memory for messages to user space ?\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
NLA_PUT_U32(skb, IWL_TM_ATTR_COMMAND, IWL_TM_CMD_DEV2APP_UCODE_RX_PKT);
|
2012-03-07 17:52:30 +00:00
|
|
|
/* the length doesn't include len_n_flags field, so add it manually */
|
|
|
|
NLA_PUT(skb, IWL_TM_ATTR_UCODE_RX_PKT, length + sizeof(__le32), data);
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
cfg80211_testmode_event(skb, GFP_ATOMIC);
|
|
|
|
return;
|
|
|
|
|
|
|
|
nla_put_failure:
|
|
|
|
kfree_skb(skb);
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Ouch, overran buffer, check allocation!\n");
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void iwl_testmode_init(struct iwl_priv *priv)
|
|
|
|
{
|
2012-03-07 17:52:29 +00:00
|
|
|
priv->pre_rx_handler = NULL;
|
2011-05-06 17:21:28 +00:00
|
|
|
priv->testmode_trace.trace_enabled = false;
|
2012-01-25 11:30:27 +00:00
|
|
|
priv->testmode_mem.read_in_progress = false;
|
2011-11-23 07:03:39 +00:00
|
|
|
}
|
|
|
|
|
2012-01-25 11:30:27 +00:00
|
|
|
static void iwl_mem_cleanup(struct iwl_priv *priv)
|
2011-11-23 07:03:39 +00:00
|
|
|
{
|
2012-01-25 11:30:27 +00:00
|
|
|
if (priv->testmode_mem.read_in_progress) {
|
|
|
|
kfree(priv->testmode_mem.buff_addr);
|
|
|
|
priv->testmode_mem.buff_addr = NULL;
|
|
|
|
priv->testmode_mem.buff_size = 0;
|
|
|
|
priv->testmode_mem.num_chunks = 0;
|
|
|
|
priv->testmode_mem.read_in_progress = false;
|
2011-11-23 07:03:39 +00:00
|
|
|
}
|
2011-05-06 17:21:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void iwl_trace_cleanup(struct iwl_priv *priv)
|
|
|
|
{
|
|
|
|
if (priv->testmode_trace.trace_enabled) {
|
|
|
|
if (priv->testmode_trace.cpu_addr &&
|
|
|
|
priv->testmode_trace.dma_addr)
|
2012-01-03 14:56:15 +00:00
|
|
|
dma_free_coherent(trans(priv)->dev,
|
2011-05-30 17:29:37 +00:00
|
|
|
priv->testmode_trace.total_size,
|
2011-05-06 17:21:28 +00:00
|
|
|
priv->testmode_trace.cpu_addr,
|
|
|
|
priv->testmode_trace.dma_addr);
|
|
|
|
priv->testmode_trace.trace_enabled = false;
|
|
|
|
priv->testmode_trace.cpu_addr = NULL;
|
|
|
|
priv->testmode_trace.trace_addr = NULL;
|
|
|
|
priv->testmode_trace.dma_addr = 0;
|
2011-05-30 17:29:37 +00:00
|
|
|
priv->testmode_trace.buff_size = 0;
|
|
|
|
priv->testmode_trace.total_size = 0;
|
2011-05-06 17:21:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void iwl_testmode_cleanup(struct iwl_priv *priv)
|
|
|
|
{
|
|
|
|
iwl_trace_cleanup(priv);
|
2012-01-25 11:30:27 +00:00
|
|
|
iwl_mem_cleanup(priv);
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
}
|
|
|
|
|
2012-01-31 13:30:39 +00:00
|
|
|
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
/*
|
|
|
|
* This function handles the user application commands to the ucode.
|
|
|
|
*
|
|
|
|
* It retrieves the mandatory fields IWL_TM_ATTR_UCODE_CMD_ID and
|
|
|
|
* IWL_TM_ATTR_UCODE_CMD_DATA and calls to the handler to send the
|
|
|
|
* host command to the ucode.
|
|
|
|
*
|
|
|
|
* If any mandatory field is missing, -ENOMSG is replied to the user space
|
2012-01-31 13:30:39 +00:00
|
|
|
* application; otherwise, waits for the host command to be sent and checks
|
|
|
|
* the return code. In case or error, it is returned, otherwise a reply is
|
|
|
|
* allocated and the reply RX packet
|
|
|
|
* is returned.
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
*
|
|
|
|
* @hw: ieee80211_hw object that represents the device
|
|
|
|
* @tb: gnl message fields from the user space
|
|
|
|
*/
|
|
|
|
static int iwl_testmode_ucode(struct ieee80211_hw *hw, struct nlattr **tb)
|
|
|
|
{
|
2012-02-09 14:08:15 +00:00
|
|
|
struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
struct iwl_host_cmd cmd;
|
2012-01-31 13:30:39 +00:00
|
|
|
struct iwl_rx_packet *pkt;
|
|
|
|
struct sk_buff *skb;
|
|
|
|
void *reply_buf;
|
|
|
|
u32 reply_len;
|
|
|
|
int ret;
|
|
|
|
bool cmd_want_skb;
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
|
|
|
|
memset(&cmd, 0, sizeof(struct iwl_host_cmd));
|
|
|
|
|
|
|
|
if (!tb[IWL_TM_ATTR_UCODE_CMD_ID] ||
|
|
|
|
!tb[IWL_TM_ATTR_UCODE_CMD_DATA]) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Missing ucode command mandatory fields\n");
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
return -ENOMSG;
|
|
|
|
}
|
|
|
|
|
2012-01-31 13:30:39 +00:00
|
|
|
cmd.flags = CMD_ON_DEMAND | CMD_SYNC;
|
|
|
|
cmd_want_skb = nla_get_flag(tb[IWL_TM_ATTR_UCODE_CMD_SKB]);
|
|
|
|
if (cmd_want_skb)
|
|
|
|
cmd.flags |= CMD_WANT_SKB;
|
|
|
|
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
cmd.id = nla_get_u8(tb[IWL_TM_ATTR_UCODE_CMD_ID]);
|
2011-05-04 14:50:38 +00:00
|
|
|
cmd.data[0] = nla_data(tb[IWL_TM_ATTR_UCODE_CMD_DATA]);
|
|
|
|
cmd.len[0] = nla_len(tb[IWL_TM_ATTR_UCODE_CMD_DATA]);
|
2011-05-13 18:57:40 +00:00
|
|
|
cmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY;
|
2012-01-31 13:30:39 +00:00
|
|
|
IWL_DEBUG_INFO(priv, "testmode ucode command ID 0x%x, flags 0x%x,"
|
2011-05-04 14:50:38 +00:00
|
|
|
" len %d\n", cmd.id, cmd.flags, cmd.len[0]);
|
2012-01-31 13:30:39 +00:00
|
|
|
|
2012-03-06 21:30:39 +00:00
|
|
|
ret = iwl_dvm_send_cmd(priv, &cmd);
|
2012-01-31 13:30:39 +00:00
|
|
|
if (ret) {
|
|
|
|
IWL_ERR(priv, "Failed to send hcmd\n");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
if (!cmd_want_skb)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* Handling return of SKB to the user */
|
2012-03-05 19:24:38 +00:00
|
|
|
pkt = cmd.resp_pkt;
|
2012-01-31 13:30:39 +00:00
|
|
|
if (!pkt) {
|
|
|
|
IWL_ERR(priv, "HCMD received a null response packet\n");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
reply_len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK;
|
|
|
|
skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, reply_len + 20);
|
|
|
|
reply_buf = kmalloc(reply_len, GFP_KERNEL);
|
|
|
|
if (!skb || !reply_buf) {
|
|
|
|
kfree_skb(skb);
|
|
|
|
kfree(reply_buf);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The reply is in a page, that we cannot send to user space. */
|
2012-02-08 08:01:35 +00:00
|
|
|
memcpy(reply_buf, &(pkt->hdr), reply_len);
|
2012-03-05 19:24:38 +00:00
|
|
|
iwl_free_resp(&cmd);
|
2012-01-31 13:30:39 +00:00
|
|
|
|
|
|
|
NLA_PUT_U32(skb, IWL_TM_ATTR_COMMAND, IWL_TM_CMD_DEV2APP_UCODE_RX_PKT);
|
|
|
|
NLA_PUT(skb, IWL_TM_ATTR_UCODE_RX_PKT, reply_len, reply_buf);
|
|
|
|
return cfg80211_testmode_reply(skb);
|
|
|
|
|
|
|
|
nla_put_failure:
|
|
|
|
IWL_DEBUG_INFO(priv, "Failed creating NL attributes\n");
|
|
|
|
return -ENOMSG;
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function handles the user application commands for register access.
|
|
|
|
*
|
|
|
|
* It retrieves command ID carried with IWL_TM_ATTR_COMMAND and calls to the
|
|
|
|
* handlers respectively.
|
|
|
|
*
|
|
|
|
* If it's an unknown commdn ID, -ENOSYS is returned; or -ENOMSG if the
|
|
|
|
* mandatory fields(IWL_TM_ATTR_REG_OFFSET,IWL_TM_ATTR_REG_VALUE32,
|
|
|
|
* IWL_TM_ATTR_REG_VALUE8) are missing; Otherwise 0 is replied indicating
|
|
|
|
* the success of the command execution.
|
|
|
|
*
|
|
|
|
* If IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_REG_READ32, the register read
|
|
|
|
* value is returned with IWL_TM_ATTR_REG_VALUE32.
|
|
|
|
*
|
|
|
|
* @hw: ieee80211_hw object that represents the device
|
|
|
|
* @tb: gnl message fields from the user space
|
|
|
|
*/
|
|
|
|
static int iwl_testmode_reg(struct ieee80211_hw *hw, struct nlattr **tb)
|
|
|
|
{
|
2012-02-09 14:08:15 +00:00
|
|
|
struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
|
2012-01-25 07:19:24 +00:00
|
|
|
u32 ofs, val32, cmd;
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
u8 val8;
|
|
|
|
struct sk_buff *skb;
|
|
|
|
int status = 0;
|
|
|
|
|
|
|
|
if (!tb[IWL_TM_ATTR_REG_OFFSET]) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Missing register offset\n");
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
return -ENOMSG;
|
|
|
|
}
|
|
|
|
ofs = nla_get_u32(tb[IWL_TM_ATTR_REG_OFFSET]);
|
|
|
|
IWL_INFO(priv, "testmode register access command offset 0x%x\n", ofs);
|
|
|
|
|
2012-01-25 07:19:24 +00:00
|
|
|
/* Allow access only to FH/CSR/HBUS in direct mode.
|
|
|
|
Since we don't have the upper bounds for the CSR and HBUS segments,
|
|
|
|
we will use only the upper bound of FH for sanity check. */
|
|
|
|
cmd = nla_get_u32(tb[IWL_TM_ATTR_COMMAND]);
|
|
|
|
if ((cmd == IWL_TM_CMD_APP2DEV_DIRECT_REG_READ32 ||
|
|
|
|
cmd == IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE32 ||
|
|
|
|
cmd == IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE8) &&
|
|
|
|
(ofs >= FH_MEM_UPPER_BOUND)) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "offset out of segment (0x0 - 0x%x)\n",
|
2012-01-25 07:19:24 +00:00
|
|
|
FH_MEM_UPPER_BOUND);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (cmd) {
|
2011-11-16 03:24:32 +00:00
|
|
|
case IWL_TM_CMD_APP2DEV_DIRECT_REG_READ32:
|
2012-01-03 14:56:15 +00:00
|
|
|
val32 = iwl_read_direct32(trans(priv), ofs);
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
IWL_INFO(priv, "32bit value to read 0x%x\n", val32);
|
|
|
|
|
|
|
|
skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20);
|
|
|
|
if (!skb) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Memory allocation fail\n");
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
NLA_PUT_U32(skb, IWL_TM_ATTR_REG_VALUE32, val32);
|
|
|
|
status = cfg80211_testmode_reply(skb);
|
|
|
|
if (status < 0)
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Error sending msg : %d\n", status);
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
break;
|
2011-11-16 03:24:32 +00:00
|
|
|
case IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE32:
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
if (!tb[IWL_TM_ATTR_REG_VALUE32]) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Missing value to write\n");
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
return -ENOMSG;
|
|
|
|
} else {
|
|
|
|
val32 = nla_get_u32(tb[IWL_TM_ATTR_REG_VALUE32]);
|
|
|
|
IWL_INFO(priv, "32bit value to write 0x%x\n", val32);
|
2012-01-03 14:56:15 +00:00
|
|
|
iwl_write_direct32(trans(priv), ofs, val32);
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
}
|
|
|
|
break;
|
2011-11-16 03:24:32 +00:00
|
|
|
case IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE8:
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
if (!tb[IWL_TM_ATTR_REG_VALUE8]) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Missing value to write\n");
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
return -ENOMSG;
|
|
|
|
} else {
|
|
|
|
val8 = nla_get_u8(tb[IWL_TM_ATTR_REG_VALUE8]);
|
|
|
|
IWL_INFO(priv, "8bit value to write 0x%x\n", val8);
|
2012-01-03 14:56:15 +00:00
|
|
|
iwl_write8(trans(priv), ofs, val8);
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Unknown testmode register command ID\n");
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
return -ENOSYS;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
|
|
|
|
nla_put_failure:
|
|
|
|
kfree_skb(skb);
|
|
|
|
return -EMSGSIZE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int iwl_testmode_cfg_init_calib(struct iwl_priv *priv)
|
|
|
|
{
|
|
|
|
struct iwl_notification_wait calib_wait;
|
2012-03-15 20:26:44 +00:00
|
|
|
static const u8 calib_complete[] = {
|
|
|
|
CALIBRATION_COMPLETE_NOTIFICATION
|
|
|
|
};
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
int ret;
|
|
|
|
|
2012-03-06 21:30:58 +00:00
|
|
|
iwl_init_notification_wait(&priv->notif_wait, &calib_wait,
|
2012-03-15 20:26:44 +00:00
|
|
|
calib_complete, ARRAY_SIZE(calib_complete),
|
2012-03-06 21:30:58 +00:00
|
|
|
NULL, NULL);
|
2012-03-06 21:30:36 +00:00
|
|
|
ret = iwl_init_alive_start(priv);
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
if (ret) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Fail init calibration: %d\n", ret);
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
goto cfg_init_calib_error;
|
|
|
|
}
|
|
|
|
|
2012-03-06 21:30:58 +00:00
|
|
|
ret = iwl_wait_notification(&priv->notif_wait, &calib_wait, 2 * HZ);
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
if (ret)
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Error detecting"
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
" CALIBRATION_COMPLETE_NOTIFICATION: %d\n", ret);
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
cfg_init_calib_error:
|
2012-03-06 21:30:58 +00:00
|
|
|
iwl_remove_notification(&priv->notif_wait, &calib_wait);
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function handles the user application commands for driver.
|
|
|
|
*
|
|
|
|
* It retrieves command ID carried with IWL_TM_ATTR_COMMAND and calls to the
|
|
|
|
* handlers respectively.
|
|
|
|
*
|
|
|
|
* If it's an unknown commdn ID, -ENOSYS is replied; otherwise, the returned
|
|
|
|
* value of the actual command execution is replied to the user application.
|
|
|
|
*
|
|
|
|
* If there's any message responding to the user space, IWL_TM_ATTR_SYNC_RSP
|
|
|
|
* is used for carry the message while IWL_TM_ATTR_COMMAND must set to
|
|
|
|
* IWL_TM_CMD_DEV2APP_SYNC_RSP.
|
|
|
|
*
|
|
|
|
* @hw: ieee80211_hw object that represents the device
|
|
|
|
* @tb: gnl message fields from the user space
|
|
|
|
*/
|
|
|
|
static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
|
|
|
|
{
|
2012-02-09 14:08:15 +00:00
|
|
|
struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
|
2011-12-07 16:50:46 +00:00
|
|
|
struct iwl_trans *trans = trans(priv);
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
struct sk_buff *skb;
|
|
|
|
unsigned char *rsp_data_ptr = NULL;
|
|
|
|
int status = 0, rsp_data_len = 0;
|
2011-12-24 04:12:12 +00:00
|
|
|
u32 devid, inst_size = 0, data_size = 0;
|
2012-03-10 21:00:14 +00:00
|
|
|
const struct fw_img *img;
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
|
|
|
|
switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) {
|
|
|
|
case IWL_TM_CMD_APP2DEV_GET_DEVICENAME:
|
2011-12-16 15:07:36 +00:00
|
|
|
rsp_data_ptr = (unsigned char *)cfg(priv)->name;
|
|
|
|
rsp_data_len = strlen(cfg(priv)->name);
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy,
|
|
|
|
rsp_data_len + 20);
|
|
|
|
if (!skb) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Memory allocation fail\n");
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
NLA_PUT_U32(skb, IWL_TM_ATTR_COMMAND,
|
|
|
|
IWL_TM_CMD_DEV2APP_SYNC_RSP);
|
|
|
|
NLA_PUT(skb, IWL_TM_ATTR_SYNC_RSP,
|
|
|
|
rsp_data_len, rsp_data_ptr);
|
|
|
|
status = cfg80211_testmode_reply(skb);
|
|
|
|
if (status < 0)
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Error sending msg : %d\n", status);
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case IWL_TM_CMD_APP2DEV_LOAD_INIT_FW:
|
2012-03-06 21:30:36 +00:00
|
|
|
status = iwl_load_ucode_wait_alive(priv, IWL_UCODE_INIT);
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
if (status)
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Error loading init ucode: %d\n", status);
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB:
|
|
|
|
iwl_testmode_cfg_init_calib(priv);
|
2012-03-10 21:00:10 +00:00
|
|
|
priv->ucode_loaded = false;
|
2011-12-07 16:50:46 +00:00
|
|
|
iwl_trans_stop_device(trans);
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW:
|
2012-03-06 21:30:36 +00:00
|
|
|
status = iwl_load_ucode_wait_alive(priv, IWL_UCODE_REGULAR);
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
if (status) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv,
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
"Error loading runtime ucode: %d\n", status);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
status = iwl_alive_start(priv);
|
|
|
|
if (status)
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv,
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
"Error starting the device: %d\n", status);
|
|
|
|
break;
|
|
|
|
|
2011-11-25 06:26:53 +00:00
|
|
|
case IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW:
|
|
|
|
iwl_scan_cancel_timeout(priv, 200);
|
2012-03-10 21:00:10 +00:00
|
|
|
priv->ucode_loaded = false;
|
2011-12-07 16:50:46 +00:00
|
|
|
iwl_trans_stop_device(trans);
|
2012-03-06 21:30:36 +00:00
|
|
|
status = iwl_load_ucode_wait_alive(priv, IWL_UCODE_WOWLAN);
|
2011-11-25 06:26:53 +00:00
|
|
|
if (status) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv,
|
2011-11-25 06:26:53 +00:00
|
|
|
"Error loading WOWLAN ucode: %d\n", status);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
status = iwl_alive_start(priv);
|
|
|
|
if (status)
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv,
|
2011-11-25 06:26:53 +00:00
|
|
|
"Error starting the device: %d\n", status);
|
|
|
|
break;
|
|
|
|
|
2011-05-04 01:05:12 +00:00
|
|
|
case IWL_TM_CMD_APP2DEV_GET_EEPROM:
|
2012-04-10 00:46:58 +00:00
|
|
|
if (priv->eeprom) {
|
2011-05-04 01:05:12 +00:00
|
|
|
skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy,
|
2011-12-16 15:07:36 +00:00
|
|
|
cfg(priv)->base_params->eeprom_size + 20);
|
2011-05-04 01:05:12 +00:00
|
|
|
if (!skb) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Memory allocation fail\n");
|
2011-05-04 01:05:12 +00:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
NLA_PUT_U32(skb, IWL_TM_ATTR_COMMAND,
|
|
|
|
IWL_TM_CMD_DEV2APP_EEPROM_RSP);
|
|
|
|
NLA_PUT(skb, IWL_TM_ATTR_EEPROM,
|
2011-12-16 15:07:36 +00:00
|
|
|
cfg(priv)->base_params->eeprom_size,
|
2012-04-10 00:46:58 +00:00
|
|
|
priv->eeprom);
|
2011-05-04 01:05:12 +00:00
|
|
|
status = cfg80211_testmode_reply(skb);
|
|
|
|
if (status < 0)
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Error sending msg : %d\n",
|
|
|
|
status);
|
2011-05-04 01:05:12 +00:00
|
|
|
} else
|
|
|
|
return -EFAULT;
|
|
|
|
break;
|
|
|
|
|
2011-05-04 01:05:13 +00:00
|
|
|
case IWL_TM_CMD_APP2DEV_FIXRATE_REQ:
|
|
|
|
if (!tb[IWL_TM_ATTR_FIXRATE]) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Missing fixrate setting\n");
|
2011-05-04 01:05:13 +00:00
|
|
|
return -ENOMSG;
|
|
|
|
}
|
2011-07-08 15:46:28 +00:00
|
|
|
priv->tm_fixed_rate = nla_get_u32(tb[IWL_TM_ATTR_FIXRATE]);
|
2011-05-04 01:05:13 +00:00
|
|
|
break;
|
|
|
|
|
2011-11-28 08:55:38 +00:00
|
|
|
case IWL_TM_CMD_APP2DEV_GET_FW_VERSION:
|
2012-02-06 23:51:15 +00:00
|
|
|
IWL_INFO(priv, "uCode version raw: 0x%x\n",
|
2012-03-06 21:30:37 +00:00
|
|
|
priv->fw->ucode_ver);
|
2011-11-28 08:55:38 +00:00
|
|
|
|
|
|
|
skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20);
|
|
|
|
if (!skb) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Memory allocation fail\n");
|
2011-11-28 08:55:38 +00:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
2012-02-06 23:51:15 +00:00
|
|
|
NLA_PUT_U32(skb, IWL_TM_ATTR_FW_VERSION,
|
2012-03-06 21:30:37 +00:00
|
|
|
priv->fw->ucode_ver);
|
2011-11-28 08:55:38 +00:00
|
|
|
status = cfg80211_testmode_reply(skb);
|
|
|
|
if (status < 0)
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Error sending msg : %d\n", status);
|
2011-11-28 08:55:38 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-01 09:12:50 +00:00
|
|
|
case IWL_TM_CMD_APP2DEV_GET_DEVICE_ID:
|
2012-01-08 19:19:45 +00:00
|
|
|
devid = trans(priv)->hw_id;
|
2011-12-10 19:33:53 +00:00
|
|
|
IWL_INFO(priv, "hw version: 0x%x\n", devid);
|
2011-12-01 09:12:50 +00:00
|
|
|
|
|
|
|
skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20);
|
|
|
|
if (!skb) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Memory allocation fail\n");
|
2011-12-01 09:12:50 +00:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
NLA_PUT_U32(skb, IWL_TM_ATTR_DEVICE_ID, devid);
|
|
|
|
status = cfg80211_testmode_reply(skb);
|
|
|
|
if (status < 0)
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Error sending msg : %d\n", status);
|
2011-12-01 09:12:50 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-24 04:12:12 +00:00
|
|
|
case IWL_TM_CMD_APP2DEV_GET_FW_INFO:
|
|
|
|
skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20 + 8);
|
|
|
|
if (!skb) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Memory allocation fail\n");
|
2011-12-24 04:12:12 +00:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
2012-03-10 21:00:10 +00:00
|
|
|
if (!priv->ucode_loaded) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "No uCode has not been loaded\n");
|
2012-03-10 21:00:10 +00:00
|
|
|
return -EINVAL;
|
|
|
|
} else {
|
2012-03-15 20:26:57 +00:00
|
|
|
img = &priv->fw->img[priv->cur_ucode];
|
2012-03-10 21:00:14 +00:00
|
|
|
inst_size = img->sec[IWL_UCODE_SECTION_INST].len;
|
|
|
|
data_size = img->sec[IWL_UCODE_SECTION_DATA].len;
|
2011-12-24 04:12:12 +00:00
|
|
|
}
|
2012-03-15 20:26:57 +00:00
|
|
|
NLA_PUT_U32(skb, IWL_TM_ATTR_FW_TYPE, priv->cur_ucode);
|
2011-12-24 04:12:12 +00:00
|
|
|
NLA_PUT_U32(skb, IWL_TM_ATTR_FW_INST_SIZE, inst_size);
|
|
|
|
NLA_PUT_U32(skb, IWL_TM_ATTR_FW_DATA_SIZE, data_size);
|
|
|
|
status = cfg80211_testmode_reply(skb);
|
|
|
|
if (status < 0)
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Error sending msg : %d\n", status);
|
2011-12-24 04:12:12 +00:00
|
|
|
break;
|
|
|
|
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
default:
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Unknown testmode driver command ID\n");
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
return -ENOSYS;
|
|
|
|
}
|
|
|
|
return status;
|
|
|
|
|
|
|
|
nla_put_failure:
|
|
|
|
kfree_skb(skb);
|
|
|
|
return -EMSGSIZE;
|
|
|
|
}
|
|
|
|
|
2011-05-06 17:21:28 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This function handles the user application commands for uCode trace
|
|
|
|
*
|
|
|
|
* It retrieves command ID carried with IWL_TM_ATTR_COMMAND and calls to the
|
|
|
|
* handlers respectively.
|
|
|
|
*
|
|
|
|
* If it's an unknown commdn ID, -ENOSYS is replied; otherwise, the returned
|
|
|
|
* value of the actual command execution is replied to the user application.
|
|
|
|
*
|
|
|
|
* @hw: ieee80211_hw object that represents the device
|
|
|
|
* @tb: gnl message fields from the user space
|
|
|
|
*/
|
|
|
|
static int iwl_testmode_trace(struct ieee80211_hw *hw, struct nlattr **tb)
|
|
|
|
{
|
2012-02-09 14:08:15 +00:00
|
|
|
struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
|
2011-05-06 17:21:28 +00:00
|
|
|
struct sk_buff *skb;
|
|
|
|
int status = 0;
|
2012-01-03 14:56:15 +00:00
|
|
|
struct device *dev = trans(priv)->dev;
|
2011-05-06 17:21:28 +00:00
|
|
|
|
|
|
|
switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) {
|
|
|
|
case IWL_TM_CMD_APP2DEV_BEGIN_TRACE:
|
|
|
|
if (priv->testmode_trace.trace_enabled)
|
|
|
|
return -EBUSY;
|
|
|
|
|
2011-05-30 17:29:37 +00:00
|
|
|
if (!tb[IWL_TM_ATTR_TRACE_SIZE])
|
|
|
|
priv->testmode_trace.buff_size = TRACE_BUFF_SIZE_DEF;
|
|
|
|
else
|
|
|
|
priv->testmode_trace.buff_size =
|
|
|
|
nla_get_u32(tb[IWL_TM_ATTR_TRACE_SIZE]);
|
|
|
|
if (!priv->testmode_trace.buff_size)
|
|
|
|
return -EINVAL;
|
|
|
|
if (priv->testmode_trace.buff_size < TRACE_BUFF_SIZE_MIN ||
|
|
|
|
priv->testmode_trace.buff_size > TRACE_BUFF_SIZE_MAX)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
priv->testmode_trace.total_size =
|
|
|
|
priv->testmode_trace.buff_size + TRACE_BUFF_PADD;
|
2011-05-06 17:21:28 +00:00
|
|
|
priv->testmode_trace.cpu_addr =
|
|
|
|
dma_alloc_coherent(dev,
|
2011-05-30 17:29:37 +00:00
|
|
|
priv->testmode_trace.total_size,
|
2011-05-06 17:21:28 +00:00
|
|
|
&priv->testmode_trace.dma_addr,
|
|
|
|
GFP_KERNEL);
|
|
|
|
if (!priv->testmode_trace.cpu_addr)
|
|
|
|
return -ENOMEM;
|
|
|
|
priv->testmode_trace.trace_enabled = true;
|
|
|
|
priv->testmode_trace.trace_addr = (u8 *)PTR_ALIGN(
|
|
|
|
priv->testmode_trace.cpu_addr, 0x100);
|
|
|
|
memset(priv->testmode_trace.trace_addr, 0x03B,
|
2011-05-30 17:29:37 +00:00
|
|
|
priv->testmode_trace.buff_size);
|
2011-05-06 17:21:28 +00:00
|
|
|
skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy,
|
|
|
|
sizeof(priv->testmode_trace.dma_addr) + 20);
|
|
|
|
if (!skb) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Memory allocation fail\n");
|
2011-05-06 17:21:28 +00:00
|
|
|
iwl_trace_cleanup(priv);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
NLA_PUT(skb, IWL_TM_ATTR_TRACE_ADDR,
|
|
|
|
sizeof(priv->testmode_trace.dma_addr),
|
|
|
|
(u64 *)&priv->testmode_trace.dma_addr);
|
|
|
|
status = cfg80211_testmode_reply(skb);
|
|
|
|
if (status < 0) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Error sending msg : %d\n", status);
|
2011-05-06 17:21:28 +00:00
|
|
|
}
|
2011-05-31 15:03:02 +00:00
|
|
|
priv->testmode_trace.num_chunks =
|
|
|
|
DIV_ROUND_UP(priv->testmode_trace.buff_size,
|
2011-11-23 07:05:02 +00:00
|
|
|
DUMP_CHUNK_SIZE);
|
2011-05-06 17:21:28 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case IWL_TM_CMD_APP2DEV_END_TRACE:
|
|
|
|
iwl_trace_cleanup(priv);
|
|
|
|
break;
|
|
|
|
default:
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Unknown testmode mem command ID\n");
|
2011-05-06 17:21:28 +00:00
|
|
|
return -ENOSYS;
|
|
|
|
}
|
|
|
|
return status;
|
|
|
|
|
|
|
|
nla_put_failure:
|
|
|
|
kfree_skb(skb);
|
|
|
|
if (nla_get_u32(tb[IWL_TM_ATTR_COMMAND]) ==
|
|
|
|
IWL_TM_CMD_APP2DEV_BEGIN_TRACE)
|
|
|
|
iwl_trace_cleanup(priv);
|
|
|
|
return -EMSGSIZE;
|
|
|
|
}
|
|
|
|
|
2012-03-07 17:52:14 +00:00
|
|
|
static int iwl_testmode_trace_dump(struct ieee80211_hw *hw,
|
2011-05-31 15:03:02 +00:00
|
|
|
struct sk_buff *skb,
|
|
|
|
struct netlink_callback *cb)
|
|
|
|
{
|
2012-02-09 14:08:15 +00:00
|
|
|
struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
|
2011-05-31 15:03:02 +00:00
|
|
|
int idx, length;
|
|
|
|
|
|
|
|
if (priv->testmode_trace.trace_enabled &&
|
|
|
|
priv->testmode_trace.trace_addr) {
|
|
|
|
idx = cb->args[4];
|
|
|
|
if (idx >= priv->testmode_trace.num_chunks)
|
|
|
|
return -ENOENT;
|
2011-11-23 07:05:02 +00:00
|
|
|
length = DUMP_CHUNK_SIZE;
|
2011-05-31 15:03:02 +00:00
|
|
|
if (((idx + 1) == priv->testmode_trace.num_chunks) &&
|
2011-11-23 07:05:02 +00:00
|
|
|
(priv->testmode_trace.buff_size % DUMP_CHUNK_SIZE))
|
2011-05-31 15:03:02 +00:00
|
|
|
length = priv->testmode_trace.buff_size %
|
2011-11-23 07:05:02 +00:00
|
|
|
DUMP_CHUNK_SIZE;
|
2011-05-31 15:03:02 +00:00
|
|
|
|
|
|
|
NLA_PUT(skb, IWL_TM_ATTR_TRACE_DUMP, length,
|
|
|
|
priv->testmode_trace.trace_addr +
|
2011-11-23 07:05:02 +00:00
|
|
|
(DUMP_CHUNK_SIZE * idx));
|
2011-05-31 15:03:02 +00:00
|
|
|
idx++;
|
|
|
|
cb->args[4] = idx;
|
|
|
|
return 0;
|
|
|
|
} else
|
|
|
|
return -EFAULT;
|
|
|
|
|
|
|
|
nla_put_failure:
|
|
|
|
return -ENOBUFS;
|
|
|
|
}
|
|
|
|
|
2011-07-08 15:46:26 +00:00
|
|
|
/*
|
|
|
|
* This function handles the user application switch ucode ownership.
|
|
|
|
*
|
|
|
|
* It retrieves the mandatory fields IWL_TM_ATTR_UCODE_OWNER and
|
|
|
|
* decide who the current owner of the uCode
|
|
|
|
*
|
|
|
|
* If the current owner is OWNERSHIP_TM, then the only host command
|
|
|
|
* can deliver to uCode is from testmode, all the other host commands
|
|
|
|
* will dropped.
|
|
|
|
*
|
|
|
|
* default driver is the owner of uCode in normal operational mode
|
|
|
|
*
|
|
|
|
* @hw: ieee80211_hw object that represents the device
|
|
|
|
* @tb: gnl message fields from the user space
|
|
|
|
*/
|
|
|
|
static int iwl_testmode_ownership(struct ieee80211_hw *hw, struct nlattr **tb)
|
|
|
|
{
|
2012-02-09 14:08:15 +00:00
|
|
|
struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
|
2011-07-08 15:46:26 +00:00
|
|
|
u8 owner;
|
|
|
|
|
|
|
|
if (!tb[IWL_TM_ATTR_UCODE_OWNER]) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Missing ucode owner\n");
|
2011-07-08 15:46:26 +00:00
|
|
|
return -ENOMSG;
|
|
|
|
}
|
|
|
|
|
|
|
|
owner = nla_get_u8(tb[IWL_TM_ATTR_UCODE_OWNER]);
|
2012-03-07 17:52:29 +00:00
|
|
|
if (owner == IWL_OWNERSHIP_DRIVER) {
|
2012-03-06 21:30:59 +00:00
|
|
|
priv->ucode_owner = owner;
|
2012-03-07 17:52:29 +00:00
|
|
|
priv->pre_rx_handler = NULL;
|
|
|
|
} else if (owner == IWL_OWNERSHIP_TM) {
|
|
|
|
priv->pre_rx_handler = iwl_testmode_ucode_rx_pkt;
|
|
|
|
priv->ucode_owner = owner;
|
|
|
|
} else {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Invalid owner\n");
|
2011-07-08 15:46:26 +00:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-01-25 11:30:27 +00:00
|
|
|
static int iwl_testmode_indirect_read(struct iwl_priv *priv, u32 addr, u32 size)
|
|
|
|
{
|
|
|
|
struct iwl_trans *trans = trans(priv);
|
|
|
|
unsigned long flags;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (size & 0x3)
|
|
|
|
return -EINVAL;
|
|
|
|
priv->testmode_mem.buff_size = size;
|
|
|
|
priv->testmode_mem.buff_addr =
|
|
|
|
kmalloc(priv->testmode_mem.buff_size, GFP_KERNEL);
|
|
|
|
if (priv->testmode_mem.buff_addr == NULL)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
/* Hard-coded periphery absolute address */
|
|
|
|
if (IWL_TM_ABS_PRPH_START <= addr &&
|
|
|
|
addr < IWL_TM_ABS_PRPH_START + PRPH_END) {
|
|
|
|
spin_lock_irqsave(&trans->reg_lock, flags);
|
|
|
|
iwl_grab_nic_access(trans);
|
2012-02-05 22:40:47 +00:00
|
|
|
iwl_write32(trans, HBUS_TARG_PRPH_RADDR,
|
|
|
|
addr | (3 << 24));
|
2012-01-25 11:30:27 +00:00
|
|
|
for (i = 0; i < size; i += 4)
|
2012-02-05 22:40:47 +00:00
|
|
|
*(u32 *)(priv->testmode_mem.buff_addr + i) =
|
2012-01-25 11:30:27 +00:00
|
|
|
iwl_read32(trans, HBUS_TARG_PRPH_RDAT);
|
|
|
|
iwl_release_nic_access(trans);
|
|
|
|
spin_unlock_irqrestore(&trans->reg_lock, flags);
|
|
|
|
} else { /* target memory (SRAM) */
|
|
|
|
_iwl_read_targ_mem_words(trans, addr,
|
|
|
|
priv->testmode_mem.buff_addr,
|
|
|
|
priv->testmode_mem.buff_size / 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
priv->testmode_mem.num_chunks =
|
|
|
|
DIV_ROUND_UP(priv->testmode_mem.buff_size, DUMP_CHUNK_SIZE);
|
|
|
|
priv->testmode_mem.read_in_progress = true;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static int iwl_testmode_indirect_write(struct iwl_priv *priv, u32 addr,
|
|
|
|
u32 size, unsigned char *buf)
|
|
|
|
{
|
|
|
|
struct iwl_trans *trans = trans(priv);
|
|
|
|
u32 val, i;
|
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
if (IWL_TM_ABS_PRPH_START <= addr &&
|
|
|
|
addr < IWL_TM_ABS_PRPH_START + PRPH_END) {
|
|
|
|
/* Periphery writes can be 1-3 bytes long, or DWORDs */
|
|
|
|
if (size < 4) {
|
|
|
|
memcpy(&val, buf, size);
|
|
|
|
spin_lock_irqsave(&trans->reg_lock, flags);
|
|
|
|
iwl_grab_nic_access(trans);
|
|
|
|
iwl_write32(trans, HBUS_TARG_PRPH_WADDR,
|
2012-02-05 22:40:47 +00:00
|
|
|
(addr & 0x0000FFFF) |
|
|
|
|
((size - 1) << 24));
|
2012-01-25 11:30:27 +00:00
|
|
|
iwl_write32(trans, HBUS_TARG_PRPH_WDAT, val);
|
|
|
|
iwl_release_nic_access(trans);
|
|
|
|
/* needed after consecutive writes w/o read */
|
|
|
|
mmiowb();
|
|
|
|
spin_unlock_irqrestore(&trans->reg_lock, flags);
|
|
|
|
} else {
|
|
|
|
if (size % 4)
|
|
|
|
return -EINVAL;
|
|
|
|
for (i = 0; i < size; i += 4)
|
|
|
|
iwl_write_prph(trans, addr+i,
|
2012-02-05 22:40:47 +00:00
|
|
|
*(u32 *)(buf+i));
|
2012-01-25 11:30:27 +00:00
|
|
|
}
|
|
|
|
} else if (iwlagn_hw_valid_rtc_data_addr(addr) ||
|
|
|
|
(IWLAGN_RTC_INST_LOWER_BOUND <= addr &&
|
|
|
|
addr < IWLAGN_RTC_INST_UPPER_BOUND)) {
|
|
|
|
_iwl_write_targ_mem_words(trans, addr, buf, size/4);
|
|
|
|
} else
|
|
|
|
return -EINVAL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-11-23 07:03:39 +00:00
|
|
|
/*
|
|
|
|
* This function handles the user application commands for SRAM data dump
|
|
|
|
*
|
|
|
|
* It retrieves the mandatory fields IWL_TM_ATTR_SRAM_ADDR and
|
|
|
|
* IWL_TM_ATTR_SRAM_SIZE to decide the memory area for SRAM data reading
|
|
|
|
*
|
|
|
|
* Several error will be retured, -EBUSY if the SRAM data retrieved by
|
|
|
|
* previous command has not been delivered to userspace, or -ENOMSG if
|
|
|
|
* the mandatory fields (IWL_TM_ATTR_SRAM_ADDR,IWL_TM_ATTR_SRAM_SIZE)
|
|
|
|
* are missing, or -ENOMEM if the buffer allocation fails.
|
|
|
|
*
|
|
|
|
* Otherwise 0 is replied indicating the success of the SRAM reading.
|
|
|
|
*
|
|
|
|
* @hw: ieee80211_hw object that represents the device
|
|
|
|
* @tb: gnl message fields from the user space
|
|
|
|
*/
|
2012-01-25 11:30:27 +00:00
|
|
|
static int iwl_testmode_indirect_mem(struct ieee80211_hw *hw,
|
|
|
|
struct nlattr **tb)
|
2011-11-23 07:03:39 +00:00
|
|
|
{
|
2012-02-09 14:08:15 +00:00
|
|
|
struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
|
2012-01-25 11:30:27 +00:00
|
|
|
u32 addr, size, cmd;
|
|
|
|
unsigned char *buf;
|
2011-11-23 07:03:39 +00:00
|
|
|
|
2012-01-25 11:30:27 +00:00
|
|
|
/* Both read and write should be blocked, for atomicity */
|
|
|
|
if (priv->testmode_mem.read_in_progress)
|
2011-11-23 07:03:39 +00:00
|
|
|
return -EBUSY;
|
|
|
|
|
2012-01-25 11:30:27 +00:00
|
|
|
cmd = nla_get_u32(tb[IWL_TM_ATTR_COMMAND]);
|
|
|
|
if (!tb[IWL_TM_ATTR_MEM_ADDR]) {
|
|
|
|
IWL_ERR(priv, "Error finding memory offset address\n");
|
2011-11-23 07:03:39 +00:00
|
|
|
return -ENOMSG;
|
|
|
|
}
|
2012-01-25 11:30:27 +00:00
|
|
|
addr = nla_get_u32(tb[IWL_TM_ATTR_MEM_ADDR]);
|
|
|
|
if (!tb[IWL_TM_ATTR_BUFFER_SIZE]) {
|
|
|
|
IWL_ERR(priv, "Error finding size for memory reading\n");
|
2011-11-23 07:03:39 +00:00
|
|
|
return -ENOMSG;
|
|
|
|
}
|
2012-01-25 11:30:27 +00:00
|
|
|
size = nla_get_u32(tb[IWL_TM_ATTR_BUFFER_SIZE]);
|
|
|
|
|
|
|
|
if (cmd == IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_READ)
|
|
|
|
return iwl_testmode_indirect_read(priv, addr, size);
|
|
|
|
else {
|
|
|
|
if (!tb[IWL_TM_ATTR_BUFFER_DUMP])
|
|
|
|
return -EINVAL;
|
|
|
|
buf = (unsigned char *) nla_data(tb[IWL_TM_ATTR_BUFFER_DUMP]);
|
|
|
|
return iwl_testmode_indirect_write(priv, addr, size, buf);
|
2011-11-23 07:03:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-07 17:52:14 +00:00
|
|
|
static int iwl_testmode_buffer_dump(struct ieee80211_hw *hw,
|
|
|
|
struct sk_buff *skb,
|
|
|
|
struct netlink_callback *cb)
|
2011-11-23 07:03:39 +00:00
|
|
|
{
|
2012-02-09 14:08:15 +00:00
|
|
|
struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
|
2011-11-23 07:03:39 +00:00
|
|
|
int idx, length;
|
|
|
|
|
2012-01-25 11:30:27 +00:00
|
|
|
if (priv->testmode_mem.read_in_progress) {
|
2011-11-23 07:03:39 +00:00
|
|
|
idx = cb->args[4];
|
2012-01-25 11:30:27 +00:00
|
|
|
if (idx >= priv->testmode_mem.num_chunks) {
|
|
|
|
iwl_mem_cleanup(priv);
|
2011-11-23 07:03:39 +00:00
|
|
|
return -ENOENT;
|
|
|
|
}
|
2011-11-23 07:05:02 +00:00
|
|
|
length = DUMP_CHUNK_SIZE;
|
2012-01-25 11:30:27 +00:00
|
|
|
if (((idx + 1) == priv->testmode_mem.num_chunks) &&
|
|
|
|
(priv->testmode_mem.buff_size % DUMP_CHUNK_SIZE))
|
|
|
|
length = priv->testmode_mem.buff_size %
|
2011-11-23 07:05:02 +00:00
|
|
|
DUMP_CHUNK_SIZE;
|
2011-11-23 07:03:39 +00:00
|
|
|
|
2012-01-25 11:30:27 +00:00
|
|
|
NLA_PUT(skb, IWL_TM_ATTR_BUFFER_DUMP, length,
|
|
|
|
priv->testmode_mem.buff_addr +
|
2011-11-23 07:05:02 +00:00
|
|
|
(DUMP_CHUNK_SIZE * idx));
|
2011-11-23 07:03:39 +00:00
|
|
|
idx++;
|
|
|
|
cb->args[4] = idx;
|
|
|
|
return 0;
|
|
|
|
} else
|
|
|
|
return -EFAULT;
|
|
|
|
|
|
|
|
nla_put_failure:
|
|
|
|
return -ENOBUFS;
|
|
|
|
}
|
|
|
|
|
2012-03-07 17:52:29 +00:00
|
|
|
static int iwl_testmode_notifications(struct ieee80211_hw *hw,
|
|
|
|
struct nlattr **tb)
|
|
|
|
{
|
|
|
|
struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
|
|
|
|
bool enable;
|
|
|
|
|
|
|
|
enable = nla_get_flag(tb[IWL_TM_ATTR_ENABLE_NOTIFICATION]);
|
|
|
|
if (enable)
|
|
|
|
priv->pre_rx_handler = iwl_testmode_ucode_rx_pkt;
|
|
|
|
else
|
|
|
|
priv->pre_rx_handler = NULL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-07-08 15:46:26 +00:00
|
|
|
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
/* The testmode gnl message handler that takes the gnl message from the
|
|
|
|
* user space and parses it per the policy iwl_testmode_gnl_msg_policy, then
|
|
|
|
* invoke the corresponding handlers.
|
|
|
|
*
|
|
|
|
* This function is invoked when there is user space application sending
|
|
|
|
* gnl message through the testmode tunnel NL80211_CMD_TESTMODE regulated
|
|
|
|
* by nl80211.
|
|
|
|
*
|
|
|
|
* It retrieves the mandatory field, IWL_TM_ATTR_COMMAND, before
|
|
|
|
* dispatching it to the corresponding handler.
|
|
|
|
*
|
|
|
|
* If IWL_TM_ATTR_COMMAND is missing, -ENOMSG is replied to user application;
|
|
|
|
* -ENOSYS is replied to the user application if the command is unknown;
|
|
|
|
* Otherwise, the command is dispatched to the respective handler.
|
|
|
|
*
|
|
|
|
* @hw: ieee80211_hw object that represents the device
|
|
|
|
* @data: pointer to user space message
|
|
|
|
* @len: length in byte of @data
|
|
|
|
*/
|
2011-10-10 14:27:11 +00:00
|
|
|
int iwlagn_mac_testmode_cmd(struct ieee80211_hw *hw, void *data, int len)
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
{
|
2011-07-11 17:47:39 +00:00
|
|
|
struct nlattr *tb[IWL_TM_ATTR_MAX];
|
2012-02-09 14:08:15 +00:00
|
|
|
struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
int result;
|
|
|
|
|
|
|
|
result = nla_parse(tb, IWL_TM_ATTR_MAX - 1, data, len,
|
|
|
|
iwl_testmode_gnl_msg_policy);
|
|
|
|
if (result != 0) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Error parsing the gnl message : %d\n", result);
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* IWL_TM_ATTR_COMMAND is absolutely mandatory */
|
|
|
|
if (!tb[IWL_TM_ATTR_COMMAND]) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Missing testmode command type\n");
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
return -ENOMSG;
|
|
|
|
}
|
|
|
|
/* in case multiple accesses to the device happens */
|
2012-03-06 21:30:42 +00:00
|
|
|
mutex_lock(&priv->mutex);
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
|
|
|
|
switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) {
|
|
|
|
case IWL_TM_CMD_APP2DEV_UCODE:
|
|
|
|
IWL_DEBUG_INFO(priv, "testmode cmd to uCode\n");
|
|
|
|
result = iwl_testmode_ucode(hw, tb);
|
|
|
|
break;
|
2011-11-16 03:24:32 +00:00
|
|
|
case IWL_TM_CMD_APP2DEV_DIRECT_REG_READ32:
|
|
|
|
case IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE32:
|
|
|
|
case IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE8:
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
IWL_DEBUG_INFO(priv, "testmode cmd to register\n");
|
|
|
|
result = iwl_testmode_reg(hw, tb);
|
|
|
|
break;
|
|
|
|
case IWL_TM_CMD_APP2DEV_GET_DEVICENAME:
|
|
|
|
case IWL_TM_CMD_APP2DEV_LOAD_INIT_FW:
|
|
|
|
case IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB:
|
|
|
|
case IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW:
|
2011-05-04 01:05:12 +00:00
|
|
|
case IWL_TM_CMD_APP2DEV_GET_EEPROM:
|
2011-05-04 01:05:13 +00:00
|
|
|
case IWL_TM_CMD_APP2DEV_FIXRATE_REQ:
|
2011-11-25 06:26:53 +00:00
|
|
|
case IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW:
|
2011-11-28 08:55:38 +00:00
|
|
|
case IWL_TM_CMD_APP2DEV_GET_FW_VERSION:
|
2011-12-01 09:12:50 +00:00
|
|
|
case IWL_TM_CMD_APP2DEV_GET_DEVICE_ID:
|
2011-12-24 04:12:12 +00:00
|
|
|
case IWL_TM_CMD_APP2DEV_GET_FW_INFO:
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
IWL_DEBUG_INFO(priv, "testmode cmd to driver\n");
|
|
|
|
result = iwl_testmode_driver(hw, tb);
|
|
|
|
break;
|
2011-05-06 17:21:28 +00:00
|
|
|
|
|
|
|
case IWL_TM_CMD_APP2DEV_BEGIN_TRACE:
|
|
|
|
case IWL_TM_CMD_APP2DEV_END_TRACE:
|
|
|
|
case IWL_TM_CMD_APP2DEV_READ_TRACE:
|
|
|
|
IWL_DEBUG_INFO(priv, "testmode uCode trace cmd to driver\n");
|
|
|
|
result = iwl_testmode_trace(hw, tb);
|
|
|
|
break;
|
|
|
|
|
2011-07-08 15:46:26 +00:00
|
|
|
case IWL_TM_CMD_APP2DEV_OWNERSHIP:
|
|
|
|
IWL_DEBUG_INFO(priv, "testmode change uCode ownership\n");
|
|
|
|
result = iwl_testmode_ownership(hw, tb);
|
|
|
|
break;
|
|
|
|
|
2012-01-25 11:30:27 +00:00
|
|
|
case IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_READ:
|
|
|
|
case IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_WRITE:
|
|
|
|
IWL_DEBUG_INFO(priv, "testmode indirect memory cmd "
|
|
|
|
"to driver\n");
|
|
|
|
result = iwl_testmode_indirect_mem(hw, tb);
|
2011-11-23 07:03:39 +00:00
|
|
|
break;
|
|
|
|
|
2012-03-07 17:52:29 +00:00
|
|
|
case IWL_TM_CMD_APP2DEV_NOTIFICATIONS:
|
|
|
|
IWL_DEBUG_INFO(priv, "testmode notifications cmd "
|
|
|
|
"to driver\n");
|
|
|
|
result = iwl_testmode_notifications(hw, tb);
|
|
|
|
break;
|
|
|
|
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
default:
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Unknown testmode command\n");
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
result = -ENOSYS;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-03-06 21:30:42 +00:00
|
|
|
mutex_unlock(&priv->mutex);
|
iwlwifi: support the svtool messages interactions through nl80211 test mode
This patch adds the feature to support the test mode operation through
the generic netlink channel NL80211_CMD_TESTMODE between intel
wireless device iwlwifi and the user space application svtool.
The main purpose is to create a transportation layer between the iwlwifi
device and the user space application so that the interaction between the
user space application svtool and the iwlwifi device in the kernel space is
in a way of generic netlink messaging.
The detail specific functions are:
1. The function iwl_testmode_cmd() is added to digest the svtool test command
from the user space application. The svtool test commands are categorized to
three types : commands to be processed by the device ucode, commands to access
the registers, and commands to be processed at the driver level(such as reload
the ucode). iwl_testmode_cmd() dispatches the commands the corresponding handlers
and reply to user space regarding the command execution status. Extra data is
returned to the user space application if there's any.
2. The function iwl_testmode_ucode_rx_pkt() is added to multicast all the spontaneous
messages from the iwlwifi device to the user space. Regardless the message types,
whenever there is a valid spontaneous message received by the iwlwifi ISR,
iwl_testmode_ucode_rx_pkt() is invoked to multicast the message content to user
space. The message content is not attacked and the message parsing is left to
the user space application.
Implementation guidelines:
1. The generic netlink messaging for iwliwif test mode is through NL80211_CMD_TESTMODE
channel, therefore, the codes need to follow the regulations set by cfg80211.ko
to get the actual device instance ieee80211_ops via cfg80211.ko, so that the iwlwifi
device is indicated with ieee80211_ops and can be actually accessed.
Therefore, a callback iwl_testmode_cmd() is added to the structure
iwlagn_hw_ops in iwl-agn.c.
2. It intends to utilize those low level device access APIs from iwlwifi device driver
(ie. iwlagn.ko) rather than creating it's own set of device access functions.
For example, iwl_send_cmd(), iwl_read32(), iwl_write8(), and iwl_write32() are reused.
3. The main functions are maintained in new files instead of spreading all over the
existing iwlwifi driver files.
The new files added are :
drivers/net/wireless/iwlwifi/iwl-sv-open.c
- to handle the user space test mode application command
and reply the respective command status to the user space application.
- to multicast the spontaneous messages from device to user space.
drivers/net/wireless/iwlwifi/iwl-testmode.h
- the commonly referenced definitions for the TLVs used in
the generic netlink messages
Signed-off-by: Cindy H. Kao <cindy.h.kao@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-05-06 17:40:15 +00:00
|
|
|
return result;
|
|
|
|
}
|
2011-05-31 15:03:02 +00:00
|
|
|
|
2011-10-10 14:27:11 +00:00
|
|
|
int iwlagn_mac_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *skb,
|
2011-05-31 15:03:02 +00:00
|
|
|
struct netlink_callback *cb,
|
|
|
|
void *data, int len)
|
|
|
|
{
|
|
|
|
struct nlattr *tb[IWL_TM_ATTR_MAX];
|
2012-02-09 14:08:15 +00:00
|
|
|
struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
|
2011-05-31 15:03:02 +00:00
|
|
|
int result;
|
|
|
|
u32 cmd;
|
|
|
|
|
|
|
|
if (cb->args[3]) {
|
|
|
|
/* offset by 1 since commands start at 0 */
|
|
|
|
cmd = cb->args[3] - 1;
|
|
|
|
} else {
|
|
|
|
result = nla_parse(tb, IWL_TM_ATTR_MAX - 1, data, len,
|
|
|
|
iwl_testmode_gnl_msg_policy);
|
|
|
|
if (result) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv,
|
|
|
|
"Error parsing the gnl message : %d\n", result);
|
2011-05-31 15:03:02 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* IWL_TM_ATTR_COMMAND is absolutely mandatory */
|
|
|
|
if (!tb[IWL_TM_ATTR_COMMAND]) {
|
2012-02-03 21:06:57 +00:00
|
|
|
IWL_ERR(priv, "Missing testmode command type\n");
|
2011-05-31 15:03:02 +00:00
|
|
|
return -ENOMSG;
|
|
|
|
}
|
|
|
|
cmd = nla_get_u32(tb[IWL_TM_ATTR_COMMAND]);
|
|
|
|
cb->args[3] = cmd + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* in case multiple accesses to the device happens */
|
2012-03-06 21:30:42 +00:00
|
|
|
mutex_lock(&priv->mutex);
|
2011-05-31 15:03:02 +00:00
|
|
|
switch (cmd) {
|
|
|
|
case IWL_TM_CMD_APP2DEV_READ_TRACE:
|
|
|
|
IWL_DEBUG_INFO(priv, "uCode trace cmd to driver\n");
|
2012-03-07 17:52:14 +00:00
|
|
|
result = iwl_testmode_trace_dump(hw, skb, cb);
|
2011-05-31 15:03:02 +00:00
|
|
|
break;
|
2012-01-25 11:30:27 +00:00
|
|
|
case IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_DUMP:
|
2011-11-23 07:03:39 +00:00
|
|
|
IWL_DEBUG_INFO(priv, "testmode sram dump cmd to driver\n");
|
2012-03-07 17:52:14 +00:00
|
|
|
result = iwl_testmode_buffer_dump(hw, skb, cb);
|
2011-11-23 07:03:39 +00:00
|
|
|
break;
|
2011-05-31 15:03:02 +00:00
|
|
|
default:
|
|
|
|
result = -EINVAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-03-06 21:30:42 +00:00
|
|
|
mutex_unlock(&priv->mutex);
|
2011-05-31 15:03:02 +00:00
|
|
|
return result;
|
|
|
|
}
|