All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/26] use unified firmware and add ops in cfg
@ 2016-01-12  7:39 Glen Lee
  2016-01-12  7:39 ` [PATCH 01/26] staging: wilc1000: fix bug when changing virtual interface Glen Lee
                   ` (25 more replies)
  0 siblings, 26 replies; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

This patch series contains
* support suspend and resume functionality
* use a unified firmware for all mode of operations(station, ap, p2p)
* support Station/AP concurrency
* increase link speed
* add a cfg operation for adjusting the tx power
* fix bug on p2p, WEP security and chaning virtual interface

Glen Lee (26):
  staging: wilc1000: fix bug when changing virtual interface
  staging: wilc1000: remove define WILC_OPTIMIZE_SLEEP_INT
  staging: wilc1000: support suspend/resume functionality
  staging: wilc1000: add sdio resume/suspend
  staging: wilc1000: sdio_init: add resume argument
  staging: wilc1000: add ops resuem/suspend/wakeup in cfg80211
  staging: wilc1000: remove sleep and reduce close timeout
  staging: wilc1000: get address from wilc
  staging: wilc1000: use unified firmware
  staging: wilc1000: remove wilc_set_machw_change_vir_if
  staging: wilc1000: set bssid with mode
  staging: wilc1000: set proper bssid address
  staging: wilc1000: change_virtual_intf: change codes for unified
    firmware
  staging: wilc1000: call power save after changing mode
  staging: wilc1000: wilc_set_wfi_drv_handler: add mac index
  staging: wilc1000: remove unused functions
  staging: wilc1000: ignore power save
  staging: wilc1000: handle connecting error
  staging: wilc1000: tcp_process: fix a build warning
  staging: wilc1000: remove define TCP_ACK_FILTER
  staging: wilc1000: increase link speed
  staging: wilc1000: disable power save when AP mode
  staging: wilc1000: fix bug on p2p connection
  staging: wilc1000: add ops tx power in cfg80211
  staging: wilc1000: fix WEP security bug
  staging: wilc1000: get mac address after setting drv handler

 drivers/staging/wilc1000/Makefile                 |   6 +-
 drivers/staging/wilc1000/host_interface.c         | 250 ++++++++--------
 drivers/staging/wilc1000/host_interface.h         |   9 +-
 drivers/staging/wilc1000/linux_wlan.c             |  87 +++---
 drivers/staging/wilc1000/wilc_sdio.c              | 102 ++++++-
 drivers/staging/wilc1000/wilc_spi.c               |   2 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 350 +++++++---------------
 drivers/staging/wilc1000/wilc_wfi_netdevice.h     |   8 +-
 drivers/staging/wilc1000/wilc_wlan.c              | 202 ++++---------
 drivers/staging/wilc1000/wilc_wlan.h              |  10 +-
 drivers/staging/wilc1000/wilc_wlan_if.h           |   3 +-
 11 files changed, 439 insertions(+), 590 deletions(-)

-- 
1.9.1


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

* [PATCH 01/26] staging: wilc1000: fix bug when changing virtual interface
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-12  7:39 ` [PATCH 02/26] staging: wilc1000: remove define WILC_OPTIMIZE_SLEEP_INT Glen Lee
                   ` (24 subsequent siblings)
  25 siblings, 0 replies; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

This patch fixes a bug connection error when changing virtual interface to p2p.
Variable quit needs to be set 0 when wilc is reinitialized again.

Fixes : 67e2a07ed800 ("staging: wilc1000: move all of wilc_wlan_dev_t to struct wilc")
Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/wilc_wlan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 83af51b..07460ff 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1588,6 +1588,8 @@ int wilc_wlan_init(struct net_device *dev)
 
 	PRINT_D(INIT_DBG, "Initializing WILC_Wlan ...\n");
 
+	wilc->quit = 0;
+
 	if (!wilc->hif_func->hif_init(wilc)) {
 		ret = -EIO;
 		goto _fail_;
-- 
1.9.1


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

* [PATCH 02/26] staging: wilc1000: remove define WILC_OPTIMIZE_SLEEP_INT
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
  2016-01-12  7:39 ` [PATCH 01/26] staging: wilc1000: fix bug when changing virtual interface Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-12  7:39 ` [PATCH 03/26] staging: wilc1000: support suspend/resume functionality Glen Lee
                   ` (23 subsequent siblings)
  25 siblings, 0 replies; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

Take the codes of WILC_OPTIMIZE_SLEEP_INT and remove codes inside ifndef.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/wilc_wlan.c | 74 +-----------------------------------
 1 file changed, 2 insertions(+), 72 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 07460ff..dabb0bd 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -3,9 +3,7 @@
 #include "wilc_wfi_netdevice.h"
 #include "wilc_wlan_cfg.h"
 
-#ifdef WILC_OPTIMIZE_SLEEP_INT
 static inline void chip_allow_sleep(struct wilc *wilc);
-#endif
 static inline void chip_wakeup(struct wilc *wilc);
 static u32 dbgflag = N_INIT | N_ERR | N_INTR | N_TXQ | N_RXQ;
 
@@ -29,21 +27,14 @@ static CHIP_PS_STATE_T chip_ps_state = CHIP_WAKEDUP;
 static inline void acquire_bus(struct wilc *wilc, BUS_ACQUIRE_T acquire)
 {
 	mutex_lock(&wilc->hif_cs);
-	#ifndef WILC_OPTIMIZE_SLEEP_INT
-	if (chip_ps_state != CHIP_WAKEDUP)
-	#endif
-	{
-		if (acquire == ACQUIRE_AND_WAKEUP)
-			chip_wakeup(wilc);
-	}
+	if (acquire == ACQUIRE_AND_WAKEUP)
+		chip_wakeup(wilc);
 }
 
 static inline void release_bus(struct wilc *wilc, BUS_RELEASE_T release)
 {
-	#ifdef WILC_OPTIMIZE_SLEEP_INT
 	if (release == RELEASE_ALLOW_SLEEP)
 		chip_allow_sleep(wilc);
-	#endif
 	mutex_unlock(&wilc->hif_cs);
 }
 
@@ -524,8 +515,6 @@ static struct rxq_entry_t *wilc_wlan_rxq_remove(struct wilc *wilc)
 	return NULL;
 }
 
-#ifdef WILC_OPTIMIZE_SLEEP_INT
-
 static inline void chip_allow_sleep(struct wilc *wilc)
 {
 	u32 reg = 0;
@@ -538,7 +527,6 @@ static inline void chip_allow_sleep(struct wilc *wilc)
 static inline void chip_wakeup(struct wilc *wilc)
 {
 	u32 reg, clk_status_reg, trials = 0;
-	u32 sleep_time;
 
 	if ((wilc->io_type & 0x1) == HIF_SPI) {
 		do {
@@ -597,66 +585,14 @@ static inline void chip_wakeup(struct wilc *wilc)
 	}
 	chip_ps_state = CHIP_WAKEDUP;
 }
-#else
-static inline void chip_wakeup(struct wilc *wilc)
-{
-	u32 reg, trials = 0;
-
-	do {
-		if ((wilc->io_type & 0x1) == HIF_SPI) {
-			wilc->hif_func->hif_read_reg(wilc, 1, &reg);
-			wilc->hif_func->hif_write_reg(wilc, 1, reg & ~BIT(1));
-			wilc->hif_func->hif_write_reg(wilc, 1, reg | BIT(1));
-			wilc->hif_func->hif_write_reg(wilc, 1, reg  & ~BIT(1));
-		} else if ((wilc->io_type & 0x1) == HIF_SDIO)	 {
-			wilc->hif_func->hif_read_reg(wilc, 0xf0, &reg);
-			wilc->hif_func->hif_write_reg(wilc, 0xf0,
-						      reg & ~BIT(0));
-			wilc->hif_func->hif_write_reg(wilc, 0xf0,
-						      reg | BIT(0));
-			wilc->hif_func->hif_write_reg(wilc, 0xf0,
-						      reg  & ~BIT(0));
-		}
-
-		do {
-			mdelay(3);
-
-			if ((wilc_get_chipid(wilc, true) == 0))
-				wilc_debug(N_ERR, "Couldn't read chip id. Wake up failed\n");
-
-		} while ((wilc_get_chipid(wilc, true) == 0) && ((++trials % 3) == 0));
-
-	} while (wilc_get_chipid(wilc, true) == 0);
 
-	if (chip_ps_state == CHIP_SLEEPING_MANUAL) {
-		wilc->hif_func->hif_read_reg(wilc, 0x1C0C, &reg);
-		reg &= ~BIT(0);
-		wilc->hif_func->hif_write_reg(wilc, 0x1C0C, reg);
-
-		if (wilc_get_chipid(wilc, false) >= 0x1002b0) {
-			u32 val32;
-
-			wilc->hif_func->hif_read_reg(wilc, 0x1e1c, &val32);
-			val32 |= BIT(6);
-			wilc->hif_func->hif_write_reg(wilc, 0x1e1c, val32);
-
-			wilc->hif_func->hif_read_reg(wilc, 0x1e9c, &val32);
-			val32 |= BIT(6);
-			wilc->hif_func->hif_write_reg(wilc, 0x1e9c, val32);
-		}
-	}
-	chip_ps_state = CHIP_WAKEDUP;
-}
-#endif
 void wilc_chip_sleep_manually(struct wilc *wilc)
 {
 	if (chip_ps_state != CHIP_WAKEDUP)
 		return;
 	acquire_bus(wilc, ACQUIRE_ONLY);
 
-#ifdef WILC_OPTIMIZE_SLEEP_INT
 	chip_allow_sleep(wilc);
-#endif
 	wilc->hif_func->hif_write_reg(wilc, 0x10a8, 1);
 
 	chip_ps_state = CHIP_SLEEPING_MANUAL;
@@ -1041,9 +977,6 @@ static void wilc_pllupdate_isr_ext(struct wilc *wilc, u32 int_stats)
 static void wilc_sleeptimer_isr_ext(struct wilc *wilc, u32 int_stats1)
 {
 	wilc->hif_func->hif_clear_int_ext(wilc, SLEEP_INT_CLR);
-#ifndef WILC_OPTIMIZE_SLEEP_INT
-	chip_ps_state = CHIP_SLEEPING_AUTO;
-#endif
 }
 
 static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status)
@@ -1113,9 +1046,6 @@ void wilc_handle_isr(struct wilc *wilc)
 
 	if (int_status & DATA_INT_EXT) {
 		wilc_wlan_handle_isr_ext(wilc, int_status);
-	#ifndef WILC_OPTIMIZE_SLEEP_INT
-		chip_ps_state = CHIP_WAKEDUP;
-	#endif
 	}
 	if (int_status & SLEEP_INT_EXT)
 		wilc_sleeptimer_isr_ext(wilc, int_status);
-- 
1.9.1


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

* [PATCH 03/26] staging: wilc1000: support suspend/resume functionality
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
  2016-01-12  7:39 ` [PATCH 01/26] staging: wilc1000: fix bug when changing virtual interface Glen Lee
  2016-01-12  7:39 ` [PATCH 02/26] staging: wilc1000: remove define WILC_OPTIMIZE_SLEEP_INT Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-12  7:39 ` [PATCH 04/26] staging: wilc1000: add sdio resume/suspend Glen Lee
                   ` (22 subsequent siblings)
  25 siblings, 0 replies; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

wilc supports suspend/resume functionality. Introduce new sleep and wakeup
functions and remove old codes since that will be handled in the new functions.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/wilc_wlan.c | 31 +++++++++++++++++++------------
 drivers/staging/wilc1000/wilc_wlan.h |  4 +++-
 2 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index dabb0bd..977bd8a0 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -522,6 +522,7 @@ static inline void chip_allow_sleep(struct wilc *wilc)
 	wilc->hif_func->hif_read_reg(wilc, 0xf0, &reg);
 
 	wilc->hif_func->hif_write_reg(wilc, 0xf0, reg & ~BIT(0));
+	wilc->hif_func->hif_write_reg(wilc, 0xfa, 0);
 }
 
 static inline void chip_wakeup(struct wilc *wilc)
@@ -543,6 +544,8 @@ static inline void chip_wakeup(struct wilc *wilc)
 
 		} while (wilc_get_chipid(wilc, true) == 0);
 	} else if ((wilc->io_type & 0x1) == HIF_SDIO)	 {
+		wilc->hif_func->hif_write_reg(wilc, 0xfa, 1);
+		udelay(200);
 		wilc->hif_func->hif_read_reg(wilc, 0xf0, &reg);
 		do {
 			wilc->hif_func->hif_write_reg(wilc, 0xf0,
@@ -567,11 +570,7 @@ static inline void chip_wakeup(struct wilc *wilc)
 	}
 
 	if (chip_ps_state == CHIP_SLEEPING_MANUAL) {
-		wilc->hif_func->hif_read_reg(wilc, 0x1C0C, &reg);
-		reg &= ~BIT(0);
-		wilc->hif_func->hif_write_reg(wilc, 0x1C0C, reg);
-
-		if (wilc_get_chipid(wilc, false) >= 0x1002b0) {
+		if (wilc_get_chipid(wilc, false) < 0x1002b0) {
 			u32 val32;
 
 			wilc->hif_func->hif_read_reg(wilc, 0x1e1c, &val32);
@@ -599,6 +598,20 @@ void wilc_chip_sleep_manually(struct wilc *wilc)
 	release_bus(wilc, RELEASE_ONLY);
 }
 
+void host_wakeup_notify(struct wilc *wilc)
+{
+	acquire_bus(wilc, ACQUIRE_ONLY);
+	wilc->hif_func->hif_write_reg(wilc, 0x10b0, 1);
+	release_bus(wilc, RELEASE_ONLY);
+}
+
+void host_sleep_notify(struct wilc *wilc)
+{
+	acquire_bus(wilc, ACQUIRE_ONLY);
+	wilc->hif_func->hif_write_reg(wilc, 0x10ac, 1);
+	release_bus(wilc, RELEASE_ONLY);
+}
+
 int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
 {
 	int i, entries = 0;
@@ -701,9 +714,6 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
 					break;
 				}
 				PRINT_WRN(GENERIC_DBG, "[wilc txq]: warn, vmm table not clear yet, wait...\n");
-				release_bus(wilc, RELEASE_ALLOW_SLEEP);
-				usleep_range(3000, 3000);
-				acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
 			}
 		} while (!wilc->quit);
 
@@ -736,9 +746,6 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
 					break;
 				} else {
 					release_bus(wilc, RELEASE_ALLOW_SLEEP);
-					usleep_range(3000, 3000);
-					acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
-					PRINT_WRN(GENERIC_DBG, "Can't get VMM entery - reg = %2x\n", reg);
 				}
 			} while (--timeout);
 			if (timeout <= 0) {
@@ -1156,7 +1163,7 @@ int wilc_wlan_start(struct wilc *wilc)
 #ifdef WILC_EXT_PA_INV_TX_RX
 	reg |= WILC_HAVE_EXT_PA_INV_TX_RX;
 #endif
-
+	reg |= WILC_HAVE_USE_IRQ_AS_HOST_WAKE;
 	reg |= WILC_HAVE_LEGACY_RF_SETTINGS;
 #ifdef XTAL_24
 	reg |= WILC_HAVE_XTAL_24;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 2edd744..dd5abc5 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -106,6 +106,7 @@
 #define WILC_HAVE_LEGACY_RF_SETTINGS	BIT(5)
 #define WILC_HAVE_XTAL_24		BIT(6)
 #define WILC_HAVE_DISABLE_WILC_UART	BIT(7)
+#define WILC_HAVE_USE_IRQ_AS_HOST_WAKE	BIT(8)
 
 /********************************************
  *
@@ -294,7 +295,8 @@ int wilc_mac_close(struct net_device *ndev);
 
 int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID);
 void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size);
-
+void host_wakeup_notify(struct wilc *wilc);
+void host_sleep_notify(struct wilc *wilc);
 extern bool wilc_enable_ps;
 
 #endif
-- 
1.9.1


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

* [PATCH 04/26] staging: wilc1000: add sdio resume/suspend
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (2 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 03/26] staging: wilc1000: support suspend/resume functionality Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-22  7:44   ` Dan Carpenter
  2016-01-12  7:39 ` [PATCH 05/26] staging: wilc1000: sdio_init: add resume argument Glen Lee
                   ` (21 subsequent siblings)
  25 siblings, 1 reply; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

This patch introduces sdio device suspend and resume functionality. sdio_reset
function is added to reset sdio. Remove static inline keyword from
chip_allow_sleep and chip_wakeup, and export symbols.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/wilc_sdio.c          | 72 +++++++++++++++++++++++++++
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 +
 drivers/staging/wilc1000/wilc_wlan.c          | 11 ++--
 drivers/staging/wilc1000/wilc_wlan.h          |  3 +-
 4 files changed, 82 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index caad876..ece2f58 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -42,6 +42,7 @@ static wilc_sdio_t g_sdio;
 
 static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data);
 static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data);
