[RFC 1/2] nl80211: add common API to configure SAR power limitations.
Abhishek Kumar
kuabhs at chromium.org
Fri Oct 30 22:46:31 EDT 2020
From: kuabhs at chromium.org
There are few more additional comments here.
> + * @NL80211_CMD_SET_SAR_SPECS: SAR power limitation configuration is
> + * Â Â passed using %NL80211_ATTR_SAR_SPEC.
> + *
This command requires NL80211_ATTR_IFINDEX, probably should be better to add
this in the comment ?
> +static int
> +nl80211_put_sar_specs(struct cfg80211_registered_device *rdev,
> + Â Â Â Â Â Â Â Â Â Â struct sk_buff *msg)
> +{
> + Â Â Â struct nlattr *sar_capa, *specs, *sub_freq_range;
> + Â Â Â u8 Â num_freq_ranges;
> + Â Â Â int i;
> +
> + Â Â Â if (!rdev->wiphy.sar_capa)
> + Â Â Â Â Â Â Â return 0;
> +
> + Â Â Â num_freq_ranges = rdev->wiphy.sar_capa->num_freq_ranges;
> +
> + Â Â Â sar_capa = nla_nest_start(msg, NL80211_ATTR_SAR_SPEC);
> + Â Â Â if (!sar_capa)
> + Â Â Â Â Â Â Â return -ENOSPC;
I see some places nla_nest_start_noflag being used and here nla_nest_start.
Whats the specific reason to do that ? In the newer Kernel versions, I believe
nla_nest_start is preferred.
> + Â Â Â Â Â Â Â power = nla_get_u8(spec[NL80211_SAR_ATTR_SPECS_POWER]);
> + Â Â Â Â Â Â Â sar_spec->sub_specs[specs].power = power;
> +
> + Â Â Â Â Â Â Â /* if NL80211_SAR_ATTR_SPECS_FREQ_RANGE_INDEX isn't present,
> + Â Â Â Â Â Â Â Â * then the power applies to all bands. But it's only valid
> + Â Â Â Â Â Â Â Â * for the first entry.
> + Â Â Â Â Â Â Â Â */
> + Â Â Â Â Â Â Â if (!spec[NL80211_SAR_ATTR_SPECS_FREQ_RANGE_INDEX]) {
> + Â Â Â Â Â Â Â Â Â Â Â if (specs) {
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â err = -EINVAL;
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â goto error;
> + Â Â Â Â Â Â Â Â Â Â Â } else {
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â sar_spec->sub_specs[specs].freq_range_index =
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â NL80211_SAR_ALL_FREQ_RNAGES;
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â specs++;
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break;
> + Â Â Â Â Â Â Â Â Â Â Â }
> + Â Â Â Â Â Â Â }
Here I see you are assigning same power to all freq band if for the first band
the freq index is not provided. Is there any specific reason to only check the first
here ? Probably this logic should move into specific drivers. Thoughts ?
-Abhishek
More information about the ath10k
mailing list