Re: [ath9k-devel] inferring time of frame at head of hw queue from

2012-11-30 Thread abhinav narain
You are right,
I have used; ath9k_hw_computetxtime()
ath_pkt_duration()

for data packets.
I have questions for RTS, ACK :

(1) I don't know if they use short/long preamble ?
There is no  40mhz ,gi for control packets, as far I can think
ath9k_hw_computetxtime() uses ieee80211_rate-bitrate {a value in kbps) as
the input, and there is no index used, unlike in this case, there is an
index used in ath_buf_set_rate()
code
  info-rtscts_rate = rate-hw_value;
/code

(2) Do I subtract 1 ACK frame from the timestamp of ath_tx_status
If yes, I can't find the hw rate index for bitrate of ACK !
Thomas (another person who responded on the list) said its 6 Mbps, but what
can I use as the index ?

Awaiting response !
-Abhinav

On Thu, Nov 29, 2012 at 7:38 PM, Adrian Chadd adrian.ch...@gmail.comwrote:

 There's a function to calculate the TX time of a frame given the rate
 and the config (short/long gi, 20/40mhz, short/long preamble.)

 You should use that? :-)



 Adrian


 On 29 November 2012 15:36, abhinav narain abhinavnarai...@gmail.com
 wrote:
  hi,
I am trying to infer the time of frame when it was at head of queue.
  ath9k returns the time of successful retransmission in
  ath_tx_status-ts_tstamp.
 
  I have calculated the time for frame duration using  ath_buf_set_rate().
  I am doing this in ath_tx_rc_status()
 
  I am somehow exporting the rts rate from the ath_buf_set_rate(), but
  ieee80211_rate-hw_value is a hardware rate code I suppose and is
 written to
  register.
  How do I calculate the airtime from this no ?
  currently, I did
  rts airtime = 20*(tx_status-shortretry) / rate-hw_value ! which is not
  right ..
  Can someone suggest what shall I do .. the hw_value is set to 11,27 most
 of
  the time.
 
  I am calulating the time at head by doing ath_tx_status-ts_stamp -
  (time_for_data_frame_retx + rts_artime  )
 
  Do I need to add (14/6)i.e ACK back at 6 Mbps above also ?
  Do I need to add some SIFS constant ?
 
  is rts_airtime calculation correct ? or there are SIFS to be added ?
 
  compat-wireless folder doesn't have code for such calculations. Can
 someone
  please suggest ?
 
  -Abhinav Narain
 
 

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


Re: [ath9k-devel] ath9k_htc test release: please test

2012-11-30 Thread Adrian Chadd
.. be64_to_cpu() ? That field is not already converted for you?



Adrian


