[PATCH] iw: print 4ADDR attribute when dumping interface

2018-06-17 Thread Antonio Quartulli
Print the value of the 4ADDr attribute when dumping the interface
status.

Signed-off-by: Antonio Quartulli 
---
 interface.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/interface.c b/interface.c
index 712bbdc..678955d 100644
--- a/interface.c
+++ b/interface.c
@@ -447,6 +447,11 @@ static int print_iface_handler(struct nl_msg *msg, void 
*arg)
printf("%s\tmulticast TXQ:%s\n", indent, buf);
}
 
+   if (tb_msg[NL80211_ATTR_4ADDR]) {
+   uint8_t use_4addr = nla_get_u8(tb_msg[NL80211_ATTR_4ADDR]);
+   printf("%s\t4addr: %d\n", indent, use_4addr);
+   }
+
return NL_SKIP;
 }
 
-- 
2.17.1



Re: Atheros AR9462 - 5Ghz not working

2018-06-17 Thread Tom Psyborg
Hi

Your log only show attemps on ch 2447, Can you try connecting to 5GHz
AP? Connect to Hidden Wireless Network option at the bottom of the
nm-applet? Running airodump in monitor mode to see if it captures
anything? Maybe your laptop's antennas were designed for 2.4G card
only but this just dumb guessing...

On 17/06/2018, mgre...@cinci.rr.com  wrote:
>
>  "Michał Kazior"  wrote:
>> On 15 June 2018 at 19:23,   wrote:
>> >  mgre...@cinci.rr.com wrote:
>> >>  "Michał Kazior"  wrote:
>> >> > Your noise floor readout in survey dump is terribly bad for 5GHz. It
>> >> > ain't stellar for 2.4GHz either but within reason nonetheless.
>> >> >
>> >> > Did you try using the card in a different device? I wonder if the
>> >> > device you're trying to use it in has some sort of internal noise on
>> >> > those frequencies and/or ath9k's ANI isn't able to deal with it.
>> >> >
>> >> >
>> >> > Michał
>> >> >
>> >> > On 15 June 2018 at 15:31,   wrote:
>> >>
>> >> I did.
>> >> I took it out of the Penguin-Z notebook and put it in a Dell XPS15 9560
>> >> running Windows 10. Only 2.4Ghz networks were visible from there as
>> >> well. Not exactly apples-to-apples, but consistent results.
>>
>> This reduces likeliness this is tied to a os/driver issue. Maybe
>> calibration data on the device eeprom is broken? Or maybe it's a
>> hardware defect?
>
>
>
>
> I have three of these cards all with the same problem, so if it's a hardware
> defect then it's pretty much game over and these cards are all useless.
> Forgive my ignorance, but is there any way to check/fix calibration data?
>
>
>
>
>>
>>
>> > Could it be antenna related (in multiple devices)?
>>
>> Antennas can be designed to work better on certain frequency ranges. I
>> wouldn't expect such a dramatic effect though.
>>
>>
>> > On wikidevi.com I see some M.2 cards listed with an antenna connector of
>> > U.FL and others with MHF4. I can't find anything describing the
>> > difference, if any. The connectors seemed to fit OK. Also, what's the
>> > deal with 'main' and 'aux' antenna connectors? I've seen people suggest
>> > swapping them has helped in some cases with poor signal, while others
>> > insist that it makes no difference. I have not tried swapping the
>> > connectors.
>>
>> I think it's not a connector problem because 2.4GHz scan results
>> report reasonable signal strength for found APs (-60dBm). My
>> experience is that if you use a wrong (but seemingly fitting)
>> connector you'd get near 0 results or below -90dBm across the board.
>>
>>
>> Michał
>
>


Re: Atheros AR9462 - 5Ghz not working

2018-06-17 Thread mgreger


 "Michał Kazior"  wrote: 
