4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2015 Joyent, Inc.
24 */
25
26 #include <sys/types.h>
27 #include <sys/cred.h>
28 #include <sys/sysmacros.h>
29 #include <sys/conf.h>
30 #include <sys/cmn_err.h>
31 #include <sys/list.h>
32 #include <sys/ksynch.h>
33 #include <sys/kmem.h>
34 #include <sys/stream.h>
35 #include <sys/modctl.h>
36 #include <sys/ddi.h>
37 #include <sys/sunddi.h>
38 #include <sys/atomic.h>
39 #include <sys/stat.h>
40 #include <sys/modhash.h>
41 #include <sys/strsubr.h>
42 #include <sys/strsun.h>
43 #include <sys/dlpi.h>
1081 default:
1082 err = ENOTSUP;
1083 break;
1084 }
1085 return (err);
1086 }
1087
1088 /* ARGSUSED */
1089 static int
1090 vnic_m_getprop(void *arg, const char *pr_name, mac_prop_id_t pr_num,
1091 uint_t pr_valsize, void *pr_val)
1092 {
1093 vnic_t *vn = arg;
1094 int ret = 0;
1095
1096 switch (pr_num) {
1097 case MAC_PROP_SECONDARY_ADDRS:
1098 ret = vnic_get_secondary_macs(vn, pr_valsize, pr_val);
1099 break;
1100 default:
1101 ret = EINVAL;
1102 break;
1103 }
1104
1105 return (ret);
1106 }
1107
1108 /* ARGSUSED */
1109 static void vnic_m_propinfo(void *m_driver, const char *pr_name,
1110 mac_prop_id_t pr_num, mac_prop_info_handle_t prh)
1111 {
1112 vnic_t *vn = m_driver;
1113
1114 switch (pr_num) {
1115 case MAC_PROP_MTU:
1116 if (vn->vn_link_id == DATALINK_INVALID_LINKID) {
1117 mac_prop_info_set_range_uint32(prh,
1118 ANCHOR_VNIC_MIN_MTU, ANCHOR_VNIC_MAX_MTU);
1119 } else {
1120 uint32_t max;
1121 mac_perim_handle_t mph;
|
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2015 Joyent, Inc.
24 * Copyright 2016 OmniTI Computer Consulting, Inc. All rights reserved.
25 */
26
27 #include <sys/types.h>
28 #include <sys/cred.h>
29 #include <sys/sysmacros.h>
30 #include <sys/conf.h>
31 #include <sys/cmn_err.h>
32 #include <sys/list.h>
33 #include <sys/ksynch.h>
34 #include <sys/kmem.h>
35 #include <sys/stream.h>
36 #include <sys/modctl.h>
37 #include <sys/ddi.h>
38 #include <sys/sunddi.h>
39 #include <sys/atomic.h>
40 #include <sys/stat.h>
41 #include <sys/modhash.h>
42 #include <sys/strsubr.h>
43 #include <sys/strsun.h>
44 #include <sys/dlpi.h>
1082 default:
1083 err = ENOTSUP;
1084 break;
1085 }
1086 return (err);
1087 }
1088
1089 /* ARGSUSED */
1090 static int
1091 vnic_m_getprop(void *arg, const char *pr_name, mac_prop_id_t pr_num,
1092 uint_t pr_valsize, void *pr_val)
1093 {
1094 vnic_t *vn = arg;
1095 int ret = 0;
1096
1097 switch (pr_num) {
1098 case MAC_PROP_SECONDARY_ADDRS:
1099 ret = vnic_get_secondary_macs(vn, pr_valsize, pr_val);
1100 break;
1101 default:
1102 ret = ENOTSUP;
1103 break;
1104 }
1105
1106 return (ret);
1107 }
1108
1109 /* ARGSUSED */
1110 static void vnic_m_propinfo(void *m_driver, const char *pr_name,
1111 mac_prop_id_t pr_num, mac_prop_info_handle_t prh)
1112 {
1113 vnic_t *vn = m_driver;
1114
1115 switch (pr_num) {
1116 case MAC_PROP_MTU:
1117 if (vn->vn_link_id == DATALINK_INVALID_LINKID) {
1118 mac_prop_info_set_range_uint32(prh,
1119 ANCHOR_VNIC_MIN_MTU, ANCHOR_VNIC_MAX_MTU);
1120 } else {
1121 uint32_t max;
1122 mac_perim_handle_t mph;
|