Skip to content

Commit afdc71e

Browse files
mdrustadJeff Kirsher
authored andcommitted
ixgbe: Fix flow control for Xeon D KR backplane
Xeon D KR backplane is different from other backplanes, in that we can't use auto-negotiation to determine the mode. Instead, use whatever the user configured. Signed-off-by: Mark Rustad <[email protected]> Tested-by: Phil Schmitt <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent cb2b3ed commit afdc71e

File tree

7 files changed

+98
-7
lines changed

7 files changed

+98
-7
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,7 @@ static const struct ixgbe_mac_operations mac_ops_82598 = {
11921192
.clear_vfta = &ixgbe_clear_vfta_82598,
11931193
.set_vfta = &ixgbe_set_vfta_82598,
11941194
.fc_enable = &ixgbe_fc_enable_82598,
1195+
.setup_fc = ixgbe_setup_fc_generic,
11951196
.set_fw_drv_ver = NULL,
11961197
.acquire_swfw_sync = &ixgbe_acquire_swfw_sync,
11971198
.release_swfw_sync = &ixgbe_release_swfw_sync,

drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2220,6 +2220,7 @@ static const struct ixgbe_mac_operations mac_ops_82599 = {
22202220
.clear_vfta = &ixgbe_clear_vfta_generic,
22212221
.set_vfta = &ixgbe_set_vfta_generic,
22222222
.fc_enable = &ixgbe_fc_enable_generic,
2223+
.setup_fc = ixgbe_setup_fc_generic,
22232224
.set_fw_drv_ver = &ixgbe_set_fw_drv_ver_generic,
22242225
.init_uta_tables = &ixgbe_init_uta_tables_generic,
22252226
.setup_sfp = &ixgbe_setup_sfp_modules_82599,

drivers/net/ethernet/intel/ixgbe/ixgbe_common.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*******************************************************************************
22
33
Intel 10 Gigabit PCI Express Linux driver
4-
Copyright(c) 1999 - 2015 Intel Corporation.
4+
Copyright(c) 1999 - 2016 Intel Corporation.
55
66
This program is free software; you can redistribute it and/or modify it
77
under the terms and conditions of the GNU General Public License,
@@ -111,12 +111,12 @@ bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw)
111111
}
112112

113113
/**
114-
* ixgbe_setup_fc - Set up flow control
114+
* ixgbe_setup_fc_generic - Set up flow control
115115
* @hw: pointer to hardware structure
116116
*
117117
* Called at init time to set up flow control.
118118
**/
119-
static s32 ixgbe_setup_fc(struct ixgbe_hw *hw)
119+
s32 ixgbe_setup_fc_generic(struct ixgbe_hw *hw)
120120
{
121121
s32 ret_val = 0;
122122
u32 reg = 0, reg_bp = 0;
@@ -296,7 +296,7 @@ s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw)
296296
IXGBE_WRITE_FLUSH(hw);
297297

298298
/* Setup flow control */
299-
ret_val = ixgbe_setup_fc(hw);
299+
ret_val = hw->mac.ops.setup_fc(hw);
300300
if (ret_val)
301301
return ret_val;
302302

drivers/net/ethernet/intel/ixgbe/ixgbe_common.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*******************************************************************************
22
33
Intel 10 Gigabit PCI Express Linux driver
4-
Copyright(c) 1999 - 2014 Intel Corporation.
4+
Copyright(c) 1999 - 2016 Intel Corporation.
55
66
This program is free software; you can redistribute it and/or modify it
77
under the terms and conditions of the GNU General Public License,
@@ -81,6 +81,7 @@ s32 ixgbe_disable_rx_buff_generic(struct ixgbe_hw *hw);
8181
s32 ixgbe_enable_rx_buff_generic(struct ixgbe_hw *hw);
8282
s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval);
8383
s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw);
84+
s32 ixgbe_setup_fc_generic(struct ixgbe_hw *);
8485
bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw);
8586
void ixgbe_fc_autoneg(struct ixgbe_hw *hw);
8687

