All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/15] staging: wilc1000: cleanup patches & handle review comments
@ 2019-02-02 19:16 Ajay.Kathat
  2019-02-02 19:16 ` [PATCH 01/15] staging: wilc1000: avoid the use of 'wilc_wfi_mon' static variable Ajay.Kathat
                   ` (14 more replies)
  0 siblings, 15 replies; 23+ messages in thread
From: Ajay.Kathat @ 2019-02-02 19:16 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, Adham.Abozaeid, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

This series contains cleanup patches and modification to handle few mainline
review comments mentioned below:
 - avoid static variable for monitor net_device.
 - remove conditional locking in wilc_wfi_deinit_mon_interface().
 - avoid use of interface name('wlan0' & 'p2p0') string for validation.
 - use cookie information in roc related callback.

Ajay Singh (15):
  staging: wilc1000: avoid the use of 'wilc_wfi_mon' static variable
  staging: wilc1000: remove conditional lock in
    wilc_wfi_deinit_mon_interface()
  staging: wilc1000: remove redundant macros for radiotap
  staging: wilc1000: remove unnecessary debug log messages
  staging: wilc1000: rename timeout related macros
  staging: wilc1000: make use of iface type to identify p2p interface
  staging: wilc1000: refactor scan() cfg80211 ops callback
  staging: wilc1000: use correct condition in loops for 'vif_num' count
  staging: wilc1000: remove use of 'terminated_handle' static variable
  staging: wilc1000: refactor linux_wlan_init_test_config()
  staging: wilc1000: refactor code to use cookie information
  staging: wilc1000: use random number for cookie instead of pointer
  staging: wilc1000: avoid use of interface names for validation
  staging: wilc1000: add check before performing operation on net_device
  staging: wilc1000: remove unused struct 'add_sta_param'

 drivers/staging/wilc1000/host_interface.c         |  97 ++---
 drivers/staging/wilc1000/host_interface.h         |  27 +-
 drivers/staging/wilc1000/linux_mon.c              |  68 ++--
 drivers/staging/wilc1000/linux_wlan.c             | 408 +++++++++-------------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 134 ++++---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |   7 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h     |   3 +-
 drivers/staging/wilc1000/wilc_wlan.c              |   4 +-
 drivers/staging/wilc1000/wilc_wlan.h              |   2 +-
 drivers/staging/wilc1000/wilc_wlan_if.h           |   1 -
 10 files changed, 308 insertions(+), 443 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 01/15] staging: wilc1000: avoid the use of 'wilc_wfi_mon' static variable
  2019-02-02 19:16 [PATCH 00/15] staging: wilc1000: cleanup patches & handle review comments Ajay.Kathat
@ 2019-02-02 19:16 ` Ajay.Kathat
  2019-02-04 13:38   ` Kalle Valo
  2019-02-02 19:16 ` [PATCH 02/15] staging: wilc1000: remove conditional lock in wilc_wfi_deinit_mon_interface() Ajay.Kathat
                   ` (13 subsequent siblings)
  14 siblings, 1 reply; 23+ messages in thread
From: Ajay.Kathat @ 2019-02-02 19:16 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, Adham.Abozaeid, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

Avoid use of static variable for monitor net_device and move it inside
wilc structure.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/linux_mon.c              | 52 +++++++++++------------
 drivers/staging/wilc1000/linux_wlan.c             |  4 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  3 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |  7 +--
 drivers/staging/wilc1000/wilc_wfi_netdevice.h     |  1 +
 5 files changed, 34 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
index a634468..ed06834 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -18,8 +18,6 @@ struct wilc_wfi_radiotap_cb_hdr {
 	u16 tx_flags;
 } __packed;
 
-static struct net_device *wilc_wfi_mon; /* global monitor netdev */
-
 static u8 srcadd[6];
 static u8 bssid[6];
 
@@ -29,17 +27,17 @@ static u8 bssid[6];
 #define TX_RADIOTAP_PRESENT ((1 << IEEE80211_RADIOTAP_RATE) |	\
 			     (1 << IEEE80211_RADIOTAP_TX_FLAGS))
 
-void wilc_wfi_monitor_rx(u8 *buff, u32 size)
+void wilc_wfi_monitor_rx(struct net_device *mon_dev, u8 *buff, u32 size)
 {
 	u32 header, pkt_offset;
 	struct sk_buff *skb = NULL;
 	struct wilc_wfi_radiotap_hdr *hdr;
 	struct wilc_wfi_radiotap_cb_hdr *cb_hdr;
 
-	if (!wilc_wfi_mon)
+	if (!mon_dev)
 		return;
 
-	if (!netif_running(wilc_wfi_mon))
+	if (!netif_running(mon_dev))
 		return;
 
 	/* Get WILC header */
@@ -94,7 +92,7 @@ void wilc_wfi_monitor_rx(u8 *buff, u32 size)
 		hdr->rate = 5;
 	}
 
-	skb->dev = wilc_wfi_mon;
+	skb->dev = mon_dev;
 	skb_reset_mac_header(skb);
 	skb->ip_summed = CHECKSUM_UNNECESSARY;
 	skb->pkt_type = PACKET_OTHERHOST;
@@ -156,12 +154,10 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb,
 	struct sk_buff *skb2;
 	struct wilc_wfi_radiotap_cb_hdr *cb_hdr;
 
-	if (!wilc_wfi_mon)
-		return -EFAULT;
-
-	mon_priv = netdev_priv(wilc_wfi_mon);
+	mon_priv = netdev_priv(dev);
 	if (!mon_priv)
 		return -EFAULT;
+
 	rtap_len = ieee80211_get_radiotap_len(skb->data);
 	if (skb->len < rtap_len)
 		return -1;
@@ -187,7 +183,7 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb,
 		cb_hdr->rate = 5;
 		cb_hdr->tx_flags = 0x0004;
 
-		skb2->dev = wilc_wfi_mon;
+		skb2->dev = dev;
 		skb_reset_mac_header(skb2);
 		skb2->ip_summed = CHECKSUM_UNNECESSARY;
 		skb2->pkt_type = PACKET_OTHERHOST;
@@ -223,51 +219,53 @@ static const struct net_device_ops wilc_wfi_netdev_ops = {
 
 };
 
