]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: add inline function skb_csum_is_sctp
authorXin Long <lucien.xin@gmail.com>
Sat, 16 Jan 2021 06:13:37 +0000 (14:13 +0800)
committerJakub Kicinski <kuba@kernel.org>
Tue, 19 Jan 2021 22:31:25 +0000 (14:31 -0800)
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 <alexander.duyck@gmail.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/pensando/ionic/ionic_txrx.c
include/linux/skbuff.h
net/core/dev.c

index ac4cd5d82e696b91320a8c90756cce871c5e13e2..162a1ff1e9d241e75770dd33301ed7fa18ef98f0 100644 (file)
@@ -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++;
index c9568cf60c2a6c112384a457fc0be93ea1a6ed96..46f901adf1a80afc297937f2b1765c7e072f2b72 100644 (file)
@@ -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)
 {
index 6b90520a01b197ece227e564e358044952e80d4c..0332f2e8f7da00579af8e1629aa3d04158791b3b 100644 (file)
@@ -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);