&slot,
&device);
if (rc != 4) {
- TFP_DRV_LOG(ERR,
+ /* PCI Domain not provided (optional in DPDK), thus we
+ * force domain to 0 and recheck.
+ */
+ domain = 0;
+
+ /* Check parsing of bus/slot/device */
+ rc = sscanf(parms->ctrl_chan_name,
+ "%x:%x.%d",
+ &bus,
+ &slot,
+ &device);
+ if (rc != 3) {
+ TFP_DRV_LOG(ERR,
"Failed to scan device ctrl_chan_name\n");
- return -EINVAL;
+ return -EINVAL;
+ }
}
parms->session_id.internal.domain = domain;
#include "tf_core.h"
#include "tf_session.h"
+#ifdef TF_USE_SYSTEM_MEM
+/**
+ * Select EEM sysmem mmap export to be done at init
+ * or on the first write to EEM.
+ */
+#define TF_EM_SYSMEM_DELAY_EXPORT 1
+#else
+#define TF_EM_SYSMEM_DELAY_EXPORT 0
+#endif
+
#define SUPPORT_CFA_HW_P4 1
#define SUPPORT_CFA_HW_P58 0
#define SUPPORT_CFA_HW_P59 0
tf_em_ext_system_bind(struct tf *tfp,
struct tf_em_cfg_parms *parms);
+int offload_system_mmap(struct tf_tbl_scope_cb *tbl_scope_cb);
#endif /* _TF_EM_H_ */
uint64_t big_hash;
int rc;
+#if (TF_EM_SYSMEM_DELAY_EXPORT == 1)
+ if (!tbl_scope_cb->valid) {
+ rc = offload_system_mmap(tbl_scope_cb);
+
+ if (rc) {
+ struct tf_rm_free_parms fparms = { 0 };
+
+ TFP_DRV_LOG(ERR,
+ "System alloc mmap failed\n");
+ /* Free Table control block */
+ fparms.rm_db = eem_db[TF_DIR_RX];
+ fparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;
+ fparms.index = parms->tbl_scope_id;
+ tf_rm_free(&fparms);
+ return -EINVAL;
+ }
+
+ tbl_scope_cb->valid = true;
+ }
+#endif
/* Get mask to use on hash */
mask = tf_em_get_key_mask(tbl_scope_cb->em_ctx_info[parms->dir].em_tables[TF_KEY0_TABLE].num_entries);
return -EINVAL;
}
+#if (TF_EM_SYSMEM_DELAY_EXPORT == 1)
+ if (!tbl_scope_cb->valid) {
+ rc = offload_system_mmap(tbl_scope_cb);
+
+ if (rc) {
+ struct tf_rm_free_parms fparms = { 0 };
+
+ TFP_DRV_LOG(ERR,
+ "System alloc mmap failed\n");
+ /* Free Table control block */
+ fparms.rm_db = eem_db[TF_DIR_RX];
+ fparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;
+ fparms.index = parms->tbl_scope_id;
+ tf_rm_free(&fparms);
+ return -EINVAL;
+ }
+
+ tbl_scope_cb->valid = true;
+ }
+#endif
+
op.opcode = HCAPI_CFA_HWOPS_PUT;
key_tbl.base0 =
(uint8_t *)&tbl_scope_cb->em_ctx_info[parms->dir].em_tables[TF_RECORD_TABLE];
return -1;
PMD_DRV_LOG
- (ERR,
+ (DEBUG,
"%s, Internal entry @ Index:%d rptr_index:0x%x rptr_entry:0x%x num_of_entries:%d\n",
tf_dir_2_str(parms->dir),
index,
return 0;
}
-static int
-offload_system_mmap(struct tf_tbl_scope_cb *tbl_scope_cb)
+int offload_system_mmap(struct tf_tbl_scope_cb *tbl_scope_cb)
{
int rc;
int dmabuf_fd;
}
}
+#if (TF_EM_SYSMEM_DELAY_EXPORT == 0)
rc = offload_system_mmap(tbl_scope_cb);
if (rc) {
"System alloc mmap failed\n");
goto cleanup_full;
}
+#endif
return rc;
}
tf_dmabuf_free(tfp, tbl_scope_cb);
+ tbl_scope_cb->valid = false;
return rc;
}