#include "tf_device.h"
#include "tf_device_p4.h"
#include "tfp.h"
+#include "tf_em.h"
struct tf;
struct tf_ident_cfg_parms ident_cfg;
struct tf_tbl_cfg_parms tbl_cfg;
struct tf_tcam_cfg_parms tcam_cfg;
+ struct tf_em_cfg_parms em_cfg;
+ struct tf_if_tbl_cfg_parms if_tbl_cfg;
+ struct tf_global_cfg_cfg_parms global_cfg;
- dev_handle->type = TF_DEVICE_TYPE_WH;
- /* Initial function initialization */
- dev_handle->ops = &tf_dev_ops_p4_init;
-
- dev_handle->type = TF_DEVICE_TYPE_WH;
/* Initial function initialization */
dev_handle->ops = &tf_dev_ops_p4_init;
goto fail;
}
+ /*
+ * EEM
+ */
+ em_cfg.num_elements = TF_EM_TBL_TYPE_MAX;
+ if (dev_handle->type == TF_DEVICE_TYPE_WH)
+ em_cfg.cfg = tf_em_ext_p4;
+ else
+ em_cfg.cfg = tf_em_ext_p45;
+ em_cfg.resources = resources;
+ em_cfg.mem_type = TF_EEM_MEM_TYPE_HOST;
+ rc = tf_em_ext_common_bind(tfp, &em_cfg);
+ if (rc) {
+ TFP_DRV_LOG(ERR,
+ "EEM initialization failure\n");
+ goto fail;
+ }
+
+ /*
+ * EM
+ */
+ em_cfg.num_elements = TF_EM_TBL_TYPE_MAX;
+ em_cfg.cfg = tf_em_int_p4;
+ em_cfg.resources = resources;
+ em_cfg.mem_type = 0; /* Not used by EM */
+
+ rc = tf_em_int_bind(tfp, &em_cfg);
+ if (rc) {
+ TFP_DRV_LOG(ERR,
+ "EM initialization failure\n");
+ goto fail;
+ }
+
+ /*
+ * IF_TBL
+ */
+ if_tbl_cfg.num_elements = TF_IF_TBL_TYPE_MAX;
+ if_tbl_cfg.cfg = tf_if_tbl_p4;
+ if_tbl_cfg.shadow_copy = shadow_copy;
+ rc = tf_if_tbl_bind(tfp, &if_tbl_cfg);
+ if (rc) {
+ TFP_DRV_LOG(ERR,
+ "IF Table initialization failure\n");
+ goto fail;
+ }
+
+ /*
+ * GLOBAL_CFG
+ */
+ global_cfg.num_elements = TF_GLOBAL_CFG_TYPE_MAX;
+ global_cfg.cfg = tf_global_cfg_p4;
+ rc = tf_global_cfg_bind(tfp, &global_cfg);
+ if (rc) {
+ TFP_DRV_LOG(ERR,
+ "Global Cfg initialization failure\n");
+ goto fail;
+ }
+
/* Final function initialization */
dev_handle->ops = &tf_dev_ops_p4;
fail = true;
}
+ rc = tf_em_ext_common_unbind(tfp);
+ if (rc) {
+ TFP_DRV_LOG(ERR,
+ "Device unbind failed, EEM\n");
+ fail = true;
+ }
+
+ rc = tf_em_int_unbind(tfp);
+ if (rc) {
+ TFP_DRV_LOG(ERR,
+ "Device unbind failed, EM\n");
+ fail = true;
+ }
+
+ rc = tf_if_tbl_unbind(tfp);
+ if (rc) {
+ TFP_DRV_LOG(ERR,
+ "Device unbind failed, IF Table Type\n");
+ fail = true;
+ }
+
+ rc = tf_global_cfg_unbind(tfp);
+ if (rc) {
+ TFP_DRV_LOG(ERR,
+ "Device unbind failed, Global Cfg Type\n");
+ fail = true;
+ }
+
if (fail)
return -1;
{
switch (type) {
case TF_DEVICE_TYPE_WH:
+ case TF_DEVICE_TYPE_SR:
+ dev_handle->type = type;
return tf_dev_bind_p4(tfp,
shadow_copy,
resources,
{
switch (dev_handle->type) {
case TF_DEVICE_TYPE_WH:
+ case TF_DEVICE_TYPE_SR:
return tf_dev_unbind_p4(tfp);
default:
TFP_DRV_LOG(ERR,