diff mbox series

[RFCv2,net-next,160/167] test_bpf: change the prototype of features

Message ID 20210929155334.12454-161-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:53 p.m. UTC
Changes the type of "features" of struct skb_segment_test
to "u64", for it is initialized in the variable definition
stage, avoid compile issue when change the type of
"netdev_features_t" to "unsigned long *".

Signed-off-by: Jian Shen <shenjian15@huawei.com>
---
 lib/test_bpf.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/lib/test_bpf.c b/lib/test_bpf.c
index 0018d51b93b0..68c1cebdb300 100644
--- a/lib/test_bpf.c
+++ b/lib/test_bpf.c
@@ -8876,30 +8876,31 @@  static __init struct sk_buff *build_test_skb_linear_no_head_frag(void)
 struct skb_segment_test {
 	const char *descr;
 	struct sk_buff *(*build_skb)(void);
-	netdev_features_t features;
+	u64 features[NETDEV_FEATURE_DWORDS];
 };
 
 static struct skb_segment_test skb_segment_tests[] __initconst = {
 	{
 		.descr = "gso_with_rx_frags",
 		.build_skb = build_test_skb,
-		.features = NETIF_F_SG | NETIF_F_GSO_PARTIAL | NETIF_F_IP_CSUM |
-			    NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM
+		.features = { NETIF_F_SG | NETIF_F_GSO_PARTIAL | NETIF_F_IP_CSUM |
+			      NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM }
 	},
 	{
 		.descr = "gso_linear_no_head_frag",
 		.build_skb = build_test_skb_linear_no_head_frag,
-		.features = NETIF_F_SG | NETIF_F_FRAGLIST |
-			    NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_GSO |
-			    NETIF_F_LLTX_BIT | NETIF_F_GRO |
-			    NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM |
-			    NETIF_F_HW_VLAN_STAG_TX_BIT
+		.features = { NETIF_F_SG | NETIF_F_FRAGLIST |
+			      NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_GSO |
+			      NETIF_F_LLTX_BIT | NETIF_F_GRO |
+			      NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM |
+			      NETIF_F_HW_VLAN_STAG_TX_BIT }
 	}
 };
 
 static __init int test_skb_segment_single(const struct skb_segment_test *test)
 {
 	struct sk_buff *skb, *segs;
+	netdev_features_t features;
 	int ret = -1;
 
 	skb = test->build_skb();
@@ -8908,7 +8909,9 @@  static __init int test_skb_segment_single(const struct skb_segment_test *test)
 		goto done;
 	}
 
-	segs = skb_segment(skb, test->features);
+	netdev_feature_zero(&features);
+	netdev_feature_set_bits(test->features[0], &features);
+	segs = skb_segment(skb, features);
 	if (!IS_ERR(segs)) {
 		kfree_skb_list(segs);
 		ret = 0;