1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019-2020 Broadcom
6 #include <rte_common.h>
7 #include <cfa_resource_types.h>
10 #include "tf_identifier.h"
11 #include "tf_tbl_type.h"
15 * Device specific function that retrieves the MAX number of HCAPI
16 * types the device supports.
19 * Pointer to TF handle
22 * Pointer to the MAX number of HCAPI types supported
25 * - (0) if successful.
26 * - (-EINVAL) on failure.
29 tf_dev_p4_get_max_types(struct tf *tfp __rte_unused,
32 if (max_types == NULL)
35 *max_types = CFA_RESOURCE_TYPE_P4_LAST + 1;
41 * Device specific function that retrieves the WC TCAM slices the
45 * Pointer to TF handle
48 * Pointer to the WC TCAM slice size
50 * [out] num_slices_per_row
51 * Pointer to the WC TCAM row slice configuration
54 * - (0) if successful.
55 * - (-EINVAL) on failure.
58 tf_dev_p4_get_wc_tcam_slices(struct tf *tfp __rte_unused,
60 uint16_t *num_slices_per_row)
62 #define CFA_P4_WC_TCAM_SLICE_SIZE 12
63 #define CFA_P4_WC_TCAM_SLICES_PER_ROW 2
65 if (slice_size == NULL || num_slices_per_row == NULL)
68 *slice_size = CFA_P4_WC_TCAM_SLICE_SIZE;
69 *num_slices_per_row = CFA_P4_WC_TCAM_SLICES_PER_ROW;
75 * Truflow P4 device specific functions
77 const struct tf_dev_ops tf_dev_ops_p4 = {
78 .tf_dev_get_max_types = tf_dev_p4_get_max_types,
79 .tf_dev_get_wc_tcam_slices = tf_dev_p4_get_wc_tcam_slices,
80 .tf_dev_alloc_ident = tf_ident_alloc,
81 .tf_dev_free_ident = tf_ident_free,
82 .tf_dev_alloc_tbl = tf_tbl_alloc,
83 .tf_dev_free_tbl = tf_tbl_free,
84 .tf_dev_alloc_search_tbl = tf_tbl_alloc_search,
85 .tf_dev_set_tbl = tf_tbl_set,
86 .tf_dev_get_tbl = tf_tbl_get,
87 .tf_dev_alloc_tcam = tf_tcam_alloc,
88 .tf_dev_free_tcam = tf_tcam_free,
89 .tf_dev_alloc_search_tcam = tf_tcam_alloc_search,
90 .tf_dev_set_tcam = tf_tcam_set,
91 .tf_dev_get_tcam = tf_tcam_get,