Commit a081e115 authored by Casey Leedom's avatar Casey Leedom Committed by David S. Miller

cxgb4: Add flag tc_flower_initialized

Add flag tc_flower_initialized to indicate the
completion if tc flower initialization.
Signed-off-by: default avatarCasey Leedom <leedom@chelsio.com>
Signed-off-by: default avatarGanesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8e326289
...@@ -957,6 +957,7 @@ struct adapter { ...@@ -957,6 +957,7 @@ struct adapter {
struct chcr_stats_debug chcr_stats; struct chcr_stats_debug chcr_stats;
/* TC flower offload */ /* TC flower offload */
bool tc_flower_initialized;
struct rhashtable flower_tbl; struct rhashtable flower_tbl;
struct rhashtable_params flower_ht_params; struct rhashtable_params flower_ht_params;
struct timer_list flower_stats_timer; struct timer_list flower_stats_timer;
......
...@@ -874,6 +874,9 @@ int cxgb4_init_tc_flower(struct adapter *adap) ...@@ -874,6 +874,9 @@ int cxgb4_init_tc_flower(struct adapter *adap)
{ {
int ret; int ret;
if (adap->tc_flower_initialized)
return -EEXIST;
adap->flower_ht_params = cxgb4_tc_flower_ht_params; adap->flower_ht_params = cxgb4_tc_flower_ht_params;
ret = rhashtable_init(&adap->flower_tbl, &adap->flower_ht_params); ret = rhashtable_init(&adap->flower_tbl, &adap->flower_ht_params);
if (ret) if (ret)
...@@ -882,13 +885,18 @@ int cxgb4_init_tc_flower(struct adapter *adap) ...@@ -882,13 +885,18 @@ int cxgb4_init_tc_flower(struct adapter *adap)
INIT_WORK(&adap->flower_stats_work, ch_flower_stats_handler); INIT_WORK(&adap->flower_stats_work, ch_flower_stats_handler);
timer_setup(&adap->flower_stats_timer, ch_flower_stats_cb, 0); timer_setup(&adap->flower_stats_timer, ch_flower_stats_cb, 0);
mod_timer(&adap->flower_stats_timer, jiffies + STATS_CHECK_PERIOD); mod_timer(&adap->flower_stats_timer, jiffies + STATS_CHECK_PERIOD);
adap->tc_flower_initialized = true;
return 0; return 0;
} }
void cxgb4_cleanup_tc_flower(struct adapter *adap) void cxgb4_cleanup_tc_flower(struct adapter *adap)
{ {
if (!adap->tc_flower_initialized)
return;
if (adap->flower_stats_timer.function) if (adap->flower_stats_timer.function)
del_timer_sync(&adap->flower_stats_timer); del_timer_sync(&adap->flower_stats_timer);
cancel_work_sync(&adap->flower_stats_work); cancel_work_sync(&adap->flower_stats_work);
rhashtable_destroy(&adap->flower_tbl); rhashtable_destroy(&adap->flower_tbl);
adap->tc_flower_initialized = false;
} }
...@@ -539,6 +539,9 @@ void t4_cleanup_sched(struct adapter *adap) ...@@ -539,6 +539,9 @@ void t4_cleanup_sched(struct adapter *adap)
struct port_info *pi = netdev2pinfo(adap->port[j]); struct port_info *pi = netdev2pinfo(adap->port[j]);
s = pi->sched_tbl; s = pi->sched_tbl;
if (!s)
continue;
for (i = 0; i < s->sched_size; i++) { for (i = 0; i < s->sched_size; i++) {
struct sched_class *e; struct sched_class *e;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment