如何将Link Code Word (Fast Link Pulse)包抓住?如使用ethereal?以判断目标机是否和远端hub进行协商?代码部分如下:
// Copy our capabilities from PHY_STAT_REG to PHY_AD_REG
my_phy_caps = ReadPhyReg(*pphyaddr, PHY_STAT_REG);
my_ad_caps = PHY_AD_CSMA;// I am CSMA capable
my_self_caps = 0;
if (my_phy_caps & PHY_STAT_CAP_T4)
my_ad_caps |= PHY_AD_T4;
if (my_phy_caps & PHY_STAT_CAP_TXF)
my_ad_caps |= PHY_AD_TX_FDX;
if (my_phy_caps & PHY_STAT_CAP_TXH)
my_ad_caps |= PHY_AD_TX_HDX;
if (my_phy_caps & PHY_STAT_CAP_TF)
my_ad_caps |= PHY_AD_10_FDX;
if (my_phy_caps & PHY_STAT_CAP_TH)
my_ad_caps |= PHY_AD_10_HDX;
/*
if(my_phy_caps & (PHY_STAT_CAP_T4 |PHY_STAT_CAP_TXF |
PHY_STAT_CAP_TXH))
my_self_caps |= PHY_CNTL_SPEED;
if(my_phy_caps & (PHY_STAT_CAP_TXF | PHY_STAT_CAP_TF))
my_self_caps |= PHY_CNTL_DPLX;
*/
// Update our Auto-Neg Advertisement Register
WritePhyReg(*pphyaddr, PHY_AD_REG, my_ad_caps);
PRINTK("%s:phy caps=%xn", CARDNAME, my_phy_caps);
PRINTK("%s:phy advertised caps=%xn", CARDNAME, my_ad_caps);
// Restart auto-negotiation process in order to advertise my caps
WritePhyReg(*pphyaddr, PHY_CNTL_REG,
PHY_CNTL_ANEG_EN | PHY_CNTL_ANEG_RST);
// Wait for the auto-negotiation to complete. This may take from
// 2 to 3 seconds.
// Wait for the reset to complete, or time out
timeout = 5;// Wait up to 10 seconds
while (timeout--) {
status = ReadPhyReg(*pphyaddr, PHY_STAT_REG);
if (status & PHY_STAT_ANEG_ACK) {
// auto-negotiate complete
break;
}
Delay(1);
// Restart auto-negotiation if remote fault
if (status & PHY_STAT_REM_FLT) {
PRINTK("%s:PHY remote fault detectednn", CARDNAME);
// Restart auto-negotiation
PRINTK("%s:PHY restarting auto-negotiationn",
CARDNAME);
WritePhyReg(*pphyaddr, PHY_CNTL_REG,
PHY_CNTL_ANEG_EN |
PHY_CNTL_ANEG_RST |
PHY_CNTL_SPEED | PHY_CNTL_DPLX);
}
}
但是始终是超时失败的,网线正常直连模式。
|
不是有个mii_check_media吗?
你那个等待时间搞的太奇怪了,
timeout = 5; // Wait up to 10 seconds
while (timeout--) {
status = ReadPhyReg(*pphyaddr, PHY_STAT_REG);
if (status & PHY_STAT_ANEG_ACK) {
// auto-negotiate complete
break;
}
总共几十条指令的时间,这不一下子就结束了吗?