struct tf_ident_cfg_parms *parms)
{
int rc;
+ int db_rc[TF_DIR_MAX] = { 0 };
int i;
struct tf_rm_create_db_parms db_cfg = { 0 };
struct tf_shadow_ident_cfg_parms shadow_cfg = { 0 };
db_cfg.alloc_cnt = parms->resources->ident_cnt[i].cnt;
if (tf_session_is_shared_session(tfs) &&
(!tf_session_is_shared_session_creator(tfs)))
- rc = tf_rm_create_db_no_reservation(tfp, &db_cfg);
+ db_rc[i] = tf_rm_create_db_no_reservation(tfp, &db_cfg);
else
- rc = tf_rm_create_db(tfp, &db_cfg);
- if (rc) {
- TFP_DRV_LOG(ERR,
- "%s: Identifier DB creation failed\n",
- tf_dir_2_str(i));
-
- return rc;
- }
+ db_rc[i] = tf_rm_create_db(tfp, &db_cfg);
if (parms->shadow_copy) {
shadow_cfg.alloc_cnt =
}
}
+ /* No db created */
+ if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX]) {
+ TFP_DRV_LOG(ERR, "No Identifier DB created\n");
+ return db_rc[TF_DIR_RX];
+ }
+
TFP_DRV_LOG(INFO,
"Identifier - initialized\n");
TF_CHECK_PARMS1(tfp);
rc = tf_session_get_db(tfp, TF_MODULE_TYPE_IDENTIFIER, &ident_db_ptr);
- if (rc) {
- TFP_DRV_LOG(ERR,
- "Failed to get ident_db from session, rc:%s\n",
- strerror(-rc));
- return rc;
- }
+ if (rc)
+ return 0;
ident_db = (struct ident_rm_db *)ident_db_ptr;
for (i = 0; i < TF_DIR_MAX; i++) {
+ if (ident_db->ident_db[i] == NULL)
+ continue;
fparms.rm_db = ident_db->ident_db[i];
fparms.dir = i;
rc = tf_rm_free_db(tfp, &fparms);
TF_CHECK_PARMS2(tfp, ident);
rc = tf_session_get_db(tfp, TF_MODULE_TYPE_IDENTIFIER, &ident_db_ptr);
- if (rc) {
- TFP_DRV_LOG(ERR,
- "Failed to get ident_db from session, rc:%s\n",
- strerror(-rc));
- return rc;
- }
+ if (rc == -ENOMEM)
+ return 0; /* db doesn't exist */
+ else if (rc)
+ return rc; /* error getting db */
+
ident_db = (struct ident_rm_db *)ident_db_ptr;
/* check if reserved resource for WC is multiple of num_slices */
for (d = 0; d < TF_DIR_MAX; d++) {
ainfo.rm_db = ident_db->ident_db[d];
+
+ if (!ainfo.rm_db)
+ continue;
+
dinfo = ident[d].info;
ainfo.info = (struct tf_rm_alloc_info *)dinfo;