From: Florian Westphal <fw@strlen.de>
To: <netdev@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH net-next 05/13] net: move secpath_exist helper to sk_buff.h
Date: Mon, 10 Dec 2018 15:49:58 +0100 [thread overview]
Message-ID: <20181210145006.19098-6-fw@strlen.de> (raw)
In-Reply-To: <20181210145006.19098-1-fw@strlen.de>
Future patch will remove skb->sp pointer.
To reduce noise in those patches, move existing helper to
sk_buff and use it in more places to ease skb->sp replacement later.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
include/linux/skbuff.h | 13 ++++++++++---
include/net/xfrm.h | 9 ---------
net/netfilter/nft_meta.c | 2 +-
3 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index d2d32c9fa715..da5f8226b55a 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -4074,12 +4074,19 @@ static inline void skb_init_secmark(struct sk_buff *skb)
{ }
#endif
+static inline int secpath_exists(const struct sk_buff *skb)
+{
+#ifdef CONFIG_XFRM
+ return skb->sp != NULL;
+#else
+ return 0;
+#endif
+}
+
static inline bool skb_irq_freeable(const struct sk_buff *skb)
{
return !skb->destructor &&
-#if IS_ENABLED(CONFIG_XFRM)
- !skb->sp &&
-#endif
+ !secpath_exists(skb) &&
!skb_nfct(skb) &&
!skb->_skb_refdst &&
!skb_has_frag_list(skb);
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 71b88b539f37..4e1d074dc69e 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1101,15 +1101,6 @@ struct sec_path {
struct xfrm_offload ovec[XFRM_MAX_OFFLOAD_DEPTH];
};
-static inline int secpath_exists(struct sk_buff *skb)
-{
-#ifdef CONFIG_XFRM
- return skb->sp != NULL;
-#else
- return 0;
-#endif
-}
-
static inline struct sec_path *
secpath_get(struct sec_path *sp)
{
diff --git a/net/netfilter/nft_meta.c b/net/netfilter/nft_meta.c
index 6180626c3f80..6df486c5ebd3 100644
--- a/net/netfilter/nft_meta.c
+++ b/net/netfilter/nft_meta.c
@@ -229,7 +229,7 @@ void nft_meta_get_eval(const struct nft_expr *expr,
}
#ifdef CONFIG_XFRM
case NFT_META_SECPATH:
- nft_reg_store8(dest, !!skb->sp);
+ nft_reg_store8(dest, secpath_exists(skb));
break;
#endif
#ifdef CONFIG_NF_TABLES_BRIDGE
--
2.19.2
next prev parent reply other threads:[~2018-12-10 14:57 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-10 14:49 [PATCH net-next 0/13] sk_buff: add extension infrastructure Florian Westphal
2018-12-10 14:49 ` [PATCH net-next 01/13] netfilter: avoid using skb->nf_bridge directly Florian Westphal
2018-12-10 14:49 ` [PATCH net-next 02/13] sk_buff: add skb extension infrastructure Florian Westphal
[not found] ` <CAPUCuiADYwjY4kpq76-w9BKL3uiRvNjnmzKG29mCrb=b8YeesA@mail.gmail.com>
2018-12-12 0:07 ` Mat Martineau
2018-12-12 0:11 ` Florian Westphal
2018-12-12 11:59 ` Florian Westphal
2018-12-12 16:59 ` Mat Martineau
2018-12-12 14:44 ` Willem de Bruijn
2018-12-12 15:40 ` Florian Westphal
2018-12-12 15:45 ` Willem de Bruijn
2018-12-12 17:23 ` Eric Dumazet
2018-12-12 18:44 ` Florian Westphal
2018-12-12 20:17 ` Eric Dumazet
2018-12-12 20:52 ` Florian Westphal
2018-12-13 5:40 ` Eric Dumazet
2018-12-13 9:27 ` Florian Westphal
2018-12-13 10:18 ` Eric Dumazet
2018-12-13 10:39 ` Florian Westphal
2018-12-13 10:58 ` Eric Dumazet
2018-12-13 11:03 ` Florian Westphal
2018-12-13 11:16 ` Eric Dumazet
2018-12-13 11:44 ` Florian Westphal
2018-12-13 17:00 ` Christoph Paasch
2018-12-12 18:16 ` Stephen Suryaputra
2018-12-12 18:38 ` Florian Westphal
2018-12-13 0:38 ` David Miller
2018-12-10 14:49 ` [PATCH net-next 03/13] net: convert bridge_nf to use " Florian Westphal
2018-12-10 14:49 ` [PATCH net-next 04/13] xfrm: change secpath_set to return secpath struct, not error value Florian Westphal
2018-12-10 14:49 ` Florian Westphal [this message]
2018-12-10 14:49 ` [PATCH net-next 06/13] net: use skb_sec_path helper in more places Florian Westphal
2018-12-10 14:50 ` [PATCH net-next 07/13] drivers: net: intel: use secpath helpers " Florian Westphal
2018-12-10 14:50 ` [PATCH net-next 08/13] drivers: net: ethernet: mellanox: use skb_sec_path helper Florian Westphal
2018-12-10 14:50 ` [PATCH net-next 09/13] drivers: net: netdevsim: " Florian Westphal
2018-12-10 14:50 ` [PATCH net-next 10/13] xfrm: use secpath_exist where applicable Florian Westphal
2018-12-10 14:50 ` [PATCH net-next 11/13] drivers: chelsio: use skb_sec_path helper Florian Westphal
2018-12-10 14:50 ` [PATCH net-next 12/13] xfrm: prefer secpath_set over secpath_dup Florian Westphal
2018-12-10 14:50 ` [PATCH net-next 13/13] net: switch secpath to use skb extension infrastructure Florian Westphal
2018-12-11 8:06 ` Steffen Klassert
2018-12-11 10:18 ` Florian Westphal
2018-12-11 10:20 ` Steffen Klassert
2018-12-12 11:52 ` Florian Westphal
2018-12-13 4:08 ` [PATCH net-next 0/13] sk_buff: add " Shannon Nelson
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=20181210145006.19098-6-fw@strlen.de \
--to=fw@strlen.de \
--cc=netdev@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.