1*e6550b3eSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 2*e6550b3eSThomas Gleixner /* Copyright 2010 Cisco Systems, Inc. All rights reserved. */ 3a6a5580cSJeff Kirsher 4a6a5580cSJeff Kirsher #ifndef _VNIC_VIC_H_ 5a6a5580cSJeff Kirsher #define _VNIC_VIC_H_ 6a6a5580cSJeff Kirsher 7a6a5580cSJeff Kirsher /* Note: All integer fields in NETWORK byte order */ 8a6a5580cSJeff Kirsher 9a6a5580cSJeff Kirsher /* Note: String field lengths include null char */ 10a6a5580cSJeff Kirsher 11a6a5580cSJeff Kirsher #define VIC_PROVINFO_CISCO_OUI { 0x00, 0x00, 0x0c } 12a6a5580cSJeff Kirsher #define VIC_PROVINFO_GENERIC_TYPE 0x4 13a6a5580cSJeff Kirsher 14a6a5580cSJeff Kirsher enum vic_generic_prov_tlv_type { 15a6a5580cSJeff Kirsher VIC_GENERIC_PROV_TLV_PORT_PROFILE_NAME_STR = 0, 16a6a5580cSJeff Kirsher VIC_GENERIC_PROV_TLV_CLIENT_MAC_ADDR = 1, 17a6a5580cSJeff Kirsher VIC_GENERIC_PROV_TLV_CLIENT_NAME_STR = 2, 18a6a5580cSJeff Kirsher VIC_GENERIC_PROV_TLV_CLUSTER_PORT_NAME_STR = 3, 19a6a5580cSJeff Kirsher VIC_GENERIC_PROV_TLV_CLUSTER_PORT_UUID_STR = 4, 20a6a5580cSJeff Kirsher VIC_GENERIC_PROV_TLV_CLUSTER_UUID_STR = 5, 21a6a5580cSJeff Kirsher VIC_GENERIC_PROV_TLV_CLUSTER_NAME_STR = 7, 22a6a5580cSJeff Kirsher VIC_GENERIC_PROV_TLV_HOST_UUID_STR = 8, 23a6a5580cSJeff Kirsher VIC_GENERIC_PROV_TLV_CLIENT_UUID_STR = 9, 24a6a5580cSJeff Kirsher VIC_GENERIC_PROV_TLV_INCARNATION_NUMBER = 10, 25a6a5580cSJeff Kirsher VIC_GENERIC_PROV_TLV_OS_TYPE = 11, 26a6a5580cSJeff Kirsher VIC_GENERIC_PROV_TLV_OS_VENDOR = 12, 27a6a5580cSJeff Kirsher VIC_GENERIC_PROV_TLV_CLIENT_TYPE = 15, 28a6a5580cSJeff Kirsher }; 29a6a5580cSJeff Kirsher 30a6a5580cSJeff Kirsher enum vic_generic_prov_os_type { 31a6a5580cSJeff Kirsher VIC_GENERIC_PROV_OS_TYPE_UNKNOWN = 0, 32a6a5580cSJeff Kirsher VIC_GENERIC_PROV_OS_TYPE_ESX = 1, 33a6a5580cSJeff Kirsher VIC_GENERIC_PROV_OS_TYPE_LINUX = 2, 34a6a5580cSJeff Kirsher VIC_GENERIC_PROV_OS_TYPE_WINDOWS = 3, 35a6a5580cSJeff Kirsher VIC_GENERIC_PROV_OS_TYPE_SOLARIS = 4, 36a6a5580cSJeff Kirsher }; 37a6a5580cSJeff Kirsher 38a6a5580cSJeff Kirsher struct vic_provinfo { 39a6a5580cSJeff Kirsher u8 oui[3]; /* OUI of data provider */ 40a6a5580cSJeff Kirsher u8 type; /* provider-specific type */ 41a6a5580cSJeff Kirsher u32 length; /* length of data below */ 42a6a5580cSJeff Kirsher u32 num_tlvs; /* number of tlvs */ 43a6a5580cSJeff Kirsher struct vic_provinfo_tlv { 44a6a5580cSJeff Kirsher u16 type; 45a6a5580cSJeff Kirsher u16 length; 46a6a5580cSJeff Kirsher u8 value[0]; 47d1c73cbdSGustavo A. R. Silva } tlv[]; 48a6a5580cSJeff Kirsher } __packed; 49a6a5580cSJeff Kirsher 50a6a5580cSJeff Kirsher #define VIC_PROVINFO_ADD_TLV(vp, tlvtype, tlvlen, data) \ 51a6a5580cSJeff Kirsher do { \ 52a6a5580cSJeff Kirsher err = vic_provinfo_add_tlv(vp, tlvtype, tlvlen, data); \ 53a6a5580cSJeff Kirsher if (err) \ 54a6a5580cSJeff Kirsher goto add_tlv_failure; \ 55a6a5580cSJeff Kirsher } while (0) 56a6a5580cSJeff Kirsher 57a6a5580cSJeff Kirsher #define VIC_PROVINFO_MAX_DATA 1385 58a6a5580cSJeff Kirsher #define VIC_PROVINFO_MAX_TLV_DATA (VIC_PROVINFO_MAX_DATA - \ 59a6a5580cSJeff Kirsher sizeof(struct vic_provinfo)) 60a6a5580cSJeff Kirsher 61a6a5580cSJeff Kirsher struct vic_provinfo *vic_provinfo_alloc(gfp_t flags, const u8 *oui, 62a6a5580cSJeff Kirsher const u8 type); 63a6a5580cSJeff Kirsher void vic_provinfo_free(struct vic_provinfo *vp); 64a6a5580cSJeff Kirsher int vic_provinfo_add_tlv(struct vic_provinfo *vp, u16 type, u16 length, 65a6a5580cSJeff Kirsher const void *value); 66a6a5580cSJeff Kirsher size_t vic_provinfo_size(struct vic_provinfo *vp); 67a6a5580cSJeff Kirsher 68a6a5580cSJeff Kirsher #endif /* _VNIC_VIC_H_ */ 69