On 29 November 2012 20:46, vikranth reddy
vikranth.reddydevelo...@gmail.com wrote:
 Hi,

 I have tested it using Sony BR-100 (AR7010 + AR9280). PFA the time diff logs
 for the new firmware.(htc_7010.fw)

 I added prints for time diff in
 file:-  ~/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
 function:-  ath9k_rx_tasklet
 position:- just before ieee80211_rx  function.

 Code Snippet:
 void ath9k_rx_tasklet(unsigned long data)
 {
 struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *)data;
 struct ath9k_htc_rxbuf *rxbuf = NULL, *tmp_buf = NULL;
 struct ieee80211_rx_status rx_status;
 struct sk_buff *skb;
 unsigned long flags;
 struct ieee80211_hdr *hdr;
 /* Added to measure Time-Difference between successive WiFi Packets */
 static u64 prev1,now1;
 long long diff1 = 0;
 static u32 counter1 = 0;
 //

 do {
 spin_lock_irqsave(priv-rx.rxbuflock, flags);
 list_for_each_entry(tmp_buf, priv-rx.rxbuf, list) {
 if (tmp_buf-in_process) {
 rxbuf = tmp_buf;
 break;
 }
 }

 if (rxbuf == NULL) {
 spin_unlock_irqrestore(priv-rx.rxbuflock, flags);
 break;
 }

 if (!rxbuf-skb)
 goto requeue;

 if (!ath9k_rx_prepare(priv, rxbuf, rx_status)) {
 dev_kfree_skb_any(rxbuf-skb);
 goto requeue;
 }

 memcpy(IEEE80211_SKB_RXCB(rxbuf-skb), rx_status,
   sizeof(struct ieee80211_rx_status));
 skb = rxbuf-skb;
 hdr = (struct ieee80211_hdr *) skb-data;

 if (ieee80211_is_beacon(hdr-frame_control)  priv-ps_enabled)
 ieee80211_queue_work(priv-hw, priv-ps_work);

 spin_unlock_irqrestore(priv-rx.rxbuflock, flags);
 /* Added to measure Time-Difference between successive WiFi Packets */
 now1 = be64_to_cpu(rxbuf-rxstatus.rs_tstamp);
 diff1 = now1 - prev1;
 if(diff1  0) {
 printk(###now = %llu prev = %llu diff = %lld counter =
 %u\n,now1,prev1,diff1,counter1++);
 }
 prev1 = now1;
 /**/
 ieee80211_rx(priv-hw, skb);

 spin_lock_irqsave(priv-rx.rxbuflock, flags);



 ...
 ...


 }

 Nov 29 10  36  29  [  103.724123] ###now = 2683579500078 prev =
 2684354679445 diff = -775179367
 Nov 29 10  36  49  [  122.787519] ###now = 64609 prev = 2683598441314
 diff = -2683598376705
 Nov 29 10  36  49  [  122.947963] ###now = 2683598748946 prev =
 2684354687871 diff = -755938925
 Nov 29 10  36  50  [  123.766144] ###now = 2683599568206 prev =
 2684354697547 diff = -755129341
 Nov 29 10  36  50  [  124.072922] ###now = 2683599875386 prev =
 2684354601000 diff = -754725614
 Nov 29 10  36  50  [  124.481997] ###now = 2683600284967 prev =
 2684354598998 diff = -754314031
 Nov 29 10  36  51  [  124.890184] ###now = 2683600693668 prev =
 2684354605871 diff = -753912203
 Nov 29 10  36  51  [  125.298751] ###now = 51576 prev = 2683601031091
 diff = -2683600979515

 Still I see the negative time-differences between successive WiFi-packets,
 when it is stayed connected to single AP. In the log, now is the TSF of
 current packet and prev is previous WiFi Packet's timestamp. All the
 variables are 64-bit.


 But the difference between new firmware and old-firmware is, I see less
 number of negative differences comparatively.

 Thanks
 Vikranth
 On Thu, Nov 29, 2012 at 5:20 AM, Adrian Chadd adr...@freebsd.org wrote:

 Hi all,

 I've done an updated build of the ath9k_htc firmware images. I don't
 currently have a HTC setup working so this is just a recompilation of
 the current firmware.

 http://dev.qca.qualcomm.com/~adrian/htc/20121128/

 Please let me know if it works or doesn't work for you.

 The specific two changes from Sujith's last release:

 * Fix the TSF extension logic to correctly extend TSF from 32 bit to 64
 bit;
 * Update the embedded runtime OS code to the latest from Tensilica, in
 preparation for open sourcing it;

 I don't plan on fixing any bugs that already exist in the latest
 ath9k_htc drop in the firmware git repository; I just want to check
 that the build hasn't broken any existing behaviour (ie, made things
 worse.)

 Thanks,


 Adrian
 ___
 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] ath9k_htc test release: please test

2012-11-30 Thread vikranth reddy
Hi Adrian,

No its not already converted.

See the below code-snippet in ath9k_rx_prepare

   rx_status-mactime = be64_to_cpu(rxbuf-rxstatus.rs_tstamp);
