diff options
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 e504675f263..8e7cdfaf10c 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() */ |