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); }