diff options
author | Nithin Dabilpuram <ndabilpuram@marvell.com> | 2022-01-21 18:52:00 +0530 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2022-01-28 15:02:56 +0200 |
commit | d4403fe5f97b1467354288ba733e6593a6141e7c (patch) | |
tree | 45048800fecca166215ea12f503b31db603c2865 /platform | |
parent | 73e287054145170509c2b1ef807e44e3d09c27cd (diff) |
linux-gen: tm: use dual rate flag instead of peak rate value
Use dual rate flag instead of peak rate value being zero
to determine if dual rate shaping is enabled or disabled.
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
Diffstat (limited to 'platform')
-rw-r--r-- | platform/linux-generic/odp_traffic_mngr.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/platform/linux-generic/odp_traffic_mngr.c b/platform/linux-generic/odp_traffic_mngr.c index 23980c3ac..da0715469 100644 --- a/platform/linux-generic/odp_traffic_mngr.c +++ b/platform/linux-generic/odp_traffic_mngr.c @@ -619,7 +619,7 @@ static void tm_shaper_params_cvt_to(const odp_tm_shaper_params_t *shaper_params, commit_burst = (int64_t)shaper_params->commit_burst; peak_rate = tm_bps_to_rate(shaper_params->peak_rate); - if ((shaper_params->peak_rate == 0) || (peak_rate == 0)) { + if ((!shaper_params->dual_rate) || (peak_rate == 0)) { peak_rate = 0; max_peak_time_delta = 0; peak_burst = 0; @@ -816,7 +816,7 @@ static void update_shaper_elapsed_time(tm_system_t *tm_system, shaper_obj->commit_cnt = (int64_t)MIN(max_commit, commit + commit_inc); - if (shaper_params->peak_rate != 0) { + if (shaper_params->dual_rate) { peak = shaper_obj->peak_cnt; max_peak = shaper_params->max_peak; if (shaper_params->max_peak_time_delta <= time_delta) @@ -847,7 +847,7 @@ static uint64_t time_till_not_red(tm_shaper_params_t *shaper_params, min_time_delay = MAX(shaper_obj->shaper_params->min_time_delta, UINT64_C(256)); commit_delay = MAX(commit_delay, min_time_delay); - if (shaper_params->peak_rate == 0) + if (!shaper_params->dual_rate) return commit_delay; peak_delay = 0; @@ -1051,7 +1051,7 @@ static odp_bool_t rm_pkt_from_shaper(tm_system_t *tm_system, (shaper_action == DECR_COMMIT)) shaper_obj->commit_cnt -= tkn_count; - if (shaper_params->peak_rate != 0) + if (shaper_params->dual_rate) if ((shaper_action == DECR_BOTH) || (shaper_action == DECR_PEAK)) shaper_obj->peak_cnt -= tkn_count; @@ -1083,7 +1083,7 @@ static odp_bool_t run_shaper(tm_system_t *tm_system, if (shaper_params->enabled) { if (0 < shaper_obj->commit_cnt) shaper_color = ODP_TM_SHAPER_GREEN; - else if (shaper_params->peak_rate == 0) + else if (!shaper_params->dual_rate) shaper_color = ODP_TM_SHAPER_RED; else if (shaper_obj->peak_cnt <= 0) shaper_color = ODP_TM_SHAPER_RED; |