From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next 2/5] net: skbuff: hide csum_not_inet when CONFIG_IP_SCTP not set
Date: Fri, 14 Apr 2023 09:01:02 -0700 [thread overview]
Message-ID: <20230414160105.172125-3-kuba@kernel.org> (raw)
In-Reply-To: <20230414160105.172125-1-kuba@kernel.org>
SCTP is not universally deployed, allow hiding its bit
from the skb.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
include/linux/skbuff.h | 14 ++++++++++++++
net/core/dev.c | 3 +--
net/sched/act_csum.c | 3 +--
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 7160101edc8a..45c3044e8123 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -983,7 +983,9 @@ struct sk_buff {
__u8 decrypted:1;
#endif
__u8 slow_gro:1;
+#if IS_ENABLED(CONFIG_IP_SCTP)
__u8 csum_not_inet:1;
+#endif
#ifdef CONFIG_NET_SCHED
__u16 tc_index; /* traffic control index */
@@ -5054,7 +5056,19 @@ static inline void skb_reset_redirect(struct sk_buff *skb)
static inline bool skb_csum_is_sctp(struct sk_buff *skb)
{
+#if IS_ENABLED(CONFIG_IP_SCTP)
return skb->csum_not_inet;
+#else
+ return 0;
+#endif
+}
+
+static inline void skb_reset_csum_not_inet(struct sk_buff *skb)
+{
+ skb->ip_summed = CHECKSUM_NONE;
+#if IS_ENABLED(CONFIG_IP_SCTP)
+ skb->csum_not_inet = 0;
+#endif
}
static inline void skb_set_kcov_handle(struct sk_buff *skb,
diff --git a/net/core/dev.c b/net/core/dev.c
index c7f13742b56c..177e91819850 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3315,8 +3315,7 @@ int skb_crc32c_csum_help(struct sk_buff *skb)
skb->len - start, ~(__u32)0,
crc32c_csum_stub));
*(__le32 *)(skb->data + offset) = crc32c_csum;
- skb->ip_summed = CHECKSUM_NONE;
- skb->csum_not_inet = 0;
+ skb_reset_csum_not_inet(skb);
out:
return ret;
}
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c
index 95e9304024b7..8ed285023a40 100644
--- a/net/sched/act_csum.c
+++ b/net/sched/act_csum.c
@@ -376,8 +376,7 @@ static int tcf_csum_sctp(struct sk_buff *skb, unsigned int ihl,
sctph->checksum = sctp_compute_cksum(skb,
skb_network_offset(skb) + ihl);
- skb->ip_summed = CHECKSUM_NONE;
- skb->csum_not_inet = 0;
+ skb_reset_csum_not_inet(skb);
return 1;
}
--
2.39.2
next prev parent reply other threads:[~2023-04-14 16:04 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-14 16:01 [PATCH net-next 0/5] net: skbuff: hide some bitfield members Jakub Kicinski
2023-04-14 16:01 ` [PATCH net-next 1/5] net: skbuff: hide wifi_acked when CONFIG_WIRELESS not set Jakub Kicinski
2023-04-14 17:46 ` Florian Fainelli
2023-04-14 16:01 ` Jakub Kicinski [this message]
2023-04-14 17:47 ` [PATCH net-next 2/5] net: skbuff: hide csum_not_inet when CONFIG_IP_SCTP " Florian Fainelli
2023-04-14 16:01 ` [PATCH net-next 3/5] net: skbuff: move alloc_cpu into a potential hole Jakub Kicinski
2023-04-14 17:51 ` Florian Fainelli
2023-04-14 16:01 ` [PATCH net-next 4/5] net: skbuff: push nf_trace down the bitfield Jakub Kicinski
2023-04-14 17:50 ` Florian Fainelli
2023-04-14 21:06 ` Florian Westphal
2023-04-15 8:31 ` Pablo Neira Ayuso
2023-04-17 4:12 ` Jakub Kicinski
2023-04-14 16:01 ` [PATCH net-next 5/5] net: skbuff: hide nf_trace and ipvs_property Jakub Kicinski
2023-04-14 17:50 ` Florian Fainelli
2023-04-14 21:09 ` Florian Westphal
2023-04-14 22:07 ` Jakub Kicinski
2023-04-14 23:11 ` Florian Westphal
2023-04-15 0:44 ` Jakub Kicinski
2023-04-15 0:32 ` kernel test robot
2023-04-15 0:43 ` kernel test robot
2023-04-17 12:09 ` Simon Horman
2023-04-15 11:53 ` [PATCH net-next 0/5] net: skbuff: hide some bitfield members Eric Dumazet
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=20230414160105.172125-3-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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;
as well as URLs for NNTP newsgroup(s).