rx_status-band = hw-conf.channel-band;
rx_status-freq = hw-conf.channel-center_freq;
rx_status-signal =  rxbuf-rxstatus.rs_rssi + ATH_DEFAULT_NOISE_FLOOR;
rx_status-antenna = rxbuf-rxstatus.rs_antenna;
rx_status-flag |= RX_FLAG_MACTIME_MPDU;

Which calculates the mactime, using be64_to_cpu.

Thanks
Vikranth

On Fri, Nov 30, 2012 at 2:29 PM, Adrian Chadd adr...@freebsd.org wrote:

 .. be64_to_cpu() ? That field is not already converted for you?



 Adrian


 On 29 November 2012 20:46, vikranth reddy
 vikranth.reddydevelo...@gmail.com wrote:
  Hi,
 
  I have tested it using Sony BR-100 (AR7010 + AR9280). PFA the time diff
 logs
  for the new firmware.(htc_7010.fw)
 
  I added prints for time diff in
  file:-  ~/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
  function:-  ath9k_rx_tasklet
  position:- just before ieee80211_rx  function.
 
  Code Snippet:
  void ath9k_rx_tasklet(unsigned long data)
  {
  struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *)data;
  struct ath9k_htc_rxbuf *rxbuf = NULL, *tmp_buf = NULL;
  struct ieee80211_rx_status rx_status;
  struct sk_buff *skb;
  unsigned long flags;
  struct ieee80211_hdr *hdr;
  /* Added to measure Time-Difference between successive WiFi Packets */
  static u64 prev1,now1;
  long long diff1 = 0;
  static u32 counter1 = 0;
  //
 
  do {
  spin_lock_irqsave(priv-rx.rxbuflock, flags);
  list_for_each_entry(tmp_buf, priv-rx.rxbuf, list) {
  if (tmp_buf-in_process) {
  rxbuf = tmp_buf;
  break;
  }
  }
 
  if (rxbuf == NULL) {
  spin_unlock_irqrestore(priv-rx.rxbuflock, flags);
  break;
  }
 
  if (!rxbuf-skb)
  goto requeue;
 
  if (!ath9k_rx_prepare(priv, rxbuf, rx_status)) {
  dev_kfree_skb_any(rxbuf-skb);
  goto requeue;
  }
 
  memcpy(IEEE80211_SKB_RXCB(rxbuf-skb), rx_status,
sizeof(struct ieee80211_rx_status));
  skb = rxbuf-skb;
  hdr = (struct ieee80211_hdr *) skb-data;
 
  if (ieee80211_is_beacon(hdr-frame_control)  priv-ps_enabled)
  ieee80211_queue_work(priv-hw, priv-ps_work);
 
  spin_unlock_irqrestore(priv-rx.rxbuflock, flags);
  /* Added to measure Time-Difference between successive WiFi Packets */
  now1 = be64_to_cpu(rxbuf-rxstatus.rs_tstamp);
  diff1 = now1 - prev1;
  if(diff1  0) {
  printk(###now = %llu prev = %llu diff = %lld counter =
  %u\n,now1,prev1,diff1,counter1++);
  }
  prev1 = now1;
  /**/
  ieee80211_rx(priv-hw, skb);
 
  spin_lock_irqsave(priv-rx.rxbuflock, flags);
 
 
 
  ...
  ...
 
 
  }
 
  Nov 29 10  36  29  [  103.724123] ###now = 2683579500078 prev =
  2684354679445 diff = -775179367
  Nov 29 10  36  49  [  122.787519] ###now = 64609 prev = 2683598441314
  diff = -2683598376705
  Nov 29 10  36  49  [  122.947963] ###now = 2683598748946 prev =
  2684354687871 diff = -755938925
  Nov 29 10  36  50  [  123.766144] ###now = 2683599568206 prev =
  2684354697547 diff = -755129341
  Nov 29 10  36  50  [  124.072922] ###now = 2683599875386 prev =
  2684354601000 diff = -754725614
  Nov 29 10  36  50  [  124.481997] ###now = 2683600284967 prev =
  2684354598998 diff = -754314031
  Nov 29 10  36  51  [  124.890184] ###now = 2683600693668 prev =
  2684354605871 diff = -753912203
  Nov 29 10  36  51  [  125.298751] ###now = 51576 prev = 2683601031091
  diff = -2683600979515
 
  Still I see the negative time-differences between successive
 WiFi-packets,
  when it is stayed connected to single AP. In the log, now is the TSF of
  current packet and prev is previous WiFi Packet's timestamp. All the
  variables are 64-bit.
 
 
  But the difference between new firmware and old-firmware is, I see less
  number of negative differences comparatively.
 
  Thanks
  Vikranth
  On Thu, Nov 29, 2012 at 5:20 AM, Adrian Chadd adr...@freebsd.org
 wrote:
 
  Hi all,
 
  I've done an updated build of the ath9k_htc firmware images. I don't
  currently have a HTC setup working so this is just a recompilation of
  the current firmware.
 
  http://dev.qca.qualcomm.com/~adrian/htc/20121128/
 
  Please let me know if it works or doesn't work for you.
 
  The specific two changes from Sujith's last release:
 
  * Fix the TSF extension logic to correctly extend TSF from 32 bit to 64
  bit;
  * Update the embedded runtime OS code to the latest from Tensilica, in
  preparation for open sourcing it;
 
  I don't plan on fixing any bugs that already exist in the latest
  ath9k_htc drop in the firmware git repository; I just want to check
  that the build hasn't broken any existing behaviour (ie, made things
  worse.)
 
  Thanks,
 
 
  Adrian
  ___
  ath9k-devel mailing list
  ath9k-devel@lists.ath9k.org
  https://lists.ath9k.org/mailman/listinfo/ath9k-devel
 
 


