@@ -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);
@@ -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)
{
Inline a part of skb_csum_hwoffload_help() responsible for skipping for HW-accelerated cases. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> --- include/linux/netdevice.h | 13 ++++++++++--- net/core/dev.c | 11 ++++------- 2 files changed, 14 insertions(+), 10 deletions(-)