Skip to content

Commit

Permalink
Fixes vrouter kernel module build on RHEL/CentOS 7
Browse files Browse the repository at this point in the history
Change-Id: I3bf6a426928a65b66c56ffbca1f318641f799d4b
Closes-Bug: 1736108
  • Loading branch information
wurbanski committed Dec 4, 2017
1 parent 7e1320e commit c4c68b6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions linux/vr_host_interface.c
Expand Up @@ -1643,22 +1643,21 @@ linux_if_get_settings(struct vr_interface *vif,
rtnl_lock();

if (netif_running(dev)) {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) || \
(defined(RHEL_MAJOR) && RHEL_MAJOR >= 7 && RHEL_MINOR >= 4 && LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)))
/* ethtool_link_ksettings introduced since kernel 4.6. ethtool_cmd has been removed */
struct ethtool_link_ksettings ekmd;
ekmd.base.cmd = ETHTOOL_GSET;
if (!(ret = __ethtool_get_link_ksettings(dev, &ekmd))) {
settings->vis_speed = ekmd.base.speed;
settings->vis_duplex = ekmd.base.duplex;
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) && LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0))
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) && LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0))
struct ethtool_cmd cmd;
/* As per lxr, this API was introduced in 3.2.0 */
if (!(ret = __ethtool_get_settings(dev, &cmd))) {
settings->vis_speed = ethtool_cmd_speed(&cmd);
settings->vis_duplex = cmd.duplex;
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0))
#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0))
struct ethtool_cmd cmd;
cmd.cmd = ETHTOOL_GSET;
if (!(ret = dev_ethtool_get_settings(dev, &cmd))) {
Expand Down

0 comments on commit c4c68b6

Please sign in to comment.