selftest.h 1.5 KB

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