Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | * Driver for Solarflare Solarstorm network controllers and boards |
| 3 | * Copyright 2005-2006 Fen Systems Ltd. |
| 4 | * Copyright 2006-2008 Solarflare Communications Inc. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify it |
| 7 | * under the terms of the GNU General Public License version 2 as published |
| 8 | * by the Free Software Foundation, incorporated herein by reference. |
| 9 | */ |
| 10 | |
| 11 | #ifndef EFX_SELFTEST_H |
| 12 | #define EFX_SELFTEST_H |
| 13 | |
| 14 | #include "net_driver.h" |
| 15 | |
| 16 | /* |
| 17 | * Self tests |
| 18 | */ |
| 19 | |
| 20 | struct efx_loopback_self_tests { |
Ben Hutchings | a4900ac | 2010-04-28 09:30:43 +0000 | [diff] [blame] | 21 | int tx_sent[EFX_TXQ_TYPES]; |
| 22 | int tx_done[EFX_TXQ_TYPES]; |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 23 | int rx_good; |
| 24 | int rx_bad; |
| 25 | }; |
| 26 | |
Ben Hutchings | 1796721 | 2008-12-26 13:47:25 -0800 | [diff] [blame] | 27 | #define EFX_MAX_PHY_TESTS 20 |
| 28 | |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 29 | /* Efx self test results |
| 30 | * For fields which are not counters, 1 indicates success and -1 |
| 31 | * indicates failure. |
| 32 | */ |
| 33 | struct efx_self_tests { |
Ben Hutchings | 8c8661e | 2008-09-01 12:49:02 +0100 | [diff] [blame] | 34 | /* online tests */ |
Ben Hutchings | 4f16c07 | 2010-02-03 09:30:50 +0000 | [diff] [blame] | 35 | int phy_alive; |
Ben Hutchings | 8c8661e | 2008-09-01 12:49:02 +0100 | [diff] [blame] | 36 | int nvram; |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 37 | int interrupt; |
| 38 | int eventq_dma[EFX_MAX_CHANNELS]; |
| 39 | int eventq_int[EFX_MAX_CHANNELS]; |
| 40 | int eventq_poll[EFX_MAX_CHANNELS]; |
Ben Hutchings | 8c8661e | 2008-09-01 12:49:02 +0100 | [diff] [blame] | 41 | /* offline tests */ |
| 42 | int registers; |
Ben Hutchings | 4f16c07 | 2010-02-03 09:30:50 +0000 | [diff] [blame] | 43 | int phy_ext[EFX_MAX_PHY_TESTS]; |
Ben Hutchings | 8c8661e | 2008-09-01 12:49:02 +0100 | [diff] [blame] | 44 | struct efx_loopback_self_tests loopback[LOOPBACK_TEST_MAX + 1]; |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 45 | }; |
| 46 | |
| 47 | extern void efx_loopback_rx_packet(struct efx_nic *efx, |
| 48 | const char *buf_ptr, int pkt_len); |
Ben Hutchings | 2ef3068 | 2008-12-26 13:47:04 -0800 | [diff] [blame] | 49 | extern int efx_selftest(struct efx_nic *efx, |
| 50 | struct efx_self_tests *tests, |
| 51 | unsigned flags); |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 52 | |
| 53 | #endif /* EFX_SELFTEST_H */ |