qtnfmac: update channel switch command to support 6GHz band
authorIgor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Mon, 27 Jan 2020 10:46:55 +0000 (10:46 +0000)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 12 Feb 2020 16:16:47 +0000 (18:16 +0200)
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: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/quantenna/qtnfmac/commands.c
drivers/net/wireless/quantenna/qtnfmac/qlink.h

index 1271d38..3128669 100644 (file)
@@ -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;
index 3577482..ab2bfae 100644 (file)
@@ -701,18 +701,31 @@ struct qlink_cmd_reg_notify {
 } __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;