csrs-npc.h 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629
  1. /* SPDX-License-Identifier: GPL-2.0
  2. *
  3. * Copyright (C) 2020 Marvell International Ltd.
  4. *
  5. * https://spdx.org/licenses
  6. */
  7. #ifndef __CSRS_NPC_H__
  8. #define __CSRS_NPC_H__
  9. /**
  10. * @file
  11. *
  12. * Configuration and status register (CSR) address and type definitions for
  13. * NPC.
  14. *
  15. * This file is auto generated. Do not edit.
  16. *
  17. */
  18. /**
  19. * Enumeration npc_errlev_e
  20. *
  21. * NPC Error Level Enumeration Enumerates the lowest protocol layer
  22. * containing an error.
  23. */
  24. #define NPC_ERRLEV_E_LA (1)
  25. #define NPC_ERRLEV_E_LB (2)
  26. #define NPC_ERRLEV_E_LC (3)
  27. #define NPC_ERRLEV_E_LD (4)
  28. #define NPC_ERRLEV_E_LE (5)
  29. #define NPC_ERRLEV_E_LF (6)
  30. #define NPC_ERRLEV_E_LG (7)
  31. #define NPC_ERRLEV_E_LH (8)
  32. #define NPC_ERRLEV_E_NIX (0xf)
  33. #define NPC_ERRLEV_E_RX(a) (0 + (a))
  34. #define NPC_ERRLEV_E_RE (0)
  35. /**
  36. * Enumeration npc_intf_e
  37. *
  38. * NPC Interface Enumeration Enumerates the NPC interfaces.
  39. */
  40. #define NPC_INTF_E_NIXX_RX(a) (0 + 2 * (a))
  41. #define NPC_INTF_E_NIXX_TX(a) (1 + 2 * (a))
  42. /**
  43. * Enumeration npc_lid_e
  44. *
  45. * NPC Layer ID Enumeration Enumerates layers parsed by NPC.
  46. */
  47. #define NPC_LID_E_LA (0)
  48. #define NPC_LID_E_LB (1)
  49. #define NPC_LID_E_LC (2)
  50. #define NPC_LID_E_LD (3)
  51. #define NPC_LID_E_LE (4)
  52. #define NPC_LID_E_LF (5)
  53. #define NPC_LID_E_LG (6)
  54. #define NPC_LID_E_LH (7)
  55. /**
  56. * Enumeration npc_lkupop_e
  57. *
  58. * NPC Lookup Operation Enumeration Enumerates the lookup operation for
  59. * NPC_AF_LKUP_CTL[OP].
  60. */
  61. #define NPC_LKUPOP_E_KEY (1)
  62. #define NPC_LKUPOP_E_PKT (0)
  63. /**
  64. * Enumeration npc_mcamkeyw_e
  65. *
  66. * NPC MCAM Search Key Width Enumeration
  67. */
  68. #define NPC_MCAMKEYW_E_X1 (0)
  69. #define NPC_MCAMKEYW_E_X2 (1)
  70. #define NPC_MCAMKEYW_E_X4 (2)
  71. /**
  72. * Structure npc_layer_info_s
  73. *
  74. * NPC Layer Parse Information Structure This structure specifies the
  75. * format of NPC_RESULT_S[LA,LB,...,LH].
  76. */
  77. union npc_layer_info_s {
  78. u32 u;
  79. struct npc_layer_info_s_s {
  80. u32 lptr : 8;
  81. u32 flags : 8;
  82. u32 ltype : 4;
  83. u32 reserved_20_31 : 12;
  84. } s;
  85. /* struct npc_layer_info_s_s cn; */
  86. };
  87. /**
  88. * Structure npc_layer_kex_s
  89. *
  90. * NPC Layer MCAM Search Key Extract Structure This structure specifies
  91. * the format of each of the NPC_PARSE_KEX_S[LA,LB,...,LH] fields. It
  92. * contains the subset of NPC_LAYER_INFO_S fields that can be included in
  93. * the MCAM search key. See NPC_PARSE_KEX_S and NPC_AF_INTF()_KEX_CFG.
  94. */
  95. union npc_layer_kex_s {
  96. u32 u;
  97. struct npc_layer_kex_s_s {
  98. u32 flags : 8;
  99. u32 ltype : 4;
  100. u32 reserved_12_31 : 20;
  101. } s;
  102. /* struct npc_layer_kex_s_s cn; */
  103. };
  104. /**
  105. * Structure npc_mcam_key_x1_s
  106. *
  107. * NPC MCAM Search Key X1 Structure This structure specifies the MCAM
  108. * search key format used by an interface when
  109. * NPC_AF_INTF()_KEX_CFG[KEYW] = NPC_MCAMKEYW_E::X1.
  110. */
  111. union npc_mcam_key_x1_s {
  112. u64 u[3];
  113. struct npc_mcam_key_x1_s_s {
  114. u64 intf : 2;
  115. u64 reserved_2_63 : 62;
  116. u64 kw0 : 64;
  117. u64 kw1 : 48;
  118. u64 reserved_176_191 : 16;
  119. } s;
  120. /* struct npc_mcam_key_x1_s_s cn; */
  121. };
  122. /**
  123. * Structure npc_mcam_key_x2_s
  124. *
  125. * NPC MCAM Search Key X2 Structure This structure specifies the MCAM
  126. * search key format used by an interface when
  127. * NPC_AF_INTF()_KEX_CFG[KEYW] = NPC_MCAMKEYW_E::X2.
  128. */
  129. union npc_mcam_key_x2_s {
  130. u64 u[5];
  131. struct npc_mcam_key_x2_s_s {
  132. u64 intf : 2;
  133. u64 reserved_2_63 : 62;
  134. u64 kw0 : 64;
  135. u64 kw1 : 64;
  136. u64 kw2 : 64;
  137. u64 kw3 : 32;
  138. u64 reserved_288_319 : 32;
  139. } s;
  140. /* struct npc_mcam_key_x2_s_s cn; */
  141. };
  142. /**
  143. * Structure npc_mcam_key_x4_s
  144. *
  145. * NPC MCAM Search Key X4 Structure This structure specifies the MCAM
  146. * search key format used by an interface when
  147. * NPC_AF_INTF()_KEX_CFG[KEYW] = NPC_MCAMKEYW_E::X4.
  148. */
  149. union npc_mcam_key_x4_s {
  150. u64 u[8];
  151. struct npc_mcam_key_x4_s_s {
  152. u64 intf : 2;
  153. u64 reserved_2_63 : 62;
  154. u64 kw0 : 64;
  155. u64 kw1 : 64;
  156. u64 kw2 : 64;
  157. u64 kw3 : 64;
  158. u64 kw4 : 64;
  159. u64 kw5 : 64;
  160. u64 kw6 : 64;
  161. } s;
  162. /* struct npc_mcam_key_x4_s_s cn; */
  163. };
  164. /**
  165. * Structure npc_parse_kex_s
  166. *
  167. * NPC Parse Key Extract Structure This structure contains the subset of
  168. * NPC_RESULT_S fields that can be included in the MCAM search key. See
  169. * NPC_AF_INTF()_KEX_CFG.
  170. */
  171. union npc_parse_kex_s {
  172. u64 u[2];
  173. struct npc_parse_kex_s_s {
  174. u64 chan : 12;
  175. u64 errlev : 4;
  176. u64 errcode : 8;
  177. u64 l2m : 1;
  178. u64 l2b : 1;
  179. u64 l3m : 1;
  180. u64 l3b : 1;
  181. u64 la : 12;
  182. u64 lb : 12;
  183. u64 lc : 12;
  184. u64 ld : 12;
  185. u64 le : 12;
  186. u64 lf : 12;
  187. u64 lg : 12;
  188. u64 lh : 12;
  189. u64 reserved_124_127 : 4;
  190. } s;
  191. /* struct npc_parse_kex_s_s cn; */
  192. };
  193. /**
  194. * Structure npc_result_s
  195. *
  196. * NPC Result Structure This structure contains a packet's parse and flow
  197. * identification information.
  198. */
  199. union npc_result_s {
  200. u64 u[6];
  201. struct npc_result_s_s {
  202. u64 intf : 2;
  203. u64 pkind : 6;
  204. u64 chan : 12;
  205. u64 errlev : 4;
  206. u64 errcode : 8;
  207. u64 l2m : 1;
  208. u64 l2b : 1;
  209. u64 l3m : 1;
  210. u64 l3b : 1;
  211. u64 eoh_ptr : 8;
  212. u64 reserved_44_63 : 20;
  213. u64 action : 64;
  214. u64 vtag_action : 64;
  215. u64 la : 20;
  216. u64 lb : 20;
  217. u64 lc : 20;
  218. u64 reserved_252_255 : 4;
  219. u64 ld : 20;
  220. u64 le : 20;
  221. u64 lf : 20;
  222. u64 reserved_316_319 : 4;
  223. u64 lg : 20;
  224. u64 lh : 20;
  225. u64 reserved_360_383 : 24;
  226. } s;
  227. /* struct npc_result_s_s cn; */
  228. };
  229. /**
  230. * Register (RVU_PF_BAR0) npc_af_active_pc
  231. *
  232. * NPC Interrupt-Timer Configuration Register
  233. */
  234. union npc_af_active_pc {
  235. u64 u;
  236. struct npc_af_active_pc_s {
  237. u64 active_pc : 64;
  238. } s;
  239. /* struct npc_af_active_pc_s cn; */
  240. };
  241. static inline u64 NPC_AF_ACTIVE_PC(void)
  242. __attribute__ ((pure, always_inline));
  243. static inline u64 NPC_AF_ACTIVE_PC(void)
  244. {
  245. return 0x10;
  246. }
  247. /**
  248. * Register (RVU_PF_BAR0) npc_af_blk_rst
  249. *
  250. * NPC AF Block Reset Register
  251. */
  252. union npc_af_blk_rst {
  253. u64 u;
  254. struct npc_af_blk_rst_s {
  255. u64 rst : 1;
  256. u64 reserved_1_62 : 62;
  257. u64 busy : 1;
  258. } s;
  259. /* struct npc_af_blk_rst_s cn; */
  260. };
  261. static inline u64 NPC_AF_BLK_RST(void)
  262. __attribute__ ((pure, always_inline));
  263. static inline u64 NPC_AF_BLK_RST(void)
  264. {
  265. return 0x40;
  266. }
  267. /**
  268. * Register (RVU_PF_BAR0) npc_af_cfg
  269. *
  270. * NPC AF General Configuration Register
  271. */
  272. union npc_af_cfg {
  273. u64 u;
  274. struct npc_af_cfg_s {
  275. u64 reserved_0_1 : 2;
  276. u64 cclk_force : 1;
  277. u64 force_intf_clk_en : 1;
  278. u64 reserved_4_63 : 60;
  279. } s;
  280. /* struct npc_af_cfg_s cn; */
  281. };
  282. static inline u64 NPC_AF_CFG(void)
  283. __attribute__ ((pure, always_inline));
  284. static inline u64 NPC_AF_CFG(void)
  285. {
  286. return 0;
  287. }
  288. /**
  289. * Register (RVU_PF_BAR0) npc_af_const
  290. *
  291. * NPC AF Constants Register This register contains constants for
  292. * software discovery.
  293. */
  294. union npc_af_const {
  295. u64 u;
  296. struct npc_af_const_s {
  297. u64 intfs : 4;
  298. u64 lids : 4;
  299. u64 kpus : 5;
  300. u64 reserved_13_15 : 3;
  301. u64 mcam_bank_width : 10;
  302. u64 reserved_26_27 : 2;
  303. u64 mcam_bank_depth : 16;
  304. u64 mcam_banks : 4;
  305. u64 match_stats : 16;
  306. } s;
  307. /* struct npc_af_const_s cn; */
  308. };
  309. static inline u64 NPC_AF_CONST(void)
  310. __attribute__ ((pure, always_inline));
  311. static inline u64 NPC_AF_CONST(void)
  312. {
  313. return 0x20;
  314. }
  315. /**
  316. * Register (RVU_PF_BAR0) npc_af_const1
  317. *
  318. * NPC AF Constants 1 Register This register contains constants for
  319. * software discovery.
  320. */
  321. union npc_af_const1 {
  322. u64 u;
  323. struct npc_af_const1_s {
  324. u64 kpu_entries : 12;
  325. u64 pkinds : 8;
  326. u64 cpi_size : 16;
  327. u64 reserved_36_63 : 28;
  328. } s;
  329. /* struct npc_af_const1_s cn; */
  330. };
  331. static inline u64 NPC_AF_CONST1(void)
  332. __attribute__ ((pure, always_inline));
  333. static inline u64 NPC_AF_CONST1(void)
  334. {
  335. return 0x30;
  336. }
  337. /**
  338. * Register (RVU_PF_BAR0) npc_af_cpi#_cfg
  339. *
  340. * NPC AF Channel Parse Index Table Registers
  341. */
  342. union npc_af_cpix_cfg {
  343. u64 u;
  344. struct npc_af_cpix_cfg_s {
  345. u64 padd : 4;
  346. u64 reserved_4_63 : 60;
  347. } s;
  348. /* struct npc_af_cpix_cfg_s cn; */
  349. };
  350. static inline u64 NPC_AF_CPIX_CFG(u64 a)
  351. __attribute__ ((pure, always_inline));
  352. static inline u64 NPC_AF_CPIX_CFG(u64 a)
  353. {
  354. return 0x200000 + 8 * a;
  355. }
  356. /**
  357. * Register (RVU_PF_BAR0) npc_af_dbg_ctl
  358. *
  359. * NPC AF Debug Control Register This register controls the capture of
  360. * debug information in NPC_AF_KPU()_DBG, NPC_AF_MCAM_DBG,
  361. * NPC_AF_DBG_DATA() and NPC_AF_DBG_RESULT().
  362. */
  363. union npc_af_dbg_ctl {
  364. u64 u;
  365. struct npc_af_dbg_ctl_s {
  366. u64 continuous : 1;
  367. u64 lkup_dbg : 1;
  368. u64 intf_dbg : 4;
  369. u64 reserved_6_63 : 58;
  370. } s;
  371. /* struct npc_af_dbg_ctl_s cn; */
  372. };
  373. static inline u64 NPC_AF_DBG_CTL(void)
  374. __attribute__ ((pure, always_inline));
  375. static inline u64 NPC_AF_DBG_CTL(void)
  376. {
  377. return 0x3000000;
  378. }
  379. /**
  380. * Register (RVU_PF_BAR0) npc_af_dbg_data#
  381. *
  382. * NPC AF Debug Data Registers These registers contain the packet header
  383. * data of the last packet/lookup whose debug information is captured by
  384. * NPC_AF_DBG_CTL[INTF_DBG,LKUP_DBG].
  385. */
  386. union npc_af_dbg_datax {
  387. u64 u;
  388. struct npc_af_dbg_datax_s {
  389. u64 data : 64;
  390. } s;
  391. /* struct npc_af_dbg_datax_s cn; */
  392. };
  393. static inline u64 NPC_AF_DBG_DATAX(u64 a)
  394. __attribute__ ((pure, always_inline));
  395. static inline u64 NPC_AF_DBG_DATAX(u64 a)
  396. {
  397. return 0x3001400 + 0x10 * a;
  398. }
  399. /**
  400. * Register (RVU_PF_BAR0) npc_af_dbg_result#
  401. *
  402. * NPC AF Debug Result Registers These registers contain the result data
  403. * of the last packet/lookup whose debug information is captured by
  404. * NPC_AF_DBG_CTL[INTF_DBG,LKUP_DBG]. Internal: FIXME - add note about
  405. * coherency of data in continuous packet capture mode.
  406. */
  407. union npc_af_dbg_resultx {
  408. u64 u;
  409. struct npc_af_dbg_resultx_s {
  410. u64 data : 64;
  411. } s;
  412. /* struct npc_af_dbg_resultx_s cn; */
  413. };
  414. static inline u64 NPC_AF_DBG_RESULTX(u64 a)
  415. __attribute__ ((pure, always_inline));
  416. static inline u64 NPC_AF_DBG_RESULTX(u64 a)
  417. {
  418. return 0x3001800 + 0x10 * a;
  419. }
  420. /**
  421. * Register (RVU_PF_BAR0) npc_af_dbg_status
  422. *
  423. * NPC AF Debug Status Register
  424. */
  425. union npc_af_dbg_status {
  426. u64 u;
  427. struct npc_af_dbg_status_s {
  428. u64 done : 1;
  429. u64 reserved_1_63 : 63;
  430. } s;
  431. /* struct npc_af_dbg_status_s cn; */
  432. };
  433. static inline u64 NPC_AF_DBG_STATUS(void)
  434. __attribute__ ((pure, always_inline));
  435. static inline u64 NPC_AF_DBG_STATUS(void)
  436. {
  437. return 0x3000010;
  438. }
  439. /**
  440. * Register (RVU_PF_BAR0) npc_af_dv_fc_scratch
  441. *
  442. * INTERNAL: NPC AF Scratch Register Internal: This register is for
  443. * internal DV purpose.
  444. */
  445. union npc_af_dv_fc_scratch {
  446. u64 u;
  447. struct npc_af_dv_fc_scratch_s {
  448. u64 it : 64;
  449. } s;
  450. /* struct npc_af_dv_fc_scratch_s cn; */
  451. };
  452. static inline u64 NPC_AF_DV_FC_SCRATCH(void)
  453. __attribute__ ((pure, always_inline));
  454. static inline u64 NPC_AF_DV_FC_SCRATCH(void)
  455. {
  456. return 0x60;
  457. }
  458. /**
  459. * Register (RVU_PF_BAR0) npc_af_eco0
  460. *
  461. * INTERNAL: ECO 0 Register
  462. */
  463. union npc_af_eco0 {
  464. u64 u;
  465. struct npc_af_eco0_s {
  466. u64 eco_rw : 32;
  467. u64 reserved_32_63 : 32;
  468. } s;
  469. /* struct npc_af_eco0_s cn; */
  470. };
  471. static inline u64 NPC_AF_ECO0(void)
  472. __attribute__ ((pure, always_inline));
  473. static inline u64 NPC_AF_ECO0(void)
  474. {
  475. return 0x200;
  476. }
  477. /**
  478. * Register (RVU_PF_BAR0) npc_af_ikpu_err_ctl
  479. *
  480. * NPC AF Initial KPU Error Control Registers Similar to
  481. * NPC_AF_KPU()_ERR_CTL, but specifies values captured in
  482. * NPC_RESULT_S[ERRLEV,ERRCODE] for errors detected by the PKIND-based
  483. * initial actions from NPC_AF_PKIND()_ACTION0 and
  484. * NPC_AF_PKIND()_ACTION1. [DP_OFFSET_ERRCODE] from this register is
  485. * never used.
  486. */
  487. union npc_af_ikpu_err_ctl {
  488. u64 u;
  489. struct npc_af_ikpu_err_ctl_s {
  490. u64 errlev : 4;
  491. u64 dp_offset_errcode : 8;
  492. u64 ptr_advance_errcode : 8;
  493. u64 var_len_offset_errcode : 8;
  494. u64 reserved_28_63 : 36;
  495. } s;
  496. /* struct npc_af_ikpu_err_ctl_s cn; */
  497. };
  498. static inline u64 NPC_AF_IKPU_ERR_CTL(void)
  499. __attribute__ ((pure, always_inline));
  500. static inline u64 NPC_AF_IKPU_ERR_CTL(void)
  501. {
  502. return 0x3000080;
  503. }
  504. /**
  505. * Register (RVU_PF_BAR0) npc_af_intf#_kex_cfg
  506. *
  507. * NPC AF Interface Key Extract Configuration Registers
  508. */
  509. union npc_af_intfx_kex_cfg {
  510. u64 u;
  511. struct npc_af_intfx_kex_cfg_s {
  512. u64 parse_nibble_ena : 31;
  513. u64 reserved_31 : 1;
  514. u64 keyw : 3;
  515. u64 reserved_35_63 : 29;
  516. } s;
  517. /* struct npc_af_intfx_kex_cfg_s cn; */
  518. };
  519. static inline u64 NPC_AF_INTFX_KEX_CFG(u64 a)
  520. __attribute__ ((pure, always_inline));
  521. static inline u64 NPC_AF_INTFX_KEX_CFG(u64 a)
  522. {
  523. return 0x1010 + 0x100 * a;
  524. }
  525. /**
  526. * Register (RVU_PF_BAR0) npc_af_intf#_ldata#_flags#_cfg
  527. *
  528. * NPC AF Interface Layer Data Flags Configuration Registers These
  529. * registers control the extraction of layer data (LDATA) into the MCAM
  530. * search key for each interface based on the FLAGS\<3:0\> bits of two
  531. * layers selected by NPC_AF_KEX_LDATA()_FLAGS_CFG.
  532. */
  533. union npc_af_intfx_ldatax_flagsx_cfg {
  534. u64 u;
  535. struct npc_af_intfx_ldatax_flagsx_cfg_s {
  536. u64 key_offset : 6;
  537. u64 reserved_6 : 1;
  538. u64 ena : 1;
  539. u64 hdr_offset : 8;
  540. u64 bytesm1 : 4;
  541. u64 reserved_20_63 : 44;
  542. } s;
  543. /* struct npc_af_intfx_ldatax_flagsx_cfg_s cn; */
  544. };
  545. static inline u64 NPC_AF_INTFX_LDATAX_FLAGSX_CFG(u64 a, u64 b, u64 c)
  546. __attribute__ ((pure, always_inline));
  547. static inline u64 NPC_AF_INTFX_LDATAX_FLAGSX_CFG(u64 a, u64 b, u64 c)
  548. {
  549. return 0x980000 + 0x10000 * a + 0x1000 * b + 8 * c;
  550. }
  551. /**
  552. * Register (RVU_PF_BAR0) npc_af_intf#_lid#_lt#_ld#_cfg
  553. *
  554. * NPC AF Interface Layer Data Extract Configuration Registers These
  555. * registers control the extraction of layer data (LDATA) into the MCAM
  556. * search key for each interface. Up to two LDATA fields can be extracted
  557. * per layer (LID(0..7) indexed by NPC_LID_E), with up to 16 bytes per
  558. * LDATA field. For each layer, the corresponding NPC_LAYER_INFO_S[LTYPE]
  559. * value in NPC_RESULT_S is used as the LTYPE(0..15) index and select the
  560. * associated LDATA(0..1) registers. NPC_LAYER_INFO_S[LTYPE]=0x0 means
  561. * the corresponding layer not parsed (invalid), so software should keep
  562. * NPC_AF_INTF()_LID()_LT(0)_LD()_CFG[ENA] clear to disable extraction
  563. * when LTYPE is zero.
  564. */
  565. union npc_af_intfx_lidx_ltx_ldx_cfg {
  566. u64 u;
  567. struct npc_af_intfx_lidx_ltx_ldx_cfg_s {
  568. u64 key_offset : 6;
  569. u64 flags_ena : 1;
  570. u64 ena : 1;
  571. u64 hdr_offset : 8;
  572. u64 bytesm1 : 4;
  573. u64 reserved_20_63 : 44;
  574. } s;
  575. /* struct npc_af_intfx_lidx_ltx_ldx_cfg_s cn; */
  576. };
  577. static inline u64 NPC_AF_INTFX_LIDX_LTX_LDX_CFG(u64 a, u64 b, u64 c, u64 d)
  578. __attribute__ ((pure, always_inline));
  579. static inline u64 NPC_AF_INTFX_LIDX_LTX_LDX_CFG(u64 a, u64 b, u64 c, u64 d)
  580. {
  581. return 0x900000 + 0x10000 * a + 0x1000 * b + 0x20 * c + 8 * d;
  582. }
  583. /**
  584. * Register (RVU_PF_BAR0) npc_af_intf#_miss_act
  585. *
  586. * NPC AF Interface MCAM Miss Action Data Registers When a combination of
  587. * NPC_AF_MCAME()_BANK()_CAM()_* and NPC_AF_MCAME()_BANK()_CFG[ENA]
  588. * yields an MCAM miss for a packet, this register specifies the packet's
  589. * match action captured in NPC_RESULT_S[ACTION].
  590. */
  591. union npc_af_intfx_miss_act {
  592. u64 u;
  593. struct npc_af_intfx_miss_act_s {
  594. u64 action : 64;
  595. } s;
  596. /* struct npc_af_intfx_miss_act_s cn; */
  597. };
  598. static inline u64 NPC_AF_INTFX_MISS_ACT(u64 a)
  599. __attribute__ ((pure, always_inline));
  600. static inline u64 NPC_AF_INTFX_MISS_ACT(u64 a)
  601. {
  602. return 0x1a00000 + 0x10 * a;
  603. }
  604. /**
  605. * Register (RVU_PF_BAR0) npc_af_intf#_miss_stat_act
  606. *
  607. * NPC AF Interface MCAM Miss Stat Action Data Registers Used to
  608. * optionally increment a NPC_AF_MATCH_STAT() counter when a packet
  609. * misses an MCAM entry.
  610. */
  611. union npc_af_intfx_miss_stat_act {
  612. u64 u;
  613. struct npc_af_intfx_miss_stat_act_s {
  614. u64 stat_sel : 9;
  615. u64 ena : 1;
  616. u64 reserved_10_63 : 54;
  617. } s;
  618. /* struct npc_af_intfx_miss_stat_act_s cn; */
  619. };
  620. static inline u64 NPC_AF_INTFX_MISS_STAT_ACT(u64 a)
  621. __attribute__ ((pure, always_inline));
  622. static inline u64 NPC_AF_INTFX_MISS_STAT_ACT(u64 a)
  623. {
  624. return 0x1880040 + 8 * a;
  625. }
  626. /**
  627. * Register (RVU_PF_BAR0) npc_af_intf#_miss_tag_act
  628. *
  629. * NPC AF Interface MCAM Miss VTag Action Data Registers When a
  630. * combination of NPC_AF_MCAME()_BANK()_CAM()_* and
  631. * NPC_AF_MCAME()_BANK()_CFG[ENA] yields an MCAM miss for a packet, this
  632. * register specifies the packet's match Vtag action captured in
  633. * NPC_RESULT_S[VTAG_ACTION].
  634. */
  635. union npc_af_intfx_miss_tag_act {
  636. u64 u;
  637. struct npc_af_intfx_miss_tag_act_s {
  638. u64 vtag_action : 64;
  639. } s;
  640. /* struct npc_af_intfx_miss_tag_act_s cn; */
  641. };
  642. static inline u64 NPC_AF_INTFX_MISS_TAG_ACT(u64 a)
  643. __attribute__ ((pure, always_inline));
  644. static inline u64 NPC_AF_INTFX_MISS_TAG_ACT(u64 a)
  645. {
  646. return 0x1b00008 + 0x10 * a;
  647. }
  648. /**
  649. * Register (RVU_PF_BAR0) npc_af_intf#_stat
  650. *
  651. * NPC AF Interface Statistics Registers Statistics per interface. Index
  652. * enumerated by NPC_INTF_E.
  653. */
  654. union npc_af_intfx_stat {
  655. u64 u;
  656. struct npc_af_intfx_stat_s {
  657. u64 count : 48;
  658. u64 reserved_48_63 : 16;
  659. } s;
  660. /* struct npc_af_intfx_stat_s cn; */
  661. };
  662. static inline u64 NPC_AF_INTFX_STAT(u64 a)
  663. __attribute__ ((pure, always_inline));
  664. static inline u64 NPC_AF_INTFX_STAT(u64 a)
  665. {
  666. return 0x2000800 + 0x10 * a;
  667. }
  668. /**
  669. * Register (RVU_PF_BAR0) npc_af_kcam_scrub_ctl
  670. *
  671. * NPC AF KCAM Scrub Control Register
  672. */
  673. union npc_af_kcam_scrub_ctl {
  674. u64 u;
  675. struct npc_af_kcam_scrub_ctl_s {
  676. u64 ena : 1;
  677. u64 reserved_1_7 : 7;
  678. u64 lp_dis : 1;
  679. u64 reserved_9_15 : 7;
  680. u64 toth : 4;
  681. u64 reserved_20_63 : 44;
  682. } s;
  683. /* struct npc_af_kcam_scrub_ctl_s cn; */
  684. };
  685. static inline u64 NPC_AF_KCAM_SCRUB_CTL(void)
  686. __attribute__ ((pure, always_inline));
  687. static inline u64 NPC_AF_KCAM_SCRUB_CTL(void)
  688. {
  689. return 0xb0;
  690. }
  691. /**
  692. * Register (RVU_PF_BAR0) npc_af_kex_ldata#_flags_cfg
  693. *
  694. * NPC AF Key Extract Layer Data Flags Configuration Register
  695. */
  696. union npc_af_kex_ldatax_flags_cfg {
  697. u64 u;
  698. struct npc_af_kex_ldatax_flags_cfg_s {
  699. u64 lid : 3;
  700. u64 reserved_3_63 : 61;
  701. } s;
  702. /* struct npc_af_kex_ldatax_flags_cfg_s cn; */
  703. };
  704. static inline u64 NPC_AF_KEX_LDATAX_FLAGS_CFG(u64 a)
  705. __attribute__ ((pure, always_inline));
  706. static inline u64 NPC_AF_KEX_LDATAX_FLAGS_CFG(u64 a)
  707. {
  708. return 0x800 + 8 * a;
  709. }
  710. /**
  711. * Register (RVU_PF_BAR0) npc_af_kpu#_cfg
  712. *
  713. * NPC AF KPU Configuration Registers
  714. */
  715. union npc_af_kpux_cfg {
  716. u64 u;
  717. struct npc_af_kpux_cfg_s {
  718. u64 ena : 1;
  719. u64 reserved_1_63 : 63;
  720. } s;
  721. /* struct npc_af_kpux_cfg_s cn; */
  722. };
  723. static inline u64 NPC_AF_KPUX_CFG(u64 a)
  724. __attribute__ ((pure, always_inline));
  725. static inline u64 NPC_AF_KPUX_CFG(u64 a)
  726. {
  727. return 0x500 + 8 * a;
  728. }
  729. /**
  730. * Register (RVU_PF_BAR0) npc_af_kpu#_dbg
  731. *
  732. * NPC AF KPU Debug Registers This register contains information for the
  733. * last packet/lookup for which debug is enabled by
  734. * NPC_AF_DBG_CTL[INTF_DBG,LKUP_DBG]. The register contents are undefined
  735. * when debug information is captured for a software key lookup
  736. * (NPC_AF_LKUP_CTL[OP] = NPC_LKUPOP_E::KEY).
  737. */
  738. union npc_af_kpux_dbg {
  739. u64 u;
  740. struct npc_af_kpux_dbg_s {
  741. u64 hit_entry : 8;
  742. u64 byp : 1;
  743. u64 reserved_9_63 : 55;
  744. } s;
  745. /* struct npc_af_kpux_dbg_s cn; */
  746. };
  747. static inline u64 NPC_AF_KPUX_DBG(u64 a)
  748. __attribute__ ((pure, always_inline));
  749. static inline u64 NPC_AF_KPUX_DBG(u64 a)
  750. {
  751. return 0x3000020 + 0x100 * a;
  752. }
  753. /**
  754. * Register (RVU_PF_BAR0) npc_af_kpu#_entry#_action0
  755. *
  756. * NPC AF KPU Entry Action Data 0 Registers When a KPU's search data
  757. * matches a KPU CAM entry in NPC_AF_KPU()_ENTRY()_CAM(), the
  758. * corresponding entry action in NPC_AF_KPU()_ENTRY()_ACTION0 and
  759. * NPC_AF_KPU()_ENTRY()_ACTION1 specifies the next state and operations
  760. * to perform before exiting the KPU.
  761. */
  762. union npc_af_kpux_entryx_action0 {
  763. u64 u;
  764. struct npc_af_kpux_entryx_action0_s {
  765. u64 var_len_shift : 3;
  766. u64 var_len_right : 1;
  767. u64 var_len_mask : 8;
  768. u64 var_len_offset : 8;
  769. u64 ptr_advance : 8;
  770. u64 capture_flags : 8;
  771. u64 capture_ltype : 4;
  772. u64 capture_lid : 3;
  773. u64 reserved_43 : 1;
  774. u64 next_state : 8;
  775. u64 parse_done : 1;
  776. u64 capture_ena : 1;
  777. u64 byp_count : 3;
  778. u64 reserved_57_63 : 7;
  779. } s;
  780. /* struct npc_af_kpux_entryx_action0_s cn; */
  781. };
  782. static inline u64 NPC_AF_KPUX_ENTRYX_ACTION0(u64 a, u64 b)
  783. __attribute__ ((pure, always_inline));
  784. static inline u64 NPC_AF_KPUX_ENTRYX_ACTION0(u64 a, u64 b)
  785. {
  786. return 0x100020 + 0x4000 * a + 0x40 * b;
  787. }
  788. /**
  789. * Register (RVU_PF_BAR0) npc_af_kpu#_entry#_action1
  790. *
  791. * NPC AF KPU Entry Action Data 0 Registers See
  792. * NPC_AF_KPU()_ENTRY()_ACTION0.
  793. */
  794. union npc_af_kpux_entryx_action1 {
  795. u64 u;
  796. struct npc_af_kpux_entryx_action1_s {
  797. u64 dp0_offset : 8;
  798. u64 dp1_offset : 8;
  799. u64 dp2_offset : 8;
  800. u64 errcode : 8;
  801. u64 errlev : 4;
  802. u64 reserved_36_63 : 28;
  803. } s;
  804. /* struct npc_af_kpux_entryx_action1_s cn; */
  805. };
  806. static inline u64 NPC_AF_KPUX_ENTRYX_ACTION1(u64 a, u64 b)
  807. __attribute__ ((pure, always_inline));
  808. static inline u64 NPC_AF_KPUX_ENTRYX_ACTION1(u64 a, u64 b)
  809. {
  810. return 0x100028 + 0x4000 * a + 0x40 * b;
  811. }
  812. /**
  813. * Register (RVU_PF_BAR0) npc_af_kpu#_entry#_cam#
  814. *
  815. * NPC AF KPU Entry CAM Registers KPU comparison ternary data. The field
  816. * values in NPC_AF_KPU()_ENTRY()_CAM() are ternary, where each data bit
  817. * of the search key matches as follows: _ [CAM(1)]\<n\>=0,
  818. * [CAM(0)]\<n\>=0: Always match; search key data\<n\> don't care. _
  819. * [CAM(1)]\<n\>=0, [CAM(0)]\<n\>=1: Match when search key data\<n\> ==
  820. * 0. _ [CAM(1)]\<n\>=1, [CAM(0)]\<n\>=0: Match when search key data\<n\>
  821. * == 1. _ [CAM(1)]\<n\>=1, [CAM(0)]\<n\>=1: Reserved. The reserved
  822. * combination is not allowed. Hardware suppresses any write to CAM(0) or
  823. * CAM(1) that would result in the reserved combination for any CAM bit.
  824. * The reset value for all non-reserved fields is all zeros for CAM(1)
  825. * and all ones for CAM(0), matching a search key of all zeros. Software
  826. * must program a default entry for each KPU, e.g. by programming each
  827. * KPU's last entry {b} (NPC_AF_KPU()_ENTRY({b})_CAM()) to always match
  828. * all bits.
  829. */
  830. union npc_af_kpux_entryx_camx {
  831. u64 u;
  832. struct npc_af_kpux_entryx_camx_s {
  833. u64 dp0_data : 16;
  834. u64 dp1_data : 16;
  835. u64 dp2_data : 16;
  836. u64 state : 8;
  837. u64 reserved_56_63 : 8;
  838. } s;
  839. /* struct npc_af_kpux_entryx_camx_s cn; */
  840. };
  841. static inline u64 NPC_AF_KPUX_ENTRYX_CAMX(u64 a, u64 b, u64 c)
  842. __attribute__ ((pure, always_inline));
  843. static inline u64 NPC_AF_KPUX_ENTRYX_CAMX(u64 a, u64 b, u64 c)
  844. {
  845. return 0x100000 + 0x4000 * a + 0x40 * b + 8 * c;
  846. }
  847. /**
  848. * Register (RVU_PF_BAR0) npc_af_kpu#_entry_dis#
  849. *
  850. * NPC AF KPU Entry Disable Registers See NPC_AF_KPU()_ENTRY()_ACTION0.
  851. */
  852. union npc_af_kpux_entry_disx {
  853. u64 u;
  854. struct npc_af_kpux_entry_disx_s {
  855. u64 dis : 64;
  856. } s;
  857. /* struct npc_af_kpux_entry_disx_s cn; */
  858. };
  859. static inline u64 NPC_AF_KPUX_ENTRY_DISX(u64 a, u64 b)
  860. __attribute__ ((pure, always_inline));
  861. static inline u64 NPC_AF_KPUX_ENTRY_DISX(u64 a, u64 b)
  862. {
  863. return 0x180000 + 0x40 * a + 8 * b;
  864. }
  865. /**
  866. * Register (RVU_PF_BAR0) npc_af_kpu#_err_ctl
  867. *
  868. * NPC AF KPU Error Control Registers This register specifies values
  869. * captured in NPC_RESULT_S[ERRLEV,ERRCODE] when errors are detected by a
  870. * KPU.
  871. */
  872. union npc_af_kpux_err_ctl {
  873. u64 u;
  874. struct npc_af_kpux_err_ctl_s {
  875. u64 errlev : 4;
  876. u64 dp_offset_errcode : 8;
  877. u64 ptr_advance_errcode : 8;
  878. u64 var_len_offset_errcode : 8;
  879. u64 reserved_28_63 : 36;
  880. } s;
  881. /* struct npc_af_kpux_err_ctl_s cn; */
  882. };
  883. static inline u64 NPC_AF_KPUX_ERR_CTL(u64 a)
  884. __attribute__ ((pure, always_inline));
  885. static inline u64 NPC_AF_KPUX_ERR_CTL(u64 a)
  886. {
  887. return 0x30000a0 + 0x100 * a;
  888. }
  889. /**
  890. * Register (RVU_PF_BAR0) npc_af_kpu_diag
  891. *
  892. * INTERNAL : NPC AF Debug Result Registers
  893. */
  894. union npc_af_kpu_diag {
  895. u64 u;
  896. struct npc_af_kpu_diag_s {
  897. u64 skip_dis : 1;
  898. u64 reserved_1_63 : 63;
  899. } s;
  900. /* struct npc_af_kpu_diag_s cn; */
  901. };
  902. static inline u64 NPC_AF_KPU_DIAG(void)
  903. __attribute__ ((pure, always_inline));
  904. static inline u64 NPC_AF_KPU_DIAG(void)
  905. {
  906. return 0x3002000;
  907. }
  908. /**
  909. * Register (RVU_PF_BAR0) npc_af_lkup_ctl
  910. *
  911. * NPC AF Software Lookup Control Registers
  912. */
  913. union npc_af_lkup_ctl {
  914. u64 u;
  915. struct npc_af_lkup_ctl_s {
  916. u64 intf : 2;
  917. u64 pkind : 6;
  918. u64 chan : 12;
  919. u64 hdr_sizem1 : 8;
  920. u64 op : 3;
  921. u64 exec : 1;
  922. u64 reserved_32_63 : 32;
  923. } s;
  924. /* struct npc_af_lkup_ctl_s cn; */
  925. };
  926. static inline u64 NPC_AF_LKUP_CTL(void)
  927. __attribute__ ((pure, always_inline));
  928. static inline u64 NPC_AF_LKUP_CTL(void)
  929. {
  930. return 0x2000000;
  931. }
  932. /**
  933. * Register (RVU_PF_BAR0) npc_af_lkup_data#
  934. *
  935. * NPC AF Software Lookup Data Registers
  936. */
  937. union npc_af_lkup_datax {
  938. u64 u;
  939. struct npc_af_lkup_datax_s {
  940. u64 data : 64;
  941. } s;
  942. /* struct npc_af_lkup_datax_s cn; */
  943. };
  944. static inline u64 NPC_AF_LKUP_DATAX(u64 a)
  945. __attribute__ ((pure, always_inline));
  946. static inline u64 NPC_AF_LKUP_DATAX(u64 a)
  947. {
  948. return 0x2000200 + 0x10 * a;
  949. }
  950. /**
  951. * Register (RVU_PF_BAR0) npc_af_lkup_result#
  952. *
  953. * NPC AF Software Lookup Result Registers
  954. */
  955. union npc_af_lkup_resultx {
  956. u64 u;
  957. struct npc_af_lkup_resultx_s {
  958. u64 data : 64;
  959. } s;
  960. /* struct npc_af_lkup_resultx_s cn; */
  961. };
  962. static inline u64 NPC_AF_LKUP_RESULTX(u64 a)
  963. __attribute__ ((pure, always_inline));
  964. static inline u64 NPC_AF_LKUP_RESULTX(u64 a)
  965. {
  966. return 0x2000400 + 0x10 * a;
  967. }
  968. /**
  969. * Register (RVU_PF_BAR0) npc_af_match_stat#
  970. *
  971. * NPC AF Match Statistics Registers
  972. */
  973. union npc_af_match_statx {
  974. u64 u;
  975. struct npc_af_match_statx_s {
  976. u64 count : 48;
  977. u64 reserved_48_63 : 16;
  978. } s;
  979. /* struct npc_af_match_statx_s cn; */
  980. };
  981. static inline u64 NPC_AF_MATCH_STATX(u64 a)
  982. __attribute__ ((pure, always_inline));
  983. static inline u64 NPC_AF_MATCH_STATX(u64 a)
  984. {
  985. return 0x1880008 + 0x100 * a;
  986. }
  987. /**
  988. * Register (RVU_PF_BAR0) npc_af_mcam_bank#_hit#
  989. *
  990. * NPC AF MCAM Bank Hit Registers
  991. */
  992. union npc_af_mcam_bankx_hitx {
  993. u64 u;
  994. struct npc_af_mcam_bankx_hitx_s {
  995. u64 hit : 64;
  996. } s;
  997. /* struct npc_af_mcam_bankx_hitx_s cn; */
  998. };
  999. static inline u64 NPC_AF_MCAM_BANKX_HITX(u64 a, u64 b)
  1000. __attribute__ ((pure, always_inline));
  1001. static inline u64 NPC_AF_MCAM_BANKX_HITX(u64 a, u64 b)
  1002. {
  1003. return 0x1c80000 + 0x100 * a + 0x10 * b;
  1004. }
  1005. /**
  1006. * Register (RVU_PF_BAR0) npc_af_mcam_dbg
  1007. *
  1008. * NPC AF MCAM Debug Register This register contains information for the
  1009. * last packet/lookup for which debug is enabled by
  1010. * NPC_AF_DBG_CTL[INTF_DBG,LKUP_DBG].
  1011. */
  1012. union npc_af_mcam_dbg {
  1013. u64 u;
  1014. struct npc_af_mcam_dbg_s {
  1015. u64 hit_entry : 10;
  1016. u64 reserved_10_11 : 2;
  1017. u64 hit_bank : 2;
  1018. u64 reserved_14_15 : 2;
  1019. u64 miss : 1;
  1020. u64 reserved_17_63 : 47;
  1021. } s;
  1022. /* struct npc_af_mcam_dbg_s cn; */
  1023. };
  1024. static inline u64 NPC_AF_MCAM_DBG(void)
  1025. __attribute__ ((pure, always_inline));
  1026. static inline u64 NPC_AF_MCAM_DBG(void)
  1027. {
  1028. return 0x3001000;
  1029. }
  1030. /**
  1031. * Register (RVU_PF_BAR0) npc_af_mcam_scrub_ctl
  1032. *
  1033. * NPC AF MCAM Scrub Control Register
  1034. */
  1035. union npc_af_mcam_scrub_ctl {
  1036. u64 u;
  1037. struct npc_af_mcam_scrub_ctl_s {
  1038. u64 ena : 1;
  1039. u64 reserved_1_7 : 7;
  1040. u64 lp_dis : 1;
  1041. u64 reserved_9_15 : 7;
  1042. u64 toth : 4;
  1043. u64 reserved_20_63 : 44;
  1044. } s;
  1045. /* struct npc_af_mcam_scrub_ctl_s cn; */
  1046. };
  1047. static inline u64 NPC_AF_MCAM_SCRUB_CTL(void)
  1048. __attribute__ ((pure, always_inline));
  1049. static inline u64 NPC_AF_MCAM_SCRUB_CTL(void)
  1050. {
  1051. return 0xa0;
  1052. }
  1053. /**
  1054. * Register (RVU_PF_BAR0) npc_af_mcame#_bank#_action
  1055. *
  1056. * NPC AF MCAM Entry Bank Action Data Registers Specifies a packet's
  1057. * match action captured in NPC_RESULT_S[ACTION]. When an interface is
  1058. * configured to use the NPC_MCAM_KEY_X2_S search key format
  1059. * (NPC_AF_INTF()_KEX_CFG[KEYW] = NPC_MCAMKEYW_E::X2), *
  1060. * NPC_AF_MCAME()_BANK(0)_ACTION/_TAG_ACT/_STAT_ACT are used if the
  1061. * search key matches NPC_AF_MCAME()_BANK(0..1)_CAM()_W*. *
  1062. * NPC_AF_MCAME()_BANK(2)_ACTION/_TAG_ACT/_STAT_ACT are used if the
  1063. * search key matches NPC_AF_MCAME()_BANK(2..3)_CAM()_W*. *
  1064. * NPC_AF_MCAME()_BANK(1,3)_ACTION/_TAG_ACT/_STAT_ACT are not used. When
  1065. * an interface is configured to use the NPC_MCAM_KEY_X4_S search key
  1066. * format (NPC_AF_INTF()_KEX_CFG[KEYW] = NPC_MCAMKEYW_E::X4): *
  1067. * NPC_AF_MCAME()_BANK(0)_ACTION/_TAG_ACT/_STAT_ACT are used if the
  1068. * search key matches NPC_AF_MCAME()_BANK(0..3)_CAM()_W*. *
  1069. * NPC_AF_MCAME()_BANK(1..3)_ACTION/_TAG_ACT/_STAT_ACT are not used.
  1070. */
  1071. union npc_af_mcamex_bankx_action {
  1072. u64 u;
  1073. struct npc_af_mcamex_bankx_action_s {
  1074. u64 action : 64;
  1075. } s;
  1076. /* struct npc_af_mcamex_bankx_action_s cn; */
  1077. };
  1078. static inline u64 NPC_AF_MCAMEX_BANKX_ACTION(u64 a, u64 b)
  1079. __attribute__ ((pure, always_inline));
  1080. static inline u64 NPC_AF_MCAMEX_BANKX_ACTION(u64 a, u64 b)
  1081. {
  1082. return 0x1900000 + 0x100 * a + 0x10 * b;
  1083. }
  1084. /**
  1085. * Register (RVU_PF_BAR0) npc_af_mcame#_bank#_cam#_intf
  1086. *
  1087. * NPC AF MCAM Entry Bank CAM Data Interface Registers MCAM comparison
  1088. * ternary data interface word. The field values in
  1089. * NPC_AF_MCAME()_BANK()_CAM()_INTF, NPC_AF_MCAME()_BANK()_CAM()_W0 and
  1090. * NPC_AF_MCAME()_BANK()_CAM()_W1 are ternary, where each data bit of
  1091. * the search key matches as follows: _ [CAM(1)]\<n\>=0, [CAM(0)]\<n\>=0:
  1092. * Always match; search key data\<n\> don't care. _ [CAM(1)]\<n\>=0,
  1093. * [CAM(0)]\<n\>=1: Match when search key data\<n\> == 0. _
  1094. * [CAM(1)]\<n\>=1, [CAM(0)]\<n\>=0: Match when search key data\<n\> ==
  1095. * 1. _ [CAM(1)]\<n\>=1, [CAM(0)]\<n\>=1: Reserved. The reserved
  1096. * combination is not allowed. Hardware suppresses any write to CAM(0) or
  1097. * CAM(1) that would result in the reserved combination for any CAM bit.
  1098. * The reset value for all non-reserved fields in
  1099. * NPC_AF_MCAME()_BANK()_CAM()_INTF, NPC_AF_MCAME()_BANK()_CAM()_W0 and
  1100. * NPC_AF_MCAME()_BANK()_CAM()_W1 is all zeros for CAM(1) and all ones
  1101. * for CAM(0), matching a search key of all zeros. When an interface is
  1102. * configured to use the NPC_MCAM_KEY_X1_S search key format
  1103. * (NPC_AF_INTF()_KEX_CFG[KEYW] = NPC_MCAMKEYW_E::X1), the four banks of
  1104. * every MCAM entry are used as individual entries, each of which is
  1105. * independently compared with the search key as follows: _
  1106. * NPC_AF_MCAME()_BANK()_CAM()_INTF[INTF] corresponds to
  1107. * NPC_MCAM_KEY_X1_S[INTF]. _ NPC_AF_MCAME()_BANK()_CAM()_W0[MD]
  1108. * corresponds to NPC_MCAM_KEY_X1_S[KW0]. _
  1109. * NPC_AF_MCAME()_BANK()_CAM()_W1[MD] corresponds to
  1110. * NPC_MCAM_KEY_X1_S[KW1]. When an interface is configured to use the
  1111. * NPC_MCAM_KEY_X2_S search key format (NPC_AF_INTF()_KEX_CFG[KEYW] =
  1112. * NPC_MCAMKEYW_E::X2), banks 0-1 of every MCAM entry are used as one
  1113. * double-wide entry, banks 2-3 as a second double-wide entry, and each
  1114. * double-wide entry is independently compared with the search key as
  1115. * follows: _ NPC_AF_MCAME()_BANK(0,2)_CAM()_INTF[INTF] corresponds to
  1116. * NPC_MCAM_KEY_X2_S[INTF]. _ NPC_AF_MCAME()_BANK(0,2)_CAM()_W0[MD]
  1117. * corresponds to NPC_MCAM_KEY_X2_S[KW0]. _
  1118. * NPC_AF_MCAME()_BANK(0,2)_CAM()_W1[MD] corresponds to
  1119. * NPC_MCAM_KEY_X2_S[KW1]\<47:0\>. _
  1120. * NPC_AF_MCAME()_BANK(1,3)_CAM()_INTF[INTF] corresponds to
  1121. * NPC_MCAM_KEY_X2_S[INTF]. _
  1122. * NPC_AF_MCAME()_BANK(1,3)_CAM()_W0[MD]\<15:0\> corresponds to
  1123. * NPC_MCAM_KEY_X2_S[KW1]\<63:48\>. _
  1124. * NPC_AF_MCAME()_BANK(1,3)_CAM()_W0[MD]\<63:16\> corresponds to
  1125. * NPC_MCAM_KEY_X2_S[KW2]\<47:0\>. _
  1126. * NPC_AF_MCAME()_BANK(1,3)_CAM()_W1[MD]\<15:0\> corresponds to
  1127. * NPC_MCAM_KEY_X2_S[KW2]\<63:48\>. _
  1128. * NPC_AF_MCAME()_BANK(1,3)_CAM()_W1[MD]\<47:16\> corresponds to
  1129. * NPC_MCAM_KEY_X2_S[KW3]\<31:0\>. When an interface is configured to
  1130. * use the NPC_MCAM_KEY_X4_S search key format
  1131. * (NPC_AF_INTF()_KEX_CFG[KEYW] = NPC_MCAMKEYW_E::X4), the four banks of
  1132. * every MCAM entry are used as a single quad-wide entry that is compared
  1133. * with the search key as follows: _
  1134. * NPC_AF_MCAME()_BANK(0)_CAM()_INTF[INTF] corresponds to
  1135. * NPC_MCAM_KEY_X4_S[INTF]. _ NPC_AF_MCAME()_BANK(0)_CAM()_W0[MD]
  1136. * corresponds to NPC_MCAM_KEY_X4_S[KW0]. _
  1137. * NPC_AF_MCAME()_BANK(0)_CAM()_W1[MD] corresponds to
  1138. * NPC_MCAM_KEY_X4_S[KW1]\<47:0\>. _
  1139. * NPC_AF_MCAME()_BANK(1)_CAM()_INTF[INTF] corresponds to
  1140. * NPC_MCAM_KEY_X4_S[INTF]. _ NPC_AF_MCAME()_BANK(1)_CAM()_W0[MD]\<15:0\>
  1141. * corresponds to NPC_MCAM_KEY_X4_S[KW1]\<63:48\>. _
  1142. * NPC_AF_MCAME()_BANK(1)_CAM()_W0[MD]\<63:16\> corresponds to
  1143. * NPC_MCAM_KEY_X4_S[KW2]\<47:0\>. _
  1144. * NPC_AF_MCAME()_BANK(1)_CAM()_W1[MD]\<15:0\> corresponds to
  1145. * NPC_MCAM_KEY_X4_S[KW2]\<63:48\>. _
  1146. * NPC_AF_MCAME()_BANK(1)_CAM()_W1[MD]\<47:16\> corresponds to
  1147. * NPC_MCAM_KEY_X4_S[KW3]\<31:0\>. _
  1148. * NPC_AF_MCAME()_BANK(2)_CAM()_INTF[INTF] corresponds to
  1149. * NPC_MCAM_KEY_X4_S[INTF]. _ NPC_AF_MCAME()_BANK(2)_CAM()_W0[MD]\<31:0\>
  1150. * corresponds to NPC_MCAM_KEY_X4_S[KW3]\<63:32\>. _
  1151. * NPC_AF_MCAME()_BANK(2)_CAM()_W0[MD]\<63:32\> corresponds to
  1152. * NPC_MCAM_KEY_X4_S[KW4]\<31:0\>. _
  1153. * NPC_AF_MCAME()_BANK(2)_CAM()_W1[MD]\<31:0\> corresponds to
  1154. * NPC_MCAM_KEY_X4_S[KW4]\<63:32\>. _
  1155. * NPC_AF_MCAME()_BANK(2)_CAM()_W1[MD]\<47:32\> corresponds to
  1156. * NPC_MCAM_KEY_X4_S[KW5]\<15:0\>. _
  1157. * NPC_AF_MCAME()_BANK(3)_CAM()_INTF[INTF] corresponds to
  1158. * NPC_MCAM_KEY_X4_S[INTF]. _ NPC_AF_MCAME()_BANK(3)_CAM()_W0[MD]\<47:0\>
  1159. * corresponds to NPC_MCAM_KEY_X4_S[KW5]\<63:16\>. _
  1160. * NPC_AF_MCAME()_BANK(3)_CAM()_W0[MD]\<63:48\> corresponds to
  1161. * NPC_MCAM_KEY_X4_S[KW6]\<15:0\>. _ NPC_AF_MCAME()_BANK(3)_CAM()_W1[MD]
  1162. * corresponds to NPC_MCAM_KEY_X4_S[KW6]\<63:16\>. Note that for the X2
  1163. * and X4 formats, a wide entry will not match unless the INTF fields
  1164. * from the associated two or four banks match the INTF value from the
  1165. * search key. For the X1 and X2 formats, a match in a lower-numbered
  1166. * bank takes priority over a match in any higher numbered banks. Within
  1167. * each bank, the lowest numbered matching entry takes priority over any
  1168. * higher numbered entry.
  1169. */
  1170. union npc_af_mcamex_bankx_camx_intf {
  1171. u64 u;
  1172. struct npc_af_mcamex_bankx_camx_intf_s {
  1173. u64 intf : 2;
  1174. u64 reserved_2_63 : 62;
  1175. } s;
  1176. /* struct npc_af_mcamex_bankx_camx_intf_s cn; */
  1177. };
  1178. static inline u64 NPC_AF_MCAMEX_BANKX_CAMX_INTF(u64 a, u64 b, u64 c)
  1179. __attribute__ ((pure, always_inline));
  1180. static inline u64 NPC_AF_MCAMEX_BANKX_CAMX_INTF(u64 a, u64 b, u64 c)
  1181. {
  1182. return 0x1000000 + 0x400 * a + 0x40 * b + 8 * c;
  1183. }
  1184. /**
  1185. * Register (RVU_PF_BAR0) npc_af_mcame#_bank#_cam#_w0
  1186. *
  1187. * NPC AF MCAM Entry Bank CAM Data Word 0 Registers MCAM comparison
  1188. * ternary data word 0. See NPC_AF_MCAME()_BANK()_CAM()_INTF.
  1189. */
  1190. union npc_af_mcamex_bankx_camx_w0 {
  1191. u64 u;
  1192. struct npc_af_mcamex_bankx_camx_w0_s {
  1193. u64 md : 64;
  1194. } s;
  1195. /* struct npc_af_mcamex_bankx_camx_w0_s cn; */
  1196. };
  1197. static inline u64 NPC_AF_MCAMEX_BANKX_CAMX_W0(u64 a, u64 b, u64 c)
  1198. __attribute__ ((pure, always_inline));
  1199. static inline u64 NPC_AF_MCAMEX_BANKX_CAMX_W0(u64 a, u64 b, u64 c)
  1200. {
  1201. return 0x1000010 + 0x400 * a + 0x40 * b + 8 * c;
  1202. }
  1203. /**
  1204. * Register (RVU_PF_BAR0) npc_af_mcame#_bank#_cam#_w1
  1205. *
  1206. * NPC AF MCAM Entry Bank Data Word 1 Registers MCAM comparison ternary
  1207. * data word 1. See NPC_AF_MCAME()_BANK()_CAM()_INTF.
  1208. */
  1209. union npc_af_mcamex_bankx_camx_w1 {
  1210. u64 u;
  1211. struct npc_af_mcamex_bankx_camx_w1_s {
  1212. u64 md : 48;
  1213. u64 reserved_48_63 : 16;
  1214. } s;
  1215. /* struct npc_af_mcamex_bankx_camx_w1_s cn; */
  1216. };
  1217. static inline u64 NPC_AF_MCAMEX_BANKX_CAMX_W1(u64 a, u64 b, u64 c)
  1218. __attribute__ ((pure, always_inline));
  1219. static inline u64 NPC_AF_MCAMEX_BANKX_CAMX_W1(u64 a, u64 b, u64 c)
  1220. {
  1221. return 0x1000020 + 0x400 * a + 0x40 * b + 8 * c;
  1222. }
  1223. /**
  1224. * Register (RVU_PF_BAR0) npc_af_mcame#_bank#_cfg
  1225. *
  1226. * NPC AF MCAM Entry Bank Configuration Registers
  1227. */
  1228. union npc_af_mcamex_bankx_cfg {
  1229. u64 u;
  1230. struct npc_af_mcamex_bankx_cfg_s {
  1231. u64 ena : 1;
  1232. u64 reserved_1_63 : 63;
  1233. } s;
  1234. /* struct npc_af_mcamex_bankx_cfg_s cn; */
  1235. };
  1236. static inline u64 NPC_AF_MCAMEX_BANKX_CFG(u64 a, u64 b)
  1237. __attribute__ ((pure, always_inline));
  1238. static inline u64 NPC_AF_MCAMEX_BANKX_CFG(u64 a, u64 b)
  1239. {
  1240. return 0x1800000 + 0x100 * a + 0x10 * b;
  1241. }
  1242. /**
  1243. * Register (RVU_PF_BAR0) npc_af_mcame#_bank#_stat_act
  1244. *
  1245. * NPC AF MCAM Entry Bank Statistics Action Registers Used to optionally
  1246. * increment a NPC_AF_MATCH_STAT() counter when a packet matches an MCAM
  1247. * entry. See also NPC_AF_MCAME()_BANK()_ACTION.
  1248. */
  1249. union npc_af_mcamex_bankx_stat_act {
  1250. u64 u;
  1251. struct npc_af_mcamex_bankx_stat_act_s {
  1252. u64 stat_sel : 9;
  1253. u64 ena : 1;
  1254. u64 reserved_10_63 : 54;
  1255. } s;
  1256. /* struct npc_af_mcamex_bankx_stat_act_s cn; */
  1257. };
  1258. static inline u64 NPC_AF_MCAMEX_BANKX_STAT_ACT(u64 a, u64 b)
  1259. __attribute__ ((pure, always_inline));
  1260. static inline u64 NPC_AF_MCAMEX_BANKX_STAT_ACT(u64 a, u64 b)
  1261. {
  1262. return 0x1880000 + 0x100 * a + 0x10 * b;
  1263. }
  1264. /**
  1265. * Register (RVU_PF_BAR0) npc_af_mcame#_bank#_tag_act
  1266. *
  1267. * NPC AF MCAM Entry Bank VTag Action Data Registers Specifies a packet's
  1268. * match Vtag action captured in NPC_RESULT_S[VTAG_ACTION]. See also
  1269. * NPC_AF_MCAME()_BANK()_ACTION.
  1270. */
  1271. union npc_af_mcamex_bankx_tag_act {
  1272. u64 u;
  1273. struct npc_af_mcamex_bankx_tag_act_s {
  1274. u64 vtag_action : 64;
  1275. } s;
  1276. /* struct npc_af_mcamex_bankx_tag_act_s cn; */
  1277. };
  1278. static inline u64 NPC_AF_MCAMEX_BANKX_TAG_ACT(u64 a, u64 b)
  1279. __attribute__ ((pure, always_inline));
  1280. static inline u64 NPC_AF_MCAMEX_BANKX_TAG_ACT(u64 a, u64 b)
  1281. {
  1282. return 0x1900008 + 0x100 * a + 0x10 * b;
  1283. }
  1284. /**
  1285. * Register (RVU_PF_BAR0) npc_af_pck_cfg
  1286. *
  1287. * NPC AF Protocol Check Configuration Register
  1288. */
  1289. union npc_af_pck_cfg {
  1290. u64 u;
  1291. struct npc_af_pck_cfg_s {
  1292. u64 reserved_0 : 1;
  1293. u64 iip4_cksum : 1;
  1294. u64 oip4_cksum : 1;
  1295. u64 reserved_3 : 1;
  1296. u64 l3b : 1;
  1297. u64 l3m : 1;
  1298. u64 l2b : 1;
  1299. u64 l2m : 1;
  1300. u64 reserved_8_23 : 16;
  1301. u64 iip4_cksum_errcode : 8;
  1302. u64 oip4_cksum_errcode : 8;
  1303. u64 reserved_40_63 : 24;
  1304. } s;
  1305. /* struct npc_af_pck_cfg_s cn; */
  1306. };
  1307. static inline u64 NPC_AF_PCK_CFG(void)
  1308. __attribute__ ((pure, always_inline));
  1309. static inline u64 NPC_AF_PCK_CFG(void)
  1310. {
  1311. return 0x600;
  1312. }
  1313. /**
  1314. * Register (RVU_PF_BAR0) npc_af_pck_def_iip4
  1315. *
  1316. * NPC AF Protocol Check Inner IPv4 Definition Register Provides layer
  1317. * information used by the protocol checker to identify an inner IPv4
  1318. * header.
  1319. */
  1320. union npc_af_pck_def_iip4 {
  1321. u64 u;
  1322. struct npc_af_pck_def_iip4_s {
  1323. u64 ltype_mask : 4;
  1324. u64 ltype_match : 4;
  1325. u64 lid : 3;
  1326. u64 reserved_11_63 : 53;
  1327. } s;
  1328. /* struct npc_af_pck_def_iip4_s cn; */
  1329. };
  1330. static inline u64 NPC_AF_PCK_DEF_IIP4(void)
  1331. __attribute__ ((pure, always_inline));
  1332. static inline u64 NPC_AF_PCK_DEF_IIP4(void)
  1333. {
  1334. return 0x640;
  1335. }
  1336. /**
  1337. * Register (RVU_PF_BAR0) npc_af_pck_def_oip4
  1338. *
  1339. * NPC AF Protocol Check Outer IPv4 Definition Register Provides layer
  1340. * information used by the protocol checker to identify an outer IPv4
  1341. * header.
  1342. */
  1343. union npc_af_pck_def_oip4 {
  1344. u64 u;
  1345. struct npc_af_pck_def_oip4_s {
  1346. u64 ltype_mask : 4;
  1347. u64 ltype_match : 4;
  1348. u64 lid : 3;
  1349. u64 reserved_11_63 : 53;
  1350. } s;
  1351. /* struct npc_af_pck_def_oip4_s cn; */
  1352. };
  1353. static inline u64 NPC_AF_PCK_DEF_OIP4(void)
  1354. __attribute__ ((pure, always_inline));
  1355. static inline u64 NPC_AF_PCK_DEF_OIP4(void)
  1356. {
  1357. return 0x620;
  1358. }
  1359. /**
  1360. * Register (RVU_PF_BAR0) npc_af_pck_def_oip6
  1361. *
  1362. * NPC AF Protocol Check Outer IPv6 Definition Register Provides layer
  1363. * information used by the protocol checker to identify an outer IPv6
  1364. * header. [LID] must have the same value as NPC_AF_PCK_DEF_OIP4[LID].
  1365. */
  1366. union npc_af_pck_def_oip6 {
  1367. u64 u;
  1368. struct npc_af_pck_def_oip6_s {
  1369. u64 ltype_mask : 4;
  1370. u64 ltype_match : 4;
  1371. u64 lid : 3;
  1372. u64 reserved_11_63 : 53;
  1373. } s;
  1374. /* struct npc_af_pck_def_oip6_s cn; */
  1375. };
  1376. static inline u64 NPC_AF_PCK_DEF_OIP6(void)
  1377. __attribute__ ((pure, always_inline));
  1378. static inline u64 NPC_AF_PCK_DEF_OIP6(void)
  1379. {
  1380. return 0x630;
  1381. }
  1382. /**
  1383. * Register (RVU_PF_BAR0) npc_af_pck_def_ol2
  1384. *
  1385. * NPC AF Protocol Check Outer L2 Definition Register Provides layer
  1386. * information used by the protocol checker to identify an outer L2
  1387. * header.
  1388. */
  1389. union npc_af_pck_def_ol2 {
  1390. u64 u;
  1391. struct npc_af_pck_def_ol2_s {
  1392. u64 ltype_mask : 4;
  1393. u64 ltype_match : 4;
  1394. u64 lid : 3;
  1395. u64 reserved_11_63 : 53;
  1396. } s;
  1397. /* struct npc_af_pck_def_ol2_s cn; */
  1398. };
  1399. static inline u64 NPC_AF_PCK_DEF_OL2(void)
  1400. __attribute__ ((pure, always_inline));
  1401. static inline u64 NPC_AF_PCK_DEF_OL2(void)
  1402. {
  1403. return 0x610;
  1404. }
  1405. /**
  1406. * Register (RVU_PF_BAR0) npc_af_pkind#_action0
  1407. *
  1408. * NPC AF Port Kind Action Data 0 Registers NPC_AF_PKIND()_ACTION0 and
  1409. * NPC_AF_PKIND()_ACTION1 specify the initial parse state and operations
  1410. * to perform before entering KPU 0.
  1411. */
  1412. union npc_af_pkindx_action0 {
  1413. u64 u;
  1414. struct npc_af_pkindx_action0_s {
  1415. u64 var_len_shift : 3;
  1416. u64 var_len_right : 1;
  1417. u64 var_len_mask : 8;
  1418. u64 var_len_offset : 8;
  1419. u64 ptr_advance : 8;
  1420. u64 capture_flags : 8;
  1421. u64 capture_ltype : 4;
  1422. u64 capture_lid : 3;
  1423. u64 reserved_43 : 1;
  1424. u64 next_state : 8;
  1425. u64 parse_done : 1;
  1426. u64 capture_ena : 1;
  1427. u64 byp_count : 3;
  1428. u64 reserved_57_63 : 7;
  1429. } s;
  1430. /* struct npc_af_pkindx_action0_s cn; */
  1431. };
  1432. static inline u64 NPC_AF_PKINDX_ACTION0(u64 a)
  1433. __attribute__ ((pure, always_inline));
  1434. static inline u64 NPC_AF_PKINDX_ACTION0(u64 a)
  1435. {
  1436. return 0x80000 + 0x40 * a;
  1437. }
  1438. /**
  1439. * Register (RVU_PF_BAR0) npc_af_pkind#_action1
  1440. *
  1441. * NPC AF Port Kind Action Data 1 Registers NPC_AF_PKIND()_ACTION0 and
  1442. * NPC_AF_PKIND()_ACTION1 specify the initial parse state and operations
  1443. * to perform before entering KPU 0.
  1444. */
  1445. union npc_af_pkindx_action1 {
  1446. u64 u;
  1447. struct npc_af_pkindx_action1_s {
  1448. u64 dp0_offset : 8;
  1449. u64 dp1_offset : 8;
  1450. u64 dp2_offset : 8;
  1451. u64 errcode : 8;
  1452. u64 errlev : 4;
  1453. u64 reserved_36_63 : 28;
  1454. } s;
  1455. /* struct npc_af_pkindx_action1_s cn; */
  1456. };
  1457. static inline u64 NPC_AF_PKINDX_ACTION1(u64 a)
  1458. __attribute__ ((pure, always_inline));
  1459. static inline u64 NPC_AF_PKINDX_ACTION1(u64 a)
  1460. {
  1461. return 0x80008 + 0x40 * a;
  1462. }
  1463. /**
  1464. * Register (RVU_PF_BAR0) npc_af_pkind#_cpi_def#
  1465. *
  1466. * NPC AF Port Kind Channel Parse Index Definition Registers These
  1467. * registers specify the layer information and algorithm to compute a
  1468. * packet's channel parse index (CPI), which provides a port to channel
  1469. * adder for calculating NPC_RESULT_S[CHAN]. There are two CPI
  1470. * definitions per port kind, allowing the CPI computation to use two
  1471. * possible layer definitions in the parsed packet, e.g. DiffServ DSCP
  1472. * from either IPv4 or IPv6 header. CPI pseudocode: \<pre\> for (i = 0;
  1473. * i \< 2; i++) { cpi_def = NPC_AF_PKIND()_CPI_DEF(i); LX = LA, LB,
  1474. * ..., or LH as selected by cpi_def[LID]; if (cpi_def[ENA] &&
  1475. * ((cpi_def[LTYPE_MATCH] & cpi_def[LTYPE_MASK]) ==
  1476. * (NPC_RESULT_S[LX[LTYPE]] & cpi_def[LTYPE_MASK])) &&
  1477. * ((cpi_def[FLAGS_MATCH] & cpi_def[FLAGS_MASK]) ==
  1478. * (NPC_RESULT_S[LX[FLAGS]] & cpi_def[FLAGS_MASK]))) { // Found
  1479. * matching layer nibble_offset = (2*NPC_RESULT_S[LX[LPTR]]) +
  1480. * cpi_def[ADD_OFFSET]; add_byte = byte at nibble_offset from start
  1481. * of packet; cpi_add = (add_byte & cpi_def[ADD_MASK]) \>\>
  1482. * cpi_def[ADD_SHIFT]; cpi = cpi_def[CPI_BASE] + cpi_add;
  1483. * NPC_RESULT_S[CHAN] += NPC_AF_CPI(cpi)_CFG[PADD]; break; } }
  1484. * \</pre\>
  1485. */
  1486. union npc_af_pkindx_cpi_defx {
  1487. u64 u;
  1488. struct npc_af_pkindx_cpi_defx_s {
  1489. u64 cpi_base : 10;
  1490. u64 reserved_10_11 : 2;
  1491. u64 add_shift : 3;
  1492. u64 reserved_15 : 1;
  1493. u64 add_mask : 8;
  1494. u64 add_offset : 8;
  1495. u64 flags_mask : 8;
  1496. u64 flags_match : 8;
  1497. u64 ltype_mask : 4;
  1498. u64 ltype_match : 4;
  1499. u64 lid : 3;
  1500. u64 reserved_59_62 : 4;
  1501. u64 ena : 1;
  1502. } s;
  1503. /* struct npc_af_pkindx_cpi_defx_s cn; */
  1504. };
  1505. static inline u64 NPC_AF_PKINDX_CPI_DEFX(u64 a, u64 b)
  1506. __attribute__ ((pure, always_inline));
  1507. static inline u64 NPC_AF_PKINDX_CPI_DEFX(u64 a, u64 b)
  1508. {
  1509. return 0x80020 + 0x40 * a + 8 * b;
  1510. }
  1511. #endif /* __CSRS_NPC_H__ */