All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pkshih <pkshih@realtek.com>
To: "kvalo@codeaurora.org" <kvalo@codeaurora.org>,
	"ath10k@lists.infradead.org" <ath10k@lists.infradead.org>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH 1/2] nl80211: vendor-cmd: qca: add dynamic SAR power limits
Date: Thu, 19 Dec 2019 09:44:52 +0000	[thread overview]
Message-ID: <1576748692.7758.17.camel@realtek.com> (raw)
In-Reply-To: <1576684108-30177-2-git-send-email-kvalo@codeaurora.org>

On Wed, 2019-12-18 at 17:48 +0200, Kalle Valo wrote:
> From: Wen Gong <wgong@codeaurora.org>
> 
> The vendor commands is to add API for user to configure dynamic SAR
> power limits, it will not replace the existing power control
> functionality, it is to make more convenient to configure power.
> 
> An example of usage(wlan0 is the wireless interface dev name):
> iw dev wlan0 vendor send 0x1374 0x92 0x2C 0x00 0x03 0x00 0x14 0x00 0x01
> 0x00 0x08 0x00 0x07 0x00 0x22 0x00 0x00 0x00 0x08 0x00 0x04 0x00 0x00
> 0x00 0x00 0x00 0x14 0x00 0x02 0x00 0x08 0x00 0x07 0x00 0x11 0x00 0x00
> 0x00 0x08 0x00 0x04 0x00 0x01 0x00 0x00 0x00
> 
> means of bytes:
> 0x1374: vendor id
> 0x92: vendor subcmd id
> 0x22: 2.4G power limit
> 0x11: 5G power limit
> 
> Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00029.
> 
> Signed-off-by: Wen Gong <wgong@codeaurora.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
> ---
>  include/uapi/nl80211-vnd-qca.h | 68
> ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 68 insertions(+)
>  create mode 100644 include/uapi/nl80211-vnd-qca.h
> 
> diff --git a/include/uapi/nl80211-vnd-qca.h b/include/uapi/nl80211-vnd-qca.h
> new file mode 100644
> index 000000000000..482c9409a2c0
> --- /dev/null
> +++ b/include/uapi/nl80211-vnd-qca.h
> @@ -0,0 +1,68 @@
> +/* SPDX-License-Identifier: ISC */
> +/*
> + * Copyright (c) 2019 The Linux Foundation. All rights reserved.
> + */
> +
> +#ifndef _UAPI_NL80211_VND_QCA_H
> +#define _UAPI_NL80211_VND_QCA_H
> +
> +/* Vendor id to be used in vendor specific command and events to user space
> + * NOTE: The authoritative place for definition of QCA_NL80211_VENDOR_ID,
> + * vendor subcmd definitions prefixed with QCA_NL80211_VENDOR_SUBCMD, and
> + * qca_wlan_vendor_attr is open source file src/common/qca-vendor.h in
> + * git://w1.fi/srv/git/hostap.git; the values here are just a copy of that
> + */
> +#define QCA_NL80211_VENDOR_ID 0x001374
> +
> +/**
> + * enum qca_nl80211_vendor_subcmds - QCA nl80211 vendor command identifiers
> + *
> + *@QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS and is used to retrieve the
> + *	settings currently in use. The attributes returned by this command
> are
> + *	defined by enum qca_vendor_attr_sar_limits.
> + */
> +enum qca_nl80211_vendor_subcmds {
> +	QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS = 146,
> +	};
> +
> +/**
> + * enum qca_vendor_attr_sar_limits - Attributes for SAR power limits
> + *
> + * @QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC: Nested array of SAR power
> + *	limit specifications. The number of specifications is
> + *	specified by @QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_NUM_SPECS. Each
> + *	specification contains a set of
> + *	QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_* attributes. A
> + *	specification is uniquely identified by the attributes
> + *	%QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_BAND and always
> + *	contains as a payload the attribute
> + *	%QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT.
> + *
> + * @QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_BAND: Optional (u32) value to
> + *	indicate for which band this specification applies. Valid
> + *	values are enumerated in enum %nl80211_band (although not all
> + *	bands may be supported by a given device). If the attribute is

Can we define separated enum to address four 5G sub-bands, likes

enum nl80211_sar_band {
	NL80211_SAR_BAND_2G,
	NL80211_SAR_BAND_5G_BAND1,
	NL80211_SAR_BAND_5G_BAND2,
	NL80211_SAR_BAND_5G_BAND3,
	NL80211_SAR_BAND_5G_BAND4,
};

I think this vendor command can be a generic nl80211 command, because
we need SAR
power limit as well.

> + *	not supplied then the specification will be applied to all
> + *	supported bands.
> + *
> + * @QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT: Required (u32)
> + *	value to specify the actual power limit value in units of 0.5
> + *	dBm (i.e., a value of 11 represents 5.5 dBm).

Can we have higher precision, in unit of 0.125?


> + *	This is required, when %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT is
> + *	%QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_USER.
> + *
> + * These attributes are used with %QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS
> + * and %QCA_NL80211_VENDOR_SUBCMD_GET_SAR_LIMITS.
> + */
> +enum qca_vendor_attr_sar_limits {
> +	QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_INVALID = 0,
> +	QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC = 3,
> +	QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_BAND = 4,
> +	QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT = 7,

Why these enum aren't continual?
The reason may be because QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT and something
me
ntioned in above paragraph but missing in this enum?

They will waste memory when doing nla_parse() with tb[MAX];

> +
> +	QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_AFTER_LAST,
> +	QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_MAX =
> +		QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_AFTER_LAST - 1
> +};
> +
> +#endif /* _UAPI_NL80211_VND_QCA_H_ */

