net: Changes to GRO for encapsulation
Subsystems (4)
cover net: Changes to GRO for encapsulation
This patch set has some fixes for encapsulation and GRO.
Tom Herbert (5):
net: Fix GRE RX to use skb_transport_header for GRE header offset
ipip: Add gro callbacks to ipip offload
sit: Add gro callbacks to sit offload
udp: Add try convert checksum is case of skb_steal_sock
net: Export inet_offloads and inet6_offloads
net/ipv4/af_inet.c | 2 ++ net/ipv4/gre_demux.c | 5 ++--- net/ipv4/protocol.c | 1 + net/ipv4/udp.c | 4 ++++ net/ipv6/ip6_offload.c | 2 ++ net/ipv6/protocol.c | 1 + 6 files changed, 12 insertions(+), 3 deletions(-)
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 1/5 net: Fix GRE RX to use skb_transport_header for GRE header offset
GRE assumes that the GRE header is at skb_network_header + ip_hrdlen(skb). It is more general to use skb_transport_header and this allows the possbility of inserting additional header between IP and GRE (which is what we will done in Generic UDP Encapsulation for GRE).
--- net/ipv4/gre_demux.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
net/ipv4/gre_demux.c +2 -3
@@ -98,7 +98,6 @@ EXPORT_SYMBOL_GPL(gre_build_header);static int parse_gre_header (struct sk_buff *skb,struct tnl_ptk_info *tpi,bool *csum_err) { -unsigned int ip_hlen =ip_hdrlen (skb);const struct gre_base_hdr *greh;__be32 *options;int hdr_len;
@@ -106,7 +105,7 @@ static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,if (unlikely (!pskb_may_pull (skb,sizeof (struct gre_base_hdr ))))return -EINVAL ; - greh = (struct gre_base_hdr *)(skb_network_header (skb) + ip_hlen); + greh = (struct gre_base_hdr *)skb_transport_header (skb);if (unlikely (greh->flags & (GRE_VERSION |GRE_ROUTING )))return -EINVAL ;
@@ -116,7 +115,7 @@ static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,if (!pskb_may_pull (skb, hdr_len))return -EINVAL ; - greh = (struct gre_base_hdr *)(skb_network_header (skb) + ip_hlen); + greh = (struct gre_base_hdr *)skb_transport_header (skb); tpi->proto = greh->protocol; options = (__be32 *)(greh +1 );
Signature · 1 line
2.1.0.rc2.206.gedb03e5
Re: [PATCH net-next 1/5] net: Fix GRE RX to use skb_transport_header for GRE header offset
Quoted 10 lines · Tom Herbert
GRE assumes that the GRE header is at
skb_network_header+ip_hrdlen(skb). It is more general to useskb_transport_headerand this allows the possbility of inserting additional header between IP and GRE (which is what we will done in Generic UDP Encapsulation for GRE).Signed-off-by Tom Herbert <[email protected]>--- net/ipv4/gre_demux.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Note this has nothing to do with GRO ;)
PATCH 2/5 ipip: Add gro callbacks to ipip offload
In reply to Tom HerbertAdd inet_gro_receive and inet_gro_complete to ipip_offload to support GRO.
--- net/ipv4/af_inet.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv4/af_inet.c +2 -0
@@ -1670,6 +1670,8 @@ static const struct net_offload ipip_offload = { .callbacks = { .gso_send_check = inet_gso_send_check, .gso_segment = inet_gso_segment, + .gro_receive = inet_gro_receive, + .gro_complete = inet_gro_complete, }, };
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 3/5 sit: Add gro callbacks to sit offload
In reply to Tom HerbertAdd ip6_gro_receive and inet_gro_complete to ip6_offload to support GRO.
--- net/ipv6/ip6_offload.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv6/ip6_offload.c +2 -0
@@ -314,6 +314,8 @@ static const struct net_offload sit_offload = { .callbacks = { .gso_send_check = ipv6_gso_send_check, .gso_segment = ipv6_gso_segment, + .gro_receive = ipv6_gro_receive, + .gro_complete = ipv6_gro_complete, }, };
Signature · 1 line
2.1.0.rc2.206.gedb03e5
Re: [PATCH net-next 3/5] sit: Add gro callbacks to sit offload
Quoted 13 lines · Tom Herbert
Add
ip6_gro_receiveandinet_gro_completetoip6_offloadto support GRO.Signed-off-by Tom Herbert <[email protected]>--- net/ipv6/ip6_offload.c | 2 ++ 1 file changed, 2 insertions(+)net/ipv6/ip6_offload.c +0
-0
net/ipv6/ip6_offload.c static const struct net_offload sit_offload = { · line 321
Quoted 8 lines
net/ipv6/ip6_offload.c +2
-0@@ -314,6 +314,8 @@ static const struct net_offload sit_offload = { .callbacks = { .gso_send_check = ipv6_gso_send_check, .gso_segment = ipv6_gso_segment, + .gro_receive = ipv6_gro_receive, + .gro_complete = ipv6_gro_complete, }, };
changelog has typos : It should be :
Add ip6_gro_receive and ip6_gro_complete to sit_offload to support GRO.
PATCH 4/5 udp: Add try convert checksum is case of skb_steal_sock
In reply to Tom HerbertIf an skb already has an associated socket that we can steal in UDP receive then attempt checksum conversion before calling udp_queue_rcv_skb.
--- net/ipv4/udp.c | 4 ++++ 1 file changed, 4 insertions(+)
net/ipv4/udp.c +4 -0
@@ -1769,6 +1769,10 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,if (unlikely (sk->sk_rx_dst != dst))udp_sk_rx_dst_set (sk, dst); +if (udp_sk (sk)->convert_csum && uh->check && !IS_UDPLITE (sk)) +skb_checksum_try_convert (skb,IPPROTO_UDP , uh->check, + inet_compute_pseudo); + ret =udp_queue_rcv_skb (sk, skb);sock_put (sk);/* a return value > 0 means to resubmit the input, but
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 5/5 net: Export inet_offloads and inet6_offloads
In reply to Tom HerbertWant to be able to call this in foo-over-udp offloads, etc.
--- net/ipv4/protocol.c | 1 + net/ipv6/protocol.c | 1 + 2 files changed, 2 insertions(+)
net/ipv4/protocol.c +1 -0
@@ -30,6 +30,7 @@const struct net_protocol __rcu *inet_protos[MAX_INET_PROTOS ]__read_mostly ;const struct net_offload __rcu *inet_offloads[MAX_INET_PROTOS ]__read_mostly ; +EXPORT_SYMBOL (inet_offloads);int inet_add_protocol (const struct net_protocol *prot,unsigned char protocol) {
net/ipv6/protocol.c +1 -0
@@ -51,6 +51,7 @@ EXPORT_SYMBOL(inet6_del_protocol);#endif const struct net_offload __rcu *inet6_offloads[MAX_INET_PROTOS ]__read_mostly ; +EXPORT_SYMBOL (inet6_offloads);int inet6_add_offload (const struct net_offload *prot,unsigned char protocol) {
Signature · 1 line
2.1.0.rc2.206.gedb03e5
Re: [PATCH net-next 5/5] net: Export inet_offloads and inet6_offloads
Quoted 7 lines · Tom Herbert
Want to be able to call this in foo-over-udp offloads, etc.
Signed-off-by Tom Herbert <[email protected]>--- net/ipv4/protocol.c | 1 + net/ipv6/protocol.c | 1 + 2 files changed, 2 insertions(+)
This should not be last patch of this serie, but added in a later serie when really needed.
David Miller
maintainerFrom: Tom Herbert <[email protected]>
Date: Sun, 7 Sep 2014 22:26:24 -0700
Quoted 8 lines
This patch set has some fixes for encapsulation and GRO.
Tom Herbert (5):
net: Fix GRE RX to useskb_transport_headerfor GRE header offset
ipip: Add gro callbacks to ipip offload
sit: Add gro callbacks to sit offload
udp: Add try convert checksum is case ofskb_steal_sock
net: Exportinet_offloadsandinet6_offloads
Please address Eric's feedback and respin this series, thanks!