-struct net_device *wilc_wfi_init_mon_interface(const char *name,
+struct net_device *wilc_wfi_init_mon_interface(struct wilc *wl,
+					       const char *name,
 					       struct net_device *real_dev)
 {
 	struct wilc_wfi_mon_priv *priv;
 
 	/*If monitor interface is already initialized, return it*/
-	if (wilc_wfi_mon)
-		return wilc_wfi_mon;
+	if (wl->monitor_dev)
+		return wl->monitor_dev;
 
-	wilc_wfi_mon = alloc_etherdev(sizeof(struct wilc_wfi_mon_priv));
-	if (!wilc_wfi_mon)
+	wl->monitor_dev = alloc_etherdev(sizeof(struct wilc_wfi_mon_priv));
+	if (!wl->monitor_dev)
 		return NULL;
-	wilc_wfi_mon->type = ARPHRD_IEEE80211_RADIOTAP;
-	strncpy(wilc_wfi_mon->name, name, IFNAMSIZ);
-	wilc_wfi_mon->name[IFNAMSIZ - 1] = 0;
-	wilc_wfi_mon->netdev_ops = &wilc_wfi_netdev_ops;
 
-	if (register_netdevice(wilc_wfi_mon)) {
+	wl->monitor_dev->type = ARPHRD_IEEE80211_RADIOTAP;
+	strncpy(wl->monitor_dev->name, name, IFNAMSIZ);
+	wl->monitor_dev->name[IFNAMSIZ - 1] = 0;
+	wl->monitor_dev->netdev_ops = &wilc_wfi_netdev_ops;
+
+	if (register_netdevice(wl->monitor_dev)) {
 		netdev_err(real_dev, "register_netdevice failed\n");
 		return NULL;
 	}
-	priv = netdev_priv(wilc_wfi_mon);
+	priv = netdev_priv(wl->monitor_dev);
 	if (!priv)
 		return NULL;
 
 	priv->real_ndev = real_dev;
 
-	return wilc_wfi_mon;
+	return wl->monitor_dev;
 }
 
-void wilc_wfi_deinit_mon_interface(void)
+void wilc_wfi_deinit_mon_interface(struct wilc *wl)
 {
 	bool rollback_lock = false;
 
-	if (wilc_wfi_mon) {
+	if (wl->monitor_dev) {
 		if (rtnl_is_locked()) {
 			rtnl_unlock();
 			rollback_lock = true;
 		}
-		unregister_netdev(wilc_wfi_mon);
+		unregister_netdev(wl->monitor_dev);
 
 		if (rollback_lock) {
 			rtnl_lock();
 			rollback_lock = false;
 		}
-		wilc_wfi_mon = NULL;
+		wl->monitor_dev = NULL;
 	}
 }
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 87ec048..1362d8f 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -920,7 +920,7 @@ static int wilc_mac_close(struct net_device *ndev)
 		netdev_dbg(ndev, "Deinitializing wilc1000\n");
 		wl->close = 1;
 		wilc_wlan_deinitialize(ndev);
-		wilc_wfi_deinit_mon_interface();
+		wilc_wfi_deinit_mon_interface(wl);
 	}
 
 	vif->mac_opened = 0;
@@ -976,7 +976,7 @@ void wilc_wfi_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size)
 	for (i = 0; i < wilc->vif_num; i++) {
 		vif = netdev_priv(wilc->vif[i]->ndev);
 		if (vif->monitor_flag) {
-			wilc_wfi_monitor_rx(buff, size);
+			wilc_wfi_monitor_rx(wilc->monitor_dev, buff, size);
 			return;
 		}
 	}
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 79753ad..cd3df42 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1617,7 +1617,8 @@ static struct wireless_dev *add_virtual_intf(struct wiphy *wiphy,
 	struct net_device *new_ifc;
 
 	if (type == NL80211_IFTYPE_MONITOR) {
-		new_ifc = wilc_wfi_init_mon_interface(name, vif->ndev);
+		new_ifc = wilc_wfi_init_mon_interface(vif->wilc, name,
+						      vif->ndev);
 		if (new_ifc) {
 			vif = netdev_priv(priv->wdev->netdev);
 			vif->monitor_flag = 1;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index 4812c8e..31dfa1f 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -13,9 +13,10 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net,
 void wilc_free_wiphy(struct net_device *net);
 void wilc_deinit_host_int(struct net_device *net);
 int wilc_init_host_int(struct net_device *net);
-void wilc_wfi_monitor_rx(u8 *buff, u32 size);
-void wilc_wfi_deinit_mon_interface(void);
-struct net_device *wilc_wfi_init_mon_interface(const char *name,
+void wilc_wfi_monitor_rx(struct net_device *mon_dev, u8 *buff, u32 size);
+void wilc_wfi_deinit_mon_interface(struct wilc *wl);
+struct net_device *wilc_wfi_init_mon_interface(struct wilc *wl,
+					       const char *name,
 					       struct net_device *real_dev);
 void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
 			      u16 frame_type, bool reg);
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 59e8352..cc06ef9 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -270,6 +270,7 @@ struct wilc {
 	enum chip_ps_states chip_ps_state;
 	struct wilc_cfg cfg;
 	void *bus_data;
+	struct net_device *monitor_dev;
 };
 
 struct wilc_wfi_mon_priv {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 02/15] staging: wilc1000: remove conditional lock in wilc_wfi_deinit_mon_interface()
  2019-02-02 19:16 [PATCH 00/15] staging: wilc1000: cleanup patches & handle review comments Ajay.Kathat
  2019-02-02 19:16 ` [PATCH 01/15] staging: wilc1000: avoid the use of 'wilc_wfi_mon' static variable Ajay.Kathat
@ 2019-02-02 19:16 ` Ajay.Kathat
  2019-02-02 19:16 ` [PATCH 03/15] staging: wilc1000: remove redundant macros for radiotap Ajay.Kathat
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: Ajay.Kathat @ 2019-02-02 19:16 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, Adham.Abozaeid, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

wilc_wfi_deinit_mon_interface() calls unregister_netdev() which
requires the rtnl lock again. Now move wilc_wfi_deinit_mon_interface()
out of wilc_mac_close(). Also remove explicit call to wilc_mac_close()
because unregister_netdev() takes care of calling wilc_mac_close().

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/linux_mon.c  | 19 +++++--------------
 drivers/staging/wilc1000/linux_wlan.c | 11 +++--------
 2 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
index ed06834..32d0c81 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -253,19 +253,10 @@ struct net_device *wilc_wfi_init_mon_interface(struct wilc *wl,
 
 void wilc_wfi_deinit_mon_interface(struct wilc *wl)
 {
-	bool rollback_lock = false;
-
-	if (wl->monitor_dev) {
-		if (rtnl_is_locked()) {
-			rtnl_unlock();
-			rollback_lock = true;
-		}
-		unregister_netdev(wl->monitor_dev);
+	if (!wl->monitor_dev)
+		return;
 
-		if (rollback_lock) {
-			rtnl_lock();
-			rollback_lock = false;
-		}
-		wl->monitor_dev = NULL;
-	}
+	unregister_netdev(wl->monitor_dev);
+	free_netdev(wl->monitor_dev);
+	wl->monitor_dev = NULL;
 }
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 1362d8f..b0249d2 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -920,7 +920,6 @@ static int wilc_mac_close(struct net_device *ndev)
 		netdev_dbg(ndev, "Deinitializing wilc1000\n");
 		wl->close = 1;
 		wilc_wlan_deinitialize(ndev);
-		wilc_wfi_deinit_mon_interface(wl);
 	}
 
 	vif->mac_opened = 0;
@@ -1006,19 +1005,15 @@ void wilc_netdev_cleanup(struct wilc *wilc)
 		wilc->firmware = NULL;
 	}
 
-	if (wilc->vif[0]->ndev || wilc->vif[1]->ndev) {
-		for (i = 0; i < WILC_NUM_CONCURRENT_IFC; i++)
-			if (wilc->vif[i]->ndev)
-				if (wilc->vif[i]->mac_opened)
-					wilc_mac_close(wilc->vif[i]->ndev);
-
-		for (i = 0; i < WILC_NUM_CONCURRENT_IFC; i++) {
+	for (i = 0; i < WILC_NUM_CONCURRENT_IFC; i++) {
+		if (wilc->vif[i] && wilc->vif[i]->ndev) {
 			unregister_netdev(wilc->vif[i]->ndev);
 			wilc_free_wiphy(wilc->vif[i]->ndev);
 			free_netdev(wilc->vif[i]->ndev);
 		}
 	}
 
+	wilc_wfi_deinit_mon_interface(wilc);
 	flush_workqueue(wilc->hif_workqueue);
 	destroy_workqueue(wilc->hif_workqueue);
 	wilc_wlan_cfg_deinit(wilc);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 03/15] staging: wilc1000: remove redundant macros for radiotap
  2019-02-02 19:16 [PATCH 00/15] staging: wilc1000: cleanup patches & handle review comments Ajay.Kathat
  2019-02-02 19:16 ` [PATCH 01/15] staging: wilc1000: avoid the use of 'wilc_wfi_mon' static variable Ajay.Kathat
  2019-02-02 19:16 ` [PATCH 02/15] staging: wilc1000: remove conditional lock in wilc_wfi_deinit_mon_interface() Ajay.Kathat
@ 2019-02-02 19:16 ` Ajay.Kathat
  2019-02-02 19:17 ` [PATCH 04/15] staging: wilc1000: remove unnecessary debug log messages Ajay.Kathat
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: Ajay.Kathat @ 2019-02-02 19:16 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, Adham.Abozaeid, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

Remove macro define which are already present in the included header.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/linux_mon.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
index 32d0c81..ce37b6f 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -21,9 +21,6 @@ struct wilc_wfi_radiotap_cb_hdr {
 static u8 srcadd[6];
 static u8 bssid[6];
 
-#define IEEE80211_RADIOTAP_F_TX_RTS	0x0004  /* used rts/cts handshake */
-#define IEEE80211_RADIOTAP_F_TX_FAIL	0x0001  /* failed due to excessive*/
-
 #define TX_RADIOTAP_PRESENT ((1 << IEEE80211_RADIOTAP_RATE) |	\
 			     (1 << IEEE80211_RADIOTAP_TX_FLAGS))
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 04/15] staging: wilc1000: remove unnecessary debug log messages
  2019-02-02 19:16 [PATCH 00/15] staging: wilc1000: cleanup patches & handle review comments Ajay.Kathat
                   ` (2 preceding siblings ...)
  2019-02-02 19:16 ` [PATCH 03/15] staging: wilc1000: remove redundant macros for radiotap Ajay.Kathat
@ 2019-02-02 19:17 ` Ajay.Kathat
  2019-02-02 19:17 ` [PATCH 05/15] staging: wilc1000: rename timeout related macros Ajay.Kathat
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: Ajay.Kathat @ 2019-02-02 19:17 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, Adham.Abozaeid, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

Remove unnecessary debug log messages.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 31 -------------------------------
 1 file changed, 31 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index b0249d2..81472d2 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -19,9 +19,7 @@ static int dev_state_ev_handler(struct notifier_block *this,
 	struct wilc_priv *priv;
 	struct host_if_drv *hif_drv;
 	struct net_device *dev;
-	u8 *ip_addr_buf;
 	struct wilc_vif *vif;
-	u8 null_ip[4] = {0};
 	char wlan_dev_name[5] = "wlan0";
 
 	if (!dev_iface || !dev_iface->ifa_dev || !dev_iface->ifa_dev->dev)
@@ -56,13 +54,6 @@ static int dev_state_ev_handler(struct notifier_block *this,
 		if (vif->wilc->enable_ps)
 			wilc_set_power_mgmt(vif, 1, 0);
 
-		netdev_dbg(dev, "[%s] Up IP\n", dev_iface->ifa_label);
-
-		ip_addr_buf = (char *)&dev_iface->ifa_address;
-		netdev_dbg(dev, "IP add=%d:%d:%d:%d\n",
-			   ip_addr_buf[0], ip_addr_buf[1],
-			   ip_addr_buf[2], ip_addr_buf[3]);
-
 		break;
 
 	case NETDEV_DOWN:
@@ -77,13 +68,6 @@ static int dev_state_ev_handler(struct notifier_block *this,
 
 		wilc_resolve_disconnect_aberration(vif);
 
-		netdev_dbg(dev, "[%s] Down IP\n", dev_iface->ifa_label);
-
-		ip_addr_buf = null_ip;
-		netdev_dbg(dev, "IP add=%d:%d:%d:%d\n",
-			   ip_addr_buf[0], ip_addr_buf[1],
-			   ip_addr_buf[2], ip_addr_buf[3]);
-
 		break;
 
 	default:
@@ -851,9 +835,6 @@ netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)
 	struct wilc *wilc = vif->wilc;
 	struct tx_complete_data *tx_data = NULL;
 	int queue_count;
-	char *udp_buf;
-	struct iphdr *ih;
-	struct ethhdr *eth_h;
 
 	if (skb->dev != ndev) {
 		netdev_err(ndev, "Packet not destined to this device\n");
@@ -871,18 +852,6 @@ netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)
 	tx_data->size = skb->len;
 	tx_data->skb  = skb;
 
-	eth_h = (struct ethhdr *)(skb->data);
-	if (eth_h->h_proto == cpu_to_be16(0x8e88))
-		netdev_dbg(ndev, "EAPOL transmitted\n");
-
-	ih = (struct iphdr *)(skb->data + sizeof(struct ethhdr));
-
-	udp_buf = (char *)ih + sizeof(struct iphdr);
-	if ((udp_buf[1] == 68 && udp_buf[3] == 67) ||
-	    (udp_buf[1] == 67 && udp_buf[3] == 68))
-		netdev_dbg(ndev, "DHCP Message transmitted, type:%x %x %x\n",
-			   udp_buf[248], udp_buf[249], udp_buf[250]);
-
 	vif->netstats.tx_packets++;
 	vif->netstats.tx_bytes += tx_data->size;
 	tx_data->bssid = wilc->vif[vif->idx]->bssid;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 05/15] staging: wilc1000: rename timeout related macros
  2019-02-02 19:16 [PATCH 00/15] staging: wilc1000: cleanup patches & handle review comments Ajay.Kathat
                   ` (3 preceding siblings ...)
  2019-02-02 19:17 ` [PATCH 04/15] staging: wilc1000: remove unnecessary debug log messages Ajay.Kathat
@ 2019-02-02 19:17 ` Ajay.Kathat
  2019-02-02 19:17 ` [PATCH 06/15] staging: wilc1000: make use of iface type to identify p2p interface Ajay.Kathat
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: Ajay.Kathat @ 2019-02-02 19:17 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, Adham.Abozaeid, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

Rename timeout related macros to have their unit clear from their name.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/host_interface.c         | 8 ++++----
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ++--
 drivers/staging/wilc1000/wilc_wlan.c              | 4 ++--
 drivers/staging/wilc1000/wilc_wlan.h              | 2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index e958f9b..3576834 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -6,8 +6,8 @@
 
 #include "wilc_wfi_netdevice.h"
 
-#define HOST_IF_SCAN_TIMEOUT                    4000
-#define HOST_IF_CONNECT_TIMEOUT                 9500
+#define WILC_HIF_SCAN_TIMEOUT_MS                4000
+#define WILC_HIF_CONNECT_TIMEOUT_MS             9500
 
 #define FALSE_FRMWR_CHANNEL			100
 
@@ -327,7 +327,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
 	hif_drv->usr_scan_req.arg = user_arg;
 	hif_drv->scan_timer_vif = vif;
 	mod_timer(&hif_drv->scan_timer,
-		  jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT));
+		  jiffies + msecs_to_jiffies(WILC_HIF_SCAN_TIMEOUT_MS));
 
 error:
 	if (search) {
@@ -1442,7 +1442,7 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ies,
 
 	hif_drv->connect_timer_vif = vif;
 	mod_timer(&hif_drv->connect_timer,
-		  jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT));
+		  jiffies + msecs_to_jiffies(WILC_HIF_CONNECT_TIMEOUT_MS));
 
 	return 0;
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index cd3df42..95230d7 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -72,7 +72,7 @@ static u8 curr_channel;
 static u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09};
 static u8 p2p_vendor_spec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03};
 
-#define DURING_IP_TIME_OUT	15000
+#define WILC_IP_TIMEOUT_MS		15000
 
 static void clear_during_ip(struct timer_list *t)
 {
@@ -1489,7 +1489,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
 	case NL80211_IFTYPE_P2P_GO:
 		vif->obtaining_ip = true;
 		mod_timer(&vif->during_ip_timer,
-			  jiffies + msecs_to_jiffies(DURING_IP_TIME_OUT));
+			  jiffies + msecs_to_jiffies(WILC_IP_TIMEOUT_MS));
 		wilc_set_operation_mode(vif, WILC_AP_MODE);
 		dev->ieee80211_ptr->iftype = type;
 		priv->wdev->iftype = type;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 58bcdc1..7a757c9 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1141,7 +1141,7 @@ int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, u16 wid, u8 *buffer,
 		ret_size = 0;
 
 	if (!wait_for_completion_timeout(&wilc->cfg_event,
-					 msecs_to_jiffies(CFG_PKTS_TIMEOUT))) {
+					 WILC_CFG_PKTS_TIMEOUT)) {
 		netdev_dbg(vif->ndev, "%s: Timed Out\n", __func__);
 		ret_size = 0;
 	}
@@ -1179,7 +1179,7 @@ int wilc_wlan_cfg_get(struct wilc_vif *vif, int start, u16 wid, int commit,
 		ret_size = 0;
 
 	if (!wait_for_completion_timeout(&wilc->cfg_event,
-					 msecs_to_jiffies(CFG_PKTS_TIMEOUT))) {
+					 WILC_CFG_PKTS_TIMEOUT)) {
 		netdev_dbg(vif->ndev, "%s: Timed Out\n", __func__);
 		ret_size = 0;
 	}
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 3880452..1d61e20 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -196,7 +196,7 @@
 #define ENABLE_RX_VMM		(SEL_VMM_TBL1 | EN_VMM)
 #define ENABLE_TX_VMM		(SEL_VMM_TBL0 | EN_VMM)
 /*time for expiring the completion of cfg packets*/
-#define CFG_PKTS_TIMEOUT	2000
+#define WILC_CFG_PKTS_TIMEOUT	msecs_to_jiffies(2000)
 
 #define IS_MANAGMEMENT		0x100
 #define IS_MANAGMEMENT_CALLBACK	0x080
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 06/15] staging: wilc1000: make use of iface type to identify p2p interface
  2019-02-02 19:16 [PATCH 00/15] staging: wilc1000: cleanup patches & handle review comments Ajay.Kathat
                   ` (4 preceding siblings ...)
  2019-02-02 19:17 ` [PATCH 05/15] staging: wilc1000: rename timeout related macros Ajay.Kathat
@ 2019-02-02 19:17 ` Ajay.Kathat
  2019-02-02 19:17 ` [PATCH 07/15] staging: wilc1000: refactor scan() cfg80211 ops callback Ajay.Kathat
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: Ajay.Kathat @ 2019-02-02 19:17 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, Adham.Abozaeid, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

Remove SSID string compare instead use interface type check for p2p
client interface.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/host_interface.h         |  1 -
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 19 ++++++-------------
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 7f3fc4c..8fa97a7 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -153,7 +153,6 @@ struct host_if_drv {
 	struct remain_ch remain_on_ch;
 	u8 remain_on_ch_pending;
 	u64 p2p_timeout;
-	u8 p2p_connect;
 
 	enum host_if_state hif_state;
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 95230d7..faffcc8 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -159,7 +159,7 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt, u8 mac_status,
 			connect_status = WLAN_STATUS_UNSPECIFIED_FAILURE;
 			wilc_wlan_set_bssid(priv->dev, NULL, WILC_STATION_MODE);
 
-			if (!wfi_drv->p2p_connect)
+			if (vif->iftype != WILC_CLIENT_MODE)
 				wlan_channel = INVALID_CHANNEL;
 
 			netdev_err(dev, "Unspecified failure\n");
@@ -185,7 +185,7 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt, u8 mac_status,
 		eth_zero_addr(priv->associated_bss);
 		wilc_wlan_set_bssid(priv->dev, NULL, WILC_STATION_MODE);
 
-		if (!wfi_drv->p2p_connect)
+		if (vif->iftype != WILC_CLIENT_MODE)
 			wlan_channel = INVALID_CHANNEL;
 
 		if (wfi_drv->ifc_up && dev == wl->vif[1]->ndev)
@@ -329,11 +329,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
 
 	vif->connecting = true;
 
-	if (!(strncmp(sme->ssid, "DIRECT-", 7)))
-		wfi_drv->p2p_connect = 1;
-	else
-		wfi_drv->p2p_connect = 0;
-
 	memset(priv->wep_key, 0, sizeof(priv->wep_key));
 	memset(priv->wep_key_len, 0, sizeof(priv->wep_key_len));
 
@@ -436,7 +431,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
 
 	curr_channel = ieee80211_frequency_to_channel(bss->channel->center_freq);
 
-	if (!wfi_drv->p2p_connect)
+	if (vif->iftype != WILC_CLIENT_MODE)
 		wlan_channel = curr_channel;
 
 	wilc_wlan_set_bssid(dev, bss->bssid, WILC_STATION_MODE);
@@ -452,7 +447,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
 	if (ret) {
 		netdev_err(dev, "wilc_set_join_req(): Error\n");
 		ret = -ENOENT;
-		if (!wfi_drv->p2p_connect)
+		if (vif->iftype != WILC_CLIENT_MODE)
 			wlan_channel = INVALID_CHANNEL;
 		wilc_wlan_set_bssid(dev, NULL, WILC_STATION_MODE);
 		wfi_drv->conn_info.conn_result = NULL;
@@ -477,7 +472,6 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev,
 	struct wilc_priv *priv = wiphy_priv(wiphy);
 	struct wilc_vif *vif = netdev_priv(priv->dev);
 	struct wilc *wilc = vif->wilc;
-	struct host_if_drv *wfi_drv;
 	int ret;
 
 	vif->connecting = false;
@@ -491,15 +485,14 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev,
 		return 0;
 	}
 
-	wfi_drv = (struct host_if_drv *)priv->hif_drv;
-	if (!wfi_drv->p2p_connect)
+	if (vif->iftype != WILC_CLIENT_MODE)
 		wlan_channel = INVALID_CHANNEL;
 	wilc_wlan_set_bssid(priv->dev, NULL, WILC_STATION_MODE);
 
 	priv->p2p.local_random = 0x01;
 	priv->p2p.recv_random = 0x00;
 	priv->p2p.is_wilc_ie = false;
-	wfi_drv->p2p_timeout = 0;
+	priv->hif_drv->p2p_timeout = 0;
 
 	ret = wilc_disconnect(vif);
 	if (ret != 0) {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 07/15] staging: wilc1000: refactor scan() cfg80211 ops callback
  2019-02-02 19:16 [PATCH 00/15] staging: wilc1000: cleanup patches & handle review comments Ajay.Kathat
                   ` (5 preceding siblings ...)
  2019-02-02 19:17 ` [PATCH 06/15] staging: wilc1000: make use of iface type to identify p2p interface Ajay.Kathat
@ 2019-02-02 19:17 ` Ajay.Kathat
  2019-02-02 19:17 ` [PATCH 08/15] staging: wilc1000: use correct condition in loops for 'vif_num' count Ajay.Kathat
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: Ajay.Kathat @ 2019-02-02 19:17 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, Adham.Abozaeid, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

Refactor scan() cfg80211 callback function and use correct value for
valid channel number limit.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/host_interface.h         |  2 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 55 +++++++++++------------
 2 files changed, 28 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 8fa97a7..0feb63f 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -18,7 +18,7 @@ enum {
 };
 
 #define WILC_MAX_NUM_STA			9
-#define MAX_NUM_SCANNED_NETWORKS		100
+#define WILC_MAX_NUM_SCANNED_CH			14
 #define WILC_MAX_NUM_PROBED_SSID		10
 
 #define TX_MIC_KEY_LEN				8
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index faffcc8..08b60ddd 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -266,42 +266,41 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
 	struct wilc_vif *vif = netdev_priv(priv->dev);
 	u32 i;
 	int ret = 0;
-	u8 scan_ch_list[MAX_NUM_SCANNED_NETWORKS];
+	u8 scan_ch_list[WILC_MAX_NUM_SCANNED_CH];
 	struct wilc_probe_ssid probe_ssid;
 
-	priv->scan_req = request;
+	if (request->n_channels > WILC_MAX_NUM_SCANNED_CH) {
+		netdev_err(priv->dev, "Requested scanned channels over\n");
+		return -EINVAL;
+	}
 
+	priv->scan_req = request;
 	priv->cfg_scanning = true;
-	if (request->n_channels <= MAX_NUM_SCANNED_NETWORKS) {
-		for (i = 0; i < request->n_channels; i++) {
-			u16 freq = request->channels[i]->center_freq;
-
-			scan_ch_list[i] = ieee80211_frequency_to_channel(freq);
-		}
+	for (i = 0; i < request->n_channels; i++) {
+		u16 freq = request->channels[i]->center_freq;
 
-		if (request->n_ssids >= 1) {
-			if (wilc_wfi_cfg_alloc_fill_ssid(request,
-							 &probe_ssid)) {
-				ret = -ENOMEM;
-				goto out;
-			}
+		scan_ch_list[i] = ieee80211_frequency_to_channel(freq);
+	}
 
-			ret = wilc_scan(vif, WILC_FW_USER_SCAN,
-					WILC_FW_ACTIVE_SCAN, scan_ch_list,
-					request->n_channels,
-					(const u8 *)request->ie,
-					request->ie_len, cfg_scan_result,
-					(void *)priv, &probe_ssid);
-		} else {
-			ret = wilc_scan(vif, WILC_FW_USER_SCAN,
-					WILC_FW_ACTIVE_SCAN, scan_ch_list,
-					request->n_channels,
-					(const u8 *)request->ie,
-					request->ie_len, cfg_scan_result,
-					(void *)priv, NULL);
+	if (request->n_ssids >= 1) {
+		if (wilc_wfi_cfg_alloc_fill_ssid(request, &probe_ssid)) {
+			ret = -ENOMEM;
+			goto out;
 		}
+
+		ret = wilc_scan(vif, WILC_FW_USER_SCAN,
+				WILC_FW_ACTIVE_SCAN, scan_ch_list,
+				request->n_channels,
+				(const u8 *)request->ie,
+				request->ie_len, cfg_scan_result,
+				(void *)priv, &probe_ssid);
 	} else {
-		netdev_err(priv->dev, "Requested scanned channels over\n");
+		ret = wilc_scan(vif, WILC_FW_USER_SCAN,
+				WILC_FW_ACTIVE_SCAN, scan_ch_list,
+				request->n_channels,
+				(const u8 *)request->ie,
+				request->ie_len, cfg_scan_result,
+				(void *)priv, NULL);
 	}
 
 out:
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 08/15] staging: wilc1000: use correct condition in loops for 'vif_num' count
  2019-02-02 19:16 [PATCH 00/15] staging: wilc1000: cleanup patches & handle review comments Ajay.Kathat
                   ` (6 preceding siblings ...)
  2019-02-02 19:17 ` [PATCH 07/15] staging: wilc1000: refactor scan() cfg80211 ops callback Ajay.Kathat
@ 2019-02-02 19:17 ` Ajay.Kathat
  2019-02-04  8:13   ` Dan Carpenter
  2019-02-02 19:17 ` [PATCH 09/15] staging: wilc1000: remove use of 'terminated_handle' static variable Ajay.Kathat
                   ` (6 subsequent siblings)
  14 siblings, 1 reply; 23+ messages in thread
From: Ajay.Kathat @ 2019-02-02 19:17 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, Adham.Abozaeid, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

The value of 'vif_num'(interface count) starts with 0, so modified the
loop conditions to execute for all interface.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 drivers/staging/wilc1000/linux_wlan.c     | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 3576834..fde236a 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1659,7 +1659,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
 		return -ENOMEM;
 
 	*hif_drv_handler = hif_drv;
-	for (i = 0; i < wilc->vif_num; i++)
+	for (i = 0; i <= wilc->vif_num; i++)
 		if (dev == wilc->vif[i]->ndev) {
 			wilc->vif[i]->hif_drv = hif_drv;
 			hif_drv->driver_handler_id = i + 1;
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 81472d2..466a1fa 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -164,7 +164,7 @@ static struct net_device *get_if_handler(struct wilc *wilc, u8 *mac_header)
 	bssid = mac_header + 10;
 	bssid1 = mac_header + 4;
 
-	for (i = 0; i < wilc->vif_num; i++) {
+	for (i = 0; i <= wilc->vif_num; i++) {
 		if (wilc->vif[i]->mode == WILC_STATION_MODE)
 			if (ether_addr_equal_unaligned(bssid,
 						       wilc->vif[i]->bssid))
@@ -195,7 +195,7 @@ int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc)
 	u8 i = 0;
 	u8 ret_val = 0;
 
-	for (i = 0; i < wilc->vif_num; i++)
+	for (i = 0; i <= wilc->vif_num; i++)
 		if (!is_zero_ether_addr(wilc->vif[i]->bssid))
 			ret_val++;
 
@@ -739,7 +739,7 @@ static int wilc_mac_open(struct net_device *ndev)
 		return ret;
 	}
 
-	for (i = 0; i < wl->vif_num; i++) {
+	for (i = 0; i <= wl->vif_num; i++) {
 		if (ndev == wl->vif[i]->ndev) {
 			wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif),
 						 vif->iftype, vif->ifc_id);
@@ -941,7 +941,7 @@ void wilc_wfi_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size)
 	int i = 0;
 	struct wilc_vif *vif;
 
-	for (i = 0; i < wilc->vif_num; i++) {
+	for (i = 0; i <= wilc->vif_num; i++) {
 		vif = netdev_priv(wilc->vif[i]->ndev);
 		if (vif->monitor_flag) {
 			wilc_wfi_monitor_rx(wilc->monitor_dev, buff, size);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 09/15] staging: wilc1000: remove use of 'terminated_handle' static variable
  2019-02-02 19:16 [PATCH 00/15] staging: wilc1000: cleanup patches & handle review comments Ajay.Kathat
                   ` (7 preceding siblings ...)
  2019-02-02 19:17 ` [PATCH 08/15] staging: wilc1000: use correct condition in loops for 'vif_num' count Ajay.Kathat
@ 2019-02-02 19:17 ` Ajay.Kathat
  2019-02-02 19:17 ` [PATCH 10/15] staging: wilc1000: refactor linux_wlan_init_test_config() Ajay.Kathat
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: Ajay.Kathat @ 2019-02-02 19:17 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, Adham.Abozaeid, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

Remove use of 'terminated_handle' variable and set the 'hif_drv' to
NULL once it's free.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/host_interface.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index fde236a..4598920 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -130,7 +130,6 @@ struct wilc_join_bss_param {
 	};
 } __packed;
 
-static struct host_if_drv *terminated_handle;
 static struct mutex hif_deinit_lock;
 
 /* 'msg' should be free by the caller for syc */
@@ -1478,6 +1477,9 @@ int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
 	int result;
 	struct wilc_drv_handler drv;
 
+	if (!hif_drv)
+		return -EFAULT;
+
 	wid.id = WID_SET_DRV_HANDLER;
 	wid.type = WID_STR;
 	wid.size = sizeof(drv);
@@ -1699,8 +1701,6 @@ int wilc_deinit(struct wilc_vif *vif)
 
 	mutex_lock(&hif_deinit_lock);
 
-	terminated_handle = hif_drv;
-
 	del_timer_sync(&hif_drv->scan_timer);
 	del_timer_sync(&hif_drv->connect_timer);
 	del_timer_sync(&vif->periodic_rssi);
@@ -1717,9 +1717,8 @@ int wilc_deinit(struct wilc_vif *vif)
 	hif_drv->hif_state = HOST_IF_IDLE;
 
 	kfree(hif_drv);
-
+	vif->hif_drv = NULL;
 	vif->wilc->clients_count--;
-	terminated_handle = NULL;
 	mutex_unlock(&hif_deinit_lock);
 	return result;
 }
@@ -1738,7 +1737,7 @@ void wilc_network_info_received(struct wilc *wilc, u8 *buffer, u32 length)
 		return;
 	hif_drv = vif->hif_drv;
 
-	if (!hif_drv || hif_drv == terminated_handle) {
+	if (!hif_drv) {
 		netdev_err(vif->ndev, "driver not init[%p]\n", hif_drv);
 		return;
 	}
@@ -1784,7 +1783,7 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length)
 
 	hif_drv = vif->hif_drv;
 
-	if (!hif_drv || hif_drv == terminated_handle) {
+	if (!hif_drv) {
 		mutex_unlock(&hif_deinit_lock);
 		return;
 	}
@@ -1824,7 +1823,7 @@ void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length)
 		return;
 	hif_drv = vif->hif_drv;
 
-	if (!hif_drv || hif_drv == terminated_handle)
+	if (!hif_drv)
 		return;
 
 	if (hif_drv->usr_scan_req.scan_result) {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 10/15] staging: wilc1000: refactor linux_wlan_init_test_config()
  2019-02-02 19:16 [PATCH 00/15] staging: wilc1000: cleanup patches & handle review comments Ajay.Kathat
                   ` (8 preceding siblings ...)
  2019-02-02 19:17 ` [PATCH 09/15] staging: wilc1000: remove use of 'terminated_handle' static variable Ajay.Kathat
@ 2019-02-02 19:17 ` Ajay.Kathat
  2019-02-02 19:17 ` [PATCH 11/15] staging: wilc1000: refactor code to use cookie information Ajay.Kathat
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: Ajay.Kathat @ 2019-02-02 19:17 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, Adham.Abozaeid, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

Refactor linux_wlan_init_test_config() to use correct endianness for wid
values and remove unnecessary code.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/linux_wlan.c   | 200 +++++++++++++-------------------
 drivers/staging/wilc1000/wilc_wlan_if.h |   1 -
 2 files changed, 83 insertions(+), 118 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 466a1fa..484fe3d 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -304,204 +304,170 @@ static int wilc1000_firmware_download(struct net_device *dev)
 	return 0;
 }
 
-static int linux_wlan_init_test_config(struct net_device *dev,
-				       struct wilc_vif *vif)
+static int linux_wlan_init_fw_config(struct net_device *dev,
+				     struct wilc_vif *vif)
 {
-	unsigned char c_val[64];
-	struct wilc *wilc = vif->wilc;
 	struct wilc_priv *priv;
 	struct host_if_drv *hif_drv;
+	u8 b;
+	u16 hw;
+	u32 w;
 
 	netdev_dbg(dev, "Start configuring Firmware\n");
 	priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
 	hif_drv = (struct host_if_drv *)priv->hif_drv;
 	netdev_dbg(dev, "Host = %p\n", hif_drv);
-	wilc_get_chipid(wilc, false);
-
-	*(int *)c_val = 1;
-
-	if (!wilc_wlan_cfg_set(vif, 1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0))
-		goto fail;
-
-	c_val[0] = 0;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_PC_TEST_MODE, c_val, 1, 0, 0))
-		goto fail;
-
-	c_val[0] = WILC_FW_BSS_TYPE_INFRA;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_BSS_TYPE, c_val, 1, 0, 0))
-		goto fail;
-
-	c_val[0] = WILC_FW_TX_RATE_AUTO;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0))
-		goto fail;
-
-	c_val[0] = WILC_FW_OPER_MODE_G_MIXED_11B_2;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_11G_OPERATING_MODE, c_val, 1, 0,
-			       0))
-		goto fail;
 
-	c_val[0] = 1;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0))
-		goto fail;
-
-	c_val[0] = WILC_FW_PREAMBLE_SHORT;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_PREAMBLE, c_val, 1, 0, 0))
+	w = vif->iftype;
+	cpu_to_le32s(&w);
+	if (!wilc_wlan_cfg_set(vif, 1, WID_SET_OPERATION_MODE, (u8 *)&w, 4,
+			       0, 0))
 		goto fail;
 
-	c_val[0] = WILC_FW_11N_PROT_AUTO;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_11N_PROT_MECH, c_val, 1, 0, 0))
+	b = WILC_FW_BSS_TYPE_INFRA;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_BSS_TYPE, &b, 1, 0, 0))
 		goto fail;
 
-	c_val[0] = WILC_FW_ACTIVE_SCAN;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_SCAN_TYPE, c_val, 1, 0, 0))
+	b = WILC_FW_TX_RATE_AUTO;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_CURRENT_TX_RATE, &b, 1, 0, 0))
 		goto fail;
 
-	c_val[0] = WILC_FW_SITE_SURVEY_OFF;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_SITE_SURVEY, c_val, 1, 0, 0))
+	b = WILC_FW_OPER_MODE_G_MIXED_11B_2;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_11G_OPERATING_MODE, &b, 1, 0, 0))
 		goto fail;
 
-	*((int *)c_val) = 0xffff;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_RTS_THRESHOLD, c_val, 2, 0, 0))
+	b = WILC_FW_PREAMBLE_SHORT;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_PREAMBLE, &b, 1, 0, 0))
 		goto fail;
 
-	*((int *)c_val) = 2346;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0))
+	b = WILC_FW_11N_PROT_AUTO;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_11N_PROT_MECH, &b, 1, 0, 0))
 		goto fail;
 
-	c_val[0] = 0;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_BCAST_SSID, c_val, 1, 0, 0))
+	b = WILC_FW_ACTIVE_SCAN;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_SCAN_TYPE, &b, 1, 0, 0))
 		goto fail;
 
-	c_val[0] = 1;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_QOS_ENABLE, c_val, 1, 0, 0))
+	b = WILC_FW_SITE_SURVEY_OFF;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_SITE_SURVEY, &b, 1, 0, 0))
 		goto fail;
 
-	c_val[0] = WILC_FW_NO_POWERSAVE;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0))
+	hw = 0xffff;
+	cpu_to_le16s(&hw);
+	if (!wilc_wlan_cfg_set(vif, 0, WID_RTS_THRESHOLD, (u8 *)&hw, 2, 0, 0))
 		goto fail;
 
-	c_val[0] = WILC_FW_SEC_NO;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_11I_MODE, c_val, 1, 0, 0))
+	hw = 2346;
+	cpu_to_le16s(&hw);
+	if (!wilc_wlan_cfg_set(vif, 0, WID_FRAG_THRESHOLD, (u8 *)&hw, 2, 0, 0))
 		goto fail;
 
-	c_val[0] = WILC_FW_AUTH_OPEN_SYSTEM;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_AUTH_TYPE, c_val, 1, 0, 0))
+	b = 0;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_BCAST_SSID, &b, 1, 0, 0))
 		goto fail;
 
-	strcpy(c_val, "123456790abcdef1234567890");
-	if (!wilc_wlan_cfg_set(vif, 0, WID_WEP_KEY_VALUE, c_val,
-			       (strlen(c_val) + 1), 0, 0))
+	b = 1;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_QOS_ENABLE, &b, 1, 0, 0))
 		goto fail;
 
-	strcpy(c_val, "12345678");
-	if (!wilc_wlan_cfg_set(vif, 0, WID_11I_PSK, c_val, (strlen(c_val)), 0,
-			       0))
+	b = WILC_FW_NO_POWERSAVE;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_POWER_MANAGEMENT, &b, 1, 0, 0))
 		goto fail;
 
-	strcpy(c_val, "password");
-	if (!wilc_wlan_cfg_set(vif, 0, WID_1X_KEY, c_val, (strlen(c_val) + 1),
-			       0, 0))
+	b = WILC_FW_SEC_NO;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_11I_MODE, &b, 1, 0, 0))
 		goto fail;
 
-	c_val[0] = 192;
-	c_val[1] = 168;
-	c_val[2] = 1;
-	c_val[3] = 112;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_1X_SERV_ADDR, c_val, 4, 0, 0))
+	b = WILC_FW_AUTH_OPEN_SYSTEM;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_AUTH_TYPE, &b, 1, 0, 0))
 		goto fail;
 
-	c_val[0] = 3;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_LISTEN_INTERVAL, c_val, 1, 0, 0))
+	b = 3;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_LISTEN_INTERVAL, &b, 1, 0, 0))
 		goto fail;
 
-	c_val[0] = 3;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_DTIM_PERIOD, c_val, 1, 0, 0))
+	b = 3;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_DTIM_PERIOD, &b, 1, 0, 0))
 		goto fail;
 
-	c_val[0] = WILC_FW_ACK_POLICY_NORMAL;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_ACK_POLICY, c_val, 1, 0, 0))
+	b = WILC_FW_ACK_POLICY_NORMAL;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_ACK_POLICY, &b, 1, 0, 0))
 		goto fail;
 
-	c_val[0] = 0;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_USER_CONTROL_ON_TX_POWER, c_val, 1,
+	b = 0;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_USER_CONTROL_ON_TX_POWER, &b, 1,
 			       0, 0))
 		goto fail;
 
-	c_val[0] = 48;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_TX_POWER_LEVEL_11A, c_val, 1, 0,
-			       0))
+	b = 48;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_TX_POWER_LEVEL_11A, &b, 1, 0, 0))
 		goto fail;
 
-	c_val[0] = 28;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_TX_POWER_LEVEL_11B, c_val, 1, 0,
-			       0))
+	b = 28;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_TX_POWER_LEVEL_11B, &b, 1, 0, 0))
 		goto fail;
 
-	*((int *)c_val) = 100;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_BEACON_INTERVAL, c_val, 2, 0, 0))
+	hw = 100;
+	cpu_to_le16s(&hw);
+	if (!wilc_wlan_cfg_set(vif, 0, WID_BEACON_INTERVAL, (u8 *)&hw, 2, 0, 0))
 		goto fail;
 
-	c_val[0] = WILC_FW_REKEY_POLICY_DISABLE;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_REKEY_POLICY, c_val, 1, 0, 0))
+	b = WILC_FW_REKEY_POLICY_DISABLE;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_REKEY_POLICY, &b, 1, 0, 0))
 		goto fail;
 
-	*((int *)c_val) = 84600;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_REKEY_PERIOD, c_val, 4, 0, 0))
+	w = 84600;
+	cpu_to_le32s(&w);
+	if (!wilc_wlan_cfg_set(vif, 0, WID_REKEY_PERIOD, (u8 *)&w, 4, 0, 0))
 		goto fail;
 
-	*((int *)c_val) = 500;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_REKEY_PACKET_COUNT, c_val, 4, 0,
+	w = 500;
+	cpu_to_le32s(&w);
+	if (!wilc_wlan_cfg_set(vif, 0, WID_REKEY_PACKET_COUNT, (u8 *)&w, 4, 0,
 			       0))
 		goto fail;
 
-	c_val[0] = 1;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_SHORT_SLOT_ALLOWED, c_val, 1, 0,
+	b = 1;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_SHORT_SLOT_ALLOWED, &b, 1, 0,
 			       0))
 		goto fail;
 
-	c_val[0] = WILC_FW_ERP_PROT_SELF_CTS;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_11N_ERP_PROT_TYPE, c_val, 1, 0, 0))
+	b = WILC_FW_ERP_PROT_SELF_CTS;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_11N_ERP_PROT_TYPE, &b, 1, 0, 0))
 		goto fail;
 
-	c_val[0] = 1;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_11N_ENABLE, c_val, 1, 0, 0))
+	b = 1;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_11N_ENABLE, &b, 1, 0, 0))
 		goto fail;
 
-	c_val[0] = WILC_FW_11N_OP_MODE_HT_MIXED;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_11N_OPERATING_MODE, c_val, 1, 0,
-			       0))
+	b = WILC_FW_11N_OP_MODE_HT_MIXED;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_11N_OPERATING_MODE, &b, 1, 0, 0))
 		goto fail;
 
-	c_val[0] = 1;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_11N_TXOP_PROT_DISABLE, c_val, 1, 0,
-			       0))
+	b = 1;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_11N_TXOP_PROT_DISABLE, &b, 1, 0, 0))
 		goto fail;
 
-	c_val[0] = WILC_FW_OBBS_NONHT_DETECT_PROTECT_REPORT;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_11N_OBSS_NONHT_DETECTION, c_val, 1,
+	b = WILC_FW_OBBS_NONHT_DETECT_PROTECT_REPORT;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_11N_OBSS_NONHT_DETECTION, &b, 1,
 			       0, 0))
 		goto fail;
 
-	c_val[0] = WILC_FW_HT_PROT_RTS_CTS_NONHT;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_11N_HT_PROT_TYPE, c_val, 1, 0, 0))
+	b = WILC_FW_HT_PROT_RTS_CTS_NONHT;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_11N_HT_PROT_TYPE, &b, 1, 0, 0))
 		goto fail;
 
-	c_val[0] = 0;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_11N_RIFS_PROT_ENABLE, c_val, 1, 0,
+	b = 0;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_11N_RIFS_PROT_ENABLE, &b, 1, 0,
 			       0))
 		goto fail;
 
-	c_val[0] = WILC_FW_SMPS_MODE_MIMO;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_11N_SMPS_MODE, c_val, 1, 0, 0))
-		goto fail;
-
-	c_val[0] = 7;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_11N_CURRENT_TX_MCS, c_val, 1, 0,
-			       0))
+	b = 7;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_11N_CURRENT_TX_MCS, &b, 1, 0, 0))
 		goto fail;
 
-	c_val[0] = 1;
-	if (!wilc_wlan_cfg_set(vif, 0, WID_11N_IMMEDIATE_BA_ENABLED, c_val, 1,
+	b = 1;
+	if (!wilc_wlan_cfg_set(vif, 0, WID_11N_IMMEDIATE_BA_ENABLED, &b, 1,
 			       1, 1))
 		goto fail;
 
@@ -671,7 +637,7 @@ static int wilc_wlan_initialize(struct net_device *dev, struct wilc_vif *vif)
 			firmware_ver[size] = '\0';
 			netdev_dbg(dev, "Firmware Ver = %s\n", firmware_ver);
 		}
-		ret = linux_wlan_init_test_config(dev, vif);
+		ret = linux_wlan_init_fw_config(dev, vif);
 
 		if (ret < 0) {
 			netdev_err(dev, "Failed to configure firmware\n");
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index 9370caa..26aad49 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -686,7 +686,6 @@ enum {
 	WID_TX_POWER_LEVEL_11N		= 0x00B1,
 
 	/* Custom Character WID list */
-	WID_PC_TEST_MODE		= 0x00C8,
 	/* SCAN Complete notification WID*/
 	WID_SCAN_COMPLETE		= 0x00C9,
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 11/15] staging: wilc1000: refactor code to use cookie information
  2019-02-02 19:16 [PATCH 00/15] staging: wilc1000: cleanup patches & handle review comments Ajay.Kathat
                   ` (9 preceding siblings ...)
  2019-02-02 19:17 ` [PATCH 10/15] staging: wilc1000: refactor linux_wlan_init_test_config() Ajay.Kathat
@ 2019-02-02 19:17 ` Ajay.Kathat
  2019-02-02 19:17 ` [PATCH 12/15] staging: wilc1000: use random number for cookie instead of pointer Ajay.Kathat
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: Ajay.Kathat @ 2019-02-02 19:17 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, Adham.Abozaeid, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

Make use of cookie information to pass to wpa_s and handle cookie value
received in the cfg80211_ops callbacks.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/host_interface.c         | 72 +++++++----------------
 drivers/staging/wilc1000/host_interface.h         | 13 ++--
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 51 ++++++++--------
 drivers/staging/wilc1000/wilc_wfi_netdevice.h     |  2 +-
 4 files changed, 53 insertions(+), 85 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 4598920..c6fcf27 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -920,40 +920,22 @@ static int handle_remain_on_chan(struct wilc_vif *vif,
 	struct wid wid;
 	struct host_if_drv *hif_drv = vif->hif_drv;
 
-	if (!hif_drv->remain_on_ch_pending) {
-		hif_drv->remain_on_ch.arg = hif_remain_ch->arg;
-		hif_drv->remain_on_ch.expired = hif_remain_ch->expired;
-		hif_drv->remain_on_ch.ready = hif_remain_ch->ready;
-		hif_drv->remain_on_ch.ch = hif_remain_ch->ch;
-		hif_drv->remain_on_ch.id = hif_remain_ch->id;
-	} else {
-		hif_remain_ch->ch = hif_drv->remain_on_ch.ch;
-	}
+	if (hif_drv->usr_scan_req.scan_result)
+		return -EBUSY;
 
-	if (hif_drv->usr_scan_req.scan_result) {
-		hif_drv->remain_on_ch_pending = 1;
-		result = -EBUSY;
-		goto error;
-	}
-	if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) {
-		result = -EBUSY;
-		goto error;
-	}
+	if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP)
+		return -EBUSY;
 
-	if (vif->obtaining_ip || vif->connecting) {
-		result = -EBUSY;
-		goto error;
-	}
+	if (vif->obtaining_ip || vif->connecting)
+		return -EBUSY;
 
 	remain_on_chan_flag = true;
 	wid.id = WID_REMAIN_ON_CHAN;
 	wid.type = WID_STR;
 	wid.size = 2;
 	wid.val = kmalloc(wid.size, GFP_KERNEL);
-	if (!wid.val) {
-		result = -ENOMEM;
-		goto error;
-	}
+	if (!wid.val)
+		return -ENOMEM;
 
 	wid.val[0] = remain_on_chan_flag;
 	wid.val[1] = (s8)hif_remain_ch->ch;
@@ -961,21 +943,16 @@ static int handle_remain_on_chan(struct wilc_vif *vif,
 	result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
 				      wilc_get_vif_idx(vif));
 	kfree(wid.val);
-	if (result != 0)
-		netdev_err(vif->ndev, "Failed to set remain on channel\n");
+	if (result)
+		return -EBUSY;
 
-error:
+	hif_drv->remain_on_ch.arg = hif_remain_ch->arg;
+	hif_drv->remain_on_ch.expired = hif_remain_ch->expired;
+	hif_drv->remain_on_ch.ch = hif_remain_ch->ch;
+	hif_drv->remain_on_ch.cookie = hif_remain_ch->cookie;
 	hif_drv->remain_on_ch_timer_vif = vif;
-	mod_timer(&hif_drv->remain_on_ch_timer,
-		  jiffies + msecs_to_jiffies(hif_remain_ch->duration));
-
-	if (hif_drv->remain_on_ch.ready)
-		hif_drv->remain_on_ch.ready(hif_drv->remain_on_ch.arg);
 
-	if (hif_drv->remain_on_ch_pending)
-		hif_drv->remain_on_ch_pending = 0;
-
-	return result;
+	return 0;
 }
 
 static void handle_listen_state_expired(struct work_struct *work)
@@ -1012,7 +989,7 @@ static void handle_listen_state_expired(struct work_struct *work)
 
 		if (hif_drv->remain_on_ch.expired) {
 			hif_drv->remain_on_ch.expired(hif_drv->remain_on_ch.arg,
-						      hif_remain_ch->id);
+						      hif_remain_ch->cookie);
 		}
 	} else {
 		netdev_dbg(vif->ndev, "Not in listen state\n");
@@ -1036,7 +1013,7 @@ static void listen_timer_cb(struct timer_list *t)
 	if (IS_ERR(msg))
 		return;
 
-	msg->body.remain_on_ch.id = vif->hif_drv->remain_on_ch.id;
+	msg->body.remain_on_ch.cookie = vif->hif_drv->remain_on_ch.cookie;
 
 	result = wilc_enqueue_work(msg);
 	if (result) {
@@ -1102,9 +1079,6 @@ static void handle_scan_complete(struct work_struct *work)
 
 	handle_scan_done(msg->vif, SCAN_EVENT_DONE);
 
-	if (msg->vif->hif_drv->remain_on_ch_pending)
-		handle_remain_on_chan(msg->vif,
-				      &msg->vif->hif_drv->remain_on_ch);
 	kfree(msg);
 }
 
@@ -1842,10 +1816,9 @@ void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length)
 	}
 }
 
-int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
+int wilc_remain_on_channel(struct wilc_vif *vif, u64 cookie,
 			   u32 duration, u16 chan,
-			   void (*expired)(void *, u32),
-			   void (*ready)(void *),
+			   void (*expired)(void *, u64),
 			   void *user_arg)
 {
 	struct remain_ch roc;
@@ -1853,10 +1826,9 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
 
 	roc.ch = chan;
 	roc.expired = expired;
-	roc.ready = ready;
 	roc.arg = user_arg;
 	roc.duration = duration;
-	roc.id = session_id;
+	roc.cookie = cookie;
 	result = handle_remain_on_chan(vif, &roc);
 	if (result)
 		netdev_err(vif->ndev, "%s: failed to set remain on channel\n",
@@ -1865,7 +1837,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
 	return result;
 }
 
-int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id)
+int wilc_listen_state_expired(struct wilc_vif *vif, u64 cookie)
 {
 	int result;
 	struct host_if_msg *msg;
@@ -1882,7 +1854,7 @@ int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id)
 	if (IS_ERR(msg))
 		return PTR_ERR(msg);
 
-	msg->body.remain_on_ch.id = session_id;
+	msg->body.remain_on_ch.cookie = cookie;
 
 	result = wilc_enqueue_work(msg);
 	if (result) {
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 0feb63f..994e641 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -140,10 +140,9 @@ struct wilc_conn_info {
 struct remain_ch {
 	u16 ch;
 	u32 duration;
-	void (*expired)(void *priv, u32 session_id);
-	void (*ready)(void *priv);
+	void (*expired)(void *priv, u64 cookie);
 	void *arg;
-	u32 id;
+	u32 cookie;
 };
 
 struct wilc;
@@ -151,7 +150,6 @@ struct host_if_drv {
 	struct user_scan_req usr_scan_req;
 	struct wilc_conn_info conn_info;
 	struct remain_ch remain_on_ch;
-	u8 remain_on_ch_pending;
 	u64 p2p_timeout;
 
 	enum host_if_state hif_state;
@@ -227,12 +225,11 @@ int wilc_edit_station(struct wilc_vif *vif, const u8 *mac,
 int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, u32 timeout);
 int wilc_setup_multicast_filter(struct wilc_vif *vif, u32 enabled, u32 count,
 				u8 *mc_list);
-int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
+int wilc_remain_on_channel(struct wilc_vif *vif, u64 cookie,
 			   u32 duration, u16 chan,
-			   void (*expired)(void *, u32),
-			   void (*ready)(void *),
+			   void (*expired)(void *, u64),
 			   void *user_arg);
-int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id);
+int wilc_listen_state_expired(struct wilc_vif *vif, u64 cookie);
 void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg);
 int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
 			     u8 ifc_id);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 08b60ddd..f719b74 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1119,27 +1119,12 @@ static void wilc_wfi_mgmt_tx_complete(void *priv, int status)
 	kfree(pv_data);
 }
 
-static void wilc_wfi_remain_on_channel_ready(void *priv_data)
-{
-	struct wilc_priv *priv;
-
-	priv = priv_data;
-
-	priv->p2p_listen_state = true;
-
-	cfg80211_ready_on_channel(priv->wdev,
-				  priv->remain_on_ch_params.listen_cookie,
-				  priv->remain_on_ch_params.listen_ch,
-				  priv->remain_on_ch_params.listen_duration,
-				  GFP_KERNEL);
-}
-
-static void wilc_wfi_remain_on_channel_expired(void *data, u32 session_id)
+static void wilc_wfi_remain_on_channel_expired(void *data, u64 cookie)
 {
 	struct wilc_priv *priv = data;
 	struct wilc_wfi_p2p_listen_params *params = &priv->remain_on_ch_params;
 
-	if (session_id != params->listen_session_id)
+	if (cookie != params->listen_cookie)
 		return;
 
 	priv->p2p_listen_state = false;
@@ -1156,24 +1141,36 @@ static int remain_on_channel(struct wiphy *wiphy,
 	int ret = 0;
 	struct wilc_priv *priv = wiphy_priv(wiphy);
 	struct wilc_vif *vif = netdev_priv(priv->dev);
+	u64 id;
 
 	if (wdev->iftype == NL80211_IFTYPE_AP) {
 		netdev_dbg(vif->ndev, "Required while in AP mode\n");
 		return ret;
 	}
 
+	id = ++priv->inc_roc_cookie;
+	if (id == 0)
+		id = ++priv->inc_roc_cookie;
+
+	ret = wilc_remain_on_channel(vif, id, duration, chan->hw_value,
+				     wilc_wfi_remain_on_channel_expired,
+				     (void *)priv);
+	if (ret)
+		return ret;
+
 	curr_channel = chan->hw_value;
 
 	priv->remain_on_ch_params.listen_ch = chan;
-	priv->remain_on_ch_params.listen_cookie = *cookie;
+	priv->remain_on_ch_params.listen_cookie = id;
+	*cookie = id;
+	priv->p2p_listen_state = true;
 	priv->remain_on_ch_params.listen_duration = duration;
-	priv->remain_on_ch_params.listen_session_id++;
 
-	return wilc_remain_on_channel(vif,
-				priv->remain_on_ch_params.listen_session_id,
-				duration, chan->hw_value,
-				wilc_wfi_remain_on_channel_expired,
-				wilc_wfi_remain_on_channel_ready, (void *)priv);
+	cfg80211_ready_on_channel(wdev, *cookie, chan, duration, GFP_KERNEL);
+	mod_timer(&vif->hif_drv->remain_on_ch_timer,
+		  jiffies + msecs_to_jiffies(duration));
+
+	return ret;
 }
 
 static int cancel_remain_on_channel(struct wiphy *wiphy,
@@ -1183,8 +1180,10 @@ static int cancel_remain_on_channel(struct wiphy *wiphy,
 	struct wilc_priv *priv = wiphy_priv(wiphy);
 	struct wilc_vif *vif = netdev_priv(priv->dev);
 
-	return wilc_listen_state_expired(vif,
-			priv->remain_on_ch_params.listen_session_id);
+	if (cookie != priv->remain_on_ch_params.listen_cookie)
+		return -ENOENT;
+
+	return wilc_listen_state_expired(vif, cookie);
 }
 
 static void wilc_wfi_cfg_tx_vendor_spec(struct wilc_priv *priv,
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index cc06ef9..a06b0c0 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -65,7 +65,6 @@ struct wilc_wfi_p2p_listen_params {
 	struct ieee80211_channel *listen_ch;
 	u32 listen_duration;
 	u64 listen_cookie;
-	u32 listen_session_id;
 };
 
 struct wilc_p2p_var {
@@ -161,6 +160,7 @@ struct wilc_priv {
 	struct ieee80211_rate bitrates[ARRAY_SIZE(wilc_bitrates)];
 	struct ieee80211_supported_band band;
 	u32 cipher_suites[ARRAY_SIZE(wilc_cipher_suites)];
+	u64 inc_roc_cookie;
 };
 
 struct frame_reg {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 12/15] staging: wilc1000: use random number for cookie instead of pointer
  2019-02-02 19:16 [PATCH 00/15] staging: wilc1000: cleanup patches & handle review comments Ajay.Kathat
                   ` (10 preceding siblings ...)
  2019-02-02 19:17 ` [PATCH 11/15] staging: wilc1000: refactor code to use cookie information Ajay.Kathat
@ 2019-02-02 19:17 ` Ajay.Kathat
  2019-02-02 19:17 ` [PATCH 13/15] staging: wilc1000: avoid use of interface names for validation Ajay.Kathat
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 23+ messages in thread
From: Ajay.Kathat @ 2019-02-02 19:17 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, Adham.Abozaeid, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

Use random number to assign to cookie value.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index f719b74..98121ec 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1252,7 +1252,7 @@ static int mgmt_tx(struct wiphy *wiphy,
 	u32 buf_len = len + sizeof(p2p_vendor_spec) + sizeof(priv->p2p.local_random);
 	int ret = 0;
 
-	*cookie = (unsigned long)buf;
+	*cookie = prandom_u32();
 	priv->tx_cookie = *cookie;
 	mgmt = (const struct ieee80211_mgmt *)buf;
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 13/15] staging: wilc1000: avoid use of interface names for validation
  2019-02-02 19:16 [PATCH 00/15] staging: wilc1000: cleanup patches & handle review comments Ajay.Kathat
                   ` (11 preceding siblings ...)
  2019-02-02 19:17 ` [PATCH 12/15] staging: wilc1000: use random number for cookie instead of pointer Ajay.Kathat
@ 2019-02-02 19:17 ` Ajay.Kathat
  2019-02-02 19:17 ` [PATCH 14/15] staging: wilc1000: add check before performing operation on net_device Ajay.Kathat
  2019-02-02 19:17 ` [PATCH 15/15] staging: wilc1000: remove unused struct 'add_sta_param' Ajay.Kathat
  14 siblings, 0 replies; 23+ messages in thread
From: Ajay.Kathat @ 2019-02-02 19:17 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, Adham.Abozaeid, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

Avoid use of interface name i.e 'wlan0' & 'p2p0' to check the interface
type in dev_state_ev_handler(). Now making use of netdev_ops and iface
type to know interface. Reorder the functions to avoid the forward
declaration after the above changes

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 144 +++++++++++++++++-----------------
 1 file changed, 70 insertions(+), 74 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 484fe3d..dcd5861 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -12,71 +12,6 @@
 
 #include "wilc_wfi_cfgoperations.h"
 
-static int dev_state_ev_handler(struct notifier_block *this,
-				unsigned long event, void *ptr)
-{
-	struct in_ifaddr *dev_iface = ptr;
-	struct wilc_priv *priv;
-	struct host_if_drv *hif_drv;
-	struct net_device *dev;
-	struct wilc_vif *vif;
-	char wlan_dev_name[5] = "wlan0";
-
-	if (!dev_iface || !dev_iface->ifa_dev || !dev_iface->ifa_dev->dev)
-		return NOTIFY_DONE;
-
-	if (memcmp(dev_iface->ifa_label, "wlan0", 5) &&
-	    memcmp(dev_iface->ifa_label, "p2p0", 4))
-		return NOTIFY_DONE;
-
-	dev  = (struct net_device *)dev_iface->ifa_dev->dev;
-	if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy)
-		return NOTIFY_DONE;
-
-	priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
-	if (!priv)
-		return NOTIFY_DONE;
-
-	hif_drv = (struct host_if_drv *)priv->hif_drv;
-	vif = netdev_priv(dev);
-	if (!vif || !hif_drv)
-		return NOTIFY_DONE;
-
-	switch (event) {
-	case NETDEV_UP:
-		if (vif->iftype == WILC_STATION_MODE ||
-		    vif->iftype == WILC_CLIENT_MODE) {
-			hif_drv->ifc_up = 1;
-			vif->obtaining_ip = false;
-			del_timer(&vif->during_ip_timer);
-		}
-
-		if (vif->wilc->enable_ps)
-			wilc_set_power_mgmt(vif, 1, 0);
-
-		break;
-
-	case NETDEV_DOWN:
-		if (vif->iftype == WILC_STATION_MODE ||
-		    vif->iftype == WILC_CLIENT_MODE) {
-			hif_drv->ifc_up = 0;
-			vif->obtaining_ip = false;
-		}
-
-		if (memcmp(dev_iface->ifa_label, wlan_dev_name, 5) == 0)
-			wilc_set_power_mgmt(vif, 0, 0);
-
-		wilc_resolve_disconnect_aberration(vif);
-
-		break;
-
-	default:
-		break;
-	}
-
-	return NOTIFY_DONE;
-}
-
 static irqreturn_t isr_uh_routine(int irq, void *user_data)
 {
 	struct net_device *dev = user_data;
@@ -921,6 +856,76 @@ void wilc_wfi_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size)
 		wilc_wfi_p2p_rx(wilc->vif[1]->ndev, buff, size);
 }
 
+static const struct net_device_ops wilc_netdev_ops = {
+	.ndo_init = mac_init_fn,
+	.ndo_open = wilc_mac_open,
+	.ndo_stop = wilc_mac_close,
+	.ndo_start_xmit = wilc_mac_xmit,
+	.ndo_get_stats = mac_stats,
+	.ndo_set_rx_mode  = wilc_set_multicast_list,
+};
+
+static int dev_state_ev_handler(struct notifier_block *this,
+				unsigned long event, void *ptr)
+{
+	struct in_ifaddr *dev_iface = ptr;
+	struct wilc_priv *priv;
+	struct host_if_drv *hif_drv;
+	struct net_device *dev;
+	struct wilc_vif *vif;
+
+	if (!dev_iface || !dev_iface->ifa_dev || !dev_iface->ifa_dev->dev)
+		return NOTIFY_DONE;
+
+	dev  = (struct net_device *)dev_iface->ifa_dev->dev;
+	if (dev->netdev_ops != &wilc_netdev_ops)
+		return NOTIFY_DONE;
+
+	if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy)
+		return NOTIFY_DONE;
+
+	priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
+	if (!priv)
+		return NOTIFY_DONE;
+
+	hif_drv = (struct host_if_drv *)priv->hif_drv;
+	vif = netdev_priv(dev);
+	if (!vif || !hif_drv)
+		return NOTIFY_DONE;
+
+	switch (event) {
+	case NETDEV_UP:
+		if (vif->iftype == WILC_STATION_MODE ||
+		    vif->iftype == WILC_CLIENT_MODE) {
+			hif_drv->ifc_up = 1;
+			vif->obtaining_ip = false;
+			del_timer(&vif->during_ip_timer);
+		}
+
+		if (vif->wilc->enable_ps)
+			wilc_set_power_mgmt(vif, 1, 0);
+
+		break;
+
+	case NETDEV_DOWN:
+		if (vif->iftype == WILC_STATION_MODE ||
+		    vif->iftype == WILC_CLIENT_MODE) {
+			hif_drv->ifc_up = 0;
+			vif->obtaining_ip = false;
+			wilc_set_power_mgmt(vif, 0, 0);
+		}
+
+		wilc_resolve_disconnect_aberration(vif);
+
+		break;
+
+	default:
+		break;
+	}
+
+	return NOTIFY_DONE;
+}
+
 static struct notifier_block g_dev_notifier = {
 	.notifier_call = dev_state_ev_handler
 };
@@ -957,15 +962,6 @@ void wilc_netdev_cleanup(struct wilc *wilc)
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_cleanup);
 
