annotate usr/src/uts/common/io/ixgbe/ixgbe_82599.c @ 13696:7b5944437191

2654 add ixgbe support for new x520 models Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com> Reviewed by: Keith Wesolowski <keith.wesolowski@joyent.com> Reviewed by: Dan McDonald <danmcd@nexenta.com> Reviewed by: Milan Jurik <milan.jurik@xylab.cz> Approved by: Richard Lowe <richlowe@richlowe.net>
author Robert Mustacchi <rm@joyent.com>
date Wed, 16 May 2012 09:00:21 -0700
parents f03238cace0b
children 229af35d14fb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1 /******************************************************************************
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2
13696
7b5944437191 2654 add ixgbe support for new x520 models
Robert Mustacchi <rm@joyent.com>
parents: 13448
diff changeset
3 Copyright (c) 2001-2012, Intel Corporation
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
4 All rights reserved.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
5
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
6 Redistribution and use in source and binary forms, with or without
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
7 modification, are permitted provided that the following conditions are met:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
8
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
9 1. Redistributions of source code must retain the above copyright notice,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
10 this list of conditions and the following disclaimer.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
11
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
12 2. Redistributions in binary form must reproduce the above copyright
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
13 notice, this list of conditions and the following disclaimer in the
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
14 documentation and/or other materials provided with the distribution.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
15
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
16 3. Neither the name of the Intel Corporation nor the names of its
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
17 contributors may be used to endorse or promote products derived from
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
18 this software without specific prior written permission.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
19
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
21 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
22 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
23 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
24 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
30 POSSIBILITY OF SUCH DAMAGE.
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
31
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
32 ******************************************************************************/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
33 /*$FreeBSD$*/
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
34
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
35 #include "ixgbe_type.h"
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
36 #include "ixgbe_api.h"
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
37 #include "ixgbe_common.h"
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
38 #include "ixgbe_phy.h"
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
39
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
40 s32 ixgbe_init_ops_82599(struct ixgbe_hw *hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
41 s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw,
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
42 ixgbe_link_speed *speed,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
43 bool *autoneg);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
44 enum ixgbe_media_type ixgbe_get_media_type_82599(struct ixgbe_hw *hw);
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
45 void ixgbe_disable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw);
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
46 void ixgbe_enable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw);
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
47 void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw);
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
48 s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
49 ixgbe_link_speed speed, bool autoneg,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
50 bool autoneg_wait_to_complete);
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
51 s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
52 ixgbe_link_speed speed, bool autoneg,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
53 bool autoneg_wait_to_complete);
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
54 s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw,
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
55 bool autoneg_wait_to_complete);
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
56 s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
57 ixgbe_link_speed speed,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
58 bool autoneg,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
59 bool autoneg_wait_to_complete);
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
60 static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw,
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
61 ixgbe_link_speed speed,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
62 bool autoneg,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
63 bool autoneg_wait_to_complete);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
64 s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
65 void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
66 s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
67 s32 ixgbe_read_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 *val);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
68 s32 ixgbe_write_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 val);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
69 s32 ixgbe_start_hw_rev_1_82599(struct ixgbe_hw *hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
70 s32 ixgbe_identify_phy_82599(struct ixgbe_hw *hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
71 s32 ixgbe_init_phy_ops_82599(struct ixgbe_hw *hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
72 u32 ixgbe_get_supported_physical_layer_82599(struct ixgbe_hw *hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
73 s32 ixgbe_enable_rx_dma_82599(struct ixgbe_hw *hw, u32 regval);
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
74 static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw);
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
75 bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
76
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
77
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
78 void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
79 {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
80 struct ixgbe_mac_info *mac = &hw->mac;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
81
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
82 DEBUGFUNC("ixgbe_init_mac_link_ops_82599");
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
83
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
84 /* enable the laser control functions for SFP+ fiber */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
85 if (mac->ops.get_media_type(hw) == ixgbe_media_type_fiber) {
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
86 mac->ops.disable_tx_laser =
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
87 &ixgbe_disable_tx_laser_multispeed_fiber;
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
88 mac->ops.enable_tx_laser =
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
89 &ixgbe_enable_tx_laser_multispeed_fiber;
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
90 mac->ops.flap_tx_laser = &ixgbe_flap_tx_laser_multispeed_fiber;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
91
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
92 } else {
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
93 mac->ops.disable_tx_laser = NULL;
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
94 mac->ops.enable_tx_laser = NULL;
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
95 mac->ops.flap_tx_laser = NULL;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
96 }
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
97
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
98 if (hw->phy.multispeed_fiber) {
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
99 /* Set up dual speed SFP+ support */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
100 mac->ops.setup_link = &ixgbe_setup_mac_link_multispeed_fiber;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
101 } else {
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
102 if ((ixgbe_get_media_type(hw) == ixgbe_media_type_backplane) &&
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
103 (hw->phy.smart_speed == ixgbe_smart_speed_auto ||
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
104 hw->phy.smart_speed == ixgbe_smart_speed_on) &&
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
105 !ixgbe_verify_lesm_fw_enabled_82599(hw)) {
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
106 mac->ops.setup_link = &ixgbe_setup_mac_link_smartspeed;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
107 } else {
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
108 mac->ops.setup_link = &ixgbe_setup_mac_link_82599;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
109 }
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
110 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
111 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
112
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
113 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
114 * ixgbe_init_phy_ops_82599 - PHY/SFP specific init
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
115 * @hw: pointer to hardware structure
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
116 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
117 * Initialize any function pointers that were not able to be
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
118 * set during init_shared_code because the PHY/SFP type was
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
119 * not known. Perform the SFP init if necessary.
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
120 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
121 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
122 s32 ixgbe_init_phy_ops_82599(struct ixgbe_hw *hw)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
123 {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
124 struct ixgbe_mac_info *mac = &hw->mac;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
125 struct ixgbe_phy_info *phy = &hw->phy;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
126 s32 ret_val = IXGBE_SUCCESS;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
127
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
128 DEBUGFUNC("ixgbe_init_phy_ops_82599");
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
129
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
130 /* Identify the PHY or SFP module */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
131 ret_val = phy->ops.identify(hw);
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
132 if (ret_val == IXGBE_ERR_SFP_NOT_SUPPORTED)
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
133 goto init_phy_ops_out;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
134
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
135 /* Setup function pointers based on detected SFP module and speeds */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
136 ixgbe_init_mac_link_ops_82599(hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
137 if (hw->phy.sfp_type != ixgbe_sfp_type_unknown)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
138 hw->phy.ops.reset = NULL;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
139
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
140 /* If copper media, overwrite with copper function pointers */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
141 if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
142 mac->ops.setup_link = &ixgbe_setup_copper_link_82599;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
143 mac->ops.get_link_capabilities =
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
144 &ixgbe_get_copper_link_capabilities_generic;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
145 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
146
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
147 /* Set necessary function pointers based on phy type */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
148 switch (hw->phy.type) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
149 case ixgbe_phy_tn:
12003
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
150 phy->ops.setup_link = &ixgbe_setup_phy_link_tnx;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
151 phy->ops.check_link = &ixgbe_check_phy_link_tnx;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
152 phy->ops.get_firmware_version =
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
153 &ixgbe_get_phy_firmware_version_tnx;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
154 break;
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
155 case ixgbe_phy_aq:
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
156 phy->ops.get_firmware_version =
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
157 &ixgbe_get_phy_firmware_version_generic;
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
158 break;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
159 default:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
160 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
161 }
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
162 init_phy_ops_out:
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
163 return ret_val;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
164 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
165
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
166 s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
167 {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
168 s32 ret_val = IXGBE_SUCCESS;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
169 u32 reg_anlp1 = 0;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
170 u32 i = 0;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
171 u16 list_offset, data_offset, data_value;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
172
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
173 DEBUGFUNC("ixgbe_setup_sfp_modules_82599");
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
174
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
175 if (hw->phy.sfp_type != ixgbe_sfp_type_unknown) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
176 ixgbe_init_mac_link_ops_82599(hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
177
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
178 hw->phy.ops.reset = NULL;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
179
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
180 ret_val = ixgbe_get_sfp_init_sequence_offsets(hw, &list_offset,
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
181 &data_offset);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
182 if (ret_val != IXGBE_SUCCESS)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
183 goto setup_sfp_out;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
184
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
185 /* PHY config will finish before releasing the semaphore */
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
186 ret_val = ixgbe_acquire_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM);
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
187 if (ret_val != IXGBE_SUCCESS) {
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
188 ret_val = IXGBE_ERR_SWFW_SYNC;
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
189 goto setup_sfp_out;
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
190 }
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
191
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
192 hw->eeprom.ops.read(hw, ++data_offset, &data_value);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
193 while (data_value != 0xffff) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
194 IXGBE_WRITE_REG(hw, IXGBE_CORECTL, data_value);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
195 IXGBE_WRITE_FLUSH(hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
196 hw->eeprom.ops.read(hw, ++data_offset, &data_value);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
197 }
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
198
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
199 /* Release the semaphore */
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
200 ixgbe_release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM);
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
201 /* Delay obtaining semaphore again to allow FW access */
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
202 msec_delay(hw->eeprom.semaphore_delay);
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
203
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
204 /* Now restart DSP by setting Restart_AN and clearing LMS */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
205 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, ((IXGBE_READ_REG(hw,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
206 IXGBE_AUTOC) & ~IXGBE_AUTOC_LMS_MASK) |
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
207 IXGBE_AUTOC_AN_RESTART));
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
208
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
209 /* Wait for AN to leave state 0 */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
210 for (i = 0; i < 10; i++) {
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
211 msec_delay(4);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
212 reg_anlp1 = IXGBE_READ_REG(hw, IXGBE_ANLP1);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
213 if (reg_anlp1 & IXGBE_ANLP1_AN_STATE_MASK)
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
214 break;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
215 }
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
216 if (!(reg_anlp1 & IXGBE_ANLP1_AN_STATE_MASK)) {
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
217 DEBUGOUT("sfp module setup not complete\n");
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
218 ret_val = IXGBE_ERR_SFP_SETUP_NOT_COMPLETE;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
219 goto setup_sfp_out;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
220 }
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
221
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
222 /* Restart DSP by setting Restart_AN and return to SFI mode */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
223 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, (IXGBE_READ_REG(hw,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
224 IXGBE_AUTOC) | IXGBE_AUTOC_LMS_10G_SERIAL |
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
225 IXGBE_AUTOC_AN_RESTART));
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
226 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
227
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
228 setup_sfp_out:
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
229 return ret_val;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
230 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
231
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
232 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
233 * ixgbe_init_ops_82599 - Inits func ptrs and MAC type
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
234 * @hw: pointer to hardware structure
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
235 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
236 * Initialize the function pointers and assign the MAC type for 82599.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
237 * Does not touch the hardware.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
238 **/
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
239
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
240 s32 ixgbe_init_ops_82599(struct ixgbe_hw *hw)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
241 {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
242 struct ixgbe_mac_info *mac = &hw->mac;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
243 struct ixgbe_phy_info *phy = &hw->phy;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
244 s32 ret_val;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
245
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
246 DEBUGFUNC("ixgbe_init_ops_82599");
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
247
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
248 ret_val = ixgbe_init_phy_ops_generic(hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
249 ret_val = ixgbe_init_ops_generic(hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
250
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
251 /* PHY */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
252 phy->ops.identify = &ixgbe_identify_phy_82599;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
253 phy->ops.init = &ixgbe_init_phy_ops_82599;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
254
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
255 /* MAC */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
256 mac->ops.reset_hw = &ixgbe_reset_hw_82599;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
257 mac->ops.enable_relaxed_ordering = &ixgbe_enable_relaxed_ordering_gen2;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
258 mac->ops.get_media_type = &ixgbe_get_media_type_82599;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
259 mac->ops.get_supported_physical_layer =
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
260 &ixgbe_get_supported_physical_layer_82599;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
261 mac->ops.enable_rx_dma = &ixgbe_enable_rx_dma_82599;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
262 mac->ops.read_analog_reg8 = &ixgbe_read_analog_reg8_82599;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
263 mac->ops.write_analog_reg8 = &ixgbe_write_analog_reg8_82599;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
264 mac->ops.start_hw = &ixgbe_start_hw_rev_1_82599;
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
265 mac->ops.get_san_mac_addr = &ixgbe_get_san_mac_addr_generic;
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
266 mac->ops.set_san_mac_addr = &ixgbe_set_san_mac_addr_generic;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
267 mac->ops.get_device_caps = &ixgbe_get_device_caps_generic;
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
268 mac->ops.get_wwn_prefix = &ixgbe_get_wwn_prefix_generic;
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
269 mac->ops.get_fcoe_boot_status = &ixgbe_get_fcoe_boot_status_generic;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
270
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
271 /* RAR, Multicast, VLAN */
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
272 mac->ops.set_vmdq = &ixgbe_set_vmdq_generic;
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
273 mac->ops.clear_vmdq = &ixgbe_clear_vmdq_generic;
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
274 mac->ops.insert_mac_addr = &ixgbe_insert_mac_addr_generic;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
275 mac->rar_highwater = 1;
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
276 mac->ops.set_vfta = &ixgbe_set_vfta_generic;
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
277 mac->ops.clear_vfta = &ixgbe_clear_vfta_generic;
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
278 mac->ops.init_uta_tables = &ixgbe_init_uta_tables_generic;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
279 mac->ops.setup_sfp = &ixgbe_setup_sfp_modules_82599;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
280 mac->ops.set_mac_anti_spoofing = &ixgbe_set_mac_anti_spoofing;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
281 mac->ops.set_vlan_anti_spoofing = &ixgbe_set_vlan_anti_spoofing;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
282
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
283 /* Link */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
284 mac->ops.get_link_capabilities = &ixgbe_get_link_capabilities_82599;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
285 mac->ops.check_link = &ixgbe_check_mac_link_generic;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
286 ixgbe_init_mac_link_ops_82599(hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
287
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
288 mac->mcft_size = 128;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
289 mac->vft_size = 128;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
290 mac->num_rar_entries = 128;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
291 mac->rx_pb_size = 512;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
292 mac->max_tx_queues = 128;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
293 mac->max_rx_queues = 128;
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
294 mac->max_msix_vectors = ixgbe_get_pcie_msix_count_generic(hw);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
295
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
296 return ret_val;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
297 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
298
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
299 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
300 * ixgbe_get_link_capabilities_82599 - Determines link capabilities
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
301 * @hw: pointer to hardware structure
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
302 * @speed: pointer to link speed
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
303 * @negotiation: TRUE when autoneg or autotry is enabled
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
304 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
305 * Determines the link capabilities by reading the AUTOC register.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
306 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
307 s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
308 ixgbe_link_speed *speed,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
309 bool *negotiation)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
310 {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
311 s32 status = IXGBE_SUCCESS;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
312 u32 autoc = 0;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
313
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
314 DEBUGFUNC("ixgbe_get_link_capabilities_82599");
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
315
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
316
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
317 /* Check if 1G SFP module. */
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
318 if (hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
319 hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1) {
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
320 *speed = IXGBE_LINK_SPEED_1GB_FULL;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
321 *negotiation = TRUE;
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
322 goto out;
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
323 }
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
324
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
325 /*
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
326 * Determine link capabilities based on the stored value of AUTOC,
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
327 * which represents EEPROM defaults. If AUTOC value has not
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
328 * been stored, use the current register values.
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
329 */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
330 if (hw->mac.orig_link_settings_stored)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
331 autoc = hw->mac.orig_autoc;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
332 else
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
333 autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
334
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
335 switch (autoc & IXGBE_AUTOC_LMS_MASK) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
336 case IXGBE_AUTOC_LMS_1G_LINK_NO_AN:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
337 *speed = IXGBE_LINK_SPEED_1GB_FULL;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
338 *negotiation = FALSE;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
339 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
340
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
341 case IXGBE_AUTOC_LMS_10G_LINK_NO_AN:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
342 *speed = IXGBE_LINK_SPEED_10GB_FULL;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
343 *negotiation = FALSE;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
344 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
345
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
346 case IXGBE_AUTOC_LMS_1G_AN:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
347 *speed = IXGBE_LINK_SPEED_1GB_FULL;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
348 *negotiation = TRUE;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
349 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
350
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
351 case IXGBE_AUTOC_LMS_10G_SERIAL:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
352 *speed = IXGBE_LINK_SPEED_10GB_FULL;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
353 *negotiation = FALSE;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
354 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
355
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
356 case IXGBE_AUTOC_LMS_KX4_KX_KR:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
357 case IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
358 *speed = IXGBE_LINK_SPEED_UNKNOWN;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
359 if (autoc & IXGBE_AUTOC_KR_SUPP)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
360 *speed |= IXGBE_LINK_SPEED_10GB_FULL;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
361 if (autoc & IXGBE_AUTOC_KX4_SUPP)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
362 *speed |= IXGBE_LINK_SPEED_10GB_FULL;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
363 if (autoc & IXGBE_AUTOC_KX_SUPP)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
364 *speed |= IXGBE_LINK_SPEED_1GB_FULL;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
365 *negotiation = TRUE;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
366 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
367
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
368 case IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
369 *speed = IXGBE_LINK_SPEED_100_FULL;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
370 if (autoc & IXGBE_AUTOC_KR_SUPP)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
371 *speed |= IXGBE_LINK_SPEED_10GB_FULL;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
372 if (autoc & IXGBE_AUTOC_KX4_SUPP)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
373 *speed |= IXGBE_LINK_SPEED_10GB_FULL;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
374 if (autoc & IXGBE_AUTOC_KX_SUPP)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
375 *speed |= IXGBE_LINK_SPEED_1GB_FULL;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
376 *negotiation = TRUE;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
377 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
378
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
379 case IXGBE_AUTOC_LMS_SGMII_1G_100M:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
380 *speed = IXGBE_LINK_SPEED_1GB_FULL | IXGBE_LINK_SPEED_100_FULL;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
381 *negotiation = FALSE;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
382 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
383
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
384 default:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
385 status = IXGBE_ERR_LINK_SETUP;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
386 goto out;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
387 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
388
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
389 if (hw->phy.multispeed_fiber) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
390 *speed |= IXGBE_LINK_SPEED_10GB_FULL |
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
391 IXGBE_LINK_SPEED_1GB_FULL;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
392 *negotiation = TRUE;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
393 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
394
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
395 out:
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
396 return status;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
397 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
398
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
399 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
400 * ixgbe_get_media_type_82599 - Get media type
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
401 * @hw: pointer to hardware structure
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
402 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
403 * Returns the media type (fiber, copper, backplane)
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
404 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
405 enum ixgbe_media_type ixgbe_get_media_type_82599(struct ixgbe_hw *hw)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
406 {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
407 enum ixgbe_media_type media_type;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
408
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
409 DEBUGFUNC("ixgbe_get_media_type_82599");
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
410
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
411 /* Detect if there is a copper PHY attached. */
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
412 switch (hw->phy.type) {
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
413 case ixgbe_phy_cu_unknown:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
414 case ixgbe_phy_tn:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
415 case ixgbe_phy_aq:
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
416 media_type = ixgbe_media_type_copper;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
417 goto out;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
418 default:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
419 break;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
420 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
421
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
422 switch (hw->device_id) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
423 case IXGBE_DEV_ID_82599_KX4:
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
424 case IXGBE_DEV_ID_82599_KX4_MEZZ:
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
425 case IXGBE_DEV_ID_82599_COMBO_BACKPLANE:
13696
7b5944437191 2654 add ixgbe support for new x520 models
Robert Mustacchi <rm@joyent.com>
parents: 13448
diff changeset
426 case IXGBE_DEV_ID_82599_KR:
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
427 case IXGBE_DEV_ID_82599_BACKPLANE_FCOE:
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
428 case IXGBE_DEV_ID_82599_XAUI_LOM:
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
429 /* Default device ID is mezzanine card KX/KX4 */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
430 media_type = ixgbe_media_type_backplane;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
431 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
432 case IXGBE_DEV_ID_82599_SFP:
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
433 case IXGBE_DEV_ID_82599_SFP_FCOE:
13696
7b5944437191 2654 add ixgbe support for new x520 models
Robert Mustacchi <rm@joyent.com>
parents: 13448
diff changeset
434 case IXGBE_DEV_ID_82599_SFP_EM:
7b5944437191 2654 add ixgbe support for new x520 models
Robert Mustacchi <rm@joyent.com>
parents: 13448
diff changeset
435 case IXGBE_DEV_ID_82599_SFP_SF2:
7b5944437191 2654 add ixgbe support for new x520 models
Robert Mustacchi <rm@joyent.com>
parents: 13448
diff changeset
436 case IXGBE_DEV_ID_82599EN_SFP:
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
437 media_type = ixgbe_media_type_fiber;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
438 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
439 case IXGBE_DEV_ID_82599_CX4:
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
440 media_type = ixgbe_media_type_cx4;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
441 break;
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
442 case IXGBE_DEV_ID_82599_T3_LOM:
12003
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
443 media_type = ixgbe_media_type_copper;
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
444 break;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
445 default:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
446 media_type = ixgbe_media_type_unknown;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
447 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
448 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
449 out:
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
450 return media_type;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
451 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
452
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
453 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
454 * ixgbe_start_mac_link_82599 - Setup MAC link settings
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
455 * @hw: pointer to hardware structure
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
456 * @autoneg_wait_to_complete: TRUE when waiting for completion is needed
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
457 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
458 * Configures link settings based on values in the ixgbe_hw struct.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
459 * Restarts the link. Performs autonegotiation if needed.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
460 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
461 s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
462 bool autoneg_wait_to_complete)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
463 {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
464 u32 autoc_reg;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
465 u32 links_reg;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
466 u32 i;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
467 s32 status = IXGBE_SUCCESS;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
468
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
469 DEBUGFUNC("ixgbe_start_mac_link_82599");
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
470
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
471
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
472 /* Restart link */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
473 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
474 autoc_reg |= IXGBE_AUTOC_AN_RESTART;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
475 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
476
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
477 /* Only poll for autoneg to complete if specified to do so */
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
478 if (autoneg_wait_to_complete) {
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
479 if ((autoc_reg & IXGBE_AUTOC_LMS_MASK) ==
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
480 IXGBE_AUTOC_LMS_KX4_KX_KR ||
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
481 (autoc_reg & IXGBE_AUTOC_LMS_MASK) ==
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
482 IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN ||
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
483 (autoc_reg & IXGBE_AUTOC_LMS_MASK) ==
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
484 IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) {
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
485 links_reg = 0; /* Just in case Autoneg time = 0 */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
486 for (i = 0; i < IXGBE_AUTO_NEG_TIME; i++) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
487 links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
488 if (links_reg & IXGBE_LINKS_KX_AN_COMP)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
489 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
490 msec_delay(100);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
491 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
492 if (!(links_reg & IXGBE_LINKS_KX_AN_COMP)) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
493 status = IXGBE_ERR_AUTONEG_NOT_COMPLETE;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
494 DEBUGOUT("Autoneg did not complete.\n");
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
495 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
496 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
497 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
498
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
499 /* Add delay to filter out noises during initial link setup */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
500 msec_delay(50);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
501
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
502 return status;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
503 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
504
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
505 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
506 * ixgbe_disable_tx_laser_multispeed_fiber - Disable Tx laser
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
507 * @hw: pointer to hardware structure
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
508 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
509 * The base drivers may require better control over SFP+ module
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
510 * PHY states. This includes selectively shutting down the Tx
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
511 * laser on the PHY, effectively halting physical link.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
512 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
513 void ixgbe_disable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw)
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
514 {
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
515 u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP);
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
516
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
517 /* Disable tx laser; allow 100us to go dark per spec */
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
518 esdp_reg |= IXGBE_ESDP_SDP3;
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
519 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
520 IXGBE_WRITE_FLUSH(hw);
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
521 usec_delay(100);
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
522 }
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
523
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
524 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
525 * ixgbe_enable_tx_laser_multispeed_fiber - Enable Tx laser
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
526 * @hw: pointer to hardware structure
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
527 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
528 * The base drivers may require better control over SFP+ module
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
529 * PHY states. This includes selectively turning on the Tx
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
530 * laser on the PHY, effectively starting physical link.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
531 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
532 void ixgbe_enable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw)
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
533 {
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
534 u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP);
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
535
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
536 /* Enable tx laser; allow 100ms to light up */
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
537 esdp_reg &= ~IXGBE_ESDP_SDP3;
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
538 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
539 IXGBE_WRITE_FLUSH(hw);
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
540 msec_delay(100);
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
541 }
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
542
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
543 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
544 * ixgbe_flap_tx_laser_multispeed_fiber - Flap Tx laser
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
545 * @hw: pointer to hardware structure
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
546 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
547 * When the driver changes the link speeds that it can support,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
548 * it sets autotry_restart to TRUE to indicate that we need to
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
549 * initiate a new autotry session with the link partner. To do
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
550 * so, we set the speed then disable and re-enable the tx laser, to
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
551 * alert the link partner that it also needs to restart autotry on its
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
552 * end. This is consistent with TRUE clause 37 autoneg, which also
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
553 * involves a loss of signal.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
554 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
555 void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw)
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
556 {
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
557 DEBUGFUNC("ixgbe_flap_tx_laser_multispeed_fiber");
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
558
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
559 if (hw->mac.autotry_restart) {
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
560 ixgbe_disable_tx_laser_multispeed_fiber(hw);
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
561 ixgbe_enable_tx_laser_multispeed_fiber(hw);
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
562 hw->mac.autotry_restart = FALSE;
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
563 }
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
564 }
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
565
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
566 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
567 * ixgbe_setup_mac_link_multispeed_fiber - Set MAC link speed
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
568 * @hw: pointer to hardware structure
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
569 * @speed: new link speed
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
570 * @autoneg: TRUE if autonegotiation enabled
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
571 * @autoneg_wait_to_complete: TRUE when waiting for completion is needed
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
572 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
573 * Set the link speed in the AUTOC register and restarts link.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
574 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
575 s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
576 ixgbe_link_speed speed, bool autoneg,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
577 bool autoneg_wait_to_complete)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
578 {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
579 s32 status = IXGBE_SUCCESS;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
580 ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_UNKNOWN;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
581 ixgbe_link_speed highest_link_speed = IXGBE_LINK_SPEED_UNKNOWN;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
582 u32 speedcnt = 0;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
583 u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP);
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
584 u32 i = 0;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
585 bool link_up = FALSE;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
586 bool negotiation;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
587
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
588 DEBUGFUNC("ixgbe_setup_mac_link_multispeed_fiber");
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
589
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
590 /* Mask off requested but non-supported speeds */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
591 status = ixgbe_get_link_capabilities(hw, &link_speed, &negotiation);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
592 if (status != IXGBE_SUCCESS)
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
593 return status;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
594
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
595 speed &= link_speed;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
596
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
597 /*
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
598 * Try each speed one by one, highest priority first. We do this in
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
599 * software because 10gb fiber doesn't support speed autonegotiation.
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
600 */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
601 if (speed & IXGBE_LINK_SPEED_10GB_FULL) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
602 speedcnt++;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
603 highest_link_speed = IXGBE_LINK_SPEED_10GB_FULL;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
604
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
605 /* If we already have link at this speed, just jump out */
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
606 status = ixgbe_check_link(hw, &link_speed, &link_up, FALSE);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
607 if (status != IXGBE_SUCCESS)
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
608 return status;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
609
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
610 if ((link_speed == IXGBE_LINK_SPEED_10GB_FULL) && link_up)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
611 goto out;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
612
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
613 /* Set the module link speed */
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
614 esdp_reg |= (IXGBE_ESDP_SDP5_DIR | IXGBE_ESDP_SDP5);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
615 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
616 IXGBE_WRITE_FLUSH(hw);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
617
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
618 /* Allow module to change analog characteristics (1G->10G) */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
619 msec_delay(40);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
620
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
621 status = ixgbe_setup_mac_link_82599(hw,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
622 IXGBE_LINK_SPEED_10GB_FULL,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
623 autoneg,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
624 autoneg_wait_to_complete);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
625 if (status != IXGBE_SUCCESS)
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
626 return status;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
627
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
628 /* Flap the tx laser if it has not already been done */
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
629 ixgbe_flap_tx_laser(hw);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
630
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
631 /*
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
632 * Wait for the controller to acquire link. Per IEEE 802.3ap,
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
633 * Section 73.10.2, we may have to wait up to 500ms if KR is
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
634 * attempted. 82599 uses the same timing for 10g SFI.
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
635 */
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
636 for (i = 0; i < 5; i++) {
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
637 /* Wait for the link partner to also set speed */
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
638 msec_delay(100);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
639
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
640 /* If we have link, just jump out */
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
641 status = ixgbe_check_link(hw, &link_speed,
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
642 &link_up, FALSE);
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
643 if (status != IXGBE_SUCCESS)
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
644 return status;
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
645
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
646 if (link_up)
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
647 goto out;
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
648 }
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
649 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
650
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
651 if (speed & IXGBE_LINK_SPEED_1GB_FULL) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
652 speedcnt++;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
653 if (highest_link_speed == IXGBE_LINK_SPEED_UNKNOWN)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
654 highest_link_speed = IXGBE_LINK_SPEED_1GB_FULL;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
655
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
656 /* If we already have link at this speed, just jump out */
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
657 status = ixgbe_check_link(hw, &link_speed, &link_up, FALSE);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
658 if (status != IXGBE_SUCCESS)
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
659 return status;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
660
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
661 if ((link_speed == IXGBE_LINK_SPEED_1GB_FULL) && link_up)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
662 goto out;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
663
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
664 /* Set the module link speed */
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
665 esdp_reg &= ~IXGBE_ESDP_SDP5;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
666 esdp_reg |= IXGBE_ESDP_SDP5_DIR;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
667 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
668 IXGBE_WRITE_FLUSH(hw);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
669
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
670 /* Allow module to change analog characteristics (10G->1G) */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
671 msec_delay(40);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
672
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
673 status = ixgbe_setup_mac_link_82599(hw,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
674 IXGBE_LINK_SPEED_1GB_FULL,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
675 autoneg,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
676 autoneg_wait_to_complete);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
677 if (status != IXGBE_SUCCESS)
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
678 return status;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
679
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
680 /* Flap the tx laser if it has not already been done */
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
681 ixgbe_flap_tx_laser(hw);
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
682
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
683 /* Wait for the link partner to also set speed */
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
684 msec_delay(100);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
685
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
686 /* If we have link, just jump out */
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
687 status = ixgbe_check_link(hw, &link_speed, &link_up, FALSE);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
688 if (status != IXGBE_SUCCESS)
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
689 return status;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
690
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
691 if (link_up)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
692 goto out;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
693 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
694
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
695 /*
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
696 * We didn't get link. Configure back to the highest speed we tried,
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
697 * (if there was more than one). We call ourselves back with just the
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
698 * single highest speed that the user requested.
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
699 */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
700 if (speedcnt > 1)
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
701 status = ixgbe_setup_mac_link_multispeed_fiber(hw,
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
702 highest_link_speed, autoneg, autoneg_wait_to_complete);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
703
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
704 out:
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
705 /* Set autoneg_advertised value based on input link speed */
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
706 hw->phy.autoneg_advertised = 0;
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
707
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
708 if (speed & IXGBE_LINK_SPEED_10GB_FULL)
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
709 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_10GB_FULL;
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
710
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
711 if (speed & IXGBE_LINK_SPEED_1GB_FULL)
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
712 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_1GB_FULL;
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
713
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
714 return status;
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
715 }
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
716
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
717 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
718 * ixgbe_setup_mac_link_smartspeed - Set MAC link speed using SmartSpeed
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
719 * @hw: pointer to hardware structure
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
720 * @speed: new link speed
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
721 * @autoneg: TRUE if autonegotiation enabled
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
722 * @autoneg_wait_to_complete: TRUE when waiting for completion is needed
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
723 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
724 * Implements the Intel SmartSpeed algorithm.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
725 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
726 s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
727 ixgbe_link_speed speed, bool autoneg,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
728 bool autoneg_wait_to_complete)
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
729 {
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
730 s32 status = IXGBE_SUCCESS;
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
731 ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_UNKNOWN;
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
732 s32 i, j;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
733 bool link_up = FALSE;
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
734 u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
735
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
736 DEBUGFUNC("ixgbe_setup_mac_link_smartspeed");
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
737
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
738 /* Set autoneg_advertised value based on input link speed */
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
739 hw->phy.autoneg_advertised = 0;
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
740
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
741 if (speed & IXGBE_LINK_SPEED_10GB_FULL)
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
742 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_10GB_FULL;
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
743
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
744 if (speed & IXGBE_LINK_SPEED_1GB_FULL)
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
745 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_1GB_FULL;
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
746
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
747 if (speed & IXGBE_LINK_SPEED_100_FULL)
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
748 hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_100_FULL;
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
749
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
750 /*
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
751 * Implement Intel SmartSpeed algorithm. SmartSpeed will reduce the
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
752 * autoneg advertisement if link is unable to be established at the
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
753 * highest negotiated rate. This can sometimes happen due to integrity
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
754 * issues with the physical media connection.
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
755 */
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
756
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
757 /* First, try to get link with full advertisement */
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
758 hw->phy.smart_speed_active = FALSE;
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
759 for (j = 0; j < IXGBE_SMARTSPEED_MAX_RETRIES; j++) {
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
760 status = ixgbe_setup_mac_link_82599(hw, speed, autoneg,
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
761 autoneg_wait_to_complete);
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
762 if (status != IXGBE_SUCCESS)
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
763 goto out;
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
764
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
765 /*
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
766 * Wait for the controller to acquire link. Per IEEE 802.3ap,
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
767 * Section 73.10.2, we may have to wait up to 500ms if KR is
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
768 * attempted, or 200ms if KX/KX4/BX/BX4 is attempted, per
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
769 * Table 9 in the AN MAS.
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
770 */
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
771 for (i = 0; i < 5; i++) {
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
772 msec_delay(100);
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
773
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
774 /* If we have link, just jump out */
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
775 status = ixgbe_check_link(hw, &link_speed, &link_up,
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
776 FALSE);
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
777 if (status != IXGBE_SUCCESS)
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
778 goto out;
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
779
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
780 if (link_up)
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
781 goto out;
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
782 }
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
783 }
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
784
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
785 /*
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
786 * We didn't get link. If we advertised KR plus one of KX4/KX
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
787 * (or BX4/BX), then disable KR and try again.
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
788 */
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
789 if (((autoc_reg & IXGBE_AUTOC_KR_SUPP) == 0) ||
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
790 ((autoc_reg & IXGBE_AUTOC_KX4_KX_SUPP_MASK) == 0))
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
791 goto out;
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
792
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
793 /* Turn SmartSpeed on to disable KR support */
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
794 hw->phy.smart_speed_active = TRUE;
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
795 status = ixgbe_setup_mac_link_82599(hw, speed, autoneg,
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
796 autoneg_wait_to_complete);
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
797 if (status != IXGBE_SUCCESS)
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
798 goto out;
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
799
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
800 /*
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
801 * Wait for the controller to acquire link. 600ms will allow for
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
802 * the AN link_fail_inhibit_timer as well for multiple cycles of
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
803 * parallel detect, both 10g and 1g. This allows for the maximum
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
804 * connect attempts as defined in the AN MAS table 73-7.
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
805 */
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
806 for (i = 0; i < 6; i++) {
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
807 msec_delay(100);
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
808
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
809 /* If we have link, just jump out */
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
810 status = ixgbe_check_link(hw, &link_speed, &link_up, FALSE);
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
811 if (status != IXGBE_SUCCESS)
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
812 goto out;
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
813
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
814 if (link_up)
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
815 goto out;
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
816 }
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
817
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
818 /* We didn't get link. Turn SmartSpeed back off. */
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
819 hw->phy.smart_speed_active = FALSE;
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
820 status = ixgbe_setup_mac_link_82599(hw, speed, autoneg,
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
821 autoneg_wait_to_complete);
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
822
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
823 out:
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
824 if (link_up && (link_speed == IXGBE_LINK_SPEED_1GB_FULL))
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
825 DEBUGOUT("Smartspeed has downgraded the link speed "
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
826 "from the maximum advertised\n");
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
827 return status;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
828 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
829
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
830 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
831 * ixgbe_setup_mac_link_82599 - Set MAC link speed
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
832 * @hw: pointer to hardware structure
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
833 * @speed: new link speed
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
834 * @autoneg: TRUE if autonegotiation enabled
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
835 * @autoneg_wait_to_complete: TRUE when waiting for completion is needed
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
836 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
837 * Set the link speed in the AUTOC register and restarts link.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
838 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
839 s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
840 ixgbe_link_speed speed, bool autoneg,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
841 bool autoneg_wait_to_complete)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
842 {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
843 s32 status = IXGBE_SUCCESS;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
844 u32 autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
845 u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
846 u32 start_autoc = autoc;
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
847 u32 orig_autoc = 0;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
848 u32 link_mode = autoc & IXGBE_AUTOC_LMS_MASK;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
849 u32 pma_pmd_1g = autoc & IXGBE_AUTOC_1G_PMA_PMD_MASK;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
850 u32 pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
851 u32 links_reg;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
852 u32 i;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
853 ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
854
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
855 DEBUGFUNC("ixgbe_setup_mac_link_82599");
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
856
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
857 /* Check to see if speed passed in is supported. */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
858 status = ixgbe_get_link_capabilities(hw, &link_capabilities, &autoneg);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
859 if (status != IXGBE_SUCCESS)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
860 goto out;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
861
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
862 speed &= link_capabilities;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
863
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
864 if (speed == IXGBE_LINK_SPEED_UNKNOWN) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
865 status = IXGBE_ERR_LINK_SETUP;
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
866 goto out;
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
867 }
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
868
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
869 /* Use stored value (EEPROM defaults) of AUTOC to find KR/KX4 support*/
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
870 if (hw->mac.orig_link_settings_stored)
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
871 orig_autoc = hw->mac.orig_autoc;
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
872 else
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
873 orig_autoc = autoc;
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
874
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
875 if (link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR ||
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
876 link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN ||
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
877 link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
878 /* Set KX4/KX/KR support according to speed requested */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
879 autoc &= ~(IXGBE_AUTOC_KX4_KX_SUPP_MASK | IXGBE_AUTOC_KR_SUPP);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
880 if (speed & IXGBE_LINK_SPEED_10GB_FULL)
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
881 if (orig_autoc & IXGBE_AUTOC_KX4_SUPP)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
882 autoc |= IXGBE_AUTOC_KX4_SUPP;
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
883 if ((orig_autoc & IXGBE_AUTOC_KR_SUPP) &&
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
884 (hw->phy.smart_speed_active == FALSE))
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
885 autoc |= IXGBE_AUTOC_KR_SUPP;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
886 if (speed & IXGBE_LINK_SPEED_1GB_FULL)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
887 autoc |= IXGBE_AUTOC_KX_SUPP;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
888 } else if ((pma_pmd_1g == IXGBE_AUTOC_1G_SFI) &&
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
889 (link_mode == IXGBE_AUTOC_LMS_1G_LINK_NO_AN ||
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
890 link_mode == IXGBE_AUTOC_LMS_1G_AN)) {
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
891 /* Switch from 1G SFI to 10G SFI if requested */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
892 if ((speed == IXGBE_LINK_SPEED_10GB_FULL) &&
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
893 (pma_pmd_10g_serial == IXGBE_AUTOC2_10G_SFI)) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
894 autoc &= ~IXGBE_AUTOC_LMS_MASK;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
895 autoc |= IXGBE_AUTOC_LMS_10G_SERIAL;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
896 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
897 } else if ((pma_pmd_10g_serial == IXGBE_AUTOC2_10G_SFI) &&
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
898 (link_mode == IXGBE_AUTOC_LMS_10G_SERIAL)) {
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
899 /* Switch from 10G SFI to 1G SFI if requested */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
900 if ((speed == IXGBE_LINK_SPEED_1GB_FULL) &&
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
901 (pma_pmd_1g == IXGBE_AUTOC_1G_SFI)) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
902 autoc &= ~IXGBE_AUTOC_LMS_MASK;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
903 if (autoneg)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
904 autoc |= IXGBE_AUTOC_LMS_1G_AN;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
905 else
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
906 autoc |= IXGBE_AUTOC_LMS_1G_LINK_NO_AN;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
907 }
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
908 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
909
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
910 if (autoc != start_autoc) {
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
911 /* Restart link */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
912 autoc |= IXGBE_AUTOC_AN_RESTART;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
913 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
914
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
915 /* Only poll for autoneg to complete if specified to do so */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
916 if (autoneg_wait_to_complete) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
917 if (link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR ||
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
918 link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN ||
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
919 link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) {
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
920 links_reg = 0; /*Just in case Autoneg time=0*/
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
921 for (i = 0; i < IXGBE_AUTO_NEG_TIME; i++) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
922 links_reg =
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
923 IXGBE_READ_REG(hw, IXGBE_LINKS);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
924 if (links_reg & IXGBE_LINKS_KX_AN_COMP)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
925 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
926 msec_delay(100);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
927 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
928 if (!(links_reg & IXGBE_LINKS_KX_AN_COMP)) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
929 status =
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
930 IXGBE_ERR_AUTONEG_NOT_COMPLETE;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
931 DEBUGOUT("Autoneg did not complete.\n");
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
932 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
933 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
934 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
935
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
936 /* Add delay to filter out noises during initial link setup */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
937 msec_delay(50);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
938 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
939
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
940 out:
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
941 return status;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
942 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
943
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
944 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
945 * ixgbe_setup_copper_link_82599 - Set the PHY autoneg advertised field
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
946 * @hw: pointer to hardware structure
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
947 * @speed: new link speed
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
948 * @autoneg: TRUE if autonegotiation enabled
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
949 * @autoneg_wait_to_complete: TRUE if waiting is needed to complete
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
950 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
951 * Restarts link on PHY and MAC based on settings passed in.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
952 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
953 static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
954 ixgbe_link_speed speed,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
955 bool autoneg,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
956 bool autoneg_wait_to_complete)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
957 {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
958 s32 status;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
959
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
960 DEBUGFUNC("ixgbe_setup_copper_link_82599");
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
961
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
962 /* Setup the PHY according to input speed */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
963 status = hw->phy.ops.setup_link_speed(hw, speed, autoneg,
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
964 autoneg_wait_to_complete);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
965 /* Set up MAC */
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
966 (void) ixgbe_start_mac_link_82599(hw, autoneg_wait_to_complete);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
967
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
968 return status;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
969 }
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
970
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
971 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
972 * ixgbe_reset_hw_82599 - Perform hardware reset
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
973 * @hw: pointer to hardware structure
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
974 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
975 * Resets the hardware by resetting the transmit and receive units, masks
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
976 * and clears all interrupts, perform a PHY reset, and perform a link (MAC)
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
977 * reset.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
978 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
979 s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
980 {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
981 s32 status = IXGBE_SUCCESS;
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
982 u32 ctrl;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
983 u32 i;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
984 u32 autoc;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
985 u32 autoc2;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
986
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
987 DEBUGFUNC("ixgbe_reset_hw_82599");
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
988
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
989 /* Call adapter stop to disable tx/rx and clear interrupts */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
990 hw->mac.ops.stop_adapter(hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
991
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
992 /* PHY ops must be identified and initialized prior to reset */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
993
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
994 /* Identify PHY and related function pointers */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
995 status = hw->phy.ops.init(hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
996
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
997 if (status == IXGBE_ERR_SFP_NOT_SUPPORTED)
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
998 goto reset_hw_out;
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
999
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1000 /* Setup SFP module if there is one present. */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1001 if (hw->phy.sfp_setup_needed) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1002 status = hw->mac.ops.setup_sfp(hw);
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1003 hw->phy.sfp_setup_needed = FALSE;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1004 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1005
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1006 if (status == IXGBE_ERR_SFP_NOT_SUPPORTED)
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1007 goto reset_hw_out;
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1008
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1009 /* Reset PHY */
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1010 if (hw->phy.reset_disable == FALSE && hw->phy.ops.reset != NULL)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1011 hw->phy.ops.reset(hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1012
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1013 /*
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1014 * Prevent the PCI-E bus from from hanging by disabling PCI-E master
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1015 * access and verify no pending requests before reset
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1016 */
12003
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
1017 (void) ixgbe_disable_pcie_master(hw);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1018
12003
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
1019 mac_reset_top:
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1020 /*
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1021 * Issue global reset to the MAC. This needs to be a SW reset.
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1022 * If link reset is used, it might reset the MAC when mng is using it
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1023 */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1024 ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1025 IXGBE_WRITE_REG(hw, IXGBE_CTRL, (ctrl | IXGBE_CTRL_RST));
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1026 IXGBE_WRITE_FLUSH(hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1027
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1028 /* Poll for reset bit to self-clear indicating reset is complete */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1029 for (i = 0; i < 10; i++) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1030 usec_delay(1);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1031 ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL);
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1032 if (!(ctrl & IXGBE_CTRL_RST))
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1033 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1034 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1035 if (ctrl & IXGBE_CTRL_RST) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1036 status = IXGBE_ERR_RESET_FAILED;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1037 DEBUGOUT("Reset polling failed to complete.\n");
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1038 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1039
12003
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
1040 /*
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
1041 * Double resets are required for recovery from certain error
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
1042 * conditions. Between resets, it is necessary to stall to allow time
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
1043 * for any pending HW events to complete. We use 1usec since that is
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
1044 * what is needed for ixgbe_disable_pcie_master(). The second reset
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
1045 * then clears out any effects of those events.
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
1046 */
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
1047 if (hw->mac.flags & IXGBE_FLAGS_DOUBLE_RESET_REQUIRED) {
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
1048 hw->mac.flags &= ~IXGBE_FLAGS_DOUBLE_RESET_REQUIRED;
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
1049 usec_delay(1);
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
1050 goto mac_reset_top;
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
1051 }
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
1052
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1053 msec_delay(50);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1054
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1055 /*
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1056 * Store the original AUTOC/AUTOC2 values if they have not been
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1057 * stored off yet. Otherwise restore the stored original
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1058 * values since the reset operation sets back to defaults.
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1059 */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1060 autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1061 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1062 if (hw->mac.orig_link_settings_stored == FALSE) {
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1063 hw->mac.orig_autoc = autoc;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1064 hw->mac.orig_autoc2 = autoc2;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1065 hw->mac.orig_link_settings_stored = TRUE;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1066 } else {
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1067 if (autoc != hw->mac.orig_autoc)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1068 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, (hw->mac.orig_autoc |
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1069 IXGBE_AUTOC_AN_RESTART));
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1070
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1071 if ((autoc2 & IXGBE_AUTOC2_UPPER_MASK) !=
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1072 (hw->mac.orig_autoc2 & IXGBE_AUTOC2_UPPER_MASK)) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1073 autoc2 &= ~IXGBE_AUTOC2_UPPER_MASK;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1074 autoc2 |= (hw->mac.orig_autoc2 &
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1075 IXGBE_AUTOC2_UPPER_MASK);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1076 IXGBE_WRITE_REG(hw, IXGBE_AUTOC2, autoc2);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1077 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1078 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1079
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1080 /* Store the permanent mac address */
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1081 hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr);
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1082
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1083 /*
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1084 * Store MAC address from RAR0, clear receive address registers, and
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1085 * clear the multicast table. Also reset num_rar_entries to 128,
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1086 * since we modify this value when programming the SAN MAC address.
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1087 */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1088 hw->mac.num_rar_entries = 128;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1089 hw->mac.ops.init_rx_addrs(hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1090
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1091 /* Store the permanent SAN mac address */
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1092 hw->mac.ops.get_san_mac_addr(hw, hw->mac.san_addr);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1093
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1094 /* Add the SAN MAC address to the RAR only if it's a valid address */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1095 if (ixgbe_validate_mac_addr(hw->mac.san_addr) == 0) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1096 hw->mac.ops.set_rar(hw, hw->mac.num_rar_entries - 1,
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1097 hw->mac.san_addr, 0, IXGBE_RAH_AV);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1098
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1099 /* Reserve the last RAR for the SAN MAC address */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1100 hw->mac.num_rar_entries--;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1101 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1102
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1103 /* Store the alternative WWNN/WWPN prefix */
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1104 hw->mac.ops.get_wwn_prefix(hw, &hw->mac.wwnn_prefix,
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1105 &hw->mac.wwpn_prefix);
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1106
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1107 reset_hw_out:
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1108 return status;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1109 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1110
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1111 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1112 * ixgbe_reinit_fdir_tables_82599 - Reinitialize Flow Director tables.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1113 * @hw: pointer to hardware structure
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1114 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1115 s32 ixgbe_reinit_fdir_tables_82599(struct ixgbe_hw *hw)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1116 {
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1117 int i;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1118 u32 fdirctrl = IXGBE_READ_REG(hw, IXGBE_FDIRCTRL);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1119 fdirctrl &= ~IXGBE_FDIRCTRL_INIT_DONE;
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1120
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1121 DEBUGFUNC("ixgbe_reinit_fdir_tables_82599");
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1122
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1123 /*
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1124 * Before starting reinitialization process,
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1125 * FDIRCMD.CMD must be zero.
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1126 */
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1127 for (i = 0; i < IXGBE_FDIRCMD_CMD_POLL; i++) {
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1128 if (!(IXGBE_READ_REG(hw, IXGBE_FDIRCMD) &
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1129 IXGBE_FDIRCMD_CMD_MASK))
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1130 break;
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1131 usec_delay(10);
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1132 }
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1133 if (i >= IXGBE_FDIRCMD_CMD_POLL) {
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1134 DEBUGOUT("Flow Director previous command isn't complete, "
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1135 "aborting table re-initialization. \n");
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1136 return IXGBE_ERR_FDIR_REINIT_FAILED;
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1137 }
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1138
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1139 IXGBE_WRITE_REG(hw, IXGBE_FDIRFREE, 0);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1140 IXGBE_WRITE_FLUSH(hw);
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1141 /*
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1142 * 82599 adapters flow director init flow cannot be restarted,
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1143 * Workaround 82599 silicon errata by performing the following steps
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1144 * before re-writing the FDIRCTRL control register with the same value.
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1145 * - write 1 to bit 8 of FDIRCMD register &
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1146 * - write 0 to bit 8 of FDIRCMD register
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1147 */
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1148 IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD,
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1149 (IXGBE_READ_REG(hw, IXGBE_FDIRCMD) |
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1150 IXGBE_FDIRCMD_CLEARHT));
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1151 IXGBE_WRITE_FLUSH(hw);
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1152 IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD,
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1153 (IXGBE_READ_REG(hw, IXGBE_FDIRCMD) &
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1154 ~IXGBE_FDIRCMD_CLEARHT));
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1155 IXGBE_WRITE_FLUSH(hw);
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1156 /*
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1157 * Clear FDIR Hash register to clear any leftover hashes
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1158 * waiting to be programmed.
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1159 */
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1160 IXGBE_WRITE_REG(hw, IXGBE_FDIRHASH, 0x00);
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1161 IXGBE_WRITE_FLUSH(hw);
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1162
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1163 IXGBE_WRITE_REG(hw, IXGBE_FDIRCTRL, fdirctrl);
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1164 IXGBE_WRITE_FLUSH(hw);
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1165
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1166 /* Poll init-done after we write FDIRCTRL register */
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1167 for (i = 0; i < IXGBE_FDIR_INIT_DONE_POLL; i++) {
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1168 if (IXGBE_READ_REG(hw, IXGBE_FDIRCTRL) &
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1169 IXGBE_FDIRCTRL_INIT_DONE)
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1170 break;
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1171 usec_delay(10);
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1172 }
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1173 if (i >= IXGBE_FDIR_INIT_DONE_POLL) {
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1174 DEBUGOUT("Flow Director Signature poll time exceeded!\n");
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1175 return IXGBE_ERR_FDIR_REINIT_FAILED;
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1176 }
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1177
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1178 /* Clear FDIR statistics registers (read to clear) */
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1179 (void) IXGBE_READ_REG(hw, IXGBE_FDIRUSTAT);
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1180 (void) IXGBE_READ_REG(hw, IXGBE_FDIRFSTAT);
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1181 (void) IXGBE_READ_REG(hw, IXGBE_FDIRMATCH);
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1182 (void) IXGBE_READ_REG(hw, IXGBE_FDIRMISS);
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1183 (void) IXGBE_READ_REG(hw, IXGBE_FDIRLEN);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1184
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1185 return IXGBE_SUCCESS;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1186 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1187
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1188 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1189 * ixgbe_init_fdir_signature_82599 - Initialize Flow Director signature filters
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1190 * @hw: pointer to hardware structure
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1191 * @pballoc: which mode to allocate filters with
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1192 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1193 s32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *hw, u32 pballoc)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1194 {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1195 u32 fdirctrl = 0;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1196 u32 pbsize;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1197 int i;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1198
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1199 DEBUGFUNC("ixgbe_init_fdir_signature_82599");
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1200
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1201 /*
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1202 * Before enabling Flow Director, the Rx Packet Buffer size
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1203 * must be reduced. The new value is the current size minus
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1204 * flow director memory usage size.
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1205 */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1206 pbsize = (1 << (IXGBE_FDIR_PBALLOC_SIZE_SHIFT + pballoc));
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1207 IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(0),
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1208 (IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(0)) - pbsize));
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1209
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1210 /*
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1211 * The defaults in the HW for RX PB 1-7 are not zero and so should be
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1212 * intialized to zero for non DCB mode otherwise actual total RX PB
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1213 * would be bigger than programmed and filter space would run into
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1214 * the PB 0 region.
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1215 */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1216 for (i = 1; i < 8; i++)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1217 IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), 0);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1218
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1219 /* Send interrupt when 64 filters are left */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1220 fdirctrl |= 4 << IXGBE_FDIRCTRL_FULL_THRESH_SHIFT;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1221
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1222 /* Set the maximum length per hash bucket to 0xA filters */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1223 fdirctrl |= 0xA << IXGBE_FDIRCTRL_MAX_LENGTH_SHIFT;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1224
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1225 switch (pballoc) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1226 case IXGBE_FDIR_PBALLOC_64K:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1227 /* 8k - 1 signature filters */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1228 fdirctrl |= IXGBE_FDIRCTRL_PBALLOC_64K;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1229 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1230 case IXGBE_FDIR_PBALLOC_128K:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1231 /* 16k - 1 signature filters */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1232 fdirctrl |= IXGBE_FDIRCTRL_PBALLOC_128K;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1233 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1234 case IXGBE_FDIR_PBALLOC_256K:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1235 /* 32k - 1 signature filters */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1236 fdirctrl |= IXGBE_FDIRCTRL_PBALLOC_256K;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1237 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1238 default:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1239 /* bad value */
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1240 return IXGBE_ERR_CONFIG;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1241 };
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1242
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1243 /* Move the flexible bytes to use the ethertype - shift 6 words */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1244 fdirctrl |= (0x6 << IXGBE_FDIRCTRL_FLEX_SHIFT);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1245
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1246
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1247 /* Prime the keys for hashing */
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1248 IXGBE_WRITE_REG(hw, IXGBE_FDIRHKEY, IXGBE_ATR_BUCKET_HASH_KEY);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1249 IXGBE_WRITE_REG(hw, IXGBE_FDIRSKEY, IXGBE_ATR_SIGNATURE_HASH_KEY);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1250
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1251 /*
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1252 * Poll init-done after we write the register. Estimated times:
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1253 * 10G: PBALLOC = 11b, timing is 60us
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1254 * 1G: PBALLOC = 11b, timing is 600us
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1255 * 100M: PBALLOC = 11b, timing is 6ms
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1256 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1257 * Multiple these timings by 4 if under full Rx load
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1258 *
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1259 * So we'll poll for IXGBE_FDIR_INIT_DONE_POLL times, sleeping for
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1260 * 1 msec per poll time. If we're at line rate and drop to 100M, then
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1261 * this might not finish in our poll time, but we can live with that
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1262 * for now.
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1263 */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1264 IXGBE_WRITE_REG(hw, IXGBE_FDIRCTRL, fdirctrl);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1265 IXGBE_WRITE_FLUSH(hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1266 for (i = 0; i < IXGBE_FDIR_INIT_DONE_POLL; i++) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1267 if (IXGBE_READ_REG(hw, IXGBE_FDIRCTRL) &
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1268 IXGBE_FDIRCTRL_INIT_DONE)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1269 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1270 msec_delay(1);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1271 }
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1272 if (i >= IXGBE_FDIR_INIT_DONE_POLL)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1273 DEBUGOUT("Flow Director Signature poll time exceeded!\n");
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1274
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1275 return IXGBE_SUCCESS;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1276 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1277
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1278 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1279 * ixgbe_init_fdir_perfect_82599 - Initialize Flow Director perfect filters
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1280 * @hw: pointer to hardware structure
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1281 * @pballoc: which mode to allocate filters with
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1282 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1283 s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 pballoc)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1284 {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1285 u32 fdirctrl = 0;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1286 u32 pbsize;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1287 int i;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1288
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1289 DEBUGFUNC("ixgbe_init_fdir_perfect_82599");
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1290
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1291 /*
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1292 * Before enabling Flow Director, the Rx Packet Buffer size
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1293 * must be reduced. The new value is the current size minus
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1294 * flow director memory usage size.
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1295 */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1296 pbsize = (1 << (IXGBE_FDIR_PBALLOC_SIZE_SHIFT + pballoc));
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1297 IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(0),
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1298 (IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(0)) - pbsize));
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1299
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1300 /*
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1301 * The defaults in the HW for RX PB 1-7 are not zero and so should be
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1302 * intialized to zero for non DCB mode otherwise actual total RX PB
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1303 * would be bigger than programmed and filter space would run into
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1304 * the PB 0 region.
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1305 */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1306 for (i = 1; i < 8; i++)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1307 IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), 0);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1308
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1309 /* Send interrupt when 64 filters are left */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1310 fdirctrl |= 4 << IXGBE_FDIRCTRL_FULL_THRESH_SHIFT;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1311
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1312 /* Initialize the drop queue to Rx queue 127 */
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1313 fdirctrl |= (127 << IXGBE_FDIRCTRL_DROP_Q_SHIFT);
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1314
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1315 switch (pballoc) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1316 case IXGBE_FDIR_PBALLOC_64K:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1317 /* 2k - 1 perfect filters */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1318 fdirctrl |= IXGBE_FDIRCTRL_PBALLOC_64K;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1319 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1320 case IXGBE_FDIR_PBALLOC_128K:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1321 /* 4k - 1 perfect filters */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1322 fdirctrl |= IXGBE_FDIRCTRL_PBALLOC_128K;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1323 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1324 case IXGBE_FDIR_PBALLOC_256K:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1325 /* 8k - 1 perfect filters */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1326 fdirctrl |= IXGBE_FDIRCTRL_PBALLOC_256K;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1327 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1328 default:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1329 /* bad value */
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1330 return IXGBE_ERR_CONFIG;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1331 };
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1332
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1333 /* Turn perfect match filtering on */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1334 fdirctrl |= IXGBE_FDIRCTRL_PERFECT_MATCH;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1335 fdirctrl |= IXGBE_FDIRCTRL_REPORT_STATUS;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1336
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1337 /* Move the flexible bytes to use the ethertype - shift 6 words */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1338 fdirctrl |= (0x6 << IXGBE_FDIRCTRL_FLEX_SHIFT);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1339
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1340 /* Prime the keys for hashing */
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1341 IXGBE_WRITE_REG(hw, IXGBE_FDIRHKEY, IXGBE_ATR_BUCKET_HASH_KEY);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1342 IXGBE_WRITE_REG(hw, IXGBE_FDIRSKEY,IXGBE_ATR_SIGNATURE_HASH_KEY);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1343
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1344 /*
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1345 * Poll init-done after we write the register. Estimated times:
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1346 * 10G: PBALLOC = 11b, timing is 60us
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1347 * 1G: PBALLOC = 11b, timing is 600us
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1348 * 100M: PBALLOC = 11b, timing is 6ms
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1349 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1350 * Multiple these timings by 4 if under full Rx load
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1351 *
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1352 * So we'll poll for IXGBE_FDIR_INIT_DONE_POLL times, sleeping for
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1353 * 1 msec per poll time. If we're at line rate and drop to 100M, then
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1354 * this might not finish in our poll time, but we can live with that
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1355 * for now.
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1356 */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1357
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1358 /* Set the maximum length per hash bucket to 0xA filters */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1359 fdirctrl |= (0xA << IXGBE_FDIRCTRL_MAX_LENGTH_SHIFT);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1360
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1361 IXGBE_WRITE_REG(hw, IXGBE_FDIRCTRL, fdirctrl);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1362 IXGBE_WRITE_FLUSH(hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1363 for (i = 0; i < IXGBE_FDIR_INIT_DONE_POLL; i++) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1364 if (IXGBE_READ_REG(hw, IXGBE_FDIRCTRL) &
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1365 IXGBE_FDIRCTRL_INIT_DONE)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1366 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1367 msec_delay(1);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1368 }
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1369 if (i >= IXGBE_FDIR_INIT_DONE_POLL)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1370 DEBUGOUT("Flow Director Perfect poll time exceeded!\n");
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1371
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1372 return IXGBE_SUCCESS;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1373 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1374
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1375 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1376 * ixgbe_atr_compute_hash_82599 - Compute the hashes for SW ATR
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1377 * @stream: input bitstream to compute the hash on
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1378 * @key: 32-bit hash key
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1379 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1380 u32 ixgbe_atr_compute_hash_82599(union ixgbe_atr_input *atr_input,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1381 u32 key)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1382 {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1383 /*
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1384 * The algorithm is as follows:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1385 * Hash[15:0] = Sum { S[n] x K[n+16] }, n = 0...350
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1386 * where Sum {A[n]}, n = 0...n is bitwise XOR of A[0], A[1]...A[n]
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1387 * and A[n] x B[n] is bitwise AND between same length strings
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1388 *
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1389 * K[n] is 16 bits, defined as:
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1390 * for n modulo 32 >= 15, K[n] = K[n % 32 : (n % 32) - 15]
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1391 * for n modulo 32 < 15, K[n] =
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1392 * K[(n % 32:0) | (31:31 - (14 - (n % 32)))]
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1393 *
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1394 * S[n] is 16 bits, defined as:
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1395 * for n >= 15, S[n] = S[n:n - 15]
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1396 * for n < 15, S[n] = S[(n:0) | (350:350 - (14 - n))]
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1397 *
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1398 * To simplify for programming, the algorithm is implemented
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1399 * in software this way:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1400 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1401 * key[31:0], hi_hash_dword[31:0], lo_hash_dword[31:0], hash[15:0]
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1402 *
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1403 * for (i = 0; i < 352; i+=32)
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1404 * hi_hash_dword[31:0] ^= Stream[(i+31):i];
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1405 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1406 * lo_hash_dword[15:0] ^= Stream[15:0];
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1407 * lo_hash_dword[15:0] ^= hi_hash_dword[31:16];
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1408 * lo_hash_dword[31:16] ^= hi_hash_dword[15:0];
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1409 *
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1410 * hi_hash_dword[31:0] ^= Stream[351:320];
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1411 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1412 * if(key[0])
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1413 * hash[15:0] ^= Stream[15:0];
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1414 *
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1415 * for (i = 0; i < 16; i++) {
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1416 * if (key[i])
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1417 * hash[15:0] ^= lo_hash_dword[(i+15):i];
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1418 * if (key[i + 16])
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1419 * hash[15:0] ^= hi_hash_dword[(i+15):i];
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1420 * }
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1421 *
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1422 */
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1423 __be32 common_hash_dword = 0;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1424 u32 hi_hash_dword, lo_hash_dword, flow_vm_vlan;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1425 u32 hash_result = 0;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1426 u8 i;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1427
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1428 /* record the flow_vm_vlan bits as they are a key part to the hash */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1429 flow_vm_vlan = IXGBE_NTOHL(atr_input->dword_stream[0]);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1430
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1431 /* generate common hash dword */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1432 for (i = 10; i; i -= 2)
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1433 common_hash_dword ^= atr_input->dword_stream[i] ^
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1434 atr_input->dword_stream[i - 1];
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1435
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1436 hi_hash_dword = IXGBE_NTOHL(common_hash_dword);
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1437
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1438 /* low dword is word swapped version of common */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1439 lo_hash_dword = (hi_hash_dword >> 16) | (hi_hash_dword << 16);
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1440
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1441 /* apply flow ID/VM pool/VLAN ID bits to hash words */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1442 hi_hash_dword ^= flow_vm_vlan ^ (flow_vm_vlan >> 16);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1443
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1444 /* Process bits 0 and 16 */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1445 if (key & 0x0001) hash_result ^= lo_hash_dword;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1446 if (key & 0x00010000) hash_result ^= hi_hash_dword;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1447
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1448 /*
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1449 * apply flow ID/VM pool/VLAN ID bits to lo hash dword, we had to
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1450 * delay this because bit 0 of the stream should not be processed
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1451 * so we do not add the vlan until after bit 0 was processed
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1452 */
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1453 lo_hash_dword ^= flow_vm_vlan ^ (flow_vm_vlan << 16);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1454
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1455
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1456 /* process the remaining 30 bits in the key 2 bits at a time */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1457 for (i = 15; i; i-- ) {
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1458 if (key & (0x0001 << i)) hash_result ^= lo_hash_dword >> i;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1459 if (key & (0x00010000 << i)) hash_result ^= hi_hash_dword >> i;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1460 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1461
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1462 return hash_result & IXGBE_ATR_HASH_MASK;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1463 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1464
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1465 /*
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1466 * These defines allow us to quickly generate all of the necessary instructions
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1467 * in the function below by simply calling out IXGBE_COMPUTE_SIG_HASH_ITERATION
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1468 * for values 0 through 15
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1469 */
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1470 #define IXGBE_ATR_COMMON_HASH_KEY \
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1471 (IXGBE_ATR_BUCKET_HASH_KEY & IXGBE_ATR_SIGNATURE_HASH_KEY)
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1472 #define IXGBE_COMPUTE_SIG_HASH_ITERATION(_n) \
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1473 { \
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1474 u32 n = (_n); \
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1475 if (IXGBE_ATR_COMMON_HASH_KEY & (0x01 << n)) \
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1476 common_hash ^= lo_hash_dword >> n; \
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1477 else if (IXGBE_ATR_BUCKET_HASH_KEY & (0x01 << n)) \
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1478 bucket_hash ^= lo_hash_dword >> n; \
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1479 else if (IXGBE_ATR_SIGNATURE_HASH_KEY & (0x01 << n)) \
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1480 sig_hash ^= lo_hash_dword << (16 - n); \
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1481 if (IXGBE_ATR_COMMON_HASH_KEY & (0x01 << (n + 16))) \
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1482 common_hash ^= hi_hash_dword >> n; \
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1483 else if (IXGBE_ATR_BUCKET_HASH_KEY & (0x01 << (n + 16))) \
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1484 bucket_hash ^= hi_hash_dword >> n; \
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1485 else if (IXGBE_ATR_SIGNATURE_HASH_KEY & (0x01 << (n + 16))) \
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1486 sig_hash ^= hi_hash_dword << (16 - n); \
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1487 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1488
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1489 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1490 * ixgbe_atr_compute_sig_hash_82599 - Compute the signature hash
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1491 * @stream: input bitstream to compute the hash on
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1492 *
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1493 * This function is almost identical to the function above but contains
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1494 * several optomizations such as unwinding all of the loops, letting the
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1495 * compiler work out all of the conditional ifs since the keys are static
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1496 * defines, and computing two keys at once since the hashed dword stream
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1497 * will be the same for both keys.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1498 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1499 static u32 ixgbe_atr_compute_sig_hash_82599(union ixgbe_atr_hash_dword input,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1500 union ixgbe_atr_hash_dword common)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1501 {
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1502 u32 hi_hash_dword, lo_hash_dword, flow_vm_vlan;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1503 u32 sig_hash = 0, bucket_hash = 0, common_hash = 0;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1504
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1505 /* record the flow_vm_vlan bits as they are a key part to the hash */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1506 flow_vm_vlan = IXGBE_NTOHL(input.dword);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1507
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1508 /* generate common hash dword */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1509 hi_hash_dword = IXGBE_NTOHL(common.dword);
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1510
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1511 /* low dword is word swapped version of common */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1512 lo_hash_dword = (hi_hash_dword >> 16) | (hi_hash_dword << 16);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1513
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1514 /* apply flow ID/VM pool/VLAN ID bits to hash words */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1515 hi_hash_dword ^= flow_vm_vlan ^ (flow_vm_vlan >> 16);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1516
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1517 /* Process bits 0 and 16 */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1518 IXGBE_COMPUTE_SIG_HASH_ITERATION(0);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1519
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1520 /*
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1521 * apply flow ID/VM pool/VLAN ID bits to lo hash dword, we had to
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1522 * delay this because bit 0 of the stream should not be processed
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1523 * so we do not add the vlan until after bit 0 was processed
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1524 */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1525 lo_hash_dword ^= flow_vm_vlan ^ (flow_vm_vlan << 16);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1526
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1527 /* Process remaining 30 bit of the key */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1528 IXGBE_COMPUTE_SIG_HASH_ITERATION(1);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1529 IXGBE_COMPUTE_SIG_HASH_ITERATION(2);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1530 IXGBE_COMPUTE_SIG_HASH_ITERATION(3);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1531 IXGBE_COMPUTE_SIG_HASH_ITERATION(4);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1532 IXGBE_COMPUTE_SIG_HASH_ITERATION(5);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1533 IXGBE_COMPUTE_SIG_HASH_ITERATION(6);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1534 IXGBE_COMPUTE_SIG_HASH_ITERATION(7);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1535 IXGBE_COMPUTE_SIG_HASH_ITERATION(8);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1536 IXGBE_COMPUTE_SIG_HASH_ITERATION(9);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1537 IXGBE_COMPUTE_SIG_HASH_ITERATION(10);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1538 IXGBE_COMPUTE_SIG_HASH_ITERATION(11);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1539 IXGBE_COMPUTE_SIG_HASH_ITERATION(12);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1540 IXGBE_COMPUTE_SIG_HASH_ITERATION(13);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1541 IXGBE_COMPUTE_SIG_HASH_ITERATION(14);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1542 IXGBE_COMPUTE_SIG_HASH_ITERATION(15);
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1543
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1544 /* combine common_hash result with signature and bucket hashes */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1545 bucket_hash ^= common_hash;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1546 bucket_hash &= IXGBE_ATR_HASH_MASK;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1547
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1548 sig_hash ^= common_hash << 16;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1549 sig_hash &= IXGBE_ATR_HASH_MASK << 16;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1550
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1551 /* return completed signature hash */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1552 return sig_hash ^ bucket_hash;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1553 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1554
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1555 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1556 * ixgbe_atr_add_signature_filter_82599 - Adds a signature hash filter
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1557 * @hw: pointer to hardware structure
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1558 * @stream: input bitstream
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1559 * @queue: queue index to direct traffic to
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1560 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1561 s32 ixgbe_fdir_add_signature_filter_82599(struct ixgbe_hw *hw,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1562 union ixgbe_atr_hash_dword input,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1563 union ixgbe_atr_hash_dword common,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1564 u8 queue)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1565 {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1566 u64 fdirhashcmd;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1567 u32 fdircmd;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1568
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1569 DEBUGFUNC("ixgbe_fdir_add_signature_filter_82599");
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1570
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1571 /*
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1572 * Get the flow_type in order to program FDIRCMD properly
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1573 * lowest 2 bits are FDIRCMD.L4TYPE, third lowest bit is FDIRCMD.IPV6
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1574 */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1575 switch (input.formatted.flow_type) {
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1576 case IXGBE_ATR_FLOW_TYPE_TCPV4:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1577 case IXGBE_ATR_FLOW_TYPE_UDPV4:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1578 case IXGBE_ATR_FLOW_TYPE_SCTPV4:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1579 case IXGBE_ATR_FLOW_TYPE_TCPV6:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1580 case IXGBE_ATR_FLOW_TYPE_UDPV6:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1581 case IXGBE_ATR_FLOW_TYPE_SCTPV6:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1582 break;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1583 default:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1584 DEBUGOUT(" Error on flow type input\n");
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1585 return IXGBE_ERR_CONFIG;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1586 }
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1587
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1588 /* configure FDIRCMD register */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1589 fdircmd = IXGBE_FDIRCMD_CMD_ADD_FLOW | IXGBE_FDIRCMD_FILTER_UPDATE |
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1590 IXGBE_FDIRCMD_LAST | IXGBE_FDIRCMD_QUEUE_EN;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1591 fdircmd |= input.formatted.flow_type << IXGBE_FDIRCMD_FLOW_TYPE_SHIFT;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1592 fdircmd |= (u32)queue << IXGBE_FDIRCMD_RX_QUEUE_SHIFT;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1593
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1594 /*
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1595 * The lower 32-bits of fdirhashcmd is for FDIRHASH, the upper 32-bits
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1596 * is for FDIRCMD. Then do a 64-bit register write from FDIRHASH.
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1597 */
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1598 fdirhashcmd = (u64)fdircmd << 32;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1599 fdirhashcmd |= ixgbe_atr_compute_sig_hash_82599(input, common);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1600 IXGBE_WRITE_REG64(hw, IXGBE_FDIRHASH, fdirhashcmd);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1601
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1602 DEBUGOUT2("Tx Queue=%x hash=%x\n", queue, (u32)fdirhashcmd);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1603
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1604 return IXGBE_SUCCESS;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1605 }
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1606
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1607 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1608 * ixgbe_get_fdirtcpm_82599 - generate a tcp port from atr_input_masks
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1609 * @input_mask: mask to be bit swapped
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1610 *
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1611 * The source and destination port masks for flow director are bit swapped
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1612 * in that bit 15 effects bit 0, 14 effects 1, 13, 2 etc. In order to
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1613 * generate a correctly swapped value we need to bit swap the mask and that
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1614 * is what is accomplished by this function.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1615 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1616 static u32 ixgbe_get_fdirtcpm_82599(struct ixgbe_atr_input_masks *input_masks)
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1617 {
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1618 u32 mask = IXGBE_NTOHS(input_masks->dst_port_mask);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1619 mask <<= IXGBE_FDIRTCPM_DPORTM_SHIFT;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1620 mask |= IXGBE_NTOHS(input_masks->src_port_mask);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1621 mask = ((mask & 0x55555555) << 1) | ((mask & 0xAAAAAAAA) >> 1);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1622 mask = ((mask & 0x33333333) << 2) | ((mask & 0xCCCCCCCC) >> 2);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1623 mask = ((mask & 0x0F0F0F0F) << 4) | ((mask & 0xF0F0F0F0) >> 4);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1624 return ((mask & 0x00FF00FF) << 8) | ((mask & 0xFF00FF00) >> 8);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1625 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1626
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1627 /*
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1628 * These two macros are meant to address the fact that we have registers
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1629 * that are either all or in part big-endian. As a result on big-endian
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1630 * systems we will end up byte swapping the value to little-endian before
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1631 * it is byte swapped again and written to the hardware in the original
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1632 * big-endian format.
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1633 */
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1634 #define IXGBE_STORE_AS_BE32(_value) \
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1635 (((u32)(_value) >> 24) | (((u32)(_value) & 0x00FF0000) >> 8) | \
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1636 (((u32)(_value) & 0x0000FF00) << 8) | ((u32)(_value) << 24))
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1637
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1638 #define IXGBE_WRITE_REG_BE32(a, reg, value) \
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1639 IXGBE_WRITE_REG((a), (reg), IXGBE_STORE_AS_BE32(IXGBE_NTOHL(value)))
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1640
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1641 #define IXGBE_STORE_AS_BE16(_value) \
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1642 (((u16)(_value) >> 8) | ((u16)(_value) << 8))
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1643
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1644
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1645 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1646 * ixgbe_fdir_add_perfect_filter_82599 - Adds a perfect filter
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1647 * @hw: pointer to hardware structure
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1648 * @input: input bitstream
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1649 * @input_masks: masks for the input bitstream
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1650 * @soft_id: software index for the filters
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1651 * @queue: queue index to direct traffic to
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1652 *
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1653 * Note that the caller to this function must lock before calling, since the
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1654 * hardware writes must be protected from one another.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1655 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1656 s32 ixgbe_fdir_add_perfect_filter_82599(struct ixgbe_hw *hw,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1657 union ixgbe_atr_input *input,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1658 struct ixgbe_atr_input_masks *input_masks,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1659 u16 soft_id, u8 queue)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1660 {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1661 u32 fdirhash;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1662 u32 fdircmd;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1663 u32 fdirport, fdirtcpm;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1664 u32 fdirvlan;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1665 /* start with VLAN, flex bytes, VM pool, and IPv6 destination masked */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1666 u32 fdirm = IXGBE_FDIRM_VLANID | IXGBE_FDIRM_VLANP | IXGBE_FDIRM_FLEX |
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1667 IXGBE_FDIRM_POOL | IXGBE_FDIRM_DIPv6;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1668
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1669 DEBUGFUNC("ixgbe_fdir_add_perfect_filter_82599");
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1670
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1671 /*
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1672 * Check flow_type formatting, and bail out before we touch the hardware
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1673 * if there's a configuration issue
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1674 */
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1675 switch (input->formatted.flow_type) {
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1676 case IXGBE_ATR_FLOW_TYPE_IPV4:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1677 /* use the L4 protocol mask for raw IPv4/IPv6 traffic */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1678 fdirm |= IXGBE_FDIRM_L4P;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1679 /* FALLTHRU */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1680 case IXGBE_ATR_FLOW_TYPE_SCTPV4:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1681 if (input_masks->dst_port_mask || input_masks->src_port_mask) {
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1682 DEBUGOUT(" Error on src/dst port mask\n");
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1683 return IXGBE_ERR_CONFIG;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1684 }
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1685 break;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1686 case IXGBE_ATR_FLOW_TYPE_TCPV4:
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1687 break;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1688 case IXGBE_ATR_FLOW_TYPE_UDPV4:
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1689 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1690 default:
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1691 DEBUGOUT(" Error on flow type input\n");
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1692 return IXGBE_ERR_CONFIG;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1693 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1694
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1695 /*
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1696 * Program the relevant mask registers. If src/dst_port or src/dst_addr
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1697 * are zero, then assume a full mask for that field. Also assume that
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1698 * a VLAN of 0 is unspecified, so mask that out as well. L4type
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1699 * cannot be masked out in this implementation.
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1700 *
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1701 * This also assumes IPv4 only. IPv6 masking isn't supported at this
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1702 * point in time.
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1703 */
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1704
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1705 /* Program FDIRM */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1706 switch (IXGBE_NTOHS(input_masks->vlan_id_mask) & 0xEFFF) {
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1707 case 0xEFFF:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1708 /* Unmask VLAN ID - bit 0 and fall through to unmask prio */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1709 fdirm &= ~IXGBE_FDIRM_VLANID;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1710 /* FALLTHRU */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1711 case 0xE000:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1712 /* Unmask VLAN prio - bit 1 */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1713 fdirm &= ~IXGBE_FDIRM_VLANP;
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1714 break;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1715 case 0x0FFF:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1716 /* Unmask VLAN ID - bit 0 */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1717 fdirm &= ~IXGBE_FDIRM_VLANID;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1718 break;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1719 case 0x0000:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1720 /* do nothing, vlans already masked */
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1721 break;
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1722 default:
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1723 DEBUGOUT(" Error on VLAN mask\n");
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1724 return IXGBE_ERR_CONFIG;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1725 }
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1726
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1727 if (input_masks->flex_mask & 0xFFFF) {
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1728 if ((input_masks->flex_mask & 0xFFFF) != 0xFFFF) {
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1729 DEBUGOUT(" Error on flexible byte mask\n");
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1730 return IXGBE_ERR_CONFIG;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1731 }
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1732 /* Unmask Flex Bytes - bit 4 */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1733 fdirm &= ~IXGBE_FDIRM_FLEX;
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1734 }
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1735
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1736 /* Now mask VM pool and destination IPv6 - bits 5 and 2 */
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1737 IXGBE_WRITE_REG(hw, IXGBE_FDIRM, fdirm);
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1738
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1739 /* store the TCP/UDP port masks, bit reversed from port layout */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1740 fdirtcpm = ixgbe_get_fdirtcpm_82599(input_masks);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1741
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1742 /* write both the same so that UDP and TCP use the same mask */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1743 IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, ~fdirtcpm);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1744 IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, ~fdirtcpm);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1745
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1746 /* store source and destination IP masks (big-enian) */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1747 IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRSIP4M,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1748 ~input_masks->src_ip_mask[0]);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1749 IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRDIP4M,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1750 ~input_masks->dst_ip_mask[0]);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1751
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1752 /* Apply masks to input data */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1753 input->formatted.vlan_id &= input_masks->vlan_id_mask;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1754 input->formatted.flex_bytes &= input_masks->flex_mask;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1755 input->formatted.src_port &= input_masks->src_port_mask;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1756 input->formatted.dst_port &= input_masks->dst_port_mask;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1757 input->formatted.src_ip[0] &= input_masks->src_ip_mask[0];
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1758 input->formatted.dst_ip[0] &= input_masks->dst_ip_mask[0];
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1759
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1760 /* record vlan (little-endian) and flex_bytes(big-endian) */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1761 fdirvlan =
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1762 IXGBE_STORE_AS_BE16(IXGBE_NTOHS(input->formatted.flex_bytes));
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1763 fdirvlan <<= IXGBE_FDIRVLAN_FLEX_SHIFT;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1764 fdirvlan |= IXGBE_NTOHS(input->formatted.vlan_id);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1765 IXGBE_WRITE_REG(hw, IXGBE_FDIRVLAN, fdirvlan);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1766
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1767 /* record source and destination port (little-endian)*/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1768 fdirport = IXGBE_NTOHS(input->formatted.dst_port);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1769 fdirport <<= IXGBE_FDIRPORT_DESTINATION_SHIFT;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1770 fdirport |= IXGBE_NTOHS(input->formatted.src_port);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1771 IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1772
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1773 /* record the first 32 bits of the destination address (big-endian) */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1774 IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRIPDA, input->formatted.dst_ip[0]);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1775
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1776 /* record the source address (big-endian) */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1777 IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRIPSA, input->formatted.src_ip[0]);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1778
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1779 /* configure FDIRCMD register */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1780 fdircmd = IXGBE_FDIRCMD_CMD_ADD_FLOW | IXGBE_FDIRCMD_FILTER_UPDATE |
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1781 IXGBE_FDIRCMD_LAST | IXGBE_FDIRCMD_QUEUE_EN;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1782 fdircmd |= input->formatted.flow_type << IXGBE_FDIRCMD_FLOW_TYPE_SHIFT;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1783 fdircmd |= (u32)queue << IXGBE_FDIRCMD_RX_QUEUE_SHIFT;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1784
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1785 /* we only want the bucket hash so drop the upper 16 bits */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1786 fdirhash = ixgbe_atr_compute_hash_82599(input,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1787 IXGBE_ATR_BUCKET_HASH_KEY);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1788 fdirhash |= soft_id << IXGBE_FDIRHASH_SIG_SW_INDEX_SHIFT;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1789
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1790 IXGBE_WRITE_REG(hw, IXGBE_FDIRHASH, fdirhash);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1791 IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD, fdircmd);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1792
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1793 return IXGBE_SUCCESS;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1794 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1795
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1796 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1797 * ixgbe_read_analog_reg8_82599 - Reads 8 bit Omer analog register
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1798 * @hw: pointer to hardware structure
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1799 * @reg: analog register to read
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1800 * @val: read value
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1801 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1802 * Performs read operation to Omer analog register specified.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1803 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1804 s32 ixgbe_read_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 *val)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1805 {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1806 u32 core_ctl;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1807
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1808 DEBUGFUNC("ixgbe_read_analog_reg8_82599");
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1809
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1810 IXGBE_WRITE_REG(hw, IXGBE_CORECTL, IXGBE_CORECTL_WRITE_CMD |
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1811 (reg << 8));
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1812 IXGBE_WRITE_FLUSH(hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1813 usec_delay(10);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1814 core_ctl = IXGBE_READ_REG(hw, IXGBE_CORECTL);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1815 *val = (u8)core_ctl;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1816
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1817 return IXGBE_SUCCESS;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1818 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1819
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1820 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1821 * ixgbe_write_analog_reg8_82599 - Writes 8 bit Omer analog register
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1822 * @hw: pointer to hardware structure
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1823 * @reg: atlas register to write
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1824 * @val: value to write
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1825 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1826 * Performs write operation to Omer analog register specified.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1827 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1828 s32 ixgbe_write_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 val)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1829 {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1830 u32 core_ctl;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1831
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1832 DEBUGFUNC("ixgbe_write_analog_reg8_82599");
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1833
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1834 core_ctl = (reg << 8) | val;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1835 IXGBE_WRITE_REG(hw, IXGBE_CORECTL, core_ctl);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1836 IXGBE_WRITE_FLUSH(hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1837 usec_delay(10);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1838
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1839 return IXGBE_SUCCESS;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1840 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1841
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1842 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1843 * ixgbe_start_hw_rev_1_82599 - Prepare hardware for Tx/Rx
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1844 * @hw: pointer to hardware structure
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1845 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1846 * Starts the hardware using the generic start_hw function
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1847 * and the generation start_hw function.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1848 * Then performs revision-specific operations, if any.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1849 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1850 s32 ixgbe_start_hw_rev_1_82599(struct ixgbe_hw *hw)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1851 {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1852 s32 ret_val = IXGBE_SUCCESS;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1853
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1854 DEBUGFUNC("ixgbe_start_hw_rev_1__82599");
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1855
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1856 ret_val = ixgbe_start_hw_generic(hw);
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1857 if (ret_val != IXGBE_SUCCESS)
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1858 goto out;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1859
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1860 ret_val = ixgbe_start_hw_gen2(hw);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1861 if (ret_val != IXGBE_SUCCESS)
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1862 goto out;
12003
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
1863
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1864 /* We need to run link autotry after the driver loads */
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1865 hw->mac.autotry_restart = TRUE;
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1866
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1867 if (ret_val == IXGBE_SUCCESS)
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1868 ret_val = ixgbe_verify_fw_version_82599(hw);
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1869 out:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1870 return ret_val;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1871 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1872
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1873 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1874 * ixgbe_identify_phy_82599 - Get physical layer module
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1875 * @hw: pointer to hardware structure
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1876 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1877 * Determines the physical layer module found on the current adapter.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1878 * If PHY already detected, maintains current PHY type in hw struct,
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1879 * otherwise executes the PHY detection routine.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1880 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1881 s32 ixgbe_identify_phy_82599(struct ixgbe_hw *hw)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1882 {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1883 s32 status = IXGBE_ERR_PHY_ADDR_INVALID;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1884
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1885 DEBUGFUNC("ixgbe_identify_phy_82599");
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1886
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1887 /* Detect PHY if not unknown - returns success if already detected. */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1888 status = ixgbe_identify_phy_generic(hw);
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1889 if (status != IXGBE_SUCCESS) {
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1890 /* 82599 10GBASE-T requires an external PHY */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1891 if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_copper)
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1892 goto out;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1893 else
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1894 status = ixgbe_identify_sfp_module_generic(hw);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1895 }
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1896
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1897 /* Set PHY type none if no PHY detected */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1898 if (hw->phy.type == ixgbe_phy_unknown) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1899 hw->phy.type = ixgbe_phy_none;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1900 status = IXGBE_SUCCESS;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1901 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1902
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1903 /* Return error if SFP module has been detected but is not supported */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1904 if (hw->phy.type == ixgbe_phy_sfp_unsupported)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1905 status = IXGBE_ERR_SFP_NOT_SUPPORTED;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1906
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1907 out:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1908 return status;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1909 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1910
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1911 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1912 * ixgbe_get_supported_physical_layer_82599 - Returns physical layer type
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1913 * @hw: pointer to hardware structure
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1914 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1915 * Determines physical layer capabilities of the current configuration.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1916 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1917 u32 ixgbe_get_supported_physical_layer_82599(struct ixgbe_hw *hw)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1918 {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1919 u32 physical_layer = IXGBE_PHYSICAL_LAYER_UNKNOWN;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1920 u32 autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1921 u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1922 u32 pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1923 u32 pma_pmd_10g_parallel = autoc & IXGBE_AUTOC_10G_PMA_PMD_MASK;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1924 u32 pma_pmd_1g = autoc & IXGBE_AUTOC_1G_PMA_PMD_MASK;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1925 u16 ext_ability = 0;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1926 u8 comp_codes_10g = 0;
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1927 u8 comp_codes_1g = 0;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1928
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1929 DEBUGFUNC("ixgbe_get_support_physical_layer_82599");
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
1930
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1931 hw->phy.ops.identify(hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1932
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1933 switch (hw->phy.type) {
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1934 case ixgbe_phy_tn:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1935 case ixgbe_phy_aq:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1936 case ixgbe_phy_cu_unknown:
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1937 hw->phy.ops.read_reg(hw, IXGBE_MDIO_PHY_EXT_ABILITY,
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1938 IXGBE_MDIO_PMA_PMD_DEV_TYPE, &ext_ability);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1939 if (ext_ability & IXGBE_MDIO_PHY_10GBASET_ABILITY)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1940 physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_T;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1941 if (ext_ability & IXGBE_MDIO_PHY_1000BASET_ABILITY)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1942 physical_layer |= IXGBE_PHYSICAL_LAYER_1000BASE_T;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1943 if (ext_ability & IXGBE_MDIO_PHY_100BASETX_ABILITY)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1944 physical_layer |= IXGBE_PHYSICAL_LAYER_100BASE_TX;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1945 goto out;
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1946 default:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1947 break;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1948 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1949
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1950 switch (autoc & IXGBE_AUTOC_LMS_MASK) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1951 case IXGBE_AUTOC_LMS_1G_AN:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1952 case IXGBE_AUTOC_LMS_1G_LINK_NO_AN:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1953 if (pma_pmd_1g == IXGBE_AUTOC_1G_KX_BX) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1954 physical_layer = IXGBE_PHYSICAL_LAYER_1000BASE_KX |
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1955 IXGBE_PHYSICAL_LAYER_1000BASE_BX;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1956 goto out;
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1957 }
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1958 /* SFI mode so read SFP module */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1959 goto sfp_check;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1960 case IXGBE_AUTOC_LMS_10G_LINK_NO_AN:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1961 if (pma_pmd_10g_parallel == IXGBE_AUTOC_10G_CX4)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1962 physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_CX4;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1963 else if (pma_pmd_10g_parallel == IXGBE_AUTOC_10G_KX4)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1964 physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_KX4;
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1965 else if (pma_pmd_10g_parallel == IXGBE_AUTOC_10G_XAUI)
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
1966 physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_XAUI;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1967 goto out;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1968 case IXGBE_AUTOC_LMS_10G_SERIAL:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1969 if (pma_pmd_10g_serial == IXGBE_AUTOC2_10G_KR) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1970 physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_KR;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1971 goto out;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1972 } else if (pma_pmd_10g_serial == IXGBE_AUTOC2_10G_SFI)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1973 goto sfp_check;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1974 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1975 case IXGBE_AUTOC_LMS_KX4_KX_KR:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1976 case IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1977 if (autoc & IXGBE_AUTOC_KX_SUPP)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1978 physical_layer |= IXGBE_PHYSICAL_LAYER_1000BASE_KX;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1979 if (autoc & IXGBE_AUTOC_KX4_SUPP)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1980 physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_KX4;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1981 if (autoc & IXGBE_AUTOC_KR_SUPP)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1982 physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_KR;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1983 goto out;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1984 default:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1985 goto out;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1986 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1987
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1988 sfp_check:
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1989 /* SFP check must be done last since DA modules are sometimes used to
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1990 * test KR mode - we need to id KR mode correctly before SFP module.
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
1991 * Call identify_sfp because the pluggable module may have changed */
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1992 hw->phy.ops.identify_sfp(hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1993 if (hw->phy.sfp_type == ixgbe_sfp_type_not_present)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1994 goto out;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1995
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1996 switch (hw->phy.type) {
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1997 case ixgbe_phy_sfp_passive_tyco:
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
1998 case ixgbe_phy_sfp_passive_unknown:
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
1999 physical_layer = IXGBE_PHYSICAL_LAYER_SFP_PLUS_CU;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2000 break;
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
2001 case ixgbe_phy_sfp_ftl_active:
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
2002 case ixgbe_phy_sfp_active_unknown:
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
2003 physical_layer = IXGBE_PHYSICAL_LAYER_SFP_ACTIVE_DA;
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
2004 break;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2005 case ixgbe_phy_sfp_avago:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2006 case ixgbe_phy_sfp_ftl:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2007 case ixgbe_phy_sfp_intel:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2008 case ixgbe_phy_sfp_unknown:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2009 hw->phy.ops.read_i2c_eeprom(hw,
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2010 IXGBE_SFF_1GBE_COMP_CODES, &comp_codes_1g);
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
2011 hw->phy.ops.read_i2c_eeprom(hw,
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2012 IXGBE_SFF_10GBE_COMP_CODES, &comp_codes_10g);
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2013 if (comp_codes_10g & IXGBE_SFF_10GBASESR_CAPABLE)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2014 physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_SR;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2015 else if (comp_codes_10g & IXGBE_SFF_10GBASELR_CAPABLE)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2016 physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_LR;
13018
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
2017 else if (comp_codes_1g & IXGBE_SFF_1GBASET_CAPABLE)
22e6d3edaab5 6964175 integration of Intel ixgbe shared code 3.5.13
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 12003
diff changeset
2018 physical_layer = IXGBE_PHYSICAL_LAYER_1000BASE_T;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2019 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2020 default:
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2021 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2022 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2023
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2024 out:
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2025 return physical_layer;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2026 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2027
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2028 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2029 * ixgbe_enable_rx_dma_82599 - Enable the Rx DMA unit on 82599
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2030 * @hw: pointer to hardware structure
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2031 * @regval: register value to write to RXCTRL
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2032 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2033 * Enables the Rx DMA unit for 82599
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2034 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2035 s32 ixgbe_enable_rx_dma_82599(struct ixgbe_hw *hw, u32 regval)
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2036 {
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2037 #define IXGBE_MAX_SECRX_POLL 30
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2038 int i;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2039 int secrxreg;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2040
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
2041 DEBUGFUNC("ixgbe_enable_rx_dma_82599");
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
2042
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2043 /*
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2044 * Workaround for 82599 silicon errata when enabling the Rx datapath.
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2045 * If traffic is incoming before we enable the Rx unit, it could hang
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2046 * the Rx DMA unit. Therefore, make sure the security engine is
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2047 * completely disabled prior to enabling the Rx unit.
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2048 */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2049 secrxreg = IXGBE_READ_REG(hw, IXGBE_SECRXCTRL);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2050 secrxreg |= IXGBE_SECRXCTRL_RX_DIS;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2051 IXGBE_WRITE_REG(hw, IXGBE_SECRXCTRL, secrxreg);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2052 for (i = 0; i < IXGBE_MAX_SECRX_POLL; i++) {
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2053 secrxreg = IXGBE_READ_REG(hw, IXGBE_SECRXSTAT);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2054 if (secrxreg & IXGBE_SECRXSTAT_SECRX_RDY)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2055 break;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2056 else
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2057 /* Use interrupt-safe sleep just in case */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2058 usec_delay(10);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2059 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2060
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2061 /* For informational purposes only */
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2062 if (i >= IXGBE_MAX_SECRX_POLL)
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2063 DEBUGOUT("Rx unit being enabled before security "
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2064 "path fully disabled. Continuing with init.\n");
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2065
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2066 IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, regval);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2067 secrxreg = IXGBE_READ_REG(hw, IXGBE_SECRXCTRL);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2068 secrxreg &= ~IXGBE_SECRXCTRL_RX_DIS;
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2069 IXGBE_WRITE_REG(hw, IXGBE_SECRXCTRL, secrxreg);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2070 IXGBE_WRITE_FLUSH(hw);
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2071
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2072 return IXGBE_SUCCESS;
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2073 }
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2074
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2075 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2076 * ixgbe_verify_fw_version_82599 - verify fw version for 82599
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2077 * @hw: pointer to hardware structure
9353
b9caf92a0042 6708311 ixgbe needs to support the new device Niantic
Bin Tu - Sun Microsystems - Beijing China <Samuel.Tu@Sun.COM>
parents:
diff changeset
2078 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2079 * Verifies that installed the firmware version is 0.6 or higher
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2080 * for SFI devices. All 82599 SFI devices should have version 0.6 or higher.
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2081 *
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2082 * Returns IXGBE_ERR_EEPROM_VERSION if the FW is not present or
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2083 * if the FW version is not supported.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2084 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2085 static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw)
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2086 {
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2087 s32 status = IXGBE_ERR_EEPROM_VERSION;
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2088 u16 fw_offset, fw_ptp_cfg_offset;
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2089 u16 fw_version = 0;
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2090
10998
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
2091 DEBUGFUNC("ixgbe_verify_fw_version_82599");
fa3b21f3b03c 6873301 ixgbe shared code update (version 3.1.9)
chenlu chen - Sun Microsystems - Beijing China <Chenlu.Chen@Sun.COM>
parents: 10305
diff changeset
2092
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2093 /* firmware check is only necessary for SFI devices */
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2094 if (hw->phy.media_type != ixgbe_media_type_fiber) {
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2095 status = IXGBE_SUCCESS;
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2096 goto fw_version_out;
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2097 }
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2098
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2099 /* get the offset to the Firmware Module block */
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2100 hw->eeprom.ops.read(hw, IXGBE_FW_PTR, &fw_offset);
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2101
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2102 if ((fw_offset == 0) || (fw_offset == 0xFFFF))
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2103 goto fw_version_out;
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2104
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2105 /* get the offset to the Pass Through Patch Configuration block */
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2106 hw->eeprom.ops.read(hw, (fw_offset +
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2107 IXGBE_FW_PASSTHROUGH_PATCH_CONFIG_PTR),
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2108 &fw_ptp_cfg_offset);
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2109
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2110 if ((fw_ptp_cfg_offset == 0) || (fw_ptp_cfg_offset == 0xFFFF))
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2111 goto fw_version_out;
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2112
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2113 /* get the firmware version */
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2114 hw->eeprom.ops.read(hw, (fw_ptp_cfg_offset +
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2115 IXGBE_FW_PATCH_VERSION_4),
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2116 &fw_version);
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2117
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2118 if (fw_version > 0x5)
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2119 status = IXGBE_SUCCESS;
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2120
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2121 fw_version_out:
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2122 return status;
10305
f6df05de8700 6848306 ixgbe need to update the latest shared code (2.9.1.1) from Intel
Paul Guo <Paul.Guo@Sun.COM>
parents: 9353
diff changeset
2123 }
12003
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
2124
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2125 /**
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2126 * ixgbe_verify_lesm_fw_enabled_82599 - Checks LESM FW module state.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2127 * @hw: pointer to hardware structure
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2128 *
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2129 * Returns TRUE if the LESM FW module is present and enabled. Otherwise
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2130 * returns FALSE. Smart Speed must be disabled if LESM FW module is enabled.
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2131 **/
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2132 bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw)
12003
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
2133 {
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2134 bool lesm_enabled = FALSE;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2135 u16 fw_offset, fw_lesm_param_offset, fw_lesm_state;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2136 s32 status;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2137
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2138 DEBUGFUNC("ixgbe_verify_lesm_fw_enabled_82599");
12003
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
2139
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2140 /* get the offset to the Firmware Module block */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2141 status = hw->eeprom.ops.read(hw, IXGBE_FW_PTR, &fw_offset);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2142
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2143 if ((status != IXGBE_SUCCESS) ||
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2144 (fw_offset == 0) || (fw_offset == 0xFFFF))
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2145 goto out;
12003
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
2146
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2147 /* get the offset to the LESM Parameters block */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2148 status = hw->eeprom.ops.read(hw, (fw_offset +
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2149 IXGBE_FW_LESM_PARAMETERS_PTR),
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2150 &fw_lesm_param_offset);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2151
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2152 if ((status != IXGBE_SUCCESS) ||
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2153 (fw_lesm_param_offset == 0) || (fw_lesm_param_offset == 0xFFFF))
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2154 goto out;
12003
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
2155
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2156 /* get the lesm state word */
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2157 status = hw->eeprom.ops.read(hw, (fw_lesm_param_offset +
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2158 IXGBE_FW_LESM_STATE_1),
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2159 &fw_lesm_state);
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2160
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2161 if ((status == IXGBE_SUCCESS) &&
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2162 (fw_lesm_state & IXGBE_FW_LESM_STATE_ENABLED))
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2163 lesm_enabled = TRUE;
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2164
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2165 out:
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2166 return lesm_enabled;
12003
f4f295b632a5 6918426 ixgbe spams system log with function messages
Paul Guo <Paul.Guo@Sun.COM>
parents: 10998
diff changeset
2167 }
13448
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2168
f03238cace0b 1390 ixgbe update from FreeBSD via Joyent
Jerry Jelinek <jerry.jelinek@joyent.com>
parents: 13018
diff changeset
2169