From nobody Fri Nov 29 15:35:46 2024 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED9B218A932 for ; Wed, 18 Sep 2024 11:10:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726657842; cv=none; b=dm29GS27DvEc5J+a25mlDO1I+30nPUC4d8DKQUmPjkNugM1h74cD4/0UKWpk8uoZOt1uH8kD5Nd5ezjzm0xjSvpMagFki4pHCJrUfo8K7NrOlmWe6L/GyAIHwBVDz+ikyWVbcfCsKKzMNYFNm+rhuY+LsM9KkCvZMx49kNjDmXs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726657842; c=relaxed/simple; bh=L7BvnIL4DXQmcjzasQtcRSJHZGaDYANoGBFLqeozp6s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=espBggbR0HpaCRIufNacleUvM1jz+vwJIwnfK3jE8U6AMR5BpNNMmpSdUPVyENhwqd29+6tFC8Q7RPRliVrrPdiL2SOPpb7qj3n5WUM6QpZ+TnW44A2qjOwbdmSpQAM9kSIiladY44RgxSD+UGCmjTb6Qf42JDl+OhJGX0A6e5s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sqsZs-0007wc-Pi; Wed, 18 Sep 2024 13:10:32 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqsZr-008nT6-Dh; Wed, 18 Sep 2024 13:10:31 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sqsZr-0086AC-14; Wed, 18 Sep 2024 13:10:31 +0200 From: Sascha Hauer Date: Wed, 18 Sep 2024 13:10:26 +0200 Subject: [PATCH v2 01/12] wifi: mwifiex: add missing locking Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240918-mwifiex-cleanup-1-v2-1-2d0597187d3c@pengutronix.de> References: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> In-Reply-To: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, David Lin , kernel@pengutronix.de, Sascha Hauer , Francesco Dolcini X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1726657831; l=1673; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=L7BvnIL4DXQmcjzasQtcRSJHZGaDYANoGBFLqeozp6s=; b=Ba4x/t+6l0pf5YwCfdgP3q0rpRO38vnCK9uf64/8WomytVrzVrQkq/nppHlkT73KV7HwZTMLr aJtw94t62BVBcAPdjuUCab4+ldgnH9SsldDGSaeh60EJrxydii4cVWe X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org cfg80211_rx_assoc_resp() and cfg80211_rx_mlme_mgmt() need to be called with the wiphy locked, so lock it before calling these functions. Fixes: 36995892c271 ("wifi: mwifiex: add host mlme for client mode") Reviewed-by: Francesco Dolcini Signed-off-by: Sascha Hauer Acked-by: Brian Norris --- 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/wi= reless/marvell/mwifiex/cmdevt.c index 7894102f03eb0..cdfb307e75131 100644 --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c @@ -938,8 +938,10 @@ void mwifiex_process_assoc_resp(struct mwifiex_adapter= *adapter) assoc_resp.links[0].bss =3D priv->req_bss; assoc_resp.buf =3D priv->assoc_rsp_buf; assoc_resp.len =3D 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 =3D 0; } } diff --git a/drivers/net/wireless/marvell/mwifiex/util.c b/drivers/net/wire= less/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 *pri= v, } } =20 + wiphy_lock(priv->wdev.wiphy); cfg80211_rx_mlme_mgmt(priv->netdev, skb->data, pkt_len); + wiphy_unlock(priv->wdev.wiphy); } =20 if (priv->adapter->host_mlme_enabled && --=20 2.39.5 From nobody Fri Nov 29 15:35:46 2024 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFC48187856 for ; Wed, 18 Sep 2024 11:10:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726657850; cv=none; b=o2hTCHEKrcUJtmR329/EZABreVUBEFPjNULf4kncOdd3fgSWPvmIL4VAgt8uBWLbaLMIr8ULz+E7NTp+ywmnyn7pqxvJAPxXyUTOzGUUDoJWOEp2QB65lKQ8UTNjQpksQJ6Ab2ODShC6clP2a4zAWYjHceGGNbXMxKlRfwb/vEc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726657850; c=relaxed/simple; bh=KS72d0ZEGRYTFdYR6T+6p1PGNEzCWGqS/6xdjrFeQbg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JU1Z1C3EGcbPxzSXw6caVnbjLvp/+P3+k3CdBxL1Sk+qFAdXQ3Q1qayK7WUzpoI9HmnljqeSvocTnlnXCUnOlMslgoLoLNMLrxsgx1/pnu7uNnHVoLhcDVTRI+xBP5WXcjc9AcZhn8iy6hT17YWD21t995hYJuVfajKbGXMZt78= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sqsZs-0007wg-Fz; Wed, 18 Sep 2024 13:10:32 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqsZr-008nT7-EV; Wed, 18 Sep 2024 13:10:31 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sqsZr-0086AC-15; Wed, 18 Sep 2024 13:10:31 +0200 From: Sascha Hauer Date: Wed, 18 Sep 2024 13:10:27 +0200 Subject: [PATCH v2 02/12] wifi: mwifiex: fix MAC address handling Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240918-mwifiex-cleanup-1-v2-2-2d0597187d3c@pengutronix.de> References: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> In-Reply-To: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, David Lin , kernel@pengutronix.de, Sascha Hauer , stable@vger.kernel.org X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1726657831; l=7233; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=KS72d0ZEGRYTFdYR6T+6p1PGNEzCWGqS/6xdjrFeQbg=; b=gZ96CbXVT+4f6VwoTrDd7s6hde/FcpMy3U/smM0KXjAHd5TA7XVHXRxHeQO1g5x32cwbKTXGx Fex7gX2o9ohCqF1NC6uoMnw3pWNHIqoCmZfY49cj3ZRrTKuapDx0urO X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org The mwifiex driver tries to derive the MAC addresses of the virtual interfaces from the permanent address by adding the bss_num of the particular interface used. It does so each time the virtual interface is changed from AP to station or the other way round. This means that the devices MAC address changes during a change_virtual_intf call which is pretty unexpected by userspace. Furthermore the driver doesn't use the permanent address to add the bss_num to, but instead the current MAC address increases each time we do a change_virtual_intf. Fix this by initializing the MAC address once from the permanent MAC address during creation of the virtual interface and never touch 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. It is not clear how many (if any) MAC addresses after the permanent MAC address are reserved for a device, so set the locally admistered bit for all MAC addresses derived from the permanent address. With this patch MWIFIEX_BSS_TYPE_ANY becomes unused, so it's removed. Signed-off-by: Sascha Hauer Cc: stable@vger.kernel.org --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 4 +- drivers/net/wireless/marvell/mwifiex/decl.h | 1 - drivers/net/wireless/marvell/mwifiex/init.c | 1 - drivers/net/wireless/marvell/mwifiex/main.c | 54 ++++++++++++---------= ---- drivers/net/wireless/marvell/mwifiex/main.h | 5 ++- 5 files changed, 30 insertions(+), 35 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/= wireless/marvell/mwifiex/cfg80211.c index 5697a02e6b8d3..d3e1424bea390 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -962,8 +962,6 @@ mwifiex_init_new_priv_params(struct mwifiex_private *pr= iv, adapter->rx_locked =3D false; spin_unlock_bh(&adapter->rx_proc_lock); =20 - mwifiex_set_mac_address(priv, dev, false, NULL); - return 0; } =20 @@ -3115,7 +3113,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct = wiphy *wiphy, priv->netdev =3D dev; =20 if (!adapter->mfg_mode) { - mwifiex_set_mac_address(priv, dev, false, NULL); + mwifiex_set_default_mac_address(priv, dev); =20 ret =3D mwifiex_send_cmd(priv, HostCmd_CMD_SET_BSS_MODE, HostCmd_ACT_GEN_SET, 0, NULL, true); diff --git a/drivers/net/wireless/marvell/mwifiex/decl.h b/drivers/net/wire= less/marvell/mwifiex/decl.h index 84603f1e7f6e0..d84773321dc47 100644 --- a/drivers/net/wireless/marvell/mwifiex/decl.h +++ b/drivers/net/wireless/marvell/mwifiex/decl.h @@ -139,7 +139,6 @@ enum mwifiex_bss_type { MWIFIEX_BSS_TYPE_STA =3D 0, MWIFIEX_BSS_TYPE_UAP =3D 1, MWIFIEX_BSS_TYPE_P2P =3D 2, - MWIFIEX_BSS_TYPE_ANY =3D 0xff, }; =20 enum mwifiex_bss_role { diff --git a/drivers/net/wireless/marvell/mwifiex/init.c b/drivers/net/wire= less/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; =20 priv->media_connected =3D false; - eth_broadcast_addr(priv->curr_addr); priv->port_open =3D false; priv->usb_port =3D MWIFIEX_USB_EP_DATA; priv->pkt_tx_ctrl =3D 0; diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wire= less/marvell/mwifiex/main.c index 96d1f6039fbca..46acddd03ffd1 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -971,34 +971,16 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct n= et_device *dev) } =20 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; =20 - old_mac_addr =3D ether_addr_to_u64(priv->curr_addr); + netdev_info(dev, "%s: old: %pM new: %pM\n", __func__, priv->curr_addr, ne= w_mac); =20 - if (external) { - mac_addr =3D ether_addr_to_u64(new_mac); - } else { - /* Internal mac address change */ - if (priv->bss_type =3D=3D MWIFIEX_BSS_TYPE_ANY) - return -EOPNOTSUPP; - - mac_addr =3D old_mac_addr; - - if (priv->bss_type =3D=3D MWIFIEX_BSS_TYPE_P2P) { - mac_addr |=3D BIT_ULL(MWIFIEX_MAC_LOCAL_ADMIN_BIT); - mac_addr +=3D priv->bss_num; - } else if (priv->adapter->priv[0] !=3D priv) { - /* Set mac address based on bss_type/bss_num */ - mac_addr ^=3D BIT_ULL(priv->bss_type + 8); - mac_addr +=3D priv->bss_num; - } - } + old_mac_addr =3D ether_addr_to_u64(priv->curr_addr); =20 - u64_to_ether_addr(mac_addr, priv->curr_addr); + ether_addr_copy(priv->curr_addr, new_mac); =20 /* Send request to firmware */ ret =3D mwifiex_send_cmd(priv, HostCmd_CMD_802_11_MAC_ADDRESS, @@ -1015,6 +997,26 @@ int mwifiex_set_mac_address(struct mwifiex_private *p= riv, return 0; } =20 +int mwifiex_set_default_mac_address(struct mwifiex_private *priv, + struct net_device *dev) +{ + int priv_num; + u8 mac[ETH_ALEN]; + + ether_addr_copy(mac, priv->adapter->perm_addr); + + for (priv_num =3D 0; priv_num < priv->adapter->priv_num; priv_num++) + if (priv =3D=3D priv->adapter->priv[priv_num]) + break; + + if (priv_num) { + eth_addr_add(mac, priv_num); + mac[0] |=3D 0x2; + } + + return mwifiex_set_mac_address(priv, dev, mac); +} + /* CFG802.11 network device handler for setting MAC address. */ static int @@ -1023,7 +1025,7 @@ mwifiex_ndo_set_mac_address(struct net_device *dev, v= oid *addr) struct mwifiex_private *priv =3D mwifiex_netdev_get_priv(dev); struct sockaddr *hw_addr =3D addr; =20 - return mwifiex_set_mac_address(priv, dev, true, hw_addr->sa_data); + return mwifiex_set_mac_address(priv, dev, hw_addr->sa_data); } =20 /* @@ -1364,10 +1366,6 @@ void mwifiex_init_priv_params(struct mwifiex_private= *priv, priv->assocresp_idx =3D MWIFIEX_AUTO_IDX_MASK; priv->gen_idx =3D MWIFIEX_AUTO_IDX_MASK; priv->num_tx_timeout =3D 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); =20 if (GET_BSS_ROLE(priv) =3D=3D MWIFIEX_BSS_ROLE_STA || GET_BSS_ROLE(priv) =3D=3D MWIFIEX_BSS_ROLE_UAP) { diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wire= less/marvell/mwifiex/main.h index 529863edd7a25..dc07eb11f7752 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -1694,8 +1694,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); =20 #ifdef CONFIG_DEBUG_FS --=20 2.39.5 From nobody Fri Nov 29 15:35:46 2024 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D528918DF76 for ; Wed, 18 Sep 2024 11:10:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726657847; cv=none; b=tK6Z+k1FKLbcX+0LUOdd+u33W/Xr+41/G9nvpYut6zf2aeUMnyjqOAwe+tqwPwNMgCQWwAi+XVLIvxJKwBcs8/HYMi0mZJuREDKbzP9ogXlxVhi41IxtchaCz39gqsm7k8JwpU6gyiumuYLIVlbWKSgjEEZ6g9skvgcL36JoATA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726657847; c=relaxed/simple; bh=YJf7CTJU9cjm7wgH3iWlza8QlTGiJ6PyQ1angbO+zjg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gdAGWNPZsSry9TwDmONloIitQXrlK6sufjZyUjqvODMDFyDzdmuWsA9UggFiT+CmcNEkWmeobQRB70akGeGyjxZD37V6lQ/amQtguRxwgL8KqWz2tGxRZvEDBCybK5ptYIH3zbTywSW83sBcMHmSvvVsIGZf1xObS4UO5EIeirU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sqsZs-0007wf-Pi; Wed, 18 Sep 2024 13:10:32 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqsZr-008nT8-F1; Wed, 18 Sep 2024 13:10:31 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sqsZr-0086AC-17; Wed, 18 Sep 2024 13:10:31 +0200 From: Sascha Hauer Date: Wed, 18 Sep 2024 13:10:28 +0200 Subject: [PATCH v2 03/12] wifi: mwifiex: deduplicate code in mwifiex_cmd_tx_rate_cfg() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240918-mwifiex-cleanup-1-v2-3-2d0597187d3c@pengutronix.de> References: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> In-Reply-To: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, David Lin , kernel@pengutronix.de, Sascha Hauer , Francesco Dolcini X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1726657831; l=3171; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=YJf7CTJU9cjm7wgH3iWlza8QlTGiJ6PyQ1angbO+zjg=; b=bfcCn6q3oxkvT+xrcU4RDhU5uBTI939HOToIYjAoWG33rI10vSxlnKEVYkOrFYzv/HnyL+id9 aEBCtUQpKk1A6uRpSh2b4/PoTprxthBvxWjr1UwjpfxO993g8tkZHHi X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org The code block inside the if/else is the same with just using pbitmap_rates if non NULL or priv->bitmap_rates otherwise. Deduplicate the code by picking the correct pointer first and then using it unconditionally. Reviewed-by: Francesco Dolcini Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 43 +++++++++-------------= ---- 1 file changed, 14 insertions(+), 29 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/w= ireless/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 =3D &cmd->params.tx_rate_cfg; struct mwifiex_rate_scope *rate_scope; @@ -174,34 +174,19 @@ static int mwifiex_cmd_tx_rate_cfg(struct mwifiex_pri= vate *priv, rate_scope->type =3D cpu_to_le16(TLV_TYPE_RATE_SCOPE); rate_scope->length =3D cpu_to_le16 (sizeof(*rate_scope) - sizeof(struct mwifiex_ie_types_header)); - if (pbitmap_rates !=3D NULL) { - rate_scope->hr_dsss_rate_bitmap =3D cpu_to_le16(pbitmap_rates[0]); - rate_scope->ofdm_rate_bitmap =3D cpu_to_le16(pbitmap_rates[1]); - for (i =3D 0; i < ARRAY_SIZE(rate_scope->ht_mcs_rate_bitmap); i++) - rate_scope->ht_mcs_rate_bitmap[i] =3D - cpu_to_le16(pbitmap_rates[2 + i]); - if (priv->adapter->fw_api_ver =3D=3D MWIFIEX_FW_V15) { - for (i =3D 0; - i < ARRAY_SIZE(rate_scope->vht_mcs_rate_bitmap); - i++) - rate_scope->vht_mcs_rate_bitmap[i] =3D - cpu_to_le16(pbitmap_rates[10 + i]); - } - } else { - rate_scope->hr_dsss_rate_bitmap =3D - cpu_to_le16(priv->bitmap_rates[0]); - rate_scope->ofdm_rate_bitmap =3D - cpu_to_le16(priv->bitmap_rates[1]); - for (i =3D 0; i < ARRAY_SIZE(rate_scope->ht_mcs_rate_bitmap); i++) - rate_scope->ht_mcs_rate_bitmap[i] =3D - cpu_to_le16(priv->bitmap_rates[2 + i]); - if (priv->adapter->fw_api_ver =3D=3D MWIFIEX_FW_V15) { - for (i =3D 0; - i < ARRAY_SIZE(rate_scope->vht_mcs_rate_bitmap); - i++) - rate_scope->vht_mcs_rate_bitmap[i] =3D - cpu_to_le16(priv->bitmap_rates[10 + i]); - } + if (!pbitmap_rates) + pbitmap_rates =3D priv->bitmap_rates; + + rate_scope->hr_dsss_rate_bitmap =3D cpu_to_le16(pbitmap_rates[0]); + rate_scope->ofdm_rate_bitmap =3D cpu_to_le16(pbitmap_rates[1]); + + for (i =3D 0; i < ARRAY_SIZE(rate_scope->ht_mcs_rate_bitmap); i++) + rate_scope->ht_mcs_rate_bitmap[i] =3D cpu_to_le16(pbitmap_rates[2 + i]); + + if (priv->adapter->fw_api_ver =3D=3D MWIFIEX_FW_V15) { + for (i =3D 0; i < ARRAY_SIZE(rate_scope->vht_mcs_rate_bitmap); i++) + rate_scope->vht_mcs_rate_bitmap[i] =3D + cpu_to_le16(pbitmap_rates[10 + i]); } =20 rate_drop =3D (struct mwifiex_rate_drop_pattern *) ((u8 *) rate_scope + --=20 2.39.5 From nobody Fri Nov 29 15:35:46 2024 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DF1C18E759 for ; Wed, 18 Sep 2024 11:10:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726657855; cv=none; b=IsPVa1JvckQMP/H/skk5s7aEpqZlP9jy4x9SP+CqNZUujwtNWZApezN2bokaU379D7sszUJZhmvmSbPjdP0V6n55kT+1yyGwAxi7X4+o11MlClFptL6uaIBFciSGlsoOAnWKw6QmInfFRYz6Hq4BH3TU1SOE0wQpFL+oqKbH02g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726657855; c=relaxed/simple; bh=Y7vcMOzD+BeJEW1UV+zEw7xiifW1uulAP7KKH/stJ5U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lfO59qkd0Kqqwa3Fd7nBzX0KGGXdLePmIfBU/NxbkReJpGtymAodiQ6C4YFkb9NtQtDgdQYGbLzomVtaJ+7m0PVhmW9t/wsfAjF/A1ChY3+07dkudCQ/kqGouxEI2sl7s71PcCint5iSGyAVjdsw6fMgUSy82Vi8RXpvy2xRqiM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sqsZs-0007we-Pi; Wed, 18 Sep 2024 13:10:32 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqsZr-008nT9-Et; Wed, 18 Sep 2024 13:10:31 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sqsZr-0086AC-18; Wed, 18 Sep 2024 13:10:31 +0200 From: Sascha Hauer Date: Wed, 18 Sep 2024 13:10:29 +0200 Subject: [PATCH v2 04/12] wifi: mwifiex: use adapter as context pointer for mwifiex_hs_activated_event() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240918-mwifiex-cleanup-1-v2-4-2d0597187d3c@pengutronix.de> References: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> In-Reply-To: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, David Lin , kernel@pengutronix.de, Sascha Hauer , Francesco Dolcini X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1726657831; l=7336; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=Y7vcMOzD+BeJEW1UV+zEw7xiifW1uulAP7KKH/stJ5U=; b=QufjoJqUNN67TfE5mcVRfxC8DRhcFctkaQNZ+T0DAbQd/3IkIf9wQVmPOrWxQ8/1vqmYhaee0 wJ6IfquqGCyCYlBvzYd7mknbWelhNDSWch+q8YvS+XzPDJ5zq1PONhc X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org mwifiex_hs_activated_event() takes a struct mwifiex_private * as context pointer which this function doesn't need directly and the callers don't have. Use struct mwifiex_adapter * instead to simplify both the function and the callers. Reviewed-by: Francesco Dolcini Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 44 ++++++++++++-----------= ---- drivers/net/wireless/marvell/mwifiex/main.c | 15 ++------- drivers/net/wireless/marvell/mwifiex/main.h | 2 +- 3 files changed, 23 insertions(+), 38 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wi= reless/marvell/mwifiex/cmdevt.c index cdfb307e75131..0c175c6a1b201 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 mwifie= x_adapter *adapter) (test_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags) && !adapter->sleep_period.period)) { adapter->pm_wakeup_card_req =3D true; - mwifiex_hs_activated_event(mwifiex_get_priv - (adapter, MWIFIEX_BSS_ROLE_ANY), true); + mwifiex_hs_activated_event(adapter, true); } =20 return ret; @@ -784,17 +783,16 @@ int mwifiex_exec_next_cmd(struct mwifiex_adapter *ada= pter) =20 spin_unlock_bh(&adapter->mwifiex_cmd_lock); ret =3D mwifiex_dnld_cmd_to_fw(priv, cmd_node); - priv =3D 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 !=3D - cpu_to_le16(HostCmd_CMD_802_11_HS_CFG_ENH))) { + if (host_cmd->command !=3D 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); } } =20 @@ -1160,27 +1158,27 @@ mwifiex_check_ps_cond(struct mwifiex_adapter *adapt= er) * 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 =3D true; - mwifiex_update_rxreor_flags(priv->adapter, + &adapter->work_flags)) { + adapter->hs_activated =3D 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 =3D true; + adapter->hs_activate_wait_q_woken =3D 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 =3D false; + adapter->hs_activated =3D false; } } =20 @@ -1204,7 +1202,7 @@ int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private = *priv, =20 if (phs_cfg->action =3D=3D cpu_to_le16(HS_ACTIVATE) && adapter->iface_type !=3D MWIFIEX_USB) { - mwifiex_hs_activated_event(priv, true); + mwifiex_hs_activated_event(adapter, true); return 0; } else { mwifiex_dbg(adapter, CMD, @@ -1217,11 +1215,11 @@ int mwifiex_ret_802_11_hs_cfg(struct mwifiex_privat= e *priv, if (conditions !=3D HS_CFG_CANCEL) { set_bit(MWIFIEX_IS_HS_CONFIGURED, &adapter->work_flags); if (adapter->iface_type =3D=3D 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); } =20 return 0; @@ -1250,9 +1248,7 @@ mwifiex_process_hs_config(struct mwifiex_adapter *ada= pter) adapter->hs_activated =3D 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); =20 @@ -1302,9 +1298,7 @@ mwifiex_process_sleep_confirm_resp(struct mwifiex_ada= pter *adapter, } adapter->pm_wakeup_card_req =3D 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 =3D PS_STATE_SLEEP; cmd->command =3D cpu_to_le16(command); cmd->seq_num =3D cpu_to_le16(seq_num); diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wire= less/marvell/mwifiex/main.c index 46acddd03ffd1..588887aa29a79 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 *adapt= er) 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); } } =20 @@ -438,10 +435,7 @@ int mwifiex_main_process(struct mwifiex_adapter *adapt= er) 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); } } =20 @@ -460,10 +454,7 @@ int mwifiex_main_process(struct mwifiex_adapter *adapt= er) 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); } } =20 diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wire= less/marvell/mwifiex/main.h index dc07eb11f7752..ce5b80af305a0 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); --=20 2.39.5 From nobody Fri Nov 29 15:35:46 2024 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 446DF18A947 for ; Wed, 18 Sep 2024 11:10:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726657840; cv=none; b=imI5Au7p+NEOCFMlDm3xyC8FvmFZXEXQjC/WC10fehYxI937/vIFqmU/oO0IWIGiyhgg9MQAm250euo8JoruGTNtwXkJDAbJFBKP0pG9yODd4OD8YhXOtTHefbpWI92kEGDqONMzbKiaZLuZy94eVtGcsCo4cvuSz8YW+NBtE/M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726657840; c=relaxed/simple; bh=JveW4UQoKxbbP5QkK8IlkF8VflK/7i/hbEyhgJXRFnw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WRzf69uyNOFOnPo6muPaXnb2KnalnMNV/Fs11Oo7ty4a2g94/gFjyA23hDW4HHOxoVlNbyQt2pOiVQ/ndoDeUhh5OMPxqrrqswTRiR5JIDs7XBghTSZjlvjYxXS02t9c/Jry46dqaPWCJ9Kk28ZSyxuCD+Wk/dP0vRUA3D3Ifyo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sqsZs-0007wd-Pi; Wed, 18 Sep 2024 13:10:32 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqsZr-008nTA-F8; Wed, 18 Sep 2024 13:10:31 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sqsZr-0086AC-19; Wed, 18 Sep 2024 13:10:31 +0200 From: Sascha Hauer Date: Wed, 18 Sep 2024 13:10:30 +0200 Subject: [PATCH v2 05/12] wifi: mwifiex: drop unnecessary initialization Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240918-mwifiex-cleanup-1-v2-5-2d0597187d3c@pengutronix.de> References: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> In-Reply-To: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, David Lin , kernel@pengutronix.de, Sascha Hauer , Francesco Dolcini X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1726657831; l=2020; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=JveW4UQoKxbbP5QkK8IlkF8VflK/7i/hbEyhgJXRFnw=; b=O/ZCLzfZ+uSyGXzrRpcXAEat32qPNId8OIwnhxBNvo2XQPolB+n2EpVAIoQkrMncC2mcykWHs cVNB5qT+4SeDnFl7xHLhwdlcSS4VPATLuCxp0SPwJpyLS0uofUEDiCf X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Several functions initialize the priv * without actually using the initialized value. Drop the initialization. Reviewed-by: Francesco Dolcini Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 6 ++---- drivers/net/wireless/marvell/mwifiex/txrx.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wi= reless/marvell/mwifiex/cmdevt.c index 0c175c6a1b201..8a2ad0038d36f 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 *ad= apter) int mwifiex_process_event(struct mwifiex_adapter *adapter) { int ret, i; - struct mwifiex_private *priv =3D - mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); + struct mwifiex_private *priv; struct sk_buff *skb =3D adapter->event_skb; u32 eventcause; struct mwifiex_rxinfo *rx_info; @@ -808,8 +807,7 @@ int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapt= er) int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter) { struct host_cmd_ds_command *resp; - struct mwifiex_private *priv =3D - mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); + struct mwifiex_private *priv; int ret =3D 0; uint16_t orig_cmdresp_no; uint16_t cmdresp_no; diff --git a/drivers/net/wireless/marvell/mwifiex/txrx.c b/drivers/net/wire= less/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 =3D - mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); + struct mwifiex_private *priv; struct rxpd *local_rx_pd; struct mwifiex_rxinfo *rx_info =3D MWIFIEX_SKB_RXCB(skb); int ret; --=20 2.39.5 From nobody Fri Nov 29 15:35:46 2024 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5AD631917FC for ; Wed, 18 Sep 2024 11:11:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726657862; cv=none; b=FAKVRhTB6MbHx8qseavKH1JWD65yAQDK23rZ5+HJUfNwAVU93IOO0RX+oo4ACEMhiT6zFqKuw0q59fnOFoNVSZhptqsuesraWl0I2sq/5XnlBSpun1yWRAi0ZQ2x31KaHE8VFhXLljeO9Y/8/mOOEBkhm0DPFY1ZfNWJv6mEhhI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726657862; c=relaxed/simple; bh=SkDbnW/g//Lpq45aEWvOkOmfkXLSqxyH2urQsrrcM0Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IzK4r8nU+hio6gGYG0A/VQ2gDkycrC7SqAShku/NlKqpb82SVyNk28AfpR3ksS1iZOM9yd8fCMxNb6PmMpGKFYnnFvFKFX1YNZy+818t7lyDR44iPlLSEUbVboBnqupPxJhxyzqkw789jSgBCVWV6Bm0QsCr0iEV+WgPYCflLmk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sqsZs-0007wi-Pi; Wed, 18 Sep 2024 13:10:32 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqsZr-008nTB-FS; Wed, 18 Sep 2024 13:10:31 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sqsZr-0086AC-1A; Wed, 18 Sep 2024 13:10:31 +0200 From: Sascha Hauer Date: Wed, 18 Sep 2024 13:10:31 +0200 Subject: [PATCH v2 06/12] wifi: mwifiex: make region_code_mapping_t const Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240918-mwifiex-cleanup-1-v2-6-2d0597187d3c@pengutronix.de> References: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> In-Reply-To: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, David Lin , kernel@pengutronix.de, Sascha Hauer , Francesco Dolcini X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1726657831; l=2590; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=SkDbnW/g//Lpq45aEWvOkOmfkXLSqxyH2urQsrrcM0Y=; b=HPv4eLof1YdfX0CWrNIFAqnpI6TYrRLa/um9GCbgNVSMkdxeX00n2WB7hIOr1EqYKuBKNwW5z AF6Oyytvp26CcaCoE8OviCc7fiemKfSUofztuwSJEgqZYfNGyrQGARV X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org region_code_mapping_t is not modified and shouldn't be. Mark it const. Reviewed-by: Francesco Dolcini Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 +- drivers/net/wireless/marvell/mwifiex/cfp.c | 4 ++-- drivers/net/wireless/marvell/mwifiex/main.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/= wireless/marvell/mwifiex/cfg80211.c index d3e1424bea390..8cf6267b03579 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -4701,7 +4701,7 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter = *adapter) void *wdev_priv; struct wiphy *wiphy; struct mwifiex_private *priv =3D adapter->priv[MWIFIEX_BSS_TYPE_STA]; - u8 *country_code; + const u8 *country_code; u32 thr, retry; struct cfg80211_ops *ops; =20 diff --git a/drivers/net/wireless/marvell/mwifiex/cfp.c b/drivers/net/wirel= ess/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]; }; =20 -static struct region_code_mapping region_code_mapping_t[] =3D { +static const struct region_code_mapping region_code_mapping_t[] =3D { { 0x10, "US " }, /* US FCC */ { 0x20, "CA " }, /* IC Canada */ { 0x30, "FR " }, /* France */ @@ -165,7 +165,7 @@ static struct region_code_mapping region_code_mapping_t= [] =3D { }; =20 /* 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; =20 diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wire= less/marvell/mwifiex/main.h index ce5b80af305a0..56f413cb6eb30 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 mwifie= x_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); --=20 2.39.5 From nobody Fri Nov 29 15:35:46 2024 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6200818DF7C for ; Wed, 18 Sep 2024 11:10:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726657848; cv=none; b=nW2ZqrldMaMeoSlyGsL7viyJQ3vTDzACf+G71Nhx68nREK60nGwltJcwT93BNpdbDGUMDhP3QB7GmYhJa9VGGOsVfc4UMb1FSqWw+kEZWHKu53QaxgsO409qWuXdR7gHvhasNIJ5MqtnC2iOkIn2/Vj5LdUr+vvNvcvasaqvveI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726657848; c=relaxed/simple; bh=7KBgP3YHIb8EuPDTsFYtK3mhC/xpviHm9ZADlP+zwMA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YhyN9POOVwIoFZ+RVmLaqT20yqm7vP/vC6NUdRDyoXG8OByQystiiRivHxfM/DAS207wfwREFH/Spw+avVUSGHPTZu8+kAUMNCP4/RqmU/hs2x2GqLMRkUlH9nmn+tRKJ3h9eBty6bITMlX5uiIkc9LICYlhgG93k+WcvtzOcrI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sqsZs-0007wh-Pi; Wed, 18 Sep 2024 13:10:32 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqsZr-008nTC-FY; Wed, 18 Sep 2024 13:10:31 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sqsZr-0086AC-1B; Wed, 18 Sep 2024 13:10:31 +0200 From: Sascha Hauer Date: Wed, 18 Sep 2024 13:10:32 +0200 Subject: [PATCH v2 07/12] wifi: mwifiex: pass adapter to mwifiex_dnld_cmd_to_fw() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240918-mwifiex-cleanup-1-v2-7-2d0597187d3c@pengutronix.de> References: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> In-Reply-To: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, David Lin , kernel@pengutronix.de, Sascha Hauer , Francesco Dolcini X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1726657831; l=2112; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=7KBgP3YHIb8EuPDTsFYtK3mhC/xpviHm9ZADlP+zwMA=; b=TGytUlxql5CwmBE3scbbie0V6StjnOVvkDyRZKelLKb/zXhywfjriVexwHgkx2CkHcmumTGVk o9k7tqZV7ahAQ/Hq13rirwuSVp0EHcCqgntC43srT/rtJQl94QcxsEe X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org priv is not needed in mwifiex_dnld_cmd_to_fw(), so pass the adapter to it as context pointer. Reviewed-by: Francesco Dolcini Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wi= reless/marvell/mwifiex/cmdevt.c index 8a2ad0038d36f..402531a03ece3 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 =3D 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 =3D 0; struct host_cmd_ds_command *host_cmd; @@ -766,7 +763,6 @@ int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapt= er) struct cmd_ctrl_node, list); =20 host_cmd =3D (struct host_cmd_ds_command *) (cmd_node->cmd_skb->data); - priv =3D cmd_node->priv; =20 if (adapter->ps_state !=3D PS_STATE_AWAKE) { mwifiex_dbg(adapter, ERROR, @@ -781,7 +777,7 @@ int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapt= er) spin_unlock_bh(&adapter->cmd_pending_q_lock); =20 spin_unlock_bh(&adapter->mwifiex_cmd_lock); - ret =3D mwifiex_dnld_cmd_to_fw(priv, cmd_node); + ret =3D mwifiex_dnld_cmd_to_fw(adapter, cmd_node); =20 /* Any command sent to the firmware when host is in sleep * mode should de-configure host sleep. We should skip the --=20 2.39.5 From nobody Fri Nov 29 15:35:46 2024 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 125A918A93F for ; Wed, 18 Sep 2024 11:10:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726657841; cv=none; b=CaUwQwBfB3lDzqlwMRmL353M6DY9oZW+qW242VyvGwW4032ZzV+1AcIDcaIxTXelIBiGvHMqBO4IaI4mTF/EXlqNMIbRelVtVJdUuS9kpBCjKK1z2/3kWjmMUCCLx3zoIe91BV/w6+wQZdFC2zL5JeZK49U/tWKDhjNxHkrRcvY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726657841; c=relaxed/simple; bh=NQDRpxVX8RaqX7iwlxKphX2NU4n1Amc/V8dt2RHPZTw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OL4UgczNg3yQqlj9xsfvTEG0lytfc//nySGqDQNIupF/MuHw13VrjFaewJq56LJhFmjRJyqS1a4O1k3agy5Bfnx9TF+NQKZO1YdC3ZKB4fXbGYrJX6bUiUC6BgVZbQpDpDMwSBRVh2CB/vBKzTfYP+pfWLFn0PdN+fMLsaE6o2Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sqsZs-0007wj-Fx; Wed, 18 Sep 2024 13:10:32 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqsZr-008nTD-FL; Wed, 18 Sep 2024 13:10:31 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sqsZr-0086AC-1C; Wed, 18 Sep 2024 13:10:31 +0200 From: Sascha Hauer Date: Wed, 18 Sep 2024 13:10:33 +0200 Subject: [PATCH v2 08/12] wifi: mwifiex: simplify mwifiex_setup_ht_caps() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240918-mwifiex-cleanup-1-v2-8-2d0597187d3c@pengutronix.de> References: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> In-Reply-To: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, David Lin , kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1726657831; l=2368; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=NQDRpxVX8RaqX7iwlxKphX2NU4n1Amc/V8dt2RHPZTw=; b=O3wOzaAZ0Jj6bSvu5wj3X1gYFBQluXoVP0xOndALSJ4wnoTwwGiy3VwGjcis7P8+qUpzQCJCR DezejNG7yPrB0R7ZMr8gJGfzdm2AD033zRXJRDNerMN4SZCWuF/GNnM X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org In mwifiex_setup_ht_caps() first a local struct ieee80211_mcs_info is initialized and afterwards copied over &ht_info->mcs. Simplify this by initializing &ht_info->mcs directly. While at it call memset on the u8 rx_mask[] array instead of the struct which makes the intention clearer and we no longer have to assume the rx_mask array is the first member of struct ieee80211_mcs_info. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/= wireless/marvell/mwifiex/cfg80211.c index 8cf6267b03579..8746943c17788 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -2904,16 +2904,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 =3D (u8 *)&mcs_set; struct mwifiex_adapter *adapter =3D priv->adapter; =20 ht_info->ht_supported =3D true; ht_info->ampdu_factor =3D IEEE80211_HT_MAX_AMPDU_64K; ht_info->ampdu_density =3D IEEE80211_HT_MPDU_DENSITY_NONE; =20 - 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 |=3D IEEE80211_HT_CAP_SUP_WIDTH_20_40; @@ -2959,17 +2955,15 @@ mwifiex_setup_ht_caps(struct ieee80211_sta_ht_cap *= ht_info, ht_info->cap |=3D IEEE80211_HT_CAP_SM_PS; =20 rx_mcs_supp =3D 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 =3D=3D 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); =20 ht_info->mcs.tx_params =3D IEEE80211_HT_MCS_TX_DEFINED; } --=20 2.39.5 From nobody Fri Nov 29 15:35:46 2024 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 849E318A94D for ; Wed, 18 Sep 2024 11:10:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726657841; cv=none; b=cJywTuMlpDUEqfddDvccVgOVU2ZMqhSaLgSPuDRq+HcGDDVE9JLgLQsRW1b3Y6KT3Ep/rBEDNO2mrYcYIlPKJCcS0Hz+pMv/KN+X7DQD/ZVzcLE58IStmEH5inaeCnunKoNebIahjbeAcf3bNFJ/lr5GdzOZNqFgy3ukFTfMjgk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726657841; c=relaxed/simple; bh=48+PYPR2/Of/mJeAc7DVeqDQkO4dzLzfOOVQJmQl3wE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=drOFNLMgaCsUi72p/5U8vXeb0jYn4N59p/NQDHwvFCSpxbEnAYPNxZ9m9ltAqExTgLyJVvsYD/+O+ZSXmLnG1xitI/6LEcHiVGyM6OfMsvKymz9DH7O3P+7WcAxnTU47Dw+7Wl1w9V7fkcMafFJr+eq+TAoig5iewCEVrsvCs5w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sqsZs-0007wk-Pi; Wed, 18 Sep 2024 13:10:32 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqsZr-008nTE-Fe; Wed, 18 Sep 2024 13:10:31 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sqsZr-0086AC-1D; Wed, 18 Sep 2024 13:10:31 +0200 From: Sascha Hauer Date: Wed, 18 Sep 2024 13:10:34 +0200 Subject: [PATCH v2 09/12] wifi: mwifiex: fix indention Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240918-mwifiex-cleanup-1-v2-9-2d0597187d3c@pengutronix.de> References: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> In-Reply-To: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, David Lin , kernel@pengutronix.de, Sascha Hauer , Francesco Dolcini X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1726657831; l=1250; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=48+PYPR2/Of/mJeAc7DVeqDQkO4dzLzfOOVQJmQl3wE=; b=XaLOWEIyBk345bAIpBexz2Gicj2hUAB7/uOOn9uec6VhHcQQz/SbvhftXKPjkkAeXhnl5FpJm Qe7UXPyQjQ3Ao4nkghVtZ3DE+gEn+qJ+7Oqv2nL5jUgJbUkV+fv72Zy X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Align multiline if() under the opening brace. Reviewed-by: Francesco Dolcini Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/wmm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/wmm.c b/drivers/net/wirel= ess/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 *a= dapter) } =20 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 --=20 2.39.5 From nobody Fri Nov 29 15:35:46 2024 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3454317AE0C for ; Wed, 18 Sep 2024 11:28:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726658904; cv=none; b=OaYAs+AS6/fZIyffJx6iw9oCcrKo+leUaCafySZjaduzdXhz+vNJ80QN1IQNn1N47kCcsJ95Wev1uDuMcSe58xqcgbf9/fmnXVjd0zfgeZZjZ+BrqB8n51wpHt9d/VtZptPzE2PoCyIP9pLzbMJevpfH+E4Ph5p0qXzXerIoe+0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726658904; c=relaxed/simple; bh=CUyoMyC2hCayysckc/FbG1xzD7GsfZEVr01htWGico4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FSSyJnohRP6+0WxgdgliaZ/Ik0HTV1kOearaNPI6HoNaJIM6vuriWE7QW2Rg6mJuGskXDCeuuY8mf3Kcd83vmXBFFH7ec/5wqI9/feNJAO8yskJuJTvbxKmA6JcHvV4CWqCWDkjW+xIGDmapNyRD+1gN00p446eB3XlLdr5tq+8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sqsr3-00045n-Gz; Wed, 18 Sep 2024 13:28:17 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqsr2-008noI-Kp; Wed, 18 Sep 2024 13:28:16 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sqsZr-0086AC-1E; Wed, 18 Sep 2024 13:10:31 +0200 From: Sascha Hauer Date: Wed, 18 Sep 2024 13:10:35 +0200 Subject: [PATCH v2 10/12] wifi: mwifiex: make locally used function static Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240918-mwifiex-cleanup-1-v2-10-2d0597187d3c@pengutronix.de> References: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> In-Reply-To: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, David Lin , kernel@pengutronix.de, Sascha Hauer , Francesco Dolcini X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1726657831; l=1643; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=CUyoMyC2hCayysckc/FbG1xzD7GsfZEVr01htWGico4=; b=MMFV1XRmfuSh0AvsOOREaqT73iqUFSZjCJtVVixFJznC0mAiaZVCOCOZLB82gaw8xcFTUFeTR kj6u7hzd4XuCUvRHhWuEGEjSXFy6/atU3aTDenrRX/9u02R0B+KbsI5 X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org mwifiex_is_tdls_off_chan() is only used locally. Make it static. Reviewed-by: Francesco Dolcini Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/main.h | 1 - drivers/net/wireless/marvell/mwifiex/util.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wire= less/marvell/mwifiex/main.h index 56f413cb6eb30..f026e6069be3f 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -1604,7 +1604,6 @@ mwifiex_add_sta_entry(struct mwifiex_private *priv, c= onst 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 *p= eer, u8 action_code, u8 dialog_token, diff --git a/drivers/net/wireless/marvell/mwifiex/util.c b/drivers/net/wire= less/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_privat= e *priv) return false; } =20 -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; =20 --=20 2.39.5 From nobody Fri Nov 29 15:35:46 2024 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A257333F9 for ; Wed, 18 Sep 2024 11:28:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726658912; cv=none; b=cZITKyZN0WN2vhL+ASitYcgH7TLvNjw+NCDVmRXL0OiwzutQOPebpquPJdsIEf8228ZMzZ6NqLuxiKfZVKck5fSlXi+sRfyZHHujZz8s5iKgcVeLl2h3n35P5E8/dWhnWEKB/acS9qhFYhntD5QG+Ts/nSpbg3HDhIdUs5RFiNo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726658912; c=relaxed/simple; bh=7zvvUqfJMerN1dudzoqv+U2wF5Z3UUUimESx3IGTZBg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CljiJEpklNiJTkT0n1zcTnt7CIqUGkN+w7QO/FubposN9wBoQVfezfijBHeA3ulsPmprwFPnxjKSTu/61/LplDYaskfVJ9vd7aJooWZ221QnSfGH1WoxsTP1dQ2Jk5O5zHUiGLnqm0mlF1Qqyrjv3TV0WzoZ9tCcBERjbi7aFTA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sqsr3-00045p-FJ; Wed, 18 Sep 2024 13:28:17 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqsr2-008noO-Pz; Wed, 18 Sep 2024 13:28:16 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sqsZr-0086AC-1F; Wed, 18 Sep 2024 13:10:31 +0200 From: Sascha Hauer Date: Wed, 18 Sep 2024 13:10:36 +0200 Subject: [PATCH v2 11/12] wifi: mwifiex: move common settings out of switch/case Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240918-mwifiex-cleanup-1-v2-11-2d0597187d3c@pengutronix.de> References: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> In-Reply-To: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, David Lin , kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1726657831; l=2972; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=7zvvUqfJMerN1dudzoqv+U2wF5Z3UUUimESx3IGTZBg=; b=3/WxUQz1oQv3DXrz5BTlwxFFsFDfwZLngDEyUbrcAG4BLrV8N2pi+vHr4RxiioQd2BnlPc5HI GXOYTiTDoQVAW2SHQTz+lfLrmgtG61LG/WToNn9gYwrcQSnR8HgLFN/ X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org In mwifiex_add_virtual_intf() several settings done in a switch/case are the same in all cases. Move them out of the switch/case to deduplicate the code. bss_started is not initialized in all switch/case branches, but it is only used in AP mode in the driver, so it doesn't hurt to move its initialization out of the switch/case as well. Signed-off-by: Sascha Hauer Reviewed-by: Francesco Dolcini --- 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 8746943c17788..2ce54a3fc32f8 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -3005,7 +3005,6 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct = wiphy *wiphy, return ERR_PTR(-EFAULT); } =20 - priv->wdev.wiphy =3D wiphy; priv->wdev.iftype =3D NL80211_IFTYPE_STATION; =20 if (type =3D=3D NL80211_IFTYPE_UNSPECIFIED) @@ -3014,8 +3013,6 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct = wiphy *wiphy, priv->bss_mode =3D type; =20 priv->bss_type =3D MWIFIEX_BSS_TYPE_STA; - priv->frame_type =3D MWIFIEX_DATA_FRAME_TYPE_ETH_II; - priv->bss_priority =3D 0; priv->bss_role =3D MWIFIEX_BSS_ROLE_STA; =20 break; @@ -3035,14 +3032,10 @@ struct wireless_dev *mwifiex_add_virtual_intf(struc= t wiphy *wiphy, return ERR_PTR(-EFAULT); } =20 - priv->wdev.wiphy =3D wiphy; priv->wdev.iftype =3D NL80211_IFTYPE_AP; =20 priv->bss_type =3D MWIFIEX_BSS_TYPE_UAP; - priv->frame_type =3D MWIFIEX_DATA_FRAME_TYPE_ETH_II; - priv->bss_priority =3D 0; priv->bss_role =3D MWIFIEX_BSS_ROLE_UAP; - priv->bss_started =3D 0; priv->bss_mode =3D type; =20 break; @@ -3062,7 +3055,6 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct = wiphy *wiphy, return ERR_PTR(-EFAULT); } =20 - priv->wdev.wiphy =3D wiphy; /* At start-up, wpa_supplicant tries to change the interface * to NL80211_IFTYPE_STATION if it is not managed mode. */ @@ -3075,10 +3067,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct= wiphy *wiphy, */ priv->bss_type =3D MWIFIEX_BSS_TYPE_P2P; =20 - priv->frame_type =3D MWIFIEX_DATA_FRAME_TYPE_ETH_II; - priv->bss_priority =3D 0; priv->bss_role =3D MWIFIEX_BSS_ROLE_STA; - priv->bss_started =3D 0; =20 if (mwifiex_cfg80211_init_p2p_client(priv)) { memset(&priv->wdev, 0, sizeof(priv->wdev)); @@ -3092,6 +3081,11 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct= wiphy *wiphy, return ERR_PTR(-EINVAL); } =20 + priv->wdev.wiphy =3D wiphy; + priv->bss_priority =3D 0; + priv->bss_started =3D 0; + priv->frame_type =3D MWIFIEX_DATA_FRAME_TYPE_ETH_II; + dev =3D alloc_netdev_mqs(sizeof(struct mwifiex_private *), name, name_assign_type, ether_setup, IEEE80211_NUM_ACS, 1); --=20 2.39.5 From nobody Fri Nov 29 15:35:46 2024 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE8E4381D5 for ; Wed, 18 Sep 2024 11:28:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726658904; cv=none; b=LItYc7vSd2Fvemv9ec9jOZ+0vMFFZ8qqbrtvUiXGLwvWxIDNSqrmLLUtpi/8KnGWlcRQiqi/tQafZ9/H7eN+3sVK1E5Sdl0f1uFv+iK1XuaymmVtGIQTSyn/Nydgh69Zu54/CJVQ+4x7FLB05npGP679iej08aNnKoMIxaSCuGM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726658904; c=relaxed/simple; bh=UF/lcQlF7gCt/NoALVn1F5mDrNEnIpHbfvXWA4k3Ybo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iEnUlfjKQ/isMe6fyhv7Q3gnAti2mdC9toK+UzmvMxEyblENP6FKhEN4VHFwVpY1GYqwyvZPIBu3KeEyAB24AsAil0hbSIfcd6EfqEwtoXCZ05Bi8bIwyCV0+foeQ4dy+7VxpcPPmSz8nC+heTjtBFBnKvgWI5w2DQ6LIz3AKSk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sqsr3-00045o-FJ; Wed, 18 Sep 2024 13:28:17 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqsr2-008noL-NP; Wed, 18 Sep 2024 13:28:16 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1sqsZr-0086AC-1G; Wed, 18 Sep 2024 13:10:31 +0200 From: Sascha Hauer Date: Wed, 18 Sep 2024 13:10:37 +0200 Subject: [PATCH v2 12/12] wifi: mwifiex: drop asynchronous init waiting code Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240918-mwifiex-cleanup-1-v2-12-2d0597187d3c@pengutronix.de> References: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> In-Reply-To: <20240918-mwifiex-cleanup-1-v2-0-2d0597187d3c@pengutronix.de> To: Brian Norris , Francesco Dolcini , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, David Lin , kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1726657831; l=9066; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=UF/lcQlF7gCt/NoALVn1F5mDrNEnIpHbfvXWA4k3Ybo=; b=AxjoS5E1+jOXbImnHf3p8uegyK+c5VNU50VrMncZdcbLRGufmLXBLPvX3aUqWv3azVt1ttzTB n9q4xo6H/fiDnptMtbYAa6S+oQ0H5St/T8wK7flQUy50UVLuinaWzs4 X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Historically all commands sent to the mwifiex driver have been asynchronous. The different commands sent during driver initialization have been queued at once and only the final command has been waited for being ready before finally starting the driver. This has been changed in 7bff9c974e1a ("mwifiex: send firmware initialization commands synchronously"). With this the initialization is finished once the last mwifiex_send_cmd_sync() (now mwifiex_send_cmd()) has returned. This makes all the code used to wait for the last initialization command to be finished unnecessary, so it's removed in this patch. Signed-off-by: Sascha Hauer --- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 16 ---------------- drivers/net/wireless/marvell/mwifiex/init.c | 18 +++++------------- drivers/net/wireless/marvell/mwifiex/main.c | 25 +++-------------------= --- drivers/net/wireless/marvell/mwifiex/main.h | 6 ------ drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 6 ------ drivers/net/wireless/marvell/mwifiex/util.c | 18 ------------------ 6 files changed, 8 insertions(+), 81 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wi= reless/marvell/mwifiex/cmdevt.c index 402531a03ece3..8a614dc993b2c 100644 --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c @@ -892,18 +892,6 @@ int mwifiex_process_cmdresp(struct mwifiex_adapter *ad= apter) ret =3D mwifiex_process_sta_cmdresp(priv, cmdresp_no, resp); } =20 - /* Check init command response */ - if (adapter->hw_status =3D=3D MWIFIEX_HW_STATUS_INITIALIZING) { - if (ret) { - mwifiex_dbg(adapter, ERROR, - "%s: cmd %#x failed during\t" - "initialization\n", __func__, cmdresp_no); - mwifiex_init_fw_complete(adapter); - return -1; - } else if (adapter->last_init_cmd =3D=3D cmdresp_no) - adapter->hw_status =3D MWIFIEX_HW_STATUS_INIT_DONE; - } - if (adapter->curr_cmd) { if (adapter->curr_cmd->wait_q_enabled) adapter->cmd_wait_q.status =3D ret; @@ -1022,10 +1010,6 @@ mwifiex_cmd_timeout_func(struct timer_list *t) mwifiex_cancel_pending_ioctl(adapter); } } - if (adapter->hw_status =3D=3D MWIFIEX_HW_STATUS_INITIALIZING) { - mwifiex_init_fw_complete(adapter); - return; - } =20 if (adapter->if_ops.device_dump) adapter->if_ops.device_dump(adapter); diff --git a/drivers/net/wireless/marvell/mwifiex/init.c b/drivers/net/wire= less/marvell/mwifiex/init.c index 0259c9f88486b..b27596c7c02cb 100644 --- a/drivers/net/wireless/marvell/mwifiex/init.c +++ b/drivers/net/wireless/marvell/mwifiex/init.c @@ -486,7 +486,6 @@ int mwifiex_init_fw(struct mwifiex_adapter *adapter) int ret; struct mwifiex_private *priv; u8 i, first_sta =3D true; - int is_cmd_pend_q_empty; =20 adapter->hw_status =3D MWIFIEX_HW_STATUS_INITIALIZING; =20 @@ -508,7 +507,6 @@ int mwifiex_init_fw(struct mwifiex_adapter *adapter) } if (adapter->mfg_mode) { adapter->hw_status =3D MWIFIEX_HW_STATUS_READY; - ret =3D -EINPROGRESS; } else { for (i =3D 0; i < adapter->priv_num; i++) { ret =3D mwifiex_sta_init_cmd(adapter->priv[i], @@ -520,18 +518,12 @@ int mwifiex_init_fw(struct mwifiex_adapter *adapter) } } =20 - spin_lock_bh(&adapter->cmd_pending_q_lock); - is_cmd_pend_q_empty =3D list_empty(&adapter->cmd_pending_q); - spin_unlock_bh(&adapter->cmd_pending_q_lock); - if (!is_cmd_pend_q_empty) { - /* Send the first command in queue and return */ - if (mwifiex_main_process(adapter) !=3D -1) - ret =3D -EINPROGRESS; - } else { - adapter->hw_status =3D MWIFIEX_HW_STATUS_READY; - } + adapter->hw_status =3D MWIFIEX_HW_STATUS_READY; =20 - return ret; + if (adapter->if_ops.init_fw_port) + adapter->if_ops.init_fw_port(adapter); + + return 0; } =20 /* diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wire= less/marvell/mwifiex/main.c index 588887aa29a79..63344e2e03656 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -354,13 +354,6 @@ int mwifiex_main_process(struct mwifiex_adapter *adapt= er) if (adapter->cmd_resp_received) { adapter->cmd_resp_received =3D false; mwifiex_process_cmdresp(adapter); - - /* call mwifiex back when init_fw is done */ - if (adapter->hw_status =3D=3D MWIFIEX_HW_STATUS_INIT_DONE) { - adapter->hw_status =3D MWIFIEX_HW_STATUS_READY; - mwifiex_init_fw_complete(adapter); - maybe_quirk_fw_disable_ds(adapter); - } } =20 /* Check if we need to confirm Sleep Request @@ -578,21 +571,11 @@ static int _mwifiex_fw_dpc(const struct firmware *fir= mware, void *context) goto err_dnld_fw; } =20 - adapter->init_wait_q_woken =3D false; ret =3D mwifiex_init_fw(adapter); - if (ret =3D=3D -1) { + if (ret < 0) goto err_init_fw; - } else if (!ret) { - adapter->hw_status =3D MWIFIEX_HW_STATUS_READY; - goto done; - } - /* Wait for mwifiex_init to complete */ - if (!adapter->mfg_mode) { - wait_event_interruptible(adapter->init_wait_q, - adapter->init_wait_q_woken); - if (adapter->hw_status !=3D MWIFIEX_HW_STATUS_READY) - goto err_init_fw; - } + + maybe_quirk_fw_disable_ds(adapter); =20 if (!adapter->wiphy) { if (mwifiex_register_cfg80211(adapter)) { @@ -1551,7 +1534,6 @@ mwifiex_reinit_sw(struct mwifiex_adapter *adapter) =20 adapter->hw_status =3D MWIFIEX_HW_STATUS_INITIALIZING; clear_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags); - init_waitqueue_head(&adapter->init_wait_q); clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags); adapter->hs_activated =3D false; clear_bit(MWIFIEX_IS_CMD_TIMEDOUT, &adapter->work_flags); @@ -1719,7 +1701,6 @@ mwifiex_add_card(void *card, struct completion *fw_do= ne, =20 adapter->hw_status =3D MWIFIEX_HW_STATUS_INITIALIZING; clear_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags); - init_waitqueue_head(&adapter->init_wait_q); clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags); adapter->hs_activated =3D false; init_waitqueue_head(&adapter->hs_activate_wait_q); diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wire= less/marvell/mwifiex/main.h index f026e6069be3f..1eb0b5f9cb4a5 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -240,7 +240,6 @@ struct mwifiex_dbg { enum MWIFIEX_HARDWARE_STATUS { MWIFIEX_HW_STATUS_READY, MWIFIEX_HW_STATUS_INITIALIZING, - MWIFIEX_HW_STATUS_INIT_DONE, MWIFIEX_HW_STATUS_RESET, MWIFIEX_HW_STATUS_NOT_READY }; @@ -869,8 +868,6 @@ struct mwifiex_adapter { unsigned long work_flags; u32 fw_release_number; u8 intf_hdr_len; - u16 init_wait_q_woken; - wait_queue_head_t init_wait_q; void *card; struct mwifiex_if_ops if_ops; atomic_t bypass_tx_pending; @@ -923,7 +920,6 @@ struct mwifiex_adapter { struct cmd_ctrl_node *curr_cmd; /* spin lock for command */ spinlock_t mwifiex_cmd_lock; - u16 last_init_cmd; struct timer_list cmd_timer; struct list_head cmd_free_q; /* spin lock for cmd_free_q */ @@ -1064,8 +1060,6 @@ void mwifiex_free_priv(struct mwifiex_private *priv); =20 int mwifiex_init_fw(struct mwifiex_adapter *adapter); =20 -int mwifiex_init_fw_complete(struct mwifiex_adapter *adapter); - void mwifiex_shutdown_drv(struct mwifiex_adapter *adapter); =20 int mwifiex_dnld_fw(struct mwifiex_adapter *, struct mwifiex_fw_image *); diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/w= ireless/marvell/mwifiex/sta_cmd.c index 30dd4e58e2b1d..da89e15e5fe76 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c @@ -2406,11 +2406,5 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *pri= v, u8 first_sta, bool init) ret =3D mwifiex_send_cmd(priv, HostCmd_CMD_11N_CFG, HostCmd_ACT_GEN_SET, 0, &tx_cfg, true); =20 - if (init) { - /* set last_init_cmd before sending the command */ - priv->adapter->last_init_cmd =3D HostCmd_CMD_11N_CFG; - ret =3D -EINPROGRESS; - } - return ret; } diff --git a/drivers/net/wireless/marvell/mwifiex/util.c b/drivers/net/wire= less/marvell/mwifiex/util.c index ea28d604ee69c..4c5b1de0e936c 100644 --- a/drivers/net/wireless/marvell/mwifiex/util.c +++ b/drivers/net/wireless/marvell/mwifiex/util.c @@ -115,24 +115,6 @@ static struct mwifiex_debug_data items[] =3D { =20 static int num_of_items =3D ARRAY_SIZE(items); =20 -/* - * Firmware initialization complete callback handler. - * - * This function wakes up the function waiting on the init - * wait queue for the firmware initialization to complete. - */ -int mwifiex_init_fw_complete(struct mwifiex_adapter *adapter) -{ - - if (adapter->hw_status =3D=3D MWIFIEX_HW_STATUS_READY) - if (adapter->if_ops.init_fw_port) - adapter->if_ops.init_fw_port(adapter); - - adapter->init_wait_q_woken =3D true; - wake_up_interruptible(&adapter->init_wait_q); - return 0; -} - /* * This function sends init/shutdown command * to firmware. --=20 2.39.5