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/*
2N/A * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#ifndef _SYS_VDP_H
2N/A#define _SYS_VDP_H
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#include <sys/param.h>
2N/A#include <sys/types.h>
2N/A#include <sys/nvpair.h>
2N/A#include <syslog.h>
2N/A#include <libdlpi.h>
2N/A#include <ecp.h>
2N/A#include <sys/mac_flow.h>
2N/A/*
2N/A * VDP TLV Types
2N/A */
2N/Atypedef enum vdp_tlv_type_s {
2N/A VDP_TLV_NONE = 0,
2N/A VDP_TLV_PRE_ASSOC,
2N/A VDP_TLV_PRE_ASSOC_W_RR,
2N/A VDP_TLV_ASSOC,
2N/A VDP_TLV_DEASSOC,
2N/A VDP_TLV_MGR_ID,
2N/A VDP_TLV_TIMEDOUT,
2N/A VDP_TLV_ORG_SPEC = 127
2N/A} vdp_tlv_type_t;
2N/A
2N/A/*
2N/A * VDP VSIID formats
2N/A */
2N/Atypedef enum vdp_tlv_vsiid_fmt_s {
2N/A VDP_TLV_VSIID_FMT_IPV4 = 1,
2N/A VDP_TLV_VSIID_FMT_IPV6,
2N/A VDP_TLV_VSIID_FMT_MAC,
2N/A VDP_TLV_VSIID_FMT_LOCAL,
2N/A VDP_TLV_VSIID_FMT_UUID
2N/A} vdp_tlv_vsiid_fmt_t;
2N/A
2N/A/*
2N/A * VDP Filter Info Formats
2N/A */
2N/Atypedef enum vdp_tlv_fltr_fmt_s {
2N/A VDP_FLTR_FMT_VID = 1,
2N/A VDP_FLTR_FMT_MAC_VID,
2N/A VDP_FLTR_FMT_GID_VID,
2N/A VDP_FLTR_FMT_GID_MAC_VID
2N/A} vdp_tlv_fltr_fmt_t;
2N/A
2N/A#define VDP_VSI_MGR_ID_LEN 0x10
2N/A#define VDP_TLV_VSIID_LEN 0x10
2N/A
2N/A#define VDP_VSIID_MAC_OFFSET 10
2N/A
2N/A#define VDP_ORACLE_OUI 0x0003BA
2N/A
2N/A#define VDP_ORG_HSIZE 4
2N/A
2N/A/* assumes a pointer to a 3-byte array */
2N/A#define vdp_ntoh24(p) \
2N/A (*((uint8_t *)(p)) << 16 | *((uint8_t *)((p)+1)) << 8 | \
2N/A *((uint8_t *)((p)+2)))
2N/A
2N/A/* assumes a pointer to a 3 byte array, and an integer value */
2N/A#define vdp_hton24(p, v) {\
2N/A p[0] = (((v) >> 16) & 0xFF); \
2N/A p[1] = (((v) >> 8) & 0xFF); \
2N/A p[2] = ((v) & 0xFF); \
2N/A}
2N/A
2N/A#define VDP_ORGTLV_OUI(os) vdp_ntoh24(os)
2N/A#define VDP_ORGTLV_STYPE(os) *((uint8_t *)((os) + 3))
2N/A
2N/A/* Oracle OUI subtype */
2N/A#define VDP_ORACLEOUI_VSIMGR_SUBTYPE 1
2N/A
2N/A/* VDP Stats */
2N/Atypedef struct vdp_stat_s {
2N/A uint64_t vs_ipkts;
2N/A uint64_t vs_opkts;
2N/A uint64_t vs_kas;
2N/A} vdp_stat_t;
2N/A
2N/A/* VDP timers */
2N/Atypedef struct vdp_timers_s {
2N/A boolean_t vt_rol_rwd; /* local or remote RWD used */
2N/A int vt_rwd; /* exponent for computing response wait delay */
2N/A boolean_t vt_rol_rka; /* local or remote RKA used */
2N/A int vt_rka; /* exponent for computing keep alive interval */
2N/A} vdp_timers_t;
2N/A
2N/A/* VDP args passed via door */
2N/Atypedef struct vdpt_arg_s {
2N/A int vdpt_version;
2N/A datalink_id_t vdpt_phy_link_id;
2N/A datalink_id_t vdpt_virt_link_id;
2N/A
2N/A /*
2N/A * The following are used by VDP_ADD_PROFILE.
2N/A */
2N/A datalink_id_t vdpt_virt_link_vid;
2N/A uint32_t vdpt_tlv_type_id;
2N/A int vdpt_tlv_type_version;
2N/A vdp_tlv_vsiid_fmt_t vdpt_tlv_vsiid_format;
2N/A /*
2N/A * Currently only one entry is supported
2N/A */
2N/A int vdpt_tlv_fltr_entries;
2N/A vdp_tlv_fltr_fmt_t vdpt_tlv_fltr_info_format;
2N/A mac_vsimgr_encoding_t vdpt_mgrenc;
2N/A char vdpt_mgr_id[VDP_VSI_MGR_ID_LEN];
2N/A} vdpt_arg_t;
2N/A
2N/Atypedef struct vdp_link_info_s {
2N/A size_t vli_phy_link_maclen;
2N/A uint8_t vli_phy_link_mac[ETHERADDRL];
2N/A char vli_virt_link_name[MAXLINKNAMELEN];
2N/A uint8_t vli_virt_link_mac[ETHERADDRL];
2N/A char vli_phy_link_name[MAXLINKNAMELEN];
2N/A} vdp_link_info_t;
2N/A
2N/A/*
2N/A * information returned for a profile
2N/A */
2N/A#define VDPT_TLVL_VERSION 0x1
2N/A#define VDPT_ECPCFG_VERSION 0x1
2N/A
2N/A#define VDP_VSIID_LEN 16
2N/A
2N/A/* VDP instance Information */
2N/Atypedef struct vdpd_vdpinfo_t {
2N/A int vi_ver;
2N/A char vi_phys_link_name[MAXLINKNAMELEN];
2N/A char vi_virt_link_name[MAXLINKNAMELEN];
2N/A vdp_tlv_type_t vi_vsi_state;
2N/A vdp_tlv_type_t vi_cmd_pending;
2N/A char vi_vsi_state_str[16];
2N/A char vi_cmd_pending_str[16];
2N/A uint8_t vi_vsiid_format;
2N/A uint8_t vi_vsiid[VDP_VSIID_LEN];
2N/A uint32_t vi_vsitypeid;
2N/A int vi_vsitypevers;
2N/A char vi_fltr_info_str[24];
2N/A uint_t vi_vdp_keep_alive_time_sec;
2N/A uint_t vi_vdp_keep_alive_time_msec;
2N/A uint_t vi_vdp_resp_timeout_sec;
2N/A uint_t vi_vdp_resp_timeout_msec;
2N/A} vdpd_vdpinfo_t;
2N/A
2N/A/* ECP information for VDP instances */
2N/Atypedef struct vdpd_ecpinfo_s {
2N/A int ve_ver;
2N/A char ve_phys_link_name[MAXLINKNAMELEN];
2N/A ushort_t ve_req_seq;
2N/A ushort_t ve_ack_seq;
2N/A ushort_t ve_last_ack_seq;
2N/A ushort_t ve_max_tx_attempts;
2N/A uint_t ve_ack_timeout_msec;
2N/A} vdpd_ecpinfo_t;
2N/A
2N/A#define VDP_STDERR_LOG 1
2N/A#define VDP_SYS_LOG 2
2N/A
2N/Aextern void vdp_init(int);
2N/Aextern int vdp_tlv_add(vdpt_arg_t *, vdp_link_info_t *);
2N/Aextern int vdp_tlv_del(vdpt_arg_t *);
2N/Aextern int vdp_tlv_fini();
2N/Aextern vdpd_vdpinfo_t *vdp_vdpinfo(vdpt_arg_t *, int *);
2N/Aextern vdpd_ecpinfo_t *vdp_ecpinfo(vdpt_arg_t *, int *);
2N/Aextern int vdp_vdpstats(vdpt_arg_t *, vdp_stat_t *);
2N/Aextern int vdp_ecpstats(vdpt_arg_t *, ecp_stat_t *);
2N/Aextern void vdp_vdptimers(vdpt_arg_t *, vdp_timers_t *);
2N/Aextern void vdp_ecptimers(vdpt_arg_t *, ecp_timers_t *);
2N/Aextern char *vdp_tlv_type_to_str(int);
2N/Aextern char *vdp_vsiid_fmt_to_str(int);
2N/Aextern char *vdp_tlv_fltr_fmt_to_str(int);
2N/Aextern void vdp_reason2str(uint8_t, char *, int);
2N/Aextern char *vdp_vsimgr_encoding(uint8_t);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _SYS_VDP_H */