linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mwifiex: Add support for NL80211_ATTR_MAX_AP_ASSOC_STA
@ 2020-05-21 12:35 Pali Rohár
  2020-05-29 17:19 ` Pali Rohár
  2020-05-29 17:42 ` Kalle Valo
  0 siblings, 2 replies; 4+ messages in thread
From: Pali Rohár @ 2020-05-21 12:35 UTC (permalink / raw)
  To: Amitkumar Karwar, Ganapathi Bhat, Xinming Hu
  Cc: Kalle Valo, David S. Miller, Marek Behún, linux-wireless,
	netdev, linux-kernel

SD8997 firmware sends TLV_TYPE_MAX_CONN with struct hw_spec_max_conn to
inform kernel about maximum number of p2p connections and stations in AP
mode.

During initialization of SD8997 wifi chip kernel prints warning:

  mwifiex_sdio mmc0:0001:1: Unknown GET_HW_SPEC TLV type: 0x217

This patch adds support for parsing TLV_TYPE_MAX_CONN (0x217) and sets
appropriate cfg80211 member 'max_ap_assoc_sta' from retrieved structure.

It allows userspace to retrieve NL80211_ATTR_MAX_AP_ASSOC_STA attribute.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c |  5 +++++
 drivers/net/wireless/marvell/mwifiex/cmdevt.c   | 12 ++++++++++++
 drivers/net/wireless/marvell/mwifiex/fw.h       |  8 ++++++++
 drivers/net/wireless/marvell/mwifiex/main.h     |  1 +
 4 files changed, 26 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 12bfd653a..7998e91c9 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -4339,6 +4339,11 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
 		wiphy->iface_combinations = &mwifiex_iface_comb_ap_sta;
 	wiphy->n_iface_combinations = 1;
 
+	if (adapter->max_sta_conn > adapter->max_p2p_conn)
+		wiphy->max_ap_assoc_sta = adapter->max_sta_conn;
+	else
+		wiphy->max_ap_assoc_sta = adapter->max_p2p_conn;
+
 	/* Initialize cipher suits */
 	wiphy->cipher_suites = mwifiex_cipher_suites;
 	wiphy->n_cipher_suites = ARRAY_SIZE(mwifiex_cipher_suites);
diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
index 589cc5eb1..d068b9075 100644
--- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
@@ -1495,6 +1495,7 @@ int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv,
 	struct mwifiex_adapter *adapter = priv->adapter;
 	struct mwifiex_ie_types_header *tlv;
 	struct hw_spec_api_rev *api_rev;
+	struct hw_spec_max_conn *max_conn;
 	u16 resp_size, api_id;
 	int i, left_len, parsed_len = 0;
 
@@ -1604,6 +1605,17 @@ int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv,
 					break;
 				}
 				break;
