VirtualBox

Changeset 75684 in vbox


Ignore:
Timestamp:
Nov 23, 2018 11:17:22 AM (6 years ago)
Author:
vboxsync
Message:

NetAdp: Linux 4.20 compatibility fix (bugref:4567) In struct ethtool_ops, the get_settings member is renamed get_link_ksettings. Inspired by Larry Finger's patch. Thank you Larry Finger

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.c

    r75599 r75684  
    8585
    8686static void vboxNetAdpEthGetDrvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
     87# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
     88static int vboxNetAdpEthGetLinkSettings(struct net_device *pNetDev, struct ethtool_link_ksettings *pLinkSettings);
     89#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) */
    8790static int vboxNetAdpEthGetSettings(struct net_device *dev, struct ethtool_cmd *cmd);
     91#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) */
    8892
    8993
     
    134138{
    135139    .get_drvinfo        = vboxNetAdpEthGetDrvinfo,
     140# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
     141    .get_link_ksettings = vboxNetAdpEthGetLinkSettings,
     142# else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) */
    136143    .get_settings       = vboxNetAdpEthGetSettings,
     144# endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) */
    137145    .get_link           = ethtool_op_get_link,
    138146};
     
    206214
    207215
     216# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
     217/* ethtool_ops::get_link_ksettings */
     218static int vboxNetAdpEthGetLinkSettings(struct net_device *pNetDev, struct ethtool_link_ksettings *pLinkSettings)
     219{
     220    /* We just need to set field we care for, the rest is done by ethtool_get_link_ksettings() helper in ethtool. */
     221    ethtool_link_ksettings_zero_link_mode(pLinkSettings, supported);
     222    ethtool_link_ksettings_zero_link_mode(pLinkSettings, advertising);
     223    ethtool_link_ksettings_zero_link_mode(pLinkSettings, lp_advertising);
     224    pLinkSettings->base.speed       = SPEED_10;
     225    pLinkSettings->base.duplex      = DUPLEX_FULL;
     226    pLinkSettings->base.port        = PORT_TP;
     227    pLinkSettings->base.phy_address = 0;
     228    pLinkSettings->base.transceiver = XCVR_INTERNAL;
     229    pLinkSettings->base.autoneg     = AUTONEG_DISABLE;
     230    return 0;
     231}
     232#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) */
    208233/* ethtool_ops::get_settings */
    209234static int vboxNetAdpEthGetSettings(struct net_device *pNetDev, struct ethtool_cmd *cmd)
     
    225250    return 0;
    226251}
     252#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) */
    227253
    228254
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette