Skip to content

Commit 778eb90

Browse files
committed
gve: fix coccinelle issue for xdp and ethtool on 6.15
There are some new added API for XDP and ethtool that are included in 6.16 kernel, but the coccinelle mistakenly assumes they are added in 6.15 kernel instead. Change the coccinelle check to be 6.16 to resolve the issue that driver couldn't compile on 6.15 kernel. Signed-off-by: Ziwei Xiao <[email protected]> Google-Bug-Id: 435835685 Change-Id: I958a6e47f7ccf9fd9af95461aefe07fc7f4f6d7a
1 parent 0432879 commit 778eb90

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

build/gve_ethtool.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static const char gve_gstrings_tx_stats[][ETH_GSTRING_LEN] = {
6868
"tx_xsk_sent[%u]", "tx_xdp_xmit[%u]", "tx_xdp_xmit_errors[%u]"
6969
};
7070

71-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0)
71+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0)
7272
static const char gve_gstrings_adminq_stats[][ETH_GSTRING_LEN] __nonstring_array = {
7373
"adminq_prod_cnt", "adminq_cmd_fail", "adminq_timeouts",
7474
"adminq_describe_device_cnt", "adminq_cfg_device_resources_cnt",
@@ -80,7 +80,7 @@ static const char gve_gstrings_adminq_stats[][ETH_GSTRING_LEN] __nonstring_array
8080
"adminq_query_flow_rules", "adminq_cfg_flow_rule", "adminq_cfg_rss_cnt",
8181
"adminq_query_rss_cnt", "adminq_report_nic_timestamp_cnt",
8282
};
83-
#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0) */
83+
#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0) */
8484
static const char gve_gstrings_adminq_stats[][ETH_GSTRING_LEN] = {
8585
"adminq_prod_cnt",
8686
"adminq_cmd_fail",
@@ -104,7 +104,7 @@ static const char gve_gstrings_adminq_stats[][ETH_GSTRING_LEN] = {
104104
"adminq_query_rss_cnt",
105105
"adminq_report_nic_timestamp_cnt",
106106
};
107-
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0) */
107+
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0) */
108108

109109
static const char gve_gstrings_priv_flags[][ETH_GSTRING_LEN] = {
110110
"report-stats",
@@ -165,17 +165,17 @@ static void gve_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
165165
}
166166

167167
for (i = 0; i < ARRAY_SIZE(gve_gstrings_adminq_stats); i++) {
168-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0)
168+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0)
169169
ethtool_cpy(&s, gve_gstrings_adminq_stats[i]);
170-
#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0) */
170+
#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0) */
171171
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0)
172172
ethtool_puts(&s, gve_gstrings_adminq_stats[i]);
173173
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(6,8,0) */
174174
strscpy(*&s, gve_gstrings_adminq_stats[i],
175175
ETH_GSTRING_LEN);
176176
*&s += ETH_GSTRING_LEN;
177177
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0) */
178-
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0) */
178+
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0) */
179179
}
180180

181181
break;

build/gve_main.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#define GVE_DEFAULT_RX_COPYBREAK (256)
4040

4141
#define DEFAULT_MSG_LEVEL (NETIF_MSG_DRV | NETIF_MSG_LINK)
42-
#define GVE_VERSION "1.4.5.1-59-8578b2d-49e420f-oot"
42+
#define GVE_VERSION "1.4.5.1-1-388d2c9-fc517b1-oot"
4343
#define GVE_VERSION_PREFIX "GVE-"
4444

4545
// Minimum amount of time between queue kicks in msec (10 seconds)
@@ -2236,7 +2236,7 @@ static void gve_turndown(struct gve_priv *priv)
22362236
/* Stop tx queues */
22372237
netif_tx_disable(priv->dev);
22382238

2239-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0)
2239+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0)
22402240
xdp_features_clear_redirect_target_locked(priv->dev);
22412241
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(6,3,0)) || RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,4)
22422242
xdp_features_clear_redirect_target(priv->dev);
@@ -2325,7 +2325,7 @@ static void gve_turnup(struct gve_priv *priv)
23252325
}
23262326

23272327
if (priv->tx_cfg.num_xdp_queues && gve_supports_xdp_xmit(priv)) {
2328-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0)
2328+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0)
23292329
xdp_features_set_redirect_target_locked(priv->dev, false);
23302330
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(6,3,0)) || RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,4)
23312331
xdp_features_set_redirect_target(priv->dev, false);
@@ -2803,11 +2803,11 @@ static void gve_set_netdev_xdp_features(struct gve_priv *priv)
28032803
xdp_features = 0;
28042804
}
28052805

2806-
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0))
2806+
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0))
28072807
xdp_set_features_flag_locked(priv->dev, xdp_features);
2808-
#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0)) */
2808+
#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0)) */
28092809
xdp_set_features_flag(priv->dev, xdp_features);
2810-
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0)) */
2810+
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0)) */
28112811
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(6,3,0)) || defined(KUNIT_KERNEL) || RHEL_VERSION_GTE(9,4) */
28122812
}
28132813

patches/ethtool_cpy.cocci

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
@ethtool_copy_rename@
22
expression list args;
33
@@
4-
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0)
4+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0)
55
ethtool_cpy(args);
6-
+#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0) */
6+
+#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0) */
77
+ethtool_puts(args);
8-
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0) */
8+
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0) */
99

1010
@@
1111
initializer value;
1212
identifier strarr, strlen;
1313
attribute name __nonstring_array;
1414
type C;
1515
@@
16-
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0)
16+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0)
1717
static const char strarr[][strlen] __nonstring_array = value;
18-
+#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0) */
18+
+#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0) */
1919
+static const char strarr[][strlen] = value;
20-
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0) */
20+
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0) */

patches/patch_xdp1.cocci

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -528,16 +528,16 @@ static void gve_set_netdev_xdp_features(struct gve_priv *priv)
528528
@@
529529
expression list args;
530530
@@
531-
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0))
531+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0))
532532
xdp_set_features_flag_locked(args);
533-
+#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0)) */
533+
+#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0)) */
534534
+xdp_set_features_flag(args);
535-
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0)) */
535+
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0)) */
536536

537537
@@
538538
expression list args;
539539
@@
540-
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0)
540+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0)
541541
xdp_features_set_redirect_target_locked(args);
542542
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(6,3,0)) || RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,4)
543543
+xdp_features_set_redirect_target(args);
@@ -547,7 +547,7 @@ xdp_features_set_redirect_target_locked(args);
547547
@@
548548
expression list args;
549549
@@
550-
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,0)
550+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0)
551551
xdp_features_clear_redirect_target_locked(args);
552552
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(6,3,0)) || RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,4)
553553
+xdp_features_clear_redirect_target(args);

0 commit comments

Comments
 (0)