Search Linux Wireless

Re: [RFC PATCH v5 2/7] mac80211: add debugfs interface for U-APSD queue configuration

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

 



On Thu, 2009-12-31 at 15:37 +0200, Kalle Valo wrote:

> +static ssize_t uapsd_max_sp_len_read(struct file *file, char __user
> *user_buf,
> +				     size_t count, loff_t *ppos)
> +{
> +	struct ieee80211_local *local = file->private_data;
> +	int res;
> +	char buf[10];
> +
> +	res = scnprintf(buf, sizeof(buf), "0x%x\n",
> local->uapsd_max_sp_len);
> +
> +	return simple_read_from_buffer(user_buf, count, ppos, buf, res);
> +}
> +
> +static ssize_t uapsd_max_sp_len_write(struct file *file,
> +				      const char __user *user_buf,
> +				      size_t count, loff_t *ppos)
> +{
> +	struct ieee80211_local *local = file->private_data;
> +	unsigned long val;
> +	char buf[10];
> +	size_t len;
> +	int ret;
> +
> +	len = min(count, sizeof(buf) - 1);
> +	if (copy_from_user(buf, user_buf, len))
> +		return -EFAULT;
> +	buf[len] = '\0';
> +
> +	ret = strict_strtoul(buf, 0, &val);
> +
> +	if (ret)
> +		return -EINVAL;
> +
> +	if (val != 0 && (val & IEEE80211_WMM_IE_STA_QOSINFO_SP_MASK) == 0)
> +		return -ERANGE;
> +
> +	local->uapsd_max_sp_len = val;

This seems a bit weird, that means you need to use 0x20, ..., 0x60,
right? I think you should shift it up/down when reading/writing, or
probably even store it shifted in local->uapsd_max_sp_len and then shift
it up by 5 when using that value -- the value itself is only 0..3 after
all, and only stored in a bitmasked field.

johannes

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux