[PATCH] mac80211: fix the update of path metric for RANN frame

2017-11-14 Thread Chun-Yeow Yeoh
The previous path metric update from RANN frame has not considered
the own link metric toward the transmitting mesh STA. Fix this.

Reported-by: Michael65535
Signed-off-by: Chun-Yeow Yeoh <yeohchuny...@gmail.com>
---
 net/mac80211/mesh_hwmp.c | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index c1d1b86..35ad398 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -797,7 +797,7 @@ static void hwmp_rann_frame_process(struct 
ieee80211_sub_if_data *sdata,
struct mesh_path *mpath;
u8 ttl, flags, hopcount;
const u8 *orig_addr;
-   u32 orig_sn, metric, metric_txsta, interval;
+   u32 orig_sn, new_metric, orig_metric, last_hop_metric, interval;
bool root_is_gate;
 
ttl = rann->rann_ttl;
@@ -808,7 +808,7 @@ static void hwmp_rann_frame_process(struct 
ieee80211_sub_if_data *sdata,
interval = le32_to_cpu(rann->rann_interval);
hopcount = rann->rann_hopcount;
hopcount++;
-   metric = le32_to_cpu(rann->rann_metric);
+   orig_metric = le32_to_cpu(rann->rann_metric);
 
/*  Ignore our own RANNs */
if (ether_addr_equal(orig_addr, sdata->vif.addr))
@@ -825,7 +825,10 @@ static void hwmp_rann_frame_process(struct 
ieee80211_sub_if_data *sdata,
return;
}
 
-   metric_txsta = airtime_link_metric_get(local, sta);
+   last_hop_metric = airtime_link_metric_get(local, sta);
+   new_metric = orig_metric + last_hop_metric;
+   if (new_metric < orig_metric)
+   new_metric = MAX_METRIC;
 
mpath = mesh_path_lookup(sdata, orig_addr);
if (!mpath) {
@@ -838,7 +841,7 @@ static void hwmp_rann_frame_process(struct 
ieee80211_sub_if_data *sdata,
}
 
if (!(SN_LT(mpath->sn, orig_sn)) &&
-   !(mpath->sn == orig_sn && metric < mpath->rann_metric)) {
+   !(mpath->sn == orig_sn && new_metric < mpath->rann_metric)) {
rcu_read_unlock();
return;
}
@@ -856,7 +859,7 @@ static void hwmp_rann_frame_process(struct 
ieee80211_sub_if_data *sdata,
}
 
mpath->sn = orig_sn;
-   mpath->rann_metric = metric + metric_txsta;
+   mpath->rann_metric = new_metric;
mpath->is_root = true;
/* Recording RANNs sender address to send individually
 * addressed PREQs destined for root mesh STA */
@@ -876,7 +879,7 @@ static void hwmp_rann_frame_process(struct 
ieee80211_sub_if_data *sdata,
mesh_path_sel_frame_tx(MPATH_RANN, flags, orig_addr,
   orig_sn, 0, NULL, 0, broadcast_addr,
   hopcount, ttl, interval,
-  metric + metric_txsta, 0, sdata);
+  new_metric, 0, sdata);
}
 
rcu_read_unlock();
-- 
2.3.0



Re: [PATCH v2] mac80211: mesh - always do every discovery retry

2017-03-29 Thread Chun-Yeow Yeoh
I would suggest the following modification of commit messages and
code. Let me know whether this is fine.

-
I would suggest the following edition to the commit message:

Instead of stopping path discovery when a path is established, continue the
attempts to find alternative paths until we hit the dot11MeshHWMPmaxPREQretries
limit. However, this is not a standard behavior and may easily
increase the number of
broadcast PREQ frame in your network. So this feature is turned off by default.

and the remaining are removed due to misleading explanation.

Then, in the mesh_path_timer, I think that only the following is needed:

- if (mpath->flags & MESH_PATH_RESOLVED ||
- (!(mpath->flags & MESH_PATH_RESOLVING))) {
+ if (!multiple_discoveries &&
+(mpath->flags & MESH_PATH_RESOLVED ||
+ (!(mpath->flags & MESH_PATH_RESOLVING {

---
Chun-Yeow

On Wed, Mar 29, 2017 at 4:24 PM, Johannes Berg
 wrote:
> What's the outcome of this? I'm tempted to apply the patch since it's
> optional anyway ...
>
> johannes


Re: Beacon interval for Mesh/AP in single interface

2017-03-15 Thread Chun-Yeow Yeoh
>
> Interesting. Did hardware actually support this, and if so, what did it
> do?

Yes, ath9k for mesh/AP running simultaneously in one single radio
interface can do beaconing using different beacon interval. Mesh
providing backhaul to user accessing via STA/AP mode.

> If that worked, then it'd be reasonable to add the appropriate value to
> the interface combinations to let it work as before.
>
> If it didn't really work properly, then we can just fix the defaults to
> be compatible?

I try to put beacon_int_min_gcd in the interface combination with
mesh/AP/adhoc but the patch "[PATCH] cfg80211: disallow
beacon_int_min_gcd with IBSS" disables the mesh interface due to adhoc
interface is there.

---
Chun-Yeow


Beacon interval for Mesh/AP in single interface

2017-03-08 Thread Chun-Yeow Yeoh
Hi, Johannes

The introduction of the following patches doesn't allow the AP and
mesh mode to simultaneously run on a single radio interface due to
beacon interval for both interfaces by default is different.
[PATCH] cfg80211: disallow beacon_int_min_gcd with IBSS
[PATCH] cfg80211: support virtual interfaces with different beacon intervals
[PATCH] cfg80211: validate beacon int as part of iface combinations

Any suggestion that we could solve this.

Thanks

---
Chun-Yeow


Re: [PATCH v2] mac80211: mesh - always do every discovery retry

2017-03-06 Thread Chun-Yeow Yeoh
> They are only reliable when compared to individual rate controlled frames.
> But, in general, they are most certainly not reliable. Even in a shielded
> and conductive (i.e. with physical wires connecting antennas) environment
> lost PREQ frames are not hard to see.

Did you try to reduce dot11MeshHWMPpreqMinInterval to send out more
PREQ and see whether this works for you?

I think that we have similar lengthy discussion last time.
http://comments.gmane.org/gmane.linux.kernel.wireless.general/139453

I would suggest the following edition to the commit message:

Instead of stopping path discovery when a path is established, continue the
attempts to find alternative paths until we hit the dot11MeshHWMPmaxPREQretries
limit. However, this is not a standard behavior and may easily
increase the number of
broadcast PREQ frame in your network. So this feature is turned off by default.

and the remaining are removed due to misleading explanation.

Then, in the mesh_path_timer, I think that only the following is needed:

- if (mpath->flags & MESH_PATH_RESOLVED ||
- (!(mpath->flags & MESH_PATH_RESOLVING))) {
+ if (!multiple_discoveries &&
+(mpath->flags & MESH_PATH_RESOLVED ||
+ (!(mpath->flags & MESH_PATH_RESOLVING {

Thanks

---
Chun-Yeow


Re: [PATCH v2] mac80211: mesh - always do every discovery retry

2017-03-04 Thread Chun-Yeow Yeoh
On Sat, Mar 4, 2017 at 12:01 PM, Chun-Yeow Yeoh <yeohchuny...@gmail.com> wrote:
>
>>
>> Well A-D is going to have a much smaller RTT than A-B-C-D. And, yes, using
>> multiple hops is going to reduce throughput but I'd much rather use
>> multiple
>> 120 Mbps links than a link that only supports 12 Mbps.
>>
>
> Airtime link metrics should choose the multiple links if it is good compared
> to direct link.
>
>> That's why there are link and path metrics.
>
> I don't think that you don't get this. Every nodes sends out multiple PREQs.
> Other nodes received it with rebroadcast again. Take note on this.
>
>> Improving the link metric isn't going to help with PREQ reliability
>> problems.
>
> PREQ realiabilit? It is broadcast management frame and usually using lowest
> transmission rate. So it is realiabe.
>
>> Sending more PREQs will.
>
> So reduce dot11MeshHWMPpreqMinInterval to send out more PREQ works for you?

Alright, I think that we have similar lengthy discussion last time.
http://comments.gmane.org/gmane.linux.kernel.wireless.general/139453

I would suggest the following edition to the commit message:

Instead of stopping path discovery when a path is established, continue the
attempts to find alternative paths until we hit the dot11MeshHWMPmaxPREQretries
limit. However, this is not a standard behavior and may easily
increase the number of
broadcast PREQ frame in your network. So this feature is turned off by default.

and the remaining are removed due to misleading explanation.

Then, in the mesh_path_timer, I think that only the following is needed:

- if (mpath->flags & MESH_PATH_RESOLVED ||
- (!(mpath->flags & MESH_PATH_RESOLVING))) {
+ if (!multiple_discoveries &&
+(mpath->flags & MESH_PATH_RESOLVED ||
+ (!(mpath->flags & MESH_PATH_RESOLVING {

Thanks

---
Chun-Yeow


Re: [PATCH v2] mac80211: mesh - always do every discovery retry

2017-03-03 Thread Chun-Yeow Yeoh
>
> Yes, that is a real issue. We are planning on doing some further work in
> this area to  try to minimize the explosions that can be seen with PREQs in
> larger networks while balancing the need for reliability.
>
> Path discovery
>> should stop once the path is established. By attempting 2nd, 3rd or 4th
>> doesn't guarantee the next path will be "good".
>
> It doesn't guarantee anything of course but it does raise the probability
> that the right path will be found. For example take four nodes in a ring
> where the A-B, B-C, C-D links are all good but the A-D link is poor. Poor
> enough that the higher data rates are hosed for that link but the basic rate
> used by management frames is relatively unaffected. If we assume that the
> reliability of management frames is 90% then in order for A to route to D it
> needs to get a PREQ to D and a PREP back. It has two options 1) for A-D the
> reliability will be 0.9^2 = 81% 2) for A-B-C-D the reliability will be 0.9^6
> = 53%.

What is round trip delay between A-D compared to A-B-C-D? 1 hop away
the throughput is reduced by half. Also if you have more nodes using
longer path, you consume more airtime leads to really bad network
performance, especially when B, C, or even D wants to start initial
data transmission.

> This isn't a good situation because it makes it much too easy for routing to
> pick a *really* bad path. And we have seen reliability improvements with
> this patch.
>
> We have already made changes to dial way back on the number of PREQs sent
> out so this patch made quite a bit of sense for us. In the default
> configuration where PREQs go out every 4s I don't think we have a good
> solution: picking a bad path, even for 4s, can be a horrible user experience

Reduce dot11MeshHWMPpreqMinInterval to send out more PREQ in your network.

> but PREQ volumes quickly start consuming too much airtime as network sizes
> increase.

One way of improving the path is either enhancing the airtime link
metric by considering the factor that you mentioned in or else
introducing vendor-specific path metric. Sending more broadcast frames
over the network won't be a good solution.

---
Chun-Yeow


Re: [PATCH v2] mac80211: mesh - always do every discovery retry

2017-03-01 Thread Chun-Yeow Yeoh
> Instead of stopping path discovery when a path is found continue
> attempting to find paths until we hit the dot11MeshHWMPmaxPREQretries
> limit.

I am not too sure whether by simply broadcasting the PREQ frame could
actually solve the problem and this may cause problem of PREQ flooding
in your network when the number of nodes scale. Please take note that
all nodes need to rebroadcast the PREQ frame until target STA. Path
discovery should stop once the path is established. By attempting 2nd,
3rd or 4th doesn't guarantee the next path will be "good".

> This is important because path messages are not reliable and it is
> relatively common to have a short bad path to the destination along with a
> longer but better path. With the original code rather often a path message
> along the long path would be lost so we would stick with the bad path.
> With this change we have a greater chance to get messages over the longer
> path allowing us to select the long path if it's better.

Reduce the mesh_hwmp_active_path_timeout or mesh_path_refresh_time to
reestablish your path link as soon as possible. Also, if you would
like to have such aggressive behavior, you can reduce the
mesh_hwmp_preq_min_interval to have more aggressive PREQ sending in
your network.


Chun-Yeow


[PATCH v2] rt2800lib: enable MFP if hw crypt is disabled

2016-04-20 Thread Chun-Yeow Yeoh
If rt2800usb is loaded with nohwcrypt=1, mac80211 takes
care of the crypto with software encryption/decryption
and thus, MFP can be used.

Tested for secured mesh using ath9k_htc and ath9k.

Signed-off-by: Chun-Yeow Yeoh <yeohchuny...@gmail.com>

v2: set MFP correctly (Stanislaw Gruszka)
---
 drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c 
b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
index 7fa0128..716468a 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -7492,6 +7492,10 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev 
*rt2x00dev)
if (!rt2x00_is_usb(rt2x00dev))
ieee80211_hw_set(rt2x00dev->hw, HOST_BROADCAST_PS_BUFFERING);
 
+   /* Set MFP if HW crypto is disabled. */
+   if (rt2800_hwcrypt_disabled(rt2x00dev))
+   ieee80211_hw_set(rt2x00dev->hw, MFP_CAPABLE);
+
SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
rt2800_eeprom_addr(rt2x00dev,
-- 
2.3.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] mac80211: fix the setting of center freq segment 2 in VHT oper ie

2015-09-03 Thread Chun-Yeow Yeoh
This is to avoid the Channel Center Frequency Segment 2
in broadcasted VHT operation element contains the non-zero
value for non 80+80 MHz that may failed the comparison of
cfg80211_chandef_identical.

This is tested with Bob's patches related to VHT mesh support.

Signed-off-by: Chun-Yeow Yeoh <yeohchuny...@gmail.com>
---
 net/mac80211/util.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 1104421..f167056 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2324,6 +2324,8 @@ u8 *ieee80211_ie_build_vht_oper(u8 *pos, struct 
ieee80211_sta_vht_cap *vht_cap,
if (chandef->center_freq2)
vht_oper->center_freq_seg2_idx =
ieee80211_frequency_to_channel(chandef->center_freq2);
+   else
+   vht_oper->center_freq_seg2_idx = 0x00;
 
switch (chandef->width) {
case NL80211_CHAN_WIDTH_160:
-- 
2.3.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] mac80211: remove compilation warning on mesh

2015-06-28 Thread Chun-Yeow Yeoh
Remove the warning on the following:
mesh_hwmp.c: warning: ‘target_metric’ may be used
uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Chun-Yeow Yeoh yeohchuny...@gmail.com
---
 net/mac80211/mesh_hwmp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index d80e0a4..1a1f652 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -530,7 +530,7 @@ static void hwmp_preq_frame_process(struct 
ieee80211_sub_if_data *sdata,
const u8 *target_addr, *orig_addr;
const u8 *da;
u8 target_flags, ttl, flags;
-   u32 orig_sn, target_sn, lifetime, target_metric;
+   u32 orig_sn, target_sn, lifetime, target_metric = 0;
bool reply = false;
bool forward = true;
bool root_is_gate;
@@ -551,7 +551,6 @@ static void hwmp_preq_frame_process(struct 
ieee80211_sub_if_data *sdata,
mhwmp_dbg(sdata, PREQ is for us\n);
forward = false;
reply = true;
-   target_metric = 0;
if (time_after(jiffies, ifmsh-last_sn_update +
net_traversal_jiffies(sdata)) ||
time_before(jiffies, ifmsh-last_sn_update)) {
@@ -568,7 +567,6 @@ static void hwmp_preq_frame_process(struct 
ieee80211_sub_if_data *sdata,
reply = true;
target_addr = sdata-vif.addr;
target_sn = ++ifmsh-sn;
-   target_metric = 0;
ifmsh-last_sn_update = jiffies;
}
if (root_is_gate)
-- 
2.3.0

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] mac80211: process the target only subfield for mesh hwmp accordingly

2015-06-14 Thread Chun-Yeow Yeoh
This patch does the following:
- Remove unnecessary flags field used by PERR element.
- Use the per target flags defined in ./include/linux/ieee80211.h.
- Process the target only subfield based on case E2 of sec 13.10.9.3
  of IEEE 802.11-2012.

Signed-off-by: Chun-Yeow Yeoh yeohchuny...@gmail.com
---
 net/mac80211/mesh_hwmp.c | 32 
 1 file changed, 8 insertions(+), 24 deletions(-)

diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index 085edc1..5573e21 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -19,15 +19,6 @@
 
 #define MAX_PREQ_QUEUE_LEN 64
 
-/* Destination only */
-#define MP_F_DO0x1
-/* Reply and forward */
-#define MP_F_RF0x2
-/* Unknown Sequence Number */
-#define MP_F_USN0x01
-/* Reason code Present */
-#define MP_F_RCODE  0x02
-
 static void mesh_queue_preq(struct mesh_path *, u8);
 
 static inline u32 u32_field_get(const u8 *preq_elem, int offset, bool ae)
@@ -279,15 +270,10 @@ int mesh_path_error_tx(struct ieee80211_sub_if_data 
*sdata,
*pos++ = ttl;
/* number of destinations */
*pos++ = 1;
-   /*
-* flags bit, bit 1 is unset if we know the sequence number and
-* bit 2 is set if we have a reason code
+   /* Flags field has AE bit only as defined in
+* sec 8.4.2.117 IEEE802.11-2012
 */
*pos = 0;
-   if (!target_sn)
-   *pos |= MP_F_USN;
-   if (target_rcode)
-   *pos |= MP_F_RCODE;
pos++;
memcpy(pos, target, ETH_ALEN);
pos += ETH_ALEN;
@@ -570,15 +556,13 @@ static void hwmp_preq_frame_process(struct 
ieee80211_sub_if_data *sdata,
SN_LT(mpath-sn, target_sn)) {
mpath-sn = target_sn;
mpath-flags |= MESH_PATH_SN_VALID;
-   } else if ((!(target_flags  MP_F_DO)) 
+   } else if ((!(target_flags  IEEE80211_PREQ_TO_FLAG)) 
(mpath-flags  MESH_PATH_ACTIVE)) {
reply = true;
target_metric = mpath-metric;
target_sn = mpath-sn;
-   if (target_flags  MP_F_RF)
-   target_flags |= MP_F_DO;
-   else
-   forward = false;
+   /* Case E2 of sec 13.10.9.3 IEEE 802.11-2012*/
+   target_flags |= IEEE80211_PREQ_TO_FLAG;
}
}
rcu_read_unlock();
@@ -974,7 +958,7 @@ void mesh_path_start_discovery(struct ieee80211_sub_if_data 
*sdata)
struct ieee80211_if_mesh *ifmsh = sdata-u.mesh;
struct mesh_preq_queue *preq_node;
struct mesh_path *mpath;
-   u8 ttl, target_flags;
+   u8 ttl, target_flags = 0;
const u8 *da;
u32 lifetime;
 
@@ -1033,9 +1017,9 @@ void mesh_path_start_discovery(struct 
ieee80211_sub_if_data *sdata)
}
 
if (preq_node-flags  PREQ_Q_F_REFRESH)
-   target_flags = MP_F_DO;
+   target_flags |= IEEE80211_PREQ_TO_FLAG;
else
-   target_flags = MP_F_RF;
+   target_flags = ~IEEE80211_PREQ_TO_FLAG;
 
spin_unlock_bh(mpath-state_lock);
da = (mpath-is_root) ? mpath-rann_snd_addr : broadcast_addr;
-- 
2.3.0

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ath9k_htc: add support of channel switch

2015-06-09 Thread Chun-Yeow Yeoh
Add the support of channel switching functionality, similar
to ath9k support.

Tested with TP-Link TL-WN722N and TL-WN821N.

Signed-off-by: Chun-Yeow Yeoh yeohchuny...@gmail.com
---
 drivers/net/wireless/ath/ath9k/htc.h|  2 ++
 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c | 19 +++
 drivers/net/wireless/ath/ath9k/htc_drv_init.c   |  3 ++-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c   | 17 +
 4 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index 5dbc617..16dff4b 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -531,6 +531,7 @@ struct ath9k_htc_priv {
struct ath9k_debug debug;
 #endif
struct mutex mutex;
+   struct ieee80211_vif *csa_vif;
 };
 
 static inline void ath_read_cachesize(struct ath_common *common, int *csz)
@@ -584,6 +585,7 @@ void ath9k_htc_tx_drain(struct ath9k_htc_priv *priv);
 void ath9k_htc_txstatus(struct ath9k_htc_priv *priv, void *wmi_event);
 void ath9k_tx_failed_tasklet(unsigned long data);
 void ath9k_htc_tx_cleanup_timer(unsigned long data);
+bool ath9k_htc_csa_is_finished(struct ath9k_htc_priv *priv);
 
 int ath9k_rx_init(struct ath9k_htc_priv *priv);
 void ath9k_rx_cleanup(struct ath9k_htc_priv *priv);
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
index e8b6ec3..e6bcb4c 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
@@ -257,6 +257,8 @@ static void ath9k_htc_send_beacon(struct ath9k_htc_priv 
*priv,
}
 
spin_unlock_bh(priv-beacon_lock);
+
+   ath9k_htc_csa_is_finished(priv);
 }
 
 static int ath9k_htc_choose_bslot(struct ath9k_htc_priv *priv,
@@ -503,3 +505,20 @@ void ath9k_htc_beacon_reconfig(struct ath9k_htc_priv *priv)
return;
}
 }
+
+bool ath9k_htc_csa_is_finished(struct ath9k_htc_priv *priv)
+{
+   struct ieee80211_vif *vif;
+
+   vif = priv-csa_vif;
+   if (!vif || !vif-csa_active)
+   return false;
+
+   if (!ieee80211_csa_is_complete(vif))
+   return false;
+
+   ieee80211_csa_finish(vif);
+
+   priv-csa_vif = NULL;
+   return true;
+}
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index 7468562..9569010 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -744,7 +744,8 @@ static void ath9k_set_hw_capab(struct ath9k_htc_priv *priv,
hw-wiphy-flags = ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
 
hw-wiphy-flags |= WIPHY_FLAG_IBSS_RSN |
-   WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
+   WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
+   WIPHY_FLAG_HAS_CHANNEL_SWITCH;
 
hw-wiphy-flags |= WIPHY_FLAG_SUPPORTS_TDLS;
 
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index b71f307..dab1323 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1134,6 +1134,9 @@ static void ath9k_htc_remove_interface(struct 
ieee80211_hw *hw,
priv-nvifs--;
priv-vif_slot = ~(1  avp-index);
 
+   if (priv-csa_vif == vif)
+   priv-csa_vif = NULL;
+
ath9k_htc_remove_station(priv, vif, NULL);
 
DEC_VIF(priv, vif-type);
@@ -1841,6 +1844,19 @@ static int ath9k_htc_get_antenna(struct ieee80211_hw 
*hw, u32 *tx_ant,
return 0;
 }
 
+static void ath9k_htc_channel_switch_beacon(struct ieee80211_hw *hw,
+   struct ieee80211_vif *vif,
+   struct cfg80211_chan_def *chandef)
+{
+   struct ath9k_htc_priv *priv = hw-priv;
+
+   /* mac80211 does not support CSA in multi-if cases (yet) */
+   if (WARN_ON(priv-csa_vif))
+   return;
+
+   priv-csa_vif = vif;
+}
+
 struct ieee80211_ops ath9k_htc_ops = {
.tx = ath9k_htc_tx,
.start  = ath9k_htc_start,
@@ -1867,6 +1883,7 @@ struct ieee80211_ops ath9k_htc_ops = {
.set_bitrate_mask   = ath9k_htc_set_bitrate_mask,
.get_stats  = ath9k_htc_get_stats,
.get_antenna= ath9k_htc_get_antenna,
+   .channel_switch_beacon  = ath9k_htc_channel_switch_beacon,
 
 #ifdef CONFIG_ATH9K_HTC_DEBUGFS
.get_et_sset_count  = ath9k_htc_get_et_sset_count,
-- 
2.3.0

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] mac80211: fix the beacon csa counter for mesh and ibss

2015-06-08 Thread Chun-Yeow Yeoh
The csa counter has moved from sdata to beacon/presp but
it is not updated accordingly for mesh and ibss. Fix this.

This regression is introduced by the following patch:
mac80211: move csa counters from sdata to beacon/presp

Signed-off-by: Chun-Yeow Yeoh yeohchuny...@gmail.com
---
 net/mac80211/cfg.c  | 1 +
 net/mac80211/ibss.c | 1 +
 net/mac80211/mesh.c | 1 +
 3 files changed, 3 insertions(+)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index bb9f836..0fdfc20 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3443,6 +3443,7 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct 
wireless_dev *wdev,
/* Update CSA counters */
if (sdata-vif.csa_active 
(sdata-vif.type == NL80211_IFTYPE_AP ||
+sdata-vif.type == NL80211_IFTYPE_MESH_POINT ||
 sdata-vif.type == NL80211_IFTYPE_ADHOC) 
params-n_csa_offsets) {
int i;
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 21716af..7f72bc9 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -146,6 +146,7 @@ ieee80211_ibss_build_presp(struct ieee80211_sub_if_data 
*sdata,
csa_settings-chandef.chan-center_freq);
presp-csa_counter_offsets[0] = (pos - presp-head);
*pos++ = csa_settings-count;
+   presp-csa_current_counter = csa_settings-count;
}
 
/* put the remaining rates in WLAN_EID_EXT_SUPP_RATES */
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index d468424..817098a 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -680,6 +680,7 @@ ieee80211_mesh_build_beacon(struct ieee80211_if_mesh *ifmsh)
*pos++ = 0x0;
*pos++ = ieee80211_frequency_to_channel(
csa-settings.chandef.chan-center_freq);
+   bcn-csa_current_counter = csa-settings.count;
bcn-csa_counter_offsets[0] = hdr_len + 6;
*pos++ = csa-settings.count;
*pos++ = WLAN_EID_CHAN_SWITCH_PARAM;
-- 
2.3.0

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] cfg80211: allow the plink state blocking for user managed mesh

2015-04-17 Thread Chun-Yeow Yeoh
wpa_supplicant or authsae handles the mesh peering in user
space, but the plink state is still managed in kernel space.
Currently, there is no implementation by wpa_supplicant or
authsae to block the plink state after it is set to ESTAB.

By applying this patch, we can use the iw mesh0 station set
MAC address plink_action block to block the peer mesh STA.
This is useful for experimenting purposes.

Signed-off-by: Chun-Yeow Yeoh yeohchuny...@gmail.com

v2: respin the commit log (Johannes)
---
 net/wireless/nl80211.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index dd78445..8a33bba 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4061,7 +4061,8 @@ int cfg80211_check_station_change(struct wiphy *wiphy,
return -EINVAL;
break;
case CFG80211_STA_MESH_PEER_USER:
-   if (params-plink_action != NL80211_PLINK_ACTION_NO_ACTION)
+   if (params-plink_action != NL80211_PLINK_ACTION_NO_ACTION 
+   params-plink_action != NL80211_PLINK_ACTION_BLOCK)
return -EINVAL;
break;
}
-- 
2.3.0

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] cfg80211: allow the plink state blocking for user managed mesh

2015-04-15 Thread Chun-Yeow Yeoh
User managed peering has no way to block the plink state
for mesh peering setup by wpa_supp or authsae. Try to do
allow this in kernel space, so that we can use iw utility
to do that.

Signed-off-by: Chun-Yeow Yeoh yeohchuny...@gmail.com
---
 net/wireless/nl80211.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index dd78445..8a33bba 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4061,7 +4061,8 @@ int cfg80211_check_station_change(struct wiphy *wiphy,
return -EINVAL;
break;
case CFG80211_STA_MESH_PEER_USER:
-   if (params-plink_action != NL80211_PLINK_ACTION_NO_ACTION)
+   if (params-plink_action != NL80211_PLINK_ACTION_NO_ACTION 
+   params-plink_action != NL80211_PLINK_ACTION_BLOCK)
return -EINVAL;
break;
}
-- 
2.3.0

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] rtl8192cu: fix the mesh beaconing

2015-01-23 Thread Chun-Yeow Yeoh
Patch rtlwifi: add support to send beacon frame allows
the beaconing of rtl8192cu. But mesh beaconing is not
working. Fix this.

Signed-off-by: Chun-Yeow Yeoh yeohchuny...@gmail.com
---
 drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c 
b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
index 5513217..e5a7c4f 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
@@ -1509,6 +1509,7 @@ void rtl92cu_set_beacon_related_registers(struct 
ieee80211_hw *hw)
/* TODO: Modify later (Find the right parameters)
 * NOTE: Fix test chip's bug (about contention windows's randomness) */
if ((mac-opmode == NL80211_IFTYPE_ADHOC) ||
+   (mac-opmode == NL80211_IFTYPE_MESH_POINT) ||
(mac-opmode == NL80211_IFTYPE_AP)) {
rtl_write_byte(rtlpriv, REG_RXTSF_OFFSET_CCK, 0x50);
rtl_write_byte(rtlpriv, REG_RXTSF_OFFSET_OFDM, 0x50);
-- 
2.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] ath9k_htc: Enable software crypto for mgmt frame in Tx for USB devices

2014-11-15 Thread Chun-Yeow Yeoh
In secured mesh, the unicast mgmt frame is encrypted using
the same key that used for encrypting the unicast data frame.
This patch ath9k_htc_firmware: fix the offset of CCMP header
for mesh data frame applied to open-ath9k-htc-firmware allows
the ath9k_htc to be loaded without nohwcrypt=1. Unfortunately,
this is not working and we still need CCMP encryption of
transmitted management frames to be done in software.

So this patch allows the software encryption for transmitted
management frame to be done in software but remain the hardware
decryption for received management frame.

This patch is tested with the following hardwares:
- TP-Link TL-WN821N v3 802.11n [Atheros AR7010+AR9287]
- AR9271 802.11n

and managed to work with peer mesh STA equipped with ath9k.

Signed-off-by: Chun-Yeow Yeoh yeohchuny...@gmail.com
---
 drivers/net/wireless/ath/ath9k/hw.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/hw.c 
b/drivers/net/wireless/ath/ath9k/hw.c
index a53d304..99d5dcf4 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1585,7 +1585,10 @@ static void ath9k_hw_init_mfp(struct ath_hw *ah)
 * frames when constructing CCMP AAD. */
REG_RMW_FIELD(ah, AR_AES_MUTE_MASK1, AR_AES_MUTE_MASK1_FC_MGMT,
  0xc7ff);
-   ah-sw_mgmt_crypto_tx = false;
+   if (AR_SREV_9271(ah) || AR_DEVID_7010(ah))
+   ah-sw_mgmt_crypto_tx = true;
+   else
+   ah-sw_mgmt_crypto_tx = false;
ah-sw_mgmt_crypto_rx = false;
} else if (AR_SREV_9160_10_OR_LATER(ah)) {
/* Disable hardware crypto for management frames */
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] ath9k|ath9k_htc: Seperate the software crypto flag for Tx and Rx

2014-11-15 Thread Chun-Yeow Yeoh
Use the sw_mgmt_crypto_tx flag to trigger the CCMP encryption
for transmitted management frames to be done in software while
the sw_mgmt_crypto_rx flag is used to trigger the CCMP decryption
for received management frames to be done in software.

Signed-off-by: Chun-Yeow Yeoh yeohchuny...@gmail.com
---
 drivers/net/wireless/ath/ath9k/common.c   | 2 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c | 2 +-
 drivers/net/wireless/ath/ath9k/hw.c   | 9 ++---
 drivers/net/wireless/ath/ath9k/hw.h   | 3 ++-
 drivers/net/wireless/ath/ath9k/main.c | 2 +-
 5 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/common.c 
b/drivers/net/wireless/ath/ath9k/common.c
index 33b0c7a..e8c6994 100644
--- a/drivers/net/wireless/ath/ath9k/common.c
+++ b/drivers/net/wireless/ath/ath9k/common.c
@@ -159,7 +159,7 @@ void ath9k_cmn_rx_skb_postprocess(struct ath_common *common,
if (test_bit(keyix, common-keymap))
rxs-flag |= RX_FLAG_DECRYPTED;
}
-   if (ah-sw_mgmt_crypto 
+   if (ah-sw_mgmt_crypto_rx 
(rxs-flag  RX_FLAG_DECRYPTED) 
ieee80211_is_mgmt(fc))
/* Use software decrypt for management frames. */
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 689ac99..c7d12ef 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1447,7 +1447,7 @@ static int ath9k_htc_set_key(struct ieee80211_hw *hw,
key-flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
if (key-cipher == WLAN_CIPHER_SUITE_TKIP)
key-flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
-   if (priv-ah-sw_mgmt_crypto 
+   if (priv-ah-sw_mgmt_crypto_tx 
key-cipher == WLAN_CIPHER_SUITE_CCMP)
key-flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX;
ret = 0;
diff --git a/drivers/net/wireless/ath/ath9k/hw.c 
b/drivers/net/wireless/ath/ath9k/hw.c
index 04ae1f8..a53d304 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1585,16 +1585,19 @@ static void ath9k_hw_init_mfp(struct ath_hw *ah)
 * frames when constructing CCMP AAD. */
REG_RMW_FIELD(ah, AR_AES_MUTE_MASK1, AR_AES_MUTE_MASK1_FC_MGMT,
  0xc7ff);
-   ah-sw_mgmt_crypto = false;
+   ah-sw_mgmt_crypto_tx = false;
+   ah-sw_mgmt_crypto_rx = false;
} else if (AR_SREV_9160_10_OR_LATER(ah)) {
/* Disable hardware crypto for management frames */
REG_CLR_BIT(ah, AR_PCU_MISC_MODE2,
AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE);
REG_SET_BIT(ah, AR_PCU_MISC_MODE2,
AR_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT);
-   ah-sw_mgmt_crypto = true;
+   ah-sw_mgmt_crypto_tx = true;
+   ah-sw_mgmt_crypto_rx = true;
} else {
-   ah-sw_mgmt_crypto = true;
+   ah-sw_mgmt_crypto_tx = true;
+   ah-sw_mgmt_crypto_rx = true;
}
 }
 
diff --git a/drivers/net/wireless/ath/ath9k/hw.h 
b/drivers/net/wireless/ath/ath9k/hw.h
index e49721e8..55ee0a5 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -753,7 +753,8 @@ struct ath_hw {
} eeprom;
const struct eeprom_ops *eep_ops;
 
-   bool sw_mgmt_crypto;
+   bool sw_mgmt_crypto_tx;
+   bool sw_mgmt_crypto_rx;
bool is_pciexpress;
bool aspm_enabled;
bool is_monitoring;
diff --git a/drivers/net/wireless/ath/ath9k/main.c 
b/drivers/net/wireless/ath/ath9k/main.c
index 644552c..6bf87c0 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1657,7 +1657,7 @@ static int ath9k_set_key(struct ieee80211_hw *hw,
key-flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
if (key-cipher == WLAN_CIPHER_SUITE_TKIP)
key-flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
-   if (sc-sc_ah-sw_mgmt_crypto 
+   if (sc-sc_ah-sw_mgmt_crypto_tx 
key-cipher == WLAN_CIPHER_SUITE_CCMP)
key-flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX;
ret = 0;
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/2] ath9k|ath9k_htc: Allow Software Crypto for Transmitted Management Frame in mesh

2014-11-15 Thread Chun-Yeow Yeoh
These patches enable the software encryption to be done in
software for transmitted management frame for USB devices,
especially for secured mesh.

Chun-Yeow Yeoh (2):
  ath9k|ath9k_htc: Seperate the software crypto flag for Tx and Rx
  ath9k_htc: Enable software crypto for mgmt frame in Tx for USB devices

 drivers/net/wireless/ath/ath9k/common.c   |  2 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |  2 +-
 drivers/net/wireless/ath/ath9k/hw.c   | 12 +---
 drivers/net/wireless/ath/ath9k/hw.h   |  3 ++-
 drivers/net/wireless/ath/ath9k/main.c |  2 +-
 5 files changed, 14 insertions(+), 7 deletions(-)

-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ath9k_htc: turn on software mgmt crypto for secured mesh

2014-11-13 Thread Chun-Yeow Yeoh
Secured mesh encrypts the unicast mgmt frame using the same
key that used for encrypting the unicast data frame. The patch
ath9k_htc_firmware: fix the offset of CCMP header for mesh
data frame applied to open-ath9k-htc-firmware allows the
ath9k_htc to be loaded without nohwcrypt=1. Unfortunately,
this is not working and we still need CCMP encryption of
management frames to be done in software. Fix this.

This patch is tested with the following hardwares:
- TP-Link TL-WN821N v3 802.11n [Atheros AR7010+AR9287]
- AR9271 802.11n

and managed to work with peer mesh STA equipped with ath9k.

Signed-off-by: Chun-Yeow Yeoh yeohchuny...@gmail.com
---
 drivers/net/wireless/ath/ath9k/htc_drv_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 689ac99..d3f65a2 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1447,7 +1447,8 @@ static int ath9k_htc_set_key(struct ieee80211_hw *hw,
key-flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
if (key-cipher == WLAN_CIPHER_SUITE_TKIP)
key-flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
-   if (priv-ah-sw_mgmt_crypto 
+   if ((vif-type == NL80211_IFTYPE_MESH_POINT ||
+priv-ah-sw_mgmt_crypto) 
key-cipher == WLAN_CIPHER_SUITE_CCMP)
key-flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX;
ret = 0;
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ath9k: fix the assignment of hw queues for mesh interface

2014-11-12 Thread Chun-Yeow Yeoh
We need to assign the hw queues for mesh interface. Otherwise,
we are not able to bring up the mesh interface due to the
IEEE80211_INVAL_HW_QUEUE error.

Signed-off-by: Chun-Yeow Yeoh yeohchuny...@gmail.com
---
 drivers/net/wireless/ath/ath9k/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/main.c 
b/drivers/net/wireless/ath/ath9k/main.c
index 644552c..88a5cf2 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1188,7 +1188,8 @@ static void ath9k_assign_hw_queues(struct ieee80211_hw 
*hw,
for (i = 0; i  IEEE80211_NUM_ACS; i++)
vif-hw_queue[i] = i;
 
-   if (vif-type == NL80211_IFTYPE_AP)
+   if (vif-type == NL80211_IFTYPE_AP ||
+   vif-type == NL80211_IFTYPE_MESH_POINT)
vif-cab_queue = hw-queues - 2;
else
vif-cab_queue = IEEE80211_INVAL_HW_QUEUE;
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 2/2] iw: Allow basic rates to be configured when joining mesh

2014-09-22 Thread Chun-Yeow Yeoh
This patch adds option to configure basic rates during mesh join.

Signed-off-by: Ashok Nagarajan ashok.dra...@gmail.com
Signed-off-by: Chun-Yeow Yeoh yeohchuny...@gmail.com

v2: minor change for upstream
v3: fix typo error (Colleen)
---
 mesh.c | 40 ++--
 1 file changed, 34 insertions(+), 6 deletions(-)

diff --git a/mesh.c b/mesh.c
index 570b4d3..8d69fca 100644
--- a/mesh.c
+++ b/mesh.c
@@ -438,8 +438,9 @@ static int join_mesh(struct nl80211_state *state, struct 
nl_cb *cb,
 {
struct nlattr *container;
float rate;
-   int bintval, dtim_period, i;
-   char *end;
+   unsigned char rates[NL80211_MAX_SUPP_RATES];
+   int bintval, dtim_period, i, n_rates = 0;
+   char *end, *value = NULL, *sptr = NULL;
unsigned long freq = 0;
static const struct {
const char *name;
@@ -510,6 +511,32 @@ static int join_mesh(struct nl80211_state *state, struct 
nl_cb *cb,
}
}
 
+   /* basic rates */
+   if (argc  1  strcmp(argv[0], basic-rates) == 0) {
+   argv++;
+   argc--;
+
+   value = strtok_r(argv[0], ,, sptr);
+
+   while (value  n_rates  NL80211_MAX_SUPP_RATES) {
+   rate = strtod(value, end);
+   rates[n_rates] = rate * 2;
+
+   /* filter out suspicious values  */
+   if (*end != '\0' || !rates[n_rates] ||
+   rate*2 != rates[n_rates])
+   return 1;
+
+   n_rates++;
+   value = strtok_r(NULL, ,, sptr);
+   }
+
+   NLA_PUT(msg, NL80211_ATTR_BSS_BASIC_RATES, n_rates, rates);
+   argv++;
+   argc--;
+   }
+
+   /* multicast rate */
if (argc  1  strcmp(argv[0], mcast-rate) == 0) {
argv++;
argc--;
@@ -575,13 +602,14 @@ static int join_mesh(struct nl80211_state *state, struct 
nl_cb *cb,
  nla_put_failure:
return -ENOBUFS;
 }
-COMMAND(mesh, join, mesh ID [freq freq in MHz HT20|HT40+|HT40-|NOHT]
-[mcast-rate rate in Mbps]
+COMMAND(mesh, join, mesh ID [[freq freq in MHz HT20|HT40+|HT40-|NOHT]
+[basic-rates rate in Mbps,rate2,...]], [mcast-rate rate in Mbps]
 [beacon-interval time in TUs] [dtim-period value]
 [vendor_sync on|off] [param=value]*,
NL80211_CMD_JOIN_MESH, 0, CIB_NETDEV, join_mesh,
-   Join a mesh with the given mesh ID with frequency, mcast-rate, 
-   and mesh parameters.);
+   Join a mesh with the given mesh ID with frequency, basic-rates,\n
+   mcast-rate and mesh parameters. Basic-rates are applied only if\n
+   frequency is provided.);
 
 static int leave_mesh(struct nl80211_state *state, struct nl_cb *cb,
  struct nl_msg *msg, int argc, char **argv,
-- 
1.9.2

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html