Re: [ath9k-devel] ath9k_htc test release: please test

2012-11-30 Thread Adrian Chadd
As I said, the cozybit guys reported that the TSF increment is
behaving correctly. Maybe it's only behaving correctly for beacons
here, hm.

Also, look:

 Nov 29 10  36  49  [  122.787519] ###now = 64609 prev = 2683598441314 
 diff = -2683598376705
 Nov 29 10  36  49  [  122.947963] ###now = 2683598748946 prev = 
 2684354687871 diff = -755938925

Your now/prev values are all messed up, the second prev should been
64609, right?

In any case, unless it's really obvious to fix, I'm just going to
leave this as-is as it's the same behaviour as previous firmware.
(Which is my aim here..)


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


Re: [ath9k-devel] ath9k_htc test release: please test

2012-11-30 Thread Oleksij Rempel
Am 29.11.2012 00:50, schrieb Adrian Chadd:
 Hi all,

 I've done an updated build of the ath9k_htc firmware images. I don't
 currently have a HTC setup working so this is just a recompilation of
 the current firmware.

 http://dev.qca.qualcomm.com/~adrian/htc/20121128/

 Please let me know if it works or doesn't work for you.

 The specific two changes from Sujith's last release:

 * Fix the TSF extension logic to correctly extend TSF from 32 bit to 64 bit;
 * Update the embedded runtime OS code to the latest from Tensilica, in
 preparation for open sourcing it;

 I don't plan on fixing any bugs that already exist in the latest
 ath9k_htc drop in the firmware git repository; I just want to check
 that the build hasn't broken any existing behaviour (ie, made things
 worse.)

 Thanks,



Works without regressions on ALFA AWUS036NHA (Atheros AR9271 Rev:1)


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


[ath9k-devel] PHY counter hard coded values in reg.h

2012-11-30 Thread abhinav narain
hi,
 In ath9k/reg.h,
there are some constants for the PHY error counters
#define AR_FILT_CCK0x8128

#define AR_PHY_ERR_1   0x812c
#define AR_PHY_ERR_MASK_1  0x8130

