if_frad.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * DLCI/FRAD Definitions for Frame Relay Access Devices. DLCI devices are
  4. * created for each DLCI associated with a FRAD. The FRAD driver
  5. * is not truly a network device, but the lower level device
  6. * handler. This allows other FRAD manufacturers to use the DLCI
  7. * code, including its RFC1490 encapsulation alongside the current
  8. * implementation for the Sangoma cards.
  9. *
  10. * Version: @(#)if_ifrad.h 0.15 31 Mar 96
  11. *
  12. * Author: Mike McLagan <mike.mclagan@linux.org>
  13. *
  14. * Changes:
  15. * 0.15 Mike McLagan changed structure defs (packed)
  16. * re-arranged flags
  17. * added DLCI_RET vars
  18. */
  19. #ifndef _FRAD_H_
  20. #define _FRAD_H_
  21. #include <uapi/linux/if_frad.h>
  22. #if defined(CONFIG_DLCI) || defined(CONFIG_DLCI_MODULE)
  23. /* these are the fields of an RFC 1490 header */
  24. struct frhdr
  25. {
  26. unsigned char control;
  27. /* for IP packets, this can be the NLPID */
  28. unsigned char pad;
  29. unsigned char NLPID;
  30. unsigned char OUI[3];
  31. __be16 PID;
  32. #define IP_NLPID pad
  33. } __packed;
  34. /* see RFC 1490 for the definition of the following */
  35. #define FRAD_I_UI 0x03
  36. #define FRAD_P_PADDING 0x00
  37. #define FRAD_P_Q933 0x08
  38. #define FRAD_P_SNAP 0x80
  39. #define FRAD_P_CLNP 0x81
  40. #define FRAD_P_IP 0xCC
  41. struct dlci_local
  42. {
  43. struct net_device *master;
  44. struct net_device *slave;
  45. struct dlci_conf config;
  46. int configured;
  47. struct list_head list;
  48. /* callback function */
  49. void (*receive)(struct sk_buff *skb, struct net_device *);
  50. };
  51. struct frad_local
  52. {
  53. /* devices which this FRAD is slaved to */
  54. struct net_device *master[CONFIG_DLCI_MAX];
  55. short dlci[CONFIG_DLCI_MAX];
  56. struct frad_conf config;
  57. int configured; /* has this device been configured */
  58. int initialized; /* mem_start, port, irq set ? */
  59. /* callback functions */
  60. int (*activate)(struct net_device *, struct net_device *);
  61. int (*deactivate)(struct net_device *, struct net_device *);
  62. int (*assoc)(struct net_device *, struct net_device *);
  63. int (*deassoc)(struct net_device *, struct net_device *);
  64. int (*dlci_conf)(struct net_device *, struct net_device *, int get);
  65. /* fields that are used by the Sangoma SDLA cards */
  66. struct timer_list timer;
  67. struct net_device *dev;
  68. int type; /* adapter type */
  69. int state; /* state of the S502/8 control latch */
  70. int buffer; /* current buffer for S508 firmware */
  71. };
  72. #endif /* CONFIG_DLCI || CONFIG_DLCI_MODULE */
  73. extern void dlci_ioctl_set(int (*hook)(unsigned int, void __user *));
  74. #endif