Bug 35900

Summary: Changing RealTek 8139 MAC address fails
Product: Base System Reporter: Mark Kettenis <kettenis>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.4-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Mark Kettenis 2002-03-14 21:50:00 UTC
	Changing the MAC address for my Sitecom PCI ethernet card,
        which is based on the RealTek 8139 chipset, doesn't work.
        Apparently the MAC address isn't actually changed in the
        hardware.  Since the MAC address used by the kernel does get
	changed, outgoing packets are sent with the new MAC address.
        Any reply-packets will therefore be dropped by the hardware,
        and never reach the kernel's networking code unless the
        interface is placed in promiscuous mode.

Fix: Apparently one has to enter "Config register write enable"
        mode to be able to write the MAC address into the appropriate
        hardware registers; the chipset documentation doesn't mention
        this, but the Linux driver does the same thing.

	The attached patch fixes the problem.  This patch is against
	4.4-RELEASE, but should apply fine to 5.0-CURRENT just as
	well.  The patch also changes the write access to the ID
	registers (whih contain the MAC address) from single-byte
	access to 4-byte access (which is what the chipset
	documentation demands).  The way I implemented this is a bit
	of a hack (since ac_enaddr is only 6 bytes long) but there are
	several drivers that use similar code.

	It would be great if this patch, or something similar, would
	be applied and end up in -STABLE someday.
How-To-Repeat: 	Enter the command:

	# ifconfig rl0 ether xx:xx:xx:xx:xx:xx

	And try to ping another host that would be reached through the
        rl0 interface.  It won't work unless the interface is placed in
	promiscuous mode.
Comment 1 Bill Paul freebsd_committer freebsd_triage 2003-06-29 18:35:41 UTC
State Changed
From-To: open->closed

Patch tested good with 8139B cardbus NIC, applied to -current. 
-Bill