On Tue, Nov 08, 2005 at 11:43:54AM -0800, Don Fry wrote:
> This patch contains code from Thomas Bogendoerfer which I have modified
> somewhat.  It works fine for me in my testing, but I would like
> additional exposure to this code before submitting to mainline.
> It should fix bugzilla bug #4219 as well.

Is it necessary to maintain special cases for the single-PHY
configurations?  What would be the effect of folding the single-PHY
situation into the multi-PHY handling code?

John

> @@ -936,9 +941,23 @@ static int pcnet32_phys_id(struct net_de
>      return 0;
>  }
>  
> +#define PCNET32_REGS_PER_PHY 32
> +#define PCNET32_MAX_PHYS     32
>  static int pcnet32_get_regs_len(struct net_device *dev)
>  {
> -    return(PCNET32_NUM_REGS * sizeof(u16));
> +    struct pcnet32_private *lp = dev->priv;
> +    int j = 0;
> +
> +    if (lp->multiphymask) {
> +     int i;
> +
> +     for (i=0; i<PCNET32_MAX_PHYS; i++)
> +         if (lp->multiphymask & (1 << i))
> +             j += PCNET32_REGS_PER_PHY;
> +    } else if (lp->mii) {
> +     j = PCNET32_REGS_PER_PHY;
> +    }
> +    return((PCNET32_NUM_REGS + j) * sizeof(u16));
>  }
>  
>  static void pcnet32_get_regs(struct net_device *dev, struct ethtool_regs 
> *regs,
> @@ -998,9 +1017,21 @@ static void pcnet32_get_regs(struct net_
>  
>      /* read mii phy registers */
>      if (lp->mii) {
> -     for (i=0; i<32; i++) {
> -         lp->a.write_bcr(ioaddr, 33, ((lp->mii_if.phy_id) << 5) | i);
> -         *buff++ = lp->a.read_bcr(ioaddr, 34);
> +     if (lp->multiphymask) {
> +         int j;
> +         for (j=0; j<PCNET32_MAX_PHYS; j++) {
> +             if (lp->multiphymask & (1 << j)) {
> +                 for (i=0; i<PCNET32_REGS_PER_PHY; i++) {
> +                     lp->a.write_bcr(ioaddr, 33, (j << 5) | i);
> +                     *buff++ = lp->a.read_bcr(ioaddr, 34);
> +                 }
> +             }
> +         }
> +     } else {
> +         for (i=0; i<PCNET32_REGS_PER_PHY; i++) {
> +             lp->a.write_bcr(ioaddr, 33, ((lp->mii_if.phy_id) << 5) | i);
> +             *buff++ = lp->a.read_bcr(ioaddr, 34);
> +         }
>       }
>      }
>  

-- 
John W. Linville
[EMAIL PROTECTED]
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to