#define AR_PHY_ERR_2   0x8134
#define AR_PHY_ERR_MASK_2  0x8138

Can I change them to 0x or the mask ? or the ERR are for a purpose and
will degrade router performance if modified ?

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


Re: [ath9k-devel] PHY counter hard coded values in reg.h

2012-11-30 Thread Adrian Chadd
Hi,


On 30 November 2012 16:34, abhinav narain abhinavnarai...@gmail.com wrote:
 hi,
  In ath9k/reg.h,
 there are some constants for the PHY error counters
 #define AR_FILT_CCK0x8128

 #define AR_PHY_ERR_1   0x812c
 #define AR_PHY_ERR_MASK_1  0x8130

 #define AR_PHY_ERR_2   0x8134
 #define AR_PHY_ERR_MASK_2  0x8138

 Can I change them to 0x or the mask ? or the ERR are for a purpose and
 will degrade router performance if modified ?

The counting itself won't cause problems. But right now with the ANI
code it treats those two PHY_ERR_{1,2} registers as special. So if you
change those masks, you'll change how ANI responds.

The ANI code also may still generate MIB interrupts when the counters
overflow. If you add PHY errors to those, the MIB counters will
overflow more frequently and you'll end up with more interrupts.

So, play safely :-)


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


Re: [ath9k-devel] PHY counter hard coded values in reg.h

2012-11-30 Thread Adrian Chadd
.. 0x24? Why's it ANDing with that? How big is that PHY error array?

And there's a separate RX PHY error mask register you can set to
0x for experiment:

ar5212reg.h:#define AR_PHY_ERR  0x810c  /* Phy error filter */



Adrian

On 30 November 2012 20:20, abhinav narain abhinavnarai...@gmail.com wrote:
 I won't be touching the ANI counters.
 I have the following question instead :

 In debug.c ;
 After enabling  the PHYERR, the
 if (rs-rs_status  ATH9K_RXERR_PHY) {
 RX_STAT_INC(phy_err);
 phyerr = rs-rs_phyerr  0x24;
 RX_PHY_ERR_INC(phyerr);
 }
   UNDERRUN :7723847
 TIMING :  0
 PARITY :  0
   RATE :  0
TOR :  0
 OFDM-TIMING :  0
 OFDM-SIGNAL-PARITY :  0
  OFDM-RATE : 0
OFDM-LENGTH :  0
   OFDM-POWER-DROP :  0
   OFDM-SERVICE :  0
   OFDM-RESTART :  0
   FALSE-RADAR-EXT : 0
 CCK-TIMING :  0
   CCK-HEADER-CRC :  0
   CCK-RATE :   0
CCK-SERVICE :0
CCK-RESTART :   0

 LENGTH :1238241
 CCK-LENGTH :  80508
 are the only PHY errors that are shown in debugfs output.
 I wanted to know if changing the mask would enable other error counters too
 ?
 Or the mask itself is such that only the above PHYERRs are shown.
 There is no documentation of what each represent.

 -Abhinav


 On Fri, Nov 30, 2012 at 8:25 PM, Adrian Chadd adr...@freebsd.org wrote:

 Hi,


 On 30 November 2012 16:34, abhinav narain abhinavnarai...@gmail.com
 wrote:
  hi,
   In ath9k/reg.h,
  there are some constants for the PHY error counters
  #define AR_FILT_CCK0x8128
 
  #define AR_PHY_ERR_1   0x812c
  #define AR_PHY_ERR_MASK_1  0x8130
 
  #define AR_PHY_ERR_2   0x8134
  #define AR_PHY_ERR_MASK_2  0x8138
 
  Can I change them to 0x or the mask ? or the ERR are for a purpose
  and
  will degrade router performance if modified ?

 The counting itself won't cause problems. But right now with the ANI
 code it treats those two PHY_ERR_{1,2} registers as special. So if you
 change those masks, you'll change how ANI responds.

 The ANI code also may still generate MIB interrupts when the counters
 overflow. If you add PHY errors to those, the MIB counters will
 overflow more frequently and you'll end up with more interrupts.

 So, play safely :-)


 Adrian


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