> On 15 June 2018 at 19:23,   wrote:
> >  mgre...@cinci.rr.com wrote:
> >>  "Michał Kazior"  wrote:
> >> > Your noise floor readout in survey dump is terribly bad for 5GHz. It
> >> > ain't stellar for 2.4GHz either but within reason nonetheless.
> >> >
> >> > Did you try using the card in a different device? I wonder if the
> >> > device you're trying to use it in has some sort of internal noise on
> >> > those frequencies and/or ath9k's ANI isn't able to deal with it.
> >> >
> >> >
> >> > Michał
> >> >
> >> > On 15 June 2018 at 15:31,   wrote:
> >>
> >> I did.
> >> I took it out of the Penguin-Z notebook and put it in a Dell XPS15 9560 
> >> running Windows 10. Only 2.4Ghz networks were visible from there as well. 
> >> Not exactly apples-to-apples, but consistent results.
> 
> This reduces likeliness this is tied to a os/driver issue. Maybe
> calibration data on the device eeprom is broken? Or maybe it's a
> hardware defect?




I have three of these cards all with the same problem, so if it's a hardware 
defect then it's pretty much game over and these cards are all useless.
Forgive my ignorance, but is there any way to check/fix calibration data?




> 
> 
> > Could it be antenna related (in multiple devices)?
> 
> Antennas can be designed to work better on certain frequency ranges. I
> wouldn't expect such a dramatic effect though.
> 
> 
> > On wikidevi.com I see some M.2 cards listed with an antenna connector of 
> > U.FL and others with MHF4. I can't find anything describing the difference, 
> > if any. The connectors seemed to fit OK. Also, what's the deal with 'main' 
> > and 'aux' antenna connectors? I've seen people suggest swapping them has 
> > helped in some cases with poor signal, while others insist that it makes no 
> > difference. I have not tried swapping the connectors.
> 
> I think it's not a connector problem because 2.4GHz scan results
> report reasonable signal strength for found APs (-60dBm). My
> experience is that if you use a wrong (but seemingly fitting)
> connector you'd get near 0 results or below -90dBm across the board.
> 
> 
> Michał



Re: [PATCH v3 5/5] staging: use BIT_ULL for NL80211_STA_INFO_* attribute types

2018-06-17 Thread Greg KH
On Sun, Jun 17, 2018 at 01:07:36PM +0300, Omer Efrat wrote:
> The BIT macro uses unsigned long which some architectures handle as 32 bit
> and therefore might cause macro's shift to overflow when used on a value
> equals or larger than 32 (NL80211_STA_INFO_RX_DURATION and afterwards).
> 
> Since 'filled' member in station_info changed to u64, BIT_ULL macro
> should be used with all NL80211_STA_INFO_* attribute types instead of BIT
> to prevent future possible bugs when one will use BIT macro for higher
> attributes by mistake.
> 
> This commit cleans up all usages of BIT macro with the above field
> in cfg80211 by changing it to BIT_ULL instead.
> 
> Signed-off-by: Omer Efrat 

Acked-by: Greg Kroah-Hartman 



[PATCH v3 5/5] staging: use BIT_ULL for NL80211_STA_INFO_* attribute types

2018-06-17 Thread Omer Efrat
The BIT macro uses unsigned long which some architectures handle as 32 bit
and therefore might cause macro's shift to overflow when used on a value
equals or larger than 32 (NL80211_STA_INFO_RX_DURATION and afterwards).

Since 'filled' member in station_info changed to u64, BIT_ULL macro
should be used with all NL80211_STA_INFO_* attribute types instead of BIT
to prevent future possible bugs when one will use BIT macro for higher
attributes by mistake.

This commit cleans up all usages of BIT macro with the above field
in cfg80211 by changing it to BIT_ULL instead.

Signed-off-by: Omer Efrat 
---
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 10 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 14 +++---
 drivers/staging/wlan-ng/cfg80211.c|  4 ++--
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 02178e2..26b838f 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -1273,16 +1273,16 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy,
goto exit;
}
 
-   sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL);
sinfo->signal = 
translate_percentage_to_dbm(padapter->recvpriv.signal_strength);
 
-   sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
sinfo->txrate.legacy = rtw_get_cur_max_rate(padapter);
 
-   sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS);
sinfo->rx_packets = sta_rx_data_pkts(psta);
 
