@@ -5097,8 +5097,7 @@ void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm,
if (notif->sync) {
notif->cookie = mvm->queue_sync_cookie;
- atomic_set(&mvm->queue_sync_counter,
- mvm->trans->num_rx_queues);
+ mvm->queue_sync_state = (1 << mvm->trans->num_rx_queues) - 1;
}
ret = iwl_mvm_notify_rx_queue(mvm, qmask, notif, size, !notif->sync);
@@ -5110,14 +5109,16 @@ void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm,
if (notif->sync) {
lockdep_assert_held(&mvm->mutex);
ret = wait_event_timeout(mvm->rx_sync_waitq,
- atomic_read(&mvm->queue_sync_counter) == 0 ||
+ READ_ONCE(mvm->queue_sync_state) == 0 ||
iwl_mvm_is_radio_killed(mvm),
HZ);
- WARN_ON_ONCE(!ret && !iwl_mvm_is_radio_killed(mvm));
+ WARN_ONCE(!ret && !iwl_mvm_is_radio_killed(mvm),
+ "queue sync: failed to sync, state is 0x%lx\n",
+ mvm->queue_sync_state);
}
out:
- atomic_set(&mvm->queue_sync_counter, 0);
+ mvm->queue_sync_state = 0;
if (notif->sync)
mvm->queue_sync_cookie++;
}
@@ -842,7 +842,7 @@ struct iwl_mvm {
unsigned long status;
u32 queue_sync_cookie;
- atomic_t queue_sync_counter;
+ unsigned long queue_sync_state;
/*
* for beacon filtering -
* currently only one interface can be supported
@@ -703,7 +703,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
init_waitqueue_head(&mvm->rx_sync_waitq);
- atomic_set(&mvm->queue_sync_counter, 0);
+ mvm->queue_sync_state = 0;
SET_IEEE80211_DEV(mvm->hw, mvm->trans->dev);
@@ -827,9 +827,13 @@ void iwl_mvm_rx_queue_notif(struct iwl_mvm *mvm, struct napi_struct *napi,
WARN_ONCE(1, "Invalid identifier %d", internal_notif->type);
}
- if (internal_notif->sync &&
- !atomic_dec_return(&mvm->queue_sync_counter))
- wake_up(&mvm->rx_sync_waitq);
+ if (internal_notif->sync) {
+ WARN_ONCE(!test_and_clear_bit(queue, &mvm->queue_sync_state),
+ "queue sync: queue %d responded a second time!\n",
+ queue);
+ if (READ_ONCE(mvm->queue_sync_state) == 0)
+ wake_up(&mvm->rx_sync_waitq);
+ }
}
static void iwl_mvm_oldsn_workaround(struct iwl_mvm *mvm,