X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fbnxt%2Ftf_core%2Ftf_session.c;h=3e6664e9f2ff785c6b3af6359c93fed5c09c34ad;hb=f1f6ebc0eaf68a825c6175f5e6a436f7d91660c3;hp=e6ab5181215943f53a8db6c19f44ca80dc960709;hpb=1678535b30cb86979f01a965594a3d2731176989;p=dpdk.git diff --git a/drivers/net/bnxt/tf_core/tf_session.c b/drivers/net/bnxt/tf_core/tf_session.c index e6ab518121..3e6664e9f2 100644 --- a/drivers/net/bnxt/tf_core/tf_session.c +++ b/drivers/net/bnxt/tf_core/tf_session.c @@ -188,6 +188,11 @@ tf_session_create(struct tf *tfp, if (!strncmp(name, "tf_shared", strlen("tf_shared"))) session->shared_session = true; + name = &parms->open_cfg->ctrl_chan_name[name_len - + strlen("tf_shared-wc_tcam")]; + if (!strncmp(name, "tf_shared-wc_tcam", strlen("tf_shared-wc_tcam"))) + session->shared_session = true; + if (session->shared_session && shared_session_creator) { session->shared_session_creator = true; parms->open_cfg->shared_session_creator = true; @@ -197,6 +202,7 @@ tf_session_create(struct tf *tfp, parms->open_cfg->device_type, session->shadow_copy, &parms->open_cfg->resources, + parms->open_cfg->wc_num_slices, &session->dev); /* Logging handled by dev_bind */ @@ -215,6 +221,16 @@ tf_session_create(struct tf *tfp, return 0; cleanup: + rc = tf_msg_session_close(tfp, + fw_session_id, + dev.ops->tf_dev_get_mailbox()); + if (rc) { + /* Log error */ + TFP_DRV_LOG(ERR, + "FW Session close failed, rc:%s\n", + strerror(-rc)); + } + tfp_free(tfp->session->core_data); tfp_free(tfp->session); tfp->session = NULL; @@ -479,6 +495,8 @@ tf_session_close_session(struct tf *tfp, struct tf_dev_info *tfd = NULL; struct tf_session_client_destroy_parms scdparms; uint16_t fid; + uint8_t fw_session_id = 1; + int mailbox = 0; TF_CHECK_PARMS2(tfp, parms); @@ -563,6 +581,16 @@ tf_session_close_session(struct tf *tfp, return rc; } + mailbox = tfd->ops->tf_dev_get_mailbox(); + + rc = tf_session_get_fw_session_id(tfp, &fw_session_id); + if (rc) { + TFP_DRV_LOG(ERR, + "Unable to lookup FW id, rc:%s\n", + strerror(-rc)); + return rc; + } + /* Unbind the device */ rc = tf_dev_unbind(tfp, tfd); if (rc) { @@ -572,7 +600,7 @@ tf_session_close_session(struct tf *tfp, strerror(-rc)); } - rc = tf_msg_session_close(tfp, tfs); + rc = tf_msg_session_close(tfp, fw_session_id, mailbox); if (rc) { /* Log error */ TFP_DRV_LOG(ERR, @@ -678,6 +706,22 @@ tf_session_get_session(struct tf *tfp, return rc; } +int tf_session_get(struct tf *tfp, + struct tf_session **tfs, + struct tf_dev_info **tfd) +{ + int rc; + rc = tf_session_get_session_internal(tfp, tfs); + + /* Logging done by tf_session_get_session_internal */ + if (rc) + return rc; + + rc = tf_session_get_device(*tfs, tfd); + + return rc; +} + struct tf_session_client * tf_session_get_session_client(struct tf_session *tfs, union tf_session_client_id session_client_id) @@ -881,26 +925,26 @@ tf_session_get_db(struct tf *tfp, if (tfs->id_db_handle) *db_handle = tfs->id_db_handle; else - rc = -EINVAL; + rc = -ENOMEM; break; case TF_MODULE_TYPE_TABLE: if (tfs->tbl_db_handle) *db_handle = tfs->tbl_db_handle; else - rc = -EINVAL; + rc = -ENOMEM; break; case TF_MODULE_TYPE_TCAM: if (tfs->tcam_db_handle) *db_handle = tfs->tcam_db_handle; else - rc = -EINVAL; + rc = -ENOMEM; break; case TF_MODULE_TYPE_EM: if (tfs->em_db_handle) *db_handle = tfs->em_db_handle; else - rc = -EINVAL; + rc = -ENOMEM; break; default: rc = -EINVAL; @@ -945,3 +989,83 @@ tf_session_set_db(struct tf *tfp, return rc; } + +#ifdef TF_TCAM_SHARED + +int +tf_session_get_tcam_shared_db(struct tf *tfp, + void **tcam_shared_db_handle) +{ + struct tf_session *tfs = NULL; + int rc = 0; + + *tcam_shared_db_handle = NULL; + + if (tfp == NULL) + return (-EINVAL); + + rc = tf_session_get_session_internal(tfp, &tfs); + if (rc) + return rc; + + *tcam_shared_db_handle = tfs->tcam_shared_db_handle; + return rc; +} + +int +tf_session_set_tcam_shared_db(struct tf *tfp, + void *tcam_shared_db_handle) +{ + struct tf_session *tfs = NULL; + int rc = 0; + + if (tfp == NULL) + return (-EINVAL); + + rc = tf_session_get_session_internal(tfp, &tfs); + if (rc) + return rc; + + tfs->tcam_shared_db_handle = tcam_shared_db_handle; + return rc; +} + +int +tf_session_get_sram_db(struct tf *tfp, + void **sram_handle) +{ + struct tf_session *tfs = NULL; + int rc = 0; + + *sram_handle = NULL; + + if (tfp == NULL) + return (-EINVAL); + + rc = tf_session_get_session_internal(tfp, &tfs); + if (rc) + return rc; + + *sram_handle = tfs->sram_handle; + return rc; +} + +int +tf_session_set_sram_db(struct tf *tfp, + void *sram_handle) +{ + struct tf_session *tfs = NULL; + int rc = 0; + + if (tfp == NULL) + return (-EINVAL); + + rc = tf_session_get_session_internal(tfp, &tfs); + if (rc) + return rc; + + tfs->sram_handle = sram_handle; + return rc; +} + +#endif /* TF_TCAM_SHARED */