2012-11-12 02:56:40

by Joseph Gasparakis

[permalink] [raw]
Subject: [PATCH v2 3/3] ipgre: capture inner headers during encapsulation

Populating the inner header pointers of skb for ipgre
This patch has been compile-tested only.

v2 Makes sure that checksumming does not take place if the offload flag is set in the skb's netdev features

Signed-off-by: Joseph Gasparakis <[email protected]>
Signed-off-by: Peter P Waskiewicz Jr <[email protected]>
---
net/ipv4/ip_gre.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 7240f8e..e35ed52 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -766,8 +766,10 @@ 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 &&
+ if (!(skb->dev->features & NETIF_F_HW_CSUM_ENC_BIT) &&
+ skb->ip_summed == CHECKSUM_PARTIAL &&
skb_checksum_help(skb))
goto tx_error;

@@ -902,6 +904,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)||
--
1.7.11.7


2012-11-12 03:06:57

by David Miller

[permalink] [raw]
Subject: Re: [PATCH v2 3/3] ipgre: capture inner headers during encapsulation


Please post the entire series again when making updates to any of
the patches, thank you.

2012-11-12 03:09:51

by Joseph Gasparakis

[permalink] [raw]
Subject: Re: [PATCH v2 3/3] ipgre: capture inner headers during encapsulation



On Sun, 11 Nov 2012, David Miller wrote:

>
> Please post the entire series again when making updates to any of
> the patches, thank you.
>
Will do. Thanks Dave.

2012-11-14 12:32:52

by Dmitry Kravkov

[permalink] [raw]
Subject: RE: [PATCH v2 3/3] ipgre: capture inner headers during encapsulation

> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> On Behalf Of Joseph Gasparakis
> Sent: Monday, November 12, 2012 5:04 AM
> To: [email protected]; [email protected]; [email protected]
> Cc: Joseph Gasparakis; [email protected]; [email protected];
> Peter P Waskiewicz Jr
> Subject: [PATCH v2 3/3] ipgre: capture inner headers during encapsulation
>
> Populating the inner header pointers of skb for ipgre
> This patch has been compile-tested only.
>
> v2 Makes sure that checksumming does not take place if the offload flag is set in
> the skb's netdev features
>
> Signed-off-by: Joseph Gasparakis <[email protected]>
> Signed-off-by: Peter P Waskiewicz Jr <[email protected]>
> ---
> net/ipv4/ip_gre.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
> index 7240f8e..e35ed52 100644
> --- a/net/ipv4/ip_gre.c
> +++ b/net/ipv4/ip_gre.c
> @@ -766,8 +766,10 @@ 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 &&
> + if (!(skb->dev->features & NETIF_F_HW_CSUM_ENC_BIT) &&

You should test for NETIF_F_HW_CSUM_ENC and not for NETIF_F_HW_CSUM_ENC_BIT