eth.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * INET An implementation of the TCP/IP protocol suite for the LINUX
  4. * operating system. INET is implemented using the BSD Socket
  5. * interface as the means of communication with the user level.
  6. *
  7. * Ethernet-type device handling.
  8. *
  9. * Version: @(#)eth.c 1.0.7 05/25/93
  10. *
  11. * Authors: Ross Biro
  12. * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  13. * Mark Evans, <evansmp@uhura.aston.ac.uk>
  14. * Florian La Roche, <rzsfl@rz.uni-sb.de>
  15. * Alan Cox, <gw4pts@gw4pts.ampr.org>
  16. *
  17. * Fixes:
  18. * Mr Linux : Arp problems
  19. * Alan Cox : Generic queue tidyup (very tiny here)
  20. * Alan Cox : eth_header ntohs should be htons
  21. * Alan Cox : eth_rebuild_header missing an htons and
  22. * minor other things.
  23. * Tegge : Arp bug fixes.
  24. * Florian : Removed many unnecessary functions, code cleanup
  25. * and changes for new arp and skbuff.
  26. * Alan Cox : Redid header building to reflect new format.
  27. * Alan Cox : ARP only when compiled with CONFIG_INET
  28. * Greg Page : 802.2 and SNAP stuff.
  29. * Alan Cox : MAC layer pointers/new format.
  30. * Paul Gortmaker : eth_copy_and_sum shouldn't csum padding.
  31. * Alan Cox : Protect against forwarding explosions with
  32. * older network drivers and IFF_ALLMULTI.
  33. * Christer Weinigel : Better rebuild header message.
  34. * Andrew Morton : 26Feb01: kill ether_setup() - use netdev_boot_setup().
  35. */
  36. #include <linux/module.h>
  37. #include <linux/types.h>
  38. #include <linux/kernel.h>
  39. #include <linux/string.h>
  40. #include <linux/mm.h>
  41. #include <linux/socket.h>
  42. #include <linux/in.h>
  43. #include <linux/inet.h>
  44. #include <linux/ip.h>
  45. #include <linux/netdevice.h>
  46. #include <linux/nvmem-consumer.h>
  47. #include <linux/etherdevice.h>
  48. #include <linux/skbuff.h>
  49. #include <linux/errno.h>
  50. #include <linux/init.h>
  51. #include <linux/if_ether.h>
  52. #include <linux/of_net.h>
  53. #include <linux/pci.h>
  54. #include <linux/property.h>
  55. #include <net/dst.h>
  56. #include <net/arp.h>
  57. #include <net/sock.h>
  58. #include <net/ipv6.h>
  59. #include <net/ip.h>
  60. #include <net/dsa.h>
  61. #include <net/flow_dissector.h>
  62. #include <net/gro.h>
  63. #include <linux/uaccess.h>
  64. #include <net/pkt_sched.h>
  65. /**
  66. * eth_header - create the Ethernet header
  67. * @skb: buffer to alter
  68. * @dev: source device
  69. * @type: Ethernet type field
  70. * @daddr: destination address (NULL leave destination address)
  71. * @saddr: source address (NULL use device source address)
  72. * @len: packet length (<= skb->len)
  73. *
  74. *
  75. * Set the protocol type. For a packet of type ETH_P_802_3/2 we put the length
  76. * in here instead.
  77. */
  78. int eth_header(struct sk_buff *skb, struct net_device *dev,
  79. unsigned short type,
  80. const void *daddr, const void *saddr, unsigned int len)
  81. {
  82. struct ethhdr *eth = skb_push(skb, ETH_HLEN);
  83. if (type != ETH_P_802_3 && type != ETH_P_802_2)
  84. eth->h_proto = htons(type);
  85. else
  86. eth->h_proto = htons(len);
  87. /*
  88. * Set the source hardware address.
  89. */
  90. if (!saddr)
  91. saddr = dev->dev_addr;
  92. memcpy(eth->h_source, saddr, ETH_ALEN);
  93. if (daddr) {
  94. memcpy(eth->h_dest, daddr, ETH_ALEN);
  95. return ETH_HLEN;
  96. }
  97. /*
  98. * Anyway, the loopback-device should never use this function...
  99. */
  100. if (dev->flags & (IFF_LOOPBACK | IFF_NOARP)) {
  101. eth_zero_addr(eth->h_dest);
  102. return ETH_HLEN;
  103. }
  104. return -ETH_HLEN;
  105. }
  106. EXPORT_SYMBOL(eth_header);
  107. /**
  108. * eth_get_headlen - determine the length of header for an ethernet frame
  109. * @dev: pointer to network device
  110. * @data: pointer to start of frame
  111. * @len: total length of frame
  112. *
  113. * Make a best effort attempt to pull the length for all of the headers for
  114. * a given frame in a linear buffer.
  115. */
  116. u32 eth_get_headlen(const struct net_device *dev, const void *data, u32 len)
  117. {
  118. const unsigned int flags = FLOW_DISSECTOR_F_PARSE_1ST_FRAG;
  119. const struct ethhdr *eth = (const struct ethhdr *)data;
  120. struct flow_keys_basic keys;
  121. /* this should never happen, but better safe than sorry */
  122. if (unlikely(len < sizeof(*eth)))
  123. return len;
  124. /* parse any remaining L2/L3 headers, check for L4 */
  125. if (!skb_flow_dissect_flow_keys_basic(dev_net(dev), NULL, &keys, data,
  126. eth->h_proto, sizeof(*eth),
  127. len, flags))
  128. return max_t(u32, keys.control.thoff, sizeof(*eth));
  129. /* parse for any L4 headers */
  130. return min_t(u32, __skb_get_poff(NULL, data, &keys, len), len);
  131. }
  132. EXPORT_SYMBOL(eth_get_headlen);
  133. /**
  134. * eth_type_trans - determine the packet's protocol ID.
  135. * @skb: received socket data
  136. * @dev: receiving network device
  137. *
  138. * The rule here is that we
  139. * assume 802.3 if the type field is short enough to be a length.
  140. * This is normal practice and works for any 'now in use' protocol.
  141. */
  142. __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
  143. {
  144. const unsigned short *sap;
  145. const struct ethhdr *eth;
  146. __be16 res;
  147. skb->dev = dev;
  148. skb_reset_mac_header(skb);
  149. eth = eth_skb_pull_mac(skb);
  150. eth_skb_pkt_type(skb, dev);
  151. /*
  152. * Some variants of DSA tagging don't have an ethertype field
  153. * at all, so we check here whether one of those tagging
  154. * variants has been configured on the receiving interface,
  155. * and if so, set skb->protocol without looking at the packet.
  156. */
  157. if (unlikely(netdev_uses_dsa(dev)))
  158. return htons(ETH_P_XDSA);
  159. if (likely(eth_proto_is_802_3(eth->h_proto)))
  160. return eth->h_proto;
  161. /*
  162. * This is a magic hack to spot IPX packets. Older Novell breaks
  163. * the protocol design and runs IPX over 802.3 without an 802.2 LLC
  164. * layer. We look for FFFF which isn't a used 802.2 SSAP/DSAP. This
  165. * won't work for fault tolerant netware but does for the rest.
  166. * We use skb->dev as temporary storage to not hit
  167. * CONFIG_STACKPROTECTOR_STRONG=y costs on some platforms.
  168. */
  169. sap = skb_header_pointer(skb, 0, sizeof(*sap), &skb->dev);
  170. res = (sap && *sap == 0xFFFF) ? htons(ETH_P_802_3) : htons(ETH_P_802_2);
  171. /* restore skb->dev in case it was mangled by skb_header_pointer(). */
  172. skb->dev = dev;
  173. return res;
  174. }
  175. EXPORT_SYMBOL(eth_type_trans);
  176. int eth_header_parse(const struct sk_buff *skb, const struct net_device *dev,
  177. unsigned char *haddr)
  178. {
  179. const struct ethhdr *eth = eth_hdr(skb);
  180. memcpy(haddr, eth->h_source, ETH_ALEN);
  181. return ETH_ALEN;
  182. }
  183. EXPORT_SYMBOL(eth_header_parse);
  184. /**
  185. * eth_header_cache - fill cache entry from neighbour
  186. * @neigh: source neighbour
  187. * @hh: destination cache entry
  188. * @type: Ethernet type field
  189. *
  190. * Create an Ethernet header template from the neighbour.
  191. */
  192. int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, __be16 type)
  193. {
  194. struct ethhdr *eth;
  195. const struct net_device *dev = neigh->dev;
  196. eth = (struct ethhdr *)
  197. (((u8 *) hh->hh_data) + (HH_DATA_OFF(sizeof(*eth))));
  198. if (type == htons(ETH_P_802_3))
  199. return -1;
  200. eth->h_proto = type;
  201. memcpy(eth->h_source, dev->dev_addr, ETH_ALEN);
  202. memcpy(eth->h_dest, neigh->ha, ETH_ALEN);
  203. /* Pairs with READ_ONCE() in neigh_resolve_output(),
  204. * neigh_hh_output() and neigh_update_hhs().
  205. */
  206. smp_store_release(&hh->hh_len, ETH_HLEN);
  207. return 0;
  208. }
  209. EXPORT_SYMBOL(eth_header_cache);
  210. /**
  211. * eth_header_cache_update - update cache entry
  212. * @hh: destination cache entry
  213. * @dev: network device
  214. * @haddr: new hardware address
  215. *
  216. * Called by Address Resolution module to notify changes in address.
  217. */
  218. void eth_header_cache_update(struct hh_cache *hh,
  219. const struct net_device *dev,
  220. const unsigned char *haddr)
  221. {
  222. memcpy(((u8 *) hh->hh_data) + HH_DATA_OFF(sizeof(struct ethhdr)),
  223. haddr, ETH_ALEN);
  224. }
  225. EXPORT_SYMBOL(eth_header_cache_update);
  226. /**
  227. * eth_header_parse_protocol - extract protocol from L2 header
  228. * @skb: packet to extract protocol from
  229. */
  230. __be16 eth_header_parse_protocol(const struct sk_buff *skb)
  231. {
  232. const struct ethhdr *eth = eth_hdr(skb);
  233. return eth->h_proto;
  234. }
  235. EXPORT_SYMBOL(eth_header_parse_protocol);
  236. /**
  237. * eth_prepare_mac_addr_change - prepare for mac change
  238. * @dev: network device
  239. * @p: socket address
  240. */
  241. int eth_prepare_mac_addr_change(struct net_device *dev, void *p)
  242. {
  243. struct sockaddr *addr = p;
  244. if (!(dev->priv_flags & IFF_LIVE_ADDR_CHANGE) && netif_running(dev))
  245. return -EBUSY;
  246. if (!is_valid_ether_addr(addr->sa_data))
  247. return -EADDRNOTAVAIL;
  248. return 0;
  249. }
  250. EXPORT_SYMBOL(eth_prepare_mac_addr_change);
  251. /**
  252. * eth_commit_mac_addr_change - commit mac change
  253. * @dev: network device
  254. * @p: socket address
  255. */
  256. void eth_commit_mac_addr_change(struct net_device *dev, void *p)
  257. {
  258. struct sockaddr *addr = p;
  259. eth_hw_addr_set(dev, addr->sa_data);
  260. }
  261. EXPORT_SYMBOL(eth_commit_mac_addr_change);
  262. /**
  263. * eth_mac_addr - set new Ethernet hardware address
  264. * @dev: network device
  265. * @p: socket address
  266. *
  267. * Change hardware address of device.
  268. *
  269. * This doesn't change hardware matching, so needs to be overridden
  270. * for most real devices.
  271. */
  272. int eth_mac_addr(struct net_device *dev, void *p)
  273. {
  274. int ret;
  275. ret = eth_prepare_mac_addr_change(dev, p);
  276. if (ret < 0)
  277. return ret;
  278. eth_commit_mac_addr_change(dev, p);
  279. return 0;
  280. }
  281. EXPORT_SYMBOL(eth_mac_addr);
  282. int eth_validate_addr(struct net_device *dev)
  283. {
  284. if (!is_valid_ether_addr(dev->dev_addr))
  285. return -EADDRNOTAVAIL;
  286. return 0;
  287. }
  288. EXPORT_SYMBOL(eth_validate_addr);
  289. const struct header_ops eth_header_ops ____cacheline_aligned = {
  290. .create = eth_header,
  291. .parse = eth_header_parse,
  292. .cache = eth_header_cache,
  293. .cache_update = eth_header_cache_update,
  294. .parse_protocol = eth_header_parse_protocol,
  295. };
  296. /**
  297. * ether_setup - setup Ethernet network device
  298. * @dev: network device
  299. *
  300. * Fill in the fields of the device structure with Ethernet-generic values.
  301. */
  302. void ether_setup(struct net_device *dev)
  303. {
  304. dev->header_ops = &eth_header_ops;
  305. dev->type = ARPHRD_ETHER;
  306. dev->hard_header_len = ETH_HLEN;
  307. dev->min_header_len = ETH_HLEN;
  308. dev->mtu = ETH_DATA_LEN;
  309. dev->min_mtu = ETH_MIN_MTU;
  310. dev->max_mtu = ETH_DATA_LEN;
  311. dev->addr_len = ETH_ALEN;
  312. dev->tx_queue_len = DEFAULT_TX_QUEUE_LEN;
  313. dev->flags = IFF_BROADCAST|IFF_MULTICAST;
  314. dev->priv_flags |= IFF_TX_SKB_SHARING;
  315. eth_broadcast_addr(dev->broadcast);
  316. }
  317. EXPORT_SYMBOL(ether_setup);
  318. /**
  319. * alloc_etherdev_mqs - Allocates and sets up an Ethernet device
  320. * @sizeof_priv: Size of additional driver-private structure to be allocated
  321. * for this Ethernet device
  322. * @txqs: The number of TX queues this device has.
  323. * @rxqs: The number of RX queues this device has.
  324. *
  325. * Fill in the fields of the device structure with Ethernet-generic
  326. * values. Basically does everything except registering the device.
  327. *
  328. * Constructs a new net device, complete with a private data area of
  329. * size (sizeof_priv). A 32-byte (not bit) alignment is enforced for
  330. * this private data area.
  331. */
  332. struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs,
  333. unsigned int rxqs)
  334. {
  335. return alloc_netdev_mqs(sizeof_priv, "eth%d", NET_NAME_ENUM,
  336. ether_setup, txqs, rxqs);
  337. }
  338. EXPORT_SYMBOL(alloc_etherdev_mqs);
  339. ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len)
  340. {
  341. return sysfs_emit(buf, "%*phC\n", len, addr);
  342. }
  343. EXPORT_SYMBOL(sysfs_format_mac);
  344. struct sk_buff *eth_gro_receive(struct list_head *head, struct sk_buff *skb)
  345. {
  346. const struct packet_offload *ptype;
  347. unsigned int hlen, off_eth;
  348. struct sk_buff *pp = NULL;
  349. struct ethhdr *eh, *eh2;
  350. struct sk_buff *p;
  351. __be16 type;
  352. int flush = 1;
  353. off_eth = skb_gro_offset(skb);
  354. hlen = off_eth + sizeof(*eh);
  355. eh = skb_gro_header(skb, hlen, off_eth);
  356. if (unlikely(!eh))
  357. goto out;
  358. flush = 0;
  359. list_for_each_entry(p, head, list) {
  360. if (!NAPI_GRO_CB(p)->same_flow)
  361. continue;
  362. eh2 = (struct ethhdr *)(p->data + off_eth);
  363. if (compare_ether_header(eh, eh2)) {
  364. NAPI_GRO_CB(p)->same_flow = 0;
  365. continue;
  366. }
  367. }
  368. type = eh->h_proto;
  369. ptype = gro_find_receive_by_type(type);
  370. if (ptype == NULL) {
  371. flush = 1;
  372. goto out;
  373. }
  374. skb_gro_pull(skb, sizeof(*eh));
  375. skb_gro_postpull_rcsum(skb, eh, sizeof(*eh));
  376. pp = indirect_call_gro_receive_inet(ptype->callbacks.gro_receive,
  377. ipv6_gro_receive, inet_gro_receive,
  378. head, skb);
  379. out:
  380. skb_gro_flush_final(skb, pp, flush);
  381. return pp;
  382. }
  383. EXPORT_SYMBOL(eth_gro_receive);
  384. int eth_gro_complete(struct sk_buff *skb, int nhoff)
  385. {
  386. struct ethhdr *eh = (struct ethhdr *)(skb->data + nhoff);
  387. __be16 type = eh->h_proto;
  388. struct packet_offload *ptype;
  389. int err = -ENOSYS;
  390. if (skb->encapsulation)
  391. skb_set_inner_mac_header(skb, nhoff);
  392. ptype = gro_find_complete_by_type(type);
  393. if (ptype != NULL)
  394. err = INDIRECT_CALL_INET(ptype->callbacks.gro_complete,
  395. ipv6_gro_complete, inet_gro_complete,
  396. skb, nhoff + sizeof(*eh));
  397. return err;
  398. }
  399. EXPORT_SYMBOL(eth_gro_complete);
  400. static struct packet_offload eth_packet_offload __read_mostly = {
  401. .type = cpu_to_be16(ETH_P_TEB),
  402. .priority = 10,
  403. .callbacks = {
  404. .gro_receive = eth_gro_receive,
  405. .gro_complete = eth_gro_complete,
  406. },
  407. };
  408. static int __init eth_offload_init(void)
  409. {
  410. dev_add_offload(&eth_packet_offload);
  411. return 0;
  412. }
  413. fs_initcall(eth_offload_init);
  414. unsigned char * __weak arch_get_platform_mac_address(void)
  415. {
  416. return NULL;
  417. }
  418. int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr)
  419. {
  420. unsigned char *addr;
  421. int ret;
  422. ret = of_get_mac_address(dev->of_node, mac_addr);
  423. if (!ret)
  424. return 0;
  425. addr = arch_get_platform_mac_address();
  426. if (!addr)
  427. return -ENODEV;
  428. ether_addr_copy(mac_addr, addr);
  429. return 0;
  430. }
  431. EXPORT_SYMBOL(eth_platform_get_mac_address);
  432. /**
  433. * platform_get_ethdev_address - Set netdev's MAC address from a given device
  434. * @dev: Pointer to the device
  435. * @netdev: Pointer to netdev to write the address to
  436. *
  437. * Wrapper around eth_platform_get_mac_address() which writes the address
  438. * directly to netdev->dev_addr.
  439. */
  440. int platform_get_ethdev_address(struct device *dev, struct net_device *netdev)
  441. {
  442. u8 addr[ETH_ALEN] __aligned(2);
  443. int ret;
  444. ret = eth_platform_get_mac_address(dev, addr);
  445. if (!ret)
  446. eth_hw_addr_set(netdev, addr);
  447. return ret;
  448. }
  449. EXPORT_SYMBOL(platform_get_ethdev_address);
  450. /**
  451. * nvmem_get_mac_address - Obtain the MAC address from an nvmem cell named
  452. * 'mac-address' associated with given device.
  453. *
  454. * @dev: Device with which the mac-address cell is associated.
  455. * @addrbuf: Buffer to which the MAC address will be copied on success.
  456. *
  457. * Returns 0 on success or a negative error number on failure.
  458. */
  459. int nvmem_get_mac_address(struct device *dev, void *addrbuf)
  460. {
  461. struct nvmem_cell *cell;
  462. const void *mac;
  463. size_t len;
  464. cell = nvmem_cell_get(dev, "mac-address");
  465. if (IS_ERR(cell))
  466. return PTR_ERR(cell);
  467. mac = nvmem_cell_read(cell, &len);
  468. nvmem_cell_put(cell);
  469. if (IS_ERR(mac))
  470. return PTR_ERR(mac);
  471. if (len != ETH_ALEN || !is_valid_ether_addr(mac)) {
  472. kfree(mac);
  473. return -EINVAL;
  474. }
  475. ether_addr_copy(addrbuf, mac);
  476. kfree(mac);
  477. return 0;
  478. }
  479. static int fwnode_get_mac_addr(struct fwnode_handle *fwnode,
  480. const char *name, char *addr)
  481. {
  482. int ret;
  483. ret = fwnode_property_read_u8_array(fwnode, name, addr, ETH_ALEN);
  484. if (ret)
  485. return ret;
  486. if (!is_valid_ether_addr(addr))
  487. return -EINVAL;
  488. return 0;
  489. }
  490. /**
  491. * fwnode_get_mac_address - Get the MAC from the firmware node
  492. * @fwnode: Pointer to the firmware node
  493. * @addr: Address of buffer to store the MAC in
  494. *
  495. * Search the firmware node for the best MAC address to use. 'mac-address' is
  496. * checked first, because that is supposed to contain to "most recent" MAC
  497. * address. If that isn't set, then 'local-mac-address' is checked next,
  498. * because that is the default address. If that isn't set, then the obsolete
  499. * 'address' is checked, just in case we're using an old device tree.
  500. *
  501. * Note that the 'address' property is supposed to contain a virtual address of
  502. * the register set, but some DTS files have redefined that property to be the
  503. * MAC address.
  504. *
  505. * All-zero MAC addresses are rejected, because those could be properties that
  506. * exist in the firmware tables, but were not updated by the firmware. For
  507. * example, the DTS could define 'mac-address' and 'local-mac-address', with
  508. * zero MAC addresses. Some older U-Boots only initialized 'local-mac-address'.
  509. * In this case, the real MAC is in 'local-mac-address', and 'mac-address'
  510. * exists but is all zeros.
  511. */
  512. int fwnode_get_mac_address(struct fwnode_handle *fwnode, char *addr)
  513. {
  514. if (!fwnode_get_mac_addr(fwnode, "mac-address", addr) ||
  515. !fwnode_get_mac_addr(fwnode, "local-mac-address", addr) ||
  516. !fwnode_get_mac_addr(fwnode, "address", addr))
  517. return 0;
  518. return -ENOENT;
  519. }
  520. EXPORT_SYMBOL(fwnode_get_mac_address);
  521. /**
  522. * device_get_mac_address - Get the MAC for a given device
  523. * @dev: Pointer to the device
  524. * @addr: Address of buffer to store the MAC in
  525. */
  526. int device_get_mac_address(struct device *dev, char *addr)
  527. {
  528. if (!fwnode_get_mac_address(dev_fwnode(dev), addr))
  529. return 0;
  530. return nvmem_get_mac_address(dev, addr);
  531. }
  532. EXPORT_SYMBOL(device_get_mac_address);
  533. /**
  534. * device_get_ethdev_address - Set netdev's MAC address from a given device
  535. * @dev: Pointer to the device
  536. * @netdev: Pointer to netdev to write the address to
  537. *
  538. * Wrapper around device_get_mac_address() which writes the address
  539. * directly to netdev->dev_addr.
  540. */
  541. int device_get_ethdev_address(struct device *dev, struct net_device *netdev)
  542. {
  543. u8 addr[ETH_ALEN];
  544. int ret;
  545. ret = device_get_mac_address(dev, addr);
  546. if (!ret)
  547. eth_hw_addr_set(netdev, addr);
  548. return ret;
  549. }
  550. EXPORT_SYMBOL(device_get_ethdev_address);