netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iwl-next v1] ice: change vfs.num_msix_per to vf->num_msix
@ 2023-10-24 14:20 Michal Swiatkowski
  2023-11-03 16:56 ` Simon Horman
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Swiatkowski @ 2023-10-24 14:20 UTC (permalink / raw)
  To: intel-wired-lan
  Cc: netdev, yahui.cao, jacob.e.keller, przemyslaw.kitszel,
	marcin.szycik, Michal Swiatkowski

vfs::num_msix_per should be only used as default value for
vf->num_msix. For other use cases vf->num_msix should be used, as VF can
have different MSI-X amount values.

Fix incorrect register index calculation. vfs::num_msix_per and
pf->sriov_base_vector shouldn't be used after implementation of changing
MSI-X amount on VFs. Instead vf->first_vector_idx should be used, as it
is storing value for first irq index.

Fixes: fe1c5ca2fe76 ("ice: implement num_msix field per VF")
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
---
 drivers/net/ethernet/intel/ice/ice_sriov.c    | 7 +------
 drivers/net/ethernet/intel/ice/ice_virtchnl.c | 5 ++---
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_sriov.c b/drivers/net/ethernet/intel/ice/ice_sriov.c
index 2a5e6616cc0a..e1494f24f661 100644
--- a/drivers/net/ethernet/intel/ice/ice_sriov.c
+++ b/drivers/net/ethernet/intel/ice/ice_sriov.c
@@ -374,16 +374,11 @@ static void ice_ena_vf_mappings(struct ice_vf *vf)
  */
 int ice_calc_vf_reg_idx(struct ice_vf *vf, struct ice_q_vector *q_vector)
 {
-	struct ice_pf *pf;
-
 	if (!vf || !q_vector)
 		return -EINVAL;
 
-	pf = vf->pf;
-
 	/* always add one to account for the OICR being the first MSIX */
-	return pf->sriov_base_vector + pf->vfs.num_msix_per * vf->vf_id +
-		q_vector->v_idx + 1;
+	return vf->first_vector_idx + q_vector->v_idx + 1;
 }
 
 /**
diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl.c b/drivers/net/ethernet/intel/ice/ice_virtchnl.c
index cdf17b1e2f25..5261ba802c36 100644
--- a/drivers/net/ethernet/intel/ice/ice_virtchnl.c
+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl.c
@@ -1523,7 +1523,6 @@ static int ice_vc_cfg_irq_map_msg(struct ice_vf *vf, u8 *msg)
 	u16 num_q_vectors_mapped, vsi_id, vector_id;
 	struct virtchnl_irq_map_info *irqmap_info;
 	struct virtchnl_vector_map *map;
-	struct ice_pf *pf = vf->pf;
 	struct ice_vsi *vsi;
 	int i;
 
@@ -1535,7 +1534,7 @@ static int ice_vc_cfg_irq_map_msg(struct ice_vf *vf, u8 *msg)
 	 * there is actually at least a single VF queue vector mapped
 	 */
 	if (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states) ||
-	    pf->vfs.num_msix_per < num_q_vectors_mapped ||
+	    vf->num_msix < num_q_vectors_mapped ||
 	    !num_q_vectors_mapped) {
 		v_ret = VIRTCHNL_STATUS_ERR_PARAM;
 		goto error_param;
@@ -1557,7 +1556,7 @@ static int ice_vc_cfg_irq_map_msg(struct ice_vf *vf, u8 *msg)
 		/* vector_id is always 0-based for each VF, and can never be
 		 * larger than or equal to the max allowed interrupts per VF
 		 */
-		if (!(vector_id < pf->vfs.num_msix_per) ||
+		if (!(vector_id < vf->num_msix) ||
 		    !ice_vc_isvalid_vsi_id(vf, vsi_id) ||
 		    (!vector_id && (map->rxq_map || map->txq_map))) {
 			v_ret = VIRTCHNL_STATUS_ERR_PARAM;
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH iwl-next v1] ice: change vfs.num_msix_per to vf->num_msix
  2023-10-24 14:20 [PATCH iwl-next v1] ice: change vfs.num_msix_per to vf->num_msix Michal Swiatkowski
@ 2023-11-03 16:56 ` Simon Horman
  2023-11-23 19:21   ` [Intel-wired-lan] " Romanowski, Rafal
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Horman @ 2023-11-03 16:56 UTC (permalink / raw)
  To: Michal Swiatkowski
  Cc: intel-wired-lan, netdev, yahui.cao, jacob.e.keller,
	przemyslaw.kitszel, marcin.szycik

On Tue, Oct 24, 2023 at 04:20:10PM +0200, Michal Swiatkowski wrote:
> vfs::num_msix_per should be only used as default value for
> vf->num_msix. For other use cases vf->num_msix should be used, as VF can
> have different MSI-X amount values.
> 
> Fix incorrect register index calculation. vfs::num_msix_per and
> pf->sriov_base_vector shouldn't be used after implementation of changing
> MSI-X amount on VFs. Instead vf->first_vector_idx should be used, as it
> is storing value for first irq index.
> 
> Fixes: fe1c5ca2fe76 ("ice: implement num_msix field per VF")
> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
> Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>

Reviewed-by: Simon Horman <horms@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [Intel-wired-lan] [PATCH iwl-next v1] ice: change vfs.num_msix_per to vf->num_msix
  2023-11-03 16:56 ` Simon Horman
