30 #include <linux/kernel.h>
31 #include <linux/module.h>
32 #include <linux/netdevice.h>
33 #include <linux/ethtool.h>
34 #include <linux/mii.h>
42 return mii_lpa_to_ethtool_lpa_t(advert);
58 u16 bmcr, bmsr, ctrl1000 = 0, stat1000 = 0;
94 mii_ctrl1000_to_ethtool_adv_t(ctrl1000);
99 mii_stat1000_to_ethtool_lpa_t(stat1000);
115 ethtool_cmd_speed_set(ecmd,
SPEED_10);
121 ethtool_cmd_speed_set(ecmd,
125 ((bmcr & BMCR_SPEED100) ?
147 u32 speed = ethtool_cmd_speed(ecmd);
170 u32 advert2 = 0, tmp2 = 0;
187 tmp |= ethtool_adv_to_mii_adv_t(ecmd->
advertising);
296 int prev_link = netif_carrier_ok(mii->
dev);
298 if (cur_link && !prev_link)
300 else if (prev_link && !cur_link)
314 unsigned int ok_to_print,
315 unsigned int init_media)
317 unsigned int old_carrier, new_carrier;
318 int advertise, lpa, media,
duplex;
326 old_carrier = netif_carrier_ok(mii->
dev) ? 1 : 0;
332 if ((!init_media) && (old_carrier == new_carrier))
339 netdev_info(mii->
dev,
"link down\n");
360 media = mii_nway_result(lpa & advertise);
366 netdev_info(mii->
dev,
"link up, %uMbps, %s-duplex, lpa 0x%04X\n",
370 duplex ?
"full" :
"half",
373 if ((init_media) || (mii->
full_duplex != duplex)) {
393 unsigned int *duplex_chg_out)
396 unsigned int duplex_changed = 0;
421 unsigned int new_duplex = 0;
454 if ((rc == 0) && (duplex_chg_out) && (duplex_changed))