Search Linux Wireless

[PATCH] staging: rtl8723bs, wilc1000: update management frame registration API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Sergey Matyukevich <sergey.matyukevich.os@xxxxxxxxxxxxx>

Management frame registration API has been updated in wireless core and
all the wireless drivers. Update staging wireless drivers as well.

Fixes: 6cd536fe62ef ("cfg80211: change internal management frame registration API")

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@xxxxxxxxxxxxx>
---
 .../rtl8723bs/include/ioctl_cfg80211.h        |  1 +
 .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 21 ++++---
 drivers/staging/wilc1000/cfg80211.c           | 57 ++++++++++++-------
 drivers/staging/wilc1000/netdev.c             | 35 +++++++-----
 drivers/staging/wilc1000/netdev.h             |  1 +
 5 files changed, 73 insertions(+), 42 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/ioctl_cfg80211.h b/drivers/staging/rtl8723bs/include/ioctl_cfg80211.h
index 931599d8b08a..2080ea1f18a0 100644
--- a/drivers/staging/rtl8723bs/include/ioctl_cfg80211.h
+++ b/drivers/staging/rtl8723bs/include/ioctl_cfg80211.h
@@ -83,6 +83,7 @@ struct rtw_wdev_priv
 	u8 bandroid_scan;
 	bool block;
 	bool power_mgmt;
+	u32 mgmt_mask;
 };
 
 #define wiphy_to_adapter(x) (*((struct adapter **)wiphy_priv(x)))
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 1ba85a43f05a..8d01e5f3e606 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -3163,25 +3163,31 @@ static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy,
 	return ret;
 }
 
-static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy,
-	struct wireless_dev *wdev,
-	u16 frame_type, bool reg)
+static void cfg80211_rtw_update_mgmt_frame_register(struct wiphy *wiphy,
+						    struct wireless_dev *wdev,
+						    struct mgmt_frame_regs *upd)
+
 {
+	u32 rtw_mask = BIT(IEEE80211_STYPE_PROBE_REQ >> 4);
 	struct net_device *ndev = wdev_to_ndev(wdev);
+	struct rtw_wdev_priv *wd;
 	struct adapter *adapter;
 
 	if (ndev == NULL)
 		goto exit;
 
 	adapter = (struct adapter *)rtw_netdev_priv(ndev);
+	wd = adapter_wdev_data(adapter);
 
 #ifdef DEBUG_CFG80211
-	DBG_871X(FUNC_ADPT_FMT" frame_type:%x, reg:%d\n", FUNC_ADPT_ARG(adapter),
-		frame_type, reg);
+	DBG_871X(FUNC_ADPT_FMT " old_regs:%x new_regs:%x\n",
+		 FUNC_ADPT_ARG(adapter), wd->mgmt_mask, upd->interface_stypes);
 #endif
 
-	if (frame_type != (IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ))
+	if ((upd->interface_stypes & rtw_mask) == (wd->mgmt_mask & rtw_mask))
 		return;
+
+	wd->mgmt_mask = upd->interface_stypes;
 exit:
 	return;
 }
