net/bnxt: support TruFlow core table scope
[dpdk.git] / drivers / net / bnxt / tf_core / tf_tbl.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2019-2020 Broadcom
3  * All rights reserved.
4  */
5
6 /* Truflow Table APIs and supporting code */
7
8 #include <stdio.h>
9 #include <string.h>
10 #include <stdbool.h>
11 #include <math.h>
12 #include <sys/param.h>
13 #include <rte_common.h>
14 #include <rte_errno.h>
15 #include "hsi_struct_def_dpdk.h"
16
17 #include "tf_core.h"
18 #include "tf_session.h"
19 #include "tf_msg.h"
20 #include "tfp.h"
21 #include "hwrm_tf.h"
22 #include "bnxt.h"
23 #include "tf_resources.h"
24 #include "tf_rm.h"
25
26 #define PTU_PTE_VALID          0x1UL
27 #define PTU_PTE_LAST           0x2UL
28 #define PTU_PTE_NEXT_TO_LAST   0x4UL
29
30 /* Number of pointers per page_size */
31 #define MAX_PAGE_PTRS(page_size)  ((page_size) / sizeof(void *))
32
33 /* API defined in tf_tbl.h */
34 void
35 tf_init_tbl_pool(struct tf_session *session)
36 {
37         enum tf_dir dir;
38
39         for (dir = 0; dir < TF_DIR_MAX; dir++) {
40                 session->ext_pool_2_scope[dir][TF_EXT_POOL_0] =
41                         TF_TBL_SCOPE_INVALID;
42         }
43 }