Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1392504 > unrolled thread
| Started by | Jarno Rajahalme <jarno@ovn.org> |
|---|---|
| First post | 2016-05-02 22:50 +0200 |
| Last post | 2016-05-02 22:50 +0200 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH net v2 1/2] udp_tunnel: Remove redundant udp_tunnel_gro_complete(). Jarno Rajahalme <jarno@ovn.org> - 2016-05-02 22:50 +0200
[PATCH net v2 2/2] udp_offload: Set encapsulation before inner completes. Jarno Rajahalme <jarno@ovn.org> - 2016-05-02 22:50 +0200
| From | Jarno Rajahalme <jarno@ovn.org> |
|---|---|
| Date | 2016-05-02 22:50 +0200 |
| Subject | [PATCH net v2 1/2] udp_tunnel: Remove redundant udp_tunnel_gro_complete(). |
| Message-ID | <rusX0-20t-3@gated-at.bofh.it> |
The setting of the UDP tunnel GSO type is already performed by
udp[46]_gro_complete().
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
---
drivers/net/geneve.c | 2 --
drivers/net/vxlan.c | 2 --
include/net/udp_tunnel.h | 9 ---------
net/ipv4/fou.c | 2 --
4 files changed, 15 deletions(-)
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index bc16889..98f1224 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -504,8 +504,6 @@ static int geneve_gro_complete(struct sk_buff *skb, int nhoff,
int gh_len;
int err = -ENOSYS;
- udp_tunnel_gro_complete(skb, nhoff);
-
gh = (struct genevehdr *)(skb->data + nhoff);
gh_len = geneve_hlen(gh);
type = gh->proto_type;
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 1c0fa36..dd2d032 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -616,8 +616,6 @@ out:
static int vxlan_gro_complete(struct sk_buff *skb, int nhoff,
struct udp_offload *uoff)
{
- udp_tunnel_gro_complete(skb, nhoff);
-
return eth_gro_complete(skb, nhoff + sizeof(struct vxlanhdr));
}
diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h
index b831140..a114024 100644
--- a/include/net/udp_tunnel.h
+++ b/include/net/udp_tunnel.h
@@ -106,15 +106,6 @@ static inline struct sk_buff *udp_tunnel_handle_offloads(struct sk_buff *skb,
return iptunnel_handle_offloads(skb, type);
}
-static inline void udp_tunnel_gro_complete(struct sk_buff *skb, int nhoff)
-{
- struct udphdr *uh;
-
- uh = (struct udphdr *)(skb->data + nhoff - sizeof(struct udphdr));
- skb_shinfo(skb)->gso_type |= uh->check ?
- SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL;
-}
-
static inline void udp_tunnel_encap_enable(struct socket *sock)
{
#if IS_ENABLED(CONFIG_IPV6)
diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c
index a39068b..305d9ac 100644
--- a/net/ipv4/fou.c
+++ b/net/ipv4/fou.c
@@ -228,8 +228,6 @@ static int fou_gro_complete(struct sk_buff *skb, int nhoff,
int err = -ENOSYS;
const struct net_offload **offloads;
- udp_tunnel_gro_complete(skb, nhoff);
-
rcu_read_lock();
offloads = NAPI_GRO_CB(skb)->is_ipv6 ? inet6_offloads : inet_offloads;
ops = rcu_dereference(offloads[proto]);
--
2.7.4
[toc] | [next] | [standalone]
| From | Jarno Rajahalme <jarno@ovn.org> |
|---|---|
| Date | 2016-05-02 22:50 +0200 |
| Subject | [PATCH net v2 2/2] udp_offload: Set encapsulation before inner completes. |
| Message-ID | <rusX0-20t-7@gated-at.bofh.it> |
| In reply to | #1392504 |
UDP tunnel segmentation code relies on the inner offsets being set for an UDP tunnel GSO packet, but the inner *_complete() functions will set the inner offsets only if 'encapsulation' is set before calling them. Currently, udp_gro_complete() sets 'encapsulation' only after the inner *_complete() functions are done. This causes the inner offsets having invalid values after udp_gro_complete() returns, which in turn will make it impossible to properly segment the packet in case it needs to be forwarded, which would be visible to the user either as invalid packets being sent or as packet loss. This patch fixes this by setting skb's 'encapsulation' before calling into the inner complete functions, and by removing the setting of the inner_mac_header in udp_gro_complete(). The inner complete now functions set the inner_mac_header, so it need not be done here. Furthermore, it was wrongly set to the beginning of the UDP tunnel header rather than the inner MAC header. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> --- net/ipv4/udp_offload.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c index 0ed2daf..e330c0e 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c @@ -399,6 +399,11 @@ int udp_gro_complete(struct sk_buff *skb, int nhoff) uh->len = newlen; + /* Set encapsulation before calling into inner gro_complete() functions + * to make them set up the inner offsets. + */ + skb->encapsulation = 1; + rcu_read_lock(); uo_priv = rcu_dereference(udp_offload_base); @@ -421,9 +426,6 @@ int udp_gro_complete(struct sk_buff *skb, int nhoff) if (skb->remcsum_offload) skb_shinfo(skb)->gso_type |= SKB_GSO_TUNNEL_REMCSUM; - skb->encapsulation = 1; - skb_set_inner_mac_header(skb, nhoff + sizeof(struct udphdr)); - return err; } -- 2.7.4
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web