Skip to content

Commit 4600cdf

Browse files
pkwapulianguy11
authored andcommitted
ixgbe: Enable link management in E610 device
Add high level link management support for E610 device. Enable the following features: - driver load - bring up network interface - IP address assignment - pass traffic - show statistics (e.g. via ethtool) - disable network interface - driver unload Co-developed-by: Carolyn Wyborny <[email protected]> Signed-off-by: Carolyn Wyborny <[email protected]> Co-developed-by: Jedrzej Jagielski <[email protected]> Signed-off-by: Jedrzej Jagielski <[email protected]> Reviewed-by: Jan Glaza <[email protected]> Reviewed-by: Simon Horman <[email protected]> Tested-by: Bharath R <[email protected]> Signed-off-by: Piotr Kwapulinski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 34b4157 commit 4600cdf

File tree

14 files changed

+659
-30
lines changed

14 files changed

+659
-30
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* SPDX-License-Identifier: GPL-2.0 */
2-
/* Copyright(c) 1999 - 2018 Intel Corporation. */
2+
/* Copyright(c) 1999 - 2024 Intel Corporation. */
33

44
#ifndef _IXGBE_H_
55
#define _IXGBE_H_
@@ -20,6 +20,7 @@
2020
#include "ixgbe_type.h"
2121
#include "ixgbe_common.h"
2222
#include "ixgbe_dcb.h"
23+
#include "ixgbe_e610.h"
2324
#if IS_ENABLED(CONFIG_FCOE)
2425
#define IXGBE_FCOE
2526
#include "ixgbe_fcoe.h"
@@ -173,6 +174,7 @@ enum ixgbe_tx_flags {
173174
#define VMDQ_P(p) ((p) + adapter->ring_feature[RING_F_VMDQ].offset)
174175
#define IXGBE_82599_VF_DEVICE_ID 0x10ED
175176
#define IXGBE_X540_VF_DEVICE_ID 0x1515
177+
#define IXGBE_E610_VF_DEVICE_ID 0x57AD
176178

177179
#define UPDATE_VF_COUNTER_32bit(reg, last_counter, counter) \
178180
{ \
@@ -654,13 +656,17 @@ struct ixgbe_adapter {
654656
#define IXGBE_FLAG2_RSS_FIELD_IPV6_UDP BIT(9)
655657
#define IXGBE_FLAG2_PTP_PPS_ENABLED BIT(10)
656658
#define IXGBE_FLAG2_PHY_INTERRUPT BIT(11)
659+
#define IXGBE_FLAG2_FW_ASYNC_EVENT BIT(12)
657660
#define IXGBE_FLAG2_VLAN_PROMISC BIT(13)
658661
#define IXGBE_FLAG2_EEE_CAPABLE BIT(14)
659662
#define IXGBE_FLAG2_EEE_ENABLED BIT(15)
660663
#define IXGBE_FLAG2_RX_LEGACY BIT(16)
661664
#define IXGBE_FLAG2_IPSEC_ENABLED BIT(17)
662665
#define IXGBE_FLAG2_VF_IPSEC_ENABLED BIT(18)
663666
#define IXGBE_FLAG2_AUTO_DISABLE_VF BIT(19)
667+
#define IXGBE_FLAG2_PHY_FW_LOAD_FAILED BIT(20)
668+
#define IXGBE_FLAG2_NO_MEDIA BIT(21)
669+
#define IXGBE_FLAG2_MOD_POWER_UNSUPPORTED BIT(22)
664670

665671
/* Tx fast path data */
666672
int num_tx_queues;
@@ -793,6 +799,7 @@ struct ixgbe_adapter {
793799
u32 vferr_refcount;
794800
struct ixgbe_mac_addr *mac_table;
795801
struct kobject *info_kobj;
802+
u16 lse_mask;
796803
#ifdef CONFIG_IXGBE_HWMON
797804
struct hwmon_buff *ixgbe_hwmon_buff;
798805
#endif /* CONFIG_IXGBE_HWMON */
@@ -849,6 +856,7 @@ static inline u8 ixgbe_max_rss_indices(struct ixgbe_adapter *adapter)
849856
case ixgbe_mac_X550:
850857
case ixgbe_mac_X550EM_x:
851858
case ixgbe_mac_x550em_a:
859+
case ixgbe_mac_e610:
852860
return IXGBE_MAX_RSS_INDICES_X550;
853861
default:
854862
return 0;
@@ -874,6 +882,7 @@ enum ixgbe_state_t {
874882
__IXGBE_PTP_RUNNING,
875883
__IXGBE_PTP_TX_IN_PROGRESS,
876884
__IXGBE_RESET_REQUESTED,
885+
__IXGBE_PHY_INIT_COMPLETE,
877886
};
878887

879888
struct ixgbe_cb {
@@ -896,6 +905,7 @@ enum ixgbe_boards {
896905
board_x550em_x_fw,
897906
board_x550em_a,
898907
board_x550em_a_fw,
908+
board_e610,
899909
};
900910

901911
extern const struct ixgbe_info ixgbe_82598_info;
@@ -906,6 +916,7 @@ extern const struct ixgbe_info ixgbe_X550EM_x_info;
906916
extern const struct ixgbe_info ixgbe_x550em_x_fw_info;
907917
extern const struct ixgbe_info ixgbe_x550em_a_info;
908918
extern const struct ixgbe_info ixgbe_x550em_a_fw_info;
919+
extern const struct ixgbe_info ixgbe_e610_info;
909920
#ifdef CONFIG_IXGBE_DCB
910921
extern const struct dcbnl_rtnl_ops ixgbe_dcbnl_ops;
911922
#endif

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0
2-
/* Copyright(c) 1999 - 2018 Intel Corporation. */
2+
/* Copyright(c) 1999 - 2024 Intel Corporation. */
33

44
#include <linux/pci.h>
55
#include <linux/delay.h>
@@ -1615,6 +1615,7 @@ int ixgbe_fdir_set_input_mask_82599(struct ixgbe_hw *hw,
16151615
case ixgbe_mac_X550:
16161616
case ixgbe_mac_X550EM_x:
16171617
case ixgbe_mac_x550em_a:
1618+
case ixgbe_mac_e610:
16181619
IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, ~fdirtcpm);
16191620
break;
16201621
default:

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

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0
2-
/* Copyright(c) 1999 - 2018 Intel Corporation. */
2+
/* Copyright(c) 1999 - 2024 Intel Corporation. */
33

44
#include <linux/pci.h>
55
#include <linux/delay.h>
@@ -58,6 +58,7 @@ bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw)
5858
switch (hw->device_id) {
5959
case IXGBE_DEV_ID_X550EM_A_SFP:
6060
case IXGBE_DEV_ID_X550EM_A_SFP_N:
61+
case IXGBE_DEV_ID_E610_SFP:
6162
supported = false;
6263
break;
6364
default:
@@ -88,6 +89,8 @@ bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw)
8889
case IXGBE_DEV_ID_X550EM_A_10G_T:
8990
case IXGBE_DEV_ID_X550EM_A_1G_T:
9091
case IXGBE_DEV_ID_X550EM_A_1G_T_L:
92+
case IXGBE_DEV_ID_E610_10G_T:
93+
case IXGBE_DEV_ID_E610_2_5G_T:
9194
supported = true;
9295
break;
9396
default:
@@ -469,9 +472,14 @@ int ixgbe_clear_hw_cntrs_generic(struct ixgbe_hw *hw)
469472
}
470473
}
471474

472-
if (hw->mac.type == ixgbe_mac_X550 || hw->mac.type == ixgbe_mac_X540) {
475+
if (hw->mac.type == ixgbe_mac_X550 ||
476+
hw->mac.type == ixgbe_mac_X540 ||
477+
hw->mac.type == ixgbe_mac_e610) {
473478
if (hw->phy.id == 0)
474479
hw->phy.ops.identify(hw);
480+
}
481+
482+
if (hw->mac.type == ixgbe_mac_X550 || hw->mac.type == ixgbe_mac_X540) {
475483
hw->phy.ops.read_reg(hw, IXGBE_PCRC8ECL, MDIO_MMD_PCS, &i);
476484
hw->phy.ops.read_reg(hw, IXGBE_PCRC8ECH, MDIO_MMD_PCS, &i);
477485
hw->phy.ops.read_reg(hw, IXGBE_LDPCECL, MDIO_MMD_PCS, &i);
@@ -2922,6 +2930,10 @@ u16 ixgbe_get_pcie_msix_count_generic(struct ixgbe_hw *hw)
29222930
pcie_offset = IXGBE_PCIE_MSIX_82599_CAPS;
29232931
max_msix_count = IXGBE_MAX_MSIX_VECTORS_82599;
29242932
break;
2933+
case ixgbe_mac_e610:
2934+
pcie_offset = IXGBE_PCIE_MSIX_E610_CAPS;
2935+
max_msix_count = IXGBE_MAX_MSIX_VECTORS_82599;
2936+
break;
29252937
default:
29262938
return 1;
29272939
}
@@ -3370,7 +3382,8 @@ int ixgbe_check_mac_link_generic(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
33703382
*speed = IXGBE_LINK_SPEED_1GB_FULL;
33713383
break;
33723384
case IXGBE_LINKS_SPEED_100_82599:
3373-
if ((hw->mac.type >= ixgbe_mac_X550) &&
3385+
if ((hw->mac.type >= ixgbe_mac_X550 ||
3386+
hw->mac.type == ixgbe_mac_e610) &&
33743387
(links_reg & IXGBE_LINKS_SPEED_NON_STD))
33753388
*speed = IXGBE_LINK_SPEED_5GB_FULL;
33763389
else

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0
2-
/* Copyright(c) 1999 - 2018 Intel Corporation. */
2+
/* Copyright(c) 1999 - 2024 Intel Corporation. */
33

44
#include "ixgbe.h"
55
#include <linux/dcbnl.h>
@@ -154,6 +154,7 @@ static void ixgbe_dcbnl_get_perm_hw_addr(struct net_device *netdev,
154154
case ixgbe_mac_82599EB:
155155
case ixgbe_mac_X540:
156156
case ixgbe_mac_X550:
157+
case ixgbe_mac_e610:
157158
for (j = 0; j < netdev->addr_len; j++, i++)
158159
perm_addr[i] = adapter->hw.mac.san_addr[j];
159160
break;

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

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33

44
#include "ixgbe_common.h"
55
#include "ixgbe_e610.h"
6+
#include "ixgbe_x550.h"
67
#include "ixgbe_type.h"
78
#include "ixgbe_x540.h"
9+
#include "ixgbe_mbx.h"
810
#include "ixgbe_phy.h"
911

1012
/**
@@ -2491,3 +2493,166 @@ int ixgbe_validate_eeprom_checksum_e610(struct ixgbe_hw *hw, u16 *checksum_val)
24912493

24922494
return err;
24932495
}
2496+
2497+
/**
2498+
* ixgbe_reset_hw_e610 - Perform hardware reset
2499+
* @hw: pointer to hardware structure
2500+
*
2501+
* Resets the hardware by resetting the transmit and receive units, masks
2502+
* and clears all interrupts, and performs a reset.
2503+
*
2504+
* Return: the exit code of the operation.
2505+
*/
2506+
int ixgbe_reset_hw_e610(struct ixgbe_hw *hw)
2507+
{
2508+
u32 swfw_mask = hw->phy.phy_semaphore_mask;
2509+
u32 ctrl, i;
2510+
int err;
2511+
2512+
/* Call adapter stop to disable tx/rx and clear interrupts */
2513+
err = hw->mac.ops.stop_adapter(hw);
2514+
if (err)
2515+
goto reset_hw_out;
2516+
2517+
/* Flush pending Tx transactions. */
2518+
ixgbe_clear_tx_pending(hw);
2519+
2520+
hw->phy.ops.init(hw);
2521+
mac_reset_top:
2522+
err = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask);
2523+
if (err)
2524+
return -EBUSY;
2525+
ctrl = IXGBE_CTRL_RST;
2526+
ctrl |= IXGBE_READ_REG(hw, IXGBE_CTRL);
2527+
IXGBE_WRITE_REG(hw, IXGBE_CTRL, ctrl);
2528+
IXGBE_WRITE_FLUSH(hw);
2529+
hw->mac.ops.release_swfw_sync(hw, swfw_mask);
2530+
2531+
/* Poll for reset bit to self-clear indicating reset is complete */
2532+
for (i = 0; i < 10; i++) {
2533+
udelay(1);
2534+
ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL);
2535+
if (!(ctrl & IXGBE_CTRL_RST_MASK))
2536+
break;
2537+
}
2538+
2539+
if (ctrl & IXGBE_CTRL_RST_MASK) {
2540+
struct ixgbe_adapter *adapter = container_of(hw, struct ixgbe_adapter,
2541+
hw);
2542+
2543+
err = -EIO;
2544+
netdev_err(adapter->netdev, "Reset polling failed to complete.");
2545+
}
2546+
2547+
/* Double resets are required for recovery from certain error
2548+
* conditions. Between resets, it is necessary to stall to allow time
2549+
* for any pending HW events to complete.
2550+
*/
2551+
msleep(100);
2552+
if (hw->mac.flags & IXGBE_FLAGS_DOUBLE_RESET_REQUIRED) {
2553+
hw->mac.flags &= ~IXGBE_FLAGS_DOUBLE_RESET_REQUIRED;
2554+
goto mac_reset_top;
2555+
}
2556+
2557+
/* Set the Rx packet buffer size. */
2558+
IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(0), GENMASK(18, 17));
2559+
2560+
/* Store the permanent mac address */
2561+
hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr);
2562+
2563+
/* Maximum number of Receive Address Registers. */
2564+
#define IXGBE_MAX_NUM_RAR 128
2565+
2566+
/* Store MAC address from RAR0, clear receive address registers, and
2567+
* clear the multicast table. Also reset num_rar_entries to the
2568+
* maximum number of Receive Address Registers, since we modify this
2569+
* value when programming the SAN MAC address.
2570+
*/
2571+
hw->mac.num_rar_entries = IXGBE_MAX_NUM_RAR;
2572+
hw->mac.ops.init_rx_addrs(hw);
2573+
2574+
/* Initialize bus function number */
2575+
hw->mac.ops.set_lan_id(hw);
2576+
2577+
reset_hw_out:
2578+
return err;
2579+
}
2580+
2581+
static const struct ixgbe_mac_operations mac_ops_e610 = {
2582+
.init_hw = ixgbe_init_hw_generic,
2583+
.start_hw = ixgbe_start_hw_X540,
2584+
.clear_hw_cntrs = ixgbe_clear_hw_cntrs_generic,
2585+
.enable_rx_dma = ixgbe_enable_rx_dma_generic,
2586+
.get_mac_addr = ixgbe_get_mac_addr_generic,
2587+
.get_device_caps = ixgbe_get_device_caps_generic,
2588+
.stop_adapter = ixgbe_stop_adapter_generic,
2589+
.set_lan_id = ixgbe_set_lan_id_multi_port_pcie,
2590+
.set_rxpba = ixgbe_set_rxpba_generic,
2591+
.check_link = ixgbe_check_link_e610,
2592+
.blink_led_start = ixgbe_blink_led_start_X540,
2593+
.blink_led_stop = ixgbe_blink_led_stop_X540,
2594+
.set_rar = ixgbe_set_rar_generic,
2595+
.clear_rar = ixgbe_clear_rar_generic,
2596+
.set_vmdq = ixgbe_set_vmdq_generic,
2597+
.set_vmdq_san_mac = ixgbe_set_vmdq_san_mac_generic,
2598+
.clear_vmdq = ixgbe_clear_vmdq_generic,
2599+
.init_rx_addrs = ixgbe_init_rx_addrs_generic,
2600+
.update_mc_addr_list = ixgbe_update_mc_addr_list_generic,
2601+
.enable_mc = ixgbe_enable_mc_generic,
2602+
.disable_mc = ixgbe_disable_mc_generic,
2603+
.clear_vfta = ixgbe_clear_vfta_generic,
2604+
.set_vfta = ixgbe_set_vfta_generic,
2605+
.fc_enable = ixgbe_fc_enable_generic,
2606+
.set_fw_drv_ver = ixgbe_set_fw_drv_ver_x550,
2607+
.init_uta_tables = ixgbe_init_uta_tables_generic,
2608+
.set_mac_anti_spoofing = ixgbe_set_mac_anti_spoofing,
2609+
.set_vlan_anti_spoofing = ixgbe_set_vlan_anti_spoofing,
2610+
.set_source_address_pruning =
2611+
ixgbe_set_source_address_pruning_x550,
2612+
.set_ethertype_anti_spoofing =
2613+
ixgbe_set_ethertype_anti_spoofing_x550,
2614+
.disable_rx_buff = ixgbe_disable_rx_buff_generic,
2615+
.enable_rx_buff = ixgbe_enable_rx_buff_generic,
2616+
.enable_rx = ixgbe_enable_rx_generic,
2617+
.disable_rx = ixgbe_disable_rx_e610,
2618+
.led_on = ixgbe_led_on_generic,
2619+
.led_off = ixgbe_led_off_generic,
2620+
.init_led_link_act = ixgbe_init_led_link_act_generic,
2621+
.reset_hw = ixgbe_reset_hw_e610,
2622+
.get_media_type = ixgbe_get_media_type_e610,
2623+
.setup_link = ixgbe_setup_link_e610,
2624+
.get_link_capabilities = ixgbe_get_link_capabilities_e610,
2625+
.get_bus_info = ixgbe_get_bus_info_generic,
2626+
.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X540,
2627+
.release_swfw_sync = ixgbe_release_swfw_sync_X540,
2628+
.init_swfw_sync = ixgbe_init_swfw_sync_X540,
2629+
.prot_autoc_read = prot_autoc_read_generic,
2630+
.prot_autoc_write = prot_autoc_write_generic,
2631+
.setup_fc = ixgbe_setup_fc_e610,
2632+
.fc_autoneg = ixgbe_fc_autoneg_e610,
2633+
};
2634+
2635+
static const struct ixgbe_phy_operations phy_ops_e610 = {
2636+
.init = ixgbe_init_phy_ops_e610,
2637+
.identify = ixgbe_identify_phy_e610,
2638+
.identify_sfp = ixgbe_identify_module_e610,
2639+
.setup_link_speed = ixgbe_setup_phy_link_speed_generic,
2640+
.setup_link = ixgbe_setup_phy_link_e610,
2641+
.enter_lplu = ixgbe_enter_lplu_e610,
2642+
};
2643+
2644+
static const struct ixgbe_eeprom_operations eeprom_ops_e610 = {
2645+
.read = ixgbe_read_ee_aci_e610,
2646+
.read_buffer = ixgbe_read_ee_aci_buffer_e610,
2647+
.validate_checksum = ixgbe_validate_eeprom_checksum_e610,
2648+
};
2649+
2650+
const struct ixgbe_info ixgbe_e610_info = {
2651+
.mac = ixgbe_mac_e610,
2652+
.get_invariants = ixgbe_get_invariants_X540,
2653+
.mac_ops = &mac_ops_e610,
2654+
.eeprom_ops = &eeprom_ops_e610,
2655+
.phy_ops = &phy_ops_e610,
2656+
.mbx_ops = &mbx_ops_generic,
2657+
.mvals = ixgbe_mvals_x550em_a,
2658+
};

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,6 @@ int ixgbe_read_ee_aci_e610(struct ixgbe_hw *hw, u16 offset, u16 *data);
7676
int ixgbe_read_ee_aci_buffer_e610(struct ixgbe_hw *hw, u16 offset,
7777
u16 words, u16 *data);
7878
int ixgbe_validate_eeprom_checksum_e610(struct ixgbe_hw *hw, u16 *checksum_val);
79+
int ixgbe_reset_hw_e610(struct ixgbe_hw *hw);
7980

8081
#endif /* _IXGBE_E610_H_ */

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0
2-
/* Copyright(c) 1999 - 2018 Intel Corporation. */
2+
/* Copyright(c) 1999 - 2024 Intel Corporation. */
33

44
/* ethtool support for ixgbe */
55

@@ -690,6 +690,7 @@ static void ixgbe_get_regs(struct net_device *netdev,
690690
case ixgbe_mac_X550:
691691
case ixgbe_mac_X550EM_x:
692692
case ixgbe_mac_x550em_a:
693+
case ixgbe_mac_e610:
693694
regs_buff[35 + i] = IXGBE_READ_REG(hw, IXGBE_FCRTL_82599(i));
694695
regs_buff[43 + i] = IXGBE_READ_REG(hw, IXGBE_FCRTH_82599(i));
695696
break;
@@ -1613,6 +1614,7 @@ static int ixgbe_reg_test(struct ixgbe_adapter *adapter, u64 *data)
16131614
case ixgbe_mac_X550:
16141615
case ixgbe_mac_X550EM_x:
16151616
case ixgbe_mac_x550em_a:
1617+
case ixgbe_mac_e610:
16161618
toggle = 0x7FFFF30F;
16171619
test = reg_test_82599;
16181620
break;
@@ -1874,6 +1876,7 @@ static int ixgbe_setup_desc_rings(struct ixgbe_adapter *adapter)
18741876
case ixgbe_mac_X550:
18751877
case ixgbe_mac_X550EM_x:
18761878
case ixgbe_mac_x550em_a:
1879+
case ixgbe_mac_e610:
18771880
reg_data = IXGBE_READ_REG(&adapter->hw, IXGBE_DMATXCTL);
18781881
reg_data |= IXGBE_DMATXCTL_TE;
18791882
IXGBE_WRITE_REG(&adapter->hw, IXGBE_DMATXCTL, reg_data);
@@ -1935,6 +1938,7 @@ static int ixgbe_setup_loopback_test(struct ixgbe_adapter *adapter)
19351938
case ixgbe_mac_X550:
19361939
case ixgbe_mac_X550EM_x:
19371940
case ixgbe_mac_x550em_a:
1941+
case ixgbe_mac_e610:
19381942
reg_data = IXGBE_READ_REG(hw, IXGBE_MACC);
19391943
reg_data |= IXGBE_MACC_FLU;
19401944
IXGBE_WRITE_REG(hw, IXGBE_MACC, reg_data);

0 commit comments

Comments
 (0)