Skip to content

Commit 0e674ae

Browse files
refactormanJeff Kirsher
authored andcommitted
ice: Add handler for ethtool selftest
This patch adds a handler for ethtool selftest. Selftest includes testing link, interrupts, eeprom, registers and packet loopback. Signed-off-by: Anirudh Venkataramanan <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 4b6f3ec commit 0e674ae

File tree

11 files changed

+752
-13
lines changed

11 files changed

+752
-13
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ struct ice_sw {
189189
};
190190

191191
enum ice_state {
192+
__ICE_TESTING,
192193
__ICE_DOWN,
193194
__ICE_NEEDS_RESTART,
194195
__ICE_PREPARED_FOR_RESET, /* set by driver when prepared */
@@ -399,6 +400,7 @@ struct ice_pf {
399400
unsigned long tx_timeout_last_recovery;
400401
u32 tx_timeout_recovery_level;
401402
char int_name[ICE_INT_NAME_STR_LEN];
403+
u32 sw_int_count;
402404
};
403405

404406
struct ice_netdev_priv {
@@ -451,9 +453,13 @@ ice_find_vsi_by_type(struct ice_pf *pf, enum ice_vsi_type type)
451453
return NULL;
452454
}
453455

456+
int ice_vsi_setup_tx_rings(struct ice_vsi *vsi);
457+
int ice_vsi_setup_rx_rings(struct ice_vsi *vsi);
454458
void ice_set_ethtool_ops(struct net_device *netdev);
455459
int ice_up(struct ice_vsi *vsi);
456460
int ice_down(struct ice_vsi *vsi);
461+
int ice_vsi_cfg(struct ice_vsi *vsi);
462+
struct ice_vsi *ice_lb_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi);
457463
int ice_set_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size);
458464
int ice_get_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size);
459465
void ice_fill_rss_lut(u8 *lut, u16 rss_table_size, u16 rss_size);
@@ -462,5 +468,7 @@ void ice_print_link_msg(struct ice_vsi *vsi, bool isup);
462468
int ice_pf_ena_all_vsi(struct ice_pf *pf, bool locked);
463469
void ice_pf_dis_all_vsi(struct ice_pf *pf, bool locked);
464470
#endif /* CONFIG_DCB */
471+
int ice_open(struct net_device *netdev);
472+
int ice_stop(struct net_device *netdev);
465473

466474
#endif /* _ICE_H_ */

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,14 @@ struct ice_aqc_set_event_mask {
11121112
u8 reserved1[6];
11131113
};
11141114