+static int sdio_init(struct wilc *wilc);
 
 static void wilc_sdio_interrupt(struct sdio_func *func)
 {
@@ -142,11 +143,82 @@ static void linux_sdio_remove(struct sdio_func *func)
 	wilc_netdev_cleanup(sdio_get_drvdata(func));
 }
 
+static int sdio_reset(struct wilc *wilc)
+{
+	sdio_cmd52_t cmd;
+	int ret;
+	struct sdio_func *func = dev_to_sdio_func(wilc->dev);
+
+	cmd.read_write = 1;
+	cmd.function = 0;
+	cmd.raw = 0;
+	cmd.address = 0x6;
+	cmd.data = 0x8;
+	ret = wilc_sdio_cmd52(wilc, &cmd);
+	if (ret) {
+		dev_err(&func->dev, "Fail cmd 52, reset cmd ...\n");
+		return ret;
+	}
+	return 0;
+}
+
+static int wilc_sdio_suspend(struct device *dev)
+{
+	struct sdio_func *func = dev_to_sdio_func(dev);
+	struct wilc *wilc = sdio_get_drvdata(func);
+	int ret;
+
+	dev_info(dev, "sdio suspend\n");
+	chip_wakeup(wilc);
+
+	if(!wilc->suspend_event) {
+		wilc_chip_sleep_manually(wilc);
+	} else {
+		host_sleep_notify(wilc);
+		chip_allow_sleep(wilc);
+	}
+
+	ret = sdio_reset(wilc);
+	if (ret) {
+		dev_err(&func->dev, "Fail reset sdio\n");
+		return ret;
+	}
+	sdio_claim_host(func);
+
+	return 0;
+}
+
+static int wilc_sdio_resume(struct device *dev)
+{
+	struct sdio_func *func = dev_to_sdio_func(dev);
+	struct wilc *wilc = sdio_get_drvdata(func);
+
+	dev_info(dev, "sdio resume\n");
+	sdio_release_host(func);
+	chip_wakeup(wilc);
+	sdio_init(wilc);
+
+	if(wilc->suspend_event)
+		host_wakeup_notify(wilc);
+
+	chip_allow_sleep(wilc);
+
+	return 0;
+}
+
+static const struct dev_pm_ops wilc_sdio_pm_ops = {
+	.suspend = wilc_sdio_suspend,
+	.resume = wilc_sdio_resume,
+};
+
 static struct sdio_driver wilc1000_sdio_driver = {
 	.name		= SDIO_MODALIAS,
 	.id_table	= wilc_sdio_ids,
 	.probe		= linux_sdio_probe,
 	.remove		= linux_sdio_remove,
+	.drv = {
+		.pm = &wilc_sdio_pm_ops,
+	}
 };
 module_driver(wilc1000_sdio_driver,
 	      sdio_register_driver,
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 98ac8ed..cd3d21d 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -215,6 +215,7 @@ struct wilc {
 	const struct firmware *firmware;
 
 	struct device *dev;
+	bool suspend_event;
 };
 
 struct WILC_WFI_mon_priv {
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 977bd8a0..8a39a05 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -3,8 +3,6 @@
 #include "wilc_wfi_netdevice.h"
 #include "wilc_wlan_cfg.h"
 
-static inline void chip_allow_sleep(struct wilc *wilc);
-static inline void chip_wakeup(struct wilc *wilc);
 static u32 dbgflag = N_INIT | N_ERR | N_INTR | N_TXQ | N_RXQ;
 
 /* FIXME: replace with dev_debug() */
@@ -515,7 +513,7 @@ static struct rxq_entry_t *wilc_wlan_rxq_remove(struct wilc *wilc)
 	return NULL;
 }
 
-static inline void chip_allow_sleep(struct wilc *wilc)
+void chip_allow_sleep(struct wilc *wilc)
 {
 	u32 reg = 0;
 
@@ -524,8 +522,9 @@ static inline void chip_allow_sleep(struct wilc *wilc)
 	wilc->hif_func->hif_write_reg(wilc, 0xf0, reg & ~BIT(0));
 	wilc->hif_func->hif_write_reg(wilc, 0xfa, 0);
 }
+EXPORT_SYMBOL_GPL(chip_allow_sleep);
 
-static inline void chip_wakeup(struct wilc *wilc)
+void chip_wakeup(struct wilc *wilc)
 {
 	u32 reg, clk_status_reg, trials = 0;
 
@@ -584,6 +583,7 @@ static inline void chip_wakeup(struct wilc *wilc)
 	}
 	chip_ps_state = CHIP_WAKEDUP;
 }
+EXPORT_SYMBOL_GPL(chip_wakeup);
 
 void wilc_chip_sleep_manually(struct wilc *wilc)
 {
@@ -597,6 +597,7 @@ void wilc_chip_sleep_manually(struct wilc *wilc)
 	chip_ps_state = CHIP_SLEEPING_MANUAL;
 	release_bus(wilc, RELEASE_ONLY);
 }
+EXPORT_SYMBOL_GPL(wilc_chip_sleep_manually);
 
 void host_wakeup_notify(struct wilc *wilc)
 {
@@ -604,6 +605,7 @@ void host_wakeup_notify(struct wilc *wilc)
 	wilc->hif_func->hif_write_reg(wilc, 0x10b0, 1);
 	release_bus(wilc, RELEASE_ONLY);
 }
+EXPORT_SYMBOL_GPL(host_wakeup_notify);
 
 void host_sleep_notify(struct wilc *wilc)
 {
@@ -611,6 +613,7 @@ void host_sleep_notify(struct wilc *wilc)
 	wilc->hif_func->hif_write_reg(wilc, 0x10ac, 1);
 	release_bus(wilc, RELEASE_ONLY);
 }
+EXPORT_SYMBOL_GPL(host_sleep_notify);
 
 int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
 {
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index dd5abc5..53e56ff 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -298,5 +298,6 @@ void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size);
 void host_wakeup_notify(struct wilc *wilc);
 void host_sleep_notify(struct wilc *wilc);
 extern bool wilc_enable_ps;
-
+void chip_allow_sleep(struct wilc *wilc);
+void chip_wakeup(struct wilc *wilc);
 #endif
-- 
1.9.1


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

* [PATCH 05/26] staging: wilc1000: sdio_init: add resume argument
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (3 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 04/26] staging: wilc1000: add sdio resume/suspend Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-12  7:39 ` [PATCH 06/26] staging: wilc1000: add ops resuem/suspend/wakeup in cfg80211 Glen Lee
                   ` (20 subsequent siblings)
  25 siblings, 0 replies; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

Part of sdio init codes should not run when sdio init function is called on
sdio resume so skip them.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/wilc_sdio.c | 34 +++++++++++++++++++---------------
 drivers/staging/wilc1000/wilc_spi.c  |  2 +-
 drivers/staging/wilc1000/wilc_wlan.c |  2 +-
 drivers/staging/wilc1000/wilc_wlan.h |  2 +-
 4 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index ece2f58..c8d003b 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -42,7 +42,7 @@ static wilc_sdio_t g_sdio;
 
 static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data);
 static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data);
-static int sdio_init(struct wilc *wilc);
+static int sdio_init(struct wilc *wilc, bool resume);
 
 static void wilc_sdio_interrupt(struct sdio_func *func)
 {
@@ -196,7 +196,7 @@ static int wilc_sdio_resume(struct device *dev)
 	dev_info(dev, "sdio resume\n");
 	sdio_release_host(func);
 	chip_wakeup(wilc);
-	sdio_init(wilc);
+	sdio_init(wilc, true);
 
 	if(wilc->suspend_event)
 		host_wakeup_notify(wilc);
@@ -667,16 +667,17 @@ static int sdio_deinit(struct wilc *wilc)
 	return 1;
 }
 