-static const struct net_device_ops wilc_netdev_ops = {
-	.ndo_init = mac_init_fn,
-	.ndo_open = wilc_mac_open,
-	.ndo_stop = wilc_mac_close,
-	.ndo_start_xmit = wilc_mac_xmit,
-	.ndo_get_stats = mac_stats,
-	.ndo_set_rx_mode  = wilc_set_multicast_list,
-};
-
 int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
 		     const struct wilc_hif_func *ops)
 {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 14/15] staging: wilc1000: add check before performing operation on net_device
  2019-02-02 19:16 [PATCH 00/15] staging: wilc1000: cleanup patches & handle review comments Ajay.Kathat
                   ` (12 preceding siblings ...)
  2019-02-02 19:17 ` [PATCH 13/15] staging: wilc1000: avoid use of interface names for validation Ajay.Kathat
@ 2019-02-02 19:17 ` Ajay.Kathat
  2019-02-02 19:17 ` [PATCH 15/15] staging: wilc1000: remove unused struct 'add_sta_param' Ajay.Kathat
  14 siblings, 0 replies; 23+ messages in thread
From: Ajay.Kathat @ 2019-02-02 19:17 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, Adham.Abozaeid, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

Before calling an operation on net_device check if that interface is
available.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index dcd5861..bafb454 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -159,9 +159,11 @@ static int linux_wlan_txq_task(void *vp)
 		do {
 			ret = wilc_wlan_handle_txq(dev, &txq_count);
 			if (txq_count < FLOW_CONTROL_LOWER_THRESHOLD) {
-				if (netif_queue_stopped(wl->vif[0]->ndev))
+				if (wl->vif[0]->mac_opened &&
+				    netif_queue_stopped(wl->vif[0]->ndev))
 					netif_wake_queue(wl->vif[0]->ndev);
-				if (netif_queue_stopped(wl->vif[1]->ndev))
+				if (wl->vif[1]->mac_opened &&
+				    netif_queue_stopped(wl->vif[1]->ndev))
 					netif_wake_queue(wl->vif[1]->ndev);
 			}
 		} while (ret == -ENOBUFS && !wl->close);