@ 2023-11-23 19:21   ` Romanowski, Rafal
  0 siblings, 0 replies; 3+ messages in thread
From: Romanowski, Rafal @ 2023-11-23 19:21 UTC (permalink / raw)
  To: Simon Horman, Michal Swiatkowski
  Cc: netdev@vger.kernel.org, Cao, Yahui, marcin.szycik@linux.intel.com,
	intel-wired-lan@lists.osuosl.org, Kitszel, Przemyslaw,
	Keller, Jacob E

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Simon Horman
> Sent: Friday, November 3, 2023 5:57 PM
> To: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> Cc: netdev@vger.kernel.org; Cao, Yahui <yahui.cao@intel.com>;
> marcin.szycik@linux.intel.com; intel-wired-lan@lists.osuosl.org; Kitszel,
> Przemyslaw <przemyslaw.kitszel@intel.com>; Keller, Jacob E
> <jacob.e.keller@intel.com>
> Subject: Re: [Intel-wired-lan] [PATCH iwl-next v1] ice: change
> vfs.num_msix_per to vf->num_msix
> 
> On Tue, Oct 24, 2023 at 04:20:10PM +0200, Michal Swiatkowski wrote:
> > vfs::num_msix_per should be only used as default value for
> > vf->num_msix. For other use cases vf->num_msix should be used, as VF
> > vf->can
> > have different MSI-X amount values.
> >
> > Fix incorrect register index calculation. vfs::num_msix_per and
> > pf->sriov_base_vector shouldn't be used after implementation of
> > pf->changing
> > MSI-X amount on VFs. Instead vf->first_vector_idx should be used, as
> > it is storing value for first irq index.
> >
> > Fixes: fe1c5ca2fe76 ("ice: implement num_msix field per VF")
> > Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
> > Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> 
> Reviewed-by: Simon Horman <horms@kernel.org>
> _______________________________________________
> Intel-wired-lan mailing list
> Intel-wired-lan@osuosl.org
> https://lists.osuosl.org/mailman/listinfo/intel-wired-lan


Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-23 19:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-24 14:20 [PATCH iwl-next v1] ice: change vfs.num_msix_per to vf->num_msix Michal Swiatkowski
2023-11-03 16:56 ` Simon Horman
2023-11-23 19:21   ` [Intel-wired-lan] " Romanowski, Rafal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).