* [PATCH 00/31] wifi: mwifiex: cleanup driver
@ 2024-08-20 11:55 Sascha Hauer
2024-08-20 11:55 ` [PATCH 01/31] wifi: mwifiex: remove unnecessary checks for valid priv Sascha Hauer
` (32 more replies)
0 siblings, 33 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
This series has a bunch of cleanup and bugfix patches for the mwifiex
driver.
There's one topic which goes through the whole series: an instance of
the mwifiex driver is referred to as an adapter (struct
mwifiex_adapter). An adapter has an array of struct mwifiex_private
pointers, each of them belongs to a virtual interface. Many functions
throughout the driver take a struct mwifiex_private * as context, but
are not specific to a virtual interface, but affect the whole adapter.
In many places where a priv * is needed but none is available the code
obtains a priv * by doing a:
priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
Depending on where it is used this is either a bug or could at least be
cleaned up. The driver currently has the send command function
int mwifiex_send_cmd(struct mwifiex_private *priv, u16 cmd_no,
u16 cmd_action, u32 cmd_oid, void *data_buf, bool sync)
This series introduces a second send command function which takes the
adapter as context:
int mwifiex_adapter_send_cmd(struct mwifiex_adapter *adapter, u16 cmd_no,
u16 cmd_action, u32 cmd_oid, void *data_buf, bool sync)
Many places in the driver are converted to use this function instead and
are also converted to take a struct mwifiex_adapter * as context
themselves which makes the code better readable.
Some places use this to obtain a priv *:
priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA);
This will return the first priv that is configured for station mode.
Depending on the driver configuration there can be none or many privs in
station mode, so priv can unexpectedly be NULL or in case there are
multiple privs in station mode we might have to iterate over all of
them. This is cleaned up in this series.
The remaining patches are driveby catches I found when looking through
the code.
One patch worth mentioning here is "wifi: mwifiex: fix MAC address
handling". Without it the mwifiex driver sets a new MAC address during
a change_virtual_intf operation which is pretty unexpected by userspace
and keeps the driver from working when a virtual interface is altered
from its default mode it is initialized with.
I've already sent "wifi: mwifiex: remove unnecessary priv checks" as a
separate patch, I included here again as this series depends on it, but
it's unchanged to the version I have sent earlier.
Sascha
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
Sascha Hauer (31):
wifi: mwifiex: remove unnecessary checks for valid priv
wifi: mwifiex: use adapter as context pointer for mwifiex_hs_activated_event()
wifi: mwifiex: drop HostCmd_CMD_802_11_MAC_ADDRESS response handling
wifi: mwifiex: drop unnecessary initialization
wifi: mwifiex: make region_code_mapping_t const
wifi: mwifiex: use mwifiex_deauthenticate_all()
wifi: mwifiex: pass adapter to mwifiex_dnld_cmd_to_fw()
wifi: mwifiex: simplify mwifiex_setup_ht_caps()
wifi: mwifiex: deduplicate code in mwifiex_cmd_tx_rate_cfg()
wifi: mwifiex: fix indention
wifi: mwifiex: use priv index as bss_num
wifi: mwifiex: fix MAC address handling
wifi: mwifiex: drop driver internal AP/STA limit counting
wifi: mwifiex: iterate over privs in mwifiex_process_assoc_resp()
wifi: mwifiex: add missing locking
wifi: mwifiex: make locally used function static
wifi: mwifiex: fix multiple station handling
wifi: mwifiex: make mwifiex_enable_hs() safe for multiple station mode
wifi: mwifiex: add function to send command specific to the adapter
wifi: mwifiex: pass adapter to host sleep functions
wifi: mwifiex: associate tx_power to the adapter
wifi: mwifiex: pass adapter to mwifiex_init_shutdown_fw()
wifi: mwifiex: pass adapter to mwifiex_disable_auto_ds()
wifi: mwifiex: make txpwr specific to adapter
wifi: mwifiex: return error on unexpected bss_num
wifi: mwifiex: coalesce rules are adapter specific
wifi: mwifiex: do not use mwifiex_get_priv() in mwifiex_dnld_sleep_confirm_cmd()
wifi: mwifiex: move rx_ant/tx_ant to adapter
wifi: mwifiex: pass adapter to mwifiex_fw_dump_event()
wifi: mwifiex: move common settings out of switch/case
wifi: mwifiex: allow to set MAC address in add_virtual_intf()
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 | 297 ++++-----------------
drivers/net/wireless/marvell/mwifiex/cfp.c | 4 +-
drivers/net/wireless/marvell/mwifiex/cmdevt.c | 123 +++++----
drivers/net/wireless/marvell/mwifiex/debugfs.c | 8 +-
drivers/net/wireless/marvell/mwifiex/decl.h | 10 -
drivers/net/wireless/marvell/mwifiex/init.c | 76 ++----
drivers/net/wireless/marvell/mwifiex/join.c | 3 +-
drivers/net/wireless/marvell/mwifiex/main.c | 120 +++------
drivers/net/wireless/marvell/mwifiex/main.h | 112 +++-----
drivers/net/wireless/marvell/mwifiex/pcie.c | 10 +-
drivers/net/wireless/marvell/mwifiex/scan.c | 2 -
drivers/net/wireless/marvell/mwifiex/sdio.c | 9 +-
drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 53 ++--
drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c | 70 ++---
drivers/net/wireless/marvell/mwifiex/sta_event.c | 3 +-
drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 60 ++---
drivers/net/wireless/marvell/mwifiex/txrx.c | 18 +-
drivers/net/wireless/marvell/mwifiex/uap_cmd.c | 2 +-
drivers/net/wireless/marvell/mwifiex/usb.c | 18 +-
drivers/net/wireless/marvell/mwifiex/util.c | 48 ++--
drivers/net/wireless/marvell/mwifiex/wmm.c | 19 +-
24 files changed, 365 insertions(+), 729 deletions(-)
---
base-commit: daaf0dd0398d5e93b7304f35184ca182ed583681
change-id: 20240820-mwifiex-cleanup-a2559d29e612
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 54+ messages in thread
* [PATCH 01/31] wifi: mwifiex: remove unnecessary checks for valid priv
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-22 17:58 ` Brian Norris
2024-08-20 11:55 ` [PATCH 02/31] wifi: mwifiex: use adapter as context pointer for mwifiex_hs_activated_event() Sascha Hauer
` (31 subsequent siblings)
32 siblings, 1 reply; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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;
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 02/31] wifi: mwifiex: use adapter as context pointer for mwifiex_hs_activated_event()
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
2024-08-20 11:55 ` [PATCH 01/31] wifi: mwifiex: remove unnecessary checks for valid priv Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 03/31] wifi: mwifiex: drop HostCmd_CMD_802_11_MAC_ADDRESS response handling Sascha Hauer
` (30 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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);
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 03/31] wifi: mwifiex: drop HostCmd_CMD_802_11_MAC_ADDRESS response handling
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
2024-08-20 11:55 ` [PATCH 01/31] wifi: mwifiex: remove unnecessary checks for valid priv Sascha Hauer
2024-08-20 11:55 ` [PATCH 02/31] wifi: mwifiex: use adapter as context pointer for mwifiex_hs_activated_event() Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-22 18:07 ` Brian Norris
2024-08-20 11:55 ` [PATCH 04/31] wifi: mwifiex: drop unnecessary initialization Sascha Hauer
` (29 subsequent siblings)
32 siblings, 1 reply; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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);
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 04/31] wifi: mwifiex: drop unnecessary initialization
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (2 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 03/31] wifi: mwifiex: drop HostCmd_CMD_802_11_MAC_ADDRESS response handling Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 05/31] wifi: mwifiex: make region_code_mapping_t const Sascha Hauer
` (28 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
Several functions initialize the priv * without actually using the
initialized value. Drop the initialization.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
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;
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 05/31] wifi: mwifiex: make region_code_mapping_t const
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (3 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 04/31] wifi: mwifiex: drop unnecessary initialization Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 06/31] wifi: mwifiex: use mwifiex_deauthenticate_all() Sascha Hauer
` (27 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
region_code_mapping_t is not modified and shouldn't be. Mark it const.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
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);
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 06/31] wifi: mwifiex: use mwifiex_deauthenticate_all()
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (4 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 05/31] wifi: mwifiex: make region_code_mapping_t const Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 07/31] wifi: mwifiex: pass adapter to mwifiex_dnld_cmd_to_fw() Sascha Hauer
` (26 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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);
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 07/31] wifi: mwifiex: pass adapter to mwifiex_dnld_cmd_to_fw()
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (5 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 06/31] wifi: mwifiex: use mwifiex_deauthenticate_all() Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 08/31] wifi: mwifiex: simplify mwifiex_setup_ht_caps() Sascha Hauer
` (25 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
priv is not needed in mwifiex_dnld_cmd_to_fw(), so pass the adapter to
it as context pointer.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
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
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 08/31] wifi: mwifiex: simplify mwifiex_setup_ht_caps()
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (6 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 07/31] wifi: mwifiex: pass adapter to mwifiex_dnld_cmd_to_fw() Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 09/31] wifi: mwifiex: deduplicate code in mwifiex_cmd_tx_rate_cfg() Sascha Hauer
` (24 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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;
}
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 09/31] wifi: mwifiex: deduplicate code in mwifiex_cmd_tx_rate_cfg()
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (7 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 08/31] wifi: mwifiex: simplify mwifiex_setup_ht_caps() Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 10/31] wifi: mwifiex: fix indention Sascha Hauer
` (23 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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 +
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 10/31] wifi: mwifiex: fix indention
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (8 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 09/31] wifi: mwifiex: deduplicate code in mwifiex_cmd_tx_rate_cfg() Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-22 9:36 ` [EXT] " David Lin
2024-08-20 11:55 ` [PATCH 11/31] wifi: mwifiex: use priv index as bss_num Sascha Hauer
` (22 subsequent siblings)
32 siblings, 1 reply; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
Align multiline if() under the opening brace.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
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
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 11/31] wifi: mwifiex: use priv index as bss_num
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (9 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 10/31] wifi: mwifiex: fix indention Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-22 5:48 ` Sascha Hauer
2024-08-22 23:38 ` kernel test robot
2024-08-20 11:55 ` [PATCH 12/31] wifi: mwifiex: fix MAC address handling Sascha Hauer
` (21 subsequent siblings)
32 siblings, 2 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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;
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 12/31] wifi: mwifiex: fix MAC address handling
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (10 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 11/31] wifi: mwifiex: use priv index as bss_num Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 13/31] wifi: mwifiex: drop driver internal AP/STA limit counting Sascha Hauer
` (20 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 13/31] wifi: mwifiex: drop driver internal AP/STA limit counting
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (11 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 12/31] wifi: mwifiex: fix MAC address handling Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 14/31] wifi: mwifiex: iterate over privs in mwifiex_process_assoc_resp() Sascha Hauer
` (19 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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;
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 14/31] wifi: mwifiex: iterate over privs in mwifiex_process_assoc_resp()
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (12 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 13/31] wifi: mwifiex: drop driver internal AP/STA limit counting Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 15/31] wifi: mwifiex: add missing locking Sascha Hauer
` (18 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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;
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 15/31] wifi: mwifiex: add missing locking
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (13 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 14/31] wifi: mwifiex: iterate over privs in mwifiex_process_assoc_resp() Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 16/31] wifi: mwifiex: make locally used function static Sascha Hauer
` (17 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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 &&
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 16/31] wifi: mwifiex: make locally used function static
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (14 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 15/31] wifi: mwifiex: add missing locking Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 17/31] wifi: mwifiex: fix multiple station handling Sascha Hauer
` (16 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
mwifiex_is_tdls_off_chan() is only used locally. Make it static.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
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;
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 17/31] wifi: mwifiex: fix multiple station handling
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (15 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 16/31] wifi: mwifiex: make locally used function static Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 18/31] wifi: mwifiex: make mwifiex_enable_hs() safe for multiple station mode Sascha Hauer
` (15 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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;
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 18/31] wifi: mwifiex: make mwifiex_enable_hs() safe for multiple station mode
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (16 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 17/31] wifi: mwifiex: fix multiple station handling Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 19/31] wifi: mwifiex: add function to send command specific to the adapter Sascha Hauer
` (14 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
We have to stop the bg scan for all bss in station mode, not only the
first one.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
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) {
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 19/31] wifi: mwifiex: add function to send command specific to the adapter
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (17 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 18/31] wifi: mwifiex: make mwifiex_enable_hs() safe for multiple station mode Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 20/31] wifi: mwifiex: pass adapter to host sleep functions Sascha Hauer
` (13 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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 *,
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 20/31] wifi: mwifiex: pass adapter to host sleep functions
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (18 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 19/31] wifi: mwifiex: add function to send command specific to the adapter Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 21/31] wifi: mwifiex: associate tx_power to the adapter Sascha Hauer
` (12 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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;
}
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 21/31] wifi: mwifiex: associate tx_power to the adapter
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (19 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 20/31] wifi: mwifiex: pass adapter to host sleep functions Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 22/31] wifi: mwifiex: pass adapter to mwifiex_init_shutdown_fw() Sascha Hauer
` (11 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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;
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 22/31] wifi: mwifiex: pass adapter to mwifiex_init_shutdown_fw()
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (20 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 21/31] wifi: mwifiex: associate tx_power to the adapter Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 23/31] wifi: mwifiex: pass adapter to mwifiex_disable_auto_ds() Sascha Hauer
` (10 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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);
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 23/31] wifi: mwifiex: pass adapter to mwifiex_disable_auto_ds()
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (21 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 22/31] wifi: mwifiex: pass adapter to mwifiex_init_shutdown_fw() Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 24/31] wifi: mwifiex: make txpwr specific to adapter Sascha Hauer
` (9 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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);
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 24/31] wifi: mwifiex: make txpwr specific to adapter
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (22 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 23/31] wifi: mwifiex: pass adapter to mwifiex_disable_auto_ds() Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 25/31] wifi: mwifiex: return error on unexpected bss_num Sascha Hauer
` (8 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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);
}
}
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 25/31] wifi: mwifiex: return error on unexpected bss_num
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (23 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 24/31] wifi: mwifiex: make txpwr specific to adapter Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 26/31] wifi: mwifiex: coalesce rules are adapter specific Sascha Hauer
` (7 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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;
}
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 26/31] wifi: mwifiex: coalesce rules are adapter specific
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (24 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 25/31] wifi: mwifiex: return error on unexpected bss_num Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 27/31] wifi: mwifiex: do not use mwifiex_get_priv() in mwifiex_dnld_sleep_confirm_cmd() Sascha Hauer
` (6 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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.
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 27/31] wifi: mwifiex: do not use mwifiex_get_priv() in mwifiex_dnld_sleep_confirm_cmd()
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (25 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 26/31] wifi: mwifiex: coalesce rules are adapter specific Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 28/31] wifi: mwifiex: move rx_ant/tx_ant to adapter Sascha Hauer
` (5 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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",
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 28/31] wifi: mwifiex: move rx_ant/tx_ant to adapter
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (26 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 27/31] wifi: mwifiex: do not use mwifiex_get_priv() in mwifiex_dnld_sleep_confirm_cmd() Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 29/31] wifi: mwifiex: pass adapter to mwifiex_fw_dump_event() Sascha Hauer
` (4 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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);
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 29/31] wifi: mwifiex: pass adapter to mwifiex_fw_dump_event()
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (27 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 28/31] wifi: mwifiex: move rx_ant/tx_ant to adapter Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 30/31] wifi: mwifiex: move common settings out of switch/case Sascha Hauer
` (3 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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);
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 30/31] wifi: mwifiex: move common settings out of switch/case
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (28 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 29/31] wifi: mwifiex: pass adapter to mwifiex_fw_dump_event() Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 31/31] wifi: mwifiex: allow to set MAC address in add_virtual_intf() Sascha Hauer
` (2 subsequent siblings)
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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);
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* [PATCH 31/31] wifi: mwifiex: allow to set MAC address in add_virtual_intf()
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (29 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 30/31] wifi: mwifiex: move common settings out of switch/case Sascha Hauer
@ 2024-08-20 11:55 ` Sascha Hauer
2024-08-20 13:34 ` [PATCH 00/31] wifi: mwifiex: cleanup driver Francesco Dolcini
2024-08-20 17:42 ` Kalle Valo
32 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-20 11:55 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer
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 <s.hauer@pengutronix.de>
---
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;
--
2.39.2
^ permalink raw reply related [flat|nested] 54+ messages in thread
* Re: [PATCH 00/31] wifi: mwifiex: cleanup driver
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (30 preceding siblings ...)
2024-08-20 11:55 ` [PATCH 31/31] wifi: mwifiex: allow to set MAC address in add_virtual_intf() Sascha Hauer
@ 2024-08-20 13:34 ` Francesco Dolcini
2024-08-21 11:11 ` Sascha Hauer
2024-08-21 11:33 ` Sascha Hauer
2024-08-20 17:42 ` Kalle Valo
32 siblings, 2 replies; 54+ messages in thread
From: Francesco Dolcini @ 2024-08-20 13:34 UTC (permalink / raw)
To: Sascha Hauer, Brian Norris, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel
Hello Sasha,
thanks for the patches.
Il 20 agosto 2024 13:55:25 CEST, Sascha Hauer <s.hauer@pengutronix.de> ha scritto:
>This series has a bunch of cleanup and bugfix patches for the mwifiex
>driver
Would it make sense to sort the patch series in such a way that bug fixes can be backported to stable/long-term versions? Are those bug you could reproduce or just something you noticed while looking into the driver?
...
> 24 files changed, 365 insertions(+), 729 deletions(-)
I had a quick look at the series, and it looks fine to me, I'll try to have a proper look in the next couple of weeks. What I wonder is what's the risk of introducing some subtle bugs because of firmware differences, what device/firmware combination were you able to test?
Francesco
^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: [PATCH 00/31] wifi: mwifiex: cleanup driver
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
` (31 preceding siblings ...)
2024-08-20 13:34 ` [PATCH 00/31] wifi: mwifiex: cleanup driver Francesco Dolcini
@ 2024-08-20 17:42 ` Kalle Valo
2024-08-21 11:12 ` Sascha Hauer
32 siblings, 1 reply; 54+ messages in thread
From: Kalle Valo @ 2024-08-20 17:42 UTC (permalink / raw)
To: Sascha Hauer
Cc: Brian Norris, Francesco Dolcini, linux-wireless, linux-kernel,
kernel
Sascha Hauer <s.hauer@pengutronix.de> writes:
> This series has a bunch of cleanup and bugfix patches for the mwifiex
> driver.
>
[...]
> ---
> Sascha Hauer (31):
BTW 30 patches is a lot to review. A good rule of thumb is to have max
12 patches per patchset, maybe a bit more if the patches are small.
Splitting this into two patchsets would make it a lot more pleasent for
the reviewers.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: [PATCH 00/31] wifi: mwifiex: cleanup driver
2024-08-20 13:34 ` [PATCH 00/31] wifi: mwifiex: cleanup driver Francesco Dolcini
@ 2024-08-21 11:11 ` Sascha Hauer
2024-08-21 11:33 ` Sascha Hauer
1 sibling, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-21 11:11 UTC (permalink / raw)
To: Francesco Dolcini
Cc: Brian Norris, Kalle Valo, linux-wireless, linux-kernel, kernel
On Tue, Aug 20, 2024 at 03:34:12PM +0200, Francesco Dolcini wrote:
> Hello Sasha,
> thanks for the patches.
>
> Il 20 agosto 2024 13:55:25 CEST, Sascha Hauer <s.hauer@pengutronix.de> ha scritto:
> >This series has a bunch of cleanup and bugfix patches for the mwifiex
> >driver
>
> Would it make sense to sort the patch series in such a way that bug
> fixes can be backported to stable/long-term versions?
I anticipated this question, but I was too lazy this time. Given that
Kalle asked to split up this series I'll reorder this series and send
the bug fixes first.
> Are those bug
> you could reproduce or just something you noticed while looking into
> the driver?
There are bugs I noticed because the driver didn't work as expected
which made me dive into this code. There are others that I only noticed
by looking at the code.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: [PATCH 00/31] wifi: mwifiex: cleanup driver
2024-08-20 17:42 ` Kalle Valo
@ 2024-08-21 11:12 ` Sascha Hauer
2024-08-21 14:07 ` Kalle Valo
0 siblings, 1 reply; 54+ messages in thread
From: Sascha Hauer @ 2024-08-21 11:12 UTC (permalink / raw)
To: Kalle Valo
Cc: Brian Norris, Francesco Dolcini, linux-wireless, linux-kernel,
kernel
On Tue, Aug 20, 2024 at 08:42:38PM +0300, Kalle Valo wrote:
> Sascha Hauer <s.hauer@pengutronix.de> writes:
>
> > This series has a bunch of cleanup and bugfix patches for the mwifiex
> > driver.
> >
>
> [...]
>
> > ---
> > Sascha Hauer (31):
>
> BTW 30 patches is a lot to review. A good rule of thumb is to have max
> 12 patches per patchset, maybe a bit more if the patches are small.
> Splitting this into two patchsets would make it a lot more pleasent for
> the reviewers.
Ok, I'll split up this series into smaller chunks. Be prepared there are
more to come, this driver is really full of cruft...
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: [PATCH 00/31] wifi: mwifiex: cleanup driver
2024-08-20 13:34 ` [PATCH 00/31] wifi: mwifiex: cleanup driver Francesco Dolcini
2024-08-21 11:11 ` Sascha Hauer
@ 2024-08-21 11:33 ` Sascha Hauer
1 sibling, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-21 11:33 UTC (permalink / raw)
To: Francesco Dolcini
Cc: Brian Norris, Kalle Valo, linux-wireless, linux-kernel, kernel
On Tue, Aug 20, 2024 at 03:34:12PM +0200, Francesco Dolcini wrote:
> Hello Sasha,
> thanks for the patches.
>
> Il 20 agosto 2024 13:55:25 CEST, Sascha Hauer <s.hauer@pengutronix.de> ha scritto:
> >This series has a bunch of cleanup and bugfix patches for the mwifiex
> >driver
>
>
> > 24 files changed, 365 insertions(+), 729 deletions(-)
>
> I had a quick look at the series, and it looks fine to me, I'll try to
> have a proper look in the next couple of weeks. What I wonder is
> what's the risk of introducing some subtle bugs because of firmware
> differences, what device/firmware combination were you able to test?
I tested this on a SD8978 aka iw416 SDIO card.
I just tested this on a IW61x SDIO card (mainline support for this one
still in my queue) and it didn't work, I'll investigate.
Other than that I also have a PCIe card I'll test this on next time.
I don't know there firmware versions currently, but I used the latest
ones available in linux-firmware.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: [PATCH 00/31] wifi: mwifiex: cleanup driver
2024-08-21 11:12 ` Sascha Hauer
@ 2024-08-21 14:07 ` Kalle Valo
0 siblings, 0 replies; 54+ messages in thread
From: Kalle Valo @ 2024-08-21 14:07 UTC (permalink / raw)
To: Sascha Hauer
Cc: Brian Norris, Francesco Dolcini, linux-wireless, linux-kernel,
kernel
Sascha Hauer <s.hauer@pengutronix.de> writes:
> On Tue, Aug 20, 2024 at 08:42:38PM +0300, Kalle Valo wrote:
>> Sascha Hauer <s.hauer@pengutronix.de> writes:
>>
>> > This series has a bunch of cleanup and bugfix patches for the mwifiex
>> > driver.
>> >
>>
>> [...]
>>
>> > ---
>> > Sascha Hauer (31):
>>
>> BTW 30 patches is a lot to review. A good rule of thumb is to have max
>> 12 patches per patchset, maybe a bit more if the patches are small.
>> Splitting this into two patchsets would make it a lot more pleasent for
>> the reviewers.
>
> Ok, I'll split up this series into smaller chunks. Be prepared there are
> more to come
Awesome, keep them coming!
> this driver is really full of cruft...
Honestly I have not not looked at the driver in detail but that's what
everyone are saying. So I appreciate you doing this. And I wish NXP
would help you in the effort, this a great way to learn how things work
in upstream.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: [PATCH 11/31] wifi: mwifiex: use priv index as bss_num
2024-08-20 11:55 ` [PATCH 11/31] wifi: mwifiex: use priv index as bss_num Sascha Hauer
@ 2024-08-22 5:48 ` Sascha Hauer
2024-08-22 23:38 ` kernel test robot
1 sibling, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-22 5:48 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless, linux-kernel, kernel
On Tue, Aug 20, 2024 at 01:55:36PM +0200, Sascha Hauer wrote:
> 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.
I misunderstood the driver here. I thought bss_num specifies the
instance and bss_type specifies the type of this instance. It's the
other way round: bss_num is the nth instance of type bss_type. Also
the device doesn't have 16 instances of configurable type, instead
it only has 1 station mode instance. Hence, when
bss_type == MWIFIEX_BSS_TYPE_STA every other bss_num than 0 is invalid.
Likewise there are also only three instances of type
MWIFIEX_BSS_TYPE_UAP available.
I made some assumptions on this misunderstanding throughout this series,
so it needs rework.
It would be really great to have some documentation about these devices.
Sascha
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> 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;
>
>
> --
> 2.39.2
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 54+ messages in thread
* RE: [EXT] [PATCH 10/31] wifi: mwifiex: fix indention
2024-08-20 11:55 ` [PATCH 10/31] wifi: mwifiex: fix indention Sascha Hauer
@ 2024-08-22 9:36 ` David Lin
2024-08-22 9:53 ` Marc Kleine-Budde
2024-08-26 9:37 ` Sascha Hauer
0 siblings, 2 replies; 54+ messages in thread
From: David Lin @ 2024-08-22 9:36 UTC (permalink / raw)
To: Sascha Hauer, Brian Norris, Francesco Dolcini, Kalle Valo
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@pengutronix.de
> From: Sascha Hauer <s.hauer@pengutronix.de>
> Sent: Tuesday, August 20, 2024 7:56 PM
> To: Brian Norris <briannorris@chromium.org>; Francesco Dolcini
> <francesco@dolcini.it>; Kalle Valo <kvalo@kernel.org>
> Cc: linux-wireless@vger.kernel.org; linux-kernel@vger.kernel.org;
> kernel@pengutronix.de; Sascha Hauer <s.hauer@pengutronix.de>
> Subject: [EXT] [PATCH 10/31] wifi: mwifiex: fix indention
>
> Align multiline if() under the opening brace.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> 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
>
> --
> 2.39.2
>
I wonder we still need patch for indent issue here? If so I am sure we will need a bunch of similar patches which I don't think really help improve mwifiex quality
Actually in its successor Nxpwifi (currently under review), we have cleaned up all indent, and checkpatch errors/warnings/checks.
I would suggest for Mwifiex we only take real bug fixes (Odd fixes).
•WARNING: It's generally not useful to have the filename in the file
•WARNING: Possible unnecessary 'out of memory' message
•WARNING: space prohibited between function name and open parenthesis '(‘
•WARNING: Consecutive strings are generally better as a single string
•WARNING: unchecked sscanfreturn value
•WARNING: Single statement macros should not use a do {} while (0) loop
•WARNING: do {} while (0) macros should not be semicolon terminated
•WARNING: macros should not use a trailing semicolon
•ERROR: Use C99 flexible arrays - see https://docs.kernel.org/process/deprecated.html#zero-length-and-one-element-arrays
•WARNING: Block comments use * on subsequent lines
•WARNING: const array should probably be static const
•WARNING: Prefer using '"%s...", __func__' to using 'mwifiex_register', this function's name, in a string
•WARNING: braces {} are not necessary for any arm of this statement
•WARNING: Prefer strscpyover strlcpy- see: https://github.com/KSPP/linux/issues/89
•WARNING: Statements should start on a tabstop
•WARNING: Prefer strscpyover strcpy- see: https://github.com/KSPP/linux/issues/88
•WARNING: Unnecessary space before function pointer arguments
•WARNING: Possible repeated word: 'send’
•WARNING: Possible repeated word: 'enabled’
•WARNING: quoted string split across lines
•WARNING: ENOSYS means 'invalid syscallnr' and nothing else
•WARNING:simple_strtolis obsolete, use kstrtolinstead
•ERROR: code indent should use tabs where possible
•WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
•CHECK: Avoid CamelCase: <HostCmd_CMD_ADD_NEW_STATION>
•WARNING: void function return statements are not generally useful
•WARNING: suspect code indent for conditional statements
•WARNING: braces {} are not necessary for single statement blocks
•WARNING: Avoid multiple line dereference
•WARNING: function definition argument ‘xxx' should also have an identifier name
•WARNING: else is not generally useful after a break or return
•WARNING: Missing a blank line after declarations
•WARNING: Block comments use a trailing */ on a separate line
•ERROR: need consistent spacing around '+’
•ERROR: open brace '{' following function definitions go on the next line
•WARNING: Comparisons should place the constant on the right side of the test
Thanks,
David
^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: RE: [EXT] [PATCH 10/31] wifi: mwifiex: fix indention
2024-08-22 9:36 ` [EXT] " David Lin
@ 2024-08-22 9:53 ` Marc Kleine-Budde
2024-08-22 10:44 ` Marc Kleine-Budde
2024-08-22 11:59 ` David Lin
2024-08-26 9:37 ` Sascha Hauer
1 sibling, 2 replies; 54+ messages in thread
From: Marc Kleine-Budde @ 2024-08-22 9:53 UTC (permalink / raw)
To: David Lin
Cc: Sascha Hauer, Brian Norris, Francesco Dolcini, Kalle Valo,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@pengutronix.de
[-- Attachment #1: Type: text/plain, Size: 723 bytes --]
On 22.08.2024 09:36:29, David Lin wrote:
> I wonder we still need patch for indent issue here? If so I am sure we
> will need a bunch of similar patches which I don't think really help
> improve mwifiex quality
mwifiex is the best mainline driver we have for these devices.
> Actually in its successor Nxpwifi (currently under review), we have
> cleaned up all indent, and checkpatch errors/warnings/checks.
Public review?
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 484 bytes --]
^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: RE: [EXT] [PATCH 10/31] wifi: mwifiex: fix indention
2024-08-22 9:53 ` Marc Kleine-Budde
@ 2024-08-22 10:44 ` Marc Kleine-Budde
2024-08-22 11:59 ` David Lin
1 sibling, 0 replies; 54+ messages in thread
From: Marc Kleine-Budde @ 2024-08-22 10:44 UTC (permalink / raw)
To: David Lin
Cc: Sascha Hauer, Brian Norris, Francesco Dolcini, Kalle Valo,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@pengutronix.de
[-- Attachment #1: Type: text/plain, Size: 869 bytes --]
On 22.08.2024 11:53:25, Marc Kleine-Budde wrote:
> On 22.08.2024 09:36:29, David Lin wrote:
> > I wonder we still need patch for indent issue here? If so I am sure we
> > will need a bunch of similar patches which I don't think really help
> > improve mwifiex quality
>
> mwifiex is the best mainline driver we have for these devices.
>
> > Actually in its successor Nxpwifi (currently under review), we have
> > cleaned up all indent, and checkpatch errors/warnings/checks.
>
> Public review?
Found it:
https://lore.kernel.org/all/20240809094533.1660-1-yu-hao.lin@nxp.com/
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 54+ messages in thread
* RE: RE: [EXT] [PATCH 10/31] wifi: mwifiex: fix indention
2024-08-22 9:53 ` Marc Kleine-Budde
2024-08-22 10:44 ` Marc Kleine-Budde
@ 2024-08-22 11:59 ` David Lin
2024-08-22 12:05 ` Marc Kleine-Budde
1 sibling, 1 reply; 54+ messages in thread
From: David Lin @ 2024-08-22 11:59 UTC (permalink / raw)
To: Marc Kleine-Budde
Cc: Sascha Hauer, Brian Norris, Francesco Dolcini, Kalle Valo,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@pengutronix.de
> From: Marc Kleine-Budde <mkl@pengutronix.de>
> Sent: Thursday, August 22, 2024 5:53 PM
> To: David Lin <yu-hao.lin@nxp.com>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>; Brian Norris
> <briannorris@chromium.org>; Francesco Dolcini <francesco@dolcini.it>;
> Kalle Valo <kvalo@kernel.org>; linux-wireless@vger.kernel.org;
> linux-kernel@vger.kernel.org; kernel@pengutronix.de
> Subject: Re: RE: [EXT] [PATCH 10/31] wifi: mwifiex: fix indention
>
> On 22.08.2024 09:36:29, David Lin wrote:
> > I wonder we still need patch for indent issue here? If so I am sure we
> > will need a bunch of similar patches which I don't think really help
> > improve mwifiex quality
>
> mwifiex is the best mainline driver we have for these devices.
>
Yes, we will continue to fix bugs of mwifiex just like we added the WPA3 support for it.
> > Actually in its successor Nxpwifi (currently under review), we have
> > cleaned up all indent, and checkpatch errors/warnings/checks.
>
> Public review?
>
Nxpwifi patch v2 had been submitted recently.
> regards,
> Marc
>
> --
> Pengutronix e.K. | Marc Kleine-Budde |
> Embedded Linux | https://www.pengutronix.de |
> Vertretung Nürnberg | Phone: +49-5121-206917-129 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: RE: RE: [EXT] [PATCH 10/31] wifi: mwifiex: fix indention
2024-08-22 11:59 ` David Lin
@ 2024-08-22 12:05 ` Marc Kleine-Budde
2024-08-22 12:11 ` David Lin
0 siblings, 1 reply; 54+ messages in thread
From: Marc Kleine-Budde @ 2024-08-22 12:05 UTC (permalink / raw)
To: David Lin
Cc: Sascha Hauer, Brian Norris, Francesco Dolcini, Kalle Valo,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@pengutronix.de
[-- Attachment #1: Type: text/plain, Size: 1352 bytes --]
On 22.08.2024 11:59:55, David Lin wrote:
> > From: Marc Kleine-Budde <mkl@pengutronix.de>
> > Sent: Thursday, August 22, 2024 5:53 PM
> > To: David Lin <yu-hao.lin@nxp.com>
> > Cc: Sascha Hauer <s.hauer@pengutronix.de>; Brian Norris
> > <briannorris@chromium.org>; Francesco Dolcini <francesco@dolcini.it>;
> > Kalle Valo <kvalo@kernel.org>; linux-wireless@vger.kernel.org;
> > linux-kernel@vger.kernel.org; kernel@pengutronix.de
> > Subject: Re: RE: [EXT] [PATCH 10/31] wifi: mwifiex: fix indention
> >
> > On 22.08.2024 09:36:29, David Lin wrote:
> > > I wonder we still need patch for indent issue here? If so I am sure we
> > > will need a bunch of similar patches which I don't think really help
> > > improve mwifiex quality
> >
> > mwifiex is the best mainline driver we have for these devices.
> >
>
> Yes, we will continue to fix bugs of mwifiex just like we added the
> WPA3 support for it.
Why do you think 2 drivers are easier to handle/support/maintain/...
than 1 driver, especially given the low available review bandwidth?
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 54+ messages in thread
* RE: RE: RE: [EXT] [PATCH 10/31] wifi: mwifiex: fix indention
2024-08-22 12:05 ` Marc Kleine-Budde
@ 2024-08-22 12:11 ` David Lin
2024-08-22 12:20 ` Marc Kleine-Budde
0 siblings, 1 reply; 54+ messages in thread
From: David Lin @ 2024-08-22 12:11 UTC (permalink / raw)
To: Marc Kleine-Budde
Cc: Sascha Hauer, Brian Norris, Francesco Dolcini, Kalle Valo,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@pengutronix.de
> From: Marc Kleine-Budde <mkl@pengutronix.de>
> Sent: Thursday, August 22, 2024 8:05 PM
> To: David Lin <yu-hao.lin@nxp.com>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>; Brian Norris
> <briannorris@chromium.org>; Francesco Dolcini <francesco@dolcini.it>;
> Kalle Valo <kvalo@kernel.org>; linux-wireless@vger.kernel.org;
> linux-kernel@vger.kernel.org; kernel@pengutronix.de
> Subject: Re: RE: RE: [EXT] [PATCH 10/31] wifi: mwifiex: fix indention
>
> On 22.08.2024 11:59:55, David Lin wrote:
> > > From: Marc Kleine-Budde <mkl@pengutronix.de>
> > > Sent: Thursday, August 22, 2024 5:53 PM
> > > To: David Lin <yu-hao.lin@nxp.com>
> > > Cc: Sascha Hauer <s.hauer@pengutronix.de>; Brian Norris
> > > <briannorris@chromium.org>; Francesco Dolcini
> > > <francesco@dolcini.it>; Kalle Valo <kvalo@kernel.org>;
> > > linux-wireless@vger.kernel.org; linux-kernel@vger.kernel.org;
> > > kernel@pengutronix.de
> > > Subject: Re: RE: [EXT] [PATCH 10/31] wifi: mwifiex: fix indention
> > >
> > > On 22.08.2024 09:36:29, David Lin wrote:
> > > > I wonder we still need patch for indent issue here? If so I am
> > > > sure we will need a bunch of similar patches which I don't think
> > > > really help improve mwifiex quality
> > >
> > > mwifiex is the best mainline driver we have for these devices.
> > >
> >
> > Yes, we will continue to fix bugs of mwifiex just like we added the
> > WPA3 support for it.
>
> Why do you think 2 drivers are easier to handle/support/maintain/...
> than 1 driver, especially given the low available review bandwidth?
>
Nxpwifi is used to support new NXP WiFi chips. You can check the commit message of Nxpwifi to
know the reason why we need a new driver to support new NXP WiFi chips.
Thanks,
David
> regards,
> Marc
>
> --
> Pengutronix e.K. | Marc Kleine-Budde |
> Embedded Linux | https://www.pengutronix.de |
> Vertretung Nürnberg | Phone: +49-5121-206917-129 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: RE: RE: RE: [EXT] [PATCH 10/31] wifi: mwifiex: fix indention
2024-08-22 12:11 ` David Lin
@ 2024-08-22 12:20 ` Marc Kleine-Budde
0 siblings, 0 replies; 54+ messages in thread
From: Marc Kleine-Budde @ 2024-08-22 12:20 UTC (permalink / raw)
To: David Lin
Cc: Sascha Hauer, Brian Norris, Francesco Dolcini, Kalle Valo,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@pengutronix.de
[-- Attachment #1: Type: text/plain, Size: 1076 bytes --]
On 22.08.2024 12:11:15, David Lin wrote:
> > Why do you think 2 drivers are easier to handle/support/maintain/...
> > than 1 driver, especially given the low available review bandwidth?
> >
>
> Nxpwifi is used to support new NXP WiFi chips. You can check the commit message of Nxpwifi to
> know the reason why we need a new driver to support new NXP WiFi chips.
FTR:
https://lore.kernel.org/all/20240809094533.1660-1-yu-hao.lin@nxp.com/
>> [1] We had considered adding IW61x to mwifiex driver, however due to
>> FW architecture, host command interface and supported features are
>> significantly different, we have to create the new nxpwifi driver.
>> Subsequent NXP chipsets will be added and sustained in this new driver.
Thanks for the clarification.
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: [PATCH 01/31] wifi: mwifiex: remove unnecessary checks for valid priv
2024-08-20 11:55 ` [PATCH 01/31] wifi: mwifiex: remove unnecessary checks for valid priv Sascha Hauer
@ 2024-08-22 17:58 ` Brian Norris
0 siblings, 0 replies; 54+ messages in thread
From: Brian Norris @ 2024-08-22 17:58 UTC (permalink / raw)
To: Sascha Hauer
Cc: Francesco Dolcini, Kalle Valo, linux-wireless, linux-kernel,
kernel
On Tue, Aug 20, 2024 at 01:55:26PM +0200, Sascha Hauer wrote:
> 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 <s.hauer@pengutronix.de>
You already submitted this one separately, and it has now been merged.
^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: [PATCH 03/31] wifi: mwifiex: drop HostCmd_CMD_802_11_MAC_ADDRESS response handling
2024-08-20 11:55 ` [PATCH 03/31] wifi: mwifiex: drop HostCmd_CMD_802_11_MAC_ADDRESS response handling Sascha Hauer
@ 2024-08-22 18:07 ` Brian Norris
2024-08-26 9:07 ` Sascha Hauer
0 siblings, 1 reply; 54+ messages in thread
From: Brian Norris @ 2024-08-22 18:07 UTC (permalink / raw)
To: Sascha Hauer
Cc: Francesco Dolcini, Kalle Valo, linux-wireless, linux-kernel,
kernel
Hi Sascha,
On Tue, Aug 20, 2024 at 01:55:28PM +0200, Sascha Hauer wrote:
> 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.
It took a bit to figure out what you meant here -- I guess you're
referring to mwifiex_set_mac_address()? It could help to document what
you mean.
I'm also a bit torn; this command API ostensibly has a (unused so far,
for this command) HostCmd_ACT_GEN_GET mode, in which case this *is*
important.
If anything, I might consider dropping some of the handling in
mwifiex_set_mac_address(), because it seems to presume (and then has to
undo for failure) behavior of the underlying command.
Brian
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> 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);
>
> --
> 2.39.2
>
^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: [PATCH 11/31] wifi: mwifiex: use priv index as bss_num
2024-08-20 11:55 ` [PATCH 11/31] wifi: mwifiex: use priv index as bss_num Sascha Hauer
2024-08-22 5:48 ` Sascha Hauer
@ 2024-08-22 23:38 ` kernel test robot
1 sibling, 0 replies; 54+ messages in thread
From: kernel test robot @ 2024-08-22 23:38 UTC (permalink / raw)
To: Sascha Hauer, Brian Norris, Francesco Dolcini, Kalle Valo
Cc: oe-kbuild-all, linux-wireless, linux-kernel, kernel, Sascha Hauer
Hi Sascha,
kernel test robot noticed the following build warnings:
[auto build test WARNING on daaf0dd0398d5e93b7304f35184ca182ed583681]
url: https://github.com/intel-lab-lkp/linux/commits/Sascha-Hauer/wifi-mwifiex-remove-unnecessary-checks-for-valid-priv/20240820-200559
base: daaf0dd0398d5e93b7304f35184ca182ed583681
patch link: https://lore.kernel.org/r/20240820-mwifiex-cleanup-v1-11-320d8de4a4b7%40pengutronix.de
patch subject: [PATCH 11/31] wifi: mwifiex: use priv index as bss_num
config: arc-allmodconfig (https://download.01.org/0day-ci/archive/20240823/202408230753.OZVsdQpL-lkp@intel.com/config)
compiler: arceb-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240823/202408230753.OZVsdQpL-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408230753.OZVsdQpL-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/net/wireless/marvell/mwifiex/sta_event.c: In function 'mwifiex_process_multi_chan_event':
>> drivers/net/wireless/marvell/mwifiex/sta_event.c:419:23: warning: variable 'bss_type' set but not used [-Wunused-but-set-variable]
419 | int intf_num, bss_type, bss_num, i;
| ^~~~~~~~
vim +/bss_type +419 drivers/net/wireless/marvell/mwifiex/sta_event.c
ddd7ceb3f6dd90 drivers/net/wireless/mwifiex/sta_event.c Avinash Patil 2015-06-22 410
8d6b538a5eac1f drivers/net/wireless/mwifiex/sta_event.c Avinash Patil 2015-06-22 411 void mwifiex_process_multi_chan_event(struct mwifiex_private *priv,
8d6b538a5eac1f drivers/net/wireless/mwifiex/sta_event.c Avinash Patil 2015-06-22 412 struct sk_buff *event_skb)
8d6b538a5eac1f drivers/net/wireless/mwifiex/sta_event.c Avinash Patil 2015-06-22 413 {
8d6b538a5eac1f drivers/net/wireless/mwifiex/sta_event.c Avinash Patil 2015-06-22 414 struct mwifiex_ie_types_multi_chan_info *chan_info;
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 415 struct mwifiex_ie_types_mc_group_info *grp_info;
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 416 struct mwifiex_adapter *adapter = priv->adapter;
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 417 struct mwifiex_ie_types_header *tlv;
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 418 u16 tlv_buf_left, tlv_type, tlv_len;
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 @419 int intf_num, bss_type, bss_num, i;
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 420 struct mwifiex_private *intf_priv;
8d6b538a5eac1f drivers/net/wireless/mwifiex/sta_event.c Avinash Patil 2015-06-22 421
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 422 tlv_buf_left = event_skb->len - sizeof(u32);
8d6b538a5eac1f drivers/net/wireless/mwifiex/sta_event.c Avinash Patil 2015-06-22 423 chan_info = (void *)event_skb->data + sizeof(u32);
8d6b538a5eac1f drivers/net/wireless/mwifiex/sta_event.c Avinash Patil 2015-06-22 424
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 425 if (le16_to_cpu(chan_info->header.type) != TLV_TYPE_MULTI_CHAN_INFO ||
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 426 tlv_buf_left < sizeof(struct mwifiex_ie_types_multi_chan_info)) {
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 427 mwifiex_dbg(adapter, ERROR,
8d6b538a5eac1f drivers/net/wireless/mwifiex/sta_event.c Avinash Patil 2015-06-22 428 "unknown TLV in chan_info event\n");
8d6b538a5eac1f drivers/net/wireless/mwifiex/sta_event.c Avinash Patil 2015-06-22 429 return;
8d6b538a5eac1f drivers/net/wireless/mwifiex/sta_event.c Avinash Patil 2015-06-22 430 }
8d6b538a5eac1f drivers/net/wireless/mwifiex/sta_event.c Avinash Patil 2015-06-22 431
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 432 adapter->usb_mc_status = le16_to_cpu(chan_info->status);
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 433 mwifiex_dbg(adapter, EVENT, "multi chan operation %s\n",
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 434 adapter->usb_mc_status ? "started" : "over");
8d6b538a5eac1f drivers/net/wireless/mwifiex/sta_event.c Avinash Patil 2015-06-22 435
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 436 tlv_buf_left -= sizeof(struct mwifiex_ie_types_multi_chan_info);
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 437 tlv = (struct mwifiex_ie_types_header *)chan_info->tlv_buffer;
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 438
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 439 while (tlv_buf_left >= (int)sizeof(struct mwifiex_ie_types_header)) {
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 440 tlv_type = le16_to_cpu(tlv->type);
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 441 tlv_len = le16_to_cpu(tlv->len);
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 442 if ((sizeof(struct mwifiex_ie_types_header) + tlv_len) >
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 443 tlv_buf_left) {
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 444 mwifiex_dbg(adapter, ERROR, "wrong tlv: tlvLen=%d,\t"
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 445 "tlvBufLeft=%d\n", tlv_len, tlv_buf_left);
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 446 break;
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 447 }
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 448 if (tlv_type != TLV_TYPE_MC_GROUP_INFO) {
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 449 mwifiex_dbg(adapter, ERROR, "wrong tlv type: 0x%x\n",
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 450 tlv_type);
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 451 break;
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 452 }
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 453
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 454 grp_info = (struct mwifiex_ie_types_mc_group_info *)tlv;
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 455 intf_num = grp_info->intf_num;
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 456 for (i = 0; i < intf_num; i++) {
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 457 bss_type = grp_info->bss_type_numlist[i] >> 4;
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 458 bss_num = grp_info->bss_type_numlist[i] & BSS_NUM_MASK;
92ace9c7fa9726 drivers/net/wireless/marvell/mwifiex/sta_event.c Sascha Hauer 2024-08-20 459 intf_priv = mwifiex_get_priv_by_id(adapter, bss_num);
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 460 if (!intf_priv) {
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 461 mwifiex_dbg(adapter, ERROR,
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 462 "Invalid bss_type bss_num\t"
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 463 "in multi channel event\n");
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 464 continue;
8d6b538a5eac1f drivers/net/wireless/mwifiex/sta_event.c Avinash Patil 2015-06-22 465 }
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 466 if (adapter->iface_type == MWIFIEX_USB) {
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 467 u8 ep;
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 468
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 469 ep = grp_info->hid_num.usb_ep_num;
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 470 if (ep == MWIFIEX_USB_EP_DATA ||
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 471 ep == MWIFIEX_USB_EP_DATA_CH2)
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 472 intf_priv->usb_port = ep;
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 473 }
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 474 }
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 475
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 476 tlv_buf_left -= sizeof(struct mwifiex_ie_types_header) +
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 477 tlv_len;
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 478 tlv = (void *)((u8 *)tlv + tlv_len +
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 479 sizeof(struct mwifiex_ie_types_header));
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 480 }
2b0f997db43f01 drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 481
7e4e5d2cd0817b drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 482 if (adapter->iface_type == MWIFIEX_USB) {
7e4e5d2cd0817b drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 483 adapter->tx_lock_flag = true;
7e4e5d2cd0817b drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 484 adapter->usb_mc_setup = true;
7e4e5d2cd0817b drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 485 mwifiex_multi_chan_resync(adapter);
7e4e5d2cd0817b drivers/net/wireless/mwifiex/sta_event.c Zhaoyang Liu 2015-09-18 486 }
8d6b538a5eac1f drivers/net/wireless/mwifiex/sta_event.c Avinash Patil 2015-06-22 487 }
8d6b538a5eac1f drivers/net/wireless/mwifiex/sta_event.c Avinash Patil 2015-06-22 488
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: [PATCH 03/31] wifi: mwifiex: drop HostCmd_CMD_802_11_MAC_ADDRESS response handling
2024-08-22 18:07 ` Brian Norris
@ 2024-08-26 9:07 ` Sascha Hauer
2024-08-26 22:44 ` Brian Norris
0 siblings, 1 reply; 54+ messages in thread
From: Sascha Hauer @ 2024-08-26 9:07 UTC (permalink / raw)
To: Brian Norris
Cc: Kalle Valo, linux-wireless, Francesco Dolcini, kernel,
linux-kernel
On Thu, Aug 22, 2024 at 11:07:35AM -0700, Brian Norris wrote:
> Hi Sascha,
>
> On Tue, Aug 20, 2024 at 01:55:28PM +0200, Sascha Hauer wrote:
> > 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.
>
> It took a bit to figure out what you meant here -- I guess you're
> referring to mwifiex_set_mac_address()? It could help to document what
> you mean.
Ok, I can clarify this a bit when sending this next time.
Right now what we have is:
1) mwifiex_set_mac_address() sets priv->curr_addr to the desired new MAC
address
2) mwifiex_cmd_802_11_mac_address() (called from mwifiex_send_cmd())
constructs the HostCmd_CMD_802_11_MAC_ADDRESS command, using the MAC
address in priv->curr_addr
3) mwifiex_ret_802_11_mac_address(), called from the response handler,
sets priv->curr_addr to the MAC address received with the command
response, which of course is the same as we initially copied there
in step 1), which makes 3) redundant and unnecessary
>
> I'm also a bit torn; this command API ostensibly has a (unused so far,
> for this command) HostCmd_ACT_GEN_GET mode, in which case this *is*
> important.
>
> If anything, I might consider dropping some of the handling in
> mwifiex_set_mac_address(), because it seems to presume (and then has to
> undo for failure) behavior of the underlying command.
What we could do instead of dropping 3) is:
1) pass the new MAC address in the data_buf argument to
mwifiex_send_cmd()
2) instead of priv->curr_addr use data_buf in
mwifiex_cmd_802_11_mac_address()
With this the response handler would still set priv->curr_addr in case
the command went through successfully. No need to undo priv->curr_addr
to the previous MAC address in case the command failed.
Sounds good to me. Is that where you aiming at?
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: [EXT] [PATCH 10/31] wifi: mwifiex: fix indention
2024-08-22 9:36 ` [EXT] " David Lin
2024-08-22 9:53 ` Marc Kleine-Budde
@ 2024-08-26 9:37 ` Sascha Hauer
2024-08-26 9:48 ` David Lin
1 sibling, 1 reply; 54+ messages in thread
From: Sascha Hauer @ 2024-08-26 9:37 UTC (permalink / raw)
To: David Lin
Cc: Brian Norris, Francesco Dolcini, Kalle Valo,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@pengutronix.de
On Thu, Aug 22, 2024 at 09:36:29AM +0000, David Lin wrote:
> > From: Sascha Hauer <s.hauer@pengutronix.de>
> > Sent: Tuesday, August 20, 2024 7:56 PM
> > To: Brian Norris <briannorris@chromium.org>; Francesco Dolcini
> > <francesco@dolcini.it>; Kalle Valo <kvalo@kernel.org>
> > Cc: linux-wireless@vger.kernel.org; linux-kernel@vger.kernel.org;
> > kernel@pengutronix.de; Sascha Hauer <s.hauer@pengutronix.de>
> > Subject: [EXT] [PATCH 10/31] wifi: mwifiex: fix indention
> >
> > Align multiline if() under the opening brace.
> >
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> > 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
> >
> > --
> > 2.39.2
> >
>
> I wonder we still need patch for indent issue here? If so I am sure we
> will need a bunch of similar patches which I don't think really help
> improve mwifiex quality
>
> Actually in its successor Nxpwifi (currently under review), we have
> cleaned up all indent, and checkpatch errors/warnings/checks.
BTW you advertised nxpwifi not as a successor to mwifiex, but as the
driver to be used for new chips. This means we still have to deal with
the mwifiex driver in the future to support the old chips, so even if
nxpwifi is merged it still makes sense to clean up mwifiex.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 54+ messages in thread
* RE: [EXT] [PATCH 10/31] wifi: mwifiex: fix indention
2024-08-26 9:37 ` Sascha Hauer
@ 2024-08-26 9:48 ` David Lin
2024-08-26 10:17 ` Sascha Hauer
0 siblings, 1 reply; 54+ messages in thread
From: David Lin @ 2024-08-26 9:48 UTC (permalink / raw)
To: Sascha Hauer
Cc: Brian Norris, Francesco Dolcini, Kalle Valo,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@pengutronix.de, Pete Hsieh
> From: Sascha Hauer <s.hauer@pengutronix.de>
> Sent: Monday, August 26, 2024 5:37 PM
> To: David Lin <yu-hao.lin@nxp.com>
> Cc: Brian Norris <briannorris@chromium.org>; Francesco Dolcini
> <francesco@dolcini.it>; Kalle Valo <kvalo@kernel.org>;
> linux-wireless@vger.kernel.org; linux-kernel@vger.kernel.org;
> kernel@pengutronix.de
> Subject: Re: [EXT] [PATCH 10/31] wifi: mwifiex: fix indention
>
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report
> this email' button
>
>
> On Thu, Aug 22, 2024 at 09:36:29AM +0000, David Lin wrote:
> > > From: Sascha Hauer <s.hauer@pengutronix.de>
> > > Sent: Tuesday, August 20, 2024 7:56 PM
> > > To: Brian Norris <briannorris@chromium.org>; Francesco Dolcini
> > > <francesco@dolcini.it>; Kalle Valo <kvalo@kernel.org>
> > > Cc: linux-wireless@vger.kernel.org; linux-kernel@vger.kernel.org;
> > > kernel@pengutronix.de; Sascha Hauer <s.hauer@pengutronix.de>
> > > Subject: [EXT] [PATCH 10/31] wifi: mwifiex: fix indention
> > >
> > > Align multiline if() under the opening brace.
> > >
> > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > > ---
> > > 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
> > >
> > > --
> > > 2.39.2
> > >
> >
> > I wonder we still need patch for indent issue here? If so I am sure we
> > will need a bunch of similar patches which I don't think really help
> > improve mwifiex quality
> >
> > Actually in its successor Nxpwifi (currently under review), we have
> > cleaned up all indent, and checkpatch errors/warnings/checks.
>
> BTW you advertised nxpwifi not as a successor to mwifiex, but as the driver to
> be used for new chips. This means we still have to deal with the mwifiex driver
> in the future to support the old chips, so even if nxpwifi is merged it still makes
> sense to clean up mwifiex.
>
> Sascha
>
Just like what I listed for the errors/warning/checks of Mwifiex running with checkpatch.
Mwifiex has so many issues. As the driver will only support legacy devices and the state of
it is "Odd fixes", It is better to fix really bugs of Mwifiex instead of cleanup it.
David
^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: [EXT] [PATCH 10/31] wifi: mwifiex: fix indention
2024-08-26 9:48 ` David Lin
@ 2024-08-26 10:17 ` Sascha Hauer
0 siblings, 0 replies; 54+ messages in thread
From: Sascha Hauer @ 2024-08-26 10:17 UTC (permalink / raw)
To: David Lin
Cc: Brian Norris, Francesco Dolcini, Kalle Valo,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@pengutronix.de, Pete Hsieh
On Mon, Aug 26, 2024 at 09:48:38AM +0000, David Lin wrote:
> > From: Sascha Hauer <s.hauer@pengutronix.de>
> > Sent: Monday, August 26, 2024 5:37 PM
> > To: David Lin <yu-hao.lin@nxp.com>
> > Cc: Brian Norris <briannorris@chromium.org>; Francesco Dolcini
> > <francesco@dolcini.it>; Kalle Valo <kvalo@kernel.org>;
> > linux-wireless@vger.kernel.org; linux-kernel@vger.kernel.org;
> > kernel@pengutronix.de
> > Subject: Re: [EXT] [PATCH 10/31] wifi: mwifiex: fix indention
> >
> > Caution: This is an external email. Please take care when clicking links or
> > opening attachments. When in doubt, report the message using the 'Report
> > this email' button
> >
> >
> > On Thu, Aug 22, 2024 at 09:36:29AM +0000, David Lin wrote:
> > > > From: Sascha Hauer <s.hauer@pengutronix.de>
> > > > Sent: Tuesday, August 20, 2024 7:56 PM
> > > > To: Brian Norris <briannorris@chromium.org>; Francesco Dolcini
> > > > <francesco@dolcini.it>; Kalle Valo <kvalo@kernel.org>
> > > > Cc: linux-wireless@vger.kernel.org; linux-kernel@vger.kernel.org;
> > > > kernel@pengutronix.de; Sascha Hauer <s.hauer@pengutronix.de>
> > > > Subject: [EXT] [PATCH 10/31] wifi: mwifiex: fix indention
> > > >
> > > > Align multiline if() under the opening brace.
> > > >
> > > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > > > ---
> > > > 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
> > > >
> > > > --
> > > > 2.39.2
> > > >
> > >
> > > I wonder we still need patch for indent issue here? If so I am sure we
> > > will need a bunch of similar patches which I don't think really help
> > > improve mwifiex quality
> > >
> > > Actually in its successor Nxpwifi (currently under review), we have
> > > cleaned up all indent, and checkpatch errors/warnings/checks.
> >
> > BTW you advertised nxpwifi not as a successor to mwifiex, but as the driver to
> > be used for new chips. This means we still have to deal with the mwifiex driver
> > in the future to support the old chips, so even if nxpwifi is merged it still makes
> > sense to clean up mwifiex.
> >
> > Sascha
> >
>
> Just like what I listed for the errors/warning/checks of Mwifiex running with checkpatch.
> Mwifiex has so many issues. As the driver will only support legacy devices and the state of
> it is "Odd fixes", It is better to fix really bugs of Mwifiex instead of cleanup it.
The way you use "legacy" is from a silicon vendors perspective. Many
real users only start to use a chip when it's already legacy for the
silicon vendor.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 54+ messages in thread
* Re: [PATCH 03/31] wifi: mwifiex: drop HostCmd_CMD_802_11_MAC_ADDRESS response handling
2024-08-26 9:07 ` Sascha Hauer
@ 2024-08-26 22:44 ` Brian Norris
0 siblings, 0 replies; 54+ messages in thread
From: Brian Norris @ 2024-08-26 22:44 UTC (permalink / raw)
To: Sascha Hauer
Cc: Kalle Valo, linux-wireless, Francesco Dolcini, kernel,
linux-kernel
Hi Sascha,
On Mon, Aug 26, 2024 at 11:07:03AM +0200, Sascha Hauer wrote:
> On Thu, Aug 22, 2024 at 11:07:35AM -0700, Brian Norris wrote:
> > Hi Sascha,
> >
> > On Tue, Aug 20, 2024 at 01:55:28PM +0200, Sascha Hauer wrote:
> > > 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.
> >
> > It took a bit to figure out what you meant here -- I guess you're
> > referring to mwifiex_set_mac_address()? It could help to document what
> > you mean.
>
> Ok, I can clarify this a bit when sending this next time.
>
> Right now what we have is:
>
> 1) mwifiex_set_mac_address() sets priv->curr_addr to the desired new MAC
> address
> 2) mwifiex_cmd_802_11_mac_address() (called from mwifiex_send_cmd())
> constructs the HostCmd_CMD_802_11_MAC_ADDRESS command, using the MAC
> address in priv->curr_addr
> 3) mwifiex_ret_802_11_mac_address(), called from the response handler,
> sets priv->curr_addr to the MAC address received with the command
> response, which of course is the same as we initially copied there
> in step 1), which makes 3) redundant and unnecessary
Ack, that's the understanding I got, but it took a bit of reading to get
there.
> > I'm also a bit torn; this command API ostensibly has a (unused so far,
> > for this command) HostCmd_ACT_GEN_GET mode, in which case this *is*
> > important.
> >
> > If anything, I might consider dropping some of the handling in
> > mwifiex_set_mac_address(), because it seems to presume (and then has to
> > undo for failure) behavior of the underlying command.
>
> What we could do instead of dropping 3) is:
>
> 1) pass the new MAC address in the data_buf argument to
> mwifiex_send_cmd()
> 2) instead of priv->curr_addr use data_buf in
> mwifiex_cmd_802_11_mac_address()
>
> With this the response handler would still set priv->curr_addr in case
> the command went through successfully. No need to undo priv->curr_addr
> to the previous MAC address in case the command failed.
>
> Sounds good to me. Is that where you aiming at?
Yes, that seems about right.
Brian
^ permalink raw reply [flat|nested] 54+ messages in thread
end of thread, other threads:[~2024-08-26 22:44 UTC | newest]
Thread overview: 54+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-20 11:55 [PATCH 00/31] wifi: mwifiex: cleanup driver Sascha Hauer
2024-08-20 11:55 ` [PATCH 01/31] wifi: mwifiex: remove unnecessary checks for valid priv Sascha Hauer
2024-08-22 17:58 ` Brian Norris
2024-08-20 11:55 ` [PATCH 02/31] wifi: mwifiex: use adapter as context pointer for mwifiex_hs_activated_event() Sascha Hauer
2024-08-20 11:55 ` [PATCH 03/31] wifi: mwifiex: drop HostCmd_CMD_802_11_MAC_ADDRESS response handling Sascha Hauer
2024-08-22 18:07 ` Brian Norris
2024-08-26 9:07 ` Sascha Hauer
2024-08-26 22:44 ` Brian Norris
2024-08-20 11:55 ` [PATCH 04/31] wifi: mwifiex: drop unnecessary initialization Sascha Hauer
2024-08-20 11:55 ` [PATCH 05/31] wifi: mwifiex: make region_code_mapping_t const Sascha Hauer
2024-08-20 11:55 ` [PATCH 06/31] wifi: mwifiex: use mwifiex_deauthenticate_all() Sascha Hauer
2024-08-20 11:55 ` [PATCH 07/31] wifi: mwifiex: pass adapter to mwifiex_dnld_cmd_to_fw() Sascha Hauer
2024-08-20 11:55 ` [PATCH 08/31] wifi: mwifiex: simplify mwifiex_setup_ht_caps() Sascha Hauer
2024-08-20 11:55 ` [PATCH 09/31] wifi: mwifiex: deduplicate code in mwifiex_cmd_tx_rate_cfg() Sascha Hauer
2024-08-20 11:55 ` [PATCH 10/31] wifi: mwifiex: fix indention Sascha Hauer
2024-08-22 9:36 ` [EXT] " David Lin
2024-08-22 9:53 ` Marc Kleine-Budde
2024-08-22 10:44 ` Marc Kleine-Budde
2024-08-22 11:59 ` David Lin
2024-08-22 12:05 ` Marc Kleine-Budde
2024-08-22 12:11 ` David Lin
2024-08-22 12:20 ` Marc Kleine-Budde
2024-08-26 9:37 ` Sascha Hauer
2024-08-26 9:48 ` David Lin
2024-08-26 10:17 ` Sascha Hauer
2024-08-20 11:55 ` [PATCH 11/31] wifi: mwifiex: use priv index as bss_num Sascha Hauer
2024-08-22 5:48 ` Sascha Hauer
2024-08-22 23:38 ` kernel test robot
2024-08-20 11:55 ` [PATCH 12/31] wifi: mwifiex: fix MAC address handling Sascha Hauer
2024-08-20 11:55 ` [PATCH 13/31] wifi: mwifiex: drop driver internal AP/STA limit counting Sascha Hauer
2024-08-20 11:55 ` [PATCH 14/31] wifi: mwifiex: iterate over privs in mwifiex_process_assoc_resp() Sascha Hauer
2024-08-20 11:55 ` [PATCH 15/31] wifi: mwifiex: add missing locking Sascha Hauer
2024-08-20 11:55 ` [PATCH 16/31] wifi: mwifiex: make locally used function static Sascha Hauer
2024-08-20 11:55 ` [PATCH 17/31] wifi: mwifiex: fix multiple station handling Sascha Hauer
2024-08-20 11:55 ` [PATCH 18/31] wifi: mwifiex: make mwifiex_enable_hs() safe for multiple station mode Sascha Hauer
2024-08-20 11:55 ` [PATCH 19/31] wifi: mwifiex: add function to send command specific to the adapter Sascha Hauer
2024-08-20 11:55 ` [PATCH 20/31] wifi: mwifiex: pass adapter to host sleep functions Sascha Hauer
2024-08-20 11:55 ` [PATCH 21/31] wifi: mwifiex: associate tx_power to the adapter Sascha Hauer
2024-08-20 11:55 ` [PATCH 22/31] wifi: mwifiex: pass adapter to mwifiex_init_shutdown_fw() Sascha Hauer
2024-08-20 11:55 ` [PATCH 23/31] wifi: mwifiex: pass adapter to mwifiex_disable_auto_ds() Sascha Hauer
2024-08-20 11:55 ` [PATCH 24/31] wifi: mwifiex: make txpwr specific to adapter Sascha Hauer
2024-08-20 11:55 ` [PATCH 25/31] wifi: mwifiex: return error on unexpected bss_num Sascha Hauer
2024-08-20 11:55 ` [PATCH 26/31] wifi: mwifiex: coalesce rules are adapter specific Sascha Hauer
2024-08-20 11:55 ` [PATCH 27/31] wifi: mwifiex: do not use mwifiex_get_priv() in mwifiex_dnld_sleep_confirm_cmd() Sascha Hauer
2024-08-20 11:55 ` [PATCH 28/31] wifi: mwifiex: move rx_ant/tx_ant to adapter Sascha Hauer
2024-08-20 11:55 ` [PATCH 29/31] wifi: mwifiex: pass adapter to mwifiex_fw_dump_event() Sascha Hauer
2024-08-20 11:55 ` [PATCH 30/31] wifi: mwifiex: move common settings out of switch/case Sascha Hauer
2024-08-20 11:55 ` [PATCH 31/31] wifi: mwifiex: allow to set MAC address in add_virtual_intf() Sascha Hauer
2024-08-20 13:34 ` [PATCH 00/31] wifi: mwifiex: cleanup driver Francesco Dolcini
2024-08-21 11:11 ` Sascha Hauer
2024-08-21 11:33 ` Sascha Hauer
2024-08-20 17:42 ` Kalle Valo
2024-08-21 11:12 ` Sascha Hauer
2024-08-21 14:07 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).