Skip to contentSkip to conversation

wlcore: fix WLCORE_VENDOR_ATTR_GROUP_KEY policy

PATCH In review Eliad Peller 4 participants 21 messages Dec 29, 2014 – May 6, 2015 TI wilink wireless drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/13 wlcore: fix WLCORE_VENDOR_ATTR_GROUP_KEY policy

The attribute type is binary data (with max length).

---
 drivers/net/wireless/ti/wlcore/vendor_cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ti/wlcore/vendor_cmd.c +1 -1
index ad86a48..fd4e9ba 100644
@@ -21,7 +21,7 @@ static const
 struct nla_policy wlcore_vendor_attr_policy[NUM_WLCORE_VENDOR_ATTR] = {
 	[WLCORE_VENDOR_ATTR_FREQ]		= { .type = NLA_U32 },
 	[WLCORE_VENDOR_ATTR_GROUP_ID]		= { .type = NLA_U32 },
-	[WLCORE_VENDOR_ATTR_GROUP_KEY]		= { .type = NLA_U32,
+	[WLCORE_VENDOR_ATTR_GROUP_KEY]		= { .type = NLA_BINARY,
 						    .len = WLAN_MAX_KEY_LEN },
 };
 
Signature · 1 line
1.8.5.2.229.g4448466.dirty
#1 lore raw

PATCH 2/13 wlcore: fix sparse warning

Use kstrtoul_from_user() for reading the user value, and fix the following sparse warning:

drivers/net/wireless/ti/wlcore/debugfs.c:937:15: error: incompatible types in comparison expression (different type sizes)

---
 drivers/net/wireless/ti/wlcore/debugfs.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/net/wireless/ti/wlcore/debugfs.c +1 -8
index 0be21f6..68f3bf2 100644
@@ -929,17 +929,10 @@ static ssize_t beacon_filtering_write(struct file *file,
 {
 	struct wl1271 *wl = file->private_data;
 	struct wl12xx_vif *wlvif;
-	char buf[10];
-	size_t len;
 	unsigned long value;
 	int ret;
 
-	len = min(count, sizeof(buf) - 1);
-	if (copy_from_user(buf, user_buf, len))
-		return -EFAULT;
-	buf[len] = '\0';
-
-	ret = kstrtoul(buf, 0, &value);
+	ret = kstrtoul_from_user(user_buf, count, 0, &value);
 	if (ret < 0) {
 		wl1271_warning("illegal value for beacon_filtering!");
 		return -EINVAL;
Signature · 1 line
1.8.5.2.229.g4448466.dirty
#2 lore raw

PATCH 3/13 wlcore/wl18xx: handle rc updates in a separate work

In reply to Eliad Peller

sta_rc_update runs in atomic context. thus, a new work should be scheduled in order to configure the fw with the required configuration.

---
 drivers/net/wireless/ti/wl18xx/main.c     | 18 ++++------------
 drivers/net/wireless/ti/wlcore/hw_ops.h   |  5 ++---
 drivers/net/wireless/ti/wlcore/main.c     | 35 +++++++++++++++++++++++++++++--
 drivers/net/wireless/ti/wlcore/wlcore.h   |  3 +--
 drivers/net/wireless/ti/wlcore/wlcore_i.h |  4 ++++
 5 files changed, 44 insertions(+), 21 deletions(-)
drivers/net/wireless/ti/wl18xx/main.c +4 -14
index 7af1936..6946d18 100644
@@ -1559,26 +1559,19 @@ static u32 wl18xx_pre_pkt_send(struct wl1271 *wl,
 }
 
 static void wl18xx_sta_rc_update(struct wl1271 *wl,
-				 struct wl12xx_vif *wlvif,
-				 struct ieee80211_sta *sta,
-				 u32 changed)
+				 struct wl12xx_vif *wlvif)
 {
-	bool wide = sta->bandwidth >= IEEE80211_STA_RX_BW_40;
+	bool wide = wlvif->rc_update_bw >= IEEE80211_STA_RX_BW_40;
 
 	wl1271_debug(DEBUG_MAC80211, "mac80211 sta_rc_update wide %d", wide);
 
-	if (!(changed & IEEE80211_RC_BW_CHANGED))
-		return;
-
-	mutex_lock(&wl->mutex);
-
 	/* sanity */
 	if (WARN_ON(wlvif->bss_type != BSS_TYPE_STA_BSS))
-		goto out;
+		return;
 
 	/* ignore the change before association */
 	if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags))
-		goto out;
+		return;
 
 	/*
 	 * If we started out as wide, we can change the operation mode. If we
@@ -1589,9 +1582,6 @@ static void wl18xx_sta_rc_update(struct wl1271 *wl,
 		wl18xx_acx_peer_ht_operation_mode(wl, wlvif->sta.hlid, wide);
 	else
 		ieee80211_connection_loss(wl12xx_wlvif_to_vif(wlvif));
-
-out:
-	mutex_unlock(&wl->mutex);
 }
 
 static int wl18xx_set_peer_cap(struct wl1271 *wl,
drivers/net/wireless/ti/wlcore/hw_ops.h +2 -3
index aa9f82c..29ce55f 100644
@@ -211,11 +211,10 @@ wlcore_hw_pre_pkt_send(struct wl1271 *wl, u32 buf_offset, u32 last_len)
 }
 
 static inline void
-wlcore_hw_sta_rc_update(struct wl1271 *wl, struct wl12xx_vif *wlvif,
-			struct ieee80211_sta *sta, u32 changed)
+wlcore_hw_sta_rc_update(struct wl1271 *wl, struct wl12xx_vif *wlvif)
 {
 	if (wl->ops->sta_rc_update)
-		wl->ops->sta_rc_update(wl, wlvif, sta, changed);
+		wl->ops->sta_rc_update(wl, wlvif);
 }
 
 static inline int
drivers/net/wireless/ti/wlcore/main.c +33 -2
index 2a99456..f6e37d5 100644
@@ -226,6 +226,29 @@ void wl12xx_rearm_tx_watchdog_locked(struct wl1271 *wl)
 		msecs_to_jiffies(wl->conf.tx.tx_watchdog_timeout));
 }
 
+static void wlcore_rc_update_work(struct work_struct *work)
+{
+	int ret;
+	struct wl12xx_vif *wlvif = container_of(work, struct wl12xx_vif,
+						rc_update_work);
+	struct wl1271 *wl = wlvif->wl;
+
+	mutex_lock(&wl->mutex);
+
+	if (unlikely(wl->state != WLCORE_STATE_ON))
+		goto out;
+
+	ret = wl1271_ps_elp_wakeup(wl);
+	if (ret < 0)
+		goto out;
+
+	wlcore_hw_sta_rc_update(wl, wlvif);
+
+	wl1271_ps_elp_sleep(wl);
+out:
+	mutex_unlock(&wl->mutex);
+}
+
 static void wl12xx_tx_watchdog_work(struct work_struct *work)
 {
 	struct delayed_work *dwork;
@@ -2279,6 +2302,7 @@ static int wl12xx_init_vif_data(struct wl1271 *wl, struct ieee80211_vif *vif)
 		  wl1271_rx_streaming_enable_work);
 	INIT_WORK(&wlvif->rx_streaming_disable_work,
 		  wl1271_rx_streaming_disable_work);
+	INIT_WORK(&wlvif->rc_update_work, wlcore_rc_update_work);
 	INIT_DELAYED_WORK(&wlvif->channel_switch_work,
 			  wlcore_channel_switch_work);
 	INIT_DELAYED_WORK(&wlvif->connection_loss_work,
@@ -2724,6 +2748,7 @@ unlock:
 	del_timer_sync(&wlvif->rx_streaming_timer);
 	cancel_work_sync(&wlvif->rx_streaming_enable_work);
 	cancel_work_sync(&wlvif->rx_streaming_disable_work);
+	cancel_work_sync(&wlvif->rc_update_work);
 	cancel_delayed_work_sync(&wlvif->connection_loss_work);
 	cancel_delayed_work_sync(&wlvif->channel_switch_work);
 	cancel_delayed_work_sync(&wlvif->pending_auth_complete_work);
@@ -5371,9 +5396,15 @@ static void wlcore_op_sta_rc_update(struct ieee80211_hw *hw,
 				    u32 changed)
 {
 	struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
-	struct wl1271 *wl = hw->priv;
 
-	wlcore_hw_sta_rc_update(wl, wlvif, sta, changed);
+	wl1271_debug(DEBUG_MAC80211, "mac80211 sta_rc_update");
+
+	if (!(changed & IEEE80211_RC_BW_CHANGED))
+		return;
+
+	/* this callback is atomic, so schedule a new work */
+	wlvif->rc_update_bw = sta->bandwidth;
+	ieee80211_queue_work(hw, &wlvif->rc_update_work);
 }
 
 static int wlcore_op_get_rssi(struct ieee80211_hw *hw,
drivers/net/wireless/ti/wlcore/wlcore.h +1 -2
index df78cf1..2440ebe 100644
@@ -106,8 +106,7 @@ struct wlcore_ops {
 			      struct wl12xx_vif *wlvif,
 			      struct ieee80211_channel_switch *ch_switch);
 	u32 (*pre_pkt_send)(struct wl1271 *wl, u32 buf_offset, u32 last_len);
-	void (*sta_rc_update)(struct wl1271 *wl, struct wl12xx_vif *wlvif,
-			      struct ieee80211_sta *sta, u32 changed);
+	void (*sta_rc_update)(struct wl1271 *wl, struct wl12xx_vif *wlvif);
 	int (*set_peer_cap)(struct wl1271 *wl,
 			    struct ieee80211_sta_ht_cap *ht_cap,
 			    bool allow_ht_operation,
drivers/net/wireless/ti/wlcore/wlcore_i.h +4 -0
index 0e52556..811851d 100644
@@ -463,6 +463,10 @@ struct wl12xx_vif {
 	/* work for canceling ROC after pending auth reply */
 	struct delayed_work pending_auth_complete_work;
 
+	/* update rate conrol */
+	enum ieee80211_sta_rx_bandwidth rc_update_bw;
+	struct work_struct rc_update_work;
+
 	/*
 	 * total freed FW packets on the link.
 	 * For STA this holds the PN of the link to the AP.
Signature · 1 line
1.8.5.2.229.g4448466.dirty
#3 lore raw

PATCH 4/13 wlcore: add ability to reduce FW interrupts during suspend

In reply to Eliad Peller

From: Ram Amrani <[email protected]>

Add the ability to mask FW interrupts on RX BA activity, PSM entry/exit and fast-link notifications. This is used when the host is suspended in order to decrease redundant wake ups.

---
 drivers/net/wireless/ti/wl12xx/main.c   |  3 ++
 drivers/net/wireless/ti/wl18xx/acx.c    | 56 +++++++++++++++++++++++++++
 drivers/net/wireless/ti/wl18xx/acx.h    | 25 +++++++++++-
 drivers/net/wireless/ti/wl18xx/main.c   |  3 ++
 drivers/net/wireless/ti/wlcore/conf.h   |  7 +++-
 drivers/net/wireless/ti/wlcore/hw_ops.h | 16 ++++++++
 drivers/net/wireless/ti/wlcore/main.c   | 68 ++++++++++++++++++++++-----------
 drivers/net/wireless/ti/wlcore/wlcore.h |  2 +
 8 files changed, 155 insertions(+), 25 deletions(-)
drivers/net/wireless/ti/wl12xx/main.c +3 -0
index 0bccf12..b457069 100644
@@ -250,6 +250,7 @@ static struct wlcore_conf wl12xx_conf = {
 		.keep_alive_interval         = 55000,
 		.max_listen_interval         = 20,
 		.sta_sleep_auth              = WL1271_PSM_ILLEGAL,
+		.suspend_rx_ba_activity      = 0,
 	},
 	.itrim = {
 		.enable = false,
@@ -1728,6 +1729,8 @@ static struct wlcore_ops wl12xx_ops = {
 	.convert_hwaddr		= wl12xx_convert_hwaddr,
 	.lnk_high_prio		= wl12xx_lnk_high_prio,
 	.lnk_low_prio		= wl12xx_lnk_low_prio,
+	.interrupt_notify	= NULL,
+	.rx_ba_filter		= NULL,
 };
 
 static struct ieee80211_sta_ht_cap wl12xx_ht_cap = {
drivers/net/wireless/ti/wl18xx/acx.c +56 -0

59 lines not on this page · raw message

drivers/net/wireless/ti/wl18xx/acx.h +24 -1
index 0e636de..1234bdc 100644
@@ -32,7 +32,10 @@ enum {
 	ACX_SIM_CONFIG			 = 0x0053,
 	ACX_CLEAR_STATISTICS		 = 0x0054,
 	ACX_AUTO_RX_STREAMING		 = 0x0055,
-	ACX_PEER_CAP			 = 0x0056
+	ACX_PEER_CAP			 = 0x0056,
+	ACX_INTERRUPT_NOTIFY		 = 0x0057,
+	ACX_RX_BA_FILTER		 = 0x0058
+
 };
 
 /* numbers of bits the length field takes (add 1 for the actual number) */
@@ -326,6 +329,24 @@ struct wlcore_acx_peer_cap {
 	u8 padding;
 } __packed;
 
+/*
+ * ACX_INTERRUPT_NOTIFY
+ * enable/disable fast-link/PSM notification from FW
+ */
+struct wl18xx_acx_interrupt_notify {
+	struct acx_header header;
+	u32 enable;
+};
+
+/*
+ * ACX_RX_BA_FILTER
+ * enable/disable RX BA filtering in FW
+ */
+struct wl18xx_acx_rx_ba_filter {
+	struct acx_header header;
+	u32 enable;
+};
+
 int wl18xx_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap,
 				  u32 sdio_blk_size, u32 extra_mem_blks,
 				  u32 len_field_size);
@@ -336,5 +357,7 @@ int wl18xx_acx_set_peer_cap(struct wl1271 *wl,
 			    struct ieee80211_sta_ht_cap *ht_cap,
 			    bool allow_ht_operation,
 			    u32 rate_set, u8 hlid);
+int wl18xx_acx_interrupt_notify_config(struct wl1271 *wl, bool action);
+int wl18xx_acx_rx_ba_filter(struct wl1271 *wl, bool action);
 
 #endif /* __WL18XX_ACX_H__ */
drivers/net/wireless/ti/wl18xx/main.c +3 -0
index 6946d18..7edb8a1 100644
@@ -378,6 +378,7 @@ static struct wlcore_conf wl18xx_conf = {
 		.keep_alive_interval         = 55000,
 		.max_listen_interval         = 20,
 		.sta_sleep_auth              = WL1271_PSM_ILLEGAL,
+		.suspend_rx_ba_activity      = 0,
 	},
 	.itrim = {
 		.enable = false,
@@ -1693,6 +1694,8 @@ static struct wlcore_ops wl18xx_ops = {
 	.smart_config_start = wl18xx_cmd_smart_config_start,
 	.smart_config_stop  = wl18xx_cmd_smart_config_stop,
 	.smart_config_set_group_key = wl18xx_cmd_smart_config_set_group_key,
+	.interrupt_notify = wl18xx_acx_interrupt_notify_config,
+	.rx_ba_filter	= wl18xx_acx_rx_ba_filter,
 };
 
 /* HT cap appropriate for wide channels in 2Ghz */
drivers/net/wireless/ti/wlcore/conf.h +6 -1
index 40995c4..166add0 100644
@@ -997,6 +997,11 @@ struct conf_conn_settings {
 	 * whether we can go to ELP.
 	 */
 	u8 sta_sleep_auth;
+
+	/*
+	 * Default RX BA Activity filter configuration
+	 */
+	u8 suspend_rx_ba_activity;
 } __packed;
 
 enum {
@@ -1347,7 +1352,7 @@ struct conf_recovery_settings {
  * version, the two LSB are the lower driver's private conf
  * version.
  */
-#define WLCORE_CONF_VERSION	(0x0005 << 16)
+#define WLCORE_CONF_VERSION	(0x0006 << 16)
 #define WLCORE_CONF_MASK	0xffff0000
 #define WLCORE_CONF_SIZE	(sizeof(struct wlcore_conf_header) +	\
 				 sizeof(struct wlcore_conf))
drivers/net/wireless/ti/wlcore/hw_ops.h +16 -0
index 29ce55f..c2545ce 100644
@@ -218,6 +218,22 @@ wlcore_hw_sta_rc_update(struct wl1271 *wl, struct wl12xx_vif *wlvif)
 }
 
 static inline int
+wlcore_hw_interrupt_notify(struct wl1271 *wl, bool action)
+{
+	if (wl->ops->interrupt_notify)
+		return wl->ops->interrupt_notify(wl, action);
+	return 0;
+}
+
+static inline int
+wlcore_hw_rx_ba_filter(struct wl1271 *wl, bool action)
+{
+	if (wl->ops->rx_ba_filter)
+		return wl->ops->rx_ba_filter(wl, action);
+	return 0;
+}
+
+static inline int
 wlcore_hw_set_peer_cap(struct wl1271 *wl,
 		       struct ieee80211_sta_ht_cap *ht_cap,
 		       bool allow_ht_operation,
drivers/net/wireless/ti/wlcore/main.c +45 -23

138 lines not on this page · raw message

drivers/net/wireless/ti/wlcore/wlcore.h +2 -0
index 2440ebe..7860a4e 100644
@@ -116,6 +116,8 @@ struct wlcore_ops {
 			      struct wl1271_link *lnk);
 	bool (*lnk_low_prio)(struct wl1271 *wl, u8 hlid,
 			     struct wl1271_link *lnk);
+	int (*interrupt_notify)(struct wl1271 *wl, bool action);
+	int (*rx_ba_filter)(struct wl1271 *wl, bool action);
 	int (*smart_config_start)(struct wl1271 *wl, u32 group_bitmap);
 	int (*smart_config_stop)(struct wl1271 *wl);
 	int (*smart_config_set_group_key)(struct wl1271 *wl, u16 group_id,
Signature · 1 line
1.8.5.2.229.g4448466.dirty
#4 lore raw

PATCH 5/13 wlcore: enable AP wowlan

In reply to Eliad Peller

configure wowlan when host is suspended in AP mode, since the FW can now wake the host up on Rx.

---
 drivers/net/wireless/ti/wlcore/main.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/net/wireless/ti/wlcore/main.c +13 -5
index aaa836b..0d67e39 100644
@@ -1707,7 +1707,8 @@ out:
 }
 
 static int wl1271_configure_suspend_ap(struct wl1271 *wl,
-				       struct wl12xx_vif *wlvif)
+					struct wl12xx_vif *wlvif,
+					struct cfg80211_wowlan *wow)
 {
 	int ret = 0;
 
@@ -1715,6 +1716,12 @@ static int wl1271_configure_suspend_ap(struct wl1271 *wl,
 		goto out;
 
 	ret = wl1271_acx_beacon_filter_opt(wl, wlvif, true);
+	if (ret < 0)
+		goto out;
+
+	ret = wl1271_configure_wowlan(wl, wow);
+	if (ret < 0)
+		goto out;
 
 out:
 	return ret;
@@ -1728,7 +1735,7 @@ static int wl1271_configure_suspend(struct wl1271 *wl,
 	if (wlvif->bss_type == BSS_TYPE_STA_BSS)
 		return wl1271_configure_suspend_sta(wl, wlvif, wow);
 	if (wlvif->bss_type == BSS_TYPE_AP_BSS)
-		return wl1271_configure_suspend_ap(wl, wlvif);
+		return wl1271_configure_suspend_ap(wl, wlvif, wow);
 	return 0;
 }
 
@@ -1741,12 +1748,13 @@ static void wl1271_configure_resume(struct wl1271 *wl, struct wl12xx_vif *wlvif)
 	if ((!is_ap) && (!is_sta))
 		return;
 
-	if (is_sta && !test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags))
+	if ((is_sta && !test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) ||
+	    (is_ap && !test_bit(WLVIF_FLAG_AP_STARTED, &wlvif->flags)))
 		return;
 
-	if (is_sta) {
-		wl1271_configure_wowlan(wl, NULL);
+	wl1271_configure_wowlan(wl, NULL);
 
+	if (is_sta) {
 		if ((wl->conf.conn.suspend_wake_up_event ==
 		     wl->conf.conn.wake_up_event) &&
 		    (wl->conf.conn.suspend_listen_interval ==
Signature · 1 line
1.8.5.2.229.g4448466.dirty
#5 lore raw

PATCH 6/13 wlcore: enable sleep during AP mode operation

In reply to Eliad Peller

From: Kobi L <[email protected]>

Enable ELP authorization in AP mode and enable the use of the wakeup bit in the ELP register.

Introduce AP role sleep configuration which is disabled by default. When configured, it allows the AP to sleep when ELP is authorized for it.

---
 drivers/net/wireless/ti/wl12xx/main.c   |  1 +
 drivers/net/wireless/ti/wl18xx/acx.c    | 32 ++++++++++++++++++++++++++++++++
 drivers/net/wireless/ti/wl18xx/acx.h    | 25 +++++++++++++++++++++++--
 drivers/net/wireless/ti/wl18xx/conf.h   | 23 ++++++++++++++++++++++-
 drivers/net/wireless/ti/wl18xx/main.c   |  7 +++++++
 drivers/net/wireless/ti/wlcore/hw_ops.h |  9 +++++++++
 drivers/net/wireless/ti/wlcore/init.c   |  8 ++++++--
 drivers/net/wireless/ti/wlcore/ps.c     |  6 ------
 drivers/net/wireless/ti/wlcore/wlcore.h |  1 +
 9 files changed, 101 insertions(+), 11 deletions(-)
drivers/net/wireless/ti/wl12xx/main.c +1 -0
index b457069..42264e5 100644
@@ -1731,6 +1731,7 @@ static struct wlcore_ops wl12xx_ops = {
 	.lnk_low_prio		= wl12xx_lnk_low_prio,
 	.interrupt_notify	= NULL,
 	.rx_ba_filter		= NULL,
+	.ap_sleep		= NULL,
 };
 
 static struct ieee80211_sta_ht_cap wl12xx_ht_cap = {
drivers/net/wireless/ti/wl18xx/acx.c +32 -0
index 9d4b9aa..67f2a0e 100644
@@ -24,6 +24,7 @@
 #include "../wlcore/acx.h"
 
 #include "acx.h"
+#include "wl18xx.h"
 
 int wl18xx_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap,
 				  u32 sdio_blk_size, u32 extra_mem_blks,
@@ -250,3 +251,34 @@ out:
 	kfree(acx);
 	return ret;
 }
+
+int wl18xx_acx_ap_sleep(struct wl1271 *wl)
+{
+	struct wl18xx_priv *priv = wl->priv;
+	struct acx_ap_sleep_cfg *acx;
+	struct conf_ap_sleep_settings *conf = &priv->conf.ap_sleep;
+	int ret;
+
+	wl1271_debug(DEBUG_ACX, "acx config ap sleep");
+
+	acx = kzalloc(sizeof(*acx), GFP_KERNEL);
+	if (!acx) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
+	acx->idle_duty_cycle = conf->idle_duty_cycle;
+	acx->connected_duty_cycle = conf->connected_duty_cycle;
+	acx->max_stations_thresh = conf->max_stations_thresh;
+	acx->idle_conn_thresh = conf->idle_conn_thresh;
+
+	ret = wl1271_cmd_configure(wl, ACX_AP_SLEEP_CFG, acx, sizeof(*acx));
+	if (ret < 0) {
+		wl1271_warning("acx config ap-sleep failed: %d", ret);
+		goto out;
+	}
+
+out:
+	kfree(acx);
+	return ret;
+}
drivers/net/wireless/ti/wl18xx/acx.h +23 -2
index 1234bdc..4afccd4 100644
@@ -34,8 +34,8 @@ enum {
 	ACX_AUTO_RX_STREAMING		 = 0x0055,
 	ACX_PEER_CAP			 = 0x0056,
 	ACX_INTERRUPT_NOTIFY		 = 0x0057,
-	ACX_RX_BA_FILTER		 = 0x0058
-
+	ACX_RX_BA_FILTER		 = 0x0058,
+	ACX_AP_SLEEP_CFG                 = 0x0059
 };
 
 /* numbers of bits the length field takes (add 1 for the actual number) */
@@ -347,6 +347,26 @@ struct wl18xx_acx_rx_ba_filter {
 	u32 enable;
 };
 
+struct acx_ap_sleep_cfg {
+	struct acx_header header;
+	/* Duty Cycle (20-80% of staying Awake) for IDLE AP
+	 * (0: disable)
+	 */
+	u8 idle_duty_cycle;
+	/* Duty Cycle (20-80% of staying Awake) for Connected AP
+	 * (0: disable)
+	 */
+	u8 connected_duty_cycle;
+	/* Maximum stations that are allowed to be connected to AP
+	 *  (255: no limit)
+	 */
+	u8 max_stations_thresh;
+	/* Timeout till enabling the Sleep Mechanism after data stops
+	 * [unit: 100 msec]
+	 */
+	u8 idle_conn_thresh;
+} __packed;
+
 int wl18xx_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap,
 				  u32 sdio_blk_size, u32 extra_mem_blks,
 				  u32 len_field_size);
@@ -359,5 +379,6 @@ int wl18xx_acx_set_peer_cap(struct wl1271 *wl,
 			    u32 rate_set, u8 hlid);
 int wl18xx_acx_interrupt_notify_config(struct wl1271 *wl, bool action);
 int wl18xx_acx_rx_ba_filter(struct wl1271 *wl, bool action);
+int wl18xx_acx_ap_sleep(struct wl1271 *wl);
 
 #endif /* __WL18XX_ACX_H__ */
drivers/net/wireless/ti/wl18xx/conf.h +22 -1
index e34302e..71f1ec4 100644
@@ -23,7 +23,7 @@
 #define __WL18XX_CONF_H__
 
 #define WL18XX_CONF_MAGIC	0x10e100ca
-#define WL18XX_CONF_VERSION	(WLCORE_CONF_VERSION | 0x0006)
+#define WL18XX_CONF_VERSION	(WLCORE_CONF_VERSION | 0x0007)
 #define WL18XX_CONF_MASK	0x0000ffff
 #define WL18XX_CONF_SIZE	(WLCORE_CONF_SIZE + \
 				 sizeof(struct wl18xx_priv_conf))
@@ -110,12 +110,33 @@ struct wl18xx_ht_settings {
 	u8 mode;
 } __packed;
 
+struct conf_ap_sleep_settings {
+	/* Duty Cycle (20-80% of staying Awake) for IDLE AP
+	 * (0: disable)
+	 */
+	u8 idle_duty_cycle;
+	/* Duty Cycle (20-80% of staying Awake) for Connected AP
+	 * (0: disable)
+	 */
+	u8 connected_duty_cycle;
+	/* Maximum stations that are allowed to be connected to AP
+	 *  (255: no limit)
+	 */
+	u8 max_stations_thresh;
+	/* Timeout till enabling the Sleep Mechanism after data stops
+	 * [unit: 100 msec]
+	 */
+	u8 idle_conn_thresh;
+} __packed;
+
 struct wl18xx_priv_conf {
 	/* Module params structures */
 	struct wl18xx_ht_settings ht;
 
 	/* this structure is copied wholesale to FW */
 	struct wl18xx_mac_and_phy_params phy;
+
+	struct conf_ap_sleep_settings ap_sleep;
 } __packed;
 
 #endif /* __WL18XX_CONF_H__ */
drivers/net/wireless/ti/wl18xx/main.c +7 -0
index 7edb8a1..9e648a1 100644
@@ -568,6 +568,12 @@ static struct wl18xx_priv_conf wl18xx_default_priv_conf = {
 		.high_power_val_2nd		= 0xff,
 		.tx_rf_margin			= 1,
 	},
+	.ap_sleep = {               /* disabled by default */
+		.idle_duty_cycle        = 0,
+		.connected_duty_cycle   = 0,
+		.max_stations_thresh    = 0,
+		.idle_conn_thresh       = 0,
+	},
 };
 
 static const struct wlcore_partition_set wl18xx_ptable[PART_TABLE_LEN] = {
@@ -1696,6 +1702,7 @@ static struct wlcore_ops wl18xx_ops = {
 	.smart_config_set_group_key = wl18xx_cmd_smart_config_set_group_key,
 	.interrupt_notify = wl18xx_acx_interrupt_notify_config,
 	.rx_ba_filter	= wl18xx_acx_rx_ba_filter,
+	.ap_sleep	= wl18xx_acx_ap_sleep,
 };
 
 /* HT cap appropriate for wide channels in 2Ghz */
drivers/net/wireless/ti/wlcore/hw_ops.h +9 -0
index c2545ce..449050b 100644
@@ -234,6 +234,15 @@ wlcore_hw_rx_ba_filter(struct wl1271 *wl, bool action)
 }
 
 static inline int
+wlcore_hw_ap_sleep(struct wl1271 *wl)
+{
+	if (wl->ops->ap_sleep)
+		return wl->ops->ap_sleep(wl);
+
+	return 0;
+}
+
+static inline int
 wlcore_hw_set_peer_cap(struct wl1271 *wl,
 		       struct ieee80211_sta_ht_cap *ht_cap,
 		       bool allow_ht_operation,
drivers/net/wireless/ti/wlcore/init.c +6 -2
index 199e941..5ca1fb1 100644
@@ -392,6 +392,11 @@ static int wl1271_ap_hw_init(struct wl1271 *wl, struct wl12xx_vif *wlvif)
 	if (ret < 0)
 		return ret;
 
+	/* configure AP sleep, if enabled */
+	ret = wlcore_hw_ap_sleep(wl);
+	if (ret < 0)
+		return ret;
+
 	return 0;
 }
 
@@ -567,8 +572,7 @@ int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif)
 	/* consider all existing roles before configuring psm. */
 
 	if (wl->ap_count == 0 && is_ap) { /* first AP */
-		/* Configure for power always on */
-		ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM);
+		ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_ELP);
 		if (ret < 0)
 			return ret;
 
drivers/net/wireless/ti/wlcore/ps.c +0 -6
index b52516e..f3ed543 100644
@@ -56,9 +56,6 @@ void wl1271_elp_work(struct work_struct *work)
 		goto out;
 
 	wl12xx_for_each_wlvif(wl, wlvif) {
-		if (wlvif->bss_type == BSS_TYPE_AP_BSS)
-			goto out;
-
 		if (!test_bit(WLVIF_FLAG_IN_PS, &wlvif->flags) &&
 		    test_bit(WLVIF_FLAG_IN_USE, &wlvif->flags))
 			goto out;
@@ -95,9 +92,6 @@ void wl1271_ps_elp_sleep(struct wl1271 *wl)
 		return;
 
 	wl12xx_for_each_wlvif(wl, wlvif) {
-		if (wlvif->bss_type == BSS_TYPE_AP_BSS)
-			return;
-
 		if (!test_bit(WLVIF_FLAG_IN_PS, &wlvif->flags) &&
 		    test_bit(WLVIF_FLAG_IN_USE, &wlvif->flags))
 			return;
drivers/net/wireless/ti/wlcore/wlcore.h +1 -0
index 7860a4e..c8fe2ae 100644
@@ -118,6 +118,7 @@ struct wlcore_ops {
 			     struct wl1271_link *lnk);
 	int (*interrupt_notify)(struct wl1271 *wl, bool action);
 	int (*rx_ba_filter)(struct wl1271 *wl, bool action);
+	int (*ap_sleep)(struct wl1271 *wl);
 	int (*smart_config_start)(struct wl1271 *wl, u32 group_bitmap);
 	int (*smart_config_stop)(struct wl1271 *wl);
 	int (*smart_config_set_group_key)(struct wl1271 *wl, u16 group_id,
Signature · 1 line
1.8.5.2.229.g4448466.dirty
#6 lore raw

Re: [PATCH 06/13] wlcore: enable sleep during AP mode operation

Quoted 12 lines · Eliad Peller

From: Kobi L <[email protected]>

Enable ELP authorization in AP mode and enable the use of the wakeup bit in the ELP register.

Introduce AP role sleep configuration which is disabled by default. When configured, it allows the AP to sleep when ELP is authorized for it.

[...]

Quoted 35 lines
drivers/net/wireless/ti/wl18xx/conf.h +19 -1
index e34302e..71f1ec4 100644
@@ -23,7 +23,7 @@
 #define __WL18XX_CONF_H__
 
 #define WL18XX_CONF_MAGIC	0x10e100ca
-#define WL18XX_CONF_VERSION	(WLCORE_CONF_VERSION | 0x0006)
+#define WL18XX_CONF_VERSION	(WLCORE_CONF_VERSION | 0x0007)
 #define WL18XX_CONF_MASK	0x0000ffff
 #define WL18XX_CONF_SIZE	(WLCORE_CONF_SIZE + \
 				 sizeof(struct wl18xx_priv_conf))
@@ -110,12 +110,33 @@ struct wl18xx_ht_settings {
 	u8 mode;
 } __packed;
 
+struct conf_ap_sleep_settings {
+	/* Duty Cycle (20-80% of staying Awake) for IDLE AP
+	 * (0: disable)
+	 */
+	u8 idle_duty_cycle;
+	/* Duty Cycle (20-80% of staying Awake) for Connected AP
+	 * (0: disable)
+	 */
+	u8 connected_duty_cycle;
+	/* Maximum stations that are allowed to be connected to AP
+	 *  (255: no limit)
+	 */
+	u8 max_stations_thresh;
+	/* Timeout till enabling the Sleep Mechanism after data stops
+	 * [unit: 100 msec]
+	 */
+	u8 idle_conn_thresh;
+} __packed;

drivers/net/wireless/ti/wl18xx/conf.h struct wl18xx_ht_settings { · line 140

Quoted 10 lines
drivers/net/wireless/ti/wl18xx/conf.h +3 -0
+
 struct wl18xx_priv_conf {
 	/* Module params structures */
 	struct wl18xx_ht_settings ht;
 
 	/* this structure is copied wholesale to FW */
 	struct wl18xx_mac_and_phy_params phy;
+
+	struct conf_ap_sleep_settings ap_sleep;
 } __packed;

This patch requires a new firmware, loading of "wl18xx-conf.bin" from
[1] fails with:

Quoted 1 line

wlcore: ERROR configuration binary file size is wrong, expected 1226 got 1221

regards,
Marc

[1]
http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree/ti-connectivity

Signature · 4 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |
#7 lore raw

Re: [PATCH 06/13] wlcore: enable sleep during AP mode operation

hi Marc,

Quoted 14 lines · Marc Kleine-Budde
Quoted 5 lines · Eliad Peller

From: Kobi L <[email protected]>

Enable ELP authorization in AP mode and enable the use of the wakeup bit in the ELP register.

Quoted 7 lines

Introduce AP role sleep configuration which is disabled by default. When configured, it allows the AP to sleep when ELP is authorized for it.

Quoted 8 lines

[...]

This patch requires a new firmware, loading of "wl18xx-conf.bin" from
[1] fails with:

Quoted 1 line

wlcore: ERROR configuration binary file size is wrong, expected 1226 got 1221

thanks. seems you're right.

anyway, note that this file is not actual fw, but only the default configuration params.
you can just delete it, and the driver will load just fine. you can then recreate it with something like:
cat /sys/kernel/debug/ieee80211/phy0/wlcore/wl18xx/conf > /lib/firmware/ti-connectivity/wl18xx-conf.bin

actually, i don't think it makes much sense to have this file in the linux-firmware git at all.
i'll try handling it.

Eliad.

#8 lore raw

Re: [PATCH 06/13] wlcore: enable sleep during AP mode operation

Quoted 34 lines · Eliad Peller

hi Marc,

Quoted 14 lines · Marc Kleine-Budde
Quoted 5 lines · Eliad Peller

From: Kobi L <[email protected]>

Enable ELP authorization in AP mode and enable the use of the wakeup bit in the ELP register.

Quoted 7 lines

Introduce AP role sleep configuration which is disabled by default. When configured, it allows the AP to sleep when ELP is authorized for it.

Quoted 8 lines

[...]

This patch requires a new firmware, loading of "wl18xx-conf.bin" from
[1] fails with:

Quoted 1 line

wlcore: ERROR configuration binary file size is wrong, expected 1226 got 1221

thanks. seems you're right.

anyway, note that this file is not actual fw, but only the default configuration params.
you can just delete it, and the driver will load just fine. you can then recreate it with something like:
cat /sys/kernel/debug/ieee80211/phy0/wlcore/wl18xx/conf > /lib/firmware/ti-connectivity/wl18xx-conf.bin

Quoted 3 lines

actually, i don't think it makes much sense to have this file in the linux-firmware git at all.
i'll try handling it.

Thanks, there are more file with size of ~1k, are they optional, too? What's the "error" message if these optional files are not present?

From working with $CUSTOMERS I gained the impression, messages like "error failed to load...." for optional file don't shine the best light on Linux, a neutral "using default values" is far better.

Marc

Signature · 4 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |
#9 lore raw

Re: [PATCH 06/13] wlcore: enable sleep during AP mode operation

Quoted 35 lines · Marc Kleine-Budde
Quoted 34 lines · Eliad Peller

hi Marc,

Quoted 14 lines · Marc Kleine-Budde
Quoted 5 lines · Eliad Peller

From: Kobi L <[email protected]>

Enable ELP authorization in AP mode and enable the use of the wakeup bit in the ELP register.

Quoted 7 lines

Introduce AP role sleep configuration which is disabled by default. When configured, it allows the AP to sleep when ELP is authorized for it.

Quoted 8 lines

[...]

This patch requires a new firmware, loading of "wl18xx-conf.bin" from
[1] fails with:

Quoted 1 line

wlcore: ERROR configuration binary file size is wrong, expected 1226 got 1221

thanks. seems you're right.

anyway, note that this file is not actual fw, but only the default configuration params.
you can just delete it, and the driver will load just fine. you can then recreate it with something like:
cat /sys/kernel/debug/ieee80211/phy0/wlcore/wl18xx/conf > /lib/firmware/ti-connectivity/wl18xx-conf.bin

Quoted 7 lines
Quoted 3 lines

actually, i don't think it makes much sense to have this file in the linux-firmware git at all.
i'll try handling it.

Thanks, there are more file with size of ~1k, are they optional, too? What's the "error" message if these optional files are not present?

AFAIK, the other nvs files are basically required for proper operation.

Quoted 3 lines

From working with $CUSTOMERS I gained the impression, messages like "error failed to load...." for optional file don't shine the best light on Linux, a neutral "using default values" is far better.

i agree :)

Eliad.

#10 lore raw

Re: [PATCH 06/13] wlcore: enable sleep during AP mode operation

Hi Eliad,

Quoted 43 lines · Eliad Peller
Quoted 35 lines · Marc Kleine-Budde
Quoted 34 lines · Eliad Peller

hi Marc,

Quoted 14 lines · Marc Kleine-Budde
Quoted 5 lines · Eliad Peller

From: Kobi L <[email protected]>

Enable ELP authorization in AP mode and enable the use of the wakeup bit in the ELP register.

Quoted 7 lines

Introduce AP role sleep configuration which is disabled by default. When configured, it allows the AP to sleep when ELP is authorized for it.

Quoted 8 lines

[...]

This patch requires a new firmware, loading of "wl18xx-conf.bin" from
[1] fails with:

Quoted 1 line

wlcore: ERROR configuration binary file size is wrong, expected 1226 got 1221

thanks. seems you're right.

anyway, note that this file is not actual fw, but only the default configuration params.
you can just delete it, and the driver will load just fine. you can then recreate it with something like:
cat /sys/kernel/debug/ieee80211/phy0/wlcore/wl18xx/conf > /lib/firmware/ti-connectivity/wl18xx-conf.bin

Quoted 7 lines
Quoted 3 lines

actually, i don't think it makes much sense to have this file in the linux-firmware git at all.
i'll try handling it.

Thanks, there are more file with size of ~1k, are they optional, too? What's the "error" message if these optional files are not present?

Quoted 6 lines

AFAIK, the other nvs files are basically required for proper operation.

Quoted 3 lines

From working with $CUSTOMERS I gained the impression, messages like "error failed to load...." for optional file don't shine the best light on Linux, a neutral "using default values" is far better.

i agree :)

Added Yaniv Machani in CC.

Any update on the wl18xx-conf.bin issue? This file is still in linux-firmware repo.

I have following problem. My Jorjin chip requires wl18xx-conf.bin compiled from special *.ini file.
https://github.com/TI-OpenLink/18xx-ti-utils/tree/master/wlconf
doesn't seem to support v4 firmware as it creates 1221 bytes conf file. Where can I get proper wlconf and companion files (dictionary.txt, struct.bin etc.)?

Yegor

#11 lore raw

Re: [PATCH 06/13] wlcore: enable sleep during AP mode operation

hi Yegor,

Quoted 49 lines · Yegor Yefremov
Quoted 48 lines · Eliad Peller
Quoted 35 lines · Marc Kleine-Budde
Quoted 34 lines · Eliad Peller

hi Marc,

Quoted 14 lines · Marc Kleine-Budde
Quoted 5 lines · Eliad Peller

From: Kobi L <[email protected]>

Enable ELP authorization in AP mode and enable the use of the wakeup bit in the ELP register.

Quoted 7 lines

Introduce AP role sleep configuration which is disabled by default. When configured, it allows the AP to sleep when ELP is authorized for it.

Quoted 8 lines

[...]

This patch requires a new firmware, loading of "wl18xx-conf.bin" from
[1] fails with:

Quoted 1 line

wlcore: ERROR configuration binary file size is wrong, expected 1226 got 1221

thanks. seems you're right.

anyway, note that this file is not actual fw, but only the default configuration params.
you can just delete it, and the driver will load just fine. you can then recreate it with something like:
cat /sys/kernel/debug/ieee80211/phy0/wlcore/wl18xx/conf > /lib/firmware/ti-connectivity/wl18xx-conf.bin

Quoted 7 lines
Quoted 3 lines

actually, i don't think it makes much sense to have this file in the linux-firmware git at all.
i'll try handling it.

Thanks, there are more file with size of ~1k, are they optional, too? What's the "error" message if these optional files are not present?

AFAIK, the other nvs files are basically required for proper operation.

Quoted 3 lines

From working with $CUSTOMERS I gained the impression, messages like "error failed to load...." for optional file don't shine the best light on Linux, a neutral "using default values" is far better.

Quoted 7 lines
Quoted 1 line

i agree :)

Added Yaniv Machani in CC.

Any update on the wl18xx-conf.bin issue? This file is still in linux-firmware repo.

thanks for the reminder :)

just sent a patch to fallback to default conf in case of invalid/outdated conf.

Eliad.

#12 lore raw

Re: [PATCH 06/13] wlcore: enable sleep during AP mode operation

Quoted 55 lines · Eliad Peller

hi Yegor,

Quoted 51 lines · Yegor Yefremov
Quoted 49 lines · Eliad Peller
Quoted 35 lines · Marc Kleine-Budde
Quoted 34 lines · Eliad Peller

hi Marc,

Quoted 14 lines · Marc Kleine-Budde
Quoted 5 lines · Eliad Peller

From: Kobi L <[email protected]>

Enable ELP authorization in AP mode and enable the use of the wakeup bit in the ELP register.

Quoted 7 lines

Introduce AP role sleep configuration which is disabled by default. When configured, it allows the AP to sleep when ELP is authorized for it.

Quoted 8 lines

[...]

This patch requires a new firmware, loading of "wl18xx-conf.bin" from
[1] fails with:

Quoted 1 line

wlcore: ERROR configuration binary file size is wrong, expected 1226 got 1221

thanks. seems you're right.

anyway, note that this file is not actual fw, but only the default configuration params.
you can just delete it, and the driver will load just fine. you can then recreate it with something like:
cat /sys/kernel/debug/ieee80211/phy0/wlcore/wl18xx/conf > /lib/firmware/ti-connectivity/wl18xx-conf.bin

Quoted 7 lines
Quoted 3 lines

actually, i don't think it makes much sense to have this file in the linux-firmware git at all.
i'll try handling it.

Thanks, there are more file with size of ~1k, are they optional, too? What's the "error" message if these optional files are not present?

AFAIK, the other nvs files are basically required for proper operation.

Quoted 3 lines

From working with $CUSTOMERS I gained the impression, messages like "error failed to load...." for optional file don't shine the best light on Linux, a neutral "using default values" is far better.

i agree :)

Quoted 8 lines
Quoted 5 lines

Added Yaniv Machani in CC.

Any update on the wl18xx-conf.bin issue? This file is still in linux-firmware repo.

thanks for the reminder :)

just sent a patch to fallback to default conf in case of invalid/outdated conf.

Great.

@Yaniv: but how to create a new conf with 1226 bytes for existing ini file?

Yegor

#13 lore raw

PATCH 7/13 wl18xx: add radar detection implementation

In reply to Eliad Peller

Add support for CAC start/stop commands, and pass radar detection events from the fw to mac80211.

Bump fw name (to wl18xx-fw-4.bin) and min fw version (to 8.9.*.*.11), and align event mailbox accordingly.

---
 drivers/net/wireless/ti/wl18xx/cmd.c      |  31 ++++++
 drivers/net/wireless/ti/wl18xx/cmd.h      |  11 +++
 drivers/net/wireless/ti/wl18xx/event.c    |  21 ++++
 drivers/net/wireless/ti/wl18xx/event.h    |  14 ++-
 drivers/net/wireless/ti/wl18xx/main.c     |   4 +-
 drivers/net/wireless/ti/wl18xx/wl18xx.h   |   4 +-
 drivers/net/wireless/ti/wlcore/cmd.c      |   3 +-
 drivers/net/wireless/ti/wlcore/cmd.h      |   6 ++
 drivers/net/wireless/ti/wlcore/hw_ops.h   |   9 ++
 drivers/net/wireless/ti/wlcore/main.c     | 159 +++++++++++++++++++++++++++++-
 drivers/net/wireless/ti/wlcore/wlcore.h   |   2 +
 drivers/net/wireless/ti/wlcore/wlcore_i.h |   2 +
 12 files changed, 257 insertions(+), 9 deletions(-)
drivers/net/wireless/ti/wl18xx/cmd.c +31 -0
index 44f0b20..10f9d1c 100644
@@ -167,3 +167,34 @@ out_free:
 out:
 	return ret;
 }
