blob: aed24b736059b46f12342f3a6f4842c2e53dc2ac [file] [log] [blame]
Ben Hutchings3273c2e2008-05-07 13:36:19 +01001/****************************************************************************
2 * Driver for Solarflare Solarstorm network controllers and boards
3 * Copyright 2005-2006 Fen Systems Ltd.
Ben Hutchings0a6f40c2011-02-25 00:01:34 +00004 * Copyright 2006-2010 Solarflare Communications Inc.
Ben Hutchings3273c2e2008-05-07 13:36:19 +01005 *
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
20struct efx_loopback_self_tests {
Ben Hutchingsa4900ac2010-04-28 09:30:43 +000021 int tx_sent[EFX_TXQ_TYPES];
22 int tx_done[EFX_TXQ_TYPES];
Ben Hutchings3273c2e2008-05-07 13:36:19 +010023 int rx_good;
24 int rx_bad;
25};
26
Ben Hutchings17967212008-12-26 13:47:25 -080027#define EFX_MAX_PHY_TESTS 20
28
Ben Hutchings3273c2e2008-05-07 13:36:19 +010029/* Efx self test results
30 * For fields which are not counters, 1 indicates success and -1
31 * indicates failure.
32 */
33struct efx_self_tests {
Ben Hutchings8c8661e2008-09-01 12:49:02 +010034 /* online tests */
Ben Hutchings4f16c072010-02-03 09:30:50 +000035 int phy_alive;
Ben Hutchings8c8661e2008-09-01 12:49:02 +010036 int nvram;
Ben Hutchings3273c2e2008-05-07 13:36:19 +010037 int interrupt;
38 int eventq_dma[EFX_MAX_CHANNELS];
39 int eventq_int[EFX_MAX_CHANNELS];
Ben Hutchings8c8661e2008-09-01 12:49:02 +010040 /* offline tests */
41 int registers;
Ben Hutchings4f16c072010-02-03 09:30:50 +000042 int phy_ext[EFX_MAX_PHY_TESTS];
Ben Hutchings8c8661e2008-09-01 12:49:02 +010043 struct efx_loopback_self_tests loopback[LOOPBACK_TEST_MAX + 1];
Ben Hutchings3273c2e2008-05-07 13:36:19 +010044};
45
46extern void efx_loopback_rx_packet(struct efx_nic *efx,
47 const char *buf_ptr, int pkt_len);
Ben Hutchings2ef30682008-12-26 13:47:04 -080048extern int efx_selftest(struct efx_nic *efx,
49 struct efx_self_tests *tests,
50 unsigned flags);
Ben Hutchingsdd407812012-02-28 23:40:21 +000051extern void efx_selftest_async_start(struct efx_nic *efx);
52extern void efx_selftest_async_cancel(struct efx_nic *efx);
53extern void efx_selftest_async_work(struct work_struct *data);
Ben Hutchings3273c2e2008-05-07 13:36:19 +010054
55#endif /* EFX_SELFTEST_H */