[realtek] Implementing set_mac_address for the rtl8139 driver?

Ben Greear greearb@candelatech.com
Thu, 04 Jan 2001 00:45:04 -0700


I tried adding a mac_setting method like this:



static int rtl8139_set_eth_mac_addr(struct net_device *dev, void *p)
{
        struct sockaddr *addr=p;
        int i;
        long ioaddr = dev->base_addr;
    
        if (netif_running(dev)) {
                return -EBUSY;
        }
        memcpy(dev->dev_addr, addr->sa_data,dev->addr_len);

        for (i = 0; i < 6; i++) {
                outb(dev->dev_addr[i], ioaddr + MAC0 + i);
        }

        return 0;
}


But, it worked no better than the default which didn't try to poke
anything into the driver...


Here is some diags (at this point, I've run these commands):
	ifconfig eth1 down
	ifconfig eth1 hw ether 00:48:54:85:2F:BB
	ifconfig eth1 up

	(Tried to ping various different ways...didn't work.)
	(Set to promisc mode, pings started working immediately...)

	
NOTE:  The Station Addresses (RAM, I'm hoping), have some added
space around them for readability.

NOTE2:  I'm using source-based routing, and the ping command:
ping -I eth1 192.168.10.121 to ping my other node.
I watched the interfaces with tcpdump to verify packet activity
on the correct interface.


[root@candle /root]# ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 00:48:54:85:2F:BB  
          inet addr:192.168.10.98  Bcast:192.168.10.255  Mask:255.255.255.0
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:1099 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1004 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:200 
          Interrupt:5 Base address:0xe00 

[root@candle /root]# ifconfig eth2
eth2      Link encap:Ethernet  HWaddr 00:48:54:89:F2:6B  
          inet addr:192.168.10.125  Bcast:192.168.10.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:142 errors:0 dropped:0 overruns:0 frame:0
          TX packets:236 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:200 
          Interrupt:11 Base address:0x2d00 

[root@candle /root]# rtl8139-diag 
rtl8139-diag.c:v2.00 4/19/2000 Donald Becker (becker@scyld.com)
 http://www.scyld.com/diag/index.html
Index #1: Found a RealTek RTL8139 adapter at 0xe400.
EEPROM size test returned 6, 0x204a4 / 0x2.
Index #2: Found a RealTek RTL8139 adapter at 0xe000.
EEPROM size test returned 6, 0x204a4 / 0x2.
 Use '-a' or '-aa' to show device registers,
     '-e' to show EEPROM contents, -ee for parsed contents,
  or '-m' or '-mm' to show MII management registers.
[root@candle /root]# rtl8139-diag -aa -ee -mm -f
rtl8139-diag.c:v2.00 4/19/2000 Donald Becker (becker@scyld.com)
 http://www.scyld.com/diag/index.html
Index #1: Found a RealTek RTL8139 adapter at 0xe400.
RealTek chip registers at 0xe400
 0x000: 85544800 0000b82f ffffffff ffffffff 0008a062 0008a062 0008a062 0008a062
 0x020: 0694c000 0694c600 0694cc00 0694d200 06350000 0d0a0000 04440434 0000c07f
 0x040: 78000600 0000d68f 330ac2a3 00000000 006c10c6 00000000 0088c100 00100000
 0x060: 1100f00f 01e1782d 000145e1 00000000 00000004 000307c8 58fab388 ad38d843.
  No interrupt sources are pending.
 The chip configuration is 0x10 0x6c, MII full-duplex mode.
EEPROM size test returned 6, 0x204a4 / 0x2.
Parsing the EEPROM of a RealTek chip:
  PCI IDs -- Vendor 0x10ec, Device 0x8139, Subsystem 0x10ec.
  PCI timer settings -- minimum grant 32, maximum latency 64.
  General purpose pins --  direction 0xe1  value 0x12.


  Station Address 00:48:54:85:2F:B8.


  Configuration register 0/1 -- 0x8d / 0xc2.
 EEPROM active region checksum is 09c7.
EEPROM contents:
  8129 10ec 8139 10ec 8139 4020 e112 4800
  8554 b82f 8d10 f7c2 8801 b388 58fa 8708
  d843 ad38 d843 ad38 d843 ad38 d843 ad38
  0000 0000 0000 0000 0000 0000 0000 0000
  0000 0000 0000 0000 0000 0000 0000 0000
  0000 0000 0000 0000 0000 0000 0000 0000
  0000 0000 0000 0000 0000 0000 0000 0000
  0000 0000 0000 0000 0000 0000 0000 0000
 The word-wide EEPROM checksum is 0x0271.
Index #2: Found a RealTek RTL8139 adapter at 0xe000.
RealTek chip registers at 0xe000
 0x000: 89544800 00006bf2 80000000 00000000 0008a103 0008a0fd 0008a103 0008a0fd
 0x020: 0642a000 0642a600 0642ac00 0642b200 06920000 0d0a0000 36783668 0000c07f
 0x040: 74000600 0000d68e 330e222e 00000000 006c10c6 00000000 0088c110 00100000
 0x060: 1100f00f 01e1782d 000145e1 00000000 00000004 000207c8 b0f243b9 8a36df43.
  No interrupt sources are pending.
 The chip configuration is 0x10 0x6c, MII full-duplex mode.
EEPROM size test returned 6, 0x204a4 / 0x2.
Parsing the EEPROM of a RealTek chip:
  PCI IDs -- Vendor 0x10ec, Device 0x8139, Subsystem 0x10ec.
  PCI timer settings -- minimum grant 32, maximum latency 64.
  General purpose pins --  direction 0xe1  value 0x12.


  Station Address 00:48:54:89:F2:6B.


  Configuration register 0/1 -- 0x8d / 0xc2.
 EEPROM active region checksum is 0a41.
EEPROM contents:
  8129 10ec 8139 10ec 8139 4020 e112 4800
  8954 6bf2 8d10 f7c2 8801 43b9 b0f2 031a
  df43 8a36 df43 8a36 43b9 b0f2 1111 1111
  0000 0000 0000 0000 0000 0000 0000 0000
  0000 0000 0000 0000 0000 0000 0000 0000
  0000 0000 0000 0000 0000 0000 0000 0000
  0000 0000 0000 0000 0000 0000 0000 0000
  0000 0000 0000 0000 0000 0000 0000 0000
 The word-wide EEPROM checksum is 0xf242.
[root@candle /root]# 


Thanks,
Ben


-- 
Ben Greear (greearb@candelatech.com)  http://www.candelatech.com
Author of ScryMUD:  scry.wanfear.com 4444        (Released under GPL)
http://scry.wanfear.com               http://scry.wanfear.com/~greear