diff mbox series

[iwl-next,1/5] i40e: Use existing helper to find flow director VSI

Message ID 20231113125856.346047-2-ivecera@redhat.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series i40e: Simplify VSI and VEB handling | expand

Checks

Context Check Description
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Ivan Vecera Nov. 13, 2023, 12:58 p.m. UTC
Use existing i40e_find_vsi_by_type() to find a VSI
associated with flow director.

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

Comments

Wojciech Drewek Nov. 13, 2023, 1:09 p.m. UTC | #1
On 13.11.2023 13:58, Ivan Vecera wrote:
> Use existing i40e_find_vsi_by_type() to find a VSI
> associated with flow director.
> 
> Signed-off-by: Ivan Vecera <ivecera@redhat.com>
> ---

Thanks Ivan, nice cleanup
Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>

>  drivers/net/ethernet/intel/i40e/i40e_main.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index 51ee870ffa36..90966878333c 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -15645,6 +15645,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  #ifdef CONFIG_I40E_DCB
>  	enum i40e_get_fw_lldp_status_resp lldp_status;
>  #endif /* CONFIG_I40E_DCB */
> +	struct i40e_vsi *vsi;
>  	struct i40e_pf *pf;
>  	struct i40e_hw *hw;
>  	u16 wol_nvm_bits;
> @@ -15655,7 +15656,6 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  #endif /* CONFIG_I40E_DCB */
>  	int err;
>  	u32 val;
> -	u32 i;
>  
>  	err = pci_enable_device_mem(pdev);
>  	if (err)
> @@ -16005,12 +16005,9 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	INIT_LIST_HEAD(&pf->vsi[pf->lan_vsi]->ch_list);
>  
>  	/* if FDIR VSI was set up, start it now */
> -	for (i = 0; i < pf->num_alloc_vsi; i++) {
> -		if (pf->vsi[i] && pf->vsi[i]->type == I40E_VSI_FDIR) {
> -			i40e_vsi_open(pf->vsi[i]);
> -			break;
> -		}
> -	}
> +	vsi = i40e_find_vsi_by_type(pf, I40E_VSI_FDIR);
> +	if (vsi)
> +		i40e_vsi_open(vsi);
>  
>  	/* The driver only wants link up/down and module qualification
>  	 * reports from firmware.  Note the negative logic.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 51ee870ffa36..90966878333c 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -15645,6 +15645,7 @@  static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 #ifdef CONFIG_I40E_DCB
 	enum i40e_get_fw_lldp_status_resp lldp_status;
 #endif /* CONFIG_I40E_DCB */
+	struct i40e_vsi *vsi;
 	struct i40e_pf *pf;
 	struct i40e_hw *hw;
 	u16 wol_nvm_bits;
@@ -15655,7 +15656,6 @@  static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 #endif /* CONFIG_I40E_DCB */
 	int err;
 	u32 val;
-	u32 i;
 
 	err = pci_enable_device_mem(pdev);
 	if (err)
@@ -16005,12 +16005,9 @@  static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	INIT_LIST_HEAD(&pf->vsi[pf->lan_vsi]->ch_list);
 
 	/* if FDIR VSI was set up, start it now */
-	for (i = 0; i < pf->num_alloc_vsi; i++) {
-		if (pf->vsi[i] && pf->vsi[i]->type == I40E_VSI_FDIR) {
-			i40e_vsi_open(pf->vsi[i]);
-			break;
-		}
-	}
+	vsi = i40e_find_vsi_by_type(pf, I40E_VSI_FDIR);
+	if (vsi)
+		i40e_vsi_open(vsi);
 
 	/* The driver only wants link up/down and module qualification
 	 * reports from firmware.  Note the negative logic.