bnxt_devlink.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. };
  15. static inline struct bnxt *bnxt_get_bp_from_dl(struct devlink *dl)
  16. {
  17. return ((struct bnxt_dl *)devlink_priv(dl))->bp;
  18. }
  19. /* To clear devlink pointer from bp, pass NULL dl */
  20. static inline void bnxt_link_bp_to_dl(struct bnxt *bp, struct devlink *dl)
  21. {
  22. bp->dl = dl;
  23. /* add a back pointer in dl to bp */
  24. if (dl) {
  25. struct bnxt_dl *bp_dl = devlink_priv(dl);
  26. bp_dl->bp = bp;
  27. }
  28. }
  29. #define NVM_OFF_ENABLE_SRIOV 401
  30. enum bnxt_nvm_dir_type {
  31. BNXT_NVM_SHARED_CFG = 40,
  32. BNXT_NVM_PORT_CFG,
  33. BNXT_NVM_FUNC_CFG,
  34. };
  35. struct bnxt_dl_nvm_param {
  36. u16 id;
  37. u16 offset;
  38. u16 dir_type;
  39. u16 num_bits;
  40. };
  41. int bnxt_dl_register(struct bnxt *bp);
  42. void bnxt_dl_unregister(struct bnxt *bp);
  43. #endif /* BNXT_DEVLINK_H */