-static int sdio_init(struct wilc *wilc)
+static int sdio_init(struct wilc *wilc, bool resume)
 {
 	struct sdio_func *func = dev_to_sdio_func(wilc->dev);
 	sdio_cmd52_t cmd;
 	int loop, ret;
 	u32 chipid;
 
-	memset(&g_sdio, 0, sizeof(wilc_sdio_t));
-
-	g_sdio.irq_gpio = (wilc->dev_irq_num);
+	if (!resume) {
+		memset(&g_sdio, 0, sizeof(wilc_sdio_t));
+		g_sdio.irq_gpio = (wilc->dev_irq_num);
+	}
 
 	/**
 	 *      function 0 csa enable
@@ -766,16 +767,19 @@ static int sdio_init(struct wilc *wilc)
 	/**
 	 *      make sure can read back chip id correctly
 	 **/
-	if (!sdio_read_reg(wilc, 0x1000, &chipid)) {
-		dev_err(&func->dev, "Fail cmd read chip id...\n");
-		goto _fail_;
+	if (!resume) {
+		if (!sdio_read_reg(wilc, 0x1000, &chipid)) {
+			dev_err(&func->dev, "Fail cmd read chip id...\n");
+			goto _fail_;
+		}
+		dev_err(&func->dev, "chipid (%08x)\n", chipid);
+		if ((chipid & 0xfff) > 0x2a0)
+			g_sdio.has_thrpt_enh3 = 1;
+		else
+			g_sdio.has_thrpt_enh3 = 0;
+		dev_info(&func->dev, "has_thrpt_enh3 = %d...\n",
+			 g_sdio.has_thrpt_enh3);
 	}
-	dev_err(&func->dev, "chipid (%08x)\n", chipid);
-	if ((chipid & 0xfff) > 0x2a0)
-		g_sdio.has_thrpt_enh3 = 1;
-	else
-		g_sdio.has_thrpt_enh3 = 0;
-	dev_info(&func->dev, "has_thrpt_enh3 = %d...\n", g_sdio.has_thrpt_enh3);
 
 	return 1;
 
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 86de50c..356a446 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -852,7 +852,7 @@ static int _wilc_spi_deinit(struct wilc *wilc)
 	return 1;
 }
 
-static int wilc_spi_init(struct wilc *wilc)
+static int wilc_spi_init(struct wilc *wilc, bool resume)
 {
 	struct spi_device *spi = to_spi_device(wilc->dev);
 	u32 reg;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 8a39a05..aed1dd2 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1530,7 +1530,7 @@ int wilc_wlan_init(struct net_device *dev)
 
 	wilc->quit = 0;
 
-	if (!wilc->hif_func->hif_init(wilc)) {
+	if (!wilc->hif_func->hif_init(wilc, false)) {
 		ret = -EIO;
 		goto _fail_;
 	}
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 53e56ff..a1096ed 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -227,7 +227,7 @@ struct rxq_entry_t {
  ********************************************/
 struct wilc;
 struct wilc_hif_func {
-	int (*hif_init)(struct wilc *);
+	int (*hif_init)(struct wilc *, bool resume);
 	int (*hif_deinit)(struct wilc *);
 	int (*hif_read_reg)(struct wilc *, u32, u32 *);
 	int (*hif_write_reg)(struct wilc *, u32, u32);
-- 
1.9.1


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

* [PATCH 06/26] staging: wilc1000: add ops resuem/suspend/wakeup in cfg80211
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (4 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 05/26] staging: wilc1000: sdio_init: add resume argument Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-12  7:39 ` [PATCH 07/26] staging: wilc1000: remove sleep and reduce close timeout Glen Lee
                   ` (19 subsequent siblings)
  25 siblings, 0 replies; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

This patch adds ops resume, suspend and set_wakeup in cfg80211. Together with
previous patches, driver will support suspend/resume functionality.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 39 +++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 53fb2d4..b9c3564 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -74,6 +74,10 @@ static const struct ieee80211_txrx_stypes
 	}
 };
 
+static const struct wiphy_wowlan_support wowlan_support = {
+	.flags = WIPHY_WOWLAN_ANY
+};
+
 #define WILC_WFI_DWELL_PASSIVE 100
 #define WILC_WFI_DWELL_ACTIVE  40
 
@@ -2673,6 +2677,36 @@ static int del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
 	return 0;
 }
 
+static int wilc_suspend(struct wiphy *wiphy, struct cfg80211_wowlan *wow)
+{
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(priv->dev);
+
+	if(!wow && wilc_wlan_get_num_conn_ifcs(vif->wilc))
+		vif->wilc->suspend_event = true;
+	else
+		vif->wilc->suspend_event = false;
+
+	return 0;
+}
+
+static int wilc_resume(struct wiphy *wiphy)
+{
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(priv->dev);
+
+	netdev_info(vif->ndev, "cfg resume\n");
+	return 0;
+}
+
+static void wilc_set_wakeup(struct wiphy *wiphy, bool enabled)
+{
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(priv->dev);
+
+	netdev_info(vif->ndev, "cfg set wake up = %d\n", enabled);
+}
+
 static struct cfg80211_ops wilc_cfg80211_ops = {
 	.set_monitor_channel = set_channel,
 	.scan = scan,
@@ -2708,6 +2742,10 @@ static struct cfg80211_ops wilc_cfg80211_ops = {
 	.set_power_mgmt = set_power_mgmt,
 	.set_cqm_rssi_config = set_cqm_rssi_config,
 
+	.suspend = wilc_suspend,
+	.resume = wilc_resume,
+	.set_wakeup = wilc_set_wakeup,
+
 };
 
 int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed)
@@ -2792,6 +2830,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *de
 	sema_init(&(priv->SemHandleUpdateStats), 1);
 	priv->wdev = wdev;
 	wdev->wiphy->max_scan_ssids = MAX_NUM_PROBED_SSID;
+	wdev->wiphy->wowlan = &wowlan_support;
 	wdev->wiphy->max_num_pmkids = WILC_MAX_NUM_PMKIDS;
 	PRINT_INFO(CFG80211_DBG, "Max number of PMKIDs = %d\n", wdev->wiphy->max_num_pmkids);
 
-- 
1.9.1


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

* [PATCH 07/26] staging: wilc1000: remove sleep and reduce close timeout
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (5 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 06/26] staging: wilc1000: add ops resuem/suspend/wakeup in cfg80211 Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-12  7:39 ` [PATCH 08/26] staging: wilc1000: get address from wilc Glen Lee
                   ` (18 subsequent siblings)
  25 siblings, 0 replies; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

sleep is not necessary during handling tx queue so remove it and also reduce
close time to 5 sec since it is enough time to close.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 54fe9d7..236996f 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -391,9 +391,6 @@ static int linux_wlan_txq_task(void *vp)
 			}
 
 			if (ret == WILC_TX_ERR_NO_BUF) {
-				do {
-					msleep(TX_BACKOFF_WEIGHT_UNIT_MS << backoff_weight);
-				} while (0);
 				backoff_weight += TX_BACKOFF_WEIGHT_INCR_STEP;
 				if (backoff_weight > TX_BACKOFF_WEIGHT_MAX)
 					backoff_weight = TX_BACKOFF_WEIGHT_MAX;
@@ -1403,7 +1400,7 @@ void wilc_netdev_cleanup(struct wilc *wilc)
 		release_firmware(wilc->firmware);
 
 	if (wilc && (wilc->vif[0]->ndev || wilc->vif[1]->ndev)) {
-		wilc_lock_timeout(wilc, &close_exit_sync, 12 * 1000);
+		wilc_lock_timeout(wilc, &close_exit_sync, 5 * 1000);
 
 		for (i = 0; i < NUM_CONCURRENT_IFC; i++)
 			if (wilc->vif[i]->ndev)
-- 
1.9.1


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

* [PATCH 08/26] staging: wilc1000: get address from wilc
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (6 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 07/26] staging: wilc1000: remove sleep and reduce close timeout Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-12  7:39 ` [PATCH 09/26] staging: wilc1000: use unified firmware Glen Lee
                   ` (17 subsequent siblings)
  25 siblings, 0 replies; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

Get mac address from wilc device instead of using random mac address.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 236996f..58837d7 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -511,20 +511,19 @@ static int wilc1000_firmware_download(struct net_device *dev)
 }
 
 static int linux_wlan_init_test_config(struct net_device *dev,
-				       struct wilc *wilc)
+				       struct wilc_vif *vif)
 {
 	unsigned char c_val[64];
 	unsigned char mac_add[] = {0x00, 0x80, 0xC2, 0x5E, 0xa2, 0xff};
-
+	struct wilc *wilc = vif->wilc;
 	struct wilc_priv *priv;
 	struct host_if_drv *hif_drv;
 
 	PRINT_D(TX_DBG, "Start configuring Firmware\n");
-	get_random_bytes(&mac_add[5], 1);
-	get_random_bytes(&mac_add[4], 1);
 	priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
 	hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;
 	PRINT_D(INIT_DBG, "Host = %p\n", hif_drv);
+	wilc_get_mac_address(vif, mac_add);
 
 	PRINT_D(INIT_DBG, "MAC address is : %02x-%02x-%02x-%02x-%02x-%02x\n",
 		mac_add[0], mac_add[1], mac_add[2],
@@ -944,7 +943,7 @@ int wilc1000_wlan_init(struct net_device *dev, struct wilc_vif *vif)
 			Firmware_ver[size] = '\0';
 			PRINT_D(INIT_DBG, "***** Firmware Ver = %s  *******\n", Firmware_ver);
 		}
-		ret = linux_wlan_init_test_config(dev, wl);
+		ret = linux_wlan_init_test_config(dev, vif);
 
 		if (ret < 0) {
 			PRINT_ER("Failed to configure firmware\n");
-- 
1.9.1


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

* [PATCH 09/26] staging: wilc1000: use unified firmware
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (7 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 08/26] staging: wilc1000: get address from wilc Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-12 23:18   ` Julian Calaby
  2016-01-12  7:39 ` [PATCH 10/26] staging: wilc1000: remove wilc_set_machw_change_vir_if Glen Lee
                   ` (16 subsequent siblings)
  25 siblings, 1 reply; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

Use a unified firmware for all mode of operations which are station, ap and
p2p. Two firmware are introduced for 1002 and 1003 chipset.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/Makefile     |  5 ++---
 drivers/staging/wilc1000/linux_wlan.c | 18 +++++++++---------
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile
index 20a5cb9..90c3760 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -1,8 +1,7 @@
 obj-$(CONFIG_WILC1000) += wilc1000.o
 
-ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \
-		-DAP_FIRMWARE=\"atmel/wilc1000_ap_fw.bin\" \
-		-DP2P_CONCURRENCY_FIRMWARE=\"atmel/wilc1000_p2p_fw.bin\"
+ccflags-y += -DFIRMWARE_1002=\"atmel/wilc1002_firmware.bin\" \
+		-DFIRMWARE_1003=\"atmel/wilc1003_firmware.bin\"
 
 ccflags-y += -I$(src)/ -DWILC_ASIC_A0 -DWILC_DEBUGFS
 #ccflags-y += -DTCP_ACK_FILTER
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 58837d7..9dccfd8 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -416,21 +416,21 @@ int wilc_wlan_get_firmware(struct net_device *dev)
 {
 	struct wilc_vif *vif;
 	struct wilc *wilc;
-	int ret = 0;
+	int chip_id, ret = 0;
 	const struct firmware *wilc_firmware;
 	char *firmware;
 
 	vif = netdev_priv(dev);
 	wilc = vif->wilc;
 
-	if (vif->iftype == AP_MODE) {
-		firmware = AP_FIRMWARE;
-	} else if (vif->iftype == STATION_MODE) {
-		firmware = STA_FIRMWARE;
-	} else {
-		PRINT_D(INIT_DBG, "Get P2P_CONCURRENCY_FIRMWARE\n");
-		firmware = P2P_CONCURRENCY_FIRMWARE;
-	}
+	chip_id = wilc_get_chipid(wilc, 0);
+
+	if(chip_id < 0x1003a0)
+		firmware = FIRMWARE_1002;
+	else
+		firmware = FIRMWARE_1003;
+
+	netdev_info(dev, "loading firmware %s\n", firmware);
 
 	if (!vif) {
 		PRINT_ER("vif is NULL\n");
-- 
1.9.1


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

* [PATCH 10/26] staging: wilc1000: remove wilc_set_machw_change_vir_if
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (8 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 09/26] staging: wilc1000: use unified firmware Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-12  7:39 ` [PATCH 11/26] staging: wilc1000: set bssid with mode Glen Lee
                   ` (15 subsequent siblings)
  25 siblings, 0 replies; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

wilc_set_machw_change_vir_if is not used anymore since we use one unified
firmware. Instead, wilc_set_operation_mode is called when wilc_mac_open to
let the wilc use the proper firmware. Remove wilc_set_machw_change_vir_if
and it's functions calls.
In the later patch, mac index will be passed to wilc device.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c             |  3 +--
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  6 -----
 drivers/staging/wilc1000/wilc_wfi_netdevice.h     |  1 -
 drivers/staging/wilc1000/wilc_wlan.c              | 32 -----------------------
 4 files changed, 1 insertion(+), 41 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 9dccfd8..ff7a717 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1024,14 +1024,13 @@ int wilc_mac_open(struct net_device *ndev)
 		return ret;
 	}
 
-	wilc_set_machw_change_vir_if(ndev, false);
-
 	wilc_get_mac_address(vif, mac_add);
 	PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add);
 
 	for (i = 0; i < wl->vif_num; i++) {
 		if (ndev == wl->vif[i]->ndev) {
 			memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN);
+			wilc_set_operation_mode(vif, vif->iftype);
 			break;
 		}
 	}
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index b9c3564..0ba0b06 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1274,7 +1274,6 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev,
 		kfree(g_key_gtk_params.seq);
 		g_key_gtk_params.seq = NULL;
 
-		wilc_set_machw_change_vir_if(netdev, false);
 	}
 
 	if (key_index >= 0 && key_index <= 3) {
@@ -2116,10 +2115,6 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
 	del_timer(&wilc_during_ip_timer);
 	PRINT_D(GENERIC_DBG, "Changing virtual interface, enable scan\n");
 
-	if (g_ptk_keys_saved && g_gtk_keys_saved) {
-		wilc_set_machw_change_vir_if(dev, true);
-	}
-
 	switch (type) {
 	case NL80211_IFTYPE_STATION:
 		wilc_connecting = 0;
@@ -2261,7 +2256,6 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
 			}
 
 			refresh_scan(priv, 1, true);
-			wilc_set_machw_change_vir_if(dev, false);
 
 			if (wl->initialized)	{
 				for (i = 0; i < num_reg_frame; i++) {
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index cd3d21d..0d851f8 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -235,7 +235,6 @@ int wilc_netdev_init(struct wilc **wilc, struct device *, int io_type, int gpio,
 		     const struct wilc_hif_func *ops);
 void wilc1000_wlan_deinit(struct net_device *dev);
 void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size);
-u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value);
 int wilc_wlan_get_firmware(struct net_device *dev);
 int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid);
 
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index aed1dd2..cc487d8 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1578,35 +1578,3 @@ _fail_:
 
 	return ret;
 }
-
-u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value)
-{
-	u16 ret;
-	u32 reg;
-	struct wilc_vif *vif;
-	struct wilc *wilc;
-
-	vif = netdev_priv(dev);
-	wilc = vif->wilc;
-
-	mutex_lock(&wilc->hif_cs);
-	ret = wilc->hif_func->hif_read_reg(wilc, WILC_CHANGING_VIR_IF,
-					       &reg);
-	if (!ret)
-		PRINT_ER("Error while Reading reg WILC_CHANGING_VIR_IF\n");
-
-	if (value)
-		reg |= BIT(31);
-	else
-		reg &= ~BIT(31);
-
-	ret = wilc->hif_func->hif_write_reg(wilc, WILC_CHANGING_VIR_IF,
-						reg);
-
-	if (!ret)
-		PRINT_ER("Error while writing reg WILC_CHANGING_VIR_IF\n");
-
-	mutex_unlock(&wilc->hif_cs);
-
-	return ret;
-}
-- 
1.9.1


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

* [PATCH 11/26] staging: wilc1000: set bssid with mode
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (9 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 10/26] staging: wilc1000: remove wilc_set_machw_change_vir_if Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-12  7:39 ` [PATCH 12/26] staging: wilc1000: set proper bssid address Glen Lee
                   ` (14 subsequent siblings)
  25 siblings, 0 replies; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

This patch add new argument mode to wilc_wlan_set_bssid and define mode in
struct wilc_vif also. The mode is used by get_if_handler function to get proper
netdevice for each mode.
The get_if_handler is changed together. Remove invalid handle codes and
add mode condition to get netdevice for the mode.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c             | 26 +++++++++--------------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 13 ++++++------
 drivers/staging/wilc1000/wilc_wfi_netdevice.h     |  3 ++-
 drivers/staging/wilc1000/wilc_wlan.h              |  1 -
 4 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index ff7a717..68a50e6 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -288,26 +288,19 @@ 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++)
-		if (!memcmp(bssid1, wilc->vif[i]->bssid, ETH_ALEN) ||
-		    !memcmp(bssid, wilc->vif[i]->bssid, ETH_ALEN))
-			return wilc->vif[i]->ndev;
-
-	PRINT_INFO(INIT_DBG, "Invalide handle\n");
-	for (i = 0; i < 25; i++)
-		PRINT_D(INIT_DBG, "%02x ", mac_header[i]);
-	bssid = mac_header + 18;
-	bssid1 = mac_header + 12;
-	for (i = 0; i < wilc->vif_num; i++)
-		if (!memcmp(bssid1, wilc->vif[i]->bssid, ETH_ALEN) ||
-		    !memcmp(bssid, wilc->vif[i]->bssid, ETH_ALEN))
-			return wilc->vif[i]->ndev;
+	for (i = 0; i < wilc->vif_num; i++) {
+		if (wilc->vif[i]->mode == STATION_MODE)
+			if (!memcmp(bssid, wilc->vif[i]->bssid, ETH_ALEN))
+				return wilc->vif[i]->ndev;
+		if (wilc->vif[i]->mode == AP_MODE)
+			if (!memcmp(bssid1, wilc->vif[i]->bssid, ETH_ALEN))
+				return wilc->vif[i]->ndev;
+	}
 
-	PRINT_INFO(INIT_DBG, "\n");
 	return NULL;
 }
 
-int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid)
+int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode)
 {
 	int i = 0;
 	int ret = -1;
@@ -320,6 +313,7 @@ int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid)
 	for (i = 0; i < wilc->vif_num; i++)
 		if (wilc->vif[i]->ndev == wilc_netdev) {
 			memcpy(wilc->vif[i]->bssid, bssid, 6);
+			wilc->vif[i]->mode = mode;
 			ret = 0;
 			break;
 		}
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 0ba0b06..a55d337 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -524,7 +524,8 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent,
 		if ((u8MacStatus == MAC_DISCONNECTED) &&
 		    (pstrConnectInfo->u16ConnectStatus == SUCCESSFUL_STATUSCODE)) {
 			u16ConnectStatus = WLAN_STATUS_UNSPECIFIED_FAILURE;
-			wilc_wlan_set_bssid(priv->dev, NullBssid);
+			wilc_wlan_set_bssid(priv->dev, NullBssid,
+					    STATION_MODE);
 			eth_zero_addr(wilc_connected_ssid);
 
 			if (!pstrWFIDrv->p2p_connect)
@@ -577,7 +578,7 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent,
 		p2p_recv_random = 0x00;
 		wilc_ie = false;
 		eth_zero_addr(priv->au8AssociatedBss);
-		wilc_wlan_set_bssid(priv->dev, NullBssid);
+		wilc_wlan_set_bssid(priv->dev, NullBssid, STATION_MODE);
 		eth_zero_addr(wilc_connected_ssid);
 
 		if (!pstrWFIDrv->p2p_connect)
@@ -903,7 +904,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
 	if (!pstrWFIDrv->p2p_connect)
 		wlan_channel = pstrNetworkInfo->u8channel;
 
-	wilc_wlan_set_bssid(dev, pstrNetworkInfo->au8bssid);
+	wilc_wlan_set_bssid(dev, pstrNetworkInfo->au8bssid, STATION_MODE);
 
 	s32Error = wilc_set_join_req(vif, pstrNetworkInfo->au8bssid, sme->ssid,
 				     sme->ssid_len, sme->ie, sme->ie_len,
@@ -937,7 +938,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co
 	pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
 	if (!pstrWFIDrv->p2p_connect)
 		wlan_channel = INVALID_CHANNEL;
-	wilc_wlan_set_bssid(priv->dev, NullBssid);
+	wilc_wlan_set_bssid(priv->dev, NullBssid, STATION_MODE);
 
 	PRINT_D(CFG80211_DBG, "Disconnecting with reason code(%d)\n", reason_code);
 
@@ -2400,7 +2401,7 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev,
 	if (s32Error != 0)
 		PRINT_ER("Error in setting channel\n");
 
-	wilc_wlan_set_bssid(dev, wl->vif[0]->src_addr);
+	wilc_wlan_set_bssid(dev, wl->vif[0]->src_addr, AP_MODE);
 
 	s32Error = wilc_add_beacon(vif, settings->beacon_interval,
 				   settings->dtim_period, beacon->head_len,
@@ -2444,7 +2445,7 @@ static int stop_ap(struct wiphy *wiphy, struct net_device *dev)
 
 	PRINT_D(HOSTAPD_DBG, "Deleting beacon\n");
 
-	wilc_wlan_set_bssid(dev, NullBssid);
+	wilc_wlan_set_bssid(dev, NullBssid, AP_MODE);
 
 	s32Error = wilc_del_beacon(vif);
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 0d851f8..54e762ec 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -160,6 +160,7 @@ struct wilc_vif {
 	u8 bssid[ETH_ALEN];
 	struct host_if_drv *hif_drv;
 	struct net_device *ndev;
+	u8 mode;
 };
 
 struct wilc {
@@ -236,6 +237,6 @@ int wilc_netdev_init(struct wilc **wilc, struct device *, int io_type, int gpio,
 void wilc1000_wlan_deinit(struct net_device *dev);
 void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size);
 int wilc_wlan_get_firmware(struct net_device *dev);
-int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid);
+int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode);
 
 #endif
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index a1096ed..7f04653 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -293,7 +293,6 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device *dev);
 int wilc_mac_open(struct net_device *ndev);
 int wilc_mac_close(struct net_device *ndev);
 
-int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID);
 void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size);
 void host_wakeup_notify(struct wilc *wilc);
 void host_sleep_notify(struct wilc *wilc);
-- 
1.9.1


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

* [PATCH 12/26] staging: wilc1000: set proper bssid address
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (10 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 11/26] staging: wilc1000: set bssid with mode Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-12  7:39 ` [PATCH 13/26] staging: wilc1000: change_virtual_intf: change codes for unified firmware Glen Lee
                   ` (13 subsequent siblings)
  25 siblings, 0 replies; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

This patch changes index 0 to index of vif which is currently beging used
because AP mode can run on any interface.

Signed-off-by: Glen Lee <glen.lee@atmel.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 a55d337..3379111 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2401,7 +2401,7 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev,
 	if (s32Error != 0)
 		PRINT_ER("Error in setting channel\n");
 
-	wilc_wlan_set_bssid(dev, wl->vif[0]->src_addr, AP_MODE);
+	wilc_wlan_set_bssid(dev, wl->vif[vif->u8IfIdx]->src_addr, AP_MODE);
 
 	s32Error = wilc_add_beacon(vif, settings->beacon_interval,
 				   settings->dtim_period, beacon->head_len,
-- 
1.9.1


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

* [PATCH 13/26] staging: wilc1000: change_virtual_intf: change codes for unified firmware
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (11 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 12/26] staging: wilc1000: set proper bssid address Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-12  7:39 ` [PATCH 14/26] staging: wilc1000: call power save after changing mode Glen Lee
                   ` (12 subsequent siblings)
  25 siblings, 0 replies; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

In previous patch, we use unified firmware on wilc, which means we do not need
to download firmware again to change virtual interfaces.
There are a lot of codes to change interface and they are needless now, so
remove them except wilc_set_operation_mode function which change the mode and
wilc_set_power_mgmt which control power save.
There will be unused functions and they will be removed in later patch.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 220 ++--------------------
 1 file changed, 11 insertions(+), 209 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 3379111..ba4c770 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2098,9 +2098,6 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
 {
 	struct wilc_priv *priv;
 	struct wilc_vif *vif;
-	u8 interface_type;
-	u16 TID = 0;
-	u8 i;
 	struct wilc *wl;
 
 	vif = netdev_priv(dev);
@@ -2125,74 +2122,12 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
 		priv->wdev->iftype = type;
 		vif->monitor_flag = 0;
 		vif->iftype = STATION_MODE;
+		wilc_set_operation_mode(vif, STATION_MODE);
 
 		memset(priv->assoc_stainfo.au8Sta_AssociatedBss, 0, MAX_NUM_STA * ETH_ALEN);
-		interface_type = vif->iftype;
-		vif->iftype = STATION_MODE;
-
-		if (wl->initialized) {
-			wilc_del_all_rx_ba_session(vif, wl->vif[0]->bssid,
-						   TID);
-			wilc_wait_msg_queue_idle();
-
-			up(&wl->cfg_event);
-
-			wilc1000_wlan_deinit(dev);
-			wilc1000_wlan_init(dev, vif);
-			wilc_initialized = 1;
-			vif->iftype = interface_type;
-
-			wilc_set_wfi_drv_handler(vif,
-						 wilc_get_vif_idx(wl->vif[0]));
-			wilc_set_mac_address(wl->vif[0], wl->vif[0]->src_addr);
-			wilc_set_operation_mode(vif, STATION_MODE);
-
-			if (g_wep_keys_saved) {
-				wilc_set_wep_default_keyid(wl->vif[0],
-						g_key_wep_params.key_idx);
-				wilc_add_wep_key_bss_sta(wl->vif[0],
-						g_key_wep_params.key,
-						g_key_wep_params.key_len,
-						g_key_wep_params.key_idx);
-			}
-
-			wilc_flush_join_req(vif);
-
-			if (g_ptk_keys_saved && g_gtk_keys_saved) {
-				PRINT_D(CFG80211_DBG, "ptk %x %x %x\n", g_key_ptk_params.key[0],
-					g_key_ptk_params.key[1],
-					g_key_ptk_params.key[2]);
-				PRINT_D(CFG80211_DBG, "gtk %x %x %x\n", g_key_gtk_params.key[0],
-					g_key_gtk_params.key[1],
-					g_key_gtk_params.key[2]);
-				add_key(wl->vif[0]->ndev->ieee80211_ptr->wiphy,
-					wl->vif[0]->ndev,
-					g_add_ptk_key_params.key_idx,
-					g_add_ptk_key_params.pairwise,
-					g_add_ptk_key_params.mac_addr,
-					(struct key_params *)(&g_key_ptk_params));
-
-				add_key(wl->vif[0]->ndev->ieee80211_ptr->wiphy,
-					wl->vif[0]->ndev,
-					g_add_gtk_key_params.key_idx,
-					g_add_gtk_key_params.pairwise,
-					g_add_gtk_key_params.mac_addr,
-					(struct key_params *)(&g_key_gtk_params));
-			}
-
-			if (wl->initialized)	{
-				for (i = 0; i < num_reg_frame; i++) {
-					PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type,
-						vif->g_struct_frame_reg[i].reg);
-					wilc_frame_register(vif,
-								vif->g_struct_frame_reg[i].frame_type,
-								vif->g_struct_frame_reg[i].reg);
-				}
-			}
 
-			wilc_enable_ps = true;
-			wilc_set_power_mgmt(vif, 1, 0);
-		}
+		wilc_enable_ps = true;
+		wilc_set_power_mgmt(vif, 1, 0);
 		break;
 
 	case NL80211_IFTYPE_P2P_CLIENT:
@@ -2201,73 +2136,11 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
 		wilc_connecting = 0;
 		PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_P2P_CLIENT\n");
 
-		wilc_del_all_rx_ba_session(vif, wl->vif[0]->bssid, TID);
-
 		dev->ieee80211_ptr->iftype = type;
 		priv->wdev->iftype = type;
 		vif->monitor_flag = 0;
-
-		PRINT_D(HOSTAPD_DBG, "Downloading P2P_CONCURRENCY_FIRMWARE\n");
 		vif->iftype = CLIENT_MODE;
-
-
-		if (wl->initialized)	{
-			wilc_wait_msg_queue_idle();
-
-			wilc1000_wlan_deinit(dev);
-			wilc1000_wlan_init(dev, vif);
-			wilc_initialized = 1;
-
-			wilc_set_wfi_drv_handler(vif,
-						 wilc_get_vif_idx(wl->vif[0]));
-			wilc_set_mac_address(wl->vif[0], wl->vif[0]->src_addr);
-			wilc_set_operation_mode(vif, STATION_MODE);
-
-			if (g_wep_keys_saved) {
-				wilc_set_wep_default_keyid(wl->vif[0],
-						g_key_wep_params.key_idx);
-				wilc_add_wep_key_bss_sta(wl->vif[0],
-						g_key_wep_params.key,
-						g_key_wep_params.key_len,
-						g_key_wep_params.key_idx);
-			}
-
-			wilc_flush_join_req(vif);
-
-			if (g_ptk_keys_saved && g_gtk_keys_saved) {
-				PRINT_D(CFG80211_DBG, "ptk %x %x %x\n", g_key_ptk_params.key[0],
-					g_key_ptk_params.key[1],
-					g_key_ptk_params.key[2]);
-				PRINT_D(CFG80211_DBG, "gtk %x %x %x\n", g_key_gtk_params.key[0],
-					g_key_gtk_params.key[1],
-					g_key_gtk_params.key[2]);
-				add_key(wl->vif[0]->ndev->ieee80211_ptr->wiphy,
-					wl->vif[0]->ndev,
-					g_add_ptk_key_params.key_idx,
-					g_add_ptk_key_params.pairwise,
-					g_add_ptk_key_params.mac_addr,
-					(struct key_params *)(&g_key_ptk_params));
-
-				add_key(wl->vif[0]->ndev->ieee80211_ptr->wiphy,
-					wl->vif[0]->ndev,
-					g_add_gtk_key_params.key_idx,
-					g_add_gtk_key_params.pairwise,
-					g_add_gtk_key_params.mac_addr,
-					(struct key_params *)(&g_key_gtk_params));
-			}
-
-			refresh_scan(priv, 1, true);
-
-			if (wl->initialized)	{
-				for (i = 0; i < num_reg_frame; i++) {
-					PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type,
-						vif->g_struct_frame_reg[i].reg);
-					wilc_frame_register(vif,
-								vif->g_struct_frame_reg[i].frame_type,
-								vif->g_struct_frame_reg[i].reg);
-				}
-			}
-		}
+		wilc_set_operation_mode(vif, STATION_MODE);
 		break;
 
 	case NL80211_IFTYPE_AP:
@@ -2276,23 +2149,11 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
 		dev->ieee80211_ptr->iftype = type;
 		priv->wdev->iftype = type;
 		vif->iftype = AP_MODE;
-		PRINT_D(CORECONFIG_DBG, "priv->hWILCWFIDrv[%p]\n", priv->hWILCWFIDrv);
-
-		PRINT_D(HOSTAPD_DBG, "Downloading AP firmware\n");
-		wilc_wlan_get_firmware(dev);
-
-		if (wl->initialized)	{
-			vif->iftype = AP_MODE;
-			wilc_mac_close(dev);
-			wilc_mac_open(dev);
-
-			for (i = 0; i < num_reg_frame; i++) {
-				PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type,
-					vif->g_struct_frame_reg[i].reg);
-				wilc_frame_register(vif,
-							vif->g_struct_frame_reg[i].frame_type,
-							vif->g_struct_frame_reg[i].reg);
-			}
+
+		if (wl->initialized) {
+			wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif));
+			wilc_set_operation_mode(vif, AP_MODE);
+			wilc_set_power_mgmt(vif, 0, 0);
 		}
 		break;
 
@@ -2303,72 +2164,13 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
 		mod_timer(&wilc_during_ip_timer,
 			  jiffies + msecs_to_jiffies(during_ip_time));
 		wilc_set_power_mgmt(vif, 0, 0);
-		wilc_del_all_rx_ba_session(vif, wl->vif[0]->bssid, TID);
 		wilc_enable_ps = false;
 		PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_GO\n");
+
+		wilc_set_operation_mode(vif, AP_MODE);
 		dev->ieee80211_ptr->iftype = type;
 		priv->wdev->iftype = type;
-
-		PRINT_D(CORECONFIG_DBG, "priv->hWILCWFIDrv[%p]\n", priv->hWILCWFIDrv);
-
-		PRINT_D(HOSTAPD_DBG, "Downloading P2P_CONCURRENCY_FIRMWARE\n");
-
-
 		vif->iftype = GO_MODE;
-
-		wilc_wait_msg_queue_idle();
-		wilc1000_wlan_deinit(dev);
-		wilc1000_wlan_init(dev, vif);
-		wilc_initialized = 1;
-
-		wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(wl->vif[0]));
-		wilc_set_mac_address(wl->vif[0], wl->vif[0]->src_addr);
-		wilc_set_operation_mode(vif, AP_MODE);
-
-		if (g_wep_keys_saved) {
-			wilc_set_wep_default_keyid(wl->vif[0],
-						   g_key_wep_params.key_idx);
-			wilc_add_wep_key_bss_sta(wl->vif[0],
-						 g_key_wep_params.key,
-						 g_key_wep_params.key_len,
-						 g_key_wep_params.key_idx);
-		}
-
-		wilc_flush_join_req(vif);
-
-		if (g_ptk_keys_saved && g_gtk_keys_saved) {
-			PRINT_D(CFG80211_DBG, "ptk %x %x %x cipher %x\n", g_key_ptk_params.key[0],
-				g_key_ptk_params.key[1],
-				g_key_ptk_params.key[2],
-				g_key_ptk_params.cipher);
-			PRINT_D(CFG80211_DBG, "gtk %x %x %x cipher %x\n", g_key_gtk_params.key[0],
-				g_key_gtk_params.key[1],
-				g_key_gtk_params.key[2],
-				g_key_gtk_params.cipher);
-			add_key(wl->vif[0]->ndev->ieee80211_ptr->wiphy,
-				wl->vif[0]->ndev,
-				g_add_ptk_key_params.key_idx,
-				g_add_ptk_key_params.pairwise,
-				g_add_ptk_key_params.mac_addr,
-				(struct key_params *)(&g_key_ptk_params));
-
-			add_key(wl->vif[0]->ndev->ieee80211_ptr->wiphy,
-				wl->vif[0]->ndev,
-				g_add_gtk_key_params.key_idx,
-				g_add_gtk_key_params.pairwise,
-				g_add_gtk_key_params.mac_addr,
-				(struct key_params *)(&g_key_gtk_params));
-		}
-
-		if (wl->initialized)	{
-			for (i = 0; i < num_reg_frame; i++) {
-				PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type,
-					vif->g_struct_frame_reg[i].reg);
-				wilc_frame_register(vif,
-							vif->g_struct_frame_reg[i].frame_type,
-							vif->g_struct_frame_reg[i].reg);
-			}
-		}
 		break;
 
 	default:
-- 
1.9.1


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

* [PATCH 14/26] staging: wilc1000: call power save after changing mode
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (12 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 13/26] staging: wilc1000: change_virtual_intf: change codes for unified firmware Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-12  7:39 ` [PATCH 15/26] staging: wilc1000: wilc_set_wfi_drv_handler: add mac index Glen Lee
                   ` (11 subsequent siblings)
  25 siblings, 0 replies; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

host_int_set_power_mgmt should be called after changing operation mode to
work properly. Move the function below host_int_set_operation_mode.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index ba4c770..c399326 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2131,8 +2131,6 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
 		break;
 
 	case NL80211_IFTYPE_P2P_CLIENT:
-		wilc_enable_ps = false;
-		wilc_set_power_mgmt(vif, 0, 0);
 		wilc_connecting = 0;
 		PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_P2P_CLIENT\n");
 
@@ -2141,6 +2139,9 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
 		vif->monitor_flag = 0;
 		vif->iftype = CLIENT_MODE;
 		wilc_set_operation_mode(vif, STATION_MODE);
+
+		wilc_enable_ps = false;
+		wilc_set_power_mgmt(vif, 0, 0);
 		break;
 
 	case NL80211_IFTYPE_AP:
@@ -2163,14 +2164,15 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
 		wilc_optaining_ip = true;
 		mod_timer(&wilc_during_ip_timer,
 			  jiffies + msecs_to_jiffies(during_ip_time));
-		wilc_set_power_mgmt(vif, 0, 0);
-		wilc_enable_ps = false;
 		PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_GO\n");
 
 		wilc_set_operation_mode(vif, AP_MODE);
 		dev->ieee80211_ptr->iftype = type;
 		priv->wdev->iftype = type;
 		vif->iftype = GO_MODE;
+
+		wilc_enable_ps = false;
+		wilc_set_power_mgmt(vif, 0, 0);
 		break;
 
 	default:
-- 
1.9.1


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

* [PATCH 15/26] staging: wilc1000: wilc_set_wfi_drv_handler: add mac index
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (13 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 14/26] staging: wilc1000: call power save after changing mode Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-12  7:39 ` [PATCH 16/26] staging: wilc1000: remove unused functions Glen Lee
                   ` (10 subsequent siblings)
  25 siblings, 0 replies; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

Firmware supports sta/ap concurrency so mac index will be passed to wilc.
Remove wilc_set_wfi_drv_handler in scan and connect functions, and call
the function in ndo_open which is wilc_mac_open.
WID_SET_DRV_HANDLER value has been changed as well.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c         | 11 ++++++-----
 drivers/staging/wilc1000/host_interface.h         |  3 ++-
 drivers/staging/wilc1000/linux_wlan.c             | 19 +++++++++++++++++++
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  6 ++----
 drivers/staging/wilc1000/wilc_wlan_if.h           |  2 +-
 5 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 8c77520..9ffed32 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -319,9 +319,9 @@ static s32 handle_set_wfi_drv_handler(struct wilc_vif *vif,
 	struct wid wid;
 
 	wid.id = (u16)WID_SET_DRV_HANDLER;
-	wid.type = WID_INT;
-	wid.val = (s8 *)&hif_drv_handler->handler;
-	wid.size = sizeof(u32);
+	wid.type = WID_STR;
+	wid.val = (s8 *)hif_drv_handler;
+	wid.size = sizeof(*hif_drv_handler);
 
 	result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
 				      hif_drv_handler->handler);
@@ -3558,7 +3558,7 @@ int wilc_wait_msg_queue_idle(void)
 	return result;
 }
 
-int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index)
+int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mac_idx)
 {
 	int result = 0;
 	struct host_if_msg msg;
@@ -3566,6 +3566,7 @@ int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index)
 	memset(&msg, 0, sizeof(struct host_if_msg));
 	msg.id = HOST_IF_MSG_SET_WFIDRV_HANDLER;
 	msg.body.drv.handler = index;
+	msg.body.drv.mac_idx = mac_idx;
 	msg.vif = vif;
 
 	result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -3906,7 +3907,7 @@ s32 wilc_deinit(struct wilc_vif *vif)
 
 	del_timer_sync(&hif_drv->remain_on_ch_timer);
 
-	wilc_set_wfi_drv_handler(vif, 0);
+	wilc_set_wfi_drv_handler(vif, 0, 0);
 	down(&hif_sema_driver);
 
 	if (hif_drv->usr_scan_req.scan_result) {
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 8faac27..5794246 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -217,6 +217,7 @@ struct user_conn_req {
 
 struct drv_handler {
 	u32 handler;
+	u8 mac_idx;
 };
 
 struct op_mode {
@@ -366,7 +367,7 @@ s32 wilc_remain_on_channel(struct wilc_vif *vif, u32 u32SessionID,
 			   void *pvUserArg);
 s32 wilc_listen_state_expired(struct wilc_vif *vif, u32 u32SessionID);
 s32 wilc_frame_register(struct wilc_vif *vif, u16 u16FrameType, bool bReg);
-int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index);
+int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mac_idx);
 int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode);
 
 void wilc_free_join_params(void *pJoinParams);
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 68a50e6..9dd59da 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1024,6 +1024,25 @@ int wilc_mac_open(struct net_device *ndev)
 	for (i = 0; i < wl->vif_num; i++) {
 		if (ndev == wl->vif[i]->ndev) {
 			memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN);
+			if (vif->iftype == AP_MODE) {
+				wilc_set_wfi_drv_handler(vif,
+							 wilc_get_vif_idx(vif),
+							 0);
+			} else if (!wilc_wlan_get_num_conn_ifcs(wilc)) {
+				wilc_set_wfi_drv_handler(vif,
+							 wilc_get_vif_idx(vif),
+							 wilc->open_ifcs);
+			} else {
+				if (memcmp(wilc->vif[i^1]->bssid,
+					   wilc->vif[i^1]->src_addr, 6))
+					wilc_set_wfi_drv_handler(vif,
+							 wilc_get_vif_idx(vif),
+							 0);
+				else
+					wilc_set_wfi_drv_handler(vif,
+							 wilc_get_vif_idx(vif),
+							 1);
+			}
 			wilc_set_operation_mode(vif, vif->iftype);
 			break;
 		}
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index c399326..fe99a13 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -633,7 +633,6 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
 
 	priv->u32RcvdChCount = 0;
 
-	wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif));
 	reset_shadow_found();
 
 	priv->bCfgScanning = true;
@@ -714,8 +713,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
 	vif = netdev_priv(priv->dev);
 	pstrWFIDrv = (struct host_if_drv *)(priv->hWILCWFIDrv);
 
-	wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif));
-
 	PRINT_D(CFG80211_DBG, "Connecting to SSID [%s] on netdev [%p] host if [%p]\n", sme->ssid, dev, priv->hWILCWFIDrv);
 	if (!(strncmp(sme->ssid, "DIRECT-", 7))) {
 		PRINT_D(CFG80211_DBG, "Connected to Direct network,OBSS disabled\n");
@@ -2152,7 +2149,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
 		vif->iftype = AP_MODE;
 
 		if (wl->initialized) {
-			wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif));
+			wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif),
+						 0);
 			wilc_set_operation_mode(vif, AP_MODE);
 			wilc_set_power_mgmt(vif, 0, 0);
 		}
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index 618903c..d306ec1a 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -832,7 +832,6 @@ typedef enum {
 
 	/* Custom Integer WID list */
 	WID_GET_INACTIVE_TIME		= 0x2084,
-	WID_SET_DRV_HANDLER		= 0X2085,
 	WID_SET_OPERATION_MODE		= 0X2086,
 	/* EMAC String WID list */
 	WID_SSID			= 0x3000,
@@ -865,6 +864,7 @@ typedef enum {
 	WID_MODEL_NAME			= 0x3027, /*Added for CAPI tool */
 	WID_MODEL_NUM			= 0x3028, /*Added for CAPI tool */
 	WID_DEVICE_NAME			= 0x3029, /*Added for CAPI tool */
+	WID_SET_DRV_HANDLER		= 0x3030,
 
 	/* NMAC String WID list */
 	WID_11N_P_ACTION_REQ		= 0x3080,
-- 
1.9.1


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

* [PATCH 16/26] staging: wilc1000: remove unused functions
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (14 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 15/26] staging: wilc1000: wilc_set_wfi_drv_handler: add mac index Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-12  7:39 ` [PATCH 17/26] staging: wilc1000: ignore power save Glen Lee
                   ` (9 subsequent siblings)
  25 siblings, 0 replies; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

This patch removes unused following functions.
wilc_del_all_rx_ba_session
wilc_flush_join_req
wilc_wait_msg_queue_idle
wilc_set_mac_address

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 92 -------------------------------
 drivers/staging/wilc1000/host_interface.h |  4 --
 2 files changed, 96 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 9ffed32..bc8357d 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3346,25 +3346,6 @@ s32 wilc_get_mac_address(struct wilc_vif *vif, u8 *pu8MacAddress)
 	return result;
 }
 
-s32 wilc_set_mac_address(struct wilc_vif *vif, u8 *pu8MacAddress)
-{
-	s32 result = 0;
-	struct host_if_msg msg;
-
-	PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", pu8MacAddress[0], pu8MacAddress[1], pu8MacAddress[2]);
-
-	memset(&msg, 0, sizeof(struct host_if_msg));
-	msg.id = HOST_IF_MSG_SET_MAC_ADDRESS;
-	memcpy(msg.body.set_mac_info.mac_addr, pu8MacAddress, ETH_ALEN);
-	msg.vif = vif;
-
-	result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
-	if (result)
-		PRINT_ER("Failed to send message queue: Set mac address\n");
-
-	return result;
-}
-
 s32 wilc_set_join_req(struct wilc_vif *vif, u8 *pu8bssid, const u8 *pu8ssid,
 		      size_t ssidLen, const u8 *pu8IEs, size_t IEsLen,
 		      wilc_connect_result pfConnectResult, void *pvUserArg,
@@ -3432,32 +3413,6 @@ s32 wilc_set_join_req(struct wilc_vif *vif, u8 *pu8bssid, const u8 *pu8ssid,
 	return result;
 }
 
-s32 wilc_flush_join_req(struct wilc_vif *vif)
-{
-	s32 result = 0;
-	struct host_if_msg msg;
-	struct host_if_drv *hif_drv = vif->hif_drv;
-
-	if (!join_req)
-		return -EFAULT;
-
-	if (!hif_drv) {
-		PRINT_ER("Driver is null\n");
-		return -EFAULT;
-	}
-
-	msg.id = HOST_IF_MSG_FLUSH_CONNECT;
-	msg.vif = vif;
-
-	result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
-	if (result) {
-		PRINT_ER("Failed to send message queue: Flush join request\n");
-		return -EFAULT;
-	}
-
-	return result;
-}
-
 s32 wilc_disconnect(struct wilc_vif *vif, u16 u16ReasonCode)
 {
 	s32 result = 0;
@@ -3540,24 +3495,6 @@ int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel)
 	return 0;
 }
 
-int wilc_wait_msg_queue_idle(void)
-{
-	int result = 0;
-	struct host_if_msg msg;
-
-	memset(&msg, 0, sizeof(struct host_if_msg));
-	msg.id = HOST_IF_MSG_Q_IDLE;
-	result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
-	if (result) {
-		PRINT_ER("wilc mq send fail\n");
-		result = -EINVAL;
-	}
-
-	down(&hif_sema_wait_response);
-
-	return result;
-}
-
 int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mac_idx)
 {
 	int result = 0;
@@ -4615,35 +4552,6 @@ void wilc_free_join_params(void *pJoinParams)
 		PRINT_ER("Unable to FREE null pointer\n");
 }
 
-s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *pBSSID, char TID)
-{
-	s32 result = 0;
-	struct host_if_msg msg;
-	struct ba_session_info *pBASessionInfo = &msg.body.session_info;
-	struct host_if_drv *hif_drv = vif->hif_drv;
-
-	if (!hif_drv) {
-		PRINT_ER("driver is null\n");
-		return -EFAULT;
-	}
-
-	memset(&msg, 0, sizeof(struct host_if_msg));
-
-	msg.id = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS;
-
-	memcpy(pBASessionInfo->bssid, pBSSID, ETH_ALEN);
-	pBASessionInfo->tid = TID;
-	msg.vif = vif;
-
-	result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
-	if (result)
-		PRINT_ER("wilc_mq_send fail\n");
-
-	down(&hif_sema_wait_response);
-
-	return result;
-}
-
 s32 wilc_setup_ipaddress(struct wilc_vif *vif, u8 *u16ipadd, u8 idx)
 {
 	s32 result = 0;
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 5794246..2893b2e 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -327,15 +327,12 @@ s32 wilc_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen,
 s32 wilc_set_pmkid_info(struct wilc_vif *vif,
 			struct host_if_pmkid_attr *pu8PmkidInfoArray);
 s32 wilc_get_mac_address(struct wilc_vif *vif, u8 *pu8MacAddress);
-s32 wilc_set_mac_address(struct wilc_vif *vif, u8 *pu8MacAddress);
-int wilc_wait_msg_queue_idle(void);
 s32 wilc_set_start_scan_req(struct host_if_drv *hWFIDrv, u8 scanSource);
 s32 wilc_set_join_req(struct wilc_vif *vif, u8 *pu8bssid, const u8 *pu8ssid,
 		      size_t ssidLen, const u8 *pu8IEs, size_t IEsLen,
 		      wilc_connect_result pfConnectResult, void *pvUserArg,
 		      u8 u8security, enum AUTHTYPE tenuAuth_type,
 		      u8 u8channel, void *pJoinParams);
-s32 wilc_flush_join_req(struct wilc_vif *vif);
 s32 wilc_disconnect(struct wilc_vif *vif, u16 u16ReasonCode);
 int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel);
 s32 wilc_get_rssi(struct wilc_vif *vif, s8 *ps8Rssi);
@@ -359,7 +356,6 @@ s32 wilc_set_power_mgmt(struct wilc_vif *vif, bool bIsEnabled, u32 u32Timeout);
 s32 wilc_setup_multicast_filter(struct wilc_vif *vif, bool bIsEnabled,
 				u32 u32count);
 s32 wilc_setup_ipaddress(struct wilc_vif *vif, u8 *u16ipadd, u8 idx);
-s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *pBSSID, char TID);
 s32 wilc_remain_on_channel(struct wilc_vif *vif, u32 u32SessionID,
 			   u32 u32duration, u16 chan,
 			   wilc_remain_on_chan_expired RemainOnChanExpired,
-- 
1.9.1


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

* [PATCH 17/26] staging: wilc1000: ignore power save
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (15 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 16/26] staging: wilc1000: remove unused functions Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-12  7:39 ` [PATCH 18/26] staging: wilc1000: handle connecting error Glen Lee
                   ` (8 subsequent siblings)
  25 siblings, 0 replies; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

If two interfaces are connected and it is required to enable power save then
ignore the request.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index bc8357d..a0603f0 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4342,6 +4342,9 @@ s32 wilc_set_power_mgmt(struct wilc_vif *vif, bool bIsEnabled, u32 u32Timeout)
 		return -EFAULT;
 	}
 
+	if (wilc_wlan_get_num_conn_ifcs(vif->wilc) == 2 && bIsEnabled)
+		return 0;
+
 	PRINT_D(HOSTINF_DBG, "Setting Power management message queue params\n");
 
 	memset(&msg, 0, sizeof(struct host_if_msg));
-- 
1.9.1


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

* [PATCH 18/26] staging: wilc1000: handle connecting error
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (16 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 17/26] staging: wilc1000: ignore power save Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-12  7:39 ` [PATCH 19/26] staging: wilc1000: tcp_process: fix a build warning Glen Lee
                   ` (7 subsequent siblings)
  25 siblings, 0 replies; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

If connection fails, wilc1000_connecting needs to be set false also and return
immediately because goto lable 'done' doesn't do anything. Remove lable 'done'
as well.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index fe99a13..b5731af 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -757,8 +757,8 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
 			PRINT_D(CFG80211_DBG, "No Scan results yet\n");
 		else
 			PRINT_D(CFG80211_DBG, "Required bss not in scan results: Error(%d)\n", s32Error);
-
-		goto done;
+		wilc_connecting = 0;
+		return s32Error;
 	}
 
 	priv->WILC_WFI_wep_default = 0;
@@ -845,8 +845,8 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
 		} else {
 			s32Error = -ENOTSUPP;
 			PRINT_ER("Not supported cipher: Error(%d)\n", s32Error);
-
-			goto done;
+			wilc_connecting = 0;
+			return s32Error;
 		}
 	}
 
@@ -912,11 +912,10 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
 	if (s32Error != 0) {
 		PRINT_ER("wilc_set_join_req(): Error(%d)\n", s32Error);
 		s32Error = -ENOENT;
-		goto done;
+		wilc_connecting = 0;
+		return s32Error;
 	}
 
-done:
-
 	return s32Error;
 }
 
-- 
1.9.1


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

* [PATCH 19/26] staging: wilc1000: tcp_process: fix a build warning
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (17 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 18/26] staging: wilc1000: handle connecting error Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-12  7:39 ` [PATCH 20/26] staging: wilc1000: remove define TCP_ACK_FILTER Glen Lee
                   ` (6 subsequent siblings)
  25 siblings, 0 replies; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

This patch fixes build warning "flags is used uninitialized" when
TCP_ACK_FILTER is defined.

Fixes: 562ed3f1f78a ("staging/wilc1000: pass struct wilc to most linux_wlan.c functions")
Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/wilc_wlan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index cc487d8..e0696505 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -234,6 +234,7 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
 	vif = netdev_priv(dev);
 	wilc = vif->wilc;
 
+	spin_lock_irqsave(&wilc->txq_spinlock, flags);
 
 	eth_hdr_ptr = &buffer[0];
 	h_proto = ntohs(*((unsigned short *)&eth_hdr_ptr[12]));
-- 
1.9.1


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

* [PATCH 20/26] staging: wilc1000: remove define TCP_ACK_FILTER
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (18 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 19/26] staging: wilc1000: tcp_process: fix a build warning Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-22  7:57   ` Dan Carpenter
  2016-01-12  7:39 ` [PATCH 21/26] staging: wilc1000: increase link speed Glen Lee
                   ` (5 subsequent siblings)
  25 siblings, 1 reply; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

This patch removes define TCP_ACK_FILTER and use it's feature codes.
Add argument wilc to wilc_wlan_txq_remove because compile error happens.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/Makefile    |  1 -
 drivers/staging/wilc1000/wilc_wlan.c | 22 ++--------------------
 2 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile
index 90c3760..acc3f3e 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -4,7 +4,6 @@ ccflags-y += -DFIRMWARE_1002=\"atmel/wilc1002_firmware.bin\" \
 		-DFIRMWARE_1003=\"atmel/wilc1003_firmware.bin\"
 
 ccflags-y += -I$(src)/ -DWILC_ASIC_A0 -DWILC_DEBUGFS
-#ccflags-y += -DTCP_ACK_FILTER
 
 wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
 			wilc_msgqueue.o \
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index e0696505..337a1ba 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -36,8 +36,7 @@ static inline void release_bus(struct wilc *wilc, BUS_RELEASE_T release)
 	mutex_unlock(&wilc->hif_cs);
 }
 
-#ifdef TCP_ACK_FILTER
-static void wilc_wlan_txq_remove(struct txq_entry_t *tqe)
+static void wilc_wlan_txq_remove(struct wilc *wilc, struct txq_entry_t *tqe)
 {
 
 	if (tqe == wilc->txq_head) {
@@ -54,7 +53,6 @@ static void wilc_wlan_txq_remove(struct txq_entry_t *tqe)
 	}
 	wilc->txq_entries -= 1;
 }
-#endif
 
 static struct txq_entry_t *
 wilc_wlan_txq_remove_from_head(struct net_device *dev)
@@ -146,7 +144,6 @@ static int wilc_wlan_txq_add_to_head(struct wilc *wilc, struct txq_entry_t *tqe)
 	return 0;
 }
 
-#ifdef	TCP_ACK_FILTER
 struct ack_session_info;
 struct ack_session_info {
 	u32 seq_num;
@@ -308,7 +305,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
 				pending_acks_info[i].ack_num);
 			tqe = pending_acks_info[i].txqe;
 			if (tqe) {
-				wilc_wlan_txq_remove(tqe);
+				wilc_wlan_txq_remove(wilc, tqe);
 				tqe->status = 1;
 				if (tqe->tx_complete_func)
 					tqe->tx_complete_func(tqe->priv,
@@ -335,7 +332,6 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
 
 	return 1;
 }
-#endif
 
 static bool enabled = false;
 
@@ -344,12 +340,10 @@ void wilc_enable_tcp_ack_filter(bool value)
 	enabled = value;
 }
 
-#ifdef TCP_ACK_FILTER
 static bool is_tcp_ack_filter_enabled(void)
 {
 	return enabled;
 }
-#endif
 
 static int wilc_wlan_txq_add_cfg_pkt(struct wilc *wilc, u8 *buffer, u32 buffer_size)
 {
@@ -373,9 +367,7 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc *wilc, u8 *buffer, u32 buffer_s
 	tqe->buffer_size = buffer_size;
 	tqe->tx_complete_func = NULL;
 	tqe->priv = NULL;
-#ifdef TCP_ACK_FILTER
 	tqe->tcp_pending_ack_idx = NOT_TCP_ACK;
-#endif
 	PRINT_D(TX_DBG, "Adding the config packet at the Queue tail\n");
 
 	if (wilc_wlan_txq_add_to_head(wilc, tqe))
@@ -406,11 +398,9 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
 	tqe->priv = priv;
 
 	PRINT_D(TX_DBG, "Adding mgmt packet at the Queue tail\n");
-#ifdef TCP_ACK_FILTER
 	tqe->tcp_pending_ack_idx = NOT_TCP_ACK;
 	if (is_tcp_ack_filter_enabled())
 		tcp_process(dev, tqe);
-#endif
 	wilc_wlan_txq_add_to_tail(dev, tqe);
 	return wilc->txq_entries;
 }
@@ -436,9 +426,7 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer,
 	tqe->buffer_size = buffer_size;
 	tqe->tx_complete_func = func;
 	tqe->priv = priv;
-#ifdef TCP_ACK_FILTER
 	tqe->tcp_pending_ack_idx = NOT_TCP_ACK;
-#endif
 	PRINT_D(TX_DBG, "Adding Network packet at the Queue tail\n");
 	wilc_wlan_txq_add_to_tail(dev, tqe);
 	return 1;
@@ -643,9 +631,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
 
 		wilc_lock_timeout(wilc, &wilc->txq_add_to_head_cs,
 					CFG_PKTS_TIMEOUT);
-#ifdef	TCP_ACK_FILTER
 		wilc_wlan_txq_filter_dup_tcp_ack(dev);
-#endif
 		PRINT_D(TX_DBG, "Getting the head of the TxQ\n");
 		tqe = wilc_wlan_txq_get_first(wilc);
 		i = 0;
@@ -829,10 +815,8 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
 				if (tqe->tx_complete_func)
 					tqe->tx_complete_func(tqe->priv,
 							      tqe->status);
-				#ifdef TCP_ACK_FILTER
 				if (tqe->tcp_pending_ack_idx != NOT_TCP_ACK)
 					pending_acks_info[tqe->tcp_pending_ack_idx].txqe = NULL;
-				#endif
 				kfree(tqe);
 			} else {
 				break;
@@ -1564,9 +1548,7 @@ int wilc_wlan_init(struct net_device *dev)
 		ret = -EIO;
 		goto _fail_;
 	}
