From patchwork Mon Dec 16 17:03:34 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: 11294807 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 83228930 for ; Mon, 16 Dec 2019 17:10:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5658B20717 for ; Mon, 16 Dec 2019 17:10:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="VyEL7Gln" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726852AbfLPRDq (ORCPT ); Mon, 16 Dec 2019 12:03:46 -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 S1725805AbfLPRDn (ORCPT ); Mon, 16 Dec 2019 12:03:43 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DPbcnXTvoGLhFPuW7mD/HP1/JOJ5CTRhU1X/7oYIYb2XZQigjw7DOZH54XQLklo7gep33Dmx27F2w4HsHBbJQ4gxSkpM5zjA50LCgJSX8FtD1vXQ8uQ+eH7ZPixJx2o2PDndHY47OEUxto2xXEc3nxxaKbdOkPn1ubEQ0/gaIRCokrQGKQtvEMWIHpXkFIx4sQOqjBY14RyG0eVibK+aYjSBgSWymm2QU2FMMMBwUwLquLZXI6WoiWIBcZ0bVLU3GXKcHkI3F5V6sKO+ZbCwzgZd9atbluDJPPARuKiF4LJyLTsW7IvmWlaivq5etghj+X6aNPqzEL/Mbkr5TpEluQ== 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=4+FEJwo6BZUafmDUc091MNuDC4vGtWgiYqyT633+fqI=; b=mtP4CJcW2gvIdy7G/iviyPhU63aCNwiwQSpkjSUSXEQK9A+u9nUos98eTl8ucnh65rEHB08UDh7cSlFunaIZr0u1m3qF8Mrt8p55safmSFt9/HBZQ9gJPh0fvzygvCWSJ4bj7ti1iIQX2Xf18miyvvT+HhTDo7nSovOY06Ww9IvkwVh7Aqyboq0dlXWp/jE+/cz4GwQhTp8h7p+kuu/l77q0bHcMqoHAvdUuvAVpTg5qNAGBekpIwOEUp6uZc/CpgJWy18qAiXPw3R5dmLWtbhpXf3uqHI7zzqdojZsPdYOZ8G6MDDuLPdKyqjuJf3kAq3IAcOsggrlhENrw7yRSXw== 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=4+FEJwo6BZUafmDUc091MNuDC4vGtWgiYqyT633+fqI=; b=VyEL7GlnnMvqJSzG8mc/hEMnfG9z73Fatg0EoLUM7BMXcpcOhDNFhaJtJhYrmbBTNVyNvtvvaS0J7l0b1mjAvYWLDH1XDbZNgX+C5TrqZum4baxNyvoW6XVB2J1dh3lY1E7mkwq6/uTV6VYDcSsZEvM41XgIeqwkflJaJF28RMc= 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:34 +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:34 +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 02/55] staging: wfx: fix case of lack of tx_retry_policies Thread-Topic: [PATCH 02/55] staging: wfx: fix case of lack of tx_retry_policies Thread-Index: AQHVtDLA7g5vqYmo1ESOFNPko8fBwA== Date: Mon, 16 Dec 2019 17:03:34 +0000 Message-ID: <20191216170302.29543-3-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: 11892f43-766a-4372-d190-08d78249e2b0 x-ms-traffictypediagnostic: MN2PR11MB3838: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; 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: D+ID1QJoshiP7c+6lpm6BT1yJLeRFzXArN+IXHeSvdLcmUT/4jcko9fHthr+qSAS7DownhlhHybbKZOtZJdJquqB/DltThwkd2tnB++8XQ2UnjeDCqbQHOJCNnf+vl1XyLQtlR8t3/ND1qV+R62vgbjbQbAauxKhiJ+nrGaMeiSZU43gcjMFgV0Y05hwxCLgj6w+btrCbrCjz4/uAO+b5y/BeUfW6P6kw/FTkGU1uxxkUTQfkakdJsjfLar1iEhWmTAwODXnW8bEIHFtd2ANoDuFyIO8J3K27z8cdz+BhHdopYn5eXPIhyETR5y2QrqrKoXRLtODZODVXJv/HUXxCK4K3+r9q4REA+qdrOzykYw+8nnUQfYOy9vlKMTVUlTjCIQlw6U+HJZfgBkc8iFu39BPdeYpfoZdD2tBlU++Gu6KIdLyYkqqJLmZEoRB3/OS Content-ID: <5B3FC5894829254CA871E4F28B918FB7@namprd11.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11892f43-766a-4372-d190-08d78249e2b0 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Dec 2019 17:03:34.0928 (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: FYUyYdEDfNaXnh01AGWYH5OBf1VN2dHdXE/ljv2lPuI7rMW70AJuSkTE4JinNIdQxqJdbaKJ9TFX6ww8Fb87zQ== 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 In some rare cases, driver may not have any available tx_retry_policies. In this case, the driver asks to mac80211 to stop sending data. However, it seems that a race is possible and a few frames can be sent to the driver. In this case, driver can't wait for free tx_retry_policies since wfx_tx() must be atomic. So, this patch fix this case by sending these frames with the special policy number 15. The firmware normally use policy 15 to send internal frames (PS-poll, beacons, etc...). So, it is not a so bad fallback. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/data_tx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index 02f001dab62b..df3aca03b50b 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -16,7 +16,7 @@ #include "traces.h" #include "hif_tx_mib.h" -#define WFX_INVALID_RATE_ID (0xFF) +#define WFX_INVALID_RATE_ID 15 #define WFX_LINK_ID_NO_ASSOC 15 #define WFX_LINK_ID_GC_TIMEOUT ((unsigned long)(10 * HZ)) @@ -202,6 +202,8 @@ static void wfx_tx_policy_put(struct wfx_vif *wvif, int idx) int usage, locked; struct tx_policy_cache *cache = &wvif->tx_policy_cache; + if (idx == WFX_INVALID_RATE_ID) + return; spin_lock_bh(&cache->lock); locked = list_empty(&cache->free); usage = wfx_tx_policy_release(cache, &cache->cache[idx]); @@ -549,7 +551,8 @@ static u8 wfx_tx_get_rate_id(struct wfx_vif *wvif, rate_id = wfx_tx_policy_get(wvif, tx_info->driver_rates, &tx_policy_renew); - WARN(rate_id == WFX_INVALID_RATE_ID, "unable to get a valid Tx policy"); + if (rate_id == WFX_INVALID_RATE_ID) + dev_warn(wvif->wdev->dev, "unable to get a valid Tx policy"); if (tx_policy_renew) { /* FIXME: It's not so optimal to stop TX queues every now and