* [PATCH] net: reset skb queue mapping when rx'ing over tunnel
@ 2010-09-23 21:19 Tom Herbert
2010-09-24 2:06 ` Eric Dumazet
0 siblings, 1 reply; 5+ messages in thread
From: Tom Herbert @ 2010-09-23 21:19 UTC (permalink / raw)
To: netdev, davem; +Cc: chavey
Reset queue mapping when an skb is reentering the stack via a tunnel.
On second pass, the queue mapping from the original device is no
longer valid.
Signed-off-by: Tom Herbert <therbert@google.com>
---
diff --git a/include/net/dst.h b/include/net/dst.h
index 81d1413..0238650 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -242,6 +242,7 @@ static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev)
dev->stats.rx_packets++;
dev->stats.rx_bytes += skb->len;
skb->rxhash = 0;
+ skb_set_queue_mapping(skb, 0);
skb_dst_drop(skb);
nf_reset(skb);
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] net: reset skb queue mapping when rx'ing over tunnel
2010-09-23 21:19 [PATCH] net: reset skb queue mapping when rx'ing over tunnel Tom Herbert
@ 2010-09-24 2:06 ` Eric Dumazet
2010-09-24 16:18 ` Tom Herbert
0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2010-09-24 2:06 UTC (permalink / raw)
To: Tom Herbert; +Cc: netdev, davem, chavey
Le jeudi 23 septembre 2010 à 14:19 -0700, Tom Herbert a écrit :
> Reset queue mapping when an skb is reentering the stack via a tunnel.
> On second pass, the queue mapping from the original device is no
> longer valid.
>
> Signed-off-by: Tom Herbert <therbert@google.com>
> ---
> diff --git a/include/net/dst.h b/include/net/dst.h
> index 81d1413..0238650 100644
> --- a/include/net/dst.h
> +++ b/include/net/dst.h
> @@ -242,6 +242,7 @@ static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev)
> dev->stats.rx_packets++;
> dev->stats.rx_bytes += skb->len;
> skb->rxhash = 0;
> + skb_set_queue_mapping(skb, 0);
> skb_dst_drop(skb);
> nf_reset(skb);
> }
> --
Hmm...
This would need to be reverted later when tunnels are updated to be
multiqueue aware ? I made an attempt with GRE some days ago.
I dont understand why this patch is needed, since get_rps_cpu() has a
check anyway
if (skb_rx_queue_recorded(skb)) {
u16 index = skb_get_rx_queue(skb);
if (unlikely(index >= dev->num_rx_queues)) {
WARN_ONCE(dev->num_rx_queues > 1, "%s received packet "
"on queue %u, but number of RX queues is %u\n",
dev->name, index, dev->num_rx_queues);
goto done;
}
rxqueue = dev->_rx + index;
} else
rxqueue = dev->_rx;
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] net: reset skb queue mapping when rx'ing over tunnel
2010-09-24 2:06 ` Eric Dumazet
@ 2010-09-24 16:18 ` Tom Herbert
2010-09-25 6:49 ` Eric Dumazet
0 siblings, 1 reply; 5+ messages in thread
From: Tom Herbert @ 2010-09-24 16:18 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, davem, chavey
> Hmm...
>
> This would need to be reverted later when tunnels are updated to be
> multiqueue aware ? I made an attempt with GRE some days ago.
>
> I dont understand why this patch is needed, since get_rps_cpu() has a
> check anyway
>
I think the skb queue_mapping should correspond to a queue in the
skb's device as an invariant. In the case that an skb's device is
change from a multiqueue device to single queue device (like GRE), the
inconsistency in the queue_mapping is fairly innocuous, we get one
warning but will pretty much take the unlikely branch for GRE packets
then on. But imagine a case where skb's device was change from one
multiqueue device to another, but the queue mapping was not also
updated. This would cause poor weighting in get_rps_cpus. For
example, if the new device had fewer queues than the old one,
get_rps_cpu will bias toward using queue 0's rps mask.
> if (skb_rx_queue_recorded(skb)) {
> u16 index = skb_get_rx_queue(skb);
> if (unlikely(index >= dev->num_rx_queues)) {
> WARN_ONCE(dev->num_rx_queues > 1, "%s received packet "
> "on queue %u, but number of RX queues is %u\n",
> dev->name, index, dev->num_rx_queues);
> goto done;
> }
> rxqueue = dev->_rx + index;
> } else
> rxqueue = dev->_rx;
>
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] net: reset skb queue mapping when rx'ing over tunnel
2010-09-24 16:18 ` Tom Herbert
@ 2010-09-25 6:49 ` Eric Dumazet
2010-09-27 1:48 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2010-09-25 6:49 UTC (permalink / raw)
To: Tom Herbert; +Cc: netdev, davem, chavey
Le vendredi 24 septembre 2010 à 09:18 -0700, Tom Herbert a écrit :
> > Hmm...
> >
> > This would need to be reverted later when tunnels are updated to be
> > multiqueue aware ? I made an attempt with GRE some days ago.
> >
> > I dont understand why this patch is needed, since get_rps_cpu() has a
> > check anyway
> >
> I think the skb queue_mapping should correspond to a queue in the
> skb's device as an invariant. In the case that an skb's device is
> change from a multiqueue device to single queue device (like GRE), the
> inconsistency in the queue_mapping is fairly innocuous, we get one
> warning but will pretty much take the unlikely branch for GRE packets
> then on. But imagine a case where skb's device was change from one
> multiqueue device to another, but the queue mapping was not also
> updated. This would cause poor weighting in get_rps_cpus. For
> example, if the new device had fewer queues than the old one,
> get_rps_cpu will bias toward using queue 0's rps mask.
I believe your patch is fine. Thanks
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: reset skb queue mapping when rx'ing over tunnel
2010-09-25 6:49 ` Eric Dumazet
@ 2010-09-27 1:48 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2010-09-27 1:48 UTC (permalink / raw)
To: eric.dumazet; +Cc: therbert, netdev, chavey
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sat, 25 Sep 2010 08:49:10 +0200
> Le vendredi 24 septembre 2010 à 09:18 -0700, Tom Herbert a écrit :
>> > Hmm...
>> >
>> > This would need to be reverted later when tunnels are updated to be
>> > multiqueue aware ? I made an attempt with GRE some days ago.
>> >
>> > I dont understand why this patch is needed, since get_rps_cpu() has a
>> > check anyway
>> >
>> I think the skb queue_mapping should correspond to a queue in the
>> skb's device as an invariant. In the case that an skb's device is
>> change from a multiqueue device to single queue device (like GRE), the
>> inconsistency in the queue_mapping is fairly innocuous, we get one
>> warning but will pretty much take the unlikely branch for GRE packets
>> then on. But imagine a case where skb's device was change from one
>> multiqueue device to another, but the queue mapping was not also
>> updated. This would cause poor weighting in get_rps_cpus. For
>> example, if the new device had fewer queues than the old one,
>> get_rps_cpu will bias toward using queue 0's rps mask.
>
> I believe your patch is fine. Thanks
>
> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Applied, thanks everyone.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-09-27 1:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-23 21:19 [PATCH] net: reset skb queue mapping when rx'ing over tunnel Tom Herbert
2010-09-24 2:06 ` Eric Dumazet
2010-09-24 16:18 ` Tom Herbert
2010-09-25 6:49 ` Eric Dumazet
2010-09-27 1:48 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).