1. Mar 05, 2024
    • Jacob Keller's avatar
      ice: remove vf->lan_vsi_num field · 1cf94cbf
      Jacob Keller authored
      
      
      The lan_vsi_num field of the VF structure is no longer used for any
      purpose. Remove it.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Tested-by: default avatarRafal Romanowski <rafal.romanowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      1cf94cbf
    • Jacob Keller's avatar
      ice: use relative VSI index for VFs instead of PF VSI number · 11fbb1bf
      Jacob Keller authored
      
      
      When initializing over virtchnl, the PF is required to pass a VSI ID to the
      VF as part of its capabilities exchange. The VF driver reports this value
      back to the PF in a variety of commands. The PF driver validates that this
      value matches the value it sent to the VF.
      
      Some hardware families such as the E700 series could use this value when
      reading RSS registers or communicating directly with firmware over the
      Admin Queue.
      
      However, E800 series hardware does not support any of these interfaces and
      the VF's only use for this value is to report it back to the PF. Thus,
      there is no requirement that this value be an actual VSI ID value of any
      kind.
      
      The PF driver already does not trust that the VF sends it a real VSI ID.
      The VSI structure is always looked up from the VF structure. The PF does
      validate that the VSI ID provided matches a VSI associated with the VF, but
      otherwise does not use the VSI ID for any purpose.
      
      Instead of reporting the VSI number relative to the PF space, report a
      fixed value of 1. When communicating with the VF over virtchnl, validate
      that the VSI number is returned appropriately.
      
      This avoids leaking information about the firmware of the PF state.
      Currently the ice driver only supplies a VF with a single VSI. However, it
      appears that virtchnl has some support for allowing multiple VSIs. I did
      not attempt to implement this. However, space is left open to allow further
      relative indexes if additional VSIs are provided in future feature
      development. For this reason, keep the ice_vc_isvalid_vsi_id function in
      place to allow extending it for multiple VSIs in the future.
      
      This change will also simplify handling of live migration in a future
      series. Since we no longer will provide a real VSI number to the VF, there
      will be no need to keep track of this number when migrating to a new host.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Tested-by: default avatarRafal Romanowski <rafal.romanowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      11fbb1bf
    • Jacob Keller's avatar
      ice: remove unnecessary duplicate checks for VF VSI ID · 363f6896
      Jacob Keller authored
      
      
      The ice_vc_fdir_param_check() function validates that the VSI ID of the
      virtchnl flow director command matches the VSI number of the VF. This is
      already checked by the call to ice_vc_isvalid_vsi_id() immediately
      following this.
      
      This check is unnecessary since ice_vc_isvalid_vsi_id() already confirms
      this by checking that the VSI ID can locate the VSI associated with the VF
      structure.
      
      Furthermore, a following change is going to refactor the ice driver to
      report VSI IDs using a relative index for each VF instead of reporting the
      PF VSI number. This additional check would break that logic since it
      enforces that the VSI ID matches the VSI number.
      
      Since this check duplicates  the logic in ice_vc_isvalid_vsi_id() and gets
      in the way of refactoring that logic, remove it.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Tested-by: default avatarRafal Romanowski <rafal.romanowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      363f6896
    • Jacob Keller's avatar
      ice: pass VSI pointer into ice_vc_isvalid_q_id · a2160599
      Jacob Keller authored
      
      
      The ice_vc_isvalid_q_id() function takes a VSI index and a queue ID. It
      looks up the VSI from its index, and then validates that the queue number
      is valid for that VSI.
      
      The VSI ID passed is typically a VSI index from the VF. This VSI number is
      validated by the PF to ensure that it matches the VSI associated with the
      VF already.
      
      In every flow where ice_vc_isvalid_q_id() is called, the PF driver already
      has a pointer to the VSI associated with the VF. This pointer is obtained
      using ice_get_vf_vsi(), rather than looking up the VSI using the index sent
      by the VF.
      
      Since we already know which VSI to operate on, we can modify
      ice_vc_isvalid_q_id() to take a VSI pointer instead of a VSI index. Pass
      the VSI we found from ice_get_vf_vsi() instead of re-doing the lookup. This
      removes some unnecessary computation and scanning of the VSI list.
      
      It also removes the last place where the driver directly used the VSI
      number from the VF. This will pave the way for refactoring to communicate
      relative VSI numbers to the VF instead of absolute numbers from the PF
      space.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Tested-by: default avatarRafal Romanowski <rafal.romanowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      a2160599
  2. Mar 04, 2024