[PATCH] Re: Setting MAC address in ewrk3 driver

From: Adam Kropelin (akropel1@rochester.rr.com)
Date: Thu Nov 21 2002 - 20:30:04 EST


On Thu, Nov 21, 2002 at 07:02:32PM -0500, Jeff Garzik wrote:
> Alan Cox wrote:
>
> >On Thu, 2002-11-21 at 23:39, Adam Kropelin wrote:
> >
> >>Alan, could you clarify for me? I'm the last guy to diddle with ewrk3 so
> >>I'll track this down if there is indeed something to track down. ewrk3
> >>has a private ioctl for setting the mac address. By the "up" method do
> >>you mean the etherdev open method? Should there be a standard ioctl
> >>implemented for setting the mac address?
> >
> >
> >dev->set_mac_address()
>
> To be more specific:
>
> Read the MAC address in the probe phase.
> Write MAC address to NIC on _each_ dev->open().

Got it. Quick patch below. Works for me (TM). Against recent 2.5 but
should apply to 2.4 with offsets.

Neil, does this work for you?

> If you care about changing the MAC address while interface is up,
> implement dev->set_mac_address().

Sounds like that is best avoided unless someone specifically needs it.
Even then it'll get implemented as a close/open sequence internally
anyway, so there's not much point.

--Adam

--- linux-2.5.47/drivers/net/ewrk3.c.orig Thu Nov 21 20:24:00 2002
+++ linux-2.5.47/drivers/net/ewrk3.c Thu Nov 21 20:22:24 2002
@@ -712,6 +712,7 @@
         struct ewrk3_private *lp = (struct ewrk3_private *) dev->priv;
         u_char csr, page;
         u_long iobase = dev->base_addr;
+ int i;
 
         /*
            ** Enable any multicasts
@@ -719,6 +720,13 @@
         set_multicast_list(dev);
 
         /*
+ ** Set hardware MAC address. Address is initialized from the EEPROM
+ ** during startup but may have since been changed by the user.
+ */
+ for (i=0; i<ETH_ALEN; i++)
+ outb(dev->dev_addr[i], EWRK3_PAR0 + i);
+
+ /*
            ** Clean out any remaining entries in all the queues here
          */
         while (inb(EWRK3_TQ));

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Nov 23 2002 - 22:00:39 EST