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-agn-rx.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-agn-rx.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-rx.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c index e504675f2637..8e7cdfaf10cc 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c | |||
@@ -1152,6 +1152,8 @@ int iwl_rx_dispatch(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb, | |||
1152 | { | 1152 | { |
1153 | struct iwl_rx_packet *pkt = rxb_addr(rxb); | 1153 | struct iwl_rx_packet *pkt = rxb_addr(rxb); |
1154 | struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); | 1154 | struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); |
1155 | void (*pre_rx_handler)(struct iwl_priv *, | ||
1156 | struct iwl_rx_cmd_buffer *); | ||
1155 | int err = 0; | 1157 | int err = 0; |
1156 | 1158 | ||
1157 | /* | 1159 | /* |
@@ -1161,10 +1163,20 @@ int iwl_rx_dispatch(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb, | |||
1161 | */ | 1163 | */ |
1162 | iwl_notification_wait_notify(&priv->notif_wait, pkt); | 1164 | iwl_notification_wait_notify(&priv->notif_wait, pkt); |
1163 | 1165 | ||
1164 | if (priv->pre_rx_handler && | 1166 | /* RX data may be forwarded to userspace (using pre_rx_handler) in one |
1165 | priv->ucode_owner == IWL_OWNERSHIP_TM) | 1167 | * of two cases: the first, that the user owns the uCode through |
1166 | priv->pre_rx_handler(priv, rxb); | 1168 | * testmode - in such case the pre_rx_handler is set and no further |
1167 | else { | 1169 | * processing takes place. The other case is when the user want to |
1170 | * monitor the rx w/o affecting the regular flow - the pre_rx_handler | ||
1171 | * will be set but the ownership flag != IWL_OWNERSHIP_TM and the flow | ||
1172 | * continues. | ||
1173 | * We need to use ACCESS_ONCE to prevent a case where the handler | ||
1174 | * changes between the check and the call. | ||
1175 | */ | ||
1176 | pre_rx_handler = ACCESS_ONCE(priv->pre_rx_handler); | ||
1177 | if (pre_rx_handler) | ||
1178 | pre_rx_handler(priv, rxb); | ||
1179 | if (priv->ucode_owner != IWL_OWNERSHIP_TM) { | ||
1168 | /* Based on type of command response or notification, | 1180 | /* Based on type of command response or notification, |
1169 | * handle those that need handling via function in | 1181 | * handle those that need handling via function in |
1170 | * rx_handlers table. See iwl_setup_rx_handlers() */ | 1182 | * rx_handlers table. See iwl_setup_rx_handlers() */ |