diff mbox series

[RFCv8,net-next,49/55] net: adjust the prototype of can_checksum_protocol()

Message ID 20220918094336.28958-50-shenjian15@huawei.com (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series net: extend the type of netdev_features_t to bitmap | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count fail Series longer than 15 patches (and no cover letter)
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 4386 this patch: 4386
netdev/cc_maintainers warning 2 maintainers not CCed: edumazet@google.com pabeni@redhat.com
netdev/build_clang fail Errors and warnings before: 15022 this patch: 15022
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 3924 this patch: 3956
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 53 lines checked
netdev/kdoc success Errors and warnings before: 2 this patch: 2
netdev/source_inline success Was 0 now: 0

Commit Message

shenjian (K) Sept. 18, 2022, 9:43 a.m. UTC
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 mbox series

Patch

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)) {