Thread (181 messages) 181 messages, 6 authors, 2022-01-27

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

From: Jian Shen <shenjian15@huawei.com>
Date: 2021-09-29 16:05:13
Subsystem: bpf [general] (safe dynamic programs and tools), library code, the rest · Maintainers: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Eduard Zingerman, Kumar Kartikeya Dwivedi, Andrew Morton, Linus Torvalds

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 --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;
-- 
2.33.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help