Skip to content

Commit

Permalink
sched: enable traffic class oversubscription unconditionally
Browse files Browse the repository at this point in the history
Removed RTE_SCHED_SUBPORT_TC_OV from rte_config.h.
Best effort traffic class oversubscription is always enabled.

Signed-off-by: Megha Ajmera <megha.ajmera@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
  • Loading branch information
megha-ajmera authored and tmonjalo committed Feb 24, 2022
1 parent 199d788 commit d91c4b1
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 111 deletions.
1 change: 0 additions & 1 deletion config/rte_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@

/* rte_sched defines */
#undef RTE_SCHED_CMAN
#undef RTE_SCHED_SUBPORT_TC_OV

/* rte_graph defines */
#define RTE_GRAPH_BURST_SIZE 256
Expand Down
18 changes: 0 additions & 18 deletions drivers/net/softnic/rte_eth_softnic_tm.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,15 +595,9 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
.sched_sp_n_priorities_max = 1,
.sched_wfq_n_children_per_group_max = UINT32_MAX,
.sched_wfq_n_groups_max = 1,
#ifdef RTE_SCHED_SUBPORT_TC_OV
.sched_wfq_weight_max = UINT32_MAX,
.sched_wfq_packet_mode_supported = 0,
.sched_wfq_byte_mode_supported = 1,
#else
.sched_wfq_weight_max = 1,
.sched_wfq_packet_mode_supported = 0,
.sched_wfq_byte_mode_supported = 1,
#endif

.stats_mask = STATS_MASK_DEFAULT,
} },
Expand Down Expand Up @@ -2828,8 +2822,6 @@ pmd_tm_hierarchy_commit(struct rte_eth_dev *dev,
return 0;
}

#ifdef RTE_SCHED_SUBPORT_TC_OV

static int
update_pipe_weight(struct rte_eth_dev *dev, struct tm_node *np, uint32_t weight)
{
Expand Down Expand Up @@ -2867,8 +2859,6 @@ update_pipe_weight(struct rte_eth_dev *dev, struct tm_node *np, uint32_t weight)
return 0;
}

#endif

static int
update_queue_weight(struct rte_eth_dev *dev,
struct tm_node *nq, uint32_t weight)
Expand Down Expand Up @@ -2983,21 +2973,13 @@ pmd_tm_node_parent_update(struct rte_eth_dev *dev,
rte_strerror(EINVAL));
/* fall-through */
case TM_NODE_LEVEL_PIPE:
#ifdef RTE_SCHED_SUBPORT_TC_OV
if (update_pipe_weight(dev, n, weight))
return -rte_tm_error_set(error,
EINVAL,
RTE_TM_ERROR_TYPE_UNSPECIFIED,
NULL,
rte_strerror(EINVAL));
return 0;
#else
return -rte_tm_error_set(error,
EINVAL,
RTE_TM_ERROR_TYPE_NODE_WEIGHT,
NULL,
rte_strerror(EINVAL));
#endif
/* fall-through */
case TM_NODE_LEVEL_TC:
return -rte_tm_error_set(error,
Expand Down
2 changes: 0 additions & 2 deletions examples/qos_sched/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,7 @@ static struct rte_sched_pipe_params pipe_profiles[MAX_SCHED_PIPE_PROFILES] = {
.tc_rate = {305175, 305175, 305175, 305175, 305175, 305175,
305175, 305175, 305175, 305175, 305175, 305175, 305175},
.tc_period = 40,
#ifdef RTE_SCHED_SUBPORT_TC_OV
.tc_ov_weight = 1,
#endif

.wrr_weights = {1, 1, 1, 1},
},
Expand Down
90 changes: 0 additions & 90 deletions lib/sched/rte_sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1317,14 +1317,12 @@ rte_sched_subport_config(struct rte_sched_port *port,
for (i = 0; i < RTE_SCHED_PORT_N_GRINDERS; i++)
s->grinder_base_bmp_pos[i] = RTE_SCHED_PIPE_INVALID;

#ifdef RTE_SCHED_SUBPORT_TC_OV
/* TC oversubscription */
s->tc_ov_wm_min = port->mtu;
s->tc_ov_period_id = 0;
s->tc_ov = 0;
s->tc_ov_n = 0;
s->tc_ov_rate = 0;
#endif
}

{
Expand All @@ -1344,11 +1342,9 @@ rte_sched_subport_config(struct rte_sched_port *port,
else
profile->tc_credits_per_period[i] = 0;

#ifdef RTE_SCHED_SUBPORT_TC_OV
s->tc_ov_wm_max = rte_sched_time_ms_to_bytes(profile->tc_period,
s->pipe_tc_be_rate_max);
s->tc_ov_wm = s->tc_ov_wm_max;
#endif
s->profile = subport_profile_id;

}
Expand Down Expand Up @@ -2255,50 +2251,6 @@ rte_sched_port_enqueue(struct rte_sched_port *port, struct rte_mbuf **pkts,
return result;
}

#ifndef RTE_SCHED_SUBPORT_TC_OV

static inline void
grinder_credits_update(struct rte_sched_port *port,
struct rte_sched_subport *subport, uint32_t pos)
{
struct rte_sched_grinder *grinder = subport->grinder + pos;
struct rte_sched_pipe *pipe = grinder->pipe;
struct rte_sched_pipe_profile *params = grinder->pipe_params;
struct rte_sched_subport_profile *sp = grinder->subport_params;
uint64_t n_periods;
uint32_t i;

/* Subport TB */
n_periods = (port->time - subport->tb_time) / sp->tb_period;
subport->tb_credits += n_periods * sp->tb_credits_per_period;
subport->tb_credits = RTE_MIN(subport->tb_credits, sp->tb_size);
subport->tb_time += n_periods * sp->tb_period;

/* Pipe TB */
n_periods = (port->time - pipe->tb_time) / params->tb_period;
pipe->tb_credits += n_periods * params->tb_credits_per_period;
pipe->tb_credits = RTE_MIN(pipe->tb_credits, params->tb_size);
pipe->tb_time += n_periods * params->tb_period;

/* Subport TCs */
if (unlikely(port->time >= subport->tc_time)) {
for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++)
subport->tc_credits[i] = sp->tc_credits_per_period[i];

subport->tc_time = port->time + sp->tc_period;
}

/* Pipe TCs */
if (unlikely(port->time >= pipe->tc_time)) {
for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++)
pipe->tc_credits[i] = params->tc_credits_per_period[i];

pipe->tc_time = port->time + params->tc_period;
}
}

