From patchwork Tue Dec 17 16:14:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 1211550 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=silabs.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="GfXM8Db9"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47ck0p4j21z9sRM for ; Wed, 18 Dec 2019 03:21:30 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728305AbfLQQOd (ORCPT ); Tue, 17 Dec 2019 11:14:33 -0500 Received: from mail-eopbgr770078.outbound.protection.outlook.com ([40.107.77.78]:1089 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728179AbfLQQOc (ORCPT ); Tue, 17 Dec 2019 11:14:32 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QZhUu+G831Gl5KMwiE3x+G/UpOSnHboyHGF16wDcX7J/s+IYeTqEgtLweKOKtgcxnEN5kfyu2DF+8BbwupQzyDT1YAof1M7ZkkQzX0UGmj9dnMule9B02BUP+oUa5dZ6mHpbkhLFRlbc6HZfG/t0lqdI/sRnuEiSFzcQ8icMsZ4x/Ajdq1GzSKm/KwqWEMx+vP8iyAB0jDZ9E/4QyqcsMw4sTdYalhWh3FiFMvKh8OTU7GFK8aloOjnTAxPlQj13DRIHm7IYqCgBWnriyPK0YpnLmoaPv4sJKvlu7j3uUC+xvYCZy13TciVNsLHKAIKFsTb8evxWHcc4IVHc38uVGA== 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=SllwR4vG+YkzqlvlRssm7wQtcW6OikqRtUGCUbcX9As=; b=Rgw6bueztnsMBB0MIltHGU/R1tBBdYVYBrvk3DBYp+SJFKGN1AxUjlgJH26UJZehcfFHeQ1yvHh1fD0GX7fN2mwICU7AJ2721e67WQ36yEYpehdJUj5J6jW0bx7V+f/zQ+Fdxu/Q6+VEeunKp6P0BKqQQRx7EP3smLQM7dPgS8+jXAcSzN/ZUM7X35pFxBo1E8DD1x7d5jgS1DdbgQ6AXGkBdMP2waGMQaQRo1hIENJBiOKu2O3mUzf+RjuDVxosW+oVlTwPg75vrS8IM8gtqsuDAIaEIcEHqk5aKSdG5Iu85rrupUDv45d3sqG48imp+qnhGNJPHvghW4DaEqWDLQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SllwR4vG+YkzqlvlRssm7wQtcW6OikqRtUGCUbcX9As=; b=GfXM8Db9BOX6/TiG1sQeE5iQn3fCZJAmBWoUO1DpBNOzwQJD8htpejtwsmCqiEjNLpMvfcLFECEbvraoJ85aZuf857WfdzZo18ApEn4RaUmfoAzfSn6ewzl7gFC68nEG73DFCPhuTs8U/JHbLHgvEe4AeWGmjPlq88ZKohp7/WU= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (10.255.180.22) by MN2PR11MB3678.namprd11.prod.outlook.com (20.178.254.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.16; Tue, 17 Dec 2019 16:14:28 +0000 Received: from MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::f46c:e5b4:2a85:f0bf]) by MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::f46c:e5b4:2a85:f0bf%4]) with mapi id 15.20.2538.019; Tue, 17 Dec 2019 16:14:28 +0000 From: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= To: "devel@driverdev.osuosl.org" , "linux-wireless@vger.kernel.org" CC: "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Greg Kroah-Hartman , Kalle Valo , "David S . Miller" , =?utf-8?b?SsOpcsO0bWUgUG91?= =?utf-8?q?iller?= Subject: [PATCH v2 01/55] staging: wfx: fix the cache of rate policies on interface reset Thread-Topic: [PATCH v2 01/55] staging: wfx: fix the cache of rate policies on interface reset Thread-Index: AQHVtPUOtYz/qB8C10GcnNR+XQOQZw== Date: Tue, 17 Dec 2019 16:14:27 +0000 Message-ID: <20191217161318.31402-2-Jerome.Pouiller@silabs.com> References: <20191217161318.31402-1-Jerome.Pouiller@silabs.com> In-Reply-To: <20191217161318.31402-1-Jerome.Pouiller@silabs.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PR0P264CA0174.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1c::18) To MN2PR11MB4063.namprd11.prod.outlook.com (2603:10b6:208:13f::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jerome.Pouiller@silabs.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.24.0 x-originating-ip: [37.71.187.125] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 76c97594-eb8a-4699-3cb5-08d7830c30c5 x-ms-traffictypediagnostic: MN2PR11MB3678: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-forefront-prvs: 02543CD7CD x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(346002)(396003)(39840400004)(366004)(136003)(199004)(189003)(6512007)(66574012)(1076003)(478600001)(86362001)(8936002)(110136005)(316002)(2616005)(26005)(6506007)(5660300002)(36756003)(6486002)(66946007)(66476007)(66556008)(64756008)(66446008)(71200400001)(52116002)(85182001)(81166006)(81156014)(8676002)(54906003)(107886003)(2906002)(4326008)(186003)(85202003); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR11MB3678; H:MN2PR11MB4063.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: silabs.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: BktBOETnIazi5wmIIE9TPJ+0C/4p7xtGqcD4fII041sQ1wdOkflSWPTPwQzPIDf19v6lxuFDl5shtXHsMiJmrkKuaMfIjpYexV9EFdv8c9XBtkPC7+Tiq94RYrgQvxakPOso2T61xIjx+hkjSzHmAH4pvbP5YGqlu3EVVd0kjuL8DDFS1OYl+LGB0h7fQqYoIQZs9X/mlm+YJBvzj6R6tgh6otGBDPCtoiQiW4Tz3C5BFIQEDV9LVlz0Y21qbJC8CBoW0IzJRtRAXDDmGITweStS7vzdSn/fNaP47fIgOHZV063VHRl0yRFYDi3J8SqZk4qL7AdCfk251Kx3mR7bf2ARJ0kry6ep74kczPkp4I3/weWQK+RMgAs1+aP9m7j2UFIRrhL4xrMvyMvAdRgzK37gsjzOMCkQ4rN99LL2Znp4wxN5VGmdbHqgrX84kQLw Content-ID: MIME-Version: 1.0 X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76c97594-eb8a-4699-3cb5-08d7830c30c5 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Dec 2019 16:14:27.8792 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: orAHwmr4CgWPJ/yebH6MexxxpaqbwyRbe7a7JvgxXt0106oV1E/lPsIxMiGH7aXtEqVx9Zup+xX7IUvVsxUbVQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3678 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jérôme Pouiller Device and driver maintain a cache of rate policies (aka. tx_retry_policy in hardware API). When hif_reset() is sent to hardware, device resets its cache of rate policies. In order to keep driver in sync, it is necessary to do the same on driver. Note, when driver tries to use a rate policy that has not been defined on device, data is sent at 1Mbps. So, this patch should fix abnormal throughput observed sometime after a reset of the interface. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/data_tx.c | 3 +-- drivers/staging/wfx/data_tx.h | 1 + drivers/staging/wfx/sta.c | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index b722e9773232..02f001dab62b 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -249,7 +249,7 @@ static int wfx_tx_policy_upload(struct wfx_vif *wvif) return 0; } -static void wfx_tx_policy_upload_work(struct work_struct *work) +void wfx_tx_policy_upload_work(struct work_struct *work) { struct wfx_vif *wvif = container_of(work, struct wfx_vif, tx_policy_upload_work); @@ -270,7 +270,6 @@ void wfx_tx_policy_init(struct wfx_vif *wvif) spin_lock_init(&cache->lock); INIT_LIST_HEAD(&cache->used); INIT_LIST_HEAD(&cache->free); - INIT_WORK(&wvif->tx_policy_upload_work, wfx_tx_policy_upload_work); for (i = 0; i < HIF_MIB_NUM_TX_RATE_RETRY_POLICIES; ++i) list_add(&cache->cache[i].link, &cache->free); diff --git a/drivers/staging/wfx/data_tx.h b/drivers/staging/wfx/data_tx.h index 29faa5640516..a0f9ae69baf5 100644 --- a/drivers/staging/wfx/data_tx.h +++ b/drivers/staging/wfx/data_tx.h @@ -61,6 +61,7 @@ struct wfx_tx_priv { } __packed; void wfx_tx_policy_init(struct wfx_vif *wvif); +void wfx_tx_policy_upload_work(struct work_struct *work); void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, struct sk_buff *skb); diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 29848a202ab4..471dd15b227f 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -592,6 +592,7 @@ static void wfx_do_unjoin(struct wfx_vif *wvif) wfx_tx_flush(wvif->wdev); hif_keep_alive_period(wvif, 0); hif_reset(wvif, false); + wfx_tx_policy_init(wvif); hif_set_output_power(wvif, wvif->wdev->output_power * 10); wvif->dtim_period = 0; hif_set_macaddr(wvif, wvif->vif->addr); @@ -880,8 +881,10 @@ static int wfx_update_beaconing(struct wfx_vif *wvif) if (wvif->state != WFX_STATE_AP || wvif->beacon_int != conf->beacon_int) { wfx_tx_lock_flush(wvif->wdev); - if (wvif->state != WFX_STATE_PASSIVE) + if (wvif->state != WFX_STATE_PASSIVE) { hif_reset(wvif, false); + wfx_tx_policy_init(wvif); + } wvif->state = WFX_STATE_PASSIVE; wfx_start_ap(wvif); wfx_tx_unlock(wvif->wdev); @@ -1567,6 +1570,7 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) INIT_WORK(&wvif->set_cts_work, wfx_set_cts_work); INIT_WORK(&wvif->unjoin_work, wfx_unjoin_work); + INIT_WORK(&wvif->tx_policy_upload_work, wfx_tx_policy_upload_work); mutex_unlock(&wdev->conf_mutex); hif_set_macaddr(wvif, vif->addr);