Skip to content

Commit

Permalink
Merge branch 'intel-wired-lan-driver-updates-for-2023-10-25-ice'
Browse files Browse the repository at this point in the history
Jacob Keller says:

====================
Intel Wired LAN Driver Updates for 2023-10-25 (ice)

This series extends the ice driver with basic support for the E830 device
line. It does not include support for all device features, but enables basic
functionality to load and pass traffic.

Alice adds the 200G speed and PHY types supported by E830 hardware.

Dan extends the DDP package logic to support the E830 package segment.

Paul adds the basic registers and macros used by E830 hardware, and adds
support for handling variable length link status information from firmware.

Pawel removes some redundant zeroing of the PCI IDs list, and extends the
list to include the E830 device IDs.
====================

Link: https://lore.kernel.org/r/20231025214157.1222758-1-jacob.e.keller@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed Oct 27, 2023
2 parents edd6815 + ba20ecb commit dbc0fd4
Show file tree
Hide file tree
Showing 12 changed files with 650 additions and 171 deletions.
48 changes: 43 additions & 5 deletions drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,15 @@ struct ice_aqc_get_phy_caps {
#define ICE_PHY_TYPE_HIGH_100G_CAUI2 BIT_ULL(2)
#define ICE_PHY_TYPE_HIGH_100G_AUI2_AOC_ACC BIT_ULL(3)
#define ICE_PHY_TYPE_HIGH_100G_AUI2 BIT_ULL(4)
#define ICE_PHY_TYPE_HIGH_MAX_INDEX 4
#define ICE_PHY_TYPE_HIGH_200G_CR4_PAM4 BIT_ULL(5)
#define ICE_PHY_TYPE_HIGH_200G_SR4 BIT_ULL(6)
#define ICE_PHY_TYPE_HIGH_200G_FR4 BIT_ULL(7)
#define ICE_PHY_TYPE_HIGH_200G_LR4 BIT_ULL(8)
#define ICE_PHY_TYPE_HIGH_200G_DR4 BIT_ULL(9)
#define ICE_PHY_TYPE_HIGH_200G_KR4_PAM4 BIT_ULL(10)
#define ICE_PHY_TYPE_HIGH_200G_AUI4_AOC_ACC BIT_ULL(11)
#define ICE_PHY_TYPE_HIGH_200G_AUI4 BIT_ULL(12)
#define ICE_PHY_TYPE_HIGH_MAX_INDEX 12

struct ice_aqc_get_phy_caps_data {
__le64 phy_type_low; /* Use values from ICE_PHY_TYPE_LOW_* */
Expand Down Expand Up @@ -1319,11 +1327,41 @@ struct ice_aqc_get_link_status_data {
#define ICE_AQ_LINK_SPEED_40GB BIT(8)
#define ICE_AQ_LINK_SPEED_50GB BIT(9)
#define ICE_AQ_LINK_SPEED_100GB BIT(10)
#define ICE_AQ_LINK_SPEED_200GB BIT(11)
#define ICE_AQ_LINK_SPEED_UNKNOWN BIT(15)
__le32 reserved3; /* Aligns next field to 8-byte boundary */
__le64 phy_type_low; /* Use values from ICE_PHY_TYPE_LOW_* */
__le64 phy_type_high; /* Use values from ICE_PHY_TYPE_HIGH_* */
};
/* Aligns next field to 8-byte boundary */
__le16 reserved3;
u8 ext_fec_status;
/* RS 272 FEC enabled */
#define ICE_AQ_LINK_RS_272_FEC_EN BIT(0)
u8 reserved4;
/* Use values from ICE_PHY_TYPE_LOW_* */
__le64 phy_type_low;
/* Use values from ICE_PHY_TYPE_HIGH_* */
__le64 phy_type_high;
#define ICE_AQC_LS_DATA_SIZE_V1 \
offsetofend(struct ice_aqc_get_link_status_data, phy_type_high)
/* Get link status v2 link partner data */
__le64 lp_phy_type_low;
__le64 lp_phy_type_high;
u8 lp_fec_adv;
#define ICE_AQ_LINK_LP_10G_KR_FEC_CAP BIT(0)
#define ICE_AQ_LINK_LP_25G_KR_FEC_CAP BIT(1)
#define ICE_AQ_LINK_LP_RS_528_FEC_CAP BIT(2)
#define ICE_AQ_LINK_LP_50G_KR_272_FEC_CAP BIT(3)
#define ICE_AQ_LINK_LP_100G_KR_272_FEC_CAP BIT(4)
#define ICE_AQ_LINK_LP_200G_KR_272_FEC_CAP BIT(5)
u8 lp_fec_req;
#define ICE_AQ_LINK_LP_10G_KR_FEC_REQ BIT(0)
#define ICE_AQ_LINK_LP_25G_KR_FEC_REQ BIT(1)
#define ICE_AQ_LINK_LP_RS_528_FEC_REQ BIT(2)
#define ICE_AQ_LINK_LP_KR_272_FEC_REQ BIT(3)
u8 lp_flowcontrol;
#define ICE_AQ_LINK_LP_PAUSE_ADV BIT(0)
#define ICE_AQ_LINK_LP_ASM_DIR_ADV BIT(1)
#define ICE_AQC_LS_DATA_SIZE_V2 \
offsetofend(struct ice_aqc_get_link_status_data, lp_flowcontrol)
} __packed;

/* Set event mask command (direct 0x0613) */
struct ice_aqc_set_event_mask {
Expand Down
94 changes: 68 additions & 26 deletions drivers/net/ethernet/intel/ice/ice_common.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2018, Intel Corporation. */
/* Copyright (c) 2018-2023, Intel Corporation. */

#include "ice_common.h"
#include "ice_sched.h"
Expand Down Expand Up @@ -154,6 +154,12 @@ static int ice_set_mac_type(struct ice_hw *hw)
case ICE_DEV_ID_E823L_SFP:
hw->mac_type = ICE_MAC_GENERIC;
break;
case ICE_DEV_ID_E830_BACKPLANE:
case ICE_DEV_ID_E830_QSFP56:
case ICE_DEV_ID_E830_SFP:
case ICE_DEV_ID_E830_SFP_DD:
hw->mac_type = ICE_MAC_E830;
break;
default:
hw->mac_type = ICE_MAC_UNKNOWN;
break;
Expand Down Expand Up @@ -645,6 +651,24 @@ static enum ice_media_type ice_get_media_type(struct ice_port_info *pi)
return ICE_MEDIA_UNKNOWN;
}

/**
* ice_get_link_status_datalen
* @hw: pointer to the HW struct
*
* Returns datalength for the Get Link Status AQ command, which is bigger for
* newer adapter families handled by ice driver.
*/
static u16 ice_get_link_status_datalen(struct ice_hw *hw)
{
switch (hw->mac_type) {
case ICE_MAC_E830:
return ICE_AQC_LS_DATA_SIZE_V2;
case ICE_MAC_E810:
default:
return ICE_AQC_LS_DATA_SIZE_V1;
}
}

/**
* ice_aq_get_link_info
* @pi: port information structure
Expand Down Expand Up @@ -683,8 +707,8 @@ ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse,
resp->cmd_flags = cpu_to_le16(cmd_flags);
resp->lport_num = pi->lport;

status = ice_aq_send_cmd(hw, &desc, &link_data, sizeof(link_data), cd);

status = ice_aq_send_cmd(hw, &desc, &link_data,
ice_get_link_status_datalen(hw), cd);
if (status)
return status;

Expand Down Expand Up @@ -759,8 +783,7 @@ static void
ice_fill_tx_timer_and_fc_thresh(struct ice_hw *hw,
struct ice_aqc_set_mac_cfg *cmd)
{
u16 fc_thres_val, tx_timer_val;
u32 val;
u32 val, fc_thres_m;

/* We read back the transmit timer and FC threshold value of
* LFC. Thus, we will use index =
Expand All @@ -769,19 +792,32 @@ ice_fill_tx_timer_and_fc_thresh(struct ice_hw *hw,
* Also, because we are operating on transmit timer and FC
* threshold of LFC, we don't turn on any bit in tx_tmr_priority
*/
#define IDX_OF_LFC PRTMAC_HSEC_CTL_TX_PAUSE_QUANTA_MAX_INDEX

/* Retrieve the transmit timer */
val = rd32(hw, PRTMAC_HSEC_CTL_TX_PAUSE_QUANTA(IDX_OF_LFC));
tx_timer_val = val &
PRTMAC_HSEC_CTL_TX_PAUSE_QUANTA_HSEC_CTL_TX_PAUSE_QUANTA_M;
cmd->tx_tmr_value = cpu_to_le16(tx_timer_val);

/* Retrieve the FC threshold */
val = rd32(hw, PRTMAC_HSEC_CTL_TX_PAUSE_REFRESH_TIMER(IDX_OF_LFC));
fc_thres_val = val & PRTMAC_HSEC_CTL_TX_PAUSE_REFRESH_TIMER_M;

cmd->fc_refresh_threshold = cpu_to_le16(fc_thres_val);
#define E800_IDX_OF_LFC E800_PRTMAC_HSEC_CTL_TX_PS_QNT_MAX
#define E800_REFRESH_TMR E800_PRTMAC_HSEC_CTL_TX_PS_RFSH_TMR

if (hw->mac_type == ICE_MAC_E830) {
/* Retrieve the transmit timer */
val = rd32(hw, E830_PRTMAC_CL01_PS_QNT);
cmd->tx_tmr_value =
le16_encode_bits(val, E830_PRTMAC_CL01_PS_QNT_CL0_M);

/* Retrieve the fc threshold */
val = rd32(hw, E830_PRTMAC_CL01_QNT_THR);
fc_thres_m = E830_PRTMAC_CL01_QNT_THR_CL0_M;
} else {
/* Retrieve the transmit timer */
val = rd32(hw,
E800_PRTMAC_HSEC_CTL_TX_PS_QNT(E800_IDX_OF_LFC));
cmd->tx_tmr_value =
le16_encode_bits(val,
E800_PRTMAC_HSEC_CTL_TX_PS_QNT_M);

/* Retrieve the fc threshold */
val = rd32(hw,
E800_REFRESH_TMR(E800_IDX_OF_LFC));
fc_thres_m = E800_PRTMAC_HSEC_CTL_TX_PS_RFSH_TMR_M;
}
cmd->fc_refresh_threshold = le16_encode_bits(val, fc_thres_m);
}

