Setting MAC address in ewrk3 driver
Hi,
I think I may have found a bug in the ewrk3 network driver. When I try to change the MAC address of a Digital DE205 NIC using "ifconfig eth0 hw ether XX:XX:XX:XX:XX:XX", it appears to work ("ifconfig eth0" reports the new address), but in fact it isn't sending or receiving packets any more. I'm using kernel version 2.4.10.
I've tried this with the same result in two machines using different DE205 cards. I have changed the MAC address of other types of NICs without problems, so I don't think it's something silly like an ARP problem.
I tried to report this to the driver author, David Davies, but the address given in the driver bounced. Please CC any responses to me, since I'm not subscribed to the list.
Regards,
Neil Cafferkey
Quoted 7 lines · Neil Cafferkey
Hi,
I think I may have found a bug in the ewrk3 network driver. When I try to change the MAC address of a Digital DE205 NIC using "ifconfig eth0 hw ether XX:XX:XX:XX:XX:XX", it appears to work ("ifconfig eth0" reports the new address), but in fact it isn't sending or receiving packets any more. I'm using kernel version 2.4.10.
The default handler assumes the card mac address is set by the "up" method. That driver is old enough it may not do so.
Quoted 11 lines · Alan Cox
Quoted 7 lines · Neil Cafferkey
Hi,
I think I may have found a bug in the ewrk3 network driver. When I try to change the MAC address of a Digital DE205 NIC using "ifconfig eth0 hw ether XX:XX:XX:XX:XX:XX", it appears to work ("ifconfig eth0" reports the new address), but in fact it isn't sending or receiving packets any more. I'm using kernel version 2.4.10.
The default handler assumes the card mac address is set by the "up" method. That driver is old enough it may not do so.
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?
--Adam
Quoted 5 lines · Adam Kropelin
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()
Quoted 7 lines · Neil Cafferkey
Hi,
I think I may have found a bug in the ewrk3 network driver. When I try to change the MAC address of a Digital DE205 NIC using "ifconfig eth0 hw ether XX:XX:XX:XX:XX:XX", it appears to work ("ifconfig eth0" reports the new address), but in fact it isn't sending or receiving packets any more. I'm using kernel version 2.4.10.
Try the driver from 2.4.20-rc2. There are some locking updates in the ioctl code for setting the hw address. I'm running 2.5 (approx same driver as 2.4.20-rc2) here and I observe that the address really does change (i.e. I see packets on the wire with the new MAC addr) but the kernel oopses shortly thereafter somewhere in the network stack. I'm blaming this on 2.5 instability for the moment but will fix it if it turns out to be ewrk3's fault.
--Adam
Quoted 10 lines · Alan Cox
Quoted 5 lines · Adam Kropelin
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().
If you care about changing the MAC address while interface is up, implement dev->set_mac_address().
So, dev->set_mac_address() is pretty useless, when you can just tell users "down the interface before setting MAC address" which is a sane thing to do anyway, and much less complicated.
Jeff
Quoted 11 lines · Jeff Garzik
Quoted 9 lines · Alan Cox
Quoted 5 lines · Adam Kropelin
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?
Quoted 6 lines
Quoted 1 line
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?
Quoted 2 lines
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
drivers/net/ewrk3.c renamed from drivers/net/ewrk3.c.orig +8 -0
@@ -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 ));
Quoted 5 lines · Adam Kropelin
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?
Yes, it works fine with 2.4.19. Thanks a lot. Sorry for the delay, but I didn't have the opportunity to test it for a few days.
Regards,
Neil Cafferkey