WARNING: multiple messages have this Message-ID (diff)
From: Pkshih <pkshih@realtek.com>
To: "kvalo@codeaurora.org" <kvalo@codeaurora.org>,
	"ath10k@lists.infradead.org" <ath10k@lists.infradead.org>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH 1/2] nl80211: vendor-cmd: qca: add dynamic SAR power limits
Date: Thu, 19 Dec 2019 09:44:52 +0000	[thread overview]
Message-ID: <1576748692.7758.17.camel@realtek.com> (raw)
In-Reply-To: <1576684108-30177-2-git-send-email-kvalo@codeaurora.org>

On Wed, 2019-12-18 at 17:48 +0200, Kalle Valo wrote:
> From: Wen Gong <wgong@codeaurora.org>
> 
> The vendor commands is to add API for user to configure dynamic SAR
> power limits, it will not replace the existing power control
> functionality, it is to make more convenient to configure power.
> 
> An example of usage(wlan0 is the wireless interface dev name):
> iw dev wlan0 vendor send 0x1374 0x92 0x2C 0x00 0x03 0x00 0x14 0x00 0x01
> 0x00 0x08 0x00 0x07 0x00 0x22 0x00 0x00 0x00 0x08 0x00 0x04 0x00 0x00
> 0x00 0x00 0x00 0x14 0x00 0x02 0x00 0x08 0x00 0x07 0x00 0x11 0x00 0x00
> 0x00 0x08 0x00 0x04 0x00 0x01 0x00 0x00 0x00
> 
> means of bytes:
> 0x1374: vendor id
> 0x92: vendor subcmd id
> 0x22: 2.4G power limit
> 0x11: 5G power limit
> 
> Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00029.
> 
> Signed-off-by: Wen Gong <wgong@codeaurora.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
> ---
>  include/uapi/nl80211-vnd-qca.h | 68
> ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 68 insertions(+)
>  create mode 100644 include/uapi/nl80211-vnd-qca.h
> 
> diff --git a/include/uapi/nl80211-vnd-qca.h b/include/uapi/nl80211-vnd-qca.h
> new file mode 100644
> index 000000000000..482c9409a2c0
> --- /dev/null
> +++ b/include/uapi/nl80211-vnd-qca.h
> @@ -0,0 +1,68 @@
> +/* SPDX-License-Identifier: ISC */
> +/*
> + * Copyright (c) 2019 The Linux Foundation. All rights reserved.
> + */
> +
> +#ifndef _UAPI_NL80211_VND_QCA_H
> +#define _UAPI_NL80211_VND_QCA_H
> +
> +/* Vendor id to be used in vendor specific command and events to user space
> + * NOTE: The authoritative place for definition of QCA_NL80211_VENDOR_ID,
> + * vendor subcmd definitions prefixed with QCA_NL80211_VENDOR_SUBCMD, and
> + * qca_wlan_vendor_attr is open source file src/common/qca-vendor.h in
> + * git://w1.fi/srv/git/hostap.git; the values here are just a copy of that
> + */
> +#define QCA_NL80211_VENDOR_ID 0x001374
> +
> +/**
> + * enum qca_nl80211_vendor_subcmds - QCA nl80211 vendor command identifiers
> + *
> + *@QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS and is used to retrieve the
> + *	settings currently in use. The attributes returned by this command
> are
> + *	defined by enum qca_vendor_attr_sar_limits.
> + */
> +enum qca_nl80211_vendor_subcmds {
> +	QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS = 146,
> +	};
> +
> +/**
> + * enum qca_vendor_attr_sar_limits - Attributes for SAR power limits
> + *
> + * @QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC: Nested array of SAR power
> + *	limit specifications. The number of specifications is
> + *	specified by @QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_NUM_SPECS. Each
> + *	specification contains a set of
> + *	QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_* attributes. A
> + *	specification is uniquely identified by the attributes
> + *	%QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_BAND and always
> + *	contains as a payload the attribute
> + *	%QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT.
> + *
> + * @QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_BAND: Optional (u32) value to
> + *	indicate for which band this specification applies. Valid
> + *	values are enumerated in enum %nl80211_band (although not all
> + *	bands may be supported by a given device). If the attribute is

Can we define separated enum to address four 5G sub-bands, likes

enum nl80211_sar_band {
	NL80211_SAR_BAND_2G,
	NL80211_SAR_BAND_5G_BAND1,
	NL80211_SAR_BAND_5G_BAND2,
	NL80211_SAR_BAND_5G_BAND3,
	NL80211_SAR_BAND_5G_BAND4,
};

I think this vendor command can be a generic nl80211 command, because
we need SAR
power limit as well.

> + *	not supplied then the specification will be applied to all
> + *	supported bands.
> + *
> + * @QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT: Required (u32)
> + *	value to specify the actual power limit value in units of 0.5
> + *	dBm (i.e., a value of 11 represents 5.5 dBm).

Can we have higher precision, in unit of 0.125?


> + *	This is required, when %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT is
> + *	%QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_USER.
> + *
> + * These attributes are used with %QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS
> + * and %QCA_NL80211_VENDOR_SUBCMD_GET_SAR_LIMITS.
> + */
> +enum qca_vendor_attr_sar_limits {
> +	QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_INVALID = 0,
> +	QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC = 3,
> +	QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_BAND = 4,
> +	QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT = 7,

Why these enum aren't continual?
The reason may be because QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT and something
me
ntioned in above paragraph but missing in this enum?

They will waste memory when doing nla_parse() with tb[MAX];

> +
> +	QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_AFTER_LAST,
> +	QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_MAX =
> +		QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_AFTER_LAST - 1
> +};
> +
> +#endif /* _UAPI_NL80211_VND_QCA_H_ */
_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

  reply	other threads:[~2019-12-19  9:45 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-18 15:48 [PATCH 0/2] ath10k: SAR power limit vendor command Kalle Valo
2019-12-18 15:48 ` Kalle Valo
2019-12-18 15:48 ` [PATCH 1/2] nl80211: vendor-cmd: qca: add dynamic SAR power limits Kalle Valo
2019-12-18 15:48   ` Kalle Valo
2019-12-19  9:44   ` Pkshih [this message]
2019-12-19  9:44     ` Pkshih
2019-12-19 15:48     ` Jouni Malinen
2019-12-19 15:48       ` Jouni Malinen
2019-12-19 18:32       ` Brian Norris
2019-12-19 18:32         ` Brian Norris
2019-12-19 18:55         ` Jouni Malinen
2019-12-19 18:55           ` Jouni Malinen
2019-12-19 23:40           ` Brian Norris
2019-12-19 23:40             ` Brian Norris
2020-03-17 16:54             ` Kalle Valo
2020-03-17 16:54               ` Kalle Valo
2020-03-20 12:55               ` Johannes Berg
2020-03-20 12:55                 ` Johannes Berg
2020-06-02  1:32                 ` Brian Norris
2020-06-02  1:32                   ` Brian Norris
2020-07-16  9:35                   ` Kalle Valo
2020-07-16  9:35                     ` Kalle Valo
2020-07-16 18:56                     ` Brian Norris
2020-07-16 18:56                       ` Brian Norris
2020-07-24  9:26                       ` Kalle Valo
2020-07-24  9:26                         ` Kalle Valo
2020-07-30 13:24                         ` Johannes Berg
2020-07-30 13:24                           ` Johannes Berg
2020-08-01  1:31                           ` Brian Norris
2020-08-01  1:31                             ` Brian Norris
2020-09-08  5:55                           ` Kalle Valo
2020-09-08  5:55                           ` Kalle Valo
2020-07-30 13:17                   ` Johannes Berg
2020-07-30 13:17                     ` Johannes Berg
2019-12-18 15:48 ` [PATCH 2/2] ath10k: allow dynamic SAR power limits to be configured Kalle Valo
2019-12-18 15:48   ` Kalle Valo
2019-12-19  9:45   ` Pkshih
2019-12-19  9:45     ` Pkshih
2020-04-16  7:38   ` Kalle Valo
2020-04-16  7:38   ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1576748692.7758.17.camel@realtek.com \
    --to=pkshih@realtek.com \
    --cc=ath10k@lists.infradead.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.