Commit bfd634d0 authored by Antonio Quartulli's avatar Antonio Quartulli Committed by Johannes Berg
Browse files

ath6kl: make mgmt_tx accept a NULL channel



cfg80211 passes a NULL channel to mgmt_tx if the frame has
to be sent on the one currently in use by the device.
Make the implementation of mgmt_tx correctly handle this
case

Cc: Nicolas Cavallari <Nicolas.Cavallari@lri.fr>
Acked-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: default avatarAntonio Quartulli <antonio@open-mesh.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent c2ff8cad
Loading
Loading
Loading
Loading
+17 −10
Original line number Original line Diff line number Diff line
@@ -3175,10 +3175,21 @@ static int ath6kl_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
{
{
	struct ath6kl_vif *vif = ath6kl_vif_from_wdev(wdev);
	struct ath6kl_vif *vif = ath6kl_vif_from_wdev(wdev);
	struct ath6kl *ar = ath6kl_priv(vif->ndev);
	struct ath6kl *ar = ath6kl_priv(vif->ndev);
	u32 id;
	u32 id, freq;
	const struct ieee80211_mgmt *mgmt;
	const struct ieee80211_mgmt *mgmt;
	bool more_data, queued;
	bool more_data, queued;


	/* default to the current channel, but use the one specified as argument
	 * if any
	 */
	freq = vif->ch_hint;
	if (chan)
		freq = chan->center_freq;

	/* never send freq zero to the firmware */
	if (WARN_ON(freq == 0))
		return -EINVAL;

	mgmt = (const struct ieee80211_mgmt *) buf;
	mgmt = (const struct ieee80211_mgmt *) buf;
	if (vif->nw_type == AP_NETWORK && test_bit(CONNECTED, &vif->flags) &&
	if (vif->nw_type == AP_NETWORK && test_bit(CONNECTED, &vif->flags) &&
	    ieee80211_is_probe_resp(mgmt->frame_control) &&
	    ieee80211_is_probe_resp(mgmt->frame_control) &&
@@ -3188,8 +3199,7 @@ static int ath6kl_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
		 * command to allow the target to fill in the generic IEs.
		 * command to allow the target to fill in the generic IEs.
		 */
		 */
		*cookie = 0; /* TX status not supported */
		*cookie = 0; /* TX status not supported */
		return ath6kl_send_go_probe_resp(vif, buf, len,
		return ath6kl_send_go_probe_resp(vif, buf, len, freq);
						 chan->center_freq);
	}
	}


	id = vif->send_action_id++;
	id = vif->send_action_id++;
@@ -3205,17 +3215,14 @@ static int ath6kl_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,


	/* AP mode Power saving processing */
	/* AP mode Power saving processing */
	if (vif->nw_type == AP_NETWORK) {
	if (vif->nw_type == AP_NETWORK) {
		queued = ath6kl_mgmt_powersave_ap(vif,
		queued = ath6kl_mgmt_powersave_ap(vif, id, freq, wait, buf, len,
					id, chan->center_freq,
						  &more_data, no_cck);
					wait, buf,
					len, &more_data, no_cck);
		if (queued)
		if (queued)
			return 0;
			return 0;
	}
	}


	return ath6kl_wmi_send_mgmt_cmd(ar->wmi, vif->fw_vif_idx, id,
	return ath6kl_wmi_send_mgmt_cmd(ar->wmi, vif->fw_vif_idx, id, freq,
					chan->center_freq, wait,
					wait, buf, len, no_cck);
					buf, len, no_cck);
}
}


static void ath6kl_mgmt_frame_register(struct wiphy *wiphy,
static void ath6kl_mgmt_frame_register(struct wiphy *wiphy,