drivers/net/ethernet/intel/ixgbe/ixgbe_type.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3308,6 +3308,7 @@ struct ixgbe_mac_operations {
33083308

33093309
/* Flow Control */
33103310
s32 (*fc_enable)(struct ixgbe_hw *);
3311+
s32 (*setup_fc)(struct ixgbe_hw *);
33113312

33123313
/* Manageability interface */
33133314
s32 (*set_fw_drv_ver)(struct ixgbe_hw *, u8, u8, u8, u8);
@@ -3525,6 +3526,7 @@ struct ixgbe_info {
35253526

35263527
#define IXGBE_KRM_PORT_CAR_GEN_CTRL(P) ((P) ? 0x8010 : 0x4010)
35273528
#define IXGBE_KRM_LINK_CTRL_1(P) ((P) ? 0x820C : 0x420C)
3529+
#define IXGBE_KRM_AN_CNTL_1(P) ((P) ? 0x822C : 0x422C)
35283530
#define IXGBE_KRM_DSP_TXFFE_STATE_4(P) ((P) ? 0x8634 : 0x4634)
35293531
#define IXGBE_KRM_DSP_TXFFE_STATE_5(P) ((P) ? 0x8638 : 0x4638)
35303532
#define IXGBE_KRM_RX_TRN_LINKUP_CTRL(P) ((P) ? 0x8B00 : 0x4B00)
@@ -3547,6 +3549,9 @@ struct ixgbe_info {
35473549
#define IXGBE_KRM_LINK_CTRL_1_TETH_AN_ENABLE (1 << 29)
35483550
#define IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART (1 << 31)
35493551

3552+
#define IXGBE_KRM_AN_CNTL_1_SYM_PAUSE (1 << 28)
3553+
#define IXGBE_KRM_AN_CNTL_1_ASM_PAUSE (1 << 29)
3554+
35503555
#define IXGBE_KRM_DSP_TXFFE_STATE_C0_EN (1 << 6)
35513556
#define IXGBE_KRM_DSP_TXFFE_STATE_CP1_CN1_EN (1 << 15)
35523557
#define IXGBE_KRM_DSP_TXFFE_STATE_CO_ADAPT_EN (1 << 16)

drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,7 @@ static const struct ixgbe_mac_operations mac_ops_X540 = {
846846
.clear_vfta = &ixgbe_clear_vfta_generic,
847847
.set_vfta = &ixgbe_set_vfta_generic,
848848
.fc_enable = &ixgbe_fc_enable_generic,
849+
.setup_fc = ixgbe_setup_fc_generic,
849850
.set_fw_drv_ver = &ixgbe_set_fw_drv_ver_generic,
850851
.init_uta_tables = &ixgbe_init_uta_tables_generic,
851852
.setup_sfp = NULL,

drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c

Lines changed: 84 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "ixgbe_phy.h"
2828

2929
static s32 ixgbe_setup_kr_speed_x550em(struct ixgbe_hw *, ixgbe_link_speed);
30+
static s32 ixgbe_setup_fc_x550em(struct ixgbe_hw *);
3031

3132
static s32 ixgbe_get_invariants_X550_x(struct ixgbe_hw *hw)
3233
{
@@ -1342,15 +1343,18 @@ static void ixgbe_init_mac_link_ops_X550em(struct ixgbe_hw *hw)
13421343
mac->ops.enable_tx_laser = NULL;
13431344
mac->ops.flap_tx_laser = NULL;
13441345
mac->ops.setup_link = ixgbe_setup_mac_link_multispeed_fiber;
1346+
mac->ops.setup_fc = ixgbe_setup_fc_x550em;
13451347
mac->ops.setup_mac_link = ixgbe_setup_mac_link_sfp_x550em;
13461348
mac->ops.set_rate_select_speed =
13471349
ixgbe_set_soft_rate_select_speed;
13481350
break;
13491351
case ixgbe_media_type_copper:
13501352
mac->ops.setup_link = ixgbe_setup_mac_link_t_X550em;
1353+
mac->ops.setup_fc = ixgbe_setup_fc_generic;
13511354
mac->ops.check_link = ixgbe_check_link_t_X550em;
13521355
break;
13531356
default:
1357+
mac->ops.setup_fc = ixgbe_setup_fc_x550em;
13541358
break;
13551359
}
13561360
}
@@ -1842,6 +1846,82 @@ static s32 ixgbe_get_lcd_t_x550em(struct ixgbe_hw *hw,
18421846
return status;
18431847
}
18441848

1849+
/**
1850+
* ixgbe_setup_fc_x550em - Set up flow control
1851+
* @hw: pointer to hardware structure
1852+
*/
1853+
static s32 ixgbe_setup_fc_x550em(struct ixgbe_hw *hw)
1854+
{
1855+
bool pause, asm_dir;
1856+
u32 reg_val;
1857+
s32 rc;
1858+
1859+
/* Validate the requested mode */
1860+
if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) {
1861+
hw_err(hw, "ixgbe_fc_rx_pause not valid in strict IEEE mode\n");
1862+
return IXGBE_ERR_INVALID_LINK_SETTINGS;
1863+
}
1864+
1865+
/* 10gig parts do not have a word in the EEPROM to determine the
1866+
* default flow control setting, so we explicitly set it to full.
1867+
*/
1868+
if (hw->fc.requested_mode == ixgbe_fc_default)
1869+
hw->fc.requested_mode = ixgbe_fc_full;
1870+
1871+
/* Determine PAUSE and ASM_DIR bits. */
1872+
switch (hw->fc.requested_mode) {
1873+
case ixgbe_fc_none:
1874+
pause = false;
1875+
asm_dir = false;
1876+
break;
1877+
case ixgbe_fc_tx_pause:
1878+
pause = false;
1879+
asm_dir = true;
1880+
break;
1881+
case ixgbe_fc_rx_pause:
1882+
/* Rx Flow control is enabled and Tx Flow control is
1883+
* disabled by software override. Since there really
1884+
* isn't a way to advertise that we are capable of RX
1885+
* Pause ONLY, we will advertise that we support both
1886+
* symmetric and asymmetric Rx PAUSE, as such we fall
1887+
* through to the fc_full statement. Later, we will
1888+
* disable the adapter's ability to send PAUSE frames.
1889+
*/
1890+
/* Fallthrough */
1891+
case ixgbe_fc_full:
1892+
pause = true;
1893+
asm_dir = true;
1894+
break;
1895+
default:
1896+
hw_err(hw, "Flow control param set incorrectly\n");
1897+
return IXGBE_ERR_CONFIG;
1898+
}
1899+
1900+
if (hw->device_id != IXGBE_DEV_ID_X550EM_X_KR)
1901+
return 0;
1902+
1903+
rc = ixgbe_read_iosf_sb_reg_x550(hw,
1904+
IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
1905+
IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
1906+
if (rc)
1907+
return rc;
1908+
1909+
reg_val &= ~(IXGBE_KRM_AN_CNTL_1_SYM_PAUSE |
1910+
IXGBE_KRM_AN_CNTL_1_ASM_PAUSE);
1911+
if (pause)
1912+
reg_val |= IXGBE_KRM_AN_CNTL_1_SYM_PAUSE;
1913+
if (asm_dir)
1914+
reg_val |= IXGBE_KRM_AN_CNTL_1_ASM_PAUSE;
1915+
rc = ixgbe_write_iosf_sb_reg_x550(hw,
1916+
IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
1917+
IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
1918+
1919+
/* This device does not fully support AN. */
1920+
hw->fc.disable_fc_autoneg = true;
1921+
1922+
return rc;
1923+
}
1924+
18451925
/** ixgbe_enter_lplu_x550em - Transition to low power states
18461926
* @hw: pointer to hardware structure
18471927
*
@@ -2337,8 +2417,6 @@ static void ixgbe_release_swfw_sync_X550em(struct ixgbe_hw *hw, u32 mask)
23372417
.enable_rx_buff = &ixgbe_enable_rx_buff_generic, \
23382418
.get_thermal_sensor_data = NULL, \
23392419
.init_thermal_sensor_thresh = NULL, \
2340-
.prot_autoc_read = &prot_autoc_read_generic, \
2341-
.prot_autoc_write = &prot_autoc_write_generic, \
23422420
.enable_rx = &ixgbe_enable_rx_generic, \
23432421
.disable_rx = &ixgbe_disable_rx_x550, \
23442422

@@ -2354,6 +2432,9 @@ static const struct ixgbe_mac_operations mac_ops_X550 = {
23542432
.setup_sfp = NULL,
23552433
.acquire_swfw_sync = &ixgbe_acquire_swfw_sync_X540,
23562434
.release_swfw_sync = &ixgbe_release_swfw_sync_X540,
2435+
.prot_autoc_read = prot_autoc_read_generic,
2436+
.prot_autoc_write = prot_autoc_write_generic,
2437+
.setup_fc = ixgbe_setup_fc_generic,
23572438
};
23582439

23592440
static const struct ixgbe_mac_operations mac_ops_X550EM_x = {
@@ -2368,6 +2449,7 @@ static const struct ixgbe_mac_operations mac_ops_X550EM_x = {
23682449
.setup_sfp = ixgbe_setup_sfp_modules_X550em,
23692450
.acquire_swfw_sync = &ixgbe_acquire_swfw_sync_X550em,
23702451
.release_swfw_sync = &ixgbe_release_swfw_sync_X550em,
2452+
.setup_fc = NULL, /* defined later */
23712453
};
23722454

23732455
#define X550_COMMON_EEP \

0 commit comments

Comments
 (0)