+void
+rte_swx_pipeline_free(struct rte_swx_pipeline *p)
+{
+ void *lib;
+
+ if (!p)
+ return;
+
+ lib = p->lib;
+
+ free(p->instruction_data);
+ free(p->instructions);
+
+ metarray_free(p);
+ regarray_free(p);
+ table_state_free(p);
+ learner_free(p);
+ selector_free(p);
+ table_free(p);
+ action_free(p);
+ instruction_table_free(p);
+ metadata_free(p);
+ header_free(p);
+ extern_func_free(p);
+ extern_obj_free(p);
+ port_out_free(p);
+ port_in_free(p);
+ struct_free(p);
+
+ free(p);
+
+ if (lib)
+ dlclose(lib);
+}
+
+static int
+port_in_types_register(struct rte_swx_pipeline *p)
+{
+ int status;
+
+ status = rte_swx_pipeline_port_in_type_register(p,
+ "ethdev",
+ &rte_swx_port_ethdev_reader_ops);
+ if (status)
+ return status;
+
+ status = rte_swx_pipeline_port_in_type_register(p,
+ "ring",
+ &rte_swx_port_ring_reader_ops);
+ if (status)
+ return status;
+
+#ifdef RTE_PORT_PCAP
+ status = rte_swx_pipeline_port_in_type_register(p,
+ "source",
+ &rte_swx_port_source_ops);
+ if (status)
+ return status;
+#endif
+
+ status = rte_swx_pipeline_port_in_type_register(p,
+ "fd",
+ &rte_swx_port_fd_reader_ops);
+ if (status)
+ return status;
+
+ return 0;
+}
+
+static int
+port_out_types_register(struct rte_swx_pipeline *p)
+{
+ int status;
+
+ status = rte_swx_pipeline_port_out_type_register(p,
+ "ethdev",
+ &rte_swx_port_ethdev_writer_ops);
+ if (status)
+ return status;
+
+ status = rte_swx_pipeline_port_out_type_register(p,
+ "ring",
+ &rte_swx_port_ring_writer_ops);
+ if (status)
+ return status;
+
+ status = rte_swx_pipeline_port_out_type_register(p,
+ "sink",
+ &rte_swx_port_sink_ops);
+ if (status)
+ return status;
+
+ status = rte_swx_pipeline_port_out_type_register(p,
+ "fd",
+ &rte_swx_port_fd_writer_ops);
+ if (status)
+ return status;
+
+ return 0;
+}
+
+static int
+table_types_register(struct rte_swx_pipeline *p)
+{
+ int status;
+
+ status = rte_swx_pipeline_table_type_register(p,
+ "exact",
+ RTE_SWX_TABLE_MATCH_EXACT,
+ &rte_swx_table_exact_match_ops);
+ if (status)
+ return status;
+
+ status = rte_swx_pipeline_table_type_register(p,
+ "wildcard",
+ RTE_SWX_TABLE_MATCH_WILDCARD,
+ &rte_swx_table_wildcard_match_ops);
+ if (status)
+ return status;
+
+ return 0;
+}
+