-   sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS);
sinfo->tx_packets = psta->sta_stats.tx_pkts;
 
}
@@ -3013,7 +3013,7 @@ static intcfg80211_rtw_dump_station(struct wiphy 
*wiphy, struct net_device *nde
goto exit;
}
memcpy(mac, psta->hwaddr, ETH_ALEN);
-   sinfo->filled = BIT(NL80211_STA_INFO_SIGNAL);
+   sinfo->filled = BIT_ULL(NL80211_STA_INFO_SIGNAL);
sinfo->signal = psta->rssi;
 
 exit:
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index e248702..13d3918 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1141,7 +1141,7 @@ static int get_station(struct wiphy *wiphy, struct 
net_device *dev,
return -ENOENT;
}
 
-   sinfo->filled |= BIT(NL80211_STA_INFO_INACTIVE_TIME);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME);
 
wilc_get_inactive_time(vif, mac, _time);
sinfo->inactive_time = 1000 * inactive_time;
@@ -1150,11 +1150,11 @@ static int get_station(struct wiphy *wiphy, struct 
net_device *dev,
 
wilc_get_statistics(vif, );
 
-   sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL) |
-BIT(NL80211_STA_INFO_RX_PACKETS) |
-BIT(NL80211_STA_INFO_TX_PACKETS) |
-BIT(NL80211_STA_INFO_TX_FAILED) |
-BIT(NL80211_STA_INFO_TX_BITRATE);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL) |
+BIT_ULL(NL80211_STA_INFO_RX_PACKETS) |
+BIT_ULL(NL80211_STA_INFO_TX_PACKETS) |
+BIT_ULL(NL80211_STA_INFO_TX_FAILED) |
+BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
 
sinfo->signal = stats.rssi;
sinfo->rx_packets = stats.rx_cnt;
@@ -1775,7 +1775,7 @@ static int dump_station(struct wiphy *wiphy, struct 
net_device *dev,
priv = wiphy_priv(wiphy);
vif = netdev_priv(priv->dev);
 
-   sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL);
 
wilc_get_rssi(vif, >signal);
 
diff --git a/drivers/staging/wlan-ng/cfg80211.c 
b/drivers/staging/wlan-ng/cfg80211.c
index 4291225..07c52e3 100644
--- a/drivers/staging/wlan-ng/cfg80211.c
+++ b/drivers/staging/wlan-ng/cfg80211.c
@@ -282,9 +282,9 @@ static int prism2_get_station(struct wiphy *wiphy, struct 
net_device *dev,
 
if (result == 0) {
sinfo->txrate.legacy = quality.txrate.data;
-   sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
sinfo->signal = quality.level.data;
-   sinfo->filled |= 

[PATCH v3 2/5] mac80211: use BIT_ULL for NL80211_STA_INFO_* attribute types

2018-06-17 Thread Omer Efrat
The BIT macro uses unsigned long which some architectures handle as 32 bit
and therefore might cause macro's shift to overflow when used on a value
equals or larger than 32 (NL80211_STA_INFO_RX_DURATION and afterwards).

Since 'filled' member in station_info changed to u64, BIT_ULL macro
should be used with all NL80211_STA_INFO_* attribute types instead of BIT
to prevent future possible bugs when one will use BIT macro for higher
attributes by mistake.

This commit cleans up all usages of BIT macro with the above field
in mac80211 by changing it to BIT_ULL instead.

Signed-off-by: Omer Efrat 
---
 net/mac80211/ethtool.c  |  6 ++--
 net/mac80211/sta_info.c | 84 -
 2 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/net/mac80211/ethtool.c b/net/mac80211/ethtool.c
index 690c142..5ac7438 100644
--- a/net/mac80211/ethtool.c
+++ b/net/mac80211/ethtool.c
@@ -116,16 +116,16 @@ static void ieee80211_get_stats(struct net_device *dev,
data[i++] = sta->sta_state;
 
 
-   if (sinfo.filled & BIT(NL80211_STA_INFO_TX_BITRATE))
+   if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE))
data[i] = 10ULL *
cfg80211_calculate_bitrate();
i++;
-   if (sinfo.filled & BIT(NL80211_STA_INFO_RX_BITRATE))
+   if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_RX_BITRATE))
data[i] = 10ULL *
cfg80211_calculate_bitrate();
i++;
 
