+/**
+ * Looks up table scope control block using tbl_scope_id from tf_session.
+ *
+ * [in] tfp
+ * Pointer to Truflow Handle
+ * [in] tbl_scope_id
+ * table scope id
+ *
+ * Return:
+ * - Pointer to the tf_tbl_scope_cb, if found.
+ * - (NULL) on failure, not found.
+ */
+struct tf_tbl_scope_cb *
+tf_em_ext_common_tbl_scope_find(struct tf *tfp,
+ uint32_t tbl_scope_id)
+{
+ int rc;
+ struct em_ext_db *ext_db;
+ void *ext_ptr = NULL;
+ struct tf_tbl_scope_cb *tbl_scope_cb = NULL;
+ struct ll_entry *entry;
+
+ rc = tf_session_get_em_ext_db(tfp, &ext_ptr);
+ if (rc)
+ return NULL;
+
+ ext_db = (struct em_ext_db *)ext_ptr;
+
+ for (entry = ext_db->tbl_scope_ll.head; entry != NULL;
+ entry = entry->next) {
+ tbl_scope_cb = (struct tf_tbl_scope_cb *)entry;
+ if (tbl_scope_cb->tbl_scope_id == tbl_scope_id)
+ return tbl_scope_cb;
+ }
+
+ return NULL;
+}
+