Esempio n. 1
0
static int hieth_net_set_mac_address(struct net_device *dev, void *p)
{
	struct hieth_netdev_local *ld = netdev_priv(dev);
	struct sockaddr *skaddr = p;

	if (netif_running(dev))
		return -EBUSY;
	if (!is_valid_ether_addr(skaddr->sa_data))
		return -EADDRNOTAVAIL;

	local_lock(ld);

	if (hieth_devs_save[UP_PORT])
		memcpy(hieth_devs_save[UP_PORT]->dev_addr,
				skaddr->sa_data, dev->addr_len);
	if (hieth_devs_save[DOWN_PORT])
		memcpy(hieth_devs_save[DOWN_PORT]->dev_addr,
				skaddr->sa_data, dev->addr_len);

	local_unlock(ld);

	hieth_hw_set_macaddress(ld, 1, dev->dev_addr);

	return 0;
}
Esempio n. 2
0
File: net.c Progetto: jorneytu/code
static int hieth_net_set_mac_address(struct net_device *dev, void *p)
{
	struct hieth_netdev_local *ld = netdev_priv(dev);
	struct sockaddr *skaddr = p;

	local_lock(ld);

	if (hieth_devs_save[UP_PORT])
		memcpy(hieth_devs_save[UP_PORT]->dev_addr,
				skaddr->sa_data, dev->addr_len);
	if (hieth_devs_save[DOWN_PORT])
		memcpy(hieth_devs_save[DOWN_PORT]->dev_addr,
				skaddr->sa_data, dev->addr_len);

	local_unlock(ld);

	hieth_hw_set_macaddress(ld, 1, dev->dev_addr);

	return 0;
}
Esempio n. 3
0
File: net.c Progetto: jorneytu/code
static int hieth_plat_driver_resume_port(struct platform_device *pdev, \
		int port)
{
	struct hieth_netdev_local *ld;
	struct net_device *ndev = hieth_devs_save[port];

	if (ndev) {
		ld = netdev_priv(ndev);

		/* restore local host mac */
		hieth_hw_set_macaddress(ld, 1, ndev->dev_addr);

		/* reset and init port */
		hieth_port_reset(ld, ld->port);
		hieth_port_init(ld, ld->port);

		netif_device_attach(ndev);
		hieth_net_open(ndev);
	}

	return 0;
}