* [PATCH] nl80211: Print reasons for errors in setting bitrates.
@ 2015-09-18 21:02 greearb
2015-09-21 12:27 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: greearb @ 2015-09-18 21:02 UTC (permalink / raw)
To: linux-wireless; +Cc: johannes, Ben Greear
From: Ben Greear <greearb@candelatech.com>
Makes it easier to figure out why user-space calls are
failing.
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
net/wireless/nl80211.c | 37 +++++++++++++++++++++++++++++--------
1 file changed, 29 insertions(+), 8 deletions(-)
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index ba73def..94c9ad8 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -8287,44 +8287,60 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
enum ieee80211_band band = nla_type(tx_rates);
int err;
- if (band < 0 || band >= IEEE80211_NUM_BANDS)
+ if (band < 0 || band >= IEEE80211_NUM_BANDS) {
+ pr_err("band: %d is out of range, num-bands: %d\n",
+ band, IEEE80211_NUM_BANDS);
return -EINVAL;
+ }
sband = rdev->wiphy.bands[band];
- if (sband == NULL)
+ if (!sband) {
+ pr_err("sband[%d] is null\n", band);
return -EINVAL;
+ }
err = nla_parse(tb, NL80211_TXRATE_MAX, nla_data(tx_rates),
nla_len(tx_rates), nl80211_txattr_policy);
- if (err)
+ if (err) {
+ pr_err("Error parsing tx_rates, band: %d\n", band);
return err;
+ }
if (tb[NL80211_TXRATE_LEGACY]) {
mask.control[band].legacy = rateset_to_mask(
sband,
nla_data(tb[NL80211_TXRATE_LEGACY]),
nla_len(tb[NL80211_TXRATE_LEGACY]));
if ((mask.control[band].legacy == 0) &&
- nla_len(tb[NL80211_TXRATE_LEGACY]))
+ nla_len(tb[NL80211_TXRATE_LEGACY])) {
+ pr_err("Legacy rates invalid, band: %d.\n",
+ band);
return -EINVAL;
+ }
}
if (tb[NL80211_TXRATE_HT]) {
if (!ht_rateset_to_mask(
sband,
nla_data(tb[NL80211_TXRATE_HT]),
nla_len(tb[NL80211_TXRATE_HT]),
- mask.control[band].ht_mcs))
+ mask.control[band].ht_mcs)) {
+ pr_err("HT rates invalid, band: %d\n", band);
return -EINVAL;
+ }
}
if (tb[NL80211_TXRATE_VHT]) {
if (!vht_set_mcs_mask(
sband,
nla_data(tb[NL80211_TXRATE_VHT]),
- mask.control[band].vht_mcs))
+ mask.control[band].vht_mcs)) {
+ pr_err("VHT rates invalid, band: %d\n", band);
return -EINVAL;
+ }
}
if (tb[NL80211_TXRATE_GI]) {
mask.control[band].gi =
nla_get_u8(tb[NL80211_TXRATE_GI]);
- if (mask.control[band].gi > NL80211_TXRATE_FORCE_LGI)
+ if (mask.control[band].gi > NL80211_TXRATE_FORCE_LGI) {
+ pr_err("FORCE-LGI invalid, band: %d\n", band);
return -EINVAL;
+ }
}
if (mask.control[band].legacy == 0) {
@@ -8332,8 +8348,11 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
* are not even supported.
*/
if (!(rdev->wiphy.bands[band]->ht_cap.ht_supported ||
- rdev->wiphy.bands[band]->vht_cap.vht_supported))
+ rdev->wiphy.bands[band]->vht_cap.vht_supported)) {
+ pr_err("Legacy is empty, as is ht, vht, band: %d\n",
+ band);
return -EINVAL;
+ }
for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++)
if (mask.control[band].ht_mcs[i])
@@ -8344,6 +8363,8 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
goto out;
/* legacy and mcs rates may not be both empty */
+ pr_err("Legacy and MCS both empty sets, band: %d\n",
+ band);
return -EINVAL;
}
}
--
2.4.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] nl80211: Print reasons for errors in setting bitrates.
2015-09-18 21:02 [PATCH] nl80211: Print reasons for errors in setting bitrates greearb
@ 2015-09-21 12:27 ` Johannes Berg
2015-09-21 15:53 ` Ben Greear
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2015-09-21 12:27 UTC (permalink / raw)
To: greearb, linux-wireless
On Fri, 2015-09-18 at 14:02 -0700, greearb@candelatech.com wrote:
> From: Ben Greear <greearb@candelatech.com>
>
> Makes it easier to figure out why user-space calls are
> failing.
I'm aware of this problem, but I'm not going to gratuitously start
printing to dmesg for this.
There's a scheme being discussed for extended error numbers/messages,
particularly for perf but it might be implemented for any syscall. We
might be able to extend that to netlink in a different way, including
the description in the (extended) netlink ack message.
johannes
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nl80211: Print reasons for errors in setting bitrates.
2015-09-21 12:27 ` Johannes Berg
@ 2015-09-21 15:53 ` Ben Greear
0 siblings, 0 replies; 3+ messages in thread
From: Ben Greear @ 2015-09-21 15:53 UTC (permalink / raw)
To: Johannes Berg, linux-wireless
On 09/21/2015 05:27 AM, Johannes Berg wrote:
> On Fri, 2015-09-18 at 14:02 -0700, greearb@candelatech.com wrote:
>> From: Ben Greear <greearb@candelatech.com>
>>
>> Makes it easier to figure out why user-space calls are
>> failing.
>
> I'm aware of this problem, but I'm not going to gratuitously start
> printing to dmesg for this.
>
> There's a scheme being discussed for extended error numbers/messages,
> particularly for perf but it might be implemented for any syscall. We
> might be able to extend that to netlink in a different way, including
> the description in the (extended) netlink ack message.
I understand...I figured the patch might not be wanted. A more general
solution would be welcome.
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-09-21 15:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-18 21:02 [PATCH] nl80211: Print reasons for errors in setting bitrates greearb
2015-09-21 12:27 ` Johannes Berg
2015-09-21 15:53 ` Ben Greear
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).