The ice driver currently communicates firmware VSI numbers to its virtual
functions over virtchnl. For E800 series hardware, the VF driver has no
direct use of the VSI number.

Some older legacy hardware could use the actual VSI number when
communicating directly to firmware via the AdminQ. The E800 hardware does
not allow this, and all communication happens over mailbox to the PF. The
VFs do not have a direct access to the firmware. Additionally, none of the
registers exposed to the VF depend on the VSI number.

Further, the PF is able to lookup the VSI for the VF without using the
number provided by the VF over virtchnl. Thus, there is no reason that the
number provided to the VF must actually be a real VSI number, nor does it
need to be distinct across multiple VFs.

This series modifies the ice driver to send a relative VSI number to the VF
instead of sending the firmware values. This simplifies the interface with
the VF, as the PF can simply validate this relative number. Currently, only
a single VSI is provided to each VF. Thus, a simple static value of 1 is
used. We can easily extend this to use a proper relative index if we enable
multiple VSIs for a VF in the future.

First, a couple of patches cleanup a few places in the code which still use
the VF VSI IDs. Then, the VSI ID logic over virtchnl is changed to use the
static values. Finally, the vf->lan_vsi_num field is no longer used and only
set, so we can simplify the driver further by removing this entirely.

This eliminates a path for leaking information about the PF state to the VF,
and simplifies the PF driver logic. Several of the removed code flows
required an iterated scan over the VSI list to locate the VSI with the
reported VSI number.

Finally, this has significant value for a future series implementing VF live
migration. Now that the PF always passes relative VSI indexes, migration
will no longer need to worry about migrating the absolute VSI numbers sent
previously, which will simplify both the migration process as well as
continued handling of a migrated VF after a migration event completes.

Jacob Keller (4):
  ice: pass VSI pointer into ice_vc_isvalid_q_id
  ice: remove unnecessary duplicate checks for VF VSI ID
  ice: use relative VSI index for VFs instead of PF VSI number
  ice: remove vf->lan_vsi_num field

 drivers/net/ethernet/intel/ice/ice_sriov.c    |  1 -
 drivers/net/ethernet/intel/ice/ice_vf_lib.c   | 10 +-----
 drivers/net/ethernet/intel/ice/ice_vf_lib.h   |  5 ---
 drivers/net/ethernet/intel/ice/ice_virtchnl.c | 31 +++++++------------
 drivers/net/ethernet/intel/ice/ice_virtchnl.h |  9 ++++++
 .../ethernet/intel/ice/ice_virtchnl_fdir.c    |  3 --
 6 files changed, 22 insertions(+), 37 deletions(-)


base-commit: 6cffde791c4f1c276fdfcf068554c3c77de35f40
-- 
2.41.0

Reply via email to