/**
* EM Pool
*/
-#if (TF_EM_ALLOC == 1)
#include "dpool.h"
-#endif
/**
* Insert EM internal entry API
uint16_t rptr_index = 0;
uint8_t rptr_entry = 0;
uint8_t num_of_entries = 0;
-#if (TF_EM_ALLOC == 1)
struct dpool *pool;
-#else
- struct stack *pool;
-#endif
uint32_t index;
uint32_t key0_hash;
uint32_t key1_hash;
rc = tf_session_get_device(tfs, &dev);
if (rc)
return rc;
-#if (TF_EM_ALLOC == 1)
pool = (struct dpool *)tfs->em_pool[parms->dir];
index = dpool_alloc(pool,
parms->em_record_sz_in_bits / 128,
tf_dir_2_str(parms->dir));
return -1;
}
-#else
- pool = (struct stack *)tfs->em_pool[parms->dir];
- rc = stack_pop(pool, &index);
- if (rc) {
- PMD_DRV_LOG(ERR,
- "%s, EM entry index allocation failed\n",
- tf_dir_2_str(parms->dir));
- return rc;
- }
-#endif
if (dev->ops->tf_dev_cfa_key_hash == NULL)
return -EINVAL;
&num_of_entries);
if (rc) {
/* Free the allocated index before returning */
-#if (TF_EM_ALLOC == 1)
dpool_free(pool, index);
-#else
- stack_push(pool, index);
-#endif
return -1;
}
rptr_index,
rptr_entry,
0);
-#if (TF_EM_ALLOC == 1)
dpool_set_entry_data(pool, index, parms->flow_handle);
-#endif
return 0;
}
{
int rc = 0;
struct tf_session *tfs;
-#if (TF_EM_ALLOC == 1)
struct dpool *pool;
-#else
- struct stack *pool;
-#endif
/* Retrieve the session information */
rc = tf_session_get_session(tfp, &tfs);
if (rc) {
/* Return resource to pool */
if (rc == 0) {
-#if (TF_EM_ALLOC == 1)
pool = (struct dpool *)tfs->em_pool[parms->dir];
dpool_free(pool, parms->index);
-#else
- pool = (struct stack *)tfs->em_pool[parms->dir];
- stack_push(pool, parms->index);
-#endif
}
return rc;
}
-#if (TF_EM_ALLOC == 1)
/** Move EM internal entry API
*
* returns:
return rc;
}
-#endif