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
694 err = EINVAL;
695 else {
696 ixgbe->rx_limit_per_intr = (uint32_t)result;
697 }
698 return (err);
699 }
700 if (strcmp(pr_name, "_intr_throttling") == 0) {
701 if (pr_val == NULL) {
702 err = EINVAL;
703 return (err);
704 }
705 (void) ddi_strtol(pr_val, (char **)NULL, 0, &result);
706
707 if (result < ixgbe->capab->min_intr_throttle ||
708 result > ixgbe->capab->max_intr_throttle)
709 err = EINVAL;
710 else {
711 ixgbe->intr_throttling[0] = (uint32_t)result;
712
713 /*
714 * 82599 and X540 require the interrupt throttling
715 * rate is a multiple of 8. This is enforced by the
716 * register definiton.
717 */
718 if (hw->mac.type == ixgbe_mac_82599EB ||
719 hw->mac.type == ixgbe_mac_X540) {
720 ixgbe->intr_throttling[0] =
721 ixgbe->intr_throttling[0] & 0xFF8;
722 }
723
724 for (i = 0; i < MAX_INTR_VECTOR; i++)
725 ixgbe->intr_throttling[i] =
726 ixgbe->intr_throttling[0];
727
728 /* Set interrupt throttling rate */
729 for (i = 0; i < ixgbe->intr_cnt; i++)
730 IXGBE_WRITE_REG(hw, IXGBE_EITR(i),
731 ixgbe->intr_throttling[i]);
732 }
733 return (err);
734 }
735 return (ENOTSUP);
736 }
737
738 int
739 ixgbe_get_priv_prop(ixgbe_t *ixgbe, const char *pr_name,
|
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
695 err = EINVAL;
696 else {
697 ixgbe->rx_limit_per_intr = (uint32_t)result;
698 }
699 return (err);
700 }
701 if (strcmp(pr_name, "_intr_throttling") == 0) {
702 if (pr_val == NULL) {
703 err = EINVAL;
704 return (err);
705 }
706 (void) ddi_strtol(pr_val, (char **)NULL, 0, &result);
707
708 if (result < ixgbe->capab->min_intr_throttle ||
709 result > ixgbe->capab->max_intr_throttle)
710 err = EINVAL;
711 else {
712 ixgbe->intr_throttling[0] = (uint32_t)result;
713
714 /*
715 * 82599, X540 and X550 require the interrupt
716 * throttling rate is a multiple of 8. This is
717 * enforced by the register definiton.
718 */
719 if (hw->mac.type == ixgbe_mac_82599EB ||
720 hw->mac.type == ixgbe_mac_X540 ||
721 hw->mac.type == ixgbe_mac_X550 ||
722 hw->mac.type == ixgbe_mac_X550EM_x) {
723 ixgbe->intr_throttling[0] =
724 ixgbe->intr_throttling[0] & 0xFF8;
725 }
726
727 for (i = 0; i < MAX_INTR_VECTOR; i++)
728 ixgbe->intr_throttling[i] =
729 ixgbe->intr_throttling[0];
730
731 /* Set interrupt throttling rate */
732 for (i = 0; i < ixgbe->intr_cnt; i++)
733 IXGBE_WRITE_REG(hw, IXGBE_EITR(i),
734 ixgbe->intr_throttling[i]);
735 }
736 return (err);
737 }
738 return (ENOTSUP);
739 }
740
741 int
742 ixgbe_get_priv_prop(ixgbe_t *ixgbe, const char *pr_name,
|