18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Moved here from drivers/net/net_init.c, which is: 48c2ecf20Sopenharmony_ci * Written 1993,1994,1995 by Donald Becker. 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include <linux/errno.h> 88c2ecf20Sopenharmony_ci#include <linux/module.h> 98c2ecf20Sopenharmony_ci#include <linux/netdevice.h> 108c2ecf20Sopenharmony_ci#include <linux/if_arp.h> 118c2ecf20Sopenharmony_ci#include <linux/if_ltalk.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_cistatic void ltalk_setup(struct net_device *dev) 148c2ecf20Sopenharmony_ci{ 158c2ecf20Sopenharmony_ci /* Fill in the fields of the device structure with localtalk-generic values. */ 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci dev->type = ARPHRD_LOCALTLK; 188c2ecf20Sopenharmony_ci dev->hard_header_len = LTALK_HLEN; 198c2ecf20Sopenharmony_ci dev->mtu = LTALK_MTU; 208c2ecf20Sopenharmony_ci dev->addr_len = LTALK_ALEN; 218c2ecf20Sopenharmony_ci dev->tx_queue_len = 10; 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci dev->broadcast[0] = 0xFF; 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP; 268c2ecf20Sopenharmony_ci} 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci/** 298c2ecf20Sopenharmony_ci * alloc_ltalkdev - Allocates and sets up an localtalk device 308c2ecf20Sopenharmony_ci * @sizeof_priv: Size of additional driver-private structure to be allocated 318c2ecf20Sopenharmony_ci * for this localtalk device 328c2ecf20Sopenharmony_ci * 338c2ecf20Sopenharmony_ci * Fill in the fields of the device structure with localtalk-generic 348c2ecf20Sopenharmony_ci * values. Basically does everything except registering the device. 358c2ecf20Sopenharmony_ci * 368c2ecf20Sopenharmony_ci * Constructs a new net device, complete with a private data area of 378c2ecf20Sopenharmony_ci * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for 388c2ecf20Sopenharmony_ci * this private data area. 398c2ecf20Sopenharmony_ci */ 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_cistruct net_device *alloc_ltalkdev(int sizeof_priv) 428c2ecf20Sopenharmony_ci{ 438c2ecf20Sopenharmony_ci return alloc_netdev(sizeof_priv, "lt%d", NET_NAME_UNKNOWN, 448c2ecf20Sopenharmony_ci ltalk_setup); 458c2ecf20Sopenharmony_ci} 468c2ecf20Sopenharmony_ciEXPORT_SYMBOL(alloc_ltalkdev); 47