Commit 9c6f7878 authored by Jacob Keller's avatar Jacob Keller Committed by Tony Nguyen

ice: introduce VF operations structure for reset flows

The ice driver currently supports virtualization using Single Root IOV,
with code in the ice_sriov.c file. In the future, we plan to also
implement support for Scalable IOV, which uses slightly different
hardware implementations for some functionality.

To eventually allow this, we introduce a new ice_vf_ops structure which
will contain the basic operations that are different between the two IOV
implementations. This primarily includes logic for how to handle the VF
reset registers, as well as what to do before and after rebuilding the
VF's VSI.

Implement these ops structures and call the ops table instead of
directly calling the SR-IOV specific function. This will allow us to
easily add the Scalable IOV implementation in the future. Additionally,
it helps separate the generalized VF logic from SR-IOV specifics. This
change allows us to move the reset logic out of ice_sriov.c and into
ice_vf_lib.c without placing any Single Root specific details into the
generic file.
Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Tested-by: default avatarKonrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent f5840e0d
This diff is collapsed.
...@@ -56,9 +56,7 @@ static void ice_release_vf(struct kref *ref) ...@@ -56,9 +56,7 @@ static void ice_release_vf(struct kref *ref)
{ {
struct ice_vf *vf = container_of(ref, struct ice_vf, refcnt); struct ice_vf *vf = container_of(ref, struct ice_vf, refcnt);
mutex_destroy(&vf->cfg_lock); vf->vf_ops->free(vf);
kfree_rcu(vf, rcu);
} }
/** /**
......
...@@ -52,6 +52,18 @@ struct ice_mdd_vf_events { ...@@ -52,6 +52,18 @@ struct ice_mdd_vf_events {
u16 last_printed; u16 last_printed;
}; };
/* VF operations */
struct ice_vf_ops {
enum ice_disq_rst_src reset_type;
void (*free)(struct ice_vf *vf);
void (*clear_mbx_register)(struct ice_vf *vf);
void (*trigger_reset_register)(struct ice_vf *vf, bool is_vflr);
bool (*poll_reset_status)(struct ice_vf *vf);
void (*clear_reset_trigger)(struct ice_vf *vf);
int (*vsi_rebuild)(struct ice_vf *vf);
void (*post_vsi_rebuild)(struct ice_vf *vf);
};
/* Virtchnl/SR-IOV config info */ /* Virtchnl/SR-IOV config info */
struct ice_vfs { struct ice_vfs {
DECLARE_HASHTABLE(table, 8); /* table of VF entries */ DECLARE_HASHTABLE(table, 8); /* table of VF entries */
...@@ -115,6 +127,7 @@ struct ice_vf { ...@@ -115,6 +127,7 @@ struct ice_vf {
struct ice_repr *repr; struct ice_repr *repr;
const struct ice_virtchnl_ops *virtchnl_ops; const struct ice_virtchnl_ops *virtchnl_ops;
const struct ice_vf_ops *vf_ops;
/* devlink port data */ /* devlink port data */
struct devlink_port devlink_port; struct devlink_port devlink_port;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment