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 /*
23 * Copyright(c) 2007-2010 Intel Corporation. All rights reserved.
24 */
25
26 /*
27 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Copyright 2013, Nexenta Systems, Inc. All rights reserved.
29 * Copyright 2014 Pluribus Networks Inc.
30 */
31
32 #include "igb_sw.h"
33
34 int
35 igb_m_stat(void *arg, uint_t stat, uint64_t *val)
36 {
37 igb_t *igb = (igb_t *)arg;
38 struct e1000_hw *hw = &igb->hw;
39 igb_stat_t *igb_ks;
40 uint32_t low_val, high_val;
41
42 igb_ks = (igb_stat_t *)igb->igb_ks->ks_data;
43
44 mutex_enter(&igb->gen_lock);
45
46 if (igb->igb_state & IGB_SUSPENDED) {
47 mutex_exit(&igb->gen_lock);
48 return (ECANCELED);
49 }
1099
1100 /*
1101 * Set rx buffer size
1102 */
1103 rx_size = igb->max_frame_size + IPHDR_ALIGN_ROOM;
1104 igb->rx_buf_size = ((rx_size >> 10) + ((rx_size &
1105 (((uint32_t)1 << 10) - 1)) > 0 ? 1 : 0)) << 10;
1106
1107 /*
1108 * Set tx buffer size
1109 */
1110 tx_size = igb->max_frame_size;
1111 igb->tx_buf_size = ((tx_size >> 10) + ((tx_size &
1112 (((uint32_t)1 << 10) - 1)) > 0 ? 1 : 0)) << 10;
1113 }
1114 break;
1115 case MAC_PROP_PRIVATE:
1116 err = igb_set_priv_prop(igb, pr_name, pr_valsize, pr_val);
1117 break;
1118 default:
1119 err = EINVAL;
1120 break;
1121 }
1122
1123 mutex_exit(&igb->gen_lock);
1124
1125 if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK) {
1126 ddi_fm_service_impact(igb->dip, DDI_SERVICE_DEGRADED);
1127 return (EIO);
1128 }
1129
1130 return (err);
1131 }
1132
1133 int
1134 igb_m_getprop(void *arg, const char *pr_name, mac_prop_id_t pr_num,
1135 uint_t pr_valsize, void *pr_val)
1136 {
1137 igb_t *igb = (igb_t *)arg;
1138 struct e1000_hw *hw = &igb->hw;
1139 int err = 0;
1201 break;
1202 case MAC_PROP_EN_100HDX_CAP:
1203 *(uint8_t *)pr_val = igb->param_en_100hdx_cap;
1204 break;
1205 case MAC_PROP_ADV_10FDX_CAP:
1206 *(uint8_t *)pr_val = igb->param_adv_10fdx_cap;
1207 break;
1208 case MAC_PROP_EN_10FDX_CAP:
1209 *(uint8_t *)pr_val = igb->param_en_10fdx_cap;
1210 break;
1211 case MAC_PROP_ADV_10HDX_CAP:
1212 *(uint8_t *)pr_val = igb->param_adv_10hdx_cap;
1213 break;
1214 case MAC_PROP_EN_10HDX_CAP:
1215 *(uint8_t *)pr_val = igb->param_en_10hdx_cap;
1216 break;
1217 case MAC_PROP_PRIVATE:
1218 err = igb_get_priv_prop(igb, pr_name, pr_valsize, pr_val);
1219 break;
1220 default:
1221 err = EINVAL;
1222 break;
1223 }
1224 return (err);
1225 }
1226
1227 void
1228 igb_m_propinfo(void *arg, const char *pr_name, mac_prop_id_t pr_num,
1229 mac_prop_info_handle_t prh)
1230 {
1231 igb_t *igb = (igb_t *)arg;
1232 struct e1000_hw *hw = &igb->hw;
1233 uint16_t phy_status, phy_ext_status;
1234
1235 switch (pr_num) {
1236 case MAC_PROP_DUPLEX:
1237 case MAC_PROP_SPEED:
1238 case MAC_PROP_ADV_1000FDX_CAP:
1239 case MAC_PROP_ADV_1000HDX_CAP:
1240 case MAC_PROP_EN_1000HDX_CAP:
1241 case MAC_PROP_ADV_100T4_CAP:
|
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 /*
23 * Copyright(c) 2007-2010 Intel Corporation. All rights reserved.
24 */
25
26 /*
27 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Copyright 2013, Nexenta Systems, Inc. All rights reserved.
29 * Copyright 2014 Pluribus Networks Inc.
30 * Copyright 2016 OmniTI Computer Consulting, Inc. All rights reserved.
31 */
32
33 #include "igb_sw.h"
34
35 int
36 igb_m_stat(void *arg, uint_t stat, uint64_t *val)
37 {
38 igb_t *igb = (igb_t *)arg;
39 struct e1000_hw *hw = &igb->hw;
40 igb_stat_t *igb_ks;
41 uint32_t low_val, high_val;
42
43 igb_ks = (igb_stat_t *)igb->igb_ks->ks_data;
44
45 mutex_enter(&igb->gen_lock);
46
47 if (igb->igb_state & IGB_SUSPENDED) {
48 mutex_exit(&igb->gen_lock);
49 return (ECANCELED);
50 }
1100
1101 /*
1102 * Set rx buffer size
1103 */
1104 rx_size = igb->max_frame_size + IPHDR_ALIGN_ROOM;
1105 igb->rx_buf_size = ((rx_size >> 10) + ((rx_size &
1106 (((uint32_t)1 << 10) - 1)) > 0 ? 1 : 0)) << 10;
1107
1108 /*
1109 * Set tx buffer size
1110 */
1111 tx_size = igb->max_frame_size;
1112 igb->tx_buf_size = ((tx_size >> 10) + ((tx_size &
1113 (((uint32_t)1 << 10) - 1)) > 0 ? 1 : 0)) << 10;
1114 }
1115 break;
1116 case MAC_PROP_PRIVATE:
1117 err = igb_set_priv_prop(igb, pr_name, pr_valsize, pr_val);
1118 break;
1119 default:
1120 err = ENOTSUP;
1121 break;
1122 }
1123
1124 mutex_exit(&igb->gen_lock);
1125
1126 if (igb_check_acc_handle(igb->osdep.reg_handle) != DDI_FM_OK) {
1127 ddi_fm_service_impact(igb->dip, DDI_SERVICE_DEGRADED);
1128 return (EIO);
1129 }
1130
1131 return (err);
1132 }
1133
1134 int
1135 igb_m_getprop(void *arg, const char *pr_name, mac_prop_id_t pr_num,
1136 uint_t pr_valsize, void *pr_val)
1137 {
1138 igb_t *igb = (igb_t *)arg;
1139 struct e1000_hw *hw = &igb->hw;
1140 int err = 0;
1202 break;
1203 case MAC_PROP_EN_100HDX_CAP:
1204 *(uint8_t *)pr_val = igb->param_en_100hdx_cap;
1205 break;
1206 case MAC_PROP_ADV_10FDX_CAP:
1207 *(uint8_t *)pr_val = igb->param_adv_10fdx_cap;
1208 break;
1209 case MAC_PROP_EN_10FDX_CAP:
1210 *(uint8_t *)pr_val = igb->param_en_10fdx_cap;
1211 break;
1212 case MAC_PROP_ADV_10HDX_CAP:
1213 *(uint8_t *)pr_val = igb->param_adv_10hdx_cap;
1214 break;
1215 case MAC_PROP_EN_10HDX_CAP:
1216 *(uint8_t *)pr_val = igb->param_en_10hdx_cap;
1217 break;
1218 case MAC_PROP_PRIVATE:
1219 err = igb_get_priv_prop(igb, pr_name, pr_valsize, pr_val);
1220 break;
1221 default:
1222 err = ENOTSUP;
1223 break;
1224 }
1225 return (err);
1226 }
1227
1228 void
1229 igb_m_propinfo(void *arg, const char *pr_name, mac_prop_id_t pr_num,
1230 mac_prop_info_handle_t prh)
1231 {
1232 igb_t *igb = (igb_t *)arg;
1233 struct e1000_hw *hw = &igb->hw;
1234 uint16_t phy_status, phy_ext_status;
1235
1236 switch (pr_num) {
1237 case MAC_PROP_DUPLEX:
1238 case MAC_PROP_SPEED:
1239 case MAC_PROP_ADV_1000FDX_CAP:
1240 case MAC_PROP_ADV_1000HDX_CAP:
1241 case MAC_PROP_EN_1000HDX_CAP:
1242 case MAC_PROP_ADV_100T4_CAP:
|