/* 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)
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)