[PATCH] mac80211: fix CSA in IBSS mode

2017-02-08 Thread Koen Vandeputte
Add the missing IBSS capability flag during capability init as it needs
to be inserted into the generated beacon in order for CSA to work.

Signed-off-by: Piotr Gawlowicz 
Signed-off-by: MikoĊ‚aj Chwalisz 
Tested-by: Koen Vandeputte 
---
 net/mac80211/ibss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index a31d307..98999d3 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -487,14 +487,14 @@ int ieee80211_ibss_csa_beacon(struct 
ieee80211_sub_if_data *sdata,
struct beacon_data *presp, *old_presp;
struct cfg80211_bss *cbss;
const struct cfg80211_bss_ies *ies;
-   u16 capability = 0;
+   u16 capability = WLAN_CAPABILITY_IBSS;
u64 tsf;
int ret = 0;
 
sdata_assert_lock(sdata);
 
if (ifibss->privacy)
-   capability = WLAN_CAPABILITY_PRIVACY;
+   capability |= WLAN_CAPABILITY_PRIVACY;
 
cbss = cfg80211_get_bss(sdata->local->hw.wiphy, ifibss->chandef.chan,
ifibss->bssid, ifibss->ssid,
-- 
2.7.4



[PATCH] mac80211: only alloc mem if a station doesnt exist yet

2016-12-14 Thread Koen Vandeputte
This speeds up the function in case a station already exists by avoiding
calling an expensive kzalloc just to free it again after the next check.

Signed-off-by: Koen Vandeputte 
---
 net/mac80211/sta_info.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 1711bae..0a42e6e 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -513,23 +513,23 @@ static int sta_info_insert_finish(struct sta_info *sta) 
__acquires(RCU)
 {
struct ieee80211_local *local = sta->local;
struct ieee80211_sub_if_data *sdata = sta->sdata;
-   struct station_info *sinfo;
+   struct station_info *sinfo = NULL;
int err = 0;
 
lockdep_assert_held(&local->sta_mtx);
 
-   sinfo = kzalloc(sizeof(struct station_info), GFP_KERNEL);
-   if (!sinfo) {
-   err = -ENOMEM;
-   goto out_err;
-   }
-
/* check if STA exists already */
if (sta_info_get_bss(sdata, sta->sta.addr)) {
err = -EEXIST;
goto out_err;
}
 
+   sinfo = kzalloc(sizeof(struct station_info), GFP_KERNEL);
+   if (!sinfo) {
+   err = -ENOMEM;
+   goto out_err;
+   }
+
local->num_sta++;
local->sta_generation++;
smp_mb();
-- 
2.7.4



Re: Fwd: [PATCH] ath9k: dynack: fix possible deadlock in ath_dynack_node_{de}init

2019-08-20 Thread Koen Vandeputte
less/ath/ath9k/dynack.c
@@ -298,9 +298,9 @@ void ath_dynack_node_init(struct ath_hw *ah,
struct ath_node *an)

 an->ackto = ackto;

-   spin_lock(&da->qlock);
+   spin_lock_bh(&da->qlock);
 list_add_tail(&an->list, &da->nodes);
-   spin_unlock(&da->qlock);
+   spin_unlock_bh(&da->qlock);
  }
  EXPORT_SYMBOL(ath_dynack_node_init);

@@ -314,9 +314,9 @@ void ath_dynack_node_deinit(struct ath_hw *ah,
struct ath_node *an)
  {
 struct ath_dynack *da = &ah->dynack;

-   spin_lock(&da->qlock);
+   spin_lock_bh(&da->qlock);
 list_del(&an->list);
-   spin_unlock(&da->qlock);
+   spin_unlock_bh(&da->qlock);
  }
  EXPORT_SYMBOL(ath_dynack_node_deinit);

--
2.21.0


Tested on a large amount of devices with lockdep enabled, covering:

- single core - dual core - dual cpu

Tested-by: Koen Vandeputte 





[PATCH] mac80211: IBSS: avoid unneeded return value processing

2019-09-11 Thread Koen Vandeputte
when ieee80211_ibss_csa_beacon() fails, we return it's value.
When it succeeds, we basically copy it's value and also .. return it.

Just return it immediately, simplifying the code.

Signed-off-by: Koen Vandeputte 
---
 net/mac80211/ibss.c | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 0a6ff01c68a9..d40744903fa9 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -538,7 +538,6 @@ int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data 
*sdata)
 {
struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
struct cfg80211_bss *cbss;
-   int err, changed = 0;
 
sdata_assert_lock(sdata);
 
@@ -560,13 +559,7 @@ int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data 
*sdata)
ifibss->chandef = sdata->csa_chandef;
 
/* generate the beacon */
-   err = ieee80211_ibss_csa_beacon(sdata, NULL);
-   if (err < 0)
-   return err;
-
-   changed |= err;
-
-   return changed;
+   return ieee80211_ibss_csa_beacon(sdata, NULL);
 }
 
 void ieee80211_ibss_stop(struct ieee80211_sub_if_data *sdata)
-- 
2.17.1



sta_info - sta_info_get_by_idx()

2019-09-11 Thread Koen Vandeputte

Hi All,

Within sta_info.c, there is a function named sta_info_get_by_idx().

- In sta_info.h, it is marked as BROKEN

- in cfg.c it's actively used in function function ieee80211_dump_station()


So is it broken? or not? :-)

Thanks,

Koen



Re: [PATCH 2/2] mac80211: minstrel_ht: replace rate stats ewma with a better moving average

2019-10-08 Thread Koen Vandeputte
Tested on dozens of devices interconnected offshore in IBSS (static and 
moving)


Works as advertised and reduces slight drops noticed on vessel movement.

Tested-by: Koen Vandeputte