+
+int wl18xx_cmd_set_cac(struct wl1271 *wl, struct wl12xx_vif *wlvif, bool start)
+{
+	struct wlcore_cmd_cac_start *cmd;
+	int ret = 0;
+
+	wl1271_debug(DEBUG_CMD, "cmd cac (channel %d) %s",
+		     wlvif->channel, start ? "start" : "stop");
+
+	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+	if (!cmd)
+		return -ENOMEM;
+
+	cmd->role_id = wlvif->role_id;
+	cmd->channel = wlvif->channel;
+	if (wlvif->band == IEEE80211_BAND_5GHZ)
+		cmd->band = WLCORE_BAND_5GHZ;
+	cmd->bandwidth = wlcore_get_native_channel_type(wlvif->channel_type);
+
+	ret = wl1271_cmd_send(wl,
+			      start ? CMD_CAC_START : CMD_CAC_STOP,
+			      cmd, sizeof(*cmd), 0);
+	if (ret < 0) {
+		wl1271_error("failed to send cac command");
+		goto out_free;
+	}
+
+out_free:
+	kfree(cmd);
+	return ret;
+}
drivers/net/wireless/ti/wl18xx/cmd.h +11 -0
index 92499e2..91b3e2f 100644
@@ -59,6 +59,16 @@ struct wl18xx_cmd_smart_config_set_group_key {
 	u8 key[16];
 } __packed;
 
