summaryrefslogtreecommitdiff
blob: 568a405fd69c32674a4926cdb6f08b639f21db6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
--- ./drivers/ipoe/ipoe.c.orig	2016-11-28 14:28:33.000000000 +0300
+++ ./drivers/ipoe/ipoe.c	2017-05-17 11:27:42.030000000 +0300
@@ -52,6 +52,27 @@
 #define DEFINE_SEMAPHORE(name) struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1)
 #endif
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
+static inline int
+_genl_register_family_with_ops_grps(struct genl_family *family,
+				    const struct genl_ops *ops, size_t n_ops,
+				    const struct genl_multicast_group *mcgrps,
+				    size_t n_mcgrps)
+{
+	family->module = THIS_MODULE;
+	family->ops = ops;
+	family->n_ops = n_ops;
+	family->mcgrps = mcgrps;
+	family->n_mcgrps = n_mcgrps;
+	return genl_register_family(family);
+}
+
+#define genl_register_family_with_ops_groups(family, ops, grps)	\
+	_genl_register_family_with_ops_grps((family),			\
+					    (ops), ARRAY_SIZE(ops),	\
+					    (grps), ARRAY_SIZE(grps))
+#endif
+
 struct ipoe_stats {
 	struct u64_stats_sync sync;
 	u64 packets;
@@ -1668,7 +1689,9 @@
 };
 
 static struct genl_family ipoe_nl_family = {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)
 	.id		= GENL_ID_GENERATE,
+#endif
 	.name		= IPOE_GENL_NAME,
 	.version	= IPOE_GENL_VERSION,
 	.hdrsize	= 0,
--- ./drivers/vlan_mon/vlan_mon.c.orig	2017-05-17 11:28:23.320000000 +0300
+++ ./drivers/vlan_mon/vlan_mon.c	2017-05-17 11:29:41.660000000 +0300
@@ -39,6 +39,27 @@
 #define vlan_tx_tag_present(skb) skb_vlan_tag_present(skb)
 #endif
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
+static inline int
+_genl_register_family_with_ops_grps(struct genl_family *family,
+				    const struct genl_ops *ops, size_t n_ops,
+				    const struct genl_multicast_group *mcgrps,
+				    size_t n_mcgrps)
+{
+	family->module = THIS_MODULE;
+	family->ops = ops;
+	family->n_ops = n_ops;
+	family->mcgrps = mcgrps;
+	family->n_mcgrps = n_mcgrps;
+	return genl_register_family(family);
+}
+
+#define genl_register_family_with_ops_groups(family, ops, grps)	\
+	_genl_register_family_with_ops_grps((family),			\
+					    (ops), ARRAY_SIZE(ops),	\
+					    (grps), ARRAY_SIZE(grps))
+#endif
+
 struct vlan_dev {
 	unsigned int magic;
 	int ifindex;
@@ -660,7 +681,9 @@
 };
 
 static struct genl_family vlan_mon_nl_family = {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)
 	.id		= GENL_ID_GENERATE,
+#endif
 	.name		= VLAN_MON_GENL_NAME,
 	.version	= VLAN_MON_GENL_VERSION,
 	.hdrsize	= 0,