#else

static inline uint64_t
grinder_tc_ov_credits_update(struct rte_sched_port *port,
struct rte_sched_subport *subport, uint32_t pos)
Expand Down Expand Up @@ -2393,46 +2345,6 @@ grinder_credits_update(struct rte_sched_port *port,
}
}

#endif /* RTE_SCHED_TS_CREDITS_UPDATE, RTE_SCHED_SUBPORT_TC_OV */


#ifndef RTE_SCHED_SUBPORT_TC_OV

static inline int
grinder_credits_check(struct rte_sched_port *port,
struct rte_sched_subport *subport, uint32_t pos)
{
struct rte_sched_grinder *grinder = subport->grinder + pos;
struct rte_sched_pipe *pipe = grinder->pipe;
struct rte_mbuf *pkt = grinder->pkt;
uint32_t tc_index = grinder->tc_index;
uint64_t pkt_len = pkt->pkt_len + port->frame_overhead;
uint64_t subport_tb_credits = subport->tb_credits;
uint64_t subport_tc_credits = subport->tc_credits[tc_index];
uint64_t pipe_tb_credits = pipe->tb_credits;
uint64_t pipe_tc_credits = pipe->tc_credits[tc_index];
int enough_credits;

/* Check queue credits */
enough_credits = (pkt_len <= subport_tb_credits) &&
(pkt_len <= subport_tc_credits) &&
(pkt_len <= pipe_tb_credits) &&
(pkt_len <= pipe_tc_credits);

if (!enough_credits)
return 0;

/* Update port credits */
subport->tb_credits -= pkt_len;
subport->tc_credits[tc_index] -= pkt_len;
pipe->tb_credits -= pkt_len;
pipe->tc_credits[tc_index] -= pkt_len;

return 1;
}

#else

static inline int
grinder_credits_check(struct rte_sched_port *port,
struct rte_sched_subport *subport, uint32_t pos)
Expand Down Expand Up @@ -2479,8 +2391,6 @@ grinder_credits_check(struct rte_sched_port *port,
return 1;
}

#endif /* RTE_SCHED_SUBPORT_TC_OV */


static inline int
grinder_schedule(struct rte_sched_port *port,
Expand Down

0 comments on commit d91c4b1

Please sign in to comment.