| 1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
| 2 |
/* Marvell RVU Admin Function driver |
| 3 |
* |
| 4 |
* Copyright (C) 2024 Marvell. |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
#ifndef STRUCT_H |
| 9 |
#define STRUCT_H |
| 10 |
|
| 11 |
#define NIX_MAX_CTX_SIZE 128 |
| 12 |
|
| 13 |
/* |
| 14 |
* CN20k RVU PF MBOX Interrupt Vector Enumeration |
| 15 |
* |
| 16 |
* Vectors 0 - 3 are compatible with pre cn20k and hence |
| 17 |
* existing macros are being reused. |
| 18 |
*/ |
| 19 |
enum rvu_mbox_pf_int_vec_e { |
| 20 |
RVU_MBOX_PF_INT_VEC_VFPF_MBOX0 = 0x4, |
| 21 |
RVU_MBOX_PF_INT_VEC_VFPF_MBOX1 = 0x5, |
| 22 |
RVU_MBOX_PF_INT_VEC_VFPF1_MBOX0 = 0x6, |
| 23 |
RVU_MBOX_PF_INT_VEC_VFPF1_MBOX1 = 0x7, |
| 24 |
RVU_MBOX_PF_INT_VEC_AFPF_MBOX = 0x8, |
| 25 |
RVU_MBOX_PF_INT_VEC_CNT = 0x9, |
| 26 |
}; |
| 27 |
|
| 28 |
/* RVU Admin function Interrupt Vector Enumeration */ |
| 29 |
enum rvu_af_cn20k_int_vec_e { |
| 30 |
RVU_AF_CN20K_INT_VEC_POISON = 0x0, |
| 31 |
RVU_AF_CN20K_INT_VEC_PFFLR0 = 0x1, |
| 32 |
RVU_AF_CN20K_INT_VEC_PFFLR1 = 0x2, |
| 33 |
RVU_AF_CN20K_INT_VEC_PFME0 = 0x3, |
| 34 |
RVU_AF_CN20K_INT_VEC_PFME1 = 0x4, |
| 35 |
RVU_AF_CN20K_INT_VEC_GEN = 0x5, |
| 36 |
RVU_AF_CN20K_INT_VEC_PFAF_MBOX0 = 0x6, |
| 37 |
RVU_AF_CN20K_INT_VEC_PFAF_MBOX1 = 0x7, |
| 38 |
RVU_AF_CN20K_INT_VEC_PFAF1_MBOX0 = 0x8, |
| 39 |
RVU_AF_CN20K_INT_VEC_PFAF1_MBOX1 = 0x9, |
| 40 |
RVU_AF_CN20K_INT_VEC_CNT = 0xa, |
| 41 |
}; |
| 42 |
|
| 43 |
struct nix_cn20k_sq_ctx_s { |
| 44 |
u64 ena : 1; /* W0 */ |
| 45 |
u64 qint_idx : 6; |
| 46 |
u64 substream : 20; |
| 47 |
u64 sdp_mcast : 1; |
| 48 |
u64 cq : 20; |
| 49 |
u64 sqe_way_mask : 16; |
| 50 |
u64 smq : 11; /* W1 */ |
| 51 |
u64 cq_ena : 1; |
| 52 |
u64 xoff : 1; |
| 53 |
u64 sso_ena : 1; |
| 54 |
u64 smq_rr_weight : 14; |
| 55 |
u64 default_chan : 12; |
| 56 |
u64 sqb_count : 16; |
| 57 |
u64 reserved_120_120 : 1; |
| 58 |
u64 smq_rr_count_lb : 7; |
| 59 |
u64 smq_rr_count_ub : 25; /* W2 */ |
| 60 |
u64 sqb_aura : 20; |
| 61 |
u64 sq_int : 8; |
| 62 |
u64 sq_int_ena : 8; |
| 63 |
u64 sqe_stype : 2; |
| 64 |
u64 reserved_191_191 : 1; |
| 65 |
u64 max_sqe_size : 2; /* W3 */ |
| 66 |
u64 cq_limit : 8; |
| 67 |
u64 lmt_dis : 1; |
| 68 |
u64 mnq_dis : 1; |
| 69 |
u64 smq_next_sq : 20; |
| 70 |
u64 smq_lso_segnum : 8; |
| 71 |
u64 tail_offset : 6; |
| 72 |
u64 smenq_offset : 6; |
| 73 |
u64 head_offset : 6; |
| 74 |
u64 smenq_next_sqb_vld : 1; |
| 75 |
u64 smq_pend : 1; |
| 76 |
u64 smq_next_sq_vld : 1; |
| 77 |
u64 reserved_253_255 : 3; |
| 78 |
u64 next_sqb : 64; /* W4 */ |
| 79 |
u64 tail_sqb : 64; /* W5 */ |
| 80 |
u64 smenq_sqb : 64; /* W6 */ |
| 81 |
u64 smenq_next_sqb : 64; /* W7 */ |
| 82 |
u64 head_sqb : 64; /* W8 */ |
| 83 |
u64 reserved_576_583 : 8; /* W9 */ |
| 84 |
u64 vfi_lso_total : 18; |
| 85 |
u64 vfi_lso_sizem1 : 3; |
| 86 |
u64 vfi_lso_sb : 8; |
| 87 |
u64 vfi_lso_mps : 14; |
| 88 |
u64 vfi_lso_vlan0_ins_ena : 1; |
| 89 |
u64 vfi_lso_vlan1_ins_ena : 1; |
| 90 |
u64 vfi_lso_vld : 1; |
| 91 |
u64 reserved_630_639 : 10; |
| 92 |
u64 scm_lso_rem : 18; /* W10 */ |
| 93 |
u64 reserved_658_703 : 46; |
| 94 |
u64 octs : 48; /* W11 */ |
| 95 |
u64 reserved_752_767 : 16; |
| 96 |
u64 pkts : 48; /* W12 */ |
| 97 |
u64 reserved_816_831 : 16; |
| 98 |
u64 aged_drop_octs : 32; /* W13 */ |
| 99 |
u64 aged_drop_pkts : 32; |
| 100 |
u64 dropped_octs : 48; /* W14 */ |
| 101 |
u64 reserved_944_959 : 16; |
| 102 |
u64 dropped_pkts : 48; /* W15 */ |
| 103 |
u64 reserved_1008_1023 : 16; |
| 104 |
}; |
| 105 |
|
| 106 |
static_assert(sizeof(struct nix_cn20k_sq_ctx_s) == NIX_MAX_CTX_SIZE); |
| 107 |
|
| 108 |
struct nix_cn20k_cq_ctx_s { |
| 109 |
u64 base : 64; /* W0 */ |
| 110 |
u64 lbp_ena : 1; /* W1 */ |
| 111 |
u64 lbpid_low : 3; |
| 112 |
u64 bp_ena : 1; |
| 113 |
u64 lbpid_med : 3; |
| 114 |
u64 bpid : 9; |
| 115 |
u64 lbpid_high : 3; |
| 116 |
u64 qint_idx : 7; |
| 117 |
u64 cq_err : 1; |
| 118 |
u64 cint_idx : 7; |
| 119 |
u64 avg_con : 9; |
| 120 |
u64 wrptr : 20; |
| 121 |
u64 tail : 20; /* W2 */ |
| 122 |
u64 head : 20; |
| 123 |
u64 avg_level : 8; |
| 124 |
u64 update_time : 16; |
| 125 |
u64 bp : 8; /* W3 */ |
| 126 |
u64 drop : 8; |
| 127 |
u64 drop_ena : 1; |
| 128 |
u64 ena : 1; |
| 129 |
u64 cpt_drop_err_en : 1; |
| 130 |
u64 reserved_211_211 : 1; |
| 131 |
u64 msh_dst : 11; |
| 132 |
u64 msh_valid : 1; |
| 133 |
u64 stash_thresh : 4; |
| 134 |
u64 lbp_frac : 4; |
| 135 |
u64 caching : 1; |
| 136 |
u64 stashing : 1; |
| 137 |
u64 reserved_234_235 : 2; |
| 138 |
u64 qsize : 4; |
| 139 |
u64 cq_err_int : 8; |
| 140 |
u64 cq_err_int_ena : 8; |
| 141 |
u64 bpid_ext : 2; /* W4 */ |
| 142 |
u64 reserved_258_259 : 2; |
| 143 |
u64 lbpid_ext : 2; |
| 144 |
u64 reserved_262_319 : 58; |
| 145 |
u64 reserved_320_383 : 64; /* W5 */ |
| 146 |
u64 reserved_384_447 : 64; /* W6 */ |
| 147 |
u64 reserved_448_511 : 64; /* W7 */ |
| 148 |
u64 padding[8]; |
| 149 |
}; |
| 150 |
|
| 151 |
static_assert(sizeof(struct nix_cn20k_sq_ctx_s) == NIX_MAX_CTX_SIZE); |
| 152 |
|
| 153 |
struct nix_cn20k_rq_ctx_s { |
| 154 |
u64 ena : 1; |
| 155 |
u64 sso_ena : 1; |
| 156 |
u64 ipsech_ena : 1; |
| 157 |
u64 ena_wqwd : 1; |
| 158 |
u64 cq : 20; |
| 159 |
u64 reserved_24_34 : 11; |
| 160 |
u64 port_il4_dis : 1; |
| 161 |
u64 port_ol4_dis : 1; |
| 162 |
u64 lenerr_dis : 1; |
| 163 |
u64 csum_il4_dis : 1; |
| 164 |
u64 csum_ol4_dis : 1; |
| 165 |
u64 len_il4_dis : 1; |
| 166 |
u64 len_il3_dis : 1; |
| 167 |
u64 len_ol4_dis : 1; |
| 168 |
u64 len_ol3_dis : 1; |
| 169 |
u64 wqe_aura : 20; |
| 170 |
u64 spb_aura : 20; |
| 171 |
u64 lpb_aura : 20; |
| 172 |
u64 sso_grp : 10; |
| 173 |
u64 sso_tt : 2; |
| 174 |
u64 pb_caching : 2; |
| 175 |
u64 wqe_caching : 1; |
| 176 |
u64 xqe_drop_ena : 1; |
| 177 |
u64 spb_drop_ena : 1; |
| 178 |
u64 lpb_drop_ena : 1; |
| 179 |
u64 pb_stashing : 1; |
| 180 |
u64 ipsecd_drop_en : 1; |
| 181 |
u64 chi_ena : 1; |
| 182 |
u64 reserved_125_127 : 3; |
| 183 |
u64 band_prof_id_l : 10; |
| 184 |
u64 sso_fc_ena : 1; |
| 185 |
u64 policer_ena : 1; |
| 186 |
u64 spb_sizem1 : 6; |
| 187 |
u64 wqe_skip : 2; |
| 188 |
u64 spb_high_sizem1 : 3; |
| 189 |
u64 spb_ena : 1; |
| 190 |
u64 lpb_sizem1 : 12; |
| 191 |
u64 first_skip : 7; |
| 192 |
u64 reserved_171_171 : 1; |
| 193 |
u64 later_skip : 6; |
| 194 |
u64 xqe_imm_size : 6; |
| 195 |
u64 band_prof_id_h : 4; |
| 196 |
u64 reserved_188_189 : 2; |
| 197 |
u64 xqe_imm_copy : 1; |
| 198 |
u64 xqe_hdr_split : 1; |
| 199 |
u64 xqe_drop : 8; |
| 200 |
u64 xqe_pass : 8; |
| 201 |
u64 wqe_pool_drop : 8; |
| 202 |
u64 wqe_pool_pass : 8; |
| 203 |
u64 spb_aura_drop : 8; |
| 204 |
u64 spb_aura_pass : 8; |
| 205 |
u64 spb_pool_drop : 8; |
| 206 |
u64 spb_pool_pass : 8; |
| 207 |
u64 lpb_aura_drop : 8; |
| 208 |
u64 lpb_aura_pass : 8; |
| 209 |
u64 lpb_pool_drop : 8; |
| 210 |
u64 lpb_pool_pass : 8; |
| 211 |
u64 reserved_288_291 : 4; |
| 212 |
u64 rq_int : 8; |
| 213 |
u64 rq_int_ena : 8; |
| 214 |
u64 qint_idx : 7; |
| 215 |
u64 reserved_315_319 : 5; |
| 216 |
u64 ltag : 24; |
| 217 |
u64 good_utag : 8; |
| 218 |
u64 bad_utag : 8; |
| 219 |
u64 flow_tagw : 6; |
| 220 |
u64 ipsec_vwqe : 1; |
| 221 |
u64 vwqe_ena : 1; |
| 222 |
u64 vtime_wait : 8; |
| 223 |
u64 max_vsize_exp : 4; |
| 224 |
u64 vwqe_skip : 2; |
| 225 |
u64 reserved_382_383 : 2; |
| 226 |
u64 octs : 48; |
| 227 |
u64 reserved_432_447 : 16; |
| 228 |
u64 pkts : 48; |
| 229 |
u64 reserved_496_511 : 16; |
| 230 |
u64 drop_octs : 48; |
| 231 |
u64 reserved_560_575 : 16; |
| 232 |
u64 drop_pkts : 48; |
| 233 |
u64 reserved_624_639 : 16; |
| 234 |
u64 re_pkts : 48; |
| 235 |
u64 reserved_688_703 : 16; |
| 236 |
u64 reserved_704_767 : 64; |
| 237 |
u64 reserved_768_831 : 64; |
| 238 |
u64 reserved_832_895 : 64; |
| 239 |
u64 reserved_896_959 : 64; |
| 240 |
u64 reserved_960_1023 : 64; |
| 241 |
}; |
| 242 |
|
| 243 |
static_assert(sizeof(struct nix_cn20k_rq_ctx_s) == NIX_MAX_CTX_SIZE); |
| 244 |
|
| 245 |
struct npa_cn20k_aura_s { |
| 246 |
u64 pool_addr; /* W0 */ |
| 247 |
u64 ena : 1; /* W1 */ |
| 248 |
u64 reserved_65 : 2; |
| 249 |
u64 pool_caching : 1; |
| 250 |
u64 reserved_68 : 16; |
| 251 |
u64 avg_con : 9; |
| 252 |
u64 reserved_93 : 1; |
| 253 |
u64 pool_drop_ena : 1; |
| 254 |
u64 aura_drop_ena : 1; |
| 255 |
u64 bp_ena : 1; |
| 256 |
u64 reserved_97_103 : 7; |
| 257 |
u64 aura_drop : 8; |
| 258 |
u64 shift : 6; |
| 259 |
u64 reserved_118_119 : 2; |
| 260 |
u64 avg_level : 8; |
| 261 |
u64 count : 36; /* W2 */ |
| 262 |
u64 reserved_164_167 : 4; |
| 263 |
u64 bpid : 12; |
| 264 |
u64 reserved_180_191 : 12; |
| 265 |
u64 limit : 36; /* W3 */ |
| 266 |
u64 reserved_228_231 : 4; |
| 267 |
u64 bp : 7; |
| 268 |
u64 reserved_239_243 : 5; |
| 269 |
u64 fc_ena : 1; |
| 270 |
u64 fc_up_crossing : 1; |
| 271 |
u64 fc_stype : 2; |
| 272 |
u64 fc_hyst_bits : 4; |
| 273 |
u64 reserved_252_255 : 4; |
| 274 |
u64 fc_addr; /* W4 */ |
| 275 |
u64 pool_drop : 8; /* W5 */ |
| 276 |
u64 update_time : 16; |
| 277 |
u64 err_int : 8; |
| 278 |
u64 err_int_ena : 8; |
| 279 |
u64 thresh_int : 1; |
| 280 |
u64 thresh_int_ena : 1; |
| 281 |
u64 thresh_up : 1; |
| 282 |
u64 reserved_363 : 1; |
| 283 |
u64 thresh_qint_idx : 7; |
| 284 |
u64 reserved_371 : 1; |
| 285 |
u64 err_qint_idx : 7; |
| 286 |
u64 reserved_379_383 : 5; |
| 287 |
u64 thresh : 36; /* W6*/ |
| 288 |
u64 rsvd_423_420 : 4; |
| 289 |
u64 fc_msh_dst : 11; |
| 290 |
u64 reserved_435_438 : 4; |
| 291 |
u64 op_dpc_ena : 1; |
| 292 |
u64 op_dpc_set : 5; |
| 293 |
u64 reserved_445_445 : 1; |
| 294 |
u64 stream_ctx : 1; |
| 295 |
u64 unified_ctx : 1; |
| 296 |
u64 reserved_448_511; /* W7 */ |
| 297 |
u64 padding[8]; |
| 298 |
}; |
| 299 |
|
| 300 |
static_assert(sizeof(struct npa_cn20k_aura_s) == NIX_MAX_CTX_SIZE); |
| 301 |
|
| 302 |
struct npa_cn20k_pool_s { |
| 303 |
u64 stack_base; /* W0 */ |
| 304 |
u64 ena : 1; |
| 305 |
u64 nat_align : 1; |
| 306 |
u64 reserved_66_67 : 2; |
| 307 |
u64 stack_caching : 1; |
| 308 |
u64 reserved_69_87 : 19; |
| 309 |
u64 buf_offset : 12; |
| 310 |
u64 reserved_100_103 : 4; |
| 311 |
u64 buf_size : 12; |
| 312 |
u64 reserved_116_119 : 4; |
| 313 |
u64 ref_cnt_prof : 3; |
| 314 |
u64 reserved_123_127 : 5; |
| 315 |
u64 stack_max_pages : 32; |
| 316 |
u64 stack_pages : 32; |
| 317 |
uint64_t bp_0 : 7; |
| 318 |
uint64_t bp_1 : 7; |
| 319 |
uint64_t bp_2 : 7; |
| 320 |
uint64_t bp_3 : 7; |
| 321 |
uint64_t bp_4 : 7; |
| 322 |
uint64_t bp_5 : 7; |
| 323 |
uint64_t bp_6 : 7; |
| 324 |
uint64_t bp_7 : 7; |
| 325 |
uint64_t bp_ena_0 : 1; |
| 326 |
uint64_t bp_ena_1 : 1; |
| 327 |
uint64_t bp_ena_2 : 1; |
| 328 |
uint64_t bp_ena_3 : 1; |
| 329 |
uint64_t bp_ena_4 : 1; |
| 330 |
uint64_t bp_ena_5 : 1; |
| 331 |
uint64_t bp_ena_6 : 1; |
| 332 |
uint64_t bp_ena_7 : 1; |
| 333 |
u64 stack_offset : 4; |
| 334 |
u64 reserved_260_263 : 4; |
| 335 |
u64 shift : 6; |
| 336 |
u64 reserved_270_271 : 2; |
| 337 |
u64 avg_level : 8; |
| 338 |
u64 avg_con : 9; |
| 339 |
u64 fc_ena : 1; |
| 340 |
u64 fc_stype : 2; |
| 341 |
u64 fc_hyst_bits : 4; |
| 342 |
u64 fc_up_crossing : 1; |
| 343 |
u64 reserved_297_299 : 3; |
| 344 |
u64 update_time : 16; |
| 345 |
u64 reserved_316_319 : 4; |
| 346 |
u64 fc_addr; /* W5 */ |
| 347 |
u64 ptr_start; /* W6 */ |
| 348 |
u64 ptr_end; /* W7 */ |
| 349 |
u64 bpid_0 : 12; |
| 350 |
u64 reserved_524_535 : 12; |
| 351 |
u64 err_int : 8; |
| 352 |
u64 err_int_ena : 8; |
| 353 |
u64 thresh_int : 1; |
| 354 |
u64 thresh_int_ena : 1; |
| 355 |
u64 thresh_up : 1; |
| 356 |
u64 reserved_555 : 1; |
| 357 |
u64 thresh_qint_idx : 7; |
| 358 |
u64 reserved_563 : 1; |
| 359 |
u64 err_qint_idx : 7; |
| 360 |
u64 reserved_571_575 : 5; |
| 361 |
u64 thresh : 36; |
| 362 |
u64 rsvd_612_615 : 4; |
| 363 |
u64 fc_msh_dst : 11; |
| 364 |
u64 reserved_627_630 : 4; |
| 365 |
u64 op_dpc_ena : 1; |
| 366 |
u64 op_dpc_set : 5; |
| 367 |
u64 reserved_637_637 : 1; |
| 368 |
u64 stream_ctx : 1; |
| 369 |
u64 reserved_639 : 1; |
| 370 |
u64 reserved_640_703; /* W10 */ |
| 371 |
u64 reserved_704_767; /* W11 */ |
| 372 |
u64 reserved_768_831; /* W12 */ |
| 373 |
u64 reserved_832_895; /* W13 */ |
| 374 |
u64 reserved_896_959; /* W14 */ |
| 375 |
u64 reserved_960_1023; /* W15 */ |
| 376 |
}; |
| 377 |
|
| 378 |
static_assert(sizeof(struct npa_cn20k_pool_s) == NIX_MAX_CTX_SIZE); |
| 379 |
|
| 380 |
#endif |