diff mbox series

[RFCv2,net-next,005/167] net: convert the prototype of gso_features_check

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

Commit Message

shenjian (K) Sept. 29, 2021, 3:50 p.m. UTC
For the origin type for netdev_features_t would be changed to
be unsigned long * from u64, so changes the prototype of
gso_features_check for adaption.

Signed-off-by: Jian Shen <shenjian15@huawei.com>
---
 net/core/dev.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/net/core/dev.c b/net/core/dev.c
index ef77e080504b..b3426559bac7 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3487,18 +3487,21 @@  static netdev_features_t dflt_features_check(struct sk_buff *skb,
 	return vlan_features_check(skb, features);
 }
 
-static netdev_features_t gso_features_check(const struct sk_buff *skb,
-					    struct net_device *dev,
-					    netdev_features_t features)
+static void gso_features_check(const struct sk_buff *skb,
+			       struct net_device *dev,
+			       netdev_features_t *features)
 {
 	u16 gso_segs = skb_shinfo(skb)->gso_segs;
 
-	if (gso_segs > dev->gso_max_segs)
-		return features & ~NETIF_F_GSO_MASK;
+	if (gso_segs > dev->gso_max_segs) {
+		*features &= ~NETIF_F_GSO_MASK;
+		return;
+	}
 
 	if (!skb_shinfo(skb)->gso_type) {
 		skb_warn_bad_offload(skb);
-		return features & ~NETIF_F_GSO_MASK;
+		*features &= ~NETIF_F_GSO_MASK;
+		return;
 	}
 
 	/* Support for GSO partial features requires software
@@ -3508,7 +3511,7 @@  static netdev_features_t gso_features_check(const struct sk_buff *skb,
 	 * segmented the frame.
 	 */
 	if (!(skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL))
-		features &= ~dev->gso_partial_features;
+		*features &= ~dev->gso_partial_features;
 
 	/* Make sure to clear the IPv4 ID mangling feature if the
 	 * IPv4 header has the potential to be fragmented.
@@ -3518,10 +3521,8 @@  static netdev_features_t gso_features_check(const struct sk_buff *skb,
 				    inner_ip_hdr(skb) : ip_hdr(skb);
 
 		if (!(iph->frag_off & htons(IP_DF)))
-			features &= ~NETIF_F_TSO_MANGLEID;
+			*features &= ~NETIF_F_TSO_MANGLEID;
 	}
-
-	return features;
 }
 
 netdev_features_t netif_skb_features(struct sk_buff *skb)
@@ -3530,7 +3531,7 @@  netdev_features_t netif_skb_features(struct sk_buff *skb)
 	netdev_features_t features = dev->features;
 
 	if (skb_is_gso(skb))
-		features = gso_features_check(skb, dev, features);
+		gso_features_check(skb, dev, &features);
 
 	/* If encapsulation offload request, verify we are testing
 	 * hardware encapsulation features instead of standard