@@ -761,8 +763,10 @@ netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)
 						linux_wlan_tx_complete);
 
 	if (queue_count > FLOW_CONTROL_UPPER_THRESHOLD) {
-		netif_stop_queue(wilc->vif[0]->ndev);
-		netif_stop_queue(wilc->vif[1]->ndev);
+		if (wilc->vif[0]->mac_opened)
+			netif_stop_queue(wilc->vif[0]->ndev);
+		if (wilc->vif[1]->mac_opened)
+			netif_stop_queue(wilc->vif[1]->ndev);
 	}
 
 	return 0;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 15/15] staging: wilc1000: remove unused struct 'add_sta_param'
  2019-02-02 19:16 [PATCH 00/15] staging: wilc1000: cleanup patches & handle review comments Ajay.Kathat
                   ` (13 preceding siblings ...)
  2019-02-02 19:17 ` [PATCH 14/15] staging: wilc1000: add check before performing operation on net_device Ajay.Kathat
@ 2019-02-02 19:17 ` Ajay.Kathat
  14 siblings, 0 replies; 23+ messages in thread
From: Ajay.Kathat @ 2019-02-02 19:17 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, Adham.Abozaeid, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

Remove 'add_sta_param' structure as its not used now.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/host_interface.h | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 994e641..790f83e 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -170,17 +170,6 @@ struct host_if_drv {
 	u8 assoc_resp[WILC_MAX_ASSOC_RESP_FRAME_SIZE];
 };
 
-struct add_sta_param {
-	u8 bssid[ETH_ALEN];
-	u16 aid;
-	u8 rates_len;
-	const u8 *rates;
-	bool ht_supported;
-	struct ieee80211_ht_cap ht_capa;
-	u16 flags_mask;
-	u16 flags_set;
-};
-
 struct wilc_vif;
 int wilc_remove_wep_key(struct wilc_vif *vif, u8 index);
 int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH 08/15] staging: wilc1000: use correct condition in loops for 'vif_num' count
  2019-02-02 19:17 ` [PATCH 08/15] staging: wilc1000: use correct condition in loops for 'vif_num' count Ajay.Kathat
