vnic.h revision da14cebe459d3275048785f25bd869cb09b5307f
2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#ifndef _SYS_VNIC_H
2N/A#define _SYS_VNIC_H
2N/A
2N/A#include <sys/types.h>
2N/A#include <sys/ethernet.h>
2N/A#include <sys/param.h>
2N/A#include <sys/mac.h>
2N/A#include <sys/mac_flow.h>
2N/A#include <sys/dld_ioc.h>
2N/A#include <inet/ip.h>
2N/A#include <inet/ip6.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A/*
2N/A * Extended diagnostic codes that can be returned by the various
2N/A */
2N/Atypedef enum {
2N/A VNIC_IOC_DIAG_NONE,
2N/A VNIC_IOC_DIAG_MACADDR_NIC,
2N/A VNIC_IOC_DIAG_MACADDR_INUSE,
2N/A VNIC_IOC_DIAG_MACADDR_INVALID,
2N/A VNIC_IOC_DIAG_MACADDRLEN_INVALID,
2N/A VNIC_IOC_DIAG_MACFACTORYSLOTINVALID,
2N/A VNIC_IOC_DIAG_MACFACTORYSLOTUSED,
2N/A VNIC_IOC_DIAG_MACFACTORYSLOTALLUSED,
2N/A VNIC_IOC_DIAG_MACFACTORYNOTSUP,
2N/A VNIC_IOC_DIAG_MACPREFIX_INVALID,
2N/A VNIC_IOC_DIAG_MACPREFIXLEN_INVALID,
2N/A VNIC_IOC_DIAG_MACMARGIN_INVALID,
2N/A VNIC_IOC_DIAG_NO_HWRINGS
2N/A} vnic_ioc_diag_t;
2N/A
2N/A/*
2N/A * Allowed VNIC MAC address types.
2N/A *
2N/A * - VNIC_MAC_ADDR_TYPE_FIXED, VNIC_MAC_ADDR_TYPE_RANDOM:
2N/A * The MAC address is specified by value by the caller, which
2N/A * itself can obtain it from the user directly,
2N/A * or pick it in a random fashion. Which method is used by the
2N/A * caller is irrelevant to the VNIC driver. However two different
2N/A * types are provided so that the information can be made available
2N/A * back to user-space when listing the kernel defined VNICs.
2N/A *
2N/A * When a VNIC is created, the address in passed through the
2N/A * vc_mac_addr and vc_mac_len fields of the vnic_ioc_create_t
2N/A * structure.
2N/A *
2N/A * - VNIC_MAC_ADDR_TYPE_FACTORY: the MAC address is obtained from
2N/A * one of the MAC factory MAC addresses of the underyling NIC.
2N/A *
2N/A * - VNIC_MAC_ADDR_TYPE_AUTO: the VNIC driver attempts to
2N/A * obtain the address from one of the factory MAC addresses of
2N/A * the underlying NIC. If none is available, the specified
2N/A * MAC address value is used.
2N/A *
2N/A * - VNIC_MAC_ADDR_TYPE_PRIMARY: this is a VNIC based VLAN. The
2N/A * address for this is the address of the primary MAC client.
2N/A *
2N/A */
2N/A
2N/Atypedef enum {
2N/A VNIC_MAC_ADDR_TYPE_FIXED,
2N/A VNIC_MAC_ADDR_TYPE_RANDOM,
2N/A VNIC_MAC_ADDR_TYPE_FACTORY,
2N/A VNIC_MAC_ADDR_TYPE_AUTO,
2N/A VNIC_MAC_ADDR_TYPE_PRIMARY
2N/A} vnic_mac_addr_type_t;
2N/A
2N/A#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
2N/A#pragma pack(4)
2N/A#endif
2N/A
2N/A#define VNIC_IOC_CREATE VNICIOC(1)
2N/A
2N/A#define VNIC_IOC_CREATE_NODUPCHECK 0x00000001
2N/A#define VNIC_IOC_CREATE_ANCHOR 0x00000002
2N/A
2N/A/*
2N/A * Force creation of VLAN based VNIC without checking if the
2N/A * undelying MAC supports the margin size.
2N/A */
2N/A#define VNIC_IOC_CREATE_FORCE 0x00000004
2N/A
2N/A/* Allocate a hardware ring to the vnic */
2N/A#define VNIC_IOC_CREATE_REQ_HWRINGS 0x00000008
2N/A
2N/Atypedef struct vnic_ioc_create {
2N/A datalink_id_t vc_vnic_id;
2N/A datalink_id_t vc_link_id;
2N/A vnic_mac_addr_type_t vc_mac_addr_type;
2N/A uint_t vc_mac_len;
2N/A uchar_t vc_mac_addr[MAXMACADDRLEN];
2N/A uint_t vc_mac_prefix_len;
2N/A int vc_mac_slot;
2N/A uint16_t vc_vid;
2N/A uint_t vc_status;
2N/A uint_t vc_flags;
2N/A vnic_ioc_diag_t vc_diag;
2N/A mac_resource_props_t vc_resource_props;
2N/A} vnic_ioc_create_t;
2N/A
2N/A#define VNIC_IOC_DELETE VNICIOC(2)
2N/A
2N/Atypedef struct vnic_ioc_delete {
2N/A datalink_id_t vd_vnic_id;
2N/A} vnic_ioc_delete_t;
2N/A
2N/A#define VNIC_IOC_INFO VNICIOC(3)
2N/A
2N/Atypedef struct vnic_info {
2N/A datalink_id_t vn_vnic_id;
2N/A datalink_id_t vn_link_id;
2N/A vnic_mac_addr_type_t vn_mac_addr_type;
2N/A uint_t vn_mac_len;
2N/A uchar_t vn_mac_addr[MAXMACADDRLEN];
2N/A uint_t vn_mac_slot;
2N/A uint32_t vn_mac_prefix_len;
2N/A uint16_t vn_vid;
2N/A boolean_t vn_force;
2N/A mac_resource_props_t vn_resource_props;
2N/A} vnic_info_t;
2N/A
2N/Atypedef struct vnic_ioc_info {
2N/A vnic_info_t vi_info;
2N/A} vnic_ioc_info_t;
2N/A
2N/A#define VNIC_IOC_MODIFY VNICIOC(4)
2N/A
2N/A#define VNIC_IOC_MODIFY_ADDR 0x01
2N/A#define VNIC_IOC_MODIFY_RESOURCE_CTL 0x02
2N/A
2N/Atypedef struct vnic_ioc_modify {
2N/A datalink_id_t vm_vnic_id;
2N/A uint_t vm_modify_mask;
2N/A uint_t vm_mac_len;
2N/A int vm_mac_slot;
2N/A uchar_t vm_mac_addr[MAXMACADDRLEN];
2N/A vnic_mac_addr_type_t vm_mac_addr_type;
2N/A mac_resource_props_t vm_resource_props;
2N/A vnic_ioc_diag_t vm_diag;
2N/A} vnic_ioc_modify_t;
2N/A
2N/A#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
2N/A#pragma pack()
2N/A#endif
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _SYS_VNIC_H */
2N/A