Skip to content

Commit

Permalink
Added support for kernel 4.6
Browse files Browse the repository at this point in the history
For 4.6 kernel several ethtool API functions has been removed.
If vrouter is building for 4.6 new API should be used instead.

Close-bug: #1633387

Change-Id: Ibb83f611616cba952b1ba7da4e548fccd55d0037
  • Loading branch information
Sergey Matov committed Oct 17, 2016
1 parent 3b137fe commit 5e17133
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions linux/vr_host_interface.c
Expand Up @@ -1581,17 +1581,29 @@ linux_if_get_settings(struct vr_interface *vif,
rtnl_lock();

if (netif_running(dev)) {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,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))
struct ethtool_cmd cmd;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
/* As per lxr, this API was introduced in 3.2.0 */
/* 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);
#else
settings->vis_duplex = cmd.duplex;
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0))
struct ethtool_cmd cmd;
cmd.cmd = ETHTOOL_GSET;
if (!(ret = dev_ethtool_get_settings(dev, &cmd))) {
settings->vis_speed = cmd.speed;
#endif
settings->vis_duplex = cmd.duplex;
#endif

}
}

Expand Down

0 comments on commit 5e17133

Please sign in to comment.