sched: hide structure of port hierarchy
Right now the scheduler hierarchy is encoded as a bitfield that is visible as part of the ABI. This creates an barrier limiting future expansion of the hierarchy. As a transistional step. hide the actual layout of the hierarchy and mark the exposed structure as deprecated. This will allow for expansion in later release. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
This commit is contained in:
parent
63111f7d4d
commit
320d0b6ea0
@ -184,6 +184,21 @@ enum grinder_state {
|
|||||||
e_GRINDER_READ_MBUF
|
e_GRINDER_READ_MBUF
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Path through the scheduler hierarchy used by the scheduler enqueue
|
||||||
|
* operation to identify the destination queue for the current
|
||||||
|
* packet. Stored in the field pkt.hash.sched of struct rte_mbuf of
|
||||||
|
* each packet, typically written by the classification stage and read
|
||||||
|
* by scheduler enqueue.
|
||||||
|
*/
|
||||||
|
struct __rte_sched_port_hierarchy {
|
||||||
|
uint32_t queue:2; /**< Queue ID (0 .. 3) */
|
||||||
|
uint32_t traffic_class:2; /**< Traffic class ID (0 .. 3)*/
|
||||||
|
uint32_t pipe:20; /**< Pipe ID */
|
||||||
|
uint32_t subport:6; /**< Subport ID */
|
||||||
|
uint32_t color:2; /**< Color */
|
||||||
|
};
|
||||||
|
|
||||||
struct rte_sched_grinder {
|
struct rte_sched_grinder {
|
||||||
/* Pipe cache */
|
/* Pipe cache */
|
||||||
uint16_t pcache_qmask[RTE_SCHED_GRINDER_PCACHE_SIZE];
|
uint16_t pcache_qmask[RTE_SCHED_GRINDER_PCACHE_SIZE];
|
||||||
@ -910,6 +925,45 @@ rte_sched_pipe_config(struct rte_sched_port *port,
|
|||||||
return 0;
|
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;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
rte_sched_subport_read_stats(struct rte_sched_port *port,
|
rte_sched_subport_read_stats(struct rte_sched_port *port,
|
||||||
uint32_t subport_id,
|
uint32_t subport_id,
|
||||||
|
@ -195,17 +195,19 @@ struct rte_sched_port_params {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Path through the scheduler hierarchy used by the scheduler enqueue operation to
|
/*
|
||||||
identify the destination queue for the current packet. Stored in the field hash.sched
|
* Path through scheduler hierarchy
|
||||||
of struct rte_mbuf of each packet, typically written by the classification stage and read by
|
*
|
||||||
scheduler enqueue.*/
|
* Note: direct access to internal bitfields is deprecated to allow for future expansion.
|
||||||
|
* Use rte_sched_port_pkt_read/write API instead
|
||||||
|
*/
|
||||||
struct rte_sched_port_hierarchy {
|
struct rte_sched_port_hierarchy {
|
||||||
uint32_t queue:2; /**< Queue ID (0 .. 3) */
|
uint32_t queue:2; /**< Queue ID (0 .. 3) */
|
||||||
uint32_t traffic_class:2; /**< Traffic class ID (0 .. 3)*/
|
uint32_t traffic_class:2; /**< Traffic class ID (0 .. 3)*/
|
||||||
uint32_t pipe:20; /**< Pipe ID */
|
uint32_t pipe:20; /**< Pipe ID */
|
||||||
uint32_t subport:6; /**< Subport ID */
|
uint32_t subport:6; /**< Subport ID */
|
||||||
uint32_t color:2; /**< Color */
|
uint32_t color:2; /**< Color */
|
||||||
};
|
} __attribute__ ((deprecated));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Configuration
|
* Configuration
|
||||||
@ -328,11 +330,6 @@ rte_sched_queue_read_stats(struct rte_sched_port *port,
|
|||||||
struct rte_sched_queue_stats *stats,
|
struct rte_sched_queue_stats *stats,
|
||||||
uint16_t *qlen);
|
uint16_t *qlen);
|
||||||
|
|
||||||
/*
|
|
||||||
* Run-time
|
|
||||||
*
|
|
||||||
***/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scheduler hierarchy path write to packet descriptor. Typically called by the
|
* Scheduler hierarchy path write to packet descriptor. Typically called by the
|
||||||
* packet classification stage.
|
* packet classification stage.
|
||||||
@ -350,18 +347,10 @@ rte_sched_queue_read_stats(struct rte_sched_port *port,
|
|||||||
* @param color
|
* @param color
|
||||||
* Packet color set
|
* Packet color set
|
||||||
*/
|
*/
|
||||||
static inline void
|
void
|
||||||
rte_sched_port_pkt_write(struct rte_mbuf *pkt,
|
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)
|
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;
|
|
||||||
|
|
||||||
sched->color = (uint32_t) color;
|
|
||||||
sched->subport = subport;
|
|
||||||
sched->pipe = pipe;
|
|
||||||
sched->traffic_class = traffic_class;
|
|
||||||
sched->queue = queue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scheduler hierarchy path read from packet descriptor (struct rte_mbuf). Typically
|
* Scheduler hierarchy path read from packet descriptor (struct rte_mbuf). Typically
|
||||||
@ -380,24 +369,13 @@ rte_sched_port_pkt_write(struct rte_mbuf *pkt,
|
|||||||
* Queue ID within pipe traffic class (0 .. 3)
|
* Queue ID within pipe traffic class (0 .. 3)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static inline void
|
void
|
||||||
rte_sched_port_pkt_read_tree_path(struct rte_mbuf *pkt, uint32_t *subport, uint32_t *pipe, uint32_t *traffic_class, uint32_t *queue)
|
rte_sched_port_pkt_read_tree_path(const struct rte_mbuf *pkt,
|
||||||
{
|
uint32_t *subport, uint32_t *pipe,
|
||||||
struct rte_sched_port_hierarchy *sched = (struct rte_sched_port_hierarchy *) &pkt->hash.sched;
|
uint32_t *traffic_class, uint32_t *queue);
|
||||||
|
|
||||||
*subport = sched->subport;
|
enum rte_meter_color
|
||||||
*pipe = sched->pipe;
|
rte_sched_port_pkt_read_color(const struct rte_mbuf *pkt);
|
||||||
*traffic_class = sched->traffic_class;
|
|
||||||
*queue = sched->queue;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline enum rte_meter_color
|
|
||||||
rte_sched_port_pkt_read_color(struct rte_mbuf *pkt)
|
|
||||||
{
|
|
||||||
struct rte_sched_port_hierarchy *sched = (struct rte_sched_port_hierarchy *) &pkt->hash.sched;
|
|
||||||
|
|
||||||
return (enum rte_meter_color) sched->color;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hierarchical scheduler port enqueue. Writes up to n_pkts to port scheduler and
|
* Hierarchical scheduler port enqueue. Writes up to n_pkts to port scheduler and
|
||||||
|
@ -20,3 +20,12 @@ DPDK_2.0 {
|
|||||||
|
|
||||||
local: *;
|
local: *;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DPDK_2.1 {
|
||||||
|
global:
|
||||||
|
|
||||||
|
rte_sched_port_pkt_write;
|
||||||
|
rte_sched_port_pkt_read_tree_path;
|
||||||
|
rte_sched_port_pkt_read_color;
|
||||||
|
|
||||||
|
} DPDK_2.0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user