+/* cac_start and cac_stop share the same params */
+struct wlcore_cmd_cac_start {
+	struct wl1271_cmd_header header;
+
+	u8 role_id;
+	u8 channel;
+	u8 band;
+	u8 bandwidth;
+} __packed;
+
 int wl18xx_cmd_channel_switch(struct wl1271 *wl,
 			      struct wl12xx_vif *wlvif,
 			      struct ieee80211_channel_switch *ch_switch);
@@ -66,4 +76,5 @@ int wl18xx_cmd_smart_config_start(struct wl1271 *wl, u32 group_bitmap);
 int wl18xx_cmd_smart_config_stop(struct wl1271 *wl);
 int wl18xx_cmd_smart_config_set_group_key(struct wl1271 *wl, u16 group_id,
 					  u8 key_len, u8 *key);
+int wl18xx_cmd_set_cac(struct wl1271 *wl, struct wl12xx_vif *wlvif, bool start);
 #endif
drivers/net/wireless/ti/wl18xx/event.c +21 -0
index eb1848e..c28f068 100644
@@ -47,6 +47,19 @@ int wl18xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event,
 	return wlcore_cmd_wait_for_event_or_timeout(wl, local_event, timeout);
 }
 
+static const char *wl18xx_radar_type_decode(u8 radar_type)
+{
+	switch (radar_type) {
+	case RADAR_TYPE_REGULAR:
+		return "REGULAR";
+	case RADAR_TYPE_CHIRP:
+		return "CHIRP";
+	case RADAR_TYPE_NONE:
+	default:
+		return "N/A";
+	}
+}
+
 static int wlcore_smart_config_sync_event(struct wl1271 *wl, u8 sync_channel,
 					  u8 sync_band)
 {
@@ -115,6 +128,14 @@ int wl18xx_process_mailbox_events(struct wl1271 *wl)
 			wl18xx_scan_completed(wl, wl->scan_wlvif);
 	}
 
