selftest.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /****************************************************************************
  3. * Driver for Solarflare network controllers and boards
  4. * Copyright 2005-2006 Fen Systems Ltd.
  5. * Copyright 2006-2012 Solarflare Communications Inc.
  6. */
  7. #ifndef EF4_SELFTEST_H
  8. #define EF4_SELFTEST_H
  9. #include "net_driver.h"
  10. /*
  11. * Self tests
  12. */
  13. struct ef4_loopback_self_tests {
  14. int tx_sent[EF4_TXQ_TYPES];
  15. int tx_done[EF4_TXQ_TYPES];
  16. int rx_good;
  17. int rx_bad;
  18. };
  19. #define EF4_MAX_PHY_TESTS 20
  20. /* Efx self test results
  21. * For fields which are not counters, 1 indicates success and -1
  22. * indicates failure; 0 indicates test could not be run.
  23. */
  24. struct ef4_self_tests {
  25. /* online tests */
  26. int phy_alive;
  27. int nvram;
  28. int interrupt;
  29. int eventq_dma[EF4_MAX_CHANNELS];
  30. int eventq_int[EF4_MAX_CHANNELS];
  31. /* offline tests */
  32. int memory;
  33. int registers;
  34. int phy_ext[EF4_MAX_PHY_TESTS];
  35. struct ef4_loopback_self_tests loopback[LOOPBACK_TEST_MAX + 1];
  36. };
  37. void ef4_loopback_rx_packet(struct ef4_nic *efx, const char *buf_ptr,
  38. int pkt_len);
  39. int ef4_selftest(struct ef4_nic *efx, struct ef4_self_tests *tests,
  40. unsigned flags);
  41. void ef4_selftest_async_start(struct ef4_nic *efx);
  42. void ef4_selftest_async_cancel(struct ef4_nic *efx);
  43. void ef4_selftest_async_work(struct work_struct *data);
  44. #endif /* EF4_SELFTEST_H */