* [PATCH] gso: Handle Trans-Ether-Bridging protocol in skb_network_protocol()
@ 2013-05-08 6:41 Pravin B Shelar
2013-05-08 7:42 ` PJ Waskiewicz
2013-05-08 20:15 ` David Miller
0 siblings, 2 replies; 7+ messages in thread
From: Pravin B Shelar @ 2013-05-08 6:41 UTC (permalink / raw)
To: netdev; +Cc: Pravin B Shelar, Eric Dumazet, Cong Wang, David S. Miller
Rather than having logic to calculate inner protocol in every
tunnel gso handler move it to gso code. This simplifies code.
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Cong Wang <amwang@redhat.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
---
net/core/dev.c | 11 +++++++++++
net/ipv4/gre.c | 8 +-------
net/ipv4/udp.c | 4 +---
3 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 40b1fad..fc1e289 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2213,6 +2213,17 @@ __be16 skb_network_protocol(struct sk_buff *skb)
__be16 type = skb->protocol;
int vlan_depth = ETH_HLEN;
+ /* Tunnel gso handlers can set protocol to ethernet. */
+ if (type == htons(ETH_P_TEB)) {
+ struct ethhdr *eth;
+
+ if (unlikely(!pskb_may_pull(skb, sizeof(struct ethhdr))))
+ return 0;
+
+ eth = (struct ethhdr *)skb_mac_header(skb);
+ type = eth->h_proto;
+ }
+
while (type == htons(ETH_P_8021Q) || type == htons(ETH_P_8021AD)) {
struct vlan_hdr *vh;
diff --git a/net/ipv4/gre.c b/net/ipv4/gre.c
index cc22363..b2e805a 100644
--- a/net/ipv4/gre.c
+++ b/net/ipv4/gre.c
@@ -150,13 +150,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
csum = false;
/* setup inner skb. */
- if (greh->protocol == htons(ETH_P_TEB)) {
- struct ethhdr *eth = (struct ethhdr *)skb_inner_mac_header(skb);
- skb->protocol = eth->h_proto;
- } else {
- skb->protocol = greh->protocol;
- }
-
+ skb->protocol = greh->protocol;
skb->encapsulation = 0;
if (unlikely(!pskb_may_pull(skb, ghl)))
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 0ae038a..0bf5d39 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2311,7 +2311,6 @@ static struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb,
struct sk_buff *segs = ERR_PTR(-EINVAL);
int mac_len = skb->mac_len;
int tnl_hlen = skb_inner_mac_header(skb) - skb_transport_header(skb);
- struct ethhdr *inner_eth = (struct ethhdr *)skb_inner_mac_header(skb);
__be16 protocol = skb->protocol;
netdev_features_t enc_features;
int outer_hlen;
@@ -2324,8 +2323,7 @@ static struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb,
skb_reset_mac_header(skb);
skb_set_network_header(skb, skb_inner_network_offset(skb));
skb->mac_len = skb_inner_network_offset(skb);
- inner_eth = (struct ethhdr *)skb_mac_header(skb);
- skb->protocol = inner_eth->h_proto;
+ skb->protocol = htons(ETH_P_TEB);
/* segment inner packet. */
enc_features = skb->dev->hw_enc_features & netif_skb_features(skb);
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] gso: Handle Trans-Ether-Bridging protocol in skb_network_protocol()
2013-05-08 6:41 [PATCH] gso: Handle Trans-Ether-Bridging protocol in skb_network_protocol() Pravin B Shelar
@ 2013-05-08 7:42 ` PJ Waskiewicz
2013-05-08 16:23 ` Stephen Hemminger
2013-05-08 20:15 ` David Miller
1 sibling, 1 reply; 7+ messages in thread
From: PJ Waskiewicz @ 2013-05-08 7:42 UTC (permalink / raw)
To: Pravin B Shelar; +Cc: netdev, Eric Dumazet, Cong Wang, David S. Miller
On 5/7/2013 11:41 PM, Pravin B Shelar wrote:
> Rather than having logic to calculate inner protocol in every
> tunnel gso handler move it to gso code. This simplifies code.
Moving code that isn't used on a regular basis to hotpath for most
networking to simplify code isn't always a good thing.
Have you run tests on non-tunneled streams using GSO to make sure there
isn't an adverse impact to performance due to the new, untaken branch?
-PJ
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] gso: Handle Trans-Ether-Bridging protocol in skb_network_protocol()
2013-05-08 7:42 ` PJ Waskiewicz
@ 2013-05-08 16:23 ` Stephen Hemminger
0 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2013-05-08 16:23 UTC (permalink / raw)
To: PJ Waskiewicz
Cc: Pravin B Shelar, netdev, Eric Dumazet, Cong Wang, David S. Miller
On Wed, 08 May 2013 00:42:49 -0700
PJ Waskiewicz <peter.p.waskiewicz.jr@linux.intel.com> wrote:
> On 5/7/2013 11:41 PM, Pravin B Shelar wrote:
> > Rather than having logic to calculate inner protocol in every
> > tunnel gso handler move it to gso code. This simplifies code.
>
> Moving code that isn't used on a regular basis to hotpath for most
> networking to simplify code isn't always a good thing.
>
> Have you run tests on non-tunneled streams using GSO to make sure there
> isn't an adverse impact to performance due to the new, untaken branch?
>
> -PJ
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Maybe use unlikely here?
It looks like more and more of this tunnel unwrapping needs to be handled here
(vxlan? ipip?) probably want more general switch statement and per-protocol functions.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] gso: Handle Trans-Ether-Bridging protocol in skb_network_protocol()
2013-05-08 6:41 [PATCH] gso: Handle Trans-Ether-Bridging protocol in skb_network_protocol() Pravin B Shelar
2013-05-08 7:42 ` PJ Waskiewicz
@ 2013-05-08 20:15 ` David Miller
2013-05-09 2:32 ` Pravin Shelar
1 sibling, 1 reply; 7+ messages in thread
From: David Miller @ 2013-05-08 20:15 UTC (permalink / raw)
To: pshelar; +Cc: netdev, eric.dumazet, amwang
From: Pravin B Shelar <pshelar@nicira.com>
Date: Tue, 7 May 2013 23:41:07 -0700
> Rather than having logic to calculate inner protocol in every
> tunnel gso handler move it to gso code. This simplifies code.
>
> Cc: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: Cong Wang <amwang@redhat.com>
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Applied.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] gso: Handle Trans-Ether-Bridging protocol in skb_network_protocol()
2013-05-08 20:15 ` David Miller
@ 2013-05-09 2:32 ` Pravin Shelar
2013-05-09 2:43 ` David Miller
2013-05-09 2:49 ` Eric Dumazet
0 siblings, 2 replies; 7+ messages in thread
From: Pravin Shelar @ 2013-05-09 2:32 UTC (permalink / raw)
To: David Miller; +Cc: netdev, eric.dumazet, amwang
On Wed, May 8, 2013 at 1:15 PM, David Miller <davem@davemloft.net> wrote:
> From: Pravin B Shelar <pshelar@nicira.com>
> Date: Tue, 7 May 2013 23:41:07 -0700
>
>> Rather than having logic to calculate inner protocol in every
>> tunnel gso handler move it to gso code. This simplifies code.
>>
>> Cc: Eric Dumazet <eric.dumazet@gmail.com>
>> Cc: Cong Wang <amwang@redhat.com>
>> Cc: David S. Miller <davem@davemloft.net>
>> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
>
> Applied.
Hi David,
Can you queue this patch for -stable ?
Thanks,
Pravin.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] gso: Handle Trans-Ether-Bridging protocol in skb_network_protocol()
2013-05-09 2:32 ` Pravin Shelar
@ 2013-05-09 2:43 ` David Miller
2013-05-09 2:49 ` Eric Dumazet
1 sibling, 0 replies; 7+ messages in thread
From: David Miller @ 2013-05-09 2:43 UTC (permalink / raw)
To: pshelar; +Cc: netdev, eric.dumazet, amwang
From: Pravin Shelar <pshelar@nicira.com>
Date: Wed, 8 May 2013 19:32:40 -0700
> On Wed, May 8, 2013 at 1:15 PM, David Miller <davem@davemloft.net> wrote:
>> From: Pravin B Shelar <pshelar@nicira.com>
>> Date: Tue, 7 May 2013 23:41:07 -0700
>>
>>> Rather than having logic to calculate inner protocol in every
>>> tunnel gso handler move it to gso code. This simplifies code.
>>>
>>> Cc: Eric Dumazet <eric.dumazet@gmail.com>
>>> Cc: Cong Wang <amwang@redhat.com>
>>> Cc: David S. Miller <davem@davemloft.net>
>>> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
>>
>> Applied.
>
> Hi David,
> Can you queue this patch for -stable ?
Done.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] gso: Handle Trans-Ether-Bridging protocol in skb_network_protocol()
2013-05-09 2:32 ` Pravin Shelar
2013-05-09 2:43 ` David Miller
@ 2013-05-09 2:49 ` Eric Dumazet
1 sibling, 0 replies; 7+ messages in thread
From: Eric Dumazet @ 2013-05-09 2:49 UTC (permalink / raw)
To: Pravin Shelar; +Cc: David Miller, netdev, amwang
On Wed, 2013-05-08 at 19:32 -0700, Pravin Shelar wrote:
> Hi David,
> Can you queue this patch for -stable ?
BTW you should always include in the changelog :
Bug added in commit 121212121212
("foo: some fancy patch")
This eases David and all stable/distro guys work.
Thanks
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-05-09 2:49 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-08 6:41 [PATCH] gso: Handle Trans-Ether-Bridging protocol in skb_network_protocol() Pravin B Shelar
2013-05-08 7:42 ` PJ Waskiewicz
2013-05-08 16:23 ` Stephen Hemminger
2013-05-08 20:15 ` David Miller
2013-05-09 2:32 ` Pravin Shelar
2013-05-09 2:43 ` David Miller
2013-05-09 2:49 ` Eric Dumazet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox