4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, v.1, (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://opensource.org/licenses/CDDL-1.0.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
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]
23 * Copyright 2014-2017 Cavium, Inc.
24 * The contents of this file are subject to the terms of the Common Development
25 * and Distribution License, v.1, (the "License").
27 * You may not use this file except in compliance with the License.
29 * You can obtain a copy of the License at available
30 * at http://opensource.org/licenses/CDDL-1.0
32 * See the License for the specific language governing permissions and
33 * limitations under the License.
39 qede_link_props_t qede_def_link_props
=
53 qede_cfg_get_val(qede_t
*qede
,
60 #define QEDE_CFG_NAME_LEN_MAX 128
62 char name
[QEDE_CFG_NAME_LEN_MAX
];
64 /* first check if the hardcoded default has been overridden */
66 snprintf(name
, QEDE_CFG_NAME_LEN_MAX
, "default_%s", pName
);
68 val
= ddi_prop_get_int(DDI_DEV_T_ANY
,
70 (DDI_PROP_NOTPROM
| DDI_PROP_DONTPASS
),
73 /* now check for a config for this specific instance */
75 snprintf(name
, QEDE_CFG_NAME_LEN_MAX
, "qede%d_%s", qede
->instance
,
78 val
= ddi_prop_get_int(DDI_DEV_T_ANY
,
80 (DDI_PROP_NOTPROM
| DDI_PROP_DONTPASS
),
85 *((boolean_t
*)pVal
) = (val
) ? B_TRUE
: B_FALSE
;
92 qede_cfg_init(qede_t
*qede
)
97 qede
->checksum
= DEFAULT_CKSUM_OFFLOAD
;
98 qede
->enabled_offloads
= QEDE_OFFLOAD_NONE
;
99 qede
->mtu
= DEFAULT_MTU
;
100 qede
->num_fp
= DEFAULT_FASTPATH_COUNT
;
101 qede
->rx_ring_size
= DEFAULT_RX_RING_SIZE
;
102 qede
->tx_ring_size
= DEFAULT_TX_RING_SIZE
;
103 qede
->tx_recycle_threshold
= DEFAULT_TX_RECYCLE_THRESHOLD
;
104 qede
->rx_copy_threshold
= DEFAULT_RX_COPY_THRESHOLD
;
105 qede
->tx_bcopy_threshold
= DEFAULT_TX_COPY_THRESHOLD
;
106 qede
->lso_enable
= B_TRUE
;
107 qede
->lro_enable
= B_TRUE
;
108 qede
->log_enable
= B_TRUE
;
109 qede
->ecore_debug_level
= DEFAULT_ECORE_DEBUG_LEVEL
;
110 qede
->ecore_debug_module
= DEFAULT_ECORE_DEBUG_MODULE
;
112 qede_cfg_get_val(qede
, "checksum",
116 switch(qede
->checksum
) {
117 case USER_OPTION_CKSUM_L3
:
118 case USER_OPTION_CKSUM_L3_L4
:
119 qede
->checksum
= DEFAULT_CKSUM_OFFLOAD
;
123 qede_cfg_get_val(qede
, "mtu", &option
,
127 if (option
!= DEFAULT_JUMBO_MTU
&&
128 option
!= DEFAULT_MTU
) {
129 qede
->mtu
= DEFAULT_MTU
;
130 qede
->jumbo_enable
= B_FALSE
;
132 if (qede
->mtu
!= option
) {
135 if (option
== DEFAULT_JUMBO_MTU
) {
136 qede
->jumbo_enable
= B_TRUE
;
140 qede_cfg_get_val(qede
, "num_fp", &option
,
143 qede
->num_fp
= (option
< MIN_FASTPATH_COUNT
) ?
145 (option
> MAX_FASTPATH_COUNT
) ?
149 qede_cfg_get_val(qede
, "rx_ring_size", &option
,
152 qede
->rx_ring_size
= (option
< MIN_RX_RING_SIZE
) ?
154 (option
> MAX_RX_RING_SIZE
) ?
157 qede_cfg_get_val(qede
, "tx_ring_size", &option
,
160 qede
->tx_ring_size
= (option
< MIN_TX_RING_SIZE
) ?
162 (option
> MAX_TX_RING_SIZE
) ?
165 qede_cfg_get_val(qede
, "rx_copy_threshold", &option
,
166 qede
->rx_copy_threshold
,
168 qede_cfg_get_val(qede
, "tx_copy_threshold", &option
,
169 qede
->tx_bcopy_threshold
,
171 qede_cfg_get_val(qede
, "tx_recycle_threshold", &option
,
172 qede
->tx_bcopy_threshold
,
174 qede
->tx_recycle_threshold
=
176 (option
> qede
->tx_ring_size
) ?
177 qede
->tx_ring_size
: option
;
178 qede_cfg_get_val(qede
, "lso_enable", &option
,
181 qede
->lso_enable
= option
;
182 qede_cfg_get_val(qede
, "lro_enable", &option
,
185 qede
->lro_enable
= option
;
187 if(qede
->checksum
!= DEFAULT_CKSUM_OFFLOAD
) {
188 qede
->lso_enable
= B_FALSE
;
189 qede
->lro_enable
= B_FALSE
;
192 qede_cfg_get_val(qede
, "log_enable", &option
,
195 qede_cfg_get_val(qede
, "debug_level", &option
,
196 qede
->ecore_debug_level
,
198 qede
->ecore_debug_level
= (uint32_t)((option
< 0) ? 0 : option
);
200 qede_cfg_get_val(qede
, "debug_module", &option
,
201 qede
->ecore_debug_module
,
203 qede
->ecore_debug_module
= (uint32_t)((option
< 0) ? 0 : option
);
208 qede_cfg_reset(qede_t
*qede
)
210 qede
->params
.link_state
= 0;
211 /* reset the link status */
212 qede
->props
.link_speed
= 0;
213 qede
->props
.link_duplex
= B_FALSE
;
214 qede
->props
.tx_pause
= B_FALSE
;
215 qede
->props
.rx_pause
= B_FALSE
;
216 qede
->props
.uptime
= 0;