From: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
To: dev@dpdk.org
Cc: Randy Schacher <stuart.schacher@broadcom.com>,
Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>,
Farah Smith <farah.smith@broadcom.com>,
Shuanglin Wang <shuanglin.wang@broadcom.com>,
Shahaji Bhosle <sbhosle@broadcom.com>,
Ajit Khaparde <ajit.khaparde@broadcom.com>
Subject: [PATCH v8 08/47] net/bnxt: tf_core: convert priority based TCAM manager to dynamic allocation
Date: Thu, 7 Nov 2024 19:22:15 +0530 [thread overview]
Message-ID: <20241107135254.1611676-9-sriharsha.basavapatna@broadcom.com> (raw)
In-Reply-To: <20241107135254.1611676-1-sriharsha.basavapatna@broadcom.com>
From: Randy Schacher <stuart.schacher@broadcom.com>
Previously, TCAM entries were allocated statically, but this takes
up too much stack memory. Change the identifier for TCAM entries
from an index which is tied to the HW location,
to an abstract entry ID associated with the session.
Signed-off-by: Randy Schacher <stuart.schacher@broadcom.com>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Reviewed-by: Farah Smith <farah.smith@broadcom.com>
Reviewed-by: Shuanglin Wang <shuanglin.wang@broadcom.com>
Reviewed-by: Shahaji Bhosle <sbhosle@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/tf_core/cfa_tcam_mgr.c | 1449 +++++++++--------
drivers/net/bnxt/tf_core/cfa_tcam_mgr.h | 43 +-
.../net/bnxt/tf_core/cfa_tcam_mgr_device.h | 86 +-
.../net/bnxt/tf_core/cfa_tcam_mgr_hwop_msg.c | 135 +-
.../net/bnxt/tf_core/cfa_tcam_mgr_hwop_msg.h | 18 +-
drivers/net/bnxt/tf_core/cfa_tcam_mgr_p4.c | 610 ++++---
drivers/net/bnxt/tf_core/cfa_tcam_mgr_p4.h | 9 +-
drivers/net/bnxt/tf_core/cfa_tcam_mgr_p58.c | 600 ++++---
drivers/net/bnxt/tf_core/cfa_tcam_mgr_p58.h | 10 +-
.../net/bnxt/tf_core/cfa_tcam_mgr_session.h | 57 -
drivers/net/bnxt/tf_core/meson.build | 3 +-
drivers/net/bnxt/tf_core/tf_core.c | 6 +-
drivers/net/bnxt/tf_core/tf_device.h | 4 +-
drivers/net/bnxt/tf_core/tf_device_p58.c | 6 +-
.../net/bnxt/tf_core/tf_em_hash_internal.c | 6 +-
drivers/net/bnxt/tf_core/tf_em_internal.c | 4 +-
drivers/net/bnxt/tf_core/tf_resources.c | 171 +-
drivers/net/bnxt/tf_core/tf_resources.h | 16 +-
drivers/net/bnxt/tf_core/tf_rm.c | 6 +-
drivers/net/bnxt/tf_core/tf_session.c | 4 +-
drivers/net/bnxt/tf_core/tf_session.h | 6 +-
drivers/net/bnxt/tf_core/tf_tcam.c | 4 +-
drivers/net/bnxt/tf_core/tf_tcam_mgr_msg.c | 55 +-
23 files changed, 1814 insertions(+), 1494 deletions(-)
delete mode 100644 drivers/net/bnxt/tf_core/cfa_tcam_mgr_session.h
diff --git a/drivers/net/bnxt/tf_core/cfa_tcam_mgr.c b/drivers/net/bnxt/tf_core/cfa_tcam_mgr.c
index 33b1e4121e..21fc77d2f6 100644
--- a/drivers/net/bnxt/tf_core/cfa_tcam_mgr.c
+++ b/drivers/net/bnxt/tf_core/cfa_tcam_mgr.c
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2021-2023 Broadcom
+ * Copyright(c) 2021-2024 Broadcom
* All rights reserved.
*/
@@ -12,22 +12,13 @@
#include "tf_session.h"
#include "tf_util.h"
#include "cfa_tcam_mgr.h"
-#include "cfa_tcam_mgr_hwop_msg.h"
#include "cfa_tcam_mgr_device.h"
-#include "cfa_tcam_mgr_session.h"
+#include "cfa_tcam_mgr_hwop_msg.h"
#include "cfa_tcam_mgr_p58.h"
#include "cfa_tcam_mgr_p4.h"
#define TF_TCAM_SLICE_INVALID (-1)
-static struct cfa_tcam_mgr_entry_data *entry_data[TF_TCAM_MAX_SESSIONS];
-
-static int global_data_initialized[TF_TCAM_MAX_SESSIONS];
-int cfa_tcam_mgr_max_entries[TF_TCAM_MAX_SESSIONS];
-
-struct cfa_tcam_mgr_table_data
-cfa_tcam_mgr_tables[TF_TCAM_MAX_SESSIONS][TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX];
-
static int physical_table_types[CFA_TCAM_MGR_TBL_TYPE_MAX] = {
[CFA_TCAM_MGR_TBL_TYPE_L2_CTXT_TCAM_HIGH_APPS] =
TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH,
@@ -109,7 +100,7 @@ cfa_tcam_mgr_get_num_slices(unsigned int key_size, unsigned int slice_width)
{
int num_slices = 0;
- if (key_size == 0)
+ if (!key_size)
return -CFA_TCAM_MGR_ERR_CODE(INVAL);
num_slices = ((key_size - 1U) / slice_width) + 1U;
@@ -132,36 +123,43 @@ cfa_tcam_mgr_get_num_slices(unsigned int key_size, unsigned int slice_width)
}
static struct cfa_tcam_mgr_entry_data *
-cfa_tcam_mgr_entry_get(int sess_idx, uint16_t id)
+cfa_tcam_mgr_entry_get(struct cfa_tcam_mgr_data *tcam_mgr_data, uint16_t id)
{
- if (id > cfa_tcam_mgr_max_entries[sess_idx])
+ if (id > tcam_mgr_data->cfa_tcam_mgr_max_entries)
return NULL;
- return &entry_data[sess_idx][id];
+ return &tcam_mgr_data->entry_data[id];
}
/* Insert an entry into the entry table */
static int
-cfa_tcam_mgr_entry_insert(int sess_idx, uint16_t id,
+cfa_tcam_mgr_entry_insert(struct cfa_tcam_mgr_data *tcam_mgr_data,
+ struct tf *tfp __rte_unused, uint16_t id,
struct cfa_tcam_mgr_entry_data *entry)
{
- if (id > cfa_tcam_mgr_max_entries[sess_idx])
+ if (id > tcam_mgr_data->cfa_tcam_mgr_max_entries)
return -CFA_TCAM_MGR_ERR_CODE(INVAL);
- memcpy(&entry_data[sess_idx][id], entry,
- sizeof(entry_data[sess_idx][id]));
+ memcpy(&tcam_mgr_data->entry_data[id], entry,
+ sizeof(tcam_mgr_data->entry_data[id]));
+
+ PMD_DRV_LOG_LINE(INFO, "Added entry %d to table", id);
return 0;
}
/* Delete an entry from the entry table */
static int
-cfa_tcam_mgr_entry_delete(int sess_idx, uint16_t id)
+cfa_tcam_mgr_entry_delete(struct cfa_tcam_mgr_data *tcam_mgr_data,
+ struct tf *tfp __rte_unused, uint16_t id)
{
- if (id > cfa_tcam_mgr_max_entries[sess_idx])
+ if (id > tcam_mgr_data->cfa_tcam_mgr_max_entries)
return -CFA_TCAM_MGR_ERR_CODE(INVAL);
- memset(&entry_data[sess_idx][id], 0, sizeof(entry_data[sess_idx][id]));
+ memset(&tcam_mgr_data->entry_data[id], 0,
+ sizeof(tcam_mgr_data->entry_data[id]));
+
+ PMD_DRV_LOG_LINE(INFO, "Deleted entry %d from table.", id);
return 0;
}
@@ -170,11 +168,12 @@ cfa_tcam_mgr_entry_delete(int sess_idx, uint16_t id)
* TCAM supports.
*/
static int
-cfa_tcam_mgr_row_size_get(int sess_idx, enum tf_dir dir,
+cfa_tcam_mgr_row_size_get(struct cfa_tcam_mgr_data *tcam_mgr_data,
+ enum tf_dir dir,
enum cfa_tcam_mgr_tbl_type type)
{
return sizeof(struct cfa_tcam_mgr_table_rows_0) +
- (cfa_tcam_mgr_tables[sess_idx][dir][type].max_slices *
+ (tcam_mgr_data->cfa_tcam_mgr_tables[dir][type].max_slices *
sizeof(((struct cfa_tcam_mgr_table_rows_0 *)0)->entries[0]));
}
@@ -188,18 +187,19 @@ cfa_tcam_mgr_row_ptr_get(void *base, int index, int row_size)
* Searches a table to find the direction and type of an entry.
*/
static int
-cfa_tcam_mgr_entry_find_in_table(int sess_idx, int id, enum tf_dir dir,
+cfa_tcam_mgr_entry_find_in_table(struct cfa_tcam_mgr_data *tcam_mgr_data,
+ int id, enum tf_dir dir,
enum cfa_tcam_mgr_tbl_type type)
{
struct cfa_tcam_mgr_table_data *table_data;
- struct cfa_tcam_mgr_table_rows_0 *row;
int max_slices, row_idx, row_size, slice;
+ struct cfa_tcam_mgr_table_rows_0 *row;
- table_data = &cfa_tcam_mgr_tables[sess_idx][dir][type];
+ table_data = &tcam_mgr_data->cfa_tcam_mgr_tables[dir][type];
if (table_data->max_entries > 0 &&
table_data->hcapi_type > 0) {
max_slices = table_data->max_slices;
- row_size = cfa_tcam_mgr_row_size_get(sess_idx, dir, type);
+ row_size = cfa_tcam_mgr_row_size_get(tcam_mgr_data, dir, type);
for (row_idx = table_data->start_row;
row_idx <= table_data->end_row;
row_idx++) {
@@ -225,19 +225,24 @@ cfa_tcam_mgr_entry_find_in_table(int sess_idx, int id, enum tf_dir dir,
* Searches all the tables to find the direction and type of an entry.
*/
static int
-cfa_tcam_mgr_entry_find(int sess_idx, int id, enum tf_dir *tbl_dir,
+cfa_tcam_mgr_entry_find(struct cfa_tcam_mgr_data *tcam_mgr_data, int id,
+ enum tf_dir *tbl_dir,
enum cfa_tcam_mgr_tbl_type *tbl_type)
{
- enum tf_dir dir;
enum cfa_tcam_mgr_tbl_type type;
int rc = -CFA_TCAM_MGR_ERR_CODE(NOENT);
+ enum tf_dir dir;
- for (dir = TF_DIR_RX; dir < ARRAY_SIZE(cfa_tcam_mgr_tables[sess_idx]); dir++) {
+ for (dir = TF_DIR_RX; dir <
+ ARRAY_SIZE(tcam_mgr_data->cfa_tcam_mgr_tables);
+ dir++) {
for (type = CFA_TCAM_MGR_TBL_TYPE_START;
- type < ARRAY_SIZE(cfa_tcam_mgr_tables[sess_idx][dir]);
+ type <
+ ARRAY_SIZE(tcam_mgr_data->cfa_tcam_mgr_tables[dir]);
type++) {
- rc = cfa_tcam_mgr_entry_find_in_table(sess_idx, id, dir, type);
- if (rc == 0) {
+ rc = cfa_tcam_mgr_entry_find_in_table(tcam_mgr_data,
+ id, dir, type);
+ if (!rc) {
*tbl_dir = dir;
*tbl_type = type;
return rc;
@@ -262,11 +267,11 @@ cfa_tcam_mgr_row_is_entry_free(struct cfa_tcam_mgr_table_rows_0 *row,
return j;
}
}
- return -1;
+ return -CFA_TCAM_MGR_ERR_CODE(INVAL);
}
static int
-cfa_tcam_mgr_entry_move(int sess_idx, struct cfa_tcam_mgr_context *context,
+cfa_tcam_mgr_entry_move(struct cfa_tcam_mgr_data *tcam_mgr_data, struct tf *tfp,
enum tf_dir dir, enum cfa_tcam_mgr_tbl_type type,
int entry_id,
struct cfa_tcam_mgr_table_data *table_data,
@@ -280,15 +285,15 @@ cfa_tcam_mgr_entry_move(int sess_idx, struct cfa_tcam_mgr_context *context,
struct cfa_tcam_mgr_set_parms sparms = { 0 };
struct cfa_tcam_mgr_free_parms fparms = { 0 };
struct cfa_tcam_mgr_entry_data *entry;
- uint8_t key[CFA_TCAM_MGR_MAX_KEY_SIZE];
- uint8_t mask[CFA_TCAM_MGR_MAX_KEY_SIZE];
uint8_t result[CFA_TCAM_MGR_MAX_KEY_SIZE];
+ uint8_t mask[CFA_TCAM_MGR_MAX_KEY_SIZE];
+ uint8_t key[CFA_TCAM_MGR_MAX_KEY_SIZE];
int j, rc;
- entry = cfa_tcam_mgr_entry_get(sess_idx, entry_id);
- if (entry == NULL)
- return -1;
+ entry = cfa_tcam_mgr_entry_get(tcam_mgr_data, entry_id);
+ if (!entry)
+ return -CFA_TCAM_MGR_ERR_CODE(INVAL);
gparms.dir = dir;
gparms.type = type;
@@ -300,11 +305,11 @@ cfa_tcam_mgr_entry_move(int sess_idx, struct cfa_tcam_mgr_context *context,
gparms.key_size = sizeof(key);
gparms.result_size = sizeof(result);
- rc = cfa_tcam_mgr_entry_get_msg(sess_idx, context, &gparms,
+ rc = cfa_tcam_mgr_entry_get_msg(tcam_mgr_data, tfp, &gparms,
source_row_index,
entry->slice * source_row->entry_size,
table_data->max_slices);
- if (rc != 0)
+ if (rc)
return rc;
sparms.dir = dir;
@@ -332,18 +337,19 @@ cfa_tcam_mgr_entry_move(int sess_idx, struct cfa_tcam_mgr_context *context,
if (dest_row_slice < 0)
return -CFA_TCAM_MGR_ERR_CODE(PERM);
- rc = cfa_tcam_mgr_entry_set_msg(sess_idx, context, &sparms,
+ rc = cfa_tcam_mgr_entry_set_msg(tcam_mgr_data, tfp, &sparms,
dest_row_index,
dest_row_slice * dest_row->entry_size,
table_data->max_slices);
- if (rc != 0)
+ if (rc)
return rc;
if (free_source_entry) {
fparms.dir = dir;
fparms.type = type;
fparms.hcapi_type = table_data->hcapi_type;
- rc = cfa_tcam_mgr_entry_free_msg(sess_idx, context, &fparms,
+ rc = cfa_tcam_mgr_entry_free_msg(tcam_mgr_data,
+ tfp, &fparms,
source_row_index,
entry->slice *
dest_row->entry_size,
@@ -352,15 +358,15 @@ cfa_tcam_mgr_entry_move(int sess_idx, struct cfa_tcam_mgr_context *context,
source_row->entry_size,
table_data->result_size,
table_data->max_slices);
- if (rc != 0) {
+ if (rc) {
CFA_TCAM_MGR_LOG_DIR_TYPE(ERR,
dir, type,
- "Failed to free entry ID %d at"
- " row %d, slice %d for sess_idx %d. rc: %d.\n",
+ "Failed to free entry ID:%d"
+ " at row:%d slice:%d"
+ " rc:%d\n",
gparms.id,
source_row_index,
entry->slice,
- sess_idx,
-rc);
}
}
@@ -375,9 +381,9 @@ cfa_tcam_mgr_entry_move(int sess_idx, struct cfa_tcam_mgr_context *context,
}
static int
-cfa_tcam_mgr_row_move(int sess_idx, struct cfa_tcam_mgr_context *context,
+cfa_tcam_mgr_row_move(struct cfa_tcam_mgr_data *tcam_mgr_data, struct tf *tfp,
enum tf_dir dir, enum cfa_tcam_mgr_tbl_type type,
- struct cfa_tcam_mgr_table_data *table_data,
+ struct cfa_tcam_mgr_table_data *tbl_data,
int dest_row_index,
struct cfa_tcam_mgr_table_rows_0 *dest_row,
int source_row_index,
@@ -392,30 +398,32 @@ cfa_tcam_mgr_row_move(int sess_idx, struct cfa_tcam_mgr_context *context,
fparms.dir = dir;
fparms.type = type;
- fparms.hcapi_type = table_data->hcapi_type;
+ fparms.hcapi_type = tbl_data->hcapi_type;
for (j = 0;
- j < (table_data->max_slices / source_row->entry_size);
+ j < (tbl_data->max_slices / source_row->entry_size);
j++) {
if (ROW_ENTRY_INUSE(source_row, j)) {
- cfa_tcam_mgr_entry_move(sess_idx, context, dir, type,
+ cfa_tcam_mgr_entry_move(tcam_mgr_data, tfp,
+ dir, type,
source_row->entries[j],
- table_data,
+ tbl_data,
dest_row_index, j, dest_row,
source_row_index, source_row,
true);
} else {
/* Slice not in use, write an empty slice. */
- rc = cfa_tcam_mgr_entry_free_msg(sess_idx, context, &fparms,
- dest_row_index,
- j *
- dest_row->entry_size,
- table_data->row_width /
- table_data->max_slices *
- dest_row->entry_size,
- table_data->result_size,
- table_data->max_slices);
- if (rc != 0)
+ rc = cfa_tcam_mgr_entry_free_msg(tcam_mgr_data,
+ tfp, &fparms,
+ dest_row_index,
+ j *
+ dest_row->entry_size,
+ tbl_data->row_width /
+ tbl_data->max_slices *
+ dest_row->entry_size,
+ tbl_data->result_size,
+ tbl_data->max_slices);
+ if (rc)
return rc;
}
}
@@ -425,7 +433,7 @@ cfa_tcam_mgr_row_move(int sess_idx, struct cfa_tcam_mgr_context *context,
/* Install entry into in-memory tables, not into TCAM (yet). */
static void
-cfa_tcam_mgr_row_entry_install(int sess_idx,
+cfa_tcam_mgr_row_entry_install(struct tf *tfp __rte_unused,
struct cfa_tcam_mgr_table_rows_0 *row,
struct cfa_tcam_mgr_alloc_parms *parms,
struct cfa_tcam_mgr_entry_data *entry,
@@ -433,12 +441,6 @@ cfa_tcam_mgr_row_entry_install(int sess_idx,
int key_slices,
int row_index, int slice)
{
- if (global_data_initialized[sess_idx] == 0) {
- CFA_TCAM_MGR_LOG(INFO, "PANIC: No TCAM data created for sess_idx %d\n",
- sess_idx);
- return;
- }
-
if (slice == TF_TCAM_SLICE_INVALID) {
slice = 0;
row->entry_size = key_slices;
@@ -449,36 +451,52 @@ cfa_tcam_mgr_row_entry_install(int sess_idx,
row->entries[slice] = id;
entry->row = row_index;
entry->slice = slice;
+
+ PMD_DRV_LOG_LINE(INFO,
+ "Entry %d installed row:%d slice:%d prio:%d",
+ id, row_index, slice, row->priority);
}
/* Finds an empty row that can be used and reserve for entry. If necessary,
* entries will be shuffled in order to make room.
*/
static struct cfa_tcam_mgr_table_rows_0 *
-cfa_tcam_mgr_empty_row_alloc(int sess_idx, struct cfa_tcam_mgr_context *context,
+cfa_tcam_mgr_empty_row_alloc(struct cfa_tcam_mgr_data *tcam_mgr_data,
+ struct tf *tfp,
struct cfa_tcam_mgr_alloc_parms *parms,
struct cfa_tcam_mgr_entry_data *entry,
- uint16_t id,
- int key_slices)
+ uint16_t id, int key_slices)
{
+ int to_row_idx, from_row_idx, slice, start_row, end_row;
struct cfa_tcam_mgr_table_rows_0 *tcam_rows;
+ struct cfa_tcam_mgr_table_data *table_data;
struct cfa_tcam_mgr_table_rows_0 *from_row;
struct cfa_tcam_mgr_table_rows_0 *to_row;
struct cfa_tcam_mgr_table_rows_0 *row;
- struct cfa_tcam_mgr_table_data *table_data;
int i, max_slices, row_size;
- int to_row_idx, from_row_idx, slice, start_row, end_row;
- int empty_row = -1;
int target_row = -1;
+ int empty_row = -1;
- table_data = &cfa_tcam_mgr_tables[sess_idx][parms->dir][parms->type];
+ table_data =
+ &tcam_mgr_data->cfa_tcam_mgr_tables[parms->dir][parms->type];
- start_row = table_data->start_row;
- end_row = table_data->end_row;
+ start_row = table_data->start_row;
+ end_row = table_data->end_row;
max_slices = table_data->max_slices;
- tcam_rows = table_data->tcam_rows;
+ tcam_rows = table_data->tcam_rows;
+
+ row_size = cfa_tcam_mgr_row_size_get(tcam_mgr_data, parms->dir,
+ parms->type);
+ /*
+ * Note: The rows are ordered from highest priority to lowest priority.
+ * That is, the first row in the table will have the highest priority
+ * and the last row in the table will have the lowest priority.
+ */
- row_size = cfa_tcam_mgr_row_size_get(sess_idx, parms->dir, parms->type);
+ PMD_DRV_LOG_LINE(INFO, "Trying to alloc space for entry with "
+ "priority %d and width %d slices.",
+ parms->priority,
+ key_slices);
/*
* First check for partially used entries, but only if the key needs
@@ -497,10 +515,11 @@ cfa_tcam_mgr_empty_row_alloc(int sess_idx, struct cfa_tcam_mgr_context *context,
max_slices,
key_slices);
if (slice >= 0) {
- cfa_tcam_mgr_row_entry_install(sess_idx, row, parms,
+ cfa_tcam_mgr_row_entry_install(tfp,
+ row, parms,
entry, id,
- key_slices,
- i, slice);
+ key_slices, i,
+ slice);
return row;
}
}
@@ -519,11 +538,10 @@ cfa_tcam_mgr_empty_row_alloc(int sess_idx, struct cfa_tcam_mgr_context *context,
for (i = start_row; i <= end_row; i++) {
row = cfa_tcam_mgr_row_ptr_get(tcam_rows, i, row_size);
if (!ROW_INUSE(row)) {
- cfa_tcam_mgr_row_entry_install(sess_idx,
+ cfa_tcam_mgr_row_entry_install(tfp,
row, parms,
- entry,
- id, key_slices,
- i,
+ entry, id,
+ key_slices, i,
TF_TCAM_SLICE_INVALID);
return row;
}
@@ -563,7 +581,7 @@ cfa_tcam_mgr_empty_row_alloc(int sess_idx, struct cfa_tcam_mgr_context *context,
* just install new entry in empty_row.
*/
row = cfa_tcam_mgr_row_ptr_get(tcam_rows, empty_row, row_size);
- cfa_tcam_mgr_row_entry_install(sess_idx, row, parms, entry, id,
+ cfa_tcam_mgr_row_entry_install(tfp, row, parms, entry, id,
key_slices, empty_row,
TF_TCAM_SLICE_INVALID);
return row;
@@ -587,15 +605,19 @@ cfa_tcam_mgr_empty_row_alloc(int sess_idx, struct cfa_tcam_mgr_context *context,
from_row_idx = i;
from_row = row;
}
- cfa_tcam_mgr_row_move(sess_idx, context, parms->dir, parms->type,
+ cfa_tcam_mgr_row_move(tcam_mgr_data, tfp, parms->dir,
+ parms->type,
table_data, to_row_idx, to_row,
from_row_idx, from_row);
+ PMD_DRV_LOG_LINE(INFO, "Moved row %d to row %d.",
+ from_row_idx, to_row_idx);
+
to_row = from_row;
to_row_idx = from_row_idx;
}
to_row = cfa_tcam_mgr_row_ptr_get(tcam_rows, target_row, row_size);
memset(to_row, 0, row_size);
- cfa_tcam_mgr_row_entry_install(sess_idx, to_row, parms, entry, id,
+ cfa_tcam_mgr_row_entry_install(tfp, to_row, parms, entry, id,
key_slices, target_row,
TF_TCAM_SLICE_INVALID);
@@ -607,24 +629,26 @@ cfa_tcam_mgr_empty_row_alloc(int sess_idx, struct cfa_tcam_mgr_context *context,
* used necessary for the entries that are installed.
*/
static void
-cfa_tcam_mgr_rows_combine(int sess_idx, struct cfa_tcam_mgr_context *context,
+cfa_tcam_mgr_rows_combine(struct cfa_tcam_mgr_data *tcam_mgr_data,
+ struct tf *tfp,
struct cfa_tcam_mgr_free_parms *parms,
struct cfa_tcam_mgr_table_data *table_data,
int changed_row_index)
{
+ int to_row_idx, from_row_idx, start_row, end_row, max_slices;
struct cfa_tcam_mgr_table_rows_0 *from_row = NULL;
- struct cfa_tcam_mgr_table_rows_0 *to_row;
struct cfa_tcam_mgr_table_rows_0 *tcam_rows;
- int i, j, row_size;
- int to_row_idx, from_row_idx, start_row, end_row, max_slices;
+ struct cfa_tcam_mgr_table_rows_0 *to_row;
bool entry_moved = false;
+ int i, j, row_size;
start_row = table_data->start_row;
end_row = table_data->end_row;
max_slices = table_data->max_slices;
tcam_rows = table_data->tcam_rows;
- row_size = cfa_tcam_mgr_row_size_get(sess_idx, parms->dir, parms->type);
+ row_size = cfa_tcam_mgr_row_size_get(tcam_mgr_data, parms->dir,
+ parms->type);
from_row_idx = changed_row_index;
from_row = cfa_tcam_mgr_row_ptr_get(tcam_rows, from_row_idx, row_size);
@@ -658,8 +682,8 @@ cfa_tcam_mgr_rows_combine(int sess_idx, struct cfa_tcam_mgr_context *context,
j++) {
if (!ROW_ENTRY_INUSE(to_row, j)) {
cfa_tcam_mgr_entry_move
- (sess_idx,
- context,
+ (tcam_mgr_data,
+ tfp,
parms->dir,
parms->type,
from_row->entries[i],
@@ -680,19 +704,19 @@ cfa_tcam_mgr_rows_combine(int sess_idx, struct cfa_tcam_mgr_context *context,
#ifdef TF_FLOW_SCALE_QUERY
/* CFA update usage state when moved entries */
if (entry_moved) {
- if (tf_tcam_usage_update(context->tfp->session->session_id.id,
+ if (tf_tcam_usage_update(tfp,
parms->dir,
parms->type,
to_row,
TF_RESC_ALLOC)) {
- CFA_TCAM_MGR_TRACE(DEBUG, "TF tcam usage update failed\n");
+ PMD_DRV_LOG_LINE(DEBUG, "TF tcam usage update failed");
}
- if (tf_tcam_usage_update(context->tfp->session->session_id.id,
+ if (tf_tcam_usage_update(tfp,
parms->dir,
parms->type,
from_row,
TF_RESC_FREE)) {
- CFA_TCAM_MGR_TRACE(DEBUG, "TF tcam usage update failed\n");
+ PMD_DRV_LOG_LINE(DEBUG, "TF tcam usage update failed");
}
}
#endif /* TF_FLOW_SCALE_QUERY */
@@ -707,29 +731,28 @@ cfa_tcam_mgr_rows_combine(int sess_idx, struct cfa_tcam_mgr_context *context,
/*
* This function will ensure that all rows, except those of the highest
- * priority, at the end of the table. When this function is finished, all the
+ * priority, are at the end of the table. When this function is finished, all
* empty rows should be between the highest priority rows at the beginning of
* the table and the rest of the rows with lower priorities.
- */
-/*
- * Will need to free the row left newly empty as a result of moving.
*
+ * Will need to free the row left newly empty as a result of moving.
* Return row to free to caller. If new_row_to_free < 0, then no new row to
* free.
*/
static void
-cfa_tcam_mgr_rows_compact(int sess_idx, struct cfa_tcam_mgr_context *context,
+cfa_tcam_mgr_rows_compact(struct cfa_tcam_mgr_data *tcam_mgr_data,
+ struct tf *tfp,
struct cfa_tcam_mgr_free_parms *parms,
struct cfa_tcam_mgr_table_data *table_data,
int *new_row_to_free,
int changed_row_index)
{
+ int to_row_idx = 0, from_row_idx = 0, start_row = 0, end_row = 0;
struct cfa_tcam_mgr_table_rows_0 *from_row = NULL;
+ struct cfa_tcam_mgr_table_rows_0 *tcam_rows;
struct cfa_tcam_mgr_table_rows_0 *to_row;
struct cfa_tcam_mgr_table_rows_0 *row;
- struct cfa_tcam_mgr_table_rows_0 *tcam_rows;
int i, row_size, priority;
- int to_row_idx = 0, from_row_idx = 0, start_row = 0, end_row = 0;
*new_row_to_free = -1;
@@ -737,7 +760,8 @@ cfa_tcam_mgr_rows_compact(int sess_idx, struct cfa_tcam_mgr_context *context,
end_row = table_data->end_row;
tcam_rows = table_data->tcam_rows;
- row_size = cfa_tcam_mgr_row_size_get(sess_idx, parms->dir, parms->type);
+ row_size = cfa_tcam_mgr_row_size_get(tcam_mgr_data, parms->dir,
+ parms->type);
/*
* The row is no longer in use, so see if rows need to be moved in order
@@ -791,14 +815,21 @@ cfa_tcam_mgr_rows_compact(int sess_idx, struct cfa_tcam_mgr_context *context,
* to fill the newly empty (by free or by move)
* row.
*/
- if (from_row != NULL) {
- cfa_tcam_mgr_row_move(sess_idx, context,
+ if (from_row) {
+ cfa_tcam_mgr_row_move(tcam_mgr_data,
+ tfp,
parms->dir,
parms->type,
table_data,
- to_row_idx, to_row,
+ to_row_idx,
+ to_row,
from_row_idx,
from_row);
+ PMD_DRV_LOG_LINE(INFO,
+ "Moved row %d "
+ "to row %d.",
+ from_row_idx,
+ to_row_idx);
*new_row_to_free = from_row_idx;
to_row = from_row;
to_row_idx = from_row_idx;
@@ -811,11 +842,12 @@ cfa_tcam_mgr_rows_compact(int sess_idx, struct cfa_tcam_mgr_context *context,
}
}
- if (from_row != NULL) {
- cfa_tcam_mgr_row_move(sess_idx, context, parms->dir, parms->type,
- table_data,
- to_row_idx, to_row,
- from_row_idx, from_row);
+ if (from_row) {
+ cfa_tcam_mgr_row_move(tcam_mgr_data, tfp, parms->dir,
+ parms->type, table_data, to_row_idx,
+ to_row, from_row_idx, from_row);
+ PMD_DRV_LOG_LINE(INFO, "Moved row %d to row %d.",
+ from_row_idx, to_row_idx);
*new_row_to_free = from_row_idx;
}
}
@@ -824,46 +856,51 @@ cfa_tcam_mgr_rows_compact(int sess_idx, struct cfa_tcam_mgr_context *context,
* This function is to set table limits for the logical TCAM tables.
*/
static int
-cfa_tcam_mgr_table_limits_set(int sess_idx, struct cfa_tcam_mgr_init_parms *parms)
+cfa_tcam_mgr_table_limits_set(struct cfa_tcam_mgr_data *tcam_mgr_data,
+ struct cfa_tcam_mgr_init_parms *parms)
{
struct cfa_tcam_mgr_table_data *table_data;
unsigned int dir, type;
int start, stride;
- if (parms == NULL)
+ if (!parms)
return 0;
- for (dir = 0; dir < ARRAY_SIZE(cfa_tcam_mgr_tables[sess_idx]); dir++)
+ for (dir = 0; dir < ARRAY_SIZE(tcam_mgr_data->cfa_tcam_mgr_tables);
+ dir++)
for (type = 0;
- type < ARRAY_SIZE(cfa_tcam_mgr_tables[sess_idx][dir]);
+ type <
+ ARRAY_SIZE(tcam_mgr_data->cfa_tcam_mgr_tables[dir]);
type++) {
- table_data = &cfa_tcam_mgr_tables[sess_idx][dir][type];
+ table_data =
+ &tcam_mgr_data->cfa_tcam_mgr_tables[dir][type];
/*
* If num_rows is zero, then TCAM Manager did not
* allocate any row storage for that table so cannot
* manage it.
*/
- if (table_data->num_rows == 0)
+ if (!table_data->num_rows)
continue;
start = parms->resc[dir][type].start;
stride = parms->resc[dir][type].stride;
if (start % table_data->max_slices > 0) {
CFA_TCAM_MGR_LOG_DIR_TYPE(ERR, dir, type,
- "Start of resources (%d) for table (%d) "
- "does not begin on row boundary.\n",
- start, sess_idx);
+ "Start of resources"
+ " (%d) does not begin"
+ " on row boundary.\n",
+ start);
CFA_TCAM_MGR_LOG_DIR(ERR, dir,
- "Start is %d, number of slices "
- "is %d.\n",
+ "Start is %d, number of"
+ " slices is %d.\n",
start,
table_data->max_slices);
return -CFA_TCAM_MGR_ERR_CODE(INVAL);
}
if (stride % table_data->max_slices > 0) {
CFA_TCAM_MGR_LOG_DIR_TYPE(ERR, dir, type,
- "Stride of resources (%d) for table (%d)"
+ "Stride of resources (%d) "
" does not end on row boundary.\n",
- stride, sess_idx);
+ stride);
CFA_TCAM_MGR_LOG_DIR(ERR, dir,
"Stride is %d, number of "
"slices is %d.\n",
@@ -871,7 +908,7 @@ cfa_tcam_mgr_table_limits_set(int sess_idx, struct cfa_tcam_mgr_init_parms *parm
table_data->max_slices);
return -CFA_TCAM_MGR_ERR_CODE(INVAL);
}
- if (stride == 0) {
+ if (!stride) {
table_data->start_row = 0;
table_data->end_row = 0;
table_data->max_entries = 0;
@@ -890,49 +927,123 @@ cfa_tcam_mgr_table_limits_set(int sess_idx, struct cfa_tcam_mgr_init_parms *parm
return 0;
}
+static int
+cfa_tcam_mgr_bitmap_alloc(struct tf *tfp __rte_unused,
+ struct cfa_tcam_mgr_data *tcam_mgr_data)
+{
+ struct tfp_calloc_parms cparms;
+ uint64_t session_bmp_size;
+ struct bitalloc *session_bmp;
+ int32_t first_idx;
+ int max_entries;
+ int rc;
+
+ if (!tcam_mgr_data->cfa_tcam_mgr_max_entries)
+ return -CFA_TCAM_MGR_ERR_CODE(INVAL);
+
+ max_entries = tcam_mgr_data->cfa_tcam_mgr_max_entries;
+ session_bmp_size = (sizeof(uint64_t) *
+ (((max_entries - 1) / sizeof(uint64_t)) + 1));
+
+ cparms.nitems = 1;
+ cparms.size = session_bmp_size;
+ cparms.alignment = 0;
+ rc = tfp_calloc(&cparms);
+ if (rc) {
+ /* Log error */
+ TFP_DRV_LOG(ERR,
+ "Failed to allocate session bmp, rc:%s\n",
+ strerror(-rc));
+ return -CFA_TCAM_MGR_ERR_CODE(NOMEM);
+ }
+
+ session_bmp = (struct bitalloc *)cparms.mem_va;
+ rc = ba_init(session_bmp, max_entries, true);
+
+ tcam_mgr_data->session_bmp = session_bmp;
+ tcam_mgr_data->session_bmp_size = max_entries;
+
+ /* Allocate first index to avoid idx 0 */
+ first_idx = ba_alloc(tcam_mgr_data->session_bmp);
+ if (first_idx == BA_FAIL)
+ return -CFA_TCAM_MGR_ERR_CODE(NOSPC);
+
+ TFP_DRV_LOG(INFO,
+ "session bitmap size is %" PRIX64 "\n",
+ tcam_mgr_data->session_bmp_size);
+
+ return 0;
+}
+
+static void
+cfa_tcam_mgr_uninit(struct tf *tfp,
+ enum cfa_tcam_mgr_device_type type)
+{
+ switch (type) {
+ case CFA_TCAM_MGR_DEVICE_TYPE_P4:
+ cfa_tcam_mgr_uninit_p4(tfp);
+ break;
+ case CFA_TCAM_MGR_DEVICE_TYPE_P5:
+ cfa_tcam_mgr_uninit_p58(tfp);
+ break;
+ default:
+ CFA_TCAM_MGR_LOG(ERR, "No such device %d\n", type);
+ return;
+ }
+}
+
int
-cfa_tcam_mgr_init(int sess_idx, enum cfa_tcam_mgr_device_type type,
+cfa_tcam_mgr_init(struct tf *tfp, enum cfa_tcam_mgr_device_type type,
struct cfa_tcam_mgr_init_parms *parms)
{
struct cfa_tcam_mgr_table_data *table_data;
+ struct cfa_tcam_mgr_data *tcam_mgr_data;
unsigned int dir, tbl_type;
+ struct tf_session *tfs;
int rc;
+ rc = tf_session_get_session_internal(tfp, &tfs);
+ if (rc)
+ return rc;
+
switch (type) {
case CFA_TCAM_MGR_DEVICE_TYPE_P4:
- case CFA_TCAM_MGR_DEVICE_TYPE_SR:
- rc = cfa_tcam_mgr_init_p4(sess_idx, &entry_data[sess_idx]);
+ rc = cfa_tcam_mgr_init_p4(tfp);
break;
case CFA_TCAM_MGR_DEVICE_TYPE_P5:
- rc = cfa_tcam_mgr_init_p58(sess_idx, &entry_data[sess_idx]);
+ rc = cfa_tcam_mgr_init_p58(tfp);
break;
default:
- CFA_TCAM_MGR_LOG(ERR, "No such device %d for sess_idx %d\n",
- type, sess_idx);
+ CFA_TCAM_MGR_LOG(ERR, "No such device %d\n", type);
return -CFA_TCAM_MGR_ERR_CODE(NODEV);
}
- if (rc < 0)
+ if (rc)
return rc;
- rc = cfa_tcam_mgr_table_limits_set(sess_idx, parms);
- if (rc < 0)
+ tcam_mgr_data = tfs->tcam_mgr_handle;
+ rc = cfa_tcam_mgr_table_limits_set(tcam_mgr_data, parms);
+ if (rc)
return rc;
/* Now calculate the max entries per table and global max entries based
* on the updated table limits.
*/
- cfa_tcam_mgr_max_entries[sess_idx] = 0;
- for (dir = 0; dir < ARRAY_SIZE(cfa_tcam_mgr_tables[sess_idx]); dir++)
+ tcam_mgr_data->cfa_tcam_mgr_max_entries = 0;
+ for (dir = 0; dir < ARRAY_SIZE(tcam_mgr_data->cfa_tcam_mgr_tables);
+ dir++)
for (tbl_type = 0;
- tbl_type < ARRAY_SIZE(cfa_tcam_mgr_tables[sess_idx][dir]);
+ tbl_type <
+ ARRAY_SIZE(tcam_mgr_data->cfa_tcam_mgr_tables[dir]);
tbl_type++) {
- table_data = &cfa_tcam_mgr_tables[sess_idx][dir][tbl_type];
+ table_data =
+ &tcam_mgr_data->cfa_tcam_mgr_tables[dir]
+ [tbl_type];
/*
* If num_rows is zero, then TCAM Manager did not
* allocate any row storage for that table so cannot
* manage it.
*/
- if (table_data->num_rows == 0) {
+ if (!table_data->num_rows) {
table_data->start_row = 0;
table_data->end_row = 0;
table_data->max_entries = 0;
@@ -940,14 +1051,13 @@ cfa_tcam_mgr_init(int sess_idx, enum cfa_tcam_mgr_device_type type,
table_data->num_rows) {
CFA_TCAM_MGR_LOG_DIR_TYPE(EMERG, dir, tbl_type,
"End row is out of "
- "range (%d >= %d) for sess_idx %d\n",
+ "range (%d >= %d)\n",
table_data->end_row,
- table_data->num_rows,
- sess_idx);
+ table_data->num_rows);
return -CFA_TCAM_MGR_ERR_CODE(FAULT);
- } else if (table_data->max_entries == 0 &&
- table_data->start_row == 0 &&
- table_data->end_row == 0) {
+ } else if (!table_data->max_entries &&
+ !table_data->start_row &&
+ !table_data->end_row) {
/* Nothing to do */
} else {
table_data->max_entries =
@@ -955,51 +1065,45 @@ cfa_tcam_mgr_init(int sess_idx, enum cfa_tcam_mgr_device_type type,
(table_data->end_row -
table_data->start_row + 1);
}
- cfa_tcam_mgr_max_entries[sess_idx] += table_data->max_entries;
+ tcam_mgr_data->cfa_tcam_mgr_max_entries +=
+ table_data->max_entries;
}
- rc = cfa_tcam_mgr_hwops_init(type);
- if (rc < 0)
+ rc = cfa_tcam_mgr_hwops_init(tcam_mgr_data, type);
+ if (rc)
return rc;
- rc = cfa_tcam_mgr_session_init(sess_idx, type);
- if (rc < 0)
+ rc = cfa_tcam_mgr_bitmap_alloc(tfp, tcam_mgr_data);
+ if (rc)
return rc;
- global_data_initialized[sess_idx] = 1;
+ if (parms)
+ parms->max_entries = tcam_mgr_data->cfa_tcam_mgr_max_entries;
- if (parms != NULL)
- parms->max_entries = cfa_tcam_mgr_max_entries[sess_idx];
-
- CFA_TCAM_MGR_LOG(DEBUG, "Global TCAM table initialized for sess_idx %d max entries %d.\n",
- sess_idx, cfa_tcam_mgr_max_entries[sess_idx]);
+ CFA_TCAM_MGR_LOG(DEBUG, "Global TCAM tbl initialized max entries %d\n",
+ tcam_mgr_data->cfa_tcam_mgr_max_entries);
return 0;
}
int
-cfa_tcam_mgr_qcaps(struct cfa_tcam_mgr_context *context __rte_unused,
+cfa_tcam_mgr_qcaps(struct tf *tfp __rte_unused,
struct cfa_tcam_mgr_qcaps_parms *parms)
{
+ struct cfa_tcam_mgr_data *tcam_mgr_data;
+ struct tf_session *tfs;
unsigned int type;
- int rc, sess_idx;
- uint32_t session_id;
+ int rc;
- CFA_TCAM_MGR_CHECK_PARMS2(context, parms);
+ CFA_TCAM_MGR_CHECK_PARMS2(tfp, parms);
- rc = cfa_tcam_mgr_get_session_from_context(context, &session_id);
- if (rc < 0)
+ rc = tf_session_get_session_internal(tfp, &tfs);
+ if (rc)
return rc;
- sess_idx = cfa_tcam_mgr_session_find(session_id);
- if (sess_idx < 0) {
- CFA_TCAM_MGR_LOG_0(ERR, "Session not found.\n");
- return sess_idx;
- }
-
- if (global_data_initialized[sess_idx] == 0) {
- CFA_TCAM_MGR_LOG(ERR, "PANIC: No TCAM data created for sess_idx %d\n",
- sess_idx);
+ tcam_mgr_data = tfs->tcam_mgr_handle;
+ if (!tcam_mgr_data) {
+ CFA_TCAM_MGR_LOG_0(ERR, "No TCAM data created for session.\n");
return -CFA_TCAM_MGR_ERR_CODE(PERM);
}
@@ -1011,12 +1115,91 @@ cfa_tcam_mgr_qcaps(struct cfa_tcam_mgr_context *context __rte_unused,
parms->rx_tcam_supported = 0;
parms->tx_tcam_supported = 0;
for (type = 0; type < CFA_TCAM_MGR_TBL_TYPE_MAX; type++) {
- if (cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX][type].max_entries > 0 &&
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX][type].hcapi_type > 0)
- parms->rx_tcam_supported |= 1 << cfa_tcam_mgr_get_phys_table_type(type);
- if (cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX][type].max_entries > 0 &&
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX][type].hcapi_type > 0)
- parms->tx_tcam_supported |= 1 << cfa_tcam_mgr_get_phys_table_type(type);
+ if (tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
+ [type].max_entries > 0 &&
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
+ [type].hcapi_type > 0)
+ parms->rx_tcam_supported |=
+ 1 << cfa_tcam_mgr_get_phys_table_type(type);
+ if (tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
+ [type].max_entries > 0 &&
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
+ [type].hcapi_type > 0)
+ parms->tx_tcam_supported |=
+ 1 << cfa_tcam_mgr_get_phys_table_type(type);
+ }
+
+ return 0;
+}
+
+static
+int cfa_tcam_mgr_validate_tcam_cnt(struct tf *tfp __rte_unused,
+ struct cfa_tcam_mgr_data *tcam_mgr_data,
+ uint16_t tcam_cnt[]
+ [CFA_TCAM_MGR_TBL_TYPE_MAX])
+{
+ struct cfa_tcam_mgr_table_data *table_data;
+ unsigned int dir, type;
+ uint16_t requested_cnt;
+
+ /* Validate session request */
+ for (dir = 0; dir < ARRAY_SIZE(tcam_mgr_data->cfa_tcam_mgr_tables);
+ dir++) {
+ for (type = 0;
+ type < ARRAY_SIZE(tcam_mgr_data->cfa_tcam_mgr_tables[dir]);
+ type++) {
+ table_data =
+ &tcam_mgr_data->cfa_tcam_mgr_tables[dir][type];
+ requested_cnt = tcam_cnt[dir][type];
+ /* Only check if table supported (max_entries > 0). */
+ if (table_data->max_entries > 0 &&
+ requested_cnt > table_data->max_entries) {
+ PMD_DRV_LOG_LINE(ERR,
+ "%s: %s Requested %d, available %d",
+ tf_dir_2_str(dir),
+ cfa_tcam_mgr_tbl_2_str(type),
+ requested_cnt,
+ table_data->max_entries);
+ return -CFA_TCAM_MGR_ERR_CODE(NOSPC);
+ }
+ }
+ }
+
+ return 0;
+}
+
+static int cfa_tcam_mgr_free_entries(struct tf *tfp)
+{
+ struct cfa_tcam_mgr_free_parms free_parms;
+ struct cfa_tcam_mgr_data *tcam_mgr_data;
+ struct tf_session *tfs;
+ int entry_id = 0;
+ int rc = 0;
+
+ PMD_DRV_LOG_LINE(DEBUG, "Unbinding session");
+
+ rc = tf_session_get_session_internal(tfp, &tfs);
+ if (rc)
+ return rc;
+
+ tcam_mgr_data = tfs->tcam_mgr_handle;
+ memset(&free_parms, 0, sizeof(free_parms));
+
+ /*
+ * Since we are freeing all pending TCAM entries (which is typically
+ * done during tcam_unbind), we don't know the type of each entry.
+ * So we set the type to MAX as a hint to cfa_tcam_mgr_free() to
+ * figure out the actual type. We need to set it through each
+ * iteration in the loop below; otherwise, the type determined for
+ * the first entry would be used for subsequent entries that may or
+ * may not be of the same type, resulting in errors.
+ */
+
+ while ((entry_id = ba_find_next_inuse_free(tcam_mgr_data->session_bmp,
+ 0)) >= 0) {
+ free_parms.id = entry_id;
+ free_parms.type = CFA_TCAM_MGR_TBL_TYPE_MAX;
+ cfa_tcam_mgr_free(tfp, &free_parms);
}
return 0;
@@ -1027,7 +1210,7 @@ cfa_tcam_mgr_qcaps(struct cfa_tcam_mgr_context *context __rte_unused,
* and also update the sizes in the tcam count array
*/
static int
-cfa_tcam_mgr_shared_wc_bind(uint32_t sess_idx, bool dual_ha_app,
+cfa_tcam_mgr_shared_wc_bind(struct tf *tfp, bool dual_ha_app,
uint16_t tcam_cnt[][CFA_TCAM_MGR_TBL_TYPE_MAX])
{
uint16_t start_row, end_row, max_entries, slices;
@@ -1036,13 +1219,13 @@ cfa_tcam_mgr_shared_wc_bind(uint32_t sess_idx, bool dual_ha_app,
int rc;
for (dir = 0; dir < TF_DIR_MAX; dir++) {
- rc = cfa_tcam_mgr_tables_get(sess_idx, dir,
+ rc = cfa_tcam_mgr_tables_get(tfp, dir,
CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_APPS,
&start_row, &end_row, &max_entries, &slices);
if (rc)
return rc;
if (max_entries) {
- rc = cfa_tcam_mgr_tables_set(sess_idx, dir,
+ rc = cfa_tcam_mgr_tables_set(tfp, dir,
CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_HIGH_APPS,
start_row,
start_row +
@@ -1050,7 +1233,7 @@ cfa_tcam_mgr_shared_wc_bind(uint32_t sess_idx, bool dual_ha_app,
max_entries / num_pools);
if (rc)
return rc;
- rc = cfa_tcam_mgr_tables_set(sess_idx, dir,
+ rc = cfa_tcam_mgr_tables_set(tfp, dir,
CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_LOW_APPS,
start_row +
((max_entries / slices) / num_pools),
@@ -1059,7 +1242,7 @@ cfa_tcam_mgr_shared_wc_bind(uint32_t sess_idx, bool dual_ha_app,
max_entries / num_pools);
if (rc)
return rc;
- rc = cfa_tcam_mgr_tables_set(sess_idx, dir,
+ rc = cfa_tcam_mgr_tables_set(tfp, dir,
CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_APPS,
0, 0, 0);
if (rc)
@@ -1076,24 +1259,24 @@ cfa_tcam_mgr_shared_wc_bind(uint32_t sess_idx, bool dual_ha_app,
}
int
-cfa_tcam_mgr_bind(struct cfa_tcam_mgr_context *context,
+cfa_tcam_mgr_bind(struct tf *tfp,
struct cfa_tcam_mgr_cfg_parms *parms)
{
- struct cfa_tcam_mgr_table_data *table_data;
+ struct cfa_tcam_mgr_table_data *table_data;
+ enum cfa_tcam_mgr_device_type device_type;
+ struct cfa_tcam_mgr_data *tcam_mgr_data;
struct tf_dev_info *dev;
- unsigned int dir;
- int rc, sess_idx;
- uint32_t session_id;
struct tf_session *tfs;
- unsigned int type;
int prev_max_entries;
+ unsigned int type;
int start, stride;
- enum cfa_tcam_mgr_device_type device_type;
+ unsigned int dir;
+ int rc;
- CFA_TCAM_MGR_CHECK_PARMS2(context, parms);
+ CFA_TCAM_MGR_CHECK_PARMS2(tfp, parms);
/* Retrieve the session information */
- rc = tf_session_get_session_internal(context->tfp, &tfs);
+ rc = tf_session_get_session_internal(tfp, &tfs);
if (rc)
return rc;
@@ -1106,9 +1289,6 @@ cfa_tcam_mgr_bind(struct cfa_tcam_mgr_context *context,
case TF_DEVICE_TYPE_P4:
device_type = CFA_TCAM_MGR_DEVICE_TYPE_P4;
break;
- case TF_DEVICE_TYPE_SR:
- device_type = CFA_TCAM_MGR_DEVICE_TYPE_SR;
- break;
case TF_DEVICE_TYPE_P5:
device_type = CFA_TCAM_MGR_DEVICE_TYPE_P5;
break;
@@ -1117,27 +1297,21 @@ cfa_tcam_mgr_bind(struct cfa_tcam_mgr_context *context,
return -CFA_TCAM_MGR_ERR_CODE(NODEV);
}
- rc = cfa_tcam_mgr_get_session_from_context(context, &session_id);
- if (rc < 0)
- return rc;
-
- sess_idx = cfa_tcam_mgr_session_add(session_id);
- if (sess_idx < 0)
- return sess_idx;
-
- if (global_data_initialized[sess_idx] == 0) {
- rc = cfa_tcam_mgr_init(sess_idx, device_type, NULL);
- if (rc < 0)
+ tcam_mgr_data = tfs->tcam_mgr_handle;
+ if (!tcam_mgr_data) {
+ rc = cfa_tcam_mgr_init(tfp, device_type, NULL);
+ if (rc)
return rc;
+ tcam_mgr_data = tfs->tcam_mgr_handle;
}
- if (parms->num_elements != ARRAY_SIZE(cfa_tcam_mgr_tables[sess_idx][dir])) {
+ if (parms->num_elements !=
+ ARRAY_SIZE(tcam_mgr_data->cfa_tcam_mgr_tables[dir])) {
CFA_TCAM_MGR_LOG(ERR,
"Session element count (%d) differs "
- "from table count (%zu) for sess_idx %d.\n",
+ "from table count (%zu)\n",
parms->num_elements,
- ARRAY_SIZE(cfa_tcam_mgr_tables[sess_idx][dir]),
- sess_idx);
+ ARRAY_SIZE(tcam_mgr_data->cfa_tcam_mgr_tables[dir]));
return -CFA_TCAM_MGR_ERR_CODE(INVAL);
}
@@ -1145,48 +1319,51 @@ cfa_tcam_mgr_bind(struct cfa_tcam_mgr_context *context,
* Only managing one session. resv_res contains the resources allocated
* to this session by the resource manager. Update the limits on TCAMs.
*/
- for (dir = 0; dir < ARRAY_SIZE(cfa_tcam_mgr_tables[sess_idx]); dir++) {
+ for (dir = 0; dir < ARRAY_SIZE(tcam_mgr_data->cfa_tcam_mgr_tables);
+ dir++) {
for (type = 0;
- type < ARRAY_SIZE(cfa_tcam_mgr_tables[sess_idx][dir]);
+ type <
+ ARRAY_SIZE(tcam_mgr_data->cfa_tcam_mgr_tables[dir]);
type++) {
- table_data = &cfa_tcam_mgr_tables[sess_idx][dir][type];
+ table_data =
+ &tcam_mgr_data->cfa_tcam_mgr_tables[dir][type];
prev_max_entries = table_data->max_entries;
/*
* In AFM logical tables, max_entries is initialized to
* zero. These logical tables are not used when TCAM
* Manager is in the core so skip.
*/
- if (prev_max_entries == 0)
+ if (!prev_max_entries)
continue;
start = parms->resv_res[dir][type].start;
stride = parms->resv_res[dir][type].stride;
if (start % table_data->max_slices > 0) {
CFA_TCAM_MGR_LOG_DIR_TYPE(ERR, dir, type,
- "Start of resources (%d) for table(%d) "
- "does not begin on row boundary.\n",
- start, sess_idx);
+ "%s: %s Resource:%d not row bounded\n",
+ tf_dir_2_str(dir),
+ cfa_tcam_mgr_tbl_2_str(type),
+ start);
CFA_TCAM_MGR_LOG_DIR(ERR, dir,
- "Start is %d, number of slices "
- "is %d.\n",
- start,
+ "%s: Start:%d, num slices:%d\n",
+ tf_dir_2_str(dir), start,
table_data->max_slices);
- (void)cfa_tcam_mgr_session_free(session_id, context);
+ cfa_tcam_mgr_free_entries(tfp);
return -CFA_TCAM_MGR_ERR_CODE(INVAL);
}
if (stride % table_data->max_slices > 0) {
CFA_TCAM_MGR_LOG_DIR_TYPE(ERR, dir, type,
- "Stride of resources (%d) for table(%d) "
- "does not end on row boundary.\n",
- stride, sess_idx);
+ "%s: %s Resource:%d not row bound\n",
+ tf_dir_2_str(dir),
+ cfa_tcam_mgr_tbl_2_str(type),
+ stride);
CFA_TCAM_MGR_LOG_DIR(ERR, dir,
- "Stride is %d, number of "
- "slices is %d.\n",
- stride,
+ "%s: Stride:%d num slices:%d\n",
+ tf_dir_2_str(dir), stride,
table_data->max_slices);
- (void)cfa_tcam_mgr_session_free(session_id, context);
+ cfa_tcam_mgr_free_entries(tfp);
return -CFA_TCAM_MGR_ERR_CODE(INVAL);
}
- if (stride == 0) {
+ if (!stride) {
table_data->start_row = 0;
table_data->end_row = 0;
table_data->max_entries = 0;
@@ -1200,22 +1377,27 @@ cfa_tcam_mgr_bind(struct cfa_tcam_mgr_context *context,
(table_data->end_row -
table_data->start_row + 1);
}
- cfa_tcam_mgr_max_entries[sess_idx] += (table_data->max_entries -
- prev_max_entries);
+ tcam_mgr_data->cfa_tcam_mgr_max_entries +=
+ (table_data->max_entries - prev_max_entries);
}
}
+ CFA_TCAM_MGR_LOG(DEBUG, "TCAM table bind for max entries %d.\n",
+ tcam_mgr_data->cfa_tcam_mgr_max_entries);
+
if (tf_session_is_shared_hotup_session(tfs)) {
- rc = cfa_tcam_mgr_shared_wc_bind(sess_idx, false, parms->tcam_cnt);
+ rc = cfa_tcam_mgr_shared_wc_bind(tfp, false,
+ parms->tcam_cnt);
if (rc) {
- (void)cfa_tcam_mgr_session_free(session_id, context);
+ cfa_tcam_mgr_free_entries(tfp);
return rc;
}
}
- rc = cfa_tcam_mgr_session_cfg(session_id, parms->tcam_cnt);
- if (rc < 0) {
- (void)cfa_tcam_mgr_session_free(session_id, context);
+ rc = cfa_tcam_mgr_validate_tcam_cnt(tfp, tcam_mgr_data,
+ parms->tcam_cnt);
+ if (rc) {
+ cfa_tcam_mgr_free_entries(tfp);
return rc;
}
@@ -1228,48 +1410,104 @@ cfa_tcam_mgr_bind(struct cfa_tcam_mgr_context *context,
}
int
-cfa_tcam_mgr_unbind(struct cfa_tcam_mgr_context *context)
+cfa_tcam_mgr_unbind(struct tf *tfp)
{
- int rc, sess_idx;
- uint32_t session_id;
+ enum cfa_tcam_mgr_device_type device_type;
+ struct cfa_tcam_mgr_data *tcam_mgr_data;
+ struct tf_dev_info *dev;
+ struct tf_session *tfs;
+ int rc;
- CFA_TCAM_MGR_CHECK_PARMS1(context);
+ CFA_TCAM_MGR_CHECK_PARMS1(tfp);
- rc = cfa_tcam_mgr_get_session_from_context(context, &session_id);
- if (rc < 0)
+ rc = tf_session_get_session_internal(tfp, &tfs);
+ if (rc)
return rc;
- sess_idx = cfa_tcam_mgr_session_find(session_id);
- if (sess_idx < 0) {
- CFA_TCAM_MGR_LOG_0(ERR, "Session not found.\n");
- return sess_idx;
+ /* Retrieve the device information */
+ rc = tf_session_get_device(tfs, &dev);
+ if (rc)
+ return rc;
+
+ switch (dev->type) {
+ case TF_DEVICE_TYPE_P4:
+ device_type = CFA_TCAM_MGR_DEVICE_TYPE_P4;
+ break;
+ case TF_DEVICE_TYPE_P5:
+ device_type = CFA_TCAM_MGR_DEVICE_TYPE_P5;
+ break;
+ default:
+ PMD_DRV_LOG_LINE(DEBUG,
+ "TF tcam get dev type failed");
+ return -CFA_TCAM_MGR_ERR_CODE(NODEV);
}
- if (global_data_initialized[sess_idx] == 0) {
- CFA_TCAM_MGR_LOG(INFO, "PANIC: No TCAM data created for sess_idx %d\n",
- sess_idx);
+ tcam_mgr_data = tfs->tcam_mgr_handle;
+ if (!tcam_mgr_data) {
+ PMD_DRV_LOG_LINE(ERR,
+ "No TCAM data created for session");
return -CFA_TCAM_MGR_ERR_CODE(PERM);
}
- (void)cfa_tcam_mgr_session_free(session_id, context);
+ cfa_tcam_mgr_free_entries(tfp);
+ cfa_tcam_mgr_uninit(tfp, device_type);
+
+ return 0;
+}
+
+static int cfa_tcam_mgr_alloc_entry(struct tf *tfp __rte_unused,
+ struct cfa_tcam_mgr_data *tcam_mgr_data,
+ enum tf_dir dir __rte_unused)
+{
+ int32_t free_idx;
+
+ /* Scan bitmap to get the free pool */
+ free_idx = ba_alloc(tcam_mgr_data->session_bmp);
+ if (free_idx == BA_FAIL) {
+ PMD_DRV_LOG_LINE(ERR,
+ "Table full (session)");
+ return -CFA_TCAM_MGR_ERR_CODE(NOSPC);
+ }
+
+ return free_idx;
+}
+
+static int cfa_tcam_mgr_free_entry(struct tf *tfp __rte_unused,
+ struct cfa_tcam_mgr_data *tcam_mgr_data,
+ unsigned int entry_id,
+ enum tf_dir dir __rte_unused,
+ enum cfa_tcam_mgr_tbl_type type __rte_unused)
+{
+ int rc = 0;
+
+ if (entry_id >= tcam_mgr_data->session_bmp_size)
+ return -CFA_TCAM_MGR_ERR_CODE(INVAL);
+
+ rc = ba_free(tcam_mgr_data->session_bmp, entry_id);
+ if (rc)
+ return rc;
+
+ PMD_DRV_LOG_LINE(INFO,
+ "Remove session from entry %d",
+ entry_id);
- global_data_initialized[sess_idx] = 0;
return 0;
}
int
-cfa_tcam_mgr_alloc(struct cfa_tcam_mgr_context *context,
+cfa_tcam_mgr_alloc(struct tf *tfp,
struct cfa_tcam_mgr_alloc_parms *parms)
{
- struct cfa_tcam_mgr_entry_data entry;
+ struct cfa_tcam_mgr_table_data *table_data;
+ struct cfa_tcam_mgr_data *tcam_mgr_data;
struct cfa_tcam_mgr_table_rows_0 *row;
- struct cfa_tcam_mgr_table_data *table_data;
+ struct cfa_tcam_mgr_entry_data entry;
+ struct tf_session *tfs;
+ int key_slices, rc;
int dir, tbl_type;
- int key_slices, rc, sess_idx;
int new_entry_id;
- uint32_t session_id;
- CFA_TCAM_MGR_CHECK_PARMS2(context, parms);
+ CFA_TCAM_MGR_CHECK_PARMS2(tfp, parms);
dir = parms->dir;
tbl_type = parms->type;
@@ -1289,40 +1527,31 @@ cfa_tcam_mgr_alloc(struct cfa_tcam_mgr_context *context,
#if TF_TCAM_PRIORITY_MAX < UINT16_MAX
if (parms->priority > TF_TCAM_PRIORITY_MAX) {
CFA_TCAM_MGR_LOG_DIR(ERR, dir,
- "Priority (%u) out of range (%u -%u).\n",
- parms->priority,
+ "%s: Priority:%u out of range (%u-%u).\n",
+ tf_dir_2_str(dir), parms->priority,
TF_TCAM_PRIORITY_MIN,
TF_TCAM_PRIORITY_MAX);
}
#endif
- /* Check for session limits */
- rc = cfa_tcam_mgr_get_session_from_context(context, &session_id);
- if (rc < 0)
+ rc = tf_session_get_session_internal(tfp, &tfs);
+ if (rc)
return rc;
- sess_idx = cfa_tcam_mgr_session_find(session_id);
- if (sess_idx < 0) {
- CFA_TCAM_MGR_LOG(ERR, "Session 0x%08x not found.\n",
- session_id);
- return -CFA_TCAM_MGR_ERR_CODE(NODEV);
- }
-
- if (global_data_initialized[sess_idx] == 0) {
- CFA_TCAM_MGR_LOG(ERR, "PANIC: No TCAM data created for sess_idx %d\n",
- sess_idx);
+ tcam_mgr_data = tfs->tcam_mgr_handle;
+ if (!tcam_mgr_data) {
+ CFA_TCAM_MGR_LOG(ERR, "No TCAM data created for session\n");
return -CFA_TCAM_MGR_ERR_CODE(PERM);
}
- table_data = &cfa_tcam_mgr_tables[sess_idx][dir][tbl_type];
+ table_data = &tcam_mgr_data->cfa_tcam_mgr_tables[dir][tbl_type];
- if (parms->key_size == 0 ||
+ if (!parms->key_size ||
parms->key_size > table_data->row_width) {
CFA_TCAM_MGR_LOG_DIR(ERR, dir,
- "Invalid key size:%d (range 1-%d) sess_idx %d.\n",
+ "Invalid key size:%d (range 1-%d).\n",
parms->key_size,
- table_data->row_width,
- sess_idx);
+ table_data->row_width);
return -CFA_TCAM_MGR_ERR_CODE(INVAL);
}
@@ -1330,53 +1559,51 @@ cfa_tcam_mgr_alloc(struct cfa_tcam_mgr_context *context,
if (table_data->used_entries >=
table_data->max_entries) {
CFA_TCAM_MGR_LOG_DIR_TYPE(ERR, dir, tbl_type,
- "Table full sess_idx %d.\n",
- sess_idx);
+ "Table full.\n");
return -CFA_TCAM_MGR_ERR_CODE(NOSPC);
}
/* There is room, now increment counts and allocate an entry. */
- new_entry_id = cfa_tcam_mgr_session_entry_alloc(session_id,
- parms->dir,
- parms->type);
+ new_entry_id = cfa_tcam_mgr_alloc_entry(tfp, tcam_mgr_data, parms->dir);
if (new_entry_id < 0)
return new_entry_id;
memset(&entry, 0, sizeof(entry));
entry.ref_cnt++;
+ PMD_DRV_LOG_LINE(INFO, "Allocated entry ID %d.", new_entry_id);
+
key_slices = cfa_tcam_mgr_get_num_slices(parms->key_size,
(table_data->row_width /
table_data->max_slices));
- row = cfa_tcam_mgr_empty_row_alloc(sess_idx, context, parms, &entry,
+ row = cfa_tcam_mgr_empty_row_alloc(tcam_mgr_data, tfp, parms, &entry,
new_entry_id, key_slices);
- if (row == NULL) {
+ if (!row) {
CFA_TCAM_MGR_LOG_DIR_TYPE(ERR, parms->dir, parms->type,
- "Table full (HW) sess_idx %d.\n",
- sess_idx);
- (void)cfa_tcam_mgr_session_entry_free(session_id, new_entry_id,
- parms->dir, parms->type);
+ "Table full (HW).\n");
+ cfa_tcam_mgr_free_entry(tfp, tcam_mgr_data, new_entry_id,
+ parms->dir, parms->type);
return -CFA_TCAM_MGR_ERR_CODE(NOSPC);
}
- memcpy(&entry_data[sess_idx][new_entry_id],
+ memcpy(&tcam_mgr_data->entry_data[new_entry_id],
&entry,
- sizeof(entry_data[sess_idx][new_entry_id]));
+ sizeof(tcam_mgr_data->entry_data[new_entry_id]));
table_data->used_entries += 1;
- cfa_tcam_mgr_entry_insert(sess_idx, new_entry_id, &entry);
+ cfa_tcam_mgr_entry_insert(tcam_mgr_data, tfp, new_entry_id, &entry);
parms->id = new_entry_id;
#ifdef TF_FLOW_SCALE_QUERY
/* CFA update usage state */
- if (tf_tcam_usage_update(session_id,
+ if (tf_tcam_usage_update(tfp,
parms->dir,
parms->type,
row,
TF_RESC_ALLOC)) {
- CFA_TCAM_MGR_TRACE(DEBUG, "TF tcam usage update failed\n");
+ PMD_DRV_LOG_LINE(DEBUG, "TF tcam usage update failed");
}
#endif /* TF_FLOW_SCALE_QUERY */
@@ -1384,46 +1611,38 @@ cfa_tcam_mgr_alloc(struct cfa_tcam_mgr_context *context,
}
int
-cfa_tcam_mgr_free(struct cfa_tcam_mgr_context *context,
+cfa_tcam_mgr_free(struct tf *tfp,
struct cfa_tcam_mgr_free_parms *parms)
{
+ struct cfa_tcam_mgr_table_data *table_data;
+ struct cfa_tcam_mgr_data *tcam_mgr_data;
struct cfa_tcam_mgr_entry_data *entry;
struct cfa_tcam_mgr_table_rows_0 *row;
- struct cfa_tcam_mgr_table_data *table_data;
- int row_size, rc, sess_idx, new_row_to_free;
- uint32_t session_id;
+ int row_size, rc, new_row_to_free;
+ struct tf_session *tfs;
uint16_t id;
- CFA_TCAM_MGR_CHECK_PARMS2(context, parms);
+ CFA_TCAM_MGR_CHECK_PARMS2(tfp, parms);
- rc = cfa_tcam_mgr_get_session_from_context(context, &session_id);
- if (rc < 0)
+ rc = tf_session_get_session_internal(tfp, &tfs);
+ if (rc)
return rc;
- sess_idx = cfa_tcam_mgr_session_find(session_id);
- if (sess_idx < 0) {
- CFA_TCAM_MGR_LOG(ERR, "Session 0x%08x not found.\n",
- session_id);
- return sess_idx;
- }
-
- if (global_data_initialized[sess_idx] == 0) {
- CFA_TCAM_MGR_LOG(INFO, "PANIC: No TCAM data created for sess_idx %d\n",
- sess_idx);
+ tcam_mgr_data = tfs->tcam_mgr_handle;
+ if (!tcam_mgr_data) {
+ CFA_TCAM_MGR_LOG(ERR, "No TCAM data created for session\n");
return -CFA_TCAM_MGR_ERR_CODE(PERM);
}
id = parms->id;
- entry = cfa_tcam_mgr_entry_get(sess_idx, id);
- if (entry == NULL) {
- CFA_TCAM_MGR_LOG(INFO, "Entry %d not found for sess_idx %d.\n",
- id, sess_idx);
+ entry = cfa_tcam_mgr_entry_get(tcam_mgr_data, id);
+ if (!entry) {
+ CFA_TCAM_MGR_LOG(INFO, "Entry %d not found\n", id);
return -CFA_TCAM_MGR_ERR_CODE(INVAL);
}
- if (entry->ref_cnt == 0) {
- CFA_TCAM_MGR_LOG(ERR, "Entry %d not in use for sess_idx %d.\n",
- id, sess_idx);
+ if (!entry->ref_cnt) {
+ CFA_TCAM_MGR_LOG(ERR, "Entry %d not in use.\n", id);
return -CFA_TCAM_MGR_ERR_CODE(INVAL);
}
@@ -1439,30 +1658,38 @@ cfa_tcam_mgr_free(struct cfa_tcam_mgr_context *context,
*/
if (parms->type == CFA_TCAM_MGR_TBL_TYPE_MAX) {
/* Need to search for the entry in the tables */
- rc = cfa_tcam_mgr_entry_find(sess_idx, id, &parms->dir, &parms->type);
- if (rc < 0) {
- CFA_TCAM_MGR_LOG(ERR, "Entry %d not in tables for sess_idx %d.\n",
- id, sess_idx);
+ rc = cfa_tcam_mgr_entry_find(tcam_mgr_data, id, &parms->dir,
+ &parms->type);
+ if (rc) {
+ CFA_TCAM_MGR_LOG(ERR,
+ "Entry %d not in tables\n", id);
return rc;
}
+ PMD_DRV_LOG_LINE(INFO, "id: %d dir: 0x%x type: 0x%x",
+ id, parms->dir, parms->type);
}
- table_data = &cfa_tcam_mgr_tables[sess_idx][parms->dir][parms->type];
+ table_data =
+ &tcam_mgr_data->cfa_tcam_mgr_tables[parms->dir][parms->type];
parms->hcapi_type = table_data->hcapi_type;
- row_size = cfa_tcam_mgr_row_size_get(sess_idx, parms->dir, parms->type);
+ row_size = cfa_tcam_mgr_row_size_get(tcam_mgr_data, parms->dir,
+ parms->type);
row = cfa_tcam_mgr_row_ptr_get(table_data->tcam_rows, entry->row,
row_size);
entry->ref_cnt--;
- (void)cfa_tcam_mgr_session_entry_free(session_id, id,
- parms->dir, parms->type);
+ cfa_tcam_mgr_free_entry(tfp, tcam_mgr_data, id, parms->dir,
+ parms->type);
- if (entry->ref_cnt == 0) {
- cfa_tcam_mgr_entry_free_msg(sess_idx, context, parms,
- entry->row,
+ if (!entry->ref_cnt) {
+ PMD_DRV_LOG_LINE(INFO,
+ "Freeing entry %d, row %d, slice %d.",
+ id, entry->row, entry->slice);
+ cfa_tcam_mgr_entry_free_msg(tcam_mgr_data, tfp,
+ parms, entry->row,
entry->slice * row->entry_size,
table_data->row_width /
table_data->max_slices *
@@ -1473,81 +1700,82 @@ cfa_tcam_mgr_free(struct cfa_tcam_mgr_context *context,
#ifdef TF_FLOW_SCALE_QUERY
/* CFA update usage state */
- if (tf_tcam_usage_update(session_id,
+ if (tf_tcam_usage_update(tfp,
parms->dir,
parms->type,
row,
TF_RESC_FREE)) {
- CFA_TCAM_MGR_TRACE(DEBUG, "TF tcam usage update failed\n");
+ PMD_DRV_LOG_LINE(DEBUG, "TF tcam usage update failed");
}
#endif /* TF_FLOW_SCALE_QUERY */
new_row_to_free = entry->row;
- cfa_tcam_mgr_rows_combine(sess_idx, context, parms, table_data,
- new_row_to_free);
+ cfa_tcam_mgr_rows_combine(tcam_mgr_data, tfp, parms,
+ table_data, new_row_to_free);
if (!ROW_INUSE(row)) {
- cfa_tcam_mgr_rows_compact(sess_idx, context,
+ cfa_tcam_mgr_rows_compact(tcam_mgr_data, tfp,
parms, table_data,
&new_row_to_free,
new_row_to_free);
if (new_row_to_free >= 0)
- cfa_tcam_mgr_entry_free_msg(sess_idx, context, parms,
+ cfa_tcam_mgr_entry_free_msg(tcam_mgr_data,
+ tfp, parms,
new_row_to_free, 0,
table_data->row_width,
table_data->result_size,
table_data->max_slices);
}
- cfa_tcam_mgr_entry_delete(sess_idx, id);
+ cfa_tcam_mgr_entry_delete(tcam_mgr_data, tfp, id);
table_data->used_entries -= 1;
+ PMD_DRV_LOG_LINE(INFO, "Freed entry %d.", id);
+ } else {
+ PMD_DRV_LOG_LINE(INFO, "Entry %d ref cnt = %d.",
+ id,
+ entry->ref_cnt);
}
return 0;
}
int
-cfa_tcam_mgr_set(struct cfa_tcam_mgr_context *context,
+cfa_tcam_mgr_set(struct tf *tfp,
struct cfa_tcam_mgr_set_parms *parms)
{
+ struct cfa_tcam_mgr_table_data *table_data;
+ struct cfa_tcam_mgr_data *tcam_mgr_data;
struct cfa_tcam_mgr_entry_data *entry;
struct cfa_tcam_mgr_table_rows_0 *row;
- struct cfa_tcam_mgr_table_data *table_data;
- int rc;
- int row_size, sess_idx;
int entry_size_in_bytes;
- uint32_t session_id;
+ struct tf_session *tfs;
+ int row_size;
+ int rc;
- CFA_TCAM_MGR_CHECK_PARMS2(context, parms);
+ CFA_TCAM_MGR_CHECK_PARMS2(tfp, parms);
- rc = cfa_tcam_mgr_get_session_from_context(context, &session_id);
- if (rc < 0)
+ rc = tf_session_get_session_internal(tfp, &tfs);
+ if (rc)
return rc;
- sess_idx = cfa_tcam_mgr_session_find(session_id);
- if (sess_idx < 0) {
- CFA_TCAM_MGR_LOG(ERR, "Session 0x%08x not found.\n",
- session_id);
- return sess_idx;
- }
-
- if (global_data_initialized[sess_idx] == 0) {
- CFA_TCAM_MGR_LOG(ERR, "PANIC: No TCAM data created for sess_idx %d\n",
- sess_idx);
+ tcam_mgr_data = tfs->tcam_mgr_handle;
+ if (!tcam_mgr_data) {
+ CFA_TCAM_MGR_LOG(ERR, "No TCAM data created for session\n");
return -CFA_TCAM_MGR_ERR_CODE(PERM);
}
- entry = cfa_tcam_mgr_entry_get(sess_idx, parms->id);
- if (entry == NULL) {
- CFA_TCAM_MGR_LOG(ERR, "Entry %d not found for sess_idx %d.\n",
- parms->id, sess_idx);
+ entry = cfa_tcam_mgr_entry_get(tcam_mgr_data, parms->id);
+ if (!entry) {
+ CFA_TCAM_MGR_LOG(ERR, "Entry %d not found.\n", parms->id);
return -CFA_TCAM_MGR_ERR_CODE(INVAL);
}
- table_data = &cfa_tcam_mgr_tables[sess_idx][parms->dir][parms->type];
+ table_data =
+ &tcam_mgr_data->cfa_tcam_mgr_tables[parms->dir][parms->type];
parms->hcapi_type = table_data->hcapi_type;
- row_size = cfa_tcam_mgr_row_size_get(sess_idx, parms->dir, parms->type);
+ row_size = cfa_tcam_mgr_row_size_get(tcam_mgr_data, parms->dir,
+ parms->type);
row = cfa_tcam_mgr_row_ptr_get(table_data->tcam_rows, entry->row,
row_size);
@@ -1558,71 +1786,68 @@ cfa_tcam_mgr_set(struct cfa_tcam_mgr_context *context,
CFA_TCAM_MGR_LOG(ERR,
"Key size(%d) is different from entry "
"size(%d).\n",
- parms->key_size,
- entry_size_in_bytes);
+ parms->key_size, entry_size_in_bytes);
return -CFA_TCAM_MGR_ERR_CODE(INVAL);
}
- rc = cfa_tcam_mgr_entry_set_msg(sess_idx, context, parms,
+ rc = cfa_tcam_mgr_entry_set_msg(tcam_mgr_data, tfp, parms,
entry->row,
entry->slice * row->entry_size,
table_data->max_slices);
- if (rc < 0) {
+ if (rc) {
CFA_TCAM_MGR_LOG_0(ERR, "Failed to set TCAM data.\n");
return rc;
}
+ PMD_DRV_LOG_LINE(INFO, "Set data for entry %d", parms->id);
+
return 0;
}
int
-cfa_tcam_mgr_get(struct cfa_tcam_mgr_context *context __rte_unused,
+cfa_tcam_mgr_get(struct tf *tfp __rte_unused,
struct cfa_tcam_mgr_get_parms *parms)
{
+ struct cfa_tcam_mgr_table_data *table_data;
+ struct cfa_tcam_mgr_data *tcam_mgr_data;
struct cfa_tcam_mgr_entry_data *entry;
struct cfa_tcam_mgr_table_rows_0 *row;
- struct cfa_tcam_mgr_table_data *table_data;
+ struct tf_session *tfs;
+ int row_size;
int rc;
- int row_size, sess_idx;
- uint32_t session_id;
- CFA_TCAM_MGR_CHECK_PARMS2(context, parms);
+ CFA_TCAM_MGR_CHECK_PARMS2(tfp, parms);
- rc = cfa_tcam_mgr_get_session_from_context(context, &session_id);
- if (rc < 0)
+ rc = tf_session_get_session_internal(tfp, &tfs);
+ if (rc)
return rc;
- sess_idx = cfa_tcam_mgr_session_find(session_id);
- if (sess_idx < 0) {
- CFA_TCAM_MGR_LOG(ERR, "Session 0x%08x not found.\n",
- session_id);
- return sess_idx;
- }
-
- if (global_data_initialized[sess_idx] == 0) {
- CFA_TCAM_MGR_LOG(ERR, "PANIC: No TCAM data created for sess_idx %d\n",
- sess_idx);
+ tcam_mgr_data = tfs->tcam_mgr_handle;
+ if (!tcam_mgr_data) {
+ CFA_TCAM_MGR_LOG(ERR, "No TCAM data created for session\n");
return -CFA_TCAM_MGR_ERR_CODE(PERM);
}
- entry = cfa_tcam_mgr_entry_get(sess_idx, parms->id);
- if (entry == NULL) {
+ entry = cfa_tcam_mgr_entry_get(tcam_mgr_data, parms->id);
+ if (!entry) {
CFA_TCAM_MGR_LOG(ERR, "Entry %d not found.\n", parms->id);
return -CFA_TCAM_MGR_ERR_CODE(INVAL);
}
- table_data = &cfa_tcam_mgr_tables[sess_idx][parms->dir][parms->type];
+ table_data =
+ &tcam_mgr_data->cfa_tcam_mgr_tables[parms->dir][parms->type];
parms->hcapi_type = table_data->hcapi_type;
- row_size = cfa_tcam_mgr_row_size_get(sess_idx, parms->dir, parms->type);
+ row_size = cfa_tcam_mgr_row_size_get(tcam_mgr_data, parms->dir,
+ parms->type);
row = cfa_tcam_mgr_row_ptr_get(table_data->tcam_rows, entry->row,
row_size);
- rc = cfa_tcam_mgr_entry_get_msg(sess_idx, context, parms,
+ rc = cfa_tcam_mgr_entry_get_msg(tcam_mgr_data, tfp, parms,
entry->row,
entry->slice * row->entry_size,
table_data->max_slices);
- if (rc < 0) {
+ if (rc) {
CFA_TCAM_MGR_LOG_0(ERR, "Failed to read from TCAM.\n");
return rc;
}
@@ -1630,49 +1855,44 @@ cfa_tcam_mgr_get(struct cfa_tcam_mgr_context *context __rte_unused,
return 0;
}
-int cfa_tcam_mgr_shared_clear(struct cfa_tcam_mgr_context *context,
- struct cfa_tcam_mgr_shared_clear_parms *parms)
+int cfa_tcam_mgr_shared_clear(struct tf *tfp,
+ struct cfa_tcam_mgr_shared_clear_parms *parms)
{
- int rc;
- uint16_t row, slice = 0;
- int sess_idx;
- uint32_t session_id;
- struct cfa_tcam_mgr_free_parms fparms;
- struct cfa_tcam_mgr_table_data *table_data;
uint16_t start_row, end_row, max_entries, max_slices;
+ struct cfa_tcam_mgr_table_data *table_data;
+ struct cfa_tcam_mgr_data *tcam_mgr_data;
+ struct cfa_tcam_mgr_free_parms fparms;
+ uint16_t row, slice = 0;
+ struct tf_session *tfs;
+ int rc;
- CFA_TCAM_MGR_CHECK_PARMS2(context, parms);
+ CFA_TCAM_MGR_CHECK_PARMS2(tfp, parms);
- rc = cfa_tcam_mgr_get_session_from_context(context, &session_id);
- if (rc < 0)
+ rc = tf_session_get_session_internal(tfp, &tfs);
+ if (rc)
return rc;
- sess_idx = cfa_tcam_mgr_session_find(session_id);
- if (sess_idx < 0) {
- CFA_TCAM_MGR_LOG(ERR, "Session 0x%08x not found.\n",
- session_id);
- return sess_idx;
- }
-
- if (global_data_initialized[sess_idx] == 0) {
- CFA_TCAM_MGR_LOG(ERR, "PANIC: No TCAM data created for sess_idx %d\n",
- sess_idx);
+ tcam_mgr_data = tfs->tcam_mgr_handle;
+ if (!tcam_mgr_data) {
+ CFA_TCAM_MGR_LOG(ERR, "No TCAM data created for session\n");
return -CFA_TCAM_MGR_ERR_CODE(PERM);
}
- table_data = &cfa_tcam_mgr_tables[sess_idx][parms->dir][parms->type];
+ table_data =
+ &tcam_mgr_data->cfa_tcam_mgr_tables[parms->dir][parms->type];
fparms.dir = parms->dir;
fparms.type = parms->type;
fparms.hcapi_type = table_data->hcapi_type;
fparms.id = 0;
- rc = cfa_tcam_mgr_tables_get(sess_idx, parms->dir, parms->type,
- &start_row, &end_row, &max_entries, &max_slices);
+ rc = cfa_tcam_mgr_tables_get(tfp, parms->dir, parms->type,
+ &start_row, &end_row, &max_entries,
+ &max_slices);
if (rc)
return rc;
for (row = start_row; row <= end_row; row++) {
- cfa_tcam_mgr_entry_free_msg(sess_idx, context, &fparms,
+ cfa_tcam_mgr_entry_free_msg(tcam_mgr_data, tfp, &fparms,
row,
slice,
table_data->row_width,
@@ -1683,16 +1903,11 @@ int cfa_tcam_mgr_shared_clear(struct cfa_tcam_mgr_context *context,
}
static void
-cfa_tcam_mgr_mv_used_entries_cnt(int sess_idx, enum tf_dir dir,
- struct cfa_tcam_mgr_table_data *dst_table_data,
+cfa_tcam_mgr_mv_used_entries_cnt(struct cfa_tcam_mgr_table_data *dst_table_data,
struct cfa_tcam_mgr_table_data *src_table_data)
{
dst_table_data->used_entries++;
src_table_data->used_entries--;
-
- cfa_tcam_mgr_mv_session_used_entries_cnt(sess_idx, dir,
- CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_LOW_APPS,
- CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_HIGH_APPS);
}
/*
@@ -1700,33 +1915,34 @@ cfa_tcam_mgr_mv_used_entries_cnt(int sess_idx, enum tf_dir dir,
* This happens when secondary is becoming primary
*/
static int
-cfa_tcam_mgr_shared_entry_move(int sess_idx, struct cfa_tcam_mgr_context *context,
- enum tf_dir dir, enum cfa_tcam_mgr_tbl_type type,
- int entry_id,
- struct cfa_tcam_mgr_table_data *dst_table_data,
- struct cfa_tcam_mgr_table_data *table_data,
- int dst_row_index, int dst_row_slice,
- struct cfa_tcam_mgr_table_rows_0 *dst_row,
- int src_row_index,
- struct cfa_tcam_mgr_table_rows_0 *src_row)
+cfa_tcam_mgr_shared_entry_move(struct cfa_tcam_mgr_data *tcam_mgr_data,
+ struct tf *tfp,
+ enum tf_dir dir, enum cfa_tcam_mgr_tbl_type type,
+ int entry_id,
+ struct cfa_tcam_mgr_table_data *dst_table_data,
+ struct cfa_tcam_mgr_table_data *table_data,
+ int dst_row_index, int dst_row_slice,
+ struct cfa_tcam_mgr_table_rows_0 *dst_row,
+ int src_row_index,
+ struct cfa_tcam_mgr_table_rows_0 *src_row)
{
+ struct cfa_tcam_mgr_free_parms fparms = { 0 };
struct cfa_tcam_mgr_get_parms gparms = { 0 };
struct cfa_tcam_mgr_set_parms sparms = { 0 };
- struct cfa_tcam_mgr_free_parms fparms = { 0 };
- struct cfa_tcam_mgr_entry_data *entry;
- uint8_t key[CFA_TCAM_MGR_MAX_KEY_SIZE];
- uint8_t mask[CFA_TCAM_MGR_MAX_KEY_SIZE];
uint8_t result[CFA_TCAM_MGR_MAX_KEY_SIZE];
+ uint8_t mask[CFA_TCAM_MGR_MAX_KEY_SIZE];
+ uint8_t key[CFA_TCAM_MGR_MAX_KEY_SIZE];
+ struct cfa_tcam_mgr_entry_data *entry;
+ int rc;
+
/*
* Copy entry size before moving else if
* slice number is non zero and entry size is zero it will cause issues
*/
dst_row->entry_size = src_row->entry_size;
- int rc;
-
- entry = cfa_tcam_mgr_entry_get(sess_idx, entry_id);
- if (entry == NULL)
+ entry = cfa_tcam_mgr_entry_get(tcam_mgr_data, entry_id);
+ if (!entry)
return -1;
gparms.dir = dir;
@@ -1739,11 +1955,11 @@ cfa_tcam_mgr_shared_entry_move(int sess_idx, struct cfa_tcam_mgr_context *contex
gparms.key_size = sizeof(key);
gparms.result_size = sizeof(result);
- rc = cfa_tcam_mgr_entry_get_msg(sess_idx, context, &gparms,
+ rc = cfa_tcam_mgr_entry_get_msg(tcam_mgr_data, tfp, &gparms,
src_row_index,
entry->slice * src_row->entry_size,
table_data->max_slices);
- if (rc != 0)
+ if (rc)
return rc;
sparms.dir = dir;
@@ -1756,17 +1972,17 @@ cfa_tcam_mgr_shared_entry_move(int sess_idx, struct cfa_tcam_mgr_context *contex
sparms.key_size = gparms.key_size;
sparms.result_size = gparms.result_size;
- rc = cfa_tcam_mgr_entry_set_msg(sess_idx, context, &sparms,
+ rc = cfa_tcam_mgr_entry_set_msg(tcam_mgr_data, tfp, &sparms,
dst_row_index,
dst_row_slice * dst_row->entry_size,
table_data->max_slices);
- if (rc != 0)
+ if (rc)
return rc;
fparms.dir = dir;
fparms.type = type;
fparms.hcapi_type = table_data->hcapi_type;
- rc = cfa_tcam_mgr_entry_free_msg(sess_idx, context, &fparms,
+ rc = cfa_tcam_mgr_entry_free_msg(tcam_mgr_data, tfp, &fparms,
src_row_index,
entry->slice *
dst_row->entry_size,
@@ -1775,23 +1991,21 @@ cfa_tcam_mgr_shared_entry_move(int sess_idx, struct cfa_tcam_mgr_context *contex
src_row->entry_size,
table_data->result_size,
table_data->max_slices);
- if (rc != 0) {
+ if (rc)
CFA_TCAM_MGR_LOG_DIR_TYPE(ERR,
dir, type,
"Failed to free entry ID %d at"
- " row %d, slice %d for sess_idx %d. rc: %d.\n",
+ " row %d, slice %d. rc: %d.\n",
gparms.id,
src_row_index,
entry->slice,
- sess_idx,
-rc);
- }
#ifdef CFA_TCAM_MGR_TRACING
- CFA_TCAM_MGR_TRACE(INFO, "Moved entry %d from row %d, slice %d to "
- "row %d, slice %d.\n",
- entry_id, src_row_index, entry->slice,
- dst_row_index, dst_row_slice);
+ PMD_DRV_LOG_LINE(INFO, "Moved entry %d from row %d, slice %d to "
+ "row %d, slice %d.\n",
+ entry_id, src_row_index, entry->slice,
+ dst_row_index, dst_row_slice);
#endif
ROW_ENTRY_SET(dst_row, dst_row_slice);
@@ -1801,54 +2015,44 @@ cfa_tcam_mgr_shared_entry_move(int sess_idx, struct cfa_tcam_mgr_context *contex
entry->row = dst_row_index;
entry->slice = dst_row_slice;
- cfa_tcam_mgr_mv_used_entries_cnt(sess_idx, dir, dst_table_data, table_data);
-
-#ifdef CFA_TCAM_MGR_TRACING
- cfa_tcam_mgr_rows_dump(sess_idx, dir, type);
- cfa_tcam_mgr_rows_dump(sess_idx, dir, CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_LOW_APPS);
-#endif
+ cfa_tcam_mgr_mv_used_entries_cnt(dst_table_data, table_data);
return 0;
}
-int cfa_tcam_mgr_shared_move(struct cfa_tcam_mgr_context *context,
- struct cfa_tcam_mgr_shared_move_parms *parms)
+int cfa_tcam_mgr_shared_move(struct tf *tfp,
+ struct cfa_tcam_mgr_shared_move_parms *parms)
{
- int rc;
- int sess_idx;
- uint32_t session_id;
- uint16_t src_row, dst_row, row_size, slice;
struct cfa_tcam_mgr_table_rows_0 *src_table_row;
struct cfa_tcam_mgr_table_rows_0 *dst_table_row;
struct cfa_tcam_mgr_table_data *src_table_data;
struct cfa_tcam_mgr_table_data *dst_table_data;
+ uint16_t src_row, dst_row, row_size, slice;
+ struct cfa_tcam_mgr_data *tcam_mgr_data;
+ struct tf_session *tfs;
+ int rc;
- CFA_TCAM_MGR_CHECK_PARMS2(context, parms);
+ CFA_TCAM_MGR_CHECK_PARMS2(tfp, parms);
- rc = cfa_tcam_mgr_get_session_from_context(context, &session_id);
+ rc = tf_session_get_session_internal(tfp, &tfs);
if (rc < 0)
return rc;
- sess_idx = cfa_tcam_mgr_session_find(session_id);
- if (sess_idx < 0) {
- CFA_TCAM_MGR_LOG(ERR, "Session 0x%08x not found.\n",
- session_id);
- return sess_idx;
- }
-
- if (global_data_initialized[sess_idx] == 0) {
- CFA_TCAM_MGR_LOG(ERR, "PANIC: No TCAM data created for sess_idx %d\n",
- sess_idx);
+ tcam_mgr_data = tfs->tcam_mgr_handle;
+ if (!tcam_mgr_data) {
+ CFA_TCAM_MGR_LOG(ERR, "No TCAM data created for session\n");
return -CFA_TCAM_MGR_ERR_CODE(PERM);
}
src_table_data =
- &cfa_tcam_mgr_tables[sess_idx][parms->dir][CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_HIGH_APPS];
+ &tcam_mgr_data->cfa_tcam_mgr_tables[parms->dir]
+ [CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_HIGH_APPS];
dst_table_data =
- &cfa_tcam_mgr_tables[sess_idx][parms->dir][CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_LOW_APPS];
+ &tcam_mgr_data->cfa_tcam_mgr_tables[parms->dir]
+ [CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_LOW_APPS];
row_size =
- cfa_tcam_mgr_row_size_get(sess_idx,
+ cfa_tcam_mgr_row_size_get(tcam_mgr_data,
parms->dir,
CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_HIGH_APPS);
@@ -1866,15 +2070,15 @@ int cfa_tcam_mgr_shared_move(struct cfa_tcam_mgr_context *context,
slice++) {
if (ROW_ENTRY_INUSE(src_table_row, slice)) {
#ifdef CFA_TCAM_MGR_TRACING
- CFA_TCAM_MGR_TRACE(INFO, "Move entry id %d "
- "from src_row %d, slice %d "
- "to dst_row %d, slice %d.\n",
- src_table_row->entries[slice],
- src_row, slice,
- dst_row, slice);
+ PMD_DRV_LOG_LINE(INFO, "Move entry id %d "
+ "from src_row %d, slice %d "
+ "to dst_row %d, slice %d",
+ src_table_row->entries[slice],
+ src_row, slice,
+ dst_row, slice);
#endif
- rc = cfa_tcam_mgr_shared_entry_move(sess_idx,
- context,
+ rc = cfa_tcam_mgr_shared_entry_move(tcam_mgr_data,
+ tfp,
parms->dir,
CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_HIGH_APPS,
src_table_row->entries[slice],
@@ -1893,15 +2097,15 @@ int cfa_tcam_mgr_shared_move(struct cfa_tcam_mgr_context *context,
}
static void
-cfa_tcam_mgr_tbl_get(int sess_idx, enum tf_dir dir,
- enum cfa_tcam_mgr_tbl_type type,
- uint16_t *start_row,
- uint16_t *end_row,
- uint16_t *max_entries,
- uint16_t *slices)
+cfa_tcam_mgr_tbl_get(struct cfa_tcam_mgr_data *tcam_mgr_data, enum tf_dir dir,
+ enum cfa_tcam_mgr_tbl_type type,
+ uint16_t *start_row,
+ uint16_t *end_row,
+ uint16_t *max_entries,
+ uint16_t *slices)
{
struct cfa_tcam_mgr_table_data *table_data =
- &cfa_tcam_mgr_tables[sess_idx][dir][type];
+ &tcam_mgr_data->cfa_tcam_mgr_tables[dir][type];
/* Get start, end and max for tcam type*/
*start_row = table_data->start_row;
@@ -1911,51 +2115,59 @@ cfa_tcam_mgr_tbl_get(int sess_idx, enum tf_dir dir,
}
int
-cfa_tcam_mgr_tables_get(int sess_idx, enum tf_dir dir,
+cfa_tcam_mgr_tables_get(struct tf *tfp, enum tf_dir dir,
enum cfa_tcam_mgr_tbl_type type,
uint16_t *start_row,
uint16_t *end_row,
uint16_t *max_entries,
uint16_t *slices)
{
+ struct cfa_tcam_mgr_data *tcam_mgr_data;
+ struct tf_session *tfs;
+ int rc;
+
CFA_TCAM_MGR_CHECK_PARMS3(start_row, end_row, max_entries);
- if (global_data_initialized[sess_idx] == 0) {
- CFA_TCAM_MGR_LOG(ERR, "PANIC: TCAM not initialized for sess_idx %d.\n",
- sess_idx);
- return -CFA_TCAM_MGR_ERR_CODE(INVAL);
+ rc = tf_session_get_session_internal(tfp, &tfs);
+ if (rc)
+ return rc;
+
+ tcam_mgr_data = tfs->tcam_mgr_handle;
+ if (!tcam_mgr_data) {
+ CFA_TCAM_MGR_LOG_0(ERR, "No TCAM data created for session.\n");
+ return -CFA_TCAM_MGR_ERR_CODE(PERM);
}
if (dir >= TF_DIR_MAX) {
- CFA_TCAM_MGR_LOG(ERR, "Must specify valid dir (0-%d) forsess_idx %d.\n",
- TF_DIR_MAX - 1, sess_idx);
+ CFA_TCAM_MGR_LOG(ERR, "Must specify valid dir (0-%d).\n",
+ TF_DIR_MAX - 1);
return -CFA_TCAM_MGR_ERR_CODE(INVAL);
}
if (type >= CFA_TCAM_MGR_TBL_TYPE_MAX) {
- CFA_TCAM_MGR_LOG(ERR, "Must specify valid tbl type (0-%d) forsess_idx %d.\n",
- CFA_TCAM_MGR_TBL_TYPE_MAX - 1, sess_idx);
+ CFA_TCAM_MGR_LOG(ERR, "Must specify valid tbl type (0-%d).\n",
+ CFA_TCAM_MGR_TBL_TYPE_MAX - 1);
return -CFA_TCAM_MGR_ERR_CODE(INVAL);
}
- cfa_tcam_mgr_tbl_get(sess_idx, dir,
- type,
- start_row,
- end_row,
- max_entries,
- slices);
+ cfa_tcam_mgr_tbl_get(tcam_mgr_data, dir,
+ type,
+ start_row,
+ end_row,
+ max_entries,
+ slices);
return 0;
}
static void
-cfa_tcam_mgr_tbl_set(int sess_idx, enum tf_dir dir,
- enum cfa_tcam_mgr_tbl_type type,
- uint16_t start_row,
- uint16_t end_row,
- uint16_t max_entries)
+cfa_tcam_mgr_tbl_set(struct cfa_tcam_mgr_data *tcam_mgr_data, enum tf_dir dir,
+ enum cfa_tcam_mgr_tbl_type type,
+ uint16_t start_row,
+ uint16_t end_row,
+ uint16_t max_entries)
{
struct cfa_tcam_mgr_table_data *table_data =
- &cfa_tcam_mgr_tables[sess_idx][dir][type];
+ &tcam_mgr_data->cfa_tcam_mgr_tables[dir][type];
/* Update start, end and max for tcam type*/
table_data->start_row = start_row;
@@ -1964,197 +2176,42 @@ cfa_tcam_mgr_tbl_set(int sess_idx, enum tf_dir dir,
}
int
-cfa_tcam_mgr_tables_set(int sess_idx, enum tf_dir dir,
+cfa_tcam_mgr_tables_set(struct tf *tfp, enum tf_dir dir,
enum cfa_tcam_mgr_tbl_type type,
uint16_t start_row,
uint16_t end_row,
uint16_t max_entries)
{
- if (global_data_initialized[sess_idx] == 0) {
- CFA_TCAM_MGR_LOG(ERR, "PANIC: TCAM not initialized for sess_idx %d.\n",
- sess_idx);
- return -CFA_TCAM_MGR_ERR_CODE(INVAL);
+ struct cfa_tcam_mgr_data *tcam_mgr_data;
+ struct tf_session *tfs;
+ int rc;
+
+ rc = tf_session_get_session_internal(tfp, &tfs);
+ if (rc)
+ return rc;
+
+ tcam_mgr_data = tfs->tcam_mgr_handle;
+ if (!tcam_mgr_data) {
+ CFA_TCAM_MGR_LOG_0(ERR, "No TCAM data created for session.\n");
+ return -CFA_TCAM_MGR_ERR_CODE(PERM);
}
if (dir >= TF_DIR_MAX) {
- CFA_TCAM_MGR_LOG(ERR, "Must specify valid dir (0-%d) forsess_idx %d.\n",
- TF_DIR_MAX - 1, sess_idx);
+ CFA_TCAM_MGR_LOG(ERR, "Must specify valid dir (0-%d).\n",
+ TF_DIR_MAX - 1);
return -CFA_TCAM_MGR_ERR_CODE(INVAL);
}
if (type >= CFA_TCAM_MGR_TBL_TYPE_MAX) {
- CFA_TCAM_MGR_LOG(ERR, "Must specify valid tbl type (0-%d) forsess_idx %d.\n",
- CFA_TCAM_MGR_TBL_TYPE_MAX - 1, sess_idx);
+ CFA_TCAM_MGR_LOG(ERR, "Must specify valid tbl type (0-%d).\n",
+ CFA_TCAM_MGR_TBL_TYPE_MAX - 1);
return -CFA_TCAM_MGR_ERR_CODE(INVAL);
}
- cfa_tcam_mgr_tbl_set(sess_idx, dir,
- type,
- start_row,
- end_row,
- max_entries);
+ cfa_tcam_mgr_tbl_set(tcam_mgr_data, dir,
+ type,
+ start_row,
+ end_row,
+ max_entries);
return 0;
}
-
-void
-cfa_tcam_mgr_rows_dump(int sess_idx, enum tf_dir dir,
- enum cfa_tcam_mgr_tbl_type type)
-{
- struct cfa_tcam_mgr_table_data *table_data;
- struct cfa_tcam_mgr_table_rows_0 *table_row;
- int i, row, row_size;
- bool row_found = false;
- bool empty_row = false;
-
- if (global_data_initialized[sess_idx] == 0) {
- printf("PANIC: TCAM not initialized for sess_idx %d.\n", sess_idx);
- return;
- }
-
- if (dir >= TF_DIR_MAX) {
- printf("Must specify a valid direction (0-%d).\n",
- TF_DIR_MAX - 1);
- return;
- }
- if (type >= CFA_TCAM_MGR_TBL_TYPE_MAX) {
- printf("Must specify a valid type (0-%d).\n",
- CFA_TCAM_MGR_TBL_TYPE_MAX - 1);
- return;
- }
-
- table_data = &cfa_tcam_mgr_tables[sess_idx][dir][type];
- row_size = cfa_tcam_mgr_row_size_get(sess_idx, dir, type);
-
- printf("\nTCAM Rows:\n");
- printf("Rows for direction %s, Logical table type %s\n",
- tf_dir_2_str(dir), cfa_tcam_mgr_tbl_2_str(type));
- printf("Managed rows %d-%d for sess_idx %d:\n",
- table_data->start_row, table_data->end_row, sess_idx);
-
- printf("Index Pri Size Entry IDs\n");
- printf(" Sl 0");
- for (i = 1; i < table_data->max_slices; i++)
- printf(" Sl %d", i);
- printf("\n");
- for (row = table_data->start_row; row <= table_data->end_row; row++) {
- table_row = cfa_tcam_mgr_row_ptr_get(table_data->tcam_rows, row,
- row_size);
- if (ROW_INUSE(table_row)) {
- empty_row = false;
- printf("%5u %5u %4u",
- row,
- TF_TCAM_PRIORITY_MAX - table_row->priority - 1,
- table_row->entry_size);
- for (i = 0;
- i < table_data->max_slices / table_row->entry_size;
- i++) {
- if (ROW_ENTRY_INUSE(table_row, i))
- printf(" %5u", table_row->entries[i]);
- else
- printf(" x");
- }
- printf("\n");
- row_found = true;
- } else if (!empty_row) {
- empty_row = true;
- printf("\n");
- }
- }
-
- if (!row_found)
- printf("No rows in use.\n");
-}
-
-static void
-cfa_tcam_mgr_table_dump(int sess_idx, enum tf_dir dir,
- enum cfa_tcam_mgr_tbl_type type)
-{
- struct cfa_tcam_mgr_table_data *table_data =
- &cfa_tcam_mgr_tables[sess_idx][dir][type];
-
- printf("%3s %-22s %5u %5u %5u %5u %6u %7u %2u\n",
- tf_dir_2_str(dir),
- cfa_tcam_mgr_tbl_2_str(type),
- table_data->row_width,
- table_data->num_rows,
- table_data->start_row,
- table_data->end_row,
- table_data->max_entries,
- table_data->used_entries,
- table_data->max_slices);
-}
-
-#define TABLE_DUMP_HEADER \
- "Dir Table Width Rows Start End " \
- "MaxEnt UsedEnt Slices\n"
-
-void
-cfa_tcam_mgr_tables_dump(int sess_idx, enum tf_dir dir,
- enum cfa_tcam_mgr_tbl_type type)
-{
- if (global_data_initialized[sess_idx] == 0) {
- printf("PANIC: TCAM not initialized for sess_idx %d.\n", sess_idx);
- return;
- }
-
- printf("\nTCAM Table(s) for sess_idx %d:\n", sess_idx);
- printf(TABLE_DUMP_HEADER);
- if (dir >= TF_DIR_MAX) {
- /* Iterate over all directions */
- for (dir = 0; dir < TF_DIR_MAX; dir++) {
- if (type >= CFA_TCAM_MGR_TBL_TYPE_MAX) {
- /* Iterate over all types */
- for (type = 0;
- type < CFA_TCAM_MGR_TBL_TYPE_MAX;
- type++) {
- cfa_tcam_mgr_table_dump(sess_idx, dir, type);
- }
- } else {
- /* Display a specific type */
- cfa_tcam_mgr_table_dump(sess_idx, dir, type);
- }
- }
- } else if (type >= CFA_TCAM_MGR_TBL_TYPE_MAX) {
- /* Iterate over all types for a direction */
- for (type = 0; type < CFA_TCAM_MGR_TBL_TYPE_MAX; type++)
- cfa_tcam_mgr_table_dump(sess_idx, dir, type);
- } else {
- /* Display a specific direction and type */
- cfa_tcam_mgr_table_dump(sess_idx, dir, type);
- }
-}
-
-#define ENTRY_DUMP_HEADER "Entry RefCnt Row Slice\n"
-
-void
-cfa_tcam_mgr_entries_dump(int sess_idx)
-{
- struct cfa_tcam_mgr_entry_data *entry;
- bool entry_found = false;
- uint16_t id;
-
- if (global_data_initialized[sess_idx] == 0) {
- CFA_TCAM_MGR_LOG(INFO, "PANIC: No TCAM data created for sess_idx %d\n",
- sess_idx);
- return;
- }
-
- printf("\nGlobal Maximum Entries: %d\n\n",
- cfa_tcam_mgr_max_entries[sess_idx]);
- printf("TCAM Entry Table:\n");
- for (id = 0; id < cfa_tcam_mgr_max_entries[sess_idx]; id++) {
- if (entry_data[sess_idx][id].ref_cnt > 0) {
- entry = &entry_data[sess_idx][id];
- if (!entry_found)
- printf(ENTRY_DUMP_HEADER);
- printf("%5u %5u %5u %5u",
- id, entry->ref_cnt,
- entry->row, entry->slice);
- printf("\n");
- entry_found = true;
- }
- }
-
- if (!entry_found)
- printf("No entries found.\n");
-}
diff --git a/drivers/net/bnxt/tf_core/cfa_tcam_mgr.h b/drivers/net/bnxt/tf_core/cfa_tcam_mgr.h
index e6d81cb95a..d1471ca6ad 100644
--- a/drivers/net/bnxt/tf_core/cfa_tcam_mgr.h
+++ b/drivers/net/bnxt/tf_core/cfa_tcam_mgr.h
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2021-2023 Broadcom
+ * Copyright(c) 2021-2024 Broadcom
* All rights reserved.
*/
@@ -15,10 +15,6 @@
* The TCAM module provides processing of Internal TCAM types.
*/
-#ifndef TF_TCAM_MAX_SESSIONS
-#define TF_TCAM_MAX_SESSIONS 16
-#endif
-
#define ENTRY_ID_INVALID UINT16_MAX
#define TF_TCAM_PRIORITY_MIN 0
@@ -79,9 +75,10 @@
} \
} while (0)
+#define CFA_TCAM_MGR_TBL_TYPE_START 0
+
+/* Logical TCAM tables */
enum cfa_tcam_mgr_tbl_type {
- /* Logical TCAM tables */
- CFA_TCAM_MGR_TBL_TYPE_START,
CFA_TCAM_MGR_TBL_TYPE_L2_CTXT_TCAM_HIGH_AFM =
CFA_TCAM_MGR_TBL_TYPE_START,
CFA_TCAM_MGR_TBL_TYPE_L2_CTXT_TCAM_HIGH_APPS,
@@ -106,15 +103,10 @@ enum cfa_tcam_mgr_tbl_type {
enum cfa_tcam_mgr_device_type {
CFA_TCAM_MGR_DEVICE_TYPE_P4 = 0,
- CFA_TCAM_MGR_DEVICE_TYPE_SR,
CFA_TCAM_MGR_DEVICE_TYPE_P5,
CFA_TCAM_MGR_DEVICE_TYPE_MAX
};
-struct cfa_tcam_mgr_context {
- struct tf *tfp;
-};
-
/**
* TCAM Manager initialization parameters
*/
@@ -361,7 +353,7 @@ cfa_tcam_mgr_tbl_2_str(enum cfa_tcam_mgr_tbl_type tcam_type);
* - (<0) on failure.
*/
int
-cfa_tcam_mgr_init(int sess_idx, enum cfa_tcam_mgr_device_type type,
+cfa_tcam_mgr_init(struct tf *tfp, enum cfa_tcam_mgr_device_type type,
struct cfa_tcam_mgr_init_parms *parms);
/**
@@ -391,7 +383,7 @@ cfa_tcam_mgr_get_phys_table_type(enum cfa_tcam_mgr_tbl_type type);
* - (<0) on failure.
*/
int
-cfa_tcam_mgr_qcaps(struct cfa_tcam_mgr_context *context __rte_unused,
+cfa_tcam_mgr_qcaps(struct tf *tfp __rte_unused,
struct cfa_tcam_mgr_qcaps_parms *parms);
/**
@@ -408,7 +400,7 @@ cfa_tcam_mgr_qcaps(struct cfa_tcam_mgr_context *context __rte_unused,
* - (0) if successful.
* - (-EINVAL) on failure.
*/
-int cfa_tcam_mgr_bind(struct cfa_tcam_mgr_context *context,
+int cfa_tcam_mgr_bind(struct tf *tfp,
struct cfa_tcam_mgr_cfg_parms *parms);
/**
@@ -424,7 +416,7 @@ int cfa_tcam_mgr_bind(struct cfa_tcam_mgr_context *context,
* - (0) if successful.
* - (-EINVAL) on failure.
*/
-int cfa_tcam_mgr_unbind(struct cfa_tcam_mgr_context *context);
+int cfa_tcam_mgr_unbind(struct tf *tfp);
/**
* Allocates the requested tcam type from the internal RM DB.
@@ -439,7 +431,7 @@ int cfa_tcam_mgr_unbind(struct cfa_tcam_mgr_context *context);
* - (0) if successful.
* - (-EINVAL) on failure.
*/
-int cfa_tcam_mgr_alloc(struct cfa_tcam_mgr_context *context,
+int cfa_tcam_mgr_alloc(struct tf *tfp,
struct cfa_tcam_mgr_alloc_parms *parms);
/**
@@ -456,7 +448,7 @@ int cfa_tcam_mgr_alloc(struct cfa_tcam_mgr_context *context,
* - (0) if successful.
* - (-EINVAL) on failure.
*/
-int cfa_tcam_mgr_free(struct cfa_tcam_mgr_context *context,
+int cfa_tcam_mgr_free(struct tf *tfp,
struct cfa_tcam_mgr_free_parms *parms);
/**
@@ -473,7 +465,7 @@ int cfa_tcam_mgr_free(struct cfa_tcam_mgr_context *context,
* - (0) if successful.
* - (-EINVAL) on failure.
*/
-int cfa_tcam_mgr_set(struct cfa_tcam_mgr_context *context,
+int cfa_tcam_mgr_set(struct tf *tfp,
struct cfa_tcam_mgr_set_parms *parms);
/**
@@ -490,30 +482,27 @@ int cfa_tcam_mgr_set(struct cfa_tcam_mgr_context *context,
* - (0) if successful.
* - (-EINVAL) on failure.
*/
-int cfa_tcam_mgr_get(struct cfa_tcam_mgr_context *context,
+int cfa_tcam_mgr_get(struct tf *tfp,
struct cfa_tcam_mgr_get_parms *parms);
int
-cfa_tcam_mgr_tables_get(int sess_idx, enum tf_dir dir,
+cfa_tcam_mgr_tables_get(struct tf *tfp, enum tf_dir dir,
enum cfa_tcam_mgr_tbl_type type,
uint16_t *start_row,
uint16_t *end_row,
uint16_t *max_entries,
uint16_t *slices);
int
-cfa_tcam_mgr_tables_set(int sess_idx, enum tf_dir dir,
+cfa_tcam_mgr_tables_set(struct tf *tfp, enum tf_dir dir,
enum cfa_tcam_mgr_tbl_type type,
uint16_t start_row,
uint16_t end_row,
uint16_t max_entries);
-int cfa_tcam_mgr_shared_clear(struct cfa_tcam_mgr_context *context,
+int cfa_tcam_mgr_shared_clear(struct tf *tfp,
struct cfa_tcam_mgr_shared_clear_parms *parms);
-int cfa_tcam_mgr_shared_move(struct cfa_tcam_mgr_context *context,
+int cfa_tcam_mgr_shared_move(struct tf *tfp,
struct cfa_tcam_mgr_shared_move_parms *parms);
-void cfa_tcam_mgr_rows_dump(int sess_idx, enum tf_dir dir, enum cfa_tcam_mgr_tbl_type type);
-void cfa_tcam_mgr_tables_dump(int sess_idx, enum tf_dir dir, enum cfa_tcam_mgr_tbl_type type);
-void cfa_tcam_mgr_entries_dump(int sess_idx);
#endif /* _CFA_TCAM_MGR_H */
diff --git a/drivers/net/bnxt/tf_core/cfa_tcam_mgr_device.h b/drivers/net/bnxt/tf_core/cfa_tcam_mgr_device.h
index c24e5c8389..9d7f560e7b 100644
--- a/drivers/net/bnxt/tf_core/cfa_tcam_mgr_device.h
+++ b/drivers/net/bnxt/tf_core/cfa_tcam_mgr_device.h
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2021-2023 Broadcom
+ * Copyright(c) 2021-2024 Broadcom
* All rights reserved.
*/
@@ -8,6 +8,34 @@
#include <inttypes.h>
#include "cfa_tcam_mgr.h"
+#include "bitalloc.h"
+
+struct cfa_tcam_mgr_data;
+
+/* HW OP definitions */
+typedef int (*cfa_tcam_mgr_hwop_set_func_t)(struct cfa_tcam_mgr_data
+ *tcam_mgr_data,
+ struct cfa_tcam_mgr_set_parms
+ *parms, int row, int slice,
+ int max_slices);
+typedef int (*cfa_tcam_mgr_hwop_get_func_t)(struct cfa_tcam_mgr_data
+ *tcam_mgr_data,
+ struct cfa_tcam_mgr_get_parms
+ *parms, int row, int slice,
+ int max_slices);
+typedef int (*cfa_tcam_mgr_hwop_free_func_t)(struct cfa_tcam_mgr_data
+ *tcam_mgr_data,
+ struct cfa_tcam_mgr_free_parms
+ *parms, int row, int slice,
+ int max_slices);
+
+struct cfa_tcam_mgr_hwops_funcs {
+ cfa_tcam_mgr_hwop_set_func_t set;
+ cfa_tcam_mgr_hwop_get_func_t get;
+ cfa_tcam_mgr_hwop_free_func_t free;
+};
+
+/* End: HW OP definitions */
/*
* This identifier is to be used for one-off variable sizes. Do not use it for
@@ -42,8 +70,7 @@ TF_TCAM_TABLE_ROWS_DEF(2);
TF_TCAM_TABLE_ROWS_DEF(4);
TF_TCAM_TABLE_ROWS_DEF(8);
-/*
- * The following macros are for setting the entry status in a row entry.
+/* The following macros are for setting the entry status in a row entry.
* row is (struct cfa_tcam_mgr_table_rows_0 *)
*/
#define ROW_ENTRY_INUSE(row, entry) ((row)->entry_inuse & (1U << (entry)))
@@ -64,6 +91,13 @@ TF_TCAM_TABLE_ROWS_DEF(8);
VEB_TCAM_RX_MAX_ENTRIES + \
VEB_TCAM_TX_MAX_ENTRIES)
+#define TCAM_SET_END_ROW(n) ((n) ? (n) - 1 : 0)
+
+#define L2_CTXT_TCAM_RX_APP_LO_START (L2_CTXT_TCAM_RX_NUM_ROWS / 2)
+#define L2_CTXT_TCAM_RX_APP_HI_END (L2_CTXT_TCAM_RX_APP_LO_START - 1)
+#define L2_CTXT_TCAM_TX_APP_LO_START (L2_CTXT_TCAM_TX_NUM_ROWS / 2)
+#define L2_CTXT_TCAM_TX_APP_HI_END (L2_CTXT_TCAM_TX_APP_LO_START - 1)
+
struct cfa_tcam_mgr_entry_data {
uint16_t row;
uint8_t slice;
@@ -73,38 +107,28 @@ struct cfa_tcam_mgr_entry_data {
struct cfa_tcam_mgr_table_data {
struct cfa_tcam_mgr_table_rows_0 *tcam_rows;
uint16_t hcapi_type;
- uint16_t num_rows; /* Rows in physical TCAM */
- uint16_t start_row; /* Where the logical TCAM starts */
- uint16_t end_row; /* Where the logical TCAM ends */
+ uint16_t num_rows; /* Rows in physical TCAM */
+ uint16_t start_row; /* Where the logical TCAM starts */
+ uint16_t end_row; /* Where the logical TCAM ends */
uint16_t max_entries;
uint16_t used_entries;
- uint8_t row_width; /* bytes */
- uint8_t result_size; /* bytes */
+ uint8_t row_width; /* bytes */
+ uint8_t result_size; /* bytes */
uint8_t max_slices;
};
-extern int cfa_tcam_mgr_max_entries[TF_TCAM_MAX_SESSIONS];
-
-extern struct cfa_tcam_mgr_table_data
-cfa_tcam_mgr_tables[TF_TCAM_MAX_SESSIONS][TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX];
-
-/* HW OP definitions begin here */
-typedef int (*cfa_tcam_mgr_hwop_set_func_t)(int sess_idx,
- struct cfa_tcam_mgr_set_parms
- *parms, int row, int slice,
- int max_slices);
-typedef int (*cfa_tcam_mgr_hwop_get_func_t)(int sess_idx,
- struct cfa_tcam_mgr_get_parms
- *parms, int row, int slice,
- int max_slices);
-typedef int (*cfa_tcam_mgr_hwop_free_func_t)(int sess_idx,
- struct cfa_tcam_mgr_free_parms
- *parms, int row, int slice,
- int max_slices);
-
-struct cfa_tcam_mgr_hwops_funcs {
- cfa_tcam_mgr_hwop_set_func_t set;
- cfa_tcam_mgr_hwop_get_func_t get;
- cfa_tcam_mgr_hwop_free_func_t free;
+struct cfa_tcam_mgr_data {
+ int cfa_tcam_mgr_max_entries;
+ struct cfa_tcam_mgr_table_data
+ cfa_tcam_mgr_tables[TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX];
+ void *table_rows;
+ struct cfa_tcam_mgr_entry_data *entry_data;
+ struct bitalloc *session_bmp;
+ uint64_t session_bmp_size;
+ void *row_tables[TF_DIR_MAX][TF_TCAM_TBL_TYPE_MAX];
+ void *rx_row_data;
+ void *tx_row_data;
+ struct cfa_tcam_mgr_hwops_funcs hwop_funcs;
};
+
#endif /* CFA_TCAM_MGR_DEVICE_H */
diff --git a/drivers/net/bnxt/tf_core/cfa_tcam_mgr_hwop_msg.c b/drivers/net/bnxt/tf_core/cfa_tcam_mgr_hwop_msg.c
index 0fb5563cc3..b421309e89 100644
--- a/drivers/net/bnxt/tf_core/cfa_tcam_mgr_hwop_msg.c
+++ b/drivers/net/bnxt/tf_core/cfa_tcam_mgr_hwop_msg.c
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2021-2023 Broadcom
+ * Copyright(c) 2021-2024 Broadcom
* All rights reserved.
*/
@@ -14,8 +14,8 @@
#include "tf_tcam.h"
#include "hcapi_cfa_defs.h"
#include "cfa_tcam_mgr.h"
-#include "cfa_tcam_mgr_hwop_msg.h"
#include "cfa_tcam_mgr_device.h"
+#include "cfa_tcam_mgr_hwop_msg.h"
#include "cfa_tcam_mgr_p58.h"
#include "cfa_tcam_mgr_p4.h"
#include "tf_session.h"
@@ -23,20 +23,18 @@
#include "tfp.h"
#include "tf_util.h"
-/*
- * The free hwop will free more than a single slice so cannot be used.
- */
-struct cfa_tcam_mgr_hwops_funcs hwop_funcs;
-
int
-cfa_tcam_mgr_hwops_init(enum cfa_tcam_mgr_device_type type)
+cfa_tcam_mgr_hwops_init(struct cfa_tcam_mgr_data *tcam_mgr_data,
+ enum cfa_tcam_mgr_device_type type)
{
+ struct cfa_tcam_mgr_hwops_funcs *hwop_funcs =
+ &tcam_mgr_data->hwop_funcs;
+
switch (type) {
case CFA_TCAM_MGR_DEVICE_TYPE_P4:
- case CFA_TCAM_MGR_DEVICE_TYPE_SR:
- return cfa_tcam_mgr_hwops_get_funcs_p4(&hwop_funcs);
+ return cfa_tcam_mgr_hwops_get_funcs_p4(hwop_funcs);
case CFA_TCAM_MGR_DEVICE_TYPE_P5:
- return cfa_tcam_mgr_hwops_get_funcs_p58(&hwop_funcs);
+ return cfa_tcam_mgr_hwops_get_funcs_p58(hwop_funcs);
default:
CFA_TCAM_MGR_LOG(ERR, "No such device\n");
return -CFA_TCAM_MGR_ERR_CODE(NODEV);
@@ -51,27 +49,27 @@ cfa_tcam_mgr_hwops_init(enum cfa_tcam_mgr_device_type type)
*/
int
-cfa_tcam_mgr_entry_set_msg(int sess_idx, struct cfa_tcam_mgr_context *context
- __rte_unused,
+cfa_tcam_mgr_entry_set_msg(struct cfa_tcam_mgr_data *tcam_mgr_data,
+ struct tf *tfp __rte_unused,
struct cfa_tcam_mgr_set_parms *parms,
int row, int slice,
int max_slices __rte_unused)
{
+ enum tf_tcam_tbl_type type =
+ cfa_tcam_mgr_get_phys_table_type(parms->type);
cfa_tcam_mgr_hwop_set_func_t set_func;
-
- set_func = hwop_funcs.set;
- if (set_func == NULL)
- return -CFA_TCAM_MGR_ERR_CODE(PERM);
-
struct tf_tcam_set_parms sparms;
- struct tf_session *tfs;
struct tf_dev_info *dev;
+ struct tf_session *tfs;
int rc;
- enum tf_tcam_tbl_type type =
- cfa_tcam_mgr_get_phys_table_type(parms->type);
+
+ set_func = tcam_mgr_data->hwop_funcs.set;
+ if (!set_func)
+ return -CFA_TCAM_MGR_ERR_CODE(INVAL);
+
/* Retrieve the session information */
- rc = tf_session_get_session_internal(context->tfp, &tfs);
+ rc = tf_session_get_session_internal(tfp, &tfs);
if (rc)
return rc;
@@ -91,63 +89,75 @@ cfa_tcam_mgr_entry_set_msg(int sess_idx, struct cfa_tcam_mgr_context *context
sparms.result = parms->result;
sparms.result_size = parms->result_size;
- rc = tf_msg_tcam_entry_set(context->tfp, dev, &sparms);
+#ifdef CFA_TCAM_MGR_TRACING
+ CFA_TCAM_MGR_LOG_DIR_TYPE(INFO, parms->dir, parms->type,
+ "%s: %s row:%d slice:%d "
+ "set tcam physical idx 0x%x\n",
+ tf_dir_2_str(parms->dir),
+ cfa_tcam_mgr_tbl_2_str(parms->type),
+ row, slice, sparms.idx);
+#endif
+
+ rc = tf_msg_tcam_entry_set(tfp, dev, &sparms);
if (rc) {
- /* Log error */
CFA_TCAM_MGR_LOG_DIR_TYPE(ERR, parms->dir, parms->type,
- "Entry %d set failed, rc:%d\n",
+ "%s: %s entry:%d "
+ "set tcam failed, rc:%d\n",
+ tf_dir_2_str(parms->dir),
+ cfa_tcam_mgr_tbl_2_str(parms->type),
parms->id, -rc);
return rc;
}
- return set_func(sess_idx, parms, row, slice, max_slices);
+ return set_func(tcam_mgr_data, parms, row, slice, max_slices);
}
int
-cfa_tcam_mgr_entry_get_msg(int sess_idx, struct cfa_tcam_mgr_context *context
- __rte_unused,
+cfa_tcam_mgr_entry_get_msg(struct cfa_tcam_mgr_data *tcam_mgr_data,
+ struct tf *tfp __rte_unused,
struct cfa_tcam_mgr_get_parms *parms,
int row, int slice,
int max_slices __rte_unused)
{
cfa_tcam_mgr_hwop_get_func_t get_func;
- get_func = hwop_funcs.get;
- if (get_func == NULL)
+ get_func = tcam_mgr_data->hwop_funcs.get;
+ if (!get_func)
return -CFA_TCAM_MGR_ERR_CODE(PERM);
- return get_func(sess_idx, parms, row, slice, max_slices);
+ return get_func(tcam_mgr_data, parms, row, slice, max_slices);
}
int
-cfa_tcam_mgr_entry_free_msg(int sess_idx, struct cfa_tcam_mgr_context *context
- __rte_unused,
+cfa_tcam_mgr_entry_free_msg(struct cfa_tcam_mgr_data *tcam_mgr_data,
+ struct tf *tfp __rte_unused,
struct cfa_tcam_mgr_free_parms *parms,
int row, int slice,
int key_size,
int result_size,
int max_slices)
{
+ enum tf_tcam_tbl_type type =
+ cfa_tcam_mgr_get_phys_table_type(parms->type);
+ uint8_t mask[CFA_TCAM_MGR_MAX_KEY_SIZE] = { 0 };
+ uint8_t key[CFA_TCAM_MGR_MAX_KEY_SIZE] = { 0 };
cfa_tcam_mgr_hwop_free_func_t free_func;
-
- free_func = hwop_funcs.free;
- if (free_func == NULL)
- return -CFA_TCAM_MGR_ERR_CODE(PERM);
-
+ struct tf_tcam_set_parms sparms;
struct tf_dev_info *dev;
struct tf_session *tfs;
int rc;
- enum tf_tcam_tbl_type type =
- cfa_tcam_mgr_get_phys_table_type(parms->type);
- /* Free will clear an entire row. */
- /* Use set message to clear an individual entry */
- struct tf_tcam_set_parms sparms;
- uint8_t key[CFA_TCAM_MGR_MAX_KEY_SIZE] = { 0 };
- uint8_t mask[CFA_TCAM_MGR_MAX_KEY_SIZE] = { 0 };
+ free_func = tcam_mgr_data->hwop_funcs.free;
+ if (!free_func)
+ return -CFA_TCAM_MGR_ERR_CODE(PERM);
+
+ /*
+ * The free hwop will free more than a single slice (an entire row),
+ * so cannot be used. Use set message to clear an individual entry
+ */
/* Retrieve the session information */
- rc = tf_session_get_session_internal(context->tfp, &tfs);
+ rc = tf_session_get_session_internal(tfp, &tfs);
if (rc)
return rc;
@@ -158,7 +168,9 @@ cfa_tcam_mgr_entry_free_msg(int sess_idx, struct cfa_tcam_mgr_context *context
if (key_size > CFA_TCAM_MGR_MAX_KEY_SIZE) {
CFA_TCAM_MGR_LOG_DIR_TYPE(ERR, parms->dir, parms->type,
- "Entry %d key size is %d greater than:%d\n",
+ "%s: %s entry:%d key size:%d > %d\n",
+ tf_dir_2_str(parms->dir),
+ cfa_tcam_mgr_tbl_2_str(parms->type),
parms->id, key_size,
CFA_TCAM_MGR_MAX_KEY_SIZE);
return -EINVAL;
@@ -166,7 +178,9 @@ cfa_tcam_mgr_entry_free_msg(int sess_idx, struct cfa_tcam_mgr_context *context
if (result_size > CFA_TCAM_MGR_MAX_KEY_SIZE) {
CFA_TCAM_MGR_LOG_DIR_TYPE(ERR, parms->dir, parms->type,
- "Entry %d result size is %d greater than:%d\n",
+ "%s: %s entry:%d res size:%d > %d\n",
+ tf_dir_2_str(parms->dir),
+ cfa_tcam_mgr_tbl_2_str(parms->type),
parms->id, result_size,
CFA_TCAM_MGR_MAX_KEY_SIZE);
return -EINVAL;
@@ -186,16 +200,27 @@ cfa_tcam_mgr_entry_free_msg(int sess_idx, struct cfa_tcam_mgr_context *context
sparms.key_size = key_size;
sparms.result_size = result_size;
- rc = tf_msg_tcam_entry_set(context->tfp, dev, &sparms);
+#ifdef CFA_TCAM_MGR_TRACING
+ CFA_TCAM_MGR_LOG_DIR_TYPE(INFO, parms->dir, parms->type,
+ "%s: %s row:%d slice:%d free idx:%d "
+ "key_sz:%d result_sz:%d\n",
+ tf_dir_2_str(parms->dir),
+ cfa_tcam_mgr_tbl_2_str(parms->type),
+ row, slice, sparms.idx, key_size,
+ result_size);
+#endif
+
+ rc = tf_msg_tcam_entry_set(tfp, dev, &sparms);
if (rc) {
/* Log error */
CFA_TCAM_MGR_LOG_DIR_TYPE(ERR, parms->dir, parms->type,
- "Row %d, slice %d set failed, "
- "rc:%d.\n",
- row,
- slice,
- rc);
+ "%s: %s row:%d slice:%d set failed, "
+ "rc:%d\n",
+ tf_dir_2_str(parms->dir),
+ cfa_tcam_mgr_tbl_2_str(parms->type),
+ row, slice, rc);
return rc;
}
- return free_func(sess_idx, parms, row, slice, max_slices);
+
+ return free_func(tcam_mgr_data, parms, row, slice, max_slices);
}
diff --git a/drivers/net/bnxt/tf_core/cfa_tcam_mgr_hwop_msg.h b/drivers/net/bnxt/tf_core/cfa_tcam_mgr_hwop_msg.h
index f7ba625c07..3b896d4548 100644
--- a/drivers/net/bnxt/tf_core/cfa_tcam_mgr_hwop_msg.h
+++ b/drivers/net/bnxt/tf_core/cfa_tcam_mgr_hwop_msg.h
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2021-2023 Broadcom
+ * Copyright(c) 2021-2024 Broadcom
* All rights reserved.
*/
@@ -7,22 +7,24 @@
#define CFA_TCAM_MGR_HWOP_MSG_H
int
-cfa_tcam_mgr_hwops_init(enum cfa_tcam_mgr_device_type type);
+cfa_tcam_mgr_hwops_init(struct cfa_tcam_mgr_data *tcam_mgr_data,
+ enum cfa_tcam_mgr_device_type type);
int
-cfa_tcam_mgr_entry_set_msg(int sess_idx,
- struct cfa_tcam_mgr_context *context,
+cfa_tcam_mgr_entry_set_msg(struct cfa_tcam_mgr_data *tcam_mgr_data,
+ struct tf *tfp,
struct cfa_tcam_mgr_set_parms *parms,
int row, int slice, int max_slices);
int
-cfa_tcam_mgr_entry_get_msg(int sess_idx,
- struct cfa_tcam_mgr_context *context,
+cfa_tcam_mgr_entry_get_msg(struct cfa_tcam_mgr_data *tcam_mgr_data,
+ struct tf *tfp,
struct cfa_tcam_mgr_get_parms *parms,
int row, int slice, int max_slices);
int
-cfa_tcam_mgr_entry_free_msg(int sess_idx,
- struct cfa_tcam_mgr_context *context,
+cfa_tcam_mgr_entry_free_msg(struct cfa_tcam_mgr_data *tcam_mgr_data,
+ struct tf *tfp,
struct cfa_tcam_mgr_free_parms *parms,
int row, int slice, int key_size,
int result_size, int max_slices);
+
#endif /* CFA_TCAM_MGR_HWOP_MSG_H */
diff --git a/drivers/net/bnxt/tf_core/cfa_tcam_mgr_p4.c b/drivers/net/bnxt/tf_core/cfa_tcam_mgr_p4.c
index 63c84c5938..27748bea90 100644
--- a/drivers/net/bnxt/tf_core/cfa_tcam_mgr_p4.c
+++ b/drivers/net/bnxt/tf_core/cfa_tcam_mgr_p4.c
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2021-2023 Broadcom
+ * Copyright(c) 2021-2024 Broadcom
* All rights reserved.
*/
@@ -12,6 +12,7 @@
#include "tfp.h"
#include "assert.h"
#include "tf_util.h"
+#include "tf_session.h"
/*
* Sizings of the TCAMs on P4
@@ -126,38 +127,40 @@
* Array sizes have 1 added to avoid zero length arrays.
*/
-static struct cfa_tcam_mgr_table_rows_1
- cfa_tcam_mgr_table_rows_L2_CTXT_TCAM_RX[TF_TCAM_MAX_SESSIONS][L2_CTXT_TCAM_RX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_1
- cfa_tcam_mgr_table_rows_L2_CTXT_TCAM_TX[TF_TCAM_MAX_SESSIONS][L2_CTXT_TCAM_TX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_1
- cfa_tcam_mgr_table_rows_PROF_TCAM_RX[TF_TCAM_MAX_SESSIONS][PROF_TCAM_RX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_1
- cfa_tcam_mgr_table_rows_PROF_TCAM_TX[TF_TCAM_MAX_SESSIONS][PROF_TCAM_TX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_4
- cfa_tcam_mgr_table_rows_WC_TCAM_RX[TF_TCAM_MAX_SESSIONS][WC_TCAM_RX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_4
- cfa_tcam_mgr_table_rows_WC_TCAM_TX[TF_TCAM_MAX_SESSIONS][WC_TCAM_TX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_1
- cfa_tcam_mgr_table_rows_SP_TCAM_RX[TF_TCAM_MAX_SESSIONS][SP_TCAM_RX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_1
- cfa_tcam_mgr_table_rows_SP_TCAM_TX[TF_TCAM_MAX_SESSIONS][SP_TCAM_TX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_1
- cfa_tcam_mgr_table_rows_CT_RULE_TCAM_RX[TF_TCAM_MAX_SESSIONS][CT_RULE_TCAM_RX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_1
- cfa_tcam_mgr_table_rows_CT_RULE_TCAM_TX[TF_TCAM_MAX_SESSIONS][CT_RULE_TCAM_TX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_1
- cfa_tcam_mgr_table_rows_VEB_TCAM_RX[TF_TCAM_MAX_SESSIONS][VEB_TCAM_RX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_1
- cfa_tcam_mgr_table_rows_VEB_TCAM_TX[TF_TCAM_MAX_SESSIONS][VEB_TCAM_TX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_4
- cfa_tcam_mgr_table_rows_WC_TCAM_RX_HIGH[TF_TCAM_MAX_SESSIONS][WC_TCAM_RX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_4
- cfa_tcam_mgr_table_rows_WC_TCAM_RX_LOW[TF_TCAM_MAX_SESSIONS][WC_TCAM_RX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_4
- cfa_tcam_mgr_table_rows_WC_TCAM_TX_HIGH[TF_TCAM_MAX_SESSIONS][WC_TCAM_TX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_4
- cfa_tcam_mgr_table_rows_WC_TCAM_TX_LOW[TF_TCAM_MAX_SESSIONS][WC_TCAM_TX_NUM_ROWS + 1];
+struct cfa_tcam_mgr_table_rows_p4 {
+ struct cfa_tcam_mgr_table_rows_1
+ table_rows_L2_CTXT_TCAM_RX[L2_CTXT_TCAM_RX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_1
+ table_rows_L2_CTXT_TCAM_TX[L2_CTXT_TCAM_TX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_1
+ table_rows_PROF_TCAM_RX[PROF_TCAM_RX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_1
+ table_rows_PROF_TCAM_TX[PROF_TCAM_TX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_4
+ table_rows_WC_TCAM_RX[WC_TCAM_RX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_4
+ table_rows_WC_TCAM_TX[WC_TCAM_TX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_1
+ table_rows_SP_TCAM_RX[SP_TCAM_RX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_1
+ table_rows_SP_TCAM_TX[SP_TCAM_TX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_1
+ table_rows_CT_RULE_TCAM_RX[CT_RULE_TCAM_RX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_1
+ table_rows_CT_RULE_TCAM_TX[CT_RULE_TCAM_TX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_1
+ table_rows_VEB_TCAM_RX[VEB_TCAM_RX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_1
+ table_rows_VEB_TCAM_TX[VEB_TCAM_TX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_4
+ table_rows_WC_TCAM_RX_HIGH[WC_TCAM_RX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_4
+ table_rows_WC_TCAM_RX_LOW[WC_TCAM_RX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_4
+ table_rows_WC_TCAM_TX_HIGH[WC_TCAM_TX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_4
+ table_rows_WC_TCAM_TX_LOW[WC_TCAM_TX_NUM_ROWS + 1];
+};
struct cfa_tcam_mgr_table_data
cfa_tcam_mgr_tables_p4[TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX] = {
@@ -177,7 +180,7 @@ cfa_tcam_mgr_tables_p4[TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX] = {
.row_width = L2_CTXT_TCAM_RX_ROW_WIDTH,
.num_rows = L2_CTXT_TCAM_RX_NUM_ROWS,
.start_row = 0,
- .end_row = (L2_CTXT_TCAM_RX_NUM_ROWS / 2) - 1,
+ .end_row = L2_CTXT_TCAM_RX_APP_HI_END,
.max_entries = (L2_CTXT_TCAM_RX_MAX_ENTRIES / 2),
.result_size = L2_CTXT_TCAM_RX_RESULT_SIZE,
.hcapi_type = CFA_RESOURCE_TYPE_P4_L2_CTXT_TCAM_HIGH,
@@ -196,7 +199,7 @@ cfa_tcam_mgr_tables_p4[TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX] = {
.max_slices = L2_CTXT_TCAM_RX_MAX_SLICES,
.row_width = L2_CTXT_TCAM_RX_ROW_WIDTH,
.num_rows = L2_CTXT_TCAM_RX_NUM_ROWS,
- .start_row = (L2_CTXT_TCAM_RX_NUM_ROWS / 2),
+ .start_row = L2_CTXT_TCAM_RX_APP_LO_START,
.end_row = L2_CTXT_TCAM_RX_NUM_ROWS - 1,
.max_entries = (L2_CTXT_TCAM_RX_MAX_ENTRIES / 2),
.result_size = L2_CTXT_TCAM_RX_RESULT_SIZE,
@@ -277,7 +280,8 @@ cfa_tcam_mgr_tables_p4[TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX] = {
.num_rows = CT_RULE_TCAM_RX_NUM_ROWS,
.start_row = 0,
#if CT_RULE_TCAM_RX_NUM_ROWS > 0
- .end_row = CT_RULE_TCAM_RX_NUM_ROWS - 1,
+ .end_row =
+ TCAM_SET_END_ROW(CT_RULE_TCAM_RX_NUM_ROWS),
#else
.end_row = CT_RULE_TCAM_RX_NUM_ROWS,
#endif
@@ -299,7 +303,8 @@ cfa_tcam_mgr_tables_p4[TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX] = {
.num_rows = VEB_TCAM_RX_NUM_ROWS,
.start_row = 0,
#if VEB_TCAM_RX_NUM_ROWS > 0
- .end_row = VEB_TCAM_RX_NUM_ROWS - 1,
+ .end_row =
+ TCAM_SET_END_ROW(VEB_TCAM_RX_NUM_ROWS),
#else
.end_row = VEB_TCAM_RX_NUM_ROWS,
#endif
@@ -363,7 +368,7 @@ cfa_tcam_mgr_tables_p4[TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX] = {
.row_width = L2_CTXT_TCAM_TX_ROW_WIDTH,
.num_rows = L2_CTXT_TCAM_TX_NUM_ROWS,
.start_row = 0,
- .end_row = (L2_CTXT_TCAM_TX_NUM_ROWS / 2) - 1,
+ .end_row = L2_CTXT_TCAM_TX_APP_HI_END,
.max_entries = (L2_CTXT_TCAM_TX_MAX_ENTRIES / 2),
.result_size = L2_CTXT_TCAM_TX_RESULT_SIZE,
.hcapi_type = CFA_RESOURCE_TYPE_P4_L2_CTXT_TCAM_HIGH,
@@ -382,7 +387,7 @@ cfa_tcam_mgr_tables_p4[TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX] = {
.max_slices = L2_CTXT_TCAM_TX_MAX_SLICES,
.row_width = L2_CTXT_TCAM_TX_ROW_WIDTH,
.num_rows = L2_CTXT_TCAM_TX_NUM_ROWS,
- .start_row = (L2_CTXT_TCAM_TX_NUM_ROWS / 2),
+ .start_row = L2_CTXT_TCAM_TX_APP_LO_START,
.end_row = L2_CTXT_TCAM_TX_NUM_ROWS - 1,
.max_entries = (L2_CTXT_TCAM_TX_MAX_ENTRIES / 2),
.result_size = L2_CTXT_TCAM_TX_RESULT_SIZE,
@@ -463,7 +468,8 @@ cfa_tcam_mgr_tables_p4[TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX] = {
.num_rows = CT_RULE_TCAM_TX_NUM_ROWS,
.start_row = 0,
#if CT_RULE_TCAM_TX_NUM_ROWS > 0
- .end_row = CT_RULE_TCAM_TX_NUM_ROWS - 1,
+ .end_row =
+ TCAM_SET_END_ROW(CT_RULE_TCAM_TX_NUM_ROWS),
#else
.end_row = CT_RULE_TCAM_TX_NUM_ROWS,
#endif
@@ -487,6 +493,7 @@ cfa_tcam_mgr_tables_p4[TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX] = {
.end_row = VEB_TCAM_TX_NUM_ROWS - 1,
.max_entries = VEB_TCAM_TX_MAX_ENTRIES,
.result_size = VEB_TCAM_RX_RESULT_SIZE,
+/* .hcapi_type = */
},
{ /* AFM */
.max_slices = WC_TCAM_TX_MAX_SLICES,
@@ -531,225 +538,315 @@ cfa_tcam_mgr_tables_p4[TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX] = {
},
};
-static struct cfa_tcam_mgr_entry_data entry_data_p4[TF_TCAM_MAX_SESSIONS][TF_TCAM_MAX_ENTRIES];
-
-static struct sbmp session_bmp_p4[TF_TCAM_MAX_SESSIONS][TF_TCAM_MAX_ENTRIES];
+static int cfa_tcam_mgr_row_data_alloc(struct cfa_tcam_mgr_data *tcam_mgr_data);
+static void cfa_tcam_mgr_row_data_free(struct cfa_tcam_mgr_data *tcam_mgr_data);
-int
-cfa_tcam_mgr_sess_table_get_p4(int sess_idx, struct sbmp **session_bmp)
+static void cfa_tcam_mgr_data_free(struct tf_session *tfs)
{
- *session_bmp = session_bmp_p4[sess_idx];
- return 0;
+ struct cfa_tcam_mgr_data *tcam_mgr_data = tfs->tcam_mgr_handle;
+
+ if (!tcam_mgr_data)
+ return;
+
+ tfp_free(tcam_mgr_data->table_rows);
+ tfp_free(tcam_mgr_data->entry_data);
+ tfp_free(tcam_mgr_data->session_bmp);
+ cfa_tcam_mgr_row_data_free(tcam_mgr_data);
+
+ tfp_free(tcam_mgr_data);
+ tfs->tcam_mgr_handle = NULL;
}
int
-cfa_tcam_mgr_init_p4(int sess_idx, struct cfa_tcam_mgr_entry_data **global_entry_data)
+cfa_tcam_mgr_init_p4(struct tf *tfp)
{
- int max_row_width = 0;
+ struct cfa_tcam_mgr_table_rows_p4 *table_rows;
+ struct cfa_tcam_mgr_data *tcam_mgr_data;
+ struct tfp_calloc_parms cparms;
int max_result_size = 0;
+ struct tf_session *tfs;
+ int max_row_width = 0;
int dir, type;
+ int rc;
+
+ rc = tf_session_get_session_internal(tfp, &tfs);
+ if (rc)
+ return rc;
+
+ cparms.nitems = 1;
+ cparms.size = sizeof(struct cfa_tcam_mgr_data);
+ cparms.alignment = 0;
+ rc = tfp_calloc(&cparms);
+ if (rc) {
+ /* Log error */
+ TFP_DRV_LOG(ERR,
+ "Failed to allocate block, rc:%s\n",
+ strerror(-rc));
+ return rc;
+ }
- *global_entry_data = entry_data_p4[sess_idx];
+ tfs->tcam_mgr_handle = (struct cfa_tcam_mgr_data *)cparms.mem_va;
+ tcam_mgr_data = tfs->tcam_mgr_handle;
- memcpy(&cfa_tcam_mgr_tables[sess_idx],
+ cparms.nitems = 1;
+ cparms.size = sizeof(struct cfa_tcam_mgr_table_rows_p4);
+ cparms.alignment = 0;
+ rc = tfp_calloc(&cparms);
+ if (rc) {
+ /* Log error */
+ TFP_DRV_LOG(ERR,
+ "Failed to allocate block, rc:%s\n",
+ strerror(-rc));
+ tfp_free(tfs->tcam_mgr_handle);
+ tfs->tcam_mgr_handle = NULL;
+ return rc;
+ }
+ tcam_mgr_data->table_rows =
+ (struct cfa_tcam_mgr_table_rows_p4 *)cparms.mem_va;
+ table_rows = tcam_mgr_data->table_rows;
+
+ cparms.nitems = TF_TCAM_MAX_ENTRIES;
+ cparms.size = sizeof(struct cfa_tcam_mgr_entry_data);
+ cparms.alignment = 0;
+ rc = tfp_calloc(&cparms);
+ if (rc) {
+ /* Log error */
+ TFP_DRV_LOG(ERR,
+ "Failed to allocate block, rc:%s\n",
+ strerror(-rc));
+ goto fail;
+ }
+ tcam_mgr_data->entry_data =
+ (struct cfa_tcam_mgr_entry_data *)cparms.mem_va;
+
+ rc = cfa_tcam_mgr_row_data_alloc(tcam_mgr_data);
+ if (rc) {
+ /* Log error */
+ TFP_DRV_LOG(ERR,
+ "Failed to allocate tcam_mgr_row_data, rc:%s\n",
+ strerror(-rc));
+ goto fail;
+ }
+
+ memcpy(&tcam_mgr_data->cfa_tcam_mgr_tables,
&cfa_tcam_mgr_tables_p4,
- sizeof(cfa_tcam_mgr_tables[sess_idx]));
+ sizeof(tcam_mgr_data->cfa_tcam_mgr_tables));
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_L2_CTXT_TCAM_HIGH_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_L2_CTXT_TCAM_RX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ &table_rows->table_rows_L2_CTXT_TCAM_RX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_L2_CTXT_TCAM_HIGH_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_L2_CTXT_TCAM_RX[sess_idx];
+ &table_rows->table_rows_L2_CTXT_TCAM_RX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_L2_CTXT_TCAM_HIGH_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_L2_CTXT_TCAM_TX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ &table_rows->table_rows_L2_CTXT_TCAM_TX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_L2_CTXT_TCAM_HIGH_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_L2_CTXT_TCAM_TX[sess_idx];
+ &table_rows->table_rows_L2_CTXT_TCAM_TX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_L2_CTXT_TCAM_LOW_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_L2_CTXT_TCAM_RX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ &table_rows->table_rows_L2_CTXT_TCAM_RX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_L2_CTXT_TCAM_LOW_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_L2_CTXT_TCAM_RX[sess_idx];
+ &table_rows->table_rows_L2_CTXT_TCAM_RX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_L2_CTXT_TCAM_LOW_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_L2_CTXT_TCAM_TX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ &table_rows->table_rows_L2_CTXT_TCAM_TX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_L2_CTXT_TCAM_LOW_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_L2_CTXT_TCAM_TX[sess_idx];
+ &table_rows->table_rows_L2_CTXT_TCAM_TX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_PROF_TCAM_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_PROF_TCAM_RX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ &table_rows->table_rows_PROF_TCAM_RX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_PROF_TCAM_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_PROF_TCAM_RX[sess_idx];
+ &table_rows->table_rows_PROF_TCAM_RX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_PROF_TCAM_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_PROF_TCAM_TX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ &table_rows->table_rows_PROF_TCAM_TX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_PROF_TCAM_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_PROF_TCAM_TX[sess_idx];
+ &table_rows->table_rows_PROF_TCAM_TX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_RX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ &table_rows->table_rows_WC_TCAM_RX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_RX[sess_idx];
+ &table_rows->table_rows_WC_TCAM_RX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_TX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ &table_rows->table_rows_WC_TCAM_TX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_TX[sess_idx];
+ &table_rows->table_rows_WC_TCAM_TX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_SP_TCAM_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_SP_TCAM_RX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ &table_rows->table_rows_SP_TCAM_RX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_SP_TCAM_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_SP_TCAM_RX[sess_idx];
+ &table_rows->table_rows_SP_TCAM_RX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_SP_TCAM_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_SP_TCAM_TX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ &table_rows->table_rows_SP_TCAM_TX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_SP_TCAM_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_SP_TCAM_TX[sess_idx];
+ &table_rows->table_rows_SP_TCAM_TX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_CT_RULE_TCAM_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_CT_RULE_TCAM_RX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ &table_rows->table_rows_CT_RULE_TCAM_RX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_CT_RULE_TCAM_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_CT_RULE_TCAM_RX[sess_idx];
+ &table_rows->table_rows_CT_RULE_TCAM_RX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_CT_RULE_TCAM_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_CT_RULE_TCAM_TX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ &table_rows->table_rows_CT_RULE_TCAM_TX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_CT_RULE_TCAM_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_CT_RULE_TCAM_TX[sess_idx];
+ &table_rows->table_rows_CT_RULE_TCAM_TX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_VEB_TCAM_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_VEB_TCAM_RX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ &table_rows->table_rows_VEB_TCAM_RX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_VEB_TCAM_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_VEB_TCAM_RX[sess_idx];
+ &table_rows->table_rows_VEB_TCAM_RX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_VEB_TCAM_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_VEB_TCAM_TX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ &table_rows->table_rows_VEB_TCAM_TX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_VEB_TCAM_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_VEB_TCAM_TX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ &table_rows->table_rows_VEB_TCAM_TX[0];
+
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_HIGH_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_RX_HIGH[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ &table_rows->table_rows_WC_TCAM_RX_HIGH[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_HIGH_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_RX_HIGH[sess_idx];
+ &table_rows->table_rows_WC_TCAM_RX_HIGH[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_HIGH_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_TX_HIGH[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ &table_rows->table_rows_WC_TCAM_TX_HIGH[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_HIGH_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_TX_HIGH[sess_idx];
+ &table_rows->table_rows_WC_TCAM_TX_HIGH[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_LOW_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_RX_LOW[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ &table_rows->table_rows_WC_TCAM_RX_LOW[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_LOW_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_RX_LOW[sess_idx];
+ &table_rows->table_rows_WC_TCAM_RX_LOW[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_LOW_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_TX_LOW[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ &table_rows->table_rows_WC_TCAM_TX_LOW[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_LOW_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_TX_LOW[sess_idx];
+ &table_rows->table_rows_WC_TCAM_TX_LOW[0];
for (dir = 0; dir < TF_DIR_MAX; dir++) {
for (type = 0; type < CFA_TCAM_MGR_TBL_TYPE_MAX; type++) {
- if (cfa_tcam_mgr_tables[sess_idx][dir][type].row_width >
- max_row_width)
+ if (tcam_mgr_data->cfa_tcam_mgr_tables[dir]
+ [type].row_width >
+ max_row_width)
max_row_width =
- cfa_tcam_mgr_tables[sess_idx][dir][type].row_width;
- if (cfa_tcam_mgr_tables[sess_idx][dir][type].result_size >
- max_result_size)
+ tcam_mgr_data->cfa_tcam_mgr_tables[dir]
+ [type].row_width;
+ if (tcam_mgr_data->cfa_tcam_mgr_tables[dir]
+ [type].result_size >
+ max_result_size)
max_result_size =
- cfa_tcam_mgr_tables[sess_idx][dir][type].result_size;
+ tcam_mgr_data->cfa_tcam_mgr_tables[dir]
+ [type].result_size;
}
}
if (max_row_width != MAX_ROW_WIDTH) {
CFA_TCAM_MGR_LOG(ERR,
- "MAX_ROW_WIDTH (%d) does not match actual "
- "value (%d).\n",
- MAX_ROW_WIDTH,
- max_row_width);
- return -CFA_TCAM_MGR_ERR_CODE(INVAL);
+ "MAX_ROW_WIDTH:%d does not match val:%d\n",
+ MAX_ROW_WIDTH, max_row_width);
+ rc = -CFA_TCAM_MGR_ERR_CODE(INVAL);
+ goto fail;
}
if (max_result_size != MAX_RESULT_SIZE) {
CFA_TCAM_MGR_LOG(ERR,
- "MAX_RESULT_SIZE (%d) does not match actual "
- "value (%d).\n",
- MAX_RESULT_SIZE,
- max_result_size);
- return -CFA_TCAM_MGR_ERR_CODE(INVAL);
+ "MAX_RESULT_SIZE:%d does not match val:%d\n",
+ MAX_RESULT_SIZE, max_result_size);
+ rc = -CFA_TCAM_MGR_ERR_CODE(INVAL);
+ goto fail;
}
+
return 0;
+
+fail:
+ cfa_tcam_mgr_data_free(tfs);
+ return rc;
+}
+
+void cfa_tcam_mgr_uninit_p4(struct tf *tfp)
+{
+ struct tf_session *tfs;
+ int rc;
+
+ rc = tf_session_get_session_internal(tfp, &tfs);
+ if (rc)
+ return;
+
+ cfa_tcam_mgr_data_free(tfs);
}
/* HW OP declarations begin here */
-struct cfa_tcam_mgr_TCAM_row_data {
+struct cfa_tcam_mgr_tcam_row_data {
int key_size;
int result_size;
uint8_t key[MAX_ROW_WIDTH];
@@ -776,133 +873,182 @@ struct cfa_tcam_mgr_TCAM_row_data {
(CT_RULE_TCAM_TX_MAX_SLICES * CT_RULE_TCAM_TX_NUM_ROWS)
#define VEB_TX_MAX_ROWS (VEB_TCAM_TX_MAX_SLICES * VEB_TCAM_TX_NUM_ROWS)
-static int cfa_tcam_mgr_max_rows[TF_TCAM_TBL_TYPE_MAX] = {
- L2_CTXT_RX_MAX_ROWS,
- L2_CTXT_RX_MAX_ROWS,
- PROF_RX_MAX_ROWS,
- WC_RX_MAX_ROWS,
- SP_RX_MAX_ROWS,
- CT_RULE_RX_MAX_ROWS,
- VEB_RX_MAX_ROWS,
- WC_RX_MAX_ROWS,
- WC_RX_MAX_ROWS
+struct cfa_tcam_mgr_rx_row_data {
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_L2_CTXT_TCAM_RX_row_data[L2_CTXT_RX_MAX_ROWS + 1];
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_PROF_TCAM_RX_row_data[PROF_RX_MAX_ROWS + 1];
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_WC_TCAM_RX_row_data[WC_RX_MAX_ROWS + 1];
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_SP_TCAM_RX_row_data[SP_RX_MAX_ROWS + 1];
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_CT_RULE_TCAM_RX_row_data[CT_RULE_RX_MAX_ROWS + 1];
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_VEB_TCAM_RX_row_data[VEB_RX_MAX_ROWS + 1];
};
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_L2_CTXT_TCAM_RX_row_data[TF_TCAM_MAX_SESSIONS][L2_CTXT_RX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_PROF_TCAM_RX_row_data[TF_TCAM_MAX_SESSIONS][PROF_RX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_WC_TCAM_RX_row_data[TF_TCAM_MAX_SESSIONS][WC_RX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_SP_TCAM_RX_row_data[TF_TCAM_MAX_SESSIONS][SP_RX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_CT_RULE_TCAM_RX_row_data[TF_TCAM_MAX_SESSIONS][CT_RULE_RX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_VEB_TCAM_RX_row_data[TF_TCAM_MAX_SESSIONS][VEB_RX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_WC_TCAM_RX_row_data[TF_TCAM_MAX_SESSIONS][WC_RX_MAX_ROWS];
-
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_L2_CTXT_TCAM_TX_row_data[TF_TCAM_MAX_SESSIONS][L2_CTXT_TX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_PROF_TCAM_TX_row_data[TF_TCAM_MAX_SESSIONS][PROF_TX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_WC_TCAM_TX_row_data[TF_TCAM_MAX_SESSIONS][WC_TX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_SP_TCAM_TX_row_data[TF_TCAM_MAX_SESSIONS][SP_TX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_CT_RULE_TCAM_TX_row_data[TF_TCAM_MAX_SESSIONS][CT_RULE_TX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_VEB_TCAM_TX_row_data[TF_TCAM_MAX_SESSIONS][VEB_TX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_WC_TCAM_TX_row_data[TF_TCAM_MAX_SESSIONS][WC_TX_MAX_ROWS];
-
-static struct cfa_tcam_mgr_TCAM_row_data *
-row_tables[TF_DIR_MAX][TF_TCAM_TBL_TYPE_MAX] = {
- {
- cfa_tcam_mgr_L2_CTXT_TCAM_RX_row_data[0],
- cfa_tcam_mgr_L2_CTXT_TCAM_RX_row_data[0],
- cfa_tcam_mgr_PROF_TCAM_RX_row_data[0],
- cfa_tcam_mgr_WC_TCAM_RX_row_data[0],
- cfa_tcam_mgr_SP_TCAM_RX_row_data[0],
- cfa_tcam_mgr_CT_RULE_TCAM_RX_row_data[0],
- cfa_tcam_mgr_VEB_TCAM_RX_row_data[0],
- cfa_tcam_mgr_WC_TCAM_RX_row_data[0],
- cfa_tcam_mgr_WC_TCAM_RX_row_data[0],
- },
- {
- cfa_tcam_mgr_L2_CTXT_TCAM_TX_row_data[0],
- cfa_tcam_mgr_L2_CTXT_TCAM_TX_row_data[0],
- cfa_tcam_mgr_PROF_TCAM_TX_row_data[0],
- cfa_tcam_mgr_WC_TCAM_TX_row_data[0],
- cfa_tcam_mgr_SP_TCAM_TX_row_data[0],
- cfa_tcam_mgr_CT_RULE_TCAM_TX_row_data[0],
- cfa_tcam_mgr_VEB_TCAM_TX_row_data[0],
- cfa_tcam_mgr_WC_TCAM_TX_row_data[0],
- cfa_tcam_mgr_WC_TCAM_TX_row_data[0],
- }
+
+struct cfa_tcam_mgr_tx_row_data {
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_L2_CTXT_TCAM_TX_row_data[L2_CTXT_TX_MAX_ROWS + 1];
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_PROF_TCAM_TX_row_data[PROF_TX_MAX_ROWS + 1];
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_WC_TCAM_TX_row_data[WC_TX_MAX_ROWS + 1];
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_SP_TCAM_TX_row_data[SP_TX_MAX_ROWS + 1];
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_CT_RULE_TCAM_TX_row_data[CT_RULE_TX_MAX_ROWS + 1];
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_VEB_TCAM_TX_row_data[VEB_TX_MAX_ROWS + 1];
};
-static int cfa_tcam_mgr_get_max_rows(enum tf_tcam_tbl_type type)
+#define TF_TCAM_L2_CTX_HI TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH
+#define TF_TCAM_L2_CTX_LO TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW
+#define TF_TCAM_PROF TF_TCAM_TBL_TYPE_PROF_TCAM
+#define TF_TCAM_WC TF_TCAM_TBL_TYPE_WC_TCAM
+#define TF_TCAM_SP TF_TCAM_TBL_TYPE_SP_TCAM
+#define TF_TCAM_CT TF_TCAM_TBL_TYPE_CT_RULE_TCAM
+#define TF_TCAM_VEB TF_TCAM_TBL_TYPE_VEB_TCAM
+#define TF_TCAM_WC_HI TF_TCAM_TBL_TYPE_WC_TCAM_HIGH
+#define TF_TCAM_WC_LO TF_TCAM_TBL_TYPE_WC_TCAM_LOW
+
+static int cfa_tcam_mgr_row_data_alloc(struct cfa_tcam_mgr_data *tcam_mgr_data)
{
- if (type >= TF_TCAM_TBL_TYPE_MAX)
- assert(0);
- else
- return cfa_tcam_mgr_max_rows[type];
+ struct cfa_tcam_mgr_rx_row_data *rx_row_data;
+ struct cfa_tcam_mgr_tx_row_data *tx_row_data;
+ struct tfp_calloc_parms cparms;
+ int rc;
+
+ cparms.nitems = 1;
+ cparms.size = sizeof(struct cfa_tcam_mgr_rx_row_data);
+ cparms.alignment = 0;
+ rc = tfp_calloc(&cparms);
+ if (rc) {
+ /* Log error */
+ TFP_DRV_LOG(ERR,
+ "Failed to allocate rx_row_data, rc:%s\n",
+ strerror(-rc));
+ return -ENOMEM;
+ }
+
+ rx_row_data = (struct cfa_tcam_mgr_rx_row_data *)cparms.mem_va;
+
+ cparms.nitems = 1;
+ cparms.size = sizeof(struct cfa_tcam_mgr_tx_row_data);
+ cparms.alignment = 0;
+ rc = tfp_calloc(&cparms);
+ if (rc) {
+ /* Log error */
+ TFP_DRV_LOG(ERR,
+ "Failed to allocate tx_row_data, rc:%s\n",
+ strerror(-rc));
+ tfp_free(rx_row_data);
+ return -ENOMEM;
+ }
+
+ tx_row_data = (struct cfa_tcam_mgr_tx_row_data *)cparms.mem_va;
+
+ tcam_mgr_data->rx_row_data = rx_row_data;
+ tcam_mgr_data->tx_row_data = tx_row_data;
+
+ tcam_mgr_data->row_tables[TF_DIR_RX][TF_TCAM_L2_CTX_HI] =
+ &rx_row_data->cfa_tcam_mgr_L2_CTXT_TCAM_RX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_RX][TF_TCAM_L2_CTX_LO] =
+ &rx_row_data->cfa_tcam_mgr_L2_CTXT_TCAM_RX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_RX][TF_TCAM_PROF] =
+ &rx_row_data->cfa_tcam_mgr_PROF_TCAM_RX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_RX][TF_TCAM_WC] =
+ &rx_row_data->cfa_tcam_mgr_WC_TCAM_RX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_RX][TF_TCAM_SP] =
+ &rx_row_data->cfa_tcam_mgr_SP_TCAM_RX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_RX][TF_TCAM_CT] =
+ &rx_row_data->cfa_tcam_mgr_CT_RULE_TCAM_RX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_RX][TF_TCAM_VEB] =
+ &rx_row_data->cfa_tcam_mgr_VEB_TCAM_RX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_RX][TF_TCAM_WC_HI] =
+ &rx_row_data->cfa_tcam_mgr_WC_TCAM_RX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_RX][TF_TCAM_WC_LO] =
+ &rx_row_data->cfa_tcam_mgr_WC_TCAM_RX_row_data[0];
+
+ tcam_mgr_data->row_tables[TF_DIR_TX][TF_TCAM_L2_CTX_HI] =
+ &tx_row_data->cfa_tcam_mgr_L2_CTXT_TCAM_TX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_TX][TF_TCAM_L2_CTX_LO] =
+ &tx_row_data->cfa_tcam_mgr_L2_CTXT_TCAM_TX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_TX][TF_TCAM_PROF] =
+ &tx_row_data->cfa_tcam_mgr_PROF_TCAM_TX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_TX][TF_TCAM_WC] =
+ &tx_row_data->cfa_tcam_mgr_WC_TCAM_TX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_TX][TF_TCAM_SP] =
+ &tx_row_data->cfa_tcam_mgr_SP_TCAM_TX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_TX][TF_TCAM_CT] =
+ &tx_row_data->cfa_tcam_mgr_CT_RULE_TCAM_TX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_TX][TF_TCAM_VEB] =
+ &tx_row_data->cfa_tcam_mgr_VEB_TCAM_TX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_TX][TF_TCAM_WC_HI] =
+ &tx_row_data->cfa_tcam_mgr_WC_TCAM_TX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_TX][TF_TCAM_WC_LO] =
+ &tx_row_data->cfa_tcam_mgr_WC_TCAM_TX_row_data[0];
+
+ return 0;
}
-static int cfa_tcam_mgr_hwop_set(int sess_idx,
+static void cfa_tcam_mgr_row_data_free(struct cfa_tcam_mgr_data
+ *tcam_mgr_data)
+{
+ tfp_free(tcam_mgr_data->rx_row_data);
+ tfp_free(tcam_mgr_data->tx_row_data);
+}
+
+static int cfa_tcam_mgr_hwop_set(struct cfa_tcam_mgr_data *tcam_mgr_data,
struct cfa_tcam_mgr_set_parms *parms, int row,
int slice, int max_slices)
{
- struct cfa_tcam_mgr_TCAM_row_data *this_table;
- struct cfa_tcam_mgr_TCAM_row_data *this_row;
- this_table = row_tables[parms->dir]
+ struct cfa_tcam_mgr_tcam_row_data *this_table;
+ struct cfa_tcam_mgr_tcam_row_data *this_row;
+
+ this_table = tcam_mgr_data->row_tables[parms->dir]
[cfa_tcam_mgr_get_phys_table_type(parms->type)];
- this_table += (sess_idx *
- cfa_tcam_mgr_get_max_rows(cfa_tcam_mgr_get_phys_table_type(parms->type)));
this_row = &this_table[row * max_slices + slice];
this_row->key_size = parms->key_size;
memcpy(&this_row->key, parms->key, parms->key_size);
memcpy(&this_row->mask, parms->mask, parms->key_size);
this_row->result_size = parms->result_size;
- if (parms->result != ((void *)0))
+ if (parms->result)
memcpy(&this_row->result, parms->result, parms->result_size);
return 0;
};
-static int cfa_tcam_mgr_hwop_get(int sess_idx,
+static int cfa_tcam_mgr_hwop_get(struct cfa_tcam_mgr_data *tcam_mgr_data,
struct cfa_tcam_mgr_get_parms *parms, int row,
int slice, int max_slices)
{
- struct cfa_tcam_mgr_TCAM_row_data *this_table;
- struct cfa_tcam_mgr_TCAM_row_data *this_row;
- this_table = row_tables[parms->dir]
+ struct cfa_tcam_mgr_tcam_row_data *this_table;
+ struct cfa_tcam_mgr_tcam_row_data *this_row;
+
+ this_table = tcam_mgr_data->row_tables[parms->dir]
[cfa_tcam_mgr_get_phys_table_type(parms->type)];
- this_table += (sess_idx *
- cfa_tcam_mgr_get_max_rows(cfa_tcam_mgr_get_phys_table_type(parms->type)));
this_row = &this_table[row * max_slices + slice];
parms->key_size = this_row->key_size;
parms->result_size = this_row->result_size;
- if (parms->key != ((void *)0))
+ if (parms->key)
memcpy(parms->key, &this_row->key, parms->key_size);
- if (parms->mask != ((void *)0))
+ if (parms->mask)
memcpy(parms->mask, &this_row->mask, parms->key_size);
- if (parms->result != ((void *)0))
+ if (parms->result)
memcpy(parms->result, &this_row->result, parms->result_size);
return 0;
};
-static int cfa_tcam_mgr_hwop_free(int sess_idx,
+static int cfa_tcam_mgr_hwop_free(struct cfa_tcam_mgr_data *tcam_mgr_data,
struct cfa_tcam_mgr_free_parms *parms,
int row, int slice, int max_slices)
{
- struct cfa_tcam_mgr_TCAM_row_data *this_table;
- struct cfa_tcam_mgr_TCAM_row_data *this_row;
- this_table = row_tables[parms->dir]
+ struct cfa_tcam_mgr_tcam_row_data *this_table;
+ struct cfa_tcam_mgr_tcam_row_data *this_row;
+
+ this_table = tcam_mgr_data->row_tables[parms->dir]
[cfa_tcam_mgr_get_phys_table_type(parms->type)];
- this_table += (sess_idx *
- cfa_tcam_mgr_get_max_rows(cfa_tcam_mgr_get_phys_table_type(parms->type)));
this_row = &this_table[row * max_slices + slice];
memset(&this_row->key, 0, sizeof(this_row->key));
memset(&this_row->mask, 0, sizeof(this_row->mask));
diff --git a/drivers/net/bnxt/tf_core/cfa_tcam_mgr_p4.h b/drivers/net/bnxt/tf_core/cfa_tcam_mgr_p4.h
index 3ca59b2aeb..acf3029578 100644
--- a/drivers/net/bnxt/tf_core/cfa_tcam_mgr_p4.h
+++ b/drivers/net/bnxt/tf_core/cfa_tcam_mgr_p4.h
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2021-2023 Broadcom
+ * Copyright(c) 2021-2024 Broadcom
* All rights reserved.
*/
@@ -7,13 +7,12 @@
#define CFA_TCAM_MGR_P4_H
#include "cfa_tcam_mgr_device.h"
-#include "cfa_tcam_mgr_sbmp.h"
int
-cfa_tcam_mgr_init_p4(int sess_idx, struct cfa_tcam_mgr_entry_data **global_entry_data);
+cfa_tcam_mgr_init_p4(struct tf *tfp);
-int
-cfa_tcam_mgr_sess_table_get_p4(int sess_idx, struct sbmp **session_bmp);
+void
+cfa_tcam_mgr_uninit_p4(struct tf *tfp);
int
cfa_tcam_mgr_hwops_get_funcs_p4(struct cfa_tcam_mgr_hwops_funcs *hwop_funcs);
diff --git a/drivers/net/bnxt/tf_core/cfa_tcam_mgr_p58.c b/drivers/net/bnxt/tf_core/cfa_tcam_mgr_p58.c
index 656b10641e..a9d3d08673 100644
--- a/drivers/net/bnxt/tf_core/cfa_tcam_mgr_p58.c
+++ b/drivers/net/bnxt/tf_core/cfa_tcam_mgr_p58.c
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2021-2023 Broadcom
+ * Copyright(c) 2021-2024 Broadcom
* All rights reserved.
*/
@@ -12,6 +12,7 @@
#include "tfp.h"
#include "assert.h"
#include "tf_util.h"
+#include "tf_session.h"
/*
* Sizings of the TCAMs on P5
@@ -126,38 +127,40 @@
* Array sizes have 1 added to avoid zero length arrays.
*/
-static struct cfa_tcam_mgr_table_rows_1
- cfa_tcam_mgr_table_rows_L2_CTXT_TCAM_RX[TF_TCAM_MAX_SESSIONS][L2_CTXT_TCAM_RX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_1
- cfa_tcam_mgr_table_rows_L2_CTXT_TCAM_TX[TF_TCAM_MAX_SESSIONS][L2_CTXT_TCAM_TX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_1
- cfa_tcam_mgr_table_rows_PROF_TCAM_RX[TF_TCAM_MAX_SESSIONS][PROF_TCAM_RX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_1
- cfa_tcam_mgr_table_rows_PROF_TCAM_TX[TF_TCAM_MAX_SESSIONS][PROF_TCAM_TX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_4
- cfa_tcam_mgr_table_rows_WC_TCAM_RX[TF_TCAM_MAX_SESSIONS][WC_TCAM_RX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_4
- cfa_tcam_mgr_table_rows_WC_TCAM_TX[TF_TCAM_MAX_SESSIONS][WC_TCAM_TX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_1
- cfa_tcam_mgr_table_rows_SP_TCAM_RX[TF_TCAM_MAX_SESSIONS][SP_TCAM_RX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_1
- cfa_tcam_mgr_table_rows_SP_TCAM_TX[TF_TCAM_MAX_SESSIONS][SP_TCAM_TX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_1
- cfa_tcam_mgr_table_rows_CT_RULE_TCAM_RX[TF_TCAM_MAX_SESSIONS][CT_RULE_TCAM_RX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_1
- cfa_tcam_mgr_table_rows_CT_RULE_TCAM_TX[TF_TCAM_MAX_SESSIONS][CT_RULE_TCAM_TX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_1
- cfa_tcam_mgr_table_rows_VEB_TCAM_RX[TF_TCAM_MAX_SESSIONS][VEB_TCAM_RX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_1
- cfa_tcam_mgr_table_rows_VEB_TCAM_TX[TF_TCAM_MAX_SESSIONS][VEB_TCAM_TX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_4
- cfa_tcam_mgr_table_rows_WC_TCAM_RX_HIGH[TF_TCAM_MAX_SESSIONS][WC_TCAM_RX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_4
- cfa_tcam_mgr_table_rows_WC_TCAM_RX_LOW[TF_TCAM_MAX_SESSIONS][WC_TCAM_RX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_4
- cfa_tcam_mgr_table_rows_WC_TCAM_TX_HIGH[TF_TCAM_MAX_SESSIONS][WC_TCAM_TX_NUM_ROWS + 1];
-static struct cfa_tcam_mgr_table_rows_4
- cfa_tcam_mgr_table_rows_WC_TCAM_TX_LOW[TF_TCAM_MAX_SESSIONS][WC_TCAM_TX_NUM_ROWS + 1];
+struct cfa_tcam_mgr_table_rows_p58 {
+ struct cfa_tcam_mgr_table_rows_1
+ table_rows_L2_CTXT_TCAM_RX[L2_CTXT_TCAM_RX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_1
+ table_rows_L2_CTXT_TCAM_TX[L2_CTXT_TCAM_TX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_1
+ table_rows_PROF_TCAM_RX[PROF_TCAM_RX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_1
+ table_rows_PROF_TCAM_TX[PROF_TCAM_TX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_4
+ table_rows_WC_TCAM_RX[WC_TCAM_RX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_4
+ table_rows_WC_TCAM_TX[WC_TCAM_TX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_1
+ table_rows_SP_TCAM_RX[SP_TCAM_RX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_1
+ table_rows_SP_TCAM_TX[SP_TCAM_TX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_1
+ table_rows_CT_RULE_TCAM_RX[CT_RULE_TCAM_RX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_1
+ table_rows_CT_RULE_TCAM_TX[CT_RULE_TCAM_TX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_1
+ table_rows_VEB_TCAM_RX[VEB_TCAM_RX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_1
+ table_rows_VEB_TCAM_TX[VEB_TCAM_TX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_4
+ table_rows_WC_TCAM_RX_HIGH[WC_TCAM_RX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_4
+ table_rows_WC_TCAM_RX_LOW[WC_TCAM_RX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_4
+ table_rows_WC_TCAM_TX_HIGH[WC_TCAM_TX_NUM_ROWS + 1];
+ struct cfa_tcam_mgr_table_rows_4
+ table_rows_WC_TCAM_TX_LOW[WC_TCAM_TX_NUM_ROWS + 1];
+};
struct cfa_tcam_mgr_table_data
cfa_tcam_mgr_tables_p58[TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX] = {
@@ -177,7 +180,7 @@ cfa_tcam_mgr_tables_p58[TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX] = {
.row_width = L2_CTXT_TCAM_RX_ROW_WIDTH,
.num_rows = L2_CTXT_TCAM_RX_NUM_ROWS,
.start_row = 0,
- .end_row = (L2_CTXT_TCAM_RX_NUM_ROWS / 2) - 1,
+ .end_row = L2_CTXT_TCAM_RX_APP_HI_END,
.max_entries = (L2_CTXT_TCAM_RX_MAX_ENTRIES / 2),
.result_size = L2_CTXT_TCAM_RX_RESULT_SIZE,
.hcapi_type = CFA_RESOURCE_TYPE_P58_L2_CTXT_TCAM_HIGH,
@@ -196,7 +199,7 @@ cfa_tcam_mgr_tables_p58[TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX] = {
.max_slices = L2_CTXT_TCAM_RX_MAX_SLICES,
.row_width = L2_CTXT_TCAM_RX_ROW_WIDTH,
.num_rows = L2_CTXT_TCAM_RX_NUM_ROWS,
- .start_row = (L2_CTXT_TCAM_RX_NUM_ROWS / 2),
+ .start_row = L2_CTXT_TCAM_RX_APP_LO_START,
.end_row = L2_CTXT_TCAM_RX_NUM_ROWS - 1,
.max_entries = (L2_CTXT_TCAM_RX_MAX_ENTRIES / 2),
.result_size = L2_CTXT_TCAM_RX_RESULT_SIZE,
@@ -275,7 +278,8 @@ cfa_tcam_mgr_tables_p58[TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX] = {
.num_rows = CT_RULE_TCAM_RX_NUM_ROWS,
.start_row = 0,
#if CT_RULE_TCAM_RX_NUM_ROWS > 0
- .end_row = CT_RULE_TCAM_RX_NUM_ROWS - 1,
+ .end_row =
+ TCAM_SET_END_ROW(CT_RULE_TCAM_RX_NUM_ROWS),
#else
.end_row = CT_RULE_TCAM_RX_NUM_ROWS,
#endif
@@ -298,7 +302,7 @@ cfa_tcam_mgr_tables_p58[TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX] = {
.num_rows = VEB_TCAM_RX_NUM_ROWS,
.start_row = 0,
#if VEB_TCAM_RX_NUM_ROWS > 0
- .end_row = VEB_TCAM_RX_NUM_ROWS - 1,
+ .end_row = TCAM_SET_END_ROW(VEB_TCAM_RX_NUM_ROWS),
#else
.end_row = VEB_TCAM_RX_NUM_ROWS,
#endif
@@ -363,7 +367,7 @@ cfa_tcam_mgr_tables_p58[TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX] = {
.row_width = L2_CTXT_TCAM_TX_ROW_WIDTH,
.num_rows = L2_CTXT_TCAM_TX_NUM_ROWS,
.start_row = 0,
- .end_row = (L2_CTXT_TCAM_TX_NUM_ROWS / 2) - 1,
+ .end_row = L2_CTXT_TCAM_TX_APP_HI_END,
.max_entries = (L2_CTXT_TCAM_TX_MAX_ENTRIES / 2),
.result_size = L2_CTXT_TCAM_TX_RESULT_SIZE,
.hcapi_type = CFA_RESOURCE_TYPE_P58_L2_CTXT_TCAM_HIGH,
@@ -382,7 +386,7 @@ cfa_tcam_mgr_tables_p58[TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX] = {
.max_slices = L2_CTXT_TCAM_TX_MAX_SLICES,
.row_width = L2_CTXT_TCAM_TX_ROW_WIDTH,
.num_rows = L2_CTXT_TCAM_TX_NUM_ROWS,
- .start_row = (L2_CTXT_TCAM_TX_NUM_ROWS / 2),
+ .start_row = L2_CTXT_TCAM_TX_APP_LO_START,
.end_row = L2_CTXT_TCAM_TX_NUM_ROWS - 1,
.max_entries = (L2_CTXT_TCAM_TX_MAX_ENTRIES / 2),
.result_size = L2_CTXT_TCAM_TX_RESULT_SIZE,
@@ -461,7 +465,8 @@ cfa_tcam_mgr_tables_p58[TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX] = {
.num_rows = CT_RULE_TCAM_TX_NUM_ROWS,
.start_row = 0,
#if CT_RULE_TCAM_TX_NUM_ROWS > 0
- .end_row = CT_RULE_TCAM_TX_NUM_ROWS - 1,
+ .end_row =
+ TCAM_SET_END_ROW(CT_RULE_TCAM_TX_NUM_ROWS),
#else
.end_row = CT_RULE_TCAM_TX_NUM_ROWS,
#endif
@@ -531,227 +536,310 @@ cfa_tcam_mgr_tables_p58[TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX] = {
},
};
-static struct cfa_tcam_mgr_entry_data entry_data_p58[TF_TCAM_MAX_SESSIONS][TF_TCAM_MAX_ENTRIES];
-
-static struct sbmp session_bmp_p58[TF_TCAM_MAX_SESSIONS][TF_TCAM_MAX_ENTRIES];
+static int cfa_tcam_mgr_row_data_alloc(struct cfa_tcam_mgr_data *tcam_mgr_data);
+static void cfa_tcam_mgr_row_data_free(struct cfa_tcam_mgr_data *tcam_mgr_data);
-int
-cfa_tcam_mgr_sess_table_get_p58(int sess_idx, struct sbmp **session_bmp)
+static void cfa_tcam_mgr_data_free(struct tf_session *tfs)
{
- *session_bmp = session_bmp_p58[sess_idx];
- return 0;
+ struct cfa_tcam_mgr_data *tcam_mgr_data = tfs->tcam_mgr_handle;
+
+ if (!tcam_mgr_data)
+ return;
+
+ tfp_free(tcam_mgr_data->table_rows);
+ tfp_free(tcam_mgr_data->entry_data);
+ tfp_free(tcam_mgr_data->session_bmp);
+ cfa_tcam_mgr_row_data_free(tcam_mgr_data);
+
+ tfp_free(tcam_mgr_data);
+ tfs->tcam_mgr_handle = NULL;
}
int
-cfa_tcam_mgr_init_p58(int sess_idx, struct cfa_tcam_mgr_entry_data **global_entry_data)
+cfa_tcam_mgr_init_p58(struct tf *tfp)
{
- int max_row_width = 0;
+ struct cfa_tcam_mgr_table_rows_p58 *table_rows;
+ struct cfa_tcam_mgr_data *tcam_mgr_data;
+ struct tfp_calloc_parms cparms;
int max_result_size = 0;
+ struct tf_session *tfs;
+ int max_row_width = 0;
int dir, type;
+ int rc;
+
+ rc = tf_session_get_session_internal(tfp, &tfs);
+ if (rc)
+ return rc;
+
+ cparms.nitems = 1;
+ cparms.size = sizeof(struct cfa_tcam_mgr_data);
+ cparms.alignment = 0;
+ rc = tfp_calloc(&cparms);
+ if (rc) {
+ /* Log error */
+ TFP_DRV_LOG(ERR,
+ "Failed to allocate block, rc:%s\n",
+ strerror(-rc));
+ return rc;
+ }
+ tcam_mgr_data = (struct cfa_tcam_mgr_data *)cparms.mem_va;
+ tfs->tcam_mgr_handle = tcam_mgr_data;
+
+ cparms.nitems = 1;
+ cparms.size = sizeof(struct cfa_tcam_mgr_table_rows_p58);
+ cparms.alignment = 0;
+ rc = tfp_calloc(&cparms);
+ if (rc) {
+ /* Log error */
+ TFP_DRV_LOG(ERR,
+ "Failed to allocate block, rc:%s\n",
+ strerror(-rc));
+ tfp_free(tfs->tcam_mgr_handle);
+ tfs->tcam_mgr_handle = NULL;
+ return rc;
+ }
+ table_rows = (struct cfa_tcam_mgr_table_rows_p58 *)cparms.mem_va;
+ tcam_mgr_data->table_rows = table_rows;
- *global_entry_data = entry_data_p58[sess_idx];
+ cparms.nitems = TF_TCAM_MAX_ENTRIES;
+ cparms.size = sizeof(struct cfa_tcam_mgr_entry_data);
+ cparms.alignment = 0;
+ rc = tfp_calloc(&cparms);
+ if (rc) {
+ /* Log error */
+ TFP_DRV_LOG(ERR,
+ "Failed to allocate block, rc:%s\n",
+ strerror(-rc));
+ goto fail;
+ }
+ tcam_mgr_data->entry_data =
+ (struct cfa_tcam_mgr_entry_data *)cparms.mem_va;
+
+ rc = cfa_tcam_mgr_row_data_alloc(tcam_mgr_data);
+ if (rc)
+ goto fail;
- memcpy(&cfa_tcam_mgr_tables[sess_idx],
+ memcpy(tcam_mgr_data->cfa_tcam_mgr_tables,
&cfa_tcam_mgr_tables_p58,
- sizeof(cfa_tcam_mgr_tables[sess_idx]));
+ sizeof(tcam_mgr_data->cfa_tcam_mgr_tables));
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_L2_CTXT_TCAM_HIGH_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_L2_CTXT_TCAM_RX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ &table_rows->table_rows_L2_CTXT_TCAM_RX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_L2_CTXT_TCAM_HIGH_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_L2_CTXT_TCAM_RX[sess_idx];
+ &table_rows->table_rows_L2_CTXT_TCAM_RX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_L2_CTXT_TCAM_HIGH_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_L2_CTXT_TCAM_TX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ &table_rows->table_rows_L2_CTXT_TCAM_TX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_L2_CTXT_TCAM_HIGH_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_L2_CTXT_TCAM_TX[sess_idx];
+ &table_rows->table_rows_L2_CTXT_TCAM_TX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_L2_CTXT_TCAM_LOW_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_L2_CTXT_TCAM_RX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ &table_rows->table_rows_L2_CTXT_TCAM_RX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_L2_CTXT_TCAM_LOW_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_L2_CTXT_TCAM_RX[sess_idx];
+ &table_rows->table_rows_L2_CTXT_TCAM_RX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_L2_CTXT_TCAM_LOW_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_L2_CTXT_TCAM_TX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ &table_rows->table_rows_L2_CTXT_TCAM_TX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_L2_CTXT_TCAM_LOW_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_L2_CTXT_TCAM_TX[sess_idx];
+ &table_rows->table_rows_L2_CTXT_TCAM_TX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_PROF_TCAM_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_PROF_TCAM_RX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ &table_rows->table_rows_PROF_TCAM_RX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_PROF_TCAM_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_PROF_TCAM_RX[sess_idx];
+ &table_rows->table_rows_PROF_TCAM_RX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_PROF_TCAM_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_PROF_TCAM_TX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ &table_rows->table_rows_PROF_TCAM_TX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_PROF_TCAM_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_PROF_TCAM_TX[sess_idx];
+ &table_rows->table_rows_PROF_TCAM_TX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_RX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ &table_rows->table_rows_WC_TCAM_RX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_RX[sess_idx];
+ &table_rows->table_rows_WC_TCAM_RX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_TX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ &table_rows->table_rows_WC_TCAM_TX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_TX[sess_idx];
+ &table_rows->table_rows_WC_TCAM_TX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_SP_TCAM_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_SP_TCAM_RX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ &table_rows->table_rows_SP_TCAM_RX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_SP_TCAM_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_SP_TCAM_RX[sess_idx];
+ &table_rows->table_rows_SP_TCAM_RX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_SP_TCAM_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_SP_TCAM_TX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ &table_rows->table_rows_SP_TCAM_TX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_SP_TCAM_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_SP_TCAM_TX[sess_idx];
+ &table_rows->table_rows_SP_TCAM_TX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_CT_RULE_TCAM_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_CT_RULE_TCAM_RX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ &table_rows->table_rows_CT_RULE_TCAM_RX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_CT_RULE_TCAM_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_CT_RULE_TCAM_RX[sess_idx];
+ &table_rows->table_rows_CT_RULE_TCAM_RX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_CT_RULE_TCAM_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_CT_RULE_TCAM_TX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ &table_rows->table_rows_CT_RULE_TCAM_TX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_CT_RULE_TCAM_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_CT_RULE_TCAM_TX[sess_idx];
+ &table_rows->table_rows_CT_RULE_TCAM_TX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_VEB_TCAM_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_VEB_TCAM_RX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ &table_rows->table_rows_VEB_TCAM_RX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_VEB_TCAM_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_VEB_TCAM_RX[sess_idx];
+ &table_rows->table_rows_VEB_TCAM_RX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_VEB_TCAM_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_VEB_TCAM_TX[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ &table_rows->table_rows_VEB_TCAM_TX[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_VEB_TCAM_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_VEB_TCAM_TX[sess_idx];
+ &table_rows->table_rows_VEB_TCAM_TX[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_HIGH_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_RX_HIGH[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ &table_rows->table_rows_WC_TCAM_RX_HIGH[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_HIGH_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_RX_HIGH[sess_idx];
+ &table_rows->table_rows_WC_TCAM_RX_HIGH[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_HIGH_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_TX_HIGH[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ &table_rows->table_rows_WC_TCAM_TX_HIGH[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_HIGH_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_TX_HIGH[sess_idx];
+ &table_rows->table_rows_WC_TCAM_TX_HIGH[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_LOW_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_RX_LOW[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_RX]
+ &table_rows->table_rows_WC_TCAM_RX_LOW[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_RX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_LOW_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_RX_LOW[sess_idx];
+ &table_rows->table_rows_WC_TCAM_RX_LOW[0];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_LOW_AFM].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_TX_LOW[sess_idx];
- cfa_tcam_mgr_tables[sess_idx][TF_DIR_TX]
+ &table_rows->table_rows_WC_TCAM_TX_LOW[0];
+ tcam_mgr_data->cfa_tcam_mgr_tables[TF_DIR_TX]
[CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_LOW_APPS].tcam_rows =
(struct cfa_tcam_mgr_table_rows_0 *)
- &cfa_tcam_mgr_table_rows_WC_TCAM_TX_LOW[sess_idx];
+ &table_rows->table_rows_WC_TCAM_TX_LOW[0];
+
for (dir = 0; dir < TF_DIR_MAX; dir++) {
for (type = 0; type < CFA_TCAM_MGR_TBL_TYPE_MAX; type++) {
- if (cfa_tcam_mgr_tables[sess_idx][dir][type].row_width >
+ if (tcam_mgr_data->cfa_tcam_mgr_tables[dir]
+ [type].row_width >
max_row_width)
max_row_width =
- cfa_tcam_mgr_tables[sess_idx][dir][type].row_width;
- if (cfa_tcam_mgr_tables[sess_idx][dir][type].result_size >
+ tcam_mgr_data->cfa_tcam_mgr_tables[dir]
+ [type].row_width;
+ if (tcam_mgr_data->cfa_tcam_mgr_tables[dir]
+ [type].result_size >
max_result_size)
max_result_size =
- cfa_tcam_mgr_tables[sess_idx][dir][type].result_size;
+ tcam_mgr_data->cfa_tcam_mgr_tables[dir]
+ [type].result_size;
}
}
if (max_row_width != MAX_ROW_WIDTH) {
- CFA_TCAM_MGR_LOG(ERR,
- "MAX_ROW_WIDTH (%d) does not match actual "
- "value (%d).\n",
- MAX_ROW_WIDTH,
- max_row_width);
- return -CFA_TCAM_MGR_ERR_CODE(INVAL);
+ TFP_DRV_LOG(ERR,
+ "MAX_ROW_WIDTH:%d does not match actual val:%d\n",
+ MAX_ROW_WIDTH, max_row_width);
+ rc = -EINVAL;
+ goto fail;
}
if (max_result_size != MAX_RESULT_SIZE) {
- CFA_TCAM_MGR_LOG(ERR,
- "MAX_RESULT_SIZE (%d) does not match actual "
- "value (%d).\n",
- MAX_RESULT_SIZE,
- max_result_size);
- return -CFA_TCAM_MGR_ERR_CODE(INVAL);
+ TFP_DRV_LOG(ERR,
+ "MAX_RESULT_SIZE:%d does not match actual val:%d\n",
+ MAX_RESULT_SIZE, max_result_size);
+ rc = -EINVAL;
+ goto fail;
}
+
return 0;
+
+fail:
+ cfa_tcam_mgr_data_free(tfs);
+ return rc;
+}
+
+void cfa_tcam_mgr_uninit_p58(struct tf *tfp)
+{
+ struct tf_session *tfs;
+ int rc;
+
+ rc = tf_session_get_session_internal(tfp, &tfs);
+ if (rc)
+ return;
+
+ cfa_tcam_mgr_data_free(tfs);
}
/* HW OP declarations begin here */
-struct cfa_tcam_mgr_TCAM_row_data {
+struct cfa_tcam_mgr_tcam_row_data {
int key_size;
int result_size;
uint8_t key[MAX_ROW_WIDTH];
@@ -778,134 +866,182 @@ struct cfa_tcam_mgr_TCAM_row_data {
(CT_RULE_TCAM_TX_MAX_SLICES * CT_RULE_TCAM_TX_NUM_ROWS)
#define VEB_TX_MAX_ROWS (VEB_TCAM_TX_MAX_SLICES * VEB_TCAM_TX_NUM_ROWS)
-static int cfa_tcam_mgr_max_rows[TF_TCAM_TBL_TYPE_MAX] = {
- L2_CTXT_RX_MAX_ROWS,
- L2_CTXT_RX_MAX_ROWS,
- PROF_RX_MAX_ROWS,
- WC_RX_MAX_ROWS,
- SP_RX_MAX_ROWS,
- CT_RULE_RX_MAX_ROWS,
- VEB_RX_MAX_ROWS,
- WC_RX_MAX_ROWS,
- WC_RX_MAX_ROWS
+struct cfa_tcam_mgr_rx_row_data {
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_L2_CTXT_TCAM_RX_row_data[L2_CTXT_RX_MAX_ROWS + 1];
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_PROF_TCAM_RX_row_data[PROF_RX_MAX_ROWS + 1];
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_WC_TCAM_RX_row_data[WC_TX_MAX_ROWS + 1];
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_SP_TCAM_RX_row_data[SP_RX_MAX_ROWS + 1];
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_CT_RULE_TCAM_RX_row_data[CT_RULE_RX_MAX_ROWS + 1];
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_VEB_TCAM_RX_row_data[VEB_RX_MAX_ROWS + 1];
};
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_L2_CTXT_TCAM_RX_row_data[TF_TCAM_MAX_SESSIONS][L2_CTXT_RX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_PROF_TCAM_RX_row_data[TF_TCAM_MAX_SESSIONS][PROF_RX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_WC_TCAM_RX_row_data[TF_TCAM_MAX_SESSIONS][WC_RX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_SP_TCAM_RX_row_data[TF_TCAM_MAX_SESSIONS][SP_RX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_CT_RULE_TCAM_RX_row_data[TF_TCAM_MAX_SESSIONS][CT_RULE_RX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_VEB_TCAM_RX_row_data[TF_TCAM_MAX_SESSIONS][VEB_RX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_WC_TCAM_RX_row_data[TF_TCAM_MAX_SESSIONS][WC_RX_MAX_ROWS];
-
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_L2_CTXT_TCAM_TX_row_data[TF_TCAM_MAX_SESSIONS][L2_CTXT_TX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_PROF_TCAM_TX_row_data[TF_TCAM_MAX_SESSIONS][PROF_TX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_WC_TCAM_TX_row_data[TF_TCAM_MAX_SESSIONS][WC_TX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_SP_TCAM_TX_row_data[TF_TCAM_MAX_SESSIONS][SP_TX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_CT_RULE_TCAM_TX_row_data[TF_TCAM_MAX_SESSIONS][CT_RULE_TX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_VEB_TCAM_TX_row_data[TF_TCAM_MAX_SESSIONS][VEB_TX_MAX_ROWS];
-static struct cfa_tcam_mgr_TCAM_row_data
- cfa_tcam_mgr_WC_TCAM_TX_row_data[TF_TCAM_MAX_SESSIONS][WC_TX_MAX_ROWS];
-
-static struct cfa_tcam_mgr_TCAM_row_data *
-row_tables[TF_DIR_MAX][TF_TCAM_TBL_TYPE_MAX] = {
- {
- cfa_tcam_mgr_L2_CTXT_TCAM_RX_row_data[0],
- cfa_tcam_mgr_L2_CTXT_TCAM_RX_row_data[0],
- cfa_tcam_mgr_PROF_TCAM_RX_row_data[0],
- cfa_tcam_mgr_WC_TCAM_RX_row_data[0],
- cfa_tcam_mgr_SP_TCAM_RX_row_data[0],
- cfa_tcam_mgr_CT_RULE_TCAM_RX_row_data[0],
- cfa_tcam_mgr_VEB_TCAM_RX_row_data[0],
- cfa_tcam_mgr_WC_TCAM_RX_row_data[0],
- cfa_tcam_mgr_WC_TCAM_RX_row_data[0],
- },
- {
- cfa_tcam_mgr_L2_CTXT_TCAM_TX_row_data[0],
- cfa_tcam_mgr_L2_CTXT_TCAM_TX_row_data[0],
- cfa_tcam_mgr_PROF_TCAM_TX_row_data[0],
- cfa_tcam_mgr_WC_TCAM_TX_row_data[0],
- cfa_tcam_mgr_SP_TCAM_TX_row_data[0],
- cfa_tcam_mgr_CT_RULE_TCAM_TX_row_data[0],
- cfa_tcam_mgr_VEB_TCAM_TX_row_data[0],
- cfa_tcam_mgr_WC_TCAM_TX_row_data[0],
- cfa_tcam_mgr_WC_TCAM_TX_row_data[0],
- }
+struct cfa_tcam_mgr_tx_row_data {
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_L2_CTXT_TCAM_TX_row_data[L2_CTXT_TX_MAX_ROWS + 1];
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_PROF_TCAM_TX_row_data[PROF_TX_MAX_ROWS + 1];
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_WC_TCAM_TX_row_data[WC_TX_MAX_ROWS + 1];
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_SP_TCAM_TX_row_data[SP_TX_MAX_ROWS + 1];
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_CT_RULE_TCAM_TX_row_data[CT_RULE_TX_MAX_ROWS + 1];
+ struct cfa_tcam_mgr_tcam_row_data
+ cfa_tcam_mgr_VEB_TCAM_TX_row_data[VEB_TX_MAX_ROWS + 1];
};
-static int cfa_tcam_mgr_get_max_rows(enum tf_tcam_tbl_type type)
+#define TF_TCAM_L2_CTX_HI TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH
+#define TF_TCAM_L2_CTX_LO TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW
+#define TF_TCAM_PROF TF_TCAM_TBL_TYPE_PROF_TCAM
+#define TF_TCAM_WC TF_TCAM_TBL_TYPE_WC_TCAM
+#define TF_TCAM_SP TF_TCAM_TBL_TYPE_SP_TCAM
+#define TF_TCAM_CT TF_TCAM_TBL_TYPE_CT_RULE_TCAM
+#define TF_TCAM_VEB TF_TCAM_TBL_TYPE_VEB_TCAM
+#define TF_TCAM_WC_HI TF_TCAM_TBL_TYPE_WC_TCAM_HIGH
+#define TF_TCAM_WC_LO TF_TCAM_TBL_TYPE_WC_TCAM_LOW
+
+static int cfa_tcam_mgr_row_data_alloc(struct cfa_tcam_mgr_data *tcam_mgr_data)
+{
+ struct cfa_tcam_mgr_rx_row_data *rx_row_data;
+ struct cfa_tcam_mgr_tx_row_data *tx_row_data;
+ struct tfp_calloc_parms cparms;
+ int rc;
+
+ cparms.nitems = 1;
+ cparms.size = sizeof(struct cfa_tcam_mgr_rx_row_data);
+ cparms.alignment = 0;
+ rc = tfp_calloc(&cparms);
+ if (rc) {
+ /* Log error */
+ TFP_DRV_LOG(ERR,
+ "Failed to allocate rx_row_data, rc:%s\n",
+ strerror(-rc));
+ return -ENOMEM;
+ }
+
+ rx_row_data = (struct cfa_tcam_mgr_rx_row_data *)cparms.mem_va;
+
+ cparms.nitems = 1;
+ cparms.size = sizeof(struct cfa_tcam_mgr_tx_row_data);
+ cparms.alignment = 0;
+ rc = tfp_calloc(&cparms);
+ if (rc) {
+ /* Log error */
+ TFP_DRV_LOG(ERR,
+ "Failed to allocate tx_row_data, rc:%s\n",
+ strerror(-rc));
+ tfp_free(rx_row_data);
+ return -ENOMEM;
+ }
+
+ tx_row_data = (struct cfa_tcam_mgr_tx_row_data *)cparms.mem_va;
+
+ tcam_mgr_data->rx_row_data = rx_row_data;
+ tcam_mgr_data->tx_row_data = tx_row_data;
+
+ tcam_mgr_data->row_tables[TF_DIR_RX][TF_TCAM_L2_CTX_HI] =
+ &rx_row_data->cfa_tcam_mgr_L2_CTXT_TCAM_RX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_RX][TF_TCAM_L2_CTX_LO] =
+ &rx_row_data->cfa_tcam_mgr_L2_CTXT_TCAM_RX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_RX][TF_TCAM_PROF] =
+ &rx_row_data->cfa_tcam_mgr_PROF_TCAM_RX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_RX][TF_TCAM_WC] =
+ &rx_row_data->cfa_tcam_mgr_WC_TCAM_RX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_RX][TF_TCAM_SP] =
+ &rx_row_data->cfa_tcam_mgr_SP_TCAM_RX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_RX][TF_TCAM_CT] =
+ &rx_row_data->cfa_tcam_mgr_CT_RULE_TCAM_RX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_RX][TF_TCAM_VEB] =
+ &rx_row_data->cfa_tcam_mgr_VEB_TCAM_RX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_RX][TF_TCAM_WC_HI] =
+ &rx_row_data->cfa_tcam_mgr_WC_TCAM_RX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_RX][TF_TCAM_WC_LO] =
+ &rx_row_data->cfa_tcam_mgr_WC_TCAM_RX_row_data[0];
+
+ tcam_mgr_data->row_tables[TF_DIR_TX][TF_TCAM_L2_CTX_HI] =
+ &tx_row_data->cfa_tcam_mgr_L2_CTXT_TCAM_TX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_TX][TF_TCAM_L2_CTX_LO] =
+ &tx_row_data->cfa_tcam_mgr_L2_CTXT_TCAM_TX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_TX][TF_TCAM_PROF] =
+ &tx_row_data->cfa_tcam_mgr_PROF_TCAM_TX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_TX][TF_TCAM_WC] =
+ &tx_row_data->cfa_tcam_mgr_WC_TCAM_TX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_TX][TF_TCAM_SP] =
+ &tx_row_data->cfa_tcam_mgr_SP_TCAM_TX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_TX][TF_TCAM_CT] =
+ &tx_row_data->cfa_tcam_mgr_CT_RULE_TCAM_TX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_TX][TF_TCAM_VEB] =
+ &tx_row_data->cfa_tcam_mgr_VEB_TCAM_TX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_TX][TF_TCAM_WC_HI] =
+ &tx_row_data->cfa_tcam_mgr_WC_TCAM_TX_row_data[0];
+ tcam_mgr_data->row_tables[TF_DIR_TX][TF_TCAM_WC_LO] =
+ &tx_row_data->cfa_tcam_mgr_WC_TCAM_TX_row_data[0];
+
+ return 0;
+}
+
+static void cfa_tcam_mgr_row_data_free(struct cfa_tcam_mgr_data
+ *tcam_mgr_data)
{
- if (type >= TF_TCAM_TBL_TYPE_MAX)
- assert(0);
- else
- return cfa_tcam_mgr_max_rows[type];
+ tfp_free(tcam_mgr_data->rx_row_data);
+ tfp_free(tcam_mgr_data->tx_row_data);
}
-static int cfa_tcam_mgr_hwop_set(int sess_idx,
+static int cfa_tcam_mgr_hwop_set(struct cfa_tcam_mgr_data *tcam_mgr_data,
struct cfa_tcam_mgr_set_parms *parms, int row,
int slice, int max_slices)
{
- struct cfa_tcam_mgr_TCAM_row_data *this_table;
- struct cfa_tcam_mgr_TCAM_row_data *this_row;
- this_table = row_tables[parms->dir]
+ struct cfa_tcam_mgr_tcam_row_data *this_table;
+ struct cfa_tcam_mgr_tcam_row_data *this_row;
+
+ this_table = tcam_mgr_data->row_tables[parms->dir]
[cfa_tcam_mgr_get_phys_table_type(parms->type)];
- this_table += (sess_idx *
- cfa_tcam_mgr_get_max_rows(cfa_tcam_mgr_get_phys_table_type(parms->type)));
this_row = &this_table[row * max_slices + slice];
this_row->key_size = parms->key_size;
memcpy(&this_row->key, parms->key, parms->key_size);
memcpy(&this_row->mask, parms->mask, parms->key_size);
this_row->result_size = parms->result_size;
- if (parms->result != ((void *)0))
+ if (parms->result)
memcpy(&this_row->result, parms->result, parms->result_size);
return 0;
};
-static int cfa_tcam_mgr_hwop_get(int sess_idx,
+static int cfa_tcam_mgr_hwop_get(struct cfa_tcam_mgr_data *tcam_mgr_data,
struct cfa_tcam_mgr_get_parms *parms, int row,
int slice, int max_slices)
{
- struct cfa_tcam_mgr_TCAM_row_data *this_table;
- struct cfa_tcam_mgr_TCAM_row_data *this_row;
- this_table = row_tables[parms->dir]
+ struct cfa_tcam_mgr_tcam_row_data *this_table;
+ struct cfa_tcam_mgr_tcam_row_data *this_row;
+
+ this_table = tcam_mgr_data->row_tables[parms->dir]
[cfa_tcam_mgr_get_phys_table_type(parms->type)];
- this_table += (sess_idx *
- cfa_tcam_mgr_get_max_rows(cfa_tcam_mgr_get_phys_table_type(parms->type)));
this_row = &this_table[row * max_slices + slice];
parms->key_size = this_row->key_size;
parms->result_size = this_row->result_size;
- if (parms->key != ((void *)0))
+ if (parms->key)
memcpy(parms->key, &this_row->key, parms->key_size);
- if (parms->mask != ((void *)0))
+ if (parms->mask)
memcpy(parms->mask, &this_row->mask, parms->key_size);
- if (parms->result != ((void *)0))
+ if (parms->result)
memcpy(parms->result, &this_row->result, parms->result_size);
return 0;
};
-static int cfa_tcam_mgr_hwop_free(int sess_idx,
+static int cfa_tcam_mgr_hwop_free(struct cfa_tcam_mgr_data *tcam_mgr_data,
struct cfa_tcam_mgr_free_parms *parms,
int row, int slice, int max_slices)
{
- struct cfa_tcam_mgr_TCAM_row_data *this_table;
- struct cfa_tcam_mgr_TCAM_row_data *this_row;
- this_table = row_tables[parms->dir]
+ struct cfa_tcam_mgr_tcam_row_data *this_table;
+ struct cfa_tcam_mgr_tcam_row_data *this_row;
+
+ this_table = tcam_mgr_data->row_tables[parms->dir]
[cfa_tcam_mgr_get_phys_table_type(parms->type)];
- this_table += (sess_idx *
- cfa_tcam_mgr_get_max_rows(cfa_tcam_mgr_get_phys_table_type(parms->type)));
this_row = &this_table[row * max_slices + slice];
memset(&this_row->key, 0, sizeof(this_row->key));
memset(&this_row->mask, 0, sizeof(this_row->mask));
diff --git a/drivers/net/bnxt/tf_core/cfa_tcam_mgr_p58.h b/drivers/net/bnxt/tf_core/cfa_tcam_mgr_p58.h
index 7640f91911..0fa5e06898 100644
--- a/drivers/net/bnxt/tf_core/cfa_tcam_mgr_p58.h
+++ b/drivers/net/bnxt/tf_core/cfa_tcam_mgr_p58.h
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2021-2023 Broadcom
+ * Copyright(c) 2021-2024 Broadcom
* All rights reserved.
*/
@@ -7,14 +7,14 @@
#define CFA_TCAM_MGR_P58_H
#include "cfa_tcam_mgr_device.h"
-#include "cfa_tcam_mgr_sbmp.h"
int
-cfa_tcam_mgr_init_p58(int sess_idx, struct cfa_tcam_mgr_entry_data **global_entry_data);
+cfa_tcam_mgr_init_p58(struct tf *tfp);
-int
-cfa_tcam_mgr_sess_table_get_p58(int sess_idx, struct sbmp **session_bmp);
+void
+cfa_tcam_mgr_uninit_p58(struct tf *tfp);
int
cfa_tcam_mgr_hwops_get_funcs_p58(struct cfa_tcam_mgr_hwops_funcs *hwop_funcs);
+
#endif /* CFA_TCAM_MGR_P58_H */
diff --git a/drivers/net/bnxt/tf_core/cfa_tcam_mgr_session.h b/drivers/net/bnxt/tf_core/cfa_tcam_mgr_session.h
deleted file mode 100644
index 7e75776686..0000000000
--- a/drivers/net/bnxt/tf_core/cfa_tcam_mgr_session.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2023 Broadcom
- * All rights reserved.
- */
-
-#ifndef CFA_TCAM_MGR_SESSION_H
-#define CFA_TCAM_MGR_SESSION_H
-
-#include <inttypes.h>
-#include "cfa_tcam_mgr.h"
-
-int
-cfa_tcam_mgr_session_init(int sess_idx, enum cfa_tcam_mgr_device_type type);
-
-int
-cfa_tcam_mgr_get_session_from_context(struct cfa_tcam_mgr_context *context,
- uint32_t *session_id);
-
-int
-cfa_tcam_mgr_session_find(unsigned int session_id);
-
-int
-cfa_tcam_mgr_session_empty(void);
-
-int
-cfa_tcam_mgr_session_add(unsigned int session_id);
-
-int
-cfa_tcam_mgr_session_free(unsigned int session_id,
- struct cfa_tcam_mgr_context *context);
-
-int
-cfa_tcam_mgr_session_cfg(unsigned int session_id,
- uint16_t tcam_cnt[][CFA_TCAM_MGR_TBL_TYPE_MAX]);
-
-int
-cfa_tcam_mgr_session_entry_alloc(unsigned int session_id,
- enum tf_dir dir,
- enum cfa_tcam_mgr_tbl_type type);
-int
-cfa_tcam_mgr_session_entry_free(unsigned int session_id,
- unsigned int entry_id,
- enum tf_dir dir,
- enum cfa_tcam_mgr_tbl_type type);
-
-void
-cfa_tcam_mgr_sessions_dump(void);
-void
-cfa_tcam_mgr_entry_sessions_dump(int sess_idx, uint16_t id);
-void
-cfa_tcam_mgr_session_entries_dump(int sess_idx);
-
-void
-cfa_tcam_mgr_mv_session_used_entries_cnt(int sess_idx, enum tf_dir dir,
- enum cfa_tcam_mgr_tbl_type dst_type,
- enum cfa_tcam_mgr_tbl_type src_type);
-#endif /* CFA_TCAM_MGR_SESSION_H */
diff --git a/drivers/net/bnxt/tf_core/meson.build b/drivers/net/bnxt/tf_core/meson.build
index 7d38ab8793..803a89cbb5 100644
--- a/drivers/net/bnxt/tf_core/meson.build
+++ b/drivers/net/bnxt/tf_core/meson.build
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2018 Intel Corporation
-# Copyright(c) 2023 Broadcom
+# Copyright(c) 2024 Broadcom
#Include the folder for headers
includes += include_directories('.')
@@ -12,7 +12,6 @@ sources += files(
'cfa_tcam_mgr_hwop_msg.c',
'cfa_tcam_mgr_p4.c',
'cfa_tcam_mgr_p58.c',
- 'cfa_tcam_mgr_session.c',
'dpool.c',
'll.c',
'rand.c',
diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c
index 1c728aadd8..f1b3be48aa 100644
--- a/drivers/net/bnxt/tf_core/tf_core.c
+++ b/drivers/net/bnxt/tf_core/tf_core.c
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2023 Broadcom
+ * Copyright(c) 2019-2024 Broadcom
* All rights reserved.
*/
@@ -1104,7 +1104,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
#ifdef TF_FLOW_SCALE_QUERY
/* Update resource usage buffer */
if (!rc && dev->ops->tf_dev_update_tbl_usage_buffer) {
- rc = dev->ops->tf_dev_update_tbl_usage_buffer(tfs->session_id.id,
+ rc = dev->ops->tf_dev_update_tbl_usage_buffer(tfp,
parms->dir,
parms->type,
TF_RESC_ALLOC);
@@ -1200,7 +1200,7 @@ tf_free_tbl_entry(struct tf *tfp,
#ifdef TF_FLOW_SCALE_QUERY
/* Update resource usage buffer */
if (!rc && dev->ops->tf_dev_update_tbl_usage_buffer) {
- rc = dev->ops->tf_dev_update_tbl_usage_buffer(tfs->session_id.id,
+ rc = dev->ops->tf_dev_update_tbl_usage_buffer(tfp,
parms->dir,
parms->type,
TF_RESC_FREE);
diff --git a/drivers/net/bnxt/tf_core/tf_device.h b/drivers/net/bnxt/tf_core/tf_device.h
index 0b0ca8b42f..e58c53000e 100644
--- a/drivers/net/bnxt/tf_core/tf_device.h
+++ b/drivers/net/bnxt/tf_core/tf_device.h
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2023 Broadcom
+ * Copyright(c) 2019-2024 Broadcom
* All rights reserved.
*/
@@ -1187,7 +1187,7 @@ struct tf_dev_ops {
* 0 - Success
* -EINVAL - Error
*/
- int (*tf_dev_update_tbl_usage_buffer)(uint32_t session_id,
+ int (*tf_dev_update_tbl_usage_buffer)(struct tf *tfp,
enum tf_dir dir,
enum tf_tbl_type tbl_type,
uint32_t resc_opt);
diff --git a/drivers/net/bnxt/tf_core/tf_device_p58.c b/drivers/net/bnxt/tf_core/tf_device_p58.c
index 8f915744a7..fb4123eb80 100644
--- a/drivers/net/bnxt/tf_core/tf_device_p58.c
+++ b/drivers/net/bnxt/tf_core/tf_device_p58.c
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2023 Broadcom
+ * Copyright(c) 2019-2024 Broadcom
* All rights reserved.
*/
@@ -865,13 +865,13 @@ static int tf_dev_p58_query_resc_usage(struct tf *tfp,
* -EINVAL - Error
*/
static int
-tf_dev_p58_update_tbl_usage_buffer(uint32_t session_id,
+tf_dev_p58_update_tbl_usage_buffer(struct tf *tfp,
enum tf_dir dir,
enum tf_tbl_type tbl_type,
enum tf_resc_opt resc_opt)
{
int rc;
- rc = tf_tbl_usage_update(session_id, dir, tbl_type, resc_opt);
+ rc = tf_tbl_usage_update(tfp, dir, tbl_type, resc_opt);
return rc;
}
#endif /* TF_FLOW_SCALE_QUERY */
diff --git a/drivers/net/bnxt/tf_core/tf_em_hash_internal.c b/drivers/net/bnxt/tf_core/tf_em_hash_internal.c
index eacff28c5f..0212abd05d 100644
--- a/drivers/net/bnxt/tf_core/tf_em_hash_internal.c
+++ b/drivers/net/bnxt/tf_core/tf_em_hash_internal.c
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2023 Broadcom
+ * Copyright(c) 2019-2024 Broadcom
* All rights reserved.
*/
@@ -111,7 +111,7 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
#ifdef TF_FLOW_SCALE_QUERY
/* Update usage state buffer for EM */
- tf_em_usage_update(tfs->session_id.id,
+ tf_em_usage_update(tfp,
parms->dir,
num_of_entries,
TF_RESC_ALLOC);
@@ -155,7 +155,7 @@ tf_em_hash_delete_int_entry(struct tf *tfp,
#ifdef TF_FLOW_SCALE_QUERY
/* Update usage state buffer for EM */
size = DP_FLAGS_SIZE(pool->entry[parms->index - pool->start_index].flags);
- tf_em_usage_update(tfs->session_id.id,
+ tf_em_usage_update(tfp,
parms->dir,
size,
TF_RESC_FREE);
diff --git a/drivers/net/bnxt/tf_core/tf_em_internal.c b/drivers/net/bnxt/tf_core/tf_em_internal.c
index 0952f30146..cbc10b89e8 100644
--- a/drivers/net/bnxt/tf_core/tf_em_internal.c
+++ b/drivers/net/bnxt/tf_core/tf_em_internal.c
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2023 Broadcom
+ * Copyright(c) 2019-2024 Broadcom
* All rights reserved.
*/
@@ -296,7 +296,7 @@ tf_em_int_bind(struct tf *tfp,
#ifdef TF_FLOW_SCALE_QUERY
/* Initialize the usage state buffer for EM */
- tf_em_usage_init(tfs->session_id.id,
+ tf_em_usage_init(tfp,
i,
iparms.info->entry.stride);
#endif /* TF_FLOW_SCALE_QUERY */
diff --git a/drivers/net/bnxt/tf_core/tf_resources.c b/drivers/net/bnxt/tf_core/tf_resources.c
index b814dfe902..6045624652 100644
--- a/drivers/net/bnxt/tf_core/tf_resources.c
+++ b/drivers/net/bnxt/tf_core/tf_resources.c
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2023 Broadcom
+ * Copyright(c) 2019-2024 Broadcom
* All rights reserved.
*/
@@ -16,7 +16,6 @@
#include "tf_session.h"
#include "tf_device.h"
#include "cfa_tcam_mgr_device.h"
-#include "cfa_tcam_mgr_session.h"
#ifdef TF_FLOW_SCALE_QUERY
@@ -35,41 +34,32 @@ struct tf_resc_usage_buffer_control {
static struct tf_resc_usage_buffer_control resc_usage_control;
/* Check if supporting resource usage */
-static bool tf_resc_usage_support(int session_id)
+static bool tf_resc_usage_support(struct tf *tfp)
{
+ struct tf_session *tfs;
bool support = true;
- int sess_idx;
+ int rc;
/* Not valid session id */
- if (!session_id)
+ rc = tf_session_get_session_internal(tfp, &tfs);
+ if (rc)
return false;
- /* Support Generic template with one session */
- sess_idx = cfa_tcam_mgr_session_find(session_id);
- if (sess_idx < 0 && !cfa_tcam_mgr_session_empty())
- support = false;
-
/* Support Thor */
- if (resc_usage_control.device_type != TF_DEVICE_TYPE_P5)
+ if (resc_usage_control.device_type != tfs->dev.type)
support = false;
#if (TF_FLOW_SCALE_QUERY_DEBUG == 1)
- TFP_DRV_LOG(INFO, "Resc usage update sess_id: %x, idx: %d, type: %d, allow: %s\n",
- session_id,
- sess_idx,
- resc_usage_control.device_type,
- support ? "True" : "False");
+ TFP_DRV_LOG(INFO, "Resc usage update on device type: %d, allow: %s\n",
+ resc_usage_control.device_type,
+ support ? "True" : "False");
#endif /* TF_FLOW_SCALE_QUERY_DEBUG == 1 */
return support;
}
/* Reset the resource usage buffer */
-void tf_resc_usage_reset(enum tf_device_type type, int session_id)
+void tf_resc_usage_reset(struct tf *tfp __rte_unused, enum tf_device_type type)
{
- /* Check if supported on this device */
- if (cfa_tcam_mgr_session_find(session_id) > 0)
- return;
-
/* Support Thor only*/
if (type != TF_DEVICE_TYPE_P5)
return;
@@ -96,24 +86,35 @@ tf_tcam_mgr_row_entry_used(struct cfa_tcam_mgr_table_rows_0 *row,
}
/* Initialize the resource usage buffer for WC-TCAM tables */
-void tf_tcam_usage_init(int session_id)
+void tf_tcam_usage_init(struct tf *tfp)
{
- enum tf_dir dir;
enum cfa_tcam_mgr_tbl_type type = CFA_TCAM_MGR_TBL_TYPE_WC_TCAM_APPS;
struct cfa_tcam_mgr_table_data *table_data = NULL;
struct tf_resc_wc_tcam_usage *usage_data = NULL;
- int sess_idx = cfa_tcam_mgr_session_find(session_id);
+ struct cfa_tcam_mgr_data *tcam_mgr_data;
+ struct tf_session *tfs;
+ enum tf_dir dir;
+ int rc;
/* Check if supported on this device */
- if (!tf_resc_usage_support(session_id))
+ rc = tf_session_get_session_internal(tfp, &tfs);
+ if (rc)
return;
+ tcam_mgr_data = tfs->tcam_mgr_handle;
+ if (!tcam_mgr_data) {
+ TFP_DRV_LOG(ERR,
+ "%s: No TCAM data created for session\n",
+ __func__);
+ return;
+ }
+
/* Iterate over all directions */
for (dir = 0; dir < TF_DIR_MAX; dir++) {
- table_data = &cfa_tcam_mgr_tables[sess_idx][dir][type];
+ table_data = &tcam_mgr_data->cfa_tcam_mgr_tables[dir][type];
usage_data = &tf_resc_usage[dir].wc_tcam_usage;
- /* cfa_tcam_mgr_table_dump(session_id, dir, type); */
+ /* cfa_tcam_mgr_table_dump(tfs->session_id.id, dir, type); */
memset(usage_data, 0, sizeof(*usage_data));
if (table_data->start_row != table_data->end_row)
usage_data->max_row_number = table_data->end_row -
@@ -122,33 +123,49 @@ void tf_tcam_usage_init(int session_id)
#if (TF_FLOW_SCALE_QUERY_DEBUG == 1)
/* dump usage data */
- CFA_TCAM_MGR_LOG(INFO, "WC-TCAM: 1-p 1-f 2-p 2-f 4-f free-rows\n");
- CFA_TCAM_MGR_LOG(INFO, "%s %-4d %-4d %-4d %-4d %-4d %-4d\n",
- (dir == TF_DIR_RX) ? "RX" : "TX",
- usage_data->slice_row_1_p_used,
- usage_data->slice_row_1_f_used,
- usage_data->slice_row_2_p_used,
- usage_data->slice_row_2_f_used,
- usage_data->slice_row_4_used,
- usage_data->unused_row_number);
+ TFP_DRV_LOG(INFO, "WC-TCAM: 1-p 1-f 2-p 2-f 4-f free-rows\n");
+ TFP_DRV_LOG(INFO, "%s %-4d %-4d %-4d %-4d %-4d %-4d\n",
+ (dir == TF_DIR_RX) ? "RX" : "TX",
+ usage_data->slice_row_1_p_used,
+ usage_data->slice_row_1_f_used,
+ usage_data->slice_row_2_p_used,
+ usage_data->slice_row_2_f_used,
+ usage_data->slice_row_4_used,
+ usage_data->unused_row_number);
#endif
}
}
/* Update wc-tcam table resoure usage */
-int tf_tcam_usage_update(int session_id,
+int tf_tcam_usage_update(struct tf *tfp,
enum tf_dir dir,
int tcam_tbl_type,
void *data,
enum tf_resc_opt resc_opt)
{
- struct tf_resc_wc_tcam_usage *usage_data;
- int used_entries;
struct cfa_tcam_mgr_table_rows_0 *key_row = (struct cfa_tcam_mgr_table_rows_0 *)data;
+ struct tf_resc_wc_tcam_usage *usage_data;
+ struct cfa_tcam_mgr_data *tcam_mgr_data;
int key_slices = key_row->entry_size;
+ struct tf_session *tfs;
+ int used_entries;
+ int rc;
+
+ /* Check if supported on this device */
+ rc = tf_session_get_session_internal(tfp, &tfs);
+ if (rc)
+ return rc;
+
+ tcam_mgr_data = tfs->tcam_mgr_handle;
+ if (!tcam_mgr_data) {
+ TFP_DRV_LOG(ERR,
+ "%s: No TCAM data created for session\n",
+ __func__);
+ return -CFA_TCAM_MGR_ERR_CODE(PERM);
+ }
/* Check if supported on this device */
- if (!tf_resc_usage_support(session_id))
+ if (!tf_resc_usage_support(tfp))
return -1;
/* Support WC-TCAM APPs only */
@@ -184,7 +201,8 @@ int tf_tcam_usage_update(int session_id,
}
break;
default:
- CFA_TCAM_MGR_LOG(ERR, "CFA invalid size of key slices: %d\n", key_slices);
+ TFP_DRV_LOG(ERR, "CFA invalid size of key slices: %d\n",
+ key_slices);
break;
}
} else { /* free one entry */
@@ -213,32 +231,33 @@ int tf_tcam_usage_update(int session_id,
}
break;
default:
- CFA_TCAM_MGR_LOG(ERR, "CFA invalid size of key slices: %d\n", key_slices);
+ TFP_DRV_LOG(ERR, "CFA invalid size of key slices: %d\n",
+ key_slices);
break;
}
}
#if (TF_FLOW_SCALE_QUERY_DEBUG == 1)
/* dump usage data*/
- CFA_TCAM_MGR_LOG(INFO, "WC-TCAM: 1-p 1-f 2-p 2-f 4-f free-rows\n");
- CFA_TCAM_MGR_LOG(INFO, " %-4d %-4d %-4d %-4d %-4d %-4d\n",
- usage_data->slice_row_1_p_used,
- usage_data->slice_row_1_f_used,
- usage_data->slice_row_2_p_used,
- usage_data->slice_row_2_f_used,
- usage_data->slice_row_4_used,
- usage_data->unused_row_number);
+ TFP_DRV_LOG(INFO, "WC-TCAM: 1-p 1-f 2-p 2-f 4-f free-rows\n");
+ TFP_DRV_LOG(INFO, " %-4d %-4d %-4d %-4d %-4d %-4d\n",
+ usage_data->slice_row_1_p_used,
+ usage_data->slice_row_1_f_used,
+ usage_data->slice_row_2_p_used,
+ usage_data->slice_row_2_f_used,
+ usage_data->slice_row_4_used,
+ usage_data->unused_row_number);
#endif
return 0;
}
/* Initialize the EM usage table */
-void tf_em_usage_init(uint32_t session_id, enum tf_dir dir, uint16_t max_entries)
+void tf_em_usage_init(struct tf *tfp, enum tf_dir dir, uint16_t max_entries)
{
struct tf_resc_em_usage *em;
/* Check if supported on this device */
- if (!tf_resc_usage_support(session_id))
+ if (!tf_resc_usage_support(tfp))
return;
em = &tf_resc_usage[dir].em_int_usage;
@@ -247,7 +266,7 @@ void tf_em_usage_init(uint32_t session_id, enum tf_dir dir, uint16_t max_entries
}
/* Update the EM usage table */
-int tf_em_usage_update(uint32_t session_id,
+int tf_em_usage_update(struct tf *tfp,
enum tf_dir dir,
uint16_t size,
enum tf_resc_opt resc_opt)
@@ -255,15 +274,15 @@ int tf_em_usage_update(uint32_t session_id,
struct tf_resc_em_usage *em;
#if (TF_FLOW_SCALE_QUERY_DEBUG == 1)
- CFA_TCAM_MGR_LOG(INFO, "%s: %s: EM record size: %d, %s\n",
- __func__,
- dir ? "TX" : "RX",
- size,
- resc_opt == TF_RESC_ALLOC ? "Alloc" : "Free");
+ TFP_DRV_LOG(INFO, "%s: %s: EM record size: %d, %s\n",
+ __func__,
+ dir ? "TX" : "RX",
+ size,
+ resc_opt == TF_RESC_ALLOC ? "Alloc" : "Free");
#endif /* TF_FLOW_SCALE_QUERY_DEBUG == 1 */
/* Check if supported on this device */
- if (!tf_resc_usage_support(session_id))
+ if (!tf_resc_usage_support(tfp))
return -1;
/* not valid size */
@@ -283,7 +302,7 @@ int tf_em_usage_update(uint32_t session_id,
}
/* Initialize the usage buffer for all kinds of sram tables */
-void tf_tbl_usage_init(uint32_t session_id,
+void tf_tbl_usage_init(struct tf *tfp,
enum tf_dir dir,
uint32_t tbl_type,
uint16_t max_entries)
@@ -291,17 +310,17 @@ void tf_tbl_usage_init(uint32_t session_id,
struct tf_rm_element_cfg *tbl_cfg = tf_tbl_p58[dir];
#if (TF_FLOW_SCALE_QUERY_DEBUG == 1)
- CFA_TCAM_MGR_LOG(INFO, "%s: %s: tbl_type: %d[%s], max entries: [%d]:[0x%x]\n",
- __func__,
- dir ? "TX" : "RX",
- tbl_type,
- tf_tbl_type_2_str(tbl_type),
- max_entries,
- max_entries);
+ TFP_DRV_LOG(INFO, "%s: %s: tbl_type: %d[%s], max entries: [%d]:[0x%x]\n",
+ __func__,
+ dir ? "TX" : "RX",
+ tbl_type,
+ tf_tbl_type_2_str(tbl_type),
+ max_entries,
+ max_entries);
#endif /* TF_FLOW_SCALE_QUERY_DEBUG == 1 */
/* Check if supported on this device */
- if (!tf_resc_usage_support(session_id))
+ if (!tf_resc_usage_support(tfp))
return;
/* Convert to entries */
@@ -372,7 +391,7 @@ void tf_tbl_usage_init(uint32_t session_id,
}
/* Update the usage buffer for sram tables: add or free one entry */
-int tf_tbl_usage_update(uint32_t session_id,
+int tf_tbl_usage_update(struct tf *tfp,
enum tf_dir dir,
uint32_t tbl_type,
enum tf_resc_opt resc_opt)
@@ -384,7 +403,7 @@ int tf_tbl_usage_update(uint32_t session_id,
int entries = 0;
/* Check if supported on this device */
- if (!tf_resc_usage_support(session_id))
+ if (!tf_resc_usage_support(tfp))
return -1;
/* Convert to entries */
@@ -393,11 +412,11 @@ int tf_tbl_usage_update(uint32_t session_id,
#if (TF_FLOW_SCALE_QUERY_DEBUG == 1)
TFP_DRV_LOG(INFO, "%s: %s: tbl_type: %d[%s] %s, Entries: %d\n", __func__,
- dir ? "TX" : "RX",
- tbl_type,
- tf_tbl_type_2_str(tbl_type),
- resc_opt ? "Alloc" : "Free",
- entries);
+ dir ? "TX" : "RX",
+ tbl_type,
+ tf_tbl_type_2_str(tbl_type),
+ resc_opt ? "Alloc" : "Free",
+ entries);
#endif /* TF_FLOW_SCALE_QUERY_DEBUG == 1 */
resc_usage_control.buffer_dirty[dir] = 1;
@@ -521,7 +540,7 @@ void tf_resc_usage_update_all(struct bnxt *bp)
}
/* Check if supported on this device */
- if (!tf_resc_usage_support(tfp->session->session_id.id))
+ if (!tf_resc_usage_support(tfp))
return;
/* update usage state with firmware for each direction */
diff --git a/drivers/net/bnxt/tf_core/tf_resources.h b/drivers/net/bnxt/tf_core/tf_resources.h
index 715c9e0d94..e77e882b70 100644
--- a/drivers/net/bnxt/tf_core/tf_resources.h
+++ b/drivers/net/bnxt/tf_core/tf_resources.h
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2023 Broadcom
+ * Copyright(c) 2019-2024 Broadcom
* All rights reserved.
*/
@@ -97,29 +97,29 @@ typedef struct cfa_tf_resc_usage {
/* global data stored in firmware memory and TruFlow driver */
extern cfa_tf_resc_usage_t tf_resc_usage[TF_DIR_MAX];
-void tf_resc_usage_reset(enum tf_device_type type, int session_id);
+void tf_resc_usage_reset(struct tf *tfp, enum tf_device_type type);
-void tf_tcam_usage_init(int session_id);
+void tf_tcam_usage_init(struct tf *tfp);
-int tf_tcam_usage_update(int session_id,
+int tf_tcam_usage_update(struct tf *tfp,
enum tf_dir dir,
int tcam_tbl_type,
void *key_row,
enum tf_resc_opt resc_opt);
-void tf_em_usage_init(uint32_t session_id, enum tf_dir dir, uint16_t max_entries);
+void tf_em_usage_init(struct tf *tfp, enum tf_dir dir, uint16_t max_entries);
-int tf_em_usage_update(uint32_t session_id,
+int tf_em_usage_update(struct tf *tfp,
enum tf_dir dir,
uint16_t size,
enum tf_resc_opt resc_opt);
-void tf_tbl_usage_init(uint32_t session_id,
+void tf_tbl_usage_init(struct tf *tfp,
enum tf_dir dir,
uint32_t tbl_type,
uint16_t max_entries);
-int tf_tbl_usage_update(uint32_t session_id,
+int tf_tbl_usage_update(struct tf *tfp,
enum tf_dir dir,
uint32_t tbl_type,
enum tf_resc_opt resc_opt);
diff --git a/drivers/net/bnxt/tf_core/tf_rm.c b/drivers/net/bnxt/tf_core/tf_rm.c
index e38bfcf4f6..e9a2fbd851 100644
--- a/drivers/net/bnxt/tf_core/tf_rm.c
+++ b/drivers/net/bnxt/tf_core/tf_rm.c
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2023 Broadcom
+ * Copyright(c) 2019-2024 Broadcom
* All rights reserved.
*/
@@ -428,7 +428,7 @@ tf_rm_update_parent_reservations(struct tf *tfp,
req_cnt[child] = 0;
#ifdef TF_FLOW_SCALE_QUERY
/* Initialize the usage buffer for SRAM tables */
- tf_tbl_usage_init(tfp->session->session_id.id,
+ tf_tbl_usage_init(tfp,
dir,
child,
alloc_cnt[child]);
@@ -698,7 +698,7 @@ tf_rm_create_db(struct tf *tfp,
tbl_type = TF_TBL_TYPE_METER_INST;
else
tbl_type = TF_TBL_TYPE_METER_PROF;
- tf_tbl_usage_init(tfp->session->session_id.id,
+ tf_tbl_usage_init(tfp,
parms->dir,
tbl_type,
req_cnt[i]);
diff --git a/drivers/net/bnxt/tf_core/tf_session.c b/drivers/net/bnxt/tf_core/tf_session.c
index 7545974c93..1c14378d11 100644
--- a/drivers/net/bnxt/tf_core/tf_session.c
+++ b/drivers/net/bnxt/tf_core/tf_session.c
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2023 Broadcom
+ * Copyright(c) 2019-2024 Broadcom
* All rights reserved.
*/
@@ -199,7 +199,7 @@ tf_session_create(struct tf *tfp,
#ifdef TF_FLOW_SCALE_QUERY
/* Reset the resource usage buffer before binding a device */
- tf_resc_usage_reset(parms->open_cfg->device_type, tfp->session->session_id.id);
+ tf_resc_usage_reset(tfp, parms->open_cfg->device_type);
#endif /* TF_FLOW_SCALE_QUERY */
rc = tf_dev_bind(tfp,
diff --git a/drivers/net/bnxt/tf_core/tf_session.h b/drivers/net/bnxt/tf_core/tf_session.h
index 9bbbccf125..d46d89e9e9 100644
--- a/drivers/net/bnxt/tf_core/tf_session.h
+++ b/drivers/net/bnxt/tf_core/tf_session.h
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2023 Broadcom
+ * Copyright(c) 2019-2024 Broadcom
* All rights reserved.
*/
@@ -179,6 +179,10 @@ struct tf_session {
*/
int tcam_mgr_control[TF_DIR_MAX][TF_TCAM_TBL_TYPE_MAX];
+ /**
+ * TCAM Manager handle pointing to session based tcam memory
+ */
+ void *tcam_mgr_handle;
};
/**
diff --git a/drivers/net/bnxt/tf_core/tf_tcam.c b/drivers/net/bnxt/tf_core/tf_tcam.c
index df5cad75b5..fa8f60777d 100644
--- a/drivers/net/bnxt/tf_core/tf_tcam.c
+++ b/drivers/net/bnxt/tf_core/tf_tcam.c
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2019-2023 Broadcom
+ * Copyright(c) 2019-2024 Broadcom
* All rights reserved.
*/
@@ -27,7 +27,7 @@ tf_tcam_bind(struct tf *tfp,
int d, t;
struct tf_rm_alloc_info info;
struct tf_rm_free_db_parms fparms;
- struct tf_rm_create_db_parms db_cfg;
+ struct tf_rm_create_db_parms db_cfg = { 0 };
struct tf_tcam_resources local_tcam_cnt[TF_DIR_MAX];
struct tf_tcam_resources *tcam_cnt;
struct tf_rm_get_alloc_info_parms ainfo;
diff --git a/drivers/net/bnxt/tf_core/tf_tcam_mgr_msg.c b/drivers/net/bnxt/tf_core/tf_tcam_mgr_msg.c
index c535f4f4f6..8c1e6d2e0f 100644
--- a/drivers/net/bnxt/tf_core/tf_tcam_mgr_msg.c
+++ b/drivers/net/bnxt/tf_core/tf_tcam_mgr_msg.c
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2021-2023 Broadcom
+ * Copyright(c) 2021-2024 Broadcom
* All rights reserved.
*/
@@ -8,6 +8,7 @@
#include "tfp.h"
#include "tf_tcam.h"
#include "cfa_tcam_mgr.h"
+#include "cfa_tcam_mgr_device.h"
#include "tf_tcam_mgr_msg.h"
/*
@@ -53,13 +54,11 @@ tf_tcam_mgr_qcaps_msg(struct tf *tfp,
uint32_t *rx_tcam_supported,
uint32_t *tx_tcam_supported)
{
- struct cfa_tcam_mgr_context context;
struct cfa_tcam_mgr_qcaps_parms mgr_parms;
int rc;
- context.tfp = tfp;
memset(&mgr_parms, 0, sizeof(mgr_parms));
- rc = cfa_tcam_mgr_qcaps(&context, &mgr_parms);
+ rc = cfa_tcam_mgr_qcaps(tfp, &mgr_parms);
if (rc >= 0) {
*rx_tcam_supported = mgr_parms.rx_tcam_supported;
*tx_tcam_supported = mgr_parms.tx_tcam_supported;
@@ -75,7 +74,10 @@ tf_tcam_mgr_bind_msg(struct tf *tfp,
__rte_unused
)
{
- /* Common Code */
+ struct tf_rm_resc_entry
+ mgr_resv_res[TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX];
+ struct cfa_tcam_mgr_cfg_parms mgr_parms;
+ int dir, rc;
int type;
if (parms->num_elements != TF_TCAM_TBL_TYPE_MAX) {
@@ -91,14 +93,6 @@ tf_tcam_mgr_bind_msg(struct tf *tfp,
for (type = 0; type < TF_TCAM_TBL_TYPE_MAX; type++)
hcapi_type[type] = parms->cfg[type].hcapi_type;
- struct cfa_tcam_mgr_context context;
- struct cfa_tcam_mgr_cfg_parms mgr_parms;
- struct tf_rm_resc_entry
- mgr_resv_res[TF_DIR_MAX][CFA_TCAM_MGR_TBL_TYPE_MAX];
- int dir, rc;
-
- context.tfp = tfp;
-
memset(&mgr_parms, 0, sizeof(mgr_parms));
mgr_parms.num_elements = CFA_TCAM_MGR_TBL_TYPE_MAX;
@@ -116,7 +110,7 @@ tf_tcam_mgr_bind_msg(struct tf *tfp,
}
mgr_parms.resv_res = mgr_resv_res;
- rc = cfa_tcam_mgr_bind(&context, &mgr_parms);
+ rc = cfa_tcam_mgr_bind(tfp, &mgr_parms);
return rc;
}
@@ -125,11 +119,7 @@ int
tf_tcam_mgr_unbind_msg(struct tf *tfp,
struct tf_dev_info *dev __rte_unused)
{
- struct cfa_tcam_mgr_context context;
-
- context.tfp = tfp;
-
- return cfa_tcam_mgr_unbind(&context);
+ return cfa_tcam_mgr_unbind(tfp);
}
int
@@ -137,7 +127,6 @@ tf_tcam_mgr_alloc_msg(struct tf *tfp,
struct tf_dev_info *dev __rte_unused,
struct tf_tcam_alloc_parms *parms)
{
- struct cfa_tcam_mgr_context context;
struct cfa_tcam_mgr_alloc_parms mgr_parms;
int rc;
@@ -148,8 +137,6 @@ tf_tcam_mgr_alloc_msg(struct tf *tfp,
return -EINVAL;
}
- context.tfp = tfp;
-
mgr_parms.dir = parms->dir;
mgr_parms.type = tcam_types[parms->type];
mgr_parms.hcapi_type = hcapi_type[parms->type];
@@ -159,7 +146,7 @@ tf_tcam_mgr_alloc_msg(struct tf *tfp,
else
mgr_parms.priority = TF_TCAM_PRIORITY_MAX - parms->priority - 1;
- rc = cfa_tcam_mgr_alloc(&context, &mgr_parms);
+ rc = cfa_tcam_mgr_alloc(tfp, &mgr_parms);
if (rc)
return rc;
@@ -172,7 +159,6 @@ tf_tcam_mgr_free_msg(struct tf *tfp,
struct tf_dev_info *dev __rte_unused,
struct tf_tcam_free_parms *parms)
{
- struct cfa_tcam_mgr_context context;
struct cfa_tcam_mgr_free_parms mgr_parms;
if (parms->type >= TF_TCAM_TBL_TYPE_MAX) {
@@ -182,13 +168,12 @@ tf_tcam_mgr_free_msg(struct tf *tfp,
return -EINVAL;
}
- context.tfp = tfp;
mgr_parms.dir = parms->dir;
mgr_parms.type = tcam_types[parms->type];
mgr_parms.hcapi_type = hcapi_type[parms->type];
mgr_parms.id = parms->idx;
- return cfa_tcam_mgr_free(&context, &mgr_parms);
+ return cfa_tcam_mgr_free(tfp, &mgr_parms);
}
int
@@ -196,7 +181,6 @@ tf_tcam_mgr_set_msg(struct tf *tfp,
struct tf_dev_info *dev __rte_unused,
struct tf_tcam_set_parms *parms)
{
- struct cfa_tcam_mgr_context context;
struct cfa_tcam_mgr_set_parms mgr_parms;
if (parms->type >= TF_TCAM_TBL_TYPE_MAX) {
@@ -206,7 +190,6 @@ tf_tcam_mgr_set_msg(struct tf *tfp,
return -EINVAL;
}
- context.tfp = tfp;
mgr_parms.dir = parms->dir;
mgr_parms.type = tcam_types[parms->type];
mgr_parms.hcapi_type = hcapi_type[parms->type];
@@ -217,7 +200,7 @@ tf_tcam_mgr_set_msg(struct tf *tfp,
mgr_parms.result = parms->result;
mgr_parms.result_size = parms->result_size;
- return cfa_tcam_mgr_set(&context, &mgr_parms);
+ return cfa_tcam_mgr_set(tfp, &mgr_parms);
}
int
@@ -225,9 +208,8 @@ tf_tcam_mgr_get_msg(struct tf *tfp,
struct tf_dev_info *dev __rte_unused,
struct tf_tcam_get_parms *parms)
{
- int rc;
- struct cfa_tcam_mgr_context context;
struct cfa_tcam_mgr_get_parms mgr_parms;
+ int rc;
if (parms->type >= TF_TCAM_TBL_TYPE_MAX) {
TFP_DRV_LOG(ERR,
@@ -236,7 +218,6 @@ tf_tcam_mgr_get_msg(struct tf *tfp,
return -EINVAL;
}
- context.tfp = tfp;
mgr_parms.dir = parms->dir;
mgr_parms.type = tcam_types[parms->type];
mgr_parms.hcapi_type = hcapi_type[parms->type];
@@ -247,7 +228,7 @@ tf_tcam_mgr_get_msg(struct tf *tfp,
mgr_parms.result = parms->result;
mgr_parms.result_size = parms->result_size;
- rc = cfa_tcam_mgr_get(&context, &mgr_parms);
+ rc = cfa_tcam_mgr_get(tfp, &mgr_parms);
if (rc)
return rc;
@@ -261,26 +242,22 @@ int
tf_tcam_mgr_shared_clear_msg(struct tf *tfp,
struct tf_clear_tcam_shared_entries_parms *parms)
{
- struct cfa_tcam_mgr_context context;
struct cfa_tcam_mgr_shared_clear_parms mgr_parms;
- context.tfp = tfp;
mgr_parms.dir = parms->dir;
mgr_parms.type = tcam_types[parms->tcam_tbl_type];
- return cfa_tcam_mgr_shared_clear(&context, &mgr_parms);
+ return cfa_tcam_mgr_shared_clear(tfp, &mgr_parms);
}
int
tf_tcam_mgr_shared_move_msg(struct tf *tfp,
struct tf_move_tcam_shared_entries_parms *parms)
{
- struct cfa_tcam_mgr_context context;
struct cfa_tcam_mgr_shared_move_parms mgr_parms;
- context.tfp = tfp;
mgr_parms.dir = parms->dir;
mgr_parms.type = tcam_types[parms->tcam_tbl_type];
- return cfa_tcam_mgr_shared_move(&context, &mgr_parms);
+ return cfa_tcam_mgr_shared_move(tfp, &mgr_parms);
}
--
2.39.3
next prev parent reply other threads:[~2024-11-07 13:43 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 13:52 [PATCH v8 00/47] TruFlow update for Thor2 Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 01/47] net/bnxt: tf_core: fix wc tcam multi slice delete issue Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 02/47] net/bnxt: tf_core: tcam manager data corruption Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 03/47] net/bnxt: tf_core: External EM support cleanup Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 04/47] net/bnxt: tf_core: Thor TF EM key size check Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 05/47] net/bnxt: tf_core: flow scale improvement Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 06/47] net/bnxt: tf_core: TF support flow scale query Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 07/47] net/bnxt: tf_core: fix slice count in case of HA entry move Sriharsha Basavapatna
2024-11-07 13:52 ` Sriharsha Basavapatna [this message]
2024-11-07 13:52 ` [PATCH v8 09/47] net/bnxt: tf_core: remove dead AFM code from session-based priority TCAM mgr Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 10/47] net/bnxt: tf_core: remove dead " Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 11/47] net/bnxt: tfc: support tf-core for Thor2 Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 12/47] net/bnxt: tf_ulp: add vxlan-gpe base support Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 13/47] net/bnxt: tf_ulp: add custom l2 etype tunnel support Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 14/47] net/bnxt: tf_ulp: add support for vf to vf flow offload Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 15/47] net/bnxt: tf_ulp: Wh+ mirroring support Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 16/47] net/bnxt: tf_ulp: miscellaneous fixes Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 17/47] net/bnxt: tf_ulp: support for Thor2 ulp layer Sriharsha Basavapatna
2024-12-10 13:32 ` David Marchand
2024-11-07 13:52 ` [PATCH v8 18/47] net/bnxt: tf_ulp: add support for overlapping flows Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 19/47] net/bnxt: tf_ulp: convert recipe table to dynamic memory Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 20/47] net/bnxt: tf_ulp: add feature bit support Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 21/47] net/bnxt: tf_ulp: add action read and clear support Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 22/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 23/47] net/bnxt: tf_ulp: VFR updates for Thor 2 Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 24/47] net/bnxt: tf_ulp: add support for tunnel flow stats Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 25/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 26/47] net/bnxt: tf_ulp: enable recipe id generation Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 27/47] net/bnxt: tf_ulp: fixed parent child db counters Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 28/47] net/bnxt: tf_ulp: modify return values to adhere to C coding standard Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 29/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 30/47] net/bnxt: tf_ulp: add mask defaults when mask is not specified Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 31/47] net/bnxt: tf_ulp: add jump action support Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 32/47] net/bnxt: tf_ulp: add support for flow priority Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 33/47] net/bnxt: tf_ulp: support for dynamic tunnel ports Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 34/47] net/bnxt: tf_ulp: add rte_mtr support for Thor2 Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 35/47] net/bnxt: tf_ulp: TF support flow scale query Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 36/47] net/bnxt: tf_ulp: add support for rss flow query to ULP Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 37/47] net/bnxt: tf_ulp: add track type feature to tables Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 38/47] net/bnxt: tf_ulp: inline utility functions and use likely/unlikely Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 39/47] net/bnxt: tf_ulp: switch ulp to use rte crc32 hash Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 40/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 41/47] net/bnxt: tf_ulp: support a few generic template items Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 42/47] net/bnxt: tf_ulp: TFC support flow scale query for Thor2 Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 43/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 44/47] net/bnxt: tf_ulp: enable support for truflow feature configuration Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 45/47] net/bnxt: tf_ulp: support a few feature extensions Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 46/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-11-07 13:52 ` [PATCH v8 47/47] net/bnxt: tf_ulp: add stats cache for thor2 Sriharsha Basavapatna
2024-11-08 2:05 ` [PATCH v8 00/47] TruFlow update for Thor2 Sriharsha Basavapatna
2024-11-08 2:14 ` Ajit Khaparde
2024-11-12 11:00 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241107135254.1611676-9-sriharsha.basavapatna@broadcom.com \
--to=sriharsha.basavapatna@broadcom.com \
--cc=ajit.khaparde@broadcom.com \
--cc=dev@dpdk.org \
--cc=farah.smith@broadcom.com \
--cc=sbhosle@broadcom.com \
--cc=shuanglin.wang@broadcom.com \
--cc=stuart.schacher@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).