| 2285 | } |
| 2286 | |
| 2287 | static inline void |
| 2288 | grinder_credits_update(struct rte_sched_port *port, |
| 2289 | struct rte_sched_subport *subport, uint32_t pos) |
| 2290 | { |
| 2291 | struct rte_sched_grinder *grinder = subport->grinder + pos; |
| 2292 | struct rte_sched_pipe *pipe = grinder->pipe; |
| 2293 | struct rte_sched_pipe_profile *params = grinder->pipe_params; |
| 2294 | struct rte_sched_subport_profile *sp = grinder->subport_params; |
| 2295 | uint64_t n_periods; |
| 2296 | uint32_t i; |
| 2297 | |
| 2298 | /* Subport TB */ |
| 2299 | n_periods = (port->time - subport->tb_time) / sp->tb_period; |
| 2300 | subport->tb_credits += n_periods * sp->tb_credits_per_period; |
| 2301 | subport->tb_credits = RTE_MIN(subport->tb_credits, sp->tb_size); |
| 2302 | subport->tb_time += n_periods * sp->tb_period; |
| 2303 | |
| 2304 | /* Pipe TB */ |
| 2305 | n_periods = (port->time - pipe->tb_time) / params->tb_period; |
| 2306 | pipe->tb_credits += n_periods * params->tb_credits_per_period; |
| 2307 | pipe->tb_credits = RTE_MIN(pipe->tb_credits, params->tb_size); |
| 2308 | pipe->tb_time += n_periods * params->tb_period; |
| 2309 | |
| 2310 | /* Subport TCs */ |
| 2311 | if (unlikely(port->time >= subport->tc_time)) { |
| 2312 | for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) |
| 2313 | subport->tc_credits[i] = sp->tc_credits_per_period[i]; |
| 2314 | |
| 2315 | subport->tc_time = port->time + sp->tc_period; |
| 2316 | } |
| 2317 | |
| 2318 | /* Pipe TCs */ |
| 2319 | if (unlikely(port->time >= pipe->tc_time)) { |
| 2320 | for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) |
| 2321 | pipe->tc_credits[i] = params->tc_credits_per_period[i]; |
| 2322 | pipe->tc_time = port->time + params->tc_period; |
| 2323 | } |
| 2324 | } |
| 2325 | |
| 2326 | static inline void |
| 2327 | grinder_credits_update_with_tc_ov(struct rte_sched_port *port, |