vnic_vic.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright 2010 Cisco Systems, Inc. All rights reserved.
  3. *
  4. * This program is free software; you may redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; version 2 of the License.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  9. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  10. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  11. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  12. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  13. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  14. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  15. * SOFTWARE.
  16. *
  17. */
  18. #ifndef _VNIC_VIC_H_
  19. #define _VNIC_VIC_H_
  20. /* Note: All integer fields in NETWORK byte order */
  21. /* Note: String field lengths include null char */
  22. #define VIC_PROVINFO_CISCO_OUI { 0x00, 0x00, 0x0c }
  23. #define VIC_PROVINFO_GENERIC_TYPE 0x4
  24. enum vic_generic_prov_tlv_type {
  25. VIC_GENERIC_PROV_TLV_PORT_PROFILE_NAME_STR = 0,
  26. VIC_GENERIC_PROV_TLV_CLIENT_MAC_ADDR = 1,
  27. VIC_GENERIC_PROV_TLV_CLIENT_NAME_STR = 2,
  28. VIC_GENERIC_PROV_TLV_CLUSTER_PORT_NAME_STR = 3,
  29. VIC_GENERIC_PROV_TLV_CLUSTER_PORT_UUID_STR = 4,
  30. VIC_GENERIC_PROV_TLV_CLUSTER_UUID_STR = 5,
  31. VIC_GENERIC_PROV_TLV_CLUSTER_NAME_STR = 7,
  32. VIC_GENERIC_PROV_TLV_HOST_UUID_STR = 8,
  33. VIC_GENERIC_PROV_TLV_CLIENT_UUID_STR = 9,
  34. VIC_GENERIC_PROV_TLV_INCARNATION_NUMBER = 10,
  35. VIC_GENERIC_PROV_TLV_OS_TYPE = 11,
  36. VIC_GENERIC_PROV_TLV_OS_VENDOR = 12,
  37. VIC_GENERIC_PROV_TLV_CLIENT_TYPE = 15,
  38. };
  39. enum vic_generic_prov_os_type {
  40. VIC_GENERIC_PROV_OS_TYPE_UNKNOWN = 0,
  41. VIC_GENERIC_PROV_OS_TYPE_ESX = 1,
  42. VIC_GENERIC_PROV_OS_TYPE_LINUX = 2,
  43. VIC_GENERIC_PROV_OS_TYPE_WINDOWS = 3,
  44. VIC_GENERIC_PROV_OS_TYPE_SOLARIS = 4,
  45. };
  46. struct vic_provinfo {
  47. u8 oui[3]; /* OUI of data provider */
  48. u8 type; /* provider-specific type */
  49. u32 length; /* length of data below */
  50. u32 num_tlvs; /* number of tlvs */
  51. struct vic_provinfo_tlv {
  52. u16 type;
  53. u16 length;
  54. u8 value[0];
  55. } tlv[0];
  56. } __packed;
  57. #define VIC_PROVINFO_ADD_TLV(vp, tlvtype, tlvlen, data) \
  58. do { \
  59. err = vic_provinfo_add_tlv(vp, tlvtype, tlvlen, data); \
  60. if (err) \
  61. goto add_tlv_failure; \
  62. } while (0)
  63. #define VIC_PROVINFO_MAX_DATA 1385
  64. #define VIC_PROVINFO_MAX_TLV_DATA (VIC_PROVINFO_MAX_DATA - \
  65. sizeof(struct vic_provinfo))
  66. struct vic_provinfo *vic_provinfo_alloc(gfp_t flags, const u8 *oui,
  67. const u8 type);
  68. void vic_provinfo_free(struct vic_provinfo *vp);
  69. int vic_provinfo_add_tlv(struct vic_provinfo *vp, u16 type, u16 length,
  70. const void *value);
  71. size_t vic_provinfo_size(struct vic_provinfo *vp);
  72. #endif /* _VNIC_VIC_H_ */