X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=drivers%2Fcommon%2Fcnxk%2Froc_nix_tm_ops.c;h=5884ce5114fc2ab0497d9bdbb66e521cac632d2e;hb=28b283fa7f7519425c2d26ff9f774c5e5afdf429;hp=eee80d5f0038265c0d4de598cdb37251e066dbf8;hpb=f9dbd4a5b25cfa9b9becd94a5a538dad85ef0a95;p=dpdk.git diff --git a/drivers/common/cnxk/roc_nix_tm_ops.c b/drivers/common/cnxk/roc_nix_tm_ops.c index eee80d5f00..5884ce5114 100644 --- a/drivers/common/cnxk/roc_nix_tm_ops.c +++ b/drivers/common/cnxk/roc_nix_tm_ops.c @@ -38,7 +38,7 @@ roc_nix_tm_sq_aura_fc(struct roc_nix_sq *sq, bool enable) req->aura.fc_ena = enable; req->aura_mask.fc_ena = 1; - if (roc_model_is_cn9k() || roc_model_is_cn10ka_a0()) { + if (roc_model_is_cn9k() || roc_errata_npa_has_no_fc_stype_ststp()) { req->aura.fc_stype = 0x0; /* STF */ req->aura_mask.fc_stype = 0x0; /* STF */ } else { @@ -107,7 +107,7 @@ nix_tm_adjust_shaper_pps_rate(struct nix_tm_shaper_profile *profile) if (profile->peak.rate && min_rate > profile->peak.rate) min_rate = profile->peak.rate; - /* Each packet accomulate single count, whereas HW + /* Each packet accumulate single count, whereas HW * considers each unit as Byte, so we need convert * user pps to bps */ @@ -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; @@ -168,8 +173,8 @@ nix_tm_shaper_profile_add(struct roc_nix *roc_nix, if (commit_rate || commit_sz) { if (commit_sz < min_burst || commit_sz > max_burst) return NIX_ERR_TM_INVALID_COMMIT_SZ; - else if (!nix_tm_shaper_rate_conv(commit_rate, NULL, NULL, - NULL)) + else if (!nix_tm_shaper_rate_conv(commit_rate, NULL, NULL, NULL, + profile->accuracy)) return NIX_ERR_TM_INVALID_COMMIT_RATE; } @@ -177,10 +182,15 @@ nix_tm_shaper_profile_add(struct roc_nix *roc_nix, if (peak_sz || peak_rate) { if (peak_sz < min_burst || peak_sz > max_burst) return NIX_ERR_TM_INVALID_PEAK_SZ; - else if (!nix_tm_shaper_rate_conv(peak_rate, NULL, NULL, NULL)) + else if (!nix_tm_shaper_rate_conv(peak_rate, NULL, NULL, NULL, + profile->accuracy)) 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); @@ -221,6 +231,7 @@ roc_nix_tm_shaper_profile_add(struct roc_nix *roc_nix, profile->pkt_len_adj = roc_profile->pkt_len_adj; profile->pkt_mode = roc_profile->pkt_mode; profile->free_fn = roc_profile->free_fn; + profile->accuracy = roc_profile->accuracy; return nix_tm_shaper_profile_add(roc_nix, profile, 0); } @@ -237,6 +248,8 @@ roc_nix_tm_shaper_profile_update(struct roc_nix *roc_nix, profile->peak.rate = roc_profile->peak_rate; profile->commit.size = roc_profile->commit_sz; profile->peak.size = roc_profile->peak_sz; + profile->pkt_len_adj = roc_profile->pkt_len_adj; + profile->accuracy = roc_profile->accuracy; return nix_tm_shaper_profile_add(roc_nix, profile, 1); } @@ -452,6 +465,21 @@ roc_nix_tm_hierarchy_disable(struct roc_nix *roc_nix) } } + /* Disable backpressure, it will be enabled back if needed on + * hierarchy enable + */ + for (i = 0; i < sq_cnt; i++) { + sq = nix->sqs[i]; + if (!sq) + continue; + + rc = nix_tm_bp_config_set(roc_nix, sq->qid, 0, false); + if (rc && rc != -ENOENT) { + plt_err("Failed to disable backpressure, rc=%d", rc); + goto cleanup; + } + } + /* Flush all tx queues */ for (i = 0; i < sq_cnt; i++) { sq = nix->sqs[i];