xref: /titanic_41/usr/src/uts/sun4v/sys/vnet_mailbox.h (revision 861a91627796c35220e75654dac61e5707536dcd)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_VNET_MAILBOX_H
28 #define	_SYS_VNET_MAILBOX_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #include <sys/vio_mailbox.h>
35 #include <sys/dds.h>
36 #include <sys/ethernet.h>
37 
38 /*
39  * VNET specific Control envelopes: 0x0100 - 0x01FF
40  *	type == VIO_TYPE_CTRL
41  *	subtype == VIO_SUBTYPE_{INFO|ACK|NACK}
42  */
43 #define	VNET_MCAST_INFO		0x0101
44 #define	VNET_DDS_INFO		0x0102
45 #define	VNET_PHYSLINK_INFO	0x0103	/* Physical Link Information */
46 
47 /*
48  * Vnet/Vswitch device attributes information message.
49  *
50  * tag.msgtype == VIO_TYPE_CTRL
51  * tag.submsgtype = VIO_SUBTYPE_{INFO|ACK|NACK}
52  * tag.subtype_env == VIO_ATTR_INFO
53  */
54 
55 /* Value for 'addr_type' in vnet attribute message */
56 #define	ADDR_TYPE_MAC		0x1
57 
58 /*
59  * Physical link property updates to be negotiated as part of attribute message
60  * exchange, in protocol versions >= 1.5. This is only valid between a vnet
61  * client and the corresponding vswitch service; and not between peer vnets. A
62  * vnet device could negotiate with vswitch to obtain updates about certain
63  * physical link properties. Only 'physical link status' updates are supported
64  * for now. A vnet device that desires to get physical link status updates,
65  * sets the appropriate bit(s) in its ATTR/INFO message to the vswitch; the
66  * vswitch sets the relevant ack/nack bits in its response message. Whenever
67  * there is a change in the physical link props for which the vnet device has
68  * negotiated, vswitch updates it by sending a message with updated values
69  * of the relevant physical link properties (see vnet_physlink_msg_t below).
70  */
71 enum {
72 	PHYSLINK_UPDATE_NONE = 0,
73 	PHYSLINK_UPDATE_STATE = 0x1,
74 	PHYSLINK_UPDATE_STATE_ACK = 0x2,
75 	PHYSLINK_UPDATE_STATE_NACK = 0x3
76 };
77 
78 #define	PHYSLINK_UPDATE_STATE_MASK	0x3
79 
80 typedef struct vnet_attr_msg {
81 	/* Common tag */
82 	vio_msg_tag_t		tag;
83 
84 	/* attributes specific payload */
85 	uint8_t			xfer_mode;	/* data transfer mode */
86 	uint8_t			addr_type;	/* device address type */
87 	uint16_t		ack_freq;	/* ack after rcving # of pkts */
88 	uint8_t			physlink_update; /* physlink updates(s)? */
89 	uint8_t			options;	/* options - dring mode */
90 	uint16_t		resv2;		/* reserved */
91 
92 	uint64_t		addr;		/* device address */
93 	uint64_t		mtu;		/* maximum data xfer unit */
94 
95 	/* padding to align things */
96 	uint64_t		resv3[3];
97 
98 } vnet_attr_msg_t;
99 
100 /*
101  * Vnet/Vswitch enable/disable multicast address msg
102  *
103  * tag.msgtype == VIO_TYPE_CTRL
104  * tag.subtype == VIO_SUBTYPE_{INFO|ACK|NACK}
105  * tag.subtype_env == VNET_MCAST_INFO
106  */
107 #define	VNET_NUM_MCAST	7	/* max # of multicast addresses in the msg */
108 
109 typedef struct vnet_mcast_msg {
110 	/* Common tag */
111 	vio_msg_tag_t		tag;
112 
113 	/* multicast address information */
114 	uint8_t			set;	/* add if set to 1, else remove */
115 	uint8_t			count;	/* number of addrs in the msg */
116 	struct ether_addr	mca[VNET_NUM_MCAST];	/* mcast addrs */
117 	uint32_t		resv1;	/* padding */
118 } vnet_mcast_msg_t;
119 
120 /*
121  * Values of the various physical link properties. We
122  * support only 'link state' property updates for now.
123  */
124 enum {
125 	VNET_PHYSLINK_STATE_DOWN = 0x1,
126 	VNET_PHYSLINK_STATE_UP = 0x2,
127 	VNET_PHYSLINK_STATE_UNKNOWN = 0x3
128 };
129 
130 #define	VNET_PHYSLINK_STATE_MASK	0x3
131 
132 /*
133  * Vnet/Vswitch physical link info message.
134  * We only support link state information for now.
135  *
136  * tag.msgtype == VIO_TYPE_CTRL
137  * tag.subtype == VIO_SUBTYPE_{INFO|ACK|NACK}
138  * tag.subtype_env == VNET_PHYSLINK_INFO
139  */
140 typedef struct vnet_physlink_msg {
141 	/* Common tag */
142 	vio_msg_tag_t		tag;
143 
144 	/* physical link information */
145 	uint32_t		physlink_info;
146 
147 	/* padding to align things */
148 	uint32_t		resv1;
149 	uint64_t		resv2[5];
150 } vnet_physlink_msg_t;
151 
152 #ifdef __cplusplus
153 }
154 #endif
155 
156 #endif	/* _SYS_VNET_MAILBOX_H */
157