Skip to content

Commit fa82117

Browse files
lxinkuba-moo
authored andcommitted
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 <[email protected]> Signed-off-by: Xin Long <[email protected]> Reviewed-by: Alexander Duyck <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 7eab14d commit fa82117

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

drivers/net/ethernet/pensando/ionic/ionic_txrx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ static int ionic_tx_calc_csum(struct ionic_queue *q, struct sk_buff *skb)
979979
stats->vlan_inserted++;
980980
}
981981

982-
if (skb->csum_not_inet)
982+
if (skb_csum_is_sctp(skb))
983983
stats->crc32_csum++;
984984
else
985985
stats->csum++;

include/linux/skbuff.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4621,6 +4621,11 @@ static inline void skb_reset_redirect(struct sk_buff *skb)
46214621
#endif
46224622
}
46234623

4624+
static inline bool skb_csum_is_sctp(struct sk_buff *skb)
4625+
{
4626+
return skb->csum_not_inet;
4627+
}
4628+
46244629
static inline void skb_set_kcov_handle(struct sk_buff *skb,
46254630
const u64 kcov_handle)
46264631
{

net/core/dev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3617,7 +3617,7 @@ static struct sk_buff *validate_xmit_vlan(struct sk_buff *skb,
36173617
int skb_csum_hwoffload_help(struct sk_buff *skb,
36183618
const netdev_features_t features)
36193619
{
3620-
if (unlikely(skb->csum_not_inet))
3620+
if (unlikely(skb_csum_is_sctp(skb)))
36213621
return !!(features & NETIF_F_SCTP_CRC) ? 0 :
36223622
skb_crc32c_csum_help(skb);
36233623

0 commit comments

Comments
 (0)