xref: /onnv-gate/usr/src/uts/sun4v/sys/vnet_mailbox.h (revision 12011:2377022c7a2d)
11991Sheppo /*
21991Sheppo  * CDDL HEADER START
31991Sheppo  *
41991Sheppo  * The contents of this file are subject to the terms of the
51991Sheppo  * Common Development and Distribution License (the "License").
61991Sheppo  * You may not use this file except in compliance with the License.
71991Sheppo  *
81991Sheppo  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
91991Sheppo  * or http://www.opensolaris.org/os/licensing.
101991Sheppo  * See the License for the specific language governing permissions
111991Sheppo  * and limitations under the License.
121991Sheppo  *
131991Sheppo  * When distributing Covered Code, include this CDDL HEADER in each
141991Sheppo  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
151991Sheppo  * If applicable, add the following below this CDDL HEADER, with the
161991Sheppo  * fields enclosed by brackets "[]" replaced with your own identifying
171991Sheppo  * information: Portions Copyright [yyyy] [name of copyright owner]
181991Sheppo  *
191991Sheppo  * CDDL HEADER END
201991Sheppo  */
211991Sheppo 
221991Sheppo /*
23*12011SSriharsha.Basavapatna@Sun.COM  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
241991Sheppo  * Use is subject to license terms.
251991Sheppo  */
261991Sheppo 
271991Sheppo #ifndef _SYS_VNET_MAILBOX_H
281991Sheppo #define	_SYS_VNET_MAILBOX_H
291991Sheppo 
301991Sheppo #ifdef __cplusplus
311991Sheppo extern "C" {
321991Sheppo #endif
331991Sheppo 
341991Sheppo #include <sys/vio_mailbox.h>
356495Sspeer #include <sys/dds.h>
361991Sheppo #include <sys/ethernet.h>
371991Sheppo 
381991Sheppo /*
391991Sheppo  * VNET specific Control envelopes: 0x0100 - 0x01FF
401991Sheppo  *	type == VIO_TYPE_CTRL
411991Sheppo  *	subtype == VIO_SUBTYPE_{INFO|ACK|NACK}
421991Sheppo  */
431991Sheppo #define	VNET_MCAST_INFO		0x0101
446495Sspeer #define	VNET_DDS_INFO		0x0102
459336SSriharsha.Basavapatna@Sun.COM #define	VNET_PHYSLINK_INFO	0x0103	/* Physical Link Information */
461991Sheppo 
471991Sheppo /*
481991Sheppo  * Vnet/Vswitch device attributes information message.
491991Sheppo  *
501991Sheppo  * tag.msgtype == VIO_TYPE_CTRL
511991Sheppo  * tag.submsgtype = VIO_SUBTYPE_{INFO|ACK|NACK}
521991Sheppo  * tag.subtype_env == VIO_ATTR_INFO
531991Sheppo  */
545365Slm66018 
555365Slm66018 /* Value for 'addr_type' in vnet attribute message */
565365Slm66018 #define	ADDR_TYPE_MAC		0x1
575365Slm66018 
589336SSriharsha.Basavapatna@Sun.COM /*
599336SSriharsha.Basavapatna@Sun.COM  * Physical link property updates to be negotiated as part of attribute message
609336SSriharsha.Basavapatna@Sun.COM  * exchange, in protocol versions >= 1.5. This is only valid between a vnet
619336SSriharsha.Basavapatna@Sun.COM  * client and the corresponding vswitch service; and not between peer vnets. A
629336SSriharsha.Basavapatna@Sun.COM  * vnet device could negotiate with vswitch to obtain updates about certain
639336SSriharsha.Basavapatna@Sun.COM  * physical link properties. Only 'physical link status' updates are supported
649336SSriharsha.Basavapatna@Sun.COM  * for now. A vnet device that desires to get physical link status updates,
659336SSriharsha.Basavapatna@Sun.COM  * sets the appropriate bit(s) in its ATTR/INFO message to the vswitch; the
669336SSriharsha.Basavapatna@Sun.COM  * vswitch sets the relevant ack/nack bits in its response message. Whenever
679336SSriharsha.Basavapatna@Sun.COM  * there is a change in the physical link props for which the vnet device has
689336SSriharsha.Basavapatna@Sun.COM  * negotiated, vswitch updates it by sending a message with updated values
699336SSriharsha.Basavapatna@Sun.COM  * of the relevant physical link properties (see vnet_physlink_msg_t below).
709336SSriharsha.Basavapatna@Sun.COM  */
719336SSriharsha.Basavapatna@Sun.COM enum {
729336SSriharsha.Basavapatna@Sun.COM 	PHYSLINK_UPDATE_NONE = 0,
739336SSriharsha.Basavapatna@Sun.COM 	PHYSLINK_UPDATE_STATE = 0x1,
749336SSriharsha.Basavapatna@Sun.COM 	PHYSLINK_UPDATE_STATE_ACK = 0x2,
759336SSriharsha.Basavapatna@Sun.COM 	PHYSLINK_UPDATE_STATE_NACK = 0x3
769336SSriharsha.Basavapatna@Sun.COM };
779336SSriharsha.Basavapatna@Sun.COM 
789336SSriharsha.Basavapatna@Sun.COM #define	PHYSLINK_UPDATE_STATE_MASK	0x3
799336SSriharsha.Basavapatna@Sun.COM 
801991Sheppo typedef struct vnet_attr_msg {
811991Sheppo 	/* Common tag */
821991Sheppo 	vio_msg_tag_t		tag;
831991Sheppo 
841991Sheppo 	/* attributes specific payload */
851991Sheppo 	uint8_t			xfer_mode;	/* data transfer mode */
861991Sheppo 	uint8_t			addr_type;	/* device address type */
871991Sheppo 	uint16_t		ack_freq;	/* ack after rcving # of pkts */
889336SSriharsha.Basavapatna@Sun.COM 	uint8_t			physlink_update; /* physlink updates(s)? */
89*12011SSriharsha.Basavapatna@Sun.COM 	uint8_t			options;	/* options - dring mode */
909336SSriharsha.Basavapatna@Sun.COM 	uint16_t		resv2;		/* reserved */
911991Sheppo 
921991Sheppo 	uint64_t		addr;		/* device address */
931991Sheppo 	uint64_t		mtu;		/* maximum data xfer unit */
941991Sheppo 
951991Sheppo 	/* padding to align things */
969336SSriharsha.Basavapatna@Sun.COM 	uint64_t		resv3[3];
971991Sheppo 
981991Sheppo } vnet_attr_msg_t;
991991Sheppo 
1001991Sheppo /*
1011991Sheppo  * Vnet/Vswitch enable/disable multicast address msg
1021991Sheppo  *
1031991Sheppo  * tag.msgtype == VIO_TYPE_CTRL
1041991Sheppo  * tag.subtype == VIO_SUBTYPE_{INFO|ACK|NACK}
1051991Sheppo  * tag.subtype_env == VNET_MCAST_INFO
1061991Sheppo  */
1071991Sheppo #define	VNET_NUM_MCAST	7	/* max # of multicast addresses in the msg */
1081991Sheppo 
1091991Sheppo typedef struct vnet_mcast_msg {
1101991Sheppo 	/* Common tag */
1111991Sheppo 	vio_msg_tag_t		tag;
1121991Sheppo 
1131991Sheppo 	/* multicast address information */
1141991Sheppo 	uint8_t			set;	/* add if set to 1, else remove */
1151991Sheppo 	uint8_t			count;	/* number of addrs in the msg */
1161991Sheppo 	struct ether_addr	mca[VNET_NUM_MCAST];	/* mcast addrs */
1171991Sheppo 	uint32_t		resv1;	/* padding */
1181991Sheppo } vnet_mcast_msg_t;
1191991Sheppo 
1209336SSriharsha.Basavapatna@Sun.COM /*
1219336SSriharsha.Basavapatna@Sun.COM  * Values of the various physical link properties. We
1229336SSriharsha.Basavapatna@Sun.COM  * support only 'link state' property updates for now.
1239336SSriharsha.Basavapatna@Sun.COM  */
1249336SSriharsha.Basavapatna@Sun.COM enum {
1259336SSriharsha.Basavapatna@Sun.COM 	VNET_PHYSLINK_STATE_DOWN = 0x1,
1269336SSriharsha.Basavapatna@Sun.COM 	VNET_PHYSLINK_STATE_UP = 0x2,
1279336SSriharsha.Basavapatna@Sun.COM 	VNET_PHYSLINK_STATE_UNKNOWN = 0x3
1289336SSriharsha.Basavapatna@Sun.COM };
1299336SSriharsha.Basavapatna@Sun.COM 
1309336SSriharsha.Basavapatna@Sun.COM #define	VNET_PHYSLINK_STATE_MASK	0x3
1319336SSriharsha.Basavapatna@Sun.COM 
1329336SSriharsha.Basavapatna@Sun.COM /*
1339336SSriharsha.Basavapatna@Sun.COM  * Vnet/Vswitch physical link info message.
1349336SSriharsha.Basavapatna@Sun.COM  * We only support link state information for now.
1359336SSriharsha.Basavapatna@Sun.COM  *
1369336SSriharsha.Basavapatna@Sun.COM  * tag.msgtype == VIO_TYPE_CTRL
1379336SSriharsha.Basavapatna@Sun.COM  * tag.subtype == VIO_SUBTYPE_{INFO|ACK|NACK}
1389336SSriharsha.Basavapatna@Sun.COM  * tag.subtype_env == VNET_PHYSLINK_INFO
1399336SSriharsha.Basavapatna@Sun.COM  */
1409336SSriharsha.Basavapatna@Sun.COM typedef struct vnet_physlink_msg {
1419336SSriharsha.Basavapatna@Sun.COM 	/* Common tag */
1429336SSriharsha.Basavapatna@Sun.COM 	vio_msg_tag_t		tag;
1439336SSriharsha.Basavapatna@Sun.COM 
1449336SSriharsha.Basavapatna@Sun.COM 	/* physical link information */
1459336SSriharsha.Basavapatna@Sun.COM 	uint32_t		physlink_info;
1469336SSriharsha.Basavapatna@Sun.COM 
1479336SSriharsha.Basavapatna@Sun.COM 	/* padding to align things */
1489336SSriharsha.Basavapatna@Sun.COM 	uint32_t		resv1;
1499336SSriharsha.Basavapatna@Sun.COM 	uint64_t		resv2[5];
1509336SSriharsha.Basavapatna@Sun.COM } vnet_physlink_msg_t;
1519336SSriharsha.Basavapatna@Sun.COM 
1521991Sheppo #ifdef __cplusplus
1531991Sheppo }
1541991Sheppo #endif
1551991Sheppo 
1561991Sheppo #endif	/* _SYS_VNET_MAILBOX_H */
157