EtherLinkCallback doesn't execute on ethernet down

Discussion to talk about software related topics only.
Post Reply
John.Ohl
Posts: 20
Joined: Mon Dec 03, 2012 7:00 pm

EtherLinkCallback doesn't execute on ethernet down

Post by John.Ohl »

Using MOD5270, if you set the EtherLinkCallback in the start of the main function or anywhere else for that matter, it appears to never be executed when the ethernet link goes down.

Looking @ ethernet.cpp I am assuming it's because @ line 239 bEthLink is set to false, and the function is only called if it was set to true. Moving line 239 after the callback is executed solves the problem.

Before:

Code: Select all

      ...
      else // There was no link detected
      {
         bEthLink = FALSE;
         if( PHY_OUI_ID == DAVICOM_OUI_ID )
         {
            sim.fec.mdata = phy_read_mdata11; // Set to have read Davicom reg 0x11 in next check for parallel link fault ( Gigabit negotiation fix )
            last_phy_read = 0x11;
         }
         else
         {
            sim.fec.mdata = phy_read_mdata1; // Set to read phy reg 1 for next link check
            last_phy_read = 1;
         }
         if (bEthLink && EtherLinkCallback)
         {
            (*EtherLinkCallback)(FALSE);
         }
      }
      ...
After:

Before:

Code: Select all

      ...
      else // There was no link detected
      {
         if( PHY_OUI_ID == DAVICOM_OUI_ID )
         {
            sim.fec.mdata = phy_read_mdata11; // Set to have read Davicom reg 0x11 in next check for parallel link fault ( Gigabit negotiation fix )
            last_phy_read = 0x11;
         }
         else
         {
            sim.fec.mdata = phy_read_mdata1; // Set to read phy reg 1 for next link check
            last_phy_read = 1;
         }
         if (bEthLink && EtherLinkCallback)
         {
            (*EtherLinkCallback)(FALSE);
         }
         bEthLink = FALSE;
      }
      ...
User avatar
dciliske
Posts: 624
Joined: Mon Feb 06, 2012 9:37 am
Location: San Diego, CA
Contact:

Re: EtherLinkCallback doesn't execute on ethernet down

Post by dciliske »

Well... that shouldn't be there... actually, the correct thing to do is to remove the check for link status from the condition (like it is on the 54415 parts). This has now been fixed.

-Dan
Dan Ciliske
Project Engineer
Netburner, Inc
Post Reply