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 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html