From patchwork Wed Nov 25 11:41:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 332765 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD1F9C56202 for ; Wed, 25 Nov 2020 11:41:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 241E3206D9 for ; Wed, 25 Nov 2020 11:41:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="hMTGttyu"; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="Be+WLXnd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727780AbgKYLlM (ORCPT ); Wed, 25 Nov 2020 06:41:12 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:51746 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726039AbgKYLlL (ORCPT ); Wed, 25 Nov 2020 06:41:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1606304470; x=1637840470; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=qPxkbBU/85AZngGcyzLQrAu7gYT8WS5mnobx/iPf3us=; b=hMTGttyur6/eVuex4Y66JhUE0hCEN+FPLe0Bx8WuVf0bB1C/0wRHUA94 j1YuLKXQ+TIN9f3c+Naxs/U1zBVKydgHGHd1DfF0vOBQUJslTdpgf21NA govYzI8O1KsPhM7Yv2JdrC+grDFgr5F0Te1wqVtI+BSgwG9ScLrVG6aWq eSYHGtpQhBK8aHo8ff/pFJ6/KUhkWjgQekpG6kuVBkTXI2aoWtSLxrH6P aNtn0512Mr3mNc/XIGr26DClQEKsU6PwRBP97B+i5wFFiJT2YziDuis0n vYwYxDbQjs1glG2CctTfDFzY8QsukUcbwEEEm4BFgV/1B+glPy4ZBHk0Z g==; IronPort-SDR: guo5uVhuClmmHG2EtZvvytyexcD8QVzE3xeejQc3TwcQULI34W7nHyFA5//HC3H2esFG1Q3+lZ VPgIYk5bCrTiDxtbbrliI4Gg6DFA8rz6OFAsQek2u5fmJn2rg9a5KHuOa1NimWhDkiMGMF7Hjh PSJakw2mKj6icZN/KNungvho7Grz/8DmyiPslG79KQFaq0P0VMTX7NteAP0oFWtlHQwSqp038L am22AXPjtkqueft2S4cwZtjWSwNo2vL2J2A12Vx4yA+1clBxVnkuhnbH+tngU+qZ/q7HyG3GBS f48= X-IronPort-AV: E=Sophos;i="5.78,368,1599548400"; d="scan'208";a="100348213" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 25 Nov 2020 04:41:10 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 25 Nov 2020 04:41:10 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3 via Frontend Transport; Wed, 25 Nov 2020 04:41:10 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JK1pMQFMIw2DAIBfNLyNswbxDr4PSbfB2Icxe8sgu8oH8Jey/G3Mol0zhmdcMBV7FK2ik8bbFMDL0wcFz6D15beh+0sSMYOLPYbbQLJS/jMaI5R80rsExQGQ27DH5SJDRjtCt+/II68EgClKT5VUUV5oUDxOkuZn3/Sr1vVQYvS8cpo2xGI2/wWh1Qyi+d9sCNYvjKcu8FT0H1lmHLxxWgr9SAwAVj6vPDiH2XBW0Gq2smw2T0h9HvrNBxr5SpmqEHWB0c3W/eg8MsqeGCODr553Gc5Ce2ic+2jqY8Xi9yTwwXjdoqawZKkKNoqVTYE3um5/oOxeX020IUFd9UltEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fyPY2/kVfl6grF9AJ+FWy2876/dkxnkSb8F5XyGJkPE=; b=oSbRoDvfxoppmJhDM+cNVyedcPQVO5IMJvcrfVDr6kged5Oafdit4TkBINQZPav0vABGt4ThDo6YQbrywy+MQUhdGubLUzjqAHOGZcEbh8iy2u2M5pXmFX19zWgejkrlIzKwFUUDtx0+JvQqammZVO4dJl59sMjPfh0mxhqq+jSdOczOu9lhE9ikdSetxNSn0fzTtPoz/SYMPCIHygYljFsEEX62eu7cZtcbRPbEtUa9ZTnpd8HepIfmvKYTguTqpzyFAGd18NaW4I9W7A95YCqdLay0ZY/z9FaC3jxgtJkdo08l9kVVHQ9ygEmpkue0IVwFTs5l4luTpLKGIFDGmQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fyPY2/kVfl6grF9AJ+FWy2876/dkxnkSb8F5XyGJkPE=; b=Be+WLXndbJ16xKygOpPuRIWI8ENDC3s/whmeLJUZJwP6udMK+btTMhGSI01lwL9/jhiLKPc7B0L6dT9VN/6wsGODauGSpsTE6oQIdpabkzn3t6vhyjpmQjCdkPdbTqEEWklBGhG3NpE79t8OmT7SuIzJuo33TS7CG2ArhgbVuOo= Received: from CY4PR11MB1286.namprd11.prod.outlook.com (2603:10b6:903:2e::21) by CY4PR11MB1605.namprd11.prod.outlook.com (2603:10b6:910:10::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.20; Wed, 25 Nov 2020 11:41:08 +0000 Received: from CY4PR11MB1286.namprd11.prod.outlook.com ([fe80::a0d1:a499:1c83:a988]) by CY4PR11MB1286.namprd11.prod.outlook.com ([fe80::a0d1:a499:1c83:a988%6]) with mapi id 15.20.3589.022; Wed, 25 Nov 2020 11:41:08 +0000 From: To: , CC: , , Subject: [PATCH 1/5] wilc1000: added 'ndo_set_mac_address' callback support Thread-Topic: [PATCH 1/5] wilc1000: added 'ndo_set_mac_address' callback support Thread-Index: AQHWwx/dBWbbhXDpIE29CGrbpOduxQ== Date: Wed, 25 Nov 2020 11:41:08 +0000 Message-ID: <20201125114059.10006-2-ajay.kathat@microchip.com> References: <20201125114059.10006-1-ajay.kathat@microchip.com> In-Reply-To: <20201125114059.10006-1-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.17.1 authentication-results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=microchip.com; x-originating-ip: [171.61.34.149] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 807d1767-daff-4a5b-7533-08d89136fffe x-ms-traffictypediagnostic: CY4PR11MB1605: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-bypassexternaltag: True x-ms-oob-tlc-oobclassifiers: OLM:1002; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 5wqlywXB9+O7MXpCOucljmT2NDrmUwzhXNJDxMiEHE2xT8r/cE+AGuSbWri9VLOxyZKC1TecfxMDipfTq2TLiF0/GFe470DxOqsBGytJ7Ikfu2mjGpyAHGrmFSVKsm499pXePplVQUTznKxHS3pRO9ZunK3GllThjS+D507wu1YeMPyER6ima0rDs3CXcAiECT+slf9uNpO7OFkC52O5mHS6GVJhq+GvdCpFl9O5RDRuRCSyAwokxvYEXEHCSvbh0lZ/9/dO4/tjBtqrRUzfiNevw+61hjlZZ0Ayw60PLzrMseE6IuYjyr3Krrx1oDBI x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR11MB1286.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(346002)(136003)(39860400002)(396003)(376002)(66446008)(66556008)(107886003)(2616005)(6486002)(4326008)(5660300002)(66476007)(36756003)(54906003)(71200400001)(76116006)(8936002)(64756008)(110136005)(2906002)(6506007)(66946007)(86362001)(186003)(91956017)(478600001)(83380400001)(26005)(316002)(8676002)(1076003)(6512007); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: ORwWEzSkRygUvNFbDuDffBwLaX1xsdjzeTnUKAZ+ki0i9bwldyDQNZX+x7WcFKcnArxmT8CmbIFFcjrKu9+Ab5/3AxueyCAs69VIUtT81r7HcgArIhDb7ro3UKBzoJPGYm+d5vbC0fE7x9PmMf5VQQg8UHlWSY3gPeTUeyqk4MWRv7Ll3IkX4s1WuIn/BZ4Q+7TkMt/LQq+zET+Mt0g5vaej7hh6MhIeKA+MpyDHZydxnHYjzqzUg7xMDsNUf9R/Sp242ChOvMdrCZR722DrRyBpLGFIw+oB0NTkoVick6hV91r5vxAA8NCTrdj4W2mKrFy6BTS5pbAna+yHsI+nJFztE3cMv+SnWFe+Oal0+yFsLHi9dFkZFLoZzEroLg1HFD/EAPjf6FrLZAd2Dg/gMNhI5ZKqJs2GMJDXI5TS/iNjaoXr/IGO6zuW2Ak0ZplIpebtW/AUY6U3Wn+r6fo5sD9409TQUwR4uD2PqwaUBgoviR+RZr4LjG7rJBjvkqjpSwa+wW3mV/aTvPklJ88v8Bu0D1y5Ws3MhU1cdrcjs+gKNT2MNZ+3Tahn/8xAt4UCbo1jfy+PbqYpWvtsJ5xcPod09oiTrrQgcnSq0dAppgypEMallfh6RRGcqfKwBwtmrrl3Zkl61NU83nhOdDxjpuoh3r0Ot+7eajHsD2G64PRNuMU+2eEz1tvSgIHGPb0Y4EtCDVPxbnH1MpdoQ4999NNNYxxgX/ChJPwJOeQtuTaubm6H4XjuwSHGbpkQ5BSO5Bmw6Pcv2ACTZlbegB4KrsuchRWhvMDF0ZGMYt0VBgjX8t7wRCgzWrzgjU5T/LqiBCFlc5VwPVt/dDRiIhKUqJVPvrPY+hu2qPHAi2AwPzZwl+OxROUily036Q7HdvXYVjtbAugqkIAMLOvcoPuKqA== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY4PR11MB1286.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 807d1767-daff-4a5b-7533-08d89136fffe X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Nov 2020 11:41:08.0743 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: XbVG9J/H79bieyLXA5hZnYWqAmiJmI6/JKEe++YaMFBW7YuNvFO00rhOPxLQVfKan2GCKAvWsUO/Wolt1KOOatzg+i341mI3jcGE5YiIVIg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1605 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ajay Singh Added support for 'ndo_set_mac_address call' callback to allow change of interface MAC address. Signed-off-by: Ajay Singh --- drivers/net/wireless/microchip/wilc1000/hif.c | 17 +++++++++ drivers/net/wireless/microchip/wilc1000/hif.h | 1 + .../net/wireless/microchip/wilc1000/netdev.c | 38 +++++++++++++++++++ 3 files changed, 56 insertions(+) diff --git a/drivers/net/wireless/microchip/wilc1000/hif.c b/drivers/net/wireless/microchip/wilc1000/hif.c index d025a3093015..a133736a7821 100644 --- a/drivers/net/wireless/microchip/wilc1000/hif.c +++ b/drivers/net/wireless/microchip/wilc1000/hif.c @@ -1276,6 +1276,23 @@ int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr) return result; } +int wilc_set_mac_address(struct wilc_vif *vif, u8 *mac_addr) +{ + struct wid wid; + int result; + + wid.id = WID_MAC_ADDR; + wid.type = WID_STR; + wid.size = ETH_ALEN; + wid.val = mac_addr; + + result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1); + if (result) + netdev_err(vif->ndev, "Failed to get mac address\n"); + + return result; +} + int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ies, size_t ies_len) { diff --git a/drivers/net/wireless/microchip/wilc1000/hif.h b/drivers/net/wireless/microchip/wilc1000/hif.h index db9179171f05..58811911213b 100644 --- a/drivers/net/wireless/microchip/wilc1000/hif.h +++ b/drivers/net/wireless/microchip/wilc1000/hif.h @@ -168,6 +168,7 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len, u8 cipher_mode); 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_mac_address(struct wilc_vif *vif, u8 *mac_addr); int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ies, size_t ies_len); int wilc_disconnect(struct wilc_vif *vif); diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.c b/drivers/net/wireless/microchip/wilc1000/netdev.c index 20615c7ec168..2a1fbbdd6a4b 100644 --- a/drivers/net/wireless/microchip/wilc1000/netdev.c +++ b/drivers/net/wireless/microchip/wilc1000/netdev.c @@ -628,6 +628,43 @@ static struct net_device_stats *mac_stats(struct net_device *dev) return &vif->netstats; } +static int wilc_set_mac_addr(struct net_device *dev, void *p) +{ + int result; + struct wilc_vif *vif = netdev_priv(dev); + struct wilc *wilc = vif->wilc; + struct sockaddr *addr = (struct sockaddr *)p; + unsigned char mac_addr[ETH_ALEN]; + struct wilc_vif *tmp_vif; + int srcu_idx; + + if (!is_valid_ether_addr(addr->sa_data)) + return -EINVAL; + + srcu_idx = srcu_read_lock(&wilc->srcu); + list_for_each_entry_rcu(tmp_vif, &wilc->vif_list, list) { + wilc_get_mac_address(tmp_vif, mac_addr); + if (ether_addr_equal(addr->sa_data, mac_addr)) { + if (vif != tmp_vif) { + srcu_read_unlock(&wilc->srcu, srcu_idx); + return -EINVAL; + } + srcu_read_unlock(&wilc->srcu, srcu_idx); + return 0; + } + } + srcu_read_unlock(&wilc->srcu, srcu_idx); + + result = wilc_set_mac_address(vif, (u8 *)addr->sa_data); + if (result) + return result; + + ether_addr_copy(vif->bssid, addr->sa_data); + ether_addr_copy(vif->ndev->dev_addr, addr->sa_data); + + return result; +} + static void wilc_set_multicast_list(struct net_device *dev) { struct netdev_hw_addr *ha; @@ -813,6 +850,7 @@ static const struct net_device_ops wilc_netdev_ops = { .ndo_init = mac_init_fn, .ndo_open = wilc_mac_open, .ndo_stop = wilc_mac_close, + .ndo_set_mac_address = wilc_set_mac_addr, .ndo_start_xmit = wilc_mac_xmit, .ndo_get_stats = mac_stats, .ndo_set_rx_mode = wilc_set_multicast_list, From patchwork Wed Nov 25 11:41:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 333454 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B595FC64E7C for ; Wed, 25 Nov 2020 11:41:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 482212076B for ; Wed, 25 Nov 2020 11:41:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="R2CjNddS"; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="iBGl4Zlv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728841AbgKYLlR (ORCPT ); Wed, 25 Nov 2020 06:41:17 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:51746 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727114AbgKYLlM (ORCPT ); Wed, 25 Nov 2020 06:41:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1606304472; x=1637840472; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=A3WG8JeKmtKktM0AXAH4zNnj2CBBDR9gbXQZhS7+CNg=; b=R2CjNddSLrzR6WP/3+qgJu+pVQ06Vq6RTbdLtIX6Vj7qQaFrup3CjP1Y VZXd3fuzxEzEZfo7VsgSS6MEBkwLYimfP8zfumtZ2NoA1umurhn074WtK 3Q4IWSnm36zo3jmaKJuaALQRssL6ZgnSpbod2H7YoPELLKSEyNiKbVMKT TWBSST2aPeaFufuayjskBsWjV11Es2yGgANMUX728u7OS7rnXKwpavirL XY5cVuo16Ruz3gxdeQopWAlWAqAJ74fnN3lEfBsACTMit3nK/oZJRseu5 f4UKBzmdxPyC/kOsYu7g07ZUozOjQ/ezYBFLS6r8tKn7euZfE/Zwl9usY g==; IronPort-SDR: xHMedmEeQymC+J2fQ51CXn4wX0dCgbwYYR58yRYYliFjGmozK38zurd0G6Q/R5fjIIUEs6wdfj u8+BiZd8FgC5PYKVbVTy3JhazrinH6YEMXfqI4L9FYyvYxG5sQv7PmnMvCbyCFenElNF/X9fJX J8+j/RqhuM0dPfdPzObDAwTpIpw3JxQQYwIgXAP7xhWY+Gcks5rwq68Kf5sB5FaCsyxogYpRw9 HWDwUT8LwLs+ZP/FCAU8KxUfDwQuHYTG/xDON/dI8sW79o+A0cEuu83SWRizrKL0/U73VludjB u3k= X-IronPort-AV: E=Sophos;i="5.78,368,1599548400"; d="scan'208";a="100348214" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 25 Nov 2020 04:41:10 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 25 Nov 2020 04:41:10 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3 via Frontend Transport; Wed, 25 Nov 2020 04:41:10 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jNDhlZkCGg5KRHzvmbn5AmEuT6Ed/S0AFFq107BXmHxGtTiLT5xRGgs8rieOXYC9U6IIbqwmuqeYQq+ejtkxO66qhhSf7r1pjlYN6S1EZDhzcEWnsQNv9y38RGQXfkTNP2SH8SqtOhtHrf3JSfIfXPLFwlJwikCmRSAO3SkOBCw68xyn/vMtS/+VSowJJF8QOEjYjZvoT2Tk1SmOFx72N52KIz6+jB2wQWlgfLZE8SpryqLs5jn9quGBXUyamu4OlEoJq1TxWZWIYN515vlvo69E3CrhyU36S2OBAybEhtwJdkzcQbrSZuqpKEEmZ7xE9t4TvmGQ6Kn4kLyALxF4PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OZm5g0l1cmqyVi2oTs/++OzID7Ve4Usoydzo6NoBwYY=; b=fF1lhYCCvxPUQI57bW7gUD4hMApnx0EQzmkfludTKn1dNAwPly1x67adnHAYsMwC7oyP0Rc3MXAN3dktfE8xblWYEVxwoYFXEOG7vq3k3zvPPnBYVV9PLL4ChG0atlYDDiSdqrBaLB9tYCCG1f1BTCQT/hz33XxgMOiyns62+qmKF/F52gG0CtZclVZk12bLB2Fkp6x1TNDTPLk9zLNaxaDMdc9H2fEHWWO6A+XyAX6R5s6/RQ7XcFiiHNZpymMaKsgMy6jE2OL7ycVvD4cNDSGyBLVLR3G9UMk76LVRvIGWSzd/uNvwFa7oPkOzWP9tos8dvTId94LsDp4irr8Gww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OZm5g0l1cmqyVi2oTs/++OzID7Ve4Usoydzo6NoBwYY=; b=iBGl4Zlv1iUmQqyHM9k/GMmYcgNflLKl5GPek5FRzJSVHdkSsUhSFR8b9t6OxQKlwuT1kbqR85mUo6PUyVp5fMMY9e6a82dX3S7V9KZPzq+ePop/eaSZzA9lOrhkkc+mMhq08mGe0gBe/fjgPYMjJhT7BkxrjZfdUEZbEYrQfI4= Received: from CY4PR11MB1286.namprd11.prod.outlook.com (2603:10b6:903:2e::21) by CY4PR11MB1605.namprd11.prod.outlook.com (2603:10b6:910:10::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.20; Wed, 25 Nov 2020 11:41:08 +0000 Received: from CY4PR11MB1286.namprd11.prod.outlook.com ([fe80::a0d1:a499:1c83:a988]) by CY4PR11MB1286.namprd11.prod.outlook.com ([fe80::a0d1:a499:1c83:a988%6]) with mapi id 15.20.3589.022; Wed, 25 Nov 2020 11:41:08 +0000 From: To: , CC: , , Subject: [PATCH 2/5] wilc1000: free resource in wilc_wlan_txq_add_net_pkt() for failure path Thread-Topic: [PATCH 2/5] wilc1000: free resource in wilc_wlan_txq_add_net_pkt() for failure path Thread-Index: AQHWwx/dKVqWhS/yykqTuHgnqFj2eA== Date: Wed, 25 Nov 2020 11:41:08 +0000 Message-ID: <20201125114059.10006-3-ajay.kathat@microchip.com> References: <20201125114059.10006-1-ajay.kathat@microchip.com> In-Reply-To: <20201125114059.10006-1-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.17.1 authentication-results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=microchip.com; x-originating-ip: [171.61.34.149] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e65225dc-574d-4be0-092c-08d891370064 x-ms-traffictypediagnostic: CY4PR11MB1605: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-bypassexternaltag: True x-ms-oob-tlc-oobclassifiers: OLM:883; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: MjAENITLYSCxMZ44ILPzzOHotTfuVL3YIIuRJDBjZtoLQefTYHjKMhIGIMUgxGHYQjiYVZZ78ZQ/oJtoOzI7IMAsK49OKCoKsDVeupFrmmU3V94er/wbtWJ6bM230nfHG+z3UXz0D9I0+F9oa63SL9B7cXDe4HEHI6FOy3gTlnGZQiaTmH9IQu9vh+9/6MOOZsd691LJiqjWQ7fjwpL6Pb9HACfNU3jnRueCRJzRxSXKALvzTCEF5G20u8OJlHntHAeQi/QadG5DQYK+VVze5KPIErXbmcCwlgeX1YgCUPBGtGZ7agU+kqA8ffYwojmug+XwE6BgizP9+zfFjYV4/g== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR11MB1286.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(346002)(136003)(39860400002)(396003)(376002)(66446008)(66556008)(107886003)(2616005)(6486002)(4326008)(4744005)(5660300002)(66476007)(36756003)(54906003)(71200400001)(76116006)(8936002)(64756008)(110136005)(2906002)(6506007)(66946007)(86362001)(186003)(91956017)(478600001)(83380400001)(26005)(316002)(8676002)(1076003)(6512007); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: a1t/SsJzG8ut4GOvDhUjiPljmhjfumZCSqqXa2zXYwTZEuhIaNGG2TeH4DBbxiB7W9CDus3J8FTLJ88wODPHEH3MfvYNRtwsOzuCIv0FkCQemaq/5fEvuZNFo3c8lDKunAZgOmdlGNpwrtoZCOIr5xXTq064OvV0C1qLPSesSwtSoOhHyR5p98HDXkj2fwbCFRKSgWri1xFJfKMvX1fXWsNtw/3qsqcWLPy0iSMqOluy4VrAmz1DNDDcbm+djk7ZjpRF5TX3fqB2/IAg87GwMs3aBbdSM1p/JUn6NfqMTAKK1yeKLX+8v5eLWhE4BMqkhijgM0dBTnzFkhqZNDzEax66Z15TQASa6z0jJ4Lxjp0OJTAHgoKC1qaHF1DO655TCXd7S8NvoSSGHKA/ePWemlvrS3SHXySM18yIG980hKlEsGomm0DP5p8vWkIG0F8eIcb2uQp6Qt6fMREQuA/H0KPGrfeq5zm2lU/VT5ker3zs39axoymOx7wEXpOOsgc+YuNhMXrk89X/AbwqczpBkjFt/X5WuJ8E0XwmH/bPB+SlmEGHIvZ+kcafWcWt93xpXdhwMkMPWQAgf6LTYnCf0pQC0F+PfZtPCNGePkBLioQAREAVuho9bzbaGlALFaTsVxKej9LhkMGL/t9CUln9rxKO03UEOs33CjhgXa+Tyxu1GyOkr3ZO1+pTPi99lTwZWXphF/LQ4GDKYUgn4exGDR0wSbBeU9SlCX0SUBd4GCdCb8PkZwF2Fhh8p4jwwUKzD2le9xrdVs/zhIgyUr31BtWAVHU4YArfzhNlCT7qOOb2i+jY79R54xpRdCYmycq5Qju8NN+iU1vDZXB/uAne0Iu3WRcFhIb7JnkBMUHMv5LcnBIJQJkElLWHynYELFYfI8yi1vvdXAqI1jHlX7fcSg== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY4PR11MB1286.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e65225dc-574d-4be0-092c-08d891370064 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Nov 2020 11:41:08.7640 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Qx8GtEVz4NBFWAHP4Qf5IHInG9IhIHiIS5zNCkyeX0ou3GYoYTU3PNakxaajjsdSwlktvYXvIgzsiUHxZ40/9u5FNDgVVGMz6by63GMcWZ0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1605 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ajay Singh Before returing from wilc_wlan_txq_add_net_pkt() invoke tx_complete_fn() callback to free up allocated memory for failure cases. Signed-off-by: Ajay Singh --- drivers/net/wireless/microchip/wilc1000/wlan.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c index 6a82fb2f283e..f0cc2da7c9c7 100644 --- a/drivers/net/wireless/microchip/wilc1000/wlan.c +++ b/drivers/net/wireless/microchip/wilc1000/wlan.c @@ -284,13 +284,17 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, wilc = vif->wilc; - if (wilc->quit) + if (wilc->quit) { + tx_complete_fn(priv, 0); return 0; + } tqe = kmalloc(sizeof(*tqe), GFP_ATOMIC); - if (!tqe) + if (!tqe) { + tx_complete_fn(priv, 0); return 0; + } tqe->type = WILC_NET_PKT; tqe->buffer = buffer; tqe->buffer_size = buffer_size; From patchwork Wed Nov 25 11:41:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 332763 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 529ADC64E7D for ; Wed, 25 Nov 2020 11:41:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0304E206F7 for ; Wed, 25 Nov 2020 11:41:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="eQUq8Izy"; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="fmd9kOtA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728810AbgKYLlR (ORCPT ); Wed, 25 Nov 2020 06:41:17 -0500 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:38099 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727268AbgKYLlQ (ORCPT ); Wed, 25 Nov 2020 06:41:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1606304475; x=1637840475; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Q8SSyjFwQLV3pH35wsNuNTcgt4UpXo89ak0633EPj9g=; b=eQUq8IzyJKq0tK35miSGuLFQLTMgLAMKr55hL1d3SRlBjB/DJy+Fofvj rkvsZZspQvrkiGayAhmSlIUtUmLIrwmsVXU17DkT7PKe7WvY2EjGoVnTC oJvnqdlCXmjUkjhpGL8xOfNS0yLdXnT/rb4AjUfp/a2XXwoUSsSTLSEVg 6UBN84neEnO3hQXaMNJXEMCLainCy0LAOlvghR+QfxfFGFPxLZULIM88u 9hKtI72bxt4BkzsJI4OyxNEtDIvNx1P/nrOp9aMfcdX+7HxyT//UO/JF/ MB4CGrHL9Qu7GCley5E+gvQnS65smBicJmsAqAQfpoL4H5/5s9FTwVaDB w==; IronPort-SDR: hmddJNtHN+pJbdV4e4OrvMkOpA/CTKTuD4cFizoqQPupNvj3LuTp17fVwnxOn0TLntpz55rI/B L9Nwhm0XMIr+EW4ix70lNGAgJPgiDqY2Y0NiJ5CPZRDHRxL/TSR7p2yAsng0PMeM/jJToY0sqL JWfV7gZMGefbKbZRuJva6KyoxKutlD70vpyuWtVfCvyr3wC4OCPmjx1DuL4KN583S+E6TFqcSz lQFA1oKiTm35oCNm7bQqtQ8p5f+dlrdorjuGIVtZTlMvcw7ndIbsAq7V0/hr05k/MdRER8NWz4 5h0= X-IronPort-AV: E=Sophos;i="5.78,368,1599548400"; d="scan'208";a="104995331" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 25 Nov 2020 04:41:15 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 25 Nov 2020 04:41:15 -0700 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3 via Frontend Transport; Wed, 25 Nov 2020 04:41:15 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lnikaqYirziRQrEg2kE09uniXtRHdO309fAslLW2+6FC5xFP9FAjHwqw0qtPa/Kn8qArSyrWeTucdWtXOhc0OIyk/Rud/TCFUfNbo3v4H6BtpLNPe49lvT+sCtZXSG7Geogna7EXroa5R3upmkMqOTckYuON8xjzbiY71OBFrMLZL/xZ8C3tBhHY6qAfsZDqIifQSi/AtIBd6E+hZ4jWDKT8nI2euwZXdgBbVNKl5mwhrqCnAojRf27FOoYXxw3axkgOdcpp/nx8PdVi9khU7N2BVfRtNZMfxuA+5XkmgkXjyIS4lEi4CMp2myIf9aLITO0Xp2h0w1rx7Gk5NLnQNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aAa+nFWB1Jq/y2sMmcJyudggnWveUayc1Ab3y+fCZJQ=; b=NH4JWFA7PVyzU4v1ujusR2D0q6EGHtoJ+Bi3Wee6rENN65VP8rh1MG0QxmlWo9vMdI5Puj44HC3HI/rfIEEvxUfLMmvkdJBQF/wVru2vknJI4eJKMbH+ly9ZEIg6iqWgD6tIOH17PTfZ5JvwJ9+GZ/eniNg8b3yEyunRKIqHMFrckVjHgA3E0VMU0ZMv28+o+cuLfbQk1lUYrG9AZoPFXHX/CmUFE5rhnrv/qtI03YiyWfOayRdLbCFCAP06tuprYDLb9wMpiDCzPhSRBGHU3g0dqM5x8eeduoOpyUyFp936SLLfp5k/7Qt8hffvDkJVLNZ/is7ahHTvtJPOWCl/oQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aAa+nFWB1Jq/y2sMmcJyudggnWveUayc1Ab3y+fCZJQ=; b=fmd9kOtA+Ct9OOibyEk1V+lJCckOEVVIKm9kJRGz52NIqXVVmr6dlXTJe9GhPv99oPRcY1wPMJ/oUbxYG+DdmS+IpwBHtLNfNmz8DN/563fUC4tS0AoQijeV8nQttnTP+zacSywizvAbSLvrBY+TL9T9Bcuxb/NJPDP0m/wkx0Y= Received: from CY4PR11MB1286.namprd11.prod.outlook.com (2603:10b6:903:2e::21) by CY4PR11MB1287.namprd11.prod.outlook.com (2603:10b6:903:2d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.22; Wed, 25 Nov 2020 11:41:09 +0000 Received: from CY4PR11MB1286.namprd11.prod.outlook.com ([fe80::a0d1:a499:1c83:a988]) by CY4PR11MB1286.namprd11.prod.outlook.com ([fe80::a0d1:a499:1c83:a988%6]) with mapi id 15.20.3589.022; Wed, 25 Nov 2020 11:41:09 +0000 From: To: , CC: , , Subject: [PATCH 3/5] wilc1000: free resource in wilc_wlan_txq_add_mgmt_pkt() for failure path Thread-Topic: [PATCH 3/5] wilc1000: free resource in wilc_wlan_txq_add_mgmt_pkt() for failure path Thread-Index: AQHWwx/ef/9yBNwo30Wr1rzW7nXWOg== Date: Wed, 25 Nov 2020 11:41:09 +0000 Message-ID: <20201125114059.10006-4-ajay.kathat@microchip.com> References: <20201125114059.10006-1-ajay.kathat@microchip.com> In-Reply-To: <20201125114059.10006-1-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.17.1 authentication-results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=microchip.com; x-originating-ip: [171.61.34.149] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e03ea29a-2c35-4185-d934-08d8913700da x-ms-traffictypediagnostic: CY4PR11MB1287: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-bypassexternaltag: True x-ms-oob-tlc-oobclassifiers: OLM:883; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: pH/Y8exDWDAma01rr2rhwgHbsSK8gmTPV2Gh/ocqlytzSavJK5spBiKs3zk/PNogSQk8fdhSetZwdoHGgTx8IordCaTNvRVeVTmOu5FHpDhS8ETPzmoIebAj666DdeYbX3cqyUajcoB4udABoAZCP6hjjsseXLyhTIMUHKZnSnDthozd9h9gaGrloBpieBjJvV1K7Q5neezfBduPNNvURlUYvfRrFDF9xzDVZdqB48yi4ils2S9ExEqlXdX/lTHdKsyu7S3BLEXVSYZQZOAlkmhuD14PP+wuXrTCB40EHP9cUKLhGd/NXelR9ey6pe4XKOMQ9kh3r5am1Td0WTDsZQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR11MB1286.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(39860400002)(346002)(396003)(376002)(366004)(107886003)(66476007)(4744005)(66446008)(5660300002)(83380400001)(64756008)(8676002)(54906003)(2616005)(6486002)(66556008)(4326008)(316002)(110136005)(26005)(186003)(6506007)(86362001)(6512007)(1076003)(36756003)(478600001)(66946007)(76116006)(91956017)(8936002)(71200400001)(2906002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: LGzSMck6BH4XAMXVgfV2EEwvVuonA/Flg0710ex7lc9d8xDlzwCNYhFDZ9mwWGAunI2oxpYQb/RA+nvbK224NWnSIIOZrr6ZCkh7H4FuZzF5j3bLMSM/PjUJSCMAKIsQvNWGanNHVwoEoeoDU/R+F+DO2t2b4e4+eB3ksgiJ4tf5QCu9muak6YLej2YnyeVlzISaz5q+x7UxIhwrrhqh1b2q+Do4mN3ppp+NIjChlzvU/+M3jt7EV5AGCwG3onQkq6xLyafuF/k5ob0Zavq7qZAQBjzucNUd5wZGzXkV5ZUfTS3p+e2J5hHqcBA719dH6C6xJzfhwrKCetBgTNURnbiYs2RdBjwuNwpf+Egc6uEqmdsBdwHpj7aHucijCnxKWwluJBWzKE1aQ51Q2D8hbQX1j41aIrmFgwzlj2RuYmB1xZ3qe3hsxImwN4L6W2WCh9FIMATtLetwDMR4hm7d8FxKpaq8gmwP7pk5EC03w6g/qUljn9oB+p6fTOsD7t7U3kyC8f9VD3SKQhnaFRflvKrQz010gKr3WBhpRIONBn8uQsQ0oKoJI0K3ZRkmJVIxlsVXXgo4DL0oZ2Bh0dLDdPFOoAhZIw4EKJ+51en6F/x2/iSV20THNIbJvCDUCI9faNqD6Ew56yVyu5WJ4GY/Wcu6EJxWWNp3NaMBHcmAQXvB4K+tcYEPCTNtksZvxX0rEtT/VQyRPPi/f+9MmllfcP8o9aYa0cWHvg6nPrD/HxXq5rLsLRiVGdOeMkOiL/VZbO6csujQW+4g6dIDFIDQY3jjLOSZrl248zGXf7/57dTy/ZoXJ+QBXllkseG3VjBaGtWNvBtChnJ+bTcoj03Uch4GFx+2YZz89w3CKsL2U2vV2xT6SoTEkSPhuai0RMfBpNg85UNTUlAUpjmnzDC5NA== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY4PR11MB1286.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e03ea29a-2c35-4185-d934-08d8913700da X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Nov 2020 11:41:09.5057 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Cc7O+cwDu2u/DsozGjuX//YlDfhoS3nQPvWXhLe9DXJViiTUfyv6HLgxVOngYek4uc2A646DYw5QShh0xzcVzNOMIFoFJ3inBh75OLepj4Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1287 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ajay Singh Before returing from wilc_wlan_txq_add_mgmt_pkt() invoke tx_complete_fn() callback to free up allocated memory for failure case. Signed-off-by: Ajay Singh --- drivers/net/wireless/microchip/wilc1000/wlan.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c index f0cc2da7c9c7..42b5db4e2d81 100644 --- a/drivers/net/wireless/microchip/wilc1000/wlan.c +++ b/drivers/net/wireless/microchip/wilc1000/wlan.c @@ -319,13 +319,17 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, wilc = vif->wilc; - if (wilc->quit) + if (wilc->quit) { + tx_complete_fn(priv, 0); return 0; + } tqe = kmalloc(sizeof(*tqe), GFP_ATOMIC); - if (!tqe) + if (!tqe) { + tx_complete_fn(priv, 0); return 0; + } tqe->type = WILC_MGMT_PKT; tqe->buffer = buffer; tqe->buffer_size = buffer_size; From patchwork Wed Nov 25 11:41:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 333456 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C009C63777 for ; Wed, 25 Nov 2020 11:41:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AF3722076B for ; Wed, 25 Nov 2020 11:41:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="sJfaxbzP"; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="sbg+Z1Er" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728604AbgKYLlP (ORCPT ); Wed, 25 Nov 2020 06:41:15 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:51750 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727268AbgKYLlN (ORCPT ); Wed, 25 Nov 2020 06:41:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1606304472; x=1637840472; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=x7tGFYol/qoIc/ewgqIxkMSd8CIql7Hx5Pw2Ho2lBJg=; b=sJfaxbzPMVlCqT5IWEqPRXoQviX2k1s2MFzus+GZfUO8KE9abUMl9ODU LMOXflSHv86X9b2eEfSF6xL7IBwyUQuhfNCmTGW+8u1cCKSSwn9pInVgG 5ZlwCE39jG5zIbK4LQ6aQOfPRWXaTPpmRzeRH8wWYzVhcLgh/vcmQy90k EM4yNShl3vJCd1r+FcSnNDHDoKi1WxhQoDm+pb0kYuEdkiHBWgsXTKaWh W6v4mwCUKhgzVINN6XpfqJF24U0uihXvkg7tJQ7ZHhno6i2YTTlyErs/7 eQAeWz0PBSIAaxIYMU8IAy8WtHonQPMQTvwkumPpSVynqpoJiCjQiNYM6 g==; IronPort-SDR: 9fsBbIPJogry5buIcycwD+tud0GoRSFSJD4oNpZ2o3Lkq2D6aDzDO+6/3Z4JvWhD9FgGqVzmZu /zaBGp4Y1cxfehAluepKV+/OECGmHkeaSp4pw/XdTPGPwgWnbx93sK31EQhQsKOT8KrjSpaxd5 iaNF8uFv1ZdaZ4ArmyYyvf+6nBm+faXL8Ez+5I1t8KfKFURQfmyAemu9sD4IXgjfUqrL4Yrm+T 4sdqbgwf1xNrICTaRT1SWPze3yktE2blNYvnRqRVlYT81sC3nYnFbEpzAqwA6ZozFsb0zwigxQ HAg= X-IronPort-AV: E=Sophos;i="5.78,368,1599548400"; d="scan'208";a="100348218" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 25 Nov 2020 04:41:11 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 25 Nov 2020 04:41:11 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3 via Frontend Transport; Wed, 25 Nov 2020 04:41:11 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j+8iyKI0vj/LFpy2UT2pjepMAw3oVsozoZeKFsF170wRKdQ5abGvUMeFrCJMKKNaZZjRYYj5bOdCK7mqIcsL0bIZ1+XS/wcSggJXxihEJNBabtePzKjCQ2UU0ToLwSYM8kC6XZpWAPU474wlWrJFwTbZbEbegjq43FBLue2cNh1+MYSnGa8cOfHksBg0cYHvLnUNnqVbuhPKf39oEnU83Al1pt1QrfDMYcUK/W3vSV8CnaDjiFHybcpRnrn+JVh6Bc51JNJVzzUjjAEuKwcUBxZ9DHMUVD7cIhsluoqfJTea6BiS9eWGg1i04kXEIRok/Q64tbi/fyyQMSuFGkjutQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Jsve2jUlaok+5TdrLzcUATUAv1x/ivXUPR/D1QW2FxQ=; b=YIuS0bQF/wLbw3eqitETLtFzDwfqhrytTrUCC9N+bEGUF7UyatBoALuu2jVRbz7hO8hRXVcQ4Z4e4w9Rv5UFfnji4d5ISRM2Pnrm38YCGyDsUm9xSzsb4uXN10x9wn7/OUn8pP/KiiesclIpwdNiKSD3AAjNd2m8Ib2zcGeuWR34WwInt+bzDLbK9QSlljJnX695mzJGOvXEjnBL+k27CToGZB9YraUK2CNhbKqOiJblWeAf2mmAD/0VNcuDr1+Hn77B4i8aMNEZBldmjbxXKeDWTmOW7QZFGwNm8uOiFiGdFODmFVKa3fy/PFWKru/IwlcgIrMCStL+bEpXmL+MgQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Jsve2jUlaok+5TdrLzcUATUAv1x/ivXUPR/D1QW2FxQ=; b=sbg+Z1ErolYqXJIayAl+emJGXDgLkYNGdqZsHt4fGx6sFvMGBLQK/QmqH3UhKR25v2h4w3Il2eRsoPcFNsrz73R4y8XG7A9yGeMTYf2vxNyev+ag92ALa8C78hTrYD2LCtZjS7oWEJUEgqHhXzrwGZY8OO6KHXmb3QLdZ53SEw4= Received: from CY4PR11MB1286.namprd11.prod.outlook.com (2603:10b6:903:2e::21) by CY4PR11MB1605.namprd11.prod.outlook.com (2603:10b6:910:10::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.20; Wed, 25 Nov 2020 11:41:10 +0000 Received: from CY4PR11MB1286.namprd11.prod.outlook.com ([fe80::a0d1:a499:1c83:a988]) by CY4PR11MB1286.namprd11.prod.outlook.com ([fe80::a0d1:a499:1c83:a988%6]) with mapi id 15.20.3589.022; Wed, 25 Nov 2020 11:41:10 +0000 From: To: , CC: , , Subject: [PATCH 4/5] wilc1000: call complete() for failure in wilc_wlan_txq_add_cfg_pkt() Thread-Topic: [PATCH 4/5] wilc1000: call complete() for failure in wilc_wlan_txq_add_cfg_pkt() Thread-Index: AQHWwx/eKSDKaY4O/02tWmIDpLW1+A== Date: Wed, 25 Nov 2020 11:41:10 +0000 Message-ID: <20201125114059.10006-5-ajay.kathat@microchip.com> References: <20201125114059.10006-1-ajay.kathat@microchip.com> In-Reply-To: <20201125114059.10006-1-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.17.1 authentication-results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=microchip.com; x-originating-ip: [171.61.34.149] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 677eb85b-7390-4f0a-3da6-08d89137013b x-ms-traffictypediagnostic: CY4PR11MB1605: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-bypassexternaltag: True x-ms-oob-tlc-oobclassifiers: OLM:843; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: abeDY1RIXea5DP2eFbM/5bH1xaad4Q/UJcbs6ov5OxW57fCRrrxenGhxU6oY3RI6bDreR5bTskQRcvtBlUBPSTDIORaT8mapV3m/L8QzJWfTRSzAadrWJ0DI9VQWKaeQGrt/YJM6jlvZbkxG4MqupSF2vh25qhOS2lUHa8yyECnq23vs4uHCvbQRb/vVMpSFG3WcUFz6wV93jWh0+2+C9Y1NNA1rErRyOHY2F+O68X54+mxAaNBcWojAZcjcxCsnUH+pl3SAjqaeO23GM6Ybvuf/5SOiPpqd/q/6N0cDGJLI3d2CXVfK+4syQLv1VKS9 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR11MB1286.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(346002)(136003)(39860400002)(396003)(376002)(66446008)(66556008)(107886003)(2616005)(6486002)(4326008)(4744005)(5660300002)(66476007)(36756003)(54906003)(71200400001)(76116006)(8936002)(64756008)(110136005)(2906002)(6506007)(66946007)(86362001)(186003)(91956017)(478600001)(83380400001)(26005)(316002)(8676002)(1076003)(6512007); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: ogun6f1xLkfkny41WkrNJd4lGVf9sdkilqcMQZoXXdKQkmk9hX+UbdxYbFnsG5r16bgRKdQXDYe+eF4A0T8XN6sUuXT81mfis+vxp62zhxESOpTnLlx6fs0/KcaYGZgpRjwfUSqwN9tnTnvI3hod7HC6ROn5U7/w/c0xssdaaRIP+M2p/SIG1put117AVM0lfYQJOajGNP1HTA4ecxrLlb+BejrXE65XJsSi2Vl69EPlC0O1+J0VN5nyFQJYJXR605k0zjqYnq8uGSPBMCyEexaAQnDMLCGiML6PSpHLnTSwYWFnHlSW3Dyn+IdpDy0MFFGIds4FYLoTPQKZy1l8N5WOzyDAtKyGbUWZezwHONjw3u+lpo85ff0rfu5xjPrPoY9r8lXpKQ+IJTpLdTc/U9U0WW7nYxDqPqqy3mfU4+LJ5aM6czcdOYlS6UcmsT5BmiCbOcs2C8ryUKKvVsHpeYuB4BY2h/sicNArLmjtzaWTOnniHk+n5T0o+/Sq3Ce4qrx/OX1wr3jl8O68fwP1aAT2kwFNHBjU06UJanU/K4UxXmKvZqqeNKcsPUvziKdzYVE+KyafWkj+8/3Dy2UNxDiC5JsimYbcl6ieT1M6IxexMVuxtwO5YfUT8PcczxN+la9bO7ICUNflNotzqBzkrMDAKbBJRSqTfFVZWtlNGRu1e2hPbTsl5pzjgVn8+zHp+fJCWvHXr98B2Gqf1Rx9a1z1tmzZTFEzbDbvraJaaUdarkOEWMqxahJC2zDwuLDGQKoOlBi8+GVqspQS//TRW59y8aowmAR3flaACoAU+isbNOVjs+v2IV2HGmYhuhlbPFbfZfcaiCDwih46ygihDyc1UYJr1ZJeATnSVue8K6g9QcZdzJVqCTPFRHXcPWFViuVmtkytfzL8G8XvLU9COg== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY4PR11MB1286.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 677eb85b-7390-4f0a-3da6-08d89137013b X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Nov 2020 11:41:10.2173 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: aylal6KWm20VxVQJxiUPGhCl8tYDUb3o2vcWHHOBRckOhu9hT1vac/4JQmWkWDL7dyG+/w4AsaAnA+YSOhQzAx4FahC8JZmFOJEcwVY1PRw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1605 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ajay Singh Added complete() call for failure case in wilc_wlan_txq_add_cfg_pkt(). Signed-off-by: Ajay Singh --- drivers/net/wireless/microchip/wilc1000/wlan.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c index 42b5db4e2d81..0ff4de28f622 100644 --- a/drivers/net/wireless/microchip/wilc1000/wlan.c +++ b/drivers/net/wireless/microchip/wilc1000/wlan.c @@ -258,8 +258,10 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc_vif *vif, u8 *buffer, } tqe = kmalloc(sizeof(*tqe), GFP_ATOMIC); - if (!tqe) + if (!tqe) { + complete(&wilc->cfg_event); return 0; + } tqe->type = WILC_CFG_PKT; tqe->buffer = buffer; From patchwork Wed Nov 25 11:41:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 333455 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 942A2C64E75 for ; Wed, 25 Nov 2020 11:41:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1365B206D9 for ; Wed, 25 Nov 2020 11:41:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="uqQPpIwT"; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="BnNvQuoc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728481AbgKYLlP (ORCPT ); Wed, 25 Nov 2020 06:41:15 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:51746 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728405AbgKYLlO (ORCPT ); Wed, 25 Nov 2020 06:41:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1606304473; x=1637840473; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=ebmKOXgmbfDuBc1sdYfAgmXxYoR6wXtCtWAXdVOs+1o=; b=uqQPpIwT+392EOTl+g9HOSsZGuSgop0MHPMT6/cvEn23i5wT8Mzf3xMD 3AKqoLmnmsZ0/7/jfRrd/aIdPe65XlBOUvfIGjvbU3EB9DJmdaWkQeBps fwJ545BN7OCG+RfDUIgWWti1ej2CU6D7ifuCFLrUPrUTI8gA4vuwxU7JP jz/p51tiMyPNkl3L97ArcL9vH1gLKGMh0DubdSKSpBuJtD4JYcG1MJx4n ux+pbojYL+usiCF8Mk3QZnIveUXxwrbKbQghgGmuMjMdbGFDK6t4yIJiR 8WoUxQiJ4w+pbMvnEwdbh6e3qkhEmk7Us2ldKEK4xByYt5HHxv4RWQVB+ Q==; IronPort-SDR: /SSVM1dmgUqsvTWjjzXpA8JhH2FcKkRWRkNRlztqEw7VGvdDr3Ne4OMzMRqvDf3smyE2dPp4sA 1rAz8b9klSSnlTxfXR//0RTUFyRBrGNc8IsipGxXJanQoWrdQ2SLPmPzyKrnpApLJY7/f79WvY 7Y8ovqMiyeokNBCYWyTbN+Ef2pbY+JqH86w4zvZWrRXzIfqBA/InyLf33KGlFQFyNwWJ25duvc fQ8cAcaMnGAPCsK/aunJoF4c4qCOOFzX6HJ5+hipjK/+sBCOV20JHhtljMahfzh6AbPIjsvnVB 384= X-IronPort-AV: E=Sophos;i="5.78,368,1599548400"; d="scan'208";a="100348223" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 25 Nov 2020 04:41:12 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 25 Nov 2020 04:41:12 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3 via Frontend Transport; Wed, 25 Nov 2020 04:41:12 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oXhYO5fYQIJgukikF9hXKrqlbA8J5t6uda3cea5yuasiRguhJDkxy11qBgGqRH9O52zQ/zdp0bZCNSNbbFmnyGOks7TiXR7Ju2RSBRWSbPaVR+Miru0oiI795qO6aKec9rmeV8+YdEZpZDAsFbLmPGR612Ex65Aa50RXLz4Y4lhkf++vj+5JdRT8qbAqw9tmfc/e5zobrgRImOt5OnjIr7KoXKDD67XHBmRaOVey7BAojm606hu9GEOMKxWEx/xte8+TOQ1erdSMCMKsibZUsi9U4/5ZVYVtAsJkQXZVvRYLmm2VLvyz1vodlV5GIXxB+Y+d5JhTORLxjrTT8K7KOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ebmKOXgmbfDuBc1sdYfAgmXxYoR6wXtCtWAXdVOs+1o=; b=H/YyVo+4sn+51unpYOMxTsO+XzT2yO4zraZiElWTKro/LswW7zi+JzoFTrvOEIZ4jrge3x+1WPXlDOxvYfWbpJJIe7/YbQSR7XpfThRSUmznnwFmcoeeDpxIM/IGic5BURQdW4uTq2LwrqJS3EYEu0BQR7J3q6deYX8uBhQkjNevB5QrjUUpth1e6MpWuzFCJ54jSWT14lfsVTMWIM9k2NOT36zxNXuNxpTbVGEiI8Qkcte+wZVO77F96jbkvon8fPgOwRj4yv6KKCQtmUedsREZpZ6cgYQkzHNq+EMbBnVBfsEmQXfGrFg8aL8QTO3WR9CfZMyLcy+zsmSrXmClnQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ebmKOXgmbfDuBc1sdYfAgmXxYoR6wXtCtWAXdVOs+1o=; b=BnNvQuoczExHU+otBN6mu+7E3pTXkZDICwBx/kj4no97ilv65tuIet+bGdPqCipHlABEc+n7eMedzuBg+wNRR8H9GNnKvsBFb3F8Uk89YWjnDLCISwJ7Uk8VgA0L0BU18J1ttUq6LdoJ2bG//EPl7wSAefoE04+k0OtH2FaEEdw= Received: from CY4PR11MB1286.namprd11.prod.outlook.com (2603:10b6:903:2e::21) by CY4PR11MB1605.namprd11.prod.outlook.com (2603:10b6:910:10::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.20; Wed, 25 Nov 2020 11:41:11 +0000 Received: from CY4PR11MB1286.namprd11.prod.outlook.com ([fe80::a0d1:a499:1c83:a988]) by CY4PR11MB1286.namprd11.prod.outlook.com ([fe80::a0d1:a499:1c83:a988%6]) with mapi id 15.20.3589.022; Wed, 25 Nov 2020 11:41:11 +0000 From: To: , CC: , , Subject: [PATCH 5/5] wilc1000: added queue support for WMM Thread-Topic: [PATCH 5/5] wilc1000: added queue support for WMM Thread-Index: AQHWwx/f8upo1qvFUUG5pt57bWxILQ== Date: Wed, 25 Nov 2020 11:41:10 +0000 Message-ID: <20201125114059.10006-6-ajay.kathat@microchip.com> References: <20201125114059.10006-1-ajay.kathat@microchip.com> In-Reply-To: <20201125114059.10006-1-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.17.1 authentication-results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=microchip.com; x-originating-ip: [171.61.34.149] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 679a7e35-d519-4bf1-dd80-08d8913701be x-ms-traffictypediagnostic: CY4PR11MB1605: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-bypassexternaltag: True x-ms-oob-tlc-oobclassifiers: OLM:612; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 1cp36si1V1710awpr26r3z42w8tfNWCxL8Vd/d6uzxdjKa1/01wAZ6DJIHPGKlyyxook7hf3sX1zcGw+zPAGukUTiHsZxMKhlqAJIkTLiiFCvn/1r/7sw5vT07v77PZzhGVBMyVYRt25kcIlsDQKb7h+LR4S6vOPclPsp/J+Ff3zHaar717IC9gwkg32GlnaCJBgBvGGeuCUj8fQ3jIGqn/xhO9dt+B23+cpE/RGS+aauwp2bMPddmdLV1J3Ldsdck9Yk0TjgJ7bLmMrkEdPPzwNujuG26HrrjsNjvN6cuSBg+g7uBDpsD6zZv1wUz8y x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR11MB1286.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(346002)(136003)(39860400002)(396003)(376002)(66446008)(66556008)(107886003)(2616005)(6486002)(4326008)(30864003)(5660300002)(66476007)(36756003)(54906003)(71200400001)(76116006)(8936002)(64756008)(110136005)(2906002)(6506007)(66946007)(86362001)(186003)(91956017)(478600001)(83380400001)(26005)(316002)(8676002)(1076003)(6512007); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: 8RN2o4n115c3tZz0yMl8JetNQSrcAEx7ok7DrNIlwpnphsii4KESKsKUQ6i3J7WJK103LM3BR6QED/7VnDM8GgxPNHW/ZpTyk+B5rSBA0tpIiEC1UdYfZjy8/1dD4GqM8K1U1UmJ8h+M7ZAU6v5AuBvmY0g2mmS2EizH/lXX3ZyImvRSwXl0e1xJ6Usrmkj0XOTRsUm1PDCATYxJMNrVxsl/04QPalM2blhJihcyxf2uIRFRWlm3VoGsjBmPR3bu9Q0ZI99cOM/IrI4vpIOGymZBQ9Mr5BUqFAp2rlj0MoEFLOPVOg29rUnPZ5JVaEdVZeplGTxxyPufFMzbJGVnX/rnbez6VeD/Pjh5aV0g/smL2cMNr+2nVw8Soqn2XPszfm9EsjCBsShS8+Qtm5INHjroBKy0Ft9/m6zxigVKAghdkPb9I7P6rK8o8sHosOhI6C822BhiPaw6JuR7G95rfvSWvxJby9qv/UmwnwSwiH1Fwb3BAi7xy/darDnL/VoYcDSSt0yudVvenlaoWbXM8JJu9lIb5TMTCb+rjzhaNrNAJHSBrga9W6D353w1UI5gymAomdifxdTZihh7hbGQI1L7+sZjqrDRs+QsxJFyk3J0/pSqJHzPt+8a75YzDgaJ5GUxyvQF0w9spQU8HSyd2vyuvBC4p/mtM8wOFIt6y07d6zzhnokTPdXqELbgu+MSm5vgTVgu4B+KU9H2LLGgdupAdE21CufMpm3I3HVMd2lCCwqCzWsiZMHBoarg+T0F+EEGu8WUcN0w2Mw3lRuy62kVkAym1EwFAG7LU0mPZvSR7dnOI44ux424xjJeNf89nrgt4kr/5dB0ZnEw3HZA4WKtcRUgIiz9ULkGAUsut2nBPLfaSowGuTGJYJw/P10FYxkHNR0L4MwnD5vVuCJVcw== Content-ID: <1195003C1D6776408F309065EDD1175F@namprd11.prod.outlook.com> MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY4PR11MB1286.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 679a7e35-d519-4bf1-dd80-08d8913701be X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Nov 2020 11:41:11.0180 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: KG8paNuAjGoAKXfK9ACgsNHdWRnCNQnFuytMF2ttVSdABEJCqkDTOK9npQc5Xud/cBlFEhJVGJpXKXeNiHrQr7n5mE3xoBCVhk2ZQYBhcc0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1605 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ajay Singh Added multiple queues[BK,BE,VI,VO] to handle different priority data packets. Before adding a packet to the queue, checked its priority from the header, and then add to the suitable queue. The limit for each queue is maintained separately. Also while passing the packets to the firmware via VMM take care to select data packets based on priority and available space. Signed-off-by: Ajay Singh --- .../wireless/microchip/wilc1000/cfg80211.c | 7 +- .../net/wireless/microchip/wilc1000/netdev.h | 11 +- .../net/wireless/microchip/wilc1000/wlan.c | 315 ++++++++++++++---- .../net/wireless/microchip/wilc1000/wlan.h | 30 ++ 4 files changed, 302 insertions(+), 61 deletions(-) -- 2.24.0 diff --git a/drivers/net/wireless/microchip/wilc1000/cfg80211.c b/drivers/net/wireless/microchip/wilc1000/cfg80211.c index c1ac1d84790f..e3dd205cbbe5 100644 --- a/drivers/net/wireless/microchip/wilc1000/cfg80211.c +++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c @@ -1709,7 +1709,7 @@ int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type, { struct wilc *wl; struct wilc_vif *vif; - int ret; + int ret, i; wl = wilc_create_wiphy(dev); if (!wl) @@ -1725,7 +1725,10 @@ int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type, wl->io_type = io_type; wl->hif_func = ops; wl->chip_ps_state = WILC_CHIP_WAKEDUP; - INIT_LIST_HEAD(&wl->txq_head.list); + + for (i = 0; i < NQUEUES; i++) + INIT_LIST_HEAD(&wl->txq[i].txq_head.list); + INIT_LIST_HEAD(&wl->rxq_head.list); INIT_LIST_HEAD(&wl->vif_list); diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.h b/drivers/net/wireless/microchip/wilc1000/netdev.h index d0a006b68d08..86209b391a3d 100644 --- a/drivers/net/wireless/microchip/wilc1000/netdev.h +++ b/drivers/net/wireless/microchip/wilc1000/netdev.h @@ -197,6 +197,14 @@ struct wilc_vif { struct cfg80211_bss *bss; }; +struct wilc_tx_queue_status { + u8 buffer[AC_BUFFER_SIZE]; + u16 end_index; + u16 cnt[NQUEUES]; + u16 sum; + bool initialized; +}; + struct wilc { struct wiphy *wiphy; const struct wilc_hif_func *hif_func; @@ -245,9 +253,10 @@ struct wilc { u32 rx_buffer_offset; u8 *tx_buffer; - struct txq_entry_t txq_head; + struct txq_handle txq[NQUEUES]; int txq_entries; + struct wilc_tx_queue_status tx_q_limit; struct rxq_entry_t rxq_head; const struct firmware *firmware; diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c index 0ff4de28f622..993ea7c03429 100644 --- a/drivers/net/wireless/microchip/wilc1000/wlan.c +++ b/drivers/net/wireless/microchip/wilc1000/wlan.c @@ -6,6 +6,7 @@ #include #include +#include #include "cfg80211.h" #include "wlan_cfg.h" @@ -28,33 +29,34 @@ static inline void release_bus(struct wilc *wilc, enum bus_release release) mutex_unlock(&wilc->hif_cs); } -static void wilc_wlan_txq_remove(struct wilc *wilc, struct txq_entry_t *tqe) +static void wilc_wlan_txq_remove(struct wilc *wilc, u8 q_num, + struct txq_entry_t *tqe) { list_del(&tqe->list); wilc->txq_entries -= 1; + wilc->txq[q_num].count--; } static struct txq_entry_t * -wilc_wlan_txq_remove_from_head(struct net_device *dev) +wilc_wlan_txq_remove_from_head(struct wilc *wilc, u8 q_num) { struct txq_entry_t *tqe = NULL; unsigned long flags; - struct wilc_vif *vif = netdev_priv(dev); - struct wilc *wilc = vif->wilc; spin_lock_irqsave(&wilc->txq_spinlock, flags); - if (!list_empty(&wilc->txq_head.list)) { - tqe = list_first_entry(&wilc->txq_head.list, struct txq_entry_t, - list); + if (!list_empty(&wilc->txq[q_num].txq_head.list)) { + tqe = list_first_entry(&wilc->txq[q_num].txq_head.list, + struct txq_entry_t, list); list_del(&tqe->list); wilc->txq_entries -= 1; + wilc->txq[q_num].count--; } spin_unlock_irqrestore(&wilc->txq_spinlock, flags); return tqe; } -static void wilc_wlan_txq_add_to_tail(struct net_device *dev, +static void wilc_wlan_txq_add_to_tail(struct net_device *dev, u8 q_num, struct txq_entry_t *tqe) { unsigned long flags; @@ -63,15 +65,16 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev, spin_lock_irqsave(&wilc->txq_spinlock, flags); - list_add_tail(&tqe->list, &wilc->txq_head.list); + list_add_tail(&tqe->list, &wilc->txq[q_num].txq_head.list); wilc->txq_entries += 1; + wilc->txq[q_num].count++; spin_unlock_irqrestore(&wilc->txq_spinlock, flags); complete(&wilc->txq_event); } -static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif, +static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif, u8 q_num, struct txq_entry_t *tqe) { unsigned long flags; @@ -81,8 +84,9 @@ static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif, spin_lock_irqsave(&wilc->txq_spinlock, flags); - list_add(&tqe->list, &wilc->txq_head.list); + list_add(&tqe->list, &wilc->txq[q_num].txq_head.list); wilc->txq_entries += 1; + wilc->txq[q_num].count++; spin_unlock_irqrestore(&wilc->txq_spinlock, flags); mutex_unlock(&wilc->txq_add_to_head_cs); @@ -212,7 +216,7 @@ static void wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) tqe = f->pending_acks[i].txqe; if (tqe) { - wilc_wlan_txq_remove(wilc, tqe); + wilc_wlan_txq_remove(wilc, tqe->q_num, tqe); tqe->status = 1; if (tqe->tx_complete_func) tqe->tx_complete_func(tqe->priv, @@ -268,10 +272,138 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc_vif *vif, u8 *buffer, tqe->buffer_size = buffer_size; tqe->tx_complete_func = NULL; tqe->priv = NULL; + tqe->q_num = AC_VO_Q; tqe->ack_idx = NOT_TCP_ACK; tqe->vif = vif; - wilc_wlan_txq_add_to_head(vif, tqe); + wilc_wlan_txq_add_to_head(vif, AC_VO_Q, tqe); + + return 1; +} + +static bool is_ac_q_limit(struct wilc *wl, u8 q_num) +{ + u8 factors[NQUEUES] = {1, 1, 1, 1}; + u16 i; + unsigned long flags; + struct wilc_tx_queue_status *q = &wl->tx_q_limit; + u8 end_index; + u8 q_limit; + bool ret = false; + + spin_lock_irqsave(&wl->txq_spinlock, flags); + if (!q->initialized) { + for (i = 0; i < AC_BUFFER_SIZE; i++) + q->buffer[i] = i % NQUEUES; + + for (i = 0; i < NQUEUES; i++) { + q->cnt[i] = AC_BUFFER_SIZE * factors[i] / NQUEUES; + q->sum += q->cnt[i]; + } + q->end_index = AC_BUFFER_SIZE - 1; + q->initialized = 1; + } + + end_index = q->end_index; + q->cnt[q->buffer[end_index]] -= factors[q->buffer[end_index]]; + q->cnt[q_num] += factors[q_num]; + q->sum += (factors[q_num] - factors[q->buffer[end_index]]); + + q->buffer[end_index] = q_num; + if (end_index > 0) + q->end_index--; + else + q->end_index = AC_BUFFER_SIZE - 1; + + if (!q->sum) + q_limit = 1; + else + q_limit = (q->cnt[q_num] * FLOW_CONTROL_UPPER_THRESHOLD / q->sum) + 1; + + if (wl->txq[q_num].count <= q_limit) + ret = true; + + spin_unlock_irqrestore(&wl->txq_spinlock, flags); + + return ret; +} + +static inline u8 ac_classify(struct wilc *wilc, struct sk_buff *skb) +{ + u8 q_num = AC_BE_Q; + u8 dscp; + + switch (skb->protocol) { + case htons(ETH_P_IP): + dscp = ipv4_get_dsfield(ip_hdr(skb)) & 0xfc; + break; + case htons(ETH_P_IPV6): + dscp = ipv6_get_dsfield(ipv6_hdr(skb)) & 0xfc; + break; + default: + return q_num; + } + + switch (dscp) { + case 0x08: + case 0x20: + case 0x40: + q_num = AC_BK_Q; + break; + case 0x80: + case 0xA0: + case 0x28: + q_num = AC_VI_Q; + break; + case 0xC0: + case 0xD0: + case 0xE0: + case 0x88: + case 0xB8: + q_num = AC_VO_Q; + break; + } + + return q_num; +} + +static inline int ac_balance(struct wilc *wl, u8 *ratio) +{ + u8 i, max_count = 0; + + if (!ratio) + return -EINVAL; + + for (i = 0; i < NQUEUES; i++) + if (wl->txq[i].fw.count > max_count) + max_count = wl->txq[i].fw.count; + + for (i = 0; i < NQUEUES; i++) + ratio[i] = max_count - wl->txq[i].fw.count; + + return 0; +} + +static inline void ac_update_fw_ac_pkt_info(struct wilc *wl, u32 reg) +{ + wl->txq[AC_BK_Q].fw.count = FIELD_GET(BK_AC_COUNT_FIELD, reg); + wl->txq[AC_BE_Q].fw.count = FIELD_GET(BE_AC_COUNT_FIELD, reg); + wl->txq[AC_VI_Q].fw.count = FIELD_GET(VI_AC_COUNT_FIELD, reg); + wl->txq[AC_VO_Q].fw.count = FIELD_GET(VO_AC_COUNT_FIELD, reg); + + wl->txq[AC_BK_Q].fw.acm = FIELD_GET(BK_AC_ACM_STAT_FIELD, reg); + wl->txq[AC_BE_Q].fw.acm = FIELD_GET(BE_AC_ACM_STAT_FIELD, reg); + wl->txq[AC_VI_Q].fw.acm = FIELD_GET(VI_AC_ACM_STAT_FIELD, reg); + wl->txq[AC_VO_Q].fw.acm = FIELD_GET(VO_AC_ACM_STAT_FIELD, reg); +} + +static inline u8 ac_change(struct wilc *wilc, u8 *ac) +{ + do { + if (wilc->txq[*ac].fw.acm == 0) + return 0; + (*ac)++; + } while (*ac < NQUEUES); return 1; } @@ -283,6 +415,7 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, struct txq_entry_t *tqe; struct wilc_vif *vif = netdev_priv(dev); struct wilc *wilc; + u8 q_num; wilc = vif->wilc; @@ -304,10 +437,24 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, tqe->priv = priv; tqe->vif = vif; - tqe->ack_idx = NOT_TCP_ACK; - if (vif->ack_filter.enabled) - tcp_process(dev, tqe); - wilc_wlan_txq_add_to_tail(dev, tqe); + q_num = ac_classify(wilc, priv); + tqe->q_num = q_num; + if (ac_change(wilc, &q_num)) { + tx_complete_fn(priv, 0); + kfree(tqe); + return 0; + } + + if (is_ac_q_limit(wilc, q_num)) { + tqe->ack_idx = NOT_TCP_ACK; + if (vif->ack_filter.enabled) + tcp_process(dev, tqe); + wilc_wlan_txq_add_to_tail(dev, q_num, tqe); + } else { + tx_complete_fn(priv, 0); + kfree(tqe); + } + return wilc->txq_entries; } @@ -337,22 +484,23 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, tqe->buffer_size = buffer_size; tqe->tx_complete_func = tx_complete_fn; tqe->priv = priv; + tqe->q_num = AC_BE_Q; tqe->ack_idx = NOT_TCP_ACK; tqe->vif = vif; - wilc_wlan_txq_add_to_tail(dev, tqe); + wilc_wlan_txq_add_to_tail(dev, AC_VO_Q, tqe); return 1; } -static struct txq_entry_t *wilc_wlan_txq_get_first(struct wilc *wilc) +static struct txq_entry_t *wilc_wlan_txq_get_first(struct wilc *wilc, u8 q_num) { struct txq_entry_t *tqe = NULL; unsigned long flags; spin_lock_irqsave(&wilc->txq_spinlock, flags); - if (!list_empty(&wilc->txq_head.list)) - tqe = list_first_entry(&wilc->txq_head.list, struct txq_entry_t, - list); + if (!list_empty(&wilc->txq[q_num].txq_head.list)) + tqe = list_first_entry(&wilc->txq[q_num].txq_head.list, + struct txq_entry_t, list); spin_unlock_irqrestore(&wilc->txq_spinlock, flags); @@ -360,13 +508,14 @@ static struct txq_entry_t *wilc_wlan_txq_get_first(struct wilc *wilc) } static struct txq_entry_t *wilc_wlan_txq_get_next(struct wilc *wilc, - struct txq_entry_t *tqe) + struct txq_entry_t *tqe, + u8 q_num) { unsigned long flags; spin_lock_irqsave(&wilc->txq_spinlock, flags); - if (!list_is_last(&tqe->list, &wilc->txq_head.list)) + if (!list_is_last(&tqe->list, &wilc->txq[q_num].txq_head.list)) tqe = list_next_entry(tqe, list); else tqe = NULL; @@ -489,54 +638,92 @@ EXPORT_SYMBOL_GPL(host_sleep_notify); int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count) { int i, entries = 0; + u8 k, ac; u32 sum; u32 reg; + u8 ac_desired_ratio[NQUEUES] = {0, 0, 0, 0}; + u8 ac_preserve_ratio[NQUEUES] = {1, 1, 1, 1}; + u8 *num_pkts_to_add; + u8 vmm_entries_ac[WILC_VMM_TBL_SIZE]; u32 offset = 0; + bool max_size_over = 0, ac_exist = 0; int vmm_sz = 0; - struct txq_entry_t *tqe; + struct txq_entry_t *tqe_q[NQUEUES]; int ret = 0; int counter; int timeout; u32 vmm_table[WILC_VMM_TBL_SIZE]; + u8 ac_pkt_num_to_chip[NQUEUES] = {0, 0, 0, 0}; const struct wilc_hif_func *func; + int srcu_idx; u8 *txb = wilc->tx_buffer; - struct net_device *dev; struct wilc_vif *vif; if (wilc->quit) goto out_update_cnt; + if (ac_balance(wilc, ac_desired_ratio)) + return -EINVAL; + mutex_lock(&wilc->txq_add_to_head_cs); - tqe = wilc_wlan_txq_get_first(wilc); - if (!tqe) - goto out_unlock; - dev = tqe->vif->ndev; - wilc_wlan_txq_filter_dup_tcp_ack(dev); + + srcu_idx = srcu_read_lock(&wilc->srcu); + list_for_each_entry_rcu(vif, &wilc->vif_list, list) + wilc_wlan_txq_filter_dup_tcp_ack(vif->ndev); + srcu_read_unlock(&wilc->srcu, srcu_idx); + + for (ac = 0; ac < NQUEUES; ac++) + tqe_q[ac] = wilc_wlan_txq_get_first(wilc, ac); + i = 0; sum = 0; - while (tqe && (i < (WILC_VMM_TBL_SIZE - 1))) { - if (tqe->type == WILC_CFG_PKT) - vmm_sz = ETH_CONFIG_PKT_HDR_OFFSET; - else if (tqe->type == WILC_NET_PKT) - vmm_sz = ETH_ETHERNET_HDR_OFFSET; - else - vmm_sz = HOST_HDR_OFFSET; - - vmm_sz += tqe->buffer_size; - vmm_sz = ALIGN(vmm_sz, 4); - - if ((sum + vmm_sz) > WILC_TX_BUFF_SIZE) - break; + max_size_over = 0; + num_pkts_to_add = ac_desired_ratio; + do { + ac_exist = 0; + for (ac = 0; (ac < NQUEUES) && (!max_size_over); ac++) { + if (!tqe_q[ac]) + continue; + + vif = tqe_q[ac]->vif; + ac_exist = 1; + for (k = 0; (k < num_pkts_to_add[ac]) && + (!max_size_over) && tqe_q[ac]; k++) { + if (i >= (WILC_VMM_TBL_SIZE - 1)) { + max_size_over = 1; + break; + } - vmm_table[i] = vmm_sz / 4; - if (tqe->type == WILC_CFG_PKT) - vmm_table[i] |= BIT(10); - cpu_to_le32s(&vmm_table[i]); + if (tqe_q[ac]->type == WILC_CFG_PKT) + vmm_sz = ETH_CONFIG_PKT_HDR_OFFSET; + else if (tqe_q[ac]->type == WILC_NET_PKT) + vmm_sz = ETH_ETHERNET_HDR_OFFSET; + else + vmm_sz = HOST_HDR_OFFSET; - i++; - sum += vmm_sz; - tqe = wilc_wlan_txq_get_next(wilc, tqe); - } + vmm_sz += tqe_q[ac]->buffer_size; + vmm_sz = ALIGN(vmm_sz, 4); + + if ((sum + vmm_sz) > WILC_TX_BUFF_SIZE) { + max_size_over = 1; + break; + } + vmm_table[i] = vmm_sz / 4; + if (tqe_q[ac]->type == WILC_CFG_PKT) + vmm_table[i] |= BIT(10); + + cpu_to_le32s(&vmm_table[i]); + vmm_entries_ac[i] = ac; + + i++; + sum += vmm_sz; + tqe_q[ac] = wilc_wlan_txq_get_next(wilc, + tqe_q[ac], + ac); + } + } + num_pkts_to_add = ac_preserve_ratio; + } while (!max_size_over && ac_exist); if (i == 0) goto out_unlock; @@ -550,8 +737,10 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count) if (ret) break; - if ((reg & 0x1) == 0) + if ((reg & 0x1) == 0) { + ac_update_fw_ac_pkt_info(wilc, reg); break; + } counter++; if (counter > 200) { @@ -620,11 +809,13 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count) offset = 0; i = 0; do { + struct txq_entry_t *tqe; u32 header, buffer_offset; char *bssid; u8 mgmt_ptk = 0; - tqe = wilc_wlan_txq_remove_from_head(dev); + tqe = wilc_wlan_txq_remove_from_head(wilc, vmm_entries_ac[i]); + ac_pkt_num_to_chip[vmm_entries_ac[i]]++; if (!tqe) break; @@ -649,8 +840,11 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count) if (tqe->type == WILC_CFG_PKT) { buffer_offset = ETH_CONFIG_PKT_HDR_OFFSET; } else if (tqe->type == WILC_NET_PKT) { + int prio = tqe->q_num; + bssid = tqe->vif->bssid; buffer_offset = ETH_ETHERNET_HDR_OFFSET; + memcpy(&txb[offset + 4], &prio, sizeof(prio)); memcpy(&txb[offset + 8], bssid, 6); } else { buffer_offset = HOST_HDR_OFFSET; @@ -668,6 +862,8 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count) vif->ack_filter.pending_acks[tqe->ack_idx].txqe = NULL; kfree(tqe); } while (--entries); + for (i = 0; i < NQUEUES; i++) + wilc->txq[i].fw.count += ac_pkt_num_to_chip[i]; acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP); @@ -966,14 +1162,17 @@ void wilc_wlan_cleanup(struct net_device *dev) { struct txq_entry_t *tqe; struct rxq_entry_t *rqe; + u8 ac; struct wilc_vif *vif = netdev_priv(dev); struct wilc *wilc = vif->wilc; wilc->quit = 1; - while ((tqe = wilc_wlan_txq_remove_from_head(dev))) { - if (tqe->tx_complete_func) - tqe->tx_complete_func(tqe->priv, 0); - kfree(tqe); + for (ac = 0; ac < NQUEUES; ac++) { + while ((tqe = wilc_wlan_txq_remove_from_head(wilc, ac))) { + if (tqe->tx_complete_func) + tqe->tx_complete_func(tqe->priv, 0); + kfree(tqe); + } } while ((rqe = wilc_wlan_rxq_remove(wilc))) diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.h b/drivers/net/wireless/microchip/wilc1000/wlan.h index 7689569cd82f..3d2104f19819 100644 --- a/drivers/net/wireless/microchip/wilc1000/wlan.h +++ b/drivers/net/wireless/microchip/wilc1000/wlan.h @@ -207,6 +207,18 @@ #define MODALIAS "WILC_SPI" +#define NQUEUES 4 +#define AC_BUFFER_SIZE 1000 + +#define VO_AC_COUNT_FIELD GENMASK(31, 25) +#define VO_AC_ACM_STAT_FIELD BIT(24) +#define VI_AC_COUNT_FIELD GENMASK(23, 17) +#define VI_AC_ACM_STAT_FIELD BIT(16) +#define BE_AC_COUNT_FIELD GENMASK(15, 9) +#define BE_AC_ACM_STAT_FIELD BIT(8) +#define BK_AC_COUNT_FIELD GENMASK(7, 3) +#define BK_AC_ACM_STAT_FIELD BIT(1) + #define WILC_PKT_HDR_CONFIG_FIELD BIT(31) #define WILC_PKT_HDR_OFFSET_FIELD GENMASK(30, 22) #define WILC_PKT_HDR_TOTAL_LEN_FIELD GENMASK(21, 11) @@ -295,10 +307,17 @@ * Tx/Rx Queue Structure * ********************************************/ +enum ip_pkt_priority { + AC_VO_Q = 0, + AC_VI_Q = 1, + AC_BE_Q = 2, + AC_BK_Q = 3 +}; struct txq_entry_t { struct list_head list; int type; + u8 q_num; int ack_idx; u8 *buffer; int buffer_size; @@ -308,6 +327,17 @@ struct txq_entry_t { void (*tx_complete_func)(void *priv, int status); }; +struct txq_fw_recv_queue_stat { + u8 acm; + u8 count; +}; + +struct txq_handle { + struct txq_entry_t txq_head; + u16 count; + struct txq_fw_recv_queue_stat fw; +}; + struct rxq_entry_t { struct list_head list; u8 *buffer;