[5/5] qtnfmac: add interface combination check for repeater mode
diff mbox series

Message ID 20200213114518.4415-6-sergey.matyukevich.os@quantenna.com
State Accepted
Commit 2d83dddf85cc195fa444586e232e738b33ed8225
Delegated to: Kalle Valo
Headers show
Series
  • qtnfmac: WPA3 OWE/SAE support for AP and misc fixes
Related show

Commit Message

Sergey Matyukevich Feb. 13, 2020, 11:45 a.m. UTC
From: Dmitry Lebed <dlebed@quantenna.com>

Firmware supports only STA as primary interface in repeater mode.
Since the only meaningful usage of AP + STA interface combination
is repeater, reject such combination with AP as primary interface.

Signed-off-by: Dmitry Lebed <dlebed@quantenna.com>
---
 drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Patch
diff mbox series

diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
index 018d3ed75fda..8be17106008d 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
@@ -102,6 +102,21 @@  qtnf_validate_iface_combinations(struct wiphy *wiphy,
 
 	ret = cfg80211_check_combinations(wiphy, &params);
 
+	if (ret)
+		return ret;
+
+	/* Check repeater interface combination: primary VIF should be STA only.
+	 * STA (primary) + AP (secondary) is OK.
+	 * AP (primary) + STA (secondary) is not supported.
+	 */
+	vif = qtnf_mac_get_base_vif(mac);
+	if (vif && vif->wdev.iftype == NL80211_IFTYPE_AP &&
+	    vif != change_vif && new_type == NL80211_IFTYPE_STATION) {
+		ret = -EINVAL;
+		pr_err("MAC%u invalid combination: AP as primary repeater interface is not supported\n",
+		       mac->macid);
+	}
+
 	return ret;
 }