[realtek] Apparent bug in real8139-diag.c

Andy McLeod andy.mcleod@alivero.com
Thu Mar 21 10:01:01 2002


I'm no c programmer, nor ethernet driver expert so please forgive errors,
but:-

1. There have been several posts to this list using output from the
real8139-diag utility (with -mm flags) that show bizarre outputs (e.g. all
zeros) in the output lines generated from libmii (which interpret the
register values), and have led to lots of confusion.

2. It is possible to get discrepant results in the lines output by the
utility, and the interpretation given by libmii.c, where in one place the
Basic mode control register is listed as eg 0x2100 and later listed as
0x0000.

These two facts seem to be due to a bug in the code handling the case of
multiple transceivers. My interpretation is the lines below shouldn't get
called in this case, but they do. And with the value of -1 instead of a
valid pointer to a PHY all the outputs are screwed up.

   if (show_mii > ) {
      show_mii_details(ioaddr, -1);
      if (show_mii > 2) monitor_mii(ioaddr, 32);
   }

I changed the -1 to 32 and the outputs all started making sense (except they
are all tagged with a MII PHY #32)

Now I can't explain this or say if it is the right fix (I don't feel it is,
I suspect the problem is that it is using the wrong bit of code).

So over to the guys that know for a proper fix. In the meantime, my advice
is don't rely on the outputs of this utility is you see it reporting things
like "Basic mode control register 0x0000:......".

rgds/andy