Skip to content

Commit 4914a4f

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
Tony Nguyen says: ==================== 100GbE Intel Wired LAN Driver Updates 2021-04-08 This series contains updates to ice driver only. Chinh adds retrying of sending some AQ commands when receiving EBUSY error. Victor modifies how nodes are added to reduce stack usage. Ani renames some variables to either follow spec naming or to be inline with naming in the rest of the driver. Ignores EMODE error as there are cases where this error is expected. Performs some cleanup such as removing unnecessary checks, doing variable assignments over copies, and removing unneeded variables. Revises some error codes returned in link settings to be more appropriate. He also implements support for new firmware option to get default link configuration which accounts for any needed NVM based overrides for PHY configuration. He also removes the rx_gro_dropped stat as the value no longer changes. Jeb removes setting specific link modes on firmwares that no longer require it. Brett removes unnecessary checks when adding and removing VLANs. Tony fixes a checkpatch warning for unnecessary blank line. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 4667bf7 + 2e20521 commit 4914a4f

File tree

12 files changed

+391
-250
lines changed

12 files changed

+391
-250
lines changed

drivers/net/ethernet/intel/ice/ice.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ struct ice_vsi {
265265
u32 tx_busy;
266266
u32 rx_buf_failed;
267267
u32 rx_page_failed;
268-
u32 rx_gro_dropped;
269268
u16 num_q_vectors;
270269
u16 base_vector; /* IRQ base for OS reserved vectors */
271270
enum ice_vsi_type type;

drivers/net/ethernet/intel/ice/ice_adminq_cmd.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -877,16 +877,18 @@ struct ice_aqc_get_phy_caps {
877877
__le16 param0;
878878
/* 18.0 - Report qualified modules */
879879
#define ICE_AQC_GET_PHY_RQM BIT(0)
880-
/* 18.1 - 18.2 : Report mode
881-
* 00b - Report NVM capabilities
882-
* 01b - Report topology capabilities
883-
* 10b - Report SW configured
880+
/* 18.1 - 18.3 : Report mode
881+
* 000b - Report NVM capabilities
882+
* 001b - Report topology capabilities
883+
* 010b - Report SW configured
884+
* 100b - Report default capabilities
884885
*/
885-
#define ICE_AQC_REPORT_MODE_S 1
886-
#define ICE_AQC_REPORT_MODE_M (3 << ICE_AQC_REPORT_MODE_S)
887-
#define ICE_AQC_REPORT_NVM_CAP 0
888-
#define ICE_AQC_REPORT_TOPO_CAP BIT(1)
889-
#define ICE_AQC_REPORT_SW_CFG BIT(2)
886+
#define ICE_AQC_REPORT_MODE_S 1
887+
#define ICE_AQC_REPORT_MODE_M (7 << ICE_AQC_REPORT_MODE_S)
888+
#define ICE_AQC_REPORT_TOPO_CAP_NO_MEDIA 0
889+
#define ICE_AQC_REPORT_TOPO_CAP_MEDIA BIT(1)
890+
#define ICE_AQC_REPORT_ACTIVE_CFG BIT(2)
891+
#define ICE_AQC_REPORT_DFLT_CFG BIT(3)
890892
__le32 reserved1;
891893
__le32 addr_high;
892894
__le32 addr_low;

drivers/net/ethernet/intel/ice/ice_common.c

Lines changed: 119 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode,
158158
return ICE_ERR_PARAM;
159159
hw = pi->hw;
160160

161+
if (report_mode == ICE_AQC_REPORT_DFLT_CFG &&
162+
!ice_fw_supports_report_dflt_cfg(hw))
163+
return ICE_ERR_PARAM;
164+
161165
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_get_phy_caps);
162166

163167
if (qual_mods)
@@ -191,7 +195,7 @@ ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode,
191195
ice_debug(hw, ICE_DBG_LINK, " module_type[2] = 0x%x\n",
192196
pcaps->module_type[2]);
193197

194-
if (!status && report_mode == ICE_AQC_REPORT_TOPO_CAP) {
198+
if (!status && report_mode == ICE_AQC_REPORT_TOPO_CAP_MEDIA) {
195199
pi->phy.phy_type_low = le64_to_cpu(pcaps->phy_type_low);
196200
pi->phy.phy_type_high = le64_to_cpu(pcaps->phy_type_high);
197201
memcpy(pi->phy.link_info.module_type, &pcaps->module_type,
@@ -922,7 +926,8 @@ enum ice_status ice_init_hw(struct ice_hw *hw)
922926

923927
/* Initialize port_info struct with PHY capabilities */
924928
status = ice_aq_get_phy_caps(hw->port_info, false,
925-
ICE_AQC_REPORT_TOPO_CAP, pcaps, NULL);
929+
ICE_AQC_REPORT_TOPO_CAP_MEDIA, pcaps,
930+
NULL);
926931
devm_kfree(ice_hw_to_dev(hw), pcaps);
927932
if (status)
928933
dev_warn(ice_hw_to_dev(hw), "Get PHY capabilities failed status = %d, continuing anyway\n",
@@ -1292,6 +1297,85 @@ const struct ice_ctx_ele ice_tlan_ctx_info[] = {
12921297
*/
12931298
DEFINE_MUTEX(ice_global_cfg_lock_sw);
12941299

1300+
/**
1301+
* ice_should_retry_sq_send_cmd
1302+
* @opcode: AQ opcode
1303+
*
1304+
* Decide if we should retry the send command routine for the ATQ, depending
1305+
* on the opcode.
1306+
*/
1307+
static bool ice_should_retry_sq_send_cmd(u16 opcode)
1308+
{
1309+
switch (opcode) {
1310+
case ice_aqc_opc_get_link_topo:
1311+
case ice_aqc_opc_lldp_stop:
1312+
case ice_aqc_opc_lldp_start:
1313+
case ice_aqc_opc_lldp_filter_ctrl:
1314+
return true;
1315+
}
1316+
1317+
return false;
1318+
}
1319+
1320+
/**
1321+
* ice_sq_send_cmd_retry - send command to Control Queue (ATQ)
1322+
* @hw: pointer to the HW struct
1323+
* @cq: pointer to the specific Control queue
1324+
* @desc: prefilled descriptor describing the command
1325+
* @buf: buffer to use for indirect commands (or NULL for direct commands)
1326+
* @buf_size: size of buffer for indirect commands (or 0 for direct commands)
1327+
* @cd: pointer to command details structure
1328+
*
1329+
* Retry sending the FW Admin Queue command, multiple times, to the FW Admin
1330+
* Queue if the EBUSY AQ error is returned.
1331+
*/
1332+
static enum ice_status
1333+
ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq,
1334+
struct ice_aq_desc *desc, void *buf, u16 buf_size,
1335+
struct ice_sq_cd *cd)
1336+
{
1337+
struct ice_aq_desc desc_cpy;
1338+
enum ice_status status;
1339+
bool is_cmd_for_retry;
1340+
u8 *buf_cpy = NULL;
1341+
u8 idx = 0;
1342+
u16 opcode;
1343+
1344+
opcode = le16_to_cpu(desc->opcode);
1345+
is_cmd_for_retry = ice_should_retry_sq_send_cmd(opcode);
1346+
memset(&desc_cpy, 0, sizeof(desc_cpy));
1347+
1348+
if (is_cmd_for_retry) {
1349+
if (buf) {
1350+
buf_cpy = kzalloc(buf_size, GFP_KERNEL);
1351+
if (!buf_cpy)
1352+
return ICE_ERR_NO_MEMORY;
1353+
}
1354+
1355+
memcpy(&desc_cpy, desc, sizeof(desc_cpy));
1356+
}
1357+
1358+
do {
1359+
status = ice_sq_send_cmd(hw, cq, desc, buf, buf_size, cd);
1360+
1361+
if (!is_cmd_for_retry || !status ||
1362+
hw->adminq.sq_last_status != ICE_AQ_RC_EBUSY)
1363+
break;
1364+
1365+
if (buf_cpy)
1366+
memcpy(buf, buf_cpy, buf_size);
1367+
1368+
memcpy(desc, &desc_cpy, sizeof(desc_cpy));
1369+
1370+
mdelay(ICE_SQ_SEND_DELAY_TIME_MS);
1371+
1372+
} while (++idx < ICE_SQ_SEND_MAX_EXECUTE);
1373+
1374+
kfree(buf_cpy);
1375+
1376+
return status;
1377+
}
1378+
12951379
/**
12961380
* ice_aq_send_cmd - send FW Admin Queue command to FW Admin Queue
12971381
* @hw: pointer to the HW struct
@@ -1333,7 +1417,7 @@ ice_aq_send_cmd(struct ice_hw *hw, struct ice_aq_desc *desc, void *buf,
13331417
break;
13341418
}
13351419

1336-
status = ice_sq_send_cmd(hw, &hw->adminq, desc, buf, buf_size, cd);
1420+
status = ice_sq_send_cmd_retry(hw, &hw->adminq, desc, buf, buf_size, cd);
13371421
if (lock_acquired)
13381422
mutex_unlock(&ice_global_cfg_lock_sw);
13391423

@@ -2655,7 +2739,7 @@ enum ice_status ice_update_link_info(struct ice_port_info *pi)
26552739
if (!pcaps)
26562740
return ICE_ERR_NO_MEMORY;
26572741

2658-
status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP,
2742+
status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP_MEDIA,
26592743
pcaps, NULL);
26602744

26612745
devm_kfree(ice_hw_to_dev(hw), pcaps);
@@ -2815,8 +2899,8 @@ ice_set_fc(struct ice_port_info *pi, u8 *aq_failures, bool ena_auto_link_update)
28152899
return ICE_ERR_NO_MEMORY;
28162900

28172901
/* Get the current PHY config */
2818-
status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_SW_CFG, pcaps,
2819-
NULL);
2902+
status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_ACTIVE_CFG,
2903+
pcaps, NULL);
28202904
if (status) {
28212905
*aq_failures = ICE_SET_FC_AQ_FAIL_GET;
28222906
goto out;
@@ -2929,17 +3013,6 @@ ice_copy_phy_caps_to_cfg(struct ice_port_info *pi,
29293013
cfg->link_fec_opt = caps->link_fec_options;
29303014
cfg->module_compliance_enforcement =
29313015
caps->module_compliance_enforcement;
2932-
2933-
if (ice_fw_supports_link_override(pi->hw)) {
2934-
struct ice_link_default_override_tlv tlv;
2935-
2936-
if (ice_get_link_default_override(&tlv, pi))
2937-
return;
2938-
2939-
if (tlv.options & ICE_LINK_OVERRIDE_STRICT_MODE)
2940-
cfg->module_compliance_enforcement |=
2941-
ICE_LINK_OVERRIDE_STRICT_MODE;
2942-
}
29433016
}
29443017

29453018
/**
@@ -2954,16 +3027,21 @@ ice_cfg_phy_fec(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg,
29543027
{
29553028
struct ice_aqc_get_phy_caps_data *pcaps;
29563029
enum ice_status status;
3030+
struct ice_hw *hw;
29573031

29583032
if (!pi || !cfg)
29593033
return ICE_ERR_BAD_PTR;
29603034

3035+
hw = pi->hw;
3036+
29613037
pcaps = kzalloc(sizeof(*pcaps), GFP_KERNEL);
29623038
if (!pcaps)
29633039
return ICE_ERR_NO_MEMORY;
29643040

2965-
status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP, pcaps,
2966-
NULL);
3041+
status = ice_aq_get_phy_caps(pi, false,
3042+
(ice_fw_supports_report_dflt_cfg(hw) ?
3043+
ICE_AQC_REPORT_DFLT_CFG :
3044+
ICE_AQC_REPORT_TOPO_CAP_MEDIA), pcaps, NULL);
29673045
if (status)
29683046
goto out;
29693047

@@ -3002,7 +3080,8 @@ ice_cfg_phy_fec(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg,
30023080
break;
30033081
}
30043082

3005-
if (fec == ICE_FEC_AUTO && ice_fw_supports_link_override(pi->hw)) {
3083+
if (fec == ICE_FEC_AUTO && ice_fw_supports_link_override(hw) &&
3084+
!ice_fw_supports_report_dflt_cfg(hw)) {
30063085
struct ice_link_default_override_tlv tlv;
30073086

30083087
if (ice_get_link_default_override(&tlv, pi))
@@ -4412,3 +4491,23 @@ ice_lldp_fltr_add_remove(struct ice_hw *hw, u16 vsi_num, bool add)
44124491

44134492
return ice_aq_send_cmd(hw, &desc, NULL, 0, NULL);
44144493
}
4494+
4495+
/**
4496+
* ice_fw_supports_report_dflt_cfg
4497+
* @hw: pointer to the hardware structure
4498+
*
4499+
* Checks if the firmware supports report default configuration
4500+
*/
4501+
bool ice_fw_supports_report_dflt_cfg(struct ice_hw *hw)
4502+
{
4503+
if (hw->api_maj_ver == ICE_FW_API_REPORT_DFLT_CFG_MAJ) {
4504+
if (hw->api_min_ver > ICE_FW_API_REPORT_DFLT_CFG_MIN)
4505+
return true;
4506+
if (hw->api_min_ver == ICE_FW_API_REPORT_DFLT_CFG_MIN &&
4507+
hw->api_patch >= ICE_FW_API_REPORT_DFLT_CFG_PATCH)
4508+
return true;
4509+
} else if (hw->api_maj_ver > ICE_FW_API_REPORT_DFLT_CFG_MAJ) {
4510+
return true;
4511+
}
4512+
return false;
4513+
}

drivers/net/ethernet/intel/ice/ice_common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
#include "ice_switch.h"
1212
#include <linux/avf/virtchnl.h>
1313

14+
#define ICE_SQ_SEND_DELAY_TIME_MS 10
15+
#define ICE_SQ_SEND_MAX_EXECUTE 3
16+
1417
enum ice_status ice_init_hw(struct ice_hw *hw);
1518
void ice_deinit_hw(struct ice_hw *hw);
1619
enum ice_status ice_check_reset(struct ice_hw *hw);
@@ -176,4 +179,5 @@ ice_aq_set_lldp_mib(struct ice_hw *hw, u8 mib_type, void *buf, u16 buf_size,
176179
bool ice_fw_supports_lldp_fltr_ctrl(struct ice_hw *hw);
177180
enum ice_status
178181
ice_lldp_fltr_add_remove(struct ice_hw *hw, u16 vsi_num, bool add);
182+
bool ice_fw_supports_report_dflt_cfg(struct ice_hw *hw);
179183
#endif /* _ICE_COMMON_H_ */

drivers/net/ethernet/intel/ice/ice_controlq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ static bool ice_sq_done(struct ice_hw *hw, struct ice_ctl_q_info *cq)
892892
* ice_sq_send_cmd - send command to Control Queue (ATQ)
893893
* @hw: pointer to the HW struct
894894
* @cq: pointer to the specific Control queue
895-
* @desc: prefilled descriptor describing the command (non DMA mem)
895+
* @desc: prefilled descriptor describing the command
896896
* @buf: buffer to use for indirect commands (or NULL for direct commands)
897897
* @buf_size: size of buffer for indirect commands (or 0 for direct commands)
898898
* @cd: pointer to command details structure

0 commit comments

Comments
 (0)