-   if (sinfo.filled & BIT(NL80211_STA_INFO_SIGNAL_AVG))
+   if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG))
data[i] = (u8)sinfo.signal_avg;
i++;
} else {
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index aa8fe77..f342022 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -2114,38 +2114,38 @@ void sta_set_sinfo(struct sta_info *sta, struct 
station_info *sinfo,
 
drv_sta_statistics(local, sdata, >sta, sinfo);
 
-   sinfo->filled |= BIT(NL80211_STA_INFO_INACTIVE_TIME) |
-BIT(NL80211_STA_INFO_STA_FLAGS) |
-BIT(NL80211_STA_INFO_BSS_PARAM) |
-BIT(NL80211_STA_INFO_CONNECTED_TIME) |
-BIT(NL80211_STA_INFO_RX_DROP_MISC);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME) |
+BIT_ULL(NL80211_STA_INFO_STA_FLAGS) |
+BIT_ULL(NL80211_STA_INFO_BSS_PARAM) |
+BIT_ULL(NL80211_STA_INFO_CONNECTED_TIME) |
+BIT_ULL(NL80211_STA_INFO_RX_DROP_MISC);
 
if (sdata->vif.type == NL80211_IFTYPE_STATION) {
sinfo->beacon_loss_count = sdata->u.mgd.beacon_loss_count;
-   sinfo->filled |= BIT(NL80211_STA_INFO_BEACON_LOSS);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BEACON_LOSS);
}
 
sinfo->connected_time = ktime_get_seconds() - sta->last_connected;
sinfo->inactive_time =
jiffies_to_msecs(jiffies - ieee80211_sta_last_active(sta));
 
