[RFCv8 PATCH net-next 49/55] net: adjust the prototype of can_checksum_protocol()
STALE1094d
From: Jian Shen <shenjian15@huawei.com>
Date: 2022-09-18 09:50:44
Subsystem:
networking drivers, networking [general], the rest · Maintainers:
Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds
The function can_checksum_protocol() using netdev_features_t as parameters. For the prototype of netdev_features_t will be extended to be largerthan 8 bytes, so change the prototype of the function, change the prototype of input features to 'netdev_features_t *'. Signed-off-by: Jian Shen <shenjian15@huawei.com> --- include/linux/netdevice.h | 10 +++++----- include/net/vxlan.h | 2 +- net/core/dev.c | 2 +- net/core/skbuff.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index f0fad437bdb7..4620af4591fc 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h@@ -4809,24 +4809,24 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, } __be16 skb_network_protocol(struct sk_buff *skb, int *depth); -static inline bool can_checksum_protocol(netdev_features_t features, +static inline bool can_checksum_protocol(const netdev_features_t *features, __be16 protocol) { if (protocol == htons(ETH_P_FCOE)) - return netdev_feature_test(NETIF_F_FCOE_CRC_BIT, features); + return netdev_feature_test(NETIF_F_FCOE_CRC_BIT, *features); /* Assume this is an IP checksum (not SCTP CRC) */ - if (netdev_feature_test(NETIF_F_HW_CSUM_BIT, features)) { + if (netdev_feature_test(NETIF_F_HW_CSUM_BIT, *features)) { /* Can checksum everything */ return true; } switch (protocol) { case htons(ETH_P_IP): - return netdev_feature_test(NETIF_F_IP_CSUM_BIT, features); + return netdev_feature_test(NETIF_F_IP_CSUM_BIT, *features); case htons(ETH_P_IPV6): - return netdev_feature_test(NETIF_F_IPV6_CSUM_BIT, features); + return netdev_feature_test(NETIF_F_IPV6_CSUM_BIT, *features); default: return false; }
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index 25d2bc8015c7..b1a729c4edc1 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h@@ -372,7 +372,7 @@ static inline void vxlan_features_check(struct sk_buff *skb, (skb_inner_mac_header(skb) - skb_transport_header(skb) != sizeof(struct udphdr) + sizeof(struct vxlanhdr)) || (skb->ip_summed != CHECKSUM_NONE && - !can_checksum_protocol(*features, inner_eth_hdr(skb)->h_proto)))) { + !can_checksum_protocol(features, inner_eth_hdr(skb)->h_proto)))) { netdev_features_clear(*features, netdev_csum_gso_features_mask); return; }
diff --git a/net/core/dev.c b/net/core/dev.c
index 54cb150d9db1..bed372ecef65 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c@@ -3485,7 +3485,7 @@ static void harmonize_features(struct sk_buff *skb, netdev_features_t *features) net_mpls_features(skb, features, type); if (skb->ip_summed != CHECKSUM_NONE && - !can_checksum_protocol(*features, type)) { + !can_checksum_protocol(features, type)) { netdev_features_clear(*features, netdev_csum_gso_features_mask); }
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 3e6935386637..ced731f87560 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c@@ -4060,7 +4060,7 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb, return ERR_PTR(-EINVAL); sg = netdev_feature_test(NETIF_F_SG_BIT, features); - csum = !!can_checksum_protocol(features, proto); + csum = !!can_checksum_protocol(&features, proto); if (sg && csum && (mss != GSO_BY_FRAGS)) { if (!netdev_feature_test(NETIF_F_GSO_PARTIAL_BIT, features)) {
--
2.33.0