xref: /titanic_44/usr/src/uts/sun4v/sys/vnet_mailbox.h (revision 7bd3a2e26cc8569257b88c1691d559138e1d32d0)
11ae08745Sheppo /*
21ae08745Sheppo  * CDDL HEADER START
31ae08745Sheppo  *
41ae08745Sheppo  * The contents of this file are subject to the terms of the
51ae08745Sheppo  * Common Development and Distribution License (the "License").
61ae08745Sheppo  * You may not use this file except in compliance with the License.
71ae08745Sheppo  *
81ae08745Sheppo  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
91ae08745Sheppo  * or http://www.opensolaris.org/os/licensing.
101ae08745Sheppo  * See the License for the specific language governing permissions
111ae08745Sheppo  * and limitations under the License.
121ae08745Sheppo  *
131ae08745Sheppo  * When distributing Covered Code, include this CDDL HEADER in each
141ae08745Sheppo  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
151ae08745Sheppo  * If applicable, add the following below this CDDL HEADER, with the
161ae08745Sheppo  * fields enclosed by brackets "[]" replaced with your own identifying
171ae08745Sheppo  * information: Portions Copyright [yyyy] [name of copyright owner]
181ae08745Sheppo  *
191ae08745Sheppo  * CDDL HEADER END
201ae08745Sheppo  */
211ae08745Sheppo 
221ae08745Sheppo /*
23*7bd3a2e2SSriharsha Basavapatna  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
241ae08745Sheppo  * Use is subject to license terms.
251ae08745Sheppo  */
261ae08745Sheppo 
271ae08745Sheppo #ifndef _SYS_VNET_MAILBOX_H
281ae08745Sheppo #define	_SYS_VNET_MAILBOX_H
291ae08745Sheppo 
301ae08745Sheppo #ifdef __cplusplus
311ae08745Sheppo extern "C" {
321ae08745Sheppo #endif
331ae08745Sheppo 
341ae08745Sheppo #include <sys/vio_mailbox.h>
35678453a8Sspeer #include <sys/dds.h>
361ae08745Sheppo #include <sys/ethernet.h>
371ae08745Sheppo 
381ae08745Sheppo /*
391ae08745Sheppo  * VNET specific Control envelopes: 0x0100 - 0x01FF
401ae08745Sheppo  *	type == VIO_TYPE_CTRL
411ae08745Sheppo  *	subtype == VIO_SUBTYPE_{INFO|ACK|NACK}
421ae08745Sheppo  */
431ae08745Sheppo #define	VNET_MCAST_INFO		0x0101
44678453a8Sspeer #define	VNET_DDS_INFO		0x0102
451107ea93SSriharsha Basavapatna #define	VNET_PHYSLINK_INFO	0x0103	/* Physical Link Information */
461ae08745Sheppo 
471ae08745Sheppo /*
481ae08745Sheppo  * Vnet/Vswitch device attributes information message.
491ae08745Sheppo  *
501ae08745Sheppo  * tag.msgtype == VIO_TYPE_CTRL
511ae08745Sheppo  * tag.submsgtype = VIO_SUBTYPE_{INFO|ACK|NACK}
521ae08745Sheppo  * tag.subtype_env == VIO_ATTR_INFO
531ae08745Sheppo  */
5417cadca8Slm66018 
5517cadca8Slm66018 /* Value for 'addr_type' in vnet attribute message */
5617cadca8Slm66018 #define	ADDR_TYPE_MAC		0x1
5717cadca8Slm66018 
581107ea93SSriharsha Basavapatna /*
591107ea93SSriharsha Basavapatna  * Physical link property updates to be negotiated as part of attribute message
601107ea93SSriharsha Basavapatna  * exchange, in protocol versions >= 1.5. This is only valid between a vnet
611107ea93SSriharsha Basavapatna  * client and the corresponding vswitch service; and not between peer vnets. A
621107ea93SSriharsha Basavapatna  * vnet device could negotiate with vswitch to obtain updates about certain
631107ea93SSriharsha Basavapatna  * physical link properties. Only 'physical link status' updates are supported
641107ea93SSriharsha Basavapatna  * for now. A vnet device that desires to get physical link status updates,
651107ea93SSriharsha Basavapatna  * sets the appropriate bit(s) in its ATTR/INFO message to the vswitch; the
661107ea93SSriharsha Basavapatna  * vswitch sets the relevant ack/nack bits in its response message. Whenever
671107ea93SSriharsha Basavapatna  * there is a change in the physical link props for which the vnet device has
681107ea93SSriharsha Basavapatna  * negotiated, vswitch updates it by sending a message with updated values
691107ea93SSriharsha Basavapatna  * of the relevant physical link properties (see vnet_physlink_msg_t below).
701107ea93SSriharsha Basavapatna  */
711107ea93SSriharsha Basavapatna enum {
721107ea93SSriharsha Basavapatna 	PHYSLINK_UPDATE_NONE = 0,
731107ea93SSriharsha Basavapatna 	PHYSLINK_UPDATE_STATE = 0x1,
741107ea93SSriharsha Basavapatna 	PHYSLINK_UPDATE_STATE_ACK = 0x2,
751107ea93SSriharsha Basavapatna 	PHYSLINK_UPDATE_STATE_NACK = 0x3
761107ea93SSriharsha Basavapatna };
771107ea93SSriharsha Basavapatna 
781107ea93SSriharsha Basavapatna #define	PHYSLINK_UPDATE_STATE_MASK	0x3
791107ea93SSriharsha Basavapatna 
801ae08745Sheppo typedef struct vnet_attr_msg {
811ae08745Sheppo 	/* Common tag */
821ae08745Sheppo 	vio_msg_tag_t		tag;
831ae08745Sheppo 
841ae08745Sheppo 	/* attributes specific payload */
851ae08745Sheppo 	uint8_t			xfer_mode;	/* data transfer mode */
861ae08745Sheppo 	uint8_t			addr_type;	/* device address type */
871ae08745Sheppo 	uint16_t		ack_freq;	/* ack after rcving # of pkts */
881107ea93SSriharsha Basavapatna 	uint8_t			physlink_update; /* physlink updates(s)? */
89*7bd3a2e2SSriharsha Basavapatna 	uint8_t			options;	/* options - dring mode */
901107ea93SSriharsha Basavapatna 	uint16_t		resv2;		/* reserved */
911ae08745Sheppo 
921ae08745Sheppo 	uint64_t		addr;		/* device address */
931ae08745Sheppo 	uint64_t		mtu;		/* maximum data xfer unit */
941ae08745Sheppo 
951ae08745Sheppo 	/* padding to align things */
961107ea93SSriharsha Basavapatna 	uint64_t		resv3[3];
971ae08745Sheppo 
981ae08745Sheppo } vnet_attr_msg_t;
991ae08745Sheppo 
1001ae08745Sheppo /*
1011ae08745Sheppo  * Vnet/Vswitch enable/disable multicast address msg
1021ae08745Sheppo  *
1031ae08745Sheppo  * tag.msgtype == VIO_TYPE_CTRL
1041ae08745Sheppo  * tag.subtype == VIO_SUBTYPE_{INFO|ACK|NACK}
1051ae08745Sheppo  * tag.subtype_env == VNET_MCAST_INFO
1061ae08745Sheppo  */
1071ae08745Sheppo #define	VNET_NUM_MCAST	7	/* max # of multicast addresses in the msg */
1081ae08745Sheppo 
1091ae08745Sheppo typedef struct vnet_mcast_msg {
1101ae08745Sheppo 	/* Common tag */
1111ae08745Sheppo 	vio_msg_tag_t		tag;
1121ae08745Sheppo 
1131ae08745Sheppo 	/* multicast address information */
1141ae08745Sheppo 	uint8_t			set;	/* add if set to 1, else remove */
1151ae08745Sheppo 	uint8_t			count;	/* number of addrs in the msg */
1161ae08745Sheppo 	struct ether_addr	mca[VNET_NUM_MCAST];	/* mcast addrs */
1171ae08745Sheppo 	uint32_t		resv1;	/* padding */
1181ae08745Sheppo } vnet_mcast_msg_t;
1191ae08745Sheppo 
1201107ea93SSriharsha Basavapatna /*
1211107ea93SSriharsha Basavapatna  * Values of the various physical link properties. We
1221107ea93SSriharsha Basavapatna  * support only 'link state' property updates for now.
1231107ea93SSriharsha Basavapatna  */
1241107ea93SSriharsha Basavapatna enum {
1251107ea93SSriharsha Basavapatna 	VNET_PHYSLINK_STATE_DOWN = 0x1,
1261107ea93SSriharsha Basavapatna 	VNET_PHYSLINK_STATE_UP = 0x2,
1271107ea93SSriharsha Basavapatna 	VNET_PHYSLINK_STATE_UNKNOWN = 0x3
1281107ea93SSriharsha Basavapatna };
1291107ea93SSriharsha Basavapatna 
1301107ea93SSriharsha Basavapatna #define	VNET_PHYSLINK_STATE_MASK	0x3
1311107ea93SSriharsha Basavapatna 
1321107ea93SSriharsha Basavapatna /*
1331107ea93SSriharsha Basavapatna  * Vnet/Vswitch physical link info message.
1341107ea93SSriharsha Basavapatna  * We only support link state information for now.
1351107ea93SSriharsha Basavapatna  *
1361107ea93SSriharsha Basavapatna  * tag.msgtype == VIO_TYPE_CTRL
1371107ea93SSriharsha Basavapatna  * tag.subtype == VIO_SUBTYPE_{INFO|ACK|NACK}
1381107ea93SSriharsha Basavapatna  * tag.subtype_env == VNET_PHYSLINK_INFO
1391107ea93SSriharsha Basavapatna  */
1401107ea93SSriharsha Basavapatna typedef struct vnet_physlink_msg {
1411107ea93SSriharsha Basavapatna 	/* Common tag */
1421107ea93SSriharsha Basavapatna 	vio_msg_tag_t		tag;
1431107ea93SSriharsha Basavapatna 
1441107ea93SSriharsha Basavapatna 	/* physical link information */
1451107ea93SSriharsha Basavapatna 	uint32_t		physlink_info;
1461107ea93SSriharsha Basavapatna 
1471107ea93SSriharsha Basavapatna 	/* padding to align things */
1481107ea93SSriharsha Basavapatna 	uint32_t		resv1;
1491107ea93SSriharsha Basavapatna 	uint64_t		resv2[5];
1501107ea93SSriharsha Basavapatna } vnet_physlink_msg_t;
1511107ea93SSriharsha Basavapatna 
1521ae08745Sheppo #ifdef __cplusplus
1531ae08745Sheppo }
1541ae08745Sheppo #endif
1551ae08745Sheppo 
1561ae08745Sheppo #endif	/* _SYS_VNET_MAILBOX_H */
157