+			case TLV_TYPE_MAX_CONN:
+				max_conn = (struct hw_spec_max_conn *)tlv;
+				adapter->max_p2p_conn = max_conn->max_p2p_conn;
+				adapter->max_sta_conn = max_conn->max_sta_conn;
+				mwifiex_dbg(adapter, INFO,
+					    "max p2p connections: %u\n",
+					    adapter->max_p2p_conn);
+				mwifiex_dbg(adapter, INFO,
+					    "max sta connections: %u\n",
+					    adapter->max_sta_conn);
+				break;
 			default:
 				mwifiex_dbg(adapter, FATAL,
 					    "Unknown GET_HW_SPEC TLV type: %#x\n",
diff --git a/drivers/net/wireless/marvell/mwifiex/fw.h b/drivers/net/wireless/marvell/mwifiex/fw.h
index 6f86f5b96..8047e3078 100644
--- a/drivers/net/wireless/marvell/mwifiex/fw.h
+++ b/drivers/net/wireless/marvell/mwifiex/fw.h
@@ -220,6 +220,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
 #define TLV_TYPE_BSS_MODE           (PROPRIETARY_TLV_BASE_ID + 206)
 #define TLV_TYPE_RANDOM_MAC         (PROPRIETARY_TLV_BASE_ID + 236)
 #define TLV_TYPE_CHAN_ATTR_CFG      (PROPRIETARY_TLV_BASE_ID + 237)
+#define TLV_TYPE_MAX_CONN           (PROPRIETARY_TLV_BASE_ID + 279)
 
 #define MWIFIEX_TX_DATA_BUF_SIZE_2K        2048
 
@@ -2388,4 +2389,11 @@ struct mwifiex_opt_sleep_confirm {
 	__le16 action;
 	__le16 resp_ctrl;
 } __packed;
+
+struct hw_spec_max_conn {
+	struct mwifiex_ie_types_header header;
+	u8 max_p2p_conn;
+	u8 max_sta_conn;
+} __packed;
+
 #endif /* !_MWIFIEX_FW_H_ */
diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h
index afaffc325..5923c5c14 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.h
+++ b/drivers/net/wireless/marvell/mwifiex/main.h
@@ -1022,6 +1022,7 @@ struct mwifiex_adapter {
 	bool ext_scan;
 	u8 fw_api_ver;
 	u8 key_api_major_ver, key_api_minor_ver;
+	u8 max_p2p_conn, max_sta_conn;
 	struct memory_type_mapping *mem_type_mapping_tbl;
 	u8 num_mem_types;
 	bool scan_chan_gap_enabled;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mwifiex: Add support for NL80211_ATTR_MAX_AP_ASSOC_STA
  2020-05-21 12:35 [PATCH] mwifiex: Add support for NL80211_ATTR_MAX_AP_ASSOC_STA Pali Rohár
@ 2020-05-29 17:19 ` Pali Rohár
  2020-05-29 17:28   ` Kalle Valo
  2020-05-29 17:42 ` Kalle Valo
  1 sibling, 1 reply; 4+ messages in thread
From: Pali Rohár @ 2020-05-29 17:19 UTC (permalink / raw)
  To: Kalle Valo, Ganapathi Bhat
  Cc: Amitkumar Karwar, Xinming Hu, David S. Miller, Marek Behún,
	linux-wireless, netdev, linux-kernel

On Thursday 21 May 2020 14:35:59 Pali Rohár wrote:
> SD8997 firmware sends TLV_TYPE_MAX_CONN with struct hw_spec_max_conn to
> inform kernel about maximum number of p2p connections and stations in AP
> mode.
> 
> During initialization of SD8997 wifi chip kernel prints warning:
> 
>   mwifiex_sdio mmc0:0001:1: Unknown GET_HW_SPEC TLV type: 0x217
> 
> This patch adds support for parsing TLV_TYPE_MAX_CONN (0x217) and sets
> appropriate cfg80211 member 'max_ap_assoc_sta' from retrieved structure.
> 
> It allows userspace to retrieve NL80211_ATTR_MAX_AP_ASSOC_STA attribute.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>

Hello Kalle and Ganapathi, could you please review this patch?

> ---
>  drivers/net/wireless/marvell/mwifiex/cfg80211.c |  5 +++++
>  drivers/net/wireless/marvell/mwifiex/cmdevt.c   | 12 ++++++++++++
>  drivers/net/wireless/marvell/mwifiex/fw.h       |  8 ++++++++
>  drivers/net/wireless/marvell/mwifiex/main.h     |  1 +
>  4 files changed, 26 insertions(+)
> 
> diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> index 12bfd653a..7998e91c9 100644
> --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> @@ -4339,6 +4339,11 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
>  		wiphy->iface_combinations = &mwifiex_iface_comb_ap_sta;
>  	wiphy->n_iface_combinations = 1;
>  
> +	if (adapter->max_sta_conn > adapter->max_p2p_conn)
> +		wiphy->max_ap_assoc_sta = adapter->max_sta_conn;
> +	else
> +		wiphy->max_ap_assoc_sta = adapter->max_p2p_conn;
> +
>  	/* Initialize cipher suits */
>  	wiphy->cipher_suites = mwifiex_cipher_suites;
>  	wiphy->n_cipher_suites = ARRAY_SIZE(mwifiex_cipher_suites);
> diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
> index 589cc5eb1..d068b9075 100644
> --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c
> +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
> @@ -1495,6 +1495,7 @@ int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv,
>  	struct mwifiex_adapter *adapter = priv->adapter;
>  	struct mwifiex_ie_types_header *tlv;
>  	struct hw_spec_api_rev *api_rev;
> +	struct hw_spec_max_conn *max_conn;
>  	u16 resp_size, api_id;
>  	int i, left_len, parsed_len = 0;
>  
> @@ -1604,6 +1605,17 @@ int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv,
>  					break;
>  				}
>  				break;
> +			case TLV_TYPE_MAX_CONN:
> +				max_conn = (struct hw_spec_max_conn *)tlv;
> +				adapter->max_p2p_conn = max_conn->max_p2p_conn;
> +				adapter->max_sta_conn = max_conn->max_sta_conn;
> +				mwifiex_dbg(adapter, INFO,
> +					    "max p2p connections: %u\n",
> +					    adapter->max_p2p_conn);
> +				mwifiex_dbg(adapter, INFO,
> +					    "max sta connections: %u\n",
> +					    adapter->max_sta_conn);
> +				break;
>  			default:
>  				mwifiex_dbg(adapter, FATAL,
>  					    "Unknown GET_HW_SPEC TLV type: %#x\n",
> diff --git a/drivers/net/wireless/marvell/mwifiex/fw.h b/drivers/net/wireless/marvell/mwifiex/fw.h
> index 6f86f5b96..8047e3078 100644
> --- a/drivers/net/wireless/marvell/mwifiex/fw.h
> +++ b/drivers/net/wireless/marvell/mwifiex/fw.h
> @@ -220,6 +220,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
>  #define TLV_TYPE_BSS_MODE           (PROPRIETARY_TLV_BASE_ID + 206)
>  #define TLV_TYPE_RANDOM_MAC         (PROPRIETARY_TLV_BASE_ID + 236)
>  #define TLV_TYPE_CHAN_ATTR_CFG      (PROPRIETARY_TLV_BASE_ID + 237)
> +#define TLV_TYPE_MAX_CONN           (PROPRIETARY_TLV_BASE_ID + 279)
>  
>  #define MWIFIEX_TX_DATA_BUF_SIZE_2K        2048
>  
> @@ -2388,4 +2389,11 @@ struct mwifiex_opt_sleep_confirm {
>  	__le16 action;
>  	__le16 resp_ctrl;
>  } __packed;
> +
> +struct hw_spec_max_conn {
> +	struct mwifiex_ie_types_header header;
> +	u8 max_p2p_conn;
> +	u8 max_sta_conn;
> +} __packed;
> +
>  #endif /* !_MWIFIEX_FW_H_ */
> diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h
> index afaffc325..5923c5c14 100644
> --- a/drivers/net/wireless/marvell/mwifiex/main.h
> +++ b/drivers/net/wireless/marvell/mwifiex/main.h
> @@ -1022,6 +1022,7 @@ struct mwifiex_adapter {
>  	bool ext_scan;
>  	u8 fw_api_ver;
>  	u8 key_api_major_ver, key_api_minor_ver;
> +	u8 max_p2p_conn, max_sta_conn;
>  	struct memory_type_mapping *mem_type_mapping_tbl;
>  	u8 num_mem_types;
>  	bool scan_chan_gap_enabled;
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mwifiex: Add support for NL80211_ATTR_MAX_AP_ASSOC_STA
  2020-05-29 17:19 ` Pali Rohár
@ 2020-05-29 17:28   ` Kalle Valo
  0 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2020-05-29 17:28 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Ganapathi Bhat, Amitkumar Karwar, Xinming Hu, David S. Miller,
	Marek Behún, linux-wireless, netdev, linux-kernel

Pali Rohár <pali@kernel.org> writes:

> On Thursday 21 May 2020 14:35:59 Pali Rohár wrote:
>> SD8997 firmware sends TLV_TYPE_MAX_CONN with struct hw_spec_max_conn to
>> inform kernel about maximum number of p2p connections and stations in AP
>> mode.
>> 
>> During initialization of SD8997 wifi chip kernel prints warning:
>> 
>>   mwifiex_sdio mmc0:0001:1: Unknown GET_HW_SPEC TLV type: 0x217
>> 
>> This patch adds support for parsing TLV_TYPE_MAX_CONN (0x217) and sets
>> appropriate cfg80211 member 'max_ap_assoc_sta' from retrieved structure.
>> 
>> It allows userspace to retrieve NL80211_ATTR_MAX_AP_ASSOC_STA attribute.
>> 
>> Signed-off-by: Pali Rohár <pali@kernel.org>
>
> Hello Kalle and Ganapathi, could you please review this patch?

To reduce email please first check the status from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#checking_state_of_patches_from_patchwork

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mwifiex: Add support for NL80211_ATTR_MAX_AP_ASSOC_STA
  2020-05-21 12:35 [PATCH] mwifiex: Add support for NL80211_ATTR_MAX_AP_ASSOC_STA Pali Rohár
  2020-05-29 17:19 ` Pali Rohár
@ 2020-05-29 17:42 ` Kalle Valo
  1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2020-05-29 17:42 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Amitkumar Karwar, Ganapathi Bhat, Xinming Hu, David S. Miller,
	Marek Behún, linux-wireless, netdev, linux-kernel

Pali Rohár <pali@kernel.org> wrote:

> SD8997 firmware sends TLV_TYPE_MAX_CONN with struct hw_spec_max_conn to
> inform kernel about maximum number of p2p connections and stations in AP
> mode.
> 
> During initialization of SD8997 wifi chip kernel prints warning:
> 
>   mwifiex_sdio mmc0:0001:1: Unknown GET_HW_SPEC TLV type: 0x217
> 
> This patch adds support for parsing TLV_TYPE_MAX_CONN (0x217) and sets
> appropriate cfg80211 member 'max_ap_assoc_sta' from retrieved structure.
> 
> It allows userspace to retrieve NL80211_ATTR_MAX_AP_ASSOC_STA attribute.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>

Patch applied to wireless-drivers-next.git, thanks.

982d7287f8da mwifiex: Add support for NL80211_ATTR_MAX_AP_ASSOC_STA

-- 
https://patchwork.kernel.org/patch/11562835/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-29 17:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-21 12:35 [PATCH] mwifiex: Add support for NL80211_ATTR_MAX_AP_ASSOC_STA Pali Rohár
2020-05-29 17:19 ` Pali Rohár
2020-05-29 17:28   ` Kalle Valo
2020-05-29 17:42 ` 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).