[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <8ca1d5139e1820ac7e55166f164a56b2993d10e1.1648981571.git.asml.silence@gmail.com>
Date: Sun, 3 Apr 2022 14:06:22 +0100
From: Pavel Begunkov <asml.silence@...il.com>
To: netdev@...r.kernel.org, "David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
Cc: Eric Dumazet <edumazet@...gle.com>, Wei Liu <wei.liu@...nel.org>,
Paul Durrant <paul@....org>,
Pavel Begunkov <asml.silence@...il.com>
Subject: [PATCH net-next 10/27] net: inline part of skb_csum_hwoffload_help
Inline a part of skb_csum_hwoffload_help() responsible for skipping
for HW-accelerated cases.
Signed-off-by: Pavel Begunkov <asml.silence@...il.com>
---
include/linux/netdevice.h | 13 ++++++++++---
net/core/dev.c | 11 ++++-------
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index cd7a597c55b1..a4e41f7edc47 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -4699,9 +4699,16 @@ extern u8 netdev_rss_key[NETDEV_RSS_KEY_LEN] __read_mostly;
void netdev_rss_key_fill(void *buffer, size_t len);
int skb_checksum_help(struct sk_buff *skb);
-int skb_crc32c_csum_help(struct sk_buff *skb);
-int skb_csum_hwoffload_help(struct sk_buff *skb,
- const netdev_features_t features);
+int __skb_csum_hwoffload_help(struct sk_buff *skb,
+ const netdev_features_t features);
+
+static inline int skb_csum_hwoffload_help(struct sk_buff *skb,
+ const netdev_features_t features)
+{
+ if ((features & NETIF_F_HW_CSUM) && !skb_csum_is_sctp(skb))
+ return 0;
+ return __skb_csum_hwoffload_help(skb, features);
+}
struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
netdev_features_t features, bool tx_path);
diff --git a/net/core/dev.c b/net/core/dev.c
index 4842a398f08d..6044b6124edc 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3233,7 +3233,7 @@ int skb_checksum_help(struct sk_buff *skb)
}
EXPORT_SYMBOL(skb_checksum_help);
-int skb_crc32c_csum_help(struct sk_buff *skb)
+static inline int skb_crc32c_csum_help(struct sk_buff *skb)
{
__le32 crc32c_csum;
int ret = 0, offset, start;
@@ -3572,16 +3572,13 @@ static struct sk_buff *validate_xmit_vlan(struct sk_buff *skb,
return skb;
}
-int skb_csum_hwoffload_help(struct sk_buff *skb,
- const netdev_features_t features)
+int __skb_csum_hwoffload_help(struct sk_buff *skb,
+ const netdev_features_t features)
{
if (unlikely(skb_csum_is_sctp(skb)))
return !!(features & NETIF_F_SCTP_CRC) ? 0 :
skb_crc32c_csum_help(skb);
- if (features & NETIF_F_HW_CSUM)
- return 0;
-
if (features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)) {
switch (skb->csum_offset) {
case offsetof(struct tcphdr, check):
@@ -3592,7 +3589,7 @@ int skb_csum_hwoffload_help(struct sk_buff *skb,
return skb_checksum_help(skb);
}
-EXPORT_SYMBOL(skb_csum_hwoffload_help);
+EXPORT_SYMBOL(__skb_csum_hwoffload_help);
static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device *dev, bool *again)
{
--
2.35.1
Powered by blists - more mailing lists