@ 2019-02-04  8:13   ` Dan Carpenter
  2019-02-04  9:42     ` Ajay.Kathat
  0 siblings, 1 reply; 23+ messages in thread
From: Dan Carpenter @ 2019-02-04  8:13 UTC (permalink / raw)
  To: Ajay.Kathat; +Cc: linux-wireless, devel, gregkh, johannes, Adham.Abozaeid

On Sat, Feb 02, 2019 at 07:17:13PM +0000, Ajay.Kathat@microchip.com wrote:
> From: Ajay Singh <ajay.kathat@microchip.com>
> 
> The value of 'vif_num'(interface count) starts with 0, so modified the
> loop conditions to execute for all interface.
> 
> Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>

The right thing to do is to change ->vif_num = i + 1 in
wilc_netdev_init().  That's how it was originally.  Please, add a
Fixes tag.

Fixes: 735bb39ca3be ("staging: wilc1000: simplify vif[i]->ndev accesses")

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 08/15] staging: wilc1000: use correct condition in loops for 'vif_num' count
  2019-02-04  8:13   ` Dan Carpenter
@ 2019-02-04  9:42     ` Ajay.Kathat
  2019-02-04  9:47       ` Dan Carpenter
  0 siblings, 1 reply; 23+ messages in thread
From: Ajay.Kathat @ 2019-02-04  9:42 UTC (permalink / raw)
  To: dan.carpenter; +Cc: linux-wireless, devel, gregkh, johannes, Adham.Abozaeid



On 2/4/2019 1:43 PM, Dan Carpenter wrote:
> On Sat, Feb 02, 2019 at 07:17:13PM +0000, Ajay.Kathat@microchip.com wrote:
>> From: Ajay Singh <ajay.kathat@microchip.com>
>>
>> The value of 'vif_num'(interface count) starts with 0, so modified the
>> loop conditions to execute for all interface.
>>
>> Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
> 
> The right thing to do is to change ->vif_num = i + 1 in
> wilc_netdev_init().  That's how it was originally.  Please, add a
> Fixes tag.
> 
> Fixes: 735bb39ca3be ("staging: wilc1000: simplify vif[i]->ndev accesses")
> 

Thanks. Sure, I will add Fixes tag and resubmit the changes.

Can other patches from the series be applied excluding this or should I
resubmit the complete series?
Please suggest.

Regards,
Ajay

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 08/15] staging: wilc1000: use correct condition in loops for 'vif_num' count
  2019-02-04  9:42     ` Ajay.Kathat
