-struct ofproto_dpif *
-ofproto_dpif_recirc_get_ofproto(const struct dpif_backer *backer,
- uint32_t recirc_id)
-{
- struct dpif_backer_recirc_node *node;
-
- node = CONTAINER_OF(cmap_find(&backer->recirc_map, recirc_id),
- struct dpif_backer_recirc_node, cmap_node);
-
- return node ? node->ofproto : NULL;
-}
-
-uint32_t
-ofproto_dpif_alloc_recirc_id(struct ofproto_dpif *ofproto)
-{
- struct dpif_backer *backer = ofproto->backer;
- uint32_t recirc_id = recirc_id_alloc(backer->rid_pool);
-
- if (recirc_id) {
- struct dpif_backer_recirc_node *node = xmalloc(sizeof *node);
-
- node->recirc_id = recirc_id;
- node->ofproto = ofproto;
-
- ovs_mutex_lock(&backer->recirc_mutex);
- cmap_insert(&backer->recirc_map, &node->cmap_node, node->recirc_id);
- ovs_mutex_unlock(&backer->recirc_mutex);
- }
-
- return recirc_id;
-}
-
-void
-ofproto_dpif_free_recirc_id(struct ofproto_dpif *ofproto, uint32_t recirc_id)
-{
- struct dpif_backer *backer = ofproto->backer;
- struct dpif_backer_recirc_node *node;
-
- node = CONTAINER_OF(cmap_find(&backer->recirc_map, recirc_id),
- struct dpif_backer_recirc_node, cmap_node);
- if (node) {
- ovs_mutex_lock(&backer->recirc_mutex);
- cmap_remove(&backer->recirc_map, &node->cmap_node, node->recirc_id);
- ovs_mutex_unlock(&backer->recirc_mutex);
- recirc_id_free(backer->rid_pool, node->recirc_id);
-
- /* 'recirc_id' should never be freed by non-owning 'ofproto'. */
- ovs_assert(node->ofproto == ofproto);
-
- /* RCU postpone the free, since other threads may be referring
- * to 'node' at same time. */
- ovsrcu_postpone(free, node);
- }
-}
-