-   if (!(sinfo->filled & (BIT(NL80211_STA_INFO_TX_BYTES64) |
-  BIT(NL80211_STA_INFO_TX_BYTES {
+   if (!(sinfo->filled & (BIT_ULL(NL80211_STA_INFO_TX_BYTES64) |
+  BIT_ULL(NL80211_STA_INFO_TX_BYTES {
sinfo->tx_bytes = 0;
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
sinfo->tx_bytes += sta->tx_stats.bytes[ac];
-   sinfo->filled |= BIT(NL80211_STA_INFO_TX_BYTES64);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES64);
}
 
-   if (!(sinfo->filled & BIT(NL80211_STA_INFO_TX_PACKETS))) {
+   if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_TX_PACKETS))) {
sinfo->tx_packets = 0;
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
sinfo->tx_packets += sta->tx_stats.packets[ac];
-   sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS);
}
 
-   if (!(sinfo->filled & (BIT(NL80211_STA_INFO_RX_BYTES64) |
-  BIT(NL80211_STA_INFO_RX_BYTES {
+   if (!(sinfo->filled & (BIT_ULL(NL80211_STA_INFO_RX_BYTES64) |
+  BIT_ULL(NL80211_STA_INFO_RX_BYTES {
sinfo->rx_bytes += sta_get_stats_bytes(>rx_stats);
 
if (sta->pcpu_rx_stats) {
@@ -2157,10 +2157,10 @@ void sta_set_sinfo(struct sta_info *sta, struct 
station_info *sinfo,
}
}
 
-   sinfo->filled |= BIT(NL80211_STA_INFO_RX_BYTES64);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES64);
}
 
-   if (!(sinfo->filled & 

Re: Atheros AR9462 - 5Ghz not working

2018-06-17 Thread Michał Kazior
On 15 June 2018 at 19:23,   wrote:
>  mgre...@cinci.rr.com wrote:
>>  "Michał Kazior"  wrote:
>> > Your noise floor readout in survey dump is terribly bad for 5GHz. It
>> > ain't stellar for 2.4GHz either but within reason nonetheless.
>> >
>> > Did you try using the card in a different device? I wonder if the
>> > device you're trying to use it in has some sort of internal noise on
>> > those frequencies and/or ath9k's ANI isn't able to deal with it.
>> >
>> >
>> > Michał
>> >
>> > On 15 June 2018 at 15:31,   wrote:
>>
>> I did.
>> I took it out of the Penguin-Z notebook and put it in a Dell XPS15 9560 
>> running Windows 10. Only 2.4Ghz networks were visible from there as well. 
>> Not exactly apples-to-apples, but consistent results.

This reduces likeliness this is tied to a os/driver issue. Maybe
calibration data on the device eeprom is broken? Or maybe it's a
hardware defect?


> Could it be antenna related (in multiple devices)?

Antennas can be designed to work better on certain frequency ranges. I
wouldn't expect such a dramatic effect though.


> On wikidevi.com I see some M.2 cards listed with an antenna connector of U.FL 
> and others with MHF4. I can't find anything describing the difference, if 
> any. The connectors seemed to fit OK. Also, what's the deal with 'main' and 
> 'aux' antenna connectors? I've seen people suggest swapping them has helped 
> in some cases with poor signal, while others insist that it makes no 
> difference. I have not tried swapping the connectors.

I think it's not a connector problem because 2.4GHz scan results
report reasonable signal strength for found APs (-60dBm). My
experience is that if you use a wrong (but seemingly fitting)
connector you'd get near 0 results or below -90dBm across the board.


Michał


[PATCH v3 1/5] cfg80211: use BIT_ULL for NL80211_STA_INFO_* attribute types

2018-06-17 Thread Omer Efrat
The BIT macro uses unsigned long which some architectures handle as 32 bit
and therefore might cause macro's shift to overflow when used on a value
equals or larger than 32 (NL80211_STA_INFO_RX_DURATION and afterwards).

Since 'filled' member in station_info changed to u64, BIT_ULL macro
should be used with all NL80211_STA_INFO_* attribute types instead of BIT
to prevent future possible bugs when one will use BIT macro for higher
attributes by mistake.

This commit cleans up all usages of BIT macro with the above field
in cfg80211 by changing it to BIT_ULL instead. In addition, there are
some places which don't use BIT nor BIT_ULL macros so align those as well.

Signed-off-by: Omer Efrat 
---
 net/wireless/nl80211.c | 26 +-
 net/wireless/wext-compat.c | 10 +-
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 0ccce33..350d296 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4619,13 +4619,13 @@ static int nl80211_send_station(struct sk_buff *msg, 
u32 cmd, u32 portid,
 
 #define PUT_SINFO(attr, memb, type) do {   \
BUILD_BUG_ON(sizeof(type) == sizeof(u64));  \
-   if (sinfo->filled & (1ULL << NL80211_STA_INFO_ ## attr) &&  \
+   if (sinfo->filled & BIT_ULL(NL80211_STA_INFO_ ## attr) &&   \
nla_put_ ## type(msg, NL80211_STA_INFO_ ## attr,\
 sinfo->memb))  \
goto nla_put_failure;   \
} while (0)
 #define PUT_SINFO_U64(attr, memb) do { \
-   if (sinfo->filled & (1ULL << NL80211_STA_INFO_ ## attr) &&  \
+   if (sinfo->filled & BIT_ULL(NL80211_STA_INFO_ ## attr) &&   \
nla_put_u64_64bit(msg, NL80211_STA_INFO_ ## attr,   \
  sinfo->memb, NL80211_STA_INFO_PAD))   \
goto nla_put_failure;   \
@@ -4634,14 +4634,14 @@ static int nl80211_send_station(struct sk_buff *msg, 
u32 cmd, u32 portid,
PUT_SINFO(CONNECTED_TIME, connected_time, u32);
PUT_SINFO(INACTIVE_TIME, inactive_time, u32);
 
-   if (sinfo->filled & (BIT(NL80211_STA_INFO_RX_BYTES) |
-BIT(NL80211_STA_INFO_RX_BYTES64)) &&
+   if (sinfo->filled & (BIT_ULL(NL80211_STA_INFO_RX_BYTES) |
+BIT_ULL(NL80211_STA_INFO_RX_BYTES64)) &&
nla_put_u32(msg, NL80211_STA_INFO_RX_BYTES,
(u32)sinfo->rx_bytes))
goto nla_put_failure;
 
-   if (sinfo->filled & (BIT(NL80211_STA_INFO_TX_BYTES) |
-BIT(NL80211_STA_INFO_TX_BYTES64)) &&
+   if (sinfo->filled & (BIT_ULL(NL80211_STA_INFO_TX_BYTES) |
+BIT_ULL(NL80211_STA_INFO_TX_BYTES64)) &&
nla_put_u32(msg, NL80211_STA_INFO_TX_BYTES,
(u32)sinfo->tx_bytes))
goto nla_put_failure;
@@ -4661,24 +4661,24 @@ static int nl80211_send_station(struct sk_buff *msg, 
u32 cmd, u32 portid,
default:
break;
}
-   if (sinfo->filled & BIT(NL80211_STA_INFO_CHAIN_SIGNAL)) {
+   if (sinfo->filled & BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL)) {
if (!nl80211_put_signal(msg, sinfo->chains,
sinfo->chain_signal,
NL80211_STA_INFO_CHAIN_SIGNAL))
goto nla_put_failure;
}
-   if (sinfo->filled & BIT(NL80211_STA_INFO_CHAIN_SIGNAL_AVG)) {
+   if (sinfo->filled & BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL_AVG)) {
if (!nl80211_put_signal(msg, sinfo->chains,
sinfo->chain_signal_avg,
NL80211_STA_INFO_CHAIN_SIGNAL_AVG))
goto nla_put_failure;
}
-   if (sinfo->filled & BIT(NL80211_STA_INFO_TX_BITRATE)) {
+   if (sinfo->filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE)) {
if (!nl80211_put_sta_rate(msg, >txrate,
  NL80211_STA_INFO_TX_BITRATE))
goto nla_put_failure;
}
-   if (sinfo->filled & BIT(NL80211_STA_INFO_RX_BITRATE)) {
+   if (sinfo->filled & BIT_ULL(NL80211_STA_INFO_RX_BITRATE)) {
if (!nl80211_put_sta_rate(msg, >rxrate,
  NL80211_STA_INFO_RX_BITRATE))
goto nla_put_failure;
@@ -4694,7 +4694,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 
cmd, u32 portid,
PUT_SINFO(PEER_PM, peer_pm, u32);
PUT_SINFO(NONPEER_PM, nonpeer_pm, u32);
 
-   if (sinfo->filled & BIT(NL80211_STA_INFO_BSS_PARAM)) {
+   if (sinfo->filled & BIT_ULL(NL80211_STA_INFO_BSS_PARAM)) {
 

[PATCH v3 3/5] batman-adv: use BIT_ULL for NL80211_STA_INFO_* attribute types

2018-06-17 Thread Omer Efrat
The BIT macro uses unsigned long which some architectures handle as 32 bit
and therefore might cause macro's shift to overflow when used on a value
equals or larger than 32 (NL80211_STA_INFO_RX_DURATION and afterwards).

Since 'filled' member in station_info changed to u64, BIT_ULL macro
should be used with all NL80211_STA_INFO_* attribute types instead of BIT
to prevent future possible bugs when one will use BIT macro for higher
attributes by mistake.

This commit cleans up all usages of BIT macro with the above field
in batman-adv by changing it to BIT_ULL instead.

Signed-off-by: Omer Efrat 
---
 net/batman-adv/bat_v_elp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
index 71c20c1..71e6474 100644
--- a/net/batman-adv/bat_v_elp.c
+++ b/net/batman-adv/bat_v_elp.c
@@ -114,7 +114,7 @@ static u32 batadv_v_elp_get_throughput(struct 
batadv_hardif_neigh_node *neigh)
}
if (ret)
goto default_throughput;
-   if (!(sinfo.filled & BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT)))
+   if (!(sinfo.filled & 
BIT_ULL(NL80211_STA_INFO_EXPECTED_THROUGHPUT)))
goto default_throughput;
 
return sinfo.expected_throughput / 100;
-- 
2.7.4



[PATCH v3 4/5] wireless-drivers: use BIT_ULL for NL80211_STA_INFO_ attribute types

2018-06-17 Thread Omer Efrat
The BIT macro uses unsigned long which some architectures handle as 32 bit
and therefore might cause macro's shift to overflow when used on a value
equals or larger than 32 (NL80211_STA_INFO_RX_DURATION and afterwards).

Since 'filled' member in station_info changed to u64, BIT_ULL macro
should be used with all NL80211_STA_INFO_* attribute types instead of BIT
to prevent future possible bugs when one will use BIT macro for higher
attributes by mistake.

This commit cleans up all usages of BIT macro with the above field
in wireless-drivers by changing it to BIT_ULL instead. In addition, there are
some places which don't use BIT nor BIT_ULL macros so align those as well.

Signed-off-by: Omer Efrat 
---
 drivers/net/wireless/ath/ath10k/mac.c  |  4 +--
 drivers/net/wireless/ath/ath6kl/cfg80211.c | 14 
 drivers/net/wireless/ath/wil6210/cfg80211.c| 18 +-
 .../broadcom/brcm80211/brcmfmac/cfg80211.c | 40 +++---
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c  |  6 ++--
 drivers/net/wireless/marvell/libertas/cfg.c| 12 +++
 drivers/net/wireless/marvell/mwifiex/cfg80211.c| 14 
 drivers/net/wireless/quantenna/qtnfmac/commands.c  | 32 -
 drivers/net/wireless/rndis_wlan.c  |  4 +--
 drivers/net/wireless/ti/wlcore/main.c  |  2 +-
 10 files changed, 73 insertions(+), 73 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index e9c2fb3..0d9f70f 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -7725,7 +7725,7 @@ static void ath10k_sta_statistics(struct ieee80211_hw *hw,
return;
 
sinfo->rx_duration = arsta->rx_duration;
-   sinfo->filled |= 1ULL << NL80211_STA_INFO_RX_DURATION;
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_DURATION);
 
if (!arsta->txrate.legacy && !arsta->txrate.nss)
return;
@@ -7738,7 +7738,7 @@ static void ath10k_sta_statistics(struct ieee80211_hw *hw,
sinfo->txrate.bw = arsta->txrate.bw;
}
sinfo->txrate.flags = arsta->txrate.flags;
-   sinfo->filled |= 1ULL << NL80211_STA_INFO_TX_BITRATE;
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
 }
 
 static const struct ieee80211_ops ath10k_ops = {
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c 
b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index 2ba8cf3..360c8d1 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -1811,20 +1811,20 @@ static int ath6kl_get_station(struct wiphy *wiphy, 
struct net_device *dev,
 
if (vif->target_stats.rx_byte) {
sinfo->rx_bytes = vif->target_stats.rx_byte;
-   sinfo->filled |= BIT(NL80211_STA_INFO_RX_BYTES64);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES64);
sinfo->rx_packets = vif->target_stats.rx_pkt;
-   sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS);
}
 
if (vif->target_stats.tx_byte) {
sinfo->tx_bytes = vif->target_stats.tx_byte;
-   sinfo->filled |= BIT(NL80211_STA_INFO_TX_BYTES64);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES64);
sinfo->tx_packets = vif->target_stats.tx_pkt;
-   sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS);
}
 
sinfo->signal = vif->target_stats.cs_rssi;
-   sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL);
 
rate = vif->target_stats.tx_ucast_rate;
 
@@ -1857,12 +1857,12 @@ static int ath6kl_get_station(struct wiphy *wiphy, 
struct net_device *dev,
return 0;
}
 
-   sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
 
if (test_bit(CONNECTED, >flags) &&
test_bit(DTIM_PERIOD_AVAIL, >flags) &&
vif->nw_type == INFRA_NETWORK) {
-   sinfo->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM);
sinfo->bss_param.flags = 0;
sinfo->bss_param.dtim_period = vif->assoc_bss_dtim_period;
sinfo->bss_param.beacon_interval = vif->assoc_bss_beacon_int;
diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c 
b/drivers/net/wireless/ath/wil6210/cfg80211.c
index 78946f2..013d056 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -302,14 +302,14 @@ int wil_cid_fill_sinfo(struct wil6210_vif *vif, int cid,
 
sinfo->generation = wil->sinfo_gen;
 
-   sinfo->filled = BIT(NL80211_STA_INFO_RX_BYTES) |
-  

4.17.X iwlwifi: probe of 0000:04:00.0 failed with error -12

2018-06-17 Thread Fabio Coatti
Hi all,

I'm trying out 4.17 (.0 .1 .2) and I'm getting, on boot, this dmesg line:

iwlwifi: probe of :04:00.0 failed with error -12

The wifi system is then unavailable.

On the very same hardware and configuration, kernel 4.16.3 works just fine.

Hardware: Lenovo P50
04:00.0 Network controller: Intel Corporation Wireless 8260 (rev 3a)

Linux firmware provided by gentoo, version 20180606

I'm willing to provide more info if needed, just let me know.
If you don't mind, please CC: me if answering as I'm not subscribed to
this list.

Many thanks in advance.
(I'm using gentoo with vanilla kernels, no distro patch applied)




-- 
Fabio