Skip to content

Commit a081e11

Browse files
Casey Leedomdavem330
authored andcommitted
cxgb4: Add flag tc_flower_initialized
Add flag tc_flower_initialized to indicate the completion if tc flower initialization. Signed-off-by: Casey Leedom <leedom@chelsio.com> Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 8e32628 commit a081e11

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

drivers/net/ethernet/chelsio/cxgb4/cxgb4.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,7 @@ struct adapter {
957957
struct chcr_stats_debug chcr_stats;
958958

959959
/* TC flower offload */
960+
bool tc_flower_initialized;
960961
struct rhashtable flower_tbl;
961962
struct rhashtable_params flower_ht_params;
962963
struct timer_list flower_stats_timer;

drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,9 @@ int cxgb4_init_tc_flower(struct adapter *adap)
874874
{
875875
int ret;
876876

877+
if (adap->tc_flower_initialized)
878+
return -EEXIST;
879+
877880
adap->flower_ht_params = cxgb4_tc_flower_ht_params;
878881
ret = rhashtable_init(&adap->flower_tbl, &adap->flower_ht_params);
879882
if (ret)
@@ -882,13 +885,18 @@ int cxgb4_init_tc_flower(struct adapter *adap)
882885
INIT_WORK(&adap->flower_stats_work, ch_flower_stats_handler);
883886
timer_setup(&adap->flower_stats_timer, ch_flower_stats_cb, 0);
884887
mod_timer(&adap->flower_stats_timer, jiffies + STATS_CHECK_PERIOD);
888+
adap->tc_flower_initialized = true;
885889
return 0;
886890
}
887891

888892
void cxgb4_cleanup_tc_flower(struct adapter *adap)
889893
{
894+
if (!adap->tc_flower_initialized)
895+
return;
896+
890897
if (adap->flower_stats_timer.function)
891898
del_timer_sync(&adap->flower_stats_timer);
892899
cancel_work_sync(&adap->flower_stats_work);
893900
rhashtable_destroy(&adap->flower_tbl);
901+
adap->tc_flower_initialized = false;
894902
}

drivers/net/ethernet/chelsio/cxgb4/sched.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,9 @@ void t4_cleanup_sched(struct adapter *adap)
539539
struct port_info *pi = netdev2pinfo(adap->port[j]);
540540

541541
s = pi->sched_tbl;
542+
if (!s)
543+
continue;
544+
542545
for (i = 0; i < s->sched_size; i++) {
543546
struct sched_class *e;
544547

0 commit comments

Comments
 (0)