+	if (vector & RADAR_DETECTED_EVENT_ID) {
+		wl1271_info("radar event: channel %d type %s",
+			    mbox->radar_channel,
+			    wl18xx_radar_type_decode(mbox->radar_type));
+
+		ieee80211_radar_detected(wl->hw);
+	}
+
 	if (vector & PERIODIC_SCAN_REPORT_EVENT_ID) {
 		wl1271_debug(DEBUG_EVENT,
 			     "PERIODIC_SCAN_REPORT_EVENT (results %d)",
drivers/net/wireless/ti/wl18xx/event.h +13 -1
index 0680312..266ee87 100644
@@ -42,6 +42,12 @@ enum {
 	SMART_CONFIG_DECODE_EVENT_ID		 = BIT(23),
 };
 
+enum wl18xx_radar_types {
+	RADAR_TYPE_NONE,
+	RADAR_TYPE_REGULAR,
+	RADAR_TYPE_CHIRP
+};
+
 struct wl18xx_event_mailbox {
 	__le32 events_vector;
 
@@ -83,13 +89,19 @@ struct wl18xx_event_mailbox {
 	u8 sc_token_len;
 	u8 padding1;
 	u8 sc_ssid[32];
-	u8 sc_pwd[32];
+	u8 sc_pwd[64];
 	u8 sc_token[32];
 
 	/* smart config sync channel */
 	u8 sc_sync_channel;
 	u8 sc_sync_band;
 	u8 padding2[2];
+
+	/* radar detect */
+	u8 radar_channel;
+	u8 radar_type;
+
+	u8 padding3[2];
 } __packed;
 
 int wl18xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event,
drivers/net/wireless/ti/wl18xx/main.c +3 -1
index 9e648a1..48f7628 100644
@@ -655,7 +655,7 @@ static const struct wl18xx_clk_cfg wl18xx_clk_table[NUM_CLOCK_CONFIGS] = {
 };
 
 /* TODO: maybe move to a new header file? */
-#define WL18XX_FW_NAME "ti-connectivity/wl18xx-fw-3.bin"
+#define WL18XX_FW_NAME "ti-connectivity/wl18xx-fw-4.bin"
 
 static int wl18xx_identify_chip(struct wl1271 *wl)
 {
@@ -990,6 +990,7 @@ static int wl18xx_boot(struct wl1271 *wl)
 
 	wl->event_mask = BSS_LOSS_EVENT_ID |
 		SCAN_COMPLETE_EVENT_ID |
+		RADAR_DETECTED_EVENT_ID |
 		RSSI_SNR_TRIGGER_0_EVENT_ID |
 		PERIODIC_SCAN_COMPLETE_EVENT_ID |
 		PERIODIC_SCAN_REPORT_EVENT_ID |
@@ -1703,6 +1704,7 @@ static struct wlcore_ops wl18xx_ops = {
 	.interrupt_notify = wl18xx_acx_interrupt_notify_config,
 	.rx_ba_filter	= wl18xx_acx_rx_ba_filter,
 	.ap_sleep	= wl18xx_acx_ap_sleep,
+	.set_cac	= wl18xx_cmd_set_cac,
 };
 
 /* HT cap appropriate for wide channels in 2Ghz */
drivers/net/wireless/ti/wl18xx/wl18xx.h +2 -2
index 6a2b880..71e9e38 100644
@@ -26,10 +26,10 @@
 
 /* minimum FW required for driver */
 #define WL18XX_CHIP_VER		8
-#define WL18XX_IFTYPE_VER	8
+#define WL18XX_IFTYPE_VER	9
 #define WL18XX_MAJOR_VER	WLCORE_FW_VER_IGNORE
 #define WL18XX_SUBTYPE_VER	WLCORE_FW_VER_IGNORE
-#define WL18XX_MINOR_VER	13
+#define WL18XX_MINOR_VER	11
 
 #define WL18XX_CMD_MAX_SIZE          740
 
drivers/net/wireless/ti/wlcore/cmd.c +2 -1
index b826619..aacad4e 100644
@@ -403,7 +403,7 @@ void wl12xx_free_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid)
 	WARN_ON_ONCE(wl->active_link_count < 0);
 }
 
-static u8 wlcore_get_native_channel_type(u8 nl_channel_type)
+u8 wlcore_get_native_channel_type(u8 nl_channel_type)
 {
 	switch (nl_channel_type) {
 	case NL80211_CHAN_NO_HT:
@@ -419,6 +419,7 @@ static u8 wlcore_get_native_channel_type(u8 nl_channel_type)
 		return WLCORE_CHAN_NO_HT;
 	}
 }
+EXPORT_SYMBOL_GPL(wlcore_get_native_channel_type);
 
 static int wl12xx_cmd_role_start_dev(struct wl1271 *wl,
 				     struct wl12xx_vif *wlvif,
drivers/net/wireless/ti/wlcore/cmd.h +6 -0
index 453684a..06bdee2 100644
@@ -105,6 +105,7 @@ int wl12xx_allocate_link(struct wl1271 *wl, struct wl12xx_vif *wlvif,
 void wl12xx_free_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid);
 int wlcore_cmd_wait_for_event_or_timeout(struct wl1271 *wl,
 					 u32 mask, bool *timeout);
+u8 wlcore_get_native_channel_type(u8 nl_channel_type);
 
 enum wl1271_commands {
 	CMD_INTERROGATE	= 1, /* use this to read information elements */
@@ -172,6 +173,11 @@ enum wl1271_commands {
 	CMD_SMART_CONFIG_STOP		= 62,
 	CMD_SMART_CONFIG_SET_GROUP_KEY	= 63,
 
+	CMD_CAC_START			= 64,
+	CMD_CAC_STOP			= 65,
+	CMD_DFS_MASTER_RESTART		= 66,
+	CMD_DFS_RADAR_DETECTION_DEBUG	= 67,
+
 	MAX_COMMAND_ID = 0xFFFF,
 };
 
drivers/net/wireless/ti/wlcore/hw_ops.h +9 -0
index 449050b..42fef84 100644
@@ -311,4 +311,13 @@ wlcore_smart_config_set_group_key(struct wl1271 *wl, u16 group_id,
 
 	return wl->ops->smart_config_set_group_key(wl, group_id, key_len, key);
 }
+
+static inline int
+wlcore_hw_set_cac(struct wl1271 *wl, struct wl12xx_vif *wlvif, bool start)
+{
+	if (!wl->ops->set_cac)
+		return -EINVAL;
+
+	return wl->ops->set_cac(wl, wlvif, start);
+}
 #endif
drivers/net/wireless/ti/wlcore/main.c +155 -4

202 lines not on this page · raw message

drivers/net/wireless/ti/wlcore/wlcore.h +2 -0
index c8fe2ae..caee58f 100644
@@ -123,6 +123,8 @@ struct wlcore_ops {
 	int (*smart_config_stop)(struct wl1271 *wl);
 	int (*smart_config_set_group_key)(struct wl1271 *wl, u16 group_id,
 					  u8 key_len, u8 *key);
+	int (*set_cac)(struct wl1271 *wl, struct wl12xx_vif *wlvif,
+		       bool start);
 };
 
 enum wlcore_partitions {
drivers/net/wireless/ti/wlcore/wlcore_i.h +2 -0
index 811851d..b2bdb13 100644
@@ -434,6 +434,8 @@ struct wl12xx_vif {
 
 	bool wmm_enabled;
 
+	bool radar_enabled;
+
 	/* Rx Streaming */
 	struct work_struct rx_streaming_enable_work;
 	struct work_struct rx_streaming_disable_work;
Signature · 1 line
1.8.5.2.229.g4448466.dirty
#14 lore raw

PATCH 8/13 wl18xx: add debugfs file to emulate radar event

In reply to Eliad Peller

Add debugfs file to emulate radar detection through a special fw cmd (which in turn will generate radar event)

---
 drivers/net/wireless/ti/wl18xx/cmd.c     | 26 +++++++++++++++++++
 drivers/net/wireless/ti/wl18xx/cmd.h     |  8 ++++++
 drivers/net/wireless/ti/wl18xx/debugfs.c | 43 ++++++++++++++++++++++++++++++++
 drivers/net/wireless/ti/wlcore/ps.c      |  2 ++
 4 files changed, 79 insertions(+)
drivers/net/wireless/ti/wl18xx/cmd.c +26 -0
index 10f9d1c..68e12e5 100644
@@ -198,3 +198,29 @@ out_free:
 	kfree(cmd);
 	return ret;
 }
+
+int wl18xx_cmd_radar_detection_debug(struct wl1271 *wl, u8 channel)
+{
+	struct wl18xx_cmd_dfs_radar_debug *cmd;
+	int ret = 0;
+
+	wl1271_debug(DEBUG_CMD, "cmd radar detection debug (chan %d)",
+		     channel);
+
+	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+	if (!cmd)
+		return -ENOMEM;
+
+	cmd->channel = channel;
+
+	ret = wl1271_cmd_send(wl, CMD_DFS_RADAR_DETECTION_DEBUG,
+			      cmd, sizeof(*cmd), 0);
+	if (ret < 0) {
+		wl1271_error("failed to send radar detection debug command");
+		goto out_free;
+	}
+
+out_free:
+	kfree(cmd);
+	return ret;
+}
drivers/net/wireless/ti/wl18xx/cmd.h +8 -0
index 91b3e2f..0809b92 100644
@@ -59,6 +59,13 @@ struct wl18xx_cmd_smart_config_set_group_key {
 	u8 key[16];
 } __packed;
 
+struct wl18xx_cmd_dfs_radar_debug {
+	struct wl1271_cmd_header header;
+
+	u8 channel;
+	u8 padding[3];
+} __packed;
+
 /* cac_start and cac_stop share the same params */
 struct wlcore_cmd_cac_start {
 	struct wl1271_cmd_header header;
@@ -77,4 +84,5 @@ int wl18xx_cmd_smart_config_stop(struct wl1271 *wl);
 int wl18xx_cmd_smart_config_set_group_key(struct wl1271 *wl, u16 group_id,
 					  u8 key_len, u8 *key);
 int wl18xx_cmd_set_cac(struct wl1271 *wl, struct wl12xx_vif *wlvif, bool start);
+int wl18xx_cmd_radar_detection_debug(struct wl1271 *wl, u8 channel);
 #endif
drivers/net/wireless/ti/wl18xx/debugfs.c +43 -0

64 lines not on this page · raw message

drivers/net/wireless/ti/wlcore/ps.c +2 -0
index f3ed543..4cd316e 100644
@@ -102,6 +102,7 @@ void wl1271_ps_elp_sleep(struct wl1271 *wl)
 	ieee80211_queue_delayed_work(wl->hw, &wl->elp_work,
 				     msecs_to_jiffies(timeout));
 }
+EXPORT_SYMBOL_GPL(wl1271_ps_elp_sleep);
 
 int wl1271_ps_elp_wakeup(struct wl1271 *wl)
 {
@@ -169,6 +170,7 @@ err:
 out:
 	return 0;
 }
+EXPORT_SYMBOL_GPL(wl1271_ps_elp_wakeup);
 
 int wl1271_ps_set_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif,
 		       enum wl1271_cmd_ps_mode mode)
Signature · 1 line
1.8.5.2.229.g4448466.dirty
#15 lore raw

PATCH 9/13 wlcore: add support for ap csa

In reply to Eliad Peller

Support ap csa support by implementing the channel_switch_beacon() mac80211 op.

---
 drivers/net/wireless/ti/wl18xx/cmd.c   | 11 +++--
 drivers/net/wireless/ti/wlcore/event.c | 10 +++--
 drivers/net/wireless/ti/wlcore/main.c  | 81 +++++++++++++++++++++++++++++++++-
 3 files changed, 95 insertions(+), 7 deletions(-)
drivers/net/wireless/ti/wl18xx/cmd.c +8 -3
index 68e12e5..5731950 100644
@@ -33,7 +33,8 @@ int wl18xx_cmd_channel_switch(struct wl1271 *wl,
 	u32 supported_rates;
 	int ret;
 
-	wl1271_debug(DEBUG_ACX, "cmd channel switch");
+	wl1271_debug(DEBUG_ACX, "cmd channel switch (count=%d)",
+		     ch_switch->count);
 
 	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
 	if (!cmd) {
@@ -60,8 +61,12 @@ int wl18xx_cmd_channel_switch(struct wl1271 *wl,
 		goto out_free;
 	}
 
-	supported_rates = CONF_TX_ENABLED_RATES | CONF_TX_MCS_RATES |
-			  wlcore_hw_sta_get_ap_rate_mask(wl, wlvif);
+	supported_rates = CONF_TX_ENABLED_RATES | CONF_TX_MCS_RATES;
+	if (wlvif->bss_type == BSS_TYPE_STA_BSS)
+		supported_rates |= wlcore_hw_sta_get_ap_rate_mask(wl, wlvif);
+	else
+		supported_rates |=
+			wlcore_hw_ap_get_mimo_wide_rate_mask(wl, wlvif);
 	if (wlvif->p2p)
 		supported_rates &= ~CONF_TX_CCK_RATES;
 	cmd->local_supported_rates = cpu_to_le32(supported_rates);
drivers/net/wireless/ti/wlcore/event.c +7 -3
index 5153640..69a2661 100644
@@ -139,7 +139,7 @@ void wlcore_event_channel_switch(struct wl1271 *wl,
 	wl1271_debug(DEBUG_EVENT, "%s: roles=0x%lx success=%d",
 		     __func__, roles_bitmap, success);
 
-	wl12xx_for_each_wlvif_sta(wl, wlvif) {
+	wl12xx_for_each_wlvif(wl, wlvif) {
 		if (wlvif->role_id == WL12XX_INVALID_ROLE_ID ||
 		    !test_bit(wlvif->role_id , &roles_bitmap))
 			continue;
@@ -150,8 +150,12 @@ void wlcore_event_channel_switch(struct wl1271 *wl,
 
 		vif = wl12xx_wlvif_to_vif(wlvif);
 
-		ieee80211_chswitch_done(vif, success);
-		cancel_delayed_work(&wlvif->channel_switch_work);
+		if (wlvif->bss_type == BSS_TYPE_STA_BSS) {
+			ieee80211_chswitch_done(vif, success);
+			cancel_delayed_work(&wlvif->channel_switch_work);
+		} else {
+			ieee80211_csa_finish(vif);
+		}
 	}
 }
 EXPORT_SYMBOL_GPL(wlcore_event_channel_switch);
drivers/net/wireless/ti/wlcore/main.c +80 -1

99 lines not on this page · raw message

Signature · 1 line
1.8.5.2.229.g4448466.dirty
#16 lore raw

PATCH 10/13 wlcore: add dfs master restart calls

In reply to Eliad Peller

call wlcore_cmd_dfs_master_restart when starting
the ap on a new channel (after csa is done).

Add a new WLVIF_FLAG_BEACON_DISABLED flag to
indicate that dfs_master_restart command
is required.

---
 drivers/net/wireless/ti/wl18xx/cmd.c      | 25 +++++++++++++++++++++++++
 drivers/net/wireless/ti/wl18xx/cmd.h      |  8 ++++++++
 drivers/net/wireless/ti/wl18xx/main.c     |  1 +
 drivers/net/wireless/ti/wlcore/event.c    |  1 +
 drivers/net/wireless/ti/wlcore/hw_ops.h   |  9 +++++++++
 drivers/net/wireless/ti/wlcore/main.c     | 10 +++++++++-
 drivers/net/wireless/ti/wlcore/wlcore.h   |  1 +
 drivers/net/wireless/ti/wlcore/wlcore_i.h |  1 +
 8 files changed, 55 insertions(+), 1 deletion(-)
drivers/net/wireless/ti/wl18xx/cmd.c +25 -0
index 5731950..a8d176d 100644
@@ -229,3 +229,28 @@ out_free:
 	kfree(cmd);
 	return ret;
 }
+
+int wl18xx_cmd_dfs_master_restart(struct wl1271 *wl, struct wl12xx_vif *wlvif)
+{
+	struct wl18xx_cmd_dfs_master_restart *cmd;
+	int ret = 0;
+
+	wl1271_debug(DEBUG_CMD, "cmd dfs master restart (role %d)",
+		     wlvif->role_id);
+
+	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+	if (!cmd)
+		return -ENOMEM;
+
+	cmd->role_id = wlvif->role_id;
+
+	ret = wl1271_cmd_send(wl, CMD_DFS_MASTER_RESTART,
+			      cmd, sizeof(*cmd), 0);
+	if (ret < 0) {
+		wl1271_error("failed to send dfs master restart command");
+		goto out_free;
+	}
+out_free:
+	kfree(cmd);
+	return ret;
+}
drivers/net/wireless/ti/wl18xx/cmd.h +8 -0
index 0809b92..7f9440a 100644
@@ -66,6 +66,13 @@ struct wl18xx_cmd_dfs_radar_debug {
 	u8 padding[3];
 } __packed;
 
+struct wl18xx_cmd_dfs_master_restart {
+	struct wl1271_cmd_header header;
+
+	u8 role_id;
+	u8 padding[3];
+} __packed;
+
 /* cac_start and cac_stop share the same params */
 struct wlcore_cmd_cac_start {
 	struct wl1271_cmd_header header;
@@ -85,4 +92,5 @@ int wl18xx_cmd_smart_config_set_group_key(struct wl1271 *wl, u16 group_id,
 					  u8 key_len, u8 *key);
 int wl18xx_cmd_set_cac(struct wl1271 *wl, struct wl12xx_vif *wlvif, bool start);
 int wl18xx_cmd_radar_detection_debug(struct wl1271 *wl, u8 channel);
+int wl18xx_cmd_dfs_master_restart(struct wl1271 *wl, struct wl12xx_vif *wlvif);
 #endif
drivers/net/wireless/ti/wl18xx/main.c +1 -0
index 48f7628..604de24 100644
@@ -1705,6 +1705,7 @@ static struct wlcore_ops wl18xx_ops = {
 	.rx_ba_filter	= wl18xx_acx_rx_ba_filter,
 	.ap_sleep	= wl18xx_acx_ap_sleep,
 	.set_cac	= wl18xx_cmd_set_cac,
+	.dfs_master_restart	= wl18xx_cmd_dfs_master_restart,
 };
 
 /* HT cap appropriate for wide channels in 2Ghz */
drivers/net/wireless/ti/wlcore/event.c +1 -0
index 69a2661..c42e789 100644
@@ -154,6 +154,7 @@ void wlcore_event_channel_switch(struct wl1271 *wl,
 			ieee80211_chswitch_done(vif, success);
 			cancel_delayed_work(&wlvif->channel_switch_work);
 		} else {
+			set_bit(WLVIF_FLAG_BEACON_DISABLED, &wlvif->flags);
 			ieee80211_csa_finish(vif);
 		}
 	}
drivers/net/wireless/ti/wlcore/hw_ops.h +9 -0
index 42fef84..eec5693 100644
@@ -320,4 +320,13 @@ wlcore_hw_set_cac(struct wl1271 *wl, struct wl12xx_vif *wlvif, bool start)
 
 	return wl->ops->set_cac(wl, wlvif, start);
 }
+
+static inline int
+wlcore_hw_dfs_master_restart(struct wl1271 *wl, struct wl12xx_vif *wlvif)
+{
+	if (!wl->ops->dfs_master_restart)
+		return -EINVAL;
+
+	return wl->ops->dfs_master_restart(wl, wlvif);
+}
 #endif
drivers/net/wireless/ti/wlcore/main.c +9 -1
index 9a35f30..362515f 100644
@@ -4128,8 +4128,14 @@ static int wl1271_bss_beacon_info_changed(struct wl1271 *wl,
 		ret = wlcore_set_beacon_template(wl, vif, is_ap);
 		if (ret < 0)
 			goto out;
-	}
 
+		if (test_and_clear_bit(WLVIF_FLAG_BEACON_DISABLED,
+				       &wlvif->flags)) {
+			ret = wlcore_hw_dfs_master_restart(wl, wlvif);
+			if (ret < 0)
+				goto out;
+		}
+	}
 out:
 	if (ret != 0)
 		wl1271_error("beacon info change failed: %d", ret);
@@ -4775,6 +4781,8 @@ static int __wlcore_switch_vif_chan(struct wl1271 *wl,
 	if (WARN_ON_ONCE(wlvif->bss_type != BSS_TYPE_AP_BSS))
 		return 0;
 
+	WARN_ON(!test_bit(WLVIF_FLAG_BEACON_DISABLED, &wlvif->flags));
+
 	if (wlvif->radar_enabled) {
 		wl1271_debug(DEBUG_MAC80211, "Stop radar detection");
 		wlcore_hw_set_cac(wl, wlvif, false);
drivers/net/wireless/ti/wlcore/wlcore.h +1 -0
index caee58f..581c479 100644
@@ -125,6 +125,7 @@ struct wlcore_ops {
 					  u8 key_len, u8 *key);
 	int (*set_cac)(struct wl1271 *wl, struct wl12xx_vif *wlvif,
 		       bool start);
+	int (*dfs_master_restart)(struct wl1271 *wl, struct wl12xx_vif *wlvif);
 };
 
 enum wlcore_partitions {
drivers/net/wireless/ti/wlcore/wlcore_i.h +1 -0
index b2bdb13..3396ce5 100644
@@ -251,6 +251,7 @@ enum wl12xx_vif_flags {
 	WLVIF_FLAG_AP_PROBE_RESP_SET,
 	WLVIF_FLAG_IN_USE,
 	WLVIF_FLAG_ACTIVE,
+	WLVIF_FLAG_BEACON_DISABLED,
 };
 
 struct wl12xx_vif;
Signature · 1 line
1.8.5.2.229.g4448466.dirty
#17 lore raw

PATCH 11/13 wlcore: allow using dfs channels

In reply to Eliad Peller

Since we are going to support dfs channels, there is no reason to mark them as NO_IR (having
the DFS flag is enough anyway).

Additionally, when setting the regdomain configuration, enable usable dfs channels.

---
 drivers/net/wireless/ti/wlcore/cmd.c  | 16 +++++++++-------
 drivers/net/wireless/ti/wlcore/main.c | 14 --------------
 2 files changed, 9 insertions(+), 21 deletions(-)
drivers/net/wireless/ti/wlcore/cmd.c +9 -7
index aacad4e..50ca10c 100644
@@ -1687,9 +1687,7 @@ int wlcore_cmd_regdomain_config_locked(struct wl1271 *wl)
 {
 	struct wl12xx_cmd_regdomain_dfs_config *cmd = NULL;
 	int ret = 0, i, b, ch_bit_idx;
-	struct ieee80211_channel *channel;
 	u32 tmp_ch_bitmap[2];
-	u16 ch;
 	struct wiphy *wiphy = wl->hw->wiphy;
 	struct ieee80211_supported_band *band;
 	bool timeout = false;
@@ -1704,12 +1702,16 @@ int wlcore_cmd_regdomain_config_locked(struct wl1271 *wl)
 	for (b = IEEE80211_BAND_2GHZ; b <= IEEE80211_BAND_5GHZ; b++) {
 		band = wiphy->bands[b];
 		for (i = 0; i < band->n_channels; i++) {
-			channel = &band->channels[i];
-			ch = channel->hw_value;
+			struct ieee80211_channel *channel = &band->channels[i];
+			u16 ch = channel->hw_value;
+			u32 flags = channel->flags;
 
-			if (channel->flags & (IEEE80211_CHAN_DISABLED |
-					      IEEE80211_CHAN_RADAR |
-					      IEEE80211_CHAN_NO_IR))
+			if (flags & (IEEE80211_CHAN_DISABLED |
+				     IEEE80211_CHAN_NO_IR))
+				continue;
+
+			if ((flags & IEEE80211_CHAN_RADAR) &&
+			    channel->dfs_state != NL80211_DFS_AVAILABLE)
 				continue;
 
 			ch_bit_idx = wlcore_get_reg_conf_ch_idx(b, ch);
drivers/net/wireless/ti/wlcore/main.c +0 -14
index 362515f..d99f289 100644
@@ -79,23 +79,9 @@ static int wl12xx_set_authorized(struct wl1271 *wl, struct wl12xx_vif *wlvif)
 static void wl1271_reg_notify(struct wiphy *wiphy,
 			      struct regulatory_request *request)
 {
-	struct ieee80211_supported_band *band;
-	struct ieee80211_channel *ch;
-	int i;
 	struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
 	struct wl1271 *wl = hw->priv;
 
-	band = wiphy->bands[IEEE80211_BAND_5GHZ];
-	for (i = 0; i < band->n_channels; i++) {
-		ch = &band->channels[i];
-		if (ch->flags & IEEE80211_CHAN_DISABLED)
-			continue;
-
-		if (ch->flags & IEEE80211_CHAN_RADAR)
-			ch->flags |= IEEE80211_CHAN_NO_IR;
-
-	}
-
 	wlcore_regdomain_config(wl);
 }
 
Signature · 1 line
1.8.5.2.229.g4448466.dirty
#18 lore raw

PATCH 12/13 wlcore: add dfs region to reg domain update cmd

In reply to Eliad Peller

From: Guy Mishol <[email protected]>

Add dfs region to the reg domain channel update command.

---
 drivers/net/wireless/ti/wlcore/cmd.c    | 1 +
 drivers/net/wireless/ti/wlcore/cmd.h    | 2 ++
 drivers/net/wireless/ti/wlcore/main.c   | 4 ++++
 drivers/net/wireless/ti/wlcore/wlcore.h | 3 +++
 4 files changed, 10 insertions(+)
drivers/net/wireless/ti/wlcore/cmd.c +1 -0
index 50ca10c..c26fc21 100644
@@ -1736,6 +1736,7 @@ int wlcore_cmd_regdomain_config_locked(struct wl1271 *wl)
 
 	cmd->ch_bit_map1 = cpu_to_le32(tmp_ch_bitmap[0]);
 	cmd->ch_bit_map2 = cpu_to_le32(tmp_ch_bitmap[1]);
+	cmd->dfs_region = wl->dfs_region;
 
 	wl1271_debug(DEBUG_CMD,
 		     "cmd reg domain bitmap1: 0x%08x, bitmap2: 0x%08x",
drivers/net/wireless/ti/wlcore/cmd.h +2 -0
index 06bdee2..e14cd40 100644
@@ -648,6 +648,8 @@ struct wl12xx_cmd_regdomain_dfs_config {
 
 	__le32 ch_bit_map1;
 	__le32 ch_bit_map2;
+	u8 dfs_region;
+	u8 padding[3];
 } __packed;
 
 struct wl12xx_cmd_config_fwlog {
drivers/net/wireless/ti/wlcore/main.c +4 -0
index d99f289..ebb03b9 100644
@@ -82,6 +82,10 @@ static void wl1271_reg_notify(struct wiphy *wiphy,
 	struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
 	struct wl1271 *wl = hw->priv;
 
+	/* copy the current dfs region */
+	if (request)
+		wl->dfs_region = request->dfs_region;
+
 	wlcore_regdomain_config(wl);
 }
 
drivers/net/wireless/ti/wlcore/wlcore.h +3 -0
index 581c479..d599c86 100644
@@ -465,6 +465,9 @@ struct wl1271 {
 	/* HW HT (11n) capabilities */
 	struct ieee80211_sta_ht_cap ht_cap[WLCORE_NUM_BANDS];
 
+	/* the current dfs region */
+	enum nl80211_dfs_regions dfs_region;
+
 	/* size of the private FW status data */
 	size_t fw_status_len;
 	size_t fw_status_priv_len;
Signature · 1 line
1.8.5.2.229.g4448466.dirty
#19 lore raw

PATCH 13/13 wl18xx: declare radar_detect_widths support for ap interfaces

In reply to Eliad Peller

After having all the dfs infrastructure in place, declare radar_detect_widths support for the ap interfaces combination.

---
 drivers/net/wireless/ti/wl18xx/main.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/wireless/ti/wl18xx/main.c +4 -0
index 604de24..e5bc557 100644
@@ -1799,6 +1799,10 @@ wl18xx_iface_combinations[] = {
 		.limits = wl18xx_iface_ap_limits,
 		.n_limits = ARRAY_SIZE(wl18xx_iface_ap_limits),
 		.num_different_channels = 1,
+		.radar_detect_widths =	BIT(NL80211_CHAN_NO_HT) |
+					BIT(NL80211_CHAN_HT20) |
+					BIT(NL80211_CHAN_HT40MINUS) |
+					BIT(NL80211_CHAN_HT40PLUS),
 	}
 };
 
Signature · 1 line
1.8.5.2.229.g4448466.dirty