* [PATCH v2 3/3] ipgre: capture inner headers during encapsulation
@ 2012-11-12 3:04 Joseph Gasparakis
2012-11-12 3:06 ` David Miller
2012-11-14 12:32 ` Dmitry Kravkov
0 siblings, 2 replies; 6+ messages in thread
From: Joseph Gasparakis @ 2012-11-12 3:04 UTC (permalink / raw)
To: davem, shemminger, chrisw
Cc: Joseph Gasparakis, netdev, linux-kernel, Peter P Waskiewicz Jr
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 <joseph.gasparakis@intel.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
---
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 3/3] ipgre: capture inner headers during encapsulation
2012-11-12 3:04 [PATCH v2 3/3] ipgre: capture inner headers during encapsulation Joseph Gasparakis
@ 2012-11-12 3:06 ` David Miller
2012-11-12 3:17 ` Joseph Gasparakis
2012-11-14 12:32 ` Dmitry Kravkov
1 sibling, 1 reply; 6+ messages in thread
From: David Miller @ 2012-11-12 3:06 UTC (permalink / raw)
To: joseph.gasparakis
Cc: shemminger, chrisw, netdev, linux-kernel, peter.p.waskiewicz.jr
Please post the entire series again when making updates to any of
the patches, thank you.
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH v2 3/3] ipgre: capture inner headers during encapsulation
2012-11-12 3:04 [PATCH v2 3/3] ipgre: capture inner headers during encapsulation Joseph Gasparakis
2012-11-12 3:06 ` David Miller
@ 2012-11-14 12:32 ` Dmitry Kravkov
1 sibling, 0 replies; 6+ messages in thread
From: Dmitry Kravkov @ 2012-11-14 12:32 UTC (permalink / raw)
To: Joseph Gasparakis, davem, shemminger, chrisw
Cc: netdev, linux-kernel, Peter P Waskiewicz Jr
> -----Original Message-----
> From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org]
> On Behalf Of Joseph Gasparakis
> Sent: Monday, November 12, 2012 5:04 AM
> To: davem@davemloft.net; shemminger@vyatta.com; chrisw@sous-sol.org
> Cc: Joseph Gasparakis; netdev@vger.kernel.org; linux-kernel@vger.kernel.org;
> 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 <joseph.gasparakis@intel.com>
> Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
> ---
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 net-next 0/3 ] tunneling: Add support for hardware-offloaded encapsulation
@ 2012-11-12 8:36 Joseph Gasparakis
2012-11-12 8:36 ` [PATCH v2 3/3] ipgre: capture inner headers during encapsulation Joseph Gasparakis
0 siblings, 1 reply; 6+ messages in thread
From: Joseph Gasparakis @ 2012-11-12 8:36 UTC (permalink / raw)
To: davem, shemminger, chrisw; +Cc: Joseph Gasparakis, netdev, linux-kernel, dmitry
The series contains updates to add in the NIC Rx and Tx checksumming support
for encapsulated packets.
The sk_buff needs to somehow have information of the inner packet, and adding
three fields for the inner mac, network and transport headers was the prefered
approach.
Not adding these fields would mean that the drivers would need to parse the
sk_buff data in hot-path, having a negative impact in the performance.
Adding in sk_buff a pointer to the skbuff of the inner packet made sense, but
would be a complicated change as assumptions needed to be made with regards to
helper functions such as skb_clone() skb_copy(). Also code for the existing
encapsulation protocols (such as VXLAN and IP GRE) had to be reworked, so the
decision was to have the simple approach of adding these three fields.
v2 Makes sure that checksumming for IP GRE does not take place if the offload flag is set in the skb's netdev features
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 3/3] ipgre: capture inner headers during encapsulation
2012-11-12 8:36 [PATCH v2 net-next 0/3 ] tunneling: Add support for hardware-offloaded encapsulation Joseph Gasparakis
@ 2012-11-12 8:36 ` Joseph Gasparakis
2012-11-12 11:20 ` Dmitry Kravkov
0 siblings, 1 reply; 6+ messages in thread
From: Joseph Gasparakis @ 2012-11-12 8:36 UTC (permalink / raw)
To: davem, shemminger, chrisw
Cc: Joseph Gasparakis, netdev, linux-kernel, dmitry, Peter P Waskiewicz Jr
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 | 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 3/3] ipgre: capture inner headers during encapsulation
2012-11-12 8:36 ` [PATCH v2 3/3] ipgre: capture inner headers during encapsulation Joseph Gasparakis
@ 2012-11-12 11:20 ` Dmitry Kravkov
0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Kravkov @ 2012-11-12 11:20 UTC (permalink / raw)
To: Joseph Gasparakis
Cc: davem, shemminger, chrisw, netdev, linux-kernel, Peter P Waskiewicz Jr
My last comment was rejected by the lists due to html tag.
Resending it in plain text. Sorry for the spam.
On Mon, 2012-11-12 at 00:36 -0800, Joseph Gasparakis wrote:
> 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 | 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;
Gre device currently has constant features set, which does not include
CSUM_ENC bit. Do you plan to propagate it from underlying physical
device?
Thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-11-14 12:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-12 3:04 [PATCH v2 3/3] ipgre: capture inner headers during encapsulation Joseph Gasparakis
2012-11-12 3:06 ` David Miller
2012-11-12 3:17 ` Joseph Gasparakis
2012-11-14 12:32 ` Dmitry Kravkov
2012-11-12 8:36 [PATCH v2 net-next 0/3 ] tunneling: Add support for hardware-offloaded encapsulation Joseph Gasparakis
2012-11-12 8:36 ` [PATCH v2 3/3] ipgre: capture inner headers during encapsulation Joseph Gasparakis
2012-11-12 11:20 ` Dmitry Kravkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®