@@ -1215,7 +1215,13 @@ struct nix_inline_ipsec_lf_cfg {
struct nix_hw_info {
struct mbox_msghdr hdr;
uint16_t __io vwqe_delay;
- uint16_t __io rsvd[15];
+ uint16_t __io max_mtu;
+ uint16_t __io min_mtu;
+ uint32_t __io rpm_dwrr_mtu;
+ uint32_t __io sdp_dwrr_mtu;
+ uint32_t __io lbk_dwrr_mtu;
+ uint32_t __io rsvd32[1];
+ uint64_t __io rsvd[15]; /* Add reserved fields for future expansion */
};
struct nix_bandprof_alloc_req {
@@ -303,8 +303,15 @@ roc_nix_get_hw_info(struct roc_nix *roc_nix)
mbox_alloc_msg_nix_get_hw_info(mbox);
rc = mbox_process_msg(mbox, (void *)&hw_info);
- if (rc == 0)
+ if (rc == 0) {
nix->vwqe_interval = hw_info->vwqe_delay;
+ if (nix->lbk_link)
+ roc_nix->dwrr_mtu = hw_info->lbk_dwrr_mtu;
+ else if (nix->sdp_link)
+ roc_nix->dwrr_mtu = hw_info->sdp_dwrr_mtu;
+ else
+ roc_nix->dwrr_mtu = hw_info->rpm_dwrr_mtu;
+ }
return rc;
}
@@ -422,6 +422,7 @@ struct roc_nix {
uint32_t ipsec_in_min_spi;
uint32_t ipsec_in_max_spi;
uint32_t ipsec_out_max_sa;
+ uint32_t dwrr_mtu;
bool ipsec_out_sso_pffunc;
bool custom_sa_action;
/* End of input parameters */
@@ -256,10 +256,6 @@ nix_tm_node_add(struct roc_nix *roc_nix, struct nix_tm_node *node)
if (node->weight > roc_nix_tm_max_sched_wt_get())
return NIX_ERR_TM_WEIGHT_EXCEED;
- /* Maintain minimum weight */
- if (!node->weight)
- node->weight = 1;
-
node->hw_lvl = nix_tm_lvl2nix(nix, lvl);
node->rr_prio = 0xF;
node->max_prio = UINT32_MAX;
@@ -1358,7 +1354,11 @@ nix_tm_prepare_default_tree(struct roc_nix *roc_nix)
node->id = nonleaf_id;
node->parent_id = parent;
node->priority = 0;
- node->weight = NIX_TM_DFLT_RR_WT;
+ /* Default VF root RR_QUANTUM is in sync with kernel */
+ if (lvl == ROC_TM_LVL_ROOT && !nix_tm_have_tl1_access(nix))
+ node->weight = 0;
+ else
+ node->weight = NIX_TM_DFLT_RR_WT;
node->shaper_profile_id = ROC_NIX_TM_SHAPER_PROFILE_NONE;
node->lvl = lvl;
node->tree = ROC_NIX_TM_DEFAULT;
@@ -644,9 +644,25 @@ nix_tm_topology_reg_prep(struct nix *nix, struct nix_tm_node *node,
return k;
}
+static inline int
+nix_tm_default_rr_weight(struct nix *nix)
+{
+ struct roc_nix *roc_nix = nix_priv_to_roc_nix(nix);
+ uint32_t max_pktlen = roc_nix_max_pkt_len(roc_nix);
+ uint32_t weight;
+
+ /* Reduce TX VTAG Insertions */
+ max_pktlen -= 8;
+ weight = max_pktlen / roc_nix->dwrr_mtu;
+ if (max_pktlen % roc_nix->dwrr_mtu)
+ weight += 1;
+
+ return weight;
+}
+
uint8_t
-nix_tm_sched_reg_prep(struct nix *nix, struct nix_tm_node *node,
- volatile uint64_t *reg, volatile uint64_t *regval)
+nix_tm_sched_reg_prep(struct nix *nix, struct nix_tm_node *node, volatile uint64_t *reg,
+ volatile uint64_t *regval)
{
uint64_t strict_prio = node->priority;
uint32_t hw_lvl = node->hw_lvl;
@@ -654,8 +670,14 @@ nix_tm_sched_reg_prep(struct nix *nix, struct nix_tm_node *node,
uint64_t rr_quantum;
uint8_t k = 0;
- /* For CN9K, weight needs to be converted to quantum */
- rr_quantum = nix_tm_weight_to_rr_quantum(node->weight);
+ /* If minimum weight not provided, then by default RR_QUANTUM
+ * should be in sync with kernel, i.e., single MTU value
+ */
+ if (!node->weight)
+ rr_quantum = nix_tm_default_rr_weight(nix);
+ else
+ /* For CN9K, weight needs to be converted to quantum */
+ rr_quantum = nix_tm_weight_to_rr_quantum(node->weight);
/* For children to root, strict prio is default if either
* device root is TL2 or TL1 Static Priority is disabled.
@@ -666,8 +688,8 @@ nix_tm_sched_reg_prep(struct nix *nix, struct nix_tm_node *node,
plt_tm_dbg("Schedule config node %s(%u) lvl %u id %u, "
"prio 0x%" PRIx64 ", rr_quantum/rr_wt 0x%" PRIx64 " (%p)",
- nix_tm_hwlvl2str(node->hw_lvl), schq, node->lvl, node->id,
- strict_prio, rr_quantum, node);
+ nix_tm_hwlvl2str(node->hw_lvl), schq, node->lvl, node->id, strict_prio,
+ rr_quantum, node);
switch (hw_lvl) {
case NIX_TXSCH_LVL_SMQ: