Lines Matching refs:group
79 static u32 sparx5_lg_get_leak_time(struct sparx5 *sparx5, u32 layer, u32 group) in sparx5_lg_get_leak_time() argument
83 value = spx5_rd(sparx5, HSCH_HSCH_TIMER_CFG(layer, group)); in sparx5_lg_get_leak_time()
87 static void sparx5_lg_set_leak_time(struct sparx5 *sparx5, u32 layer, u32 group, in sparx5_lg_set_leak_time() argument
91 HSCH_HSCH_TIMER_CFG(layer, group)); in sparx5_lg_set_leak_time()
94 static u32 sparx5_lg_get_first(struct sparx5 *sparx5, u32 layer, u32 group) in sparx5_lg_get_first() argument
98 value = spx5_rd(sparx5, HSCH_HSCH_LEAK_CFG(layer, group)); in sparx5_lg_get_first()
102 static u32 sparx5_lg_get_next(struct sparx5 *sparx5, u32 layer, u32 group, in sparx5_lg_get_next() argument
112 static u32 sparx5_lg_get_last(struct sparx5 *sparx5, u32 layer, u32 group) in sparx5_lg_get_last() argument
116 itr = sparx5_lg_get_first(sparx5, layer, group); in sparx5_lg_get_last()
119 next = sparx5_lg_get_next(sparx5, layer, group, itr); in sparx5_lg_get_last()
127 static bool sparx5_lg_is_last(struct sparx5 *sparx5, u32 layer, u32 group, in sparx5_lg_is_last() argument
130 return idx == sparx5_lg_get_next(sparx5, layer, group, idx); in sparx5_lg_is_last()
133 static bool sparx5_lg_is_first(struct sparx5 *sparx5, u32 layer, u32 group, in sparx5_lg_is_first() argument
136 return idx == sparx5_lg_get_first(sparx5, layer, group); in sparx5_lg_is_first()
139 static bool sparx5_lg_is_empty(struct sparx5 *sparx5, u32 layer, u32 group) in sparx5_lg_is_empty() argument
141 return sparx5_lg_get_leak_time(sparx5, layer, group) == 0; in sparx5_lg_is_empty()
144 static bool sparx5_lg_is_singular(struct sparx5 *sparx5, u32 layer, u32 group) in sparx5_lg_is_singular() argument
146 if (sparx5_lg_is_empty(sparx5, layer, group)) in sparx5_lg_is_singular()
149 return sparx5_lg_get_first(sparx5, layer, group) == in sparx5_lg_is_singular()
150 sparx5_lg_get_last(sparx5, layer, group); in sparx5_lg_is_singular()
153 static void sparx5_lg_enable(struct sparx5 *sparx5, u32 layer, u32 group, in sparx5_lg_enable() argument
156 sparx5_lg_set_leak_time(sparx5, layer, group, leak_time); in sparx5_lg_enable()
159 static void sparx5_lg_disable(struct sparx5 *sparx5, u32 layer, u32 group) in sparx5_lg_disable() argument
161 sparx5_lg_set_leak_time(sparx5, layer, group, 0); in sparx5_lg_disable()
165 u32 idx, u32 *group) in sparx5_lg_get_group_by_index() argument
180 *group = i; in sparx5_lg_get_group_by_index()
193 static int sparx5_lg_get_group_by_rate(u32 layer, u32 rate, u32 *group) in sparx5_lg_get_group_by_rate() argument
202 *group = i; in sparx5_lg_get_group_by_rate()
210 static int sparx5_lg_get_adjacent(struct sparx5 *sparx5, u32 layer, u32 group, in sparx5_lg_get_adjacent() argument
215 *first = sparx5_lg_get_first(sparx5, layer, group); in sparx5_lg_get_adjacent()
221 *next = sparx5_lg_get_next(sparx5, layer, group, itr); in sparx5_lg_get_adjacent()
236 static int sparx5_lg_conf_set(struct sparx5 *sparx5, u32 layer, u32 group, in sparx5_lg_conf_set() argument
239 u32 leak_time = layers[layer].leak_groups[group].leak_time; in sparx5_lg_conf_set()
242 sparx5_lg_disable(sparx5, layer, group); in sparx5_lg_conf_set()
258 HSCH_HSCH_LEAK_CFG(layer, group)); in sparx5_lg_conf_set()
261 sparx5_lg_enable(sparx5, layer, group, leak_time); in sparx5_lg_conf_set()
266 static int sparx5_lg_del(struct sparx5 *sparx5, u32 layer, u32 group, u32 idx) in sparx5_lg_del() argument
272 WARN_ON(sparx5_lg_get_adjacent(sparx5, layer, group, idx, &prev, &next, in sparx5_lg_del()
275 if (sparx5_lg_is_singular(sparx5, layer, group)) { in sparx5_lg_del()
277 } else if (sparx5_lg_is_last(sparx5, layer, group, idx)) { in sparx5_lg_del()
281 } else if (sparx5_lg_is_first(sparx5, layer, group, idx)) { in sparx5_lg_del()
290 return sparx5_lg_conf_set(sparx5, layer, group, first, idx, next, in sparx5_lg_del()
327 u32 idx, u32 group) in sparx5_shaper_conf_set() argument
351 sparx5_lg_action(sparx5, layer, group, idx); in sparx5_shaper_conf_set()
499 u32 group; in sparx5_tc_tbf_add() local
502 if (sparx5_lg_get_group_by_rate(layer, sh.rate, &group) < 0) { in sparx5_tc_tbf_add()
508 lg = &layers[layer].leak_groups[group]; in sparx5_tc_tbf_add()
522 return sparx5_shaper_conf_set(port, &sh, layer, idx, group); in sparx5_tc_tbf_add()
528 u32 group; in sparx5_tc_tbf_del() local
530 sparx5_lg_get_group_by_index(port->sparx5, layer, idx, &group); in sparx5_tc_tbf_del()
532 return sparx5_shaper_conf_set(port, &sh, layer, idx, group); in sparx5_tc_tbf_del()