vnic_impl.h revision 1a41ca239310955ae95b2569b707432432a58580
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
5b6e0c463149a26dd0aeb4c1f70611c97161ff32dougm * CDDL HEADER START
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The contents of this file are subject to the terms of the
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * Common Development and Distribution License (the "License").
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * You may not use this file except in compliance with the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fa9e4066f08beec538e775443c5be79dd423fcabahrens * or http://www.opensolaris.org/os/licensing.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * See the License for the specific language governing permissions
fa9e4066f08beec538e775443c5be79dd423fcabahrens * and limitations under the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * When distributing Covered Code, include this CDDL HEADER in each
fa9e4066f08beec538e775443c5be79dd423fcabahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * If applicable, add the following below this CDDL HEADER, with the
fa9e4066f08beec538e775443c5be79dd423fcabahrens * fields enclosed by brackets "[]" replaced with your own identifying
fa9e4066f08beec538e775443c5be79dd423fcabahrens * information: Portions Copyright [yyyy] [name of copyright owner]
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER END
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
f3861e1a2ceec23a5b699c24d814b7775a9e0b52ahl/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
99d5e173470cf967aa87653364ed614299e7b511Tim Haley * Use is subject to license terms.
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens * Copyright 2013 Joyent, Inc. All rights reserved.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrens
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens#ifndef _SYS_VNIC_IMPL_H
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens#define _SYS_VNIC_IMPL_H
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/cred.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/mac_provider.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/mac_client.h>
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks#include <sys/mac_client_priv.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/vnic.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/mac_flow.h>
99653d4ee642c6528e88224f12409a5f23060994eschrock#include <sys/ksynch.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens
6733190958bbcc0bd6d1d601e7ae0a6994dafb45dougm#ifdef __cplusplus
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrensextern "C" {
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif
069f55e237020c4a4907b235fc38fafc6442ce94Eric Schrock
069f55e237020c4a4907b235fc38fafc6442ce94Eric Schrocktypedef struct vnic_s {
fa9e4066f08beec538e775443c5be79dd423fcabahrens datalink_id_t vn_id;
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint32_t
fa9e4066f08beec538e775443c5be79dd423fcabahrens vn_enabled : 1,
fa9e4066f08beec538e775443c5be79dd423fcabahrens vn_pad_to_bit_31 : 31;
5da9ad7bc7967714b6c6e02dcfe8e6f7cc2d6098gw
5da9ad7bc7967714b6c6e02dcfe8e6f7cc2d6098gw mac_handle_t vn_mh;
5da9ad7bc7967714b6c6e02dcfe8e6f7cc2d6098gw mac_handle_t vn_lower_mh;
5da9ad7bc7967714b6c6e02dcfe8e6f7cc2d6098gw uint_t vn_nhandles; /* # of secondary mac handles */
5da9ad7bc7967714b6c6e02dcfe8e6f7cc2d6098gw /* The primary handle is always the first element in the array */
069f55e237020c4a4907b235fc38fafc6442ce94Eric Schrock mac_client_handle_t vn_mc_handles[MPT_MAXMACADDR];
069f55e237020c4a4907b235fc38fafc6442ce94Eric Schrock mac_unicast_handle_t vn_mu_handles[MPT_MAXMACADDR];
069f55e237020c4a4907b235fc38fafc6442ce94Eric Schrock uint32_t vn_margin;
069f55e237020c4a4907b235fc38fafc6442ce94Eric Schrock int vn_slot_id;
069f55e237020c4a4907b235fc38fafc6442ce94Eric Schrock vnic_mac_addr_type_t vn_addr_type;
069f55e237020c4a4907b235fc38fafc6442ce94Eric Schrock uint8_t vn_addr[MAXMACADDRLEN];
069f55e237020c4a4907b235fc38fafc6442ce94Eric Schrock size_t vn_addr_len;
99653d4ee642c6528e88224f12409a5f23060994eschrock uint16_t vn_vid;
99653d4ee642c6528e88224f12409a5f23060994eschrock vrid_t vn_vrid;
99653d4ee642c6528e88224f12409a5f23060994eschrock int vn_af;
99653d4ee642c6528e88224f12409a5f23060994eschrock boolean_t vn_force;
99653d4ee642c6528e88224f12409a5f23060994eschrock datalink_id_t vn_link_id;
29ab75c9a733dad2978c4860efd954b5625e3467rm mac_notify_handle_t vn_mnh;
99653d4ee642c6528e88224f12409a5f23060994eschrock
99653d4ee642c6528e88224f12409a5f23060994eschrock uint32_t vn_hcksum_txflags;
99653d4ee642c6528e88224f12409a5f23060994eschrock} vnic_t;
99653d4ee642c6528e88224f12409a5f23060994eschrock
99653d4ee642c6528e88224f12409a5f23060994eschrock#define vn_mch vn_mc_handles[0]
99653d4ee642c6528e88224f12409a5f23060994eschrock#define vn_muh vn_mu_handles[0]
99653d4ee642c6528e88224f12409a5f23060994eschrock
99d5e173470cf967aa87653364ed614299e7b511Tim Haleyextern int vnic_dev_create(datalink_id_t, datalink_id_t, vnic_mac_addr_type_t *,
6733190958bbcc0bd6d1d601e7ae0a6994dafb45dougm int *, uchar_t *, int *, uint_t, uint16_t, vrid_t, int,
5b6e0c463149a26dd0aeb4c1f70611c97161ff32dougm mac_resource_props_t *, uint32_t, vnic_ioc_diag_t *, cred_t *);
b2634b9c57bbcfa01bb5dec2e196aec32957925fEric Taylorextern int vnic_dev_modify(datalink_id_t, uint_t, vnic_mac_addr_type_t,
ebedde844eddf46049b2403f974b50bcba47356eEric Taylor uint_t, uchar_t *, uint_t, mac_resource_props_t *);
069f55e237020c4a4907b235fc38fafc6442ce94Eric Schrockextern int vnic_dev_delete(datalink_id_t, uint32_t, cred_t *);
069f55e237020c4a4907b235fc38fafc6442ce94Eric Schrock
069f55e237020c4a4907b235fc38fafc6442ce94Eric Schrockextern void vnic_dev_init(void);
069f55e237020c4a4907b235fc38fafc6442ce94Eric Schrockextern void vnic_dev_fini(void);
069f55e237020c4a4907b235fc38fafc6442ce94Eric Schrockextern uint_t vnic_dev_count(void);
99653d4ee642c6528e88224f12409a5f23060994eschrockextern dev_info_t *vnic_get_dip(void);
069f55e237020c4a4907b235fc38fafc6442ce94Eric Schrock
5b6e0c463149a26dd0aeb4c1f70611c97161ff32dougmextern int vnic_info(vnic_info_t *, cred_t *);
99653d4ee642c6528e88224f12409a5f23060994eschrock
fa9e4066f08beec538e775443c5be79dd423fcabahrens#ifdef __cplusplus
99653d4ee642c6528e88224f12409a5f23060994eschrock}
29ab75c9a733dad2978c4860efd954b5625e3467rm#endif
fa9e4066f08beec538e775443c5be79dd423fcabahrens
a2eea2e101e6a163a537dcc6d4e3c4da2a0ea5b2ahrens#endif /* _SYS_VNIC_IMPL_H */
a2eea2e101e6a163a537dcc6d4e3c4da2a0ea5b2ahrens