Commit fa821170 authored by Xin Long's avatar Xin Long Committed by Jakub Kicinski

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: default avatarAlexander Duyck <alexander.duyck@gmail.com>
Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Reviewed-by: default avatarAlexander Duyck <alexanderduyck@fb.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 7eab14de
...@@ -979,7 +979,7 @@ static int ionic_tx_calc_csum(struct ionic_queue *q, struct sk_buff *skb) ...@@ -979,7 +979,7 @@ static int ionic_tx_calc_csum(struct ionic_queue *q, struct sk_buff *skb)
stats->vlan_inserted++; stats->vlan_inserted++;
} }
if (skb->csum_not_inet) if (skb_csum_is_sctp(skb))
stats->crc32_csum++; stats->crc32_csum++;
else else
stats->csum++; stats->csum++;
......
...@@ -4621,6 +4621,11 @@ static inline void skb_reset_redirect(struct sk_buff *skb) ...@@ -4621,6 +4621,11 @@ static inline void skb_reset_redirect(struct sk_buff *skb)
#endif #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, static inline void skb_set_kcov_handle(struct sk_buff *skb,
const u64 kcov_handle) const u64 kcov_handle)
{ {
......
...@@ -3617,7 +3617,7 @@ static struct sk_buff *validate_xmit_vlan(struct sk_buff *skb, ...@@ -3617,7 +3617,7 @@ static struct sk_buff *validate_xmit_vlan(struct sk_buff *skb,
int skb_csum_hwoffload_help(struct sk_buff *skb, int skb_csum_hwoffload_help(struct sk_buff *skb,
const netdev_features_t features) 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 : return !!(features & NETIF_F_SCTP_CRC) ? 0 :
skb_crc32c_csum_help(skb); skb_crc32c_csum_help(skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment