From: ilant@mellanox.com
To: Steffen Klassert <steffen.klassert@secunet.com>, netdev@vger.kernel.org
Cc: Ilan Tayari <ilant@mellanox.com>
Subject: [PATCH net-next 7/7] net: Allow IPsec GSO for local sockets
Date: Tue, 1 Aug 2017 12:49:10 +0300 [thread overview]
Message-ID: <20170801094910.14895-8-ilant@mellanox.com> (raw)
In-Reply-To: <20170801094910.14895-1-ilant@mellanox.com>
From: Steffen Klassert <steffen.klassert@secunet.com>
This patch allows local sockets to make use of XFRM GSO code path.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Ilan Tayari <ilant@mellanox.com>
---
include/net/xfrm.h | 19 +++++++++++++++++++
net/core/sock.c | 2 +-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 5a360100136c..18d7de34a5c3 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1858,6 +1858,20 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x,
struct xfrm_user_offload *xuo);
bool xfrm_dev_offload_ok(struct sk_buff *skb, struct xfrm_state *x);
+static inline bool xfrm_dst_offload_ok(struct dst_entry *dst)
+{
+ struct xfrm_state *x = dst->xfrm;
+
+ if (!x || !x->type_offload)
+ return false;
+
+ if (x->xso.offload_handle && (x->xso.dev == dst->path->dev) &&
+ !dst->child->xfrm)
+ return true;
+
+ return false;
+}
+
static inline void xfrm_dev_state_delete(struct xfrm_state *x)
{
struct xfrm_state_offload *xso = &x->xso;
@@ -1900,6 +1914,11 @@ static inline bool xfrm_dev_offload_ok(struct sk_buff *skb, struct xfrm_state *x
{
return false;
}
+
+static inline bool xfrm_dst_offload_ok(struct dst_entry *dst)
+{
+ return false;
+}
#endif
static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m)
diff --git a/net/core/sock.c b/net/core/sock.c
index ac2a404c73eb..e4b45d027d8b 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1757,7 +1757,7 @@ void sk_setup_caps(struct sock *sk, struct dst_entry *dst)
sk->sk_route_caps |= NETIF_F_GSO_SOFTWARE;
sk->sk_route_caps &= ~sk->sk_route_nocaps;
if (sk_can_gso(sk)) {
- if (dst->header_len) {
+ if (dst->header_len && !xfrm_dst_offload_ok(dst)) {
sk->sk_route_caps &= ~NETIF_F_GSO_MASK;
} else {
sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM;
--
2.11.0
next prev parent reply other threads:[~2017-08-01 9:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-01 9:49 [PATCH net-next 0/7] IPSec offload improvements ilant
2017-08-01 9:49 ` [PATCH net-next 1/7] esp4: Support RX checksum with crypto offload ilant
2017-08-01 9:49 ` [PATCH net-next 2/7] esp6: " ilant
2017-08-01 9:49 ` [PATCH net-next 3/7] xfrm6: Fix CHECKSUM_COMPLETE after IPv6 header push ilant
2017-08-01 9:49 ` [PATCH net-next 4/7] esp6: Fix RX checksum after header pull ilant
2017-08-01 9:49 ` [PATCH net-next 5/7] xfrm: Auto-load xfrm offload modules ilant
2017-08-01 9:49 ` [PATCH net-next 6/7] xfrm: Clear RX SKB secpath xfrm_offload ilant
2017-08-01 9:49 ` ilant [this message]
2017-08-03 11:02 ` [PATCH net-next 0/7] IPSec offload improvements Steffen Klassert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170801094910.14895-8-ilant@mellanox.com \
--to=ilant@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=steffen.klassert@secunet.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox