diff options
author | Govindarajulu Varadarajan <_govind@gmx.com> | 2014-07-21 17:22:17 +0530 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-07-21 20:22:46 -0700 |
commit | e3e5af33e6d64a36bce1dfd9f599649f539801de (patch) | |
tree | 7c3c462982a83816159bc50007b8a5c803bde135 /drivers/net/ethernet/cisco/enic/enic_clsf.c | |
parent | 1042cab8627a2d11491e8b0dd40c4dda3180285a (diff) |
enic: remove #ifdef CONFIG_RFS_ACCEL around filter structures
This patch removes the #ifdef CONFIG_RFS_ACCEL around the classifier filter
structures. This makes the filter structures available when CONFIG_RFS_ACCEL = n.
Introduce enic_rfs_timer_start() & enic_rfs_timer_stop() to start/stop the
timer. These two functions are nop when CONFIG_RFS_ACCEL = n.
Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/cisco/enic/enic_clsf.c')
-rw-r--r-- | drivers/net/ethernet/cisco/enic/enic_clsf.c | 69 |
1 files changed, 33 insertions, 36 deletions
diff --git a/drivers/net/ethernet/cisco/enic/enic_clsf.c b/drivers/net/ethernet/cisco/enic/enic_clsf.c index bc451baac4cd..ee6acbf02ef0 100644 --- a/drivers/net/ethernet/cisco/enic/enic_clsf.c +++ b/drivers/net/ethernet/cisco/enic/enic_clsf.c @@ -65,37 +65,6 @@ int enic_delfltr(struct enic *enic, u16 filter_id) return ret; } -#ifdef CONFIG_RFS_ACCEL -void enic_flow_may_expire(unsigned long data) -{ - struct enic *enic = (struct enic *)data; - bool res; - int j; - - spin_lock(&enic->rfs_h.lock); - for (j = 0; j < ENIC_CLSF_EXPIRE_COUNT; j++) { - struct hlist_head *hhead; - struct hlist_node *tmp; - struct enic_rfs_fltr_node *n; - - hhead = &enic->rfs_h.ht_head[enic->rfs_h.toclean++]; - hlist_for_each_entry_safe(n, tmp, hhead, node) { - res = rps_may_expire_flow(enic->netdev, n->rq_id, - n->flow_id, n->fltr_id); - if (res) { - res = enic_delfltr(enic, n->fltr_id); - if (unlikely(res)) - continue; - hlist_del(&n->node); - kfree(n); - enic->rfs_h.free++; - } - } - } - spin_unlock(&enic->rfs_h.lock); - mod_timer(&enic->rfs_h.rfs_may_expire, jiffies + HZ/4); -} - /* enic_rfs_flw_tbl_init - initialize enic->rfs_h members * @enic: enic data */ @@ -109,17 +78,14 @@ void enic_rfs_flw_tbl_init(struct enic *enic) enic->rfs_h.max = enic->config.num_arfs; enic->rfs_h.free = enic->rfs_h.max; enic->rfs_h.toclean = 0; - init_timer(&enic->rfs_h.rfs_may_expire); - enic->rfs_h.rfs_may_expire.function = enic_flow_may_expire; - enic->rfs_h.rfs_may_expire.data = (unsigned long)enic; - mod_timer(&enic->rfs_h.rfs_may_expire, jiffies + HZ/4); + enic_rfs_timer_start(enic); } void enic_rfs_flw_tbl_free(struct enic *enic) { int i; - del_timer_sync(&enic->rfs_h.rfs_may_expire); + enic_rfs_timer_stop(enic); spin_lock(&enic->rfs_h.lock); enic->rfs_h.free = 0; for (i = 0; i < (1 << ENIC_RFS_FLW_BITSHIFT); i++) { @@ -137,6 +103,37 @@ void enic_rfs_flw_tbl_free(struct enic *enic) spin_unlock(&enic->rfs_h.lock); } +#ifdef CONFIG_RFS_ACCEL +void enic_flow_may_expire(unsigned long data) +{ + struct enic *enic = (struct enic *)data; + bool res; + int j; + + spin_lock(&enic->rfs_h.lock); + for (j = 0; j < ENIC_CLSF_EXPIRE_COUNT; j++) { + struct hlist_head *hhead; + struct hlist_node *tmp; + struct enic_rfs_fltr_node *n; + + hhead = &enic->rfs_h.ht_head[enic->rfs_h.toclean++]; + hlist_for_each_entry_safe(n, tmp, hhead, node) { + res = rps_may_expire_flow(enic->netdev, n->rq_id, + n->flow_id, n->fltr_id); + if (res) { + res = enic_delfltr(enic, n->fltr_id); + if (unlikely(res)) + continue; + hlist_del(&n->node); + kfree(n); + enic->rfs_h.free++; + } + } + } + spin_unlock(&enic->rfs_h.lock); + mod_timer(&enic->rfs_h.rfs_may_expire, jiffies + HZ/4); +} + static struct enic_rfs_fltr_node *htbl_key_search(struct hlist_head *h, struct flow_keys *k) { |