summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2017-12-15 11:44:33 +0300
committerDmitry Kozlov <xeb@mail.ru>2017-12-15 11:44:33 +0300
commitd423bcad1a9f321c38c707232a625de856b04bc4 (patch)
tree5ff6ccd35fda80a58bd24f972dcfc86d5da07ba9 /drivers
parent92925bfc047b32a6bb918fa6e01b8bb7e9216722 (diff)
downloadaccel-ppp-d423bcad1a9f321c38c707232a625de856b04bc4.tar.gz
accel-ppp-d423bcad1a9f321c38c707232a625de856b04bc4.zip
ipoe, vlan_mon: implemented support for centos 3.10 kernel
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ipoe/ipoe.c25
-rw-r--r--drivers/vlan_mon/vlan_mon.c24
2 files changed, 21 insertions, 28 deletions
diff --git a/drivers/ipoe/ipoe.c b/drivers/ipoe/ipoe.c
index ceab7c9..b0cd0d6 100644
--- a/drivers/ipoe/ipoe.c
+++ b/drivers/ipoe/ipoe.c
@@ -143,22 +143,15 @@ static struct net *pick_net(struct sk_buff *skb);
static const struct net_device_ops ipoe_netdev_ops;
static struct genl_family ipoe_nl_family;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) && RHEL_MAJOR < 7
static struct genl_multicast_group ipoe_nl_mcg;
#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0) || RHEL_MAJOR == 7
#define u64_stats_fetch_begin_bh u64_stats_fetch_begin_irq
#define u64_stats_fetch_retry_bh u64_stats_fetch_retry_irq
#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)
-#ifndef u64_stats_fetch_begin_bh
-#define u64_stats_fetch_begin_bh u64_stats_fetch_begin_irq
-#define u64_stats_fetch_retry_bh u64_stats_fetch_retry_irq
-#endif
-#endif
-
#ifndef NETIF_F_HW_VLAN_FILTER
#define NETIF_F_HW_VLAN_FILTER NETIF_F_HW_VLAN_CTAG_FILTER
#endif
@@ -593,7 +586,7 @@ static void ipoe_process_queue(struct work_struct *w)
if (!report_skb) {
report_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
if (report_skb)
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) && RHEL_MAJOR < 7
header = genlmsg_put(report_skb, 0, ipoe_nl_mcg.id, &ipoe_nl_family, 0, IPOE_REP_PKT);
#else
header = genlmsg_put(report_skb, 0, ipoe_nl_family.mcgrp_offset, &ipoe_nl_family, 0, IPOE_REP_PKT);
@@ -622,7 +615,7 @@ static void ipoe_process_queue(struct work_struct *w)
if (nla_nest_end(report_skb, ns) >= IPOE_NLMSG_SIZE) {
genlmsg_end(report_skb, header);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) && RHEL_MAJOR < 7
genlmsg_multicast(report_skb, 0, ipoe_nl_mcg.id, GFP_KERNEL);
#else
genlmsg_multicast(&ipoe_nl_family, report_skb, 0, 0, GFP_KERNEL);
@@ -658,7 +651,7 @@ nl_err:
if (report_skb) {
genlmsg_end(report_skb, header);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) && RHEL_MAJOR < 7
genlmsg_multicast(report_skb, 0, ipoe_nl_mcg.id, GFP_KERNEL);
#else
genlmsg_multicast(&ipoe_nl_family, report_skb, 0, 0, GFP_KERNEL);
@@ -1705,7 +1698,7 @@ static struct genl_family ipoe_nl_family = {
.maxattr = IPOE_ATTR_MAX,
};
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) && RHEL_MAJOR < 7
static struct genl_multicast_group ipoe_nl_mcg = {
.name = IPOE_GENL_MCG_PKT,
};
@@ -1746,7 +1739,7 @@ static int __init ipoe_init(void)
skb_queue_head_init(&ipoe_queue);
INIT_WORK(&ipoe_queue_work, ipoe_process_queue);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) && RHEL_MAJOR < 7
err = genl_register_family_with_ops(&ipoe_nl_family, ipoe_nl_ops, ARRAY_SIZE(ipoe_nl_ops));
#else
err = genl_register_family_with_ops_groups(&ipoe_nl_family, ipoe_nl_ops, ipoe_nl_mcgs);
@@ -1756,7 +1749,7 @@ static int __init ipoe_init(void)
return err;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) && RHEL_MAJOR < 7
err = genl_register_mc_group(&ipoe_nl_family, &ipoe_nl_mcg);
if (err < 0) {
printk(KERN_INFO "ipoe: can't register netlink multicast group\n");
@@ -1775,7 +1768,7 @@ static void __exit ipoe_fini(void)
struct net_device *dev;
int i;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) && RHEL_MAJOR < 7
genl_unregister_mc_group(&ipoe_nl_family, &ipoe_nl_mcg);
#endif
genl_unregister_family(&ipoe_nl_family);
diff --git a/drivers/vlan_mon/vlan_mon.c b/drivers/vlan_mon/vlan_mon.c
index 4e3eab9..f4a9922 100644
--- a/drivers/vlan_mon/vlan_mon.c
+++ b/drivers/vlan_mon/vlan_mon.c
@@ -35,7 +35,7 @@
#define NETIF_F_HW_VLAN_FILTER NETIF_F_HW_VLAN_CTAG_FILTER
#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0) || RHEL_MAJOR == 7
#define vlan_tx_tag_present(skb) skb_vlan_tag_present(skb)
#endif
@@ -67,7 +67,7 @@ static DEFINE_SPINLOCK(vlan_lock);
static struct work_struct vlan_notify_work;
static struct genl_family vlan_mon_nl_family;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) && RHEL_MAJOR < 7
static struct genl_multicast_group vlan_mon_nl_mcg;
#endif
@@ -130,7 +130,7 @@ static int vlan_pt_recv(struct sk_buff *skb, struct net_device *dev, struct pack
if (vid > 0) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
struct net_device *vd = __vlan_find_dev_deep(dev, vid);
-#elif LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0) && RHEL_MAJOR < 7
struct net_device *vd = __vlan_find_dev_deep(dev, skb->vlan_proto, vid);
#else
struct net_device *vd = __vlan_find_dev_deep_rcu(dev, skb->vlan_proto, vid);
@@ -191,7 +191,7 @@ static void vlan_do_notify(struct work_struct *w)
if (!report_skb) {
report_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) && RHEL_MAJOR < 7
header = genlmsg_put(report_skb, 0, vlan_mon_nl_mcg.id, &vlan_mon_nl_family, 0, VLAN_MON_NOTIFY);
#else
header = genlmsg_put(report_skb, 0, vlan_mon_nl_family.mcgrp_offset, &vlan_mon_nl_family, 0, VLAN_MON_NOTIFY);
@@ -218,7 +218,7 @@ static void vlan_do_notify(struct work_struct *w)
if (nla_nest_end(report_skb, ns) >= VLAN_MON_NLMSG_SIZE || id == 255) {
genlmsg_end(report_skb, header);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) && RHEL_MAJOR < 7
genlmsg_multicast(report_skb, 0, vlan_mon_nl_mcg.id, GFP_KERNEL);
#else
genlmsg_multicast(&vlan_mon_nl_family, report_skb, 0, 0, GFP_KERNEL);
@@ -237,7 +237,7 @@ nl_err:
if (report_skb) {
genlmsg_end(report_skb, header);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) && RHEL_MAJOR < 7
genlmsg_multicast(report_skb, 0, vlan_mon_nl_mcg.id, GFP_KERNEL);
#else
genlmsg_multicast(&vlan_mon_nl_family, report_skb, 0, 0, GFP_KERNEL);
@@ -488,7 +488,7 @@ static void vlan_dev_clean(struct vlan_dev *d, struct net_device *dev, struct li
if (d->busy[i / (8*sizeof(long))] & (1lu << (i % (8*sizeof(long))))) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
vd = __vlan_find_dev_deep(dev, i);
-#elif LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0) && RHEL_MAJOR < 7
vd = __vlan_find_dev_deep(dev, htons(ETH_P_8021Q), i);
if (!vd)
vd = __vlan_find_dev_deep(dev, htons(ETH_P_8021AD), i);
@@ -667,7 +667,7 @@ static struct genl_family vlan_mon_nl_family = {
.maxattr = VLAN_MON_ATTR_MAX,
};
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) && RHEL_MAJOR < 7
static struct genl_multicast_group vlan_mon_nl_mcg = {
.name = VLAN_MON_GENL_MCG,
};
@@ -693,7 +693,7 @@ static int __init vlan_mon_init(void)
INIT_WORK(&vlan_notify_work, vlan_do_notify);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) && RHEL_MAJOR < 7
err = genl_register_family_with_ops(&vlan_mon_nl_family, vlan_mon_nl_ops, ARRAY_SIZE(vlan_mon_nl_ops));
#else
err = genl_register_family_with_ops_groups(&vlan_mon_nl_family, vlan_mon_nl_ops, vlan_mon_nl_mcgs);
@@ -703,7 +703,7 @@ static int __init vlan_mon_init(void)
goto out;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) && RHEL_MAJOR < 7
err = genl_register_mc_group(&vlan_mon_nl_family, &vlan_mon_nl_mcg);
if (err < 0) {
printk(KERN_INFO "vlan_mon: can't register netlink multicast group\n");
@@ -715,7 +715,7 @@ static int __init vlan_mon_init(void)
return 0;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) && RHEL_MAJOR < 7
out_unreg:
#endif
genl_unregister_family(&vlan_mon_nl_family);
@@ -732,7 +732,7 @@ static void __exit vlan_mon_fini(void)
dev_remove_pack(&vlan_pt);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) && RHEL_MAJOR < 7
genl_unregister_mc_group(&vlan_mon_nl_family, &vlan_mon_nl_mcg);
#endif
genl_unregister_family(&vlan_mon_nl_family);