-#ifdef	TCP_ACK_FILTER
 	init_tcp_tracking();
-#endif
 
 	return 1;
 
-- 
1.9.1


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

* [PATCH 21/26] staging: wilc1000: increase link speed
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (19 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 20/26] staging: wilc1000: remove define TCP_ACK_FILTER Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-22  8:08   ` Dan Carpenter
  2016-01-12  7:39 ` [PATCH 22/26] staging: wilc1000: disable power save when AP mode Glen Lee
                   ` (4 subsequent siblings)
  25 siblings, 1 reply; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

This patch increases throughput by enabling tcp ack filter base on checking
statistics and also handling tcp session.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c     | 31 +++++++++++++--------------
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 ++
 drivers/staging/wilc1000/wilc_wlan.c          | 27 ++++++++++++++---------
 3 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index a0603f0..bc8032f 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -57,6 +57,9 @@
 #define BLOCK_ACK_REQ_SIZE                      0x14
 #define FALSE_FRMWR_CHANNEL			100
 
+#define TCP_ACK_FILTER_LINK_SPEED_THRESH	54
+#define DEFAULT_LINK_SPEED			72
+
 struct cfg_param_attr {
 	struct cfg_param_val cfg_attr_info;
 };
@@ -2191,7 +2194,14 @@ static s32 Handle_GetStatistics(struct wilc_vif *vif,
 	if (result)
 		PRINT_ER("Failed to send scan paramters config packet\n");
 
-	up(&hif_sema_wait_response);
+	if (pstrStatistics->link_speed > TCP_ACK_FILTER_LINK_SPEED_THRESH
+	    && pstrStatistics->link_speed != DEFAULT_LINK_SPEED)
+		wilc_enable_tcp_ack_filter(true);
+	else if (pstrStatistics->link_speed != DEFAULT_LINK_SPEED)
+		wilc_enable_tcp_ack_filter(false);
+
+	if (pstrStatistics != &vif->wilc->dummy_statistics)
+		up(&hif_sema_wait_response);
 	return 0;
 }
 
@@ -3607,7 +3617,8 @@ s32 wilc_get_statistics(struct wilc_vif *vif, struct rf_info *pstrStatistics)
 		return -EFAULT;
 	}
 
-	down(&hif_sema_wait_response);
+	if (pstrStatistics != &vif->wilc->dummy_statistics)
+		down(&hif_sema_wait_response);
 	return result;
 }
 
@@ -3695,21 +3706,9 @@ static void GetPeriodicRSSI(unsigned long arg)
 		return;
 	}
 
-	if (vif->hif_drv->hif_state == HOST_IF_CONNECTED) {
-		s32 result = 0;
-		struct host_if_msg msg;
-
-		memset(&msg, 0, sizeof(struct host_if_msg));
-
-		msg.id = HOST_IF_MSG_GET_RSSI;
-		msg.vif = vif;
+	if (vif->hif_drv->hif_state == HOST_IF_CONNECTED)
+		wilc_get_statistics(vif, &vif->wilc->dummy_statistics);
 
-		result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
-		if (result) {
-			PRINT_ER("Failed to send get host channel param's message queue ");
-			return;
-		}
-	}
 	periodic_rssi.data = (unsigned long)vif;
 	mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000));
 }
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 54e762ec..9f8c79e 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -217,6 +217,8 @@ struct wilc {
 
 	struct device *dev;
 	bool suspend_event;
+
+	struct rf_info dummy_statistics;
 };
 
 struct WILC_WFI_mon_priv {
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 337a1ba..a0819b9 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -178,19 +178,21 @@ static inline int init_tcp_tracking(void)
 
 static inline int add_tcp_session(u32 src_prt, u32 dst_prt, u32 seq)
 {
-	ack_session_info[tcp_session].seq_num = seq;
-	ack_session_info[tcp_session].bigger_ack_num = 0;
-	ack_session_info[tcp_session].src_port = src_prt;
-	ack_session_info[tcp_session].dst_port = dst_prt;
-	tcp_session++;
-
+	if (tcp_session < 2 * MAX_TCP_SESSION) {
+		ack_session_info[tcp_session].seq_num = seq;
+		ack_session_info[tcp_session].bigger_ack_num = 0;
+		ack_session_info[tcp_session].src_port = src_prt;
+		ack_session_info[tcp_session].dst_port = dst_prt;
+		tcp_session++;
+	}
 	PRINT_D(TCP_ENH, "TCP Session %d to Ack %d\n", tcp_session, seq);
 	return 0;
 }
 
 static inline int update_tcp_session(u32 index, u32 ack)
 {
-	if (ack > ack_session_info[index].bigger_ack_num)
+	if (index < 2 * MAX_TCP_SESSION
+	    && ack > ack_session_info[index].bigger_ack_num)
 		ack_session_info[index].bigger_ack_num = ack;
 	return 0;
 }
@@ -198,7 +200,7 @@ static inline int update_tcp_session(u32 index, u32 ack)
 static inline int add_tcp_pending_ack(u32 ack, u32 session_index,
 				      struct txq_entry_t *txqe)
 {
-	if (pending_acks < MAX_PENDING_ACKS) {
+	if (pending_base + pending_acks < MAX_PENDING_ACKS) {
 		pending_acks_info[pending_base + pending_acks].ack_num = ack;
 		pending_acks_info[pending_base + pending_acks].txqe = txqe;
 		pending_acks_info[pending_base + pending_acks].session_index = session_index;
@@ -265,7 +267,8 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
 					 (u32)tcp_hdr_ptr[11];
 
 				for (i = 0; i < tcp_session; i++) {
-					if (ack_session_info[i].seq_num == seq_no) {
+					if (i < 2 * MAX_TCP_SESSION
+					    && ack_session_info[i].seq_num == seq_no) {
 						update_tcp_session(i, ack_no);
 						break;
 					}
@@ -298,6 +301,9 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
 
 	spin_lock_irqsave(&wilc->txq_spinlock, wilc->txq_spinlock_flags);
 	for (i = pending_base; i < (pending_base + pending_acks); i++) {
+		if (i >= MAX_PENDING_ACKS
+		    || pending_acks_info[i].session_index >= 2 * MAX_TCP_SESSION)
+			break;
 		if (pending_acks_info[i].ack_num < ack_session_info[pending_acks_info[i].session_index].bigger_ack_num) {
 			struct txq_entry_t *tqe;
 
@@ -815,7 +821,8 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
 				if (tqe->tx_complete_func)
 					tqe->tx_complete_func(tqe->priv,
 							      tqe->status);
-				if (tqe->tcp_pending_ack_idx != NOT_TCP_ACK)
+				if (tqe->tcp_pending_ack_idx != NOT_TCP_ACK
+				    && tqe->tcp_pending_ack_idx < MAX_PENDING_ACKS)
 					pending_acks_info[tqe->tcp_pending_ack_idx].txqe = NULL;
 				kfree(tqe);
 			} else {
-- 
1.9.1


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

* [PATCH 22/26] staging: wilc1000: disable power save when AP mode
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (20 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 21/26] staging: wilc1000: increase link speed Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-12  7:39 ` [PATCH 23/26] staging: wilc1000: fix bug on p2p connection Glen Lee
                   ` (3 subsequent siblings)
  25 siblings, 0 replies; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

This patch disables power save mode in case of AP mode.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index b5731af..5839c2b 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2203,6 +2203,7 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev,
 		PRINT_ER("Error in setting channel\n");
 
 	wilc_wlan_set_bssid(dev, wl->vif[vif->u8IfIdx]->src_addr, AP_MODE);
+	wilc_set_power_mgmt(vif, 0, 0);
 
 	s32Error = wilc_add_beacon(vif, settings->beacon_interval,
 				   settings->dtim_period, beacon->head_len,
-- 
1.9.1


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

* [PATCH 23/26] staging: wilc1000: fix bug on p2p connection
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (21 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 22/26] staging: wilc1000: disable power save when AP mode Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-12  7:39 ` [PATCH 24/26] staging: wilc1000: add ops tx power in cfg80211 Glen Lee
                   ` (2 subsequent siblings)
  25 siblings, 0 replies; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

In case of action frame, size -7 is correct, but in this case, size should be
used as it is.

Signed-off-by: Glen Lee <glen.lee@atmel.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 5839c2b..8197892 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1728,7 +1728,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size)
 			}
 		}
 
-		cfg80211_rx_mgmt(priv->wdev, s32Freq, 0, buff, size - 7, 0);
+		cfg80211_rx_mgmt(priv->wdev, s32Freq, 0, buff, size, 0);
 	}
 }
 
-- 
1.9.1


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

* [PATCH 24/26] staging: wilc1000: add ops tx power in cfg80211
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (22 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 23/26] staging: wilc1000: fix bug on p2p connection Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-22  8:27   ` Dan Carpenter
  2016-01-12  7:39 ` [PATCH 25/26] staging: wilc1000: fix WEP security bug Glen Lee
  2016-01-12  7:39 ` [PATCH 26/26] staging: wilc1000: get mac address after setting drv handler Glen Lee
  25 siblings, 1 reply; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

