lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 14 Feb 2014 13:48:43 -0500 (EST)
From:	David Miller <davem@...emloft.net>
To:	dborkman@...hat.com
Cc:	mathias.kretschmer@...us.fraunhofer.de, netdev@...r.kernel.org,
	brouer@...hat.com
Subject: Re: [PATCH net] packet: check for ndo_select_queue during queue
 selection

From: Daniel Borkmann <dborkman@...hat.com>
Date: Fri, 14 Feb 2014 11:21:22 +0100

> The other two possibilities I see is 1) to check for
> dev->ieee80211_ptr on setsockopt(2) and bind(2) (which could happen
> _after_ the option was set) and just disallow that option for those
> cases (doesn't make sense to use it for ieee80211 devs anyway, and
> they seem to be the only special-cased users), or, preferably 2) to
> just leave the code as it currently is, that is, similar to pktgen.

Don't sell yourself so short, think out of the box:

typedef u16 (*select_queue_fallback_t)(struct net_device *dev, struct sk_buff *skb);
 ...
	u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb,
				void *accel_priv, select_queue_fallback_t fallback);

And your packet code would do something like:

static u16 __packet_pick_tx_queue(struct net_device *dev, struct sk_buff *skb)
{
	return (u16) raw_smp_processor_id() % dev->real_num_tx_queues;
}

static u16 packet_pick_tx_queue(struct net_device *dev, struct sk_buff *skb)
{
	u16 queue_index;

	if (ops->ndo_select_queue)
		queue_index = ops->ndo_select_queue(dev, skb, NULL, __packet_pick_tx_queue);
	else
		queue_index = __packet_pick_tx_queue(dev, skb);
	skb_set_queue_mapping(skb, queue_index);
}

Then you go through the existing ndo_select_queue implementations, you'll notice
a lot of them are of the form:

	if (special_stuff)
		queue_index = whatever;
	else
		queue_index = __netdev_pick_tx(...);

replace that __netdev_pick_tx call with one to "fallback".
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