+int __rte_experimental
+rte_sched_port_pipe_profile_add(struct rte_sched_port *port,
+ struct rte_sched_pipe_params *params,
+ uint32_t *pipe_profile_id)
+{
+ struct rte_sched_pipe_profile *pp;
+ uint32_t i;
+ int status;
+
+ /* Port */
+ if (port == NULL)
+ return -1;
+
+ /* Pipe profiles not exceeds the max limit */
+ if (port->n_pipe_profiles >= RTE_SCHED_PIPE_PROFILES_PER_PORT)
+ return -2;
+
+ /* Pipe params */
+ status = pipe_profile_check(params, port->rate);
+ if (status != 0)
+ return status;
+
+ pp = &port->pipe_profiles[port->n_pipe_profiles];
+ rte_sched_pipe_profile_convert(params, pp, port->rate);
+
+ /* Pipe profile not exists */
+ for (i = 0; i < port->n_pipe_profiles; i++)
+ if (memcmp(port->pipe_profiles + i, pp, sizeof(*pp)) == 0)
+ return -3;
+
+ /* Pipe profile commit */
+ *pipe_profile_id = port->n_pipe_profiles;
+ port->n_pipe_profiles++;
+
+ if (port->pipe_tc3_rate_max < params->tc_rate[3])
+ port->pipe_tc3_rate_max = params->tc_rate[3];
+
+ rte_sched_port_log_pipe_profile(port, *pipe_profile_id);
+
+ return 0;
+}
+
+void
+rte_sched_port_pkt_write(struct rte_mbuf *pkt,
+ uint32_t subport, uint32_t pipe, uint32_t traffic_class,
+ uint32_t queue, enum rte_meter_color color)
+{
+ struct rte_sched_port_hierarchy *sched
+ = (struct rte_sched_port_hierarchy *) &pkt->hash.sched;
+
+ RTE_BUILD_BUG_ON(sizeof(*sched) > sizeof(pkt->hash.sched));
+
+ sched->color = (uint32_t) color;
+ sched->subport = subport;
+ sched->pipe = pipe;
+ sched->traffic_class = traffic_class;
+ sched->queue = queue;
+}
+
+void
+rte_sched_port_pkt_read_tree_path(const struct rte_mbuf *pkt,
+ uint32_t *subport, uint32_t *pipe,
+ uint32_t *traffic_class, uint32_t *queue)
+{
+ const struct rte_sched_port_hierarchy *sched
+ = (const struct rte_sched_port_hierarchy *) &pkt->hash.sched;
+
+ *subport = sched->subport;
+ *pipe = sched->pipe;
+ *traffic_class = sched->traffic_class;
+ *queue = sched->queue;
+}
+
+enum rte_meter_color
+rte_sched_port_pkt_read_color(const struct rte_mbuf *pkt)
+{
+ const struct rte_sched_port_hierarchy *sched
+ = (const struct rte_sched_port_hierarchy *) &pkt->hash.sched;
+
+ return (enum rte_meter_color) sched->color;
+}
+