if_link.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. #ifndef _LINUX_IF_LINK_H
  2. #define _LINUX_IF_LINK_H
  3. #include <linux/netlink.h>
  4. /* The struct should be in sync with struct net_device_stats */
  5. struct rtnl_link_stats
  6. {
  7. __u32 rx_packets; /* total packets received */
  8. __u32 tx_packets; /* total packets transmitted */
  9. __u32 rx_bytes; /* total bytes received */
  10. __u32 tx_bytes; /* total bytes transmitted */
  11. __u32 rx_errors; /* bad packets received */
  12. __u32 tx_errors; /* packet transmit problems */
  13. __u32 rx_dropped; /* no space in linux buffers */
  14. __u32 tx_dropped; /* no space available in linux */
  15. __u32 multicast; /* multicast packets received */
  16. __u32 collisions;
  17. /* detailed rx_errors: */
  18. __u32 rx_length_errors;
  19. __u32 rx_over_errors; /* receiver ring buff overflow */
  20. __u32 rx_crc_errors; /* recved pkt with crc error */
  21. __u32 rx_frame_errors; /* recv'd frame alignment error */
  22. __u32 rx_fifo_errors; /* recv'r fifo overrun */
  23. __u32 rx_missed_errors; /* receiver missed packet */
  24. /* detailed tx_errors */
  25. __u32 tx_aborted_errors;
  26. __u32 tx_carrier_errors;
  27. __u32 tx_fifo_errors;
  28. __u32 tx_heartbeat_errors;
  29. __u32 tx_window_errors;
  30. /* for cslip etc */
  31. __u32 rx_compressed;
  32. __u32 tx_compressed;
  33. };
  34. /* The struct should be in sync with struct ifmap */
  35. struct rtnl_link_ifmap
  36. {
  37. __u64 mem_start;
  38. __u64 mem_end;
  39. __u64 base_addr;
  40. __u16 irq;
  41. __u8 dma;
  42. __u8 port;
  43. };
  44. enum
  45. {
  46. IFLA_UNSPEC,
  47. IFLA_ADDRESS,
  48. IFLA_BROADCAST,
  49. IFLA_IFNAME,
  50. IFLA_MTU,
  51. IFLA_LINK,
  52. IFLA_QDISC,
  53. IFLA_STATS,
  54. IFLA_COST,
  55. #define IFLA_COST IFLA_COST
  56. IFLA_PRIORITY,
  57. #define IFLA_PRIORITY IFLA_PRIORITY
  58. IFLA_MASTER,
  59. #define IFLA_MASTER IFLA_MASTER
  60. IFLA_WIRELESS, /* Wireless Extension event - see wireless.h */
  61. #define IFLA_WIRELESS IFLA_WIRELESS
  62. IFLA_PROTINFO, /* Protocol specific information for a link */
  63. #define IFLA_PROTINFO IFLA_PROTINFO
  64. IFLA_TXQLEN,
  65. #define IFLA_TXQLEN IFLA_TXQLEN
  66. IFLA_MAP,
  67. #define IFLA_MAP IFLA_MAP
  68. IFLA_WEIGHT,
  69. #define IFLA_WEIGHT IFLA_WEIGHT
  70. IFLA_OPERSTATE,
  71. IFLA_LINKMODE,
  72. IFLA_LINKINFO,
  73. #define IFLA_LINKINFO IFLA_LINKINFO
  74. IFLA_NET_NS_PID,
  75. __IFLA_MAX
  76. };
  77. #define IFLA_MAX (__IFLA_MAX - 1)
  78. /* backwards compatibility for userspace */
  79. #ifndef __KERNEL__
  80. #define IFLA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg))))
  81. #define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg))
  82. #endif
  83. /* ifi_flags.
  84. IFF_* flags.
  85. The only change is:
  86. IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are
  87. more not changeable by user. They describe link media
  88. characteristics and set by device driver.
  89. Comments:
  90. - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid
  91. - If neither of these three flags are set;
  92. the interface is NBMA.
  93. - IFF_MULTICAST does not mean anything special:
  94. multicasts can be used on all not-NBMA links.
  95. IFF_MULTICAST means that this media uses special encapsulation
  96. for multicast frames. Apparently, all IFF_POINTOPOINT and
  97. IFF_BROADCAST devices are able to use multicasts too.
  98. */
  99. /* IFLA_LINK.
  100. For usual devices it is equal ifi_index.
  101. If it is a "virtual interface" (f.e. tunnel), ifi_link
  102. can point to real physical interface (f.e. for bandwidth calculations),
  103. or maybe 0, what means, that real media is unknown (usual
  104. for IPIP tunnels, when route to endpoint is allowed to change)
  105. */
  106. /* Subtype attributes for IFLA_PROTINFO */
  107. enum
  108. {
  109. IFLA_INET6_UNSPEC,
  110. IFLA_INET6_FLAGS, /* link flags */
  111. IFLA_INET6_CONF, /* sysctl parameters */
  112. IFLA_INET6_STATS, /* statistics */
  113. IFLA_INET6_MCAST, /* MC things. What of them? */
  114. IFLA_INET6_CACHEINFO, /* time values and max reasm size */
  115. IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */
  116. __IFLA_INET6_MAX
  117. };
  118. #define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1)
  119. struct ifla_cacheinfo
  120. {
  121. __u32 max_reasm_len;
  122. __u32 tstamp; /* ipv6InterfaceTable updated timestamp */
  123. __u32 reachable_time;
  124. __u32 retrans_time;
  125. };
  126. enum
  127. {
  128. IFLA_INFO_UNSPEC,
  129. IFLA_INFO_KIND,
  130. IFLA_INFO_DATA,
  131. IFLA_INFO_XSTATS,
  132. __IFLA_INFO_MAX,
  133. };
  134. #define IFLA_INFO_MAX (__IFLA_INFO_MAX - 1)
  135. /* VLAN section */
  136. enum
  137. {
  138. IFLA_VLAN_UNSPEC,
  139. IFLA_VLAN_ID,
  140. IFLA_VLAN_FLAGS,
  141. IFLA_VLAN_EGRESS_QOS,
  142. IFLA_VLAN_INGRESS_QOS,
  143. __IFLA_VLAN_MAX,
  144. };
  145. #define IFLA_VLAN_MAX (__IFLA_VLAN_MAX - 1)
  146. struct ifla_vlan_flags {
  147. __u32 flags;
  148. __u32 mask;
  149. };
  150. enum
  151. {
  152. IFLA_VLAN_QOS_UNSPEC,
  153. IFLA_VLAN_QOS_MAPPING,
  154. __IFLA_VLAN_QOS_MAX
  155. };
  156. #define IFLA_VLAN_QOS_MAX (__IFLA_VLAN_QOS_MAX - 1)
  157. struct ifla_vlan_qos_mapping
  158. {
  159. __u32 from;
  160. __u32 to;
  161. };
  162. #endif /* _LINUX_IF_LINK_H */