I'm new to Madwifi and relatively new to Linux as well.

I'm studying Rate Adaptation in Madwifi. What i'm trying to do is keep track of the per-packet bitrate variations. For that, I set up an adhoc network between two computers and run an iperf from the one to the other.
At the transmitter side i added the following line within the function ath_tx_start in the file if_ath.c  :

6876        if (an->an_prevdatarix != rix)
6877                 printk("Now i'm using rate %d \n", rix);

So basically i want the driver to report the rate index to the kernel every time we have a change in the bitrate used. After running iperf for a while, i open a new command window and run a dmesg |grep 'using rate'  so as to see those printks i asked for.

I'm using the AMRR rate adaptation protocol. This protocol increases or decreases the bitrate one step at a time, so what i'd expect to see is a rate index sequence like
2,3,4,5,6,7,6,5,4,5,4, ....    or something like that.
The problem is that the indexes reported do not follow a logical sequence. I get something like this:

[  404.629807] I'm using rate 9
[  406.635286] I'm using rate 8
[  409.628868] I'm using rate 7
[  410.633380] I'm using rate 6
[  418.257337] I'm using rate 3
[  419.555140] I'm using rate 6
[  420.542011] I'm using rate 7
[  421.551500] I'm using rate 8
[  422.542228] I'm using rate 9
[  423.546218] I'm using rate 11
[  455.607794] I'm using rate 8
[  485.593441] I'm using rate 8
[  503.510782] I'm using rate 10
[  504.595141] I'm using rate 9
[  505.518029] I'm using rate 8

I can't explain how the rate might change from index 3 to index 6 for example, so i suppose that some intermediate reports are missing.
My guess is that this behavior is due to the kernel (perhaps with the way interrupts are handled) but then i'm new to linux so that's only a guess.
I should also mention that i tried to make printk to report every single packet's bitrate (not just when it changes) and the results were even less meaningful.

--Does anyone have an explanation for the behavior i described? Is there a way to get     printk to do what i want?
--Is there another (perhaps easier) way to get a per-packet report of the bitrate in use?

Thanks in advance for your time. Any help will be appreciated.

P.S. I'm using kernel 2.6.24-21  and Madwifi 0.9.4 (if it makes any difference)
P.S.2 I've already posted this to the madwifi-users list with no luck, so I thought this list might be a more appropriate place

Rediscover HotmailŪ: Get e-mail storage that grows with you. Check it out.