@ 2019-02-04  9:47       ` Dan Carpenter
  2019-02-04 11:39         ` Greg KH
  0 siblings, 1 reply; 23+ messages in thread
From: Dan Carpenter @ 2019-02-04  9:47 UTC (permalink / raw)
  To: Ajay.Kathat; +Cc: linux-wireless, devel, gregkh, johannes, Adham.Abozaeid

On Mon, Feb 04, 2019 at 09:42:36AM +0000, Ajay.Kathat@microchip.com wrote:
> 
> 
> On 2/4/2019 1:43 PM, Dan Carpenter wrote:
> > On Sat, Feb 02, 2019 at 07:17:13PM +0000, Ajay.Kathat@microchip.com wrote:
> >> From: Ajay Singh <ajay.kathat@microchip.com>
> >>
> >> The value of 'vif_num'(interface count) starts with 0, so modified the
> >> loop conditions to execute for all interface.
> >>
> >> Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
> > 
> > The right thing to do is to change ->vif_num = i + 1 in
> > wilc_netdev_init().  That's how it was originally.  Please, add a
> > Fixes tag.
> > 
> > Fixes: 735bb39ca3be ("staging: wilc1000: simplify vif[i]->ndev accesses")
> > 
> 
> Thanks. Sure, I will add Fixes tag and resubmit the changes.
> 
> Can other patches from the series be applied excluding this or should I
> resubmit the complete series?
> Please suggest.

