Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * Moved here from drivers/net/net_init.c, which is:
0004  *  Written 1993,1994,1995 by Donald Becker.
0005  */
0006 
0007 #include <linux/errno.h>
0008 #include <linux/module.h>
0009 #include <linux/netdevice.h>
0010 #include <linux/if_arp.h>
0011 #include <linux/if_ltalk.h>
0012 
0013 static void ltalk_setup(struct net_device *dev)
0014 {
0015     /* Fill in the fields of the device structure with localtalk-generic values. */
0016 
0017     dev->type       = ARPHRD_LOCALTLK;
0018     dev->hard_header_len    = LTALK_HLEN;
0019     dev->mtu        = LTALK_MTU;
0020     dev->addr_len       = LTALK_ALEN;
0021     dev->tx_queue_len   = 10;
0022 
0023     dev->broadcast[0]   = 0xFF;
0024 
0025     dev->flags      = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP;
0026 }
0027 
0028 /**
0029  * alloc_ltalkdev - Allocates and sets up an localtalk device
0030  * @sizeof_priv: Size of additional driver-private structure to be allocated
0031  *  for this localtalk device
0032  *
0033  * Fill in the fields of the device structure with localtalk-generic
0034  * values. Basically does everything except registering the device.
0035  *
0036  * Constructs a new net device, complete with a private data area of
0037  * size @sizeof_priv.  A 32-byte (not bit) alignment is enforced for
0038  * this private data area.
0039  */
0040 
0041 struct net_device *alloc_ltalkdev(int sizeof_priv)
0042 {
0043     return alloc_netdev(sizeof_priv, "lt%d", NET_NAME_UNKNOWN,
0044                 ltalk_setup);
0045 }
0046 EXPORT_SYMBOL(alloc_ltalkdev);