linux/drivers/net/ethernet/intel
Jacob Keller b03d519d34 ice: store VF pointer instead of VF ID
The VSI structure contains a vf_id field used to associate a VSI with a
VF. This is used mainly for ICE_VSI_VF as well as partially for
ICE_VSI_CTRL associated with the VFs.

This API was designed with the idea that VFs are stored in a simple
array that was expected to be static throughout most of the driver's
life.

We plan on refactoring VF storage in a few key ways:

  1) converting from a simple static array to a hash table
  2) using krefs to track VF references obtained from the hash table
  3) use RCU to delay release of VF memory until after all references
     are dropped

This is motivated by the goal to ensure that the lifetime of VF
structures is accounted for, and prevent various use-after-free bugs.

With the existing vsi->vf_id, the reference tracking for VFs would
become somewhat convoluted, because each VSI maintains a vf_id field
which will then require performing a look up. This means all these flows
will require reference tracking and proper usage of rcu_read_lock, etc.

We know that the VF VSI will always be backed by a valid VF structure,
because the VSI is created during VF initialization and removed before
the VF is destroyed. Rely on this and store a reference to the VF in the
VSI structure instead of storing a VF ID. This will simplify the usage
and avoid the need to perform lookups on the hash table in the future.

For ICE_VSI_VF, it is expected that vsi->vf is always non-NULL after
ice_vsi_alloc succeeds. Because of this, use WARN_ON when checking if a
vsi->vf pointer is valid when dealing with VF VSIs. This will aid in
debugging code which violates this assumption and avoid more disastrous
panics.

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>
2022-03-03 08:46:47 -08:00
..
e1000 e1000: switch to napi_build_skb() 2021-12-28 09:42:25 -08:00
e1000e Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-02-03 17:36:16 -08:00
fm10k fm10k: Fix syntax errors in comments 2021-12-21 09:17:47 -08:00
i40e Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-02-24 17:54:25 -08:00
iavf iavf: Remove non-inclusive language 2022-03-01 08:50:11 -08:00
ice ice: store VF pointer instead of VF ID 2022-03-03 08:46:47 -08:00
igb igb: refactor XDP registration 2022-02-07 14:23:01 -08:00
igbvf igbvf: Remove useless DMA-32 fallback configuration 2022-01-27 08:58:24 -08:00
igc igc: avoid kernel warning when changing RX ring parameters 2022-02-07 14:23:01 -08:00
ixgb ixgb: Remove useless DMA-32 fallback configuration 2022-01-27 08:58:23 -08:00
ixgbe ixgbe: Remove non-inclusive language 2022-02-23 09:55:38 -08:00
ixgbevf ixgbevf: clean up some inconsistent indenting 2022-02-23 09:55:38 -08:00
e100.c ethtool: extend ringparam setting/getting API with rx_buf_len 2021-11-22 12:31:49 +00:00
Kconfig ice: support crosstimestamping on E822 devices if supported 2021-12-21 09:11:40 -08:00
Makefile