From patchwork Sun Dec 2 18:02: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: 10708077 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 5573D13AF for ; Sun, 2 Dec 2018 18:02:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B97A2A863 for ; Sun, 2 Dec 2018 18:02:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 197C02A868; Sun, 2 Dec 2018 18:02: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,DKIM_SIGNED, DKIM_VALID,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 AC3C82A856 for ; Sun, 2 Dec 2018 18:02:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725764AbeLBSCY (ORCPT ); Sun, 2 Dec 2018 13:02:24 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:23423 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725554AbeLBSCY (ORCPT ); Sun, 2 Dec 2018 13:02:24 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="23899229" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 Dec 2018 11:02:22 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.105) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:02:18 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=q0rEnOY9DtwesnLPxPu6UXJAeyXrjgv96d80W7VTvcg=; b=jmMMKl9Kf3AePWNtnAPa6jQgZg8QqD4UT1noaqqIfj0eG9Aq2sIVIamnEea3YO7/Me9c0GxvygFfTMj/vphC7a8+KMZkFesUYMjEx/+MwQl685ZEAjKrd9XTlvyvXgo4+jJursj/ieJ8YcjhHNnJLWBIPsITLyMw5XfA/vA4TTg= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB3334.namprd11.prod.outlook.com (20.177.185.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.19; Sun, 2 Dec 2018 18:02:17 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:02:17 +0000 From: To: CC: , , , , Subject: [PATCH 01/29] staging: wilc1000: remove unnecessary checks in wilc_mac_close() Thread-Topic: [PATCH 01/29] staging: wilc1000: remove unnecessary checks in wilc_mac_close() Thread-Index: AQHUimkppEx8r1aIkE21uh5bSl2U1w== Date: Sun, 2 Dec 2018 18:02:16 +0000 Message-ID: <1543773663-20561-2-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB3334;6:BpCFShD/ICRrBN7tog/vtp3hex4GKlOYNE7OlUZq7oX+/Ik9kValYJEnLckibDIKsgNvZZbiMXa3EbLPUdav9T5Akj5Mo/WyWNQWR8KcQh0jmNEx/UO0N8fKsP3f6r3+KPw3iKYhCs5nFqMjp6EHf/ZoBBJziWd9l2dvcPyHWK+B0QGoAvgFIONdmTVtO0TwKrajg0ScMp0crAAjSGd85ceMUNrtBgiMZrDy0URveE1flhS6Pe10HtmdP9SR0jsJYH/+2qWC+jGy7WCugMaDwLtxCb537qvabRLYPkF2voGJmtFVn7zcpxwT7s5JCutTtlPlUqLP+ApFu7oXkBwswmhHOl/pl94nfMpO8ZWdvjv1LFOk2SDWAyeC3M0U/KwZAbrbMr4dtRScqrdGYpHhtfvYp2R0oEopzu50wy0ppFAmRhbxetqzfxUhQCWrR8oTzyhCwDcI/s8DwOJUCthOoQ==;5:F29ozlHPovagFNBNM4aK5RVYxr81WHWmPAh1T/Fmtw0sMKOssKOhSJbLIM+6shJY46MQFxXYesF5ffihtEi0cwgzEHEnlQB7CVahlY2hggUpzRYUipdJKCVsqRCxILj/M/uPwj1nXRTc/Yx6TfnFD6usvqSrb+qFtLy/Pg1E2qY=;7:g6kF+SX28xeMSRfL44Igbo13+Rt4ZtWcig22Krd54vqMMu4ONIdWis1LWviwO29dLyUGHjLbwzGXY13uEiflfNCAUtsbqFz2wM6ypBMJMoPIahj313tmlAEUEjno3qplII07q1zqzRh2XoaOf9/Iaw== x-ms-office365-filtering-correlation-id: 54598fcb-3b02-4be9-261b-08d658804b78 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB3334; x-ms-traffictypediagnostic: BYAPR11MB3334: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231455)(999002)(944501491)(52105112)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB3334;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB3334; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(346002)(366004)(376002)(396003)(39850400004)(199004)(189003)(107886003)(6916009)(386003)(5660300001)(5640700003)(446003)(4326008)(11346002)(6506007)(78486014)(2906002)(6512007)(53936002)(54906003)(3846002)(6116002)(2351001)(81166006)(316002)(81156014)(52116002)(8676002)(26005)(8936002)(256004)(14444005)(76176011)(6436002)(97736004)(106356001)(99286004)(486006)(6486002)(68736007)(105586002)(14454004)(478600001)(2616005)(7736002)(66066001)(36756003)(305945005)(72206003)(186003)(2501003)(86362001)(102836004)(476003)(71190400001)(25786009)(71200400001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB3334;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: w96kFHp0JBzrnVj/ELOK4CLKDUK9ns5cfJEupm9P/+4vEo5OPAsC/E7PTF4UmA2QUeBROOj+WkpwRhjawbK1W5L/W0C00gyZY27HIbghpBRnm7tM8KvRdOhNUmN4B3VwHfmYFBklUR3lT3X2bHyGlHco0afbfbUU5LYtgRXT0SzgQWZzXtNprXOdpaVyUrVtJuz4mZIPPchigjHCMm43yotJdv6OfSws8mAvd7WA+KIJBj9ag4m/XNgCnuJFNrl/wsYxdaQRjBVis/7/ze6pSAOVoBBs482eD1v+bTEbxDIl8dY73SJ9LOUbJ7/P2QwK7VhaOmAq/2VASF78+waYOlCGHrLTqYG5/jskLLH8ny0= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 54598fcb-3b02-4be9-261b-08d658804b78 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:02:16.9190 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3334 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Remove unnecessary 'if' check in wilc_mac_close() as those conditions will not happen. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/linux_wlan.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 66fb988..c92ee79 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -896,31 +896,11 @@ netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev) static int wilc_mac_close(struct net_device *ndev) { - struct wilc_priv *priv; struct wilc_vif *vif = netdev_priv(ndev); - struct host_if_drv *hif_drv; - struct wilc *wl; - - if (!vif || !vif->ndev || !vif->ndev->ieee80211_ptr || - !vif->ndev->ieee80211_ptr->wiphy) - return 0; - - priv = wiphy_priv(vif->ndev->ieee80211_ptr->wiphy); - wl = vif->wilc; - - if (!priv) - return 0; - - hif_drv = (struct host_if_drv *)priv->hif_drv; + struct wilc *wl = vif->wilc; netdev_dbg(ndev, "Mac close\n"); - if (!wl) - return 0; - - if (!hif_drv) - return 0; - if (wl->open_ifcs > 0) wl->open_ifcs--; else From patchwork Sun Dec 2 18:02:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10708081 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 7C38113BB for ; Sun, 2 Dec 2018 18:02:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F5422A855 for ; Sun, 2 Dec 2018 18:02:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63AB12A863; Sun, 2 Dec 2018 18:02: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,DKIM_SIGNED, DKIM_VALID,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 CD76B2A85A for ; Sun, 2 Dec 2018 18:02:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725768AbeLBSCY (ORCPT ); Sun, 2 Dec 2018 13:02:24 -0500 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:40345 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725554AbeLBSCY (ORCPT ); Sun, 2 Dec 2018 13:02:24 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="21024629" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 Dec 2018 11:02:22 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.105) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:02:22 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BP1ExmvOVf/VzoNTJkAQ4s68x8jk9BGtTAZ4wLcS2FA=; b=OgNsLHcyIy1Yc52bJfalZNDrU7FJ2xrbJYKKFOxdmsVDwiaCkpK+GoXVnlXvMlkHpwEML1kqneXlDue0g9zdyhc1SqAsKudXC+igEDK89vLXpm48drT2eryhu3GQXexkBl7x8YwT8T3F3MBui9Nag7Xse6AMzuaJy5+a3huwrv4= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB3334.namprd11.prod.outlook.com (20.177.185.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.19; Sun, 2 Dec 2018 18:02:19 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:02:20 +0000 From: To: CC: , , , , Subject: [PATCH 02/29] staging: wilc1000: make use of put_unaligned_le32 in handle_set_wfi_drv_handler() Thread-Topic: [PATCH 02/29] staging: wilc1000: make use of put_unaligned_le32 in handle_set_wfi_drv_handler() Thread-Index: AQHUimkqWYkIBXXfrEiEHzq4sDr6vg== Date: Sun, 2 Dec 2018 18:02:19 +0000 Message-ID: <1543773663-20561-3-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB3334;6:BhlZV9oWmlacVq4SxbB4MUJwwDr0RSF8KJKfN1weN2D2IYByaaSTMVGZ/0eeuR3tVJLfpaB5c+G11wv9U4Edtlx3i8Fsud0/73B3Krb0d0g/QPgoAA6T0TxsenNxN8vGzDj6LyxBhhmuJT5hc82ZVap8N7wK8eDWwK/xefjbH940nFeOOHri89M1LjKtqVcr/8x3hVpP6jPobrh+ZXJOakSHpZ4soDkBCc8X4XVnrFPmbj/u715JkMBtTGMfuecB82GBVZv14EdxvYxDllHok+6WuuUYY1UgcDgtEqFphCOuY5YnOjuuQJVdmBy0/Psh7eW673AAwQapbqH5iPAt45e4rCA7KvXQmONYemQh3vZVTKNtZjqKWF95vTWYqqzanZSFuQ9NgpgLbXiD+Dx+7PoXl2XiqsKoh1FcUYIKby94/jDGc019ay46GONTmNXiE8KW8wJpQi85C9KHa6AEyA==;5:iBzOYDThdgwTO2R3+4VdSYMLH/0fP7MUQsLoQYJai38ZURJjZK3OLsVTRCmP0TENBcl79yH+L0B/QD+XpRMAz2yO2Cdk5L8S95x3WRMFgViZ4A3OTiYfjVgjfSjk68Wn1YA75Tmaxehc0FZT7/BVUMo4XSCpgMjy8bQsA1CtKXM=;7:b/5BZYbjTNfZRMsbpnfO2GD8eIfMoHn4gsFP23ZdTFWj9eo91GFoDGEBK4Nmx0t4xmoBibLhZLBEcg+dwAXEuyQ9HL0oCPGPfiXDnpeAu7sxIEgGhQ4rHP8+S20m83Qly8Rvbr00+YlR6Q5L/NXi2A== x-ms-office365-filtering-correlation-id: 1c983767-5c26-4426-c7c6-08d658804d4c x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB3334; x-ms-traffictypediagnostic: BYAPR11MB3334: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231455)(999002)(944501491)(52105112)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB3334;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB3334; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(346002)(366004)(376002)(396003)(39850400004)(199004)(189003)(107886003)(6916009)(386003)(5660300001)(5640700003)(446003)(4326008)(11346002)(6506007)(78486014)(2906002)(6512007)(53936002)(54906003)(3846002)(6116002)(2351001)(81166006)(316002)(81156014)(52116002)(8676002)(26005)(8936002)(256004)(76176011)(6436002)(97736004)(106356001)(99286004)(486006)(6486002)(68736007)(105586002)(14454004)(478600001)(2616005)(7736002)(66066001)(36756003)(305945005)(72206003)(186003)(2501003)(86362001)(575784001)(102836004)(476003)(71190400001)(25786009)(71200400001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB3334;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: +OfLM0RST4+G3d1dXnTPrAuFznSVvhqJ0ls4XUpOb1DlgVan1k122XPUNReGTzNbkiZeb0q4pzPRBwKdIZW2c+sxfksvZBlU8kzoVqIKgpD6j+DjOJbL7J3VbdmOowPl1XNJBegLVuMxJAUub+w+ZgxnwYLUWMYo37PhISF1KEeai7RyKtN0y5t04geqG97gulqwUod7O9yAxI9a6LD0oXWq0bg/OcrPjl+21/uS4Td5TDJvgd3nll+pCB6bZJZqBikGVh3Ek2iD+ax1gfNaNpKRv14mxNJIO6TppnPr3nmYXtKbt4Mb7zJSQWTYU2kXJ+MxiDSIcoZ7tRPxyh0XND6/3bHfYZTMqquVFSztkew= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 1c983767-5c26-4426-c7c6-08d658804d4c X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:02:19.8101 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3334 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Make use of put_unaligned_le32() function to pack the wid command buffer for firmware. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 10 ++-------- drivers/staging/wilc1000/host_interface.h | 1 - 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 3f3b013..e179a8e 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -289,14 +289,8 @@ static void handle_set_wfi_drv_handler(struct work_struct *work) goto free_msg; currbyte = buffer; - *currbyte = hif_drv->driver_handler_id & DRV_HANDLER_MASK; - currbyte++; - *currbyte = (u32)0 & DRV_HANDLER_MASK; - currbyte++; - *currbyte = (u32)0 & DRV_HANDLER_MASK; - currbyte++; - *currbyte = (u32)0 & DRV_HANDLER_MASK; - currbyte++; + put_unaligned_le32(hif_drv->driver_handler_id, currbyte); + currbyte += 4; *currbyte = (hif_drv_handler->name | (hif_drv_handler->mode << 1)); wid.id = WID_SET_DRV_HANDLER; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 8279345..7a71cb6 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -41,7 +41,6 @@ enum { #define WILC_ADD_STA_LENGTH 40 #define WILC_NUM_CONCURRENT_IFC 2 #define WILC_DRV_HANDLER_SIZE 5 -#define DRV_HANDLER_MASK 0x000000FF #define NUM_RSSI 5 From patchwork Sun Dec 2 18:02:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10708085 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 C48C618A7 for ; Sun, 2 Dec 2018 18:02:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3B8B2A856 for ; Sun, 2 Dec 2018 18:02:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A81DB2A868; Sun, 2 Dec 2018 18:02: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,DKIM_SIGNED, DKIM_VALID,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 EDC6B2A85E for ; Sun, 2 Dec 2018 18:02:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725774AbeLBSC0 (ORCPT ); Sun, 2 Dec 2018 13:02:26 -0500 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:62999 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725554AbeLBSC0 (ORCPT ); Sun, 2 Dec 2018 13:02:26 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="23749565" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES128-SHA; 02 Dec 2018 11:02:24 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.37) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:02:24 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vlM32ZHb4cdB0IfziKhIcKf9Km8+dLyFRTKguu49Afw=; b=gJDFsmEJ/L5Ofrd5AXiXnPOBHpYtWRCMcHhh8azxVAor8AlCrKsnxjQOCBr0hoNhNg2t6ARxRIbyoq3vBMA5ayFJbzlyV1i3YFMtviKns7FbAeV83p4+t7wxJOf/6kPpOp66i3XDewAKVqcWxX6OyYNVeKExSG1jQr6CtRsh9po= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB3334.namprd11.prod.outlook.com (20.177.185.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.19; Sun, 2 Dec 2018 18:02:22 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:02:22 +0000 From: To: CC: , , , , Subject: [PATCH 03/29] staging: wilc1000: avoid the use of the static variable to configure wiphy struct Thread-Topic: [PATCH 03/29] staging: wilc1000: avoid the use of the static variable to configure wiphy struct Thread-Index: AQHUimksOLpIYfb32E+AYQewZHPHlA== Date: Sun, 2 Dec 2018 18:02:22 +0000 Message-ID: <1543773663-20561-4-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB3334;6:Fy7qKLqzW+/9Cfcl5dkS9TRXZHTa8ZXU3vk7lK7alv79nJm1KiP5yHa6ugHK0K2GSnhB1gDq1dudI+aQiGFiI27/1GV7LnYqvJHWYZ3FsfxS7pRgWVH7MNjelz1wE6HDuwo85vTDkLiYeuVYmjYZ5aXEGKaCrBI8b732igiXtoPtygl59Wel9Fe9kw1kXGSQfwb6RnICYsaoj0k842jHC+ku81Duk0QuxM6STn24jGYFqebXMBkvs+v6xCgGwHTvYg99GEbs3x6CZVy3e48PVhxub/Cw2YCfRIsofQyF1IJakSCqIjRhpWp00hzacwTJV3SruVLqq0WoNFzeP7NaTk3p0PYPklTZaxy1/5u1JUYdulKkbxmDGXgyvrAoPIkayHms1OzYbhgwOhFFio/zLSAjsMQ9b7ssjtihpibUMNWGggGBtewe0J9BYoGsEf2tDTVMUx4Cutp7G+/RjQql5A==;5:ceBcXVsJE/TeVjbvXsFNul8AhjFyiCG2jhiTQL4LHmMuZLA3qGvPqFBLMYNIcCfetfn5XVvSC8VKNMUxHI2hgNksDKPDIF54JXQHlzxv37jut1fdkyxAhNzdJUUbLGc0w6g21thYaXE1AeTzNamaMPM9fsveCZOTpyG+wZ44FXs=;7:44t/HvI2lF43NwayF27b/B2Yhx+ydAu0YPbfysMZCiNBPikJgIHtnS8K6vgzE2sj6zBIR+Te/E6nQKHYrp9uozT8ZY3GEsItQqQMjkh66GLpc8f83BOG81QKOLLjmfrNevER0p9HfBYqLLtkgkhEVw== x-ms-office365-filtering-correlation-id: cf2b1df7-4b5d-44cb-b82a-08d658804f02 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB3334; x-ms-traffictypediagnostic: BYAPR11MB3334: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231455)(999002)(944501491)(52105112)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB3334;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB3334; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(346002)(366004)(376002)(396003)(39850400004)(199004)(189003)(107886003)(6916009)(386003)(5660300001)(5640700003)(446003)(4326008)(11346002)(6506007)(78486014)(2906002)(6512007)(53936002)(54906003)(3846002)(6116002)(2351001)(81166006)(316002)(81156014)(52116002)(8676002)(26005)(8936002)(256004)(14444005)(76176011)(6436002)(97736004)(106356001)(99286004)(486006)(6486002)(68736007)(105586002)(14454004)(478600001)(2616005)(7736002)(66066001)(36756003)(305945005)(72206003)(186003)(2501003)(86362001)(102836004)(476003)(71190400001)(25786009)(71200400001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB3334;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: KPxmS90EL/mFVAuc4ng2EsKgMYrwnF6PqFLS9/oHt3BnEYeJL3iFw/O2qrASAg12x2w0mcOabtCqMTnbhnEtK/HvXh6zGWVuRxsyyz5st+8mKd/qhxmv5ipiC1eyY9f22iULZeJU8Ucti5XFy27yEw4Lbn7/pSsvI27qm5Nql4Xd0Wce2jsw74Rbxy+zEBImRQcALEqWRSRL4s/tAtySLQcWfBxUycn7ja4az8M8e4lLIOA75eviig7kOkdBcL5JYrYfjiExPICGtM5DGj2wLKOF4rNw3kJkydJhYOa5eq8tMwNWSfUZ0JoxZXCICcDbP+j62J2hkUD5sd+c/qxvj97gmE+fGIf/HE5q9KKRlH4= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: cf2b1df7-4b5d-44cb-b82a-08d658804f02 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:02:22.7482 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3334 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Refactor code to avoid the use of static variables to configure the 'wiphy' structure. Now move static variables as part of 'priv' data so it helped to maintain this information per interface. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 92 +++++------------------ drivers/staging/wilc1000/wilc_wfi_netdevice.h | 60 +++++++++++++++ 2 files changed, 80 insertions(+), 72 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 1dec6bb..69b181f 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -32,14 +32,6 @@ #define nl80211_SCAN_RESULT_EXPIRE (3 * HZ) #define SCAN_RESULT_EXPIRE (40 * HZ) -static const u32 cipher_suites[] = { - WLAN_CIPHER_SUITE_WEP40, - WLAN_CIPHER_SUITE_WEP104, - WLAN_CIPHER_SUITE_TKIP, - WLAN_CIPHER_SUITE_CCMP, - WLAN_CIPHER_SUITE_AES_CMAC, -}; - static const struct ieee80211_txrx_stypes wilc_wfi_cfg80211_mgmt_types[NUM_NL80211_IFTYPES] = { [NL80211_IFTYPE_STATION] = { @@ -73,53 +65,6 @@ static const struct wiphy_wowlan_support wowlan_support = { .flags = WIPHY_WOWLAN_ANY }; -#define CHAN2G(_channel, _freq, _flags) { \ - .band = NL80211_BAND_2GHZ, \ - .center_freq = (_freq), \ - .hw_value = (_channel), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 30, \ -} - -static struct ieee80211_channel ieee80211_2ghz_channels[] = { - CHAN2G(1, 2412, 0), - CHAN2G(2, 2417, 0), - CHAN2G(3, 2422, 0), - CHAN2G(4, 2427, 0), - CHAN2G(5, 2432, 0), - CHAN2G(6, 2437, 0), - CHAN2G(7, 2442, 0), - CHAN2G(8, 2447, 0), - CHAN2G(9, 2452, 0), - CHAN2G(10, 2457, 0), - CHAN2G(11, 2462, 0), - CHAN2G(12, 2467, 0), - CHAN2G(13, 2472, 0), - CHAN2G(14, 2484, 0), -}; - -#define RATETAB_ENT(_rate, _hw_value, _flags) { \ - .bitrate = (_rate), \ - .hw_value = (_hw_value), \ - .flags = (_flags), \ -} - -static struct ieee80211_rate ieee80211_bitrates[] = { - RATETAB_ENT(10, 0, 0), - RATETAB_ENT(20, 1, 0), - RATETAB_ENT(55, 2, 0), - RATETAB_ENT(110, 3, 0), - RATETAB_ENT(60, 9, 0), - RATETAB_ENT(90, 6, 0), - RATETAB_ENT(120, 7, 0), - RATETAB_ENT(180, 8, 0), - RATETAB_ENT(240, 9, 0), - RATETAB_ENT(360, 10, 0), - RATETAB_ENT(480, 11, 0), - RATETAB_ENT(540, 12, 0), -}; - struct p2p_mgmt_data { int size; u8 *buff; @@ -130,13 +75,6 @@ static u8 curr_channel; static u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09}; static u8 p2p_vendor_spec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03}; -static struct ieee80211_supported_band wilc_band_2ghz = { - .channels = ieee80211_2ghz_channels, - .n_channels = ARRAY_SIZE(ieee80211_2ghz_channels), - .bitrates = ieee80211_bitrates, - .n_bitrates = ARRAY_SIZE(ieee80211_bitrates), -}; - #define AGING_TIME (9 * 1000) #define DURING_IP_TIME_OUT 15000 @@ -2110,14 +2048,6 @@ static struct wireless_dev *wilc_wfi_cfg_alloc(void) if (!wdev->wiphy) goto free_mem; - wilc_band_2ghz.ht_cap.ht_supported = 1; - wilc_band_2ghz.ht_cap.cap |= (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT); - wilc_band_2ghz.ht_cap.mcs.rx_mask[0] = 0xff; - wilc_band_2ghz.ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_8K; - wilc_band_2ghz.ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE; - - wdev->wiphy->bands[NL80211_BAND_2GHZ] = &wilc_band_2ghz; - return wdev; free_mem: @@ -2141,6 +2071,22 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, priv = wdev_priv(wdev); priv->wdev = wdev; + + memcpy(priv->bitrates, wilc_bitrates, sizeof(wilc_bitrates)); + memcpy(priv->channels, wilc_2ghz_channels, sizeof(wilc_2ghz_channels)); + priv->band.bitrates = priv->bitrates; + priv->band.n_bitrates = ARRAY_SIZE(priv->bitrates); + priv->band.channels = priv->channels; + priv->band.n_channels = ARRAY_SIZE(wilc_2ghz_channels); + + priv->band.ht_cap.ht_supported = 1; + priv->band.ht_cap.cap |= (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT); + priv->band.ht_cap.mcs.rx_mask[0] = 0xff; + priv->band.ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_8K; + priv->band.ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE; + + wdev->wiphy->bands[NL80211_BAND_2GHZ] = &priv->band; + wdev->wiphy->max_scan_ssids = WILC_MAX_NUM_PROBED_SSID; #ifdef CONFIG_PM wdev->wiphy->wowlan = &wowlan_support; @@ -2148,8 +2094,10 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, wdev->wiphy->max_num_pmkids = WILC_MAX_NUM_PMKIDS; wdev->wiphy->max_scan_ie_len = 1000; wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; - wdev->wiphy->cipher_suites = cipher_suites; - wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); + memcpy(priv->cipher_suites, wilc_cipher_suites, + sizeof(wilc_cipher_suites)); + wdev->wiphy->cipher_suites = priv->cipher_suites; + wdev->wiphy->n_cipher_suites = ARRAY_SIZE(wilc_cipher_suites); wdev->wiphy->mgmt_stypes = wilc_wfi_cfg80211_mgmt_types; wdev->wiphy->max_remain_on_channel_duration = 500; diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index c6dad12..e71d949 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -74,6 +74,61 @@ struct wilc_p2p_var { bool is_wilc_ie; }; +static const u32 wilc_cipher_suites[] = { + WLAN_CIPHER_SUITE_WEP40, + WLAN_CIPHER_SUITE_WEP104, + WLAN_CIPHER_SUITE_TKIP, + WLAN_CIPHER_SUITE_CCMP, + WLAN_CIPHER_SUITE_AES_CMAC +}; + +#define CHAN2G(_channel, _freq, _flags) { \ + .band = NL80211_BAND_2GHZ, \ + .center_freq = (_freq), \ + .hw_value = (_channel), \ + .flags = (_flags), \ + .max_antenna_gain = 0, \ + .max_power = 30, \ +} + +static const struct ieee80211_channel wilc_2ghz_channels[] = { + CHAN2G(1, 2412, 0), + CHAN2G(2, 2417, 0), + CHAN2G(3, 2422, 0), + CHAN2G(4, 2427, 0), + CHAN2G(5, 2432, 0), + CHAN2G(6, 2437, 0), + CHAN2G(7, 2442, 0), + CHAN2G(8, 2447, 0), + CHAN2G(9, 2452, 0), + CHAN2G(10, 2457, 0), + CHAN2G(11, 2462, 0), + CHAN2G(12, 2467, 0), + CHAN2G(13, 2472, 0), + CHAN2G(14, 2484, 0) +}; + +#define RATETAB_ENT(_rate, _hw_value, _flags) { \ + .bitrate = (_rate), \ + .hw_value = (_hw_value), \ + .flags = (_flags), \ +} + +static struct ieee80211_rate wilc_bitrates[] = { + RATETAB_ENT(10, 0, 0), + RATETAB_ENT(20, 1, 0), + RATETAB_ENT(55, 2, 0), + RATETAB_ENT(110, 3, 0), + RATETAB_ENT(60, 9, 0), + RATETAB_ENT(90, 6, 0), + RATETAB_ENT(120, 7, 0), + RATETAB_ENT(180, 8, 0), + RATETAB_ENT(240, 9, 0), + RATETAB_ENT(360, 10, 0), + RATETAB_ENT(480, 11, 0), + RATETAB_ENT(540, 12, 0) +}; + struct wilc_priv { struct wireless_dev *wdev; struct cfg80211_scan_request *scan_req; @@ -104,6 +159,11 @@ struct wilc_priv { struct network_info scanned_shadow[MAX_NUM_SCANNED_NETWORKS_SHADOW]; int scanned_cnt; struct wilc_p2p_var p2p; + + struct ieee80211_channel channels[ARRAY_SIZE(wilc_2ghz_channels)]; + struct ieee80211_rate bitrates[ARRAY_SIZE(wilc_bitrates)]; + struct ieee80211_supported_band band; + u32 cipher_suites[ARRAY_SIZE(wilc_cipher_suites)]; }; struct frame_reg { From patchwork Sun Dec 2 18:02:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10708083 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 A77671932 for ; Sun, 2 Dec 2018 18:02:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 984352A856 for ; Sun, 2 Dec 2018 18:02:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D2772A85A; Sun, 2 Dec 2018 18:02: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,DKIM_SIGNED, DKIM_VALID,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 1ABD92A856 for ; Sun, 2 Dec 2018 18:02:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725777AbeLBSCb (ORCPT ); Sun, 2 Dec 2018 13:02:31 -0500 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:52831 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbeLBSCa (ORCPT ); Sun, 2 Dec 2018 13:02:30 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="23451081" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 Dec 2018 11:02:27 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.108) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:02:27 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=njCKqgmGUQmx+6uZ8txvzbXOEy68fYV4ZtQRAVV/QDY=; b=vCZAzjyjQ+K2Mi01n8JCDzLnOdQtpp5WeTPFLDt07+F0QdPD2Zl/IC5z+wC7QeH0qHShnRV5XaBP2J+TeWLAtNrzfLTvv8lkBskgXRkcnI55LDS2ETSRHfMuN5WxXMmupuPQ67rbHP6vfGMEqVm+kwzE7xK075iT41bC5j+fn+A= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB3334.namprd11.prod.outlook.com (20.177.185.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.19; Sun, 2 Dec 2018 18:02:25 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:02:25 +0000 From: To: CC: , , , , Subject: [PATCH 04/29] staging: wilc1000: use mutex lock to synchronized sending 'wid' cmd to firmware Thread-Topic: [PATCH 04/29] staging: wilc1000: use mutex lock to synchronized sending 'wid' cmd to firmware Thread-Index: AQHUimkuJ+UGe/H8iEeaWt7U24vD6Q== Date: Sun, 2 Dec 2018 18:02:25 +0000 Message-ID: <1543773663-20561-5-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB3334;6:GUUcwXRE1qx8+HTEWeQLIuI96Abwk0RXvZEZYVm7ONHjg0c3X+Gaqn5vRoN+lyEiwJuivbFDxW1kkRcjq58ja8D+YBVQj2Fin610V1B+cunbLREU6+Geb1vZPkX89D3nFBRQVPr0VUpDkJ4xtZDKXW4Qlc4j4scDqNYCdIVgfL9wnQhlU7ctUhAdnO/tMqCJcbxp5RRnLkNMI3hT2FTmIOXes2Y3jcJkrm+yFKzioHEUGYiJLuYHlT3Z2oYuAp+sswkFvpZXlxi3DroEc2avlxj6JOZfRde2OGLK+cSH6LWFjCn80Z7kkBy5wb1IcygtZiV3sFTYLH3Y7C7f+R2r5x0Ffjkf9OOCdHOdJ9ZwR2479mtwDVV7GQasSFdQUJbJKCk9hSp0jFQ9zenfraT//Kb79gkp1LmnR8SO45yvZc/Bvfn/6LQjasx7HbJRJotrX0jwJRcISNRDW9967dNkkw==;5:YAFpaTNGRfuiT1VZgrd4NTUYcLF2r5fYYA2r4t0r69EOVwT4DrlcAX0d1ZkJ7LDmZkcGzmpH2RH2Le2HRPpocDJfanW8ccyI2Gm1xBLzDT2ii+j3as/UUKn4h1wR2cQ5UD6+0n3x5PrXp/1olUaFuA72D2DTs1gS8PHxotOrgkk=;7:/Nz40RA2kcE+rEx9ldrBeZrtwYz9zHaNBg+3lmbGsXJ0P3ZGqkU4e0ojVz3RaxUUfO2Jdv2P4CcLF3QWZz/RoGKPjL1xFxIqE7IEoZeKjvH17SiP1uCmTJPNqHSRpU+d5VDZ/VtTkumX+1ZU79iVwA== x-ms-office365-filtering-correlation-id: 6b210567-c120-48b2-f08f-08d6588050b1 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB3334; x-ms-traffictypediagnostic: BYAPR11MB3334: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231455)(999002)(944501491)(52105112)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB3334;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB3334; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(346002)(366004)(376002)(396003)(39850400004)(199004)(189003)(107886003)(6916009)(386003)(5660300001)(5640700003)(446003)(4326008)(11346002)(6506007)(78486014)(2906002)(6512007)(53936002)(54906003)(3846002)(6116002)(2351001)(81166006)(316002)(81156014)(52116002)(8676002)(26005)(8936002)(256004)(14444005)(76176011)(6436002)(97736004)(106356001)(99286004)(486006)(6486002)(68736007)(105586002)(14454004)(478600001)(2616005)(7736002)(66066001)(36756003)(305945005)(72206003)(186003)(2501003)(86362001)(575784001)(102836004)(476003)(71190400001)(25786009)(71200400001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB3334;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: vUDyjf8ZayDnCtPJnEMdUrjLvOSyWcJlYncUf0CaZKQND5NVB4CowOm4sALhMsO1qxuM6EIDcgbA2kCkGob968h13GJjDRTQtpUydfz/qq5kC7MHAl/WVVHydAc0mIOOvvEqiGTEBM1qFz1euLObVxiFqr5Goj8T8fQCjxbkHN+ogVMb5QgjumaqVrgvMg87ZTSu1b4SpFtMXZgbO3HZWZC8QRIJN6lcArJ+4Hh7TErhdgjatCSQC5enDogUbHVu+8WtqOTSQ+6PkVnMqvAdawAsn1lH2x2WydHPIRq+3zBOQdeGNS1ysvRDjl/3jHqMX5bpcDCzTquFHXAZtC0jqnEOALNhk+M5hrWGdKFhz84= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 6b210567-c120-48b2-f08f-08d6588050b1 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:02:25.5272 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3334 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Use mutex lock to protect the issuing of wid cmd to the firmware. Currently the wid commands are synchronized by use of hif_workqueue work queue. Now, these changes are required to synchronize the access to wid command, so the commands can be issued directly from cfg80211 context and 'WILC_wq' thread. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/linux_wlan.c | 2 ++ drivers/staging/wilc1000/wilc_wfi_netdevice.h | 3 ++- drivers/staging/wilc1000/wilc_wlan.c | 21 ++++++++++----------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index c92ee79..e246d18 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -531,6 +531,7 @@ static void wlan_deinit_locks(struct net_device *dev) mutex_destroy(&wilc->hif_cs); mutex_destroy(&wilc->rxq_cs); + mutex_destroy(&wilc->cfg_cmd_lock); mutex_destroy(&wilc->txq_add_to_head_cs); } @@ -592,6 +593,7 @@ static void wlan_init_locks(struct net_device *dev) mutex_init(&wl->hif_cs); mutex_init(&wl->rxq_cs); + mutex_init(&wl->cfg_cmd_lock); spin_lock_init(&wl->txq_spinlock); mutex_init(&wl->txq_add_to_head_cs); diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index e71d949..02970c3 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -247,7 +247,8 @@ struct wilc { struct task_struct *txq_thread; int quit; - int cfg_frame_in_use; + /* lock to protect issue of wid command to firmware */ + struct mutex cfg_cmd_lock; struct wilc_cfg_frame cfg_frame; u32 cfg_frame_offset; int cfg_seq_no; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index f0b10e2..3c5e9e0 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1122,8 +1122,7 @@ int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, u16 wid, u8 *buffer, int ret_size; struct wilc *wilc = vif->wilc; - if (wilc->cfg_frame_in_use) - return 0; + mutex_lock(&wilc->cfg_cmd_lock); if (start) wilc->cfg_frame_offset = 0; @@ -1134,11 +1133,12 @@ int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, u16 wid, u8 *buffer, offset += ret_size; wilc->cfg_frame_offset = offset; - if (!commit) + if (!commit) { + mutex_unlock(&wilc->cfg_cmd_lock); return ret_size; + } netdev_dbg(vif->ndev, "%s: seqno[%d]\n", __func__, wilc->cfg_seq_no); - wilc->cfg_frame_in_use = 1; if (wilc_wlan_cfg_commit(vif, WILC_CFG_SET, drv_handler)) ret_size = 0; @@ -1149,9 +1149,9 @@ int wilc_wlan_cfg_set(struct wilc_vif *vif, int start, u16 wid, u8 *buffer, ret_size = 0; } - wilc->cfg_frame_in_use = 0; wilc->cfg_frame_offset = 0; wilc->cfg_seq_no += 1; + mutex_unlock(&wilc->cfg_cmd_lock); return ret_size; } @@ -1163,8 +1163,7 @@ int wilc_wlan_cfg_get(struct wilc_vif *vif, int start, u16 wid, int commit, int ret_size; struct wilc *wilc = vif->wilc; - if (wilc->cfg_frame_in_use) - return 0; + mutex_lock(&wilc->cfg_cmd_lock); if (start) wilc->cfg_frame_offset = 0; @@ -1174,10 +1173,10 @@ int wilc_wlan_cfg_get(struct wilc_vif *vif, int start, u16 wid, int commit, offset += ret_size; wilc->cfg_frame_offset = offset; - if (!commit) + if (!commit) { + mutex_unlock(&wilc->cfg_cmd_lock); return ret_size; - - wilc->cfg_frame_in_use = 1; + } if (wilc_wlan_cfg_commit(vif, WILC_CFG_QUERY, drv_handler)) ret_size = 0; @@ -1187,9 +1186,9 @@ int wilc_wlan_cfg_get(struct wilc_vif *vif, int start, u16 wid, int commit, netdev_dbg(vif->ndev, "%s: Timed Out\n", __func__); ret_size = 0; } - wilc->cfg_frame_in_use = 0; wilc->cfg_frame_offset = 0; wilc->cfg_seq_no += 1; + mutex_unlock(&wilc->cfg_cmd_lock); return ret_size; } From patchwork Sun Dec 2 18:02:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10708087 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 DEA9D5C90 for ; Sun, 2 Dec 2018 18:02:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDDB52A855 for ; Sun, 2 Dec 2018 18:02:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C259E2A85E; Sun, 2 Dec 2018 18:02: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,DKIM_SIGNED, DKIM_VALID,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 3C96A2A862 for ; Sun, 2 Dec 2018 18:02:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725780AbeLBSCd (ORCPT ); Sun, 2 Dec 2018 13:02:33 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:23435 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbeLBSCc (ORCPT ); Sun, 2 Dec 2018 13:02:32 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="23899242" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 Dec 2018 11:02:30 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.108) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:02:30 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=v0r6edAlUbQT4ka5eHUVWJFCCsGTXJ7BrR0gqPRhb80=; b=y6n/6fyhcOMeShDmWMRlSn+/qbigwmGV0M/E5AE1bBd0/TneMMMZG65Pqhc39+vUJnB09KkBXuGe8DRxau940okPEws9iM47QoqfoTN0r08ml4xVrA3BpyiUrpFgrIpH6Kk1iZOdTMvDaYuQ2PUahGo33imJNNBwi2TOC0am5nA= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB3334.namprd11.prod.outlook.com (20.177.185.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.19; Sun, 2 Dec 2018 18:02:28 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:02:28 +0000 From: To: CC: , , , , Subject: [PATCH 05/29] staging: wilc1000: handle tx power related callback from cfg80211 context Thread-Topic: [PATCH 05/29] staging: wilc1000: handle tx power related callback from cfg80211 context Thread-Index: AQHUimkwoshV31LXWEqXoDquSCWAwA== Date: Sun, 2 Dec 2018 18:02:28 +0000 Message-ID: <1543773663-20561-6-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB3334;6:2voDG+aPfGW/AccEJe1l5HiyBL9w94hMrGdAUIfqLvC8hFhb1nLpLafv8m3VIv9aR6s59NzTYOx7unRncGZj4CR7J/i0ercYljqyeKK52BalCmvVgE4R6dmcuHDX9Xp2NQeQoDpacaZm6SAkm+tMiw6pRfcK5vGUIMcrW08ToW0c1n9ossbCkMRryKEswnyyc9mWhf7M0w8Oqs5SrVq+TJVr7kkPmPkkDOG6FqhjCPJNlOKIyzG98FhWgLHxNXkTvJaQ58EEkCwzwH/wa4r6oHDnxYE2VICfHx3SATK9x0K40Cl7lZHBtP5dWi+v9lIc1upt3/m47e6TOWajG+RTAZjU4P1myWQ2MardzzE0ED56K2Zpxh5nt4qNYBL7nlBOXWAwa1xJI5Y9Nl89pFg/TOSGaIwM/tRES4HAUDu/kUWVZOgGlwl4ZJA7TGm2yf/0t9ADjz4y+60h5td7dvAiFg==;5:m3NNz/5Lx6ofhjqc7+qh1/tv3aru+9KFXrARUqADHxqOi93AEPPGU7cI4QqcLhh35ulPKDseMpLsNinfYgMlB4QCmh24rGzebBfK6Mm9QUJXQXjjn2dkXk/o5cVlIERGH6Boao/ttY6iiwd3th6DBwtNLhowvFXYMiF4tSqJ6RY=;7:1Jppf4Y4EIplbTxRMCc2Lav/9tT+KUROEM0qWQfam6xkPVkHaaSdLdlWng0M8om/1lG2F4c5vnFHR2tgUtSrQ+MPeE8jekn/bonGiZ79XV29DR7i7M4UtvwurtcfQlo4qIRWH6wpZZIG5P8/5Sd//A== x-ms-office365-filtering-correlation-id: ff4cf538-43ae-4b8f-5c64-08d65880526f x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB3334; x-ms-traffictypediagnostic: BYAPR11MB3334: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231455)(999002)(944501491)(52105112)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB3334;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB3334; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(346002)(366004)(376002)(396003)(39850400004)(199004)(189003)(107886003)(6916009)(386003)(5660300001)(5640700003)(446003)(4326008)(11346002)(6506007)(78486014)(2906002)(6512007)(53936002)(54906003)(3846002)(6116002)(2351001)(81166006)(316002)(81156014)(52116002)(8676002)(26005)(8936002)(256004)(76176011)(6436002)(97736004)(106356001)(99286004)(486006)(6486002)(68736007)(105586002)(14454004)(478600001)(2616005)(7736002)(66066001)(36756003)(305945005)(72206003)(186003)(2501003)(86362001)(102836004)(476003)(71190400001)(25786009)(71200400001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB3334;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: qjG5RKsowgVQ5hfynZ+4OYRDN230ZkuFsAYiqQN4/uh1n29azMxmhGkeUOHD0gSb1/4Mqh1uhyel8aNpk73HSnu108he4dHqdpkgUny2KLa32rxnDEcMkOjHFQoFRK9+AAfM9gJmXgPyKFSkS+DznmTaqZwgRQHR4A0k8f4Zf4nWTv8+9FGNjqjOOosWp/xFcJa0p4Ui/Qwi+T49fmDfhePb98fkQ+68FzICOY0GTsQlreWYRMXRjytDJvpIRMebbR3Fv66Vr2uoO7qOVaH+9zGby7Rr40GXDYYAfzuUGtsZpWhCYiFNEA5ulcM5KzPvaqjFqNQnqUWMDhdNoHbviAxEySVQtYJWDdTJ33QYQrs= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: ff4cf538-43ae-4b8f-5c64-08d65880526f X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:02:28.4313 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3334 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Avoid the use of internal work queue to defer the handling of tx power related cfg operations callback. Now issuing the wid command to firmware directly from the caller context. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 85 +++++-------------------------- 1 file changed, 14 insertions(+), 71 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index e179a8e..88d9010 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -117,10 +117,6 @@ struct sta_inactive_t { u8 mac[6]; }; -struct tx_power { - u8 tx_pwr; -}; - union message_body { struct scan_attr scan_info; struct connect_attr con_info; @@ -145,7 +141,6 @@ union message_body { struct reg_frame reg_frame; char *data; struct del_all_sta del_all_sta_info; - struct tx_power tx_power; }; struct host_if_msg { @@ -2371,48 +2366,6 @@ static void handle_set_mcast_filter(struct work_struct *work) kfree(msg); } -static void handle_set_tx_pwr(struct work_struct *work) -{ - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; - u8 tx_pwr = msg->body.tx_power.tx_pwr; - int ret; - struct wid wid; - - wid.id = WID_TX_POWER; - wid.type = WID_CHAR; - wid.val = &tx_pwr; - wid.size = sizeof(char); - - ret = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, - wilc_get_vif_idx(vif)); - if (ret) - netdev_err(vif->ndev, "Failed to set TX PWR\n"); - kfree(msg); -} - -/* Note: 'msg' will be free after using data */ -static void handle_get_tx_pwr(struct work_struct *work) -{ - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; - u8 *tx_pwr = &msg->body.tx_power.tx_pwr; - int ret; - struct wid wid; - - wid.id = WID_TX_POWER; - wid.type = WID_CHAR; - wid.val = (s8 *)tx_pwr; - wid.size = sizeof(char); - - ret = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1, - wilc_get_vif_idx(vif)); - if (ret) - netdev_err(vif->ndev, "Failed to get TX PWR\n"); - - complete(&msg->work_comp); -} - static void handle_scan_timer(struct work_struct *work) { struct host_if_msg *msg = container_of(work, struct host_if_msg, work); @@ -3740,19 +3693,15 @@ int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled, u32 count, int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power) { int ret; - struct host_if_msg *msg; - - msg = wilc_alloc_work(vif, handle_set_tx_pwr, false); - if (IS_ERR(msg)) - return PTR_ERR(msg); + struct wid wid; - msg->body.tx_power.tx_pwr = tx_power; + wid.id = WID_TX_POWER; + wid.type = WID_CHAR; + wid.val = &tx_power; + wid.size = sizeof(char); - ret = wilc_enqueue_work(msg); - if (ret) { - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - kfree(msg); - } + ret = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, + wilc_get_vif_idx(vif)); return ret; } @@ -3760,21 +3709,15 @@ int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power) int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power) { int ret; - struct host_if_msg *msg; + struct wid wid; - msg = wilc_alloc_work(vif, handle_get_tx_pwr, true); - if (IS_ERR(msg)) - return PTR_ERR(msg); + wid.id = WID_TX_POWER; + wid.type = WID_CHAR; + wid.val = tx_power; + wid.size = sizeof(char); - ret = wilc_enqueue_work(msg); - if (ret) { - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - } else { - wait_for_completion(&msg->work_comp); - *tx_power = msg->body.tx_power.tx_pwr; - } + ret = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1, + wilc_get_vif_idx(vif)); - /* free 'msg' after copying data */ - kfree(msg); return ret; } From patchwork Sun Dec 2 18:02:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10708089 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 2C86013BB for ; Sun, 2 Dec 2018 18:02:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D7F02A855 for ; Sun, 2 Dec 2018 18:02:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 122162A862; Sun, 2 Dec 2018 18:02:41 +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,DKIM_SIGNED, DKIM_VALID,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 93CA22A855 for ; Sun, 2 Dec 2018 18:02:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725783AbeLBSCf (ORCPT ); Sun, 2 Dec 2018 13:02:35 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:23435 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbeLBSCf (ORCPT ); Sun, 2 Dec 2018 13:02:35 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="23899243" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 Dec 2018 11:02:33 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.105) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:02:33 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YBcDDMMihiQDexbtHKuYu4BccgT6041L2wpKn531DhI=; b=MNsoJsMy862gjLVGY0m8Vay4B+43r4pJWKGBy/uc11aBb/fV1ab5TRVwj+wZhSjCwBxrIgr3y3qAxQWRPCDXNeYunU0AiN1381d5VOFLTLY8RP3NWrNeE4Oz5uFM22T/VQgmuDB+x+lRScQvTBVePA9PU1C8lpwMeCXeyzp1bc4= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB3334.namprd11.prod.outlook.com (20.177.185.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.19; Sun, 2 Dec 2018 18:02:31 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:02:31 +0000 From: To: CC: , , , , Subject: [PATCH 06/29] staging: wilc1000: handle setting power management from cfg80211 context Thread-Topic: [PATCH 06/29] staging: wilc1000: handle setting power management from cfg80211 context Thread-Index: AQHUimkxjU1/3pR4YE26Q30YVkx5Hg== Date: Sun, 2 Dec 2018 18:02:31 +0000 Message-ID: <1543773663-20561-7-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB3334;6:NCm5FuNb+oXAXAPlab0VV5mR/Ni9FIjwlOcLkw0Qf4h2Pw5XYXNYuIUEHQEwsyIH9KtED9DFnmGTE+Xn0TrmbbM0NcWf2n8ktfJcecuYejrHGZ6IOGCB56mRD4dsdBnEF69ivqfL49emoYYyl7vukLs/toiRnhoY5Bibj68Vhs5J0+nU8nxJrB9niqMIyfmv8l1uk9OcEjbHASOEHtzeQvAKF2rjsu0J7yNztzB/SkV/ntZ9ckaATBLp0Fy/SN5XK5YeJgG2QlIbi8DbEChtthX1S7f7Wojs0aWgWFEEsVkfmcGBSqzt57DlUocnQVUFH9j6+K8U/hNlG+h7F+qJa2DvUw/191mcXBcDnn7oRrV7BK+lXeVXnrnWpiHMLZhqxYPfUHAYRxn+7wO5OUWbtHLIZkwylHc3tc4ERPBuRrVXPwvGpS+cQG9SqN7aIexioL8OG3IDDHtGbKNIo0XnGg==;5:Y68UjPIuiWYeHwHOD+V9+k31J+lSqfdmtGmO3IyGp1QqvDcQXLEQapEU/2Zz2YDQ6f7EYZCdjSlRP3Vbh10bxpGPPzrZVHFzekDVzfhsvGcJEU4qHxcCr+s/wF6tWVtXaQU5FRzcUwtAT0Bie3GT7gZVEu/h3VuyyEzcvEW/7p8=;7:0DvmJ/n+bVJv3slca9niOSxvT8c3kyT2OlIOhEEwmB1pFMPUHnDFjp6pHXriVhfxf7fjUO7/Dk0DFBuFTXh8Mt4SpuyEpFFNCWVIc4SUNOFyUJjhquW+IquZvDSLcC+mQZCv+2lMUKU6ElOL/kemfw== x-ms-office365-filtering-correlation-id: da8edb75-5e7e-49c2-5c14-08d65880541d x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB3334; x-ms-traffictypediagnostic: BYAPR11MB3334: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231455)(999002)(944501491)(52105112)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB3334;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB3334; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(979002)(136003)(346002)(366004)(376002)(396003)(39850400004)(199004)(189003)(107886003)(6916009)(386003)(5660300001)(5640700003)(446003)(4326008)(11346002)(6506007)(78486014)(2906002)(6512007)(53936002)(54906003)(3846002)(6116002)(2351001)(81166006)(316002)(81156014)(52116002)(8676002)(26005)(8936002)(256004)(76176011)(6436002)(97736004)(106356001)(99286004)(486006)(6486002)(68736007)(105586002)(14454004)(478600001)(2616005)(7736002)(66066001)(36756003)(305945005)(72206003)(186003)(2501003)(86362001)(102836004)(476003)(71190400001)(25786009)(71200400001)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB3334;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: DdDl6e92O+B0MBXO/SStypAo8Pi/X10UJKUAfcZh0QySjaLc/D2wgqiNsLIvqmyJHwOh4O97TRKyRikRB8jLQgtG7hQtd2iU0rLmxHmTX9esz1qE4A9AzErN8hFScOG52fby7X0NnNqEuDf1BqX5LwbJgbJSKJ0yKL30T29WqzYA7+jTQV8LTolCffH7wqvxz28mQCwmEGl0I/XbEQnQz0dOQwFxEm/Uzy9BsouakF4aYz0bmx1R8CiOJyzcrKMrRhrAr3ZJKNdW3jlyoRjjA0KHSN85Wg3VYFAwAHXcXyQgPCwfhKOvgIAb3v/+Z41Yh37WEs/00ldxeN3aQDCl+bSHC4ijYVfEyo08zidhTWA= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: da8edb75-5e7e-49c2-5c14-08d65880541d X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:02:31.4215 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3334 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Refactor the code to handle the power management cfg operation from the caller context. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 56 +++++++------------------------ 1 file changed, 13 insertions(+), 43 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 88d9010..4074a37 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -102,11 +102,6 @@ struct del_sta { u8 mac_addr[ETH_ALEN]; }; -struct power_mgmt_param { - bool enabled; - u32 timeout; -}; - struct set_ip_addr { u8 *ip_addr; u8 idx; @@ -129,7 +124,6 @@ union message_body { struct add_sta_param add_sta_info; struct del_sta del_sta_info; struct add_sta_param edit_sta_info; - struct power_mgmt_param pwr_mgmt_info; struct sta_inactive_t mac_info; struct set_ip_addr ip_info; struct drv_handler drv; @@ -2298,32 +2292,6 @@ static void listen_timer_cb(struct timer_list *t) } } -static void handle_power_management(struct work_struct *work) -{ - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; - struct power_mgmt_param *pm_param = &msg->body.pwr_mgmt_info; - int result; - struct wid wid; - s8 power_mode; - - wid.id = WID_POWER_MANAGEMENT; - - if (pm_param->enabled) - power_mode = WILC_FW_MIN_FAST_PS; - else - power_mode = WILC_FW_NO_POWERSAVE; - - wid.val = &power_mode; - wid.size = sizeof(char); - - result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, - wilc_get_vif_idx(vif)); - if (result) - netdev_err(vif->ndev, "Failed to send power management\n"); - kfree(msg); -} - static void handle_set_mcast_filter(struct work_struct *work) { struct host_if_msg *msg = container_of(work, struct host_if_msg, work); @@ -3647,24 +3615,26 @@ int wilc_edit_station(struct wilc_vif *vif, int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, u32 timeout) { + struct wid wid; int result; - struct host_if_msg *msg; + s8 power_mode; if (wilc_wlan_get_num_conn_ifcs(vif->wilc) == 2 && enabled) return 0; - msg = wilc_alloc_work(vif, handle_power_management, false); - if (IS_ERR(msg)) - return PTR_ERR(msg); + if (enabled) + power_mode = WILC_FW_MIN_FAST_PS; + else + power_mode = WILC_FW_NO_POWERSAVE; - msg->body.pwr_mgmt_info.enabled = enabled; - msg->body.pwr_mgmt_info.timeout = timeout; + wid.id = WID_POWER_MANAGEMENT; + wid.val = &power_mode; + wid.size = sizeof(char); + result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, + wilc_get_vif_idx(vif)); + if (result) + netdev_err(vif->ndev, "Failed to send power management\n"); - result = wilc_enqueue_work(msg); - if (result) { - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - kfree(msg); - } return result; } From patchwork Sun Dec 2 18:02:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10708093 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 C5F2018A7 for ; Sun, 2 Dec 2018 18:02:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B72512A855 for ; Sun, 2 Dec 2018 18:02:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ABBD22A85A; Sun, 2 Dec 2018 18:02:41 +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,DKIM_SIGNED, DKIM_VALID,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 D30BD2A856 for ; Sun, 2 Dec 2018 18:02:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725786AbeLBSCi (ORCPT ); Sun, 2 Dec 2018 13:02:38 -0500 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:40359 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbeLBSCi (ORCPT ); Sun, 2 Dec 2018 13:02:38 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="21024640" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 Dec 2018 11:02:36 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.105) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:02:36 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=M8l4vAqaN2FEqbpiSoCp7luS1KfwwXHrzDqQ1XwkkA4=; b=J5Z57fcleLg8qKzNNm+QXZQmVWwClC/KyEZi9KgeYDFcK5Ku5HfP2vyXKde0H6zWjQYhEGXkhJ6xo2TfVJZtlrHw1G1to28TipYJ1FveCZ4E4kIEPMMnAVyNh18uTIK82yFbdd0IPQjvr0Ake5xnnE+I2ul6mzRB1YVvstmwzeM= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB3334.namprd11.prod.outlook.com (20.177.185.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.19; Sun, 2 Dec 2018 18:02:34 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:02:34 +0000 From: To: CC: , , , , Subject: [PATCH 07/29] staging: wilc1000: handle add and edit station from the cfg80211 context Thread-Topic: [PATCH 07/29] staging: wilc1000: handle add and edit station from the cfg80211 context Thread-Index: AQHUimkzVHMl0DbA5UeoDAetEx6vUw== Date: Sun, 2 Dec 2018 18:02:34 +0000 Message-ID: <1543773663-20561-8-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB3334;6:cscKibvFQO6pjE4ZNDQYbQzJ3U5BiHegrmuXDquLKJM8Y4s5eytK/boNLQk/26Fqo491y4v43dUFgWDfne4F5nCMBpS6iseKN30CKqzssfyk4KLaf2/ogLuE6FWl6DKjRVeu4Uq9mezhZoiHJRg0/aY8u45Yz0QyvxCIZ9A/rsVb3XKC+8Ldya7eKxfuliC5AfZXl8FHRf3ZpTnk94mUY3Y1KT2HVpCSEQzFlJA4cMH2kBlifqZwFhNv2VM0v3R3fsz8eUM81VsjDsbLx0EsHU4yCNJoatDqt+8uC6VR0P3cLcRGAKbWMy2gxjw/2xcgiCrXDrcM811kco8EMqMWiZtCIka656xeY3zxMCA8gf1k+Rd+Usxy6BtNe0/9QyhluvARmr+2tlDsZxDj6o3M3kPT45pY36zJilUwVEjbTdy1mojM61POAWwI2zRqXH7zmU9EaWEfA8ar7w/K9GChAg==;5:MDRFViXEYbLkvyKLVj+sVvyZn1Jkw8EbNnNEuz5xeiiZBJtUjkwCYeJ/HuRtUsCDLxSXbFuxPCicwA57yZhZ2x82uo77W7ylXW2PSy+SZCAqTH2DYHt5AIarblwu6Veop1z1zX+D70JQtwvlSTdV0dJQ/N8MQoGKwyrdOTx3iUo=;7:X41jmoo8NBdnDuUdEFHffsBXJprvo/WCX9Lao0FJnEFopKsEZIBqy3DBPpjEHxHi0GPfvVJHdrQoyqzm/sXJ59UbWJ28qFc4kpMWd79UgEKI1hZLKO+I0vYD9gj1Yli+ts/dM0Ok1QtbiMUKYqbUnQ== x-ms-office365-filtering-correlation-id: 44bfae3f-3da7-48c8-3ad3-08d6588055d2 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB3334; x-ms-traffictypediagnostic: BYAPR11MB3334: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231455)(999002)(944501491)(52105112)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB3334;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB3334; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(346002)(366004)(376002)(396003)(39850400004)(199004)(189003)(107886003)(6916009)(386003)(5660300001)(5640700003)(446003)(4326008)(11346002)(6506007)(78486014)(2906002)(6512007)(53936002)(54906003)(3846002)(6116002)(2351001)(81166006)(316002)(81156014)(52116002)(8676002)(26005)(8936002)(256004)(76176011)(6436002)(97736004)(106356001)(99286004)(486006)(6486002)(68736007)(105586002)(14454004)(478600001)(2616005)(7736002)(66066001)(36756003)(305945005)(72206003)(186003)(2501003)(86362001)(575784001)(102836004)(476003)(71190400001)(25786009)(4744004)(71200400001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB3334;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 3ShvbZqBwKT6MbXfKVZAWhvLSOtIao5wvAHhBfUflTUjPfn+E19Y/o5RhP+3MuBXwKLeffYFGCH7Ayrd8/bQLnijqGCgVtRHz+dnsgzPCzrnZF01V+Msf0rUmHYdu955P9N14TZpWdDVQN3W5mnOZoCKBPQmjpBrMZhEFWYbA/c+Hv+N4BJ2UnVLhzrngh/2aq0kOExO4BTVAoIGe9667rzPVzMHWvo5N2rh+nLP1Pg+CeeB2Mt9UNAXLYcb9a9hoXy9V+eeRRCiSe9a9aUoy0RWGgZOExG6yuWcLw58tyJz9Y5a8XdF8+nS41mU/UPvCQjeRAmAFYyVamp14H1i81WzK1ME4EWXD4cvsL9WFNs= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 44bfae3f-3da7-48c8-3ad3-08d6588055d2 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:02:34.1675 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3334 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Refactor the code to avoid handling of add/edit stations using work queue and now set the wid value from caller context. Avoid making an extra copy of buffer and directly copy the data in firmware expected format. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 192 +++++++--------------- drivers/staging/wilc1000/host_interface.h | 7 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 35 +--- 3 files changed, 67 insertions(+), 167 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 4074a37..fedcff8 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -121,9 +121,7 @@ union message_body { struct cfg_param_attr cfg_info; struct channel_attr channel_info; struct beacon_attr beacon_info; - struct add_sta_param add_sta_info; struct del_sta del_sta_info; - struct add_sta_param edit_sta_info; struct sta_inactive_t mac_info; struct set_ip_addr ip_info; struct drv_handler drv; @@ -1962,67 +1960,41 @@ static void handle_del_beacon(struct work_struct *work) kfree(msg); } -static u32 wilc_hif_pack_sta_param(u8 *buff, struct add_sta_param *param) +static u32 wilc_hif_pack_sta_param(u8 *buff, const u8 *mac, + struct station_parameters *params) { u8 *cur_byte; cur_byte = buff; - - memcpy(cur_byte, param->bssid, ETH_ALEN); - cur_byte += ETH_ALEN; - - *cur_byte++ = param->aid & 0xFF; - *cur_byte++ = (param->aid >> 8) & 0xFF; - - *cur_byte++ = param->rates_len; - if (param->rates_len > 0) - memcpy(cur_byte, param->rates, param->rates_len); - cur_byte += param->rates_len; - - *cur_byte++ = param->ht_supported; - memcpy(cur_byte, ¶m->ht_capa, sizeof(struct ieee80211_ht_cap)); + ether_addr_copy(cur_byte, mac); + cur_byte += ETH_ALEN; + + put_unaligned_le16(params->aid, cur_byte); + cur_byte += 2; + + *cur_byte++ = params->supported_rates_len; + if (params->supported_rates_len > 0) + memcpy(cur_byte, params->supported_rates, + params->supported_rates_len); + cur_byte += params->supported_rates_len; + + if (params->ht_capa) { + *cur_byte++ = true; + memcpy(cur_byte, ¶ms->ht_capa, + sizeof(struct ieee80211_ht_cap)); + } else { + *cur_byte++ = false; + } cur_byte += sizeof(struct ieee80211_ht_cap); - *cur_byte++ = param->flags_mask & 0xFF; - *cur_byte++ = (param->flags_mask >> 8) & 0xFF; - - *cur_byte++ = param->flags_set & 0xFF; - *cur_byte++ = (param->flags_set >> 8) & 0xFF; + put_unaligned_le16(params->sta_flags_mask, cur_byte); + cur_byte += 2; + put_unaligned_le16(params->sta_flags_set, cur_byte); + cur_byte += 2; return cur_byte - buff; } -static void handle_add_station(struct work_struct *work) -{ - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; - struct add_sta_param *param = &msg->body.add_sta_info; - int result; - struct wid wid; - u8 *cur_byte; - - wid.id = WID_ADD_STA; - wid.type = WID_BIN; - wid.size = WILC_ADD_STA_LENGTH + param->rates_len; - - wid.val = kmalloc(wid.size, GFP_KERNEL); - if (!wid.val) - goto error; - - cur_byte = wid.val; - cur_byte += wilc_hif_pack_sta_param(cur_byte, param); - - result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, - wilc_get_vif_idx(vif)); - if (result != 0) - netdev_err(vif->ndev, "Failed to send add station\n"); - -error: - kfree(param->rates); - kfree(wid.val); - kfree(msg); -} - static void handle_del_all_sta(struct work_struct *work) { struct host_if_msg *msg = container_of(work, struct host_if_msg, work); @@ -2095,37 +2067,6 @@ static void handle_del_station(struct work_struct *work) kfree(msg); } -static void handle_edit_station(struct work_struct *work) -{ - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; - struct add_sta_param *param = &msg->body.edit_sta_info; - int result; - struct wid wid; - u8 *cur_byte; - - wid.id = WID_EDIT_STA; - wid.type = WID_BIN; - wid.size = WILC_ADD_STA_LENGTH + param->rates_len; - - wid.val = kmalloc(wid.size, GFP_KERNEL); - if (!wid.val) - goto error; - - cur_byte = wid.val; - cur_byte += wilc_hif_pack_sta_param(cur_byte, param); - - result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, - wilc_get_vif_idx(vif)); - if (result) - netdev_err(vif->ndev, "Failed to send edit station\n"); - -error: - kfree(param->rates); - kfree(wid.val); - kfree(msg); -} - static int handle_remain_on_chan(struct wilc_vif *vif, struct remain_ch *hif_remain_ch) { @@ -3484,34 +3425,30 @@ int wilc_del_beacon(struct wilc_vif *vif) return result; } -int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param) +int wilc_add_station(struct wilc_vif *vif, const u8 *mac, + struct station_parameters *params) { + struct wid wid; int result; - struct host_if_msg *msg; - struct add_sta_param *add_sta_info; + u8 *cur_byte; - msg = wilc_alloc_work(vif, handle_add_station, false); - if (IS_ERR(msg)) - return PTR_ERR(msg); + wid.id = WID_ADD_STA; + wid.type = WID_BIN; + wid.size = WILC_ADD_STA_LENGTH + params->supported_rates_len; + wid.val = kmalloc(wid.size, GFP_KERNEL); + if (!wid.val) + return -ENOMEM; - add_sta_info = &msg->body.add_sta_info; - memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param)); - if (add_sta_info->rates_len > 0) { - add_sta_info->rates = kmemdup(sta_param->rates, - add_sta_info->rates_len, - GFP_KERNEL); - if (!add_sta_info->rates) { - kfree(msg); - return -ENOMEM; - } - } + cur_byte = wid.val; + cur_byte += wilc_hif_pack_sta_param(cur_byte, mac, params); + + result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, + wilc_get_vif_idx(vif)); + if (result != 0) + netdev_err(vif->ndev, "Failed to send add station\n"); + + kfree(wid.val); - result = wilc_enqueue_work(msg); - if (result) { - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - kfree(add_sta_info->rates); - kfree(msg); - } return result; } @@ -3580,36 +3517,29 @@ int wilc_del_allstation(struct wilc_vif *vif, u8 mac_addr[][ETH_ALEN]) return result; } -int wilc_edit_station(struct wilc_vif *vif, - struct add_sta_param *sta_param) +int wilc_edit_station(struct wilc_vif *vif, const u8 *mac, + struct station_parameters *params) { + struct wid wid; int result; - struct host_if_msg *msg; - struct add_sta_param *add_sta_info; + u8 *cur_byte; - msg = wilc_alloc_work(vif, handle_edit_station, false); - if (IS_ERR(msg)) - return PTR_ERR(msg); + wid.id = WID_EDIT_STA; + wid.type = WID_BIN; + wid.size = WILC_ADD_STA_LENGTH + params->supported_rates_len; + wid.val = kmalloc(wid.size, GFP_KERNEL); + if (!wid.val) + return -ENOMEM; - add_sta_info = &msg->body.add_sta_info; - memcpy(add_sta_info, sta_param, sizeof(*add_sta_info)); - if (add_sta_info->rates_len > 0) { - add_sta_info->rates = kmemdup(sta_param->rates, - add_sta_info->rates_len, - GFP_KERNEL); - if (!add_sta_info->rates) { - kfree(msg); - return -ENOMEM; - } - } + cur_byte = wid.val; + cur_byte += wilc_hif_pack_sta_param(cur_byte, mac, params); - result = wilc_enqueue_work(msg); - if (result) { - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - kfree(add_sta_info->rates); - kfree(msg); - } + result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, + wilc_get_vif_idx(vif)); + if (result) + netdev_err(vif->ndev, "Failed to send edit station\n"); + kfree(wid.val); return result; } diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 7a71cb6..bebf0c6 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -326,11 +326,12 @@ int wilc_deinit(struct wilc_vif *vif); int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period, u32 head_len, u8 *head, u32 tail_len, u8 *tail); int wilc_del_beacon(struct wilc_vif *vif); -int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param); +int wilc_add_station(struct wilc_vif *vif, const u8 *mac, + struct station_parameters *params); int wilc_del_allstation(struct wilc_vif *vif, u8 mac_addr[][ETH_ALEN]); int wilc_del_station(struct wilc_vif *vif, const u8 *mac_addr); -int wilc_edit_station(struct wilc_vif *vif, - struct add_sta_param *sta_param); +int wilc_edit_station(struct wilc_vif *vif, const u8 *mac, + struct station_parameters *params); 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, u8 *mc_list); diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 69b181f..bbe68ba 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1818,28 +1818,13 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, { int ret = 0; struct wilc_priv *priv = wiphy_priv(wiphy); - struct add_sta_param sta_params = { {0} }; struct wilc_vif *vif = netdev_priv(dev); if (vif->iftype == WILC_AP_MODE || vif->iftype == WILC_GO_MODE) { - memcpy(sta_params.bssid, mac, ETH_ALEN); memcpy(priv->assoc_stainfo.sta_associated_bss[params->aid], mac, ETH_ALEN); - sta_params.aid = params->aid; - sta_params.rates_len = params->supported_rates_len; - sta_params.rates = params->supported_rates; - if (!params->ht_capa) { - sta_params.ht_supported = false; - } else { - sta_params.ht_supported = true; - sta_params.ht_capa = *params->ht_capa; - } - - sta_params.flags_mask = params->sta_flags_mask; - sta_params.flags_set = params->sta_flags_set; - - ret = wilc_add_station(vif, &sta_params); + ret = wilc_add_station(vif, mac, params); if (ret) netdev_err(dev, "Host add station fail\n"); } @@ -1874,26 +1859,10 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, const u8 *mac, struct station_parameters *params) { int ret = 0; - struct add_sta_param sta_params = { {0} }; struct wilc_vif *vif = netdev_priv(dev); if (vif->iftype == WILC_AP_MODE || vif->iftype == WILC_GO_MODE) { - memcpy(sta_params.bssid, mac, ETH_ALEN); - sta_params.aid = params->aid; - sta_params.rates_len = params->supported_rates_len; - sta_params.rates = params->supported_rates; - - if (!params->ht_capa) { - sta_params.ht_supported = false; - } else { - sta_params.ht_supported = true; - sta_params.ht_capa = *params->ht_capa; - } - - sta_params.flags_mask = params->sta_flags_mask; - sta_params.flags_set = params->sta_flags_set; - - ret = wilc_edit_station(vif, &sta_params); + ret = wilc_edit_station(vif, mac, params); if (ret) netdev_err(dev, "Host edit station fail\n"); } From patchwork Sun Dec 2 18:02:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10708091 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 8236513AF for ; Sun, 2 Dec 2018 18:02:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7318B2A855 for ; Sun, 2 Dec 2018 18:02:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 681932A85A; Sun, 2 Dec 2018 18:02:41 +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,DKIM_SIGNED, DKIM_VALID,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 094FB2A85E for ; Sun, 2 Dec 2018 18:02:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725790AbeLBSCl (ORCPT ); Sun, 2 Dec 2018 13:02:41 -0500 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:63009 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbeLBSCk (ORCPT ); Sun, 2 Dec 2018 13:02:40 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="23749570" 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; 02 Dec 2018 11:02:39 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.49) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:02:38 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k0oeqhaBSzkqVNphJN5Qn9zMWOaJ4Cc7V5gtvW3+i08=; b=WCVieIVupbxzPwOaNfl0bpjzQ9DnE/OpZdzofyzTxA8/rhdEcscciRKJzHyLwtJ7rSa/xXPdGyFjHuUCLUMSjn+B1u9LRVtVwId7HzfUAX+7FqhS3lXXr3mUYYqwHHoFPyWq/gv4AC83OXuCczVARVozITaOPg7tzsoBeDmYgg0= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB3334.namprd11.prod.outlook.com (20.177.185.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.19; Sun, 2 Dec 2018 18:02:36 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:02:37 +0000 From: To: CC: , , , , Subject: [PATCH 08/29] staging: wilc1000: use void return for wilc_hif_pack_sta_param() Thread-Topic: [PATCH 08/29] staging: wilc1000: use void return for wilc_hif_pack_sta_param() Thread-Index: AQHUimk1lIAgSgqWJEGtf5DSG10zHg== Date: Sun, 2 Dec 2018 18:02:36 +0000 Message-ID: <1543773663-20561-9-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB3334;6:AkFjoIxyeFKE/8UaopYxngnoQ6weS9f0NhO2LvtXPnL2jZnmHRtTkTU0QX/UfQXYNjtcortOl2MZQRnQkZyim5T6iqG2+VgmwI9iGnfxayQ57tXGs9Zax+pGPNQ5s8cUiwP4Y8esBqjeV0nXyirs7a+8JK0qDFxgtSAV9qjV1HNskg/Mj7MmXpshJKNXdIpgqfD+Dm5ISAEih7k1rcudmmEAWHfhE2iHXWIIEwcQFVcNAfW3vc1u1LEz3WkEFK5X99svwSlBehCKGws+7x4vQ0Indcp+qcb2RPRjId3NBRXFzYD3Q7mkTClETsmRO5Isi3YlXEGhQejAmlk2MJAuKpqfJVOWie1C9bm3/EJtp09Y2A+XNk9gb217vVRMhA+fezoy3rL19bKoUO6KXZKLA6TsQyD3dhhziayq86PYr3aP06X9LDFVQgRgWogqXK8JiaexLRG8ICgCPNyWCQAVKA==;5:+hEGjCFs6F27HpJCnv3bgvxAXkGNwppGUBeQelA4jqVQg1E/gfs8EezPHpEQWWSGmbStbIWCw6scsqiyK1yvpBzIRxE/J7NDT/wS2rrOu/Uv7zYt4jkmTMV6kCxlpz+OpwzIJrt2+v+GhawdJvcVBiW3x+iUstZCjKczcRxciDI=;7:RvEkeBsgwF9qlypAsg4MlU5zCwz2udmksb2hBDKY48cKYTnl8QvPRHYpA/Kdqg5hY2OTJf0+C+yjA8AtQhkXmqipFTlAMUCeoCpBwdxfKAp0ZIOosRfLlsdHhuqwFamj0SlemBg4Xa+h/eDR8MITQQ== x-ms-office365-filtering-correlation-id: 05ada13c-82f7-4978-70e4-08d658805778 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB3334; x-ms-traffictypediagnostic: BYAPR11MB3334: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231455)(999002)(944501491)(52105112)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB3334;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB3334; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(346002)(366004)(376002)(396003)(39850400004)(199004)(189003)(107886003)(6916009)(386003)(5660300001)(5640700003)(446003)(4326008)(11346002)(6506007)(78486014)(2906002)(6512007)(53936002)(54906003)(3846002)(6116002)(2351001)(81166006)(316002)(81156014)(52116002)(8676002)(26005)(8936002)(256004)(76176011)(6436002)(97736004)(106356001)(99286004)(486006)(6486002)(68736007)(105586002)(14454004)(478600001)(2616005)(7736002)(66066001)(36756003)(305945005)(72206003)(186003)(2501003)(86362001)(102836004)(476003)(71190400001)(25786009)(71200400001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB3334;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: eapxa6/HpWzT0X25nHXKyTrlBTG3jzRLmn2Bqkmeo+3CqqAjQt1yULckt8Q7gwnobE4kjYZMpptria8qBlrqlij+MG8BDIR1gknjPepJuaz7ClLDeoMK9BxpIEw3Iec5MPvRBeRZ2fvuIziDif+KvsKpZokk29xwATcr1M6g1BS+dR843ndRNrOn1nySzy8ORTH3pcXZjLibRpU+GEXeD9HLAicGNHvS/3CUluJfoOilLHh/Xsr3OSCp023NqwzQ2yiNAFM8Ijw5rMawRvNF9k1VXdzeT02g0gFIV+p4uz1zzGqgVulFr3wurkBY7/fFcuCqb7XIrxbyxdAvbY0QFMK9gdN1E2kIsoALIHLELCI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 05ada13c-82f7-4978-70e4-08d658805778 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:02:36.8805 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3334 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Change the return type from u32 to void for wilc_hif_pack_sta_param() as its value is not used. Also remove the use of extra pointer as it's not required now. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index fedcff8..40477ca 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1960,12 +1960,9 @@ static void handle_del_beacon(struct work_struct *work) kfree(msg); } -static u32 wilc_hif_pack_sta_param(u8 *buff, const u8 *mac, - struct station_parameters *params) +static void wilc_hif_pack_sta_param(u8 *cur_byte, const u8 *mac, + struct station_parameters *params) { - u8 *cur_byte; - - cur_byte = buff; ether_addr_copy(cur_byte, mac); cur_byte += ETH_ALEN; @@ -1990,9 +1987,6 @@ static u32 wilc_hif_pack_sta_param(u8 *buff, const u8 *mac, put_unaligned_le16(params->sta_flags_mask, cur_byte); cur_byte += 2; put_unaligned_le16(params->sta_flags_set, cur_byte); - cur_byte += 2; - - return cur_byte - buff; } static void handle_del_all_sta(struct work_struct *work) @@ -3440,7 +3434,7 @@ int wilc_add_station(struct wilc_vif *vif, const u8 *mac, return -ENOMEM; cur_byte = wid.val; - cur_byte += wilc_hif_pack_sta_param(cur_byte, mac, params); + wilc_hif_pack_sta_param(cur_byte, mac, params); result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); @@ -3532,7 +3526,7 @@ int wilc_edit_station(struct wilc_vif *vif, const u8 *mac, return -ENOMEM; cur_byte = wid.val; - cur_byte += wilc_hif_pack_sta_param(cur_byte, mac, params); + wilc_hif_pack_sta_param(cur_byte, mac, params); result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); From patchwork Sun Dec 2 18:02:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10708095 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 8012513AF for ; Sun, 2 Dec 2018 18:02:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E9AE2A856 for ; Sun, 2 Dec 2018 18:02:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 62A802A85E; Sun, 2 Dec 2018 18:02:45 +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,DKIM_SIGNED, DKIM_VALID,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 C82D22A856 for ; Sun, 2 Dec 2018 18:02:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725793AbeLBSCp (ORCPT ); Sun, 2 Dec 2018 13:02:45 -0500 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:39776 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbeLBSCp (ORCPT ); Sun, 2 Dec 2018 13:02:45 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="24754991" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES128-SHA; 02 Dec 2018 11:02:42 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.37) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:02:42 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+ME0kObpKBAx4a5Yq2g+DeF9rxVEHSn7WG6jW3xcSfs=; b=vZAafs7a8PvWJORTQD6i3hCIp9d6u/Qd1zy/vxf/wVz88lF/8Lj8asWatMg6CKKG2B0G1MHCZKqycdm8hyU/olw05z8eNcbc1UkuhoCFSL2/G0hi9+LzEhDbvTzRaAqqEXOeDXeiQEzXcjp3VPI9v7M7U5j1pOZnMg2dlZJQ/vQ= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB3334.namprd11.prod.outlook.com (20.177.185.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.19; Sun, 2 Dec 2018 18:02:40 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:02:40 +0000 From: To: CC: , , , , Subject: [PATCH 09/29] staging: wilc1000: handle delete station related callback ops from cfg80211 context Thread-Topic: [PATCH 09/29] staging: wilc1000: handle delete station related callback ops from cfg80211 context Thread-Index: AQHUimk3y4xd6sZZEECR5lInIFORTQ== Date: Sun, 2 Dec 2018 18:02:40 +0000 Message-ID: <1543773663-20561-10-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB3334;6:O6GiOu3blnBv9OF5l625X1r3ZtAAi79JyDRSpIk8O2CnsS40B6zqrs/TdALQxXeCxFWAmfbui7x7wKWXk1wiXCIeAGbA1H9ilGe5LmcegeAR4RSr8ds6IR9GMDQS3woc194rv+KCQJ4IL9uNiYFr4HZ2dZJ4yBgnSih5XFy3ppjx57v0jSG1R3jxkhwqkCE5xv7a8MIViJSfonD/+SBLF4qtPATEAbFaL9R3rnr0QQHwHsjdMf/SLJfIYgbxN56/ahmI+M60RYfMK5l7DxZEuWECnTgudHWU+KYhXxS80GyqDWhkTO7rTKUGOy0/W7BSfgHmj1OdTZM8forqCdH6I7hLuVKhYUT89Ez3UIoMCO0hIH5ypIRZppGqyvC75q9gnPewswrkRmRsRRwoCeIt0kVotEYsa/ZnHOXsvEs+KO+qww7QeGhqVSJkTptZxb/oLOwrYf7biH3hjok+YrvqUw==;5:0VmBl2xjiUqm0W2vNU4hFkWb6Bs6ECUzTEEYgwHxEqdoXXQGOg44JiK5Nv+/aMkBEWBIvRTUQz2Xc8KTlYIl6xgyDUAgwxgA1iuJT4yxad8yqEzvJ/q/cEm/TdLghqIP9gXtfEpAL8fwFDnWU55IaQDvBP9uFEwP6xjS/cBmsgg=;7:jHFrBhqnVCEivxPlm1AObfFnaDtgCUHTz/xpDYtNsrVTg9VcEuu4UPWK1R/IKvGucvodt3mASbB8J4/0s2zcZELhpysKDWKfBbqtC4/YwPrwaCB3qM+YDvy3RIVSdw2UpqHo0SNODdmlJlCGDscI0Q== x-ms-office365-filtering-correlation-id: 33709390-b755-4977-7f3e-08d65880593d x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB3334; x-ms-traffictypediagnostic: BYAPR11MB3334: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231455)(999002)(944501491)(52105112)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB3334;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB3334; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(346002)(366004)(376002)(396003)(39850400004)(199004)(189003)(107886003)(6916009)(386003)(5660300001)(5640700003)(446003)(4326008)(11346002)(6506007)(78486014)(2906002)(6512007)(53936002)(54906003)(3846002)(6116002)(2351001)(81166006)(316002)(81156014)(52116002)(8676002)(26005)(8936002)(256004)(14444005)(76176011)(6436002)(97736004)(106356001)(99286004)(486006)(6486002)(68736007)(105586002)(14454004)(478600001)(2616005)(7736002)(66066001)(36756003)(305945005)(72206003)(186003)(2501003)(86362001)(102836004)(476003)(71190400001)(25786009)(71200400001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB3334;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: Ulb8NdSwfEIhKqGkS1nXmmSHDmw/r7BSFVWkYSmtxR+z7vWrrXaHdx0g7EIMuM/ajbSO27kHieSVvjEXUMIjWgebY6PH7YD6Z414DR6yOs978n7tLyGvdLlsTydqrUDAinRq7wp7VboRUxeQm8mIQk7PfGlSgTPm9OEK6KRwBVp13J9MpZUJA+bQ4MiruG0+Ru/SkAp0zQ0q89mIB2x05+lyf2xt3VNHRiZ2abTjRuluIOfy4vbZVWX75hHVqw5NB7Db4oVlEDvYhc/LCi+si/sKbEeJ3uz4oWKGq+1zdy/hfw3/dfbU2yqN10RvfY+zLBT1h5hd9QtVcxg1nww7DI8QWcTUTMooHejwlHhQhG0= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 33709390-b755-4977-7f3e-08d65880593d X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:02:40.0477 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3334 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Refactor the code to handle delete/delete_all station operation callback from cfg80211 context. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 147 +++++++----------------------- 1 file changed, 33 insertions(+), 114 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 40477ca..8ce56a3 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -94,12 +94,8 @@ struct set_multicast { }; struct del_all_sta { - u8 del_all_sta[WILC_MAX_NUM_STA][ETH_ALEN]; u8 assoc_sta; -}; - -struct del_sta { - u8 mac_addr[ETH_ALEN]; + u8 mac[WILC_MAX_NUM_STA][ETH_ALEN]; }; struct set_ip_addr { @@ -121,7 +117,6 @@ union message_body { struct cfg_param_attr cfg_info; struct channel_attr channel_info; struct beacon_attr beacon_info; - struct del_sta del_sta_info; struct sta_inactive_t mac_info; struct set_ip_addr ip_info; struct drv_handler drv; @@ -132,7 +127,6 @@ union message_body { struct remain_ch remain_on_ch; struct reg_frame reg_frame; char *data; - struct del_all_sta del_all_sta_info; }; struct host_if_msg { @@ -1989,78 +1983,6 @@ static void wilc_hif_pack_sta_param(u8 *cur_byte, const u8 *mac, put_unaligned_le16(params->sta_flags_set, cur_byte); } -static void handle_del_all_sta(struct work_struct *work) -{ - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; - struct del_all_sta *param = &msg->body.del_all_sta_info; - int result; - struct wid wid; - u8 *curr_byte; - u8 i; - u8 zero_buff[6] = {0}; - - wid.id = WID_DEL_ALL_STA; - wid.type = WID_STR; - wid.size = (param->assoc_sta * ETH_ALEN) + 1; - - wid.val = kmalloc((param->assoc_sta * ETH_ALEN) + 1, GFP_KERNEL); - if (!wid.val) - goto error; - - curr_byte = wid.val; - - *(curr_byte++) = param->assoc_sta; - - for (i = 0; i < WILC_MAX_NUM_STA; i++) { - if (memcmp(param->del_all_sta[i], zero_buff, ETH_ALEN)) - memcpy(curr_byte, param->del_all_sta[i], ETH_ALEN); - else - continue; - - curr_byte += ETH_ALEN; - } - - result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, - wilc_get_vif_idx(vif)); - if (result) - netdev_err(vif->ndev, "Failed to send delete all station\n"); - -error: - kfree(wid.val); - - /* free 'msg' data in caller */ - complete(&msg->work_comp); -} - -static void handle_del_station(struct work_struct *work) -{ - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; - struct del_sta *param = &msg->body.del_sta_info; - int result; - struct wid wid; - - wid.id = WID_REMOVE_STA; - wid.type = WID_BIN; - wid.size = ETH_ALEN; - - wid.val = kmalloc(wid.size, GFP_KERNEL); - if (!wid.val) - goto error; - - ether_addr_copy(wid.val, param->mac_addr); - - result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, - wilc_get_vif_idx(vif)); - if (result) - netdev_err(vif->ndev, "Failed to del station\n"); - -error: - kfree(wid.val); - kfree(msg); -} - static int handle_remain_on_chan(struct wilc_vif *vif, struct remain_ch *hif_remain_ch) { @@ -3448,65 +3370,62 @@ int wilc_add_station(struct wilc_vif *vif, const u8 *mac, int wilc_del_station(struct wilc_vif *vif, const u8 *mac_addr) { + struct wid wid; int result; - struct host_if_msg *msg; - struct del_sta *del_sta_info; - - msg = wilc_alloc_work(vif, handle_del_station, false); - if (IS_ERR(msg)) - return PTR_ERR(msg); - del_sta_info = &msg->body.del_sta_info; + wid.id = WID_REMOVE_STA; + wid.type = WID_BIN; + wid.size = ETH_ALEN; + wid.val = kzalloc(wid.size, GFP_KERNEL); + if (!wid.val) + return -ENOMEM; if (!mac_addr) - eth_broadcast_addr(del_sta_info->mac_addr); + eth_broadcast_addr(wid.val); else - memcpy(del_sta_info->mac_addr, mac_addr, ETH_ALEN); + ether_addr_copy(wid.val, mac_addr); + + result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, + wilc_get_vif_idx(vif)); + if (result) + netdev_err(vif->ndev, "Failed to del station\n"); + + kfree(wid.val); - result = wilc_enqueue_work(msg); - if (result) { - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - kfree(msg); - } return result; } int wilc_del_allstation(struct wilc_vif *vif, u8 mac_addr[][ETH_ALEN]) { + struct wid wid; int result; - struct host_if_msg *msg; - struct del_all_sta *del_all_sta_info; - u8 zero_addr[ETH_ALEN] = {0}; int i; + u8 zero_addr[ETH_ALEN] = {0}; u8 assoc_sta = 0; + struct del_all_sta del_sta; - msg = wilc_alloc_work(vif, handle_del_all_sta, true); - if (IS_ERR(msg)) - return PTR_ERR(msg); - - del_all_sta_info = &msg->body.del_all_sta_info; - + memset(&del_sta, 0x0, sizeof(del_sta)); for (i = 0; i < WILC_MAX_NUM_STA; i++) { if (memcmp(mac_addr[i], zero_addr, ETH_ALEN)) { - memcpy(del_all_sta_info->del_all_sta[i], mac_addr[i], - ETH_ALEN); assoc_sta++; + ether_addr_copy(del_sta.mac[i], mac_addr[i]); } } - if (!assoc_sta) { - kfree(msg); + + if (!assoc_sta) return 0; - } - del_all_sta_info->assoc_sta = assoc_sta; - result = wilc_enqueue_work(msg); + del_sta.assoc_sta = assoc_sta; - if (result) - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - else - wait_for_completion(&msg->work_comp); + wid.id = WID_DEL_ALL_STA; + wid.type = WID_STR; + wid.size = (assoc_sta * ETH_ALEN) + 1; + wid.val = (u8 *)&del_sta; - kfree(msg); + result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, + wilc_get_vif_idx(vif)); + if (result) + netdev_err(vif->ndev, "Failed to send delete all station\n"); return result; } From patchwork Sun Dec 2 18:02:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10708097 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 4ED8E13AF for ; Sun, 2 Dec 2018 18:02:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4078B2A856 for ; Sun, 2 Dec 2018 18:02:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34CDC2A85E; Sun, 2 Dec 2018 18:02:48 +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,DKIM_SIGNED, DKIM_VALID,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 D0DFF2A856 for ; Sun, 2 Dec 2018 18:02:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725797AbeLBSCs (ORCPT ); Sun, 2 Dec 2018 13:02:48 -0500 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:39776 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbeLBSCs (ORCPT ); Sun, 2 Dec 2018 13:02:48 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="24754994" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 Dec 2018 11:02:46 -0700 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.38) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:02:45 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R9rHb59dJtr/P0RfJgIMZwvlKGzLHv4UT8RYez7xY2Q=; b=LhLUn8AerrJdcf1YMkwDF+Hoi2kJFChTIxtYnO3cHoyYSjbuiN3YvOwstjMVz0W8nkyHEd8B13OjjATC5bQqnnzcQMeajwngEqwpcvlTs+Vfo6gs3MiSbj7xHpQG2FAzoav8JSA+33hQ2g8op7YOTTbZ4zHL4WpWdDahg00fhT4= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2806.namprd11.prod.outlook.com (52.135.228.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sun, 2 Dec 2018 18:02:43 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:02:43 +0000 From: To: CC: , , , , Subject: [PATCH 10/29] staging: wilc1000: use is_zero_ether_addr() API to check mac address Thread-Topic: [PATCH 10/29] staging: wilc1000: use is_zero_ether_addr() API to check mac address Thread-Index: AQHUimk4LUt8ViMG5UOMBa6G8mkvlg== Date: Sun, 2 Dec 2018 18:02:43 +0000 Message-ID: <1543773663-20561-11-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2806;6:6sUCNkL7494GJa6Ip7G0E+z3G/B+lVRIN8RCvgZHafzohkeaEFeap+ItBUrZCm7fZYeDBbI8gNjsfdPTrfSfbBAgI4yn5NgmIjR1pw9GCz11mDtiqosTewpjQKAkT+sEy3KwXtyIw7qOeJSvXayRwGk0vGBwo3+rjsd/tXHrBZSUL7aGdxGDZlQmMj+PqhTBzpiee1zkE5Rdvr5Jt1ork/+OBV9rx3rdi5uavgzP0NLENty2tq7YIos78W0a9iuzpZZVN/ggxGZIyfMzvkvmOAWpbMk07+Yhwb9UTyqCP4jNT39IfhgbNQKKpXFE4E0AotEUfldrbcVVPFzbAye4CveXyqeY/jrwNbRjv1xmWIJeJCiIw/MDpCrp6P+tot+WoHoJWkXWeudyRemPabLARB3JpJifDLErWz9TXZBpt3GTgFBBk5ThYtb2mE4tvTs9E6HtzFH7rc12YG73fskZIg==;5:jUsz4X7y3A9eUzkHh4yyp0+RDWGjm0l4o+CoLDs0W/fi1xds8AVyQzc4toG5kjtKMJTXtI0wC1pTO60ApGlktzowtFI4PTmVpnyz8+BTBJ1S5wbUSSb3FLacFESalQvjH7pDBbNYc+VXFOz3eWBVrY7b/uS9NTvFUvkxH71ZVaM=;7:gl/MO6oXvE665sw5Hrs6j4f10p0yQEZcwOm6nSfjvJqXqKf2zSuTCMtHAdNQr5H3/E5clyfXnMF/JKzQ9fQFjDY4PQsWifPqsygfIsH0SsL9l9qdkrz63L9Upw52RjfdQdYL3NO+M3Abo5ymIOdB+A== x-ms-office365-filtering-correlation-id: 5c271f37-ad39-49cd-d2ec-08d658805b25 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2806; x-ms-traffictypediagnostic: BYAPR11MB2806: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231455)(999002)(944501491)(52105112)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB2806;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB2806; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(366004)(39850400004)(396003)(136003)(199004)(189003)(186003)(4326008)(7736002)(26005)(14454004)(2906002)(107886003)(305945005)(386003)(53936002)(6506007)(36756003)(76176011)(6512007)(71190400001)(52116002)(71200400001)(5640700003)(256004)(3846002)(6116002)(99286004)(5660300001)(78486014)(6486002)(446003)(11346002)(486006)(86362001)(105586002)(8676002)(97736004)(68736007)(316002)(2616005)(6436002)(476003)(54906003)(66066001)(25786009)(102836004)(81156014)(81166006)(8936002)(72206003)(2351001)(2501003)(478600001)(6916009)(106356001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2806;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 1FQZbn53v0rqY/OMn3pK4P034og5T9smmnOK1I4BzQxNOEZsqf9toGCvYXuanHSdYTLhOZxHObOH6IPsZD4hhjSBaza9K4wHaoe14q7e+XjJLdvwY/yc6yXnLgzxDVRUFknNRZH507HFtxn4kKHJnys/+1kvBSZHjMqnXIk7j9l6NDQI/K/tvbvuGPWNoQgAHAoIEAESzgA2XP8P3Gx2GSBG5/S5HoI4mSKI9/wwEuxIlvpVn4+6zogXK8cQahHxWK5rXmM01yeOAiEnIBH2lr0IuwfyP3777uWoIEaPmlKBSlAyuoeKgwwJuol1f+slYjZHgzvw1tYvKrCTDwe70i+OTU0jv3rps8JdyExaqZ0= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 5c271f37-ad39-49cd-d2ec-08d658805b25 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:02:43.0429 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2806 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Use is_zero_ether_addr() API to check if mac address value is zero. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 3 +-- drivers/staging/wilc1000/linux_wlan.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 8ce56a3..310138d 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3400,13 +3400,12 @@ int wilc_del_allstation(struct wilc_vif *vif, u8 mac_addr[][ETH_ALEN]) struct wid wid; int result; int i; - u8 zero_addr[ETH_ALEN] = {0}; u8 assoc_sta = 0; struct del_all_sta del_sta; memset(&del_sta, 0x0, sizeof(del_sta)); for (i = 0; i < WILC_MAX_NUM_STA; i++) { - if (memcmp(mac_addr[i], zero_addr, ETH_ALEN)) { + if (!is_zero_ether_addr(mac_addr[i])) { assoc_sta++; ether_addr_copy(del_sta.mac[i], mac_addr[i]); } diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index e246d18..142816a 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -205,11 +205,10 @@ void wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode) int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc) { u8 i = 0; - u8 null_bssid[6] = {0}; u8 ret_val = 0; for (i = 0; i < wilc->vif_num; i++) - if (memcmp(wilc->vif[i]->bssid, null_bssid, 6)) + if (!is_zero_ether_addr(wilc->vif[i]->bssid)) ret_val++; return ret_val; From patchwork Sun Dec 2 18:02:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10708099 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 C68DE13BB for ; Sun, 2 Dec 2018 18:02:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7DC42A856 for ; Sun, 2 Dec 2018 18:02:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC3C32A85E; Sun, 2 Dec 2018 18:02: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,DKIM_SIGNED, DKIM_VALID,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 4E0A72A856 for ; Sun, 2 Dec 2018 18:02:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725802AbeLBSCt (ORCPT ); Sun, 2 Dec 2018 13:02:49 -0500 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:39776 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbeLBSCt (ORCPT ); Sun, 2 Dec 2018 13:02:49 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="24754996" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 Dec 2018 11:02:47 -0700 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.38) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:02:47 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MjrTeDt1jZFIEHycKahQPpYawtMBYp45QJpMAQN+H+E=; b=IrrgTFvOy6Zkix4IVDsXhvxDVVkpC6aEk9SfSdnRQShCIebLCoJq3LTQIynstMBa/PnsuuQBhD/Jp8D8+Fbkdi1Y4055e1PWwyQ4SZKcuR2E01iCQ4GL4obr2LJLwZH2iHQw487Us9aXaJywvPlsMEhN0BJw2GZSOIgC3W2E+OY= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2806.namprd11.prod.outlook.com (52.135.228.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sun, 2 Dec 2018 18:02:45 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:02:45 +0000 From: To: CC: , , , , Subject: [PATCH 11/29] staging: wilc1000: handle delete beacon cfg ops from cfg80211 context() Thread-Topic: [PATCH 11/29] staging: wilc1000: handle delete beacon cfg ops from cfg80211 context() Thread-Index: AQHUimk6m4xaZYq6oUiIA/wAs8jokQ== Date: Sun, 2 Dec 2018 18:02:45 +0000 Message-ID: <1543773663-20561-12-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2806;6:oiJWj+h/+lvRGprgoSpaqr8p/lPyBpOIkf5Mo1UfqfW68xNswGnL4JG8mNkCvnGti6OLVr0YDYVVHUoxl2XItn2CNQODSnL7/vAmdNp5MFb79Mg3WRqXDTsbh167z8tvhxzDmz4Rhsq8xCYO5Z/J9D+qSxfYK0S5bRgUmLePtV8JRDzQE1nIHwRraTeKCzS67wJtb6d7zZt9JKa4UeirU18bu+FTtQc+M3fyTzYQXp/eMxYazb52dqI7uwFLEQZljrM7daqwvPJUo4SWL3xG7blzuYndO14ufnYf3ugr7KdE0HbhpbVNiv0GSERAGO9FbsqEfsALZhwTqZcB+uvLpAPCRl1MUcVzlpsF88TWfOUeomFEYVcA4Gx4UBC5wBPGXKYjwk7MAkbOyEJa6Y9MBszw9Kc/dJLjs4k4ZuqALLpN7ILxohHhzbRkvazRP5bnHHKJrBn3V4KW+DC4Kw47hg==;5:QpMCYSVnseTyG1s/hZ7GNmhyR8ioIom8VhtIciHs9RMk/aK2RqupZP1CDsb0ror8o9e/k0wWI+j9IBISOHEpbigvZaagmGtir/MmX8p7zXNxDNIAPfdJ/yfR/I69hlFriAyD/WXdyIRuqeo6lYLvz1u49bmlkwrrlYrGJ5F456k=;7:jn5jW4KPSw4d1vLEhm6FaDlMFH7HFx9LRXeekBz4HZ48KnYJHt5gCWkbJZoyrTkNOH+mU40xjt+PEgWMUFiQtkAOUaqIjBWrV9gWwUbxQJJtXmAQ5eMAllGx04sLHKSOMWQwh9G9DeBR8lELjd9zVw== x-ms-office365-filtering-correlation-id: 9cc8e05a-fab8-4d7a-d02e-08d658805cab x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2806; x-ms-traffictypediagnostic: BYAPR11MB2806: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231455)(999002)(944501491)(52105112)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB2806;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB2806; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(366004)(39850400004)(396003)(136003)(199004)(189003)(186003)(4326008)(7736002)(26005)(14454004)(2906002)(107886003)(305945005)(386003)(53936002)(6506007)(36756003)(76176011)(6512007)(71190400001)(52116002)(71200400001)(5640700003)(14444005)(256004)(3846002)(6116002)(99286004)(5660300001)(78486014)(6486002)(446003)(11346002)(486006)(86362001)(105586002)(8676002)(97736004)(68736007)(316002)(2616005)(6436002)(476003)(54906003)(66066001)(25786009)(102836004)(81156014)(81166006)(8936002)(72206003)(2351001)(2501003)(478600001)(6916009)(106356001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2806;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: yCDkGkiWDyjFrYBIcgAkNLJXcOC2egZKr8ulSz1Q3d/cd94I76fQWT3Jy6LOHen5OmyqXlryzmszytHFjpJ1gcYBcdxr6MThxB1G4zZxZi0HO+/NO/14RXfmwSvJie0617CKGYyc+CHWa39i1bebTz86u2gvhrNth02sFoBI0DRv3VqTfMgmxzbQhbHgmKLUWxmWKKE4B9SBdBVnvmIS3ImGdWKJ8VEgCM/sxtgtiiQVp13fwQvm0OAzSRAlxjlACUV1S2W0R2/zCzh1hjQVcn2pq9sbsr3pXxgUPZD1B3gMM8Iky8TB2ETVVrg099n+WwOkMq+npSZ5gbNgvq4APv+UG1EtYtN1U4Jhc141cJs= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 9cc8e05a-fab8-4d7a-d02e-08d658805cab X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:02:45.7869 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2806 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Refactor the code to handle delete beacon cfg operation from cfg80211 context. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 39 ++++++++----------------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 310138d..995ca65 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1934,26 +1934,6 @@ static void handle_add_beacon(struct work_struct *work) kfree(msg); } -static void handle_del_beacon(struct work_struct *work) -{ - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; - int result; - struct wid wid; - u8 del_beacon = 0; - - wid.id = WID_DEL_BEACON; - wid.type = WID_CHAR; - wid.size = sizeof(char); - wid.val = &del_beacon; - - result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, - wilc_get_vif_idx(vif)); - if (result) - netdev_err(vif->ndev, "Failed to send delete beacon\n"); - kfree(msg); -} - static void wilc_hif_pack_sta_param(u8 *cur_byte, const u8 *mac, struct station_parameters *params) { @@ -3326,17 +3306,18 @@ int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period, int wilc_del_beacon(struct wilc_vif *vif) { int result; - struct host_if_msg *msg; + struct wid wid; + u8 del_beacon = 0; - msg = wilc_alloc_work(vif, handle_del_beacon, false); - if (IS_ERR(msg)) - return PTR_ERR(msg); + wid.id = WID_DEL_BEACON; + wid.type = WID_CHAR; + wid.size = sizeof(char); + wid.val = &del_beacon; - result = wilc_enqueue_work(msg); - if (result) { - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - kfree(msg); - } + result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, + wilc_get_vif_idx(vif)); + if (result) + netdev_err(vif->ndev, "Failed to send delete beacon\n"); return result; } From patchwork Sun Dec 2 18:02:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10708101 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 98A6113BB for ; Sun, 2 Dec 2018 18:02:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8938F2A856 for ; Sun, 2 Dec 2018 18:02:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D3F92A85E; Sun, 2 Dec 2018 18:02:53 +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,DKIM_SIGNED, DKIM_VALID,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 CC9BD2A856 for ; Sun, 2 Dec 2018 18:02:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725805AbeLBSCx (ORCPT ); Sun, 2 Dec 2018 13:02:53 -0500 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:63018 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbeLBSCx (ORCPT ); Sun, 2 Dec 2018 13:02:53 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="23749573" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES128-SHA; 02 Dec 2018 11:02:51 -0700 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.37) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:02:50 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=imZZ5q0DJOMAOxw0UIMx2TMUafK6yx3B/pUaYTBGN6Q=; b=OVLKszTfjk0KHTe5vF6GUztC9bVd2SDr9lGUy7m7TnxoPi1hWuy8nho5Ptj/0o/Oqa/Jz54PkWM7mjtQW/7Yo490xVlxQD2iq4eCyfvJy8u5gJ9xMHHoTwJcroZttd9x8iXiZ5ipfMDCalZRUgx27TxLu5dow2/BFIPcdlFhfpo= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2806.namprd11.prod.outlook.com (52.135.228.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sun, 2 Dec 2018 18:02:49 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:02:49 +0000 From: To: CC: , , , , Subject: [PATCH 12/29] staging: wilc1000: handle add beacon operation callback from cfg80211 context Thread-Topic: [PATCH 12/29] staging: wilc1000: handle add beacon operation callback from cfg80211 context Thread-Index: AQHUimk8SRAMUwYY10eq0u7Jv3i+hg== Date: Sun, 2 Dec 2018 18:02:48 +0000 Message-ID: <1543773663-20561-13-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2806;6:K7BQBKDg8iSNv8lQLyh1M9pUIzkEWKO5WT9pXR96ksswBK/sNdNmlNUMY9UVSIMHm9ZV0KQlR5/sa1JE6TJ4sMM0izYgtTqDWEQD/1A9fsVUD+TN1ok0mnObWp60F/x8A2Vppe/XVaapqQ5aYCchLW9cPcDt+UlV5unChLExmxVVhTSi0Gvi5Ez3nChu4PoEx9LgLxze2NRXpuKFbix/yxojHXy68fPG68Yv2YNs6ZLRzaFGkpodk65FSeiMMDPl7BRE90XOoWgKmrAGidA0FSvs4H4IPFTYhLPK8bZHBI/EXhFaDtc/Io15vNEu7c6Zf6ESsvcqDU76Fb7y05EZ2lIgIZWMxPkMJSGiIyxC/DdkHT7xwyqpp+LkU5ON0flBURgPjDL1byoVY2dgye1IC8twerx1Cjf8HGVMiKtplOZCnVr4i5ygyUffgfg9uCZJjIHxRr70tUGO6mtrSy1eNw==;5:TGgiWz48uRJ9lk56tCTbiLy9niKlooRuao/wjXsNZSf/DE6NlGMOpWhAhKTkV/WzHLCoJp6O23KtR4trroSoejlU6QZSYtBVXGKAx0pE/1zTKY8ggB3mGvHCFSelRIKMA2nTGdXiKgtOvYXvD3KeyNrOVdpcyAbOuyTzz47oiEA=;7:tDiUEfJoxYX4pkA4AVE40+jqrbKnWhQd6NsOG+u90rtMGe/ICC24dKeGcMGTaCZ5kIsuVLUZ5Mu43dXtwBMdfRbKrl3DlGYgfCsxVzGT/MtjJ/Ryp5JWAdmG6m7/tpwV0LpHZ2e4f+nX0iu/IgsTtQ== x-ms-office365-filtering-correlation-id: 7fb31c5d-1e7b-437e-7b0f-08d658805e85 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2806; x-ms-traffictypediagnostic: BYAPR11MB2806: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231455)(999002)(944501491)(52105112)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB2806;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB2806; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(366004)(39850400004)(396003)(136003)(199004)(189003)(186003)(4326008)(7736002)(26005)(14454004)(2906002)(107886003)(305945005)(386003)(53936002)(6506007)(36756003)(76176011)(6512007)(71190400001)(52116002)(71200400001)(5640700003)(256004)(3846002)(6116002)(99286004)(5660300001)(78486014)(6486002)(446003)(11346002)(486006)(575784001)(86362001)(105586002)(8676002)(97736004)(68736007)(316002)(2616005)(6436002)(476003)(54906003)(66066001)(25786009)(102836004)(81156014)(81166006)(8936002)(72206003)(2351001)(2501003)(478600001)(6916009)(106356001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2806;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: nGlL3scGpbSk0YDWMntrDnd29Am8GMiSTgCexOw+axQbMV8JF8S+43ro7THtOinegPp7VWMeItfhAhdvZYJG4NfO7BpYbp1vsNal5BK8aoDMkr7RFYKafeMPg4ZFSTkHb2IeDXNXn/lV1DsSyojU/WITShKihEx/TMXeG6EkocUJ1X4q1JXNLFScdRAeTX6WU2ulrC9G2Wxk1d4d6mT77QjhMQiYRCsvKrE7mgXt/K+6yJNzko/AgUrAd73EyXQdbipmFiK3XnuDVJsPpsegbfDP2MgQFythbeea7WeCcRTnzsQUCftP4CE+n+CketYBH43hkTJCRWG8tfaAWbGi0EXRjHAc24nzcfxq9o8b9Pk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 7fb31c5d-1e7b-437e-7b0f-08d658805e85 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:02:48.8921 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2806 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Refactor add/change beacon cfg80211 operation callback to handle from cfg context. Also avoided extra copy of information by packing directly in firmware expected format. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 128 +++++----------------- drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 10 +- 3 files changed, 32 insertions(+), 108 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 995ca65..97b84d2 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -78,15 +78,6 @@ struct channel_attr { u8 set_ch; }; -struct beacon_attr { - u32 interval; - u32 dtim_period; - u32 head_len; - u8 *head; - u32 tail_len; - u8 *tail; -}; - struct set_multicast { bool enabled; u32 cnt; @@ -116,7 +107,6 @@ union message_body { struct key_attr key_info; struct cfg_param_attr cfg_info; struct channel_attr channel_info; - struct beacon_attr beacon_info; struct sta_inactive_t mac_info; struct set_ip_addr ip_info; struct drv_handler drv; @@ -1878,62 +1868,6 @@ static void handle_get_inactive_time(struct work_struct *work) complete(&msg->work_comp); } -static void handle_add_beacon(struct work_struct *work) -{ - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; - struct beacon_attr *param = &msg->body.beacon_info; - int result; - struct wid wid; - u8 *cur_byte; - - wid.id = WID_ADD_BEACON; - wid.type = WID_BIN; - wid.size = param->head_len + param->tail_len + 16; - wid.val = kmalloc(wid.size, GFP_KERNEL); - if (!wid.val) - goto error; - - cur_byte = wid.val; - *cur_byte++ = (param->interval & 0xFF); - *cur_byte++ = ((param->interval >> 8) & 0xFF); - *cur_byte++ = ((param->interval >> 16) & 0xFF); - *cur_byte++ = ((param->interval >> 24) & 0xFF); - - *cur_byte++ = (param->dtim_period & 0xFF); - *cur_byte++ = ((param->dtim_period >> 8) & 0xFF); - *cur_byte++ = ((param->dtim_period >> 16) & 0xFF); - *cur_byte++ = ((param->dtim_period >> 24) & 0xFF); - - *cur_byte++ = (param->head_len & 0xFF); - *cur_byte++ = ((param->head_len >> 8) & 0xFF); - *cur_byte++ = ((param->head_len >> 16) & 0xFF); - *cur_byte++ = ((param->head_len >> 24) & 0xFF); - - memcpy(cur_byte, param->head, param->head_len); - cur_byte += param->head_len; - - *cur_byte++ = (param->tail_len & 0xFF); - *cur_byte++ = ((param->tail_len >> 8) & 0xFF); - *cur_byte++ = ((param->tail_len >> 16) & 0xFF); - *cur_byte++ = ((param->tail_len >> 24) & 0xFF); - - if (param->tail) - memcpy(cur_byte, param->tail, param->tail_len); - cur_byte += param->tail_len; - - result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, - wilc_get_vif_idx(vif)); - if (result) - netdev_err(vif->ndev, "Failed to send add beacon\n"); - -error: - kfree(wid.val); - kfree(param->head); - kfree(param->tail); - kfree(msg); -} - static void wilc_hif_pack_sta_param(u8 *cur_byte, const u8 *mac, struct station_parameters *params) { @@ -3258,47 +3192,43 @@ void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg) } int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period, - u32 head_len, u8 *head, u32 tail_len, u8 *tail) + struct cfg80211_beacon_data *params) { + struct wid wid; int result; - struct host_if_msg *msg; - struct beacon_attr *beacon_info; + u8 *cur_byte; - msg = wilc_alloc_work(vif, handle_add_beacon, false); - if (IS_ERR(msg)) - return PTR_ERR(msg); + wid.id = WID_ADD_BEACON; + wid.type = WID_BIN; + wid.size = params->head_len + params->tail_len + 16; + wid.val = kzalloc(wid.size, GFP_KERNEL); + if (!wid.val) + return -ENOMEM; - beacon_info = &msg->body.beacon_info; - beacon_info->interval = interval; - beacon_info->dtim_period = dtim_period; - beacon_info->head_len = head_len; - beacon_info->head = kmemdup(head, head_len, GFP_KERNEL); - if (!beacon_info->head) { - result = -ENOMEM; - goto error; - } - beacon_info->tail_len = tail_len; + cur_byte = wid.val; + put_unaligned_le32(interval, cur_byte); + cur_byte += 4; + put_unaligned_le32(dtim_period, cur_byte); + cur_byte += 4; + put_unaligned_le32(params->head_len, cur_byte); + cur_byte += 4; - if (tail_len > 0) { - beacon_info->tail = kmemdup(tail, tail_len, GFP_KERNEL); - if (!beacon_info->tail) { - result = -ENOMEM; - goto error; - } - } else { - beacon_info->tail = NULL; - } + if (params->head_len > 0) + memcpy(cur_byte, params->head, params->head_len); + cur_byte += params->head_len; - result = wilc_enqueue_work(msg); + put_unaligned_le32(params->tail_len, cur_byte); + cur_byte += 4; + + if (params->tail_len > 0) + memcpy(cur_byte, params->tail, params->tail_len); + + result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, + wilc_get_vif_idx(vif)); if (result) - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); + netdev_err(vif->ndev, "Failed to send add beacon\n"); -error: - if (result) { - kfree(beacon_info->head); - kfree(beacon_info->tail); - kfree(msg); - } + kfree(wid.val); return result; } diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index bebf0c6..647a1af 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -324,7 +324,7 @@ int wilc_hif_set_cfg(struct wilc_vif *vif, int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler); int wilc_deinit(struct wilc_vif *vif); int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period, - u32 head_len, u8 *head, u32 tail_len, u8 *tail); + struct cfg80211_beacon_data *params); int wilc_del_beacon(struct wilc_vif *vif); int wilc_add_station(struct wilc_vif *vif, const u8 *mac, struct station_parameters *params); diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index bbe68ba..18370ef 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1768,11 +1768,9 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev, { struct wilc_vif *vif = netdev_priv(dev); struct wilc *wl = vif->wilc; - struct cfg80211_beacon_data *beacon = &settings->beacon; int ret; ret = set_channel(wiphy, &settings->chandef); - if (ret != 0) netdev_err(dev, "Error in setting channel\n"); @@ -1780,9 +1778,7 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev, wilc_set_power_mgmt(vif, 0, 0); return wilc_add_beacon(vif, settings->beacon_interval, - settings->dtim_period, beacon->head_len, - (u8 *)beacon->head, beacon->tail_len, - (u8 *)beacon->tail); + settings->dtim_period, &settings->beacon); } static int change_beacon(struct wiphy *wiphy, struct net_device *dev, @@ -1791,9 +1787,7 @@ static int change_beacon(struct wiphy *wiphy, struct net_device *dev, struct wilc_priv *priv = wiphy_priv(wiphy); struct wilc_vif *vif = netdev_priv(priv->dev); - return wilc_add_beacon(vif, 0, 0, beacon->head_len, - (u8 *)beacon->head, beacon->tail_len, - (u8 *)beacon->tail); + return wilc_add_beacon(vif, 0, 0, beacon); } static int stop_ap(struct wiphy *wiphy, struct net_device *dev) From patchwork Sun Dec 2 18:02:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10708103 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 D489213AF for ; Sun, 2 Dec 2018 18:02:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C547B2A856 for ; Sun, 2 Dec 2018 18:02:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8E212A85E; Sun, 2 Dec 2018 18:02:55 +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,DKIM_SIGNED, DKIM_VALID,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 3747F2A856 for ; Sun, 2 Dec 2018 18:02:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725808AbeLBSCz (ORCPT ); Sun, 2 Dec 2018 13:02:55 -0500 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:39788 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbeLBSCz (ORCPT ); Sun, 2 Dec 2018 13:02:55 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="24755001" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 Dec 2018 11:02:53 -0700 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.38) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:02:53 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yUZNHHBNThpghEXh1wa9+1zqv7HI5fwJxwolpTMLu64=; b=VLDsjkg+Nxf9DT49D+sCWgwomDwmzlu3ke9HBCVUmPR0ES2iqRDWj0Uqw968immQ4fX51SMk/l3apPhQbNp6rGhpz/PfxinQlzfeDTqzgbdCMJQqqBswsmF/wkjg1ohpAQsIGEKmVsR4MXYoKXK0uGEXHD/LRdptsgLqrNcb2UI= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2806.namprd11.prod.outlook.com (52.135.228.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sun, 2 Dec 2018 18:02:51 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:02:51 +0000 From: To: CC: , , , , Subject: [PATCH 13/29] staging: wilc1000: handle mgmt_frame_register ops from cfg82011 context Thread-Topic: [PATCH 13/29] staging: wilc1000: handle mgmt_frame_register ops from cfg82011 context Thread-Index: AQHUimk95/U4dlnk60KiYT5YqPv/6w== Date: Sun, 2 Dec 2018 18:02:51 +0000 Message-ID: <1543773663-20561-14-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2806;6:AVIpkFRgRNXzCXsFpYJCN0ujrjBaG7sTy7bKLH230mQrVlo6NZmA40m+hXhG1gDMsxIPjXxC1UdovClUucm182yUOrxo9XmqCjEbmp1pkjoKsPLckXUxo63st+PvuQ5e34KFJcqj3sE1WkaExdeLRa8coepcI7K5WGSJuKkegZ1mYT7i1ayWbktaFPW12RA4ce3r8f33U0dMyfwxY6ArLewCCCiv2ggwl7OwohRr4wV8yofSpZy0CtQSVWUGcpCMgVRqgB3d8eQhYF8WR5w7QKnf0qdLlop6SZQwyoAuqNsD6g5KoddNfDGi2OD+wTgrSDaHaLvxvRnXGA8OR1Q1G7E+fiAY57eul1SmhQnNfbjeauicu5zp6YITr6+DgwzsF31TCs61VqnbS0EaOqMqe+xTB9Do/OD45uOm6Tx+fHr68+Y7f/7alXVmhTtVOx6nU9bfrid32BU1Ge4ZPPLJZg==;5:A4sxd0S2ljOlYTg+PV9aDaoRUhAutjCLNxh+/altiu4vTbqIGAThglLclLWOcYQcqyveBWHxGYveyR/CO2r2+DK3eLZsJHIgXOddMl/1sXWRT6TYX84imyJUj+wsx6zn1P+VH/wmGq1Fx4Nt7IeIBSi7f1rXAftJICiEtom38Qc=;7:Ppp6P5XtjJMLYfF7GLeojv5tSgRLF42DZ9L0YOa9k9rl9XzNq7p0CERVXHu5nhYU45ARE/LYJ9VTpSZhG+yK6o/vkMkdrWslUByweV8KUTni/ey7+kXWeApyCzG2vd6XGfeW7+B/huPL7DWNOyH0oA== x-ms-office365-filtering-correlation-id: 40f99371-8ec8-462a-788f-08d65880603e x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2806; x-ms-traffictypediagnostic: BYAPR11MB2806: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231455)(999002)(944501491)(52105112)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB2806;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB2806; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(366004)(39850400004)(396003)(136003)(199004)(189003)(186003)(4326008)(7736002)(26005)(14454004)(2906002)(107886003)(305945005)(386003)(53936002)(6506007)(36756003)(76176011)(6512007)(71190400001)(52116002)(71200400001)(5640700003)(14444005)(256004)(3846002)(6116002)(99286004)(5660300001)(78486014)(6486002)(446003)(11346002)(486006)(86362001)(105586002)(8676002)(97736004)(68736007)(316002)(2616005)(6436002)(476003)(54906003)(66066001)(25786009)(102836004)(81156014)(81166006)(8936002)(72206003)(2351001)(2501003)(478600001)(6916009)(106356001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2806;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: UblCPtgQ0MChwQSON3O4TKoveqnpGq4tyJiJhhW139JbWlvCpCi4YHm0BW+/4df08GXbg1BUNtzuK68n5o4FIyqWn4DlyUqk6RwS2OnuRSQp75N1+ebl+2DPVgHji07H6xG6QMDU0/F4Ghb8TcWGVY4YzrynR1K4Qc4/PLbNKIUQmcCK7LHprZ7PfZUfGWdf+XDPDme8/9apfFiOs6FSyk2WejVeZ6CodAnBM4GB02xo3P7TpowKQQPnKw5MRibYNMrxPgaMzo6kyJcIL7P1hT7kWp2Zy5eSJhZqoJVkuwpxhRYuXC8aMuqHtfQCbZza4ZAhWFUkAbv6RtVfhAt9Cc1VNuGwal/tobCQ83AZWEI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 40f99371-8ec8-462a-788f-08d65880603e X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:02:51.5740 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2806 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Avoid handling of mgmt_frame_register operation callback in a deferred manner. Now set the wid command to firmware directly from caller context. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 70 ++++++++++--------------------- drivers/staging/wilc1000/host_interface.h | 6 --- 2 files changed, 22 insertions(+), 54 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 97b84d2..4d1fa4a 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -89,6 +89,12 @@ struct del_all_sta { u8 mac[WILC_MAX_NUM_STA][ETH_ALEN]; }; +struct wilc_reg_frame { + bool reg; + u8 reg_id; + __le32 frame_type; +} __packed; + struct set_ip_addr { u8 *ip_addr; u8 idx; @@ -115,7 +121,6 @@ union message_body { struct get_mac_addr get_mac_info; struct ba_session_info session_info; struct remain_ch remain_on_ch; - struct reg_frame reg_frame; char *data; }; @@ -1963,39 +1968,6 @@ static int handle_remain_on_chan(struct wilc_vif *vif, return result; } -static void handle_register_frame(struct work_struct *work) -{ - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; - struct reg_frame *hif_reg_frame = &msg->body.reg_frame; - int result; - struct wid wid; - u8 *cur_byte; - - wid.id = WID_REGISTER_FRAME; - wid.type = WID_STR; - wid.val = kmalloc(sizeof(u16) + 2, GFP_KERNEL); - if (!wid.val) - goto out; - - cur_byte = wid.val; - - *cur_byte++ = hif_reg_frame->reg; - *cur_byte++ = hif_reg_frame->reg_id; - memcpy(cur_byte, &hif_reg_frame->frame_type, sizeof(u16)); - - wid.size = sizeof(u16) + 2; - - result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, - wilc_get_vif_idx(vif)); - kfree(wid.val); - if (result) - netdev_err(vif->ndev, "Failed to frame register\n"); - -out: - kfree(msg); -} - static void handle_listen_state_expired(struct work_struct *work) { struct host_if_msg *msg = container_of(work, struct host_if_msg, work); @@ -3162,33 +3134,35 @@ int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id) void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg) { + struct wid wid; int result; - struct host_if_msg *msg; + struct wilc_reg_frame reg_frame; - msg = wilc_alloc_work(vif, handle_register_frame, false); - if (IS_ERR(msg)) - return; + wid.id = WID_REGISTER_FRAME; + wid.type = WID_STR; + wid.size = sizeof(reg_frame); + wid.val = (u8 *)®_frame; + + memset(®_frame, 0x0, sizeof(reg_frame)); + reg_frame.reg = reg; switch (frame_type) { case IEEE80211_STYPE_ACTION: - msg->body.reg_frame.reg_id = WILC_FW_ACTION_FRM_IDX; + reg_frame.reg_id = WILC_FW_ACTION_FRM_IDX; break; case IEEE80211_STYPE_PROBE_REQ: - msg->body.reg_frame.reg_id = WILC_FW_PROBE_REQ_IDX; + reg_frame.reg_id = WILC_FW_PROBE_REQ_IDX; break; default: break; } - msg->body.reg_frame.frame_type = frame_type; - msg->body.reg_frame.reg = reg; - - result = wilc_enqueue_work(msg); - if (result) { - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - kfree(msg); - } + reg_frame.frame_type = cpu_to_le16(frame_type); + result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, + wilc_get_vif_idx(vif)); + if (result) + netdev_err(vif->ndev, "Failed to frame register\n"); } int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period, diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 647a1af..10d5627 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -244,12 +244,6 @@ struct remain_ch { u32 id; }; -struct reg_frame { - bool reg; - u16 frame_type; - u8 reg_id; -}; - struct wilc; struct host_if_drv { struct user_scan_req usr_scan_req; From patchwork Sun Dec 2 18:02: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: 10708105 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 DA15813AF for ; Sun, 2 Dec 2018 18:02:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAA6F2A856 for ; Sun, 2 Dec 2018 18:02:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC6082A85E; Sun, 2 Dec 2018 18:02: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,DKIM_SIGNED, DKIM_VALID,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 4B0BF2A856 for ; Sun, 2 Dec 2018 18:02:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725810AbeLBSC6 (ORCPT ); Sun, 2 Dec 2018 13:02:58 -0500 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:52847 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbeLBSC6 (ORCPT ); Sun, 2 Dec 2018 13:02:58 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="23451102" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 Dec 2018 11:02:56 -0700 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.107) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:02:56 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gr/UOchA/6cX6lKR/aDDCabcWwWqdOSZ4rDf0sE36o0=; b=2mbOfTV7b9lfVcQz9fBzEWX1mS+0QR5GWwRfDUY2ixzXWO/66AJ3FHBZ5chYrhREsx7Q7eMjD9r0yiyXNA9DXkTMDl95wtES7yerJfGIMUOf9+pS6kSMrpMOtkgoUxKhLVEIFcbOYMJb4CHhbw+zmdiDlFeGKVuHMwZvhXfyEPQ= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2806.namprd11.prod.outlook.com (52.135.228.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sun, 2 Dec 2018 18:02:54 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:02:54 +0000 From: To: CC: , , , , Subject: [PATCH 14/29] staging: wilc1000: refactor wilc_set_mac_chnl_num() to avoid deferred handling Thread-Topic: [PATCH 14/29] staging: wilc1000: refactor wilc_set_mac_chnl_num() to avoid deferred handling Thread-Index: AQHUimk/hR+BjAyON0Gq/ufNAKnx8g== Date: Sun, 2 Dec 2018 18:02:54 +0000 Message-ID: <1543773663-20561-15-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2806;6:HcURBxqAr65GPnkMoJzLD+1DGXQz+AhFOEKdONnVU3d+pRqTDLQ0UCxMlnfJRbxtjmA6McD4iKcU94UpsX1hRrLI79exfjwrIoTIAmooeutxZtmBE0m+7bpYgOFzMGVjeiyOMATFtV1sC9k30k12e+51izYBc0o8mVaXQAeYV2i4c9y7Kkh9sY1+iPOCPXayCRcbdnfG+neUdXnPQ+21KvlhvwDLzeginLWDxJ8m5imL6bQzZe3c/pI2P5/Up4f+Mv3Id5/MGYw63skF2/1KDygC7OybOWudFMRuGQleJ2n2uSVPyWfD7I2osgIg6TfQz7MeyrzRXoLkZRc5ibbt9Mbih3hbet5eJxZ1m8eSXtT1WbZ2a1MitkWcmXJAldd2U0O1wnEZqHGtR1Nt6ajSD7HY71W1Mf6SEoYg9femqkkyXfl5dU5BSlz52oQOmIQW/02207ss3kIYma2d4a0qww==;5:nHLXupSbr6IgIje+xfsqMhSR8w2vxgZfJcuGrO13nxAlJC6+QU168JtDqkbGSFyKm0piXYND6BKvDPN6qtisYn0o8ZiCwUuAQVziDQbb3e6+eX/GvdP3ete2+0IzBdP6shh3XObzY2djTJabrE4xhLkJmkJJ1T3uge/FODrfbZw=;7:OD1olfA9mvgrmG52VG0YPrndzaK9h8qROVkoogpFAk2rY3oJQaoOnr/NxbcRaXNgDlBIV63wgytHiy1N/oCJG8zBwmoDTG9OmSZ12RK/t9dNBxGdJ2hFPnPJQU8l+/9A7Nn8hOvgXQwmWhDzMsgj5g== x-ms-office365-filtering-correlation-id: 49b592ae-7862-4920-577b-08d658806207 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2806; x-ms-traffictypediagnostic: BYAPR11MB2806: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231455)(999002)(944501491)(52105112)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB2806;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB2806; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(366004)(39850400004)(396003)(136003)(199004)(189003)(186003)(4326008)(7736002)(26005)(14454004)(2906002)(107886003)(305945005)(386003)(53936002)(6506007)(36756003)(76176011)(6512007)(71190400001)(52116002)(71200400001)(5640700003)(14444005)(256004)(3846002)(6116002)(99286004)(5660300001)(78486014)(6486002)(446003)(11346002)(486006)(86362001)(105586002)(8676002)(97736004)(68736007)(316002)(2616005)(6436002)(476003)(54906003)(66066001)(25786009)(102836004)(81156014)(81166006)(8936002)(72206003)(2351001)(2501003)(478600001)(6916009)(106356001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2806;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: m63kmp4bfHsPJV6JP1UytSW0CA36DDYeFFzQjw2mnu4x7zsLfivqyE2FOIJNRNGFjZyE8G8ipZzA/JgetF0jhO5YkAaS+A77RN92EVMCLIPmihATZV0NdRcraHiV2qbmednLUYquBoOHWo8PWCVtUA2vzV5yVZduovmCQmlAC2qLKg0TDBCsJ0Z112ChUuHxAyGiUE6XMMjj12EZ4hq1vpqaYF3DgqkM7pTSylylA8qEC7HHeHwGJWye11MtxbD8B/+pJRpwX4DzRf0EzlI97sn1IMVaF3QeKbq5LtmOj1+57x+VXDxCRnO2BOxD3/meBEGiJ+CYbxK7JUuBXqbj6gvp0HCGviR+CW83egAU4wc= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 49b592ae-7862-4920-577b-08d658806207 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:02:54.5692 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2806 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Avoid handling of WID_CURRENT_CHANNEL wid command in deferred approach. Instead of posting the wid to workqueue now handle directly from the caller context. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 46 ++++++------------------------- 1 file changed, 9 insertions(+), 37 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 4d1fa4a..f6bd76c 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -74,10 +74,6 @@ struct rcvd_async_info { u32 len; }; -struct channel_attr { - u8 set_ch; -}; - struct set_multicast { bool enabled; u32 cnt; @@ -112,7 +108,6 @@ union message_body { struct rcvd_async_info async_info; struct key_attr key_info; struct cfg_param_attr cfg_info; - struct channel_attr channel_info; struct sta_inactive_t mac_info; struct set_ip_addr ip_info; struct drv_handler drv; @@ -224,27 +219,6 @@ static struct wilc_vif *wilc_get_vif_from_idx(struct wilc *wilc, int idx) return wilc->vif[index]; } -static void handle_set_channel(struct work_struct *work) -{ - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; - struct channel_attr *hif_set_ch = &msg->body.channel_info; - int ret; - struct wid wid; - - wid.id = WID_CURRENT_CHANNEL; - wid.type = WID_CHAR; - wid.val = (char *)&hif_set_ch->set_ch; - wid.size = sizeof(char); - - ret = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, - wilc_get_vif_idx(vif)); - - if (ret) - netdev_err(vif->ndev, "Failed to set channel\n"); - kfree(msg); -} - static void handle_set_wfi_drv_handler(struct work_struct *work) { struct host_if_msg *msg = container_of(work, struct host_if_msg, work); @@ -2600,20 +2574,18 @@ int wilc_disconnect(struct wilc_vif *vif, u16 reason_code) int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel) { + struct wid wid; int result; - struct host_if_msg *msg; - msg = wilc_alloc_work(vif, handle_set_channel, false); - if (IS_ERR(msg)) - return PTR_ERR(msg); - - msg->body.channel_info.set_ch = channel; + wid.id = WID_CURRENT_CHANNEL; + wid.type = WID_CHAR; + wid.size = sizeof(char); + wid.val = &channel; - result = wilc_enqueue_work(msg); - if (result) { - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - kfree(msg); - } + result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, + wilc_get_vif_idx(vif)); + if (result) + netdev_err(vif->ndev, "Failed to set channel\n"); return result; } From patchwork Sun Dec 2 18:02: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: 10708113 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 E9A1D13BB for ; Sun, 2 Dec 2018 18:03:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D988D2A85A for ; Sun, 2 Dec 2018 18:03:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C96682A862; Sun, 2 Dec 2018 18:03:11 +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,DKIM_SIGNED, DKIM_VALID,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 381E22A85A for ; Sun, 2 Dec 2018 18:03:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725821AbeLBSDL (ORCPT ); Sun, 2 Dec 2018 13:03:11 -0500 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:39796 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbeLBSDL (ORCPT ); Sun, 2 Dec 2018 13:03:11 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="24755012" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES128-SHA; 02 Dec 2018 11:02:59 -0700 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.37) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:02:59 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=C81+GM0mlqHKAtpvJHJiZwcf+mDIMTmPjcRCc3801fc=; b=0LBzaC7gS+8vT78pBhsUPyhHQCe+uWC7EhEN7XKWRXd0FA6QaztkqRT71ZHdnuP41HHOQwKRXGqZTtALTynpK61S0Z2/HVvJhDof1e8BFYLwm0JNCTz/ENc9cYFnpjH51WlyZ74nfWlR25+k5xaseXmu2zlMDt8ZgVl7vCp6Yc8= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2806.namprd11.prod.outlook.com (52.135.228.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sun, 2 Dec 2018 18:02:57 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:02:57 +0000 From: To: CC: , , , , Subject: [PATCH 15/29] staging: wilc1000: refactor wilc_hif_set_cfg() to avoid deferred handling Thread-Topic: [PATCH 15/29] staging: wilc1000: refactor wilc_hif_set_cfg() to avoid deferred handling Thread-Index: AQHUimlBqAvdDE4SvkaLd/T9aHySXQ== Date: Sun, 2 Dec 2018 18:02:57 +0000 Message-ID: <1543773663-20561-16-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2806;6:Wr1vgu1dt5AC+8I78L10ATxYOx8w+9GOEN8TIVZhhqXfebtqMPCaIHfXalB8HehkDyk/918hPWy6B+vyDIYokgRkh3fdZU0aXMMl6SopUGtebmFxdSKFl1QD5Xtlvdm3+Aoo33JIZdHtvGMFSPhIuomU5TS1Gp51dda7x2hSO6entjzUod+BWe9jEu5pjl2LXNRFpCipYxpd3nYzSfKZar4IUOoqT/zRylQoo8LN7bg6iDuMmjiCh73oP6TnUX/7JVRB76YqYDUpnThpVuQarA7SINggtJaWbDuEbfZcWzebxYiafzKnO3czO3jnFk8Sr6c9IKiO1bvw2M/PT7LnXZDN3Zf/fm3w1JVpL9eKyyHYoThyEnEMCcxNCZPX3039m+9ov4rUe+2K7gR6l7X8VisZUM1xLY9BtLetYWrQx2Y+BTHFp2NtHBjlJDBT8VKkCe9799uRlcy15GC/X/TFKQ==;5:knKn1KtjoslCaL0aH6Ftxm/jnMYYMPER85iY41V4RDa5mULTEsRLCATV1IS5hoYSkbWDARWLpbgbtG3I3T/S8yl+JsaEpvDhGHCGaTwYb3q3MiyRY6tDq6MF7x4K5nIinxJpIG0CBLsq3/0hP+27mn4l+P2KrdAgRNUD09f3XpI=;7:M77ekKbfOGJ05sbAe1l0mZ5XU7XCX6svEoped+wD3DlyeLACA89c/zfGlzYfPkqYqd8XUyU1aQoD8IxL27akkKUdKlMy/zHeblkkQdRCKOURmXC1Bs0cvMqmtyan/w5IZax9E78QSTBgc2XJ+njiyw== x-ms-office365-filtering-correlation-id: 8f2cfee4-1648-4281-4943-08d658806393 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2806; x-ms-traffictypediagnostic: BYAPR11MB2806: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231455)(999002)(944501491)(52105112)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB2806;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB2806; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(366004)(39850400004)(396003)(136003)(199004)(189003)(186003)(4326008)(7736002)(26005)(14454004)(2906002)(107886003)(305945005)(386003)(53936002)(6506007)(36756003)(76176011)(6512007)(71190400001)(52116002)(71200400001)(5640700003)(14444005)(256004)(3846002)(6116002)(99286004)(5660300001)(78486014)(6486002)(446003)(11346002)(486006)(86362001)(105586002)(8676002)(97736004)(68736007)(316002)(2616005)(6436002)(476003)(54906003)(66066001)(25786009)(102836004)(81156014)(81166006)(8936002)(72206003)(2351001)(2501003)(478600001)(6916009)(106356001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2806;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: dqVWuUr9tEQYCWrVRLyhpPXD5MV6BXTMH+mctpCPlFO5267HFdsPnJgIuZwT/Z0PM+B9sM46IGsbHY57tbDtDpLQtwJiwIIXW+pnEeA7MP5HKWIHgGLti7RMz+U5zlz6RmwsuQWjpHRyhDckQ47no7k/LbIq+hoNR31MpMrj/14hlMmL0UHi+7KsnRXc8tyHPbqdSuU+eUyPgHIYtxGzT9yN5RY6NfI/Uv6wQLlVIErO9Ka9OYcVjoSnB+8/up/Bl31l20czVeup/kaD/644U09dnxw2qn62KoEHs0o7qW3pOE1a9MYQJ1A5QFiCZalFklpjdLodpsndyMOqx5pHCZrH65quAQkws2wKz772m80= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 8f2cfee4-1648-4281-4943-08d658806393 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:02:57.2291 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2806 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Avoid handling configuration params wid command in deferred approach. Instead of posting to workqueue now handle directly from the caller context. Reduce the size of wid array from 32 to 4 as maximum only 4 wid used at a time. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 95 +++++++++++-------------------- 1 file changed, 32 insertions(+), 63 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index f6bd76c..6b1c9e3 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -107,7 +107,6 @@ union message_body { struct rcvd_net_info net_info; struct rcvd_async_info async_info; struct key_attr key_info; - struct cfg_param_attr cfg_info; struct sta_inactive_t mac_info; struct set_ip_addr ip_info; struct drv_handler drv; @@ -306,53 +305,6 @@ static void handle_get_mac_address(struct work_struct *work) /* free 'msg' data later, in caller */ } -static void handle_cfg_param(struct work_struct *work) -{ - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; - struct cfg_param_attr *param = &msg->body.cfg_info; - int ret; - struct wid wid_list[32]; - int i = 0; - - if (param->flag & WILC_CFG_PARAM_RETRY_SHORT) { - wid_list[i].id = WID_SHORT_RETRY_LIMIT; - wid_list[i].val = (s8 *)¶m->short_retry_limit; - wid_list[i].type = WID_SHORT; - wid_list[i].size = sizeof(u16); - i++; - } - if (param->flag & WILC_CFG_PARAM_RETRY_LONG) { - wid_list[i].id = WID_LONG_RETRY_LIMIT; - wid_list[i].val = (s8 *)¶m->long_retry_limit; - wid_list[i].type = WID_SHORT; - wid_list[i].size = sizeof(u16); - i++; - } - if (param->flag & WILC_CFG_PARAM_FRAG_THRESHOLD) { - wid_list[i].id = WID_FRAG_THRESHOLD; - wid_list[i].val = (s8 *)¶m->frag_threshold; - wid_list[i].type = WID_SHORT; - wid_list[i].size = sizeof(u16); - i++; - } - if (param->flag & WILC_CFG_PARAM_RTS_THRESHOLD) { - wid_list[i].id = WID_RTS_THRESHOLD; - wid_list[i].val = (s8 *)¶m->rts_threshold; - wid_list[i].type = WID_SHORT; - wid_list[i].size = sizeof(u16); - i++; - } - - ret = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list, - i, wilc_get_vif_idx(vif)); - - if (ret) - netdev_err(vif->ndev, "Error in setting CFG params\n"); - - kfree(msg); -} - static int handle_scan_done(struct wilc_vif *vif, enum scan_event evt) { int result = 0; @@ -2797,26 +2749,43 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type, return result; } -int wilc_hif_set_cfg(struct wilc_vif *vif, - struct cfg_param_attr *cfg_param) +int wilc_hif_set_cfg(struct wilc_vif *vif, struct cfg_param_attr *param) { - struct host_if_msg *msg; - struct host_if_drv *hif_drv = vif->hif_drv; + struct wid wid_list[4]; + int i = 0; int result; - if (!hif_drv) { - netdev_err(vif->ndev, "%s: hif driver is NULL", __func__); - return -EFAULT; + if (param->flag & WILC_CFG_PARAM_RETRY_SHORT) { + wid_list[i].id = WID_SHORT_RETRY_LIMIT; + wid_list[i].val = (s8 *)¶m->short_retry_limit; + wid_list[i].type = WID_SHORT; + wid_list[i].size = sizeof(u16); + i++; + } + if (param->flag & WILC_CFG_PARAM_RETRY_LONG) { + wid_list[i].id = WID_LONG_RETRY_LIMIT; + wid_list[i].val = (s8 *)¶m->long_retry_limit; + wid_list[i].type = WID_SHORT; + wid_list[i].size = sizeof(u16); + i++; + } + if (param->flag & WILC_CFG_PARAM_FRAG_THRESHOLD) { + wid_list[i].id = WID_FRAG_THRESHOLD; + wid_list[i].val = (s8 *)¶m->frag_threshold; + wid_list[i].type = WID_SHORT; + wid_list[i].size = sizeof(u16); + i++; + } + if (param->flag & WILC_CFG_PARAM_RTS_THRESHOLD) { + wid_list[i].id = WID_RTS_THRESHOLD; + wid_list[i].val = (s8 *)¶m->rts_threshold; + wid_list[i].type = WID_SHORT; + wid_list[i].size = sizeof(u16); + i++; } - msg = wilc_alloc_work(vif, handle_cfg_param, false); - if (IS_ERR(msg)) - return PTR_ERR(msg); - - msg->body.cfg_info = *cfg_param; - result = wilc_enqueue_work(msg); - if (result) - kfree(msg); + result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list, + i, wilc_get_vif_idx(vif)); return result; } From patchwork Sun Dec 2 18:02: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: 10708107 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 8422B13AF for ; Sun, 2 Dec 2018 18:03:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 757942A856 for ; Sun, 2 Dec 2018 18:03:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 69EE42A85E; Sun, 2 Dec 2018 18:03: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,DKIM_SIGNED, DKIM_VALID,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 E8D832A856 for ; Sun, 2 Dec 2018 18:03:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725812AbeLBSDE (ORCPT ); Sun, 2 Dec 2018 13:03:04 -0500 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:52852 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbeLBSDE (ORCPT ); Sun, 2 Dec 2018 13:03:04 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="23451108" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 Dec 2018 11:03:02 -0700 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.108) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:03:01 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ndCiTukvZ5mXd5y4wgAYSyRWQiOqPTb/omz8u5EH7T8=; b=ewYdIPkagwHd2JKDUWYk+PP3ZMbYbFCkr4/GQWW1aZ+of1w05KV0u69iRG9eMLyJeKEglgmzsIAVloLYdXdJBbDAjPQzMMVr3qDD46ThubvK/54T906TRH4uSrHiBQnmCHFJG6sa5FtBjXj44OTs5ZOyJMxyVD2QEgC3wKutRck= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2806.namprd11.prod.outlook.com (52.135.228.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sun, 2 Dec 2018 18:03:00 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:03:00 +0000 From: To: CC: , , , , Subject: [PATCH 16/29] staging: wilc1000: handle station dump cfg ops from cfg80211 context Thread-Topic: [PATCH 16/29] staging: wilc1000: handle station dump cfg ops from cfg80211 context Thread-Index: AQHUimlCsVBtmfm3zk6CrdvyYxIHqw== Date: Sun, 2 Dec 2018 18:02:59 +0000 Message-ID: <1543773663-20561-17-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2806;6:DHv0eddppDVRTW1s3m8XBwVRV+rKoHufgHg7xIwixptRxEKtbiqPQR7OutWi5sPexIOheJSkH/JcXNP/aRQ1E0KneoWF4ItS5bmAIRUsf7R6bwUEKs+gblk354vdmeHl8b/ZTmn3BevDx76PD7zDYj/Y5/TCQXFV+vZaUGWoiUZW2KDNqvBb6qMC1SDIMrcWDmxN8mIPL1FMNgDR7xk6flEqm2jyjzrSSKOT2A1T8rwpz7HGi3STyCm5nw8VbL6t2y0gQTVK1jShN2Xf6E9BHP1RZSoqyCbLLUgVVCmV7e78zaHeLkwwJFmlPv9Ge5aDlUItXS8mC+rrxnJTl38m2HY9Z6R8G4+0EOQkwTXiRgdTVumXYFuLei8WiqxF43WJTv2Rd3IDU5iRG19j0u6Zsop3JsxjZ0pvi6wQ4dZQrbbDyL+ulcxLdGK3kS0FDz+jeFyZeORhINw55RgW5kQZgg==;5:HUWhB1dfq+j/G46y/qb5xPxOk56dy24JxqnySFiyNXrHsbL+k+Shu0kotptBI4hslerYJr1mxsfeUkRQLHtINsO6jfzNFxkRuOu/6UoBMagzT42uVhbfC9YzBpLh8yABnHCiRzdEXo08184qPtH7xoxxReTuj0af9/DecTJhBCk=;7:rJQBplxOGOCqbqX70YpGbebq3YiO0RsFvLaZCAB4nab/FeBvPfleuk/XqArH8G/RsGvSZZ6H+7zp8/goC4AgkDT5fSoaQntqeT7wriFsVCg4Eeir4WpufXi80eo1DRunIM5o5lWI6Zqn/P/VcZZY0g== x-ms-office365-filtering-correlation-id: 8ed142f5-a4de-4297-ff5b-08d658806533 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2806; x-ms-traffictypediagnostic: BYAPR11MB2806: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231455)(999002)(944501491)(52105112)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB2806;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB2806; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(366004)(39850400004)(396003)(136003)(199004)(189003)(186003)(4326008)(7736002)(26005)(14454004)(2906002)(107886003)(305945005)(386003)(53936002)(6506007)(36756003)(76176011)(6512007)(71190400001)(52116002)(71200400001)(5640700003)(14444005)(256004)(3846002)(6116002)(99286004)(5660300001)(78486014)(6486002)(446003)(11346002)(486006)(86362001)(105586002)(8676002)(97736004)(68736007)(316002)(2616005)(6436002)(476003)(54906003)(66066001)(25786009)(102836004)(81156014)(81166006)(8936002)(72206003)(2351001)(2501003)(478600001)(6916009)(106356001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2806;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: fgA2HuDSlpyb0R9Fr2o5hBxhlwgQ0ZftUucer773bx6YTGv4FTCVjSfdQqtaqtttbiY2JptwnJQ59htzPH71tXUNMZFf/xKZrn6MJSGhLUHP7KWXON2tOboKQsQ7ReguKAFBbDxlqOEUwXHKVtY7qe8ixt3mUvceGzcHcWl793zFt7CQBzuZ3mENkJo4XbiwMLdaNtDxGEqNYsONOQSWgHXCQJKhzcJ3vfymkhjJAejV6tK2K66pJdo4PHVeaSyASGE07UuLic/6le72CZEfM15mnXlPrVw0tjRc2ZqjbIzz7otIIlaw0hXiyhfF5pRrxLfRfBd1lOeRvSm2RwzfjBlCs8xnZjQJ5NCq3ex1OSo= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 8ed142f5-a4de-4297-ff5b-08d658806533 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:02:59.9200 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2806 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Refactor code to handle dump_station() callback from cfg80211 context. Instead of deferring issue of wid command now send it directly from cfg context. Also making use of wilc_get_rssi() error status in case there is a failure to post the wid command to the firmware. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 51 ++++------------------- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 5 ++- 2 files changed, 13 insertions(+), 43 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 6b1c9e3..1910f9a 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1678,27 +1678,6 @@ void wilc_resolve_disconnect_aberration(struct wilc_vif *vif) wilc_disconnect(vif, 1); } -static void handle_get_rssi(struct work_struct *work) -{ - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; - int result; - struct wid wid; - - wid.id = WID_RSSI; - wid.type = WID_CHAR; - wid.val = msg->body.data; - wid.size = sizeof(char); - - result = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1, - wilc_get_vif_idx(vif)); - if (result) - netdev_err(vif->ndev, "Failed to get RSSI value\n"); - - complete(&msg->work_comp); - /* free 'msg' data in caller */ -} - static void handle_get_statistics(struct work_struct *work) { struct host_if_msg *msg = container_of(work, struct host_if_msg, work); @@ -2620,34 +2599,22 @@ s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac, int wilc_get_rssi(struct wilc_vif *vif, s8 *rssi_level) { + struct wid wid; int result; - struct host_if_msg *msg; if (!rssi_level) { netdev_err(vif->ndev, "%s: RSSI level is NULL\n", __func__); return -EFAULT; } - msg = wilc_alloc_work(vif, handle_get_rssi, true); - if (IS_ERR(msg)) - return PTR_ERR(msg); - - msg->body.data = kzalloc(sizeof(s8), GFP_KERNEL); - if (!msg->body.data) { - kfree(msg); - return -ENOMEM; - } - - result = wilc_enqueue_work(msg); - if (result) { - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - } else { - wait_for_completion(&msg->work_comp); - *rssi_level = *msg->body.data; - } - - kfree(msg->body.data); - kfree(msg); + wid.id = WID_RSSI; + wid.type = WID_CHAR; + wid.size = sizeof(char); + wid.val = rssi_level; + result = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1, + wilc_get_vif_idx(vif)); + if (result) + netdev_err(vif->ndev, "Failed to get RSSI value\n"); return result; } diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 18370ef..4802ce9 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1659,13 +1659,16 @@ static int dump_station(struct wiphy *wiphy, struct net_device *dev, { struct wilc_priv *priv = wiphy_priv(wiphy); struct wilc_vif *vif = netdev_priv(priv->dev); + int ret; if (idx != 0) return -ENOENT; sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); - wilc_get_rssi(vif, &sinfo->signal); + ret = wilc_get_rssi(vif, &sinfo->signal); + if (ret) + return ret; memcpy(mac, priv->associated_bss, ETH_ALEN); return 0; From patchwork Sun Dec 2 18:03: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: 10708109 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 C0FE413AF for ; Sun, 2 Dec 2018 18:03:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2F482A856 for ; Sun, 2 Dec 2018 18:03:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A77532A85E; Sun, 2 Dec 2018 18:03: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,DKIM_SIGNED, DKIM_VALID,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 212052A856 for ; Sun, 2 Dec 2018 18:03:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725815AbeLBSDH (ORCPT ); Sun, 2 Dec 2018 13:03:07 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:23448 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbeLBSDH (ORCPT ); Sun, 2 Dec 2018 13:03:07 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="23899267" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 Dec 2018 11:03:05 -0700 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.108) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:03:05 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Yr8HF2PyKrYRJ6xbHRQsyu557ObUIoREqYqbMezwD0Q=; b=K9G01a+hRTdOvgeugFZC67apCgJ3evTswAre2JX852EVFatLaOvXno5+9yKPtn9NcQeJqprUiAGX1MonxJmufIOO9d409SrUcnwyGddDIDQkiYcKcTy3isW+WY9f385EWazAZpliTlLwslBlFJQmvzCezUeOhlavRja584ePhWs= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2806.namprd11.prod.outlook.com (52.135.228.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sun, 2 Dec 2018 18:03:03 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:03:03 +0000 From: To: CC: , , , , Subject: [PATCH 17/29] staging: wilc1000: refactor wilc_set_operation_mode() to avoid deferred handling Thread-Topic: [PATCH 17/29] staging: wilc1000: refactor wilc_set_operation_mode() to avoid deferred handling Thread-Index: AQHUimlEtbpaTnF9zE6bxpK9SmXI/A== Date: Sun, 2 Dec 2018 18:03:03 +0000 Message-ID: <1543773663-20561-18-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2806;6:K8WuI5b5uhT1IaJhPPUfZ8BXiimvUeMgrb3PhFrx8KAOcX5sSPbnoBya3HNa/sJZOG2NWVFmRuTpT+tD/BKZ6JRqMXa+ltcPiBEF6hzLgOnZ0A6DYcwXy5hVxOusILgrTODso0/4hiSMpi80bXujOc4bPc/Ydo/YtMzOxmVCltv7cWE1cSyKYp0Lydbdl/kLH8vQQyxvdrdqngTzeAVYkV6e1Kj3CbAHbDyHFpQZyq44LT19s/SU+6xVEf1KfPC4JwUCRaFo4EjQAB3v3O6dWmr/F/4kqQoUSMNbDM0+DVk435KgP/M9i9u7rT9pGMutdALsbzXVPQvbrmHCi/2TVWK1df718YViLCm2A4/5kETn9W0GYFfhPel87bQ1KI1oq6wfbBX4hOLRN+oygSFyOIRarcZdfT/7Nma+HElIdnwHG0Ab/WRVesQMXOvattqXglllqrpBOLxyy4w6RyxmXw==;5:9oJQvbIWaNZhL4PCWhvrGEiB5fZ0tTKz8GOIMpP6WVPN6D4Wc2CZT5UqK7AeGBE1dz2MXH9w/FXacPdIXCSDIGBbHa6KBf1hDOm2/MXOS3h77sWldQ4fuMNycfnc2bpGbd+SbI1nalfvNG6QpYHaNQ9bPdR0xwOl6aSLwKUCvXg=;7:UCjkMBb5Wihm9j2PaM2hbiNLuwbkrYeErPQTpKwDGDoFbLD95oo0GLeK1knuTbf6smdYXZSo87xmMKheHKlhWmHYVseO2YR1EZqdMT7AFZl0cfi7QmA4OIFmRaQBWw0zu+cLdQ3UQNV9GzoEPg/ILw== x-ms-office365-filtering-correlation-id: 63a84e2f-b484-428a-d8ff-08d658806709 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2806; x-ms-traffictypediagnostic: BYAPR11MB2806: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231455)(999002)(944501491)(52105112)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB2806;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB2806; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(366004)(39850400004)(396003)(136003)(199004)(189003)(186003)(4326008)(7736002)(26005)(14454004)(2906002)(107886003)(305945005)(386003)(53936002)(6506007)(36756003)(76176011)(6512007)(71190400001)(52116002)(71200400001)(5640700003)(14444005)(256004)(3846002)(6116002)(99286004)(5660300001)(78486014)(6486002)(446003)(11346002)(486006)(86362001)(105586002)(8676002)(97736004)(68736007)(316002)(2616005)(6436002)(476003)(54906003)(66066001)(25786009)(102836004)(81156014)(81166006)(8936002)(72206003)(2351001)(2501003)(478600001)(6916009)(106356001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2806;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 1ZdoupXxFR07S0IDf4IoSbLVwlRcv02p2hJQMv3Hp5oVif+zmD3QNEWc34TDNcDl6VbptcGOVojVTr/c4b7s8Op7Ah3VzPZxzKhW0uF3u9CRk6YRoQUYrKJlg5kzsno4TJBEv0ToJJVlMEGGmAGTB1sU9qFHMkTog/mhCi+caHwATpD3d0OKgaXMDA1e2E3qU925/2G5FID96tmrS8JbK7rGAa4lLixfEYsmmoq2Ou2ZHxb7yXiwOn0GS5RwC9r08D/0NJZO7a8wWg0/meyDG911s8Hyl+dlLxbBhgaYEXVoJnG4L2+MlpycHQBM3xaxOyIG3UU2lDCTC9qtUxiQnnPz2j+2BN4zazm9HvPoc10= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 63a84e2f-b484-428a-d8ff-08d658806709 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:03:03.1753 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2806 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Avoid handling of WID_CURRENT_CHANNEL wid command in deferred approach. Instead of posting the wid to work queue now handle directly from the caller context. Use structure to fill in the firmware specific format. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 49 ++++++++++--------------------- drivers/staging/wilc1000/host_interface.h | 4 --- 2 files changed, 16 insertions(+), 37 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 1910f9a..312c01e 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -85,6 +85,10 @@ struct del_all_sta { u8 mac[WILC_MAX_NUM_STA][ETH_ALEN]; }; +struct wilc_op_mode { + __le32 mode; +}; + struct wilc_reg_frame { bool reg; u8 reg_id; @@ -111,7 +115,6 @@ union message_body { struct set_ip_addr ip_info; struct drv_handler drv; struct set_multicast multicast_info; - struct op_mode mode; struct get_mac_addr get_mac_info; struct ba_session_info session_info; struct remain_ch remain_on_ch; @@ -261,28 +264,6 @@ static void handle_set_wfi_drv_handler(struct work_struct *work) kfree(msg); } -static void handle_set_operation_mode(struct work_struct *work) -{ - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; - struct op_mode *hif_op_mode = &msg->body.mode; - int ret; - struct wid wid; - - wid.id = WID_SET_OPERATION_MODE; - wid.type = WID_INT; - wid.val = (s8 *)&hif_op_mode->mode; - wid.size = sizeof(u32); - - ret = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, - wilc_get_vif_idx(vif)); - - if (ret) - netdev_err(vif->ndev, "Failed to set operation mode\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); @@ -2550,19 +2531,21 @@ int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode, int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode) { + struct wid wid; + struct wilc_op_mode op_mode; int result; - struct host_if_msg *msg; - msg = wilc_alloc_work(vif, handle_set_operation_mode, false); - if (IS_ERR(msg)) - return PTR_ERR(msg); + wid.id = WID_SET_OPERATION_MODE; + wid.type = WID_INT; + wid.size = sizeof(op_mode); + wid.val = (u8 *)&op_mode; - msg->body.mode.mode = mode; - result = wilc_enqueue_work(msg); - if (result) { - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - kfree(msg); - } + op_mode.mode = cpu_to_le32(mode); + + result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, + wilc_get_vif_idx(vif)); + if (result) + netdev_err(vif->ndev, "Failed to set operation mode\n"); return result; } diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 10d5627..e958357 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -220,10 +220,6 @@ struct drv_handler { u8 name; }; -struct op_mode { - u32 mode; -}; - struct get_mac_addr { u8 *mac_addr; }; From patchwork Sun Dec 2 18:03: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: 10708111 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 A2E8713AF for ; Sun, 2 Dec 2018 18:03:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 959592A856 for ; Sun, 2 Dec 2018 18:03:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A16C2A862; Sun, 2 Dec 2018 18:03: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,DKIM_SIGNED, DKIM_VALID,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 E46F82A856 for ; Sun, 2 Dec 2018 18:03:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725818AbeLBSDK (ORCPT ); Sun, 2 Dec 2018 13:03:10 -0500 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:63033 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbeLBSDK (ORCPT ); Sun, 2 Dec 2018 13:03:10 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="23749589" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES128-SHA; 02 Dec 2018 11:03:07 -0700 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.37) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:03:07 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RH1T78XcWMR6XyC9gVs3Bqc8tRB7iAjvZtx1Xh9a+JY=; b=Zjwt9jlPfl4aD1pS1FKSoTNEwd7KilxCX9loJzcVHZHEpkgfXIr+WqEL2yDTeYC0LfbdxFewTThQ5PTG2etdMDLVFApaQ0FYvLWOPcR8VLh5KQ+zMsKv/dkFhPshdOOZbD3OM222YuK5kcidtk1TH8uFqSQA+pkYXYkiIi8nqWc= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2806.namprd11.prod.outlook.com (52.135.228.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sun, 2 Dec 2018 18:03:05 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:03:05 +0000 From: To: CC: , , , , Subject: [PATCH 18/29] staging: wilc1000: refactor wilc_set_wfi_drv_handler() to avoid deferred handling Thread-Topic: [PATCH 18/29] staging: wilc1000: refactor wilc_set_wfi_drv_handler() to avoid deferred handling Thread-Index: AQHUimlGQnnLxfVs8kWnTqBnbz8MmA== Date: Sun, 2 Dec 2018 18:03:05 +0000 Message-ID: <1543773663-20561-19-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2806;6:kSC9lRkTAPVlldgyy0oB4ifRZj1Fm69C6IWV+80L5VcNhC7Gmy7Oc8//LZNJx4tKdhUKTfJ3kjp+Rjg4H2PbV22NSN3YhbXcTmUneInk67uK7e5WcQBsaxNtMs2Vhdg+/jJ9VyPObFcVvS2LlJilHarEEz12ktqT54JT3/HUUGwr7Zs94hXz3VTf/PORvW/12mGxqxZvCg8olH0ms7ndtOeQFobcDvgqE6qMM6pAFFYxPOOWs/cp62X/Awa8FnjDAqExPBDh6zlvdxI7oIaoiepkVx8IXjDdc63BQ6+3Orj0Don+E2WMHNFHOvviFV61LLX0pnNk6f5EwirQ0mLsP2GlPUivxItFyM+Idj7wajwJzXHGtw2K/IQsHL7x7ba++CMordyXLCsLAo6tY3ECHS424SIl9Vu+aPbT/A2k8D20O/da9tnsxwA0IxfDuHmAHaqfpTP606852JXy1cKFuQ==;5:da5/y2Eb/tTXmFOBTbhUnYdj7ykYYzHZY6Rj+1/PlxWaPnNg9xHchvpWnHKbakECqZWXi/4vG+t3b1ClyHtvCkR9M7ZKbIYjf7rRHIy9SDQYerTXNOAbHWR39V+G58MqFLkBRKEONnvzT23h0de2P4TBpBtWxMcNcMiOYAZ9Ycs=;7:uNOHWPhJP1V26L3V6zDFZcdAuDT3bjw9nTcKINZ3suQjNOut1Ur5+mWxBALRQgg4poZvHXa1ty0i5u7PDKBCTEKgmj2Q1t3IdyEiVU5Mm7OLAV2sbwrrP9KKolshzJ6QXUr7arZwBZLo4wJ96cqWDA== x-ms-office365-filtering-correlation-id: 7152ea16-917c-43f2-470f-08d6588068b1 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2806; x-ms-traffictypediagnostic: BYAPR11MB2806: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231455)(999002)(944501491)(52105112)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB2806;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB2806; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(366004)(39850400004)(396003)(136003)(199004)(189003)(186003)(4326008)(7736002)(26005)(14454004)(2906002)(107886003)(305945005)(386003)(53936002)(6506007)(36756003)(76176011)(6512007)(71190400001)(52116002)(71200400001)(5640700003)(14444005)(256004)(3846002)(6116002)(99286004)(5660300001)(78486014)(6486002)(446003)(11346002)(486006)(86362001)(105586002)(8676002)(97736004)(68736007)(316002)(2616005)(6436002)(476003)(54906003)(66066001)(25786009)(102836004)(81156014)(81166006)(8936002)(72206003)(2351001)(2501003)(478600001)(6916009)(106356001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2806;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 9v4CcYtBTofA95ABIV0qMSazNEHYSyffSdP7923tomM8Ul0Wy3V9RbAYuNRN80s2tSHZ1WH89XFCBGg6Rbvyud3cVOGVjUVlw/L4XPKkSnX/FnQS20tk0b/ObKnAN1DAwJOEntUjasoptPunFQLKWNikSTgvHDjsog0TUrdGLNcPLF7VsMVXNnmGXXlbwcVOfgtNqtlDcQgRpXB1vcoYGB3sP7Woz/Gd2RpTjl0r7bF5n/CyqkCv4hshXKlxPQkKD4HFErAqFBC535Ff9Poj6b8mocnO0wV9rd/3+iFC6dzQ7gCveAd6KrSp4/wg45DjxIajYFEqxS+eiAvaPVLTjE9BoYZGGiOds2PuGY+eRbA= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 7152ea16-917c-43f2-470f-08d6588068b1 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:03:05.7752 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2806 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Avoid handling of WID_SET_DRV_HANDLER wid command in deferred approach. Instead of posting the wid to work queue now handle directly from the caller context. Remove 'is_sync' parameter from the API as it's not required anymore. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 82 ++++++----------------- drivers/staging/wilc1000/host_interface.h | 8 +-- drivers/staging/wilc1000/linux_wlan.c | 3 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +- 4 files changed, 23 insertions(+), 72 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 312c01e..ab770d8 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -95,6 +95,11 @@ struct wilc_reg_frame { __le32 frame_type; } __packed; +struct wilc_drv_handler { + __le32 handler; + u8 mode; +} __packed; + struct set_ip_addr { u8 *ip_addr; u8 idx; @@ -113,7 +118,6 @@ union message_body { struct key_attr key_info; struct sta_inactive_t mac_info; struct set_ip_addr ip_info; - struct drv_handler drv; struct set_multicast multicast_info; struct get_mac_addr get_mac_info; struct ba_session_info session_info; @@ -221,49 +225,6 @@ static struct wilc_vif *wilc_get_vif_from_idx(struct wilc *wilc, int idx) return wilc->vif[index]; } -static void handle_set_wfi_drv_handler(struct work_struct *work) -{ - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; - struct drv_handler *hif_drv_handler = &msg->body.drv; - int ret; - struct wid wid; - u8 *currbyte, *buffer; - struct host_if_drv *hif_drv; - - if (!vif->hif_drv || !hif_drv_handler) - goto free_msg; - - hif_drv = vif->hif_drv; - - buffer = kzalloc(WILC_DRV_HANDLER_SIZE, GFP_KERNEL); - if (!buffer) - goto free_msg; - - currbyte = buffer; - put_unaligned_le32(hif_drv->driver_handler_id, currbyte); - currbyte += 4; - *currbyte = (hif_drv_handler->name | (hif_drv_handler->mode << 1)); - - wid.id = WID_SET_DRV_HANDLER; - wid.type = WID_STR; - wid.val = (s8 *)buffer; - wid.size = WILC_DRV_HANDLER_SIZE; - - ret = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, - hif_drv->driver_handler_id); - if (ret) - netdev_err(vif->ndev, "Failed to set driver handler\n"); - - kfree(buffer); - -free_msg: - if (msg->is_sync) - complete(&msg->work_comp); - - 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); @@ -2503,28 +2464,25 @@ int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel) } int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode, - u8 ifc_id, bool is_sync) + u8 ifc_id) { + struct wid wid; + struct host_if_drv *hif_drv = vif->hif_drv; int result; - struct host_if_msg *msg; - - msg = wilc_alloc_work(vif, handle_set_wfi_drv_handler, is_sync); - if (IS_ERR(msg)) - return PTR_ERR(msg); + struct wilc_drv_handler drv; - msg->body.drv.handler = index; - msg->body.drv.mode = mode; - msg->body.drv.name = ifc_id; + wid.id = WID_SET_DRV_HANDLER; + wid.type = WID_STR; + wid.size = sizeof(drv); + wid.val = (u8 *)&drv; - result = wilc_enqueue_work(msg); - if (result) { - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - kfree(msg); - return result; - } + drv.handler = cpu_to_le32(index); + drv.mode = (ifc_id | (mode << 1)); - if (is_sync) - wait_for_completion(&msg->work_comp); + result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, + hif_drv->driver_handler_id); + if (result) + netdev_err(vif->ndev, "Failed to set driver handler\n"); return result; } @@ -2814,7 +2772,7 @@ int wilc_deinit(struct wilc_vif *vif) del_timer_sync(&vif->periodic_rssi); del_timer_sync(&hif_drv->remain_on_ch_timer); - wilc_set_wfi_drv_handler(vif, 0, 0, 0, true); + wilc_set_wfi_drv_handler(vif, 0, 0, 0); if (hif_drv->usr_scan_req.scan_result) { hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, NULL, diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index e958357..7748f65 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -214,12 +214,6 @@ struct user_conn_req { void *arg; }; -struct drv_handler { - u32 handler; - u8 mode; - u8 name; -}; - struct get_mac_addr { u8 *mac_addr; }; @@ -333,7 +327,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id, int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id); void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg); int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode, - u8 ifc_id, bool is_sync); + u8 ifc_id); int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode); int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats, bool is_sync); diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 142816a..7216890 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -754,8 +754,7 @@ static int wilc_mac_open(struct net_device *ndev) for (i = 0; i < wl->vif_num; i++) { if (ndev == wl->vif[i]->ndev) { wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif), - vif->iftype, vif->ifc_id, - false); + vif->iftype, vif->ifc_id); wilc_set_operation_mode(vif, vif->iftype); break; } diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 4802ce9..3ed8ca9 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1739,7 +1739,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, if (wl->initialized) { wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif), - 0, vif->ifc_id, false); + 0, vif->ifc_id); wilc_set_operation_mode(vif, WILC_AP_MODE); wilc_set_power_mgmt(vif, 0, 0); } From patchwork Sun Dec 2 18:03: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: 10708115 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 590BC13BB for ; Sun, 2 Dec 2018 18:03:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49BD02A85A for ; Sun, 2 Dec 2018 18:03:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3DAC92A863; Sun, 2 Dec 2018 18:03: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,DKIM_SIGNED, DKIM_VALID,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 9F97C2A85A for ; Sun, 2 Dec 2018 18:03:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725823AbeLBSDO (ORCPT ); Sun, 2 Dec 2018 13:03:14 -0500 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:54455 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbeLBSDO (ORCPT ); Sun, 2 Dec 2018 13:03:14 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="21782561" 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; 02 Dec 2018 11:03:12 -0700 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.106) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:03:10 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rvKjIsycoDa89j1JM6MP0KHxl0asHd+Wdk3aWo5GHT0=; b=qDqSkJfUajYoosYBTYIWvTbtK6AUdesgtDJ+6H0yJXL/4x+ixKe8D4B/LAy/opt7MsvUCYHXZ46es3PAMkMhSxLF9hgEI9qlc3+EgfEi8oG11RzdnOTy9j4BybqOEsfhyAZi7QgbfgQEJ3MWstb77a9farV3ls03jygaKRdP5Y0= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2806.namprd11.prod.outlook.com (52.135.228.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sun, 2 Dec 2018 18:03:08 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:03:08 +0000 From: To: CC: , , , , Subject: [PATCH 19/29] staging: wilc1000: refactor wilc_get_inactive_time() to avoid deferred handling Thread-Topic: [PATCH 19/29] staging: wilc1000: refactor wilc_get_inactive_time() to avoid deferred handling Thread-Index: AQHUimlIjY3qL0ugG0mrd0vznqezCA== Date: Sun, 2 Dec 2018 18:03:08 +0000 Message-ID: <1543773663-20561-20-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2806;6:cBVYCe09dZ381YrtRMsG/mboUm4qA6oLIiJwq5IeNZIb5Gtw7gZax1gtE5vQTZOYL15ry82mqtWzbXiDIaf6mgkSjKqAmMWg6vS0qBsWCfLNRWHQTynHeBwuABCPvbGyJPXL47RgDGGwI8J4WZeuMHi9BQ6ewC/OQIhtEbQwuiIQ6xtMpeJPjQuONd7tNBs88jKjrnOzdO2DjvArzSmU2N/a78A7JJZgBa+msrpDEsJ6QTNMyyIq1UVBfAjUr/A4DLYgHHszv/dy0IhA+xU/AygYsQrlI3o0uoWHVwPFgQlSfKIDkFBzR1c8hjRmYryDaZFddb8wh9Wh3mAF3aP/h1eMWhBTr2PG5jHUX0MLxIFVFB2WBLRMmPUhRxj11d/jEIg6zBAkzKPpALtY9kT8NlTFy1LZSXkUEQhWmtl6Nd7mzF44uAEvjJ6dGC+r4QPlWGkqKS/c81q6FkxBAERh9A==;5:XN595j2X9If4Q/fAdwbsLTcm9e3nUjmJrNGFAApAuReVu+ypcAe+r4h5wzEPms3vEezoUgZBJRIg+roqlZf9vvL4cyFbx0dwRfHwHrPdq+VxgQnyVCk48lepZgWEKQvy6eXqOkT2DCfQuky4WD/sgLBimZ2DCFWH4tiE+54lYgY=;7:4w4lBOT5+Qrm+wq8nPhNJ7xEzeIL7c7usDJBlHU/yFogbpozp+u0yUnoJbHQiTADVyPd/TiShDK+eDiM2Mu8rbN2uOHbaueSavZLvbp1/qp+kweVUBUauycbn0Ne0hnAX7elDiTB+K5JumriMp0s4Q== x-ms-office365-filtering-correlation-id: ac570baf-5c91-4f2e-e016-08d658806a56 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2806; x-ms-traffictypediagnostic: BYAPR11MB2806: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231455)(999002)(944501491)(52105112)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB2806;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB2806; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(366004)(39850400004)(396003)(136003)(199004)(189003)(186003)(4326008)(7736002)(26005)(14454004)(2906002)(107886003)(305945005)(386003)(53936002)(6506007)(36756003)(76176011)(6512007)(71190400001)(52116002)(71200400001)(5640700003)(14444005)(256004)(3846002)(6116002)(99286004)(5660300001)(78486014)(6486002)(446003)(11346002)(486006)(86362001)(105586002)(8676002)(97736004)(68736007)(316002)(2616005)(6436002)(476003)(54906003)(66066001)(25786009)(102836004)(81156014)(81166006)(8936002)(72206003)(2351001)(2501003)(478600001)(6916009)(106356001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2806;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: hTaeK6OSsj5iD86u6zCTBnKCzmBgBDvAL7D9XgxQ8HqMJvD4jAzbfXqnlslZoPxjcDdcnN8Av2ZRZ4Ey4dlWvxyrFyfyEPx20IzxqGgHkm9wrK17PjaKb7op/TT6Vgp6ixRMGGzPA43qEJhaflX8HLLuF5qZ6v97mfuyiQRXlT0KCZngfc0TUtHHhFDslV9amr0bitiR7NLIVjDOCUcoS54n6wQsspte/rQb4FQSemeG/BDH0a6rrHD9dopXndXS6Z8i/9aWUjlNr9mLUc/F4a9DT6KX6OLv5mG67wS2jxqjBInLlVeLBi22f1OEU0G7+4djin0i+L+tTyqxuLjrrsMNyVm66vaoE/ZLOAvpxFw= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: ac570baf-5c91-4f2e-e016-08d658806a56 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:03:08.7193 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2806 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Avoid handling of inactive time related wid command in deferred manner. Instead of posting the wid to workqueue now handle directly from the caller context. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 91 ++++++++----------------------- 1 file changed, 23 insertions(+), 68 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index ab770d8..e3dc9b6 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -105,18 +105,12 @@ struct set_ip_addr { u8 idx; }; -struct sta_inactive_t { - u32 inactive_time; - u8 mac[6]; -}; - union message_body { struct scan_attr scan_info; struct connect_attr con_info; struct rcvd_net_info net_info; struct rcvd_async_info async_info; struct key_attr key_info; - struct sta_inactive_t mac_info; struct set_ip_addr ip_info; struct set_multicast multicast_info; struct get_mac_addr get_mac_info; @@ -1678,48 +1672,6 @@ static void handle_get_statistics(struct work_struct *work) kfree(msg); } -static void handle_get_inactive_time(struct work_struct *work) -{ - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; - struct sta_inactive_t *hif_sta_inactive = &msg->body.mac_info; - int result; - struct wid wid; - - wid.id = WID_SET_STA_MAC_INACTIVE_TIME; - wid.type = WID_STR; - wid.size = ETH_ALEN; - wid.val = kmalloc(wid.size, GFP_KERNEL); - if (!wid.val) - goto out; - - ether_addr_copy(wid.val, hif_sta_inactive->mac); - - result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, - wilc_get_vif_idx(vif)); - kfree(wid.val); - - if (result) { - netdev_err(vif->ndev, "Failed to set inactive mac\n"); - goto out; - } - - wid.id = WID_GET_INACTIVE_TIME; - wid.type = WID_INT; - wid.val = (s8 *)&hif_sta_inactive->inactive_time; - wid.size = sizeof(u32); - - result = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1, - wilc_get_vif_idx(vif)); - - if (result) - netdev_err(vif->ndev, "Failed to get inactive time\n"); - -out: - /* free 'msg' data in caller */ - complete(&msg->work_comp); -} - static void wilc_hif_pack_sta_param(u8 *cur_byte, const u8 *mac, struct station_parameters *params) { @@ -2508,32 +2460,35 @@ int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode) return result; } -s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac, - u32 *out_val) +s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac, u32 *out_val) { + struct wid wid; s32 result; - struct host_if_msg *msg; - struct host_if_drv *hif_drv = vif->hif_drv; - - if (!hif_drv) { - netdev_err(vif->ndev, "%s: hif driver is NULL", __func__); - return -EFAULT; - } - msg = wilc_alloc_work(vif, handle_get_inactive_time, true); - if (IS_ERR(msg)) - return PTR_ERR(msg); + wid.id = WID_SET_STA_MAC_INACTIVE_TIME; + wid.type = WID_STR; + wid.size = ETH_ALEN; + wid.val = kzalloc(wid.size, GFP_KERNEL); + if (!wid.val) + return -ENOMEM; - memcpy(msg->body.mac_info.mac, mac, ETH_ALEN); + ether_addr_copy(wid.val, mac); + result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, + wilc_get_vif_idx(vif)); + kfree(wid.val); + if (result) { + netdev_err(vif->ndev, "Failed to set inactive mac\n"); + return result; + } - result = wilc_enqueue_work(msg); + wid.id = WID_GET_INACTIVE_TIME; + wid.type = WID_INT; + wid.val = (s8 *)out_val; + wid.size = sizeof(u32); + result = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1, + wilc_get_vif_idx(vif)); if (result) - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - else - wait_for_completion(&msg->work_comp); - - *out_val = msg->body.mac_info.inactive_time; - kfree(msg); + netdev_err(vif->ndev, "Failed to get inactive time\n"); return result; } From patchwork Sun Dec 2 18:03: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: 10708117 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 154F613AF for ; Sun, 2 Dec 2018 18:03:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 037222A856 for ; Sun, 2 Dec 2018 18:03:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA0D52A85E; Sun, 2 Dec 2018 18:03: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,DKIM_SIGNED, DKIM_VALID,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 61C562A85A for ; Sun, 2 Dec 2018 18:03:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725826AbeLBSDR (ORCPT ); Sun, 2 Dec 2018 13:03:17 -0500 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:40381 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbeLBSDQ (ORCPT ); Sun, 2 Dec 2018 13:03:16 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="21024676" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 Dec 2018 11:03:14 -0700 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.107) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:03:13 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UoXt3BRimfdOpoh0CNxpwtetEwX20T3pvydZpw5/au8=; b=ElEMwvYNMbos3DHTyltyRPflTWFtnFt71nN3t0m1ffw4oxhhcuYVcKREPOCoH9NSDPOWtZTQ6VxP1XCV7/pWogjwJOLHFl7bnFQJEWQei+/JF0Ls1zgwrK0BL5veGikXfOZRqANIHmX0HriIjP79+TY0gRt8U9VQEIXEzPH3wNI= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2806.namprd11.prod.outlook.com (52.135.228.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sun, 2 Dec 2018 18:03:11 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:03:11 +0000 From: To: CC: , , , , Subject: [PATCH 20/29] staging: wilc1000: handle key related cfg operation from cfg80211 context Thread-Topic: [PATCH 20/29] staging: wilc1000: handle key related cfg operation from cfg80211 context Thread-Index: AQHUimlJPUERpJZfEEK33tNY0thdbQ== Date: Sun, 2 Dec 2018 18:03:11 +0000 Message-ID: <1543773663-20561-21-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2806;6:0ec1SLFgVN4DOB1FJLAowUzzcMYv+aRlNcEv3Xz6GH4ATXldYFZ9tslpXK2PunfeuMCDoFdcpKIm8PnxxfyBwC+5PP3uQooN0OKO+p8wIAmtVZirZ6S9qYQsfOoNc6yNif5k21y27E0H32VZ925gXQQBIyWwWw+ozojSOU59pscjy/m5yX2LlPzRFoBhH2afM0pBbDqL4YzNIXZpNH+axKiyE0I1PHLw5MtIZcVPpz70OnbWc9cO7IcN3JrkJS1lZAFRKcastMxyiH0Bgw/uzlJ3RPS+rctZtvOfvyEuNIEOTxPDMGVnIpxRnjb+K6Pvckr4Jd4erxsmuvQVFrzergpaZ/ALAxlcSABC0eLR5V9mDMfB3/Sn+/lEelL0xLIQu3SZSnGcQlJXcXZi5sGh5nOV2JOArmJJpei3DbIH9l8cpB+rmw/GKaJLVkPPhsQ96P0GiI09jQoEWYtKAlb9xA==;5:DD16+tKVl1uimYCiDevwVvg8uRClPKKz5rrpstVtRfP1JJHIVeLOMota2CSY1FYm52Tyo0Q0EV71B2seROrxzqSPne87nJObNTxOlbA0kX0R6+gHcTct4F0QgekDYHLbt96ogMu2pn3anQk1u569OR63Z/CFl3z1DIGppTiEWbc=;7:V32N7XSgQ3IGH+tPq4w/0GW2IdTwiaDqpd20LBny54cH2kgLxSFkaus8aaJv/Uq3t91S5qhuChQr7p4ZY3dsLy/4Dg+4E4W1jxFWqwHQy7RK0hcv9G7utHWo++m/3HTk0v0tbYQc61+8cRwufzKKJw== x-ms-office365-filtering-correlation-id: 91d2f2e0-376d-4b64-ca77-08d658806c19 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2806; x-ms-traffictypediagnostic: BYAPR11MB2806: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231455)(999002)(944501491)(52105112)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB2806;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB2806; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(366004)(39850400004)(396003)(136003)(199004)(189003)(186003)(4326008)(7736002)(26005)(14454004)(2906002)(107886003)(305945005)(386003)(53936002)(6506007)(36756003)(53946003)(76176011)(6512007)(71190400001)(52116002)(71200400001)(5640700003)(14444005)(256004)(3846002)(6116002)(99286004)(5660300001)(78486014)(6486002)(446003)(11346002)(486006)(86362001)(105586002)(8676002)(97736004)(68736007)(316002)(2616005)(6436002)(476003)(54906003)(4744004)(66066001)(25786009)(102836004)(81156014)(81166006)(8936002)(72206003)(2351001)(2501003)(478600001)(6916009)(106356001)(579004)(559001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2806;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: idlQTHEZJwihkx8Ws3skqkxgPq9FLgKkzoA0nAsmVyo2G9ls17xFLrx9/B2fMqwffl2LItHFozA64zn8BHirJRE9Qgk+HaUqvI2iO1SswDcez0hwMR2r59UtWJwGS+AUJGzxgaTAYEeB7LyhdORfM4eaXWLe6jJYPHADDRlSe/Tl9FBbeJGNVyQtdzbzKzOkW/ZVFDzuKAXwUOT4NgNVfD55vUe3kOFQdICL7TtF09fLQtvk6wTXrqtPeYdQodjqeOH4dSoZdeF9p+YXt9+quygb3UrZGP65xzNSpHvgdX1wIfFzg5tVQ3X7MBEmIFAV8hdNhK0l1S7RqeHgflvjqXa20UrhjpFY4FYTbgN8E4E= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 91d2f2e0-376d-4b64-ca77-08d658806c19 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:03:11.6164 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2806 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Refactor add/delete key operation to handle directly from cfg80211 context. Also, avoid an extra copy of the information in hif layer and directly fill the buffer in firmware format. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 691 ++++++---------------- drivers/staging/wilc1000/host_interface.h | 13 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 +- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +- 4 files changed, 204 insertions(+), 506 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index e3dc9b6..596a321 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -37,12 +37,6 @@ union host_if_key_attr { struct host_if_pmkid_attr pmkid; }; -struct key_attr { - enum KEY_TYPE type; - u8 action; - union host_if_key_attr attr; -}; - struct scan_attr { u8 src; u8 type; @@ -100,6 +94,33 @@ struct wilc_drv_handler { u8 mode; } __packed; +struct wilc_wep_key { + u8 index; + u8 key_len; + u8 key[0]; +} __packed; + +struct wilc_sta_wpa_ptk { + u8 mac_addr[ETH_ALEN]; + u8 key_len; + u8 key[0]; +} __packed; + +struct wilc_ap_wpa_ptk { + u8 mac_addr[ETH_ALEN]; + u8 index; + u8 key_len; + u8 key[0]; +} __packed; + +struct wilc_gtk_key { + u8 mac_addr[ETH_ALEN]; + u8 rsc[8]; + u8 index; + u8 key_len; + u8 key[0]; +} __packed; + struct set_ip_addr { u8 *ip_addr; u8 idx; @@ -110,7 +131,6 @@ union message_body { struct connect_attr con_info; struct rcvd_net_info net_info; struct rcvd_async_info async_info; - struct key_attr key_info; struct set_ip_addr ip_info; struct set_multicast multicast_info; struct get_mac_addr get_mac_info; @@ -1275,264 +1295,6 @@ static void handle_rcvd_gnrl_async_info(struct work_struct *work) kfree(msg); } -static int wilc_pmksa_key_copy(struct wilc_vif *vif, struct key_attr *hif_key) -{ - int i; - int ret; - struct wid wid; - u8 *key_buf; - - key_buf = kmalloc((hif_key->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1, - GFP_KERNEL); - if (!key_buf) - return -ENOMEM; - - key_buf[0] = hif_key->attr.pmkid.numpmkid; - - for (i = 0; i < hif_key->attr.pmkid.numpmkid; i++) { - memcpy(key_buf + ((PMKSA_KEY_LEN * i) + 1), - hif_key->attr.pmkid.pmkidlist[i].bssid, ETH_ALEN); - memcpy(key_buf + ((PMKSA_KEY_LEN * i) + ETH_ALEN + 1), - hif_key->attr.pmkid.pmkidlist[i].pmkid, WLAN_PMKID_LEN); - } - - wid.id = WID_PMKID_INFO; - wid.type = WID_STR; - wid.val = (s8 *)key_buf; - wid.size = (hif_key->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1; - - ret = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, - wilc_get_vif_idx(vif)); - - kfree(key_buf); - - return ret; -} - -static void handle_key(struct work_struct *work) -{ - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; - struct key_attr *hif_key = &msg->body.key_info; - int result = 0; - struct wid wid; - struct wid wid_list[5]; - u8 *key_buf; - struct host_if_drv *hif_drv = vif->hif_drv; - - switch (hif_key->type) { - case WILC_KEY_TYPE_WEP: - - if (hif_key->action & WILC_ADD_KEY_AP) { - wid_list[0].id = WID_11I_MODE; - wid_list[0].type = WID_CHAR; - wid_list[0].size = sizeof(char); - wid_list[0].val = (s8 *)&hif_key->attr.wep.mode; - - wid_list[1].id = WID_AUTH_TYPE; - wid_list[1].type = WID_CHAR; - wid_list[1].size = sizeof(char); - wid_list[1].val = (s8 *)&hif_key->attr.wep.auth_type; - - key_buf = kmalloc(hif_key->attr.wep.key_len + 2, - GFP_KERNEL); - if (!key_buf) { - result = -ENOMEM; - goto out_wep; - } - - key_buf[0] = hif_key->attr.wep.index; - key_buf[1] = hif_key->attr.wep.key_len; - - memcpy(&key_buf[2], hif_key->attr.wep.key, - hif_key->attr.wep.key_len); - - wid_list[2].id = WID_WEP_KEY_VALUE; - wid_list[2].type = WID_STR; - wid_list[2].size = hif_key->attr.wep.key_len + 2; - wid_list[2].val = (s8 *)key_buf; - - result = wilc_send_config_pkt(vif, WILC_SET_CFG, - wid_list, 3, - wilc_get_vif_idx(vif)); - kfree(key_buf); - } else if (hif_key->action & WILC_ADD_KEY) { - key_buf = kmalloc(hif_key->attr.wep.key_len + 2, - GFP_KERNEL); - if (!key_buf) { - result = -ENOMEM; - goto out_wep; - } - key_buf[0] = hif_key->attr.wep.index; - memcpy(key_buf + 1, &hif_key->attr.wep.key_len, 1); - memcpy(key_buf + 2, hif_key->attr.wep.key, - hif_key->attr.wep.key_len); - - wid.id = WID_ADD_WEP_KEY; - wid.type = WID_STR; - wid.val = (s8 *)key_buf; - wid.size = hif_key->attr.wep.key_len + 2; - - result = wilc_send_config_pkt(vif, WILC_SET_CFG, - &wid, 1, - wilc_get_vif_idx(vif)); - kfree(key_buf); - } else if (hif_key->action & WILC_REMOVE_KEY) { - wid.id = WID_REMOVE_WEP_KEY; - wid.type = WID_STR; - - wid.val = (s8 *)&hif_key->attr.wep.index; - wid.size = 1; - - result = wilc_send_config_pkt(vif, WILC_SET_CFG, - &wid, 1, - wilc_get_vif_idx(vif)); - } else if (hif_key->action & WILC_DEFAULT_KEY) { - wid.id = WID_KEY_ID; - wid.type = WID_CHAR; - wid.val = (s8 *)&hif_key->attr.wep.index; - wid.size = sizeof(char); - - result = wilc_send_config_pkt(vif, WILC_SET_CFG, - &wid, 1, - wilc_get_vif_idx(vif)); - } -out_wep: - complete(&msg->work_comp); - break; - - case WILC_KEY_TYPE_WPA_RX_GTK: - if (hif_key->action & WILC_ADD_KEY_AP) { - key_buf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); - if (!key_buf) { - result = -ENOMEM; - goto out_wpa_rx_gtk; - } - - if (hif_key->attr.wpa.seq) - memcpy(key_buf + 6, hif_key->attr.wpa.seq, 8); - - memcpy(key_buf + 14, &hif_key->attr.wpa.index, 1); - memcpy(key_buf + 15, &hif_key->attr.wpa.key_len, 1); - memcpy(key_buf + 16, hif_key->attr.wpa.key, - hif_key->attr.wpa.key_len); - - wid_list[0].id = WID_11I_MODE; - wid_list[0].type = WID_CHAR; - wid_list[0].size = sizeof(char); - wid_list[0].val = (s8 *)&hif_key->attr.wpa.mode; - - wid_list[1].id = WID_ADD_RX_GTK; - wid_list[1].type = WID_STR; - wid_list[1].val = (s8 *)key_buf; - wid_list[1].size = RX_MIC_KEY_MSG_LEN; - - result = wilc_send_config_pkt(vif, WILC_SET_CFG, - wid_list, 2, - wilc_get_vif_idx(vif)); - - kfree(key_buf); - } else if (hif_key->action & WILC_ADD_KEY) { - key_buf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); - if (!key_buf) { - result = -ENOMEM; - goto out_wpa_rx_gtk; - } - - if (hif_drv->hif_state == HOST_IF_CONNECTED) - memcpy(key_buf, hif_drv->assoc_bssid, ETH_ALEN); - else - netdev_err(vif->ndev, "Couldn't handle\n"); - - memcpy(key_buf + 6, hif_key->attr.wpa.seq, 8); - memcpy(key_buf + 14, &hif_key->attr.wpa.index, 1); - memcpy(key_buf + 15, &hif_key->attr.wpa.key_len, 1); - memcpy(key_buf + 16, hif_key->attr.wpa.key, - hif_key->attr.wpa.key_len); - - wid.id = WID_ADD_RX_GTK; - wid.type = WID_STR; - wid.val = (s8 *)key_buf; - wid.size = RX_MIC_KEY_MSG_LEN; - - result = wilc_send_config_pkt(vif, WILC_SET_CFG, - &wid, 1, - wilc_get_vif_idx(vif)); - - kfree(key_buf); - } -out_wpa_rx_gtk: - complete(&msg->work_comp); - break; - - case WILC_KEY_TYPE_WPA_PTK: - if (hif_key->action & WILC_ADD_KEY_AP) { - key_buf = kmalloc(PTK_KEY_MSG_LEN + 1, GFP_KERNEL); - if (!key_buf) { - result = -ENOMEM; - goto out_wpa_ptk; - } - - memcpy(key_buf, hif_key->attr.wpa.mac_addr, 6); - memcpy(key_buf + 6, &hif_key->attr.wpa.index, 1); - memcpy(key_buf + 7, &hif_key->attr.wpa.key_len, 1); - memcpy(key_buf + 8, hif_key->attr.wpa.key, - hif_key->attr.wpa.key_len); - - wid_list[0].id = WID_11I_MODE; - wid_list[0].type = WID_CHAR; - wid_list[0].size = sizeof(char); - wid_list[0].val = (s8 *)&hif_key->attr.wpa.mode; - - wid_list[1].id = WID_ADD_PTK; - wid_list[1].type = WID_STR; - wid_list[1].val = (s8 *)key_buf; - wid_list[1].size = PTK_KEY_MSG_LEN + 1; - - result = wilc_send_config_pkt(vif, WILC_SET_CFG, - wid_list, 2, - wilc_get_vif_idx(vif)); - kfree(key_buf); - } else if (hif_key->action & WILC_ADD_KEY) { - key_buf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL); - if (!key_buf) { - result = -ENOMEM; - goto out_wpa_ptk; - } - - memcpy(key_buf, hif_key->attr.wpa.mac_addr, 6); - memcpy(key_buf + 6, &hif_key->attr.wpa.key_len, 1); - memcpy(key_buf + 7, hif_key->attr.wpa.key, - hif_key->attr.wpa.key_len); - - wid.id = WID_ADD_PTK; - wid.type = WID_STR; - wid.val = (s8 *)key_buf; - wid.size = PTK_KEY_MSG_LEN; - - result = wilc_send_config_pkt(vif, WILC_SET_CFG, - &wid, 1, - wilc_get_vif_idx(vif)); - kfree(key_buf); - } - -out_wpa_ptk: - complete(&msg->work_comp); - break; - - case WILC_KEY_TYPE_PMKSA: - result = wilc_pmksa_key_copy(vif, hif_key); - /*free 'msg', this case it not a sync call*/ - kfree(msg); - break; - } - - if (result) - netdev_err(vif->ndev, "Failed to send key config packet\n"); - - /* free 'msg' data in caller sync call */ -} - static void handle_disconnect(struct work_struct *work) { struct host_if_msg *msg = container_of(work, struct host_if_msg, work); @@ -1944,145 +1706,107 @@ static void timer_connect_cb(struct timer_list *t) int wilc_remove_wep_key(struct wilc_vif *vif, u8 index) { + struct wid wid; int result; - struct host_if_msg *msg; - struct host_if_drv *hif_drv = vif->hif_drv; - if (!hif_drv) { - result = -EFAULT; - netdev_err(vif->ndev, "%s: hif driver is NULL", __func__); - return result; - } - - msg = wilc_alloc_work(vif, handle_key, true); - if (IS_ERR(msg)) - return PTR_ERR(msg); - - msg->body.key_info.type = WILC_KEY_TYPE_WEP; - msg->body.key_info.action = WILC_REMOVE_KEY; - msg->body.key_info.attr.wep.index = index; + wid.id = WID_REMOVE_WEP_KEY; + wid.type = WID_STR; + wid.size = sizeof(char); + wid.val = &index; - result = wilc_enqueue_work(msg); + result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, + wilc_get_vif_idx(vif)); if (result) - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - else - wait_for_completion(&msg->work_comp); - - kfree(msg); + netdev_err(vif->ndev, + "Failed to send remove wep key config packet\n"); return result; } int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index) { + struct wid wid; int result; - struct host_if_msg *msg; - struct host_if_drv *hif_drv = vif->hif_drv; - if (!hif_drv) { - result = -EFAULT; - netdev_err(vif->ndev, "%s: hif driver is NULL\n", __func__); - return result; - } - - msg = wilc_alloc_work(vif, handle_key, true); - if (IS_ERR(msg)) - return PTR_ERR(msg); - - msg->body.key_info.type = WILC_KEY_TYPE_WEP; - msg->body.key_info.action = WILC_DEFAULT_KEY; - msg->body.key_info.attr.wep.index = index; - - result = wilc_enqueue_work(msg); + wid.id = WID_KEY_ID; + wid.type = WID_CHAR; + wid.size = sizeof(char); + wid.val = &index; + result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, + wilc_get_vif_idx(vif)); if (result) - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - else - wait_for_completion(&msg->work_comp); + netdev_err(vif->ndev, + "Failed to send wep default key config packet\n"); - kfree(msg); return result; } int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len, u8 index) { + struct wid wid; int result; - struct host_if_msg *msg; - struct host_if_drv *hif_drv = vif->hif_drv; + struct wilc_wep_key *wep_key; - if (!hif_drv) { - netdev_err(vif->ndev, "%s: hif driver is NULL", __func__); - return -EFAULT; - } - - msg = wilc_alloc_work(vif, handle_key, true); - if (IS_ERR(msg)) - return PTR_ERR(msg); + wid.id = WID_ADD_WEP_KEY; + wid.type = WID_STR; + wid.size = sizeof(*wep_key) + len; + wep_key = kzalloc(wid.size, GFP_KERNEL); + if (!wep_key) + return -ENOMEM; - msg->body.key_info.type = WILC_KEY_TYPE_WEP; - msg->body.key_info.action = WILC_ADD_KEY; - msg->body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL); - if (!msg->body.key_info.attr.wep.key) { - result = -ENOMEM; - goto free_msg; - } + wid.val = (u8 *)wep_key; - msg->body.key_info.attr.wep.key_len = len; - msg->body.key_info.attr.wep.index = index; + wep_key->index = index; + wep_key->key_len = len; + memcpy(wep_key->key, key, len); - result = wilc_enqueue_work(msg); + result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, + wilc_get_vif_idx(vif)); if (result) - goto free_key; - - wait_for_completion(&msg->work_comp); - -free_key: - kfree(msg->body.key_info.attr.wep.key); + netdev_err(vif->ndev, + "Failed to add wep key config packet\n"); -free_msg: - kfree(msg); + kfree(wep_key); return result; } int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len, u8 index, u8 mode, enum authtype auth_type) { + struct wid wid_list[3]; int result; - struct host_if_msg *msg; - struct host_if_drv *hif_drv = vif->hif_drv; - - if (!hif_drv) { - netdev_err(vif->ndev, "%s: hif driver is NULL\n", __func__); - return -EFAULT; - } - - msg = wilc_alloc_work(vif, handle_key, true); - if (IS_ERR(msg)) - return PTR_ERR(msg); - - msg->body.key_info.type = WILC_KEY_TYPE_WEP; - msg->body.key_info.action = WILC_ADD_KEY_AP; - msg->body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL); - if (!msg->body.key_info.attr.wep.key) { - result = -ENOMEM; - goto free_msg; - } + struct wilc_wep_key *wep_key; + + wid_list[0].id = WID_11I_MODE; + wid_list[0].type = WID_CHAR; + wid_list[0].size = sizeof(char); + wid_list[0].val = &mode; + + wid_list[1].id = WID_AUTH_TYPE; + wid_list[1].type = WID_CHAR; + wid_list[1].size = sizeof(char); + wid_list[1].val = (s8 *)&auth_type; + + wid_list[2].id = WID_WEP_KEY_VALUE; + wid_list[2].type = WID_STR; + wid_list[2].size = sizeof(*wep_key) + len; + wep_key = kzalloc(wid_list[2].size, GFP_KERNEL); + if (!wep_key) + return -ENOMEM; - msg->body.key_info.attr.wep.key_len = len; - msg->body.key_info.attr.wep.index = index; - msg->body.key_info.attr.wep.mode = mode; - msg->body.key_info.attr.wep.auth_type = auth_type; + wid_list[2].val = (u8 *)wep_key; - result = wilc_enqueue_work(msg); + wep_key->index = index; + wep_key->key_len = len; + memcpy(wep_key->key, key, len); + result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list, + ARRAY_SIZE(wid_list), + wilc_get_vif_idx(vif)); if (result) - goto free_key; - - wait_for_completion(&msg->work_comp); - -free_key: - kfree(msg->body.key_info.attr.wep.key); + netdev_err(vif->ndev, + "Failed to add wep ap key config packet\n"); -free_msg: - kfree(msg); + kfree(wep_key); return result; } @@ -2090,65 +1814,72 @@ int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len, const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic, u8 mode, u8 cipher_mode, u8 index) { - int result; - struct host_if_msg *msg; - struct host_if_drv *hif_drv = vif->hif_drv; - u8 key_len = ptk_key_len; - - if (!hif_drv) { - netdev_err(vif->ndev, "%s: hif driver is NULL", __func__); - return -EFAULT; - } + int result = 0; + u8 t_key_len = ptk_key_len + RX_MIC_KEY_LEN + TX_MIC_KEY_LEN; - if (rx_mic) - key_len += RX_MIC_KEY_LEN; + if (mode == WILC_AP_MODE) { + struct wid wid_list[2]; + struct wilc_ap_wpa_ptk *key_buf; - if (tx_mic) - key_len += TX_MIC_KEY_LEN; + wid_list[0].id = WID_11I_MODE; + wid_list[0].type = WID_CHAR; + wid_list[0].size = sizeof(char); + wid_list[0].val = (s8 *)&cipher_mode; - msg = wilc_alloc_work(vif, handle_key, true); - if (IS_ERR(msg)) - return PTR_ERR(msg); + key_buf = kzalloc(sizeof(*key_buf) + t_key_len, GFP_KERNEL); + if (!key_buf) + return -ENOMEM; - msg->body.key_info.type = WILC_KEY_TYPE_WPA_PTK; - if (mode == WILC_AP_MODE) { - msg->body.key_info.action = WILC_ADD_KEY_AP; - msg->body.key_info.attr.wpa.index = index; - } - if (mode == WILC_STATION_MODE) - msg->body.key_info.action = WILC_ADD_KEY; + ether_addr_copy(key_buf->mac_addr, mac_addr); + key_buf->index = index; + key_buf->key_len = t_key_len; + memcpy(&key_buf->key[0], ptk, ptk_key_len); + + if (rx_mic) + memcpy(&key_buf->key[ptk_key_len], rx_mic, + RX_MIC_KEY_LEN); + + if (tx_mic) + memcpy(&key_buf->key[ptk_key_len + RX_MIC_KEY_LEN], + tx_mic, TX_MIC_KEY_LEN); + + wid_list[1].id = WID_ADD_PTK; + wid_list[1].type = WID_STR; + wid_list[1].size = sizeof(*key_buf) + t_key_len; + wid_list[1].val = (u8 *)key_buf; + result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list, + ARRAY_SIZE(wid_list), + wilc_get_vif_idx(vif)); + kfree(key_buf); + } else if (mode == WILC_STATION_MODE) { + struct wid wid; + struct wilc_sta_wpa_ptk *key_buf; - msg->body.key_info.attr.wpa.key = kmemdup(ptk, ptk_key_len, GFP_KERNEL); - if (!msg->body.key_info.attr.wpa.key) { - result = -ENOMEM; - goto free_msg; - } + key_buf = kzalloc(sizeof(*key_buf) + t_key_len, GFP_KERNEL); + if (!key_buf) + return -ENOMEM; - if (rx_mic) - memcpy(msg->body.key_info.attr.wpa.key + 16, rx_mic, - RX_MIC_KEY_LEN); + ether_addr_copy(key_buf->mac_addr, mac_addr); + key_buf->key_len = t_key_len; + memcpy(&key_buf->key[0], ptk, ptk_key_len); - if (tx_mic) - memcpy(msg->body.key_info.attr.wpa.key + 24, tx_mic, - TX_MIC_KEY_LEN); + if (rx_mic) + memcpy(&key_buf->key[ptk_key_len], rx_mic, + RX_MIC_KEY_LEN); - msg->body.key_info.attr.wpa.key_len = key_len; - msg->body.key_info.attr.wpa.mac_addr = mac_addr; - msg->body.key_info.attr.wpa.mode = cipher_mode; + if (tx_mic) + memcpy(&key_buf->key[ptk_key_len + RX_MIC_KEY_LEN], + tx_mic, TX_MIC_KEY_LEN); - result = wilc_enqueue_work(msg); - if (result) { - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - goto free_key; + wid.id = WID_ADD_PTK; + wid.type = WID_STR; + wid.size = sizeof(*key_buf) + t_key_len; + wid.val = (s8 *)key_buf; + result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, + wilc_get_vif_idx(vif)); + kfree(key_buf); } - wait_for_completion(&msg->work_comp); - -free_key: - kfree(msg->body.key_info.attr.wpa.key); - -free_msg: - kfree(msg); return result; } @@ -2157,108 +1888,76 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len, const u8 *rx_mic, const u8 *tx_mic, u8 mode, u8 cipher_mode) { - int result; - struct host_if_msg *msg; - struct host_if_drv *hif_drv = vif->hif_drv; - u8 key_len = gtk_key_len; + int result = 0; + struct wilc_gtk_key *gtk_key; + int t_key_len = gtk_key_len + RX_MIC_KEY_LEN + TX_MIC_KEY_LEN; - if (!hif_drv) { - netdev_err(vif->ndev, "%s: hif driver is NULL", __func__); - return -EFAULT; - } + gtk_key = kzalloc(sizeof(*gtk_key) + t_key_len, GFP_KERNEL); + if (!gtk_key) + return -ENOMEM; - msg = wilc_alloc_work(vif, handle_key, true); - if (IS_ERR(msg)) - return PTR_ERR(msg); + /* fill bssid value only in station mode */ + if (mode == WILC_STATION_MODE && + vif->hif_drv->hif_state == HOST_IF_CONNECTED) + memcpy(gtk_key->mac_addr, vif->hif_drv->assoc_bssid, ETH_ALEN); + + if (key_rsc) + memcpy(gtk_key->rsc, key_rsc, 8); + gtk_key->index = index; + gtk_key->key_len = t_key_len; + memcpy(>k_key->key[0], rx_gtk, gtk_key_len); if (rx_mic) - key_len += RX_MIC_KEY_LEN; + memcpy(>k_key->key[gtk_key_len], rx_mic, RX_MIC_KEY_LEN); if (tx_mic) - key_len += TX_MIC_KEY_LEN; - - if (key_rsc) { - msg->body.key_info.attr.wpa.seq = kmemdup(key_rsc, - key_rsc_len, - GFP_KERNEL); - if (!msg->body.key_info.attr.wpa.seq) { - result = -ENOMEM; - goto free_msg; - } - } - - msg->body.key_info.type = WILC_KEY_TYPE_WPA_RX_GTK; + memcpy(>k_key->key[gtk_key_len + RX_MIC_KEY_LEN], + tx_mic, TX_MIC_KEY_LEN); if (mode == WILC_AP_MODE) { - msg->body.key_info.action = WILC_ADD_KEY_AP; - msg->body.key_info.attr.wpa.mode = cipher_mode; - } - if (mode == WILC_STATION_MODE) - msg->body.key_info.action = WILC_ADD_KEY; + struct wid wid_list[2]; - msg->body.key_info.attr.wpa.key = kmemdup(rx_gtk, key_len, GFP_KERNEL); - if (!msg->body.key_info.attr.wpa.key) { - result = -ENOMEM; - goto free_seq; - } + wid_list[0].id = WID_11I_MODE; + wid_list[0].type = WID_CHAR; + wid_list[0].size = sizeof(char); + wid_list[0].val = (s8 *)&cipher_mode; - if (rx_mic) - memcpy(msg->body.key_info.attr.wpa.key + 16, rx_mic, - RX_MIC_KEY_LEN); + wid_list[1].id = WID_ADD_RX_GTK; + wid_list[1].type = WID_STR; + wid_list[1].size = sizeof(*gtk_key) + t_key_len; + wid_list[1].val = (u8 *)gtk_key; - if (tx_mic) - memcpy(msg->body.key_info.attr.wpa.key + 24, tx_mic, - TX_MIC_KEY_LEN); - - msg->body.key_info.attr.wpa.index = index; - msg->body.key_info.attr.wpa.key_len = key_len; - msg->body.key_info.attr.wpa.seq_len = key_rsc_len; + result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list, + ARRAY_SIZE(wid_list), + wilc_get_vif_idx(vif)); + kfree(gtk_key); + } else if (mode == WILC_STATION_MODE) { + struct wid wid; - result = wilc_enqueue_work(msg); - if (result) { - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - goto free_key; + wid.id = WID_ADD_RX_GTK; + wid.type = WID_STR; + wid.size = sizeof(*gtk_key) + t_key_len; + wid.val = (u8 *)gtk_key; + result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, + wilc_get_vif_idx(vif)); + kfree(gtk_key); } - wait_for_completion(&msg->work_comp); - -free_key: - kfree(msg->body.key_info.attr.wpa.key); - -free_seq: - kfree(msg->body.key_info.attr.wpa.seq); - -free_msg: - kfree(msg); return result; } -int wilc_set_pmkid_info(struct wilc_vif *vif, - struct host_if_pmkid_attr *pmkid) +int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr *pmkid) { + struct wid wid; int result; - struct host_if_msg *msg; - int i; - - msg = wilc_alloc_work(vif, handle_key, false); - if (IS_ERR(msg)) - return PTR_ERR(msg); - - msg->body.key_info.type = WILC_KEY_TYPE_PMKSA; - msg->body.key_info.action = WILC_ADD_KEY; - for (i = 0; i < pmkid->numpmkid; i++) { - memcpy(msg->body.key_info.attr.pmkid.pmkidlist[i].bssid, - &pmkid->pmkidlist[i].bssid, ETH_ALEN); - memcpy(msg->body.key_info.attr.pmkid.pmkidlist[i].pmkid, - &pmkid->pmkidlist[i].pmkid, WLAN_PMKID_LEN); - } + wid.id = WID_PMKID_INFO; + wid.type = WID_STR; + wid.size = (pmkid->numpmkid * sizeof(struct wilc_pmkid)) + 1; + wid.val = (u8 *)pmkid; - result = wilc_enqueue_work(msg); - if (result) { - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - kfree(msg); - } + result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, + wilc_get_vif_idx(vif)); return result; } diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 7748f65..477372b 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -117,15 +117,15 @@ enum host_if_state { HOST_IF_FORCE_32BIT = 0xFFFFFFFF }; -struct host_if_pmkid { +struct wilc_pmkid { u8 bssid[ETH_ALEN]; u8 pmkid[WLAN_PMKID_LEN]; -}; +} __packed; -struct host_if_pmkid_attr { +struct wilc_pmkid_attr { u8 numpmkid; - struct host_if_pmkid pmkidlist[WILC_MAX_NUM_PMKIDS]; -}; + struct wilc_pmkid pmkidlist[WILC_MAX_NUM_PMKIDS]; +} __packed; struct cfg_param_attr { u32 flag; @@ -288,8 +288,7 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len, u8 index, u32 key_rsc_len, const u8 *key_rsc, const u8 *rx_mic, const u8 *tx_mic, u8 mode, u8 cipher_mode); -int wilc_set_pmkid_info(struct wilc_vif *vif, - struct host_if_pmkid_attr *pmkid); +int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr *pmkid); int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr); int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid, size_t ssid_len, const u8 *ies, size_t ies_len, diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 3ed8ca9..4c9444e 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1171,7 +1171,7 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev, if (!memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid, ETH_ALEN)) { memset(&priv->pmkid_list.pmkidlist[i], 0, - sizeof(struct host_if_pmkid)); + sizeof(struct wilc_pmkid)); break; } } @@ -1197,7 +1197,7 @@ static int flush_pmksa(struct wiphy *wiphy, struct net_device *netdev) { struct wilc_priv *priv = wiphy_priv(wiphy); - memset(&priv->pmkid_list, 0, sizeof(struct host_if_pmkid_attr)); + memset(&priv->pmkid_list, 0, sizeof(struct wilc_pmkid_attr)); return 0; } diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 02970c3..c6685c0 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -144,7 +144,7 @@ struct wilc_priv { struct sk_buff *skb; struct net_device *dev; struct host_if_drv *hif_drv; - struct host_if_pmkid_attr pmkid_list; + struct wilc_pmkid_attr pmkid_list; u8 wep_key[4][WLAN_KEY_LEN_WEP104]; u8 wep_key_len[4]; /* The real interface that the monitor is on */ From patchwork Sun Dec 2 18:03: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: 10708135 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 2010113BB for ; Sun, 2 Dec 2018 18:03:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0EF9C2949D for ; Sun, 2 Dec 2018 18:03:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 000E929C91; Sun, 2 Dec 2018 18:03:56 +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,DKIM_SIGNED, DKIM_VALID,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 B14FA2949D for ; Sun, 2 Dec 2018 18:03:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725780AbeLBSD4 (ORCPT ); Sun, 2 Dec 2018 13:03:56 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:23471 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725616AbeLBSD4 (ORCPT ); Sun, 2 Dec 2018 13:03:56 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="23899284" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 Dec 2018 11:03:53 -0700 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.105) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:03:16 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=G01il5MTiHF4rDgZ2CofhslZdSaD+T5c4UlkLPaJtb4=; b=YoSITCAS+hdY+pLZ/gcrEKEVormDk52s+iNlFpwCeC6Xs/OQj3KtN2S4N1o1nKZykDpmpN5lf+mCR4gsp4A3HH1CxIWEEfs/R4HL+0crdenravYdhlweb9fVhquCpxIbuUinweo6cuJoDVZx0T/SNbwwIOJnG116svp9VmLqgJA= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2806.namprd11.prod.outlook.com (52.135.228.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sun, 2 Dec 2018 18:03:14 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:03:14 +0000 From: To: CC: , , , , Subject: [PATCH 21/29] staging: wilc1000: delete the unused code after code refactor Thread-Topic: [PATCH 21/29] staging: wilc1000: delete the unused code after code refactor Thread-Index: AQHUimlLpYbIxmT/EUygrz4NS2LMoA== Date: Sun, 2 Dec 2018 18:03:14 +0000 Message-ID: <1543773663-20561-22-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2806;6:ntwgnGmPbbsKmi14R1js/0Tycakhsnwuz2pCvU+/NC34lnfE2cnkCXhhT6cGgC/gA8hBVxaTFm0fZ1nP+hiSi1CdNlfdgilUg7ohnS+y35DCcb4p5KYA5TB2YzKNiKFuiMqWDsi4gXmA3ev7L5x9aJyblrtDhaDdKfnmRr0KdQK+nG2HbCpXBle6wMmCMuDk8QTh2yo5WItsX7ZpKSgJSgsnHgShH4ieoAjYKT0S7g6eN1qWKvYyhFdYZloO4SzS5zrOy0uZaAKTUDXM+1WQ9yle9S9UsiMCUoN6olfB5uU0yXNYW7m4ZwOdbtceHKzmYeMHWent+I7gZTPgOLjmIJ1net1B1M0nxRTahHaJfKOIyOsSmgjW8Czrt+9V4ZtBxoHLaMWl8Cbt3brscC+fbU0+a1QsZw4oDJTLTxMwZDOi0umNOEetkEB/Rgzi0phjfLSvYQQheNHfsm97G+RQMw==;5:cV7p2Z03YWx1LvjqKx15xrY7ZNPZMmOsvV5pMpc3dhc0+vYeP3HGT+eN6rWB1iso9D1zabxnD4UwvkAnQFOPjOn31Y2Cl+2QCLz2MJWk2D1MzerVEpxYC1UvEdGrUWhow+DgLRQor3eQ/5IInomPbBw9LKfyX3uKL/L8LWKT6NY=;7:NWadZwxwbXTU7/ZT+hGqt9nJ2Ko+9bPFu3hoKY87HzbFSCjo+2oka8fCG8LDKVyZvoFHv83JM35JMg0c7+vz7E7omt6OQ6Q7gxO4DBC5wSNECN5PrzySHWMyNS1IUeF2dwYb7ExJ3jktk+7P4vlYfw== x-ms-office365-filtering-correlation-id: 867849b0-689a-48f4-12f2-08d658806db6 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2806; x-ms-traffictypediagnostic: BYAPR11MB2806: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231455)(999002)(944501491)(52105112)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB2806;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB2806; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(366004)(39850400004)(396003)(136003)(199004)(189003)(186003)(4326008)(7736002)(26005)(14454004)(2906002)(107886003)(305945005)(386003)(53936002)(6506007)(36756003)(76176011)(6512007)(71190400001)(52116002)(71200400001)(5640700003)(256004)(3846002)(6116002)(99286004)(5660300001)(78486014)(6486002)(446003)(11346002)(486006)(86362001)(105586002)(8676002)(97736004)(68736007)(316002)(2616005)(6436002)(476003)(54906003)(66066001)(25786009)(102836004)(81156014)(81166006)(8936002)(72206003)(2351001)(2501003)(478600001)(6916009)(106356001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2806;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: B3G2ZAyQ3bRRdHIG9e1bjtHtL1XKvFDJtmVimKG6ho0e8n7OCrLxKqkz3c7a0icW3kg8uhiId40ccbH2W4vyLhadACRcP9mXdZtXwxL9wV+NiCOU9K7FmEilTrZdVAKPYMiLgs02kNXLnlNs4qQsftLqyt06Ppkc0uC/jirQSH2RDXibydkXt7jCvrTzVNE7ZiaDR1zX4iLXR9vxL41n7brbdimh1BTlpg8SJkeUPM7F73DeAVot/41TI11lQpckUcBHRpk341+CrT2UTVlECuozWRN6g9cGYEospnS7dauepRlsHJdS18TwFIJb2Vdstr+0769J3Awx9d27Kjys1PZuIhQ01s5Uv5P86Es27+s= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 867849b0-689a-48f4-12f2-08d658806db6 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:03:14.3844 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2806 X-OriginatorOrg: microchip.com 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 From: Ajay Singh After code refactor some of the macro and variables are not required any more, so deleted the unused code. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 31 ------------------------------- drivers/staging/wilc1000/host_interface.h | 27 --------------------------- 2 files changed, 58 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 596a321..71395d8 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -13,30 +13,6 @@ #define REAL_JOIN_REQ 0 -struct host_if_wpa_attr { - u8 *key; - const u8 *mac_addr; - u8 *seq; - u8 seq_len; - u8 index; - u8 key_len; - u8 mode; -}; - -struct host_if_wep_attr { - u8 *key; - u8 key_len; - u8 index; - u8 mode; - enum authtype auth_type; -}; - -union host_if_key_attr { - struct host_if_wep_attr wep; - struct host_if_wpa_attr wpa; - struct host_if_pmkid_attr pmkid; -}; - struct scan_attr { u8 src; u8 type; @@ -121,20 +97,13 @@ struct wilc_gtk_key { u8 key[0]; } __packed; -struct set_ip_addr { - u8 *ip_addr; - u8 idx; -}; - union message_body { struct scan_attr scan_info; struct connect_attr con_info; struct rcvd_net_info net_info; struct rcvd_async_info async_info; - struct set_ip_addr ip_info; struct set_multicast multicast_info; struct get_mac_addr get_mac_info; - struct ba_session_info session_info; struct remain_ch remain_on_ch; char *data; }; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 477372b..d2f29ea 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -17,13 +17,6 @@ enum { WILC_CLIENT_MODE = 0x4 }; -enum { - WILC_ADD_KEY = 0x1, - WILC_REMOVE_KEY = 0x2, - WILC_DEFAULT_KEY = 0x4, - WILC_ADD_KEY_AP = 0x8 -}; - #define WILC_MAX_NUM_STA 9 #define MAX_NUM_SCANNED_NETWORKS 100 #define MAX_NUM_SCANNED_NETWORKS_SHADOW 130 @@ -31,16 +24,10 @@ enum { #define TX_MIC_KEY_LEN 8 #define RX_MIC_KEY_LEN 8 -#define PTK_KEY_LEN 16 -#define RX_MIC_KEY_MSG_LEN 48 -#define PTK_KEY_MSG_LEN 39 - -#define PMKSA_KEY_LEN 22 #define WILC_MAX_NUM_PMKIDS 16 #define WILC_ADD_STA_LENGTH 40 #define WILC_NUM_CONCURRENT_IFC 2 -#define WILC_DRV_HANDLER_SIZE 5 #define NUM_RSSI 5 @@ -160,13 +147,6 @@ enum conn_event { CONN_DISCONN_EVENT_FORCE_32BIT = 0xFFFFFFFF }; -enum KEY_TYPE { - WILC_KEY_TYPE_WEP, - WILC_KEY_TYPE_WPA_RX_GTK, - WILC_KEY_TYPE_WPA_PTK, - WILC_KEY_TYPE_PMKSA, -}; - typedef void (*wilc_scan_result)(enum scan_event, struct network_info *, void *, void *); @@ -218,13 +198,6 @@ struct get_mac_addr { u8 *mac_addr; }; -struct ba_session_info { - u8 bssid[ETH_ALEN]; - u8 tid; - u16 buf_size; - u16 time_out; -}; - struct remain_ch { u16 ch; u32 duration; From patchwork Sun Dec 2 18:03:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10708119 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 E32D513BB for ; Sun, 2 Dec 2018 18:03:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2F38285D8 for ; Sun, 2 Dec 2018 18:03:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C653E2957F; Sun, 2 Dec 2018 18:03: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,DKIM_SIGNED, DKIM_VALID,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 4FD38298FF for ; Sun, 2 Dec 2018 18:03:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725828AbeLBSDh (ORCPT ); Sun, 2 Dec 2018 13:03:37 -0500 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:63046 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbeLBSDh (ORCPT ); Sun, 2 Dec 2018 13:03:37 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="23749613" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES128-SHA; 02 Dec 2018 11:03:34 -0700 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.37) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:03:34 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Zh+EixQnBfoG+mV8ELJKLmIQsVm3Aizvm1gQJ/G4r6U=; b=aAOCRDfZ5KyEWWkIYbZKk5eRWUFsIb66l3gcdRga4VRh7pK8EGWCVUhPzgftzxl/TKuXIx73YNJq8+GpmGbRIW1+txFcbpNQZV12FugLF4DtJF9nhP3f/aX1F5SGuyDiT6v+4s97H6J8z1q1+5DQzG4TRpG7xyuRVYcp+JkfHXQ= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2806.namprd11.prod.outlook.com (52.135.228.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sun, 2 Dec 2018 18:03:17 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:03:17 +0000 From: To: CC: , , , , Subject: [PATCH 22/29] staging: wilc1000: refactor wilc_get_mac_address() to avoid deferred handling Thread-Topic: [PATCH 22/29] staging: wilc1000: refactor wilc_get_mac_address() to avoid deferred handling Thread-Index: AQHUimlN3PAIBqPX1k+g1GKrN0kWeQ== Date: Sun, 2 Dec 2018 18:03:17 +0000 Message-ID: <1543773663-20561-23-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2806;6:8KgbROTeJCRvNROJOkEKQk3wZX45CPAB/Oi0Doa6UqkCJ4sweFNxDgrhZRQTtom8VJKXkBETDHzT/aBbD6BffdSQWFeti/KWabW/p4cwG+rBvBIdwIbbS7hwUZOeITY0vZZmuYkhSVznfd/aD8mVRxVePGnf6KibITwVkjouN6GNAs+tfrggEYthDcSbF0QDQUWvb/mh6GDM0ZvbtIf7EwXUAcbXrkvMrXWZLhwopCzL44hDTUuFs/wCvKrZ/fXN21obj36hS3Fc7/K5UJiVsQZtzzcx/EZKOL1edj6BNwL+6dojnFqPWRhVpTWr8VH75diMuJc9voq3Zm3/+CqxhV9yVKDWWRUKiA3qAsgPxZQtAMAtbJb/rLIrjPmLaZeXSOxsgOhEbwr0TG5QbsUf80neSek81BsWm9STIJykrp/1rrwTNYG+I3gCtK4fLd4yr6u5bqH9mI2NaoeZzVxz7w==;5:08zTxs/Cjs3MEUPYfPVmnvDhY8JEgDIfs5q/5SHW2uDa5JLBjZE3QCC3E+PgGfq7MhwMFbJRDPZ3BepeR1T57PXLToUt9aOKIkt4yBuWCvvagsbdzJS66kCP3MslZZwx9dFmQaxDsnbkL4iKAQY6D6tkhD8jsboVBiXsGnEQovU=;7:iRFyXNwU84qCoCnd6HMRSTWqSnhATZx6j6X6aIf0/Ey3npEegCzsCB91VU0xPsGavuX+lbEHFfkWfPqOIUF8AMrXW+pOI6QDUcTLnuO7gbOV42twxnmbgZwF2yIAtBkz0LNVcGzqrd0EsFZu6Hwngg== x-ms-office365-filtering-correlation-id: 2fc7e6cf-3421-41da-be73-08d658806f70 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2806; x-ms-traffictypediagnostic: BYAPR11MB2806: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231455)(999002)(944501491)(52105112)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB2806;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB2806; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(366004)(39850400004)(396003)(136003)(199004)(189003)(186003)(4326008)(7736002)(26005)(14454004)(2906002)(107886003)(305945005)(386003)(53936002)(6506007)(36756003)(76176011)(6512007)(71190400001)(52116002)(71200400001)(5640700003)(14444005)(256004)(3846002)(6116002)(99286004)(5660300001)(78486014)(6486002)(446003)(11346002)(486006)(575784001)(86362001)(105586002)(8676002)(97736004)(68736007)(316002)(2616005)(6436002)(476003)(54906003)(66066001)(25786009)(102836004)(81156014)(81166006)(8936002)(72206003)(2351001)(2501003)(478600001)(6916009)(106356001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2806;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 5mLRyPUaunoK0XTFHBOR8B2jX37gGQEQQkdjZDR5IUnqaDjyMBfS2j7r7kfXCYv46kChlDHUAM+6qND2oklLdr02e1Krs9hyjraGSvlnATTXRYP2qJnaUTD691Rcs0aUXyYsKXUHPTkK3siX6rtfWD+3AXQ7j4a4m+nA7Jfvf9+bjIVhMxNZnkbuyBry0YMhQsi9yrc+tzR/KtJeWr+r0k5pSPZonZ/2BqF+GAxBaAHMRaBasJDXQSX1VZcREzGOxYeQe/Te9ayL4fh33KTyMWbaJ3LeOC0VS7BY6naWUOONVlh/l313WRVvElmPTOkmPnlA69XYZl6c6kZzDUg5x45695KrlpW8W37mnknj0DU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 2fc7e6cf-3421-41da-be73-08d658806f70 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:03:17.2885 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2806 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Avoid handling of WID_MAC_ADDR wid command in deferred approach. Instead of posting the wid to workqueue now handle directly from the caller context. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 43 ++++++------------------------- drivers/staging/wilc1000/host_interface.h | 4 --- 2 files changed, 8 insertions(+), 39 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 71395d8..dc02561 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -103,7 +103,6 @@ union message_body { struct rcvd_net_info net_info; struct rcvd_async_info async_info; struct set_multicast multicast_info; - struct get_mac_addr get_mac_info; struct remain_ch remain_on_ch; char *data; }; @@ -208,28 +207,6 @@ static struct wilc_vif *wilc_get_vif_from_idx(struct wilc *wilc, int idx) return wilc->vif[index]; } -static void handle_get_mac_address(struct work_struct *work) -{ - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; - struct get_mac_addr *get_mac_addr = &msg->body.get_mac_info; - int ret; - struct wid wid; - - wid.id = WID_MAC_ADDR; - wid.type = WID_STR; - wid.val = get_mac_addr->mac_addr; - wid.size = ETH_ALEN; - - ret = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1, - wilc_get_vif_idx(vif)); - - if (ret) - netdev_err(vif->ndev, "Failed to get mac address\n"); - complete(&msg->work_comp); - /* free 'msg' data later, in caller */ -} - static int handle_scan_done(struct wilc_vif *vif, enum scan_event evt) { int result = 0; @@ -1934,21 +1911,17 @@ int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr *pmkid) int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr) { int result; - struct host_if_msg *msg; - - msg = wilc_alloc_work(vif, handle_get_mac_address, true); - if (IS_ERR(msg)) - return PTR_ERR(msg); + struct wid wid; - msg->body.get_mac_info.mac_addr = mac_addr; + wid.id = WID_MAC_ADDR; + wid.type = WID_STR; + wid.size = ETH_ALEN; + wid.val = mac_addr; - result = wilc_enqueue_work(msg); + result = wilc_send_config_pkt(vif, WILC_GET_CFG, &wid, 1, + wilc_get_vif_idx(vif)); if (result) - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - else - wait_for_completion(&msg->work_comp); - - kfree(msg); + netdev_err(vif->ndev, "Failed to get mac address\n"); return result; } diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index d2f29ea..953f0ea 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -194,10 +194,6 @@ struct user_conn_req { void *arg; }; -struct get_mac_addr { - u8 *mac_addr; -}; - struct remain_ch { u16 ch; u32 duration; From patchwork Sun Dec 2 18:03:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10708121 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 514A817F0 for ; Sun, 2 Dec 2018 18:03:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4430F29C91 for ; Sun, 2 Dec 2018 18:03:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38A8D29C3C; Sun, 2 Dec 2018 18:03:37 +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,DKIM_SIGNED, DKIM_VALID,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 D4CA62934D for ; Sun, 2 Dec 2018 18:03:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725830AbeLBSDh (ORCPT ); Sun, 2 Dec 2018 13:03:37 -0500 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:39814 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725774AbeLBSDh (ORCPT ); Sun, 2 Dec 2018 13:03:37 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="24755026" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES128-SHA; 02 Dec 2018 11:03:35 -0700 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.37) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:03:35 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nVyokLjFi1f34+1ALmXatJtBvE3VVxuX+WRlVJJhmsE=; b=tXBfBpE7wRJa7XHn9tvCCm6qVOguw01mbcSrcvaR7gHr7NXD4Z1csK7++wHx/sWoCH92/f/UyxosKS0Add9heXdeM5cjpBFjtRiRkYFdWXByiXKlABj7rWrAHgbaku03zF1xBiBizc8bqKoZM1Qy0ULYIO4qaJkBX4eaGcPLKJw= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2806.namprd11.prod.outlook.com (52.135.228.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sun, 2 Dec 2018 18:03:20 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:03:20 +0000 From: To: CC: , , , , Subject: [PATCH 23/29] staging: wilc1000: use correct 'struct remain_ch' variable in scan complete Thread-Topic: [PATCH 23/29] staging: wilc1000: use correct 'struct remain_ch' variable in scan complete Thread-Index: AQHUimlOjfJFSoedCkuc0JLcN5W2Pw== Date: Sun, 2 Dec 2018 18:03:20 +0000 Message-ID: <1543773663-20561-24-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2806;6:WXMT4tpNE61yxk7xBj+RGmxxDNfMIvxdCISyeypu+8TIz7HX3hkHNr8feRr/b/EP/4OgcogEj0NDRJHfs2hm/HyersoHH9X8XfyurHmojJy2m5u8WiY4jJ2i/w+e9iubAqDUWgfeowfxnWHcY0QgYUry08/SVgfeYCP0wjvKZO4KTJGrtsrSHKt3iwFcZe95xK+Bk86e33SVuGTyKq/Kylww0oVeNLSiTfEFmT9lKv864x9/M6BpyoOxQ0VZPuVWBpDBa4Ie+Oxr+h1CnKJmyf082mPxeKbzNw0LNVEjDUl2nDOVmYYrTCxmeHoGaS8FH30D34kIq6PsOMR5jDVesQpQL8MWvEPg0hnewfCpXHTMFAkaQFGl/2kCIKPVjb7T9jz5iaYXgzgyq1+/AdEoypNbXerP3Bc4YQRp38qeWvetllyuhdx/o5x8Ppt2GrH30AfdnOhwMoDH0IJpAEeoyw==;5:qEWfwF3cfARaujdasK4Ed/mnCleaYVQz7gSvUkWc8DxsQwePtCrMvZoqY2c+tOqhXXTFcEBuNDVIHNFUA3T7yOFbjS4/CC3K1tZ9B7BC4+tQkVLtueAwZDnc4GV2MWJmac0X+rQXqeBt7cLDLGVgPBtLkhW4Ql2rxAz74EsgiFU=;7:CKy3RzJRoJ2hk4R7o0wzUFEUAX/3ZqhgdUQbOsevEQqJ4Fzc9IwecQvjBUuoZpfwKpcWQb3LjWhdvSpH3x9emlMAVEcz+kRu6vcwMEi4ybq9lfsGQ+yAgtxJM1M9fTRR8ZoGIXafYsW+YsJGPpGhVw== x-ms-office365-filtering-correlation-id: 1a6190c9-0f86-4599-cb3a-08d658807121 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2806; x-ms-traffictypediagnostic: BYAPR11MB2806: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231455)(999002)(944501491)(52105112)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB2806;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB2806; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(366004)(39850400004)(396003)(136003)(199004)(189003)(186003)(4326008)(7736002)(26005)(14454004)(2906002)(107886003)(305945005)(386003)(53936002)(6506007)(36756003)(76176011)(6512007)(71190400001)(52116002)(71200400001)(5640700003)(14444005)(256004)(3846002)(6116002)(99286004)(5660300001)(78486014)(6486002)(446003)(11346002)(486006)(575784001)(86362001)(105586002)(8676002)(97736004)(68736007)(316002)(2616005)(6436002)(476003)(54906003)(66066001)(25786009)(102836004)(81156014)(81166006)(8936002)(72206003)(2351001)(2501003)(478600001)(6916009)(106356001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2806;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: zD5wXyQIUJl0c9mGpIwwEsJY9vJYWDax3bmM1FOH7T8y7RacZsUQ5R8gnrbli+f9LPBjpLeR/Vh7ui3P2k/LVLLpC1w4hntmJI6cx1ItUbthNdJFgU9x0i1NhY70VgqhRvTpjFRQjFwOPkJJ5EfBifSbVbeV/Efp8mxVb7k2f+4gkJplwL9vXDyE7dEaaxdE0pSogSLagu6gKQeDZolooSJnIY2EYh1smRJv+gS3/fg4RHsBU6l8FRCQUkXb/ZFKMBa3DogcNhEa/oYnbE0AFMXMsUSkFBQuNC98DiqA9xpuQKLgmKoXHzDtIjLOvoQsCx4VhvmNLet47ZtocrtDsCdKC3YWMclyhvRkZVQ1wRo= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 1a6190c9-0f86-4599-cb3a-08d658807121 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:03:20.1145 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2806 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Use the correct reference to remain_ch variable in scan complete. Passing 'msg->body.remain_on_ch' to handle_remain_on_chan is not correct. So used the correct reference used to store roc related information during the scan. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index dc02561..9139e0e 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1613,7 +1613,8 @@ static void handle_scan_complete(struct work_struct *work) handle_scan_done(msg->vif, SCAN_EVENT_DONE); if (msg->vif->hif_drv->remain_on_ch_pending) - handle_remain_on_chan(msg->vif, &msg->body.remain_on_ch); + handle_remain_on_chan(msg->vif, + &msg->vif->hif_drv->remain_on_ch); kfree(msg); } From patchwork Sun Dec 2 18:03:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10708123 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 7280413AF for ; Sun, 2 Dec 2018 18:03:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 645E72949D for ; Sun, 2 Dec 2018 18:03:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58A7429FC4; Sun, 2 Dec 2018 18:03:38 +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,DKIM_SIGNED, DKIM_VALID,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 C6A542949D for ; Sun, 2 Dec 2018 18:03:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725835AbeLBSDi (ORCPT ); Sun, 2 Dec 2018 13:03:38 -0500 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:63046 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725774AbeLBSDi (ORCPT ); Sun, 2 Dec 2018 13:03:38 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="23749614" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES128-SHA; 02 Dec 2018 11:03:36 -0700 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.37) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:03:35 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uWg16O5cFn6MJ9BPk5f9KcOhdZT9bSi5AiZUi88yqT8=; b=TMK5Z9FoUK4ahr/9SSU3NqXG50OHQ3T89ud4aQfcrQGshIyvoBILR+yMFPKwOdhdI8EQnH30rdxTQya9O1uBtrxm2ThB5v8lKzC9YDo6pM8q9F/hWWOhJRWF0FXHc53Wi88ogNTk0MbaW9xYR1xawJC37CgpLmQS3AuDxyHE564= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2806.namprd11.prod.outlook.com (52.135.228.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sun, 2 Dec 2018 18:03:22 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:03:22 +0000 From: To: CC: , , , , Subject: [PATCH 24/29] staging: wilc1000: handle remain on channel cfg ops from cfg80211 context Thread-Topic: [PATCH 24/29] staging: wilc1000: handle remain on channel cfg ops from cfg80211 context Thread-Index: AQHUimlQakLtXRwGtk+e0/s+Yut5pw== Date: Sun, 2 Dec 2018 18:03:22 +0000 Message-ID: <1543773663-20561-25-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2806;6:N1AQA+06PVlTtcCzglTqEGRLpPyE8oPKo8KO4IO1roafrViPz0z17S/T+/vRh4e96ZLoiVXos040A0dfXOo6lRPvNiBg3+HNZCQA34B2ZxkpoYOjZ4HYeV9iyFUZRQlOE8jGqwZt0nhc3abNNzYovGv96wU6+LPKULZrmAnJ1/dSkK8Dv5HgvOLezEX9NFBITC923MjC2gg7EmzV69qMnxDXZRfzRq+trBMZBRai9odrCGZpk7yAxd9MUQ28soQxlhsUTcD3CX6nRaNOrUs7ZOHKZzjYYLXA6JpTDy4awXqARY2l3kD2Ipo5PGhvhSqkutJ0qnPEY8ba5MlLW69qh4Z4HL/X8z3F3s9iGB/9a3kDRbtjY+fMTYXp0eh67bU69Ts7ugeRlDVDkml+iyaxd8L5vZmIYd2w+SBLSjzrSPao40i2+P8TVOIJmzzh/EUkjcv0VraoP5IqMb2px5Ianw==;5:I12uoktjZGbrMKizBpjaXYlbmelJzvFRjSZpdUMVCpTSa/tKOeQMsecsf0oKK6H5Xup222Q5xq8t9heBkHj8lceAANz3gpCOpJquo6IVWcmwfKwIcKcXCMplnusP8Qqb9p61lTozmsOLygaExuSGKLDoCGUADwoIuNUsBYfXoSk=;7:WtcTVNZXuaU3AluOSvtMybMrNFRn5Au1E2K+jZmTx/Q9wW12ijURH9uMVCYCAJjIbht9i4sQca7Q417JrmPplFQBi7f6dAyLvJc7ag1RrTHu+I3ZFUSwCJEbMwYQdLKOOPg0CB3LfeCtrYtAvs1bQw== x-ms-office365-filtering-correlation-id: 3811ee8a-6186-48e2-c40f-08d6588072c8 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2806; x-ms-traffictypediagnostic: BYAPR11MB2806: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231455)(999002)(944501491)(52105112)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB2806;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB2806; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(366004)(39850400004)(396003)(136003)(199004)(189003)(186003)(4326008)(7736002)(26005)(14454004)(2906002)(107886003)(305945005)(386003)(53936002)(6506007)(36756003)(76176011)(6512007)(71190400001)(52116002)(71200400001)(5640700003)(14444005)(256004)(3846002)(6116002)(99286004)(5660300001)(78486014)(6486002)(446003)(11346002)(486006)(575784001)(86362001)(105586002)(8676002)(97736004)(68736007)(316002)(2616005)(6436002)(476003)(54906003)(66066001)(25786009)(102836004)(81156014)(81166006)(8936002)(72206003)(2351001)(2501003)(478600001)(6916009)(106356001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2806;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: KTWgh5WYylorvgbamg7CRWFwME4whA6YfAveFFHBv0frQI39T1nnt7foxJzQdeJv3NAfUR8tshsk7Pb98Ma85wep3zFXN9DZnBgSRFBp3WlFX0Cbkk/BA/JEzqb/wTdgO9d6gYz4XTnpI06Gj4aDnirubcp72WTMkCQsNO6eDByoQXEE5mV5gcW2x4DlxM8/smkUR11b3KKkxVUstZUE3dG5xUbBI+ccnXl+yZIwTI417t/9+qVC6sIqRATRfCdmGu54PUJYaKhjkkKJGfnW93cFiUcUScykbwp3ySCSMz6kWZ53RJSZ38dzwHqI8A8p1Q8YDOWZBtD14qxH32XRmWSpkUF9VcSJUfTfk+gqYko= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 3811ee8a-6186-48e2-c40f-08d6588072c8 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:03:22.7954 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2806 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Refactor wilc_remain_on_channel() to handle remain_on_channel callback from cfg80211 context. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 36 ++++++++++--------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 9139e0e..4762925 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1592,14 +1592,6 @@ static void handle_scan_timer(struct work_struct *work) kfree(msg); } -static void handle_remain_on_chan_work(struct work_struct *work) -{ - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - - handle_remain_on_chan(msg->vif, &msg->body.remain_on_ch); - kfree(msg); -} - static void handle_scan_complete(struct work_struct *work) { struct host_if_msg *msg = container_of(work, struct host_if_msg, work); @@ -2527,25 +2519,19 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id, wilc_remain_on_chan_ready ready, void *user_arg) { + struct remain_ch roc; int result; - struct host_if_msg *msg; - - msg = wilc_alloc_work(vif, handle_remain_on_chan_work, false); - if (IS_ERR(msg)) - return PTR_ERR(msg); - msg->body.remain_on_ch.ch = chan; - msg->body.remain_on_ch.expired = expired; - msg->body.remain_on_ch.ready = ready; - msg->body.remain_on_ch.arg = user_arg; - msg->body.remain_on_ch.duration = duration; - msg->body.remain_on_ch.id = session_id; - - result = wilc_enqueue_work(msg); - if (result) { - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - kfree(msg); - } + roc.ch = chan; + roc.expired = expired; + roc.ready = ready; + roc.arg = user_arg; + roc.duration = duration; + roc.id = session_id; + result = handle_remain_on_chan(vif, &roc); + if (result) + netdev_err(vif->ndev, "%s: failed to set remain on channel\n", + __func__); return result; } From patchwork Sun Dec 2 18:03:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10708125 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 5737A13AF for ; Sun, 2 Dec 2018 18:03:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4904D2949D for ; Sun, 2 Dec 2018 18:03:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3D62A29C99; Sun, 2 Dec 2018 18:03:39 +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,DKIM_SIGNED, DKIM_VALID,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 AC1B02949D for ; Sun, 2 Dec 2018 18:03:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725840AbeLBSDj (ORCPT ); Sun, 2 Dec 2018 13:03:39 -0500 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:39814 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725832AbeLBSDj (ORCPT ); Sun, 2 Dec 2018 13:03:39 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="24755028" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES128-SHA; 02 Dec 2018 11:03:36 -0700 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.37) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:03:36 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PwaBd8+KtmpJSubPFMD7QKkdhLURYOWvykl/mkNivSA=; b=NcZ19Q5rkrTUwgUo0Py6eRHtwvwuEx5GyhbqsvUJZ/3BkW1w9qb8vOEbeGJc253CFZQraxAj1TnCBtFYb4p7iGiCon4qkQ7k2AbleTnm6PlJsKPmEKqqTZinYUzP5i9PREPHj4rlI82fPxmjN49RmmiaBFwJGho1ppAerLKnJS8= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2806.namprd11.prod.outlook.com (52.135.228.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sun, 2 Dec 2018 18:03:25 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:03:25 +0000 From: To: CC: , , , , Subject: [PATCH 25/29] staging: wilc1000: handle get_station() ops callback in cfg80211 context Thread-Topic: [PATCH 25/29] staging: wilc1000: handle get_station() ops callback in cfg80211 context Thread-Index: AQHUimlS42/BdOhgUkGzrwNGJ2i80A== Date: Sun, 2 Dec 2018 18:03:25 +0000 Message-ID: <1543773663-20561-26-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2806;6:ePyQSA4YUSxr8XwGeWQSt3KTu9jiwwUUDnl/6MdwcmEHpAycCGOvci12BToJ730R0wwhDS825p5Jg88uC3RdSGo4KWbVnBB+nbxI8mrb4kkJLa+YI4HH8g0+DlCRO7ITf8GyNACGZD+jzNO8+sf+IA9fVUeb0qKGrnIIeYt33KXlP363CGaqohh6SAi8+G+R+Jrxlxj0rcGAlDl0fF39X+UgtwP1WKbi4T43Ers5CXc0M7PiqeR0Gpb/ladbtVZcb4daE+rGfZ2cacgJa4JNjjiMHM6L/1ySz2nMg8FO19qDgY6ZfixDxEaajWL/+RkjWeHx+CFj5Z+IJzj8yL375F0WKDDu8CO6wEAIzTL+1svT+PtPIGmKwxIHSJfBYrmGWKdHXA0sZegJphQxz1rGiWSqgbt1TSzLN3qFx+aPzMDEU1sVVY+CRU+G4XborRcMErY5p3/Yr3vEv4S51rz5cA==;5:A9IksV8gTQe4F2Mo+6Ai7WMLRgYcxZr3/KgqWQ+0oGwkA/ZuvwYmpEZZogG1ZE594wdOIjuzIGhF4O+LjtX13scqDRczaO6WXnvUJQk4WaiPNwgmZ8VowsVSQOJkBQQcTLpoxVO2+ujNYOvZLiMsUUvfhIvzfl7huuYgTj8fJP8=;7:X4mf1wU6Y2Dag5meiU8JDf0Yk7LONVzTofkMcLYz44868lFFoQo/U3hlUf3lFKX0325zNXjgsE98zxX8vAIWsNLPy4srn+VNm7nHSxgOPooyiXL7Fm05fd2Ak5+yY4VlkKITDzYXGlFxZPwgeN+f0g== x-ms-office365-filtering-correlation-id: 95c1ec17-fd10-4e72-37ad-08d658807496 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2806; x-ms-traffictypediagnostic: BYAPR11MB2806: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231455)(999002)(944501491)(52105112)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB2806;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB2806; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(366004)(39850400004)(396003)(136003)(199004)(189003)(186003)(4326008)(7736002)(26005)(14454004)(2906002)(107886003)(305945005)(386003)(53936002)(6506007)(36756003)(76176011)(6512007)(71190400001)(52116002)(71200400001)(5640700003)(256004)(3846002)(6116002)(99286004)(5660300001)(78486014)(6486002)(446003)(11346002)(486006)(575784001)(86362001)(105586002)(8676002)(97736004)(68736007)(316002)(2616005)(6436002)(476003)(54906003)(66066001)(25786009)(102836004)(81156014)(81166006)(8936002)(72206003)(2351001)(2501003)(478600001)(6916009)(106356001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2806;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: ql9OqOQ9YTXi+Zqcb4L5ICGf2RY0vQs9Vbc2bpIHNxZl15olstD7+AmnCQJ5V230IJjOi+wuGKTZoNTRDc7w4UAdvvb0m1H3LXeZINfNV2d9bUbUFemBGPXMeFDa9NgLO237zO8IBjG11e0z/FeYoQLvP1Ysqg8rLvl8/W/BLVbfxeuPMd369WEBinJXAHgF+8Xb+la33n2VSo1mKRkUpgjpIE3dD3rLgEIzRXG00YetDx66NxiRmquG1iwDXcuBaq2UXrQAP/pXFleRHhsFD+1Y39JwmZ3xpf5kEW/pVyXEjon3SVmNVJK1Kb6w6RTXAj6tNB1OSq5Dj1uRHT/DlqhNLkPy3U9UyqRiHFBx4lU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 95c1ec17-fd10-4e72-37ad-08d658807496 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:03:25.7395 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2806 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Refactor code to handle the get_station() callback from cfg80211 context. Provided different API's to fetch the station statistics information in sync or async call. From cfg80211 get_station() ops callback calls the sync version of API. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 38 +++++++++++------------ drivers/staging/wilc1000/host_interface.h | 3 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 4762925..7ab46ef 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1322,13 +1322,10 @@ void wilc_resolve_disconnect_aberration(struct wilc_vif *vif) wilc_disconnect(vif, 1); } -static void handle_get_statistics(struct work_struct *work) +int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats) { - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; struct wid wid_list[5]; u32 wid_cnt = 0, result; - struct rf_info *stats = (struct rf_info *)msg->body.data; wid_list[wid_cnt].id = WID_LINKSPEED; wid_list[wid_cnt].type = WID_CHAR; @@ -1364,8 +1361,10 @@ static void handle_get_statistics(struct work_struct *work) wid_cnt, wilc_get_vif_idx(vif)); - if (result) + if (result) { netdev_err(vif->ndev, "Failed to send scan parameters\n"); + return result; + } if (stats->link_speed > TCP_ACK_FILTER_LINK_SPEED_THRESH && stats->link_speed != DEFAULT_LINK_SPEED) @@ -1373,11 +1372,18 @@ static void handle_get_statistics(struct work_struct *work) else if (stats->link_speed != DEFAULT_LINK_SPEED) wilc_enable_tcp_ack_filter(vif, false); - /* free 'msg' for async command, for sync caller will free it */ - if (msg->is_sync) - complete(&msg->work_comp); - else - kfree(msg); + return result; +} + +static void handle_get_statistics(struct work_struct *work) +{ + struct host_if_msg *msg = container_of(work, struct host_if_msg, work); + struct wilc_vif *vif = msg->vif; + struct rf_info *stats = (struct rf_info *)msg->body.data; + + wilc_get_statistics(vif, stats); + + kfree(msg); } static void wilc_hif_pack_sta_param(u8 *cur_byte, const u8 *mac, @@ -2149,13 +2155,12 @@ int wilc_get_rssi(struct wilc_vif *vif, s8 *rssi_level) return result; } -int -wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats, bool is_sync) +int wilc_get_stats_async(struct wilc_vif *vif, struct rf_info *stats) { int result; struct host_if_msg *msg; - msg = wilc_alloc_work(vif, handle_get_statistics, is_sync); + msg = wilc_alloc_work(vif, handle_get_statistics, false); if (IS_ERR(msg)) return PTR_ERR(msg); @@ -2168,11 +2173,6 @@ wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats, bool is_sync) return result; } - if (is_sync) { - wait_for_completion(&msg->work_comp); - kfree(msg); - } - return result; } @@ -2297,7 +2297,7 @@ static void get_periodic_rssi(struct timer_list *t) } if (vif->hif_drv->hif_state == HOST_IF_CONNECTED) - wilc_get_statistics(vif, &vif->periodic_stat, false); + wilc_get_stats_async(vif, &vif->periodic_stat); mod_timer(&vif->periodic_rssi, jiffies + msecs_to_jiffies(5000)); } diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 953f0ea..20af5c4 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -297,8 +297,7 @@ void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg); int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode, u8 ifc_id); int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode); -int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats, - bool is_sync); +int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats); void wilc_resolve_disconnect_aberration(struct wilc_vif *vif); int wilc_get_vif_idx(struct wilc_vif *vif); int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power); diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 4c9444e..045e365 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1039,7 +1039,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, } else if (vif->iftype == WILC_STATION_MODE) { struct rf_info stats; - wilc_get_statistics(vif, &stats, true); + wilc_get_statistics(vif, &stats); sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL) | BIT_ULL(NL80211_STA_INFO_RX_PACKETS) | From patchwork Sun Dec 2 18:03:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10708127 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 3F9E313BB for ; Sun, 2 Dec 2018 18:03:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 305EA2949D for ; Sun, 2 Dec 2018 18:03:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 24AD429C99; Sun, 2 Dec 2018 18:03: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,DKIM_SIGNED, DKIM_VALID,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 97CD32949D for ; Sun, 2 Dec 2018 18:03:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725846AbeLBSDk (ORCPT ); Sun, 2 Dec 2018 13:03:40 -0500 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:63046 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725774AbeLBSDj (ORCPT ); Sun, 2 Dec 2018 13:03:39 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="23749618" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES128-SHA; 02 Dec 2018 11:03:37 -0700 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.37) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:03:37 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GjyqwWPOiuuLFRBJNDxq/oE4kuNBiwitMjwx+bMEI88=; b=m4b3GPDvayFOYEsgcZLXNhXrOAOXVcFvNo3ft3mLmUtHpJ2FQeuk2y5t6ZdpyvxZlcgoAG0pqjZLZdwp49BNkVBA2h65lSfOYFFncA7TFU3zcP365YO/Q0H0pUW+MT2S74eiuD6N5Vg/LtPKvxMv+Y/ZWb+y1ttAI2kHF7OiEeo= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2806.namprd11.prod.outlook.com (52.135.228.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sun, 2 Dec 2018 18:03:28 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:03:28 +0000 From: To: CC: , , , , Subject: [PATCH 26/29] staging: wilc1000: avoid deferred handling of cfg80211 disconnect callback Thread-Topic: [PATCH 26/29] staging: wilc1000: avoid deferred handling of cfg80211 disconnect callback Thread-Index: AQHUimlUWxupk3gNuUem1Bfls51OpA== Date: Sun, 2 Dec 2018 18:03:28 +0000 Message-ID: <1543773663-20561-27-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2806;6:ujpDzSIUFGUM9ZrdnlV71H1Yys2ggk6cNDQv2nnxVGOmFa2S4ayLgLnLwpd3gRlEOuMNiD/XXXoHoUOeKsEABQU8tomcEkT+3oyxCEuPlEZ1JGpvInDpIxboXWgmh1SEYg+n1Syw6x1PHyzKrYxNgzKWPuQbRdOizF5Nta3FLS3NeuptUP14fPXVP4yIg3Tb8kcb11oj3Az+A6ohw+6Ex/R3sKnL1lex5oubNVuqKofTZkbLhOSiUedWFbdoZkRNbbT8noXK6IRPUY6JwUnCTXcWlR2U1gvRVkiTX5OXwdl2sYIKloge6OdJEAEJi7YxNFfSnkUh3Z4Fv12ElJuV9D78Y79e1z9ERx+gy2owAlEtPhPLhzbASDtaMw7wmA5Oa7tGqdrG5TGablVnPf2HHq7zA5nuN1GxYLhhEJZX2sZPogxZHBc3/XWHI+RiZ7MTZifbEmcpyqEoTUqs2a6ejA==;5:P0v0jQrHiwEpaN/WhP1+PEXbq5Ux6ZVfArA+yDa+M8FjRDxkkEdzVz/zjiAtxRBdO3H5O0cPhomnUR4RK9VWCrdYvUiqEP6lsSjAFf5VOVRgTMf6HfLasl30j8N4yHpAYp4I4uAkfeLywRVAhn9rEzYkfUkd0hAVpGYaZBu0xOA=;7:tku5jsU69blY13AR70fzD0gG/LlpQCHkRnR2eqY6WN9zgHjBm5ZSJsr/ish7WnB5bvSYDtY6SIQDfaFQ4pdCJ8+Ei41ODOoazFVGMV0gtziy2rDfyLHD+AKVoymmBtIEFtzcFa4lP3UU1DtR5dcCmg== x-ms-office365-filtering-correlation-id: 50e3b2bb-22e6-4cf8-827d-08d65880763b x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2806; x-ms-traffictypediagnostic: BYAPR11MB2806: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231455)(999002)(944501491)(52105112)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB2806;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB2806; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(366004)(39850400004)(396003)(136003)(199004)(189003)(186003)(4326008)(7736002)(26005)(14454004)(2906002)(107886003)(305945005)(386003)(53936002)(6506007)(36756003)(76176011)(6512007)(71190400001)(52116002)(71200400001)(5640700003)(14444005)(256004)(3846002)(6116002)(99286004)(5660300001)(78486014)(6486002)(446003)(11346002)(486006)(86362001)(105586002)(8676002)(97736004)(68736007)(316002)(2616005)(6436002)(476003)(54906003)(66066001)(25786009)(102836004)(81156014)(81166006)(8936002)(72206003)(2351001)(2501003)(478600001)(6916009)(106356001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2806;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: V7rnt+hK9Ab1/4wGddV9VNTsEX3JHpxRRLquSAvgS61V1QLrT9eZU+aX/X1Obna+2FC1t5ulMqZbiS7u6qIrBqrJMfwgr9lh1C7mLKyxFpst2ebBdsASlE/vXKyawHgXXmwFdrIsi1HQr3gF5DWNt82uZ+4rudXubiTq5aN2Tymh7k3HpXHF5OJpUDGiMmF+dpdO+RdIIT2+9mR6P5XRpJaDDdmumXaYuvskn/NCC7etEvA+lXBdLzhQkMhoRxXcAJSJAQtwmm24gu5fzmKx2fT5EbTnvy4f+bHg9rN+6x7oVJ7TYrYpGVC8cAdS/4K9frIlVwRy2uuLE3uD6L1fS5qL9dldWsUFutPhi2o4BS0= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 50e3b2bb-22e6-4cf8-827d-08d65880763b X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:03:28.6987 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2806 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Refactor disconnect operation callback to handle from the cfg80211 context. The reason code is not required to pass as parameter to the function, so remove it. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 39 +++-------------------- drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +- 3 files changed, 6 insertions(+), 37 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 7ab46ef..6a908ea 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1241,10 +1241,8 @@ static void handle_rcvd_gnrl_async_info(struct work_struct *work) kfree(msg); } -static void handle_disconnect(struct work_struct *work) +int wilc_disconnect(struct wilc_vif *vif) { - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; struct wid wid; struct host_if_drv *hif_drv = vif->hif_drv; struct disconnect_info disconn_info; @@ -1263,10 +1261,9 @@ static void handle_disconnect(struct work_struct *work) result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); - if (result) { netdev_err(vif->ndev, "Failed to send dissconect\n"); - goto out; + return result; } memset(&disconn_info, 0, sizeof(struct disconnect_info)); @@ -1307,10 +1304,7 @@ static void handle_disconnect(struct work_struct *work) kfree(conn_req->ies); conn_req->ies = NULL; -out: - - complete(&msg->work_comp); - /* free 'msg' in caller after receiving completion */ + return 0; } void wilc_resolve_disconnect_aberration(struct wilc_vif *vif) @@ -1319,7 +1313,7 @@ void wilc_resolve_disconnect_aberration(struct wilc_vif *vif) return; if (vif->hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP || vif->hif_drv->hif_state == HOST_IF_CONNECTING) - wilc_disconnect(vif, 1); + wilc_disconnect(vif); } int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats) @@ -2012,31 +2006,6 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid, return result; } -int wilc_disconnect(struct wilc_vif *vif, u16 reason_code) -{ - int result; - struct host_if_msg *msg; - struct host_if_drv *hif_drv = vif->hif_drv; - - if (!hif_drv) { - netdev_err(vif->ndev, "%s: hif driver is NULL", __func__); - return -EFAULT; - } - - msg = wilc_alloc_work(vif, handle_disconnect, true); - if (IS_ERR(msg)) - return PTR_ERR(msg); - - result = wilc_enqueue_work(msg); - if (result) - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - else - wait_for_completion(&msg->work_comp); - - kfree(msg); - return result; -} - int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel) { struct wid wid; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 20af5c4..ac4bdfe 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -264,7 +264,7 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid, wilc_connect_result connect_result, void *user_arg, u8 security, enum authtype auth_type, u8 channel, void *join_params); -int wilc_disconnect(struct wilc_vif *vif, u16 reason_code); +int wilc_disconnect(struct wilc_vif *vif); int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel); int wilc_get_rssi(struct wilc_vif *vif, s8 *rssi_level); int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type, diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 045e365..7cc985e 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -760,7 +760,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, priv->p2p.is_wilc_ie = false; wfi_drv->p2p_timeout = 0; - ret = wilc_disconnect(vif, reason_code); + ret = wilc_disconnect(vif); if (ret != 0) { netdev_err(priv->dev, "Error in disconnecting\n"); ret = -EINVAL; From patchwork Sun Dec 2 18:03:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10708133 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 84E0013AF for ; Sun, 2 Dec 2018 18:03:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 767452949D for ; Sun, 2 Dec 2018 18:03:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6AB4429C99; Sun, 2 Dec 2018 18:03:44 +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,DKIM_SIGNED, DKIM_VALID,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 C91B52949D for ; Sun, 2 Dec 2018 18:03:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725849AbeLBSDm (ORCPT ); Sun, 2 Dec 2018 13:03:42 -0500 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:39822 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725845AbeLBSDl (ORCPT ); Sun, 2 Dec 2018 13:03:41 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="24755030" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES128-SHA; 02 Dec 2018 11:03:38 -0700 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.37) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:03:38 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ngiOMfuul7QGjUMjNM91IFBzHzeGFHMvwsDDt7TGl1w=; b=UBzK6zjvUpdQ+2E4dPXjUGj0/zXOIyGJ2wpLlTlCJ4WQntjZNfsXVnc2hgIH2NoMJhLjtgoIYgvUMOjbL9lr5LLze75xuvtl/AccNsWdbnFHVhUzCSPAH11+Fl2FiWHAuPhkeZwSgRcKO8GDdv4jf2AMEn1yZpODTVHHGLhRIGo= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2806.namprd11.prod.outlook.com (52.135.228.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sun, 2 Dec 2018 18:03:31 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:03:31 +0000 From: To: CC: , , , , Subject: [PATCH 27/29] staging: wilc1000: handle connect ops callback from cfg80211 context Thread-Topic: [PATCH 27/29] staging: wilc1000: handle connect ops callback from cfg80211 context Thread-Index: AQHUimlVLL2WWmlQ3Ee+hX+9QxyJpg== Date: Sun, 2 Dec 2018 18:03:31 +0000 Message-ID: <1543773663-20561-28-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2806;6:v8XSjfwFwBXirxrYOdegqMOgOUgrQWU6OqfWq5x9uMFGE6bzSIyHfiu+Fh1v+Il2aFeY9aR370u5EFNTWv0I5JSSSvWOHjrIBFql++PphvRS+kIAKrTSejLKSBj9iQiKgan5Le2sOURfJFkHDHIqUesbxt+lrajy13PeKRilRborIUWu2j00iICqSnjGvGW2V0okMAigDvErNDQnesQlNj7NeUfQZgSmCdpSwmSdl6QlZBYqseaKtdiWfuKlehbbvWUQqBN85IAXr2r+Jul/cR7bFP8jOANq1vpAqtNeeIXC6TZD6RFd5P88r0VIMnKoCTZeLemziY2icwc4N/tu2yZN5tF1uNXlZ16Emce2krrDtBF6IeJpshqP3rZdTfpAa7zOUi+dM8N3tpmB0s+a7cf/kemk7novhjrF3oJr15GJ5NcC+ZyZej0K8uyGaXFaF7vk/aUaEdEAwPXN8jpLzA==;5:Z/AbQ0G1BuqNBLMMgMci0gqzak6iD5HnjOu3jY5rsgyN30Yefi7zexG6FFOCNon9rlTzNkOoAUoX2XZ9WPkUeqUVMftv5xk+9jtogPkXKaQ8TTRK9EsZf+bL4p9Kw1M9xj7tIuawmxcVubEtmuLVSdh9qiw7pwgF+wX0JSHLhpM=;7:b8u7ketKP/xLE1SOejflqKbGnUj1WajcZOhlNWkcsIGJClMhgpNS8i0aNMt4moMgtxxfYTmbPS9oRV/77CuGq0+P0JrW77wI9aknDpsYzrHOIIazj5C5PhreDAiZktdarwZU3RssB5btaRsHO9uqrg== x-ms-office365-filtering-correlation-id: 00d76234-5ad6-4c45-9947-08d6588077f1 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2806; x-ms-traffictypediagnostic: BYAPR11MB2806: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231455)(999002)(944501491)(52105112)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB2806;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB2806; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(979002)(376002)(346002)(366004)(39850400004)(396003)(136003)(199004)(189003)(186003)(4326008)(7736002)(26005)(14454004)(2906002)(107886003)(305945005)(386003)(53936002)(6506007)(36756003)(76176011)(6512007)(71190400001)(52116002)(71200400001)(5640700003)(14444005)(256004)(3846002)(6116002)(99286004)(5660300001)(78486014)(6486002)(446003)(11346002)(486006)(86362001)(105586002)(8676002)(97736004)(68736007)(316002)(2616005)(6436002)(476003)(54906003)(66066001)(25786009)(102836004)(81156014)(81166006)(8936002)(72206003)(2351001)(2501003)(478600001)(6916009)(106356001)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2806;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: dYbaDdFzWB04sugwnq9r9EgVemMe1VwB873gPbOrFa+VDY/6HRAUTVH/Ih4tCcu6k4DQIhKfbH+qnSqp/SRmzLYStxQLFszGYj0boymBqsqL6HrgXCriJNWwVkDEuUNKidmCzfnUKl56FFkNoxfie/TA7YjFcVPm79oNcqclQbHWTc1/QPKO+rGpY2HfMIBpJFLyXwWwCYpbnzJkFIGZtTETsUW1FVtVdxQ7pKQLryp7jGMttL3fZbzgPxBo1r/NTcw9DI8WQYqVBU/eFIlIGFTgf6EPwwfm3EBtggwzDluwjxWLBvrhqiz59LvYblMeRLoRVw028XVT9m6CAKdaBzI+O+bea++KkLcStjfvyIM= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 00d76234-5ad6-4c45-9947-08d6588077f1 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:03:31.5327 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2806 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Refactor the connect related cfg callback to be called from cfg80211 context. No need to post connect command internally in case scan is in progress instead simply return the error status in connect ops callback. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 104 +++++++++++++----------------- 1 file changed, 44 insertions(+), 60 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 6a908ea..783c99b 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -362,34 +362,16 @@ static void handle_scan(struct work_struct *work) kfree(msg); } -static void handle_connect(struct work_struct *work) +static int wilc_send_connect_wid(struct wilc_vif *vif, + struct connect_attr *conn_attr) { - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; - struct connect_attr *conn_attr = &msg->body.con_info; int result = 0; struct wid wid_list[8]; u32 wid_cnt = 0, dummyval = 0; u8 *cur_byte = NULL; - struct join_bss_param *bss_param; + struct join_bss_param *bss_param = conn_attr->params; struct host_if_drv *hif_drv = vif->hif_drv; - if (msg->vif->hif_drv->usr_scan_req.scan_result) { - result = wilc_enqueue_work(msg); - if (result) - goto error; - - usleep_range(2 * 1000, 2 * 1000); - return; - } - - bss_param = conn_attr->params; - if (!bss_param) { - netdev_err(vif->ndev, "Required BSSID not found\n"); - result = -ENOENT; - goto error; - } - if (conn_attr->bssid) { hif_drv->usr_conn_req.bssid = kmemdup(conn_attr->bssid, 6, GFP_KERNEL); @@ -490,8 +472,8 @@ static void handle_connect(struct work_struct *work) netdev_err(vif->ndev, "Channel out of range\n"); *(cur_byte++) = 0xFF; } - *(cur_byte++) = (bss_param->cap_info) & 0xFF; - *(cur_byte++) = ((bss_param->cap_info) >> 8) & 0xFF; + put_unaligned_le16(bss_param->cap_info, cur_byte); + cur_byte += 2; if (conn_attr->bssid) memcpy(cur_byte, conn_attr->bssid, 6); @@ -501,8 +483,8 @@ static void handle_connect(struct work_struct *work) memcpy(cur_byte, conn_attr->bssid, 6); cur_byte += 6; - *(cur_byte++) = (bss_param->beacon_period) & 0xFF; - *(cur_byte++) = ((bss_param->beacon_period) >> 8) & 0xFF; + put_unaligned_le16(bss_param->beacon_period, cur_byte); + cur_byte += 2; *(cur_byte++) = bss_param->dtim_period; memcpy(cur_byte, bss_param->supp_rates, MAX_RATES_SUPPORTED + 1); @@ -533,10 +515,8 @@ static void handle_connect(struct work_struct *work) *(cur_byte++) = bss_param->noa_enabled; if (bss_param->noa_enabled) { - *(cur_byte++) = (bss_param->tsf) & 0xFF; - *(cur_byte++) = ((bss_param->tsf) >> 8) & 0xFF; - *(cur_byte++) = ((bss_param->tsf) >> 16) & 0xFF; - *(cur_byte++) = ((bss_param->tsf) >> 24) & 0xFF; + put_unaligned_le32(bss_param->tsf, cur_byte); + cur_byte += 4; *(cur_byte++) = bss_param->opp_enabled; *(cur_byte++) = bss_param->idx; @@ -616,8 +596,10 @@ static void handle_connect(struct work_struct *work) kfree(conn_attr->ies); conn_attr->ies = NULL; + kfree(conn_attr); kfree(cur_byte); - kfree(msg); + + return result; } static void handle_connect_timeout(struct work_struct *work) @@ -1926,8 +1908,8 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid, u8 channel, void *join_params) { int result; - struct host_if_msg *msg; struct host_if_drv *hif_drv = vif->hif_drv; + struct connect_attr *con_info; if (!hif_drv || !connect_result) { netdev_err(vif->ndev, @@ -1941,50 +1923,51 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid, return -EFAULT; } - msg = wilc_alloc_work(vif, handle_connect, false); - if (IS_ERR(msg)) - return PTR_ERR(msg); + if (hif_drv->usr_scan_req.scan_result) { + netdev_err(vif->ndev, "%s: Scan in progress\n", __func__); + return -EBUSY; + } + + con_info = kzalloc(sizeof(*con_info), GFP_KERNEL); + if (!con_info) + return -ENOMEM; - msg->body.con_info.security = security; - msg->body.con_info.auth_type = auth_type; - msg->body.con_info.ch = channel; - msg->body.con_info.result = connect_result; - msg->body.con_info.arg = user_arg; - msg->body.con_info.params = join_params; + con_info->security = security; + con_info->auth_type = auth_type; + con_info->ch = channel; + con_info->result = connect_result; + con_info->arg = user_arg; + con_info->params = join_params; if (bssid) { - msg->body.con_info.bssid = kmemdup(bssid, 6, GFP_KERNEL); - if (!msg->body.con_info.bssid) { + con_info->bssid = kmemdup(bssid, 6, GFP_KERNEL); + if (!con_info->bssid) { result = -ENOMEM; - goto free_msg; + goto free_con_info; } } if (ssid) { - msg->body.con_info.ssid_len = ssid_len; - msg->body.con_info.ssid = kmemdup(ssid, ssid_len, GFP_KERNEL); - if (!msg->body.con_info.ssid) { + con_info->ssid_len = ssid_len; + con_info->ssid = kmemdup(ssid, ssid_len, GFP_KERNEL); + if (!con_info->ssid) { result = -ENOMEM; goto free_bssid; } } if (ies) { - msg->body.con_info.ies_len = ies_len; - msg->body.con_info.ies = kmemdup(ies, ies_len, GFP_KERNEL); - if (!msg->body.con_info.ies) { + con_info->ies_len = ies_len; + con_info->ies = kmemdup(ies, ies_len, GFP_KERNEL); + if (!con_info->ies) { result = -ENOMEM; goto free_ssid; } } - if (hif_drv->hif_state < HOST_IF_CONNECTING) - hif_drv->hif_state = HOST_IF_CONNECTING; - result = wilc_enqueue_work(msg); - if (result) { - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); + result = wilc_send_connect_wid(vif); + if (result) goto free_ies; - } hif_drv->connect_timer_vif = vif; mod_timer(&hif_drv->connect_timer, @@ -1993,16 +1976,17 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid, return 0; free_ies: - kfree(msg->body.con_info.ies); + kfree(con_info->ies); free_ssid: - kfree(msg->body.con_info.ssid); + kfree(con_info->ssid); free_bssid: - kfree(msg->body.con_info.bssid); + kfree(con_info->bssid); + +free_con_info: + kfree(con_info); -free_msg: - kfree(msg); return result; } From patchwork Sun Dec 2 18:03:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10708129 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 7053413BB for ; Sun, 2 Dec 2018 18:03:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61AF92949D for ; Sun, 2 Dec 2018 18:03:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 557E329C99; Sun, 2 Dec 2018 18:03:42 +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,DKIM_SIGNED, DKIM_VALID,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 A0DEF2949D for ; Sun, 2 Dec 2018 18:03:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725850AbeLBSDm (ORCPT ); Sun, 2 Dec 2018 13:03:42 -0500 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:39814 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725832AbeLBSDl (ORCPT ); Sun, 2 Dec 2018 13:03:41 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="24755029" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES128-SHA; 02 Dec 2018 11:03:38 -0700 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.37) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:03:38 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=n6fVIMwFcE6trYcn6TTc8Ak2w7/d48d63/inIQdJLF4=; b=M2mSSu5IGMqfFRqRQ4tzjrh7gM8Ea/SG2XeHgF2C5apElxMUw47YM+9+bFVXIXfhYhsnUNlHPSWJr8PV4BCIkZLs+gP0wVtqJgUIP0kOMWUrD4/VkF+Mk/dutvuZqVc9Ttmhy3D3OlCahq3ZkY/PfX08A65U7Nzk8WB5/nPmz58= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB3096.namprd11.prod.outlook.com (20.177.227.78) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.21; Sun, 2 Dec 2018 18:03:35 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:03:35 +0000 From: To: CC: , , , , Subject: [PATCH 28/29] staging: wilc1000: avoid extra buffer copy while connect cfg ops Thread-Topic: [PATCH 28/29] staging: wilc1000: avoid extra buffer copy while connect cfg ops Thread-Index: AQHUimlXlIKZOsDzm0qlFqEiavv2VA== Date: Sun, 2 Dec 2018 18:03:34 +0000 Message-ID: <1543773663-20561-29-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB3096;6:PWAyai2mpkhF0abmTAxyC3PD1cRg6svnQCRlomGZAQNoytvup+oSxasB0vO1a1nJYO9l/SuhygZfvvd/KIii8/dcOpX4+tnyhWaOEM2CAUADoKu81uOIC9vqFNn6ANDNSh+SnkJswAtjWWayN+1k+Nnb3AMzxAJiMmOBBxjpeUsmxak6GK8jC+gXd03GQNeeybIi20oCOoxIiXc/VnCytJmwxRh8/rcWVz1X1z0gTEIxAK3N8GDNNY/0ZjG35d5R2Xk1tVAS6FpmHrM/dNPp4gzJd+h0xmV3jmB0/Ddha/UrE57Tqzp+q2Dng6h+/xHjLMqxLBwNCZXDmp80w0fumjunqiDstIUy6oMUDWxgVIn0VT2fvOB/nJk7QvWcgRphMT6+clfuIfUiy0nZaGfMr68pmRIrsiEUTCt7LOu2lw3j/Q1iaUtv4wZNDt/xc3kdU2hv3Dnord2CNGVs7Kf+1Q==;5:kp/9VGddXyzsNtTsUCuSKKNTGAPNpG6PBa/Wd8O8DUhglFmEPebH5J5f+bruKbseww2LDphYNsxnNlHst1+GiGDeZkBl6LxWSxX9KJ9nXCtbMrtPd6NZqSb033cKFxDa/YGxFsvylNypskC6Hq9IWkn4c50hxcWwp6e7L9tLQps=;7:4drCQJA61+RyUVO6W9buzX/sIIRGc12n4zQXQGyBjaYXkbL957WwNHaCugPA4I64g9eFl05Ys1kUJztIeRiF9iAeqmdCsvSKgoCUlVrK7N1o0KeqbX8EK50+22QiVPB6uX6KlI66trYIQSUDoJ7nAw== x-ms-office365-filtering-correlation-id: cec368d1-f615-4a06-92f7-08d6588079ac x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB3096; x-ms-traffictypediagnostic: BYAPR11MB3096: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231455)(999002)(944501491)(52105112)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123558120)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB3096;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB3096; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39840400004)(366004)(396003)(136003)(376002)(346002)(189003)(199004)(6512007)(8936002)(107886003)(81156014)(53936002)(6916009)(81166006)(105586002)(8676002)(106356001)(68736007)(6436002)(6486002)(5660300001)(86362001)(2351001)(2906002)(5640700003)(72206003)(7736002)(478600001)(305945005)(14444005)(256004)(97736004)(14454004)(486006)(186003)(26005)(66066001)(476003)(2616005)(11346002)(446003)(4326008)(36756003)(78486014)(54906003)(2501003)(316002)(25786009)(3846002)(6116002)(76176011)(99286004)(386003)(6506007)(102836004)(71200400001)(52116002)(71190400001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB3096;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: rq4663rqJ97Gu6qGQlyjAb02P8OOIgIZtHcRi8XCP7zCWN66ZfRGXBCQZ3DwaowZzwl8A3+abYmiFikTHF1UFnIsex4MxSp/0z1guAMBhzkc4LQBhJpVB+lSD5yJWKsuA1vY/yWMl1BUeZS3yCNqGp3Z5HIPZbBdHKJpfkhfCUHY+K2MCjg99kx6HiJ6HnczWKxWw9iI38YtvajUrlLeNMkdfGpLyTcbEi4T5iBRgp8UYiVn1DYmXNZhH0KMsakWa1jEU1wBFeTGR/HPvamxWuR6eSywI7oWrXdg+BO3PqfEPOHBYsxMtb+/5a3EwBEspljajNufgOWlAxpgI1zRi3nWB6xJMR8rlx/+qb1v5js= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: cec368d1-f615-4a06-92f7-08d6588079ac X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:03:35.2083 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3096 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Refactor the code to avoid the use of an extra buffer to store the connection related parameter. No need to call cfg80211_disconnected in case of failure to send the wid command to firmware, an error status is directly returned in cfg80211 connect callback. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 129 +++------------------- drivers/staging/wilc1000/host_interface.h | 2 + drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 + 3 files changed, 21 insertions(+), 112 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 783c99b..f50728c 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -25,20 +25,6 @@ struct scan_attr { struct hidden_network hidden_network; }; -struct connect_attr { - u8 *bssid; - u8 *ssid; - size_t ssid_len; - u8 *ies; - size_t ies_len; - u8 security; - wilc_connect_result result; - void *arg; - enum authtype auth_type; - u8 ch; - void *params; -}; - struct rcvd_async_info { u8 *buffer; u32 len; @@ -99,7 +85,6 @@ struct wilc_gtk_key { union message_body { struct scan_attr scan_info; - struct connect_attr con_info; struct rcvd_net_info net_info; struct rcvd_async_info async_info; struct set_multicast multicast_info; @@ -362,54 +347,15 @@ static void handle_scan(struct work_struct *work) kfree(msg); } -static int wilc_send_connect_wid(struct wilc_vif *vif, - struct connect_attr *conn_attr) +static int wilc_send_connect_wid(struct wilc_vif *vif) { int result = 0; struct wid wid_list[8]; u32 wid_cnt = 0, dummyval = 0; u8 *cur_byte = NULL; - struct join_bss_param *bss_param = conn_attr->params; struct host_if_drv *hif_drv = vif->hif_drv; - - if (conn_attr->bssid) { - hif_drv->usr_conn_req.bssid = kmemdup(conn_attr->bssid, 6, - GFP_KERNEL); - if (!hif_drv->usr_conn_req.bssid) { - result = -ENOMEM; - goto error; - } - } - - hif_drv->usr_conn_req.ssid_len = conn_attr->ssid_len; - if (conn_attr->ssid) { - hif_drv->usr_conn_req.ssid = kmalloc(conn_attr->ssid_len + 1, - GFP_KERNEL); - if (!hif_drv->usr_conn_req.ssid) { - result = -ENOMEM; - goto error; - } - memcpy(hif_drv->usr_conn_req.ssid, - conn_attr->ssid, - conn_attr->ssid_len); - hif_drv->usr_conn_req.ssid[conn_attr->ssid_len] = '\0'; - } - - hif_drv->usr_conn_req.ies_len = conn_attr->ies_len; - if (conn_attr->ies) { - hif_drv->usr_conn_req.ies = kmemdup(conn_attr->ies, - conn_attr->ies_len, - GFP_KERNEL); - if (!hif_drv->usr_conn_req.ies) { - result = -ENOMEM; - goto error; - } - } - - hif_drv->usr_conn_req.security = conn_attr->security; - hif_drv->usr_conn_req.auth_type = conn_attr->auth_type; - hif_drv->usr_conn_req.conn_result = conn_attr->result; - hif_drv->usr_conn_req.arg = conn_attr->arg; + struct user_conn_req *conn_attr = &hif_drv->usr_conn_req; + struct join_bss_param *bss_param = hif_drv->usr_conn_req.param; wid_list[wid_cnt].id = WID_SUCCESS_FRAME_COUNT; wid_list[wid_cnt].type = WID_INT; @@ -431,20 +377,20 @@ static int wilc_send_connect_wid(struct wilc_vif *vif, wid_list[wid_cnt].id = WID_INFO_ELEMENT_ASSOCIATE; wid_list[wid_cnt].type = WID_BIN_DATA; - wid_list[wid_cnt].val = hif_drv->usr_conn_req.ies; - wid_list[wid_cnt].size = hif_drv->usr_conn_req.ies_len; + wid_list[wid_cnt].val = conn_attr->ies; + wid_list[wid_cnt].size = conn_attr->ies_len; wid_cnt++; wid_list[wid_cnt].id = WID_11I_MODE; wid_list[wid_cnt].type = WID_CHAR; wid_list[wid_cnt].size = sizeof(char); - wid_list[wid_cnt].val = (s8 *)&hif_drv->usr_conn_req.security; + wid_list[wid_cnt].val = (s8 *)&conn_attr->security; wid_cnt++; wid_list[wid_cnt].id = WID_AUTH_TYPE; wid_list[wid_cnt].type = WID_CHAR; wid_list[wid_cnt].size = sizeof(char); - wid_list[wid_cnt].val = (s8 *)&hif_drv->usr_conn_req.auth_type; + wid_list[wid_cnt].val = (s8 *)&conn_attr->auth_type; wid_cnt++; wid_list[wid_cnt].id = WID_JOIN_REQ_EXTENDED; @@ -494,7 +440,7 @@ static int wilc_send_connect_wid(struct wilc_vif *vif, *(cur_byte++) = bss_param->uapsd_cap; *(cur_byte++) = bss_param->ht_capable; - hif_drv->usr_conn_req.ht_capable = bss_param->ht_capable; + conn_attr->ht_capable = bss_param->ht_capable; *(cur_byte++) = bss_param->rsn_found; *(cur_byte++) = bss_param->rsn_grp_policy; @@ -547,45 +493,16 @@ static int wilc_send_connect_wid(struct wilc_vif *vif, wilc_get_vif_idx(vif)); if (result) { netdev_err(vif->ndev, "failed to send config packet\n"); - result = -EFAULT; + kfree(cur_byte); goto error; } else { hif_drv->hif_state = HOST_IF_WAITING_CONN_RESP; } -error: - if (result) { - struct connect_info conn_info; - - del_timer(&hif_drv->connect_timer); - - memset(&conn_info, 0, sizeof(struct connect_info)); - - if (conn_attr->result) { - if (conn_attr->bssid) - memcpy(conn_info.bssid, conn_attr->bssid, 6); - - if (conn_attr->ies) { - conn_info.req_ies_len = conn_attr->ies_len; - conn_info.req_ies = kmalloc(conn_attr->ies_len, - GFP_KERNEL); - memcpy(conn_info.req_ies, - conn_attr->ies, - conn_attr->ies_len); - } - - conn_attr->result(CONN_DISCONN_EVENT_CONN_RESP, - &conn_info, - WILC_MAC_STATUS_DISCONNECTED, - NULL, conn_attr->arg); - hif_drv->hif_state = HOST_IF_IDLE; - kfree(conn_info.req_ies); - conn_info.req_ies = NULL; + kfree(cur_byte); + return 0; - } else { - netdev_err(vif->ndev, "Connect callback is NULL\n"); - } - } +error: kfree(conn_attr->bssid); conn_attr->bssid = NULL; @@ -596,9 +513,6 @@ static int wilc_send_connect_wid(struct wilc_vif *vif, kfree(conn_attr->ies); conn_attr->ies = NULL; - kfree(conn_attr); - kfree(cur_byte); - return result; } @@ -1909,7 +1823,7 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid, { int result; struct host_if_drv *hif_drv = vif->hif_drv; - struct connect_attr *con_info; + struct user_conn_req *con_info = &hif_drv->usr_conn_req; if (!hif_drv || !connect_result) { netdev_err(vif->ndev, @@ -1928,23 +1842,17 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid, return -EBUSY; } - con_info = kzalloc(sizeof(*con_info), GFP_KERNEL); - if (!con_info) - return -ENOMEM; - con_info->security = security; con_info->auth_type = auth_type; con_info->ch = channel; - con_info->result = connect_result; + con_info->conn_result = connect_result; con_info->arg = user_arg; - con_info->params = join_params; + con_info->param = join_params; if (bssid) { con_info->bssid = kmemdup(bssid, 6, GFP_KERNEL); - if (!con_info->bssid) { - result = -ENOMEM; - goto free_con_info; - } + if (!con_info->bssid) + return -ENOMEM; } if (ssid) { @@ -1984,9 +1892,6 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid, free_bssid: kfree(con_info->bssid); -free_con_info: - kfree(con_info); - return result; } diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index ac4bdfe..9b396a79 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -191,7 +191,9 @@ struct user_conn_req { size_t ies_len; wilc_connect_result conn_result; bool ht_capable; + u8 ch; void *arg; + void *param; }; struct remain_ch { diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 7cc985e..08d4461 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -719,6 +719,8 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, netdev_err(dev, "wilc_set_join_req(): Error\n"); ret = -ENOENT; + if (!wfi_drv->p2p_connect) + wlan_channel = INVALID_CHANNEL; wilc_wlan_set_bssid(dev, null_bssid, WILC_STATION_MODE); goto out_error; } From patchwork Sun Dec 2 18:03:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10708131 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 7D05F13AF for ; Sun, 2 Dec 2018 18:03:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D2982949D for ; Sun, 2 Dec 2018 18:03:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60F3729C99; Sun, 2 Dec 2018 18:03: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,DKIM_SIGNED, DKIM_VALID,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 B36392949D for ; Sun, 2 Dec 2018 18:03:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725779AbeLBSDn (ORCPT ); Sun, 2 Dec 2018 13:03:43 -0500 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:52871 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725747AbeLBSDm (ORCPT ); Sun, 2 Dec 2018 13:03:42 -0500 X-IronPort-AV: E=Sophos;i="5.56,307,1539673200"; d="scan'208";a="23451133" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 Dec 2018 11:03:40 -0700 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.49) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 2 Dec 2018 11:03:39 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PEoRXonCN3451kh3RGvUHCRys6T0ehfHcNwblPz3O28=; b=Orw+plL2taywjyHx5ZOxk6JqJlDtDY2LSV/a2f6YEalHahBeAkbYBO22Nx/SJli0u/8nPto1RdsWsHJHdVX4Uy2GmnFw9JRQz/5wZXmVSC8gp9i3E8d9KjGvpu89WTm/lZgMBDKIxjtEIA2NMjH0RXO3IGrBfmjsKcF0LbkIX5s= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB3096.namprd11.prod.outlook.com (20.177.227.78) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.21; Sun, 2 Dec 2018 18:03:38 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::391c:cb9c:2556:436f%4]) with mapi id 15.20.1382.020; Sun, 2 Dec 2018 18:03:38 +0000 From: To: CC: , , , , Subject: [PATCH 29/29] staging: wilc1000: handle scan operation callback from cfg80211 context Thread-Topic: [PATCH 29/29] staging: wilc1000: handle scan operation callback from cfg80211 context Thread-Index: AQHUimlZQ1+Zp5z0eE6dGfCpad7bqA== Date: Sun, 2 Dec 2018 18:03:38 +0000 Message-ID: <1543773663-20561-30-git-send-email-ajay.kathat@microchip.com> References: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1543773663-20561-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0063.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::25) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [183.82.18.98] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB3096;6:UeJQKgEO3E6U8tdZiLc7yBAedVbr3Ww/jnre1qUoqE2BfnUjQhxZpHluxGEgi0gDnlFpvTuPVjAm1IHkF622OhU5GwpYV/VteAhiSyh6VQlWVTKk8sRdpkvzmovcNOWcMKa1T/6G1L5tG9bM4uWKssqTVk9tJ1w47/7+5NiJ4/zezsdZ1lYycBc9lkpUJjW+llQ/6SlfsLB7+BowSPD0grVc5fDYRsyLSf5/wnMbUHo1KcD/ng9QQS9vyuFJlUDXz4F1ilKsPM43oSnDCUq6h+gIbiM5JIesCpiIEQ1FJQkcMkzZ3tl4Oa+faCE3T9MYIz+IwfAj52KqXccyzGWB+Qmn2dOBW0lmzoWDQZRLodDcqnOgTXtBSPdKvdFhsMjPHBfTHxBK8j2jz+AAyj9Bkz8TuQtqTx6Jcb7kEM1y04kRFwx15gveg2/2I4Kc1JNZIUJ1Wl28esgefEzvpthIeA==;5:EwHBp4Mb0z+9jjeHwIYasNlc9m0V652RNXGprsm2W0clQl+6Vh+01uDu7ciVRs9x/2B7xWg8ExrP7+PB43TLNkl+ffyM+R7PshDvUL0hfvPQB7xg4/RZXelP0zAJvZG+qreV9tCfFGTIMqJsBHDm3ct6wL6uD+8e/4kCALdFna4=;7:adZ6TaQMbSlW9nK/FqyzLoDqcHPQjlt3L6tV2r8FkAdarP5OM3I/Dfipl9nW+tTW38tNErMXttvvKBqjaQIByMcFgVEW0kYegqq0SlJ1VJQXM64qlghsJDcDilSDeU9HsFC1vA+7IX9BkyKv0tEPWQ== x-ms-office365-filtering-correlation-id: 7f90812e-7cdb-4489-b5f6-08d658807bf5 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB3096; x-ms-traffictypediagnostic: BYAPR11MB3096: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231455)(999002)(944501491)(52105112)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123558120)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095);SRVR:BYAPR11MB3096;BCL:0;PCL:0;RULEID:;SRVR:BYAPR11MB3096; x-forefront-prvs: 087474FBFA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39840400004)(366004)(396003)(136003)(376002)(346002)(189003)(199004)(6512007)(8936002)(107886003)(81156014)(53936002)(6916009)(81166006)(105586002)(8676002)(106356001)(68736007)(6436002)(6486002)(5660300001)(86362001)(2351001)(2906002)(5640700003)(72206003)(7736002)(478600001)(305945005)(14444005)(256004)(97736004)(14454004)(486006)(186003)(26005)(66066001)(476003)(2616005)(11346002)(446003)(4326008)(36756003)(78486014)(54906003)(2501003)(316002)(25786009)(3846002)(6116002)(76176011)(99286004)(386003)(6506007)(102836004)(71200400001)(52116002)(71190400001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB3096;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: kexySjMTD+T6laqqW9AMrbPEo5Zoe+tr7XDMsAJ4Hepildec8R+IxT7prmvRV/V4NeFt6KNlijHXFnG8o7iPO2017PeMMZ2F8I8cKoD9u6ZHJSK/wlgHraNwQ/NIAN7gDYfIHXTYtG7rr9GwctDBrtbfDfcdPSpQJ0CeL0UfN51TBDKpmSR51BOmYDg2jp9Hw63nv4hsI+ibkWQwgBXaWc2lPq/2L0WuKXnh1CfFfQ2lLwXlT+wEhWYDdmoduOhPX3YdZ/QLXbWxyB11rC6vTCgEPqC3bkWmcKUyopjc1eaTW6HH+B/og61W072cSPY2BmMAl+MOzFwKjUo0sPjUiEwsfHLLRdsbNu9bf277M3g= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 7f90812e-7cdb-4489-b5f6-08d658807bf5 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2018 18:03:38.2735 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3096 X-OriginatorOrg: microchip.com 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 From: Ajay Singh Refactor code to handle scan operation callback from cfg80211 context. No need to maintain 'scan_attr' struct as the wid command is directly sent to firmware from cfg80211 context. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 143 ++++------------------ drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 13 +- 2 files changed, 33 insertions(+), 123 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index f50728c..b8603f2 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -13,18 +13,6 @@ #define REAL_JOIN_REQ 0 -struct scan_attr { - u8 src; - u8 type; - u8 *ch_freq_list; - u8 ch_list_len; - u8 *ies; - size_t ies_len; - wilc_scan_result result; - void *arg; - struct hidden_network hidden_network; -}; - struct rcvd_async_info { u8 *buffer; u32 len; @@ -84,7 +72,6 @@ struct wilc_gtk_key { } __packed; union message_body { - struct scan_attr scan_info; struct rcvd_net_info net_info; struct rcvd_async_info async_info; struct set_multicast multicast_info; @@ -230,11 +217,11 @@ static int handle_scan_done(struct wilc_vif *vif, enum scan_event evt) return result; } -static void handle_scan(struct work_struct *work) +int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type, + u8 *ch_freq_list, u8 ch_list_len, const u8 *ies, + size_t ies_len, wilc_scan_result scan_result, void *user_arg, + struct hidden_network *hidden_net) { - struct host_if_msg *msg = container_of(work, struct host_if_msg, work); - struct wilc_vif *vif = msg->vif; - struct scan_attr *scan_info = &msg->body.scan_info; int result = 0; struct wid wid_list[5]; u32 index = 0; @@ -243,10 +230,6 @@ static void handle_scan(struct work_struct *work) u8 valuesize = 0; u8 *hdn_ntwk_wid_val = NULL; struct host_if_drv *hif_drv = vif->hif_drv; - struct hidden_network *hidden_net = &scan_info->hidden_network; - - hif_drv->usr_scan_req.scan_result = scan_info->result; - hif_drv->usr_scan_req.arg = scan_info->arg; if (hif_drv->hif_state >= HOST_IF_SCANNING && hif_drv->hif_state < HOST_IF_CONNECTED) { @@ -288,63 +271,55 @@ static void handle_scan(struct work_struct *work) wid_list[index].id = WID_INFO_ELEMENT_PROBE; wid_list[index].type = WID_BIN_DATA; - wid_list[index].val = scan_info->ies; - wid_list[index].size = scan_info->ies_len; + wid_list[index].val = (s8 *)ies; + wid_list[index].size = ies_len; index++; wid_list[index].id = WID_SCAN_TYPE; wid_list[index].type = WID_CHAR; wid_list[index].size = sizeof(char); - wid_list[index].val = (s8 *)&scan_info->type; + wid_list[index].val = (s8 *)&scan_type; index++; wid_list[index].id = WID_SCAN_CHANNEL_LIST; wid_list[index].type = WID_BIN_DATA; - if (scan_info->ch_freq_list && - scan_info->ch_list_len > 0) { - int i; - - for (i = 0; i < scan_info->ch_list_len; i++) { - if (scan_info->ch_freq_list[i] > 0) - scan_info->ch_freq_list[i] -= 1; + if (ch_freq_list && ch_list_len > 0) { + for (i = 0; i < ch_list_len; i++) { + if (ch_freq_list[i] > 0) + ch_freq_list[i] -= 1; } } - wid_list[index].val = scan_info->ch_freq_list; - wid_list[index].size = scan_info->ch_list_len; + wid_list[index].val = ch_freq_list; + wid_list[index].size = ch_list_len; index++; wid_list[index].id = WID_START_SCAN_REQ; wid_list[index].type = WID_CHAR; wid_list[index].size = sizeof(char); - wid_list[index].val = (s8 *)&scan_info->src; + wid_list[index].val = (s8 *)&scan_source; index++; result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list, index, wilc_get_vif_idx(vif)); - - if (result) - netdev_err(vif->ndev, "Failed to send scan parameters\n"); - -error: if (result) { - del_timer(&hif_drv->scan_timer); - handle_scan_done(vif, SCAN_EVENT_ABORTED); + netdev_err(vif->ndev, "Failed to send scan parameters\n"); + goto error; } - kfree(scan_info->ch_freq_list); - scan_info->ch_freq_list = NULL; - - kfree(scan_info->ies); - scan_info->ies = NULL; - kfree(scan_info->hidden_network.net_info); - scan_info->hidden_network.net_info = NULL; + hif_drv->usr_scan_req.scan_result = scan_result; + hif_drv->usr_scan_req.arg = user_arg; + hif_drv->scan_timer_vif = vif; + mod_timer(&hif_drv->scan_timer, + jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT)); +error: + kfree(hidden_net->net_info); kfree(hdn_ntwk_wid_val); - kfree(msg); + return result; } static int wilc_send_connect_wid(struct wilc_vif *vif) @@ -2034,76 +2009,6 @@ int wilc_get_stats_async(struct wilc_vif *vif, struct rf_info *stats) return result; } -int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type, - u8 *ch_freq_list, u8 ch_list_len, const u8 *ies, - size_t ies_len, wilc_scan_result scan_result, void *user_arg, - struct hidden_network *hidden_network) -{ - int result; - struct host_if_msg *msg; - struct scan_attr *scan_info; - struct host_if_drv *hif_drv = vif->hif_drv; - - if (!hif_drv || !scan_result) { - netdev_err(vif->ndev, "hif_drv or scan_result = NULL\n"); - return -EFAULT; - } - - msg = wilc_alloc_work(vif, handle_scan, false); - if (IS_ERR(msg)) - return PTR_ERR(msg); - - scan_info = &msg->body.scan_info; - - if (hidden_network) { - scan_info->hidden_network.net_info = hidden_network->net_info; - scan_info->hidden_network.n_ssids = hidden_network->n_ssids; - } - - scan_info->src = scan_source; - scan_info->type = scan_type; - scan_info->result = scan_result; - scan_info->arg = user_arg; - - scan_info->ch_list_len = ch_list_len; - scan_info->ch_freq_list = kmemdup(ch_freq_list, - ch_list_len, - GFP_KERNEL); - if (!scan_info->ch_freq_list) { - result = -ENOMEM; - goto free_msg; - } - - scan_info->ies_len = ies_len; - scan_info->ies = kmemdup(ies, ies_len, GFP_KERNEL); - if (!scan_info->ies) { - result = -ENOMEM; - goto free_freq_list; - } - - result = wilc_enqueue_work(msg); - if (result) { - netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); - goto free_ies; - } - - hif_drv->scan_timer_vif = vif; - mod_timer(&hif_drv->scan_timer, - jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT)); - - return 0; - -free_ies: - kfree(scan_info->ies); - -free_freq_list: - kfree(scan_info->ch_freq_list); - -free_msg: - kfree(msg); - return result; -} - int wilc_hif_set_cfg(struct wilc_vif *vif, struct cfg_param_attr *param) { struct wid wid_list[4]; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 08d4461..ac47dda 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -547,8 +547,10 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) if (request->n_ssids >= 1) { if (wilc_wfi_cfg_alloc_fill_ssid(request, - &hidden_ntwk)) - return -ENOMEM; + &hidden_ntwk)) { + ret = -ENOMEM; + goto out; + } ret = wilc_scan(vif, WILC_FW_USER_SCAN, WILC_FW_ACTIVE_SCAN, scan_ch_list, @@ -568,8 +570,11 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) netdev_err(priv->dev, "Requested scanned channels over\n"); } - if (ret != 0) - ret = -EBUSY; +out: + if (ret) { + priv->scan_req = NULL; + priv->cfg_scanning = false; + } return ret; }