netdev
[Top] [All Lists]

Re: Setting MAC addr on ethernet cards?

To: Ben Greear <greearb@xxxxxxxxxxxxxxx>
Subject: Re: Setting MAC addr on ethernet cards?
From: Philip Blundell <Philip.Blundell@xxxxxxxxx>
Date: Sun, 27 Feb 2000 11:27:15 +0000
Cc: "netdev@xxxxxxxxxxx" <netdev@xxxxxxxxxxx>
In-reply-to: Message from Ben Greear <greearb@xxxxxxxxxxxxxxx> of "Sat, 26 Feb 2000 18:09:41 MST." <38B87955.B545160A@xxxxxxxxxxxxxxx>
References: <38B87955.B545160A@xxxxxxxxxxxxxxx>
Sender: owner-netdev@xxxxxxxxxxx
>Was this not implemented in these drivers because the hardware
>doesn't support it, or just because the coders didn't get around
>to it?

The latter.  Virtually all cards allow you to set the MAC address; the Tulip 
and RTL8319 certainly do.

>If it's the latter, anyone wanna volunteer a patch? :)

Well, the API is a little sketchy at the moment.  There is a dev->
set_mac_address method in the device structure, which is what ifconfig uses.  
Currently this is initialised to `eth_mac_addr', which copies the new MAC 
address into dev->dev_addr (so it will be used on outgoing frames) but doesn't 
call the driver to actually reconfigure the receive filter.

The thing to do, probably, is have the driver override dev->set_mac_address to 
point to a new function of its own which does both of these tasks.  You can 
copy eth_mac_addr's code; it's in drivers/net/net_init.c.  The code to 
actually change the hardware settings can be cribbed from the driver's `open' 
method for both the cards you mentioned.

p.



<Prev in Thread] Current Thread [Next in Thread>