if_bonding.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */
  2. /*
  3. * Bond several ethernet interfaces into a Cisco, running 'Etherchannel'.
  4. *
  5. *
  6. * Portions are (c) Copyright 1995 Simon "Guru Aleph-Null" Janes
  7. * NCM: Network and Communications Management, Inc.
  8. *
  9. * BUT, I'm the one who modified it for ethernet, so:
  10. * (c) Copyright 1999, Thomas Davis, tadavis@lbl.gov
  11. *
  12. * This software may be used and distributed according to the terms
  13. * of the GNU Public License, incorporated herein by reference.
  14. *
  15. * 2003/03/18 - Amir Noam <amir.noam at intel dot com>
  16. * - Added support for getting slave's speed and duplex via ethtool.
  17. * Needed for 802.3ad and other future modes.
  18. *
  19. * 2003/03/18 - Tsippy Mendelson <tsippy.mendelson at intel dot com> and
  20. * Shmulik Hen <shmulik.hen at intel dot com>
  21. * - Enable support of modes that need to use the unique mac address of
  22. * each slave.
  23. *
  24. * 2003/03/18 - Tsippy Mendelson <tsippy.mendelson at intel dot com> and
  25. * Amir Noam <amir.noam at intel dot com>
  26. * - Moved driver's private data types to bonding.h
  27. *
  28. * 2003/03/18 - Amir Noam <amir.noam at intel dot com>,
  29. * Tsippy Mendelson <tsippy.mendelson at intel dot com> and
  30. * Shmulik Hen <shmulik.hen at intel dot com>
  31. * - Added support for IEEE 802.3ad Dynamic link aggregation mode.
  32. *
  33. * 2003/05/01 - Amir Noam <amir.noam at intel dot com>
  34. * - Added ABI version control to restore compatibility between
  35. * new/old ifenslave and new/old bonding.
  36. *
  37. * 2003/12/01 - Shmulik Hen <shmulik.hen at intel dot com>
  38. * - Code cleanup and style changes
  39. *
  40. * 2005/05/05 - Jason Gabler <jygabler at lbl dot gov>
  41. * - added definitions for various XOR hashing policies
  42. */
  43. #ifndef _LINUX_IF_BONDING_H
  44. #define _LINUX_IF_BONDING_H
  45. #include <linux/if.h>
  46. #include <linux/types.h>
  47. #include <linux/if_ether.h>
  48. /* userland - kernel ABI version (2003/05/08) */
  49. #define BOND_ABI_VERSION 2
  50. /*
  51. * We can remove these ioctl definitions in 2.5. People should use the
  52. * SIOC*** versions of them instead
  53. */
  54. #define BOND_ENSLAVE_OLD (SIOCDEVPRIVATE)
  55. #define BOND_RELEASE_OLD (SIOCDEVPRIVATE + 1)
  56. #define BOND_SETHWADDR_OLD (SIOCDEVPRIVATE + 2)
  57. #define BOND_SLAVE_INFO_QUERY_OLD (SIOCDEVPRIVATE + 11)
  58. #define BOND_INFO_QUERY_OLD (SIOCDEVPRIVATE + 12)
  59. #define BOND_CHANGE_ACTIVE_OLD (SIOCDEVPRIVATE + 13)
  60. #define BOND_CHECK_MII_STATUS (SIOCGMIIPHY)
  61. #define BOND_MODE_ROUNDROBIN 0
  62. #define BOND_MODE_ACTIVEBACKUP 1
  63. #define BOND_MODE_XOR 2
  64. #define BOND_MODE_BROADCAST 3
  65. #define BOND_MODE_8023AD 4
  66. #define BOND_MODE_TLB 5
  67. #define BOND_MODE_ALB 6 /* TLB + RLB (receive load balancing) */
  68. /* each slave's link has 4 states */
  69. #define BOND_LINK_UP 0 /* link is up and running */
  70. #define BOND_LINK_FAIL 1 /* link has just gone down */
  71. #define BOND_LINK_DOWN 2 /* link has been down for too long time */
  72. #define BOND_LINK_BACK 3 /* link is going back */
  73. /* each slave has several states */
  74. #define BOND_STATE_ACTIVE 0 /* link is active */
  75. #define BOND_STATE_BACKUP 1 /* link is backup */
  76. #define BOND_DEFAULT_MAX_BONDS 1 /* Default maximum number of devices to support */
  77. #define BOND_DEFAULT_TX_QUEUES 16 /* Default number of tx queues per device */
  78. #define BOND_DEFAULT_RESEND_IGMP 1 /* Default number of IGMP membership reports */
  79. /* hashing types */
  80. #define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */
  81. #define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ (TCP || UDP)) */
  82. #define BOND_XMIT_POLICY_LAYER23 2 /* layer 2+3 (IP ^ MAC) */
  83. #define BOND_XMIT_POLICY_ENCAP23 3 /* encapsulated layer 2+3 */
  84. #define BOND_XMIT_POLICY_ENCAP34 4 /* encapsulated layer 3+4 */
  85. typedef struct ifbond {
  86. __s32 bond_mode;
  87. __s32 num_slaves;
  88. __s32 miimon;
  89. } ifbond;
  90. typedef struct ifslave {
  91. __s32 slave_id; /* Used as an IN param to the BOND_SLAVE_INFO_QUERY ioctl */
  92. char slave_name[IFNAMSIZ];
  93. __s8 link;
  94. __s8 state;
  95. __u32 link_failure_count;
  96. } ifslave;
  97. struct ad_info {
  98. __u16 aggregator_id;
  99. __u16 ports;
  100. __u16 actor_key;
  101. __u16 partner_key;
  102. __u8 partner_system[ETH_ALEN];
  103. };
  104. #endif /* _LINUX_IF_BONDING_H */
  105. /*
  106. * Local variables:
  107. * version-control: t
  108. * kept-new-versions: 5
  109. * c-indent-level: 8
  110. * c-basic-offset: 8
  111. * tab-width: 8
  112. * End:
  113. */