^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Driver for Solarflare network controllers and boards
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright 2005-2006 Fen Systems Ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright 2006-2012 Solarflare Communications Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #ifndef EFX_SELFTEST_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define EFX_SELFTEST_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include "net_driver.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * Self tests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) struct efx_loopback_self_tests {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) int tx_sent[EFX_MAX_TXQ_PER_CHANNEL];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) int tx_done[EFX_MAX_TXQ_PER_CHANNEL];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) int rx_good;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) int rx_bad;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define EFX_MAX_PHY_TESTS 20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) /* Efx self test results
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * For fields which are not counters, 1 indicates success and -1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * indicates failure; 0 indicates test could not be run.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) struct efx_self_tests {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) /* online tests */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) int phy_alive;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) int nvram;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) int interrupt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) int eventq_dma[EFX_MAX_CHANNELS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) int eventq_int[EFX_MAX_CHANNELS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) /* offline tests */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) int memory;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) int registers;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) int phy_ext[EFX_MAX_PHY_TESTS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) struct efx_loopback_self_tests loopback[LOOPBACK_TEST_MAX + 1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) void efx_loopback_rx_packet(struct efx_nic *efx, const char *buf_ptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) int pkt_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) unsigned flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) void efx_selftest_async_init(struct efx_nic *efx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) void efx_selftest_async_start(struct efx_nic *efx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) void efx_selftest_async_cancel(struct efx_nic *efx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #endif /* EFX_SELFTEST_H */