1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2015-2020
5 #include <rte_malloc.h>
7 #include "txgbe_ethdev.h"
10 txgbe_tm_conf_init(struct rte_eth_dev *dev)
12 struct txgbe_tm_conf *tm_conf = TXGBE_DEV_TM_CONF(dev);
14 /* initialize shaper profile list */
15 TAILQ_INIT(&tm_conf->shaper_profile_list);
17 /* initialize node configuration */
19 TAILQ_INIT(&tm_conf->queue_list);
20 TAILQ_INIT(&tm_conf->tc_list);
21 tm_conf->nb_tc_node = 0;
22 tm_conf->nb_queue_node = 0;
23 tm_conf->committed = false;
27 txgbe_tm_conf_uninit(struct rte_eth_dev *dev)
29 struct txgbe_tm_conf *tm_conf = TXGBE_DEV_TM_CONF(dev);
30 struct txgbe_tm_shaper_profile *shaper_profile;
31 struct txgbe_tm_node *tm_node;
33 /* clear node configuration */
34 while ((tm_node = TAILQ_FIRST(&tm_conf->queue_list))) {
35 TAILQ_REMOVE(&tm_conf->queue_list, tm_node, node);
38 tm_conf->nb_queue_node = 0;
39 while ((tm_node = TAILQ_FIRST(&tm_conf->tc_list))) {
40 TAILQ_REMOVE(&tm_conf->tc_list, tm_node, node);
43 tm_conf->nb_tc_node = 0;
45 rte_free(tm_conf->root);
49 /* Remove all shaper profiles */
50 while ((shaper_profile =
51 TAILQ_FIRST(&tm_conf->shaper_profile_list))) {
52 TAILQ_REMOVE(&tm_conf->shaper_profile_list,
53 shaper_profile, node);
54 rte_free(shaper_profile);