From: Xin Long Date: Sat, 16 Jan 2021 06:13:37 +0000 (+0800) Subject: net: add inline function skb_csum_is_sctp X-Git-Tag: baikal/aarch64/sdk6.1~7291^2~302^2~5 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=3d985ffbf1cd21d514de1bfd2bddb2fb8b5f35d7;p=kernel.git net: add inline function skb_csum_is_sctp This patch is to define a inline function skb_csum_is_sctp(), and also replace all places where it checks if it's a SCTP CSUM skb. This function would be used later in many networking drivers in the following patches. Suggested-by: Alexander Duyck Signed-off-by: Xin Long Reviewed-by: Alexander Duyck Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c index ac4cd5d82e696..162a1ff1e9d24 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c @@ -979,7 +979,7 @@ static int ionic_tx_calc_csum(struct ionic_queue *q, struct sk_buff *skb) stats->vlan_inserted++; } - if (skb->csum_not_inet) + if (skb_csum_is_sctp(skb)) stats->crc32_csum++; else stats->csum++; diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index c9568cf60c2a6..46f901adf1a80 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -4621,6 +4621,11 @@ static inline void skb_reset_redirect(struct sk_buff *skb) #endif } +static inline bool skb_csum_is_sctp(struct sk_buff *skb) +{ + return skb->csum_not_inet; +} + static inline void skb_set_kcov_handle(struct sk_buff *skb, const u64 kcov_handle) { diff --git a/net/core/dev.c b/net/core/dev.c index 6b90520a01b19..0332f2e8f7da0 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3617,7 +3617,7 @@ static struct sk_buff *validate_xmit_vlan(struct sk_buff *skb, int skb_csum_hwoffload_help(struct sk_buff *skb, const netdev_features_t features) { - if (unlikely(skb->csum_not_inet)) + if (unlikely(skb_csum_is_sctp(skb))) return !!(features & NETIF_F_SCTP_CRC) ? 0 : skb_crc32c_csum_help(skb);