Re: [ath9k-devel] PHY counter hard coded values in reg.h

2012-11-30 Thread abhinav narain
On Fri, Nov 30, 2012 at 11:27 PM, Adrian Chadd adr...@freebsd.org wrote:

 .. 0x24? Why's it ANDing with that?


Not my code !  Its already present in debgufs.c

How big is that PHY error array?

 Enum is indexed till 37

 And there's a separate RX PHY error mask register you can set to
 0x for experiment:

 ar5212reg.h:#define AR_PHY_ERR  0x810c  /* Phy error filter */

 Okay, thanks.
-Abhinav




 Adrian

 On 30 November 2012 20:20, abhinav narain abhinavnarai...@gmail.com
 wrote:
  I won't be touching the ANI counters.
  I have the following question instead :
 
  In debug.c ;
  After enabling  the PHYERR, the
  if (rs-rs_status  ATH9K_RXERR_PHY) {
  RX_STAT_INC(phy_err);
  phyerr = rs-rs_phyerr  0x24;
  RX_PHY_ERR_INC(phyerr);
  }
UNDERRUN :7723847
  TIMING :  0
  PARITY :  0
RATE :  0
 TOR :  0
  OFDM-TIMING :  0
  OFDM-SIGNAL-PARITY :  0
   OFDM-RATE : 0
 OFDM-LENGTH :  0
OFDM-POWER-DROP :  0
OFDM-SERVICE :  0
OFDM-RESTART :  0
FALSE-RADAR-EXT : 0
  CCK-TIMING :  0
CCK-HEADER-CRC :  0
CCK-RATE :   0
 CCK-SERVICE :0
 CCK-RESTART :   0
 
  LENGTH :1238241
  CCK-LENGTH :  80508
  are the only PHY errors that are shown in debugfs output.
  I wanted to know if changing the mask would enable other error counters
 too
  ?
  Or the mask itself is such that only the above PHYERRs are shown.
  There is no documentation of what each represent.
 
  -Abhinav
 
 
  On Fri, Nov 30, 2012 at 8:25 PM, Adrian Chadd adr...@freebsd.org
 wrote:
 
  Hi,
 
 
  On 30 November 2012 16:34, abhinav narain abhinavnarai...@gmail.com
  wrote:
   hi,
In ath9k/reg.h,
   there are some constants for the PHY error counters
   #define AR_FILT_CCK0x8128
  
   #define AR_PHY_ERR_1   0x812c
   #define AR_PHY_ERR_MASK_1  0x8130
  
   #define AR_PHY_ERR_2   0x8134
   #define AR_PHY_ERR_MASK_2  0x8138
  
   Can I change them to 0x or the mask ? or the ERR are for a purpose
   and
   will degrade router performance if modified ?
 
  The counting itself won't cause problems. But right now with the ANI
  code it treats those two PHY_ERR_{1,2} registers as special. So if you
  change those masks, you'll change how ANI responds.
 
  The ANI code also may still generate MIB interrupts when the counters
  overflow. If you add PHY errors to those, the MIB counters will
  overflow more frequently and you'll end up with more interrupts.
 
  So, play safely :-)
 
 
  Adrian
 
 

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


Re: [ath9k-devel] PHY counter hard coded values in reg.h

2012-11-30 Thread Adrian Chadd
On 30 November 2012 21:05, abhinav narain abhinavnarai...@gmail.com wrote:


 On Fri, Nov 30, 2012 at 11:27 PM, Adrian Chadd adr...@freebsd.org wrote:

 .. 0x24? Why's it ANDing with that?


 Not my code !  Its already present in debgufs.c

 How big is that PHY error array?

 Enum is indexed till 37

Right. Then AND'ing it is entirely wrong.. I'll submit a patch to fix
that on Monday.




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