Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
[linux-2.6-block.git] / drivers / net / ethernet / sfc / selftest.h
CommitLineData
d2912cb1 1/* SPDX-License-Identifier: GPL-2.0-only */
3273c2e8 2/****************************************************************************
f7a6d2c4 3 * Driver for Solarflare network controllers and boards
3273c2e8 4 * Copyright 2005-2006 Fen Systems Ltd.
f7a6d2c4 5 * Copyright 2006-2012 Solarflare Communications Inc.
3273c2e8
BH
6 */
7
8#ifndef EFX_SELFTEST_H
9#define EFX_SELFTEST_H
10
11#include "net_driver.h"
12
13/*
14 * Self tests
15 */
16
17struct efx_loopback_self_tests {
12804793
EC
18 int tx_sent[EFX_MAX_TXQ_PER_CHANNEL];
19 int tx_done[EFX_MAX_TXQ_PER_CHANNEL];
3273c2e8
BH
20 int rx_good;
21 int rx_bad;
22};
23
1796721a
BH
24#define EFX_MAX_PHY_TESTS 20
25
3273c2e8
BH
26/* Efx self test results
27 * For fields which are not counters, 1 indicates success and -1
942e298e 28 * indicates failure; 0 indicates test could not be run.
3273c2e8
BH
29 */
30struct efx_self_tests {
8c8661e4 31 /* online tests */
4f16c073 32 int phy_alive;
8c8661e4 33 int nvram;
3273c2e8
BH
34 int interrupt;
35 int eventq_dma[EFX_MAX_CHANNELS];
36 int eventq_int[EFX_MAX_CHANNELS];
8c8661e4 37 /* offline tests */
74cd60a4 38 int memory;
8c8661e4 39 int registers;
4f16c073 40 int phy_ext[EFX_MAX_PHY_TESTS];
8c8661e4 41 struct efx_loopback_self_tests loopback[LOOPBACK_TEST_MAX + 1];
3273c2e8
BH
42};
43
00aef986
JP
44void efx_loopback_rx_packet(struct efx_nic *efx, const char *buf_ptr,
45 int pkt_len);
46int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests,
47 unsigned flags);
86de7ced 48void efx_selftest_async_init(struct efx_nic *efx);
00aef986
JP
49void efx_selftest_async_start(struct efx_nic *efx);
50void efx_selftest_async_cancel(struct efx_nic *efx);
3273c2e8
BH
51
52#endif /* EFX_SELFTEST_H */