Re: [ath9k-devel] [RFC 03/10] ath9k: add dynamic ack timeout estimation

2014-07-10 Thread Hosam Hittini
I managed to change the CRDA settings by getting backports package 
http://www.kernel.org/pub/linux/kernel/projects/backports/stable/v3.15.1/, 
modifying the db.txt and forcing the driver to follow my db.txt
This how my db.txt looks like
country 00:
(2402 - 2482 @ 20), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20)
(5490 - 5710 @ 40), (N/A, 20)
(5735 - 5835 @ 40), (N/A, 20)Regards,
However, when I try to configure the AP on a 5GHz channel I still get the same 
error
wlan0: IEEE 802.11 Configured channel (36) not found from the channel list of 
current mode (2) IEEE 802.11a
There is one more strange thing, the output of iw reg get and iw list have a 
conflict
hosam@SanDisk-16:~$ iw reg get
country 00:
(2402 - 2482 @ 20), (N/A, 20)
(5170 - 5250 @ 40), (N/A, 20)
(5250 - 5330 @ 40), (N/A, 20)
(5490 - 5710 @ 40), (N/A, 20)
(5735 - 5835 @ 40), (N/A, 20)
iw list
Frequencies:
* 5180 MHz [36] (30.0 dBm) (passive scanning, no IBSS)
* 5200 MHz [40] (30.0 dBm) (passive scanning, no IBSS)
* 5220 MHz [44] (30.0 dBm) (passive scanning, no IBSS)
* 5240 MHz [48] (30.0 dBm) (passive scanning, no IBSS)
* 5260 MHz [52] (30.0 dBm) (passive scanning, no IBSS, 
radar detection)
* 5280 MHz [56] (30.0 dBm) (passive scanning, no IBSS, 
radar detection)
* 5300 MHz [60] (30.0 dBm) (passive scanning, no IBSS, 
radar detection)
* 5320 MHz [64] (30.0 dBm) (passive scanning, no IBSS, 
radar detection)
* 5500 MHz [100] (30.0 dBm) (passive scanning, no IBSS, 
radar detection)
* 5520 MHz [104] (30.0 dBm) (passive scanning, no IBSS, 
radar detection)
* 5540 MHz [108] (30.0 dBm) (passive scanning, no IBSS, 
radar detection)
* 5560 MHz [112] (30.0 dBm) (passive scanning, no IBSS, 
radar detection)
* 5580 MHz [116] (30.0 dBm) (passive scanning, no IBSS, 
radar detection)
* 5600 MHz [120] (30.0 dBm) (passive scanning, no IBSS, 
radar detection)
* 5620 MHz [124] (30.0 dBm) (passive scanning, no IBSS, 
radar detection)
* 5640 MHz [128] (30.0 dBm) (passive scanning, no IBSS, 
radar detection)
* 5660 MHz [132] (30.0 dBm) (passive scanning, no IBSS, 
radar detection)
* 5680 MHz [136] (30.0 dBm) (passive scanning, no IBSS, 
radar detection)
* 5700 MHz [140] (30.0 dBm) (passive scanning, no IBSS, 
radar detection)
* 5745 MHz [149] (30.0 dBm) (passive scanning, no IBSS)
* 5765 MHz [153] (30.0 dBm) (passive scanning, no IBSS)
* 5785 MHz [157] (30.0 dBm) (passive scanning, no IBSS)
* 5805 MHz [161] (30.0 dBm) (passive scanning, no IBSS)
* 5825 MHz [165] (30.0 dBm) (passive scanning, no IBSS)

Eng. Hosam Hittini

On Jul 9, 2014, at 9:47 PM, Lorenzo Bianconi lorenzo.biancon...@gmail.com 
wrote:

 Hi Sujith,
 
 Lorenzo Bianconi wrote:
 +/*
 + * Copyright 2014, Lorenzo Bianconi lorenzo.biancon...@gmail.com
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + */
 
 I have not reviewed the patches, but the ath9k driver is licensed
 under ISC. Introducing a file with GPLv2 license is bound to cause
 complications and I think might require legal clearance from a
 QCA employee maintaining ath9k.
 
 Right now, I am not sure if there is an official maintainer for
 ath9k, but is there any specific reason why you have chosen
 GPLv2 ?
 
 Sujith
 
 Nope. I didn't know ath9k is under ISC license. I think I can replace
 GPLv2 license with an ISC one.
 Best regards,
 
 Lorenzo
 
 
 -- 
 UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch;
 unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp;
 umount; make clean; sleep
 ___
 ath9k-devel mailing list
 ath9k-devel@lists.ath9k.org
 https://lists.ath9k.org/mailman/listinfo/ath9k-devel

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [RFC 03/10] ath9k: add dynamic ack timeout estimation

