mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
net: r8168: Fix build for Linux v6.9
For Linux v6.9, the structure 'ethtool_eee' was replaced by 'ethtool_keee' and this new structure uses bitmaps for the structure fields 'supported', 'advertised' and 'lp_advertised' as opposed to 'u32' types. A test has been added to the conftest script to detect the presence of the ethtool_keee structure and so use the definitions generated by conftest to compile the r8168 accordingly. Note that because the 'supported', 'advertised' and 'lp_advertised' fields are no longer 'u32' types use the functions mii_eee_cap1_mod_linkmode_t() and linkmode_to_mii_eee_cap1_t() for working with the bitmap types. Bug 4471899 Change-Id: I44053d36499261c2aec855ea396bf5654b207ff6 Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3110495 GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com> Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> Tested-by: Laxman Dewangan <ldewangan@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
b0c580762b
commit
74c60d6681
@@ -6747,7 +6747,11 @@ static int rtl_nway_reset(struct net_device *dev)
|
|||||||
|
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)
|
||||||
static int
|
static int
|
||||||
|
#if defined(NV_ETHTOOL_KEEE_STRUCT_PRESENT) /* Linux v6.9 */
|
||||||
|
rtl_ethtool_get_eee(struct net_device *net, struct ethtool_keee *eee)
|
||||||
|
#else
|
||||||
rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *eee)
|
rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *eee)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
struct rtl8168_private *tp = netdev_priv(net);
|
struct rtl8168_private *tp = netdev_priv(net);
|
||||||
u32 lp, adv, supported = 0;
|
u32 lp, adv, supported = 0;
|
||||||
@@ -6770,14 +6774,26 @@ rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *eee)
|
|||||||
|
|
||||||
rtl8168_mdio_write(tp, 0x1F, 0x0A5C);
|
rtl8168_mdio_write(tp, 0x1F, 0x0A5C);
|
||||||
val = rtl8168_mdio_read(tp, 0x12);
|
val = rtl8168_mdio_read(tp, 0x12);
|
||||||
|
#if defined(NV_ETHTOOL_KEEE_STRUCT_PRESENT) /* Linux v6.9 */
|
||||||
|
supported = val;
|
||||||
|
#else
|
||||||
supported = mmd_eee_cap_to_ethtool_sup_t(val);
|
supported = mmd_eee_cap_to_ethtool_sup_t(val);
|
||||||
|
#endif
|
||||||
|
|
||||||
rtl8168_mdio_write(tp, 0x1F, 0x0A5D);
|
rtl8168_mdio_write(tp, 0x1F, 0x0A5D);
|
||||||
val = rtl8168_mdio_read(tp, 0x10);
|
val = rtl8168_mdio_read(tp, 0x10);
|
||||||
|
#if defined(NV_ETHTOOL_KEEE_STRUCT_PRESENT) /* Linux v6.9 */
|
||||||
|
adv = val;
|
||||||
|
#else
|
||||||
adv = mmd_eee_adv_to_ethtool_adv_t(val);
|
adv = mmd_eee_adv_to_ethtool_adv_t(val);
|
||||||
|
#endif
|
||||||
|
|
||||||
val = rtl8168_mdio_read(tp, 0x11);
|
val = rtl8168_mdio_read(tp, 0x11);
|
||||||
|
#if defined(NV_ETHTOOL_KEEE_STRUCT_PRESENT) /* Linux v6.9 */
|
||||||
|
lp = val;
|
||||||
|
#else
|
||||||
lp = mmd_eee_adv_to_ethtool_adv_t(val);
|
lp = mmd_eee_adv_to_ethtool_adv_t(val);
|
||||||
|
#endif
|
||||||
|
|
||||||
val = rtl8168_eri_read(tp, 0x1B0, 2, ERIAR_ExGMAC);
|
val = rtl8168_eri_read(tp, 0x1B0, 2, ERIAR_ExGMAC);
|
||||||
val &= BIT_1 | BIT_0;
|
val &= BIT_1 | BIT_0;
|
||||||
@@ -6788,15 +6804,25 @@ rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *eee)
|
|||||||
|
|
||||||
eee->eee_enabled = !!val;
|
eee->eee_enabled = !!val;
|
||||||
eee->eee_active = !!(supported & adv & lp);
|
eee->eee_active = !!(supported & adv & lp);
|
||||||
|
#if defined(NV_ETHTOOL_KEEE_STRUCT_PRESENT) /* Linux v6.9 */
|
||||||
|
mii_eee_cap1_mod_linkmode_t(eee->supported, supported);
|
||||||
|
mii_eee_cap1_mod_linkmode_t(eee->advertised, adv);
|
||||||
|
mii_eee_cap1_mod_linkmode_t(eee->lp_advertised, lp);
|
||||||
|
#else
|
||||||
eee->supported = supported;
|
eee->supported = supported;
|
||||||
eee->advertised = adv;
|
eee->advertised = adv;
|
||||||
eee->lp_advertised = lp;
|
eee->lp_advertised = lp;
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
#if defined(NV_ETHTOOL_KEEE_STRUCT_PRESENT) /* Linux v6.9 */
|
||||||
|
rtl_ethtool_set_eee(struct net_device *net, struct ethtool_keee *eee)
|
||||||
|
#else
|
||||||
rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *eee)
|
rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *eee)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
struct rtl8168_private *tp = netdev_priv(net);
|
struct rtl8168_private *tp = netdev_priv(net);
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
@@ -6821,7 +6847,11 @@ rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *eee)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tp->eee_enabled = eee->eee_enabled;
|
tp->eee_enabled = eee->eee_enabled;
|
||||||
|
#if defined(NV_ETHTOOL_KEEE_STRUCT_PRESENT) /* Linux v6.9 */
|
||||||
|
tp->eee_adv_t = linkmode_to_mii_eee_cap1_t(eee->advertised);
|
||||||
|
#else
|
||||||
tp->eee_adv_t = ethtool_adv_to_mmd_eee_adv_t(eee->advertised);
|
tp->eee_adv_t = ethtool_adv_to_mmd_eee_adv_t(eee->advertised);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (tp->eee_enabled)
|
if (tp->eee_enabled)
|
||||||
rtl8168_enable_EEE(tp);
|
rtl8168_enable_EEE(tp);
|
||||||
|
|||||||
Reference in New Issue
Block a user