]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
qtnfmac: allow to control DFS slave radar detection
authorIgor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Tue, 9 Apr 2019 07:35:10 +0000 (07:35 +0000)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 26 Apr 2019 11:53:12 +0000 (14:53 +0300)
In ETSI region DFS slave device can operate in two modes on DFS channels:
 - do on-channel radar detection and use higher Tx power
 - don't do radar detection and use lower Tx power as a consequence

Allow user to control that behavior through qtnfmac module parameter.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
drivers/net/wireless/quantenna/qtnfmac/commands.c
drivers/net/wireless/quantenna/qtnfmac/commands.h
drivers/net/wireless/quantenna/qtnfmac/core.c
drivers/net/wireless/quantenna/qtnfmac/core.h
drivers/net/wireless/quantenna/qtnfmac/qlink.h

index c78500bcaa2dda9b7110d57cadf13dfdd8658f74..d90016125dfcacb5ff57f8abaeace331c94de7dc 100644 (file)
@@ -1008,7 +1008,7 @@ static void qtnf_cfg80211_reg_notifier(struct wiphy *wiphy,
        pr_debug("MAC%u: initiator=%d alpha=%c%c\n", mac->macid, req->initiator,
                 req->alpha2[0], req->alpha2[1]);
 
-       ret = qtnf_cmd_reg_notify(mac, req);
+       ret = qtnf_cmd_reg_notify(mac, req, qtnf_mac_slave_radar_get(wiphy));
        if (ret) {
                pr_err("MAC%u: failed to update region to %c%c: %d\n",
                       mac->macid, req->alpha2[0], req->alpha2[1], ret);
index 22313a46c3ae9ae7a7322df4afb2b51aab4db0ea..459f6b81d2eb027b05cfbcf78bf64d5fd2d6e8c5 100644 (file)
@@ -2367,7 +2367,8 @@ int qtnf_cmd_send_updown_intf(struct qtnf_vif *vif, bool up)
        return ret;
 }
 
-int qtnf_cmd_reg_notify(struct qtnf_wmac *mac, struct regulatory_request *req)
+int qtnf_cmd_reg_notify(struct qtnf_wmac *mac, struct regulatory_request *req,
+                       bool slave_radar)
 {
        struct wiphy *wiphy = priv_to_wiphy(mac);
        struct qtnf_bus *bus = mac->bus;
@@ -2429,6 +2430,7 @@ int qtnf_cmd_reg_notify(struct qtnf_wmac *mac, struct regulatory_request *req)
                break;
        }
 
+       cmd->slave_radar = slave_radar;
        cmd->num_channels = 0;
 
        for (band = 0; band < NUM_NL80211_BANDS; band++) {
index 6406365287fca4431b94eb8aed1fb56c86043330..88d7a3cd90d21bac487b06c5d8078e5032f1803a 100644 (file)
@@ -57,7 +57,8 @@ int qtnf_cmd_send_disconnect(struct qtnf_vif *vif,
                             u16 reason_code);
 int qtnf_cmd_send_updown_intf(struct qtnf_vif *vif,
                              bool up);
-int qtnf_cmd_reg_notify(struct qtnf_wmac *mac, struct regulatory_request *req);
+int qtnf_cmd_reg_notify(struct qtnf_wmac *mac, struct regulatory_request *req,
+                       bool slave_radar);
 int qtnf_cmd_get_chan_stats(struct qtnf_wmac *mac, u16 channel,
                            struct qtnf_chan_stats *stats);
 int qtnf_cmd_send_chan_switch(struct qtnf_vif *vif,
index 54ea86ae49597c13f285adaf04d7c64590e9571b..ad0c9e012056ed3c98929ba7c045640df1fd2707 100644 (file)
 #define QTNF_DMP_MAX_LEN 48
 #define QTNF_PRIMARY_VIF_IDX   0
 
+static bool slave_radar = true;
+module_param(slave_radar, bool, 0644);
+MODULE_PARM_DESC(slave_radar, "set 0 to disable radar detection in slave mode");
+
 struct qtnf_frame_meta_info {
        u8 magic_s;
        u8 ifidx;
@@ -426,6 +430,11 @@ static struct qtnf_wmac *qtnf_core_mac_alloc(struct qtnf_bus *bus,
        return mac;
 }
 
+bool qtnf_mac_slave_radar_get(struct wiphy *wiphy)
+{
+       return slave_radar;
+}
+
 static const struct ethtool_ops qtnf_ethtool_ops = {
        .get_drvinfo = cfg80211_get_drvinfo,
 };
index af8372dfb927a14e1eededc1733f1f86db0566e5..d5caff45ac472c03bf4afc27deafd97961fe9a5a 100644 (file)
@@ -134,6 +134,7 @@ struct qtnf_vif *qtnf_mac_get_free_vif(struct qtnf_wmac *mac);
 struct qtnf_vif *qtnf_mac_get_base_vif(struct qtnf_wmac *mac);
 void qtnf_mac_iface_comb_free(struct qtnf_wmac *mac);
 void qtnf_mac_ext_caps_free(struct qtnf_wmac *mac);
+bool qtnf_mac_slave_radar_get(struct wiphy *wiphy);
 struct wiphy *qtnf_wiphy_allocate(struct qtnf_bus *bus);
 int qtnf_core_net_attach(struct qtnf_wmac *mac, struct qtnf_vif *priv,
                         const char *name, unsigned char name_assign_type);
index 158c9eba20ef6200e22660aa1a013bfd3f0c2338..8a3c6344fa8ed5ab20124bb0d1667771e7457387 100644 (file)
@@ -588,6 +588,7 @@ enum qlink_user_reg_hint_type {
  *     of &enum qlink_user_reg_hint_type.
  * @num_channels: number of &struct qlink_tlv_channel in a variable portion of a
  *     payload.
+ * @slave_radar: whether slave device should enable radar detection.
  * @dfs_region: one of &enum qlink_dfs_regions.
  * @info: variable portion of regulatory notifier callback.
  */
@@ -598,7 +599,8 @@ struct qlink_cmd_reg_notify {
        u8 user_reg_hint_type;
        u8 num_channels;
        u8 dfs_region;
-       u8 rsvd[2];
+       u8 slave_radar;
+       u8 rsvd[1];
        u8 info[0];
 } __packed;