2014-07-09 Thread Sujith Manoharan
Lorenzo Bianconi wrote:
 +/*
 + * Copyright 2014, Lorenzo Bianconi lorenzo.biancon...@gmail.com
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + */

I have not reviewed the patches, but the ath9k driver is licensed
under ISC. Introducing a file with GPLv2 license is bound to cause
complications and I think might require legal clearance from a
QCA employee maintaining ath9k.

Right now, I am not sure if there is an official maintainer for
ath9k, but is there any specific reason why you have chosen
GPLv2 ?

Sujith
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [RFC 03/10] ath9k: add dynamic ack timeout estimation

2014-07-09 Thread Lorenzo Bianconi
Hi Sujith,

 Lorenzo Bianconi wrote:
 +/*
 + * Copyright 2014, Lorenzo Bianconi lorenzo.biancon...@gmail.com
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + */

 I have not reviewed the patches, but the ath9k driver is licensed
 under ISC. Introducing a file with GPLv2 license is bound to cause
 complications and I think might require legal clearance from a
 QCA employee maintaining ath9k.

 Right now, I am not sure if there is an official maintainer for
 ath9k, but is there any specific reason why you have chosen
 GPLv2 ?

 Sujith

Nope. I didn't know ath9k is under ISC license. I think I can replace
GPLv2 license with an ISC one.
Best regards,

Lorenzo


-- 
UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch;
unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp;
umount; make clean; sleep
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [RFC 03/10] ath9k: add dynamic ack timeout estimation

2014-07-07 Thread Thomas Hühn
Hi Lorenzo,

