bnxt_devlink.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* Broadcom NetXtreme-C/E network driver.
  2. *
  3. * Copyright (c) 2017 Broadcom Limited
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation.
  8. */
  9. #ifndef BNXT_DEVLINK_H
  10. #define BNXT_DEVLINK_H
  11. /* Struct to hold housekeeping info needed by devlink interface */
  12. struct bnxt_dl {
  13. struct bnxt *bp; /* back ptr to the controlling dev */
  14. bool remote_reset;
  15. };
  16. static inline struct bnxt *bnxt_get_bp_from_dl(struct devlink *dl)
  17. {
  18. return ((struct bnxt_dl *)devlink_priv(dl))->bp;
  19. }
  20. static inline void bnxt_dl_remote_reload(struct bnxt *bp)
  21. {
  22. devlink_remote_reload_actions_performed(bp->dl, 0,
  23. BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT) |
  24. BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE));
  25. }
  26. static inline bool bnxt_dl_get_remote_reset(struct devlink *dl)
  27. {
  28. return ((struct bnxt_dl *)devlink_priv(dl))->remote_reset;
  29. }
  30. static inline void bnxt_dl_set_remote_reset(struct devlink *dl, bool value)
  31. {
  32. ((struct bnxt_dl *)devlink_priv(dl))->remote_reset = value;
  33. }
  34. #define NVM_OFF_MSIX_VEC_PER_PF_MAX 108
  35. #define NVM_OFF_MSIX_VEC_PER_PF_MIN 114
  36. #define NVM_OFF_IGNORE_ARI 164
  37. #define NVM_OFF_DIS_GRE_VER_CHECK 171
  38. #define NVM_OFF_ENABLE_SRIOV 401
  39. #define NVM_OFF_NVM_CFG_VER 602
  40. #define BNXT_NVM_CFG_VER_BITS 8
  41. #define BNXT_NVM_CFG_VER_BYTES 1
  42. #define BNXT_MSIX_VEC_MAX 512
  43. #define BNXT_MSIX_VEC_MIN_MAX 128
  44. enum bnxt_nvm_dir_type {
  45. BNXT_NVM_SHARED_CFG = 40,
  46. BNXT_NVM_PORT_CFG,
  47. BNXT_NVM_FUNC_CFG,
  48. };
  49. struct bnxt_dl_nvm_param {
  50. u16 id;
  51. u16 offset;
  52. u16 dir_type;
  53. u16 nvm_num_bits;
  54. u8 dl_num_bytes;
  55. };
  56. enum bnxt_dl_version_type {
  57. BNXT_VERSION_FIXED,
  58. BNXT_VERSION_RUNNING,
  59. BNXT_VERSION_STORED,
  60. };
  61. void bnxt_devlink_health_fw_report(struct bnxt *bp);
  62. void bnxt_dl_health_fw_status_update(struct bnxt *bp, bool healthy);
  63. void bnxt_dl_health_fw_recovery_done(struct bnxt *bp);
  64. void bnxt_dl_fw_reporters_create(struct bnxt *bp);
  65. void bnxt_dl_fw_reporters_destroy(struct bnxt *bp);
  66. int bnxt_dl_register(struct bnxt *bp);
  67. void bnxt_dl_unregister(struct bnxt *bp);
  68. #endif /* BNXT_DEVLINK_H */