@@ -3397,7 +3403,8 @@ static struct cfg80211_ops rtw_cfg80211_ops = {
 	.change_bss = cfg80211_rtw_change_bss,
 
 	.mgmt_tx = cfg80211_rtw_mgmt_tx,
-	.mgmt_frame_register = cfg80211_rtw_mgmt_frame_register,
+	.update_mgmt_frame_registrations =
+		cfg80211_rtw_update_mgmt_frame_register,
 
 #if defined(CONFIG_PNO_SUPPORT)
 	.sched_scan_start = cfg80211_rtw_sched_scan_start,
diff --git a/drivers/staging/wilc1000/cfg80211.c b/drivers/staging/wilc1000/cfg80211.c
index 4bdcbc5fd2fd..d6877381b493 100644
--- a/drivers/staging/wilc1000/cfg80211.c
+++ b/drivers/staging/wilc1000/cfg80211.c
@@ -1217,33 +1217,50 @@ static int mgmt_tx_cancel_wait(struct wiphy *wiphy,
 	return 0;
 }
 
-void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
-			      u16 frame_type, bool reg)
+void wilc_update_mgmt_frame_registration(struct wiphy *wiphy,
+					 struct wireless_dev *wdev,
+					 struct mgmt_frame_regs *upd)
 {
-	struct wilc *wl = wiphy_priv(wiphy);
 	struct wilc_vif *vif = netdev_priv(wdev->netdev);
-
-	if (!frame_type)
+	struct wilc *wl = wiphy_priv(wiphy);
+	u32 new_mask = upd->interface_stypes;
+	u32 old_mask = vif->mgmt_bitmask;
+	static const struct {
+		u32 mask, type;
+	} updates[NUM_REG_FRAME] = {
+		{
+			.mask = BIT(IEEE80211_STYPE_PROBE_REQ >> 4),
+			.type = IEEE80211_STYPE_PROBE_REQ,
+		},
+		{
+			.mask = BIT(IEEE80211_STYPE_ACTION >> 4),
+			.type = IEEE80211_STYPE_PROBE_REQ,
+		},
+	};
+	unsigned int i;
+	u32 type;
+	u32 mask;
+	bool reg;
+
+	if (new_mask == old_mask)
 		return;
 
-	switch (frame_type) {
-	case IEEE80211_STYPE_PROBE_REQ:
-		vif->frame_reg[0].type = frame_type;
-		vif->frame_reg[0].reg = reg;
-		break;
+	for (i = 0; i < NUM_REG_FRAME; i++) {
+		type = updates[i].type;
+		mask = updates[i].mask;
+		reg = new_mask & mask;
 
-	case IEEE80211_STYPE_ACTION:
-		vif->frame_reg[1].type = frame_type;
-		vif->frame_reg[1].reg = reg;
-		break;
+		if ((new_mask & mask) == (old_mask & mask))
+			continue;
 
-	default:
-		break;
+		vif->frame_reg[i].type = type;
+		vif->frame_reg[i].reg = reg;
+
+		if (wl->initialized)
+			wilc_frame_register(vif, type, reg);
 	}
 
-	if (!wl->initialized)
-		return;
-	wilc_frame_register(vif, frame_type, reg);
+	vif->mgmt_bitmask = new_mask;
 }
 
 static int set_cqm_rssi_config(struct wiphy *wiphy, struct net_device *dev,
@@ -1665,7 +1682,7 @@ static const struct cfg80211_ops wilc_cfg80211_ops = {
 	.cancel_remain_on_channel = cancel_remain_on_channel,
 	.mgmt_tx_cancel_wait = mgmt_tx_cancel_wait,
 	.mgmt_tx = mgmt_tx,
-	.mgmt_frame_register = wilc_mgmt_frame_register,
+	.update_mgmt_frame_registrations = wilc_update_mgmt_frame_registration,
 	.set_power_mgmt = set_power_mgmt,
 	.set_cqm_rssi_config = set_cqm_rssi_config,
 
diff --git a/drivers/staging/wilc1000/netdev.c b/drivers/staging/wilc1000/netdev.c
index f94a17babd12..08345d603ffc 100644
--- a/drivers/staging/wilc1000/netdev.c
+++ b/drivers/staging/wilc1000/netdev.c
@@ -570,6 +570,7 @@ static int wilc_mac_open(struct net_device *ndev)
 	struct wilc_vif *vif = netdev_priv(ndev);
 	struct wilc *wl = vif->wilc;
 	unsigned char mac_add[ETH_ALEN] = {0};
+	unsigned int i;
 	int ret = 0;
 
 	if (!wl || !wl->dev) {
@@ -602,14 +603,12 @@ static int wilc_mac_open(struct net_device *ndev)
 		return -EINVAL;
 	}
 
-	wilc_mgmt_frame_register(vif->ndev->ieee80211_ptr->wiphy,
-				 vif->ndev->ieee80211_ptr,
-				 vif->frame_reg[0].type,
-				 vif->frame_reg[0].reg);
-	wilc_mgmt_frame_register(vif->ndev->ieee80211_ptr->wiphy,
-				 vif->ndev->ieee80211_ptr,
-				 vif->frame_reg[1].type,
-				 vif->frame_reg[1].reg);
+	for (i = 0; i < NUM_REG_FRAME; i++) {
+		if (wl->initialized && vif->frame_reg[i].type)
+			wilc_frame_register(vif, vif->frame_reg[i].type,
+					    vif->frame_reg[i].reg);
+	}
+
 	netif_wake_queue(ndev);
 	wl->open_ifcs++;
 	vif->mac_opened = 1;
@@ -786,19 +785,25 @@ void wilc_frmw_to_host(struct wilc *wilc, u8 *buff, u32 size,
 
 void wilc_wfi_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size)
 {
-	int srcu_idx;
 	struct wilc_vif *vif;
+	struct frame_reg *fr;
+	unsigned int i;
+	int srcu_idx;
 
 	srcu_idx = srcu_read_lock(&wilc->srcu);
 	list_for_each_entry_rcu(vif, &wilc->vif_list, list) {
 		u16 type = le16_to_cpup((__le16 *)buff);
 
-		if (vif->priv.p2p_listen_state &&
-		    ((type == vif->frame_reg[0].type &&
-		      vif->frame_reg[0].reg) ||
-		     (type == vif->frame_reg[1].type &&
-		      vif->frame_reg[1].reg)))
-			wilc_wfi_p2p_rx(vif, buff, size);
+		if (vif->priv.p2p_listen_state) {
+			for (i = 0; i < NUM_REG_FRAME; i++) {
+				fr = &vif->frame_reg[i];
+
+				if (fr->type && fr->reg && type == fr->type) {
+					wilc_wfi_p2p_rx(vif, buff, size);
+					break;
+				}
+			}
+		}
 
 		if (vif->monitor_flag)
 			wilc_wfi_monitor_rx(wilc->monitor_dev, buff, size);
diff --git a/drivers/staging/wilc1000/netdev.h b/drivers/staging/wilc1000/netdev.h
index 61cbec674a62..9291dbc830ba 100644
--- a/drivers/staging/wilc1000/netdev.h
+++ b/drivers/staging/wilc1000/netdev.h
@@ -202,6 +202,7 @@ struct wilc_vif {
 	struct wilc_priv priv;
 	struct list_head list;
 	struct cfg80211_bss *bss;
+	u32 mgmt_bitmask;
 };
 
 struct wilc {
-- 
2.26.2




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux