From patchwork Wed Jan 15 12:12:24 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: 216651 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AD33C33CB1 for ; Wed, 15 Jan 2020 12:19:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 659C9207FF for ; Wed, 15 Jan 2020 12:19:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="ESGgX2Rj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730842AbgAOMTT (ORCPT ); Wed, 15 Jan 2020 07:19:19 -0500 Received: from mail-bn7nam10on2050.outbound.protection.outlook.com ([40.107.92.50]:24527 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730333AbgAOMMb (ORCPT ); Wed, 15 Jan 2020 07:12:31 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZXbKK+SLJIeEGPMneT37MTlMQbRvWs219TwJoGUqleLzRc8avhoqkKnSp1lwXtDgaAH95YCnnS5ek1P1qxXIC8oUz4BQtxNiT6ThQTjoYAKQjn/HaDS0oJKiOwgumD0SQJF1/TrtjCbD7zFUnYy0DwRmCVjKrECEPBotoS7W92u3IlsPn/Wh3NNweT/6kR3jtFjP73oiMwS/WqPlQYO16CAkiB3j1hTM8PTl3GaO8JpNL99bTeec5ORnmJPfoJ4RDB0tr2DeltLGU+xVvAImGIKURqvZVSFflOPzLxepJwwr60O77QEbnzLEGZEypB9LB5cTn2yP3ahljS9pWoi3uA== 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=qXjwnQ3yvU8lyBSO2Sod3uaseaRMamnlynrVm+tTnXQ=; b=eo55ObKd7EBMnYy5EJcQVbo89noUAlJiWomVGMhlrD+7oEGrAzuvZKJqzY9Tel/jEjITmUn3tv2d+GeMBJr5mud3KkzFzX9lmLn1RmFAPG2FeTQ+jmWGtR6onzEXH3pHB/iuY7QExWGCo9RMyA9wRjhOG9cZeyHUnoU1w6jVjb23nNL85W30EfpTb6NLfo2KFvLnPOwu7dUiK3Bb0kAW6TSYciBUfumxO2b1fWrh4e0iN5rhavWCFtiunf3lCpaSOw4vyR1U5jj25axZZUAEQUKHIxibSlq54aw6R0dEHa6zZ+3r9on21luGafa85ByOHnCmY6xRg8/rEcLCTp7asQ== 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=qXjwnQ3yvU8lyBSO2Sod3uaseaRMamnlynrVm+tTnXQ=; b=ESGgX2RjWwzekhAetFpuTsq99f4bS7qrqcBRsjbtsFn8RbL51+8d9J4Relw12Bmdf20F5bDlREM1CPuSNVl+8MMrxeazQ9ZKe9JCkFwsP/m3dsiezSvvwl4de4oYBxZScuMFgObDPAuaPLr3OnnCPDyU3PnieJH0If8lEAtMd18= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (10.255.180.22) by MN2PR11MB4096.namprd11.prod.outlook.com (20.179.150.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.10; Wed, 15 Jan 2020 12:12:24 +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:12:24 +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:12:23 +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 12/65] staging: wfx: retrieve greenfield mode from sta->ht_cap and bss_conf Thread-Topic: [PATCH 12/65] staging: wfx: retrieve greenfield mode from sta->ht_cap and bss_conf Thread-Index: AQHVy50LTsPXvOgDXUODFi8ErFW3kw== Date: Wed, 15 Jan 2020 12:12:24 +0000 Message-ID: <20200115121041.10863-13-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: 2a608148-22f8-4b2c-a044-08d799b42e3e x-ms-traffictypediagnostic: MN2PR11MB4096: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:341; x-forefront-prvs: 02830F0362 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(346002)(39860400002)(366004)(376002)(136003)(199004)(189003)(85202003)(66946007)(66446008)(66476007)(2906002)(107886003)(66556008)(1076003)(64756008)(5660300002)(8936002)(6486002)(186003)(26005)(8676002)(316002)(81156014)(36756003)(52116002)(2616005)(7696005)(478600001)(16526019)(956004)(54906003)(110136005)(86362001)(71200400001)(85182001)(4326008)(81166006); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR11MB4096; 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: H6O127am20eMXytAkEyhlTQvlQ7c9Mn8rIFEg8Q8EIwTEMwKw/1ruMHEeODggYOUlrYwAqJ0W9jvfJeKdeuYV3AFYWihX1i2BDgKEwXBBRraL3ULxPxFiN8cJzGHrfRSR0pMYXIQ3ia4cv6olwIAKQHKSAEi4KBWT4GmFHfFyTEHetYjBayt2hkg8IwHtn0SgcDcyH0uLpJUEqXaChlVbdrLSFhNQKgNMEGXJVjnFVEOuIGkRyDGqJaIr3HBdY/DRgovjBo29pMP2ePM2DYsmmRfYneThF366Di8WaCYJOFOqJrzNcdX+JgMrwwc06+attQn6o+pOff/nG9TCWf4mLclYizoulbK+fhvLXsMs2Mchaim3QbhHBOrWmoVMjWI6OYkfTajejPZr0eXYLB7Rc+oQiQLGpjOeUoBToSDkhY+hrO3JqRrx3vJiR3oX1wn Content-ID: MIME-Version: 1.0 X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a608148-22f8-4b2c-a044-08d799b42e3e X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jan 2020 12:12:24.7012 (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: 1L/cqEYuU+TOp5KfdHPL85ikjpasdRTWOYbE1ZYePU55HfTYHAf3AlMzJcA9NbnrGDBgmhe0hXSshxpC1ZPwGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4096 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller wvif->ht_info contains useless copies of sta->ht_cap and bss_conf->ht_operation_mode. Prefer to retrieve information from the original structs instead of rely on wvif->ht_info. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/sta.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index f13a5b41735c..fcd9fe66e417 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -817,14 +817,6 @@ static int wfx_is_ht(const struct wfx_ht_info *ht_info) return ht_info->channel_type != NL80211_CHAN_NO_HT; } -static int wfx_ht_greenfield(const struct wfx_ht_info *ht_info) -{ - return wfx_is_ht(ht_info) && - (ht_info->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD) && - !(ht_info->operation_mode & - IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); -} - static void wfx_join_finalize(struct wfx_vif *wvif, struct ieee80211_bss_conf *info) { @@ -849,9 +841,8 @@ static void wfx_join_finalize(struct wfx_vif *wvif, } rcu_read_unlock(); - /* Non Greenfield stations present */ - if (wvif->ht_info.operation_mode & - IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT) + if (sta && + info->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT) hif_dual_cts_protection(wvif, true); else hif_dual_cts_protection(wvif, false); @@ -862,7 +853,10 @@ static void wfx_join_finalize(struct wfx_vif *wvif, association_mode.spacing = 1; association_mode.short_preamble = info->use_short_preamble; association_mode.basic_rate_set = cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, info->basic_rates)); - association_mode.greenfield = wfx_ht_greenfield(&wvif->ht_info); + if (sta && sta->ht_cap.ht_supported && + !(info->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT)) + association_mode.greenfield = + !!(sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD); if (sta && sta->ht_cap.ht_supported) association_mode.mpdu_start_spacing = sta->ht_cap.ampdu_density;