From patchwork Tue Dec 17 16:14:29 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: 11298205 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 75EAE6C1 for ; Tue, 17 Dec 2019 16:21:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4901324676 for ; Tue, 17 Dec 2019 16:21:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="kdrbXaZo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728334AbfLQQOg (ORCPT ); Tue, 17 Dec 2019 11:14:36 -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 S1726858AbfLQQOd (ORCPT ); Tue, 17 Dec 2019 11:14:33 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PX1F9Mf3WovbK2b5f4UKgPw4FFyYDx/2Xs15uJlspuIkXwN/q9JZ6rGPbXSYSiVsS0oUzaxPlI9fqRDzt7t8t7mf+slsagL4S3mSlnbpAFG+/jC7aZvq8roYz31oJ8I119gZRwSDLMmyF/BnFxLyFj2bNUGIC9CGmtwSMDCpAGnCWULiMFu1RO/pQDXGAWntwi0ZOWA6VSe/8xX+ByFJLXRsij1dazFgQxUIhIxS2fAuxKAbpU3xWdo0DWU6zQwQmcUOr9L8doc+nHRQgtm7zxiZB1B+uHqyhJ94gsVGwsKsGRkyN6OrWpQ1NIZf2FczgvrkKQ/F7MrdI5zsJ/MH2g== 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=6FKLXPwFiAaxz9IjURM8K6izCl2qp7MySkfX7eEdZc4=; b=joyrZuK9AfufqvFl0RNXTcvK/eq5wh1PqL51K5zjaqeFJo6bjcYKXn/MQ1FP8I8A61IOQkYfk8En7MZN4S961oqJ+IySMK9Sd3dWrALi3AFb2sQD4uKsM626IelKiCHMkMLALvddJ0jsDg+VpSaQfjo5PDUaPR9cCCKp4Q+xvdrFHniRfOeumRNDonXBh9Zxv9euvQ98tCsNNy18rjBdOpeStvZm00x4L1l62+I9PAqZGy3gG1B4vKr8jhEud5Ll9nduZl4Eq9jN3vertUchcQp4P6U533ZDOKGdkSKYMZo7l3eQL998j7t9BWbhL+eZpI+rIQF/myLIfx7reh/0Ww== 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=6FKLXPwFiAaxz9IjURM8K6izCl2qp7MySkfX7eEdZc4=; b=kdrbXaZoIlO+kgfywXp6LpFTCZCthhKIT0MRNtGAujpcroU6ogyrIpIN4+sLcPEdth9SzdWEuIw3UGZAwPT9YC3K7V7SK2wTsD9L01xprYU6RuGir/D+Bqqf7UtQuV7FgwbtFyEzPjpmQa0nurO+gM+cgVL/RFOChl2G0WNQq+E= 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:29 +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:29 +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 v2 02/55] staging: wfx: fix case of lack of tx_retry_policies Thread-Topic: [PATCH v2 02/55] staging: wfx: fix case of lack of tx_retry_policies Thread-Index: AQHVtPUPAJFfhQ1HJkic9pTjXp8ciQ== Date: Tue, 17 Dec 2019 16:14:29 +0000 Message-ID: <20191217161318.31402-3-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: 402f5594-1a37-4007-8702-08d7830c3187 x-ms-traffictypediagnostic: MN2PR11MB3678: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; 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: zHmWdBnQlHDMvYMakg/1VT/GcqVZvCmgxF0Ag33SRmd+QDXWX69jlTLbegvWctaPLxSISVhuzjGvM8wi80/uMaT79lKYjRM5teV/rcHhzXTGKhk6KBzv0mu6jgSYiaql56m4U1VOBVdQhOvfTJKqHPSck0X3hlSzvvbtzOc2Z0qZInWoaO5qsvcTvx3jzlBhTsR57z93xHl7z6UibovnqQ+qCZan2+or2SA9Wwtgyr+BwfGjNKcpfx3EFO6Wf93uDFUT/p1L27wwniTSlIyCPzOc6CUJ8g5scI1HyfNvqJeNTRsDgtOneiEF0DWDeXH9OzvNmOM1I6PnaiOp198EukwFUDp5DDe2p2CeZPwPPP1+WpVUCqzjIGa0hlLJU+fs+O9qsJkyMdjr07e4DihZiOaEjgCWgIkVGxHHknN7t7jDa1lZxs80jlylYODC2LT7 Content-ID: MIME-Version: 1.0 X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 402f5594-1a37-4007-8702-08d7830c3187 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Dec 2019 16:14:29.1925 (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: 1e9LAFymy5wKnpAlb8BUcuK5KSh4QdrnRrnobfSNQIeppzH5i7hDw5sT/D04Sl6rrljBm+YLpckoQ0qvooWGpQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3678 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