switch.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * switch.h: Switch configuration API
  3. *
  4. * Copyright (C) 2008 Felix Fietkau <[email protected]>
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version 2
  9. * of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. */
  16. #ifndef _UAPI_LINUX_SWITCH_H
  17. #define _UAPI_LINUX_SWITCH_H
  18. #include <linux/types.h>
  19. #include <linux/netdevice.h>
  20. #include <linux/netlink.h>
  21. #include <linux/genetlink.h>
  22. #ifndef __KERNEL__
  23. #include <netlink/netlink.h>
  24. #include <netlink/genl/genl.h>
  25. #include <netlink/genl/ctrl.h>
  26. #endif
  27. /* main attributes */
  28. enum {
  29. SWITCH_ATTR_UNSPEC,
  30. /* global */
  31. SWITCH_ATTR_TYPE,
  32. /* device */
  33. SWITCH_ATTR_ID,
  34. SWITCH_ATTR_DEV_NAME,
  35. SWITCH_ATTR_ALIAS,
  36. SWITCH_ATTR_NAME,
  37. SWITCH_ATTR_VLANS,
  38. SWITCH_ATTR_PORTS,
  39. SWITCH_ATTR_PORTMAP,
  40. SWITCH_ATTR_CPU_PORT,
  41. /* attributes */
  42. SWITCH_ATTR_OP_ID,
  43. SWITCH_ATTR_OP_TYPE,
  44. SWITCH_ATTR_OP_NAME,
  45. SWITCH_ATTR_OP_PORT,
  46. SWITCH_ATTR_OP_VLAN,
  47. SWITCH_ATTR_OP_VALUE_INT,
  48. SWITCH_ATTR_OP_VALUE_STR,
  49. SWITCH_ATTR_OP_VALUE_PORTS,
  50. SWITCH_ATTR_OP_DESCRIPTION,
  51. /* port lists */
  52. SWITCH_ATTR_PORT,
  53. SWITCH_ATTR_MAX
  54. };
  55. enum {
  56. /* port map */
  57. SWITCH_PORTMAP_PORTS,
  58. SWITCH_PORTMAP_SEGMENT,
  59. SWITCH_PORTMAP_VIRT,
  60. SWITCH_PORTMAP_MAX
  61. };
  62. /* commands */
  63. enum {
  64. SWITCH_CMD_UNSPEC,
  65. SWITCH_CMD_GET_SWITCH,
  66. SWITCH_CMD_NEW_ATTR,
  67. SWITCH_CMD_LIST_GLOBAL,
  68. SWITCH_CMD_GET_GLOBAL,
  69. SWITCH_CMD_SET_GLOBAL,
  70. SWITCH_CMD_LIST_PORT,
  71. SWITCH_CMD_GET_PORT,
  72. SWITCH_CMD_SET_PORT,
  73. SWITCH_CMD_LIST_VLAN,
  74. SWITCH_CMD_GET_VLAN,
  75. SWITCH_CMD_SET_VLAN
  76. };
  77. /* data types */
  78. enum switch_val_type {
  79. SWITCH_TYPE_UNSPEC,
  80. SWITCH_TYPE_INT,
  81. SWITCH_TYPE_STRING,
  82. SWITCH_TYPE_PORTS,
  83. SWITCH_TYPE_NOVAL,
  84. };
  85. /* port nested attributes */
  86. enum {
  87. SWITCH_PORT_UNSPEC,
  88. SWITCH_PORT_ID,
  89. SWITCH_PORT_FLAG_TAGGED,
  90. SWITCH_PORT_ATTR_MAX
  91. };
  92. #define SWITCH_ATTR_DEFAULTS_OFFSET 0x1000
  93. #endif /* _UAPI_LINUX_SWITCH_H */