I don't have an opinion on that.  I guess if you just resend them all,
that's the easiest for Greg.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 08/15] staging: wilc1000: use correct condition in loops for 'vif_num' count
  2019-02-04  9:47       ` Dan Carpenter
@ 2019-02-04 11:39         ` Greg KH
  2019-02-04 12:25           ` Ajay.Kathat
  0 siblings, 1 reply; 23+ messages in thread
From: Greg KH @ 2019-02-04 11:39 UTC (permalink / raw)
  To: Ajay.Kathat, devel, johannes, linux-wireless, Adham.Abozaeid
  Cc: Dan Carpenter

On Mon, Feb 04, 2019 at 12:47:23PM +0300, Dan Carpenter wrote:
> On Mon, Feb 04, 2019 at 09:42:36AM +0000, Ajay.Kathat@microchip.com wrote:
> > 
> > 
> > On 2/4/2019 1:43 PM, Dan Carpenter wrote:
> > > On Sat, Feb 02, 2019 at 07:17:13PM +0000, Ajay.Kathat@microchip.com wrote:
> > >> From: Ajay Singh <ajay.kathat@microchip.com>
> > >>
> > >> The value of 'vif_num'(interface count) starts with 0, so modified the
> > >> loop conditions to execute for all interface.
> > >>
> > >> Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
> > > 
> > > The right thing to do is to change ->vif_num = i + 1 in
> > > wilc_netdev_init().  That's how it was originally.  Please, add a
> > > Fixes tag.
> > > 
> > > Fixes: 735bb39ca3be ("staging: wilc1000: simplify vif[i]->ndev accesses")
> > > 
> > 
> > Thanks. Sure, I will add Fixes tag and resubmit the changes.
> > 
> > Can other patches from the series be applied excluding this or should I
> > resubmit the complete series?
> > Please suggest.
> 
> I don't have an opinion on that.  I guess if you just resend them all,
> that's the easiest for Greg.

I took the first 7 patches here, so just a respin of the remaining ones
would be fine.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 08/15] staging: wilc1000: use correct condition in loops for 'vif_num' count
  2019-02-04 11:39         ` Greg KH
