npc.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* SPDX-License-Identifier: GPL-2.0
  2. *
  3. * Copyright (C) 2018 Marvell International Ltd.
  4. */
  5. #ifndef __NPC_H__
  6. #define __NPC_H__
  7. #define RSVD_MCAM_ENTRIES_PER_PF 2 /** Ucast and Bcast */
  8. #define RSVD_MCAM_ENTRIES_PER_NIXLF 1 /** Ucast for VFs */
  9. struct npc_kpu_profile_cam {
  10. u8 state;
  11. u8 state_mask;
  12. u16 dp0;
  13. u16 dp0_mask;
  14. u16 dp1;
  15. u16 dp1_mask;
  16. u16 dp2;
  17. u16 dp2_mask;
  18. };
  19. struct npc_kpu_profile_action {
  20. u8 errlev;
  21. u8 errcode;
  22. u8 dp0_offset;
  23. u8 dp1_offset;
  24. u8 dp2_offset;
  25. u8 bypass_count;
  26. u8 parse_done;
  27. u8 next_state;
  28. u8 ptr_advance;
  29. u8 cap_ena;
  30. u8 lid;
  31. u8 ltype;
  32. u8 flags;
  33. u8 offset;
  34. u8 mask;
  35. u8 right;
  36. u8 shift;
  37. };
  38. struct npc_kpu_profile {
  39. int cam_entries;
  40. int action_entries;
  41. struct npc_kpu_profile_cam *cam;
  42. struct npc_kpu_profile_action *action;
  43. };
  44. struct npc_pkind {
  45. struct rsrc_bmap rsrc;
  46. u32 *pfchan_map;
  47. };
  48. struct npc_mcam {
  49. struct rsrc_bmap rsrc;
  50. u16 *pfvf_map;
  51. u16 total_entries; /* Total number of MCAM entries */
  52. u16 entries; /* Total - reserved for NIX LFs */
  53. u8 banks_per_entry; /* Number of keywords in key */
  54. u8 keysize;
  55. u8 banks; /* Number of MCAM banks */
  56. u16 banksize; /* Number of MCAM entries in each bank */
  57. u16 counters; /* Number of match counters */
  58. u16 nixlf_offset;
  59. u16 pf_offset;
  60. };
  61. struct nix_af_handle;
  62. struct nix_handle;
  63. struct rvu_hwinfo;
  64. struct npc_af {
  65. struct nix_af_handle *nix_af;
  66. struct npc_pkind pkind;
  67. void __iomem *npc_af_base;
  68. u8 npc_kpus; /** Number of parser units */
  69. struct npc_mcam mcam;
  70. struct rvu_block block;
  71. struct rvu_hwinfo *hw;
  72. };
  73. struct npc {
  74. struct npc_af *npc_af;
  75. void __iomem *npc_base;
  76. struct nix_handle *nix;
  77. }
  78. #endif /* __NPC_H__ */