core: Factor out flow calculation from get_rps_cpu
Subsystems (2)
PATCH v5 1/2 core: Factor out flow calculation from get_rps_cpu
From: Krishna Kumar <[email protected]>
Factor out flow calculation code from get_rps_cpu, since other functions can use the same code.
Revisions:
v2 (Ben): Separate flow calcuation out and use in select queue. v3 (Arnd): Don't re-implement MIN.
v4 (Changli): skb->data points to ethernet header in macvtap, and
make a fast path. Tested macvtap with this patch.
v5 (Changli):
- Cache skb->rxhash in skb_get_rxhash
- macvtap may not have pow(2) queues, so change code for queue selection.
(Arnd):
- Use first available queue if all fails.
--- include/linux/skbuff.h | 9 +++ net/core/dev.c | 106 ++++++++++++++++++++++----------------- 2 files changed, 71 insertions(+), 44 deletions(-)
include/linux/skbuff.h +9 -0
@@ -558,6 +558,15 @@ extern unsigned int skb_find_text(stru unsigned int to, struct ts_config *config, struct ts_state *state); +extern __u32 __skb_get_rxhash (struct sk_buff *skb); +static inline __u32 skb_get_rxhash (struct sk_buff *skb) +{ +if (!skb->rxhash) + skb->rxhash =__skb_get_rxhash (skb); + +return skb->rxhash; +} +#ifdef NET_SKBUFF_DATA_USES_OFFSET static inline unsigned char *skb_end_pointer (const struct sk_buff *skb) {
net/core/dev.c +62 -44
156 lines not on this page · raw message
PATCH v5 2/2 macvtap: Implement multiqueue for macvtap driver
From: Krishna Kumar <[email protected]>
Implement multiqueue facility for macvtap driver. The idea is that a macvtap device can be opened multiple times and the fd's can be used to register eg, as backend for vhost.
--- drivers/net/macvtap.c | 99 ++++++++++++++++++++++++++++------- include/linux/if_macvlan.h | 9 ++- 2 files changed, 90 insertions(+), 18 deletions(-)
include/linux/if_macvlan.h +8 -1
@@ -40,6 +40,12 @@ struct macvlan_rx_stats {unsigned long rx_errors; }; +/* +* Maximum times a macvtap device can be opened. This can be used to +* configure the number of receive queue, e.g. for multiqueue virtio. +*/ +#define MAX_MACVTAP_QUEUES (NR_CPUS < 16 ? NR_CPUS : 16) +struct macvlan_dev {struct net_device *dev;struct list_head list;
@@ -50,7 +56,8 @@ struct macvlan_dev {enum macvlan_mode mode;int (*receive)(struct sk_buff *skb);int (*forward)(struct net_device *dev,struct sk_buff *skb); -struct macvtap_queue *tap; +struct macvtap_queue *taps[MAX_MACVTAP_QUEUES ]; +int numvtaps; }; static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
drivers/net/macvtap.c +82 -17
156 lines not on this page · raw message
Re: [PATCH v5 2/2] macvtap: Implement multiqueue for macvtap driver
From: Krishna Kumar <[email protected]>
Date: Wed, 04 Aug 2010 21:45:59 +0530
Quoted 3 lines
Implement multiqueue facility for macvtap driver. The idea is that a macvtap device can be opened multiple times and the fd's can be used to register eg, as backend for vhost.
Applied.
From: Krishna Kumar <[email protected]>
Date: Wed, 04 Aug 2010 21:45:52 +0530
Quoted 2 lines
Factor out flow calculation code from
get_rps_cpu, since other functions can use the same code.
Applied.