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