aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pasemi_mac.c
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2008-01-23 14:56:19 -0500
committerDavid S. Miller <davem@davemloft.net>2008-02-03 07:27:53 -0500
commit5cea73b0f7d4d49e276b0c4842465890d00de861 (patch)
tree9d46b61c0c050942a4df9e7dd68c796016ddb746 /drivers/net/pasemi_mac.c
parentc88559539bd16eae4e9056d4734b3fe8a9858c45 (diff)
pasemi_mac: Add support for changing mac address
Straightforward. It used to be hardcoded and impossible to override with ifconfig. Signed-off-by: Olof Johansson <olof@lixom.net> Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/pasemi_mac.c')
-rw-r--r--drivers/net/pasemi_mac.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index bb88a41b7591..59dea3f829fc 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -221,6 +221,33 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
221 return 0; 221 return 0;
222} 222}
223 223
224static int pasemi_mac_set_mac_addr(struct net_device *dev, void *p)
225{
226 struct pasemi_mac *mac = netdev_priv(dev);
227 struct sockaddr *addr = p;
228 unsigned int adr0, adr1;
229
230 if (!is_valid_ether_addr(addr->sa_data))
231 return -EINVAL;
232
233 memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
234
235 adr0 = dev->dev_addr[2] << 24 |
236 dev->dev_addr[3] << 16 |
237 dev->dev_addr[4] << 8 |
238 dev->dev_addr[5];
239 adr1 = read_mac_reg(mac, PAS_MAC_CFG_ADR1);
240 adr1 &= ~0xffff;
241 adr1 |= dev->dev_addr[0] << 8 | dev->dev_addr[1];
242
243 pasemi_mac_intf_disable(mac);
244 write_mac_reg(mac, PAS_MAC_CFG_ADR0, adr0);
245 write_mac_reg(mac, PAS_MAC_CFG_ADR1, adr1);
246 pasemi_mac_intf_enable(mac);
247
248 return 0;
249}
250
224static int get_skb_hdr(struct sk_buff *skb, void **iphdr, 251static int get_skb_hdr(struct sk_buff *skb, void **iphdr,
225 void **tcph, u64 *hdr_flags, void *data) 252 void **tcph, u64 *hdr_flags, void *data)
226{ 253{
@@ -1475,6 +1502,7 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1475 dev->stop = pasemi_mac_close; 1502 dev->stop = pasemi_mac_close;
1476 dev->hard_start_xmit = pasemi_mac_start_tx; 1503 dev->hard_start_xmit = pasemi_mac_start_tx;
1477 dev->set_multicast_list = pasemi_mac_set_rx_mode; 1504 dev->set_multicast_list = pasemi_mac_set_rx_mode;
1505 dev->set_mac_address = pasemi_mac_set_mac_addr;
1478 1506
1479 if (err) 1507 if (err)
1480 goto out; 1508 goto out;