@ 2019-02-04 12:25           ` Ajay.Kathat
  0 siblings, 0 replies; 23+ messages in thread
From: Ajay.Kathat @ 2019-02-04 12:25 UTC (permalink / raw)
  To: gregkh, devel, johannes, linux-wireless, Adham.Abozaeid; +Cc: dan.carpenter

Hi Greg,

On 2/4/2019 5:09 PM, Greg KH wrote:
> On Mon, Feb 04, 2019 at 12:47:23PM +0300, Dan Carpenter wrote:
>> On Mon, Feb 04, 2019 at 09:42:36AM +0000, Ajay.Kathat@microchip.com wrote:
>>>
>>>
>>> On 2/4/2019 1:43 PM, Dan Carpenter wrote:
>>>> On Sat, Feb 02, 2019 at 07:17:13PM +0000, Ajay.Kathat@microchip.com wrote:
>>>>> From: Ajay Singh <ajay.kathat@microchip.com>
>>>>>
>>>>> The value of 'vif_num'(interface count) starts with 0, so modified the
>>>>> loop conditions to execute for all interface.
>>>>>
>>>>> Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
>>>>
>>>> The right thing to do is to change ->vif_num = i + 1 in
>>>> wilc_netdev_init().  That's how it was originally.  Please, add a
>>>> Fixes tag.
>>>>
>>>> Fixes: 735bb39ca3be ("staging: wilc1000: simplify vif[i]->ndev accesses")
>>>>
>>>
>>> Thanks. Sure, I will add Fixes tag and resubmit the changes.
>>>
>>> Can other patches from the series be applied excluding this or should I
>>> resubmit the complete series?
>>> Please suggest.
>>
>> I don't have an opinion on that.  I guess if you just resend them all,
>> that's the easiest for Greg.
> 
> I took the first 7 patches here, so just a respin of the remaining ones
> would be fine.
> 

Thanks alot.
This patch will take some time for modification. As remaining patches
are not dependent on this. I will resend them.

Regards,
Ajay

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 01/15] staging: wilc1000: avoid the use of 'wilc_wfi_mon' static variable
  2019-02-02 19:16 ` [PATCH 01/15] staging: wilc1000: avoid the use of 'wilc_wfi_mon' static variable Ajay.Kathat
@ 2019-02-04 13:38   ` Kalle Valo
  2019-02-05  2:56     ` Ajay.Kathat
  0 siblings, 1 reply; 23+ messages in thread
From: Kalle Valo @ 2019-02-04 13:38 UTC (permalink / raw)
  To: Ajay.Kathat; +Cc: linux-wireless, devel, gregkh, Adham.Abozaeid, johannes

<Ajay.Kathat@microchip.com> writes:

> From: Ajay Singh <ajay.kathat@microchip.com>
>
> Avoid use of static variable for monitor net_device and move it inside
> wilc structure.
>
> Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>

[...]

> --- a/drivers/staging/wilc1000/linux_mon.c
> +++ b/drivers/staging/wilc1000/linux_mon.c
> @@ -18,8 +18,6 @@ struct wilc_wfi_radiotap_cb_hdr {
>  	u16 tx_flags;
>  } __packed;
>  
> -static struct net_device *wilc_wfi_mon; /* global monitor netdev */
> -
>  static u8 srcadd[6];
>  static u8 bssid[6];

I hope you are working on moving srcadd and bssid as well (at some
point).

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 01/15] staging: wilc1000: avoid the use of 'wilc_wfi_mon' static variable
  2019-02-04 13:38   ` Kalle Valo
@ 2019-02-05  2:56     ` Ajay.Kathat
  0 siblings, 0 replies; 23+ messages in thread
From: Ajay.Kathat @ 2019-02-05  2:56 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, devel, gregkh, Adham.Abozaeid, johannes

Hi Kalle,

On 2/4/2019 7:08 PM, Kalle Valo wrote:
> <Ajay.Kathat@microchip.com> writes:
> 
>> From: Ajay Singh <ajay.kathat@microchip.com>
>>
>> Avoid use of static variable for monitor net_device and move it inside
>> wilc structure.
>>
>> Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
> 
> [...]
> 
>> --- a/drivers/staging/wilc1000/linux_mon.c
>> +++ b/drivers/staging/wilc1000/linux_mon.c
>> @@ -18,8 +18,6 @@ struct wilc_wfi_radiotap_cb_hdr {
>>  	u16 tx_flags;
>>  } __packed;
>>  
>> -static struct net_device *wilc_wfi_mon; /* global monitor netdev */
>> -
>>  static u8 srcadd[6];
>>  static u8 bssid[6];
> 
> I hope you are working on moving srcadd and bssid as well (at some
> point).
> 

Yes, I will take care of this before submitting the driver for another
mainline review.

Regards,
Ajay

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2019-02-05  2:56 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-02 19:16 [PATCH 00/15] staging: wilc1000: cleanup patches & handle review comments Ajay.Kathat
2019-02-02 19:16 ` [PATCH 01/15] staging: wilc1000: avoid the use of 'wilc_wfi_mon' static variable Ajay.Kathat
2019-02-04 13:38   ` Kalle Valo
2019-02-05  2:56     ` Ajay.Kathat
2019-02-02 19:16 ` [PATCH 02/15] staging: wilc1000: remove conditional lock in wilc_wfi_deinit_mon_interface() Ajay.Kathat
2019-02-02 19:16 ` [PATCH 03/15] staging: wilc1000: remove redundant macros for radiotap Ajay.Kathat
2019-02-02 19:17 ` [PATCH 04/15] staging: wilc1000: remove unnecessary debug log messages Ajay.Kathat
2019-02-02 19:17 ` [PATCH 05/15] staging: wilc1000: rename timeout related macros Ajay.Kathat
2019-02-02 19:17 ` [PATCH 06/15] staging: wilc1000: make use of iface type to identify p2p interface Ajay.Kathat
2019-02-02 19:17 ` [PATCH 07/15] staging: wilc1000: refactor scan() cfg80211 ops callback Ajay.Kathat
2019-02-02 19:17 ` [PATCH 08/15] staging: wilc1000: use correct condition in loops for 'vif_num' count Ajay.Kathat
2019-02-04  8:13   ` Dan Carpenter
2019-02-04  9:42     ` Ajay.Kathat
2019-02-04  9:47       ` Dan Carpenter
2019-02-04 11:39         ` Greg KH
2019-02-04 12:25           ` Ajay.Kathat
2019-02-02 19:17 ` [PATCH 09/15] staging: wilc1000: remove use of 'terminated_handle' static variable Ajay.Kathat
2019-02-02 19:17 ` [PATCH 10/15] staging: wilc1000: refactor linux_wlan_init_test_config() Ajay.Kathat
2019-02-02 19:17 ` [PATCH 11/15] staging: wilc1000: refactor code to use cookie information Ajay.Kathat
2019-02-02 19:17 ` [PATCH 12/15] staging: wilc1000: use random number for cookie instead of pointer Ajay.Kathat
2019-02-02 19:17 ` [PATCH 13/15] staging: wilc1000: avoid use of interface names for validation Ajay.Kathat
2019-02-02 19:17 ` [PATCH 14/15] staging: wilc1000: add check before performing operation on net_device Ajay.Kathat
2019-02-02 19:17 ` [PATCH 15/15] staging: wilc1000: remove unused struct 'add_sta_param' Ajay.Kathat

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.