/**
Expand Down Expand Up @@ -2464,16 +2500,21 @@ ice_parse_1588_func_caps(struct ice_hw *hw, struct ice_hw_func_caps *func_p,
static void
ice_parse_fdir_func_caps(struct ice_hw *hw, struct ice_hw_func_caps *func_p)
{
u32 reg_val, val;
u32 reg_val, gsize, bsize;

reg_val = rd32(hw, GLQF_FD_SIZE);
val = (reg_val & GLQF_FD_SIZE_FD_GSIZE_M) >>
GLQF_FD_SIZE_FD_GSIZE_S;
func_p->fd_fltr_guar =
ice_get_num_per_func(hw, val);
val = (reg_val & GLQF_FD_SIZE_FD_BSIZE_M) >>
GLQF_FD_SIZE_FD_BSIZE_S;
func_p->fd_fltr_best_effort = val;
switch (hw->mac_type) {
case ICE_MAC_E830:
gsize = FIELD_GET(E830_GLQF_FD_SIZE_FD_GSIZE_M, reg_val);
bsize = FIELD_GET(E830_GLQF_FD_SIZE_FD_BSIZE_M, reg_val);
break;
case ICE_MAC_E810:
default:
gsize = FIELD_GET(E800_GLQF_FD_SIZE_FD_GSIZE_M, reg_val);
bsize = FIELD_GET(E800_GLQF_FD_SIZE_FD_BSIZE_M, reg_val);
}
func_p->fd_fltr_guar = ice_get_num_per_func(hw, gsize);
func_p->fd_fltr_best_effort = bsize;

ice_debug(hw, ICE_DBG_INIT, "func caps: fd_fltr_guar = %d\n",
func_p->fd_fltr_guar);
Expand Down Expand Up @@ -6069,6 +6110,7 @@ static const u32 ice_aq_to_link_speed[] = {
SPEED_40000,
SPEED_50000,
SPEED_100000, /* BIT(10) */
SPEED_200000,
};

/**
Expand Down
Loading

0 comments on commit dbc0fd4

Please sign in to comment.