diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2006-05-14 23:39:47 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-05-19 00:35:26 -0400 |
commit | 07fb3f454cc9e0f656e378a6feb5bdd6cac4bd41 (patch) | |
tree | 5a754125950cb7ccb4029fc61748e1b171a7920a /drivers/net/iseries_veth.c | |
parent | d6b89a196dfb03fdfbe3d574ab6773fe14a1d2c6 (diff) |
[PATCH] powerpc: update iseries_veth device-tree information
Make the device-tree information more generic and more
like the pSeries virtual lan device. Also use the MAC
address from the device tree.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers/net/iseries_veth.c')
-rw-r--r-- | drivers/net/iseries_veth.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c index f0f04be989d6..93394d76587a 100644 --- a/drivers/net/iseries_veth.c +++ b/drivers/net/iseries_veth.c | |||
@@ -69,6 +69,7 @@ | |||
69 | #include <linux/delay.h> | 69 | #include <linux/delay.h> |
70 | #include <linux/mm.h> | 70 | #include <linux/mm.h> |
71 | #include <linux/ethtool.h> | 71 | #include <linux/ethtool.h> |
72 | #include <linux/if_ether.h> | ||
72 | 73 | ||
73 | #include <asm/abs_addr.h> | 74 | #include <asm/abs_addr.h> |
74 | #include <asm/iseries/mf.h> | 75 | #include <asm/iseries/mf.h> |
@@ -1035,11 +1036,22 @@ static struct ethtool_ops ops = { | |||
1035 | .get_link = veth_get_link, | 1036 | .get_link = veth_get_link, |
1036 | }; | 1037 | }; |
1037 | 1038 | ||
1038 | static struct net_device * __init veth_probe_one(int vlan, struct device *vdev) | 1039 | static struct net_device * __init veth_probe_one(int vlan, |
1040 | struct vio_dev *vio_dev) | ||
1039 | { | 1041 | { |
1040 | struct net_device *dev; | 1042 | struct net_device *dev; |
1041 | struct veth_port *port; | 1043 | struct veth_port *port; |
1044 | struct device *vdev = &vio_dev->dev; | ||
1042 | int i, rc; | 1045 | int i, rc; |
1046 | const unsigned char *mac_addr; | ||
1047 | |||
1048 | mac_addr = vio_get_attribute(vio_dev, "local-mac-address", NULL); | ||
1049 | if (mac_addr == NULL) | ||
1050 | mac_addr = vio_get_attribute(vio_dev, "mac-address", NULL); | ||
1051 | if (mac_addr == NULL) { | ||
1052 | veth_error("Unable to fetch MAC address from device tree.\n"); | ||
1053 | return NULL; | ||
1054 | } | ||
1043 | 1055 | ||
1044 | dev = alloc_etherdev(sizeof (struct veth_port)); | 1056 | dev = alloc_etherdev(sizeof (struct veth_port)); |
1045 | if (! dev) { | 1057 | if (! dev) { |
@@ -1064,16 +1076,11 @@ static struct net_device * __init veth_probe_one(int vlan, struct device *vdev) | |||
1064 | } | 1076 | } |
1065 | port->dev = vdev; | 1077 | port->dev = vdev; |
1066 | 1078 | ||
1067 | dev->dev_addr[0] = 0x02; | 1079 | memcpy(dev->dev_addr, mac_addr, ETH_ALEN); |
1068 | dev->dev_addr[1] = 0x01; | ||
1069 | dev->dev_addr[2] = 0xff; | ||
1070 | dev->dev_addr[3] = vlan; | ||
1071 | dev->dev_addr[4] = 0xff; | ||
1072 | dev->dev_addr[5] = this_lp; | ||
1073 | 1080 | ||
1074 | dev->mtu = VETH_MAX_MTU; | 1081 | dev->mtu = VETH_MAX_MTU; |
1075 | 1082 | ||
1076 | memcpy(&port->mac_addr, dev->dev_addr, 6); | 1083 | memcpy(&port->mac_addr, mac_addr, ETH_ALEN); |
1077 | 1084 | ||
1078 | dev->open = veth_open; | 1085 | dev->open = veth_open; |
1079 | dev->hard_start_xmit = veth_start_xmit; | 1086 | dev->hard_start_xmit = veth_start_xmit; |
@@ -1608,7 +1615,7 @@ static int veth_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
1608 | struct net_device *dev; | 1615 | struct net_device *dev; |
1609 | struct veth_port *port; | 1616 | struct veth_port *port; |
1610 | 1617 | ||
1611 | dev = veth_probe_one(i, &vdev->dev); | 1618 | dev = veth_probe_one(i, vdev); |
1612 | if (dev == NULL) { | 1619 | if (dev == NULL) { |
1613 | veth_remove(vdev); | 1620 | veth_remove(vdev); |
1614 | return 1; | 1621 | return 1; |
@@ -1641,7 +1648,7 @@ static int veth_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
1641 | * support. | 1648 | * support. |
1642 | */ | 1649 | */ |
1643 | static struct vio_device_id veth_device_table[] __devinitdata = { | 1650 | static struct vio_device_id veth_device_table[] __devinitdata = { |
1644 | { "vlan", "" }, | 1651 | { "network", "IBM,iSeries-l-lan" }, |
1645 | { "", "" } | 1652 | { "", "" } |
1646 | }; | 1653 | }; |
1647 | MODULE_DEVICE_TABLE(vio, veth_device_table); | 1654 | MODULE_DEVICE_TABLE(vio, veth_device_table); |