for (;;) {
next = sparx5_sdlb_group_get_next(sparx5, group, itr); if (itr == next) return count;
itr = next;
count++;
}
}
int sparx5_sdlb_group_get_by_rate(struct sparx5 *sparx5, u32 rate, u32 burst)
{ conststruct sparx5_ops *ops = sparx5->data->ops; conststruct sparx5_sdlb_group *group;
u64 rate_bps; int i, count;
rate_bps = rate * 1000;
for (i = sparx5->data->consts->n_lb_groups - 1; i >= 0; i--) {
group = ops->get_sdlb_group(i);
count = sparx5_sdlb_group_get_count(sparx5, i);
/* Check that this group is not full. * According to LB group configuration rules: the number of XLBs * in a group must not exceed PUP_INTERVAL/4 - 1.
*/ if (count > ((group->pup_interval / 4) - 1)) continue;
if (rate_bps < group->max_rate) return i;
}
return -ENOSPC;
}
int sparx5_sdlb_group_get_by_index(struct sparx5 *sparx5, u32 idx, u32 *group)
{
u32 itr, next; int i;
for (i = 0; i < sparx5->data->consts->n_lb_groups; i++) { if (sparx5_sdlb_group_is_empty(sparx5, i)) continue;
itr = sparx5_sdlb_group_get_first(sparx5, i);
for (;;) {
next = sparx5_sdlb_group_get_next(sparx5, i, itr);
if (itr == idx) {
*group = i; return 0; /* Found it */
} if (itr == next) break; /* Was not found */
/* Link insertion lb to next lb */
spx5_wr(ANA_AC_SDLB_XLB_NEXT_LBSET_NEXT_SET(next) |
ANA_AC_SDLB_XLB_NEXT_LBGRP_SET(group),
sparx5, ANA_AC_SDLB_XLB_NEXT(idx));
/* Set the first lb */
spx5_wr(ANA_AC_SDLB_XLB_START_LBSET_START_SET(first), sparx5,
ANA_AC_SDLB_XLB_START(group));
if (sparx5_sdlb_group_get_adjacent(sparx5, group, idx, &prev, &next,
&first) < 0) {
pr_err("%s:%d Could not find idx: %d in group: %d", __func__,
__LINE__, idx, group); return -EINVAL;
}
if (sparx5_sdlb_group_is_singular(sparx5, group)) {
empty = true;
} elseif (sparx5_sdlb_group_is_last(sparx5, group, idx)) { /* idx is removed, prev is now last */
idx = prev;
next = prev;
} elseif (sparx5_sdlb_group_is_first(sparx5, group, idx)) { /* idx is removed and points to itself, first is next */
first = next;
next = idx;
} else { /* Next is not touched */
idx = prev;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.