From patchwork Mon Dec 16 17:03:33 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: 11294677 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 48A2F930 for ; Mon, 16 Dec 2019 17:03:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1C067206D7 for ; Mon, 16 Dec 2019 17:03:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="Xa+WmeXL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726512AbfLPRDi (ORCPT ); Mon, 16 Dec 2019 12:03:38 -0500 Received: from mail-eopbgr750081.outbound.protection.outlook.com ([40.107.75.81]:59109 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726016AbfLPRDi (ORCPT ); Mon, 16 Dec 2019 12:03:38 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EbAarm5TlbOuF7nMFybJBUQAwWyh+m6XVpVD4hPTkcooMiMsG8Pf+8hsqzzj5e+nZOeA6F8gLSqta/zXNSQJgCrDy2+pmdtIbi2SzdH7ZcHPb6szQodeuHwNCMGHHPBy4wWhnwLNvP8FuAanMqIutFZcY9LzIZMwEUWpubeB2TNbtDSXsFIuHVRk10TuQzoEZ3LIGwAUViyCkxbXs4gpk33nM0XqxT3+WFEXXfAJ83wRAf3wD6Atjnxj6JMjjazwb0ktH01z6dhNnYRvdZMxsOzvFUg+B3YKbDaka3BYARTCYQO/WOrxGb6WjU9Rhq5oKLZZBVLL0cydCVLV29I/EA== 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=+Dvr+kvx6Q5qAoNnAw4+GkI8AOBwNA1bAmQT1ux4GTU=; b=R1r8MC0lkgZO0iqmzSOoO2C1QVJQyV2gvlSezTs46eAyViP5ghR1D1vhfT8jsm/LOhrKMXEC+5ynYMWceMqc1OhyhNZDUDQpCeH4iF0KvLOnMCV6nxNjLbpXayWL31ap4NZSUJqbQn2cC2WP1rIfgxOphBd6Wt7fx8MCRaGFExVIbE12l9Sd75y6ps2STej8ttnnrNBWnwRhEGfNDTItlp47VPs6m/piRSVdkK0LHS55E4ooNHCPN6Kj1ICClcIAAF33U2KF/duPsLpl/A08iJX/rlKX4xYOmA3ENp4xG9gmiyUITYX33YNf/YuUiJsHXORxn+GIS2GQY7qwtuOVgQ== 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=+Dvr+kvx6Q5qAoNnAw4+GkI8AOBwNA1bAmQT1ux4GTU=; b=Xa+WmeXL4wcfju1rt8tBFwgMXf85IG7scsCp6wzBk/7wZvnvoXeZoiJgqsv7Rem+rxdOmIU+2vN2RrGyzvcd9+VoIh4AVFCS73cdfxQHV3gQpwy1n5UcI3aWosw1nkVddrqM72cJu61iOuXqkfMkEexuI1RhicI3omriU7PjmyI= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (10.255.180.22) by MN2PR11MB3838.namprd11.prod.outlook.com (20.178.252.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.19; Mon, 16 Dec 2019 17:03:33 +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; Mon, 16 Dec 2019 17:03:33 +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?SsOpcsO0bWUgUG91aWxsZXI=?= Subject: [PATCH 01/55] staging: wfx: fix the cache of rate policies on interface reset Thread-Topic: [PATCH 01/55] staging: wfx: fix the cache of rate policies on interface reset Thread-Index: AQHVtDK/FGlLQ2gb2UOMnSXAR2+Aow== Date: Mon, 16 Dec 2019 17:03:33 +0000 Message-ID: <20191216170302.29543-2-Jerome.Pouiller@silabs.com> References: <20191216170302.29543-1-Jerome.Pouiller@silabs.com> In-Reply-To: <20191216170302.29543-1-Jerome.Pouiller@silabs.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jerome.Pouiller@silabs.com; x-originating-ip: [37.71.187.125] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 40a18dd3-02c1-4797-9227-08d78249e25b x-ms-traffictypediagnostic: MN2PR11MB3838: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-forefront-prvs: 02530BD3AA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(136003)(39860400002)(396003)(366004)(189003)(199004)(85202003)(8936002)(81166006)(8676002)(54906003)(110136005)(316002)(85182001)(6506007)(186003)(2906002)(5660300002)(6512007)(26005)(107886003)(81156014)(36756003)(4326008)(2616005)(76116006)(91956017)(64756008)(66556008)(66476007)(66946007)(71200400001)(86362001)(66446008)(6486002)(478600001)(1076003)(66574012);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR11MB3838;H:MN2PR11MB4063.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A: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: 7AB4safKcbspFlys09C+bMdj3W3B/mMZSqLqu9d0jFSk5+tTRYdwUPBbfiWnLQapAOQiUYiyRKouV3z5w0irrMFEdve6ro4b+Dr0JrrTXUdxQpKXOyBvR9Z948b1Pc6UjVxryBn4nwRiYC5lc9kWovnK6w3yMMc9XGI5ihS4fvANvGduJojPiKHQ2DYLsjCpLxEu7JTiG4ASLJpn/hhbny4CuulAPlVbo8AVd2NCesQqjzYKQ9GqIA2BlCqXVJ6CYxNVlNc0Jfs8Sbc+TfGm8Jh9nqvdTXrzIplI/m9N953I3as3CEJjtgaGfLV1iF+yv3i5ASLAYB1W8Avn3u8/33zVVo4NJD1chb9H2zTOTjLouASZeH4vhWxpidzKAdsGKkRo2nwAscymmZxMqXPDznOzRnu6SbFZM3fadTIXpUhnhGBwJ8daolvcLgxPFe1k Content-ID: MIME-Version: 1.0 X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 40a18dd3-02c1-4797-9227-08d78249e25b X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Dec 2019 17:03:33.5671 (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: jKxfrTUjK+tOuUrNR1Nxab657azfSn+PXlbTHJWhb+dic+9gZhl5E+zctXn8cgA6T9es8IfGluZbQBI+KkaX6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3838 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@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);