18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/**************************************************************************** 38c2ecf20Sopenharmony_ci * Driver for Solarflare network controllers and boards 48c2ecf20Sopenharmony_ci * Copyright 2005-2006 Fen Systems Ltd. 58c2ecf20Sopenharmony_ci * Copyright 2006-2012 Solarflare Communications Inc. 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef EFX_SELFTEST_H 98c2ecf20Sopenharmony_ci#define EFX_SELFTEST_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include "net_driver.h" 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci/* 148c2ecf20Sopenharmony_ci * Self tests 158c2ecf20Sopenharmony_ci */ 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_cistruct efx_loopback_self_tests { 188c2ecf20Sopenharmony_ci int tx_sent[EFX_MAX_TXQ_PER_CHANNEL]; 198c2ecf20Sopenharmony_ci int tx_done[EFX_MAX_TXQ_PER_CHANNEL]; 208c2ecf20Sopenharmony_ci int rx_good; 218c2ecf20Sopenharmony_ci int rx_bad; 228c2ecf20Sopenharmony_ci}; 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#define EFX_MAX_PHY_TESTS 20 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/* Efx self test results 278c2ecf20Sopenharmony_ci * For fields which are not counters, 1 indicates success and -1 288c2ecf20Sopenharmony_ci * indicates failure; 0 indicates test could not be run. 298c2ecf20Sopenharmony_ci */ 308c2ecf20Sopenharmony_cistruct efx_self_tests { 318c2ecf20Sopenharmony_ci /* online tests */ 328c2ecf20Sopenharmony_ci int phy_alive; 338c2ecf20Sopenharmony_ci int nvram; 348c2ecf20Sopenharmony_ci int interrupt; 358c2ecf20Sopenharmony_ci int eventq_dma[EFX_MAX_CHANNELS]; 368c2ecf20Sopenharmony_ci int eventq_int[EFX_MAX_CHANNELS]; 378c2ecf20Sopenharmony_ci /* offline tests */ 388c2ecf20Sopenharmony_ci int memory; 398c2ecf20Sopenharmony_ci int registers; 408c2ecf20Sopenharmony_ci int phy_ext[EFX_MAX_PHY_TESTS]; 418c2ecf20Sopenharmony_ci struct efx_loopback_self_tests loopback[LOOPBACK_TEST_MAX + 1]; 428c2ecf20Sopenharmony_ci}; 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_civoid efx_loopback_rx_packet(struct efx_nic *efx, const char *buf_ptr, 458c2ecf20Sopenharmony_ci int pkt_len); 468c2ecf20Sopenharmony_ciint efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests, 478c2ecf20Sopenharmony_ci unsigned flags); 488c2ecf20Sopenharmony_civoid efx_selftest_async_init(struct efx_nic *efx); 498c2ecf20Sopenharmony_civoid efx_selftest_async_start(struct efx_nic *efx); 508c2ecf20Sopenharmony_civoid efx_selftest_async_cancel(struct efx_nic *efx); 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci#endif /* EFX_SELFTEST_H */ 53