Author Topic: How can I negotiate low speed first?  (Read 4656 times)

Offline alager

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
How can I negotiate low speed first?
« on: February 18, 2009, 07:27:31 PM »
For the freescale chips there is a 100mW power savings if 10M lan speed is selected over 100M.  The typical protocol for selecting speeds is to negotiate the highest speed possible, and only go slower when that fails.

But from a "green" point of view I can save 100mW if I go for 10M first.  How can the order be changed, such that first 10M is tried, then if that fails (maybe the user only has 100/1000 hubs) it tries 100M?

Are there some other gotchas that I'm not aware of, or need to consider when changing the order?
Our little server doesn't need 100M speed or capacity, so that won't be an issue.

Thanks,
Aaron

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3191
    • View Profile
    • uTasker
Re: How can I negotiate low speed first?
« Reply #1 on: February 18, 2009, 09:03:18 PM »
Hi Aaron

It is true that there is a power saving when the network speed is reduced.
Auto-negotiation will however chose the fastest possible.

I would try setting 10M and, if no link after a delay, set 100M. The Ethernet configuration doesn't allow this to be called twice with different settings but it is quite easy to identify which settings are required for the second case and add a routine to specifically set the new speed.

regards

Mark

Offline alager

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
Re: How can I negotiate low speed first?
« Reply #2 on: February 18, 2009, 10:57:56 PM »
Mark,

Looking at the code below, once I call fnMIIwrite(), how would I know if link is established?
Code: [Select]
if (!(pars->usMode & (LAN_10M | LAN_100M))) {
      usMIIData |= PHY_R0_RAN;                                           // start autonegotiation
  }
  else {
      if (pars->usMode & FULL_DUPLEX) {
          usMIIData |= PHY_R0_DPLX;                                      // set full duplex operation
      }
      else {
          usMIIData &= ~PHY_R0_DPLX;                                     // set half-duplex operation
      }

      if (pars->usMode & LAN_100M) {
          usMIIData |= PHY_R0_DR;                                        // set manual 100Mb
      }
      else {
          usMIIData &= ~PHY_R0_DR;                                       // set manual 10Mb
      }
  }
  fnMIIwrite(PHY_ADDRESS, PHY_REG_CR, usMIIData);                        // command operating mode of PHY

Your system already seems to handle loosing link (hot unplug cable) and re-establishing link (hot plug cable).  Is this not configuring the PHY each time?

Since this Freescale chip can not be guaranteed to auto negotiate, I need a software solution anyway.   I know that's what the Internich folks ended up doing.   I figured I should just be able to change the order.

Thanks,
Aaron

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3191
    • View Profile
    • uTasker
Re: How can I negotiate low speed first?
« Reply #3 on: February 19, 2009, 10:52:13 PM »
Hi Aaron

There is no need to command the PHY when unplugging and plugging the cable. The PHY will detect this and simple give a link-up or link-down state, and reconnect on its own.

Check the PHY interrupt routine - it have an option to work with the NetIndicator task, which will receive link-up and link-down events (with speed). It can be used to control the Link and activity LEDs with SW, rather than letting the PHY do it itself (the M5223X PHY does it a bit fast and it is not always that visible). Check the Coldfire tutorial since this is explained a bit more there.

In any case, you can use these events (also routed to your own task if you want) to detect link up and down and then perform polling if it is taking too long.

Note that the new Kirin3 M5225x doesn't suffer from the auto-negotiation bug, but does require an external PHY. The external PHYs tend to be also lower power...

Good luck

regards

Mark