Lines Matching refs:dev
46 void eth_set_dev(struct eth_device *dev) in eth_set_dev() argument
48 eth_current = dev; in eth_set_dev()
53 struct eth_device *dev, *target_dev; in eth_get_dev_by_name() local
60 dev = eth_devices; in eth_get_dev_by_name()
63 if (strcmp(devname, dev->name) == 0) { in eth_get_dev_by_name()
64 target_dev = dev; in eth_get_dev_by_name()
67 dev = dev->next; in eth_get_dev_by_name()
68 } while (dev != eth_devices); in eth_get_dev_by_name()
75 struct eth_device *dev, *target_dev; in eth_get_dev_by_index() local
80 dev = eth_devices; in eth_get_dev_by_index()
83 if (dev->index == index) { in eth_get_dev_by_index()
84 target_dev = dev; in eth_get_dev_by_index()
87 dev = dev->next; in eth_get_dev_by_index()
88 } while (dev != eth_devices); in eth_get_dev_by_index()
105 struct eth_device *dev; in on_ethaddr() local
113 dev = eth_devices; in on_ethaddr()
115 if (dev->index == index) { in on_ethaddr()
119 eth_parse_enetaddr(value, dev->enetaddr); in on_ethaddr()
120 eth_write_hwaddr(dev, "eth", dev->index); in on_ethaddr()
123 memset(dev->enetaddr, 0, ARP_HLEN); in on_ethaddr()
126 dev = dev->next; in on_ethaddr()
127 } while (dev != eth_devices); in on_ethaddr()
133 int eth_write_hwaddr(struct eth_device *dev, const char *base_name, in eth_write_hwaddr() argument
142 if (!is_zero_ethaddr(dev->enetaddr) && in eth_write_hwaddr()
143 memcmp(dev->enetaddr, env_enetaddr, ARP_HLEN)) { in eth_write_hwaddr()
145 dev->name); in eth_write_hwaddr()
147 dev->enetaddr); in eth_write_hwaddr()
152 memcpy(dev->enetaddr, env_enetaddr, ARP_HLEN); in eth_write_hwaddr()
153 } else if (is_valid_ethaddr(dev->enetaddr)) { in eth_write_hwaddr()
155 dev->enetaddr); in eth_write_hwaddr()
156 } else if (is_zero_ethaddr(dev->enetaddr)) { in eth_write_hwaddr()
158 net_random_ethaddr(dev->enetaddr); in eth_write_hwaddr()
160 dev->name, eth_number, dev->enetaddr); in eth_write_hwaddr()
163 dev->name); in eth_write_hwaddr()
168 if (dev->write_hwaddr && !eth_mac_skip(eth_number)) { in eth_write_hwaddr()
169 if (!is_valid_ethaddr(dev->enetaddr)) { in eth_write_hwaddr()
171 dev->name, dev->enetaddr); in eth_write_hwaddr()
175 ret = dev->write_hwaddr(dev); in eth_write_hwaddr()
178 dev->name); in eth_write_hwaddr()
184 int eth_register(struct eth_device *dev) in eth_register() argument
189 assert(strlen(dev->name) < sizeof(dev->name)); in eth_register()
192 eth_devices = dev; in eth_register()
193 eth_current = dev; in eth_register()
198 d->next = dev; in eth_register()
201 dev->state = ETH_STATE_INIT; in eth_register()
202 dev->next = eth_devices; in eth_register()
203 dev->index = index++; in eth_register()
208 int eth_unregister(struct eth_device *dev) in eth_unregister() argument
216 for (cur = eth_devices; cur->next != eth_devices && cur->next != dev; in eth_unregister()
221 if (cur->next != dev) in eth_unregister()
224 cur->next = dev->next; in eth_unregister()
226 if (eth_devices == dev) in eth_unregister()
227 eth_devices = dev->next == eth_devices ? NULL : dev->next; in eth_unregister()
229 if (eth_current == dev) { in eth_unregister()
262 struct eth_device *dev = eth_devices; in eth_initialize() local
267 if (dev->index) in eth_initialize()
270 printf("%s", dev->name); in eth_initialize()
272 if (ethprime && strcmp(dev->name, ethprime) == 0) { in eth_initialize()
273 eth_current = dev; in eth_initialize()
277 if (strchr(dev->name, ' ')) in eth_initialize()
281 eth_write_hwaddr(dev, "eth", dev->index); in eth_initialize()
283 dev = dev->next; in eth_initialize()
285 } while (dev != eth_devices); in eth_initialize()
348 int eth_is_active(struct eth_device *dev) in eth_is_active() argument
350 return dev && dev->state == ETH_STATE_ACTIVE; in eth_is_active()