X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fbnxt%2Ftf_core%2Ftf_core.c;h=0dbde1de2d0c3d4ae756fd69e46997eae6ee5141;hb=7ecfe8521fbb6a845f08a6b178676d1d6c5a7802;hp=ca3280b6b1adce157a790ca5f683d1d7f65b3be6;hpb=7d5d5b877582ee30e64946ee788d21d50d03ae2e;p=dpdk.git diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c index ca3280b6b1..0dbde1de2d 100644 --- a/drivers/net/bnxt/tf_core/tf_core.c +++ b/drivers/net/bnxt/tf_core/tf_core.c @@ -75,7 +75,6 @@ tf_open_session(struct tf *tfp, /* Session vs session client is decided in * tf_session_open_session() */ - printf("TF_OPEN, %s\n", parms->ctrl_chan_name); rc = tf_session_open_session(tfp, &oparms); /* Logging handled by tf_session_open_session */ if (rc) @@ -953,6 +952,71 @@ tf_alloc_tbl_entry(struct tf *tfp, return 0; } +int +tf_search_tbl_entry(struct tf *tfp, + struct tf_search_tbl_entry_parms *parms) +{ + int rc; + struct tf_session *tfs; + struct tf_dev_info *dev; + struct tf_tbl_alloc_search_parms sparms; + + TF_CHECK_PARMS2(tfp, parms); + + /* Retrieve the session information */ + rc = tf_session_get_session(tfp, &tfs); + if (rc) { + TFP_DRV_LOG(ERR, + "%s: Failed to lookup session, rc:%s\n", + tf_dir_2_str(parms->dir), + strerror(-rc)); + return rc; + } + + /* Retrieve the device information */ + rc = tf_session_get_device(tfs, &dev); + if (rc) { + TFP_DRV_LOG(ERR, + "%s: Failed to lookup device, rc:%s\n", + tf_dir_2_str(parms->dir), + strerror(-rc)); + return rc; + } + + if (dev->ops->tf_dev_alloc_search_tbl == NULL) { + rc = -EOPNOTSUPP; + TFP_DRV_LOG(ERR, + "%s: Operation not supported, rc:%s\n", + tf_dir_2_str(parms->dir), + strerror(-rc)); + return rc; + } + + memset(&sparms, 0, sizeof(struct tf_tbl_alloc_search_parms)); + sparms.dir = parms->dir; + sparms.type = parms->type; + sparms.result = parms->result; + sparms.result_sz_in_bytes = parms->result_sz_in_bytes; + sparms.alloc = parms->alloc; + sparms.tbl_scope_id = parms->tbl_scope_id; + rc = dev->ops->tf_dev_alloc_search_tbl(tfp, &sparms); + if (rc) { + TFP_DRV_LOG(ERR, + "%s: TBL allocation failed, rc:%s\n", + tf_dir_2_str(parms->dir), + strerror(-rc)); + return rc; + } + + /* Return the outputs from the search */ + parms->hit = sparms.hit; + parms->search_status = sparms.search_status; + parms->ref_cnt = sparms.ref_cnt; + parms->idx = sparms.idx; + + return 0; +} + int tf_free_tbl_entry(struct tf *tfp, struct tf_free_tbl_entry_parms *parms)