if_link.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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_MAX
  73. };
  74. #define IFLA_MAX (__IFLA_MAX - 1)
  75. /* backwards compatibility for userspace */
  76. #ifndef __KERNEL__
  77. #define IFLA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg))))
  78. #define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg))
  79. #endif
  80. /* ifi_flags.
  81. IFF_* flags.
  82. The only change is:
  83. IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are
  84. more not changeable by user. They describe link media
  85. characteristics and set by device driver.
  86. Comments:
  87. - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid
  88. - If neither of these three flags are set;
  89. the interface is NBMA.
  90. - IFF_MULTICAST does not mean anything special:
  91. multicasts can be used on all not-NBMA links.
  92. IFF_MULTICAST means that this media uses special encapsulation
  93. for multicast frames. Apparently, all IFF_POINTOPOINT and
  94. IFF_BROADCAST devices are able to use multicasts too.
  95. */
  96. /* IFLA_LINK.
  97. For usual devices it is equal ifi_index.
  98. If it is a "virtual interface" (f.e. tunnel), ifi_link
  99. can point to real physical interface (f.e. for bandwidth calculations),
  100. or maybe 0, what means, that real media is unknown (usual
  101. for IPIP tunnels, when route to endpoint is allowed to change)
  102. */
  103. /* Subtype attributes for IFLA_PROTINFO */
  104. enum
  105. {
  106. IFLA_INET6_UNSPEC,
  107. IFLA_INET6_FLAGS, /* link flags */
  108. IFLA_INET6_CONF, /* sysctl parameters */
  109. IFLA_INET6_STATS, /* statistics */
  110. IFLA_INET6_MCAST, /* MC things. What of them? */
  111. IFLA_INET6_CACHEINFO, /* time values and max reasm size */
  112. __IFLA_INET6_MAX
  113. };
  114. #define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1)
  115. struct ifla_cacheinfo
  116. {
  117. __u32 max_reasm_len;
  118. __u32 tstamp; /* ipv6InterfaceTable updated timestamp */
  119. __u32 reachable_time;
  120. __u32 retrans_time;
  121. };
  122. #endif /* _LINUX_IF_LINK_H */