Patchwork [3/3] ipgre: capture inner headers during encapsulation

login
register
mail settings
Submitter Joseph Gasparakis
Date Nov. 9, 2012, 2:18 a.m.
Message ID <1352427483-4380-4-git-send-email-joseph.gasparakis@intel.com>
Download mbox | patch
Permalink /patch/197912/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Joseph Gasparakis - Nov. 9, 2012, 2:18 a.m.
Populating the inner header pointers of skb for ipgre
This patch has been compile-tested only.

Signed-off-by: Joseph Gasparakis <joseph.gasparakis@intel.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
---
 net/ipv4/ip_gre.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Dmitry Kravkov - Nov. 11, 2012, 3:18 p.m.
On Thu, 2012-11-08 at 18:18 -0800, Joseph Gasparakis wrote:
>  
>  	if (skb->ip_summed == CHECKSUM_PARTIAL &&
>  	    skb_checksum_help(skb))
> @@ -902,6 +903,17 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
>  			tunnel->err_count = 0;
>  	}
>  
> +	offset = skb->data - skb->head;
> +
> +	skb_reset_inner_mac_header(skb);
> +
> +	if (skb->network_header)
> +		skb_set_inner_network_header(skb, skb->network_header - offset);
> +
> +	if (skb->transport_header)
> +		skb_set_inner_transport_header(skb, skb->transport_header -
> +					       offset);
> +
>  	max_headroom = LL_RESERVED_SPACE(tdev) + gre_hlen + rt->dst.header_len;
>  
>  	if (skb_headroom(skb) < max_headroom || skb_shared(skb)||

How it will be useful if skb_checksum_help(skb) will calculate csum? And
leaves nothing to offload 



--
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
Joseph Gasparakis - Nov. 12, 2012, 1:47 a.m.
On Sun, 11 Nov 2012, Dmitry Kravkov wrote:

> On Thu, 2012-11-08 at 18:18 -0800, Joseph Gasparakis wrote:
> >  
> >  	if (skb->ip_summed == CHECKSUM_PARTIAL &&
> >  	    skb_checksum_help(skb))
> > @@ -902,6 +903,17 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
> >  			tunnel->err_count = 0;
> >  	}
> >  
> > +	offset = skb->data - skb->head;
> > +
> > +	skb_reset_inner_mac_header(skb);
> > +
> > +	if (skb->network_header)
> > +		skb_set_inner_network_header(skb, skb->network_header - offset);
> > +
> > +	if (skb->transport_header)
> > +		skb_set_inner_transport_header(skb, skb->transport_header -
> > +					       offset);
> > +
> >  	max_headroom = LL_RESERVED_SPACE(tdev) + gre_hlen + rt->dst.header_len;
> >  
> >  	if (skb_headroom(skb) < max_headroom || skb_shared(skb)||
> 
> How it will be useful if skb_checksum_help(skb) will calculate csum? And
> leaves nothing to offload 
>
Thanks for catching this Dmitry. Will fix it in v2 
--
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

Patch

diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 7240f8e..ec3ebb1 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -766,6 +766,7 @@  static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
 	int    gre_hlen;
 	__be32 dst;
 	int    mtu;
+	unsigned int offset;
 
 	if (skb->ip_summed == CHECKSUM_PARTIAL &&
 	    skb_checksum_help(skb))
@@ -902,6 +903,17 @@  static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
 			tunnel->err_count = 0;
 	}
 
+	offset = skb->data - skb->head;
+
+	skb_reset_inner_mac_header(skb);
+
+	if (skb->network_header)
+		skb_set_inner_network_header(skb, skb->network_header - offset);
+
+	if (skb->transport_header)
+		skb_set_inner_transport_header(skb, skb->transport_header -
+					       offset);
+
 	max_headroom = LL_RESERVED_SPACE(tdev) + gre_hlen + rt->dst.header_len;
 
 	if (skb_headroom(skb) < max_headroom || skb_shared(skb)||