net/bnxt: add resource manager

- Add TruFlow RM functionality for resource handling
- Update the TruFlow Resource Manager (RM) with resource
  support functions for debugging as well as resource cleanup.
- Add support for Internal and external pools.

Signed-off-by: Michael Wildt <michael.wildt@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
This commit is contained in:
Michael Wildt 2020-04-15 13:48:45 +05:30 committed by Ferruh Yigit
parent f8b6392ad7
commit 4943fad64c
5 changed files with 1661 additions and 2 deletions

View File

@ -149,6 +149,20 @@ tf_open_session(struct tf *tfp,
goto cleanup_close;
}
/* Shadow DB configuration */
if (parms->shadow_copy) {
/* Ignore shadow_copy setting */
session->shadow_copy = 0;/* parms->shadow_copy; */
#if (TF_SHADOW == 1)
rc = tf_rm_shadow_db_init(tfs);
if (rc)
PMD_DRV_LOG(ERR,
"Shadow DB Initialization failed\n, rc:%d",
rc);
/* Add additional processing */
#endif /* TF_SHADOW */
}
/* Adjust the Session with what firmware allowed us to get */
rc = tf_rm_allocate_validate(tfp);
if (rc) {

View File

@ -30,6 +30,32 @@ enum tf_dir {
TF_DIR_MAX
};
/**
* External pool size
*
* Defines a single pool of external action records of
* fixed size. Currently, this is an index.
*/
#define TF_EXT_POOL_ENTRY_SZ_BYTES 1
/**
* External pool entry count
*
* Defines the number of entries in the external action pool
*/
#define TF_EXT_POOL_ENTRY_CNT (1 * 1024)
/**
* Number of external pools
*/
#define TF_EXT_POOL_CNT_MAX 1
/**
* External pool Id
*/
#define TF_EXT_POOL_0 0 /**< matches TF_TBL_TYPE_EXT */
#define TF_EXT_POOL_1 1 /**< matches TF_TBL_TYPE_EXT_0 */
/********** BEGIN API FUNCTION PROTOTYPES/PARAMETERS **********/
/**

File diff suppressed because it is too large Load Diff

View File

@ -12,6 +12,7 @@
#include "bitalloc.h"
#include "tf_core.h"
#include "tf_rm.h"
#include "tf_tbl.h"
/** Session defines
*/
@ -285,6 +286,15 @@ struct tf_session {
/** Lookup3 init values */
uint32_t lkup_lkup3_init_cfg[TF_DIR_MAX];
/** Table scope array */
struct tf_tbl_scope_cb tbl_scopes[TF_NUM_TBL_SCOPE];
/** Each external pool is associated with a single table scope
* For each external pool store the associated table scope in
* this data structure
*/
uint32_t ext_pool_2_scope[TF_DIR_MAX][TF_EXT_POOL_CNT_MAX];
};
#endif /* _TF_SESSION_H_ */

View File

@ -0,0 +1,43 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2019-2020 Broadcom
* All rights reserved.
*/
#ifndef _TF_TBL_H_
#define _TF_TBL_H_
#include <stdint.h>
enum tf_pg_tbl_lvl {
PT_LVL_0,
PT_LVL_1,
PT_LVL_2,
PT_LVL_MAX
};
/** Invalid table scope id */
#define TF_TBL_SCOPE_INVALID 0xffffffff
/**
* Table Scope Control Block
*
* Holds private data for a table scope. Only one instance of a table
* scope with Internal EM is supported.
*/
struct tf_tbl_scope_cb {
uint32_t tbl_scope_id;
int index;
uint32_t *ext_pool_mem[TF_DIR_MAX][TF_EXT_POOL_CNT_MAX];
};
/**
* Initialize table pool structure to indicate
* no table scope has been associated with the
* external pool of indexes.
*
* [in] session
*/
void
tf_init_tbl_pool(struct tf_session *session);
#endif /* _TF_TBL_H_ */