This patch implements set_tx_power and get_tx_power of cfg80211_ops.
In addition, Id of HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS is changed with 37.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c         | 88 ++++++++++++++++++++++-
 drivers/staging/wilc1000/host_interface.h         |  2 +
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 37 ++++++++++
 drivers/staging/wilc1000/wilc_wlan_if.h           |  1 +
 4 files changed, 127 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index bc8032f..6bdaace 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -46,7 +46,9 @@
 #define HOST_IF_MSG_DEL_BA_SESSION              34
 #define HOST_IF_MSG_Q_IDLE                      35
 #define HOST_IF_MSG_DEL_ALL_STA                 36
-#define HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS      34
+#define HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS      37
+#define HOST_IF_MSG_SET_TX_POWER		38
+#define HOST_IF_MSG_GET_TX_POWER		39
 #define HOST_IF_MSG_EXIT                        100
 
 #define HOST_IF_SCAN_TIMEOUT                    4000
@@ -166,6 +168,10 @@ struct sta_inactive_t {
 	u8 mac[6];
 };
 
+struct tx_power {
+	u8 tx_pwr;
+};
+
 union message_body {
 	struct scan_attr scan_info;
 	struct connect_attr con_info;
@@ -191,6 +197,7 @@ union message_body {
 	struct reg_frame reg_frame;
 	char *data;
 	struct del_all_sta del_all_sta_info;
+	struct tx_power tx_power;
 };
 
 struct host_if_msg {
@@ -2787,6 +2794,40 @@ static s32 Handle_DelAllRxBASessions(struct wilc_vif *vif,
 	return result;
 }
 
+static void handle_set_tx_pwr(struct wilc_vif *vif, u8 tx_pwr)
+{
+	s32 ret = 0;
+	struct wid wid;
+
+	wid.id = (u16)WID_TX_POWER;
+	wid.type = WID_CHAR;
+	wid.val = (s8 *)&tx_pwr;
+	wid.size = sizeof(char);
+
+	ret = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
+			     wilc_get_vif_idx(vif));
+	if(ret)
+		netdev_err(vif->ndev,"Failed to set TX PWR\n");
+}
+
+static void handle_get_tx_pwr(struct wilc_vif *vif, u8 *tx_pwr)
+{
+	s32 ret = 0;
+	struct wid wid;
+
+	wid.id = (u16)WID_TX_POWER;
+	wid.type = WID_CHAR;
+	wid.val = (s8 *)tx_pwr;
+	wid.size = sizeof(char);
+
+	ret = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1,
+			     wilc_get_vif_idx(vif));
+	if(ret)
+		netdev_err(vif->ndev,"Failed to get TX PWR\n");
+
+	up(&hif_sema_wait_response);
+}
+
 static int hostIFthread(void *pvArg)
 {
 	u32 u32Ret;
@@ -2990,6 +3031,13 @@ static int hostIFthread(void *pvArg)
 			Handle_DelAllSta(msg.vif, &msg.body.del_all_sta_info);
 			break;
 
+		case HOST_IF_MSG_SET_TX_POWER:
+			handle_set_tx_pwr(msg.vif, msg.body.tx_power.tx_pwr);
+			break;
+
+		case HOST_IF_MSG_GET_TX_POWER:
+			handle_get_tx_pwr(msg.vif, &msg.body.tx_power.tx_pwr);
+			break;
 		default:
 			PRINT_ER("[Host Interface] undefined Received Msg ID\n");
 			break;
@@ -4608,3 +4656,41 @@ static s32 host_int_get_ipaddress(struct wilc_vif *vif,
 
 	return result;
 }
+
+int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power)
+{
+	int ret = 0;
+	struct host_if_msg msg;
+
+	memset(&msg, 0, sizeof(struct host_if_msg));
+
+	msg.id = HOST_IF_MSG_SET_TX_POWER;
+	msg.body.tx_power.tx_pwr = tx_power;
+	msg.vif = vif;
+
+	ret = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+	if (ret)
+		netdev_err(vif->ndev, "wilc_mq_send fail\n");
+
+	return ret;
+}
+
+int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power)
+{
+	int ret = 0;
+	struct host_if_msg msg;
+
+	memset(&msg, 0, sizeof(struct host_if_msg));
+
+	msg.id = HOST_IF_MSG_GET_TX_POWER;
+	msg.vif = vif;
+
+	ret = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
+	if (ret)
+		netdev_err(vif->ndev, "Failed to get TX PWR\n");
+
+	down(&hif_sema_wait_response);
+	*tx_power = msg.body.tx_power.tx_pwr;
+
+	return ret;
+}
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index 2893b2e..7724ade 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -371,6 +371,8 @@ void wilc_free_join_params(void *pJoinParams);
 s32 wilc_get_statistics(struct wilc_vif *vif, struct rf_info *pstrStatistics);
 void wilc_resolve_disconnect_aberration(struct wilc_vif *vif);
 int wilc_get_vif_idx(struct wilc_vif *vif);