My comments are inline.


 Add dynamic ack timeout estimation algorithm based on ack frame RX timestamp,
 TX frame timestamp and frame duration.
 
 Signed-off-by: Lorenzo Bianconi lorenzo.biancon...@gmail.com
 ---
 drivers/net/wireless/ath/ath.h  |   2 +
 drivers/net/wireless/ath/ath9k/ath9k.h  |   3 +
 drivers/net/wireless/ath/ath9k/dynack.c | 293 
 drivers/net/wireless/ath/ath9k/dynack.h |  81 +
 drivers/net/wireless/ath/ath9k/hw.c |   2 +
 drivers/net/wireless/ath/ath9k/hw.h |   3 +
 6 files changed, 384 insertions(+)
 create mode 100644 drivers/net/wireless/ath/ath9k/dynack.c
 create mode 100644 drivers/net/wireless/ath/ath9k/dynack.h
 
 diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
 index fd9e530..4e51072 100644
 --- a/drivers/net/wireless/ath/ath.h
 +++ b/drivers/net/wireless/ath/ath.h
 @@ -234,6 +234,7 @@ void ath_printk(const char *level, const struct 
 ath_common *common,
  *AR9462.
  * @ATH_DBG_DFS: radar datection
  * @ATH_DBG_WOW: Wake on Wireless
 + * @ATH_DBG_DYNACK: dynack handling
  * @ATH_DBG_ANY: enable all debugging
  *
  * The debug level is used to control the amount and type of debugging output
 @@ -261,6 +262,7 @@ enum ATH_DEBUG {
   ATH_DBG_MCI = 0x8000,
   ATH_DBG_DFS = 0x0001,
   ATH_DBG_WOW = 0x0002,
 + ATH_DBG_DYNACK  = 0x0004,
   ATH_DBG_ANY = 0x
 };
 
 diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h 
 b/drivers/net/wireless/ath/ath9k/ath9k.h
 index 11b5e4d..65a2587 100644
 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
 @@ -272,6 +272,9 @@ struct ath_node {
   struct ath_rx_rate_stats rx_rate_stats;
 #endif
   u8 key_idx[4];
 +
 + u32 ackto;
 + struct list_head list;
 };
 
 struct ath_tx_control {
 diff --git a/drivers/net/wireless/ath/ath9k/dynack.c 
 b/drivers/net/wireless/ath/ath9k/dynack.c
 new file mode 100644
 index 000..50297e7
 --- /dev/null
 +++ b/drivers/net/wireless/ath/ath9k/dynack.c
 @@ -0,0 +1,293 @@
 +/*
 + * Copyright 2014, Lorenzo Bianconi lorenzo.biancon...@gmail.com
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + */
 +#include ath9k.h
 +#include hw.h
 +#include dynack.h
 +
 +#define COMPUTE_TO   (5 * HZ)
 +#define LATEACK_DELAY(10 * HZ)
 +#define LATEACK_TO   256
 +#define MAX_DELAY300
 +#define EWMA_LEVEL   75
 +#define DYNACK_EWMA(old, new)\
 + (((new) * (100 - EWMA_LEVEL) + (old) * EWMA_LEVEL) / 100)
 +

You could change this EWMA calculation as we did it in Minstrel to use powers 
of two as the calculation speed increased.
This would change :
- EWMA_DIV   from 100 to 2^7
- EWMA_LEVEL from 75 (/EWMA_DIV=100) to 2^6 + 2^5 (/EWMA_DIV=128)

Note that this changes EWMA_DIV - EWMA_LEVEL from 25 to 2^5 and keeps
EWMA_LEVEL / EWMA_DIV == 0.75.

Something like this:

+#define EWMA_LEVEL 96  /* ewma weighting factor [/EWMA_DIV] */
+#define EWMA_DIV   128

static inline int
dynack_ewma(int old, int new, int weight)
{
+   return (new * (EWMA_DIV - weight) + old * weight) / EWMA_DIV;
}


 +/**
 + * ath_dynack_get_sifs - get sifs time based on phy used
 + * @ah: ath hw
 + * @phy: phy used
 + */
 +static inline u32 ath_dynack_get_sifs(struct ath_hw *ah, int phy)
 +{
 + u32 sifs = CCK_SIFS_TIME;
 +
 + if (phy == WLAN_RC_PHY_OFDM) {
 + if (IS_CHAN_QUARTER_RATE(ah-curchan))
 + sifs = OFDM_SIFS_TIME_QUARTER;
 + else if (IS_CHAN_HALF_RATE(ah-curchan))
 + sifs = OFDM_SIFS_TIME_HALF;
 + else
 + sifs = OFDM_SIFS_TIME;
 + }
 + return sifs;
 +}
 +
 +static inline bool ath_dynack_bssidmask(struct ath_hw *ah, const u8 *mac)
 +{
 + int i;
 + struct ath_common *common = ath9k_hw_common(ah);
 +
 + for (i = 0; i  ETH_ALEN; i++) {
 + if ((common-macaddr[i]  common-bssidmask[i]) !=
 + (mac[i]  common-bssidmask[i]))
 + return false;
 + }
 +
 + return true;
 +}
 +
 +/**
 + * ath_dynack_set_ackto - compute ack timeout based on sta timeout
 + * @ah: ath hw
 + *
 + * should be called while holding qlock
 + */
 +static void ath_dynack_compute_ackto(struct ath_hw *ah)

The function name does not match the name in the comment above 
(ath_dynack_set_ackto != ath_dynack_compute_ackto).

 +{
 + struct ath_node *an;
 + u32 to = 0;
 + struct ath_dynack *da = ah-dynack;
 + struct ath_common *common = ath9k_hw_common(ah);
 +

 + list_for_each_entry(an, da-nodes, list)
 + if (an-ackto  to)
 + to = an-ackto;
 +

This list parsing would probably need rcu protection like:

 

Re: [ath9k-devel] [RFC 03/10] ath9k: add dynamic ack timeout estimation

2014-07-07 Thread Felix Fietkau
On 2014-07-07 13:41, Thomas Hühn wrote:

 +{
 +struct ath_node *an;
 +u32 to = 0;
 +struct ath_dynack *da = ah-dynack;
 +struct ath_common *common = ath9k_hw_common(ah);
 +
 
 +list_for_each_entry(an, da-nodes, list)
 +if (an-ackto  to)
 +to = an-ackto;
 +
 
 This list parsing would probably need rcu protection like:
   
   rcu_read_lock();
   list_for_each_entry(an, da-nodes, list)
   if (an-ackto  to)
   to = an-ackto;
   rcu_read_unlock();
Nope, that's already done in the calling code.

 I am not sure that you need to call the entire function with spin_lock as you 
 do it now.
 
 +if (to  da-ackto != to) {
 +u32 slottime;
 +
 +slottime = (to - 3) / 2;
 
 Should the case to  3 be covered or is it safe to have potentially slottime 
 = 0 ?
slottime should never be 0. It is not user configurable.

 +/**
 + * ath_dynack_compute_to - compute ack timeout
 + * @ah: ath hw
 + *
 + * should be called while holding qlock
 + */
 +static void ath_dynack_compute_to(struct ath_hw *ah)
 +{
 +u32 ackto, ack_ts;
 +u8 *dst, *src;
 +struct ieee80211_sta *sta;
 +struct ath_node *an;
 +struct ts_info *st_ts;
 +struct ath_dynack *da = ah-dynack;
 +
 +rcu_read_lock();
 +
 +while (da-st_rbf.h_rb != da-st_rbf.t_rb 
 +   da-ack_rbf.h_rb != da-ack_rbf.t_rb) {
 +ack_ts = da-ack_rbf.tstamp[da-ack_rbf.h_rb];
 +st_ts = da-st_rbf.ts[da-st_rbf.h_rb];
 +dst = da-st_rbf.addr[da-st_rbf.h_rb].h_dest;
 +src = da-st_rbf.addr[da-st_rbf.h_rb].h_src;
 +
 +ath_dbg(ath9k_hw_common(ah), DYNACK,
 +ack_ts %u st_ts %u st_dur %u [%u-%u]\n,
 +ack_ts, st_ts-tstamp, st_ts-dur,
 +da-ack_rbf.h_rb, da-st_rbf.h_rb);
 +
 +if (ack_ts  st_ts-tstamp + st_ts-dur) {
 +ackto = ack_ts - st_ts-tstamp - st_ts-dur;
 +
 +if (ackto  MAX_DELAY) {
 +sta = ieee80211_find_sta_by_ifaddr(ah-hw, dst,
 +   src);
 +if (sta) {
 +an = (struct ath_node *)sta-drv_priv;
 +an-ackto = DYNACK_EWMA((u32)ackto,
 +an-ackto);
 +ath_dbg(ath9k_hw_common(ah), DYNACK,
 +%pM to %u\n, dst, an-ackto);
 +if (time_is_before_jiffies(da-lto)) {
 +ath_dynack_compute_ackto(ah);
 +da-lto = jiffies + COMPUTE_TO;
 +}
 +}
 +INCR(da-ack_rbf.h_rb, ATH_DYN_BUF);
 +}
 +INCR(da-st_rbf.h_rb, ATH_DYN_BUF);
 +} else {
 +INCR(da-ack_rbf.h_rb, ATH_DYN_BUF);
 +}
 +}
 +
 +rcu_read_unlock();
 
 I think it is sufficient to have the rcu_read_unlock just around
 ieee80211_find_sta_by_ifaddr(). So the lock does not need to
 include the whole while loop under lock.
That doesn't make things any better - rcu_read_lock is not like a normal
lock. Doing it once outside of the loop is not only simpler, but also
slightly more efficient.

- Felix
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [RFC 03/10] ath9k: add dynamic ack timeout estimation

2014-07-07 Thread Lorenzo Bianconi
 Hi Lorenzo,


Hi Thomas,

 My comments are inline.


 Add dynamic ack timeout estimation algorithm based on ack frame RX timestamp,
 TX frame timestamp and frame duration.

 Signed-off-by: Lorenzo Bianconi lorenzo.biancon...@gmail.com
 ---
 drivers/net/wireless/ath/ath.h  |   2 +
 drivers/net/wireless/ath/ath9k/ath9k.h  |   3 +
 drivers/net/wireless/ath/ath9k/dynack.c | 293 
 
 drivers/net/wireless/ath/ath9k/dynack.h |  81 +
 drivers/net/wireless/ath/ath9k/hw.c |   2 +
 drivers/net/wireless/ath/ath9k/hw.h |   3 +
 6 files changed, 384 insertions(+)
 create mode 100644 drivers/net/wireless/ath/ath9k/dynack.c
 create mode 100644 drivers/net/wireless/ath/ath9k/dynack.h

 diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
 index fd9e530..4e51072 100644
 --- a/drivers/net/wireless/ath/ath.h
 +++ b/drivers/net/wireless/ath/ath.h
 @@ -234,6 +234,7 @@ void ath_printk(const char *level, const struct 
 ath_common *common,
  *AR9462.
  * @ATH_DBG_DFS: radar datection
  * @ATH_DBG_WOW: Wake on Wireless
 + * @ATH_DBG_DYNACK: dynack handling
  * @ATH_DBG_ANY: enable all debugging
  *
  * The debug level is used to control the amount and type of debugging output
 @@ -261,6 +262,7 @@ enum ATH_DEBUG {
   ATH_DBG_MCI = 0x8000,
   ATH_DBG_DFS = 0x0001,
   ATH_DBG_WOW = 0x0002,
 + ATH_DBG_DYNACK  = 0x0004,
   ATH_DBG_ANY = 0x
 };

 diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h 
 b/drivers/net/wireless/ath/ath9k/ath9k.h
 index 11b5e4d..65a2587 100644
 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
 @@ -272,6 +272,9 @@ struct ath_node {
   struct ath_rx_rate_stats rx_rate_stats;
 #endif
   u8 key_idx[4];
 +
 + u32 ackto;
 + struct list_head list;
 };

 struct ath_tx_control {
 diff --git a/drivers/net/wireless/ath/ath9k/dynack.c 
 b/drivers/net/wireless/ath/ath9k/dynack.c
 new file mode 100644
 index 000..50297e7
 --- /dev/null
 +++ b/drivers/net/wireless/ath/ath9k/dynack.c
 @@ -0,0 +1,293 @@
 +/*
 + * Copyright 2014, Lorenzo Bianconi lorenzo.biancon...@gmail.com
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + */
 +#include ath9k.h
 +#include hw.h
 +#include dynack.h
 +
 +#define COMPUTE_TO   (5 * HZ)
 +#define LATEACK_DELAY(10 * HZ)
 +#define LATEACK_TO   256
 +#define MAX_DELAY300
 +#define EWMA_LEVEL   75
 +#define DYNACK_EWMA(old, new)\
 + (((new) * (100 - EWMA_LEVEL) + (old) * EWMA_LEVEL) / 100)
 +

 You could change this EWMA calculation as we did it in Minstrel to use powers 
 of two as the calculation speed increased.
 This would change :
 - EWMA_DIV   from 100 to 2^7
 - EWMA_LEVEL from 75 (/EWMA_DIV=100) to 2^6 + 2^5 (/EWMA_DIV=128)

 Note that this changes EWMA_DIV - EWMA_LEVEL from 25 to 2^5 and keeps
 EWMA_LEVEL / EWMA_DIV == 0.75.

 Something like this:

 +#define EWMA_LEVEL 96  /* ewma weighting factor [/EWMA_DIV] */
 +#define EWMA_DIV   128

 static inline int
 dynack_ewma(int old, int new, int weight)
 {
 +   return (new * (EWMA_DIV - weight) + old * weight) / EWMA_DIV;
 }


Ack


 +/**
 + * ath_dynack_get_sifs - get sifs time based on phy used
 + * @ah: ath hw
 + * @phy: phy used
 + */
 +static inline u32 ath_dynack_get_sifs(struct ath_hw *ah, int phy)
 +{
 + u32 sifs = CCK_SIFS_TIME;
 +
 + if (phy == WLAN_RC_PHY_OFDM) {
 + if (IS_CHAN_QUARTER_RATE(ah-curchan))
 + sifs = OFDM_SIFS_TIME_QUARTER;
 + else if (IS_CHAN_HALF_RATE(ah-curchan))
 + sifs = OFDM_SIFS_TIME_HALF;
 + else
 + sifs = OFDM_SIFS_TIME;
 + }
 + return sifs;
 +}
 +
 +static inline bool ath_dynack_bssidmask(struct ath_hw *ah, const u8 *mac)
 +{
 + int i;
 + struct ath_common *common = ath9k_hw_common(ah);
 +
 + for (i = 0; i  ETH_ALEN; i++) {
 + if ((common-macaddr[i]  common-bssidmask[i]) !=
 + (mac[i]  common-bssidmask[i]))
 + return false;
 + }
 +
 + return true;
 +}
 +
 +/**
 + * ath_dynack_set_ackto - compute ack timeout based on sta timeout
 + * @ah: ath hw
 + *
 + * should be called while holding qlock
 + */
 +static void ath_dynack_compute_ackto(struct ath_hw *ah)

 The function name does not match the name in the comment above 
 (ath_dynack_set_ackto != ath_dynack_compute_ackto).


Sorry, just a typo

 +{
 + struct ath_node *an;
 + u32 to = 0;
 + struct ath_dynack *da = ah-dynack;
 + struct ath_common *common = ath9k_hw_common(ah);
 +

 + list_for_each_entry(an, da-nodes, list)
 + if (an-ackto  to)
 + to = an-ackto;
 +

 This list