lec.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /*
  2. * Lan Emulation client header file
  3. *
  4. * Marko Kiiskila <mkiiskila@yahoo.com>
  5. */
  6. #ifndef _LEC_H_
  7. #define _LEC_H_
  8. #include <linux/config.h>
  9. #include <linux/atmdev.h>
  10. #include <linux/netdevice.h>
  11. #include <linux/atmlec.h>
  12. #define LEC_HEADER_LEN 16
  13. struct lecdatahdr_8023 {
  14. unsigned short le_header;
  15. unsigned char h_dest[ETH_ALEN];
  16. unsigned char h_source[ETH_ALEN];
  17. unsigned short h_type;
  18. };
  19. struct lecdatahdr_8025 {
  20. unsigned short le_header;
  21. unsigned char ac_pad;
  22. unsigned char fc;
  23. unsigned char h_dest[ETH_ALEN];
  24. unsigned char h_source[ETH_ALEN];
  25. };
  26. #define LEC_MINIMUM_8023_SIZE 62
  27. #define LEC_MINIMUM_8025_SIZE 16
  28. /*
  29. * Operations that LANE2 capable device can do. Two first functions
  30. * are used to make the device do things. See spec 3.1.3 and 3.1.4.
  31. *
  32. * The third function is intented for the MPOA component sitting on
  33. * top of the LANE device. The MPOA component assigns it's own function
  34. * to (*associate_indicator)() and the LANE device will use that
  35. * function to tell about TLVs it sees floating through.
  36. *
  37. */
  38. struct lane2_ops {
  39. int (*resolve) (struct net_device *dev, u8 *dst_mac, int force,
  40. u8 **tlvs, u32 *sizeoftlvs);
  41. int (*associate_req) (struct net_device *dev, u8 *lan_dst,
  42. u8 *tlvs, u32 sizeoftlvs);
  43. void (*associate_indicator) (struct net_device *dev, u8 *mac_addr,
  44. u8 *tlvs, u32 sizeoftlvs);
  45. };
  46. /*
  47. * ATM LAN Emulation supports both LLC & Dix Ethernet EtherType
  48. * frames.
  49. *
  50. * 1. Dix Ethernet EtherType frames encoded by placing EtherType
  51. * field in h_type field. Data follows immediatelly after header.
  52. * 2. LLC Data frames whose total length, including LLC field and data,
  53. * but not padding required to meet the minimum data frame length,
  54. * is less than 1536(0x0600) MUST be encoded by placing that length
  55. * in the h_type field. The LLC field follows header immediatelly.
  56. * 3. LLC data frames longer than this maximum MUST be encoded by placing
  57. * the value 0 in the h_type field.
  58. *
  59. */
  60. /* Hash table size */
  61. #define LEC_ARP_TABLE_SIZE 16
  62. struct lec_priv {
  63. struct net_device_stats stats;
  64. unsigned short lecid; /* Lecid of this client */
  65. struct hlist_head lec_arp_empty_ones;
  66. /* Used for storing VCC's that don't have a MAC address attached yet */
  67. struct hlist_head lec_arp_tables[LEC_ARP_TABLE_SIZE];
  68. /* Actual LE ARP table */
  69. struct hlist_head lec_no_forward;
  70. /*
  71. * Used for storing VCC's (and forward packets from) which are to
  72. * age out by not using them to forward packets.
  73. * This is because to some LE clients there will be 2 VCCs. Only
  74. * one of them gets used.
  75. */
  76. struct hlist_head mcast_fwds;
  77. /*
  78. * With LANEv2 it is possible that BUS (or a special multicast server)
  79. * establishes multiple Multicast Forward VCCs to us. This list
  80. * collects all those VCCs. LANEv1 client has only one item in this
  81. * list. These entries are not aged out.
  82. */
  83. spinlock_t lec_arp_lock;
  84. struct atm_vcc *mcast_vcc; /* Default Multicast Send VCC */
  85. struct atm_vcc *lecd;
  86. struct work_struct lec_arp_work; /* C10 */
  87. unsigned int maximum_unknown_frame_count;
  88. /*
  89. * Within the period of time defined by this variable, the client will send
  90. * no more than C10 frames to BUS for a given unicast destination. (C11)
  91. */
  92. unsigned long max_unknown_frame_time;
  93. /*
  94. * If no traffic has been sent in this vcc for this period of time,
  95. * vcc will be torn down (C12)
  96. */
  97. unsigned long vcc_timeout_period;
  98. /*
  99. * An LE Client MUST not retry an LE_ARP_REQUEST for a
  100. * given frame's LAN Destination more than maximum retry count times,
  101. * after the first LEC_ARP_REQUEST (C13)
  102. */
  103. unsigned short max_retry_count;
  104. /*
  105. * Max time the client will maintain an entry in its arp cache in
  106. * absence of a verification of that relationship (C17)
  107. */
  108. unsigned long aging_time;
  109. /*
  110. * Max time the client will maintain an entry in cache when
  111. * topology change flag is true (C18)
  112. */
  113. unsigned long forward_delay_time; /* Topology change flag (C19) */
  114. int topology_change;
  115. /*
  116. * Max time the client expects an LE_ARP_REQUEST/LE_ARP_RESPONSE
  117. * cycle to take (C20)
  118. */
  119. unsigned long arp_response_time;
  120. /*
  121. * Time limit ot wait to receive an LE_FLUSH_RESPONSE after the
  122. * LE_FLUSH_REQUEST has been sent before taking recover action. (C21)
  123. */
  124. unsigned long flush_timeout;
  125. /* The time since sending a frame to the bus after which the
  126. * LE Client may assume that the frame has been either discarded or
  127. * delivered to the recipient (C22)
  128. */
  129. unsigned long path_switching_delay;
  130. u8 *tlvs; /* LANE2: TLVs are new */
  131. u32 sizeoftlvs; /* The size of the tlv array in bytes */
  132. int lane_version; /* LANE2 */
  133. int itfnum; /* e.g. 2 for lec2, 5 for lec5 */
  134. struct lane2_ops *lane2_ops; /* can be NULL for LANE v1 */
  135. int is_proxy; /* bridge between ATM and Ethernet */
  136. int is_trdev; /* Device type, 0 = Ethernet, 1 = TokenRing */
  137. };
  138. struct lec_vcc_priv {
  139. void (*old_pop) (struct atm_vcc *vcc, struct sk_buff *skb);
  140. int xoff;
  141. };
  142. #define LEC_VCC_PRIV(vcc) ((struct lec_vcc_priv *)((vcc)->user_back))
  143. #endif /* _LEC_H_ */