Commit b6760017 authored by Alessandro Rubini's avatar Alessandro Rubini Committed by Grzegorz Daniluk

userspace/hal: save port's MAC address to shmem

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 01a0ac34
...@@ -74,7 +74,7 @@ static void hal_port_reset_state(struct hal_port_state * p) ...@@ -74,7 +74,7 @@ static void hal_port_reset_state(struct hal_port_state * p)
} }
/* checks if the port is supported by the FPGA firmware */ /* checks if the port is supported by the FPGA firmware */
static int hal_port_check_presence(const char *if_name) static int hal_port_check_presence(const char *if_name, unsigned char *mac)
{ {
struct ifreq ifr; struct ifreq ifr;
...@@ -82,7 +82,7 @@ static int hal_port_check_presence(const char *if_name) ...@@ -82,7 +82,7 @@ static int hal_port_check_presence(const char *if_name)
if (ioctl(hal_port_fd, SIOCGIFHWADDR, &ifr) < 0) if (ioctl(hal_port_fd, SIOCGIFHWADDR, &ifr) < 0)
return 0; return 0;
memcpy(mac, ifr.ifr_hwaddr.sa_data, ETH_ALEN);
return 1; return 1;
} }
...@@ -112,7 +112,7 @@ static int hal_port_init(int index) ...@@ -112,7 +112,7 @@ static int hal_port_init(int index)
strncpy(p->name, name, 16); strncpy(p->name, name, 16);
/* check if the port is built into the firmware, if not, we are done */ /* check if the port is built into the firmware, if not, we are done */
if (!hal_port_check_presence(name)) if (!hal_port_check_presence(name, p->hw_addr))
return -1; return -1;
p->state = HAL_PORT_STATE_DISABLED; p->state = HAL_PORT_STATE_DISABLED;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment