How to read the current bit rate from within a kernel modul?

Live forum: http://rt2x00.serialmonkey.com/viewtopic.php?t=6072

iltersuat

06-05-2010 16:11:08

Hi everyone,

I am not sure if this is the right place to ask my question. If not, please excuse me.

I am developing a kernel module for a sort of kernel profiler and I need to read/poll the current bit rate from this module. I've traced the source code of WE and rt2x00 driver for a day and finally found some points to work on, but I am not sure if I will get any good result. I am running out of time, so I thought maybe someone here could lead me to the right path.
As the subject hints, how can I really read this connection bit rate in safe way from a different kernel module? The "iwconfig" and "iwlist" achieves that by using ioctl(SIOCGIWRATE) from user space. What is the correct way to do that from kernel space?

I have a D-Link DWL-G122 and using version 2.6.27 of the Linux kernel.

Any help is welcome.
Thanks in advance.
ilter

IvD

06-05-2010 16:50:16

Well it depends on what you exactly need. You can obtain the bitrate in the rt2x00queue_create_tx_descriptor() function, but this is the per-frame bitrate.
If you need the average which is run from IOCTL, you have to check the ratecontrol module in mac80211.

iltersuat

06-05-2010 17:58:55

Well it depends on what you exactly need. You can obtain the bitrate in the rt2x00queue_create_tx_descriptor() function, but this is the per-frame bitrate.
If you need the average which is run from IOCTL, you have to check the ratecontrol module in mac80211.[/quote9nkpcgwp]

Thank you IvD. If you don't mind I have another question Is there any mechanism that keeps track of receive frame/packet rate anywhere in the kernel? In other words, is it possible to know the receive rate by reading some structures? I am very new to network programming stuff, so please excuse my naive question.

Thanks again.
ilter

IvD

06-05-2010 18:53:44

You have to check mac80211 for that. rt2x00 will report the RX rate for each frame to mac80211 during the reporting of the RX frame. So if you want to collect the statistics you need to look for them in mac80211. That way you also have the most portable way which works for all wireless network drivers.

iltersuat

06-05-2010 20:54:09

You have to check mac80211 for that. rt2x00 will report the RX rate for each frame to mac80211 during the reporting of the RX frame. So if you want to collect the statistics you need to look for them in mac80211. That way you also have the most portable way which works for all wireless network drivers.[/quote3hof5k52]

Thank you IvD.
ilter