Search Linux Wireless

Re: [PATCH/RFC 3/3] mac80211_hwsim: enable user space frame processing

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

 



On Thu, 2010-03-11 at 23:43 -0500, Bob Copeland wrote:

> -static int radios = 2;
> -module_param(radios, int, 0444);
> -MODULE_PARM_DESC(radios, "Number of simulated radios");

Never mind my other comment ...

> +	txi = IEEE80211_SKB_CB(skb);
> +	response->cookie = (unsigned long) skb;
> +	response->rts_cts_rate_idx = txi->control.rts_cts_rate_idx;
> +	for (i=0; i < IEEE80211_TX_MAX_RATES; i++)
> +	{
> +		response->rates[i].idx = txi->control.rates[i].idx;
> +		response->rates[i].count = txi->control.rates[i].count;
> +		response->rates[i].flags = txi->control.rates[i].flags;

It's a debugging thing, but still .. how stable do we expect these flags
to be? I sure wouldn't think twice about changing them in mac80211.h.

> +static
> +int mac80211_hwsim_control_write(struct file *file, const char __user *buf,
> +				 size_t count, loff_t *pos)
> +{
> +	struct mac80211_hwsim_data *data;
> +	struct sk_buff *skb;
> +	struct ieee80211_rx_status rx_status;
> +
> +	data = file->private_data;
> +
> +	skb = dev_alloc_skb(count);
> +	if (!skb)
> +		return -ENOMEM;
> +
> +	if (copy_from_user(skb_put(skb, count), buf, count)) {
> +		dev_kfree_skb(skb);
> +		return -EFAULT;
> +	}
> +
> +	if (data->idle || !data->started ||
> +	    !data->channel ||
> +	    !hwsim_ps_rx_ok(data, skb)) {
> +		dev_kfree_skb(skb);
> +		goto out;
> +	}
> +
> +	/* XXX: parse radiotap header to set rx status, get channel etc. */

Or maybe just use a struct here just like for read()?

> +/* This structure is returned on a read() */
> +struct mac80211_hwsim_tx_packet {
> +	__u64 cookie;
> +	struct mac80211_hwsim_tx_rate rates[MAC80211_TX_MAX_RATES];
> +	__s8 rts_cts_rate_idx;
> +	__u16 pkt_len;
> +	__u8 pkt_data[0];
> +} __attribute__((packed));

Maybe this should have some reserved fields? But then you did say the
ABI should be reworked :)

> +#ifdef __KERNEL__
> +
> +#endif /* __KERNEL__ */

?

Overall looks pretty good!

johannes

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