11f7ea1cdSQi Zhang /* SPDX-License-Identifier: GPL-2.0 */ 21f7ea1cdSQi Zhang /* Copyright (C) 2021, Intel Corporation. */ 31f7ea1cdSQi Zhang 41f7ea1cdSQi Zhang #ifndef _ICE_VIRTCHNL_FDIR_H_ 51f7ea1cdSQi Zhang #define _ICE_VIRTCHNL_FDIR_H_ 61f7ea1cdSQi Zhang 71f7ea1cdSQi Zhang struct ice_vf; 8d6218317SQi Zhang struct ice_pf; 9109aba47SJacob Keller struct ice_vsi; 10d6218317SQi Zhang 11d6218317SQi Zhang enum ice_fdir_ctx_stat { 12d6218317SQi Zhang ICE_FDIR_CTX_READY, 13d6218317SQi Zhang ICE_FDIR_CTX_IRQ, 14d6218317SQi Zhang ICE_FDIR_CTX_TIMEOUT, 15d6218317SQi Zhang }; 16d6218317SQi Zhang 17d6218317SQi Zhang struct ice_vf_fdir_ctx { 18d6218317SQi Zhang struct timer_list rx_tmr; 19d6218317SQi Zhang enum virtchnl_ops v_opcode; 20d6218317SQi Zhang enum ice_fdir_ctx_stat stat; 21d6218317SQi Zhang union ice_32b_rx_flex_desc rx_desc; 22d6218317SQi Zhang #define ICE_VF_FDIR_CTX_VALID BIT(0) 23d6218317SQi Zhang u32 flags; 24d6218317SQi Zhang 25d6218317SQi Zhang void *conf; 26d6218317SQi Zhang }; 271f7ea1cdSQi Zhang 281f7ea1cdSQi Zhang /* VF FDIR information structure */ 291f7ea1cdSQi Zhang struct ice_vf_fdir { 301f7ea1cdSQi Zhang u16 fdir_fltr_cnt[ICE_FLTR_PTYPE_MAX][ICE_FD_HW_SEG_MAX]; 311f7ea1cdSQi Zhang int prof_entry_cnt[ICE_FLTR_PTYPE_MAX][ICE_FD_HW_SEG_MAX]; 32*d6238907SAhmed Zaki u16 fdir_fltr_cnt_total; 331f7ea1cdSQi Zhang struct ice_fd_hw_prof **fdir_prof; 341f7ea1cdSQi Zhang 351f7ea1cdSQi Zhang struct idr fdir_rule_idr; 361f7ea1cdSQi Zhang struct list_head fdir_rule_list; 37d6218317SQi Zhang 38d6218317SQi Zhang spinlock_t ctx_lock; /* protects FDIR context info */ 39d6218317SQi Zhang struct ice_vf_fdir_ctx ctx_irq; 40d6218317SQi Zhang struct ice_vf_fdir_ctx ctx_done; 411f7ea1cdSQi Zhang }; 421f7ea1cdSQi Zhang 43d6218317SQi Zhang #ifdef CONFIG_PCI_IOV 441f7ea1cdSQi Zhang int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg); 451f7ea1cdSQi Zhang int ice_vc_del_fdir_fltr(struct ice_vf *vf, u8 *msg); 461f7ea1cdSQi Zhang void ice_vf_fdir_init(struct ice_vf *vf); 471f7ea1cdSQi Zhang void ice_vf_fdir_exit(struct ice_vf *vf); 48d6218317SQi Zhang void 49d6218317SQi Zhang ice_vc_fdir_irq_handler(struct ice_vsi *ctrl_vsi, 50d6218317SQi Zhang union ice_32b_rx_flex_desc *rx_desc); 51d6218317SQi Zhang void ice_flush_fdir_ctx(struct ice_pf *pf); 52d6218317SQi Zhang #else 53d6218317SQi Zhang static inline void ice_vc_fdir_irq_handler(struct ice_vsi * ctrl_vsi,union ice_32b_rx_flex_desc * rx_desc)54d6218317SQi Zhangice_vc_fdir_irq_handler(struct ice_vsi *ctrl_vsi, union ice_32b_rx_flex_desc *rx_desc) { } ice_flush_fdir_ctx(struct ice_pf * pf)55d6218317SQi Zhangstatic inline void ice_flush_fdir_ctx(struct ice_pf *pf) { } 56d6218317SQi Zhang #endif /* CONFIG_PCI_IOV */ 571f7ea1cdSQi Zhang #endif /* _ICE_VIRTCHNL_FDIR_H_ */ 58