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 /*
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 2012 Nexenta Systems, Inc. All rights reserved.
29 */
30
31 #include "ixgbe_sw.h"
32
33 /*
34 * Bring the device out of the reset/quiesced state that it
35 * was in when the interface was registered.
36 */
37 int
38 ixgbe_m_start(void *arg)
39 {
40 ixgbe_t *ixgbe = (ixgbe_t *)arg;
41
42 mutex_enter(&ixgbe->gen_lock);
43
44 if (ixgbe->ixgbe_state & IXGBE_SUSPENDED) {
45 mutex_exit(&ixgbe->gen_lock);
46 return (ECANCELED);
47 }
48
414
415 /*
416 * Set rx buffer size
417 */
418 rx_size = ixgbe->max_frame_size + IPHDR_ALIGN_ROOM;
419 ixgbe->rx_buf_size = ((rx_size >> 10) + ((rx_size &
420 (((uint32_t)1 << 10) - 1)) > 0 ? 1 : 0)) << 10;
421
422 /*
423 * Set tx buffer size
424 */
425 tx_size = ixgbe->max_frame_size;
426 ixgbe->tx_buf_size = ((tx_size >> 10) + ((tx_size &
427 (((uint32_t)1 << 10) - 1)) > 0 ? 1 : 0)) << 10;
428 }
429 break;
430 case MAC_PROP_PRIVATE:
431 err = ixgbe_set_priv_prop(ixgbe, pr_name, pr_valsize, pr_val);
432 break;
433 default:
434 err = EINVAL;
435 break;
436 }
437 mutex_exit(&ixgbe->gen_lock);
438 return (err);
439 }
440
441 int
442 ixgbe_m_getprop(void *arg, const char *pr_name, mac_prop_id_t pr_num,
443 uint_t pr_valsize, void *pr_val)
444 {
445 ixgbe_t *ixgbe = (ixgbe_t *)arg;
446 struct ixgbe_hw *hw = &ixgbe->hw;
447 int err = 0;
448 uint32_t flow_control;
449 uint64_t tmp = 0;
450
451 switch (pr_num) {
452 case MAC_PROP_DUPLEX:
453 ASSERT(pr_valsize >= sizeof (link_duplex_t));
454 bcopy(&ixgbe->link_duplex, pr_val,
487 case MAC_PROP_EN_10GFDX_CAP:
488 *(uint8_t *)pr_val = ixgbe->param_en_10000fdx_cap;
489 break;
490 case MAC_PROP_ADV_1000FDX_CAP:
491 *(uint8_t *)pr_val = ixgbe->param_adv_1000fdx_cap;
492 break;
493 case MAC_PROP_EN_1000FDX_CAP:
494 *(uint8_t *)pr_val = ixgbe->param_en_1000fdx_cap;
495 break;
496 case MAC_PROP_ADV_100FDX_CAP:
497 *(uint8_t *)pr_val = ixgbe->param_adv_100fdx_cap;
498 break;
499 case MAC_PROP_EN_100FDX_CAP:
500 *(uint8_t *)pr_val = ixgbe->param_en_100fdx_cap;
501 break;
502 case MAC_PROP_PRIVATE:
503 err = ixgbe_get_priv_prop(ixgbe, pr_name,
504 pr_valsize, pr_val);
505 break;
506 default:
507 err = EINVAL;
508 break;
509 }
510 return (err);
511 }
512
513 void
514 ixgbe_m_propinfo(void *arg, const char *pr_name, mac_prop_id_t pr_num,
515 mac_prop_info_handle_t prh)
516 {
517 ixgbe_t *ixgbe = (ixgbe_t *)arg;
518 uint_t perm;
519
520 switch (pr_num) {
521 case MAC_PROP_DUPLEX:
522 case MAC_PROP_SPEED:
523 mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
524 break;
525
526 case MAC_PROP_ADV_100FDX_CAP:
527 case MAC_PROP_ADV_1000FDX_CAP:
|
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 /*
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 2012 Nexenta Systems, Inc. All rights reserved.
29 * Copyright 2016 OmniTI Computer Consulting, Inc. All rights reserved.
30 */
31
32 #include "ixgbe_sw.h"
33
34 /*
35 * Bring the device out of the reset/quiesced state that it
36 * was in when the interface was registered.
37 */
38 int
39 ixgbe_m_start(void *arg)
40 {
41 ixgbe_t *ixgbe = (ixgbe_t *)arg;
42
43 mutex_enter(&ixgbe->gen_lock);
44
45 if (ixgbe->ixgbe_state & IXGBE_SUSPENDED) {
46 mutex_exit(&ixgbe->gen_lock);
47 return (ECANCELED);
48 }
49
415
416 /*
417 * Set rx buffer size
418 */
419 rx_size = ixgbe->max_frame_size + IPHDR_ALIGN_ROOM;
420 ixgbe->rx_buf_size = ((rx_size >> 10) + ((rx_size &
421 (((uint32_t)1 << 10) - 1)) > 0 ? 1 : 0)) << 10;
422
423 /*
424 * Set tx buffer size
425 */
426 tx_size = ixgbe->max_frame_size;
427 ixgbe->tx_buf_size = ((tx_size >> 10) + ((tx_size &
428 (((uint32_t)1 << 10) - 1)) > 0 ? 1 : 0)) << 10;
429 }
430 break;
431 case MAC_PROP_PRIVATE:
432 err = ixgbe_set_priv_prop(ixgbe, pr_name, pr_valsize, pr_val);
433 break;
434 default:
435 err = ENOTSUP;
436 break;
437 }
438 mutex_exit(&ixgbe->gen_lock);
439 return (err);
440 }
441
442 int
443 ixgbe_m_getprop(void *arg, const char *pr_name, mac_prop_id_t pr_num,
444 uint_t pr_valsize, void *pr_val)
445 {
446 ixgbe_t *ixgbe = (ixgbe_t *)arg;
447 struct ixgbe_hw *hw = &ixgbe->hw;
448 int err = 0;
449 uint32_t flow_control;
450 uint64_t tmp = 0;
451
452 switch (pr_num) {
453 case MAC_PROP_DUPLEX:
454 ASSERT(pr_valsize >= sizeof (link_duplex_t));
455 bcopy(&ixgbe->link_duplex, pr_val,
488 case MAC_PROP_EN_10GFDX_CAP:
489 *(uint8_t *)pr_val = ixgbe->param_en_10000fdx_cap;
490 break;
491 case MAC_PROP_ADV_1000FDX_CAP:
492 *(uint8_t *)pr_val = ixgbe->param_adv_1000fdx_cap;
493 break;
494 case MAC_PROP_EN_1000FDX_CAP:
495 *(uint8_t *)pr_val = ixgbe->param_en_1000fdx_cap;
496 break;
497 case MAC_PROP_ADV_100FDX_CAP:
498 *(uint8_t *)pr_val = ixgbe->param_adv_100fdx_cap;
499 break;
500 case MAC_PROP_EN_100FDX_CAP:
501 *(uint8_t *)pr_val = ixgbe->param_en_100fdx_cap;
502 break;
503 case MAC_PROP_PRIVATE:
504 err = ixgbe_get_priv_prop(ixgbe, pr_name,
505 pr_valsize, pr_val);
506 break;
507 default:
508 err = ENOTSUP;
509 break;
510 }
511 return (err);
512 }
513
514 void
515 ixgbe_m_propinfo(void *arg, const char *pr_name, mac_prop_id_t pr_num,
516 mac_prop_info_handle_t prh)
517 {
518 ixgbe_t *ixgbe = (ixgbe_t *)arg;
519 uint_t perm;
520
521 switch (pr_num) {
522 case MAC_PROP_DUPLEX:
523 case MAC_PROP_SPEED:
524 mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
525 break;
526
527 case MAC_PROP_ADV_100FDX_CAP:
528 case MAC_PROP_ADV_1000FDX_CAP:
|