+int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power);
+int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power);
 
 extern bool wilc_optaining_ip;
 extern u8 wilc_connected_ssid[6];
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 8197892..a790f70 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2504,6 +2504,41 @@ static void wilc_set_wakeup(struct wiphy *wiphy, bool enabled)
 	netdev_info(vif->ndev, "cfg set wake up = %d\n", enabled);
 }
 
+static int set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
+			enum nl80211_tx_power_setting type, int mbm)
+{
+	int ret = 0;
+	s32 tx_power = MBM_TO_DBM(mbm);
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(priv->dev);
+
+	netdev_info(vif->ndev, "Setting tx power to %d\n", tx_power);
+
+	if(tx_power < 0)
+		tx_power = 0;
+	else if(tx_power > 18)
+		tx_power = 18;
+	ret = wilc_set_tx_power(vif ,(u8)tx_power);
+	if (ret)
+		netdev_err(vif->ndev, "Failed to set tx power\n");
+
+	return ret;
+}
+
+static int get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
+			int *dbm)
+{
+	int ret = 0;
+	struct wilc_priv *priv = wiphy_priv(wiphy);
+	struct wilc_vif *vif = netdev_priv(priv->dev);
+
+	ret = wilc_get_tx_power(vif, (u8 *)dbm);
+	if (ret)
+		netdev_err(vif->ndev, "Failed to get tx power\n");
+
+	return ret;
+}
+
 static struct cfg80211_ops wilc_cfg80211_ops = {
 	.set_monitor_channel = set_channel,
 	.scan = scan,
@@ -2542,6 +2577,8 @@ static struct cfg80211_ops wilc_cfg80211_ops = {
 	.suspend = wilc_suspend,
 	.resume = wilc_resume,
 	.set_wakeup = wilc_set_wakeup,
+	.set_tx_power = set_tx_power,
+	.get_tx_power = get_tx_power,
 
 };
 
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index d306ec1a..c446af6 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -761,6 +761,7 @@ typedef enum {
 	WID_DEL_BEACON			= 0x00CA,
 
 	WID_LOGTerminal_Switch		= 0x00CD,
+	WID_TX_POWER			= 0x00CE,
 	/*  EMAC Short WID list */
 	/*  RTS Threshold */
 	/*
-- 
1.9.1


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

* [PATCH 25/26] staging: wilc1000: fix WEP security bug
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (23 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 24/26] staging: wilc1000: add ops tx power in cfg80211 Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  2016-01-12  7:39 ` [PATCH 26/26] staging: wilc1000: get mac address after setting drv handler Glen Lee
  25 siblings, 0 replies; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

Station cannot connect to soft AP mode wilc when it is configured for WEP
security. This patch fixes it by setting the key index within the key value and
change the last else condition with DEFAULTKEY action case, and also do not use
WILC_WFI_wep_default index to set wep key id.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/host_interface.c         | 27 +++++++++++------------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  9 +-------
 drivers/staging/wilc1000/wilc_wfi_netdevice.h     |  1 -
 3 files changed, 14 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 6bdaace..dd2cd60 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1741,14 +1741,7 @@ static int Handle_Key(struct wilc_vif *vif,
 			strWIDList[1].size = sizeof(char);
 			strWIDList[1].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.auth_type;
 
-			strWIDList[2].id = (u16)WID_KEY_ID;
-			strWIDList[2].type = WID_CHAR;
-
-			strWIDList[2].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.index;
-			strWIDList[2].size = sizeof(char);
-
-			pu8keybuf = kmemdup(pstrHostIFkeyAttr->attr.wep.key,
-					    pstrHostIFkeyAttr->attr.wep.key_len,
+			pu8keybuf = kmalloc(pstrHostIFkeyAttr->attr.wep.key_len + 2,
 					    GFP_KERNEL);
 
 			if (pu8keybuf == NULL) {
@@ -1756,15 +1749,21 @@ static int Handle_Key(struct wilc_vif *vif,
 				return -ENOMEM;
 			}
 
+			pu8keybuf[0] = pstrHostIFkeyAttr->attr.wep.index;
+			pu8keybuf[1] = pstrHostIFkeyAttr->attr.wep.key_len;
+
+			memcpy(&pu8keybuf[2], pstrHostIFkeyAttr->attr.wep.key,
+			       pstrHostIFkeyAttr->attr.wep.key_len);
+
 			kfree(pstrHostIFkeyAttr->attr.wep.key);
 
-			strWIDList[3].id = (u16)WID_WEP_KEY_VALUE;
-			strWIDList[3].type = WID_STR;
-			strWIDList[3].size = pstrHostIFkeyAttr->attr.wep.key_len;
-			strWIDList[3].val = (s8 *)pu8keybuf;
+			strWIDList[2].id = (u16)WID_WEP_KEY_VALUE;
+			strWIDList[2].type = WID_STR;
+			strWIDList[2].size = pstrHostIFkeyAttr->attr.wep.key_len + 2;
+			strWIDList[2].val = (s8 *)pu8keybuf;
 
 			result = wilc_send_config_pkt(vif->wilc, SET_CFG,
-						strWIDList, 4,
+						strWIDList, 3,
 						wilc_get_vif_idx(vif));
 			kfree(pu8keybuf);
 		} else if (pstrHostIFkeyAttr->action & ADDKEY) {
@@ -1801,7 +1800,7 @@ static int Handle_Key(struct wilc_vif *vif,
 			result = wilc_send_config_pkt(vif->wilc, SET_CFG,
 						&wid, 1,
 						wilc_get_vif_idx(vif));
-		} else {
+		} else if (pstrHostIFkeyAttr->action & DEFAULTKEY) {
 			wid.id = (u16)WID_KEY_ID;
 			wid.type = WID_CHAR;
 			wid.val = (s8 *)&pstrHostIFkeyAttr->attr.wep.index;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index a790f70..eb99722 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -761,7 +761,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
 		return s32Error;
 	}
 
-	priv->WILC_WFI_wep_default = 0;
 	memset(priv->WILC_WFI_wep_key, 0, sizeof(priv->WILC_WFI_wep_key));
 	memset(priv->WILC_WFI_wep_key_len, 0, sizeof(priv->WILC_WFI_wep_key_len));
 
@@ -788,7 +787,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
 				for (i = 0; i < sme->key_len; i++)
 					PRINT_D(CORECONFIG_DBG, "WEP Key Value[%d] = %d\n", i, sme->key[i]);
 			}
-			priv->WILC_WFI_wep_default = sme->key_idx;
 			priv->WILC_WFI_wep_key_len[sme->key_idx] = sme->key_len;
 			memcpy(priv->WILC_WFI_wep_key[sme->key_idx], sme->key, sme->key_len);
 
@@ -806,7 +804,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
 			pcgroup_encrypt_val = "WEP104";
 			pccipher_group = "WLAN_CIPHER_SUITE_WEP104";
 
-			priv->WILC_WFI_wep_default = sme->key_idx;
 			priv->WILC_WFI_wep_key_len[sme->key_idx] = sme->key_len;
 			memcpy(priv->WILC_WFI_wep_key[sme->key_idx], sme->key, sme->key_len);
 
@@ -986,7 +983,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
 	case WLAN_CIPHER_SUITE_WEP40:
 	case WLAN_CIPHER_SUITE_WEP104:
 		if (priv->wdev->iftype == NL80211_IFTYPE_AP) {
-			priv->WILC_WFI_wep_default = key_index;
 			priv->WILC_WFI_wep_key_len[key_index] = params->key_len;
 			memcpy(priv->WILC_WFI_wep_key[key_index], params->key, params->key_len);
 
@@ -1009,7 +1005,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
 			break;
 		}
 		if (memcmp(params->key, priv->WILC_WFI_wep_key[key_index], params->key_len)) {
-			priv->WILC_WFI_wep_default = key_index;
 			priv->WILC_WFI_wep_key_len[key_index] = params->key_len;
 			memcpy(priv->WILC_WFI_wep_key[key_index], params->key, params->key_len);
 
@@ -1336,9 +1331,7 @@ static int set_default_key(struct wiphy *wiphy, struct net_device *netdev, u8 ke
 
 	PRINT_D(CFG80211_DBG, "Setting default key with idx = %d\n", key_index);
 
-	if (key_index != priv->WILC_WFI_wep_default) {
-		wilc_set_wep_default_keyid(vif, key_index);
-	}
+	wilc_set_wep_default_keyid(vif, key_index);
 
 	return 0;
 }
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 9f8c79e..07eda4d 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -124,7 +124,6 @@ struct wilc_priv {
 	struct host_if_drv *hWILCWFIDrv;
 	struct host_if_pmkid_attr pmkid_list;
 	struct WILC_WFI_stats netstats;
-	u8 WILC_WFI_wep_default;
 	u8 WILC_WFI_wep_key[4][WLAN_KEY_LEN_WEP104];
 	u8 WILC_WFI_wep_key_len[4];
 	/* The real interface that the monitor is on */
-- 
1.9.1


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

* [PATCH 26/26] staging: wilc1000: get mac address after setting drv handler
  2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
                   ` (24 preceding siblings ...)
  2016-01-12  7:39 ` [PATCH 25/26] staging: wilc1000: fix WEP security bug Glen Lee
@ 2016-01-12  7:39 ` Glen Lee
  25 siblings, 0 replies; 35+ messages in thread
From: Glen Lee @ 2016-01-12  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-wireless, tony.cho, glen.lee, leo.kim, austin.shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

This patch moves wilc_get_mac_address and address memcpy function after
calling wilc_set_wif_drv_handler to get selected mac address.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 9dd59da..2577bce 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1018,12 +1018,8 @@ int wilc_mac_open(struct net_device *ndev)
 		return ret;
 	}
 
-	wilc_get_mac_address(vif, mac_add);
-	PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add);
-
 	for (i = 0; i < wl->vif_num; i++) {
 		if (ndev == wl->vif[i]->ndev) {
-			memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN);
 			if (vif->iftype == AP_MODE) {
 				wilc_set_wfi_drv_handler(vif,
 							 wilc_get_vif_idx(vif),
@@ -1044,6 +1040,11 @@ int wilc_mac_open(struct net_device *ndev)
 							 1);
 			}
 			wilc_set_operation_mode(vif, vif->iftype);
+
+			wilc_get_mac_address(vif, mac_add);
+			netdev_dbg(ndev, "Mac address: %pM\n", mac_add);
+			memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN);
+
 			break;
 		}
 	}
-- 
1.9.1


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

* Re: [PATCH 09/26] staging: wilc1000: use unified firmware
  2016-01-12  7:39 ` [PATCH 09/26] staging: wilc1000: use unified firmware Glen Lee
@ 2016-01-12 23:18   ` Julian Calaby
  2016-01-13  2:32     ` glen lee
  0 siblings, 1 reply; 35+ messages in thread
From: Julian Calaby @ 2016-01-12 23:18 UTC (permalink / raw)
  To: Glen Lee
  Cc: Greg KH, devel, linux-wireless, Tony Cho, leo.kim, Austin Shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE

Hi Glen,

On Tue, Jan 12, 2016 at 6:39 PM, Glen Lee <glen.lee@atmel.com> wrote:
> Use a unified firmware for all mode of operations which are station, ap and
> p2p. Two firmware are introduced for 1002 and 1003 chipset.
>
> Signed-off-by: Glen Lee <glen.lee@atmel.com>
> ---
>  drivers/staging/wilc1000/Makefile     |  5 ++---
>  drivers/staging/wilc1000/linux_wlan.c | 18 +++++++++---------
>  2 files changed, 11 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile
> index 20a5cb9..90c3760 100644
> --- a/drivers/staging/wilc1000/Makefile
> +++ b/drivers/staging/wilc1000/Makefile
> @@ -1,8 +1,7 @@
>  obj-$(CONFIG_WILC1000) += wilc1000.o
>
> -ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \
> -               -DAP_FIRMWARE=\"atmel/wilc1000_ap_fw.bin\" \
> -               -DP2P_CONCURRENCY_FIRMWARE=\"atmel/wilc1000_p2p_fw.bin\"
> +ccflags-y += -DFIRMWARE_1002=\"atmel/wilc1002_firmware.bin\" \
> +               -DFIRMWARE_1003=\"atmel/wilc1003_firmware.bin\"

You can probably put these defines in a header somewhere instead of here.

Also, are these firmwares publicly available and have they been
submitted to linux-firmware?

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/

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

* Re: [PATCH 09/26] staging: wilc1000: use unified firmware
  2016-01-12 23:18   ` Julian Calaby
@ 2016-01-13  2:32     ` glen lee
  0 siblings, 0 replies; 35+ messages in thread
From: glen lee @ 2016-01-13  2:32 UTC (permalink / raw)
  To: Julian Calaby
  Cc: Greg KH, devel, linux-wireless, Tony Cho, leo.kim, Austin Shin,
	adel.noureldin, adham.abozaeid, Nicolas.FERRE



On 2016년 01월 13일 08:18, Julian Calaby wrote:
> Hi Glen,
>
> On Tue, Jan 12, 2016 at 6:39 PM, Glen Lee <glen.lee@atmel.com> wrote:
>> Use a unified firmware for all mode of operations which are station, ap and
>> p2p. Two firmware are introduced for 1002 and 1003 chipset.
>>
>> Signed-off-by: Glen Lee <glen.lee@atmel.com>
>> ---
>>   drivers/staging/wilc1000/Makefile     |  5 ++---
>>   drivers/staging/wilc1000/linux_wlan.c | 18 +++++++++---------
>>   2 files changed, 11 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile
>> index 20a5cb9..90c3760 100644
>> --- a/drivers/staging/wilc1000/Makefile
>> +++ b/drivers/staging/wilc1000/Makefile
>> @@ -1,8 +1,7 @@
>>   obj-$(CONFIG_WILC1000) += wilc1000.o
>>
>> -ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \
>> -               -DAP_FIRMWARE=\"atmel/wilc1000_ap_fw.bin\" \
>> -               -DP2P_CONCURRENCY_FIRMWARE=\"atmel/wilc1000_p2p_fw.bin\"
>> +ccflags-y += -DFIRMWARE_1002=\"atmel/wilc1002_firmware.bin\" \
>> +               -DFIRMWARE_1003=\"atmel/wilc1003_firmware.bin\"
> You can probably put these defines in a header somewhere instead of here.

Hi Julian,

It's better to define in header as you say. I'll do this later.

>
> Also, are these firmwares publicly available and have they been
> submitted to linux-firmware?

Not yet. We will patch new firmware as soon as possible.

Thanks,

Glen lee.

>
> Thanks,
>


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

* Re: [PATCH 04/26] staging: wilc1000: add sdio resume/suspend
  2016-01-12  7:39 ` [PATCH 04/26] staging: wilc1000: add sdio resume/suspend Glen Lee
@ 2016-01-22  7:44   ` Dan Carpenter
  2016-01-22  8:10     ` glen lee
  0 siblings, 1 reply; 35+ messages in thread
From: Dan Carpenter @ 2016-01-22  7:44 UTC (permalink / raw)
  To: Glen Lee
  Cc: gregkh, devel, austin.shin, linux-wireless, Nicolas.FERRE,
	adel.noureldin, tony.cho, leo.kim, adham.abozaeid

You should be running checkpatch.pl on your patches.

regards,
dan carpenter


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

* Re: [PATCH 20/26] staging: wilc1000: remove define TCP_ACK_FILTER
  2016-01-12  7:39 ` [PATCH 20/26] staging: wilc1000: remove define TCP_ACK_FILTER Glen Lee
@ 2016-01-22  7:57   ` Dan Carpenter
  0 siblings, 0 replies; 35+ messages in thread
From: Dan Carpenter @ 2016-01-22  7:57 UTC (permalink / raw)
  To: Glen Lee
  Cc: gregkh, devel, austin.shin, linux-wireless, Nicolas.FERRE,
	adel.noureldin, tony.cho, leo.kim, adham.abozaeid

What does TCP_ACK_FILTER do?

regards,
dan carpenter


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

* Re: [PATCH 21/26] staging: wilc1000: increase link speed
  2016-01-12  7:39 ` [PATCH 21/26] staging: wilc1000: increase link speed Glen Lee
@ 2016-01-22  8:08   ` Dan Carpenter
  0 siblings, 0 replies; 35+ messages in thread
From: Dan Carpenter @ 2016-01-22  8:08 UTC (permalink / raw)
  To: Glen Lee
  Cc: gregkh, devel, austin.shin, linux-wireless, Nicolas.FERRE,
	adel.noureldin, tony.cho, leo.kim, adham.abozaeid

Btw, even though I don't always comment, I see all the places where
checkpatch would have complained.  It's like that TV show "Person of
Interest".

https://www.youtube.com/watch?v=WOnQ8CD3v4g#t=16s

regards,
dan carpenter



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

* Re: [PATCH 04/26] staging: wilc1000: add sdio resume/suspend
  2016-01-22  7:44   ` Dan Carpenter
@ 2016-01-22  8:10     ` glen lee
  2016-01-24 20:57       ` Greg KH
  0 siblings, 1 reply; 35+ messages in thread
From: glen lee @ 2016-01-22  8:10 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: gregkh, devel, austin.shin, linux-wireless, Nicolas.FERRE,
	adel.noureldin, tony.cho, leo.kim, adham.abozaeid


On 2016년 01월 22일 16:44, Dan Carpenter wrote:
> You should be running checkpatch.pl on your patches.

It's my mistake. I will run checkpatch.pl on the patch series.
Thank you your advise.

glen lee.

>
> regards,
> dan carpenter
>


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

* Re: [PATCH 24/26] staging: wilc1000: add ops tx power in cfg80211
  2016-01-12  7:39 ` [PATCH 24/26] staging: wilc1000: add ops tx power in cfg80211 Glen Lee
@ 2016-01-22  8:27   ` Dan Carpenter
  0 siblings, 0 replies; 35+ messages in thread
From: Dan Carpenter @ 2016-01-22  8:27 UTC (permalink / raw)
  To: Glen Lee
  Cc: gregkh, devel, austin.shin, linux-wireless, Nicolas.FERRE,
	adel.noureldin, tony.cho, leo.kim, adham.abozaeid

On Tue, Jan 12, 2016 at 04:39:53PM +0900, Glen Lee wrote:
> +static void handle_set_tx_pwr(struct wilc_vif *vif, u8 tx_pwr)
> +{
> +	s32 ret = 0;

s32 should almost always be changed to int.  Don't initialize variables
with bogus values.  GCC has a helper warning for uninitialized variables
and this disables GCC's uninitialized variable checking.

> +	struct wid wid;
> +
> +	wid.id = (u16)WID_TX_POWER;
> +	wid.type = WID_CHAR;
> +	wid.val = (s8 *)&tx_pwr;

Casting an unsigned value from the user to signed seems like a recipe
for disaster.

> +	wid.size = sizeof(char);
> +
> +	ret = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
> +			     wilc_get_vif_idx(vif));
> +	if(ret)

grumble grumble... checkpatch.

> +		netdev_err(vif->ndev,"Failed to set TX PWR\n");
> +}

[ snip]

> +static int set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
> +			enum nl80211_tx_power_setting type, int mbm)
> +{
> +	int ret = 0;

No need.

> +	s32 tx_power = MBM_TO_DBM(mbm);
> +	struct wilc_priv *priv = wiphy_priv(wiphy);
> +	struct wilc_vif *vif = netdev_priv(priv->dev);
> +
> +	netdev_info(vif->ndev, "Setting tx power to %d\n", tx_power);

Remove this debug output.

> +
> +	if(tx_power < 0)

grumble.

> +		tx_power = 0;
> +	else if(tx_power > 18)
> +		tx_power = 18;
> +	ret = wilc_set_tx_power(vif ,(u8)tx_power);

This cast is not needed.  Whitespace grumble.

regards,
dan carpenter


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

* Re: [PATCH 04/26] staging: wilc1000: add sdio resume/suspend
  2016-01-22  8:10     ` glen lee
@ 2016-01-24 20:57       ` Greg KH
  0 siblings, 0 replies; 35+ messages in thread
From: Greg KH @ 2016-01-24 20:57 UTC (permalink / raw)
  To: glen lee
  Cc: Dan Carpenter, devel, austin.shin, linux-wireless, Nicolas.FERRE,
	adel.noureldin, tony.cho, leo.kim, adham.abozaeid

On Fri, Jan 22, 2016 at 05:10:39PM +0900, glen lee wrote:
> 
> On 2016년 01월 22일 16:44, Dan Carpenter wrote:
> >You should be running checkpatch.pl on your patches.
> 
> It's my mistake. I will run checkpatch.pl on the patch series.
> Thank you your advise.

Please do so and resend this series, I've dropped it from my queue.

greg k-h

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

end of thread, other threads:[~2016-01-24 20:57 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-12  7:39 [PATCH 00/26] use unified firmware and add ops in cfg Glen Lee
2016-01-12  7:39 ` [PATCH 01/26] staging: wilc1000: fix bug when changing virtual interface Glen Lee
2016-01-12  7:39 ` [PATCH 02/26] staging: wilc1000: remove define WILC_OPTIMIZE_SLEEP_INT Glen Lee
2016-01-12  7:39 ` [PATCH 03/26] staging: wilc1000: support suspend/resume functionality Glen Lee
2016-01-12  7:39 ` [PATCH 04/26] staging: wilc1000: add sdio resume/suspend Glen Lee
2016-01-22  7:44   ` Dan Carpenter
2016-01-22  8:10     ` glen lee
2016-01-24 20:57       ` Greg KH
2016-01-12  7:39 ` [PATCH 05/26] staging: wilc1000: sdio_init: add resume argument Glen Lee
2016-01-12  7:39 ` [PATCH 06/26] staging: wilc1000: add ops resuem/suspend/wakeup in cfg80211 Glen Lee
2016-01-12  7:39 ` [PATCH 07/26] staging: wilc1000: remove sleep and reduce close timeout Glen Lee
2016-01-12  7:39 ` [PATCH 08/26] staging: wilc1000: get address from wilc Glen Lee
2016-01-12  7:39 ` [PATCH 09/26] staging: wilc1000: use unified firmware Glen Lee
2016-01-12 23:18   ` Julian Calaby
2016-01-13  2:32     ` glen lee
2016-01-12  7:39 ` [PATCH 10/26] staging: wilc1000: remove wilc_set_machw_change_vir_if Glen Lee
2016-01-12  7:39 ` [PATCH 11/26] staging: wilc1000: set bssid with mode Glen Lee
2016-01-12  7:39 ` [PATCH 12/26] staging: wilc1000: set proper bssid address Glen Lee
2016-01-12  7:39 ` [PATCH 13/26] staging: wilc1000: change_virtual_intf: change codes for unified firmware Glen Lee
2016-01-12  7:39 ` [PATCH 14/26] staging: wilc1000: call power save after changing mode Glen Lee
2016-01-12  7:39 ` [PATCH 15/26] staging: wilc1000: wilc_set_wfi_drv_handler: add mac index Glen Lee
2016-01-12  7:39 ` [PATCH 16/26] staging: wilc1000: remove unused functions Glen Lee
2016-01-12  7:39 ` [PATCH 17/26] staging: wilc1000: ignore power save Glen Lee
2016-01-12  7:39 ` [PATCH 18/26] staging: wilc1000: handle connecting error Glen Lee
2016-01-12  7:39 ` [PATCH 19/26] staging: wilc1000: tcp_process: fix a build warning Glen Lee
2016-01-12  7:39 ` [PATCH 20/26] staging: wilc1000: remove define TCP_ACK_FILTER Glen Lee
2016-01-22  7:57   ` Dan Carpenter
2016-01-12  7:39 ` [PATCH 21/26] staging: wilc1000: increase link speed Glen Lee
2016-01-22  8:08   ` Dan Carpenter
2016-01-12  7:39 ` [PATCH 22/26] staging: wilc1000: disable power save when AP mode Glen Lee
2016-01-12  7:39 ` [PATCH 23/26] staging: wilc1000: fix bug on p2p connection Glen Lee
2016-01-12  7:39 ` [PATCH 24/26] staging: wilc1000: add ops tx power in cfg80211 Glen Lee
2016-01-22  8:27   ` Dan Carpenter
2016-01-12  7:39 ` [PATCH 25/26] staging: wilc1000: fix WEP security bug Glen Lee
2016-01-12  7:39 ` [PATCH 26/26] staging: wilc1000: get mac address after setting drv handler Glen Lee

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.