From patchwork Tue Aug 14 06:49:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565067 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB2151510 for ; Tue, 14 Aug 2018 06:50:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EBFC296B2 for ; Tue, 14 Aug 2018 06:50:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9300E29684; Tue, 14 Aug 2018 06:50:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13FE2296AF for ; Tue, 14 Aug 2018 06:50:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731755AbeHNJgN (ORCPT ); Tue, 14 Aug 2018 05:36:13 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:41306 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJgN (ORCPT ); Tue, 14 Aug 2018 05:36:13 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="17924156" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:50:25 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:50:24 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 01/24] staging: wilc1000: move 'wilc_enable_ps' global variable into 'wilc' struct Date: Tue, 14 Aug 2018 12:19:53 +0530 Message-ID: <1534229416-13254-2-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of having 'wilc_enable_ps' as global variable moved it to 'wilc' structure. Rename 'wilc_enable_ps' to 'enable_ps' as its already part of 'wilc' structure Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/linux_wlan.c | 5 ++--- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 10 +++++----- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 + drivers/staging/wilc1000/wilc_wlan.h | 1 - 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 01cf4bd..57e3176 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -12,8 +12,6 @@ #include "wilc_wfi_cfgoperations.h" -bool wilc_enable_ps = true; - static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr) { @@ -54,7 +52,7 @@ static int dev_state_ev_handler(struct notifier_block *this, del_timer(&wilc_during_ip_timer); } - if (wilc_enable_ps) + if (vif->wilc->enable_ps) wilc_set_power_mgmt(vif, 1, 0); netdev_dbg(dev, "[%s] Up IP\n", dev_iface->ifa_label); @@ -1066,6 +1064,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, *wilc = wl; wl->io_type = io_type; wl->hif_func = ops; + wl->enable_ps = true; INIT_LIST_HEAD(&wl->txq_head.list); INIT_LIST_HEAD(&wl->rxq_head.list); diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 7cd0330..4727a8a 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1732,7 +1732,7 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, if (!priv->hif_drv) return -EIO; - if (wilc_enable_ps) + if (vif->wilc->enable_ps) wilc_set_power_mgmt(vif, enabled, timeout); return 0; @@ -1764,7 +1764,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, memset(priv->assoc_stainfo.sta_associated_bss, 0, MAX_NUM_STA * ETH_ALEN); - wilc_enable_ps = true; + wl->enable_ps = true; wilc_set_power_mgmt(vif, 1, 0); break; @@ -1776,12 +1776,12 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, vif->iftype = CLIENT_MODE; wilc_set_operation_mode(vif, STATION_MODE); - wilc_enable_ps = false; + wl->enable_ps = false; wilc_set_power_mgmt(vif, 0, 0); break; case NL80211_IFTYPE_AP: - wilc_enable_ps = false; + wl->enable_ps = false; dev->ieee80211_ptr->iftype = type; priv->wdev->iftype = type; vif->iftype = AP_MODE; @@ -1803,7 +1803,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, priv->wdev->iftype = type; vif->iftype = GO_MODE; - wilc_enable_ps = false; + wl->enable_ps = false; wilc_set_power_mgmt(vif, 0, 0); break; diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index b7eee77..8b74d61 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -166,6 +166,7 @@ struct wilc { bool suspend_event; struct rf_info dummy_statistics; + bool enable_ps; }; struct wilc_wfi_mon_priv { diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 7467188..1f874d1 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -289,7 +289,6 @@ netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *dev); 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); int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids, From patchwork Tue Aug 14 06:49:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565069 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 29D291510 for ; Tue, 14 Aug 2018 06:50:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D0D4295F6 for ; Tue, 14 Aug 2018 06:50:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11378296C9; Tue, 14 Aug 2018 06:50:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F353296CA for ; Tue, 14 Aug 2018 06:50:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731767AbeHNJgR (ORCPT ); Tue, 14 Aug 2018 05:36:17 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:57878 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJgR (ORCPT ); Tue, 14 Aug 2018 05:36:17 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="15840887" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:50:29 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:50:27 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 02/24] staging: wilc1000: move 'aging_timer' static variable to wilc_priv struct Date: Tue, 14 Aug 2018 12:19:54 +0530 Message-ID: <1534229416-13254-3-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Moved 'aging_timer' to wilc_priv struct instead of having it as static variable. As 'aging_timer' is maintained for each interfaces so 'op_ifcs' check is not required before the timer_setup() and del_timer_sync() call. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 25 ++++++++++++----------- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 4727a8a..d853508 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -85,7 +85,6 @@ static const struct wiphy_wowlan_support wowlan_support = { static struct network_info last_scanned_shadow[MAX_NUM_SCANNED_NETWORKS_SHADOW]; static u32 last_scanned_cnt; struct timer_list wilc_during_ip_timer; -static struct timer_list aging_timer; static u8 op_ifcs; #define CHAN2G(_channel, _freq, _flags) { \ @@ -165,8 +164,6 @@ static void clear_shadow_scan(void) if (op_ifcs != 0) return; - del_timer_sync(&aging_timer); - for (i = 0; i < last_scanned_cnt; i++) { if (last_scanned_shadow[last_scanned_cnt].ies) { kfree(last_scanned_shadow[i].ies); @@ -245,8 +242,9 @@ static void update_scan_time(void) last_scanned_shadow[i].time_scan = jiffies; } -static void remove_network_from_shadow(struct timer_list *unused) +static void remove_network_from_shadow(struct timer_list *t) { + struct wilc_priv *priv = from_timer(priv, t, aging_timer); unsigned long now = jiffies; int i, j; @@ -266,7 +264,8 @@ static void remove_network_from_shadow(struct timer_list *unused) } if (last_scanned_cnt != 0) - mod_timer(&aging_timer, jiffies + msecs_to_jiffies(AGING_TIME)); + mod_timer(&priv->aging_timer, + jiffies + msecs_to_jiffies(AGING_TIME)); } static void clear_during_ip(struct timer_list *unused) @@ -274,13 +273,15 @@ static void clear_during_ip(struct timer_list *unused) wilc_optaining_ip = false; } -static int is_network_in_shadow(struct network_info *nw_info, void *user_void) +static int is_network_in_shadow(struct network_info *nw_info, + struct wilc_priv *priv) { int state = -1; int i; if (last_scanned_cnt == 0) { - mod_timer(&aging_timer, jiffies + msecs_to_jiffies(AGING_TIME)); + mod_timer(&priv->aging_timer, + jiffies + msecs_to_jiffies(AGING_TIME)); state = -1; } else { for (i = 0; i < last_scanned_cnt; i++) { @@ -295,9 +296,9 @@ static int is_network_in_shadow(struct network_info *nw_info, void *user_void) } static void add_network_to_shadow(struct network_info *nw_info, - void *user_void, void *join_params) + struct wilc_priv *priv, void *join_params) { - int ap_found = is_network_in_shadow(nw_info, user_void); + int ap_found = is_network_in_shadow(nw_info, priv); u32 ap_index = 0; u8 rssi_index = 0; struct network_info *shadow_nw_info; @@ -2166,10 +2167,9 @@ int wilc_init_host_int(struct net_device *net) int ret; struct wilc_priv *priv = wdev_priv(net->ieee80211_ptr); - if (op_ifcs == 0) { - timer_setup(&aging_timer, remove_network_from_shadow, 0); + timer_setup(&priv->aging_timer, remove_network_from_shadow, 0); + if (op_ifcs == 0) timer_setup(&wilc_during_ip_timer, clear_during_ip, 0); - } op_ifcs++; priv->p2p_listen_state = false; @@ -2195,6 +2195,7 @@ int wilc_deinit_host_int(struct net_device *net) mutex_destroy(&priv->scan_req_lock); ret = wilc_deinit(vif); + del_timer_sync(&priv->aging_timer); clear_shadow_scan(); if (op_ifcs == 0) del_timer_sync(&wilc_during_ip_timer); diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 8b74d61..a76b68c 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -94,7 +94,7 @@ struct wilc_priv { /* mutexes */ struct mutex scan_req_lock; bool p2p_listen_state; - + struct timer_list aging_timer; }; struct frame_reg { From patchwork Tue Aug 14 06:49:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565071 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 71CA61815 for ; Tue, 14 Aug 2018 06:50:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67A6429684 for ; Tue, 14 Aug 2018 06:50:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6594829618; Tue, 14 Aug 2018 06:50:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19A3D296AB for ; Tue, 14 Aug 2018 06:50:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731789AbeHNJgT (ORCPT ); Tue, 14 Aug 2018 05:36:19 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:41316 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJgT (ORCPT ); Tue, 14 Aug 2018 05:36:19 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="17924166" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:50:32 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:50:30 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 03/24] staging: wilc1000: fix to use correct index to free scanned info in clear_shadow_scan() Date: Tue, 14 Aug 2018 12:19:55 +0530 Message-ID: <1534229416-13254-4-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fixes to use correct index to free the allocated memory for ies information. The check was done using 'last_scanned_cnt' index and its not correct, so use the correct index ('i') to check for before freeing the allocated memory. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index d853508..ede9134 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -165,9 +165,9 @@ static void clear_shadow_scan(void) return; for (i = 0; i < last_scanned_cnt; i++) { - if (last_scanned_shadow[last_scanned_cnt].ies) { + if (last_scanned_shadow[i].ies) { kfree(last_scanned_shadow[i].ies); - last_scanned_shadow[last_scanned_cnt].ies = NULL; + last_scanned_shadow[i].ies = NULL; } kfree(last_scanned_shadow[i].join_params); From patchwork Tue Aug 14 06:49:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565073 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 56E0B17E1 for ; Tue, 14 Aug 2018 06:50:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A2DE2961F for ; Tue, 14 Aug 2018 06:50:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BD5429786; Tue, 14 Aug 2018 06:50:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA2652961F for ; Tue, 14 Aug 2018 06:50:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731795AbeHNJgX (ORCPT ); Tue, 14 Aug 2018 05:36:23 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:57882 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJgX (ORCPT ); Tue, 14 Aug 2018 05:36:23 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="15840896" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:50:36 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:50:34 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 04/24] staging: wilc1000: remove unnecessary NULL check in clear_shadow_scan() Date: Tue, 14 Aug 2018 12:19:56 +0530 Message-ID: <1534229416-13254-5-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Cleanup patch to remove the unnecessary NULL check before freeing up ies information in clear_shadow_scan(). Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index ede9134..00a167b 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -165,10 +165,8 @@ static void clear_shadow_scan(void) return; for (i = 0; i < last_scanned_cnt; i++) { - if (last_scanned_shadow[i].ies) { - kfree(last_scanned_shadow[i].ies); - last_scanned_shadow[i].ies = NULL; - } + kfree(last_scanned_shadow[i].ies); + last_scanned_shadow[i].ies = NULL; kfree(last_scanned_shadow[i].join_params); last_scanned_shadow[i].join_params = NULL; From patchwork Tue Aug 14 06:49:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565081 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 710EE1510 for ; Tue, 14 Aug 2018 06:50:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6458C29640 for ; Tue, 14 Aug 2018 06:50:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60A4F296B2; Tue, 14 Aug 2018 06:50:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 003DE296E2 for ; Tue, 14 Aug 2018 06:50:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731807AbeHNJg1 (ORCPT ); Tue, 14 Aug 2018 05:36:27 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:41320 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJg1 (ORCPT ); Tue, 14 Aug 2018 05:36:27 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="17924169" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:50:38 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:50:37 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 05/24] staging: wilc1000: moved last_scanned_shadow & last_scanned_cnt to wilc_priv struct Date: Tue, 14 Aug 2018 12:19:57 +0530 Message-ID: <1534229416-13254-6-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Avoid use of static variables and moved the varibles as part of private data. last_scanned_shadow & last_scanned_cnt variable is moved to 'wilc_priv' to maintain for each interface. After moving static variable, clear_shadow_scan() doesn't require check 'op_ifcs' count as now for each interface the againg timer is initiated. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 105 +++++++++++----------- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 + 2 files changed, 52 insertions(+), 55 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 00a167b..1eac244 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -82,8 +82,6 @@ static const struct wiphy_wowlan_support wowlan_support = { .flags = WIPHY_WOWLAN_ANY }; -static struct network_info last_scanned_shadow[MAX_NUM_SCANNED_NETWORKS_SHADOW]; -static u32 last_scanned_cnt; struct timer_list wilc_during_ip_timer; static u8 op_ifcs; @@ -157,21 +155,18 @@ static struct ieee80211_supported_band wilc_band_2ghz = { #define AGING_TIME (9 * 1000) #define DURING_IP_TIME_OUT 15000 -static void clear_shadow_scan(void) +static void clear_shadow_scan(struct wilc_priv *priv) { int i; - if (op_ifcs != 0) - return; - - for (i = 0; i < last_scanned_cnt; i++) { - kfree(last_scanned_shadow[i].ies); - last_scanned_shadow[i].ies = NULL; + for (i = 0; i < priv->scanned_cnt; i++) { + kfree(priv->scanned_shadow[i].ies); + priv->scanned_shadow[i].ies = NULL; - kfree(last_scanned_shadow[i].join_params); - last_scanned_shadow[i].join_params = NULL; + kfree(priv->scanned_shadow[i].join_params); + priv->scanned_shadow[i].join_params = NULL; } - last_scanned_cnt = 0; + priv->scanned_cnt = 0; } static u32 get_rssi_avg(struct network_info *network_info) @@ -193,14 +188,14 @@ static void refresh_scan(struct wilc_priv *priv, bool direct_scan) struct wiphy *wiphy = priv->dev->ieee80211_ptr->wiphy; int i; - for (i = 0; i < last_scanned_cnt; i++) { + for (i = 0; i < priv->scanned_cnt; i++) { struct network_info *network_info; s32 freq; struct ieee80211_channel *channel; int rssi; struct cfg80211_bss *bss; - network_info = &last_scanned_shadow[i]; + network_info = &priv->scanned_shadow[i]; if (!memcmp("DIRECT-", network_info->ssid, 7) && !direct_scan) continue; @@ -224,20 +219,20 @@ static void refresh_scan(struct wilc_priv *priv, bool direct_scan) } } -static void reset_shadow_found(void) +static void reset_shadow_found(struct wilc_priv *priv) { int i; - for (i = 0; i < last_scanned_cnt; i++) - last_scanned_shadow[i].found = 0; + for (i = 0; i < priv->scanned_cnt; i++) + priv->scanned_shadow[i].found = 0; } -static void update_scan_time(void) +static void update_scan_time(struct wilc_priv *priv) { int i; - for (i = 0; i < last_scanned_cnt; i++) - last_scanned_shadow[i].time_scan = jiffies; + for (i = 0; i < priv->scanned_cnt; i++) + priv->scanned_shadow[i].time_scan = jiffies; } static void remove_network_from_shadow(struct timer_list *t) @@ -246,22 +241,22 @@ static void remove_network_from_shadow(struct timer_list *t) unsigned long now = jiffies; int i, j; - for (i = 0; i < last_scanned_cnt; i++) { - if (!time_after(now, last_scanned_shadow[i].time_scan + + for (i = 0; i < priv->scanned_cnt; i++) { + if (!time_after(now, priv->scanned_shadow[i].time_scan + (unsigned long)(SCAN_RESULT_EXPIRE))) continue; - kfree(last_scanned_shadow[i].ies); - last_scanned_shadow[i].ies = NULL; + kfree(priv->scanned_shadow[i].ies); + priv->scanned_shadow[i].ies = NULL; - kfree(last_scanned_shadow[i].join_params); + kfree(priv->scanned_shadow[i].join_params); - for (j = i; (j < last_scanned_cnt - 1); j++) - last_scanned_shadow[j] = last_scanned_shadow[j + 1]; + for (j = i; (j < priv->scanned_cnt - 1); j++) + priv->scanned_shadow[j] = priv->scanned_shadow[j + 1]; - last_scanned_cnt--; + priv->scanned_cnt--; } - if (last_scanned_cnt != 0) + if (priv->scanned_cnt != 0) mod_timer(&priv->aging_timer, jiffies + msecs_to_jiffies(AGING_TIME)); } @@ -277,13 +272,13 @@ static int is_network_in_shadow(struct network_info *nw_info, int state = -1; int i; - if (last_scanned_cnt == 0) { + if (priv->scanned_cnt == 0) { mod_timer(&priv->aging_timer, jiffies + msecs_to_jiffies(AGING_TIME)); state = -1; } else { - for (i = 0; i < last_scanned_cnt; i++) { - if (memcmp(last_scanned_shadow[i].bssid, + for (i = 0; i < priv->scanned_cnt; i++) { + if (memcmp(priv->scanned_shadow[i].bssid, nw_info->bssid, 6) == 0) { state = i; break; @@ -301,16 +296,16 @@ static void add_network_to_shadow(struct network_info *nw_info, u8 rssi_index = 0; struct network_info *shadow_nw_info; - if (last_scanned_cnt >= MAX_NUM_SCANNED_NETWORKS_SHADOW) + if (priv->scanned_cnt >= MAX_NUM_SCANNED_NETWORKS_SHADOW) return; if (ap_found == -1) { - ap_index = last_scanned_cnt; - last_scanned_cnt++; + ap_index = priv->scanned_cnt; + priv->scanned_cnt++; } else { ap_index = ap_found; } - shadow_nw_info = &last_scanned_shadow[ap_index]; + shadow_nw_info = &priv->scanned_shadow[ap_index]; rssi_index = shadow_nw_info->rssi_history.index; shadow_nw_info->rssi_history.samples[rssi_index++] = nw_info->rssi; if (rssi_index == NUM_RSSI) { @@ -402,7 +397,7 @@ static void cfg_scan_result(enum scan_event scan_event, u32 i; for (i = 0; i < priv->rcvd_ch_cnt; i++) { - if (memcmp(last_scanned_shadow[i].bssid, + if (memcmp(priv->scanned_shadow[i].bssid, network_info->bssid, 6) == 0) break; } @@ -410,8 +405,8 @@ static void cfg_scan_result(enum scan_event scan_event, if (i >= priv->rcvd_ch_cnt) return; - last_scanned_shadow[i].rssi = network_info->rssi; - last_scanned_shadow[i].time_scan = jiffies; + priv->scanned_shadow[i].rssi = network_info->rssi; + priv->scanned_shadow[i].time_scan = jiffies; } } else if (scan_event == SCAN_EVENT_DONE) { refresh_scan(priv, false); @@ -437,7 +432,7 @@ static void cfg_scan_result(enum scan_event scan_event, .aborted = false, }; - update_scan_time(); + update_scan_time(priv); refresh_scan(priv, false); cfg80211_scan_done(priv->scan_req, &info); @@ -448,11 +443,11 @@ static void cfg_scan_result(enum scan_event scan_event, } } -static inline bool wilc_wfi_cfg_scan_time_expired(int i) +static inline bool wilc_cfg_scan_time_expired(struct wilc_priv *priv, int i) { unsigned long now = jiffies; - if (time_after(now, last_scanned_shadow[i].time_scan_cached + + if (time_after(now, priv->scanned_shadow[i].time_scan_cached + (unsigned long)(nl80211_SCAN_RESULT_EXPIRE - (1 * HZ)))) return true; else @@ -501,11 +496,11 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt, memcpy(priv->associated_bss, conn_info->bssid, ETH_ALEN); - for (i = 0; i < last_scanned_cnt; i++) { - if (memcmp(last_scanned_shadow[i].bssid, + for (i = 0; i < priv->scanned_cnt; i++) { + if (memcmp(priv->scanned_shadow[i].bssid, conn_info->bssid, ETH_ALEN) == 0) { - if (wilc_wfi_cfg_scan_time_expired(i)) + if (wilc_cfg_scan_time_expired(priv, i)) scan_refresh = true; break; @@ -619,7 +614,7 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) priv->rcvd_ch_cnt = 0; - reset_shadow_found(); + reset_shadow_found(priv); priv->cfg_scanning = true; if (request->n_channels <= MAX_NUM_SCANNED_NETWORKS) { @@ -679,18 +674,18 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, else wfi_drv->p2p_connect = 0; - for (i = 0; i < last_scanned_cnt; i++) { - if (sme->ssid_len == last_scanned_shadow[i].ssid_len && - memcmp(last_scanned_shadow[i].ssid, + for (i = 0; i < priv->scanned_cnt; i++) { + if (sme->ssid_len == priv->scanned_shadow[i].ssid_len && + memcmp(priv->scanned_shadow[i].ssid, sme->ssid, sme->ssid_len) == 0) { if (!sme->bssid) { if (sel_bssi_idx == UINT_MAX || - last_scanned_shadow[i].rssi > - last_scanned_shadow[sel_bssi_idx].rssi) + priv->scanned_shadow[i].rssi > + priv->scanned_shadow[sel_bssi_idx].rssi) sel_bssi_idx = i; } else { - if (memcmp(last_scanned_shadow[i].bssid, + if (memcmp(priv->scanned_shadow[i].bssid, sme->bssid, ETH_ALEN) == 0) { sel_bssi_idx = i; @@ -700,8 +695,8 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, } } - if (sel_bssi_idx < last_scanned_cnt) { - nw_info = &last_scanned_shadow[sel_bssi_idx]; + if (sel_bssi_idx < priv->scanned_cnt) { + nw_info = &priv->scanned_shadow[sel_bssi_idx]; } else { ret = -ENOENT; wilc_connecting = 0; @@ -2194,7 +2189,7 @@ int wilc_deinit_host_int(struct net_device *net) ret = wilc_deinit(vif); del_timer_sync(&priv->aging_timer); - clear_shadow_scan(); + clear_shadow_scan(priv); if (op_ifcs == 0) del_timer_sync(&wilc_during_ip_timer); diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index a76b68c..3767e31 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -95,6 +95,8 @@ struct wilc_priv { struct mutex scan_req_lock; bool p2p_listen_state; struct timer_list aging_timer; + struct network_info scanned_shadow[MAX_NUM_SCANNED_NETWORKS_SHADOW]; + int scanned_cnt; }; struct frame_reg { From patchwork Tue Aug 14 06:49:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565075 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 15ECA1510 for ; Tue, 14 Aug 2018 06:50:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9899929753 for ; Tue, 14 Aug 2018 06:50:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 94D81296B2; Tue, 14 Aug 2018 06:50:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C2B5529722 for ; Tue, 14 Aug 2018 06:50:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731813AbeHNJga (ORCPT ); Tue, 14 Aug 2018 05:36:30 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:57888 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJga (ORCPT ); Tue, 14 Aug 2018 05:36:30 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="15840899" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:50:42 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:50:41 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 06/24] staging: wilc1000: move during_ip_timer & wilc_optaining_ip to 'wilc_vif' struct Date: Tue, 14 Aug 2018 12:19:58 +0530 Message-ID: <1534229416-13254-7-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Move global variable 'wilc_during_ip_timer' and 'wilc_optaining_ip' to 'wilc_vif' structure. Rename these variables like below wilc_during_ip_timer -> during_ip_timer wilc_optaining_ip -> obtaining_ip. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 15 +++++++------- drivers/staging/wilc1000/host_interface.h | 2 -- drivers/staging/wilc1000/linux_wlan.c | 6 +++--- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 24 +++++++++++------------ drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 ++ 5 files changed, 24 insertions(+), 25 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 42d8acc..11eb632 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -186,7 +186,6 @@ struct join_bss_param { }; static struct host_if_drv *terminated_handle; -bool wilc_optaining_ip; static u8 p2p_listen_state; static struct workqueue_struct *hif_workqueue; static struct completion hif_driver_comp; @@ -791,7 +790,7 @@ static void handle_scan(struct work_struct *work) goto error; } - if (wilc_optaining_ip || wilc_connecting) { + if (vif->obtaining_ip || wilc_connecting) { netdev_err(vif->ndev, "Don't do obss scan\n"); result = -EBUSY; goto error; @@ -1562,8 +1561,8 @@ static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif, hif_drv->hif_state = HOST_IF_CONNECTED; - wilc_optaining_ip = true; - mod_timer(&wilc_during_ip_timer, + vif->obtaining_ip = true; + mod_timer(&vif->during_ip_timer, jiffies + msecs_to_jiffies(10000)); } else { hif_drv->hif_state = HOST_IF_IDLE; @@ -1595,7 +1594,7 @@ static inline void host_int_handle_disconnect(struct wilc_vif *vif) disconn_info.ie_len = 0; if (conn_result) { - wilc_optaining_ip = false; + vif->obtaining_ip = false; wilc_set_power_mgmt(vif, 0, 0); conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, 0, @@ -1942,7 +1941,7 @@ static void handle_disconnect(struct work_struct *work) wid.val = (s8 *)&dummy_reason_code; wid.size = sizeof(char); - wilc_optaining_ip = false; + vif->obtaining_ip = false; wilc_set_power_mgmt(vif, 0, 0); eth_zero_addr(wilc_connected_ssid); @@ -2397,7 +2396,7 @@ static int handle_remain_on_chan(struct wilc_vif *vif, goto error; } - if (wilc_optaining_ip || wilc_connecting) { + if (vif->obtaining_ip || wilc_connecting) { result = -EBUSY; goto error; } @@ -3455,7 +3454,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) break; } - wilc_optaining_ip = false; + vif->obtaining_ip = false; if (clients_count == 0) { init_completion(&hif_driver_comp); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 84866a6..d026f44 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -361,11 +361,9 @@ 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]; extern u8 wilc_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; extern int wilc_connecting; -extern struct timer_list wilc_during_ip_timer; #endif diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 57e3176..283bb74 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -48,8 +48,8 @@ static int dev_state_ev_handler(struct notifier_block *this, case NETDEV_UP: if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) { hif_drv->ifc_up = 1; - wilc_optaining_ip = false; - del_timer(&wilc_during_ip_timer); + vif->obtaining_ip = false; + del_timer(&vif->during_ip_timer); } if (vif->wilc->enable_ps) @@ -68,7 +68,7 @@ static int dev_state_ev_handler(struct notifier_block *this, case NETDEV_DOWN: if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) { hif_drv->ifc_up = 0; - wilc_optaining_ip = false; + vif->obtaining_ip = false; } if (memcmp(dev_iface->ifa_label, wlan_dev_name, 5) == 0) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 1eac244..1690890 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -82,7 +82,6 @@ static const struct wiphy_wowlan_support wowlan_support = { .flags = WIPHY_WOWLAN_ANY }; -struct timer_list wilc_during_ip_timer; static u8 op_ifcs; #define CHAN2G(_channel, _freq, _flags) { \ @@ -261,9 +260,11 @@ static void remove_network_from_shadow(struct timer_list *t) jiffies + msecs_to_jiffies(AGING_TIME)); } -static void clear_during_ip(struct timer_list *unused) +static void clear_during_ip(struct timer_list *t) { - wilc_optaining_ip = false; + struct wilc_vif *vif = from_timer(vif, t, during_ip_timer); + + vif->obtaining_ip = false; } static int is_network_in_shadow(struct network_info *nw_info, @@ -518,7 +519,7 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt, conn_info->resp_ies_len, connect_status, GFP_KERNEL); } else if (conn_disconn_evt == CONN_DISCONN_EVENT_DISCONN_NOTIF) { - wilc_optaining_ip = false; + vif->obtaining_ip = false; p2p_local_random = 0x01; p2p_recv_random = 0x00; wilc_ie = false; @@ -1743,8 +1744,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, p2p_local_random = 0x01; p2p_recv_random = 0x00; wilc_ie = false; - wilc_optaining_ip = false; - del_timer(&wilc_during_ip_timer); + vif->obtaining_ip = false; + del_timer(&vif->during_ip_timer); switch (type) { case NL80211_IFTYPE_STATION: @@ -1789,8 +1790,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, break; case NL80211_IFTYPE_P2P_GO: - wilc_optaining_ip = true; - mod_timer(&wilc_during_ip_timer, + vif->obtaining_ip = true; + mod_timer(&vif->during_ip_timer, jiffies + msecs_to_jiffies(DURING_IP_TIME_OUT)); wilc_set_operation_mode(vif, AP_MODE); dev->ieee80211_ptr->iftype = type; @@ -2159,10 +2160,10 @@ int wilc_init_host_int(struct net_device *net) { int ret; struct wilc_priv *priv = wdev_priv(net->ieee80211_ptr); + struct wilc_vif *vif = netdev_priv(priv->dev); timer_setup(&priv->aging_timer, remove_network_from_shadow, 0); - if (op_ifcs == 0) - timer_setup(&wilc_during_ip_timer, clear_during_ip, 0); + timer_setup(&vif->during_ip_timer, clear_during_ip, 0); op_ifcs++; priv->p2p_listen_state = false; @@ -2190,8 +2191,7 @@ int wilc_deinit_host_int(struct net_device *net) del_timer_sync(&priv->aging_timer); clear_shadow_scan(priv); - if (op_ifcs == 0) - del_timer_sync(&wilc_during_ip_timer); + del_timer_sync(&vif->during_ip_timer); if (ret) netdev_err(net, "Error while deinitializing host interface\n"); diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 3767e31..8e56a28 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -118,6 +118,8 @@ struct wilc_vif { struct net_device *ndev; u8 mode; u8 ifc_id; + struct timer_list during_ip_timer; + bool obtaining_ip; }; struct wilc { From patchwork Tue Aug 14 06:49:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565077 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1C0E817E1 for ; Tue, 14 Aug 2018 06:50:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FA8F296FB for ; Tue, 14 Aug 2018 06:50:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43087296E8; Tue, 14 Aug 2018 06:50:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 000B529773 for ; Tue, 14 Aug 2018 06:50:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731821AbeHNJgd (ORCPT ); Tue, 14 Aug 2018 05:36:33 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:41327 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJgd (ORCPT ); Tue, 14 Aug 2018 05:36:33 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="17924178" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:50:45 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:50:44 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 07/24] staging: wilc1000: remove unused variable 'op_ifcs' Date: Tue, 14 Aug 2018 12:19:59 +0530 Message-ID: <1534229416-13254-8-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP After code refactor in previous commit now 'op_ifcs' is not require any more, so remove it. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 1690890..3418d2d 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -82,8 +82,6 @@ static const struct wiphy_wowlan_support wowlan_support = { .flags = WIPHY_WOWLAN_ANY }; -static u8 op_ifcs; - #define CHAN2G(_channel, _freq, _flags) { \ .band = NL80211_BAND_2GHZ, \ .center_freq = (_freq), \ @@ -2164,7 +2162,6 @@ int wilc_init_host_int(struct net_device *net) timer_setup(&priv->aging_timer, remove_network_from_shadow, 0); timer_setup(&vif->during_ip_timer, clear_during_ip, 0); - op_ifcs++; priv->p2p_listen_state = false; @@ -2184,8 +2181,6 @@ int wilc_deinit_host_int(struct net_device *net) priv->p2p_listen_state = false; - op_ifcs--; - mutex_destroy(&priv->scan_req_lock); ret = wilc_deinit(vif); From patchwork Tue Aug 14 06:50:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565079 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2AA441815 for ; Tue, 14 Aug 2018 06:50:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F58F296E8 for ; Tue, 14 Aug 2018 06:50:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C3538296FA; Tue, 14 Aug 2018 06:50:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80C1F29684 for ; Tue, 14 Aug 2018 06:50:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731835AbeHNJgh (ORCPT ); Tue, 14 Aug 2018 05:36:37 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:57891 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731824AbeHNJgh (ORCPT ); Tue, 14 Aug 2018 05:36:37 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="15840900" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:50:49 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:50:47 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 08/24] staging: wilc1000: avoid use of extra 'if' condition in wilc_init() Date: Tue, 14 Aug 2018 12:20:00 +0530 Message-ID: <1534229416-13254-9-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Cleanup patch to avoid the avoid extra 'if' condition and clubbed the same condition in single 'if' block. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 11eb632..6225e67 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3459,9 +3459,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) if (clients_count == 0) { init_completion(&hif_driver_comp); mutex_init(&hif_deinit_lock); - } - if (clients_count == 0) { hif_workqueue = create_singlethread_workqueue("WILC_wq"); if (!hif_workqueue) { netdev_err(vif->ndev, "Failed to create workqueue\n"); From patchwork Tue Aug 14 06:50:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565083 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 018551510 for ; Tue, 14 Aug 2018 06:50:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8CA2296AB for ; Tue, 14 Aug 2018 06:50:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DBE82296E8; Tue, 14 Aug 2018 06:50:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA7C229618 for ; Tue, 14 Aug 2018 06:50:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731843AbeHNJgk (ORCPT ); Tue, 14 Aug 2018 05:36:40 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:41331 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731824AbeHNJgk (ORCPT ); Tue, 14 Aug 2018 05:36:40 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="17924183" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:50:52 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:50:51 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 09/24] staging: wilc1000: move static variable clients_count to 'wilc' structure Date: Tue, 14 Aug 2018 12:20:01 +0530 Message-ID: <1534229416-13254-10-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Avoid use of static variable 'clients_count' and move it part of 'wilc' structure. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 9 ++++----- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 6225e67..d930f06 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -199,7 +199,6 @@ static u8 rcv_assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE]; static u8 set_ip[2][4]; static u8 get_ip[2][4]; -static u32 clients_count; static int host_int_get_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx); @@ -3456,7 +3455,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) vif->obtaining_ip = false; - if (clients_count == 0) { + if (wilc->clients_count == 0) { init_completion(&hif_driver_comp); mutex_init(&hif_deinit_lock); @@ -3490,7 +3489,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) mutex_unlock(&hif_drv->cfg_values_lock); - clients_count++; + wilc->clients_count++; return 0; } @@ -3526,7 +3525,7 @@ int wilc_deinit(struct wilc_vif *vif) hif_drv->hif_state = HOST_IF_IDLE; - if (clients_count == 1) { + if (vif->wilc->clients_count == 1) { struct host_if_msg *msg; msg = wilc_alloc_work(vif, handle_hif_exit_work, true); @@ -3544,7 +3543,7 @@ int wilc_deinit(struct wilc_vif *vif) kfree(hif_drv); - clients_count--; + vif->wilc->clients_count--; terminated_handle = NULL; mutex_unlock(&hif_deinit_lock); return result; diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 8e56a28..8cccbbc 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -171,6 +171,7 @@ struct wilc { struct rf_info dummy_statistics; bool enable_ps; + int clients_count; }; struct wilc_wfi_mon_priv { From patchwork Tue Aug 14 06:50:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565085 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A583D1510 for ; Tue, 14 Aug 2018 06:50:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99ED8296B1 for ; Tue, 14 Aug 2018 06:50:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DF8F296E8; Tue, 14 Aug 2018 06:50:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1822329622 for ; Tue, 14 Aug 2018 06:50:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731886AbeHNJgo (ORCPT ); Tue, 14 Aug 2018 05:36:44 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:41331 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJgn (ORCPT ); Tue, 14 Aug 2018 05:36:43 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="17924187" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:50:55 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:50:54 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 10/24] staging: wilc1000: move wilc_multicast_mac_addr_list to 'wilc_vif' struct Date: Tue, 14 Aug 2018 12:20:02 +0530 Message-ID: <1534229416-13254-11-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of using 'wilc_multicast_mac_addr_list' as global variable move it part of wilc_vif struct. Rename 'wilc_multicast_mac_addr_list' variable to 'mc_mac_addr_list' as its now part of 'wilc_vif' struct. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 4 +--- drivers/staging/wilc1000/host_interface.h | 1 - drivers/staging/wilc1000/linux_wlan.c | 14 +++++++------- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 + 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index d930f06..642c314 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -193,8 +193,6 @@ static struct mutex hif_deinit_lock; static struct timer_list periodic_rssi; static struct wilc_vif *periodic_rssi_vif; -u8 wilc_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; - static u8 rcv_assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE]; static u8 set_ip[2][4]; @@ -2588,7 +2586,7 @@ static void handle_set_mcast_filter(struct work_struct *work) *cur_byte++ = ((hif_set_mc->cnt >> 24) & 0xFF); if (hif_set_mc->cnt > 0) - memcpy(cur_byte, wilc_multicast_mac_addr_list, + memcpy(cur_byte, vif->mc_mac_addr_list, ((hif_set_mc->cnt) * ETH_ALEN)); result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1, diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index d026f44..4a84dd2 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -362,7 +362,6 @@ 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 u8 wilc_connected_ssid[6]; -extern u8 wilc_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; extern int wilc_connecting; diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 283bb74..bbaa653 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -822,14 +822,14 @@ static void wilc_set_multicast_list(struct net_device *dev) } netdev_for_each_mc_addr(ha, dev) { - memcpy(wilc_multicast_mac_addr_list[i], ha->addr, ETH_ALEN); + memcpy(vif->mc_mac_addr_list[i], ha->addr, ETH_ALEN); netdev_dbg(dev, "Entry[%d]: %x:%x:%x:%x:%x:%x\n", i, - wilc_multicast_mac_addr_list[i][0], - wilc_multicast_mac_addr_list[i][1], - wilc_multicast_mac_addr_list[i][2], - wilc_multicast_mac_addr_list[i][3], - wilc_multicast_mac_addr_list[i][4], - wilc_multicast_mac_addr_list[i][5]); + vif->mc_mac_addr_list[i][0], + vif->mc_mac_addr_list[i][1], + vif->mc_mac_addr_list[i][2], + vif->mc_mac_addr_list[i][3], + vif->mc_mac_addr_list[i][4], + vif->mc_mac_addr_list[i][5]); i++; } diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 8cccbbc..ee8eda7 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -120,6 +120,7 @@ struct wilc_vif { u8 ifc_id; struct timer_list during_ip_timer; bool obtaining_ip; + u8 mc_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; }; struct wilc { From patchwork Tue Aug 14 06:50:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565087 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B5A3317E1 for ; Tue, 14 Aug 2018 06:51:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA1B929618 for ; Tue, 14 Aug 2018 06:51:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D9B6296FE; Tue, 14 Aug 2018 06:51:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03102296B1 for ; Tue, 14 Aug 2018 06:51:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731888AbeHNJgr (ORCPT ); Tue, 14 Aug 2018 05:36:47 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:57899 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJgr (ORCPT ); Tue, 14 Aug 2018 05:36:47 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="15840908" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:50:59 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:50:57 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 11/24] staging: wilc1000: move hif specific static variables to 'wilc' structure Date: Tue, 14 Aug 2018 12:20:03 +0530 Message-ID: <1534229416-13254-12-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Avoid use of static variable and move it in 'wilc' structure related to hif and added NULL before accessing hif_workqueue in wilc_enqueue_work(). Below variables are moved to 'wilc' struct: struct workqueue_struct *hif_workqueue; struct mutex hif_deinit_lock; struct completion hif_driver_comp; Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 43 ++++++++++++++------------- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 4 +++ 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 642c314..d5d81843 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -187,9 +187,6 @@ struct join_bss_param { static struct host_if_drv *terminated_handle; static u8 p2p_listen_state; -static struct workqueue_struct *hif_workqueue; -static struct completion hif_driver_comp; -static struct mutex hif_deinit_lock; static struct timer_list periodic_rssi; static struct wilc_vif *periodic_rssi_vif; @@ -225,7 +222,11 @@ wilc_alloc_work(struct wilc_vif *vif, void (*work_fun)(struct work_struct *), static int wilc_enqueue_work(struct host_if_msg *msg) { INIT_WORK(&msg->work, msg->fn); - if (!hif_workqueue || !queue_work(hif_workqueue, &msg->work)) + + if (!msg->vif || !msg->vif->wilc || !msg->vif->wilc->hif_workqueue) + return -EINVAL; + + if (!queue_work(msg->vif->wilc->hif_workqueue, &msg->work)) return -EINVAL; return 0; @@ -316,7 +317,7 @@ static void handle_set_wfi_drv_handler(struct work_struct *work) if (ret) netdev_err(vif->ndev, "Failed to set driver handler\n"); - complete(&hif_driver_comp); + complete(&vif->wilc->hif_driver_comp); kfree(buffer); free_msg: @@ -340,7 +341,7 @@ static void handle_set_operation_mode(struct work_struct *work) wilc_get_vif_idx(vif)); if (hif_op_mode->mode == IDLE_MODE) - complete(&hif_driver_comp); + complete(&vif->wilc->hif_driver_comp); if (ret) netdev_err(vif->ndev, "Failed to set operation mode\n"); @@ -3454,11 +3455,11 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) vif->obtaining_ip = false; if (wilc->clients_count == 0) { - init_completion(&hif_driver_comp); - mutex_init(&hif_deinit_lock); + init_completion(&wilc->hif_driver_comp); + mutex_init(&wilc->hif_deinit_lock); - hif_workqueue = create_singlethread_workqueue("WILC_wq"); - if (!hif_workqueue) { + wilc->hif_workqueue = create_singlethread_workqueue("WILC_wq"); + if (!wilc->hif_workqueue) { netdev_err(vif->ndev, "Failed to create workqueue\n"); kfree(hif_drv); return -ENOMEM; @@ -3502,7 +3503,7 @@ int wilc_deinit(struct wilc_vif *vif) return -EFAULT; } - mutex_lock(&hif_deinit_lock); + mutex_lock(&vif->wilc->hif_deinit_lock); terminated_handle = hif_drv; @@ -3512,7 +3513,7 @@ int wilc_deinit(struct wilc_vif *vif) del_timer_sync(&hif_drv->remain_on_ch_timer); wilc_set_wfi_drv_handler(vif, 0, 0, 0); - wait_for_completion(&hif_driver_comp); + wait_for_completion(&vif->wilc->hif_driver_comp); if (hif_drv->usr_scan_req.scan_result) { hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, NULL, @@ -3536,14 +3537,14 @@ int wilc_deinit(struct wilc_vif *vif) wait_for_completion(&msg->work_comp); kfree(msg); } - destroy_workqueue(hif_workqueue); + destroy_workqueue(vif->wilc->hif_workqueue); } kfree(hif_drv); vif->wilc->clients_count--; terminated_handle = NULL; - mutex_unlock(&hif_deinit_lock); + mutex_unlock(&vif->wilc->hif_deinit_lock); return result; } @@ -3596,7 +3597,7 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length) struct host_if_drv *hif_drv; struct wilc_vif *vif; - mutex_lock(&hif_deinit_lock); + mutex_lock(&wilc->hif_deinit_lock); id = buffer[length - 4]; id |= (buffer[length - 3] << 8); @@ -3604,26 +3605,26 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length) id |= (buffer[length - 1] << 24); vif = wilc_get_vif_from_idx(wilc, id); if (!vif) { - mutex_unlock(&hif_deinit_lock); + mutex_unlock(&wilc->hif_deinit_lock); return; } hif_drv = vif->hif_drv; if (!hif_drv || hif_drv == terminated_handle) { - mutex_unlock(&hif_deinit_lock); + mutex_unlock(&wilc->hif_deinit_lock); return; } if (!hif_drv->usr_conn_req.conn_result) { netdev_err(vif->ndev, "%s: conn_result is NULL\n", __func__); - mutex_unlock(&hif_deinit_lock); + mutex_unlock(&wilc->hif_deinit_lock); return; } msg = wilc_alloc_work(vif, handle_rcvd_gnrl_async_info, false); if (IS_ERR(msg)) { - mutex_unlock(&hif_deinit_lock); + mutex_unlock(&wilc->hif_deinit_lock); return; } @@ -3631,7 +3632,7 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length) msg->body.async_info.buffer = kmemdup(buffer, length, GFP_KERNEL); if (!msg->body.async_info.buffer) { kfree(msg); - mutex_unlock(&hif_deinit_lock); + mutex_unlock(&wilc->hif_deinit_lock); return; } @@ -3642,7 +3643,7 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length) kfree(msg); } - mutex_unlock(&hif_deinit_lock); + mutex_unlock(&wilc->hif_deinit_lock); } void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length) diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index ee8eda7..eb00e42 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -173,6 +173,10 @@ struct wilc { struct rf_info dummy_statistics; bool enable_ps; int clients_count; + struct workqueue_struct *hif_workqueue; + /* deinitialization lock */ + struct mutex hif_deinit_lock; + struct completion hif_driver_comp; }; struct wilc_wfi_mon_priv { From patchwork Tue Aug 14 06:50:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565089 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6CAA31510 for ; Tue, 14 Aug 2018 06:51:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E85829687 for ; Tue, 14 Aug 2018 06:51:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5299E296B3; Tue, 14 Aug 2018 06:51:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA3B229631 for ; Tue, 14 Aug 2018 06:51:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731891AbeHNJgu (ORCPT ); Tue, 14 Aug 2018 05:36:50 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:41341 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJgu (ORCPT ); Tue, 14 Aug 2018 05:36:50 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="17924194" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:51:02 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:51:01 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 12/24] staging: wilc1000: move static variable 'terminated_handle' to wilc_vif struct Date: Tue, 14 Aug 2018 12:20:04 +0530 Message-ID: <1534229416-13254-13-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Remove the use of static variable 'terminated_handle' and instead move in wilc_vif struct. After moving this variable to wilc_vif struct its not required to keep 'terminated_handle', so changed it to boolean type. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 11 +++++------ drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 + 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index d5d81843..f71f451f 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -185,7 +185,6 @@ struct join_bss_param { u8 start_time[4]; }; -static struct host_if_drv *terminated_handle; static u8 p2p_listen_state; static struct timer_list periodic_rssi; static struct wilc_vif *periodic_rssi_vif; @@ -3505,7 +3504,7 @@ int wilc_deinit(struct wilc_vif *vif) mutex_lock(&vif->wilc->hif_deinit_lock); - terminated_handle = hif_drv; + vif->is_termination_progress = true; del_timer_sync(&hif_drv->scan_timer); del_timer_sync(&hif_drv->connect_timer); @@ -3543,7 +3542,7 @@ int wilc_deinit(struct wilc_vif *vif) kfree(hif_drv); vif->wilc->clients_count--; - terminated_handle = NULL; + vif->is_termination_progress = false; mutex_unlock(&vif->wilc->hif_deinit_lock); return result; } @@ -3565,7 +3564,7 @@ void wilc_network_info_received(struct wilc *wilc, u8 *buffer, u32 length) return; hif_drv = vif->hif_drv; - if (!hif_drv || hif_drv == terminated_handle) { + if (!hif_drv || vif->is_termination_progress) { netdev_err(vif->ndev, "driver not init[%p]\n", hif_drv); return; } @@ -3611,7 +3610,7 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length) hif_drv = vif->hif_drv; - if (!hif_drv || hif_drv == terminated_handle) { + if (!hif_drv || vif->is_termination_progress) { mutex_unlock(&wilc->hif_deinit_lock); return; } @@ -3662,7 +3661,7 @@ void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length) return; hif_drv = vif->hif_drv; - if (!hif_drv || hif_drv == terminated_handle) + if (!hif_drv || vif->is_termination_progress) return; if (hif_drv->usr_scan_req.scan_result) { diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index eb00e42..ba606d0 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -121,6 +121,7 @@ struct wilc_vif { struct timer_list during_ip_timer; bool obtaining_ip; u8 mc_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; + bool is_termination_progress; }; struct wilc { From patchwork Tue Aug 14 06:50:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565091 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 943BF1510 for ; Tue, 14 Aug 2018 06:51:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 890CA296AD for ; Tue, 14 Aug 2018 06:51:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87A422971D; Tue, 14 Aug 2018 06:51:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 274B9296B1 for ; Tue, 14 Aug 2018 06:51:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731902AbeHNJgy (ORCPT ); Tue, 14 Aug 2018 05:36:54 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:57907 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJgx (ORCPT ); Tue, 14 Aug 2018 05:36:53 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="15840919" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:51:06 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:51:04 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 13/24] staging: wilc1000: move 'periodic_rssi' as part of 'wilc_vif' struct Date: Tue, 14 Aug 2018 12:20:05 +0530 Message-ID: <1534229416-13254-14-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Refactor code to move 'periodic_rssi' as part of wilc_vif struct.Move 'dummy_statistics' from 'wilc' struct to 'wilc_vif' to maintain for each interface separatly. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 19 ++++++++----------- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 3 ++- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index f71f451f..a440f84 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -186,8 +186,6 @@ struct join_bss_param { }; static u8 p2p_listen_state; -static struct timer_list periodic_rssi; -static struct wilc_vif *periodic_rssi_vif; static u8 rcv_assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE]; @@ -3417,9 +3415,9 @@ int wilc_hif_set_cfg(struct wilc_vif *vif, return result; } -static void get_periodic_rssi(struct timer_list *unused) +static void get_periodic_rssi(struct timer_list *t) { - struct wilc_vif *vif = periodic_rssi_vif; + struct wilc_vif *vif = from_timer(vif, t, periodic_rssi); if (!vif->hif_drv) { netdev_err(vif->ndev, "%s: hif driver is NULL", __func__); @@ -3427,9 +3425,9 @@ static void get_periodic_rssi(struct timer_list *unused) } if (vif->hif_drv->hif_state == HOST_IF_CONNECTED) - wilc_get_statistics(vif, &vif->wilc->dummy_statistics, false); + wilc_get_statistics(vif, &vif->dummy_statistics, false); - mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000)); + mod_timer(&vif->periodic_rssi, jiffies + msecs_to_jiffies(5000)); } int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) @@ -3463,12 +3461,11 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) kfree(hif_drv); return -ENOMEM; } - - periodic_rssi_vif = vif; - timer_setup(&periodic_rssi, get_periodic_rssi, 0); - mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000)); } + timer_setup(&vif->periodic_rssi, get_periodic_rssi, 0); + mod_timer(&vif->periodic_rssi, jiffies + msecs_to_jiffies(5000)); + timer_setup(&hif_drv->scan_timer, timer_scan_cb, 0); timer_setup(&hif_drv->connect_timer, timer_connect_cb, 0); timer_setup(&hif_drv->remain_on_ch_timer, listen_timer_cb, 0); @@ -3508,7 +3505,7 @@ int wilc_deinit(struct wilc_vif *vif) del_timer_sync(&hif_drv->scan_timer); del_timer_sync(&hif_drv->connect_timer); - del_timer_sync(&periodic_rssi); + del_timer_sync(&vif->periodic_rssi); del_timer_sync(&hif_drv->remain_on_ch_timer); wilc_set_wfi_drv_handler(vif, 0, 0, 0); diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index ba606d0..cdb90c3 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -122,6 +122,8 @@ struct wilc_vif { bool obtaining_ip; u8 mc_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; bool is_termination_progress; + struct timer_list periodic_rssi; + struct rf_info dummy_statistics; }; struct wilc { @@ -171,7 +173,6 @@ struct wilc { struct device *dev; bool suspend_event; - struct rf_info dummy_statistics; bool enable_ps; int clients_count; struct workqueue_struct *hif_workqueue; From patchwork Tue Aug 14 06:50:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565093 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7A4601510 for ; Tue, 14 Aug 2018 06:51:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E4AC2960A for ; Tue, 14 Aug 2018 06:51:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6281129711; Tue, 14 Aug 2018 06:51:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1821829687 for ; Tue, 14 Aug 2018 06:51:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731918AbeHNJg4 (ORCPT ); Tue, 14 Aug 2018 05:36:56 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:41347 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJg4 (ORCPT ); Tue, 14 Aug 2018 05:36:56 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="17924202" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:51:08 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:51:07 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 14/24] staging: wilc1000: rename 'dummy_statistics' variable to 'periodic_stat' Date: Tue, 14 Aug 2018 12:20:06 +0530 Message-ID: <1534229416-13254-15-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Cleanup patch to use appropriate variable name to fetch the periodic statistics. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 2 +- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index a440f84..98098fb 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3425,7 +3425,7 @@ static void get_periodic_rssi(struct timer_list *t) } if (vif->hif_drv->hif_state == HOST_IF_CONNECTED) - wilc_get_statistics(vif, &vif->dummy_statistics, false); + wilc_get_statistics(vif, &vif->periodic_stat, false); mod_timer(&vif->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 cdb90c3..c53d38f 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -123,7 +123,7 @@ struct wilc_vif { u8 mc_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; bool is_termination_progress; struct timer_list periodic_rssi; - struct rf_info dummy_statistics; + struct rf_info periodic_stat; }; struct wilc { From patchwork Tue Aug 14 06:50:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565095 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 25CF817E1 for ; Tue, 14 Aug 2018 06:51:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 199C129618 for ; Tue, 14 Aug 2018 06:51:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D96929722; Tue, 14 Aug 2018 06:51:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA90D29618 for ; Tue, 14 Aug 2018 06:51:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731936AbeHNJhA (ORCPT ); Tue, 14 Aug 2018 05:37:00 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:57916 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJhA (ORCPT ); Tue, 14 Aug 2018 05:37:00 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="15840926" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:51:12 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:51:11 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 15/24] staging: wilc1000: move 'rcv_assoc_resp' as part of hif_drv Date: Tue, 14 Aug 2018 12:20:07 +0530 Message-ID: <1534229416-13254-16-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Avoid use of static variable and move 'rcv_assoc_resp' as part of 'hif_drv' struct. Rename from 'rcv_assoc_resp' to 'assoc_resp'. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 8 +++----- drivers/staging/wilc1000/host_interface.h | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 98098fb..4c148bc 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -187,8 +187,6 @@ struct join_bss_param { static u8 p2p_listen_state; -static u8 rcv_assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE]; - static u8 set_ip[2][4]; static u8 get_ip[2][4]; @@ -1498,16 +1496,16 @@ static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif, if (mac_status == MAC_STATUS_CONNECTED) { u32 assoc_resp_info_len; - memset(rcv_assoc_resp, 0, MAX_ASSOC_RESP_FRAME_SIZE); + memset(hif_drv->assoc_resp, 0, MAX_ASSOC_RESP_FRAME_SIZE); - host_int_get_assoc_res_info(vif, rcv_assoc_resp, + host_int_get_assoc_res_info(vif, hif_drv->assoc_resp, MAX_ASSOC_RESP_FRAME_SIZE, &assoc_resp_info_len); if (assoc_resp_info_len != 0) { s32 err = 0; - err = wilc_parse_assoc_resp_info(rcv_assoc_resp, + err = wilc_parse_assoc_resp_info(hif_drv->assoc_resp, assoc_resp_info_len, &conn_info); if (err) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 4a84dd2..80cb298 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -284,6 +284,7 @@ struct host_if_drv { bool ifc_up; int driver_handler_id; + u8 assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE]; }; struct add_sta_param { From patchwork Tue Aug 14 06:50:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565097 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8B66517E1 for ; Tue, 14 Aug 2018 06:51:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F31929711 for ; Tue, 14 Aug 2018 06:51:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7383629618; Tue, 14 Aug 2018 06:51:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 176F929719 for ; Tue, 14 Aug 2018 06:51:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731937AbeHNJhE (ORCPT ); Tue, 14 Aug 2018 05:37:04 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:41351 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJhD (ORCPT ); Tue, 14 Aug 2018 05:37:03 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="17924206" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:51:15 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:51:14 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 16/24] staging: wilc1000: refactor tcp_process() to avoid extra leading tabs Date: Tue, 14 Aug 2018 12:20:08 +0530 Message-ID: <1534229416-13254-17-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Refactor tcp_process() to avoid unnecessary leading tabs in the function. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wlan.c | 52 +++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 6787b6e..bf45b4c 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -162,42 +162,46 @@ static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe) unsigned long flags; struct wilc_vif *vif = netdev_priv(dev); struct wilc *wilc = vif->wilc; + const struct iphdr *ip_hdr_ptr; + const struct tcphdr *tcp_hdr_ptr; + u32 IHL, total_length, data_offset; spin_lock_irqsave(&wilc->txq_spinlock, flags); - if (eth_hdr_ptr->h_proto == htons(ETH_P_IP)) { - const struct iphdr *ip_hdr_ptr = buffer + ETH_HLEN; + if (eth_hdr_ptr->h_proto != htons(ETH_P_IP)) + goto out; - if (ip_hdr_ptr->protocol == IPPROTO_TCP) { - const struct tcphdr *tcp_hdr_ptr; - u32 IHL, total_length, data_offset; + ip_hdr_ptr = buffer + ETH_HLEN; - IHL = ip_hdr_ptr->ihl << 2; - tcp_hdr_ptr = buffer + ETH_HLEN + IHL; - total_length = ntohs(ip_hdr_ptr->tot_len); + if (ip_hdr_ptr->protocol != IPPROTO_TCP) + goto out; - data_offset = tcp_hdr_ptr->doff << 2; - if (total_length == (IHL + data_offset)) { - u32 seq_no, ack_no; + IHL = ip_hdr_ptr->ihl << 2; + tcp_hdr_ptr = buffer + ETH_HLEN + IHL; + total_length = ntohs(ip_hdr_ptr->tot_len); - seq_no = ntohl(tcp_hdr_ptr->seq); - ack_no = ntohl(tcp_hdr_ptr->ack_seq); - for (i = 0; i < tcp_session; i++) { - u32 j = ack_session_info[i].seq_num; + data_offset = tcp_hdr_ptr->doff << 2; + if (total_length == (IHL + data_offset)) { + u32 seq_no, ack_no; - if (i < 2 * MAX_TCP_SESSION && - j == seq_no) { - update_tcp_session(i, ack_no); - break; - } - } - if (i == tcp_session) - add_tcp_session(0, 0, seq_no); + seq_no = ntohl(tcp_hdr_ptr->seq); + ack_no = ntohl(tcp_hdr_ptr->ack_seq); + for (i = 0; i < tcp_session; i++) { + u32 j = ack_session_info[i].seq_num; - add_tcp_pending_ack(ack_no, i, tqe); + if (i < 2 * MAX_TCP_SESSION && + j == seq_no) { + update_tcp_session(i, ack_no); + break; } } + if (i == tcp_session) + add_tcp_session(0, 0, seq_no); + + add_tcp_pending_ack(ack_no, i, tqe); } + +out: spin_unlock_irqrestore(&wilc->txq_spinlock, flags); } From patchwork Tue Aug 14 06:50:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565099 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 875D51510 for ; Tue, 14 Aug 2018 06:51:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BE2D2969E for ; Tue, 14 Aug 2018 06:51:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7026D296E9; Tue, 14 Aug 2018 06:51:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15CE429728 for ; Tue, 14 Aug 2018 06:51:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731767AbeHNJhH (ORCPT ); Tue, 14 Aug 2018 05:37:07 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:57924 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJhH (ORCPT ); Tue, 14 Aug 2018 05:37:07 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="15840934" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:51:19 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:51:17 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 17/24] staging: wilc1000: use lowercase for get_BSSID() and HIL variable Date: Tue, 14 Aug 2018 12:20:09 +0530 Message-ID: <1534229416-13254-18-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Cleanup patch to use lowercase name for get_BSSID() and HIL variable. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/coreconfigurator.c | 4 ++-- drivers/staging/wilc1000/wilc_wlan.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index e542067..d6d3a97 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -116,7 +116,7 @@ static inline void get_address3(u8 *msa, u8 *addr) memcpy(addr, msa + 16, 6); } -static inline void get_BSSID(u8 *data, u8 *bssid) +static inline void get_bssid(u8 *data, u8 *bssid) { if (get_from_ds(data) == 1) get_address2(data, bssid); @@ -233,7 +233,7 @@ s32 wilc_parse_network_info(u8 *msg_buffer, network_info->tsf_hi = tsf_lo | ((u64)tsf_hi << 32); get_ssid(msa, network_info->ssid, &network_info->ssid_len); - get_BSSID(msa, network_info->bssid); + get_bssid(msa, network_info->bssid); network_info->ch = get_current_channel_802_11n(msa, rx_len + FCS_LEN); diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index bf45b4c..d397c27 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -164,7 +164,7 @@ static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe) struct wilc *wilc = vif->wilc; const struct iphdr *ip_hdr_ptr; const struct tcphdr *tcp_hdr_ptr; - u32 IHL, total_length, data_offset; + u32 ihl, total_length, data_offset; spin_lock_irqsave(&wilc->txq_spinlock, flags); @@ -176,12 +176,12 @@ static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe) if (ip_hdr_ptr->protocol != IPPROTO_TCP) goto out; - IHL = ip_hdr_ptr->ihl << 2; - tcp_hdr_ptr = buffer + ETH_HLEN + IHL; + ihl = ip_hdr_ptr->ihl << 2; + tcp_hdr_ptr = buffer + ETH_HLEN + ihl; total_length = ntohs(ip_hdr_ptr->tot_len); data_offset = tcp_hdr_ptr->doff << 2; - if (total_length == (IHL + data_offset)) { + if (total_length == (ihl + data_offset)) { u32 seq_no, ack_no; seq_no = ntohl(tcp_hdr_ptr->seq); From patchwork Tue Aug 14 06:50:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565101 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 448EA17E1 for ; Tue, 14 Aug 2018 06:51:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 388CD29705 for ; Tue, 14 Aug 2018 06:51:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C62E2960A; Tue, 14 Aug 2018 06:51:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 51CDD29692 for ; Tue, 14 Aug 2018 06:51:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731938AbeHNJhK (ORCPT ); Tue, 14 Aug 2018 05:37:10 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:41357 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJhK (ORCPT ); Tue, 14 Aug 2018 05:37:10 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="17924211" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:51:21 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:51:20 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 18/24] staging: wilc1000: move tcp_ack_filter algo related variables to 'wilc_vif' struct Date: Tue, 14 Aug 2018 12:20:10 +0530 Message-ID: <1534229416-13254-19-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Avoid use of static variables and move them as part of wilc_vif struct. Move all the parameters related to tcp_ack_filter algo to wilc_vif struct. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 4 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 +- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 27 ++++++ drivers/staging/wilc1000/wilc_wlan.c | 107 +++++++++------------- drivers/staging/wilc1000/wilc_wlan.h | 2 +- 5 files changed, 77 insertions(+), 67 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 4c148bc..bffe0c8 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2068,9 +2068,9 @@ static void handle_get_statistics(struct work_struct *work) if (stats->link_speed > TCP_ACK_FILTER_LINK_SPEED_THRESH && stats->link_speed != DEFAULT_LINK_SPEED) - wilc_enable_tcp_ack_filter(true); + wilc_enable_tcp_ack_filter(vif, true); else if (stats->link_speed != DEFAULT_LINK_SPEED) - wilc_enable_tcp_ack_filter(false); + wilc_enable_tcp_ack_filter(vif, false); /* free 'msg' for async command, for sync caller will free it */ if (msg->is_sync) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 3418d2d..35a83d4 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1125,9 +1125,9 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, if (stats.link_speed > TCP_ACK_FILTER_LINK_SPEED_THRESH && stats.link_speed != DEFAULT_LINK_SPEED) - wilc_enable_tcp_ack_filter(true); + wilc_enable_tcp_ack_filter(vif, true); else if (stats.link_speed != DEFAULT_LINK_SPEED) - wilc_enable_tcp_ack_filter(false); + wilc_enable_tcp_ack_filter(vif, false); } return 0; } diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index c53d38f..54ce1ff 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -104,6 +104,32 @@ struct frame_reg { bool reg; }; +#define MAX_TCP_SESSION 25 +#define MAX_PENDING_ACKS 256 + +struct ack_session_info { + u32 seq_num; + u32 bigger_ack_num; + u16 src_port; + u16 dst_port; + u16 status; +}; + +struct pending_acks_info { + u32 ack_num; + u32 session_index; + struct txq_entry_t *txqe; +}; + +struct tcp_ack_filter { + struct ack_session_info ack_session_info[2 * MAX_TCP_SESSION]; + struct pending_acks_info pending_acks_info[MAX_PENDING_ACKS]; + u32 pending_base; + u32 tcp_session; + u32 pending_acks; + bool enabled; +}; + struct wilc_vif { u8 idx; u8 iftype; @@ -124,6 +150,7 @@ struct wilc_vif { bool is_termination_progress; struct timer_list periodic_rssi; struct rf_info periodic_stat; + struct tcp_ack_filter ack_filter; }; struct wilc { diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index d397c27..52402c3 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -93,63 +93,46 @@ static int wilc_wlan_txq_add_to_head(struct wilc_vif *vif, return 0; } -struct ack_session_info; -struct ack_session_info { - u32 seq_num; - u32 bigger_ack_num; - u16 src_port; - u16 dst_port; - u16 status; -}; - -struct pending_acks_info { - u32 ack_num; - u32 session_index; - struct txq_entry_t *txqe; -}; - #define NOT_TCP_ACK (-1) -#define MAX_TCP_SESSION 25 -#define MAX_PENDING_ACKS 256 -static struct ack_session_info ack_session_info[2 * MAX_TCP_SESSION]; -static struct pending_acks_info pending_acks_info[MAX_PENDING_ACKS]; - -static u32 pending_base; -static u32 tcp_session; -static u32 pending_acks; - -static inline int add_tcp_session(u32 src_prt, u32 dst_prt, u32 seq) +static inline int add_tcp_session(struct wilc_vif *vif, u32 src_prt, + u32 dst_prt, u32 seq) { - 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++; + struct tcp_ack_filter *f = &vif->ack_filter; + + if (f->tcp_session < 2 * MAX_TCP_SESSION) { + f->ack_session_info[f->tcp_session].seq_num = seq; + f->ack_session_info[f->tcp_session].bigger_ack_num = 0; + f->ack_session_info[f->tcp_session].src_port = src_prt; + f->ack_session_info[f->tcp_session].dst_port = dst_prt; + f->tcp_session++; } return 0; } -static inline int update_tcp_session(u32 index, u32 ack) +static inline int update_tcp_session(struct wilc_vif *vif, u32 index, u32 ack) { + struct tcp_ack_filter *f = &vif->ack_filter; + if (index < 2 * MAX_TCP_SESSION && - ack > ack_session_info[index].bigger_ack_num) - ack_session_info[index].bigger_ack_num = ack; + ack > f->ack_session_info[index].bigger_ack_num) + f->ack_session_info[index].bigger_ack_num = ack; return 0; } -static inline int add_tcp_pending_ack(u32 ack, u32 session_index, +static inline int add_tcp_pending_ack(struct wilc_vif *vif, u32 ack, + u32 session_index, struct txq_entry_t *txqe) { - u32 i = pending_base + pending_acks; + struct tcp_ack_filter *f = &vif->ack_filter; + u32 i = f->pending_base + f->pending_acks; if (i < MAX_PENDING_ACKS) { - pending_acks_info[i].ack_num = ack; - pending_acks_info[i].txqe = txqe; - pending_acks_info[i].session_index = session_index; + f->pending_acks_info[i].ack_num = ack; + f->pending_acks_info[i].txqe = txqe; + f->pending_acks_info[i].session_index = session_index; txqe->tcp_pending_ack_idx = i; - pending_acks++; + f->pending_acks++; } return 0; } @@ -162,6 +145,7 @@ static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe) unsigned long flags; struct wilc_vif *vif = netdev_priv(dev); struct wilc *wilc = vif->wilc; + struct tcp_ack_filter *f = &vif->ack_filter; const struct iphdr *ip_hdr_ptr; const struct tcphdr *tcp_hdr_ptr; u32 ihl, total_length, data_offset; @@ -186,19 +170,19 @@ static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe) seq_no = ntohl(tcp_hdr_ptr->seq); ack_no = ntohl(tcp_hdr_ptr->ack_seq); - for (i = 0; i < tcp_session; i++) { - u32 j = ack_session_info[i].seq_num; + for (i = 0; i < f->tcp_session; i++) { + u32 j = f->ack_session_info[i].seq_num; if (i < 2 * MAX_TCP_SESSION && j == seq_no) { - update_tcp_session(i, ack_no); + update_tcp_session(vif, i, ack_no); break; } } - if (i == tcp_session) - add_tcp_session(0, 0, seq_no); + if (i == f->tcp_session) + add_tcp_session(vif, 0, 0, seq_no); - add_tcp_pending_ack(ack_no, i, tqe); + add_tcp_pending_ack(vif, ack_no, i, tqe); } out: @@ -209,29 +193,30 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) { struct wilc_vif *vif = netdev_priv(dev); struct wilc *wilc = vif->wilc; + struct tcp_ack_filter *f = &vif->ack_filter; u32 i = 0; u32 dropped = 0; unsigned long flags; spin_lock_irqsave(&wilc->txq_spinlock, flags); - for (i = pending_base; i < (pending_base + pending_acks); i++) { + for (i = f->pending_base; i < (f->pending_base + f->pending_acks); i++) { u32 session_index; u32 bigger_ack_num; if (i >= MAX_PENDING_ACKS) break; - session_index = pending_acks_info[i].session_index; + session_index = f->pending_acks_info[i].session_index; if (session_index >= 2 * MAX_TCP_SESSION) break; - bigger_ack_num = ack_session_info[session_index].bigger_ack_num; + bigger_ack_num = f->ack_session_info[session_index].bigger_ack_num; - if (pending_acks_info[i].ack_num < bigger_ack_num) { + if (f->pending_acks_info[i].ack_num < bigger_ack_num) { struct txq_entry_t *tqe; - tqe = pending_acks_info[i].txqe; + tqe = f->pending_acks_info[i].txqe; if (tqe) { wilc_wlan_txq_remove(wilc, tqe); tqe->status = 1; @@ -243,13 +228,13 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) } } } - pending_acks = 0; - tcp_session = 0; + f->pending_acks = 0; + f->tcp_session = 0; - if (pending_base == 0) - pending_base = MAX_TCP_SESSION; + if (f->pending_base == 0) + f->pending_base = MAX_TCP_SESSION; else - pending_base = 0; + f->pending_base = 0; spin_unlock_irqrestore(&wilc->txq_spinlock, flags); @@ -262,11 +247,9 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) return 1; } -static bool enabled; - -void wilc_enable_tcp_ack_filter(bool value) +void wilc_enable_tcp_ack_filter(struct wilc_vif *vif, bool value) { - enabled = value; + vif->ack_filter.enabled = value; } static int wilc_wlan_txq_add_cfg_pkt(struct wilc_vif *vif, u8 *buffer, @@ -324,7 +307,7 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, tqe->priv = priv; tqe->tcp_pending_ack_idx = NOT_TCP_ACK; - if (enabled) + if (vif->ack_filter.enabled) tcp_process(dev, tqe); wilc_wlan_txq_add_to_tail(dev, tqe); return wilc->txq_entries; @@ -686,7 +669,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) tqe->tx_complete_func(tqe->priv, tqe->status); 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; + vif->ack_filter.pending_acks_info[tqe->tcp_pending_ack_idx].txqe = NULL; kfree(tqe); } while (--entries); diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 1f874d1..0fdffdd 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -282,7 +282,7 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, u32 buffer_size, wilc_tx_complete_func_t func); void wilc_chip_sleep_manually(struct wilc *wilc); -void wilc_enable_tcp_ack_filter(bool value); +void wilc_enable_tcp_ack_filter(struct wilc_vif *vif, bool value); int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc); netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *dev); From patchwork Tue Aug 14 06:50:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565103 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CEDB417E1 for ; Tue, 14 Aug 2018 06:51:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3F872970C for ; Tue, 14 Aug 2018 06:51:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8671296B1; Tue, 14 Aug 2018 06:51:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6EE392961E for ; Tue, 14 Aug 2018 06:51:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731942AbeHNJhN (ORCPT ); Tue, 14 Aug 2018 05:37:13 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:57930 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJhN (ORCPT ); Tue, 14 Aug 2018 05:37:13 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="15840938" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:51:26 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:51:24 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 19/24] staging: wilc1000: avoid line over 80 chars in wilc_wlan_txq_filter_dup_tcp_ack() Date: Tue, 14 Aug 2018 12:20:11 +0530 Message-ID: <1534229416-13254-20-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Cleanup patch to avoid line over 80 chars checkpatch issue introduced in previous code refactor commit. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wlan.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 52402c3..041c9dd 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -199,19 +199,20 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) unsigned long flags; spin_lock_irqsave(&wilc->txq_spinlock, flags); - for (i = f->pending_base; i < (f->pending_base + f->pending_acks); i++) { - u32 session_index; + i = f->pending_base; + for (; i < (f->pending_base + f->pending_acks); i++) { + u32 index; u32 bigger_ack_num; if (i >= MAX_PENDING_ACKS) break; - session_index = f->pending_acks_info[i].session_index; + index = f->pending_acks_info[i].session_index; - if (session_index >= 2 * MAX_TCP_SESSION) + if (index >= 2 * MAX_TCP_SESSION) break; - bigger_ack_num = f->ack_session_info[session_index].bigger_ack_num; + bigger_ack_num = f->ack_session_info[index].bigger_ack_num; if (f->pending_acks_info[i].ack_num < bigger_ack_num) { struct txq_entry_t *tqe; From patchwork Tue Aug 14 06:50:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565105 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0456C1510 for ; Tue, 14 Aug 2018 06:51:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDC05296FE for ; Tue, 14 Aug 2018 06:51:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB7A22972D; Tue, 14 Aug 2018 06:51:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3A6629722 for ; Tue, 14 Aug 2018 06:51:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731955AbeHNJhR (ORCPT ); Tue, 14 Aug 2018 05:37:17 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:41364 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJhQ (ORCPT ); Tue, 14 Aug 2018 05:37:16 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="17924215" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:51:28 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:51:27 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 20/24] staging: wilc1000: avoid line over 80 chars in tcp_process() Date: Tue, 14 Aug 2018 12:20:12 +0530 Message-ID: <1534229416-13254-21-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Cleanup patch to avoid line over 80 chars issue reported by checkpatch.pl script. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wlan.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 041c9dd..f0743d9 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -137,6 +137,11 @@ static inline int add_tcp_pending_ack(struct wilc_vif *vif, u32 ack, return 0; } +static inline void clear_tcp_session_txq(struct wilc_vif *vif, int index) +{ + vif->ack_filter.pending_acks_info[index].txqe = NULL; +} + static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe) { void *buffer = tqe->buffer; @@ -670,7 +675,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) tqe->tx_complete_func(tqe->priv, tqe->status); if (tqe->tcp_pending_ack_idx != NOT_TCP_ACK && tqe->tcp_pending_ack_idx < MAX_PENDING_ACKS) - vif->ack_filter.pending_acks_info[tqe->tcp_pending_ack_idx].txqe = NULL; + clear_tcp_session_txq(vif, tqe->tcp_pending_ack_idx); kfree(tqe); } while (--entries); From patchwork Tue Aug 14 06:50:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565107 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3314A1510 for ; Tue, 14 Aug 2018 06:51:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2444929618 for ; Tue, 14 Aug 2018 06:51:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18ED92971F; Tue, 14 Aug 2018 06:51:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8ACDF2970B for ; Tue, 14 Aug 2018 06:51:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731960AbeHNJhU (ORCPT ); Tue, 14 Aug 2018 05:37:20 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:57937 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJhU (ORCPT ); Tue, 14 Aug 2018 05:37:20 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="15840945" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:51:32 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:51:31 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 21/24] staging: wilc1000: remove unused code to set and get IP address Date: Tue, 14 Aug 2018 12:20:13 +0530 Message-ID: <1534229416-13254-22-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Cleanup code to remove the variables related to setting and getting IP address as this case was not handled from firmware side. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 105 ------------------------------ drivers/staging/wilc1000/host_interface.h | 3 - drivers/staging/wilc1000/linux_wlan.c | 3 - 3 files changed, 111 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index bffe0c8..f37ba64 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -187,11 +187,6 @@ struct join_bss_param { static u8 p2p_listen_state; -static u8 set_ip[2][4]; -static u8 get_ip[2][4]; - -static int host_int_get_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx); - /* 'msg' should be free by the caller for syc */ static struct host_if_msg* wilc_alloc_work(struct wilc_vif *vif, void (*work_fun)(struct work_struct *), @@ -344,64 +339,6 @@ static void handle_set_operation_mode(struct work_struct *work) kfree(msg); } -static void handle_set_ip_address(struct work_struct *work) -{ - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; - u8 *ip_addr = msg->body.ip_info.ip_addr; - u8 idx = msg->body.ip_info.idx; - int ret; - struct wid wid; - char firmware_ip_addr[4] = {0}; - - if (ip_addr[0] < 192) - ip_addr[0] = 0; - - memcpy(set_ip[idx], ip_addr, IP_ALEN); - - wid.id = WID_IP_ADDRESS; - wid.type = WID_STR; - wid.val = ip_addr; - wid.size = IP_ALEN; - - ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1, - wilc_get_vif_idx(vif)); - - host_int_get_ipaddress(vif, firmware_ip_addr, idx); - - if (ret) - netdev_err(vif->ndev, "Failed to set IP address\n"); - kfree(msg); -} - -static void handle_get_ip_address(struct work_struct *work) -{ - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; - u8 idx = msg->body.ip_info.idx; - int ret; - struct wid wid; - - wid.id = WID_IP_ADDRESS; - wid.type = WID_STR; - wid.val = kmalloc(IP_ALEN, GFP_KERNEL); - wid.size = IP_ALEN; - - ret = wilc_send_config_pkt(vif, GET_CFG, &wid, 1, - wilc_get_vif_idx(vif)); - - memcpy(get_ip[idx], wid.val, IP_ALEN); - - kfree(wid.val); - - if (memcmp(get_ip[idx], set_ip[idx], IP_ALEN) != 0) - wilc_setup_ipaddress(vif, set_ip[idx], idx); - - if (ret) - netdev_err(vif->ndev, "Failed to get IP address\n"); - kfree(msg); -} - static void handle_get_mac_address(struct work_struct *work) { struct host_if_msg *msg = container_of(work, struct host_if_msg, work); @@ -4002,48 +3939,6 @@ int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled, return result; } -int wilc_setup_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx) -{ - int result; - struct host_if_msg *msg; - - msg = wilc_alloc_work(vif, handle_set_ip_address, false); - if (IS_ERR(msg)) - return PTR_ERR(msg); - - msg->body.ip_info.ip_addr = ip_addr; - msg->body.ip_info.idx = idx; - - result = wilc_enqueue_work(msg); - if (result) { - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - kfree(msg); - } - - return result; -} - -static int host_int_get_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx) -{ - int result; - struct host_if_msg *msg; - - msg = wilc_alloc_work(vif, handle_get_ip_address, false); - if (IS_ERR(msg)) - return PTR_ERR(msg); - - msg->body.ip_info.ip_addr = ip_addr; - msg->body.ip_info.idx = idx; - - result = wilc_enqueue_work(msg); - if (result) { - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - kfree(msg); - } - - return result; -} - int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power) { int ret; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 80cb298..0f0d509 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -9,8 +9,6 @@ #include #include "coreconfigurator.h" -#define IP_ALEN 4 - #define IDLE_MODE 0x00 #define AP_MODE 0x01 #define STATION_MODE 0x02 @@ -344,7 +342,6 @@ int wilc_edit_station(struct wilc_vif *vif, int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, u32 timeout); int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled, u32 count); -int wilc_setup_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx); int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id, u32 duration, u16 chan, wilc_remain_on_chan_expired expired, diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index bbaa653..74f8166 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -61,7 +61,6 @@ static int dev_state_ev_handler(struct notifier_block *this, netdev_dbg(dev, "IP add=%d:%d:%d:%d\n", ip_addr_buf[0], ip_addr_buf[1], ip_addr_buf[2], ip_addr_buf[3]); - wilc_setup_ipaddress(vif, ip_addr_buf, vif->idx); break; @@ -83,8 +82,6 @@ static int dev_state_ev_handler(struct notifier_block *this, ip_addr_buf[0], ip_addr_buf[1], ip_addr_buf[2], ip_addr_buf[3]); - wilc_setup_ipaddress(vif, ip_addr_buf, vif->idx); - break; default: From patchwork Tue Aug 14 06:50:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565109 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 160C617E1 for ; Tue, 14 Aug 2018 06:51:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 098ED29618 for ; Tue, 14 Aug 2018 06:51:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F186429622; Tue, 14 Aug 2018 06:51:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B6CE29618 for ; Tue, 14 Aug 2018 06:51:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731974AbeHNJhX (ORCPT ); Tue, 14 Aug 2018 05:37:23 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:41367 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJhX (ORCPT ); Tue, 14 Aug 2018 05:37:23 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="17924216" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:51:35 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:51:34 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 22/24] staging: wilc1000: move 'chip_ps_state' static variable as part of 'wilc' struct Date: Tue, 14 Aug 2018 12:20:14 +0530 Message-ID: <1534229416-13254-23-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Move the static variable as part of 'wilc' priv struct. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/linux_wlan.c | 1 + drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 ++ drivers/staging/wilc1000/wilc_wlan.c | 10 ++++------ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 74f8166..4b99de2 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1062,6 +1062,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, wl->io_type = io_type; wl->hif_func = ops; wl->enable_ps = true; + wl->chip_ps_state = CHIP_WAKEDUP; INIT_LIST_HEAD(&wl->txq_head.list); INIT_LIST_HEAD(&wl->rxq_head.list); diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 54ce1ff..9d57adb 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -206,6 +206,8 @@ struct wilc { /* deinitialization lock */ struct mutex hif_deinit_lock; struct completion hif_driver_comp; + + enum chip_ps_states chip_ps_state; }; struct wilc_wfi_mon_priv { diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index f0743d9..fb8a1e4 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -9,8 +9,6 @@ #include "wilc_wfi_netdevice.h" #include "wilc_wlan_cfg.h" -static enum chip_ps_states chip_ps_state = CHIP_WAKEDUP; - static inline bool is_wilc1000(u32 id) { return ((id & 0xfffff000) == 0x100000 ? true : false); @@ -449,7 +447,7 @@ void chip_wakeup(struct wilc *wilc) } while ((clk_status_reg & 0x1) == 0); } - if (chip_ps_state == CHIP_SLEEPING_MANUAL) { + if (wilc->chip_ps_state == CHIP_SLEEPING_MANUAL) { if (wilc_get_chipid(wilc, false) < 0x1002b0) { u32 val32; @@ -462,19 +460,19 @@ void chip_wakeup(struct wilc *wilc) wilc->hif_func->hif_write_reg(wilc, 0x1e9c, val32); } } - chip_ps_state = CHIP_WAKEDUP; + wilc->chip_ps_state = CHIP_WAKEDUP; } void wilc_chip_sleep_manually(struct wilc *wilc) { - if (chip_ps_state != CHIP_WAKEDUP) + if (wilc->chip_ps_state != CHIP_WAKEDUP) return; acquire_bus(wilc, ACQUIRE_ONLY); chip_allow_sleep(wilc); wilc->hif_func->hif_write_reg(wilc, 0x10a8, 1); - chip_ps_state = CHIP_SLEEPING_MANUAL; + wilc->chip_ps_state = CHIP_SLEEPING_MANUAL; release_bus(wilc, RELEASE_ONLY); } From patchwork Tue Aug 14 06:50:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565111 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BDBE017E1 for ; Tue, 14 Aug 2018 06:51:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AFE9D29618 for ; Tue, 14 Aug 2018 06:51:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A1ED82961E; Tue, 14 Aug 2018 06:51:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32E8529618 for ; Tue, 14 Aug 2018 06:51:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731979AbeHNJh1 (ORCPT ); Tue, 14 Aug 2018 05:37:27 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:41367 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJh1 (ORCPT ); Tue, 14 Aug 2018 05:37:27 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="17924219" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:51:38 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:51:37 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 23/24] staging: wilc1000: move 'wilc_connecting' static variable to 'wilc_vif' struct Date: Tue, 14 Aug 2018 12:20:15 +0530 Message-ID: <1534229416-13254-24-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Move static variable 'wilc_connecting' as part of 'wilc_vif' private struct. Remove "wilc_" prefix from name as its already part of wilc_vif struct. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 -- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 18 ++++++++---------- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 + 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index f37ba64..d8cc08b 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -720,7 +720,7 @@ static void handle_scan(struct work_struct *work) goto error; } - if (vif->obtaining_ip || wilc_connecting) { + if (vif->obtaining_ip || vif->connecting) { netdev_err(vif->ndev, "Don't do obss scan\n"); result = -EBUSY; goto error; @@ -2326,7 +2326,7 @@ static int handle_remain_on_chan(struct wilc_vif *vif, goto error; } - if (vif->obtaining_ip || wilc_connecting) { + if (vif->obtaining_ip || vif->connecting) { result = -EBUSY; goto error; } diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 0f0d509..4048eab 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -361,6 +361,4 @@ int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power); extern u8 wilc_connected_ssid[6]; -extern int wilc_connecting; - #endif diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 35a83d4..cc44640 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -453,8 +453,6 @@ static inline bool wilc_cfg_scan_time_expired(struct wilc_priv *priv, int i) return false; } -int wilc_connecting; - static void cfg_connect_result(enum conn_event conn_disconn_evt, struct connect_info *conn_info, u8 mac_status, @@ -468,7 +466,7 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt, struct host_if_drv *wfi_drv = priv->hif_drv; u8 null_bssid[ETH_ALEN] = {0}; - wilc_connecting = 0; + vif->connecting = 0; if (conn_disconn_evt == CONN_DISCONN_EVENT_CONN_RESP) { u16 connect_status; @@ -666,7 +664,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, enum authtype auth_type = ANY; u32 cipher_group; - wilc_connecting = 1; + vif->connecting = 1; if (!(strncmp(sme->ssid, "DIRECT-", 7))) wfi_drv->p2p_connect = 1; @@ -698,7 +696,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, nw_info = &priv->scanned_shadow[sel_bssi_idx]; } else { ret = -ENOENT; - wilc_connecting = 0; + vif->connecting = 0; return ret; } @@ -741,7 +739,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, ret = -ENOTSUPP; netdev_err(dev, "%s: Unsupported cipher\n", __func__); - wilc_connecting = 0; + vif->connecting = 0; return ret; } } @@ -792,7 +790,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, if (ret != 0) { netdev_err(dev, "wilc_set_join_req(): Error\n"); ret = -ENOENT; - wilc_connecting = 0; + vif->connecting = 0; return ret; } @@ -809,7 +807,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, int ret; u8 null_bssid[ETH_ALEN] = {0}; - wilc_connecting = 0; + vif->connecting = 0; if (!wilc) return -EIO; @@ -1747,7 +1745,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, switch (type) { case NL80211_IFTYPE_STATION: - wilc_connecting = 0; + vif->connecting = 0; dev->ieee80211_ptr->iftype = type; priv->wdev->iftype = type; vif->monitor_flag = 0; @@ -1762,7 +1760,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, break; case NL80211_IFTYPE_P2P_CLIENT: - wilc_connecting = 0; + vif->connecting = 0; dev->ieee80211_ptr->iftype = type; priv->wdev->iftype = type; vif->monitor_flag = 0; diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 9d57adb..fd3e69e 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -151,6 +151,7 @@ struct wilc_vif { struct timer_list periodic_rssi; struct rf_info periodic_stat; struct tcp_ack_filter ack_filter; + int connecting; }; struct wilc { From patchwork Tue Aug 14 06:50:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565113 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EC5301510 for ; Tue, 14 Aug 2018 06:51:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEB2E29618 for ; Tue, 14 Aug 2018 06:51:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D277A2961E; Tue, 14 Aug 2018 06:51:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7ED2B29618 for ; Tue, 14 Aug 2018 06:51:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731986AbeHNJha (ORCPT ); Tue, 14 Aug 2018 05:37:30 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:57944 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJha (ORCPT ); Tue, 14 Aug 2018 05:37:30 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="15840953" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:51:42 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:51:40 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 24/24] staging: wilc1000: remove unnecessary static variable 'p2p_listen_state' Date: Tue, 14 Aug 2018 12:20:16 +0530 Message-ID: <1534229416-13254-25-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Remove the use of unnecessary static variable 'p2p_listen_state'. Already 'p2p_listen_state' is present in 'wilc_priv' struct. So making use of that variable as its getting set in channel ready and remain on channel expired callback. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index d8cc08b..cf7ead5 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -185,8 +185,6 @@ struct join_bss_param { u8 start_time[4]; }; -static u8 p2p_listen_state; - /* 'msg' should be free by the caller for syc */ static struct host_if_msg* wilc_alloc_work(struct wilc_vif *vif, void (*work_fun)(struct work_struct *), @@ -2351,7 +2349,6 @@ static int handle_remain_on_chan(struct wilc_vif *vif, netdev_err(vif->ndev, "Failed to set remain on channel\n"); error: - p2p_listen_state = 1; hif_drv->remain_on_ch_timer_vif = vif; mod_timer(&hif_drv->remain_on_ch_timer, jiffies + msecs_to_jiffies(hif_remain_ch->duration)); @@ -2407,8 +2404,9 @@ static void handle_listen_state_expired(struct work_struct *work) struct wid wid; int result; struct host_if_drv *hif_drv = vif->hif_drv; + struct wilc_priv *priv = wdev_priv(vif->ndev->ieee80211_ptr); - if (p2p_listen_state) { + if (priv->p2p_listen_state) { remain_on_chan_flag = false; wid.id = WID_REMAIN_ON_CHAN; wid.type = WID_STR; @@ -2433,7 +2431,6 @@ static void handle_listen_state_expired(struct work_struct *work) hif_drv->remain_on_ch.expired(hif_drv->remain_on_ch.arg, hif_remain_ch->id); } - p2p_listen_state = 0; } else { netdev_dbg(vif->ndev, "Not in listen state\n"); }