Commit 155b424c authored by Sergey Matyukevich's avatar Sergey Matyukevich Committed by Kalle Valo
Browse files

qtnfmac: add module param to configure DFS offload



Firmware may support DFS offload. However the final decision on whether
to use it or not should be up to the user. So even if firmware supports
DFS offload, it should be enabled only if user explicitly requests it.
For this purpose introduce kernel param dfs_offload which is disabled
by default.

Signed-off-by: default avatarSergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent e92b07a2
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -1056,7 +1056,8 @@ 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, qtnf_slave_radar_get());
	ret = qtnf_cmd_reg_notify(mac, req, qtnf_slave_radar_get(),
				  qtnf_dfs_offload_get());
	if (ret) {
		pr_err("MAC%u: failed to update region to %c%c: %d\n",
		       mac->macid, req->alpha2[0], req->alpha2[1], ret);
@@ -1078,7 +1079,8 @@ struct wiphy *qtnf_wiphy_allocate(struct qtnf_bus *bus)
{
	struct wiphy *wiphy;

	if (bus->hw_info.hw_capab & QLINK_HW_CAPAB_DFS_OFFLOAD)
	if (qtnf_dfs_offload_get() &&
	    (bus->hw_info.hw_capab & QLINK_HW_CAPAB_DFS_OFFLOAD))
		qtn_cfg80211_ops.start_radar_detection = NULL;

	if (!(bus->hw_info.hw_capab & QLINK_HW_CAPAB_PWR_MGMT))
@@ -1163,7 +1165,8 @@ int qtnf_wiphy_register(struct qtnf_hw_info *hw_info, struct qtnf_wmac *mac)
			WIPHY_FLAG_NETNS_OK;
	wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;

	if (hw_info->hw_capab & QLINK_HW_CAPAB_DFS_OFFLOAD)
	if (qtnf_dfs_offload_get() &&
	    (hw_info->hw_capab & QLINK_HW_CAPAB_DFS_OFFLOAD))
		wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_DFS_OFFLOAD);

	if (hw_info->hw_capab & QLINK_HW_CAPAB_SCAN_DWELL)
+2 −1
Original line number Diff line number Diff line
@@ -2454,7 +2454,7 @@ out:
}

int qtnf_cmd_reg_notify(struct qtnf_wmac *mac, struct regulatory_request *req,
			bool slave_radar)
			bool slave_radar, bool dfs_offload)
{
	struct wiphy *wiphy = priv_to_wiphy(mac);
	struct qtnf_bus *bus = mac->bus;
@@ -2517,6 +2517,7 @@ int qtnf_cmd_reg_notify(struct qtnf_wmac *mac, struct regulatory_request *req,
	}

	cmd->slave_radar = slave_radar;
	cmd->dfs_offload = dfs_offload;
	cmd->num_channels = 0;

	for (band = 0; band < NUM_NL80211_BANDS; band++) {
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ int qtnf_cmd_send_disconnect(struct qtnf_vif *vif,
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,
			bool slave_radar);
			bool slave_radar, bool dfs_offload);
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,
+9 −0
Original line number Diff line number Diff line
@@ -21,6 +21,10 @@ 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");

static bool dfs_offload;
module_param(dfs_offload, bool, 0644);
MODULE_PARM_DESC(dfs_offload, "set 1 to enable DFS offload to firmware");

static struct dentry *qtnf_debugfs_dir;

bool qtnf_slave_radar_get(void)
@@ -28,6 +32,11 @@ bool qtnf_slave_radar_get(void)
	return slave_radar;
}

bool qtnf_dfs_offload_get(void)
{
	return dfs_offload;
}

struct qtnf_wmac *qtnf_core_get_mac(const struct qtnf_bus *bus, u8 macid)
{
	struct qtnf_wmac *mac = NULL;
+1 −0
Original line number Diff line number Diff line
@@ -134,6 +134,7 @@ 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_slave_radar_get(void);
bool qtnf_dfs_offload_get(void);
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);
Loading