162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef _ENIC_CLSF_H_
362306a36Sopenharmony_ci#define _ENIC_CLSF_H_
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include "vnic_dev.h"
662306a36Sopenharmony_ci#include "enic.h"
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#define ENIC_CLSF_EXPIRE_COUNT 128
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ciint enic_addfltr_5t(struct enic *enic, struct flow_keys *keys, u16 rq);
1162306a36Sopenharmony_ciint enic_delfltr(struct enic *enic, u16 filter_id);
1262306a36Sopenharmony_civoid enic_rfs_flw_tbl_init(struct enic *enic);
1362306a36Sopenharmony_civoid enic_rfs_flw_tbl_free(struct enic *enic);
1462306a36Sopenharmony_cistruct enic_rfs_fltr_node *htbl_fltr_search(struct enic *enic, u16 fltr_id);
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#ifdef CONFIG_RFS_ACCEL
1762306a36Sopenharmony_ciint enic_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
1862306a36Sopenharmony_ci		       u16 rxq_index, u32 flow_id);
1962306a36Sopenharmony_civoid enic_flow_may_expire(struct timer_list *t);
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_cistatic inline void enic_rfs_timer_start(struct enic *enic)
2262306a36Sopenharmony_ci{
2362306a36Sopenharmony_ci	timer_setup(&enic->rfs_h.rfs_may_expire, enic_flow_may_expire, 0);
2462306a36Sopenharmony_ci	mod_timer(&enic->rfs_h.rfs_may_expire, jiffies + HZ/4);
2562306a36Sopenharmony_ci}
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_cistatic inline void enic_rfs_timer_stop(struct enic *enic)
2862306a36Sopenharmony_ci{
2962306a36Sopenharmony_ci	del_timer_sync(&enic->rfs_h.rfs_may_expire);
3062306a36Sopenharmony_ci}
3162306a36Sopenharmony_ci#else
3262306a36Sopenharmony_cistatic inline void enic_rfs_timer_start(struct enic *enic) {}
3362306a36Sopenharmony_cistatic inline void enic_rfs_timer_stop(struct enic *enic) {}
3462306a36Sopenharmony_ci#endif /* CONFIG_RFS_ACCEL */
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci#endif /* _ENIC_CLSF_H_ */
37