From patchwork Tue Aug 20 11:55:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770006 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E95618E75E for ; Tue, 20 Aug 2024 11:55:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724154940; cv=none; b=c0HXHuFBj17T8DfulykHnc7UqgkEJ8EgXtqESa3LdMv14vrRJNClRP8u8/a+gH07qbB2++yE2MNPGZN3niYXJRwjhKq0FP8lTLTTbM+ojD3glgJ6EqPOdesP8V864og1tNpNSzHBPmYJYGpqKLGaeRcr7J/5F/wJGCK6NSjpY48= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724154940; c=relaxed/simple; bh=u798ymbQiQFcpyW2g1fc8wT0q7PQ86cSqiOXvda6+sY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nyHV+wpL+RNAOc0ipeYFVXTF9Qx2uM6YN1Tw/U//92o5mjFSTa+KEjmAs6FnfB7TQ7z5msgQYZR2BeBEI2NBhY2AwkpMiiPU2PxvXbxxPxL0XuFXXQN17FlnLVDabJcPOLIsqXh89O+KmNgSQ0UX/vMsOMSw4UXphds8CVAbvT8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNSS-0000Ag-5W; Tue, 20 Aug 2024 13:55:28 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNSR-001lLf-D7; Tue, 20 Aug 2024 13:55:27 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-15; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:26 +0200 Subject: [PATCH 01/31] wifi: mwifiex: remove unnecessary checks for valid priv Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-1-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=17316; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=u798ymbQiQFcpyW2g1fc8wT0q7PQ86cSqiOXvda6+sY=; b=9yhaSKyh/iqBXp5jKOzZet0Y1I7yH5Ets8StsoDRiTMwb9gMDf5GgeIaE3D+fPEQxRe5nrL+4 JHwGzrgFKoTBlAt+pHByLOR0IoVaOCDNTGn+M95trk3qRVEN3E2r5GC X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org The pointers in adapter->priv[] are allocated in mwifiex_register(). With an allocation failed the function will return an error and driver initialization is aborted. This makes all checks for valid priv pointers unnecessary throughout the driver. In many places the pointers are assumed to be valid without checks, this patch removes the remaining checks. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/11n.c | 2 - drivers/net/wireless/marvell/mwifiex/11n.h | 4 +- .../net/wireless/marvell/mwifiex/11n_rxreorder.c | 23 +++----- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 4 +- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 2 +- drivers/net/wireless/marvell/mwifiex/init.c | 67 +++++++++------------- drivers/net/wireless/marvell/mwifiex/join.c | 3 +- drivers/net/wireless/marvell/mwifiex/main.c | 14 ++--- drivers/net/wireless/marvell/mwifiex/main.h | 30 ++++------ drivers/net/wireless/marvell/mwifiex/scan.c | 2 - drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 3 +- drivers/net/wireless/marvell/mwifiex/usb.c | 7 +-- drivers/net/wireless/marvell/mwifiex/wmm.c | 7 --- 13 files changed, 59 insertions(+), 109 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/11n.c b/drivers/net/wireless/marvell/mwifiex/11n.c index c0c635e74bc50..66f0f5377ac18 100644 --- a/drivers/net/wireless/marvell/mwifiex/11n.c +++ b/drivers/net/wireless/marvell/mwifiex/11n.c @@ -881,8 +881,6 @@ void mwifiex_update_ampdu_txwinsize(struct mwifiex_adapter *adapter) struct mwifiex_private *priv; for (i = 0; i < adapter->priv_num; i++) { - if (!adapter->priv[i]) - continue; priv = adapter->priv[i]; tx_win_size = priv->add_ba_param.tx_win_size; diff --git a/drivers/net/wireless/marvell/mwifiex/11n.h b/drivers/net/wireless/marvell/mwifiex/11n.h index 7738ebe1fec17..773bd5c0f007d 100644 --- a/drivers/net/wireless/marvell/mwifiex/11n.h +++ b/drivers/net/wireless/marvell/mwifiex/11n.h @@ -108,9 +108,7 @@ static inline u8 mwifiex_space_avail_for_new_ba_stream( for (i = 0; i < adapter->priv_num; i++) { priv = adapter->priv[i]; - if (priv) - ba_stream_num += list_count_nodes( - &priv->tx_ba_stream_tbl_ptr); + ba_stream_num += list_count_nodes(&priv->tx_ba_stream_tbl_ptr); } if (adapter->fw_api_ver == MWIFIEX_FW_V15) { diff --git a/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c b/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c index 10690e82358b8..cb948ca343736 100644 --- a/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c +++ b/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c @@ -810,8 +810,6 @@ void mwifiex_update_rxreor_flags(struct mwifiex_adapter *adapter, u8 flags) for (i = 0; i < adapter->priv_num; i++) { priv = adapter->priv[i]; - if (!priv) - continue; spin_lock_bh(&priv->rx_reorder_tbl_lock); list_for_each_entry(tbl, &priv->rx_reorder_tbl_ptr, list) @@ -834,8 +832,6 @@ static void mwifiex_update_ampdu_rxwinsize(struct mwifiex_adapter *adapter, dev_dbg(adapter->dev, "Update rxwinsize %d\n", coex_flag); for (i = 0; i < adapter->priv_num; i++) { - if (!adapter->priv[i]) - continue; priv = adapter->priv[i]; rx_win_size = priv->add_ba_param.rx_win_size; if (coex_flag) { @@ -882,17 +878,16 @@ void mwifiex_coex_ampdu_rxwinsize(struct mwifiex_adapter *adapter) u8 count = 0; for (i = 0; i < adapter->priv_num; i++) { - if (adapter->priv[i]) { - priv = adapter->priv[i]; - if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) { - if (priv->media_connected) - count++; - } - if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP) { - if (priv->bss_started) - count++; - } + priv = adapter->priv[i]; + if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) { + if (priv->media_connected) + count++; } + if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP) { + if (priv->bss_started) + count++; + } + if (count >= MWIFIEX_BSS_COEX_COUNT) break; } diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index e36ef075fe053..e36fc37d6ff6e 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -3508,7 +3508,7 @@ static int mwifiex_cfg80211_suspend(struct wiphy *wiphy, for (i = 0; i < adapter->priv_num; i++) { priv = adapter->priv[i]; - if (priv && priv->netdev) + if (priv->netdev) netif_device_detach(priv->netdev); } @@ -3580,7 +3580,7 @@ static int mwifiex_cfg80211_resume(struct wiphy *wiphy) for (i = 0; i < adapter->priv_num; i++) { priv = adapter->priv[i]; - if (priv && priv->netdev) + if (priv->netdev) netif_device_attach(priv->netdev); } diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c index ea6ebc9c23ef0..7894102f03eb0 100644 --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c @@ -482,7 +482,7 @@ int mwifiex_process_event(struct mwifiex_adapter *adapter) if ((adapter->event_cause & EVENT_ID_MASK) == EVENT_RADAR_DETECTED) { for (i = 0; i < adapter->priv_num; i++) { priv = adapter->priv[i]; - if (priv && mwifiex_is_11h_active(priv)) { + if (mwifiex_is_11h_active(priv)) { adapter->event_cause |= ((priv->bss_num & 0xff) << 16) | ((priv->bss_type & 0xff) << 24); diff --git a/drivers/net/wireless/marvell/mwifiex/init.c b/drivers/net/wireless/marvell/mwifiex/init.c index a336d45b9677e..8b61e45cd6678 100644 --- a/drivers/net/wireless/marvell/mwifiex/init.c +++ b/drivers/net/wireless/marvell/mwifiex/init.c @@ -368,15 +368,13 @@ static void mwifiex_invalidate_lists(struct mwifiex_adapter *adapter) list_del(&adapter->bss_prio_tbl[i].bss_prio_head); for (i = 0; i < adapter->priv_num; i++) { - if (adapter->priv[i]) { - priv = adapter->priv[i]; - for (j = 0; j < MAX_NUM_TID; ++j) - list_del(&priv->wmm.tid_tbl_ptr[j].ra_list); - list_del(&priv->tx_ba_stream_tbl_ptr); - list_del(&priv->rx_reorder_tbl_ptr); - list_del(&priv->sta_list); - list_del(&priv->auto_tdls_list); - } + priv = adapter->priv[i]; + for (j = 0; j < MAX_NUM_TID; ++j) + list_del(&priv->wmm.tid_tbl_ptr[j].ra_list); + list_del(&priv->tx_ba_stream_tbl_ptr); + list_del(&priv->rx_reorder_tbl_ptr); + list_del(&priv->sta_list); + list_del(&priv->auto_tdls_list); } } @@ -425,13 +423,11 @@ int mwifiex_init_lock_list(struct mwifiex_adapter *adapter) spin_lock_init(&adapter->mwifiex_cmd_lock); spin_lock_init(&adapter->queue_lock); for (i = 0; i < adapter->priv_num; i++) { - if (adapter->priv[i]) { - priv = adapter->priv[i]; - spin_lock_init(&priv->wmm.ra_list_spinlock); - spin_lock_init(&priv->curr_bcn_buf_lock); - spin_lock_init(&priv->sta_list_spinlock); - spin_lock_init(&priv->auto_tdls_lock); - } + priv = adapter->priv[i]; + spin_lock_init(&priv->wmm.ra_list_spinlock); + spin_lock_init(&priv->curr_bcn_buf_lock); + spin_lock_init(&priv->sta_list_spinlock); + spin_lock_init(&priv->auto_tdls_lock); } /* Initialize cmd_free_q */ @@ -455,8 +451,6 @@ int mwifiex_init_lock_list(struct mwifiex_adapter *adapter) } for (i = 0; i < adapter->priv_num; i++) { - if (!adapter->priv[i]) - continue; priv = adapter->priv[i]; for (j = 0; j < MAX_NUM_TID; ++j) INIT_LIST_HEAD(&priv->wmm.tid_tbl_ptr[j].ra_list); @@ -506,31 +500,24 @@ int mwifiex_init_fw(struct mwifiex_adapter *adapter) mwifiex_init_adapter(adapter); for (i = 0; i < adapter->priv_num; i++) { - if (adapter->priv[i]) { - priv = adapter->priv[i]; + priv = adapter->priv[i]; - /* Initialize private structure */ - ret = mwifiex_init_priv(priv); - if (ret) - return -1; - } + /* Initialize private structure */ + ret = mwifiex_init_priv(priv); + if (ret) + return -1; } if (adapter->mfg_mode) { adapter->hw_status = MWIFIEX_HW_STATUS_READY; ret = -EINPROGRESS; } else { for (i = 0; i < adapter->priv_num; i++) { - if (adapter->priv[i]) { - ret = mwifiex_sta_init_cmd(adapter->priv[i], - first_sta, true); - if (ret == -1) - return -1; - - first_sta = false; - } - - + ret = mwifiex_sta_init_cmd(adapter->priv[i], + first_sta, true); + if (ret == -1) + return -1; + first_sta = false; } } @@ -637,13 +624,11 @@ mwifiex_shutdown_drv(struct mwifiex_adapter *adapter) /* Clean up Tx/Rx queues and delete BSS priority table */ for (i = 0; i < adapter->priv_num; i++) { - if (adapter->priv[i]) { - priv = adapter->priv[i]; + priv = adapter->priv[i]; - mwifiex_clean_auto_tdls(priv); - mwifiex_abort_cac(priv); - mwifiex_free_priv(priv); - } + mwifiex_clean_auto_tdls(priv); + mwifiex_abort_cac(priv); + mwifiex_free_priv(priv); } atomic_set(&adapter->tx_queued, 0); diff --git a/drivers/net/wireless/marvell/mwifiex/join.c b/drivers/net/wireless/marvell/mwifiex/join.c index 249210fb2e753..6d8f1d1d7ca4e 100644 --- a/drivers/net/wireless/marvell/mwifiex/join.c +++ b/drivers/net/wireless/marvell/mwifiex/join.c @@ -1582,8 +1582,7 @@ void mwifiex_deauthenticate_all(struct mwifiex_adapter *adapter) for (i = 0; i < adapter->priv_num; i++) { priv = adapter->priv[i]; - if (priv) - mwifiex_deauthenticate(priv, NULL); + mwifiex_deauthenticate(priv, NULL); } } EXPORT_SYMBOL_GPL(mwifiex_deauthenticate_all); diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c index 88cd2d6a1dcb7..96d1f6039fbca 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -127,10 +127,8 @@ static int mwifiex_unregister(struct mwifiex_adapter *adapter) /* Free private structures */ for (i = 0; i < adapter->priv_num; i++) { - if (adapter->priv[i]) { - mwifiex_free_curr_bcn(adapter->priv[i]); - kfree(adapter->priv[i]); - } + mwifiex_free_curr_bcn(adapter->priv[i]); + kfree(adapter->priv[i]); } if (adapter->nd_info) { @@ -1171,7 +1169,7 @@ void mwifiex_drv_info_dump(struct mwifiex_adapter *adapter) } for (i = 0; i < adapter->priv_num; i++) { - if (!adapter->priv[i] || !adapter->priv[i]->netdev) + if (!adapter->priv[i]->netdev) continue; priv = adapter->priv[i]; p += sprintf(p, "\n[interface : \"%s\"]\n", @@ -1210,7 +1208,7 @@ void mwifiex_drv_info_dump(struct mwifiex_adapter *adapter) debug_info = kzalloc(sizeof(*debug_info), GFP_KERNEL); if (debug_info) { for (i = 0; i < adapter->priv_num; i++) { - if (!adapter->priv[i] || !adapter->priv[i]->netdev) + if (!adapter->priv[i]->netdev) continue; priv = adapter->priv[i]; mwifiex_get_debug_info(priv, debug_info); @@ -1472,7 +1470,7 @@ static void mwifiex_uninit_sw(struct mwifiex_adapter *adapter) /* Stop data */ for (i = 0; i < adapter->priv_num; i++) { priv = adapter->priv[i]; - if (priv && priv->netdev) { + if (priv->netdev) { mwifiex_stop_net_dev_queue(priv->netdev, adapter); if (netif_carrier_ok(priv->netdev)) netif_carrier_off(priv->netdev); @@ -1497,8 +1495,6 @@ static void mwifiex_uninit_sw(struct mwifiex_adapter *adapter) for (i = 0; i < adapter->priv_num; i++) { priv = adapter->priv[i]; - if (!priv) - continue; rtnl_lock(); if (priv->netdev && priv->wdev.iftype != NL80211_IFTYPE_UNSPECIFIED) { diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index 9024bb944e6aa..529863edd7a25 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -1303,14 +1303,12 @@ mwifiex_get_priv_by_id(struct mwifiex_adapter *adapter, int i; for (i = 0; i < adapter->priv_num; i++) { - if (adapter->priv[i]) { - if (adapter->priv[i]->bss_mode == NL80211_IFTYPE_UNSPECIFIED) - continue; + if (adapter->priv[i]->bss_mode == NL80211_IFTYPE_UNSPECIFIED) + continue; - if ((adapter->priv[i]->bss_num == bss_num) && - (adapter->priv[i]->bss_type == bss_type)) - break; - } + if ((adapter->priv[i]->bss_num == bss_num) && + (adapter->priv[i]->bss_type == bss_type)) + break; } return ((i < adapter->priv_num) ? adapter->priv[i] : NULL); } @@ -1326,11 +1324,9 @@ mwifiex_get_priv(struct mwifiex_adapter *adapter, int i; for (i = 0; i < adapter->priv_num; i++) { - if (adapter->priv[i]) { - if (bss_role == MWIFIEX_BSS_ROLE_ANY || - GET_BSS_ROLE(adapter->priv[i]) == bss_role) - break; - } + if (bss_role == MWIFIEX_BSS_ROLE_ANY || + GET_BSS_ROLE(adapter->priv[i]) == bss_role) + break; } return ((i < adapter->priv_num) ? adapter->priv[i] : NULL); @@ -1348,12 +1344,10 @@ mwifiex_get_unused_bss_num(struct mwifiex_adapter *adapter, u8 bss_type) memset(index, 0, sizeof(index)); for (i = 0; i < adapter->priv_num; i++) - if (adapter->priv[i]) { - if (adapter->priv[i]->bss_type == bss_type && - !(adapter->priv[i]->bss_mode == - NL80211_IFTYPE_UNSPECIFIED)) { - index[adapter->priv[i]->bss_num] = 1; - } + if (adapter->priv[i]->bss_type == bss_type && + !(adapter->priv[i]->bss_mode == + NL80211_IFTYPE_UNSPECIFIED)) { + index[adapter->priv[i]->bss_num] = 1; } for (j = 0; j < MWIFIEX_MAX_BSS_NUM; j++) if (!index[j]) diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c b/drivers/net/wireless/marvell/mwifiex/scan.c index e782d652cb933..010e6ff91457f 100644 --- a/drivers/net/wireless/marvell/mwifiex/scan.c +++ b/drivers/net/wireless/marvell/mwifiex/scan.c @@ -2051,8 +2051,6 @@ void mwifiex_cancel_scan(struct mwifiex_adapter *adapter) spin_unlock_bh(&adapter->mwifiex_cmd_lock); for (i = 0; i < adapter->priv_num; i++) { priv = adapter->priv[i]; - if (!priv) - continue; if (priv->scan_request) { struct cfg80211_scan_info info = { .aborted = true, diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c index a94659988a4ce..d3cba6895f8ce 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c @@ -503,8 +503,7 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter) if (disconnect_on_suspend) { for (i = 0; i < adapter->priv_num; i++) { priv = adapter->priv[i]; - if (priv) - mwifiex_deauthenticate(priv, NULL); + mwifiex_deauthenticate(priv, NULL); } } diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c index 515e6db410f28..6085cd50970d4 100644 --- a/drivers/net/wireless/marvell/mwifiex/usb.c +++ b/drivers/net/wireless/marvell/mwifiex/usb.c @@ -745,8 +745,6 @@ static void mwifiex_usb_port_resync(struct mwifiex_adapter *adapter) if (adapter->usb_mc_status) { for (i = 0; i < adapter->priv_num; i++) { priv = adapter->priv[i]; - if (!priv) - continue; if ((priv->bss_role == MWIFIEX_BSS_ROLE_UAP && !priv->bss_started) || (priv->bss_role == MWIFIEX_BSS_ROLE_STA && @@ -758,8 +756,6 @@ static void mwifiex_usb_port_resync(struct mwifiex_adapter *adapter) } else { for (i = 0; i < adapter->priv_num; i++) { priv = adapter->priv[i]; - if (!priv) - continue; if ((priv->bss_role == MWIFIEX_BSS_ROLE_UAP && priv->bss_started) || (priv->bss_role == MWIFIEX_BSS_ROLE_STA && @@ -770,8 +766,7 @@ static void mwifiex_usb_port_resync(struct mwifiex_adapter *adapter) } for (i = 0; i < adapter->priv_num; i++) { priv = adapter->priv[i]; - if (priv) - priv->usb_port = active_port; + priv->usb_port = active_port; } for (i = 0; i < MWIFIEX_TX_DATA_PORT; i++) { if (active_port == card->port[i].tx_data_ep) diff --git a/drivers/net/wireless/marvell/mwifiex/wmm.c b/drivers/net/wireless/marvell/mwifiex/wmm.c index 8558995e8fc73..bcb61dab7dc86 100644 --- a/drivers/net/wireless/marvell/mwifiex/wmm.c +++ b/drivers/net/wireless/marvell/mwifiex/wmm.c @@ -454,8 +454,6 @@ int mwifiex_bypass_txlist_empty(struct mwifiex_adapter *adapter) for (i = 0; i < adapter->priv_num; i++) { priv = adapter->priv[i]; - if (!priv) - continue; if (adapter->if_ops.is_port_ready && !adapter->if_ops.is_port_ready(priv)) continue; @@ -477,8 +475,6 @@ mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter) for (i = 0; i < adapter->priv_num; ++i) { priv = adapter->priv[i]; - if (!priv) - continue; if (!priv->port_open && (priv->bss_mode != NL80211_IFTYPE_ADHOC)) continue; @@ -1491,9 +1487,6 @@ void mwifiex_process_bypass_tx(struct mwifiex_adapter *adapter) for (i = 0; i < adapter->priv_num; ++i) { priv = adapter->priv[i]; - if (!priv) - continue; - if (adapter->if_ops.is_port_ready && !adapter->if_ops.is_port_ready(priv)) continue; From patchwork Tue Aug 20 11:55:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770007 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E91118E74F for ; Tue, 20 Aug 2024 11:55:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724154941; cv=none; b=GqzzLT5Cu/bugMa2CHTt2xEFDw3Se/vpi7AbR4JrYNgvNi+Ik66J9sqgdRmbRvC6ChmCCEHylI7z479ojnKaPGU8gYlqgAXHxlJpozHHqDTZjq/4WaGhKRIUyU5DK4CwhmQPCzofmaB1Dzki6QbmHTqX1cjoL8q+qwvkjl8jAN4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724154941; c=relaxed/simple; bh=4l8aTmB4Yh2mmWzYmdKq+bEDqq6/Dn/miS3I5NOxC9k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fSkMt/KYWqzQgNztw+xZbSKCdyaTqnBMq51qtFpc6All6fb6Ycyln9iyEiImt1U+pIlF+y94p2vaTdchU1JlN/o/BJYLHRzMAai5S/pR0Na3l4w5izJMbOGLnGalVhPnC588FAW31bJd2Ktn9iRXeQuYvvdGMNl3v6WGyCfXQrI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNSS-0000Ah-5X; Tue, 20 Aug 2024 13:55:28 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNSR-001lLg-DY; Tue, 20 Aug 2024 13:55:27 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-16; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:27 +0200 Subject: [PATCH 02/31] wifi: mwifiex: use adapter as context pointer for mwifiex_hs_activated_event() Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-2-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=7272; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=4l8aTmB4Yh2mmWzYmdKq+bEDqq6/Dn/miS3I5NOxC9k=; b=kCSh3U31oKporlY3WKjHjcmrwNJWZzVyYLa+begVORdws3FuNwBSUefHv3caRufO5RuF1MkFP GvqJzeEwVXSDeKsI3PubQBdGySL+2ZzLjQexe/uPabTTav8nmmJ+x4E X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org mwifiex_hs_activated_event() takes a struct mwifiex_private * as context pointer which this function doesn't need directly and the callers don't have. Use struct mwifiex_adapter * instead to simplify both the function and the callers. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 44 ++++++++++++--------------- drivers/net/wireless/marvell/mwifiex/main.c | 15 ++------- drivers/net/wireless/marvell/mwifiex/main.h | 2 +- 3 files changed, 23 insertions(+), 38 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c index 7894102f03eb0..48c0d9e9dff71 100644 --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c @@ -367,8 +367,7 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter) (test_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags) && !adapter->sleep_period.period)) { adapter->pm_wakeup_card_req = true; - mwifiex_hs_activated_event(mwifiex_get_priv - (adapter, MWIFIEX_BSS_ROLE_ANY), true); + mwifiex_hs_activated_event(adapter, true); } return ret; @@ -784,17 +783,16 @@ int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter) spin_unlock_bh(&adapter->mwifiex_cmd_lock); ret = mwifiex_dnld_cmd_to_fw(priv, cmd_node); - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); + /* Any command sent to the firmware when host is in sleep * mode should de-configure host sleep. We should skip the * host sleep configuration command itself though */ - if (priv && (host_cmd->command != - cpu_to_le16(HostCmd_CMD_802_11_HS_CFG_ENH))) { + if (host_cmd->command != cpu_to_le16(HostCmd_CMD_802_11_HS_CFG_ENH)) { if (adapter->hs_activated) { clear_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags); - mwifiex_hs_activated_event(priv, false); + mwifiex_hs_activated_event(adapter, false); } } @@ -1158,27 +1156,27 @@ mwifiex_check_ps_cond(struct mwifiex_adapter *adapter) * This event is generated by the driver, with a blank event body. */ void -mwifiex_hs_activated_event(struct mwifiex_private *priv, u8 activated) +mwifiex_hs_activated_event(struct mwifiex_adapter *adapter, u8 activated) { if (activated) { if (test_bit(MWIFIEX_IS_HS_CONFIGURED, - &priv->adapter->work_flags)) { - priv->adapter->hs_activated = true; - mwifiex_update_rxreor_flags(priv->adapter, + &adapter->work_flags)) { + adapter->hs_activated = true; + mwifiex_update_rxreor_flags(adapter, RXREOR_FORCE_NO_DROP); - mwifiex_dbg(priv->adapter, EVENT, + mwifiex_dbg(adapter, EVENT, "event: hs_activated\n"); - priv->adapter->hs_activate_wait_q_woken = true; + adapter->hs_activate_wait_q_woken = true; wake_up_interruptible( - &priv->adapter->hs_activate_wait_q); + &adapter->hs_activate_wait_q); } else { - mwifiex_dbg(priv->adapter, EVENT, + mwifiex_dbg(adapter, EVENT, "event: HS not configured\n"); } } else { - mwifiex_dbg(priv->adapter, EVENT, + mwifiex_dbg(adapter, EVENT, "event: hs_deactivated\n"); - priv->adapter->hs_activated = false; + adapter->hs_activated = false; } } @@ -1202,7 +1200,7 @@ int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv, if (phs_cfg->action == cpu_to_le16(HS_ACTIVATE) && adapter->iface_type != MWIFIEX_USB) { - mwifiex_hs_activated_event(priv, true); + mwifiex_hs_activated_event(adapter, true); return 0; } else { mwifiex_dbg(adapter, CMD, @@ -1215,11 +1213,11 @@ int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv, if (conditions != HS_CFG_CANCEL) { set_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags); if (adapter->iface_type == MWIFIEX_USB) - mwifiex_hs_activated_event(priv, true); + mwifiex_hs_activated_event(adapter, true); } else { clear_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags); if (adapter->hs_activated) - mwifiex_hs_activated_event(priv, false); + mwifiex_hs_activated_event(adapter, false); } return 0; @@ -1248,9 +1246,7 @@ mwifiex_process_hs_config(struct mwifiex_adapter *adapter) adapter->hs_activated = false; clear_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags); clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags); - mwifiex_hs_activated_event(mwifiex_get_priv(adapter, - MWIFIEX_BSS_ROLE_ANY), - false); + mwifiex_hs_activated_event(adapter, false); } EXPORT_SYMBOL_GPL(mwifiex_process_hs_config); @@ -1300,9 +1296,7 @@ mwifiex_process_sleep_confirm_resp(struct mwifiex_adapter *adapter, } adapter->pm_wakeup_card_req = true; if (test_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags)) - mwifiex_hs_activated_event(mwifiex_get_priv - (adapter, MWIFIEX_BSS_ROLE_ANY), - true); + mwifiex_hs_activated_event(adapter, true); adapter->ps_state = PS_STATE_SLEEP; cmd->command = cpu_to_le16(command); cmd->seq_num = cpu_to_le16(seq_num); diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c index 96d1f6039fbca..f6b0060dc87dd 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -415,10 +415,7 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter) if (adapter->hs_activated) { clear_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags); - mwifiex_hs_activated_event - (mwifiex_get_priv - (adapter, MWIFIEX_BSS_ROLE_ANY), - false); + mwifiex_hs_activated_event(adapter, false); } } @@ -438,10 +435,7 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter) if (adapter->hs_activated) { clear_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags); - mwifiex_hs_activated_event - (mwifiex_get_priv - (adapter, MWIFIEX_BSS_ROLE_ANY), - false); + mwifiex_hs_activated_event(adapter, false); } } @@ -460,10 +454,7 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter) if (adapter->hs_activated) { clear_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags); - mwifiex_hs_activated_event - (mwifiex_get_priv - (adapter, MWIFIEX_BSS_ROLE_ANY), - false); + mwifiex_hs_activated_event(adapter, false); } } diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index 529863edd7a25..846320514583b 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -1129,7 +1129,7 @@ int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv, struct host_cmd_ds_command *resp, struct mwifiex_ds_pm_cfg *pm_cfg); void mwifiex_process_hs_config(struct mwifiex_adapter *adapter); -void mwifiex_hs_activated_event(struct mwifiex_private *priv, +void mwifiex_hs_activated_event(struct mwifiex_adapter *adapter, u8 activated); int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action, int cmd_type, struct mwifiex_ds_hs_cfg *hs_cfg); From patchwork Tue Aug 20 11:55:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770009 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DE5A190068 for ; Tue, 20 Aug 2024 11:55:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724154948; cv=none; b=kjSGoOEV4KWLAixwtkvd0e9GkJz6Y5uuF+RLnPj9/Y5KW54iyK2d/NT9rkJvfuZKVczEy1QeXewSW6MvDYsOzK9ze3pNQ32/av2PxRjosehwBeGp7DOsihO7viuZMVkjTB2L731eBuy57+FAPG4uH+PN3NzI/AdGdQrxEFfoLz4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724154948; c=relaxed/simple; bh=zrTZPqrwqKbku5CptsquReGfBlQNXUNkDNqmRwZwNj0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Cocu7cyt5mH2nIrLJZdCOdjfeVYln2jOuHhkN39cFISXNrtYV9IocVfkkbVcaesKUrsCpk8TfFhpZnHfCgTwmmXxUOzyzM6oPc0GSPuDR9WnXMa6fKD0/QVIeYMS8tGiF5rQyBz1ikTqSxNzMM1LDumAdhNAU2MGuKto9iAW/jA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNSS-0000Af-5V; Tue, 20 Aug 2024 13:55:28 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNSR-001lLh-DL; Tue, 20 Aug 2024 13:55:27 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-17; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:28 +0200 Subject: [PATCH 03/31] wifi: mwifiex: drop HostCmd_CMD_802_11_MAC_ADDRESS response handling Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-3-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=1754; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=zrTZPqrwqKbku5CptsquReGfBlQNXUNkDNqmRwZwNj0=; b=2qlCSy2sZykp9cchANIYzJ3bKr+tDCatxcmAE+RLZXssChPv0XL/yoGxQ0jx0CtcDJsIzZXl/ /qApv3GC6mfDp7uUHc4zUqlLis9K1nUfYsFinwu8WnAEO8XFF+bNS5W X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org The command response handler copies the new MAC address over to priv->curr_addr. The same is done in the code issuing the call already, so drop the unnecessary HostCmd_CMD_802_11_MAC_ADDRESS handling. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c index 9c53825f222d1..7f81e709bd6b7 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c @@ -473,25 +473,6 @@ static int mwifiex_ret_rf_antenna(struct mwifiex_private *priv, return 0; } -/* - * This function handles the command response of set/get MAC address. - * - * Handling includes saving the MAC address in driver. - */ -static int mwifiex_ret_802_11_mac_address(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - struct host_cmd_ds_802_11_mac_address *cmd_mac_addr = - &resp->params.mac_addr; - - memcpy(priv->curr_addr, cmd_mac_addr->mac_addr, ETH_ALEN); - - mwifiex_dbg(priv->adapter, INFO, - "info: set mac address: %pM\n", priv->curr_addr); - - return 0; -} - /* * This function handles the command response of set/get MAC multicast * address. @@ -1232,7 +1213,6 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no, case HostCmd_CMD_MAC_CONTROL: break; case HostCmd_CMD_802_11_MAC_ADDRESS: - ret = mwifiex_ret_802_11_mac_address(priv, resp); break; case HostCmd_CMD_MAC_MULTICAST_ADR: ret = mwifiex_ret_mac_multicast_adr(priv, resp); From patchwork Tue Aug 20 11:55:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770004 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23F9718EFC7 for ; Tue, 20 Aug 2024 11:55:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724154940; cv=none; b=cp7ZJh7m0T1yj/kUP59u7Es5BfP3uY0985MxR9XIAZHEQJL2Ph5MXXIzteq4qEvg7wvqVwa0bfx37bH5IJK3xC5Vkgrq0os9oZFMBm/6A3dkF3vzQcJxYG3KNPc/1hViYn8Mk3AnCKwxdEe0QpkawTGE0aztfUNQkxSWgiRS+0M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724154940; c=relaxed/simple; bh=Bp/vNFmehXXKUarTv/nIaYlwD0qtLTsrP1PAtRs8xS4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=N0pPTAEediMcS4k9efeaIsdXgA4bOsBs31GjUsmOaKDduyXnqsNUbk376P766++wPCKYlQeYA/ORiZw5kogwsUgQxnbV+A4HKtAiL2+stSrpO3o+vPVBP7eRiZfeeLLZ+58VjFyKWi0WBieUMA83AqGv70CrUJ5IDORNVhFksDw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNSS-0000Aj-5W; Tue, 20 Aug 2024 13:55:28 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNSR-001lLi-Ej; Tue, 20 Aug 2024 13:55:27 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-18; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:29 +0200 Subject: [PATCH 04/31] wifi: mwifiex: drop unnecessary initialization Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-4-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=1956; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=Bp/vNFmehXXKUarTv/nIaYlwD0qtLTsrP1PAtRs8xS4=; b=tQFt/SkqPR3aFch1ryciwSJAEcZPQhUZTBaJGsbf/8v79r23b2pPpvJ0JxPeCrK5k7+2g530B /2dKGf/UnEwAr27T/T8h/+0//YU1nUkSWVEAvWQvnBU6UdF+iLmt6gu X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org Several functions initialize the priv * without actually using the initialized value. Drop the initialization. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 6 ++---- drivers/net/wireless/marvell/mwifiex/txrx.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c index 48c0d9e9dff71..d50a2925d0739 100644 --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c @@ -472,8 +472,7 @@ void mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter) int mwifiex_process_event(struct mwifiex_adapter *adapter) { int ret, i; - struct mwifiex_private *priv = - mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); + struct mwifiex_private *priv; struct sk_buff *skb = adapter->event_skb; u32 eventcause; struct mwifiex_rxinfo *rx_info; @@ -808,8 +807,7 @@ int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter) int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter) { struct host_cmd_ds_command *resp; - struct mwifiex_private *priv = - mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); + struct mwifiex_private *priv; int ret = 0; uint16_t orig_cmdresp_no; uint16_t cmdresp_no; diff --git a/drivers/net/wireless/marvell/mwifiex/txrx.c b/drivers/net/wireless/marvell/mwifiex/txrx.c index bd91678d26b49..f44e22f245110 100644 --- a/drivers/net/wireless/marvell/mwifiex/txrx.c +++ b/drivers/net/wireless/marvell/mwifiex/txrx.c @@ -24,8 +24,7 @@ int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter, struct sk_buff *skb) { - struct mwifiex_private *priv = - mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); + struct mwifiex_private *priv; struct rxpd *local_rx_pd; struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb); int ret; From patchwork Tue Aug 20 11:55:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770010 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79F1419006B for ; Tue, 20 Aug 2024 11:55:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724154948; cv=none; b=c8OUxVVuE865WP8FS7n7GawhI41HJvgZMO/uZ7VreitUIXu4KqCbRn7fLg/BYFvPsRwRvV2CD1FbVIpHW8o9BdD+vSCwKBC/wTN3RLjMm1+3IysNh7F74IxkTtddmm4TKHfucaXl33djGRXyMloIcLOqEQyqbpGq9dT5KdsGuH4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724154948; c=relaxed/simple; bh=hYD2Bo3po8bWswbmjOoL7qXcYpaO9JUrP4toz1DgckM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gq5QstuwVc/Sxb0su5dX2TJ2forXDSI5RFDUe09YEPaOTcx9gXNmZWBDsjN6VsEc94ZMLVRiJkvajohYCzgP0p+nzHfDFoS9CSJ6wCtFZCGq/KKU+WAlpCpf9psJpwBA3fQvxNtVd0XCZMS2b1RhdaalF7buGR15PtfI2nK5brc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNSS-0000Ai-5U; Tue, 20 Aug 2024 13:55:28 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNSR-001lLj-Ej; Tue, 20 Aug 2024 13:55:27 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-19; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:30 +0200 Subject: [PATCH 05/31] wifi: mwifiex: make region_code_mapping_t const Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-5-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=2526; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=hYD2Bo3po8bWswbmjOoL7qXcYpaO9JUrP4toz1DgckM=; b=Dfo4WxrqMWO5DfjGhxsEVQhJD50657a5R19lYv433sEIE+ixCAiI/AceZhyrE/vJeV1tPNXDE BwujXIU9udGBAWHQ20OxclZyBDlL0s4kCNvJ5RV81Jv9+kcuCG/TTeN X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org region_code_mapping_t is not modified and shouldn't be. Mark it const. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 +- drivers/net/wireless/marvell/mwifiex/cfp.c | 4 ++-- drivers/net/wireless/marvell/mwifiex/main.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index e36fc37d6ff6e..d1cdbeafcfbcb 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -4703,7 +4703,7 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) void *wdev_priv; struct wiphy *wiphy; struct mwifiex_private *priv = adapter->priv[MWIFIEX_BSS_TYPE_STA]; - u8 *country_code; + const u8 *country_code; u32 thr, retry; struct cfg80211_ops *ops; diff --git a/drivers/net/wireless/marvell/mwifiex/cfp.c b/drivers/net/wireless/marvell/mwifiex/cfp.c index d39092b992129..47c93dca6041b 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfp.c +++ b/drivers/net/wireless/marvell/mwifiex/cfp.c @@ -153,7 +153,7 @@ struct region_code_mapping { u8 region[IEEE80211_COUNTRY_STRING_LEN]; }; -static struct region_code_mapping region_code_mapping_t[] = { +static const struct region_code_mapping region_code_mapping_t[] = { { 0x10, "US " }, /* US FCC */ { 0x20, "CA " }, /* IC Canada */ { 0x30, "FR " }, /* France */ @@ -165,7 +165,7 @@ static struct region_code_mapping region_code_mapping_t[] = { }; /* This function converts integer code to region string */ -u8 *mwifiex_11d_code_2_region(u8 code) +const u8 *mwifiex_11d_code_2_region(u8 code) { u8 i; diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index 846320514583b..541bc50a9561c 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -1569,7 +1569,7 @@ int mwifiex_add_wowlan_magic_pkt_filter(struct mwifiex_adapter *adapter); int mwifiex_set_mgmt_ies(struct mwifiex_private *priv, struct cfg80211_beacon_data *data); int mwifiex_del_mgmt_ies(struct mwifiex_private *priv); -u8 *mwifiex_11d_code_2_region(u8 code); +const u8 *mwifiex_11d_code_2_region(u8 code); void mwifiex_uap_set_channel(struct mwifiex_private *priv, struct mwifiex_uap_bss_param *bss_cfg, struct cfg80211_chan_def chandef); From patchwork Tue Aug 20 11:55:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770011 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF3E618F2CC for ; Tue, 20 Aug 2024 11:55:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724154956; cv=none; b=DlQ4Oi9uyxu/HaaiBxUXE6nc2maYEwkoHv8jVqsPidtW5v5FduPln5Z7U6Mcaz0pIo1k6n3CEknZr1JcP5soku3v3ahJoWPv7A8aK0nkMkvfY37P6bFvS33qoLZ8m2jwwhAluDljO+C6mlz2CUW+qXciUwqK/xPkpI3HE53dnnY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724154956; c=relaxed/simple; bh=KHEz/0xup4pwL2LyScOW5VSyfQ62oNVFQyjfwNSqQos=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fiCzlmAQQHqQU8WJoiL+vgkfBhqfvAq2DCbFXg3608hBqgemvx1uu1KTJayW4b3ooa80z4emK4lEPGRHkEgLU25VU3LrorHCDiIZIQTZDl8s7l+iwB1IzXBBY0HUBMSitM/0X3QtO6OpuwpgJyMyNUOjJQIVA/Es2BHL6hjK4+0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNSS-0000Al-5V; Tue, 20 Aug 2024 13:55:28 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNSR-001lLk-Ew; Tue, 20 Aug 2024 13:55:27 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1A; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:31 +0200 Subject: [PATCH 06/31] wifi: mwifiex: use mwifiex_deauthenticate_all() Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-6-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=892; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=KHEz/0xup4pwL2LyScOW5VSyfQ62oNVFQyjfwNSqQos=; b=lTbIn/GCOcshW5esMbSpTMeYVvQwSCOIycmlqUfvjsLRiu3gdkUgfuSPwlThRvMhCv3o5NP2A 4C8AQavAFgoCQ4jdYf5jk+gwxnpZAe/PGw/2J0MyslZkJw0CVDLbM0M X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org mwifiex_shutdown_sw() is used to shutdown the whole adapter, so it makes more sense to deauthenticate all privs, not only the first one. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c index f6b0060dc87dd..7cb90a6a8ccab 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -1525,7 +1525,7 @@ int mwifiex_shutdown_sw(struct mwifiex_adapter *adapter) reinit_completion(adapter->fw_done); priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - mwifiex_deauthenticate(priv, NULL); + mwifiex_deauthenticate_all(adapter); mwifiex_init_shutdown_fw(priv, MWIFIEX_FUNC_SHUTDOWN); From patchwork Tue Aug 20 11:55:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770003 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E8C218E74B for ; Tue, 20 Aug 2024 11:55:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724154940; cv=none; b=uUeOQJEelxR7fUSUvKlC9s+O1j6YEM72BYDP4DIHhYC1Jno4XkMpZIamwJIRcNIaP8IvxSPJj3c9WZmr7TPIskKq2hZ4flIUzhNR4Sw7pLqi49PmT5h4C0PpbpLukVshEODB+RBrm0DdYPtG6RlsFhSFOzUjlZW2MoYpf8v2EH4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724154940; c=relaxed/simple; bh=Dy2rYpe7ga87zMwt7gfk8WBV36PYG+YAWWRPNjyhnG0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ovrry+B17EuHYlCnzvOgGQGcT6afhbvHpCU1pv4i/1feO2Vg4a7IiAtGll3mvqXfbTWJwZJGxhdKhgcZAhco4tXipivxuFaXK1X7VOPgg3E5iBihLNX/XoEyVdEoMAqbX/OLtDnSxNpbJCa4hvubrxwviEQ141ZmI6bQmxsElHs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNSS-0000An-5X; Tue, 20 Aug 2024 13:55:28 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNSR-001lLl-FB; Tue, 20 Aug 2024 13:55:27 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1B; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:32 +0200 Subject: [PATCH 07/31] wifi: mwifiex: pass adapter to mwifiex_dnld_cmd_to_fw() Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-7-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=2048; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=Dy2rYpe7ga87zMwt7gfk8WBV36PYG+YAWWRPNjyhnG0=; b=AHnT83hR8Of4IOFaciGACi2w940X2VOUZRD3Yl2ZwiPr8es4PYjzUpSa5MqsTAB0VVvXRKQ7g XN3h2sITF2kA9CNoRhutQl9BThpQkTgLebOEiB1oeNuTPZfSbTd+4m+ X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org priv is not needed in mwifiex_dnld_cmd_to_fw(), so pass the adapter to it as context pointer. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c index d50a2925d0739..4f814110f750e 100644 --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c @@ -159,11 +159,9 @@ static int mwifiex_cmd_host_cmd(struct mwifiex_private *priv, * sending. Afterwards, it logs the command ID and action for debugging * and sets up the command timeout timer. */ -static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv, +static int mwifiex_dnld_cmd_to_fw(struct mwifiex_adapter *adapter, struct cmd_ctrl_node *cmd_node) { - - struct mwifiex_adapter *adapter = priv->adapter; int ret; struct host_cmd_ds_command *host_cmd; uint16_t cmd_code; @@ -742,7 +740,6 @@ mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter *adapter, */ int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter) { - struct mwifiex_private *priv; struct cmd_ctrl_node *cmd_node; int ret = 0; struct host_cmd_ds_command *host_cmd; @@ -766,7 +763,6 @@ int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter) struct cmd_ctrl_node, list); host_cmd = (struct host_cmd_ds_command *) (cmd_node->cmd_skb->data); - priv = cmd_node->priv; if (adapter->ps_state != PS_STATE_AWAKE) { mwifiex_dbg(adapter, ERROR, @@ -781,7 +777,7 @@ int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter) spin_unlock_bh(&adapter->cmd_pending_q_lock); spin_unlock_bh(&adapter->mwifiex_cmd_lock); - ret = mwifiex_dnld_cmd_to_fw(priv, cmd_node); + ret = mwifiex_dnld_cmd_to_fw(adapter, cmd_node); /* Any command sent to the firmware when host is in sleep * mode should de-configure host sleep. We should skip the From patchwork Tue Aug 20 11:55:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770005 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31C8A18EFCA for ; Tue, 20 Aug 2024 11:55:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724154940; cv=none; b=iRdNQnmaWHi6ziZahDip8IHEncfV2ddJDWCZsvQ1EFjQV20I9O6dD+Ma0DgsRtu0OTzm+qiUXtAHM8qXDA/4ao05nLKojGv0hLZtSB9oBPhFXhXNSvk3aSxubWBKVtg9Ux3lTz3u0sGVk0q6rSN3fmjmuQPrPnPHHQzzkfHGUVY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724154940; c=relaxed/simple; bh=WnDOQXdOu6RYChj81AwXAYH8vdtm8Lq/gakdG2OPsgw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GmE5IM7AnUjQQGKKdPS6acm7EjxM6OCnBR9HLssGg9rvBotv4NxawBmuEnqqKYdLC6jR+GAYFeSy3pkg4ychX3eOer502YB7euwauGWQsIOMuw3Wi+/AMS5GDKnCmZOBdwokxFyo+33Nj1gXNIr+Jb5YSciz9ijC0PzTaos0YEM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNSS-0000Ak-5W; Tue, 20 Aug 2024 13:55:28 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNSR-001lLm-F9; Tue, 20 Aug 2024 13:55:27 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1D; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:33 +0200 Subject: [PATCH 08/31] wifi: mwifiex: simplify mwifiex_setup_ht_caps() Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-8-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=2368; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=WnDOQXdOu6RYChj81AwXAYH8vdtm8Lq/gakdG2OPsgw=; b=bxfaC36CIbCvFiTZ3tpkNHbCczOANqKc9NMUIk6yJhvUTHjliQNyZAlYJnx1sYBwf/Ln6A+7I kq9UvEagkmuC4hhTEZ5oZHzs//I+vWcICWNv1o+CmHRWDFiroauip4f X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org In mwifiex_setup_ht_caps() first a local struct ieee80211_mcs_info is initialized and afterwards copied over &ht_info->mcs. Simplify this by initializing &ht_info->mcs directly. While at it call memset on the u8 rx_mask[] array instead of the struct which makes the intention clearer and we no longer have to assume the rx_mask array is the first member of struct ieee80211_mcs_info. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index d1cdbeafcfbcb..784f342a9bf23 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -2906,16 +2906,12 @@ mwifiex_setup_ht_caps(struct ieee80211_sta_ht_cap *ht_info, struct mwifiex_private *priv) { int rx_mcs_supp; - struct ieee80211_mcs_info mcs_set; - u8 *mcs = (u8 *)&mcs_set; struct mwifiex_adapter *adapter = priv->adapter; ht_info->ht_supported = true; ht_info->ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; ht_info->ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE; - memset(&ht_info->mcs, 0, sizeof(ht_info->mcs)); - /* Fill HT capability information */ if (ISSUPP_CHANWIDTH40(adapter->hw_dot_11n_dev_cap)) ht_info->cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; @@ -2961,17 +2957,15 @@ mwifiex_setup_ht_caps(struct ieee80211_sta_ht_cap *ht_info, ht_info->cap |= IEEE80211_HT_CAP_SM_PS; rx_mcs_supp = GET_RXMCSSUPP(adapter->user_dev_mcs_support); + + memset(&ht_info->mcs, 0, sizeof(ht_info->mcs)); /* Set MCS for 1x1/2x2 */ - memset(mcs, 0xff, rx_mcs_supp); - /* Clear all the other values */ - memset(&mcs[rx_mcs_supp], 0, - sizeof(struct ieee80211_mcs_info) - rx_mcs_supp); + memset(ht_info->mcs.rx_mask, 0xff, rx_mcs_supp); + if (priv->bss_mode == NL80211_IFTYPE_STATION || ISSUPP_CHANWIDTH40(adapter->hw_dot_11n_dev_cap)) /* Set MCS32 for infra mode or ad-hoc mode with 40MHz support */ - SETHT_MCS32(mcs_set.rx_mask); - - memcpy((u8 *) &ht_info->mcs, mcs, sizeof(struct ieee80211_mcs_info)); + SETHT_MCS32(ht_info->mcs.rx_mask); ht_info->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; } From patchwork Tue Aug 20 11:55:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770012 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2261718EFFF for ; Tue, 20 Aug 2024 11:55:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724154956; cv=none; b=XQsKZHcy9n9eZVZ1Tx1QjQ81ex9drtqJfuSgI/tqZ7v9uXVjC4YTACpaNA0kjW22fDzw9wPvKsOOXYt/IyQ7wfAvnMs17ry0GOKjMFngj381lrByM3267TXx7hk+SwwosPIgYLndfExGmlf9YNEtKiJO8q+aDz5sDvBtMPqSE58= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724154956; c=relaxed/simple; bh=ub6bLaPuTHcCZMiXbWB6JhIgGt2owL18udvenP083fo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=D8A8rVnXFY0rIjSI66RLwRM36zdPKDaMqxvdYcS3c7DW4lCiIhjEcfGNqr2WvmNN3ne/c+Jp1p45Vq+8gRHTHTEwq4+Y3H8Vv4DwSJHt25Rpfj1uYOYE7UBsi5B7j20hA8w8uSo+I5YwK9GUPA/mG4B2CwJYFotITuigRVyY1Ik= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNSS-0000Am-5W; Tue, 20 Aug 2024 13:55:28 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNSR-001lLn-FN; Tue, 20 Aug 2024 13:55:27 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1E; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:34 +0200 Subject: [PATCH 09/31] wifi: mwifiex: deduplicate code in mwifiex_cmd_tx_rate_cfg() Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-9-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=3107; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=ub6bLaPuTHcCZMiXbWB6JhIgGt2owL18udvenP083fo=; b=+PIhpDmqELJBEkl3fyKxfeXdRDT+iSAeqXvKKlf9BHbbmYFR5IJONNEl+Cs/aJb0ZgeQnXQCv kzcW4BFT6ffDrauypw3y/RGNBwHdJh/0iOMSHf4hUudkzsEFJ09JSkp X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org The code block inside the if/else is the same with just using pbitmap_rates if non NULL or priv->bitmap_rates otherwise. Deduplicate the code by picking the correct pointer first and then using it unconditionally. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 43 +++++++++----------------- 1 file changed, 14 insertions(+), 29 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c index e2800a831c8ed..30dd4e58e2b1d 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c @@ -157,7 +157,7 @@ mwifiex_cmd_802_11_get_log(struct host_cmd_ds_command *cmd) */ static int mwifiex_cmd_tx_rate_cfg(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, - u16 cmd_action, u16 *pbitmap_rates) + u16 cmd_action, const u16 *pbitmap_rates) { struct host_cmd_ds_tx_rate_cfg *rate_cfg = &cmd->params.tx_rate_cfg; struct mwifiex_rate_scope *rate_scope; @@ -174,34 +174,19 @@ static int mwifiex_cmd_tx_rate_cfg(struct mwifiex_private *priv, rate_scope->type = cpu_to_le16(TLV_TYPE_RATE_SCOPE); rate_scope->length = cpu_to_le16 (sizeof(*rate_scope) - sizeof(struct mwifiex_ie_types_header)); - if (pbitmap_rates != NULL) { - rate_scope->hr_dsss_rate_bitmap = cpu_to_le16(pbitmap_rates[0]); - rate_scope->ofdm_rate_bitmap = cpu_to_le16(pbitmap_rates[1]); - for (i = 0; i < ARRAY_SIZE(rate_scope->ht_mcs_rate_bitmap); i++) - rate_scope->ht_mcs_rate_bitmap[i] = - cpu_to_le16(pbitmap_rates[2 + i]); - if (priv->adapter->fw_api_ver == MWIFIEX_FW_V15) { - for (i = 0; - i < ARRAY_SIZE(rate_scope->vht_mcs_rate_bitmap); - i++) - rate_scope->vht_mcs_rate_bitmap[i] = - cpu_to_le16(pbitmap_rates[10 + i]); - } - } else { - rate_scope->hr_dsss_rate_bitmap = - cpu_to_le16(priv->bitmap_rates[0]); - rate_scope->ofdm_rate_bitmap = - cpu_to_le16(priv->bitmap_rates[1]); - for (i = 0; i < ARRAY_SIZE(rate_scope->ht_mcs_rate_bitmap); i++) - rate_scope->ht_mcs_rate_bitmap[i] = - cpu_to_le16(priv->bitmap_rates[2 + i]); - if (priv->adapter->fw_api_ver == MWIFIEX_FW_V15) { - for (i = 0; - i < ARRAY_SIZE(rate_scope->vht_mcs_rate_bitmap); - i++) - rate_scope->vht_mcs_rate_bitmap[i] = - cpu_to_le16(priv->bitmap_rates[10 + i]); - } + if (!pbitmap_rates) + pbitmap_rates = priv->bitmap_rates; + + rate_scope->hr_dsss_rate_bitmap = cpu_to_le16(pbitmap_rates[0]); + rate_scope->ofdm_rate_bitmap = cpu_to_le16(pbitmap_rates[1]); + + for (i = 0; i < ARRAY_SIZE(rate_scope->ht_mcs_rate_bitmap); i++) + rate_scope->ht_mcs_rate_bitmap[i] = cpu_to_le16(pbitmap_rates[2 + i]); + + if (priv->adapter->fw_api_ver == MWIFIEX_FW_V15) { + for (i = 0; i < ARRAY_SIZE(rate_scope->vht_mcs_rate_bitmap); i++) + rate_scope->vht_mcs_rate_bitmap[i] = + cpu_to_le16(pbitmap_rates[10 + i]); } rate_drop = (struct mwifiex_rate_drop_pattern *) ((u8 *) rate_scope + From patchwork Tue Aug 20 11:55:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770034 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 509B718FC91 for ; Tue, 20 Aug 2024 12:00:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155235; cv=none; b=H4Ogi1BknjzYMfRor8UxMgSBGvLsUW2p/56g1kLdGs9IzWuLJ/Bu7IRHitwEeL10t9WVcoUw7uY14mGm/HdhjmIX9i52VrJ+icgnYwmk4mcAR+WEljezZpPZCIxiTaT0gsaV+l273vpO1pRcecdFu+HPMgdYGLWj8Z0y+Dysjmw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155235; c=relaxed/simple; bh=fQ6OtQihTMtbJNSqAs/DTisQPMxfV34M4V7bfNcV97g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hijLICaY3EWU08JyBqT2ZEZHX1t7zxAsJOTffPXjchqw8aOIadCe5+/LFsPKgz+HhVI9CZXdkmL600JeCWdOfiMlPr9VHaWw8QL61wFuuMKEMVcKC1MbeMIVCesp081OVbZ5TuirmkD7Q9Zygt7ah1tDQubHr5cLunAFtecfuSw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNXH-0000yc-N4; Tue, 20 Aug 2024 14:00:27 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNXH-001lO3-75; Tue, 20 Aug 2024 14:00:27 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1G; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:35 +0200 Subject: [PATCH 10/31] wifi: mwifiex: fix indention Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-10-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=1186; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=fQ6OtQihTMtbJNSqAs/DTisQPMxfV34M4V7bfNcV97g=; b=HYmKYDzN8i8IPm0HaQa+sMb1m2RkaaV0HBoUpR3cFvct8K4FqXMYtrVJdidDSUuw+4xp1EpyP 9DD3gy72gxrCaEBS2UoYMUw/gSz3KiLdlNTzZ4XLCNd2a0/mDEUEYoB X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org Align multiline if() under the opening brace. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/wmm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/wmm.c b/drivers/net/wireless/marvell/mwifiex/wmm.c index bcb61dab7dc86..1b1222c73728f 100644 --- a/drivers/net/wireless/marvell/mwifiex/wmm.c +++ b/drivers/net/wireless/marvell/mwifiex/wmm.c @@ -1428,13 +1428,13 @@ mwifiex_dequeue_tx_packet(struct mwifiex_adapter *adapter) } if (!ptr->is_11n_enabled || - ptr->ba_status || - priv->wps.session_enable) { + ptr->ba_status || + priv->wps.session_enable) { if (ptr->is_11n_enabled && - ptr->ba_status && - ptr->amsdu_in_ampdu && - mwifiex_is_amsdu_allowed(priv, tid) && - mwifiex_is_11n_aggragation_possible(priv, ptr, + ptr->ba_status && + ptr->amsdu_in_ampdu && + mwifiex_is_amsdu_allowed(priv, tid) && + mwifiex_is_11n_aggragation_possible(priv, ptr, adapter->tx_buf_size)) mwifiex_11n_aggregate_pkt(priv, ptr, ptr_index); /* ra_list_spinlock has been freed in From patchwork Tue Aug 20 11:55:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770026 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8F9C18F2E3 for ; Tue, 20 Aug 2024 12:00:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155234; cv=none; b=s49htbXfIcIllSFaFih/QIU0C6kt/4OyNdkQd2IRuPSqpKL5qDVfqEqP8QXtZtvRfhRHqWrsLJduvuuCb7tAgEKlLCpJ8fN/0Ar14NobpVAAsyGAj7nL1khpq/iPyNfxirYQy6yS27zPkZeWopeBL+ucc32DZ935ZApA2Gpemnc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155234; c=relaxed/simple; bh=nx+bPs22PwXrc8rnhbOBr+PJUh6JL5pHUQ7eHrrw8bU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=shjj2tV7ln7yXJ9DrNiiWbR1zwGLHkqaJgnWkwleeGHOxQnZVNROIXWfq4WmpP9e7bCCb9B5rKnLag+FkVw33n5H8Gl+kRx8zx/i5v/YcsgdqdLD0bTCor/QwL9mTaxVqZbMgsqDuAdYGoJRIUi4WQVMPzXP73U3JTc73kVDVaA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNXG-0000w0-TV; Tue, 20 Aug 2024 14:00:26 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNXG-001lNV-Du; Tue, 20 Aug 2024 14:00:26 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1H; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:36 +0200 Subject: [PATCH 11/31] wifi: mwifiex: use priv index as bss_num Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-11-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=8804; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=nx+bPs22PwXrc8rnhbOBr+PJUh6JL5pHUQ7eHrrw8bU=; b=lqXV3dxDx31AMp7hdOEcF7dz6ovFFpDQ696GEF7Bf0GOpRkuDQL/DchaqF8B8VeZ3b+sMP1Sp DP7HJ/+gj2oByNLfr4Ggj0xuuQwelId5ilpRwlnv5xJv718HRDvbNot X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org Instead of looking up an unused bss_num each time we add a virtual interface, associate a fixed bss_num to each priv and for simplicity just use the array index. With bss_num unique to each priv mwifiex_get_priv_by_id() doesn't need the bss_type argument anymore, so it's removed. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 11 ++--- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 6 +-- drivers/net/wireless/marvell/mwifiex/main.c | 1 + drivers/net/wireless/marvell/mwifiex/main.h | 54 ++++-------------------- drivers/net/wireless/marvell/mwifiex/sta_event.c | 3 +- drivers/net/wireless/marvell/mwifiex/txrx.c | 9 ++-- 6 files changed, 19 insertions(+), 65 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 784f342a9bf23..d5a2c8f726b9e 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -952,8 +952,6 @@ mwifiex_init_new_priv_params(struct mwifiex_private *priv, return -EOPNOTSUPP; } - priv->bss_num = mwifiex_get_unused_bss_num(adapter, priv->bss_type); - spin_lock_irqsave(&adapter->main_proc_lock, flags); adapter->main_locked = false; spin_unlock_irqrestore(&adapter->main_proc_lock, flags); @@ -2999,8 +2997,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, return ERR_PTR(-EINVAL); } - priv = mwifiex_get_unused_priv_by_bss_type( - adapter, MWIFIEX_BSS_TYPE_STA); + priv = mwifiex_get_unused_priv(adapter); if (!priv) { mwifiex_dbg(adapter, ERROR, "could not get free private struct\n"); @@ -3029,8 +3026,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, return ERR_PTR(-EINVAL); } - priv = mwifiex_get_unused_priv_by_bss_type( - adapter, MWIFIEX_BSS_TYPE_UAP); + priv = mwifiex_get_unused_priv(adapter); if (!priv) { mwifiex_dbg(adapter, ERROR, "could not get free private struct\n"); @@ -3056,8 +3052,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, return ERR_PTR(-EINVAL); } - priv = mwifiex_get_unused_priv_by_bss_type( - adapter, MWIFIEX_BSS_TYPE_P2P); + priv = mwifiex_get_unused_priv(adapter); if (!priv) { mwifiex_dbg(adapter, ERROR, "could not get free private struct\n"); diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c index 4f814110f750e..d91351384c6bb 100644 --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c @@ -496,8 +496,7 @@ int mwifiex_process_event(struct mwifiex_adapter *adapter) (u16) eventcause; /* Get BSS number and corresponding priv */ - priv = mwifiex_get_priv_by_id(adapter, EVENT_GET_BSS_NUM(eventcause), - EVENT_GET_BSS_TYPE(eventcause)); + priv = mwifiex_get_priv_by_id(adapter, EVENT_GET_BSS_NUM(eventcause)); if (!priv) priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); @@ -847,8 +846,7 @@ int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter) /* Get BSS number and corresponding priv */ priv = mwifiex_get_priv_by_id(adapter, - HostCmd_GET_BSS_NO(le16_to_cpu(resp->seq_num)), - HostCmd_GET_BSS_TYPE(le16_to_cpu(resp->seq_num))); + HostCmd_GET_BSS_NO(le16_to_cpu(resp->seq_num))); if (!priv) priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); /* Clear RET_BIT from HostCmd */ diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c index 7cb90a6a8ccab..888f2801d6f2a 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -85,6 +85,7 @@ static int mwifiex_register(void *card, struct device *dev, if (!adapter->priv[i]) goto error; + adapter->priv[i]->bss_num = i; adapter->priv[i]->adapter = adapter; adapter->priv_num++; } diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index 541bc50a9561c..2938e55a38d79 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -1297,20 +1297,12 @@ mwifiex_copy_rates(u8 *dest, u32 pos, u8 *src, int len) * upon the BSS type and BSS number. */ static inline struct mwifiex_private * -mwifiex_get_priv_by_id(struct mwifiex_adapter *adapter, - u8 bss_num, u8 bss_type) +mwifiex_get_priv_by_id(struct mwifiex_adapter *adapter, u8 bss_num) { - int i; - - for (i = 0; i < adapter->priv_num; i++) { - if (adapter->priv[i]->bss_mode == NL80211_IFTYPE_UNSPECIFIED) - continue; + if (bss_num >= MWIFIEX_MAX_BSS_NUM) + return NULL; - if ((adapter->priv[i]->bss_num == bss_num) && - (adapter->priv[i]->bss_type == bss_type)) - break; - } - return ((i < adapter->priv_num) ? adapter->priv[i] : NULL); + return adapter->priv[bss_num]; } /* @@ -1332,47 +1324,19 @@ mwifiex_get_priv(struct mwifiex_adapter *adapter, return ((i < adapter->priv_num) ? adapter->priv[i] : NULL); } -/* - * This function checks available bss_num when adding new interface or - * changing interface type. - */ -static inline u8 -mwifiex_get_unused_bss_num(struct mwifiex_adapter *adapter, u8 bss_type) -{ - u8 i, j; - int index[MWIFIEX_MAX_BSS_NUM]; - - memset(index, 0, sizeof(index)); - for (i = 0; i < adapter->priv_num; i++) - if (adapter->priv[i]->bss_type == bss_type && - !(adapter->priv[i]->bss_mode == - NL80211_IFTYPE_UNSPECIFIED)) { - index[adapter->priv[i]->bss_num] = 1; - } - for (j = 0; j < MWIFIEX_MAX_BSS_NUM; j++) - if (!index[j]) - return j; - return -1; -} - /* * This function returns the first available unused private structure pointer. */ static inline struct mwifiex_private * -mwifiex_get_unused_priv_by_bss_type(struct mwifiex_adapter *adapter, - u8 bss_type) +mwifiex_get_unused_priv(struct mwifiex_adapter *adapter) { - u8 i; + int i; for (i = 0; i < adapter->priv_num; i++) - if (adapter->priv[i]->bss_mode == - NL80211_IFTYPE_UNSPECIFIED) { - adapter->priv[i]->bss_num = - mwifiex_get_unused_bss_num(adapter, bss_type); - break; - } + if (adapter->priv[i]->bss_mode == NL80211_IFTYPE_UNSPECIFIED) + return adapter->priv[i]; - return ((i < adapter->priv_num) ? adapter->priv[i] : NULL); + return NULL; } /* diff --git a/drivers/net/wireless/marvell/mwifiex/sta_event.c b/drivers/net/wireless/marvell/mwifiex/sta_event.c index b5f3821a6a8f2..15f057d010a3d 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_event.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c @@ -456,8 +456,7 @@ void mwifiex_process_multi_chan_event(struct mwifiex_private *priv, for (i = 0; i < intf_num; i++) { bss_type = grp_info->bss_type_numlist[i] >> 4; bss_num = grp_info->bss_type_numlist[i] & BSS_NUM_MASK; - intf_priv = mwifiex_get_priv_by_id(adapter, bss_num, - bss_type); + intf_priv = mwifiex_get_priv_by_id(adapter, bss_num); if (!intf_priv) { mwifiex_dbg(adapter, ERROR, "Invalid bss_type bss_num\t" diff --git a/drivers/net/wireless/marvell/mwifiex/txrx.c b/drivers/net/wireless/marvell/mwifiex/txrx.c index f44e22f245110..21cfee3290377 100644 --- a/drivers/net/wireless/marvell/mwifiex/txrx.c +++ b/drivers/net/wireless/marvell/mwifiex/txrx.c @@ -31,8 +31,7 @@ int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter, local_rx_pd = (struct rxpd *) (skb->data); /* Get the BSS number from rxpd, get corresponding priv */ - priv = mwifiex_get_priv_by_id(adapter, local_rx_pd->bss_num & - BSS_NUM_MASK, local_rx_pd->bss_type); + priv = mwifiex_get_priv_by_id(adapter, local_rx_pd->bss_num & BSS_NUM_MASK); if (!priv) priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); @@ -165,8 +164,7 @@ static int mwifiex_host_to_card(struct mwifiex_adapter *adapter, struct mwifiex_txinfo *tx_info; tx_info = MWIFIEX_SKB_TXCB(skb); - priv = mwifiex_get_priv_by_id(adapter, tx_info->bss_num, - tx_info->bss_type); + priv = mwifiex_get_priv_by_id(adapter, tx_info->bss_num); if (!priv) { mwifiex_dbg(adapter, ERROR, "data: priv not found. Drop TX packet\n"); @@ -281,8 +279,7 @@ int mwifiex_write_data_complete(struct mwifiex_adapter *adapter, return 0; tx_info = MWIFIEX_SKB_TXCB(skb); - priv = mwifiex_get_priv_by_id(adapter, tx_info->bss_num, - tx_info->bss_type); + priv = mwifiex_get_priv_by_id(adapter, tx_info->bss_num); if (!priv) goto done; From patchwork Tue Aug 20 11:55:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770036 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1F7018FC65 for ; Tue, 20 Aug 2024 12:00:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155235; cv=none; b=SpMKQsybATYdx3qEQa5zFVVaUmw01pnLg7hbfhr7pm2va21qeUh2WoJnYDpNfxKeio/ZAouvzGKprA0MifCH7jPB3b6986PVMzdqeY6U99nYBk1qYRd8p2mpO4oUwlW1q837KeTyEGD5mw60K2dXcfox0i+7FjMzcMmGJ0zRFEc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155235; c=relaxed/simple; bh=tSf1l0pn1lT8An3Ky0FAXT8O6+y3aQ/u0Dx8uHaAMQc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CgVxA/u/mgxU+1C/HTAg78L0mYjSKQlKXSWcKRsGcbpj37P9l29YX/3oSzK5EzPMR7mo/qLZ9pbuH8wFXOOhoUvw5vJNf3yruNEMuhYlv6xe+IyS560BpyG6ROKsWQ+oFAZw+xAP0FQa0tUqFls8p+hIupI5UKlcnxwMVI2OHfs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNXH-0000wf-7P; Tue, 20 Aug 2024 14:00:27 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNXG-001lNg-M7; Tue, 20 Aug 2024 14:00:26 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1I; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:37 +0200 Subject: [PATCH 12/31] wifi: mwifiex: fix MAC address handling Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-12-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=6359; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=tSf1l0pn1lT8An3Ky0FAXT8O6+y3aQ/u0Dx8uHaAMQc=; b=XSI6lADSa9iLXhkNw6zqXqpQ2OrGeyqN4qQFs/ihMZ6wQRg9DUeQ+PktbE7Hc+nDqLSgVyimH kmxnt9TEz/pAxWFmNz19EXt13OrzAePaUL9MON68+e/E/6f1Hxi2D6z X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org The mwifiex driver tries to derive the MAC addresses of the virtual interfaces from the permanent address by adding the bss_num of the particular interface used. It does so each time the virtual interface is changed from AP to station or the other way round. This means that the devices MAC address changes during a change_virtual_intf call which is pretty unexpected by userspace. Furthermore the driver doesn't use the permanent address to add the bss_num to, but instead the current MAC address increases each time we do a change_virtual_intf. Fix this by initializing the MAC address once from the permanent MAC address during creation of the virtual interface and never touching it again. This also means that userspace can set a different MAC address which then stays like this forever and is not unexpectedly changed by the driver. The bss_type is no longer used to generate a MAC address as that may change during lifetime of the virtual interface. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 4 +-- drivers/net/wireless/marvell/mwifiex/init.c | 1 - drivers/net/wireless/marvell/mwifiex/main.c | 46 ++++++++++--------------- drivers/net/wireless/marvell/mwifiex/main.h | 5 +-- 4 files changed, 22 insertions(+), 34 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index d5a2c8f726b9e..715d98b7ff550 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -960,8 +960,6 @@ mwifiex_init_new_priv_params(struct mwifiex_private *priv, adapter->rx_locked = false; spin_unlock_bh(&adapter->rx_proc_lock); - mwifiex_set_mac_address(priv, dev, false, NULL); - return 0; } @@ -3104,7 +3102,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, priv->netdev = dev; if (!adapter->mfg_mode) { - mwifiex_set_mac_address(priv, dev, false, NULL); + mwifiex_set_default_mac_address(priv, dev); ret = mwifiex_send_cmd(priv, HostCmd_CMD_SET_BSS_MODE, HostCmd_ACT_GEN_SET, 0, NULL, true); diff --git a/drivers/net/wireless/marvell/mwifiex/init.c b/drivers/net/wireless/marvell/mwifiex/init.c index 8b61e45cd6678..0259c9f88486b 100644 --- a/drivers/net/wireless/marvell/mwifiex/init.c +++ b/drivers/net/wireless/marvell/mwifiex/init.c @@ -71,7 +71,6 @@ int mwifiex_init_priv(struct mwifiex_private *priv) u32 i; priv->media_connected = false; - eth_broadcast_addr(priv->curr_addr); priv->port_open = false; priv->usb_port = MWIFIEX_USB_EP_DATA; priv->pkt_tx_ctrl = 0; diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c index 888f2801d6f2a..f1f6deaa91122 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -963,34 +963,16 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) } int mwifiex_set_mac_address(struct mwifiex_private *priv, - struct net_device *dev, bool external, - u8 *new_mac) + struct net_device *dev, u8 *new_mac) { int ret; - u64 mac_addr, old_mac_addr; + u64 old_mac_addr; - old_mac_addr = ether_addr_to_u64(priv->curr_addr); + netdev_info(dev, "%s: old: %pM new: %pM\n", __func__, priv->curr_addr, new_mac); - if (external) { - mac_addr = ether_addr_to_u64(new_mac); - } else { - /* Internal mac address change */ - if (priv->bss_type == MWIFIEX_BSS_TYPE_ANY) - return -EOPNOTSUPP; - - mac_addr = old_mac_addr; - - if (priv->bss_type == MWIFIEX_BSS_TYPE_P2P) { - mac_addr |= BIT_ULL(MWIFIEX_MAC_LOCAL_ADMIN_BIT); - mac_addr += priv->bss_num; - } else if (priv->adapter->priv[0] != priv) { - /* Set mac address based on bss_type/bss_num */ - mac_addr ^= BIT_ULL(priv->bss_type + 8); - mac_addr += priv->bss_num; - } - } + old_mac_addr = ether_addr_to_u64(priv->curr_addr); - u64_to_ether_addr(mac_addr, priv->curr_addr); + ether_addr_copy(priv->curr_addr, new_mac); /* Send request to firmware */ ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_MAC_ADDRESS, @@ -1007,6 +989,18 @@ int mwifiex_set_mac_address(struct mwifiex_private *priv, return 0; } +int mwifiex_set_default_mac_address(struct mwifiex_private *priv, + struct net_device *dev) +{ + u8 mac[ETH_ALEN]; + + ether_addr_copy(mac, priv->adapter->perm_addr); + + eth_addr_add(mac, priv->bss_num); + + return mwifiex_set_mac_address(priv, dev, mac); +} + /* CFG802.11 network device handler for setting MAC address. */ static int @@ -1015,7 +1009,7 @@ mwifiex_ndo_set_mac_address(struct net_device *dev, void *addr) struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); struct sockaddr *hw_addr = addr; - return mwifiex_set_mac_address(priv, dev, true, hw_addr->sa_data); + return mwifiex_set_mac_address(priv, dev, hw_addr->sa_data); } /* @@ -1356,10 +1350,6 @@ void mwifiex_init_priv_params(struct mwifiex_private *priv, priv->assocresp_idx = MWIFIEX_AUTO_IDX_MASK; priv->gen_idx = MWIFIEX_AUTO_IDX_MASK; priv->num_tx_timeout = 0; - if (is_valid_ether_addr(dev->dev_addr)) - ether_addr_copy(priv->curr_addr, dev->dev_addr); - else - ether_addr_copy(priv->curr_addr, priv->adapter->perm_addr); if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA || GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP) { diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index 2938e55a38d79..39f9bb49f83ff 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -1658,8 +1658,9 @@ void mwifiex_process_multi_chan_event(struct mwifiex_private *priv, struct sk_buff *event_skb); void mwifiex_multi_chan_resync(struct mwifiex_adapter *adapter); int mwifiex_set_mac_address(struct mwifiex_private *priv, - struct net_device *dev, - bool external, u8 *new_mac); + struct net_device *dev, u8 *new_mac); +int mwifiex_set_default_mac_address(struct mwifiex_private *priv, + struct net_device *dev); void mwifiex_devdump_tmo_func(unsigned long function_context); #ifdef CONFIG_DEBUG_FS From patchwork Tue Aug 20 11:55:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770028 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC46018F2E0 for ; Tue, 20 Aug 2024 12:00:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155234; cv=none; b=sCe6rTVP0iYbqtaeU/aqcAFPOFNfAPq3Tt7pm2YQhTJqn3GXiXJwZQzIqJn/DhU2EctUmqiGsSqP9ZJ8RJnXp026th26BrE/5AUAjBo092QX4epYq55OeZUjA2BGFyZjpxUDxHl41beIerfhoLl16o5fTg9SdYNLEy+H+udJ8HM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155234; c=relaxed/simple; bh=mhTrDaiebGDY7kRj4LaTKvbwTASM29CFZ/GNVUSNDr8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gOiUrLWNDgRfdCX4yzdr88g0sghK02j3SkArt3i6DSt+nDzcpXlMmpOaLEtXF0/5CinzZ9EVLqOAyH0DXXj0IMmNzvgMXMgTQlL135WEvPlhcdWnktmfL0QoXBDo5MA+pF7kszSjOc/47NEI9BQF/LjZfRtii++cXNtOAy6exPg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNXG-0000ut-HR; Tue, 20 Aug 2024 14:00:26 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNXG-001lND-2P; Tue, 20 Aug 2024 14:00:26 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1J; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:38 +0200 Subject: [PATCH 13/31] wifi: mwifiex: drop driver internal AP/STA limit counting Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-13-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=9634; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=mhTrDaiebGDY7kRj4LaTKvbwTASM29CFZ/GNVUSNDr8=; b=1rubbqlPRBBzrzsXGZXHRmC94TFO7HtsOYz0K/jx6jJzlGr9Eovbk67SqCp6lFrFwjcWqPc/a WYglYAAbeTHCTT4bi4GvFPDpGS2MNZL7FOvMp787q1kmmOAFr8hzQAQ X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org The mwifiex driver maintains internal counters to check if there are still enough resources to change a virtual interface to a certain type. This seems to be a remnant of old times and can be removed. We can currently create three virtual interfaces (could be expanded to 16) and each of the interfaces can be configured to any type without further restrictions. The limits we actually have are already correctly described in wiphy->iface_combinations. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 149 ------------------------ drivers/net/wireless/marvell/mwifiex/decl.h | 10 -- drivers/net/wireless/marvell/mwifiex/init.c | 3 - drivers/net/wireless/marvell/mwifiex/main.h | 2 - 4 files changed, 164 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 715d98b7ff550..4c63b849e3809 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -963,117 +963,6 @@ mwifiex_init_new_priv_params(struct mwifiex_private *priv, return 0; } -static bool -is_vif_type_change_allowed(struct mwifiex_adapter *adapter, - enum nl80211_iftype old_iftype, - enum nl80211_iftype new_iftype) -{ - switch (old_iftype) { - case NL80211_IFTYPE_ADHOC: - switch (new_iftype) { - case NL80211_IFTYPE_STATION: - return true; - case NL80211_IFTYPE_P2P_CLIENT: - case NL80211_IFTYPE_P2P_GO: - return adapter->curr_iface_comb.p2p_intf != - adapter->iface_limit.p2p_intf; - case NL80211_IFTYPE_AP: - return adapter->curr_iface_comb.uap_intf != - adapter->iface_limit.uap_intf; - default: - return false; - } - - case NL80211_IFTYPE_STATION: - switch (new_iftype) { - case NL80211_IFTYPE_ADHOC: - return true; - case NL80211_IFTYPE_P2P_CLIENT: - case NL80211_IFTYPE_P2P_GO: - return adapter->curr_iface_comb.p2p_intf != - adapter->iface_limit.p2p_intf; - case NL80211_IFTYPE_AP: - return adapter->curr_iface_comb.uap_intf != - adapter->iface_limit.uap_intf; - default: - return false; - } - - case NL80211_IFTYPE_AP: - switch (new_iftype) { - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_STATION: - return adapter->curr_iface_comb.sta_intf != - adapter->iface_limit.sta_intf; - case NL80211_IFTYPE_P2P_CLIENT: - case NL80211_IFTYPE_P2P_GO: - return adapter->curr_iface_comb.p2p_intf != - adapter->iface_limit.p2p_intf; - default: - return false; - } - - case NL80211_IFTYPE_P2P_CLIENT: - switch (new_iftype) { - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_STATION: - return true; - case NL80211_IFTYPE_P2P_GO: - return true; - case NL80211_IFTYPE_AP: - return adapter->curr_iface_comb.uap_intf != - adapter->iface_limit.uap_intf; - default: - return false; - } - - case NL80211_IFTYPE_P2P_GO: - switch (new_iftype) { - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_STATION: - return true; - case NL80211_IFTYPE_P2P_CLIENT: - return true; - case NL80211_IFTYPE_AP: - return adapter->curr_iface_comb.uap_intf != - adapter->iface_limit.uap_intf; - default: - return false; - } - - default: - break; - } - - return false; -} - -static void -update_vif_type_counter(struct mwifiex_adapter *adapter, - enum nl80211_iftype iftype, - int change) -{ - switch (iftype) { - case NL80211_IFTYPE_UNSPECIFIED: - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_STATION: - adapter->curr_iface_comb.sta_intf += change; - break; - case NL80211_IFTYPE_AP: - adapter->curr_iface_comb.uap_intf += change; - break; - case NL80211_IFTYPE_P2P_CLIENT: - case NL80211_IFTYPE_P2P_GO: - adapter->curr_iface_comb.p2p_intf += change; - break; - default: - mwifiex_dbg(adapter, ERROR, - "%s: Unsupported iftype passed: %d\n", - __func__, iftype); - break; - } -} - static int mwifiex_change_vif_to_p2p(struct net_device *dev, enum nl80211_iftype curr_iftype, @@ -1098,8 +987,6 @@ mwifiex_change_vif_to_p2p(struct net_device *dev, if (mwifiex_init_new_priv_params(priv, dev, type)) return -1; - update_vif_type_counter(adapter, curr_iftype, -1); - update_vif_type_counter(adapter, type, +1); dev->ieee80211_ptr->iftype = type; switch (type) { @@ -1156,8 +1043,6 @@ mwifiex_change_vif_to_sta_adhoc(struct net_device *dev, if (mwifiex_init_new_priv_params(priv, dev, type)) return -1; - update_vif_type_counter(adapter, curr_iftype, -1); - update_vif_type_counter(adapter, type, +1); dev->ieee80211_ptr->iftype = type; if (mwifiex_send_cmd(priv, HostCmd_CMD_SET_BSS_MODE, @@ -1193,8 +1078,6 @@ mwifiex_change_vif_to_ap(struct net_device *dev, if (mwifiex_init_new_priv_params(priv, dev, type)) return -1; - update_vif_type_counter(adapter, curr_iftype, -1); - update_vif_type_counter(adapter, type, +1); dev->ieee80211_ptr->iftype = type; if (mwifiex_send_cmd(priv, HostCmd_CMD_SET_BSS_MODE, @@ -1237,13 +1120,6 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy, return 0; } - if (!is_vif_type_change_allowed(priv->adapter, curr_iftype, type)) { - mwifiex_dbg(priv->adapter, ERROR, - "%s: change from type %d to %d is not allowed\n", - dev->name, curr_iftype, type); - return -EOPNOTSUPP; - } - switch (curr_iftype) { case NL80211_IFTYPE_ADHOC: switch (type) { @@ -2988,13 +2864,6 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, case NL80211_IFTYPE_UNSPECIFIED: case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_ADHOC: - if (adapter->curr_iface_comb.sta_intf == - adapter->iface_limit.sta_intf) { - mwifiex_dbg(adapter, ERROR, - "cannot create multiple sta/adhoc ifaces\n"); - return ERR_PTR(-EINVAL); - } - priv = mwifiex_get_unused_priv(adapter); if (!priv) { mwifiex_dbg(adapter, ERROR, @@ -3017,13 +2886,6 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, break; case NL80211_IFTYPE_AP: - if (adapter->curr_iface_comb.uap_intf == - adapter->iface_limit.uap_intf) { - mwifiex_dbg(adapter, ERROR, - "cannot create multiple AP ifaces\n"); - return ERR_PTR(-EINVAL); - } - priv = mwifiex_get_unused_priv(adapter); if (!priv) { mwifiex_dbg(adapter, ERROR, @@ -3043,13 +2905,6 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, break; case NL80211_IFTYPE_P2P_CLIENT: - if (adapter->curr_iface_comb.p2p_intf == - adapter->iface_limit.p2p_intf) { - mwifiex_dbg(adapter, ERROR, - "cannot create multiple P2P ifaces\n"); - return ERR_PTR(-EINVAL); - } - priv = mwifiex_get_unused_priv(adapter); if (!priv) { mwifiex_dbg(adapter, ERROR, @@ -3182,8 +3037,6 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, mwifiex_dev_debugfs_init(priv); #endif - update_vif_type_counter(adapter, type, +1); - return &priv->wdev; err_reg_netdev: @@ -3246,8 +3099,6 @@ int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev) /* Clear the priv in adapter */ priv->netdev = NULL; - update_vif_type_counter(adapter, priv->bss_mode, -1); - priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED; if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA || diff --git a/drivers/net/wireless/marvell/mwifiex/decl.h b/drivers/net/wireless/marvell/mwifiex/decl.h index 84603f1e7f6e0..d64f75119014c 100644 --- a/drivers/net/wireless/marvell/mwifiex/decl.h +++ b/drivers/net/wireless/marvell/mwifiex/decl.h @@ -122,10 +122,6 @@ /* Rate index for OFDM 0 */ #define MWIFIEX_RATE_INDEX_OFDM0 4 -#define MWIFIEX_MAX_STA_NUM 3 -#define MWIFIEX_MAX_UAP_NUM 3 -#define MWIFIEX_MAX_P2P_NUM 3 - #define MWIFIEX_A_BAND_START_FREQ 5000 /* SDIO Aggr data packet special info */ @@ -267,12 +263,6 @@ struct mwifiex_histogram_data { atomic_t num_samples; }; -struct mwifiex_iface_comb { - u8 sta_intf; - u8 uap_intf; - u8 p2p_intf; -}; - struct mwifiex_radar_params { struct cfg80211_chan_def *chandef; u32 cac_time_ms; diff --git a/drivers/net/wireless/marvell/mwifiex/init.c b/drivers/net/wireless/marvell/mwifiex/init.c index 0259c9f88486b..df89c9dc44b75 100644 --- a/drivers/net/wireless/marvell/mwifiex/init.c +++ b/drivers/net/wireless/marvell/mwifiex/init.c @@ -307,9 +307,6 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) adapter->key_api_major_ver = 0; adapter->key_api_minor_ver = 0; eth_broadcast_addr(adapter->perm_addr); - adapter->iface_limit.sta_intf = MWIFIEX_MAX_STA_NUM; - adapter->iface_limit.uap_intf = MWIFIEX_MAX_UAP_NUM; - adapter->iface_limit.p2p_intf = MWIFIEX_MAX_P2P_NUM; adapter->active_scan_triggered = false; timer_setup(&adapter->wakeup_timer, wakeup_timer_fn, 0); adapter->devdump_len = 0; diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index 39f9bb49f83ff..60bdc6329d4a0 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -856,8 +856,6 @@ struct mwifiex_if_ops { struct mwifiex_adapter { u8 iface_type; unsigned int debug_mask; - struct mwifiex_iface_comb iface_limit; - struct mwifiex_iface_comb curr_iface_comb; struct mwifiex_private *priv[MWIFIEX_MAX_BSS_NUM]; u8 priv_num; const struct firmware *firmware; From patchwork Tue Aug 20 11:55:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770027 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E780A18F2E4 for ; Tue, 20 Aug 2024 12:00:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155233; cv=none; b=UhKhPCZNh5nzcwca3DUeEHtCpS9ib/dhxBNqF+oqklngJK3zkWzlH8KWQp32GI/FSFX2BcWeBExzt/bSASicNd2/XqENL1zZ0yKRBihjRVfSD7wfksl6rHW+HpGCcIXWsyI1Ak9qxQ25pNp3nLU3JZ41UFZYV4xIktecsdkKo+c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155233; c=relaxed/simple; bh=oyVL8KPtVxuWDBPQLbQk7Ogha44KgKtRargadCKWJ+k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=d+vmdWjLNyG3j7BGB8EXQgBzLBQuBid+zSZchgLSsaiNlj4SlvZScl6Cc6p1eWb3oEKgPojLvbdjwgTRxK/BIU7fOBmaRHiz9yDfjiofWVHdBbW7oKczHxWOw8qFbl/KQktji6wmC7XfygKf4p4JjIZcyRHuDQFzH7tJsSeMidQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNXG-0000ve-Rf; Tue, 20 Aug 2024 14:00:26 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNXG-001lNQ-Aq; Tue, 20 Aug 2024 14:00:26 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1K; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:39 +0200 Subject: [PATCH 14/31] wifi: mwifiex: iterate over privs in mwifiex_process_assoc_resp() Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-14-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=1321; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=oyVL8KPtVxuWDBPQLbQk7Ogha44KgKtRargadCKWJ+k=; b=C8pJmMyeirF19M7RABFMcLN9fk37FGwYUTgpaY/chbnEvCS9v+U7dC/vNZPnAxihZmWLf9L9U MArRWDyZNfyAU2m//VYtXcIgVCRw3bqBfJ10CacrVDfWgOoADitxeBq X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org mwifiex_process_assoc_resp() only checks the first bss in station mode for having an assoc response. This breaks when there are multiple bss in station mode, in that case we have to check all of them for having an assoc response. Do this by iterating over the available bss. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c index d91351384c6bb..c515887cc0623 100644 --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c @@ -921,10 +921,15 @@ void mwifiex_process_assoc_resp(struct mwifiex_adapter *adapter) struct cfg80211_rx_assoc_resp_data assoc_resp = { .uapsd_queues = -1, }; - struct mwifiex_private *priv = - mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA); + struct mwifiex_private *priv; + int i; + + for (i = 0; i < adapter->priv_num; i++) { + priv = adapter->priv[i]; + + if (!priv->assoc_rsp_size) + continue; - if (priv->assoc_rsp_size) { assoc_resp.links[0].bss = priv->req_bss; assoc_resp.buf = priv->assoc_rsp_buf; assoc_resp.len = priv->assoc_rsp_size; From patchwork Tue Aug 20 11:55:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770024 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A010B18F2DE for ; Tue, 20 Aug 2024 12:00:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155233; cv=none; b=fz6VRsMU4XlS4On3PczVYlupRrGedxlO1B5wTEzS8wPVKVhwL+wY5lTSA+kcAhpzbwMjLwdMeLtACLmbzoy2UMu4yaO+gPrT38Su/aRr8ZRE1Ft18I1J2ncIa75GrSDxaubf4G1KfsYjFR4ukM1JCCoPAflai7kh6kuBHCS5jz8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155233; c=relaxed/simple; bh=x6loJnPAxnTkjwHyqmEhnQX81pmOAvtlwNsAZ1vOdzA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=F9JB0r/8GFcNn/j9l7d83oETfItuovCzfNptZ9HRfoJqrjgMzWWpN/q5TBlLQ0H6IltwGk41T1jiCJ3J/5vTe/md72/vIE5uMgBbz/UsTn6AvH/bFlMK8v+/jKKT8bD5BvI1patEuyfU21QZQ7u09ZYBCDaz/BBAyI3i91j720M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNXG-0000vL-Nk; Tue, 20 Aug 2024 14:00:26 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNXG-001lNM-83; Tue, 20 Aug 2024 14:00:26 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1L; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:40 +0200 Subject: [PATCH 15/31] wifi: mwifiex: add missing locking Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-15-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=1543; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=x6loJnPAxnTkjwHyqmEhnQX81pmOAvtlwNsAZ1vOdzA=; b=elV6LQdPz2x7lOiAqQBcrSAbJLKWS8g9Rt1nNiogpj9pu7kzQWUBSbl9JHRb1ihQ2SU5vkGpZ /RKlqJw2+V0C3fzzRihxan8mX8uUf1nm0aYsP1lEoJNwqec36ziZDSP X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org cfg80211_rx_assoc_resp() and cfg80211_rx_mlme_mgmt() epect the wiphy being locked when called. Put the necessary locking around these calls. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 2 ++ drivers/net/wireless/marvell/mwifiex/util.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c index c515887cc0623..34e2dcb77c14d 100644 --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c @@ -933,8 +933,10 @@ void mwifiex_process_assoc_resp(struct mwifiex_adapter *adapter) assoc_resp.links[0].bss = priv->req_bss; assoc_resp.buf = priv->assoc_rsp_buf; assoc_resp.len = priv->assoc_rsp_size; + wiphy_lock(priv->wdev.wiphy); cfg80211_rx_assoc_resp(priv->netdev, &assoc_resp); + wiphy_unlock(priv->wdev.wiphy); priv->assoc_rsp_size = 0; } } diff --git a/drivers/net/wireless/marvell/mwifiex/util.c b/drivers/net/wireless/marvell/mwifiex/util.c index 42c04bf858da3..1f1f6280a0f25 100644 --- a/drivers/net/wireless/marvell/mwifiex/util.c +++ b/drivers/net/wireless/marvell/mwifiex/util.c @@ -494,7 +494,9 @@ mwifiex_process_mgmt_packet(struct mwifiex_private *priv, } } + wiphy_lock(priv->wdev.wiphy); cfg80211_rx_mlme_mgmt(priv->netdev, skb->data, pkt_len); + wiphy_unlock(priv->wdev.wiphy); } if (priv->adapter->host_mlme_enabled && From patchwork Tue Aug 20 11:55:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770032 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E53118FC6E for ; Tue, 20 Aug 2024 12:00:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155234; cv=none; b=FhDfTMEiVpExObzRfgCFwZWhXryx11NOvfRLWfOxt/AVs0bKjXu8/7WhdxpcOJXyEBLJ00PDSImUjGNVYBeoErihK2THdo4QdhFPmjM5+yrUa7WVlP2KjOpz20aT0EUQsPvglpwOsW9yO2UOpG53wSQASk8q6pDB+l2mHPuYNmY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155234; c=relaxed/simple; bh=pAAQd47hg/pVKudiUkI6c3rPp3nfSd103W4bSRl0wrc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TDueUNE+kSkqJm4HHuNZxUdFCljuw+wuEoEqFxNGD7y33olL1a8RBz797rua6qGFktmnTG3OOWelyy+Zm3hBIK+5epXs2wSeZC4OB1FBDA8Cw5EN6gyLN1dfB501uGLdNnL5W8zZpOs4pF0ta6Ehvbg8WMcN3wnBJDJqYd9Yipw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNXH-0000yG-K8; Tue, 20 Aug 2024 14:00:27 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNXH-001lNz-43; Tue, 20 Aug 2024 14:00:27 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1M; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:41 +0200 Subject: [PATCH 16/31] wifi: mwifiex: make locally used function static Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-16-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=1579; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=pAAQd47hg/pVKudiUkI6c3rPp3nfSd103W4bSRl0wrc=; b=YoDqg0Sj6XjDG4AHy7bms1ZNDtDmNB/1fGE/AedUNdePmSdNgeQ7/Oh/C52anoPRhu+YS/7P6 AiovS+xo42TAdMMt+TjnR5LAQl9OR3ri7Mp93CwX/IbXWm8YxRjt80W X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org mwifiex_is_tdls_off_chan() is only used locally. Make it static. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/main.h | 1 - drivers/net/wireless/marvell/mwifiex/util.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index 60bdc6329d4a0..0f75d69ada924 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -1566,7 +1566,6 @@ mwifiex_add_sta_entry(struct mwifiex_private *priv, const u8 *mac); struct mwifiex_sta_node * mwifiex_get_sta_entry(struct mwifiex_private *priv, const u8 *mac); u8 mwifiex_is_tdls_chan_switching(struct mwifiex_private *priv); -u8 mwifiex_is_tdls_off_chan(struct mwifiex_private *priv); u8 mwifiex_is_send_cmd_allowed(struct mwifiex_private *priv); int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, const u8 *peer, u8 action_code, u8 dialog_token, diff --git a/drivers/net/wireless/marvell/mwifiex/util.c b/drivers/net/wireless/marvell/mwifiex/util.c index 1f1f6280a0f25..ea28d604ee69c 100644 --- a/drivers/net/wireless/marvell/mwifiex/util.c +++ b/drivers/net/wireless/marvell/mwifiex/util.c @@ -663,7 +663,7 @@ u8 mwifiex_is_tdls_chan_switching(struct mwifiex_private *priv) return false; } -u8 mwifiex_is_tdls_off_chan(struct mwifiex_private *priv) +static u8 mwifiex_is_tdls_off_chan(struct mwifiex_private *priv) { struct mwifiex_sta_node *sta_ptr; From patchwork Tue Aug 20 11:55:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770022 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D40CF18F2C8 for ; Tue, 20 Aug 2024 12:00:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155231; cv=none; b=KOT01JXNYLsYGaDhasiVX2LBtyua9Hc5hmr3xuYCMHo5JN2n6eQ889hNE0psqk4weKaYZ9qZReGcuZ0wnXxgWKIhXAZ72pywuNDjWsFB632n7cApuhDXK+cHm+tMbGlIFBoTTGIBkWF3wMCANvbHjlOzY+oXt9ibEv8q9c8enbY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155231; c=relaxed/simple; bh=S5zYDxirLfqKRY8VFfa10cqW3syjJTFb8nhA9+uZmg0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KlFkJ0B5JaEx9SEsQUTyCnji57f7s5H5+j3z0P/7aRz31MIyyX73XGZVOYpHtD4ukoP/paXauyAEHjVHYzsZ0DgWrn/nfiVvSdKfJkvXyWv/DlJhBrwuqWzkSX9XGZI9WKIlh0zzKpLi7HxNMrRW5VvJduHiLOKEeI9u437O2lk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNXG-0000td-08; Tue, 20 Aug 2024 14:00:26 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNXF-001lMs-C1; Tue, 20 Aug 2024 14:00:25 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1N; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:42 +0200 Subject: [PATCH 17/31] wifi: mwifiex: fix multiple station handling Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-17-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=6860; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=S5zYDxirLfqKRY8VFfa10cqW3syjJTFb8nhA9+uZmg0=; b=DNW1sPUwO74m7+uVFX750UJwwUTdpa0wPLntRlwhCtCpwke1t+lKoBJQIRVDrUgAOO/7fRlpM 2ldOq4V/DE5DMU4oKaGVm+y0GvVJ2hme2SrJkG/AC++/yTsTe4ZwJHr X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org mwifiex_is_send_cmd_allowed() and mwifiex_is_tdls_chan_switching() are called with the first bss in station mode. There can be multiple bss in station mode and we have to consider all of them, not only the first one. Instead of the bss priv pass the adapter to these functions and iterate over the bss as necessary. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/main.c | 17 +++++---------- drivers/net/wireless/marvell/mwifiex/main.h | 4 ++-- drivers/net/wireless/marvell/mwifiex/util.c | 34 +++++++++++++++++------------ 3 files changed, 27 insertions(+), 28 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c index f1f6deaa91122..c1f9b483cb5da 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -330,16 +330,12 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter) if ((!adapter->scan_chan_gap_enabled && adapter->scan_processing) || adapter->data_sent || - mwifiex_is_tdls_chan_switching - (mwifiex_get_priv(adapter, - MWIFIEX_BSS_ROLE_STA)) || + mwifiex_is_tdls_chan_switching(adapter) || (mwifiex_wmm_lists_empty(adapter) && mwifiex_bypass_txlist_empty(adapter) && skb_queue_empty(&adapter->tx_data_q))) { if (adapter->cmd_sent || adapter->curr_cmd || - !mwifiex_is_send_cmd_allowed - (mwifiex_get_priv(adapter, - MWIFIEX_BSS_ROLE_STA)) || + !mwifiex_is_send_cmd_allowed(adapter) || (!is_command_pending(adapter))) break; } @@ -387,8 +383,7 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter) } if (!adapter->cmd_sent && !adapter->curr_cmd && - mwifiex_is_send_cmd_allowed - (mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA))) { + mwifiex_is_send_cmd_allowed(adapter)) { if (mwifiex_exec_next_cmd(adapter) == -1) { ret = -1; break; @@ -424,8 +419,7 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter) !adapter->scan_processing) && !adapter->data_sent && !mwifiex_bypass_txlist_empty(adapter) && - !mwifiex_is_tdls_chan_switching - (mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA))) { + !mwifiex_is_tdls_chan_switching(adapter)) { if (adapter->hs_activated_manually) { mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY), MWIFIEX_ASYNC_CMD); @@ -443,8 +437,7 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter) if ((adapter->scan_chan_gap_enabled || !adapter->scan_processing) && !adapter->data_sent && !mwifiex_wmm_lists_empty(adapter) && - !mwifiex_is_tdls_chan_switching - (mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA))) { + !mwifiex_is_tdls_chan_switching(adapter)) { if (adapter->hs_activated_manually) { mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY), MWIFIEX_ASYNC_CMD); diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index 0f75d69ada924..d3c04402a4f22 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -1565,8 +1565,8 @@ struct mwifiex_sta_node * mwifiex_add_sta_entry(struct mwifiex_private *priv, const u8 *mac); struct mwifiex_sta_node * mwifiex_get_sta_entry(struct mwifiex_private *priv, const u8 *mac); -u8 mwifiex_is_tdls_chan_switching(struct mwifiex_private *priv); -u8 mwifiex_is_send_cmd_allowed(struct mwifiex_private *priv); +u8 mwifiex_is_tdls_chan_switching(struct mwifiex_adapter *adapter); +u8 mwifiex_is_send_cmd_allowed(struct mwifiex_adapter *adapter); int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, const u8 *peer, u8 action_code, u8 dialog_token, u16 status_code, const u8 *extra_ies, diff --git a/drivers/net/wireless/marvell/mwifiex/util.c b/drivers/net/wireless/marvell/mwifiex/util.c index ea28d604ee69c..078877161ab7c 100644 --- a/drivers/net/wireless/marvell/mwifiex/util.c +++ b/drivers/net/wireless/marvell/mwifiex/util.c @@ -634,13 +634,19 @@ mwifiex_get_sta_entry(struct mwifiex_private *priv, const u8 *mac) } static struct mwifiex_sta_node * -mwifiex_get_tdls_sta_entry(struct mwifiex_private *priv, u8 status) +mwifiex_get_tdls_sta_entry(struct mwifiex_adapter *adapter, u8 status) { + struct mwifiex_private *priv; struct mwifiex_sta_node *node; + int i; - list_for_each_entry(node, &priv->sta_list, list) { - if (node->tdls_status == status) - return node; + for (i = 0; i < adapter->priv_num; i++) { + priv = adapter->priv[i]; + + list_for_each_entry(node, &priv->sta_list, list) { + if (node->tdls_status == status) + return node; + } } return NULL; @@ -649,28 +655,28 @@ mwifiex_get_tdls_sta_entry(struct mwifiex_private *priv, u8 status) /* If tdls channel switching is on-going, tx data traffic should be * blocked until the switching stage completed. */ -u8 mwifiex_is_tdls_chan_switching(struct mwifiex_private *priv) +u8 mwifiex_is_tdls_chan_switching(struct mwifiex_adapter *adapter) { struct mwifiex_sta_node *sta_ptr; - if (!priv || !ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info)) + if (!ISSUPP_TDLS_ENABLED(adapter->fw_cap_info)) return false; - sta_ptr = mwifiex_get_tdls_sta_entry(priv, TDLS_CHAN_SWITCHING); + sta_ptr = mwifiex_get_tdls_sta_entry(adapter, TDLS_CHAN_SWITCHING); if (sta_ptr) return true; return false; } -static u8 mwifiex_is_tdls_off_chan(struct mwifiex_private *priv) +static u8 mwifiex_is_tdls_off_chan(struct mwifiex_adapter *adapter) { struct mwifiex_sta_node *sta_ptr; - if (!priv || !ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info)) + if (!ISSUPP_TDLS_ENABLED(adapter->fw_cap_info)) return false; - sta_ptr = mwifiex_get_tdls_sta_entry(priv, TDLS_IN_OFF_CHAN); + sta_ptr = mwifiex_get_tdls_sta_entry(adapter, TDLS_IN_OFF_CHAN); if (sta_ptr) return true; @@ -680,13 +686,13 @@ static u8 mwifiex_is_tdls_off_chan(struct mwifiex_private *priv) /* If tdls channel switching is on-going or tdls operate on off-channel, * cmd path should be blocked until tdls switched to base-channel. */ -u8 mwifiex_is_send_cmd_allowed(struct mwifiex_private *priv) +u8 mwifiex_is_send_cmd_allowed(struct mwifiex_adapter *adapter) { - if (!priv || !ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info)) + if (!ISSUPP_TDLS_ENABLED(adapter->fw_cap_info)) return true; - if (mwifiex_is_tdls_chan_switching(priv) || - mwifiex_is_tdls_off_chan(priv)) + if (mwifiex_is_tdls_chan_switching(adapter) || + mwifiex_is_tdls_off_chan(adapter)) return false; return true; From patchwork Tue Aug 20 11:55:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770025 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8275618F2FD for ; Tue, 20 Aug 2024 12:00:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155233; cv=none; b=QRO/iHy9/mHdTsYii4uS2o9i0Gd4OT+Yi9rEfTxT+NlKyZPWrWjb7i5qWCstEERmYdMFZnthPhzo7Vr1JX0fkyUqsDA564a0WmF+zAnQHMFzoAaDfzLPQAH6yQcDuEwDk7CYYW6LJYNkGzYuAmBMJB5v3IDjFK0YpFyN63cNo4Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155233; c=relaxed/simple; bh=8/mU3JIog635n2Gcp73eIC9/7pYEDV7BK6F144LB3LU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=i7cnMIOYaeQbF8/PizV9ZZLIAiXwk77jGVvmKqvxXa5U1gEtbpVh4A1zNWGt4RI/+5hkoMrLDtI/poY80ORavrvf8Aq6HEjrRbv1kIat3rAKBykWb2cvottx59/N3vS4Ct3RTfhBVlXk2/V0SgzGrj0K3kGH/KpWtnYp6S08H20= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNXG-0000v7-LK; Tue, 20 Aug 2024 14:00:26 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNXG-001lNJ-5K; Tue, 20 Aug 2024 14:00:26 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1O; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:43 +0200 Subject: [PATCH 18/31] wifi: mwifiex: make mwifiex_enable_hs() safe for multiple station mode Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-18-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=975; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=8/mU3JIog635n2Gcp73eIC9/7pYEDV7BK6F144LB3LU=; b=bN1Hw4kMvtl0irBjfdqdg1UXeHRGEbbz26brCCL/ebFyjb8pE6JjE66cCLyO4zU+5Q6IuQXU3 nUBqmO+nReZCmmIQyzMmH0TJ3nj68XIY1R1J7UFh7kGCCide4UQmOFK X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org We have to stop the bg scan for all bss in station mode, not only the first one. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c index d3cba6895f8ce..aa138cab7bea9 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c @@ -507,9 +507,12 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter) } } - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA); + for (i = 0; i < adapter->priv_num; i++) { + priv = adapter->priv[i]; + + if (!priv->sched_scanning) + continue; - if (priv && priv->sched_scanning) { #ifdef CONFIG_PM if (priv->wdev.wiphy->wowlan_config && !priv->wdev.wiphy->wowlan_config->nd_config) { From patchwork Tue Aug 20 11:55:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770035 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A109518FC62 for ; Tue, 20 Aug 2024 12:00:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155235; cv=none; b=B/sd5aWM9GsKkQmtWYjYMrJczVLTz9rZjbkb5elVEXYrREnVB5KM74hBhc/okg3yt8gO6sMAZsEHlgzvVZSH8vCjdUu3cMEB+9OoaWelXSRdiul/LPSMJ2o2ntNhr7dxUxTkcBm44mLSWfO/j9MRSffZHqFNvFaehlPjD4u+9UI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155235; c=relaxed/simple; bh=813Z8f7kVRykMfTiH/TEg9N5o+7rH3yWTypXr1KkaKc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=c+Q9cZ+MnfFOIQDwNovbs5024aokmfJR7hUzZQjAIKlx3s5KRMIBR3zJ6y/OmpAg6yI20XQEEPpimgWajz36ke+idoEmhdboh7it2cRwyqGqOulCBZPXkEPjHiylJQPorTgKZGcE9Ya3nFAOVyFDljDi7mm8nul8mruhOcC5hQo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNXH-0000xK-Bb; Tue, 20 Aug 2024 14:00:27 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNXG-001lNo-Rl; Tue, 20 Aug 2024 14:00:26 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1P; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:44 +0200 Subject: [PATCH 19/31] wifi: mwifiex: add function to send command specific to the adapter Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-19-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=6556; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=813Z8f7kVRykMfTiH/TEg9N5o+7rH3yWTypXr1KkaKc=; b=cilVeq2sFDwvN7oKYrqmQQ7Q2izS4hlBcXGp/Ajj4cY1PeDKPuB+WgRLxeENdqjBIXBq0UqT7 dFg4omWrDgaCNBueHMAY/QapUUi+CLQGbrt9bEhAvS8sX/+iT7H+7YX X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org Current mwifiex_send_command() takes a struct mwifiex_private * as context pointer. There are several commands though that are specific to the whole adapter and not to priv *. For these commands introduce a mwifiex_adapter_send_command() function that takes the adapter as context pointer. Some users are updated to use this function, more will be converted in followup patches. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 13 ++++--------- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 14 ++++++++++++++ drivers/net/wireless/marvell/mwifiex/main.c | 11 ++++------- drivers/net/wireless/marvell/mwifiex/main.h | 4 ++++ 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 4c63b849e3809..8efb3b444cabc 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -562,7 +562,6 @@ int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy) struct ieee80211_supported_band *sband; struct ieee80211_channel *ch; struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); - struct mwifiex_private *priv; struct mwifiex_802_11d_domain_reg *domain_info = &adapter->domain_reg; /* Set country code */ @@ -620,9 +619,7 @@ int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy) domain_info->no_of_triplet = no_of_triplet; - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - - if (mwifiex_send_cmd(priv, HostCmd_CMD_802_11D_DOMAIN_INFO, + if (mwifiex_adapter_send_cmd(adapter, HostCmd_CMD_802_11D_DOMAIN_INFO, HostCmd_ACT_GEN_SET, 0, NULL, false)) { mwifiex_dbg(adapter, INFO, "11D: setting domain info in FW\n"); @@ -1814,8 +1811,6 @@ static int mwifiex_cfg80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant) { struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); - struct mwifiex_private *priv = mwifiex_get_priv(adapter, - MWIFIEX_BSS_ROLE_ANY); struct mwifiex_ds_ant_cfg ant_cfg; if (!tx_ant || !rx_ant) @@ -1833,7 +1828,7 @@ mwifiex_cfg80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant) return -EOPNOTSUPP; if ((tx_ant == BIT(adapter->number_of_antenna) - 1) && - (priv->adapter->number_of_antenna > 1)) { + (adapter->number_of_antenna > 1)) { tx_ant = RF_ANTENNA_AUTO; rx_ant = RF_ANTENNA_AUTO; } @@ -1869,8 +1864,8 @@ mwifiex_cfg80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant) ant_cfg.tx_ant = tx_ant; ant_cfg.rx_ant = rx_ant; - return mwifiex_send_cmd(priv, HostCmd_CMD_RF_ANTENNA, - HostCmd_ACT_GEN_SET, 0, &ant_cfg, true); + return mwifiex_adapter_send_cmd(adapter, HostCmd_CMD_RF_ANTENNA, + HostCmd_ACT_GEN_SET, 0, &ant_cfg, true); } static int diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c index 34e2dcb77c14d..445fca5c43a6c 100644 --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c @@ -670,6 +670,20 @@ int mwifiex_send_cmd(struct mwifiex_private *priv, u16 cmd_no, return ret; } +/* + * This function prepares a command and send it to the firmware. + * + * This function is meant to be used when a command is not specific + * to a struct mwifiex_private *priv, but globally to the adapter. + */ +int mwifiex_adapter_send_cmd(struct mwifiex_adapter *adapter, u16 cmd_no, + u16 cmd_action, u32 cmd_oid, void *data_buf, bool sync) +{ + struct mwifiex_private *priv = adapter->priv[0]; + + return mwifiex_send_cmd(priv, cmd_no, cmd_action, cmd_oid, data_buf, sync); +} + /* * This function queues a command to the command pending queue. * diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c index c1f9b483cb5da..6f4815f83af84 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -215,7 +215,6 @@ static int mwifiex_process_rx(struct mwifiex_adapter *adapter) static void maybe_quirk_fw_disable_ds(struct mwifiex_adapter *adapter) { - struct mwifiex_private *priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA); struct mwifiex_ver_ext ver_ext; if (test_and_set_bit(MWIFIEX_IS_REQUESTING_FW_VEREXT, &adapter->work_flags)) @@ -223,9 +222,9 @@ static void maybe_quirk_fw_disable_ds(struct mwifiex_adapter *adapter) memset(&ver_ext, 0, sizeof(ver_ext)); ver_ext.version_str_sel = 1; - if (mwifiex_send_cmd(priv, HostCmd_CMD_VERSION_EXT, + if (mwifiex_adapter_send_cmd(adapter, HostCmd_CMD_VERSION_EXT, HostCmd_ACT_GEN_GET, 0, &ver_ext, false)) { - mwifiex_dbg(priv->adapter, MSG, + mwifiex_dbg(adapter, MSG, "Checking hardware revision failed.\n"); } } @@ -1054,7 +1053,6 @@ mwifiex_tx_timeout(struct net_device *dev, unsigned int txqueue) void mwifiex_multi_chan_resync(struct mwifiex_adapter *adapter) { struct usb_card_rec *card = adapter->card; - struct mwifiex_private *priv; u16 tx_buf_size; int i, ret; @@ -1068,9 +1066,8 @@ void mwifiex_multi_chan_resync(struct mwifiex_adapter *adapter) card->mc_resync_flag = false; tx_buf_size = 0xffff; - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - ret = mwifiex_send_cmd(priv, HostCmd_CMD_RECONFIGURE_TX_BUFF, - HostCmd_ACT_GEN_SET, 0, &tx_buf_size, false); + ret = mwifiex_adapter_send_cmd(adapter, HostCmd_CMD_RECONFIGURE_TX_BUFF, + HostCmd_ACT_GEN_SET, 0, &tx_buf_size, false); if (ret) mwifiex_dbg(adapter, ERROR, "send reconfig tx buf size cmd err\n"); diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index d3c04402a4f22..bd8bf1f5e2653 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -1086,6 +1086,10 @@ int mwifiex_complete_cmd(struct mwifiex_adapter *adapter, int mwifiex_send_cmd(struct mwifiex_private *priv, u16 cmd_no, u16 cmd_action, u32 cmd_oid, void *data_buf, bool sync); +int mwifiex_adapter_send_cmd(struct mwifiex_adapter *adapter, u16 cmd_no, + u16 cmd_action, u32 cmd_oid, void *data_buf, + bool sync); + void mwifiex_cmd_timeout_func(struct timer_list *t); int mwifiex_get_debug_info(struct mwifiex_private *, From patchwork Tue Aug 20 11:55:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770039 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0D7C191F9B for ; Tue, 20 Aug 2024 12:00:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155240; cv=none; b=gv4nYYohSzF0+54d7VEAnvaFCnH4ZE0M7I70q/ZBe5OasbYc0J+xU8h3+ALvmFoP/gRfhi0Gy4/jxfsCXhv4p2Z0cIqDDoO1ixw59QQloGOoCwFZECjwtofsx5jOgD+fcDbEy2aPlEhsQQvhDA3Lc8ywdwZgNPMqGztg6N58atc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155240; c=relaxed/simple; bh=AsLPSKsgMMas0Su/h1eS8Xse0HWcoiFEKU1EdN43vGg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gJbRLKhBOK8RcW30MMLj1Gxb40xiCT/VKax8vWm8J5X7U9k3sXUYurnJv2iVjrnaY0OPz75sZM6n7yjJFQzmG2gC0ccUNIFChGG0HxcIFqEkr+XYjTQJq4ICoVLd6VTP1gTt/aIbx7UBgj+IA8AT3a4W/eegQVe0Ki8CL5ip7/k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNXG-0000tf-08; Tue, 20 Aug 2024 14:00:26 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNXF-001lMv-F4; Tue, 20 Aug 2024 14:00:25 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1Q; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:45 +0200 Subject: [PATCH 20/31] wifi: mwifiex: pass adapter to host sleep functions Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-20-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=10913; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=AsLPSKsgMMas0Su/h1eS8Xse0HWcoiFEKU1EdN43vGg=; b=vsL1Q4TxTBHQfJLyE1GvRMumCUn079MBNN6sX/155c3ead+/Oz5JZ73/t9CWGcin4N3E05W6F +oXiwm4tKMYBH3/JCc1IRWsBsiauSxBfNSf8flP+PC9WvlCJ5+hReGv X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org The host sleep functions have effect on the adapter as a whole and not to the priv *, so pass the adapter to these functions and use mwifiex_adapter_send_cmd() to send the commands. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 +- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 9 ++++----- drivers/net/wireless/marvell/mwifiex/debugfs.c | 8 ++++---- drivers/net/wireless/marvell/mwifiex/main.c | 9 +++------ drivers/net/wireless/marvell/mwifiex/main.h | 4 ++-- drivers/net/wireless/marvell/mwifiex/pcie.c | 3 +-- drivers/net/wireless/marvell/mwifiex/sdio.c | 3 +-- drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 12 +++++------- drivers/net/wireless/marvell/mwifiex/usb.c | 4 +--- 9 files changed, 22 insertions(+), 32 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 8efb3b444cabc..ffdd2b8e5f955 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -3392,7 +3392,7 @@ static int mwifiex_cfg80211_suspend(struct wiphy *wiphy, hs_cfg.is_invoke_hostcmd = false; hs_cfg.gpio = adapter->hs_cfg.gpio; hs_cfg.gap = adapter->hs_cfg.gap; - ret = mwifiex_set_hs_params(sta_priv, HostCmd_ACT_GEN_SET, + ret = mwifiex_set_hs_params(adapter, HostCmd_ACT_GEN_SET, MWIFIEX_SYNC_CMD, &hs_cfg); if (ret) mwifiex_dbg(adapter, ERROR, "Failed to set HS params\n"); diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c index 445fca5c43a6c..400f1785d0d9e 100644 --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c @@ -591,10 +591,10 @@ int mwifiex_send_cmd(struct mwifiex_private *priv, u16 cmd_no, return -1; } - if (priv->adapter->hs_activated_manually && + if (adapter->hs_activated_manually && cmd_no != HostCmd_CMD_802_11_HS_CFG_ENH) { - mwifiex_cancel_hs(priv, MWIFIEX_ASYNC_CMD); - priv->adapter->hs_activated_manually = false; + mwifiex_cancel_hs(adapter, MWIFIEX_ASYNC_CMD); + adapter->hs_activated_manually = false; } /* Get a new command node */ @@ -1251,8 +1251,7 @@ mwifiex_process_hs_config(struct mwifiex_adapter *adapter) adapter->if_ops.wakeup(adapter); if (adapter->hs_activated_manually) { - mwifiex_cancel_hs(mwifiex_get_priv (adapter, MWIFIEX_BSS_ROLE_ANY), - MWIFIEX_ASYNC_CMD); + mwifiex_cancel_hs(adapter, MWIFIEX_ASYNC_CMD); adapter->hs_activated_manually = false; } diff --git a/drivers/net/wireless/marvell/mwifiex/debugfs.c b/drivers/net/wireless/marvell/mwifiex/debugfs.c index 9deaf59dcb625..ed6d49418ca6d 100644 --- a/drivers/net/wireless/marvell/mwifiex/debugfs.c +++ b/drivers/net/wireless/marvell/mwifiex/debugfs.c @@ -783,12 +783,12 @@ mwifiex_hscfg_write(struct file *file, const char __user *ubuf, } if (arg_num >= 1 && arg_num < 3) - mwifiex_set_hs_params(priv, HostCmd_ACT_GEN_GET, + mwifiex_set_hs_params(priv->adapter, HostCmd_ACT_GEN_GET, MWIFIEX_SYNC_CMD, &hscfg); if (arg_num) { if (conditions == HS_CFG_CANCEL) { - mwifiex_cancel_hs(priv, MWIFIEX_ASYNC_CMD); + mwifiex_cancel_hs(priv->adapter, MWIFIEX_ASYNC_CMD); ret = count; goto done; } @@ -800,7 +800,7 @@ mwifiex_hscfg_write(struct file *file, const char __user *ubuf, hscfg.gap = gap; hscfg.is_invoke_hostcmd = false; - mwifiex_set_hs_params(priv, HostCmd_ACT_GEN_SET, + mwifiex_set_hs_params(priv->adapter, HostCmd_ACT_GEN_SET, MWIFIEX_SYNC_CMD, &hscfg); mwifiex_enable_hs(priv->adapter); @@ -828,7 +828,7 @@ mwifiex_hscfg_read(struct file *file, char __user *ubuf, if (!buf) return -ENOMEM; - mwifiex_set_hs_params(priv, HostCmd_ACT_GEN_GET, + mwifiex_set_hs_params(priv->adapter, HostCmd_ACT_GEN_GET, MWIFIEX_SYNC_CMD, &hscfg); pos = snprintf(buf, PAGE_SIZE, "%u 0x%x 0x%x\n", hscfg.conditions, diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c index 6f4815f83af84..f42d537cc6ce0 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -401,8 +401,7 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter) !adapter->data_sent && !skb_queue_empty(&adapter->tx_data_q)) { if (adapter->hs_activated_manually) { - mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY), - MWIFIEX_ASYNC_CMD); + mwifiex_cancel_hs(adapter, MWIFIEX_ASYNC_CMD); adapter->hs_activated_manually = false; } @@ -420,8 +419,7 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter) !mwifiex_bypass_txlist_empty(adapter) && !mwifiex_is_tdls_chan_switching(adapter)) { if (adapter->hs_activated_manually) { - mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY), - MWIFIEX_ASYNC_CMD); + mwifiex_cancel_hs(adapter, MWIFIEX_ASYNC_CMD); adapter->hs_activated_manually = false; } @@ -438,8 +436,7 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter) !adapter->data_sent && !mwifiex_wmm_lists_empty(adapter) && !mwifiex_is_tdls_chan_switching(adapter)) { if (adapter->hs_activated_manually) { - mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY), - MWIFIEX_ASYNC_CMD); + mwifiex_cancel_hs(adapter, MWIFIEX_ASYNC_CMD); adapter->hs_activated_manually = false; } diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index bd8bf1f5e2653..8ca770738d08e 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -1133,7 +1133,7 @@ int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv, void mwifiex_process_hs_config(struct mwifiex_adapter *adapter); void mwifiex_hs_activated_event(struct mwifiex_adapter *adapter, u8 activated); -int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action, +int mwifiex_set_hs_params(struct mwifiex_adapter *adapter, u16 action, int cmd_type, struct mwifiex_ds_hs_cfg *hs_cfg); int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv, struct host_cmd_ds_command *resp); @@ -1454,7 +1454,7 @@ int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter, struct cmd_ctrl_node *cmd_queued); int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, struct cfg80211_ssid *req_ssid); -int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type); +int mwifiex_cancel_hs(struct mwifiex_adapter *adapter, int cmd_type); int mwifiex_enable_hs(struct mwifiex_adapter *adapter); int mwifiex_disable_auto_ds(struct mwifiex_private *priv); int mwifiex_drv_get_data_rate(struct mwifiex_private *priv, u32 *rate); diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index 5f997becdbaa2..a25f90034e38d 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -359,8 +359,7 @@ static int mwifiex_pcie_resume(struct device *dev) clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags); - mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA), - MWIFIEX_ASYNC_CMD); + mwifiex_cancel_hs(adapter, MWIFIEX_ASYNC_CMD); mwifiex_disable_wake(adapter); return 0; diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c index 490ffd981164d..18ed5015064db 100644 --- a/drivers/net/wireless/marvell/mwifiex/sdio.c +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c @@ -654,8 +654,7 @@ static int mwifiex_sdio_resume(struct device *dev) clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags); /* Disable Host Sleep */ - mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA), - MWIFIEX_SYNC_CMD); + mwifiex_cancel_hs(adapter, MWIFIEX_SYNC_CMD); mwifiex_disable_wake(adapter); diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c index aa138cab7bea9..c01ac5061a05c 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c @@ -395,11 +395,10 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, * This function prepares the correct firmware command and * issues it. */ -int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action, +int mwifiex_set_hs_params(struct mwifiex_adapter *adapter, u16 action, int cmd_type, struct mwifiex_ds_hs_cfg *hs_cfg) { - struct mwifiex_adapter *adapter = priv->adapter; int status = 0; u32 prev_cond = 0; @@ -440,7 +439,7 @@ int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action, break; } - status = mwifiex_send_cmd(priv, + status = mwifiex_adapter_send_cmd(adapter, HostCmd_CMD_802_11_HS_CFG_ENH, HostCmd_ACT_GEN_SET, 0, &adapter->hs_cfg, @@ -476,14 +475,14 @@ int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action, * This function allocates the IOCTL request buffer, fills it * with requisite parameters and calls the IOCTL handler. */ -int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type) +int mwifiex_cancel_hs(struct mwifiex_adapter *adapter, int cmd_type) { struct mwifiex_ds_hs_cfg hscfg; hscfg.conditions = HS_CFG_CANCEL; hscfg.is_invoke_hostcmd = true; - return mwifiex_set_hs_params(priv, HostCmd_ACT_GEN_SET, + return mwifiex_set_hs_params(adapter, HostCmd_ACT_GEN_SET, cmd_type, &hscfg); } EXPORT_SYMBOL_GPL(mwifiex_cancel_hs); @@ -539,8 +538,7 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter) set_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags); mwifiex_cancel_all_pending_cmd(adapter); - if (mwifiex_set_hs_params(mwifiex_get_priv(adapter, - MWIFIEX_BSS_ROLE_STA), + if (mwifiex_set_hs_params(adapter, HostCmd_ACT_GEN_SET, MWIFIEX_SYNC_CMD, &hscfg)) { mwifiex_dbg(adapter, ERROR, diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c index 6085cd50970d4..520ea4bc9a3fb 100644 --- a/drivers/net/wireless/marvell/mwifiex/usb.c +++ b/drivers/net/wireless/marvell/mwifiex/usb.c @@ -637,9 +637,7 @@ static int mwifiex_usb_resume(struct usb_interface *intf) /* Disable Host Sleep */ if (adapter->hs_activated) - mwifiex_cancel_hs(mwifiex_get_priv(adapter, - MWIFIEX_BSS_ROLE_ANY), - MWIFIEX_ASYNC_CMD); + mwifiex_cancel_hs(adapter, MWIFIEX_ASYNC_CMD); return 0; } From patchwork Tue Aug 20 11:55:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770030 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8EB1E18F2DC for ; Tue, 20 Aug 2024 12:00:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155234; cv=none; b=oZ/4+jzOkDvZajFQNuOo/Ej/GXw5wVpCz39tMgXesu5CYG+zT/rAH/XDNczaUOz+nijxBk1s/g7mCKZhoGXbgeGJfL0mFlqTOXHhxvHR+YtWJMHrYDLayS+x4pmmu1rsYNDMovbh4HL+bxBGtUhducomnnEp6GIb0mmZIkvrcBs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155234; c=relaxed/simple; bh=wpHLf0bbOY2m3B3/4YzPyoXnonFr10puJFX2pVEDLyE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jmMzzai5CZE4AEHLiL7+vdr7JOzludNRr1LeaERrsDKe5pjjm5WIM1t2Kprjuosu3PSMFoih7+NSYzRGXWlyJuCT4VWxpl+LbZu/8b3yBu/inrn1YxbZQa89WjbsSIl/Pjb7TRTyScFww/LAk9OTonz0AlCf7c3En+bUl68YWUg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNXG-0000uV-Dx; Tue, 20 Aug 2024 14:00:26 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNXF-001lNA-Vm; Tue, 20 Aug 2024 14:00:25 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1R; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:46 +0200 Subject: [PATCH 21/31] wifi: mwifiex: associate tx_power to the adapter Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-21-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=11051; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=wpHLf0bbOY2m3B3/4YzPyoXnonFr10puJFX2pVEDLyE=; b=Kz5G5bIaDfkfxMhu3KvGHJQ8qESBdYrFBTMcx+C5YVoHzwmo9LkXC2GjBDgXxOdvBHsO9Rh6v zTEO9879PVrDnWqaUA026KuxpvGDsd3yUladD2Swz9ORb5oeFCO1I+R X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org The tx_power limitations are specific to the adapter, not to the priv (of which an adapter has multiple), so move the *tx_power_level variables from struct mwifiex_private to struct mwifiex_adapter and adjust the context pointers of the corresponding functions accordingly. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 14 +++----- drivers/net/wireless/marvell/mwifiex/init.c | 3 -- drivers/net/wireless/marvell/mwifiex/main.h | 8 ++--- drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c | 37 +++++++++++----------- drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 22 ++++++------- 5 files changed, 38 insertions(+), 46 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index ffdd2b8e5f955..5c8232b5a8c7d 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -379,7 +379,6 @@ mwifiex_cfg80211_set_tx_power(struct wiphy *wiphy, int mbm) { struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); - struct mwifiex_private *priv; struct mwifiex_power_cfg power_cfg; int dbm = MBM_TO_DBM(mbm); @@ -399,9 +398,7 @@ mwifiex_cfg80211_set_tx_power(struct wiphy *wiphy, break; } - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - - return mwifiex_set_tx_power(priv, &power_cfg); + return mwifiex_set_tx_power(adapter, &power_cfg); } /* @@ -413,16 +410,15 @@ mwifiex_cfg80211_get_tx_power(struct wiphy *wiphy, int *dbm) { struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); - struct mwifiex_private *priv = mwifiex_get_priv(adapter, - MWIFIEX_BSS_ROLE_ANY); - int ret = mwifiex_send_cmd(priv, HostCmd_CMD_RF_TX_PWR, - HostCmd_ACT_GEN_GET, 0, NULL, true); + + int ret = mwifiex_adapter_send_cmd(adapter, HostCmd_CMD_RF_TX_PWR, + HostCmd_ACT_GEN_GET, 0, NULL, true); if (ret < 0) return ret; /* tx_power_level is set in HostCmd_CMD_RF_TX_PWR command handler */ - *dbm = priv->tx_power_level; + *dbm = adapter->tx_power_level; return 0; } diff --git a/drivers/net/wireless/marvell/mwifiex/init.c b/drivers/net/wireless/marvell/mwifiex/init.c index df89c9dc44b75..a2296c0d91534 100644 --- a/drivers/net/wireless/marvell/mwifiex/init.c +++ b/drivers/net/wireless/marvell/mwifiex/init.c @@ -105,9 +105,6 @@ int mwifiex_init_priv(struct mwifiex_private *priv) priv->adhoc_channel = DEFAULT_AD_HOC_CHANNEL; priv->atim_window = 0; priv->adhoc_state = ADHOC_IDLE; - priv->tx_power_level = 0; - priv->max_tx_power_level = 0; - priv->min_tx_power_level = 0; priv->tx_ant = 0; priv->rx_ant = 0; priv->tx_rate = 0; diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index 8ca770738d08e..cb3a52c0869c9 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -542,9 +542,6 @@ struct mwifiex_private { u32 curr_pkt_filter; u32 bss_mode; u32 pkt_tx_ctrl; - u16 tx_power_level; - u8 max_tx_power_level; - u8 min_tx_power_level; u32 tx_ant; u32 rx_ant; u8 tx_rate; @@ -950,6 +947,9 @@ struct mwifiex_adapter { u8 config_bands; u8 tx_lock_flag; struct mwifiex_sleep_period sleep_period; + u8 max_tx_power_level; + u8 min_tx_power_level; + u16 tx_power_level; u16 ps_mode; u32 ps_state; u8 need_to_wakeup; @@ -1501,7 +1501,7 @@ int mwifiex_drv_set_power(struct mwifiex_private *priv, u32 *ps_mode); int mwifiex_drv_get_driver_version(struct mwifiex_adapter *adapter, char *version, int max_len); -int mwifiex_set_tx_power(struct mwifiex_private *priv, +int mwifiex_set_tx_power(struct mwifiex_adapter *adapter, struct mwifiex_power_cfg *power_cfg); int mwifiex_main_process(struct mwifiex_adapter *); diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c index 7f81e709bd6b7..87b4c552c4056 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c @@ -321,7 +321,7 @@ static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv, * Handling includes saving the maximum and minimum Tx power levels * in driver, as well as sending the values to user. */ -static int mwifiex_get_power_level(struct mwifiex_private *priv, void *data_buf) +static int mwifiex_get_power_level(struct mwifiex_adapter *adapter, void *data_buf) { int length, max_power = -1, min_power = -1; struct mwifiex_types_power_group *pg_tlv_hdr; @@ -353,8 +353,8 @@ static int mwifiex_get_power_level(struct mwifiex_private *priv, void *data_buf) length -= sizeof(struct mwifiex_power_group); } - priv->min_tx_power_level = (u8) min_power; - priv->max_tx_power_level = (u8) max_power; + adapter->min_tx_power_level = (u8) min_power; + adapter->max_tx_power_level = (u8) max_power; return 0; } @@ -366,10 +366,9 @@ static int mwifiex_get_power_level(struct mwifiex_private *priv, void *data_buf) * Handling includes changing the header fields into CPU format * and saving the current Tx power level in driver. */ -static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv, +static int mwifiex_ret_tx_power_cfg(struct mwifiex_adapter *adapter, struct host_cmd_ds_command *resp) { - struct mwifiex_adapter *adapter = priv->adapter; struct host_cmd_ds_txpwr_cfg *txp_cfg = &resp->params.txp_cfg; struct mwifiex_types_power_group *pg_tlv_hdr; struct mwifiex_power_group *pg; @@ -392,9 +391,9 @@ static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv, switch (action) { case HostCmd_ACT_GEN_GET: if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) - mwifiex_get_power_level(priv, pg_tlv_hdr); + mwifiex_get_power_level(adapter, pg_tlv_hdr); - priv->tx_power_level = (u16) pg->power_min; + adapter->tx_power_level = (u16) pg->power_min; break; case HostCmd_ACT_GEN_SET: @@ -402,7 +401,7 @@ static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv, break; if (pg->power_max == pg->power_min) - priv->tx_power_level = (u16) pg->power_min; + adapter->tx_power_level = (u16) pg->power_min; break; default: mwifiex_dbg(adapter, ERROR, @@ -412,8 +411,8 @@ static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv, } mwifiex_dbg(adapter, INFO, "info: Current TxPower Level = %d, Max Power=%d, Min Power=%d\n", - priv->tx_power_level, priv->max_tx_power_level, - priv->min_tx_power_level); + adapter->tx_power_level, adapter->max_tx_power_level, + adapter->min_tx_power_level); return 0; } @@ -421,23 +420,23 @@ static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv, /* * This function handles the command response of get RF Tx power. */ -static int mwifiex_ret_rf_tx_power(struct mwifiex_private *priv, +static int mwifiex_ret_rf_tx_power(struct mwifiex_adapter *adapter, struct host_cmd_ds_command *resp) { struct host_cmd_ds_rf_tx_pwr *txp = &resp->params.txp; u16 action = le16_to_cpu(txp->action); - priv->tx_power_level = le16_to_cpu(txp->cur_level); + adapter->tx_power_level = le16_to_cpu(txp->cur_level); if (action == HostCmd_ACT_GEN_GET) { - priv->max_tx_power_level = txp->max_power; - priv->min_tx_power_level = txp->min_power; + adapter->max_tx_power_level = txp->max_power; + adapter->min_tx_power_level = txp->min_power; } - mwifiex_dbg(priv->adapter, INFO, + mwifiex_dbg(adapter, INFO, "Current TxPower Level=%d, Max Power=%d, Min Power=%d\n", - priv->tx_power_level, priv->max_tx_power_level, - priv->min_tx_power_level); + adapter->tx_power_level, adapter->max_tx_power_level, + adapter->min_tx_power_level); return 0; } @@ -1237,10 +1236,10 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no, case HostCmd_CMD_802_11_BG_SCAN_CONFIG: break; case HostCmd_CMD_TXPWR_CFG: - ret = mwifiex_ret_tx_power_cfg(priv, resp); + ret = mwifiex_ret_tx_power_cfg(adapter, resp); break; case HostCmd_CMD_RF_TX_PWR: - ret = mwifiex_ret_rf_tx_power(priv, resp); + ret = mwifiex_ret_rf_tx_power(adapter, resp); break; case HostCmd_CMD_RF_ANTENNA: ret = mwifiex_ret_rf_antenna(priv, resp); diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c index c01ac5061a05c..ed9f75adcdea3 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c @@ -588,8 +588,8 @@ int mwifiex_get_bss_info(struct mwifiex_private *priv, info->media_connected = priv->media_connected; - info->max_power_level = priv->max_tx_power_level; - info->min_power_level = priv->min_tx_power_level; + info->max_power_level = adapter->max_tx_power_level; + info->min_power_level = adapter->min_tx_power_level; info->adhoc_state = priv->adhoc_state; @@ -657,7 +657,7 @@ int mwifiex_drv_get_data_rate(struct mwifiex_private *priv, u32 *rate) * - Modulation class HTBW20 * - Modulation class HTBW40 */ -int mwifiex_set_tx_power(struct mwifiex_private *priv, +int mwifiex_set_tx_power(struct mwifiex_adapter *adapter, struct mwifiex_power_cfg *power_cfg) { int ret; @@ -669,13 +669,13 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv, if (!power_cfg->is_power_auto) { dbm = (u16) power_cfg->power_level; - if ((dbm < priv->min_tx_power_level) || - (dbm > priv->max_tx_power_level)) { - mwifiex_dbg(priv->adapter, ERROR, + if ((dbm < adapter->min_tx_power_level) || + (dbm > adapter->max_tx_power_level)) { + mwifiex_dbg(adapter, ERROR, "txpower value %d dBm\t" "is out of range (%d dBm-%d dBm)\n", - dbm, priv->min_tx_power_level, - priv->max_tx_power_level); + dbm, adapter->min_tx_power_level, + adapter->max_tx_power_level); return -1; } } @@ -687,7 +687,7 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv, txp_cfg->action = cpu_to_le16(HostCmd_ACT_GEN_SET); if (!power_cfg->is_power_auto) { u16 dbm_min = power_cfg->is_power_fixed ? - dbm : priv->min_tx_power_level; + dbm : adapter->min_tx_power_level; txp_cfg->mode = cpu_to_le32(1); pg_tlv = (struct mwifiex_types_power_group *) @@ -732,8 +732,8 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv, pg->power_max = (s8) dbm; pg->ht_bandwidth = HT_BW_40; } - ret = mwifiex_send_cmd(priv, HostCmd_CMD_TXPWR_CFG, - HostCmd_ACT_GEN_SET, 0, buf, true); + ret = mwifiex_adapter_send_cmd(adapter, HostCmd_CMD_TXPWR_CFG, + HostCmd_ACT_GEN_SET, 0, buf, true); kfree(buf); return ret; From patchwork Tue Aug 20 11:55:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770018 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FD3F18F2D7 for ; Tue, 20 Aug 2024 12:00:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155231; cv=none; b=Uq26pf6+EekpSiXaPQ0gcpn73XmCcXet+tkL8clGnTM4qZWuHjMXyFmsm1+uBxIRIcG7D8qAs79xJ5u1OEUzj5qGse6v9ArS4bpiJogkFJmTxAwDcR/hb5StYo+5fC3X77E3oLzgW44ci8uCfBO4WUU3y8hMjlkUwJpl+jN59uI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155231; c=relaxed/simple; bh=a4wuBptPHFo9gmCPiVVThKDwNP1M7F5R34Dm5VBtJj0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=g3b8wB6UEdemMCfqnGwzZUWl029dexQdYpGSUQJdU1cCjUSzB0TuFiqaz38wY6KrT9Cn7IKCFk5+10l3JepgcK9BgwnhrRH08qarKhmXtxYHmTlSiEI7JRnFoyZjfZsU2Pp9KNWlfE5tOVGzQ9MjSaY5QWeDpFH+FdbSUiT2O2Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNXG-0000uO-Ab; Tue, 20 Aug 2024 14:00:26 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNXF-001lN7-Sw; Tue, 20 Aug 2024 14:00:25 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1S; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:47 +0200 Subject: [PATCH 22/31] wifi: mwifiex: pass adapter to mwifiex_init_shutdown_fw() Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-22-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=5046; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=a4wuBptPHFo9gmCPiVVThKDwNP1M7F5R34Dm5VBtJj0=; b=Jch8I4JE/geS6HJCBRRb7E+GOOWTnGB3t7WS2mYatNAwsP/DNkwcdEOwlMvb/qKDdc/wKfs/h UY1BVV8RjRQBiD8chWjJp5m8c9r5C5iWrwhxJxs/clmuzlOTsutz6QA X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org mwifiex_init_shutdown_fw() shuts down the firmware of the whole adapter, not of a single priv, so pass the adapter to this function and use mwifiex_adapter_send_cmd(). Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/main.c | 5 +---- drivers/net/wireless/marvell/mwifiex/main.h | 2 +- drivers/net/wireless/marvell/mwifiex/pcie.c | 2 +- drivers/net/wireless/marvell/mwifiex/sdio.c | 2 +- drivers/net/wireless/marvell/mwifiex/usb.c | 4 +--- drivers/net/wireless/marvell/mwifiex/util.c | 6 +++--- 6 files changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c index f42d537cc6ce0..8978934b1115e 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -1493,8 +1493,6 @@ static void mwifiex_uninit_sw(struct mwifiex_adapter *adapter) */ int mwifiex_shutdown_sw(struct mwifiex_adapter *adapter) { - struct mwifiex_private *priv; - if (!adapter) return 0; @@ -1502,10 +1500,9 @@ int mwifiex_shutdown_sw(struct mwifiex_adapter *adapter) /* Caller should ensure we aren't suspending while this happens */ reinit_completion(adapter->fw_done); - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); mwifiex_deauthenticate_all(adapter); - mwifiex_init_shutdown_fw(priv, MWIFIEX_FUNC_SHUTDOWN); + mwifiex_init_shutdown_fw(adapter, MWIFIEX_FUNC_SHUTDOWN); mwifiex_uninit_sw(adapter); adapter->is_up = false; diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index cb3a52c0869c9..114e0141dc01a 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -1436,7 +1436,7 @@ static inline void mwifiex_enable_wake(struct mwifiex_adapter *adapter) } } -int mwifiex_init_shutdown_fw(struct mwifiex_private *priv, +int mwifiex_init_shutdown_fw(struct mwifiex_adapter *adapter, u32 func_init_shutdown); int mwifiex_add_card(void *card, struct completion *fw_done, diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index a25f90034e38d..2a7ed2aad1a34 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -452,7 +452,7 @@ static void mwifiex_pcie_remove(struct pci_dev *pdev) mwifiex_disable_auto_ds(priv); - mwifiex_init_shutdown_fw(priv, MWIFIEX_FUNC_SHUTDOWN); + mwifiex_init_shutdown_fw(adapter, MWIFIEX_FUNC_SHUTDOWN); } mwifiex_remove_card(adapter); diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c index 18ed5015064db..e3a995514efc7 100644 --- a/drivers/net/wireless/marvell/mwifiex/sdio.c +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c @@ -867,7 +867,7 @@ mwifiex_sdio_remove(struct sdio_func *func) priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); mwifiex_disable_auto_ds(priv); - mwifiex_init_shutdown_fw(priv, MWIFIEX_FUNC_SHUTDOWN); + mwifiex_init_shutdown_fw(adapter, MWIFIEX_FUNC_SHUTDOWN); } mwifiex_remove_card(adapter); diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c index 520ea4bc9a3fb..e082c26003cd7 100644 --- a/drivers/net/wireless/marvell/mwifiex/usb.c +++ b/drivers/net/wireless/marvell/mwifiex/usb.c @@ -656,9 +656,7 @@ static void mwifiex_usb_disconnect(struct usb_interface *intf) if (card->udev->state != USB_STATE_NOTATTACHED && !adapter->mfg_mode) { mwifiex_deauthenticate_all(adapter); - mwifiex_init_shutdown_fw(mwifiex_get_priv(adapter, - MWIFIEX_BSS_ROLE_ANY), - MWIFIEX_FUNC_SHUTDOWN); + mwifiex_init_shutdown_fw(adapter, MWIFIEX_FUNC_SHUTDOWN); } mwifiex_dbg(adapter, FATAL, diff --git a/drivers/net/wireless/marvell/mwifiex/util.c b/drivers/net/wireless/marvell/mwifiex/util.c index 078877161ab7c..a8c44cc14f8a2 100644 --- a/drivers/net/wireless/marvell/mwifiex/util.c +++ b/drivers/net/wireless/marvell/mwifiex/util.c @@ -137,7 +137,7 @@ int mwifiex_init_fw_complete(struct mwifiex_adapter *adapter) * This function sends init/shutdown command * to firmware. */ -int mwifiex_init_shutdown_fw(struct mwifiex_private *priv, +int mwifiex_init_shutdown_fw(struct mwifiex_adapter *adapter, u32 func_init_shutdown) { u16 cmd; @@ -147,12 +147,12 @@ int mwifiex_init_shutdown_fw(struct mwifiex_private *priv, } else if (func_init_shutdown == MWIFIEX_FUNC_SHUTDOWN) { cmd = HostCmd_CMD_FUNC_SHUTDOWN; } else { - mwifiex_dbg(priv->adapter, ERROR, + mwifiex_dbg(adapter, ERROR, "unsupported parameter\n"); return -1; } - return mwifiex_send_cmd(priv, cmd, HostCmd_ACT_GEN_SET, 0, NULL, true); + return mwifiex_adapter_send_cmd(adapter, cmd, HostCmd_ACT_GEN_SET, 0, NULL, true); } EXPORT_SYMBOL_GPL(mwifiex_init_shutdown_fw); From patchwork Tue Aug 20 11:55:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770037 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB3E218FC6A for ; Tue, 20 Aug 2024 12:00:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155235; cv=none; b=bB0LLm2gUmfdtzgTuSogzOCkQSGztD59eg/fGroo6xbuBSWqAg69Ew1MwMNYqifrHWRg73lOajBO8osL2OFOwq3Z1e5WvExYMU04fsZphnQiLFmGtbEVpifvM+npQAHz9GKhxqyU4+4ALQE8xgZXq7fSvXgDUF9PmQxYkJiV7Hc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155235; c=relaxed/simple; bh=gWnCb3QuySdShmzGxQ9sy7njEC7F0EcaCl9k2MjgDF0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LQWxi+dpa73+uAGk9gpnAGWxDhrbRJOs/jshEMdbLsD3A1u30AF+At9pPdaJvAyzwSb83+yCnNYdN4iuw7N1qA7q3asvdi2QX05WxNJ1MsjfCSrAImtkYiNmPwEc0q4YkmaU5iQtKMblXpT4qYK/f1O9jjZ80g3CXgQCEXWXNvQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNXH-0000xc-FX; Tue, 20 Aug 2024 14:00:27 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNXG-001lNr-UW; Tue, 20 Aug 2024 14:00:26 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1T; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:48 +0200 Subject: [PATCH 23/31] wifi: mwifiex: pass adapter to mwifiex_disable_auto_ds() Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-23-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=3973; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=gWnCb3QuySdShmzGxQ9sy7njEC7F0EcaCl9k2MjgDF0=; b=vM30aopucHqN7m5GD2tznSI71PjvYPy56UY0BZPiN41kTNm6ehRyBQlKL4sfLsU0C1o22vLK8 9ltY6kUiQVQCcu9tDvIvIPX3aWkFDjnTLm5TYc8dNhiiVx89S0o6xJD X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org mwifiex_disable_auto_ds() has effect on the whole adapter and not to a priv, so pass the adapter to this function and use mwifiex_adapter_send_cmd() instead of mwifiex_send_cmd(). Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/main.h | 2 +- drivers/net/wireless/marvell/mwifiex/pcie.c | 5 +---- drivers/net/wireless/marvell/mwifiex/sdio.c | 4 +--- drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 6 +++--- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index 114e0141dc01a..298726c663724 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -1456,7 +1456,7 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, struct cfg80211_ssid *req_ssid); int mwifiex_cancel_hs(struct mwifiex_adapter *adapter, int cmd_type); int mwifiex_enable_hs(struct mwifiex_adapter *adapter); -int mwifiex_disable_auto_ds(struct mwifiex_private *priv); +int mwifiex_disable_auto_ds(struct mwifiex_adapter *adapter); int mwifiex_drv_get_data_rate(struct mwifiex_private *priv, u32 *rate); int mwifiex_request_scan(struct mwifiex_private *priv, struct cfg80211_ssid *req_ssid); diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index 2a7ed2aad1a34..caa3a383dd56d 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -427,7 +427,6 @@ static void mwifiex_pcie_remove(struct pci_dev *pdev) { struct pcie_service_card *card; struct mwifiex_adapter *adapter; - struct mwifiex_private *priv; const struct mwifiex_pcie_card_reg *reg; u32 fw_status; @@ -448,9 +447,7 @@ static void mwifiex_pcie_remove(struct pci_dev *pdev) if (fw_status == FIRMWARE_READY_PCIE && !adapter->mfg_mode) { mwifiex_deauthenticate_all(adapter); - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - - mwifiex_disable_auto_ds(priv); + mwifiex_disable_auto_ds(adapter); mwifiex_init_shutdown_fw(adapter, MWIFIEX_FUNC_SHUTDOWN); } diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c index e3a995514efc7..6a33afc8a9d97 100644 --- a/drivers/net/wireless/marvell/mwifiex/sdio.c +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c @@ -844,7 +844,6 @@ mwifiex_sdio_remove(struct sdio_func *func) { struct sdio_mmc_card *card; struct mwifiex_adapter *adapter; - struct mwifiex_private *priv; int ret = 0; u16 firmware_stat; @@ -865,8 +864,7 @@ mwifiex_sdio_remove(struct sdio_func *func) !adapter->mfg_mode) { mwifiex_deauthenticate_all(adapter); - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - mwifiex_disable_auto_ds(priv); + mwifiex_disable_auto_ds(adapter); mwifiex_init_shutdown_fw(adapter, MWIFIEX_FUNC_SHUTDOWN); } diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c index ed9f75adcdea3..3586def45adae 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c @@ -610,14 +610,14 @@ int mwifiex_get_bss_info(struct mwifiex_private *priv, /* * The function disables auto deep sleep mode. */ -int mwifiex_disable_auto_ds(struct mwifiex_private *priv) +int mwifiex_disable_auto_ds(struct mwifiex_adapter *adapter) { struct mwifiex_ds_auto_ds auto_ds = { .auto_ds = DEEP_SLEEP_OFF, }; - return mwifiex_send_cmd(priv, HostCmd_CMD_802_11_PS_MODE_ENH, - DIS_AUTO_PS, BITMAP_AUTO_DS, &auto_ds, true); + return mwifiex_adapter_send_cmd(adapter, HostCmd_CMD_802_11_PS_MODE_ENH, + DIS_AUTO_PS, BITMAP_AUTO_DS, &auto_ds, true); } EXPORT_SYMBOL_GPL(mwifiex_disable_auto_ds); From patchwork Tue Aug 20 11:55:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770038 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1AE818FC63 for ; Tue, 20 Aug 2024 12:00:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155236; cv=none; b=jWeIqnnDqVHuuyvalxTbBggDEZ5q8FOnGjk9IOgk/POkbZI2nOO+ccrZurGcWECd/7nR3UtGF2ufrfQ3BfOmY7/KhPq8LKifXufdyS4EDJsiqAup9vNsFcpJG6HWpa3zCqyA7vYth5v6y/cOn0wDB1X3wp82Qy+ZCsUw9IwvA2I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155236; c=relaxed/simple; bh=9X8SO+JYHum8BIevtxJ8U6Zsv0Zl9cCM2zo/USbNvo0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SAs8esSGOivpd5++ZBHKOma4j6lK3kMwgdlX2p1K/LtXz3D2BiIxVyj2K8d/6bGi5oKEdIkFTU2o79u9qp+UV/tw0xkY7/TwNvWNGtfOUvgbKcsTlJvngkWkXrcc9HuLWEELnl3IuCYdo0grwjHKzYVJbzzubYFSw72NTML6pVs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNXH-0000wT-3h; Tue, 20 Aug 2024 14:00:27 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNXG-001lNc-JN; Tue, 20 Aug 2024 14:00:26 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1U; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:49 +0200 Subject: [PATCH 24/31] wifi: mwifiex: make txpwr specific to adapter Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-24-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=5604; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=9X8SO+JYHum8BIevtxJ8U6Zsv0Zl9cCM2zo/USbNvo0=; b=Wmupbcafez0xuXE4f18yvOD+T1euZld73ZPmP49mEC+GWD9xsI8gbjYVYElIIdIWwhJ1hNGGE gNUzdkyp1HeAnV/Dorg1fCulYrQY2CTui9hCJd9SBzi98AF+vnkX9r0 X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org The txpwr settings are for the whole adapter, not for a single priv, so pass the adapter to the relevant functions and use mwifiex_adapter_send_cmd() instead of mwifiex_send_cmd(). Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 5 ++--- drivers/net/wireless/marvell/mwifiex/main.h | 4 ++-- drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 10 +++++----- drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 10 +++++----- drivers/net/wireless/marvell/mwifiex/uap_cmd.c | 2 +- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 5c8232b5a8c7d..35fb86b4cb8d5 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -657,8 +657,7 @@ static void mwifiex_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) { struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); - struct mwifiex_private *priv = mwifiex_get_priv(adapter, - MWIFIEX_BSS_ROLE_ANY); + mwifiex_dbg(adapter, INFO, "info: cfg80211 regulatory domain callback for %c%c\n", request->alpha2[0], request->alpha2[1]); @@ -684,7 +683,7 @@ static void mwifiex_reg_notifier(struct wiphy *wiphy, memcpy(adapter->country_code, request->alpha2, sizeof(request->alpha2)); mwifiex_send_domain_info_cmd_fw(wiphy); - mwifiex_dnld_txpwr_table(priv); + mwifiex_dnld_txpwr_table(adapter); } } diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index 298726c663724..c51b9a5766150 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -1554,9 +1554,9 @@ int mwifiex_11h_activate(struct mwifiex_private *priv, bool flag); void mwifiex_11h_process_join(struct mwifiex_private *priv, u8 **buffer, struct mwifiex_bssdescriptor *bss_desc); int mwifiex_11h_handle_event_chanswann(struct mwifiex_private *priv); -int mwifiex_dnld_dt_cfgdata(struct mwifiex_private *priv, +int mwifiex_dnld_dt_cfgdata(struct mwifiex_adapter *adapter, struct device_node *node, const char *prefix); -void mwifiex_dnld_txpwr_table(struct mwifiex_private *priv); +void mwifiex_dnld_txpwr_table(struct mwifiex_adapter *adapter); extern const struct ethtool_ops mwifiex_ethtool_ops; diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c index 30dd4e58e2b1d..bf081278000a7 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c @@ -1455,7 +1455,7 @@ static u32 mwifiex_parse_cal_cfg(u8 *src, size_t len, u8 *dst) return d - dst; } -int mwifiex_dnld_dt_cfgdata(struct mwifiex_private *priv, +int mwifiex_dnld_dt_cfgdata(struct mwifiex_adapter *adapter, struct device_node *node, const char *prefix) { #ifdef CONFIG_OF @@ -1472,9 +1472,9 @@ int mwifiex_dnld_dt_cfgdata(struct mwifiex_private *priv, /* property header is 6 bytes, data must fit in cmd buffer */ if (prop->value && prop->length > 6 && prop->length <= MWIFIEX_SIZE_OF_CMD_BUFFER - S_DS_GEN) { - ret = mwifiex_send_cmd(priv, HostCmd_CMD_CFG_DATA, - HostCmd_ACT_GEN_SET, 0, - prop, true); + ret = mwifiex_adapter_send_cmd(adapter, HostCmd_CMD_CFG_DATA, + HostCmd_ACT_GEN_SET, 0, + prop, true); if (ret) return ret; } @@ -2274,7 +2274,7 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init) adapter->hs_cfg.gpio = data; } - mwifiex_dnld_dt_cfgdata(priv, adapter->dt_node, + mwifiex_dnld_dt_cfgdata(adapter, adapter->dt_node, "marvell,caldata"); } diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c index 3586def45adae..1a8a60c1c2e67 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c @@ -180,13 +180,13 @@ int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv, return mwifiex_update_bss_desc_with_ie(priv->adapter, bss_desc); } -void mwifiex_dnld_txpwr_table(struct mwifiex_private *priv) +void mwifiex_dnld_txpwr_table(struct mwifiex_adapter *adapter) { - if (priv->adapter->dt_node) { + if (adapter->dt_node) { char txpwr[] = {"marvell,00_txpwrlimit"}; - memcpy(&txpwr[8], priv->adapter->country_code, 2); - mwifiex_dnld_dt_cfgdata(priv, priv->adapter->dt_node, txpwr); + memcpy(&txpwr[8], adapter->country_code, 2); + mwifiex_dnld_dt_cfgdata(adapter, adapter->dt_node, txpwr); } } @@ -249,7 +249,7 @@ static int mwifiex_process_country_ie(struct mwifiex_private *priv, return -1; } - mwifiex_dnld_txpwr_table(priv); + mwifiex_dnld_txpwr_table(priv->adapter); return 0; } diff --git a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c index 1c0ceac6b27fb..e016ca25ff5a9 100644 --- a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c @@ -1029,7 +1029,7 @@ void mwifiex_uap_set_channel(struct mwifiex_private *priv, if (old_bands != config_bands) { mwifiex_send_domain_info_cmd_fw(priv->adapter->wiphy); - mwifiex_dnld_txpwr_table(priv); + mwifiex_dnld_txpwr_table(priv->adapter); } } From patchwork Tue Aug 20 11:55:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770021 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BBD3F18E048 for ; Tue, 20 Aug 2024 12:00:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155231; cv=none; b=LHVKD/cxjXnRnRTLbFQU77MDMGnE4Jll2JPi+Zdk45K3GOq7mn3NDIYWdoKzbzBd1OBqozKV0lrA4fohs6U5yijJtJ4WEUagdTwNGBHJKwyBFI56hUTceAdbkczsIG3h/N4iYdKZnvlWYopstyJkAi+G89mdNUZyahDJGyjEV4E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155231; c=relaxed/simple; bh=NbLRRE/2rj8Js3vruT5fYGNGmwFqeMK5YEVrNf5xIH4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rwxlwV3EJem17ehU4qxnIscyNwlrgXbmIg4D1qRD0d2DNYeuIM3WOAo1lf91UeTzDzxe/jrwpLngaL1vzUKYqXE8vOQgviSKGMybYufb4KvPJaVL2U3PS1s342d5qAmOU/XHTZ5gleH6LPVmprIr9JTsqCxNZIGvF/Dncm8c2Pc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNXG-0000th-1X; Tue, 20 Aug 2024 14:00:26 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNXF-001lMy-K9; Tue, 20 Aug 2024 14:00:25 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1V; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:50 +0200 Subject: [PATCH 25/31] wifi: mwifiex: return error on unexpected bss_num Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-25-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=2733; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=NbLRRE/2rj8Js3vruT5fYGNGmwFqeMK5YEVrNf5xIH4=; b=AJLdrzn9DT8g8FDwVuPeWjmHGY0EKOuUmw7q6fY0YqvHz6VZ+yJG5sCSw3vy9qHl8G6Xxse6w zNJbY1fd/oUADAcvCGm6hHdP/K34yD2lA2CMDjh3lvmihmsa0lmj8n/ X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org When we receive an event, command response or RX packet on with a bss_num we haven't sent then it must be a driver or firmware bug. It makes no sense to continue with an arbitrary bss in this case, so print an error message and bail out with an error. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 15 +++++++++++---- drivers/net/wireless/marvell/mwifiex/txrx.c | 6 ++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c index 400f1785d0d9e..410e548fab074 100644 --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c @@ -497,8 +497,11 @@ int mwifiex_process_event(struct mwifiex_adapter *adapter) /* Get BSS number and corresponding priv */ priv = mwifiex_get_priv_by_id(adapter, EVENT_GET_BSS_NUM(eventcause)); - if (!priv) - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); + if (!priv) { + mwifiex_dbg(adapter, ERROR, "received event on unused bss_num %d\n", + EVENT_GET_BSS_NUM(eventcause)); + return -EINVAL; + } /* Clear BSS_NO_BITS from event */ eventcause &= EVENT_ID_MASK; @@ -861,8 +864,12 @@ int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter) /* Get BSS number and corresponding priv */ priv = mwifiex_get_priv_by_id(adapter, HostCmd_GET_BSS_NO(le16_to_cpu(resp->seq_num))); - if (!priv) - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); + if (!priv) { + mwifiex_dbg(adapter, ERROR, "received event on unused bss_num %d\n", + HostCmd_GET_BSS_NO(le16_to_cpu(resp->seq_num))); + return -EINVAL; + } + /* Clear RET_BIT from HostCmd */ resp->command = cpu_to_le16(orig_cmdresp_no & HostCmd_CMD_ID_MASK); diff --git a/drivers/net/wireless/marvell/mwifiex/txrx.c b/drivers/net/wireless/marvell/mwifiex/txrx.c index 21cfee3290377..0e5247bd642b6 100644 --- a/drivers/net/wireless/marvell/mwifiex/txrx.c +++ b/drivers/net/wireless/marvell/mwifiex/txrx.c @@ -32,12 +32,10 @@ int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter, local_rx_pd = (struct rxpd *) (skb->data); /* Get the BSS number from rxpd, get corresponding priv */ priv = mwifiex_get_priv_by_id(adapter, local_rx_pd->bss_num & BSS_NUM_MASK); - if (!priv) - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - if (!priv) { mwifiex_dbg(adapter, ERROR, - "data: priv not found. Drop RX packet\n"); + "data: recived RX packet on unused bss_num %d. Dropping it\n", + local_rx_pd->bss_num & BSS_NUM_MASK); dev_kfree_skb_any(skb); return -1; } From patchwork Tue Aug 20 11:55:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770019 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED44F18F2CC for ; Tue, 20 Aug 2024 12:00:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155231; cv=none; b=tRK2nMnj1wmGMpe3M293oWoYoy+MGDMqg1NsH6GjT4wdjr8G1jwbPaiLZn6A92D1PW3um3CQ8eOQ/b7FQ7vu31mPtGvCsO3nTv8pilIOYEUDEeZ32YCC2X3A5ovcUms//s2x+d6b58LiN5MRaC40OGSQnQBTv/QFDD6MZmWvRBw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155231; c=relaxed/simple; bh=HUrhV/9RXsSk4lgK781J6es6YfH4gCFyqD9ti2W7so4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=r5rtQRh2hyF9s1ZFtpvw0j8EPoEUsO6jCiDeG9S7mJUAL8q3HcJDQFWi82VXxisiJ0dd+PsE/Cdna83ilV5NcVPXA2Zr2P+ef/Eu9R/vPqW1c0kk57vFnvBmk3tqrh3FoqZZA4amkTS8jI79ZFlXoTG+BGlpTZ2+btUyQb0eo40= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNXG-0000tn-8J; Tue, 20 Aug 2024 14:00:26 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNXF-001lN4-Pt; Tue, 20 Aug 2024 14:00:25 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1W; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:51 +0200 Subject: [PATCH 26/31] wifi: mwifiex: coalesce rules are adapter specific Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-26-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=3362; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=HUrhV/9RXsSk4lgK781J6es6YfH4gCFyqD9ti2W7so4=; b=K4m8hT/tGagGzzyPfn3CmE+s3CaVMRXxNoNLwy3dTyfLbqWbdEXdhlW50gmGI77LnX9kZSiz7 6Y9yH8Gg315ARnJn27rkHqGPp9Kr8+c1LM4qDpKLvytE74vFRV/aSh/ X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org The coalesce rules are adapter specific, so use the adapter as context pointer and use mwifiex_adapter_send_cmd() instead of mwifiex_send_cmd(); Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 35fb86b4cb8d5..b341b36bc7395 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -3517,7 +3517,7 @@ static int mwifiex_get_coalesce_pkt_type(u8 *byte_seq) } static int -mwifiex_fill_coalesce_rule_info(struct mwifiex_private *priv, +mwifiex_fill_coalesce_rule_info(struct mwifiex_adapter *adapter, struct cfg80211_coalesce_rules *crule, struct mwifiex_coalesce_rule *mrule) { @@ -3534,7 +3534,7 @@ mwifiex_fill_coalesce_rule_info(struct mwifiex_private *priv, if (!mwifiex_is_pattern_supported(&crule->patterns[i], byte_seq, MWIFIEX_COALESCE_MAX_BYTESEQ)) { - mwifiex_dbg(priv->adapter, ERROR, + mwifiex_dbg(adapter, ERROR, "Pattern not supported\n"); return -EOPNOTSUPP; } @@ -3544,7 +3544,7 @@ mwifiex_fill_coalesce_rule_info(struct mwifiex_private *priv, pkt_type = mwifiex_get_coalesce_pkt_type(byte_seq); if (pkt_type && mrule->pkt_type) { - mwifiex_dbg(priv->adapter, ERROR, + mwifiex_dbg(adapter, ERROR, "Multiple packet types not allowed\n"); return -EOPNOTSUPP; } else if (pkt_type) { @@ -3568,7 +3568,7 @@ mwifiex_fill_coalesce_rule_info(struct mwifiex_private *priv, } if (!mrule->pkt_type) { - mwifiex_dbg(priv->adapter, ERROR, + mwifiex_dbg(adapter, ERROR, "Packet type can not be determined\n"); return -EOPNOTSUPP; } @@ -3582,21 +3582,19 @@ static int mwifiex_cfg80211_set_coalesce(struct wiphy *wiphy, struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); int i, ret; struct mwifiex_ds_coalesce_cfg coalesce_cfg; - struct mwifiex_private *priv = - mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA); memset(&coalesce_cfg, 0, sizeof(coalesce_cfg)); if (!coalesce) { mwifiex_dbg(adapter, WARN, "Disable coalesce and reset all previous rules\n"); - return mwifiex_send_cmd(priv, HostCmd_CMD_COALESCE_CFG, - HostCmd_ACT_GEN_SET, 0, - &coalesce_cfg, true); + return mwifiex_adapter_send_cmd(adapter, HostCmd_CMD_COALESCE_CFG, + HostCmd_ACT_GEN_SET, 0, + &coalesce_cfg, true); } coalesce_cfg.num_of_rules = coalesce->n_rules; for (i = 0; i < coalesce->n_rules; i++) { - ret = mwifiex_fill_coalesce_rule_info(priv, &coalesce->rules[i], + ret = mwifiex_fill_coalesce_rule_info(adapter, &coalesce->rules[i], &coalesce_cfg.rule[i]); if (ret) { mwifiex_dbg(adapter, ERROR, @@ -3606,8 +3604,8 @@ static int mwifiex_cfg80211_set_coalesce(struct wiphy *wiphy, } } - return mwifiex_send_cmd(priv, HostCmd_CMD_COALESCE_CFG, - HostCmd_ACT_GEN_SET, 0, &coalesce_cfg, true); + return mwifiex_adapter_send_cmd(adapter, HostCmd_CMD_COALESCE_CFG, + HostCmd_ACT_GEN_SET, 0, &coalesce_cfg, true); } /* cfg80211 ops handler for tdls_mgmt. From patchwork Tue Aug 20 11:55:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770020 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33F3F18F2D5 for ; Tue, 20 Aug 2024 12:00:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155232; cv=none; b=C/cR6jx8xPaFkw0u0BdPD3hBFMdxiMod11jnuhIjk1airJ7fT/4jNWJLW9XKVMQPaR8riHznl5LaPx9B9sMxJCBhnCrX9J5OyoJUEKSBb+9FAbyf62d0Biqe2K8cH0qk2EhpdAzDX+WUvLMvzKCt4Fx9UrjRmEo+bnyoKG2Nhc0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155232; c=relaxed/simple; bh=HEhEdThzY+uVINtwXzwbGho/WWVV5DgBTO5dvcE9lNk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=I1S3+O5Bvutoe1rj2kZuXjJ5VLTMu9XJ9q/9Cuanw3goScGMsGZK3e7XVydpKjxgPI3zDmzo679uaWu/bdsR+6SG5//sFDGKNK/Y69fCGk2lcGWINQqU7s1g0+5Bxv/CKwsFQNhlv83ucOVcz8mrP6fOJIGKLQ+MnArjWxpK9ww= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNXG-0000tj-4y; Tue, 20 Aug 2024 14:00:26 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNXF-001lN1-My; Tue, 20 Aug 2024 14:00:25 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1X; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:52 +0200 Subject: [PATCH 27/31] wifi: mwifiex: do not use mwifiex_get_priv() in mwifiex_dnld_sleep_confirm_cmd() Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-27-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=1359; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=HEhEdThzY+uVINtwXzwbGho/WWVV5DgBTO5dvcE9lNk=; b=vLiKh67V6kWSKJW7so2pK07WIBeOHxad5EJ4KyBUZpUxjcOBV7vakUfbqbMqrtKH32k7LaugV zvLZDFg9lQSAMqtegsRoWaJyxMj0Kri/rfb5gXijy/uOUc4mg2jTopm X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY) returns an arbitrary priv *, so we can just make up some valid bss_num and bss_type values ourselves without calling this function. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c index 410e548fab074..1b6d50b8078a3 100644 --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c @@ -298,19 +298,15 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_adapter *adapter, static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter) { int ret; - struct mwifiex_private *priv; struct mwifiex_opt_sleep_confirm *sleep_cfm_buf = (struct mwifiex_opt_sleep_confirm *) adapter->sleep_cfm->data; struct sk_buff *sleep_cfm_tmp; - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - adapter->seq_num++; sleep_cfm_buf->seq_num = cpu_to_le16(HostCmd_SET_SEQ_NO_BSS_INFO - (adapter->seq_num, priv->bss_num, - priv->bss_type)); + (adapter->seq_num, 0, 0)); mwifiex_dbg(adapter, CMD, "cmd: DNLD_CMD: %#x, act %#x, len %d, seqno %#x\n", From patchwork Tue Aug 20 11:55:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770023 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D81318F2F4 for ; Tue, 20 Aug 2024 12:00:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155234; cv=none; b=TsNPHi+j1HlIaXbTjaDpVJu6CjWH7+l0wfIX9DZRVKiZ7dUuOaTg3G3DIpu1Ks+fH3P3qZK10fQr2J7qRRnSR8yn4HvDL4UH2nOb+3vP9aPLU4s+TCHJDEPdMvxihYS45JD/crnbOkVUdaGeK3OVAHlO61aAkXABt0y9bRjWBQI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155234; c=relaxed/simple; bh=KkjdiOp7h9kGCcGqG0lJJWcoVvNY6hz2UpwrIQN8aJI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DA1Ejh855OCOpgkFAFvc1OI5NEAyw6Xoso2WpYBkWm2cf24JyqiQjldt6+ZFJJj2TdnzyJPzrjgR95YdWgb1ljy0VcnvTiSt9aZz983fKfwHPqwoQ0Sj1avpRTPNr1DhTAKKEF/fegWYJcCFmcK61f9mWMCNyLioQUzeI6jDy7o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNXG-0000w8-WE; Tue, 20 Aug 2024 14:00:27 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNXG-001lNY-Gg; Tue, 20 Aug 2024 14:00:26 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1Y; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:53 +0200 Subject: [PATCH 28/31] wifi: mwifiex: move rx_ant/tx_ant to adapter Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-28-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=4813; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=KkjdiOp7h9kGCcGqG0lJJWcoVvNY6hz2UpwrIQN8aJI=; b=OqrPKiaweYcUdwJBkSVfsB2YPHraoNPXkHrA/UjePyV5FzG6CVRJTTlrTfrfgAvfSAfO0/HD4 PFl/zxeyLlkAI5berNTFqkWR8Vfx2AwCniZboT//+5KoDHHuFWO7eYU X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org The antenna settings are specific to the adapter, not to the priv, so use adapter as context pointer and use mwifiex_adapter_send_cmd() instead of mwifiex_send_cmd(). Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 11 +++++------ drivers/net/wireless/marvell/mwifiex/init.c | 2 -- drivers/net/wireless/marvell/mwifiex/main.h | 4 ++-- drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c | 13 ++++++------- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index b341b36bc7395..a704886049c64 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -1867,13 +1867,12 @@ static int mwifiex_cfg80211_get_antenna(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant) { struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); - struct mwifiex_private *priv = mwifiex_get_priv(adapter, - MWIFIEX_BSS_ROLE_ANY); - mwifiex_send_cmd(priv, HostCmd_CMD_RF_ANTENNA, - HostCmd_ACT_GEN_GET, 0, NULL, true); - *tx_ant = priv->tx_ant; - *rx_ant = priv->rx_ant; + mwifiex_adapter_send_cmd(adapter, HostCmd_CMD_RF_ANTENNA, + HostCmd_ACT_GEN_GET, 0, NULL, true); + + *tx_ant = adapter->tx_ant; + *rx_ant = adapter->rx_ant; return 0; } diff --git a/drivers/net/wireless/marvell/mwifiex/init.c b/drivers/net/wireless/marvell/mwifiex/init.c index a2296c0d91534..ae79eb500ae13 100644 --- a/drivers/net/wireless/marvell/mwifiex/init.c +++ b/drivers/net/wireless/marvell/mwifiex/init.c @@ -105,8 +105,6 @@ int mwifiex_init_priv(struct mwifiex_private *priv) priv->adhoc_channel = DEFAULT_AD_HOC_CHANNEL; priv->atim_window = 0; priv->adhoc_state = ADHOC_IDLE; - priv->tx_ant = 0; - priv->rx_ant = 0; priv->tx_rate = 0; priv->rxpd_htinfo = 0; priv->rxpd_rate = 0; diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index c51b9a5766150..0098bae832885 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -542,8 +542,6 @@ struct mwifiex_private { u32 curr_pkt_filter; u32 bss_mode; u32 pkt_tx_ctrl; - u32 tx_ant; - u32 rx_ant; u8 tx_rate; u8 tx_htinfo; u8 rxpd_htinfo; @@ -950,6 +948,8 @@ struct mwifiex_adapter { u8 max_tx_power_level; u8 min_tx_power_level; u16 tx_power_level; + u32 tx_ant; + u32 rx_ant; u16 ps_mode; u32 ps_state; u8 need_to_wakeup; diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c index 87b4c552c4056..de6a623174701 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c @@ -444,16 +444,15 @@ static int mwifiex_ret_rf_tx_power(struct mwifiex_adapter *adapter, /* * This function handles the command response of set rf antenna */ -static int mwifiex_ret_rf_antenna(struct mwifiex_private *priv, +static int mwifiex_ret_rf_antenna(struct mwifiex_adapter *adapter, struct host_cmd_ds_command *resp) { struct host_cmd_ds_rf_ant_mimo *ant_mimo = &resp->params.ant_mimo; struct host_cmd_ds_rf_ant_siso *ant_siso = &resp->params.ant_siso; - struct mwifiex_adapter *adapter = priv->adapter; if (adapter->hw_dev_mcs_support == HT_STREAM_2X2) { - priv->tx_ant = le16_to_cpu(ant_mimo->tx_ant_mode); - priv->rx_ant = le16_to_cpu(ant_mimo->rx_ant_mode); + adapter->tx_ant = le16_to_cpu(ant_mimo->tx_ant_mode); + adapter->rx_ant = le16_to_cpu(ant_mimo->rx_ant_mode); mwifiex_dbg(adapter, INFO, "RF_ANT_RESP: Tx action = 0x%x, Tx Mode = 0x%04x\t" "Rx action = 0x%x, Rx Mode = 0x%04x\n", @@ -462,8 +461,8 @@ static int mwifiex_ret_rf_antenna(struct mwifiex_private *priv, le16_to_cpu(ant_mimo->action_rx), le16_to_cpu(ant_mimo->rx_ant_mode)); } else { - priv->tx_ant = le16_to_cpu(ant_siso->ant_mode); - priv->rx_ant = le16_to_cpu(ant_siso->ant_mode); + adapter->tx_ant = le16_to_cpu(ant_siso->ant_mode); + adapter->rx_ant = le16_to_cpu(ant_siso->ant_mode); mwifiex_dbg(adapter, INFO, "RF_ANT_RESP: action = 0x%x, Mode = 0x%04x\n", le16_to_cpu(ant_siso->action), @@ -1242,7 +1241,7 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no, ret = mwifiex_ret_rf_tx_power(adapter, resp); break; case HostCmd_CMD_RF_ANTENNA: - ret = mwifiex_ret_rf_antenna(priv, resp); + ret = mwifiex_ret_rf_antenna(adapter, resp); break; case HostCmd_CMD_802_11_PS_MODE_ENH: ret = mwifiex_ret_enh_power_mode(priv, resp, data_buf); From patchwork Tue Aug 20 11:55:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770031 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8BBFD18FC70 for ; Tue, 20 Aug 2024 12:00:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155235; cv=none; b=i0ROaHOepsr9nEzaxpR+8n85m78JY5nzJi0QDh2otktkFMfIQe4kswiuphX8fZe9ommgRkgxwcTSrYnKqJ9nqX+I8VaTbvrVScAMhrLnNhxwpT/glG5qzauKiPDO6vJ6hbTsoTR6cNUqilfFcmEMJVw7tFBThG0lGUpscuRQCxQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155235; c=relaxed/simple; bh=VIe/hSx1leTJy1aMRk7uETdeFagGWs1Kgniihu+KNmk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FLNI9mnoiH6D2OgcNHBSWX74mUBock1vDs/hIa8R9a1QVrd3XDfh6jjw53R6G7JTWumEd6+Zb0pb+lfEvvi81zdWf+6UZZqIfWhqGJHx1zjXQf6NVwLzJj1JYxNaoV32++o7lC/RTL2IF/d1k6qGBp6+AE/KLrelwMFFF57mMwI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNXH-0000x1-9x; Tue, 20 Aug 2024 14:00:27 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNXG-001lNk-Os; Tue, 20 Aug 2024 14:00:26 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1Z; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:54 +0200 Subject: [PATCH 29/31] wifi: mwifiex: pass adapter to mwifiex_fw_dump_event() Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-29-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=2811; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=VIe/hSx1leTJy1aMRk7uETdeFagGWs1Kgniihu+KNmk=; b=Hu7L10w1+zGHo/HFg7a3vU7M68eoDu7BzD6Bscj/H+11MShSswULLac+uQqwRLBaYJMuX24Rz 72nEZBmSje5BNAWasIishHYPD7LOd2bkPKFvOExNLv8fEK3xPeQgd4E X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org The only caller of mwifiex_fw_dump_event() gets the priv * by calling mwifiex_get_priv(card->adapter, MWIFIEX_BSS_ROLE_ANY) which is the same as mwifiex_adapter_send_cmd() does internally. Use this function instead of mwifiex_send_cmd() and pass the adapter as context pointer to mwifiex_fw_dump_event(). Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/main.h | 2 +- drivers/net/wireless/marvell/mwifiex/usb.c | 3 +-- drivers/net/wireless/marvell/mwifiex/util.c | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index 0098bae832885..e8aa498657c39 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -1640,7 +1640,7 @@ void mwifiex_drv_info_dump(struct mwifiex_adapter *adapter); void mwifiex_prepare_fw_dump_info(struct mwifiex_adapter *adapter); void mwifiex_upload_device_dump(struct mwifiex_adapter *adapter); void *mwifiex_alloc_dma_align_buf(int rx_len, gfp_t flags); -void mwifiex_fw_dump_event(struct mwifiex_private *priv); +void mwifiex_fw_dump_event(struct mwifiex_adapter *adapter); void mwifiex_queue_main_work(struct mwifiex_adapter *adapter); int mwifiex_get_wakeup_reason(struct mwifiex_private *priv, u16 action, int cmd_type, diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c index e082c26003cd7..0a1a67fdaa59e 100644 --- a/drivers/net/wireless/marvell/mwifiex/usb.c +++ b/drivers/net/wireless/marvell/mwifiex/usb.c @@ -671,8 +671,7 @@ static void mwifiex_usb_coredump(struct device *dev) struct usb_interface *intf = to_usb_interface(dev); struct usb_card_rec *card = usb_get_intfdata(intf); - mwifiex_fw_dump_event(mwifiex_get_priv(card->adapter, - MWIFIEX_BSS_ROLE_ANY)); + mwifiex_fw_dump_event(card->adapter); } static struct usb_driver mwifiex_usb_driver = { diff --git a/drivers/net/wireless/marvell/mwifiex/util.c b/drivers/net/wireless/marvell/mwifiex/util.c index a8c44cc14f8a2..312a83327cac4 100644 --- a/drivers/net/wireless/marvell/mwifiex/util.c +++ b/drivers/net/wireless/marvell/mwifiex/util.c @@ -857,9 +857,9 @@ void *mwifiex_alloc_dma_align_buf(int rx_len, gfp_t flags) } EXPORT_SYMBOL_GPL(mwifiex_alloc_dma_align_buf); -void mwifiex_fw_dump_event(struct mwifiex_private *priv) +void mwifiex_fw_dump_event(struct mwifiex_adapter *adapter) { - mwifiex_send_cmd(priv, HostCmd_CMD_FW_DUMP_EVENT, HostCmd_ACT_GEN_SET, - 0, NULL, true); + mwifiex_adapter_send_cmd(adapter, HostCmd_CMD_FW_DUMP_EVENT, + HostCmd_ACT_GEN_SET, 0, NULL, true); } EXPORT_SYMBOL_GPL(mwifiex_fw_dump_event); From patchwork Tue Aug 20 11:55:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770029 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D473318FC61 for ; Tue, 20 Aug 2024 12:00:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155235; cv=none; b=EFnYFcPkrnZfF8QORFhTL16K7Cs9F+jSvOTR+rjV1N0vI/o2CkASwCyOe+doxn/+4iOE9zBqoaHXT5F9ONTIy1ivf5CZTIGBUN4wrVmhNqwLAqjJR6iCSNT72EO64fQw8co8hlKKVgLTw8zes0ti5yQillEagUUkXApLVl8NkpA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155235; c=relaxed/simple; bh=vqxhDFbYSzTeyfcEHZVDl4FpS/x8cflMA1VyvVQPBwY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=clu7PzO3BYV+TBF28shI0SSLqf8Hcqi5BtOPmlx2Cj5tY6IiuqKwjVS9fEsl1Ko3hdohZNNmzh9oMhIaNgjRKplN9PDK0w2IK9zXMH5eBjcRSnbRAJ+cXHnHDevhlOvlzi1vBqvpx53KcRZfdq2u813MRBmte47GMnINyWjwa0E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNXH-0000xp-HF; Tue, 20 Aug 2024 14:00:27 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNXH-001lNv-13; Tue, 20 Aug 2024 14:00:27 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1a; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:55 +0200 Subject: [PATCH 30/31] wifi: mwifiex: move common settings out of switch/case Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-30-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=3401; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=vqxhDFbYSzTeyfcEHZVDl4FpS/x8cflMA1VyvVQPBwY=; b=8K2aPQKSCDVmNk6pujH7L+S3sQQ75dBem19rjkBH/jhkOGaMDxLM200+y9wKLS0XmwO1LIi9/ CvHZtua/yhnCWo8uooK1DgwhQTAfF1umT7JQNK4bUU8b1JDnwLjSOLN X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org In mwifiex_add_virtual_intf() several settings done in a switch/case are the same in all cases. Move them out of the switch/case to deduplicate the code. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 43 +++++++------------------ 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index a704886049c64..45f85493985b9 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -2849,18 +2849,18 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, if (!adapter) return ERR_PTR(-EFAULT); + priv = mwifiex_get_unused_priv(adapter); + if (!priv) { + mwifiex_dbg(adapter, ERROR, + "could not get free private struct\n"); + return ERR_PTR(-EFAULT); + } + switch (type) { case NL80211_IFTYPE_UNSPECIFIED: case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_ADHOC: - priv = mwifiex_get_unused_priv(adapter); - if (!priv) { - mwifiex_dbg(adapter, ERROR, - "could not get free private struct\n"); - return ERR_PTR(-EFAULT); - } - priv->wdev.wiphy = wiphy; priv->wdev.iftype = NL80211_IFTYPE_STATION; if (type == NL80211_IFTYPE_UNSPECIFIED) @@ -2869,39 +2869,18 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, priv->bss_mode = type; priv->bss_type = MWIFIEX_BSS_TYPE_STA; - priv->frame_type = MWIFIEX_DATA_FRAME_TYPE_ETH_II; - priv->bss_priority = 0; priv->bss_role = MWIFIEX_BSS_ROLE_STA; break; case NL80211_IFTYPE_AP: - priv = mwifiex_get_unused_priv(adapter); - if (!priv) { - mwifiex_dbg(adapter, ERROR, - "could not get free private struct\n"); - return ERR_PTR(-EFAULT); - } - - priv->wdev.wiphy = wiphy; priv->wdev.iftype = NL80211_IFTYPE_AP; priv->bss_type = MWIFIEX_BSS_TYPE_UAP; - priv->frame_type = MWIFIEX_DATA_FRAME_TYPE_ETH_II; - priv->bss_priority = 0; priv->bss_role = MWIFIEX_BSS_ROLE_UAP; - priv->bss_started = 0; priv->bss_mode = type; break; case NL80211_IFTYPE_P2P_CLIENT: - priv = mwifiex_get_unused_priv(adapter); - if (!priv) { - mwifiex_dbg(adapter, ERROR, - "could not get free private struct\n"); - return ERR_PTR(-EFAULT); - } - - priv->wdev.wiphy = wiphy; /* At start-up, wpa_supplicant tries to change the interface * to NL80211_IFTYPE_STATION if it is not managed mode. */ @@ -2914,10 +2893,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, */ priv->bss_type = MWIFIEX_BSS_TYPE_P2P; - priv->frame_type = MWIFIEX_DATA_FRAME_TYPE_ETH_II; - priv->bss_priority = 0; priv->bss_role = MWIFIEX_BSS_ROLE_STA; - priv->bss_started = 0; if (mwifiex_cfg80211_init_p2p_client(priv)) { memset(&priv->wdev, 0, sizeof(priv->wdev)); @@ -2931,6 +2907,11 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, return ERR_PTR(-EINVAL); } + priv->wdev.wiphy = wiphy; + priv->bss_priority = 0; + priv->bss_started = 0; + priv->frame_type = MWIFIEX_DATA_FRAME_TYPE_ETH_II; + dev = alloc_netdev_mqs(sizeof(struct mwifiex_private *), name, name_assign_type, ether_setup, IEEE80211_NUM_ACS, 1); From patchwork Tue Aug 20 11:55:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 13770033 X-Patchwork-Delegate: kvalo@adurom.com Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D809818FC7B for ; Tue, 20 Aug 2024 12:00:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155235; cv=none; b=qD042lVtRMEcG5EsoF4BzRRnOT615QYNQUq8LM3A4Mqe6ml4CjLNgCRTZwhaWS12uVu3IrPf0VOiuQzGFmTOMJdRsicRAl4yIYiuw1qtwRYr4SEiAlWc6NmZ1iFtlGvt6GHaovUtfWKuaOeSfZ1qY7BEEQsvscvqDjrAsq0BX0M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724155235; c=relaxed/simple; bh=s36KVY/Eo8CMBTbTA6p/cUDom9ZOuOO/I+ZP4Ffayd8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BjVygOgZQ1jW/XNjiRSJLSJUL7AL7EtXPeTSjXZajgc4V6b+ZZoPST1nzz9E+xwPHm0FfjJv6PaAUd3SH/wINSdYbbHgy86W3AWlfRHIBEfdTW97TVxQXunVVmkvyUNX1vOwOIoMfI6haUyiCM+MEYij6s1BH381yqe7uMVkJOE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sgNXH-0000yw-R9; Tue, 20 Aug 2024 14:00:27 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sgNXH-001lO7-9t; Tue, 20 Aug 2024 14:00:27 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sgNSR-00GnIQ-1b; Tue, 20 Aug 2024 13:55:27 +0200 From: Sascha Hauer Date: Tue, 20 Aug 2024 13:55:56 +0200 Subject: [PATCH 31/31] wifi: mwifiex: allow to set MAC address in add_virtual_intf() Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240820-mwifiex-cleanup-v1-31-320d8de4a4b7@pengutronix.de> References: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> In-Reply-To: <20240820-mwifiex-cleanup-v1-0-320d8de4a4b7@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724154927; l=1449; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=s36KVY/Eo8CMBTbTA6p/cUDom9ZOuOO/I+ZP4Ffayd8=; b=JjZAXsGkpHCFJYcgcuHWqcbIaxTpmE4KKPrNwL4D7QJMn9iZTeUiuRdAG+WJUjecdpyke2/IO xs69E+J06OcAbB//564CTQUN58KHc1SzSnCWYsmExYDOSJ/DVKLFtf8 X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org The MAC address of a newly created virtual interface can be specified via struct vif_params *. Add support for this. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 45f85493985b9..cd9594c18ed6c 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -2927,7 +2927,11 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, priv->netdev = dev; if (!adapter->mfg_mode) { - mwifiex_set_default_mac_address(priv, dev); + + if (params && !is_zero_ether_addr(params->macaddr)) + mwifiex_set_mac_address(priv, dev, params->macaddr); + else + mwifiex_set_default_mac_address(priv, dev); ret = mwifiex_send_cmd(priv, HostCmd_CMD_SET_BSS_MODE, HostCmd_ACT_GEN_SET, 0, NULL, true); @@ -4637,7 +4641,8 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) wiphy->features |= NL80211_FEATURE_INACTIVITY_TIMER | NL80211_FEATURE_LOW_PRIORITY_SCAN | - NL80211_FEATURE_NEED_OBSS_SCAN; + NL80211_FEATURE_NEED_OBSS_SCAN | + NL80211_FEATURE_MAC_ON_CREATE; if (adapter->host_mlme_enabled) wiphy->features |= NL80211_FEATURE_SAE;