dev.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Moved here from drivers/net/net_init.c, which is:
  3. * Written 1993,1994,1995 by Donald Becker.
  4. */
  5. #include <linux/errno.h>
  6. #include <linux/module.h>
  7. #include <linux/netdevice.h>
  8. #include <linux/if_arp.h>
  9. #include <linux/if_ltalk.h>
  10. #ifdef CONFIG_COMPAT_NET_DEV_OPS
  11. static int ltalk_change_mtu(struct net_device *dev, int mtu)
  12. {
  13. return -EINVAL;
  14. }
  15. #endif
  16. static void ltalk_setup(struct net_device *dev)
  17. {
  18. /* Fill in the fields of the device structure with localtalk-generic values. */
  19. #ifdef CONFIG_COMPAT_NET_DEV_OPS
  20. dev->change_mtu = ltalk_change_mtu;
  21. #endif
  22. dev->type = ARPHRD_LOCALTLK;
  23. dev->hard_header_len = LTALK_HLEN;
  24. dev->mtu = LTALK_MTU;
  25. dev->addr_len = LTALK_ALEN;
  26. dev->tx_queue_len = 10;
  27. dev->broadcast[0] = 0xFF;
  28. dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP;
  29. }
  30. /**
  31. * alloc_ltalkdev - Allocates and sets up an localtalk device
  32. * @sizeof_priv: Size of additional driver-private structure to be allocated
  33. * for this localtalk device
  34. *
  35. * Fill in the fields of the device structure with localtalk-generic
  36. * values. Basically does everything except registering the device.
  37. *
  38. * Constructs a new net device, complete with a private data area of
  39. * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for
  40. * this private data area.
  41. */
  42. struct net_device *alloc_ltalkdev(int sizeof_priv)
  43. {
  44. return alloc_netdev(sizeof_priv, "lt%d", ltalk_setup);
  45. }
  46. EXPORT_SYMBOL(alloc_ltalkdev);