blob: 9ef81f14835169513063e8b459abb088242306ca [file] [log] [blame]
Scott Feldmanf8bd9092010-05-17 22:50:19 -07001/*
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
19#ifndef _VNIC_VIC_H_
20#define _VNIC_VIC_H_
21
22/* Note: All integer fields in NETWORK byte order */
23
24/* Note: String field lengths include null char */
25
26#define VIC_PROVINFO_CISCO_OUI { 0x00, 0x00, 0x0c }
Roopa Prabhu6c2c9d92010-12-10 12:02:33 +000027#define VIC_PROVINFO_GENERIC_TYPE 0x4
Scott Feldmanf8bd9092010-05-17 22:50:19 -070028
Roopa Prabhu6c2c9d92010-12-10 12:02:33 +000029enum vic_generic_prov_tlv_type {
30 VIC_GENERIC_PROV_TLV_PORT_PROFILE_NAME_STR = 0,
31 VIC_GENERIC_PROV_TLV_CLIENT_MAC_ADDR = 1,
32 VIC_GENERIC_PROV_TLV_CLIENT_NAME_STR = 2,
33 VIC_GENERIC_PROV_TLV_CLUSTER_PORT_NAME_STR = 3,
34 VIC_GENERIC_PROV_TLV_CLUSTER_PORT_UUID_STR = 4,
35 VIC_GENERIC_PROV_TLV_CLUSTER_UUID_STR = 5,
36 VIC_GENERIC_PROV_TLV_CLUSTER_NAME_STR = 7,
37 VIC_GENERIC_PROV_TLV_HOST_UUID_STR = 8,
38 VIC_GENERIC_PROV_TLV_CLIENT_UUID_STR = 9,
39 VIC_GENERIC_PROV_TLV_INCARNATION_NUMBER = 10,
40 VIC_GENERIC_PROV_TLV_OS_TYPE = 11,
41 VIC_GENERIC_PROV_TLV_OS_VENDOR = 12,
42 VIC_GENERIC_PROV_TLV_CLIENT_TYPE = 15,
43};
44
45enum vic_generic_prov_os_type {
46 VIC_GENERIC_PROV_OS_TYPE_UNKNOWN = 0,
47 VIC_GENERIC_PROV_OS_TYPE_ESX = 1,
48 VIC_GENERIC_PROV_OS_TYPE_LINUX = 2,
49 VIC_GENERIC_PROV_OS_TYPE_WINDOWS = 3,
Roopa Prabhu756462f2011-03-29 20:36:02 +000050 VIC_GENERIC_PROV_OS_TYPE_SOLARIS = 4,
Scott Feldmanf8bd9092010-05-17 22:50:19 -070051};
52
53struct vic_provinfo {
54 u8 oui[3]; /* OUI of data provider */
55 u8 type; /* provider-specific type */
56 u32 length; /* length of data below */
57 u32 num_tlvs; /* number of tlvs */
58 struct vic_provinfo_tlv {
59 u16 type;
60 u16 length;
61 u8 value[0];
62 } tlv[0];
Eric Dumazetba2d3582010-06-02 18:10:09 +000063} __packed;
Scott Feldmanf8bd9092010-05-17 22:50:19 -070064
Roopa Prabhu756462f2011-03-29 20:36:02 +000065#define VIC_PROVINFO_ADD_TLV(vp, tlvtype, tlvlen, data) \
66 do { \
67 err = vic_provinfo_add_tlv(vp, tlvtype, tlvlen, data); \
68 if (err) \
69 goto add_tlv_failure; \
70 } while (0)
71
Scott Feldmanf8bd9092010-05-17 22:50:19 -070072#define VIC_PROVINFO_MAX_DATA 1385
73#define VIC_PROVINFO_MAX_TLV_DATA (VIC_PROVINFO_MAX_DATA - \
74 sizeof(struct vic_provinfo))
75
Roopa Prabhu756462f2011-03-29 20:36:02 +000076struct vic_provinfo *vic_provinfo_alloc(gfp_t flags, const u8 *oui,
77 const u8 type);
Scott Feldmanf8bd9092010-05-17 22:50:19 -070078void vic_provinfo_free(struct vic_provinfo *vp);
79int vic_provinfo_add_tlv(struct vic_provinfo *vp, u16 type, u16 length,
Roopa Prabhu756462f2011-03-29 20:36:02 +000080 const void *value);
Scott Feldmanf8bd9092010-05-17 22:50:19 -070081size_t vic_provinfo_size(struct vic_provinfo *vp);
82
83#endif /* _VNIC_VIC_H_ */