From patchwork Wed Jan 15 12:13:18 2020 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: 11333937 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 792D4138D for ; Wed, 15 Jan 2020 12:14:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3A0A924671 for ; Wed, 15 Jan 2020 12:14:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="atNMXd2L" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731702AbgAOMNr (ORCPT ); Wed, 15 Jan 2020 07:13:47 -0500 Received: from mail-bn7nam10on2064.outbound.protection.outlook.com ([40.107.92.64]:33252 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731641AbgAOMNp (ORCPT ); Wed, 15 Jan 2020 07:13:45 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OlbpDQCMMxbU2NGU68+KmDcWsxQ5+08LVJf2EDYbwPS27DHFGJ76BiRGmASHvUxap+l1b0hhPrrwK/yqX8KrH+cFDxbUlBTwKRGManooMPoXLGFY4cux5cy7f03ybPOmvQwMbuRNSO2bBTJIVW004aAliiDQPBzrX2iXpThUBwOcHYVaVEOxdXp2yt33F/5aqbvTZXHQjwsEvWRhvxHm/FQZ0erAOsDvOY3AoEAj0Xsm5uLW7KGH+Sx2TKtrwYr+xPlmMFbu5dWlaqNgaseyHfBhkNujTPSOHYMdKWWG4xzqXZha0B2u61gNFbj+Db3AvRxlfYI7MUMzeLcbtVpcPQ== 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=q+fCfnSJaynmH2NnQWzXjSclI/C2yFd80gnTfbqgY1w=; b=YM0JJU3lLa25QE4B4S2r3A8yCNHLnzSmBQY2fD3V53aDlxG/BG3NcvPPHX52H0djnUEbskmG2fasxd0G475d1CD51e2Jv+YJTaOOKSSMmeroT5jVyqC4Qe3iQFF64tE0hw7Z/xYJMe8lWYFq/jQPsCXS5iCegDgZ4U7qRxj0cWzk0uuJbNES/TwTkM71ECwGcd9MCO2WC0ROPpZ0mr3gaUD8zV5uZdHvN8loFmgZ7HFaMgMdqv8T6YiX2mjPOH13Uib4HW5JJ4ZM+bBrgfmXIk8hOns1KUlU52mIDKfnxNfvsoUE2XqlS2SqLQT6vmbW6ImY9CGAEVylBREFhKsWtg== 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=q+fCfnSJaynmH2NnQWzXjSclI/C2yFd80gnTfbqgY1w=; b=atNMXd2LpfjvqiwvjrwQqYQ8gtwU8yaHK3HUafpZWPaY5s6qPF4wPL2YosHFtAz+lIiy0xNvT6Rq0kqy9Exp2jHEreLlb5sI5jhhlAMzK6RoytFti6ihA2CKKaTzIB25wLIjxRfWiTR87Dt+wNwprwlEwVUqIV/xn03PTXr50Eo= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (10.255.180.22) by MN2PR11MB3934.namprd11.prod.outlook.com (10.255.180.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.20; Wed, 15 Jan 2020 12:13: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.2623.018; Wed, 15 Jan 2020 12:13:33 +0000 Received: from pc-42.silabs.com (37.71.187.125) by PR2PR09CA0009.eurprd09.prod.outlook.com (2603:10a6:101:16::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.18 via Frontend Transport; Wed, 15 Jan 2020 12:13:17 +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 52/65] staging: wfx: replace wfx_tx_get_tid() with ieee80211_get_tid() Thread-Topic: [PATCH 52/65] staging: wfx: replace wfx_tx_get_tid() with ieee80211_get_tid() Thread-Index: AQHVy50rurdsYUjCaUy7e1acwjtaVQ== Date: Wed, 15 Jan 2020 12:13:18 +0000 Message-ID: <20200115121041.10863-53-Jerome.Pouiller@silabs.com> References: <20200115121041.10863-1-Jerome.Pouiller@silabs.com> In-Reply-To: <20200115121041.10863-1-Jerome.Pouiller@silabs.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PR2PR09CA0009.eurprd09.prod.outlook.com (2603:10a6:101:16::21) 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.25.0 x-originating-ip: [37.71.187.125] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ec78330e-f651-4c1c-e41a-08d799b44e42 x-ms-traffictypediagnostic: MN2PR11MB3934: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 02830F0362 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(136003)(39860400002)(376002)(366004)(346002)(199004)(189003)(54906003)(110136005)(86362001)(956004)(107886003)(2616005)(316002)(36756003)(71200400001)(52116002)(7696005)(478600001)(8936002)(81156014)(8676002)(4326008)(81166006)(6486002)(2906002)(26005)(66946007)(16526019)(186003)(5660300002)(66574012)(1076003)(66556008)(64756008)(66446008)(85182001)(66476007)(85202003);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR11MB3934;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: G5ncbAkW9gjf6HpgxqYX7Kc+R2YZT6kC5EQoVu011BbTHg2aXOmLhhCxadiczYtvokFXP6pn+fBIB/N1K5SOwGxguu4OaZt+1M/rFqWEvGyHaghjd+GoiVIki1X7njiTa9RLeJD0JiXBRc+EpoWNs49JIcxbgrUjvQstX4NLMkcTE5PHcsgAlCiewL1c7tCP9C17jjcisPMZrH/OMb/OUeKmk2pAwXmQwyyB4B7U13kQaKNJ3beIGEct8V5dR+Ctq4A6j3D9nu2/HIRd+ZBEJEObC+XANBteEjDAK0Oz6gI1Mxj373G7NBnPD9NRRYvtsX+wQzdsUnC9JjRsThCNoel05gaUi7Hw5Rs947nh5jVFdoDQAGQ3RcNusYXuCufyj2J0WzVqBQpEk+CvxsNsLGBzKaN5FfDfKPuJvMmvuppEs+LggvEKfgu4bFphEQC6 Content-ID: MIME-Version: 1.0 X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec78330e-f651-4c1c-e41a-08d799b44e42 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jan 2020 12:13:18.4133 (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: fmPuQ5v1/71URSEnnEyfPWXYan/1wr3JUv0qdDc1OoN2HPtDXMiJoHTkIs7YILP3mCWO6Oc9dOJunQWqk64Rwg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3934 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller wfx_tx_get_tid() was used as a wrapper around ieee80211_get_tid(). It did sometime return WFX_MAX_TID to ask to upper layers to not include the frame in "buffered" counter. The objective of this behavior is not clear, but tests has shown that wfx_tx_get_tid() can be replaced by ieee80211_get_tid() without any regressions. BTW, it is not necessary to save the tid in tx_rpiv since it can be retrieved from the 802.11 header. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/data_tx.c | 23 ++++++----------------- drivers/staging/wfx/data_tx.h | 1 - drivers/staging/wfx/sta.c | 2 +- drivers/staging/wfx/sta.h | 5 +---- 4 files changed, 8 insertions(+), 23 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index 8c9f986ec672..7da1afd6e9b5 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -283,6 +283,7 @@ static void wfx_tx_manage_pm(struct wfx_vif *wvif, struct ieee80211_hdr *hdr, { u32 mask = ~BIT(tx_priv->raw_link_id); struct wfx_sta_priv *sta_priv; + int tid = ieee80211_get_tid(hdr); spin_lock_bh(&wvif->ps_state_lock); if (ieee80211_is_auth(hdr->frame_control)) { @@ -298,11 +299,11 @@ static void wfx_tx_manage_pm(struct wfx_vif *wvif, struct ieee80211_hdr *hdr, } spin_unlock_bh(&wvif->ps_state_lock); - if (sta && tx_priv->tid < WFX_MAX_TID) { + if (sta) { sta_priv = (struct wfx_sta_priv *)&sta->drv_priv; spin_lock_bh(&sta_priv->lock); - sta_priv->buffered[tx_priv->tid]++; - ieee80211_sta_set_buffered(sta, tx_priv->tid, true); + sta_priv->buffered[tid]++; + ieee80211_sta_set_buffered(sta, tid, true); spin_unlock_bh(&sta_priv->lock); } } @@ -418,17 +419,6 @@ static struct hif_ht_tx_parameters wfx_tx_get_tx_parms(struct wfx_dev *wdev, str return ret; } -static u8 wfx_tx_get_tid(struct ieee80211_hdr *hdr) -{ - // FIXME: ieee80211_get_tid(hdr) should be sufficient for all cases. - if (!ieee80211_is_data(hdr->frame_control)) - return WFX_MAX_TID; - if (ieee80211_is_data_qos(hdr->frame_control)) - return ieee80211_get_tid(hdr); - else - return 0; -} - static int wfx_tx_get_icv_len(struct ieee80211_key_conf *hw_key) { int mic_space; @@ -460,7 +450,6 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, memset(tx_info->rate_driver_data, 0, sizeof(struct wfx_tx_priv)); // Fill tx_priv tx_priv = (struct wfx_tx_priv *)tx_info->rate_driver_data; - tx_priv->tid = wfx_tx_get_tid(hdr); tx_priv->raw_link_id = wfx_tx_get_raw_link_id(wvif, sta, hdr); tx_priv->link_id = tx_priv->raw_link_id; if (ieee80211_has_protected(hdr->frame_control)) @@ -634,11 +623,11 @@ static void wfx_notify_buffered_tx(struct wfx_vif *wvif, struct sk_buff *skb) struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; struct ieee80211_sta *sta; struct wfx_sta_priv *sta_priv; - int tid = wfx_tx_get_tid(hdr); + int tid = ieee80211_get_tid(hdr); rcu_read_lock(); // protect sta sta = ieee80211_find_sta(wvif->vif, hdr->addr1); - if (sta && tid < WFX_MAX_TID) { + if (sta) { sta_priv = (struct wfx_sta_priv *)&sta->drv_priv; spin_lock_bh(&sta_priv->lock); WARN(!sta_priv->buffered[tid], "inconsistent notification"); diff --git a/drivers/staging/wfx/data_tx.h b/drivers/staging/wfx/data_tx.h index 83720b343484..04b2147101b6 100644 --- a/drivers/staging/wfx/data_tx.h +++ b/drivers/staging/wfx/data_tx.h @@ -38,7 +38,6 @@ struct wfx_tx_priv { struct ieee80211_key_conf *hw_key; u8 link_id; u8 raw_link_id; - u8 tid; } __packed; void wfx_tx_policy_init(struct wfx_vif *wvif); diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index eebbd3292b1b..61d64beb6143 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -604,7 +604,7 @@ int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct wfx_sta_priv *sta_priv = (struct wfx_sta_priv *) &sta->drv_priv; int i; - for (i = 0; i < WFX_MAX_TID; i++) + for (i = 0; i < ARRAY_SIZE(sta_priv->buffered); i++) WARN(sta_priv->buffered[i], "release station while Tx is in progress"); // FIXME: see note in wfx_sta_add() if (vif->type == NL80211_IFTYPE_STATION) diff --git a/drivers/staging/wfx/sta.h b/drivers/staging/wfx/sta.h index 47d94d6b8590..e832405d604e 100644 --- a/drivers/staging/wfx/sta.h +++ b/drivers/staging/wfx/sta.h @@ -12,9 +12,6 @@ #include "hif_api_cmd.h" -// FIXME: use IEEE80211_NUM_TIDS -#define WFX_MAX_TID 8 - struct wfx_dev; struct wfx_vif; @@ -40,7 +37,7 @@ struct wfx_grp_addr_table { struct wfx_sta_priv { int link_id; int vif_id; - u8 buffered[WFX_MAX_TID]; + u8 buffered[IEEE80211_NUM_TIDS]; // Ensure atomicity of "buffered" and calls to ieee80211_sta_set_buffered() spinlock_t lock; };