mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-27 04:54:41 +08:00
109aba47ca
Introduce the ice_vf_lib.c file along with the ice_vf_lib.h and ice_vf_lib_private.h header files. These files will house the generic VF structures and access functions. Move struct ice_vf and its dependent definitions into this new header file. The ice_vf_lib.c is compiled conditionally on CONFIG_PCI_IOV. Some of its functionality is required by all driver files. However, some of its functionality will only be required by other files also conditionally compiled based on CONFIG_PCI_IOV. Declaring these functions used only in CONFIG_PCI_IOV files in ice_vf_lib.h is verbose. This is because we must provide a fallback implementation for each function in this header since it is included in files which may not be compiled with CONFIG_PCI_IOV. Instead, introduce a new ice_vf_lib_private.h header which verifies that CONFIG_PCI_IOV is enabled. This header is intended to be directly included in .c files which are CONFIG_PCI_IOV only. Add a #error indication that will complain if the file ever gets included by another C file on a kernel with CONFIG_PCI_IOV disabled. Add a comment indicating the nature of the file and why it is useful. This makes it so that we can easily define functions exposed from ice_vf_lib.c into other virtualization files without needing to add fallback implementations for every single function. This begins the path to separate out generic code which will be reused by other virtualization implementations from ice_sriov.h and ice_sriov.c Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
57 lines
1.5 KiB
C
57 lines
1.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* Copyright (C) 2021, Intel Corporation. */
|
|
|
|
#ifndef _ICE_VIRTCHNL_FDIR_H_
|
|
#define _ICE_VIRTCHNL_FDIR_H_
|
|
|
|
struct ice_vf;
|
|
struct ice_pf;
|
|
struct ice_vsi;
|
|
|
|
enum ice_fdir_ctx_stat {
|
|
ICE_FDIR_CTX_READY,
|
|
ICE_FDIR_CTX_IRQ,
|
|
ICE_FDIR_CTX_TIMEOUT,
|
|
};
|
|
|
|
struct ice_vf_fdir_ctx {
|
|
struct timer_list rx_tmr;
|
|
enum virtchnl_ops v_opcode;
|
|
enum ice_fdir_ctx_stat stat;
|
|
union ice_32b_rx_flex_desc rx_desc;
|
|
#define ICE_VF_FDIR_CTX_VALID BIT(0)
|
|
u32 flags;
|
|
|
|
void *conf;
|
|
};
|
|
|
|
/* VF FDIR information structure */
|
|
struct ice_vf_fdir {
|
|
u16 fdir_fltr_cnt[ICE_FLTR_PTYPE_MAX][ICE_FD_HW_SEG_MAX];
|
|
int prof_entry_cnt[ICE_FLTR_PTYPE_MAX][ICE_FD_HW_SEG_MAX];
|
|
struct ice_fd_hw_prof **fdir_prof;
|
|
|
|
struct idr fdir_rule_idr;
|
|
struct list_head fdir_rule_list;
|
|
|
|
spinlock_t ctx_lock; /* protects FDIR context info */
|
|
struct ice_vf_fdir_ctx ctx_irq;
|
|
struct ice_vf_fdir_ctx ctx_done;
|
|
};
|
|
|
|
#ifdef CONFIG_PCI_IOV
|
|
int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg);
|
|
int ice_vc_del_fdir_fltr(struct ice_vf *vf, u8 *msg);
|
|
void ice_vf_fdir_init(struct ice_vf *vf);
|
|
void ice_vf_fdir_exit(struct ice_vf *vf);
|
|
void
|
|
ice_vc_fdir_irq_handler(struct ice_vsi *ctrl_vsi,
|
|
union ice_32b_rx_flex_desc *rx_desc);
|
|
void ice_flush_fdir_ctx(struct ice_pf *pf);
|
|
#else
|
|
static inline void
|
|
ice_vc_fdir_irq_handler(struct ice_vsi *ctrl_vsi, union ice_32b_rx_flex_desc *rx_desc) { }
|
|
static inline void ice_flush_fdir_ctx(struct ice_pf *pf) { }
|
|
#endif /* CONFIG_PCI_IOV */
|
|
#endif /* _ICE_VIRTCHNL_FDIR_H_ */
|