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 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 * Copyright 2012 Milan Jurik. All rights reserved.
25 */
26
27 /*
28 * SunOs MT STREAMS Hydra 10Gb Ethernet Device Driver.
29 */
30 #include <hxge_impl.h>
31 #include <hxge_pfc.h>
32
33 /*
34 * PSARC/2007/453 MSI-X interrupt limit override
35 * (This PSARC case is limited to MSI-X vectors
36 * and SPARC platforms only).
37 */
38 uint32_t hxge_msi_enable = 2;
39
40 /*
41 * Globals: tunable parameters (/etc/system or adb)
42 *
43 */
44 uint32_t hxge_rbr_size = HXGE_RBR_RBB_DEFAULT;
3304 case MAC_PROP_ADV_100FDX_CAP:
3305 case MAC_PROP_ADV_10FDX_CAP:
3306 case MAC_PROP_ADV_1000HDX_CAP:
3307 case MAC_PROP_ADV_100HDX_CAP:
3308 case MAC_PROP_ADV_10HDX_CAP:
3309 case MAC_PROP_EN_1000FDX_CAP:
3310 case MAC_PROP_EN_100FDX_CAP:
3311 case MAC_PROP_EN_10FDX_CAP:
3312 case MAC_PROP_EN_1000HDX_CAP:
3313 case MAC_PROP_EN_100HDX_CAP:
3314 case MAC_PROP_EN_10HDX_CAP:
3315 err = ENOTSUP;
3316 break;
3317
3318 case MAC_PROP_PRIVATE:
3319 err = hxge_get_priv_prop(hxgep, pr_name, pr_valsize,
3320 pr_val);
3321 break;
3322
3323 default:
3324 err = EINVAL;
3325 break;
3326 }
3327
3328 HXGE_DEBUG_MSG((hxgep, DLADM_CTL, "<== hxge_m_getprop"));
3329
3330 return (err);
3331 }
3332
3333 static void
3334 hxge_m_propinfo(void *arg, const char *pr_name,
3335 mac_prop_id_t pr_num, mac_prop_info_handle_t prh)
3336 {
3337 _NOTE(ARGUNUSED(arg));
3338 switch (pr_num) {
3339 case MAC_PROP_DUPLEX:
3340 case MAC_PROP_SPEED:
3341 case MAC_PROP_STATUS:
3342 case MAC_PROP_AUTONEG:
3343 case MAC_PROP_FLOWCTRL:
3344 mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
3416 (caddr_t)¶m_arr[param_class_opt_ipv4_udp]);
3417 } else if (strcmp(pr_name, "_class_opt_ipv4_ah") == 0) {
3418 err = hxge_param_set_ip_opt(hxgep, NULL, NULL, (char *)pr_val,
3419 (caddr_t)¶m_arr[param_class_opt_ipv4_ah]);
3420 } else if (strcmp(pr_name, "_class_opt_ipv4_sctp") == 0) {
3421 err = hxge_param_set_ip_opt(hxgep, NULL, NULL, (char *)pr_val,
3422 (caddr_t)¶m_arr[param_class_opt_ipv4_sctp]);
3423 } else if (strcmp(pr_name, "_class_opt_ipv6_tcp") == 0) {
3424 err = hxge_param_set_ip_opt(hxgep, NULL, NULL, (char *)pr_val,
3425 (caddr_t)¶m_arr[param_class_opt_ipv6_tcp]);
3426 } else if (strcmp(pr_name, "_class_opt_ipv6_udp") == 0) {
3427 err = hxge_param_set_ip_opt(hxgep, NULL, NULL, (char *)pr_val,
3428 (caddr_t)¶m_arr[param_class_opt_ipv6_udp]);
3429 } else if (strcmp(pr_name, "_class_opt_ipv6_ah") == 0) {
3430 err = hxge_param_set_ip_opt(hxgep, NULL, NULL, (char *)pr_val,
3431 (caddr_t)¶m_arr[param_class_opt_ipv6_ah]);
3432 } else if (strcmp(pr_name, "_class_opt_ipv6_sctp") == 0) {
3433 err = hxge_param_set_ip_opt(hxgep, NULL, NULL, (char *)pr_val,
3434 (caddr_t)¶m_arr[param_class_opt_ipv6_sctp]);
3435 } else {
3436 err = EINVAL;
3437 }
3438
3439 HXGE_DEBUG_MSG((hxgep, DLADM_CTL,
3440 "<== hxge_set_priv_prop: err %d", err));
3441
3442 return (err);
3443 }
3444
3445 static int
3446 hxge_get_priv_prop(p_hxge_t hxgep, const char *pr_name, uint_t pr_valsize,
3447 void *pr_val)
3448 {
3449 p_hxge_param_t param_arr = hxgep->param_arr;
3450 char valstr[MAXNAMELEN];
3451 int err = 0;
3452 uint_t strsize;
3453 int value = 0;
3454
3455 HXGE_DEBUG_MSG((hxgep, DLADM_CTL,
3456 "==> hxge_get_priv_prop: property %s", pr_name));
3486 err = hxge_param_get_ip_opt(hxgep, NULL, NULL,
3487 (caddr_t)¶m_arr[param_class_opt_ipv6_tcp]);
3488
3489 value = (int)param_arr[param_class_opt_ipv6_tcp].value;
3490 } else if (strcmp(pr_name, "_class_opt_ipv6_udp") == 0) {
3491 err = hxge_param_get_ip_opt(hxgep, NULL, NULL,
3492 (caddr_t)¶m_arr[param_class_opt_ipv6_udp]);
3493
3494 value = (int)param_arr[param_class_opt_ipv6_udp].value;
3495 } else if (strcmp(pr_name, "_class_opt_ipv6_ah") == 0) {
3496 err = hxge_param_get_ip_opt(hxgep, NULL, NULL,
3497 (caddr_t)¶m_arr[param_class_opt_ipv6_ah]);
3498
3499 value = (int)param_arr[param_class_opt_ipv6_ah].value;
3500 } else if (strcmp(pr_name, "_class_opt_ipv6_sctp") == 0) {
3501 err = hxge_param_get_ip_opt(hxgep, NULL, NULL,
3502 (caddr_t)¶m_arr[param_class_opt_ipv6_sctp]);
3503
3504 value = (int)param_arr[param_class_opt_ipv6_sctp].value;
3505 } else {
3506 err = EINVAL;
3507 }
3508
3509 if (err == 0) {
3510 (void) snprintf(valstr, sizeof (valstr), "0x%x", value);
3511
3512 strsize = (uint_t)strlen(valstr);
3513 if (pr_valsize < strsize) {
3514 err = ENOBUFS;
3515 } else {
3516 (void) strlcpy(pr_val, valstr, pr_valsize);
3517 }
3518 }
3519
3520 HXGE_DEBUG_MSG((hxgep, DLADM_CTL,
3521 "<== hxge_get_priv_prop: return %d", err));
3522
3523 return (err);
3524 }
3525 /*
3526 * Module loading and removing entry points.
|
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 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 * Copyright 2012 Milan Jurik. All rights reserved.
25 * Copyright 2016 OmniTI Computer Consulting, Inc. All rights reserved.
26 */
27
28 /*
29 * SunOs MT STREAMS Hydra 10Gb Ethernet Device Driver.
30 */
31 #include <hxge_impl.h>
32 #include <hxge_pfc.h>
33
34 /*
35 * PSARC/2007/453 MSI-X interrupt limit override
36 * (This PSARC case is limited to MSI-X vectors
37 * and SPARC platforms only).
38 */
39 uint32_t hxge_msi_enable = 2;
40
41 /*
42 * Globals: tunable parameters (/etc/system or adb)
43 *
44 */
45 uint32_t hxge_rbr_size = HXGE_RBR_RBB_DEFAULT;
3305 case MAC_PROP_ADV_100FDX_CAP:
3306 case MAC_PROP_ADV_10FDX_CAP:
3307 case MAC_PROP_ADV_1000HDX_CAP:
3308 case MAC_PROP_ADV_100HDX_CAP:
3309 case MAC_PROP_ADV_10HDX_CAP:
3310 case MAC_PROP_EN_1000FDX_CAP:
3311 case MAC_PROP_EN_100FDX_CAP:
3312 case MAC_PROP_EN_10FDX_CAP:
3313 case MAC_PROP_EN_1000HDX_CAP:
3314 case MAC_PROP_EN_100HDX_CAP:
3315 case MAC_PROP_EN_10HDX_CAP:
3316 err = ENOTSUP;
3317 break;
3318
3319 case MAC_PROP_PRIVATE:
3320 err = hxge_get_priv_prop(hxgep, pr_name, pr_valsize,
3321 pr_val);
3322 break;
3323
3324 default:
3325 err = ENOTSUP;
3326 break;
3327 }
3328
3329 HXGE_DEBUG_MSG((hxgep, DLADM_CTL, "<== hxge_m_getprop"));
3330
3331 return (err);
3332 }
3333
3334 static void
3335 hxge_m_propinfo(void *arg, const char *pr_name,
3336 mac_prop_id_t pr_num, mac_prop_info_handle_t prh)
3337 {
3338 _NOTE(ARGUNUSED(arg));
3339 switch (pr_num) {
3340 case MAC_PROP_DUPLEX:
3341 case MAC_PROP_SPEED:
3342 case MAC_PROP_STATUS:
3343 case MAC_PROP_AUTONEG:
3344 case MAC_PROP_FLOWCTRL:
3345 mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
3417 (caddr_t)¶m_arr[param_class_opt_ipv4_udp]);
3418 } else if (strcmp(pr_name, "_class_opt_ipv4_ah") == 0) {
3419 err = hxge_param_set_ip_opt(hxgep, NULL, NULL, (char *)pr_val,
3420 (caddr_t)¶m_arr[param_class_opt_ipv4_ah]);
3421 } else if (strcmp(pr_name, "_class_opt_ipv4_sctp") == 0) {
3422 err = hxge_param_set_ip_opt(hxgep, NULL, NULL, (char *)pr_val,
3423 (caddr_t)¶m_arr[param_class_opt_ipv4_sctp]);
3424 } else if (strcmp(pr_name, "_class_opt_ipv6_tcp") == 0) {
3425 err = hxge_param_set_ip_opt(hxgep, NULL, NULL, (char *)pr_val,
3426 (caddr_t)¶m_arr[param_class_opt_ipv6_tcp]);
3427 } else if (strcmp(pr_name, "_class_opt_ipv6_udp") == 0) {
3428 err = hxge_param_set_ip_opt(hxgep, NULL, NULL, (char *)pr_val,
3429 (caddr_t)¶m_arr[param_class_opt_ipv6_udp]);
3430 } else if (strcmp(pr_name, "_class_opt_ipv6_ah") == 0) {
3431 err = hxge_param_set_ip_opt(hxgep, NULL, NULL, (char *)pr_val,
3432 (caddr_t)¶m_arr[param_class_opt_ipv6_ah]);
3433 } else if (strcmp(pr_name, "_class_opt_ipv6_sctp") == 0) {
3434 err = hxge_param_set_ip_opt(hxgep, NULL, NULL, (char *)pr_val,
3435 (caddr_t)¶m_arr[param_class_opt_ipv6_sctp]);
3436 } else {
3437 err = ENOTSUP;
3438 }
3439
3440 HXGE_DEBUG_MSG((hxgep, DLADM_CTL,
3441 "<== hxge_set_priv_prop: err %d", err));
3442
3443 return (err);
3444 }
3445
3446 static int
3447 hxge_get_priv_prop(p_hxge_t hxgep, const char *pr_name, uint_t pr_valsize,
3448 void *pr_val)
3449 {
3450 p_hxge_param_t param_arr = hxgep->param_arr;
3451 char valstr[MAXNAMELEN];
3452 int err = 0;
3453 uint_t strsize;
3454 int value = 0;
3455
3456 HXGE_DEBUG_MSG((hxgep, DLADM_CTL,
3457 "==> hxge_get_priv_prop: property %s", pr_name));
3487 err = hxge_param_get_ip_opt(hxgep, NULL, NULL,
3488 (caddr_t)¶m_arr[param_class_opt_ipv6_tcp]);
3489
3490 value = (int)param_arr[param_class_opt_ipv6_tcp].value;
3491 } else if (strcmp(pr_name, "_class_opt_ipv6_udp") == 0) {
3492 err = hxge_param_get_ip_opt(hxgep, NULL, NULL,
3493 (caddr_t)¶m_arr[param_class_opt_ipv6_udp]);
3494
3495 value = (int)param_arr[param_class_opt_ipv6_udp].value;
3496 } else if (strcmp(pr_name, "_class_opt_ipv6_ah") == 0) {
3497 err = hxge_param_get_ip_opt(hxgep, NULL, NULL,
3498 (caddr_t)¶m_arr[param_class_opt_ipv6_ah]);
3499
3500 value = (int)param_arr[param_class_opt_ipv6_ah].value;
3501 } else if (strcmp(pr_name, "_class_opt_ipv6_sctp") == 0) {
3502 err = hxge_param_get_ip_opt(hxgep, NULL, NULL,
3503 (caddr_t)¶m_arr[param_class_opt_ipv6_sctp]);
3504
3505 value = (int)param_arr[param_class_opt_ipv6_sctp].value;
3506 } else {
3507 err = ENOTSUP;
3508 }
3509
3510 if (err == 0) {
3511 (void) snprintf(valstr, sizeof (valstr), "0x%x", value);
3512
3513 strsize = (uint_t)strlen(valstr);
3514 if (pr_valsize < strsize) {
3515 err = ENOBUFS;
3516 } else {
3517 (void) strlcpy(pr_val, valstr, pr_valsize);
3518 }
3519 }
3520
3521 HXGE_DEBUG_MSG((hxgep, DLADM_CTL,
3522 "<== hxge_get_priv_prop: return %d", err));
3523
3524 return (err);
3525 }
3526 /*
3527 * Module loading and removing entry points.
|