]> git.droids-corp.org - dpdk.git/commitdiff
common/cnxk: consider adjust value for TM burst calculation
authorSatha Rao <skoteshwar@marvell.com>
Mon, 1 Nov 2021 07:28:57 +0000 (03:28 -0400)
committerJerin Jacob <jerinj@marvell.com>
Wed, 3 Nov 2021 15:12:29 +0000 (16:12 +0100)
To support lower pps in packet mode we are changing adjust value,
same needs to be consider for burst size calculations.

When both peak and committed rates requested, then peak rate should
be larger than committed rate.

Signed-off-by: Satha Rao <skoteshwar@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
drivers/common/cnxk/roc_nix_tm_ops.c

index 6a417c0c887851d68318ea1afe2cf133b66b7b0f..3257fa67c79ef16ae603e29a5bc30220ce99f168 100644 (file)
@@ -124,6 +124,11 @@ nix_tm_adjust_shaper_pps_rate(struct nix_tm_shaper_profile *profile)
                profile->pkt_mode_adj += adjust;
                profile->commit.rate += (adjust * profile->commit.rate);
                profile->peak.rate += (adjust * profile->peak.rate);
+               /* Number of tokens freed after scheduling was proportional
+                * to adjust value
+                */
+               profile->commit.size *= adjust;
+               profile->peak.size *= adjust;
        }
 
        return 0;
@@ -181,6 +186,10 @@ nix_tm_shaper_profile_add(struct roc_nix *roc_nix,
                        return NIX_ERR_TM_INVALID_PEAK_RATE;
        }
 
+       /* If PIR and CIR are requested, PIR should always be larger than CIR */
+       if (peak_rate && commit_rate && (commit_rate > peak_rate))
+               return NIX_ERR_TM_INVALID_PEAK_RATE;
+
        if (!skip_ins)
                TAILQ_INSERT_TAIL(&nix->shaper_profile_list, profile, shaper);