From: ferran <ranker72@gmail.com>
To: linux-wireless@vger.kernel.org
Subject: [question] panic when calling drv_get_tsf
Date: Mon, 07 Sep 2015 19:44:42 +0200 [thread overview]
Message-ID: <55EDCD0A.4030503@gmail.com> (raw)
In-Reply-To: <55E9A07E.8070005@gmail.com>
Dear all,
I'm having some issues in a modified version of mac80211, which I hope
you will help me with.
I want to report a lower bound of the channel utilization to which a
mesh device is tuned in for a research project. So far, I can read
successfully from debugfs this new statistic updated periodically,
targeting mesh interfaces and tested only with atheros cards. However, I
would like to improve it as I describe at the end. The strategy is to
keep adding the rx and tx used time until a [mesh] beacon is sent, and
then, trigger a custom function that derives the utilization for that
given interval. This one reads the elapsed time since the previous
beacon (should be 1000 TU in mesh mode) and resets the counters. Caller
function:
--- tx.c ---
struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
u16 *tim_offset, u16
*tim_length)
{
struct ieee80211_local *local = hw_to_local(hw);
...
rcu_read_lock();
sdata = vif_to_sdata(vif);
...
out:
rcu_read_unlock();
/* HERE */
my_function(local, sdata->name, sdata);
return skb;
}
My function. Note that I've modified ieee80211_local to share data
between "rx", "tx status" and "beacon tx" contexts. The line comments
fix the error.
--- tx.c ---
static void my_function(struct ieee80211_local *local, char
*if_name, struct ieee80211_sub_if_data *sdata){
u64 beacon_interval = 1000 * 1024 // 1.024 seconds.
/* Retrieve counters and add them up */
/* ↓ KERNEL PANIC HERE ↓ */
// current_tsf = drv_get_tsf(local, sdata);
// beacon_interval = current_tsf -
local->ch_load.last_tsf_channel_load_update;
rem = do_div(total_used_time, beacon_interval); // compute
utilization
/* do some averaging and save */
/* reset counters */
}
So firstly, why can't I call drv_get_tsf from there? Is it because TSF
is exactly then being reset? Secondly, I feel unsafe about
synchronization. Should I rcu-protect all operations on
ieee80211_sub_if_data, ieee80211_hw and sk_buff? Worker functions on
rx.c and status.c do read values from those structures.
Finally, I would be interested on using TSF to measure the time passed
since a packet is scheduled to transmit in tx.c and its report is
received at status.c. Do you think that TSF be usable for this?
Thanks for your help!
Ferran
next parent reply other threads:[~2015-09-07 17:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <55E9A07E.8070005@gmail.com>
2015-09-07 17:44 ` ferran [this message]
2015-09-08 1:20 ` [question] panic when calling drv_get_tsf Bob Copeland
2015-09-14 17:40 ` ferran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55EDCD0A.4030503@gmail.com \
--to=ranker72@gmail.com \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).