diff options
author | Amit Beka <amit.beka@intel.com> | 2012-03-07 12:52:29 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-03-08 13:59:52 -0500 |
commit | 0aef8ddc8bedac1db4c96fddc9fb1b44b730cf4f (patch) | |
tree | 5d1e270ed94fc179643d7d4229aa4e7959c35e85 /drivers/net/wireless/iwlwifi/iwl-testmode.c | |
parent | 8722c899a07f45457464803142bd1c2d2a2c3bd8 (diff) |
iwlwifi: add testmode command for rx forwarding
Added a testmode command which tells iwl_rx_dispatch
to send the RX both as a notification to nl80211 and
with the registered RX handlers.
This is used for monitoring RX from userspace while preserving
the regular flows in the driver.
Signed-off-by: Amit Beka <amit.beka@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-testmode.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-testmode.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-testmode.c b/drivers/net/wireless/iwlwifi/iwl-testmode.c index 1d732092ebe7..b8044bcd5044 100644 --- a/drivers/net/wireless/iwlwifi/iwl-testmode.c +++ b/drivers/net/wireless/iwlwifi/iwl-testmode.c | |||
@@ -125,6 +125,8 @@ struct nla_policy iwl_testmode_gnl_msg_policy[IWL_TM_ATTR_MAX] = { | |||
125 | [IWL_TM_ATTR_FW_TYPE] = { .type = NLA_U32, }, | 125 | [IWL_TM_ATTR_FW_TYPE] = { .type = NLA_U32, }, |
126 | [IWL_TM_ATTR_FW_INST_SIZE] = { .type = NLA_U32, }, | 126 | [IWL_TM_ATTR_FW_INST_SIZE] = { .type = NLA_U32, }, |
127 | [IWL_TM_ATTR_FW_DATA_SIZE] = { .type = NLA_U32, }, | 127 | [IWL_TM_ATTR_FW_DATA_SIZE] = { .type = NLA_U32, }, |
128 | |||
129 | [IWL_TM_ATTR_ENABLE_NOTIFICATION] = {.type = NLA_FLAG, }, | ||
128 | }; | 130 | }; |
129 | 131 | ||
130 | /* | 132 | /* |
@@ -194,7 +196,7 @@ nla_put_failure: | |||
194 | 196 | ||
195 | void iwl_testmode_init(struct iwl_priv *priv) | 197 | void iwl_testmode_init(struct iwl_priv *priv) |
196 | { | 198 | { |
197 | priv->pre_rx_handler = iwl_testmode_ucode_rx_pkt; | 199 | priv->pre_rx_handler = NULL; |
198 | priv->testmode_trace.trace_enabled = false; | 200 | priv->testmode_trace.trace_enabled = false; |
199 | priv->testmode_mem.read_in_progress = false; | 201 | priv->testmode_mem.read_in_progress = false; |
200 | } | 202 | } |
@@ -770,9 +772,13 @@ static int iwl_testmode_ownership(struct ieee80211_hw *hw, struct nlattr **tb) | |||
770 | } | 772 | } |
771 | 773 | ||
772 | owner = nla_get_u8(tb[IWL_TM_ATTR_UCODE_OWNER]); | 774 | owner = nla_get_u8(tb[IWL_TM_ATTR_UCODE_OWNER]); |
773 | if ((owner == IWL_OWNERSHIP_DRIVER) || (owner == IWL_OWNERSHIP_TM)) | 775 | if (owner == IWL_OWNERSHIP_DRIVER) { |
774 | priv->ucode_owner = owner; | 776 | priv->ucode_owner = owner; |
775 | else { | 777 | priv->pre_rx_handler = NULL; |
778 | } else if (owner == IWL_OWNERSHIP_TM) { | ||
779 | priv->pre_rx_handler = iwl_testmode_ucode_rx_pkt; | ||
780 | priv->ucode_owner = owner; | ||
781 | } else { | ||
776 | IWL_ERR(priv, "Invalid owner\n"); | 782 | IWL_ERR(priv, "Invalid owner\n"); |
777 | return -EINVAL; | 783 | return -EINVAL; |
778 | } | 784 | } |
@@ -937,6 +943,20 @@ static int iwl_testmode_buffer_dump(struct ieee80211_hw *hw, | |||
937 | return -ENOBUFS; | 943 | return -ENOBUFS; |
938 | } | 944 | } |
939 | 945 | ||
946 | static int iwl_testmode_notifications(struct ieee80211_hw *hw, | ||
947 | struct nlattr **tb) | ||
948 | { | ||
949 | struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); | ||
950 | bool enable; | ||
951 | |||
952 | enable = nla_get_flag(tb[IWL_TM_ATTR_ENABLE_NOTIFICATION]); | ||
953 | if (enable) | ||
954 | priv->pre_rx_handler = iwl_testmode_ucode_rx_pkt; | ||
955 | else | ||
956 | priv->pre_rx_handler = NULL; | ||
957 | return 0; | ||
958 | } | ||
959 | |||
940 | 960 | ||
941 | /* The testmode gnl message handler that takes the gnl message from the | 961 | /* The testmode gnl message handler that takes the gnl message from the |
942 | * user space and parses it per the policy iwl_testmode_gnl_msg_policy, then | 962 | * user space and parses it per the policy iwl_testmode_gnl_msg_policy, then |
@@ -1022,6 +1042,12 @@ int iwlagn_mac_testmode_cmd(struct ieee80211_hw *hw, void *data, int len) | |||
1022 | result = iwl_testmode_indirect_mem(hw, tb); | 1042 | result = iwl_testmode_indirect_mem(hw, tb); |
1023 | break; | 1043 | break; |
1024 | 1044 | ||
1045 | case IWL_TM_CMD_APP2DEV_NOTIFICATIONS: | ||
1046 | IWL_DEBUG_INFO(priv, "testmode notifications cmd " | ||
1047 | "to driver\n"); | ||
1048 | result = iwl_testmode_notifications(hw, tb); | ||
1049 | break; | ||
1050 | |||
1025 | default: | 1051 | default: |
1026 | IWL_ERR(priv, "Unknown testmode command\n"); | 1052 | IWL_ERR(priv, "Unknown testmode command\n"); |
1027 | result = -ENOSYS; | 1053 | result = -ENOSYS; |