Search Linux Wireless

Re: [PATCH 13/17] iwlwifi: mvm: add Rx frames statistics via debugfs

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

 



On Sun, 2014-02-23 at 21:57 +0200, Emmanuel Grumbach wrote:
> From: Eyal Shapira <eyal@xxxxxxxxxx>
> 
> Collect statistics regarding rates and aggregations in Rx
> frames and export the data via debugfs.
[]
> diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/iwlwifi/mvm/debugfs.c
[]
> +static ssize_t iwl_dbgfs_frame_stats_read(struct iwl_mvm *mvm,
> +					  char __user *user_buf, size_t count,
> +					  loff_t *ppos,
> +					  struct iwl_mvm_frame_stats *stats)
> +{
> +	char *buff;
> +	int pos = 0, idx, i;

I think this would be shorter code using pos as a char *

> +	int ret;
> +	size_t bufsz = 1024;

I'd prefer #define or static const though the compiler
should do the same thing.

> +	buff = kmalloc(bufsz, GFP_KERNEL);
> +	if (!buff)
> +		return -ENOMEM;
> +
> +	spin_lock_bh(&mvm->drv_stats_lock);

	pos = buff;
	endpos = pos + bufsz;

> +	pos += scnprintf(buff + pos, bufsz - pos,
> +			 "Legacy/HT/VHT\t:\t%d/%d/%d\n",
> +			 stats->legacy_frames,
> +			 stats->ht_frames,
> +			 stats->vht_frames);

	pos += scnprintf(pos, endpos - pos, etc...

etc...


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