Commit 5edadc5a authored by Igor Mitsyanko's avatar Igor Mitsyanko Committed by Kalle Valo
Browse files

qtnfmac: update channel switch command to support 6GHz band



With an addition of 6GHz band support, channel number can no longer be
used to uniquely identify a specific channel. Modify channel switch
command to use chandef data.

Signed-off-by: default avatarIgor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 8b0b5f1b
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -2519,6 +2519,7 @@ int qtnf_cmd_send_chan_switch(struct qtnf_vif *vif,
	struct qlink_cmd_chan_switch *cmd;
	struct sk_buff *cmd_skb;
	int ret;
	u64 flags = 0;

	cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, vif->vifid,
					    QLINK_CMD_CHAN_SWITCH,
@@ -2526,19 +2527,19 @@ int qtnf_cmd_send_chan_switch(struct qtnf_vif *vif,
	if (!cmd_skb)
		return -ENOMEM;

	qtnf_bus_lock(mac->bus);
	if (params->radar_required)
		flags |= QLINK_CHAN_SW_RADAR_REQUIRED;

	if (params->block_tx)
		flags |= QLINK_CHAN_SW_BLOCK_TX;

	cmd = (struct qlink_cmd_chan_switch *)cmd_skb->data;
	cmd->channel = cpu_to_le16(params->chandef.chan->hw_value);
	cmd->radar_required = params->radar_required;
	cmd->block_tx = params->block_tx;
	qlink_chandef_cfg2q(&params->chandef, &cmd->channel);
	cmd->flags = cpu_to_le64(flags);
	cmd->beacon_count = params->count;

	qtnf_bus_lock(mac->bus);
	ret = qtnf_cmd_send(mac->bus, cmd_skb);
	if (ret)
		goto out;

out:
	qtnf_bus_unlock(mac->bus);

	return ret;
+19 −6
Original line number Diff line number Diff line
@@ -700,19 +700,32 @@ struct qlink_cmd_reg_notify {
	u8 info[0];
} __packed;

/**
 * enum qlink_chan_sw_flags - channel switch control flags
 *
 * @QLINK_CHAN_SW_RADAR_REQUIRED: whether radar detection is required on a new
 *	channel.
 * @QLINK_CHAN_SW_BLOCK_TX: whether transmissions should be blocked while
 *	changing a channel.
 */
enum qlink_chan_sw_flags {
	QLINK_CHAN_SW_RADAR_REQUIRED = BIT(0),
	QLINK_CHAN_SW_BLOCK_TX = BIT(1),
};

/**
 * struct qlink_cmd_chan_switch - data for QLINK_CMD_CHAN_SWITCH command
 *
 * @channel: channel number according to 802.11 17.3.8.3.2 and Annex J
 * @radar_required: whether radar detection is required on the new channel
 * @block_tx: whether transmissions should be blocked while changing
 * @channel: channel to switch to.
 * @flags: flags to control channel switch, bitmap of &enum qlink_chan_sw_flags.
 * @beacon_count: number of beacons until switch
 */
struct qlink_cmd_chan_switch {
	struct qlink_cmd chdr;
	__le16 channel;
	u8 radar_required;
	u8 block_tx;
	struct qlink_chandef channel;
	__le64 flags;
	__le32 n_counter_offsets_beacon;
	__le32 n_counter_offsets_presp;
	u8 beacon_count;
	u8 rsvd[3];
} __packed;