return RTE_SCHED_QUEUES_PER_PIPE * port->n_pipes_per_subport * port->n_subports_per_port;
}
+static inline struct rte_mbuf **
+rte_sched_port_qbase(struct rte_sched_port *port, uint32_t qindex)
+{
+ uint32_t pindex = qindex >> 4;
+ uint32_t qpos = qindex & 0xF;
+
+ return (port->queue_array + pindex *
+ port->qsize_sum + port->qsize_add[qpos]);
+}
+
+static inline uint16_t
+rte_sched_port_qsize(struct rte_sched_port *port, uint32_t qindex)
+{
+ uint32_t tc = (qindex >> 2) & 0x3;
+
+ return port->qsize[tc];
+}
+
static int
rte_sched_port_check_params(struct rte_sched_port_params *params)
{
void
rte_sched_port_free(struct rte_sched_port *port)
{
+ unsigned int queue;
+
/* Check user parameters */
if (port == NULL)
return;
+ /* Free enqueued mbufs */
+ for (queue = 0; queue < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; queue++) {
+ struct rte_mbuf **mbufs = rte_sched_port_qbase(port, queue);
+ unsigned int i;
+
+ for (i = 0; i < rte_sched_port_qsize(port, queue); i++)
+ rte_pktmbuf_free(mbufs[i]);
+ }
+
rte_bitmap_free(port->bmp);
rte_free(port);
}
return result;
}
-static inline struct rte_mbuf **
-rte_sched_port_qbase(struct rte_sched_port *port, uint32_t qindex)
-{
- uint32_t pindex = qindex >> 4;
- uint32_t qpos = qindex & 0xF;
-
- return (port->queue_array + pindex * port->qsize_sum + port->qsize_add[qpos]);
-}
-
-static inline uint16_t
-rte_sched_port_qsize(struct rte_sched_port *port, uint32_t qindex)
-{
- uint32_t tc = (qindex >> 2) & 0x3;
-
- return port->qsize[tc];
-}
-
#ifdef RTE_SCHED_DEBUG
static inline int
return (queue->qr == queue->qw);
}
-static inline int
-rte_sched_port_queue_is_full(struct rte_sched_port *port, uint32_t qindex)
-{
- struct rte_sched_queue *queue = port->queue + qindex;
- uint16_t qsize = rte_sched_port_qsize(port, qindex);
- uint16_t qlen = queue->qw - queue->qr;
-
- return (qlen >= qsize);
-}
-
#endif /* RTE_SCHED_DEBUG */
#ifdef RTE_SCHED_COLLECT_STATS
#ifdef RTE_SCHED_DEBUG
-static inline int
-debug_pipe_is_empty(struct rte_sched_port *port, uint32_t pindex)
-{
- uint32_t qindex, i;
-
- qindex = pindex << 4;
-
- for (i = 0; i < 16; i++) {
- uint32_t queue_empty = rte_sched_port_queue_is_empty(port, qindex + i);
- uint32_t bmp_bit_clear = (rte_bitmap_get(port->bmp, qindex + i) == 0);
-
- if (queue_empty != bmp_bit_clear)
- rte_panic("Queue status mismatch for queue %u of pipe %u\n", i, pindex);
-
- if (!queue_empty)
- return 0;
- }
-
- return 1;
-}
-
static inline void
debug_check_queue_slab(struct rte_sched_port *port, uint32_t bmp_pos,
uint64_t bmp_slab)