1115+
/* Set MAC Loopback command (direct 0x0620) */
1116+
struct ice_aqc_set_mac_lb {
1117+
u8 lb_mode;
1118+
#define ICE_AQ_MAC_LB_EN BIT(0)
1119+
#define ICE_AQ_MAC_LB_OSC_CLK BIT(1)
1120+
u8 reserved[15];
1121+
};
1122+
11151123
/* Set Port Identification LED (direct, 0x06E9) */
11161124
struct ice_aqc_set_port_id_led {
11171125
u8 lport_num;
@@ -1145,6 +1153,17 @@ struct ice_aqc_nvm {
11451153
__le32 addr_low;
11461154
};
11471155

1156+
/* NVM Checksum Command (direct, 0x0706) */
1157+
struct ice_aqc_nvm_checksum {
1158+
u8 flags;
1159+
#define ICE_AQC_NVM_CHECKSUM_VERIFY BIT(0)
1160+
#define ICE_AQC_NVM_CHECKSUM_RECALC BIT(1)
1161+
u8 rsvd;
1162+
__le16 checksum; /* Used only by response */
1163+
#define ICE_AQC_NVM_CHECKSUM_CORRECT 0xBABA
1164+
u8 rsvd2[12];
1165+
};
1166+
11481167
/**
11491168
* Send to PF command (indirect 0x0801) ID is only used by PF
11501169
*
@@ -1539,6 +1558,7 @@ struct ice_aq_desc {
15391558
struct ice_aqc_query_txsched_res query_sched_res;
15401559
struct ice_aqc_query_port_ets port_ets;
15411560
struct ice_aqc_nvm nvm;
1561+
struct ice_aqc_nvm_checksum nvm_checksum;
15421562
struct ice_aqc_pf_vf_msg virt;
15431563
struct ice_aqc_lldp_get_mib lldp_get_mib;
15441564
struct ice_aqc_lldp_set_mib_change lldp_set_event;
@@ -1554,6 +1574,7 @@ struct ice_aq_desc {
15541574
struct ice_aqc_add_update_free_vsi_resp add_update_free_vsi_res;
15551575
struct ice_aqc_fw_logging fw_logging;
15561576
struct ice_aqc_get_clear_fw_log get_clear_fw_log;
1577+
struct ice_aqc_set_mac_lb set_mac_lb;
15571578
struct ice_aqc_alloc_free_res_cmd sw_res_ctrl;
15581579
struct ice_aqc_set_event_mask set_event_mask;
15591580
struct ice_aqc_get_link_status get_link_status;
@@ -1642,10 +1663,12 @@ enum ice_adminq_opc {
16421663
ice_aqc_opc_restart_an = 0x0605,
16431664
ice_aqc_opc_get_link_status = 0x0607,
16441665
ice_aqc_opc_set_event_mask = 0x0613,
1666+
ice_aqc_opc_set_mac_lb = 0x0620,
16451667
ice_aqc_opc_set_port_id_led = 0x06E9,
16461668

16471669
/* NVM commands */
16481670
ice_aqc_opc_nvm_read = 0x0701,
1671+
ice_aqc_opc_nvm_checksum = 0x0706,
16491672

16501673
/* PF/VF mailbox commands */
16511674
ice_mbx_opc_send_msg_to_pf = 0x0801,

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2169,6 +2169,29 @@ ice_aq_set_event_mask(struct ice_hw *hw, u8 port_num, u16 mask,
21692169
return ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
21702170
}
21712171

2172+
/**
2173+
* ice_aq_set_mac_loopback
2174+
* @hw: pointer to the HW struct
2175+
* @ena_lpbk: Enable or Disable loopback
2176+
* @cd: pointer to command details structure or NULL
2177+
*
2178+
* Enable/disable loopback on a given port
2179+
*/
2180+
enum ice_status
2181+
ice_aq_set_mac_loopback(struct ice_hw *hw, bool ena_lpbk, struct ice_sq_cd *cd)
2182+
{
2183+
struct ice_aqc_set_mac_lb *cmd;
2184+
struct ice_aq_desc desc;
2185+
2186+
cmd = &desc.params.set_mac_lb;
2187+
2188+
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_set_mac_lb);
2189+
if (ena_lpbk)
2190+
cmd->lb_mode = ICE_AQ_MAC_LB_EN;
2191+
2192+
return ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
2193+
}
2194+
21722195
/**
21732196
* ice_aq_set_port_id_led
21742197
* @pi: pointer to the port information

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include "ice_switch.h"
1010
#include <linux/avf/virtchnl.h>
1111

12+
enum ice_status ice_nvm_validate_checksum(struct ice_hw *hw);
13+
1214
void
1315
ice_debug_cq(struct ice_hw *hw, u32 mask, void *desc, void *buf, u16 buf_len);
1416
enum ice_status ice_init_hw(struct ice_hw *hw);
@@ -94,6 +96,9 @@ ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse,
9496
enum ice_status
9597
ice_aq_set_event_mask(struct ice_hw *hw, u8 port_num, u16 mask,
9698
struct ice_sq_cd *cd);
99+
enum ice_status
100+
ice_aq_set_mac_loopback(struct ice_hw *hw, bool ena_lpbk, struct ice_sq_cd *cd);
101+
97102
enum ice_status
98103
ice_aq_set_port_id_led(struct ice_port_info *pi, bool is_orig_mode,
99104
struct ice_sq_cd *cd);

0 commit comments

Comments
 (0)