Search Linux Wireless

Re: [PATCH v2 03/10] ath10k: support ethtool stats.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23 September 2014 23:17,  <greearb@xxxxxxxxxxxxxxx> wrote:
[...]
> +void ath10k_get_et_stats(struct ieee80211_hw *hw,
> +                        struct ieee80211_vif *vif,
> +                        struct ethtool_stats *stats, u64 *data)
> +{
> +       struct ath10k *ar = hw->priv;
> +       int i = 0;
> +       struct ath10k_target_stats *fw_stats;
> +
> +       fw_stats = &ar->debug.target_stats;
> +
> +       mutex_lock(&ar->conf_mutex);
> +
> +       if (ar->state == ATH10K_STATE_ON)
> +               ath10k_refresh_peer_stats(ar);
> +
> +       mutex_unlock(&ar->conf_mutex);

Just for correctness sake - it's probably a good idea to
mutex_unlock() at the end (i.e. after spin_unlock_bh()) to make sure
the stats are for this particular request. With your patch there's a
very slight chance that, e.g. fw_stats debug file is being read at the
same time and it updates fw stats between the above mutex_unlock() and
following spin_lock_bh().

> +       spin_lock_bh(&ar->data_lock);
> +       data[i++] = fw_stats->hw_reaped; /* ppdu reaped */
[...]
> +       spin_unlock_bh(&ar->data_lock);
> +
> +       WARN_ON(i != ATH10K_SSTATS_LEN);
> +}


Michał
--
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




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux