diff mbox series

[v8,14/16] lpfc: vmid: Adding qfpa and vmid timeout check in worker thread

Message ID 1614835646-16217-15-git-send-email-muneendra.kumar@broadcom.com (mailing list archive)
State Changes Requested
Headers show
Series blkcg:Support to track FC storage blk io traffic | expand

Commit Message

Muneendra Kumar M March 4, 2021, 5:27 a.m. UTC
From: Gaurav Srivastava <gaurav.srivastava@broadcom.com>

This patch add the periodic check for issuing of qfpa command and vmid
timeout in the worker thread. The inactivity timeout check is added via
the timer function.

Signed-off-by: Gaurav Srivastava  <gaurav.srivastava@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>

---
v8:
checked the function return value

v7:
No change

v6:
Added Forward declarations and removed unused variable

v5:
No change

v4:
No change

v3:
No change

v2:
Ported the patch on top of 5.10/scsi-queue
---
 drivers/scsi/lpfc/lpfc_hbadisc.c | 43 ++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

Comments

Hannes Reinecke March 4, 2021, 12:47 p.m. UTC | #1
On 3/4/21 6:27 AM, Muneendra wrote:
> From: Gaurav Srivastava <gaurav.srivastava@broadcom.com>
> 
> This patch add the periodic check for issuing of qfpa command and vmid
> timeout in the worker thread. The inactivity timeout check is added via
> the timer function.
> 
> Signed-off-by: Gaurav Srivastava  <gaurav.srivastava@broadcom.com>
> Signed-off-by: James Smart <jsmart2021@gmail.com>
> 
> ---
> v8:
> checked the function return value
> 
> v7:
> No change
> 
> v6:
> Added Forward declarations and removed unused variable
> 
> v5:
> No change
> 
> v4:
> No change
> 
> v3:
> No change
> 
> v2:
> Ported the patch on top of 5.10/scsi-queue
> ---
>   drivers/scsi/lpfc/lpfc_hbadisc.c | 43 ++++++++++++++++++++++++++++++++
>   1 file changed, 43 insertions(+)
> 
> diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
> index c4519f6349bc..c807302a782d 100644
> --- a/drivers/scsi/lpfc/lpfc_hbadisc.c
> +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
> @@ -73,6 +73,7 @@ static void lpfc_unregister_fcfi_cmpl(struct lpfc_hba *, LPFC_MBOXQ_t *);
>   static int lpfc_fcf_inuse(struct lpfc_hba *);
>   static void lpfc_mbx_cmpl_read_sparam(struct lpfc_hba *, LPFC_MBOXQ_t *);
>   static void lpfc_check_inactive_vmid(struct lpfc_hba *phba);
> +static void lpfc_check_vmid_qfpa_issue(struct lpfc_hba *phba);
>   
>   static int
>   lpfc_valid_xpt_node(struct lpfc_nodelist *ndlp)
> @@ -439,6 +440,32 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp)
>   	return fcf_inuse;
>   }
>   
> +static void lpfc_check_vmid_qfpa_issue(struct lpfc_hba *phba)
> +{
> +	struct lpfc_vport *vport;
> +	struct lpfc_vport **vports;
> +	int i;
> +
> +	vports = lpfc_create_vport_work_array(phba);
> +	if (!vports)
> +		return;
> +
> +	for (i = 0; i <= phba->max_vports; i++) {
> +		if ((!vports[i]) && (i == 0))
> +			vport = phba->pport;
> +		else
> +			vport = vports[i];
> +		if (!vport)
> +			break;
> +
> +		if (vport->vmid_flag & LPFC_VMID_ISSUE_QFPA) {
> +			if (!lpfc_issue_els_qfpa(vport))
> +				vport->vmid_flag &= ~LPFC_VMID_ISSUE_QFPA;
> +		}
> +	}
> +	lpfc_destroy_vport_work_array(phba, vports);
> +}
> +
>   /**
>    * lpfc_sli4_post_dev_loss_tmo_handler - SLI4 post devloss timeout handler
>    * @phba: Pointer to hba context object.
> @@ -759,6 +786,22 @@ lpfc_work_done(struct lpfc_hba *phba)
>   	if (ha_copy & HA_LATT)
>   		lpfc_handle_latt(phba);
>   
> +	/* Handle VMID Events */
> +	if (lpfc_is_vmid_enabled(phba)) {
> +		if (phba->pport->work_port_events &
> +		    WORKER_CHECK_VMID_ISSUE_QFPA) {
> +			lpfc_check_vmid_qfpa_issue(phba);
> +			phba->pport->work_port_events &=
> +				~WORKER_CHECK_VMID_ISSUE_QFPA;
> +		}
> +		if (phba->pport->work_port_events &
> +		    WORKER_CHECK_INACTIVE_VMID) {
> +			lpfc_check_inactive_vmid(phba);
> +			phba->pport->work_port_events &=
> +			    ~WORKER_CHECK_INACTIVE_VMID;
> +		}
> +	}
> +
>   	/* Process SLI4 events */
>   	if (phba->pci_dev_grp == LPFC_PCI_DEV_OC) {
>   		if (phba->hba_flag & HBA_RRQ_ACTIVE)
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
diff mbox series

Patch

diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index c4519f6349bc..c807302a782d 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -73,6 +73,7 @@  static void lpfc_unregister_fcfi_cmpl(struct lpfc_hba *, LPFC_MBOXQ_t *);
 static int lpfc_fcf_inuse(struct lpfc_hba *);
 static void lpfc_mbx_cmpl_read_sparam(struct lpfc_hba *, LPFC_MBOXQ_t *);
 static void lpfc_check_inactive_vmid(struct lpfc_hba *phba);
+static void lpfc_check_vmid_qfpa_issue(struct lpfc_hba *phba);
 
 static int
 lpfc_valid_xpt_node(struct lpfc_nodelist *ndlp)
@@ -439,6 +440,32 @@  lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp)
 	return fcf_inuse;
 }
 
+static void lpfc_check_vmid_qfpa_issue(struct lpfc_hba *phba)
+{
+	struct lpfc_vport *vport;
+	struct lpfc_vport **vports;
+	int i;
+
+	vports = lpfc_create_vport_work_array(phba);
+	if (!vports)
+		return;
+
+	for (i = 0; i <= phba->max_vports; i++) {
+		if ((!vports[i]) && (i == 0))
+			vport = phba->pport;
+		else
+			vport = vports[i];
+		if (!vport)
+			break;
+
+		if (vport->vmid_flag & LPFC_VMID_ISSUE_QFPA) {
+			if (!lpfc_issue_els_qfpa(vport))
+				vport->vmid_flag &= ~LPFC_VMID_ISSUE_QFPA;
+		}
+	}
+	lpfc_destroy_vport_work_array(phba, vports);
+}
+
 /**
  * lpfc_sli4_post_dev_loss_tmo_handler - SLI4 post devloss timeout handler
  * @phba: Pointer to hba context object.
@@ -759,6 +786,22 @@  lpfc_work_done(struct lpfc_hba *phba)
 	if (ha_copy & HA_LATT)
 		lpfc_handle_latt(phba);
 
+	/* Handle VMID Events */
+	if (lpfc_is_vmid_enabled(phba)) {
+		if (phba->pport->work_port_events &
+		    WORKER_CHECK_VMID_ISSUE_QFPA) {
+			lpfc_check_vmid_qfpa_issue(phba);
+			phba->pport->work_port_events &=
+				~WORKER_CHECK_VMID_ISSUE_QFPA;
+		}
+		if (phba->pport->work_port_events &
+		    WORKER_CHECK_INACTIVE_VMID) {
+			lpfc_check_inactive_vmid(phba);
+			phba->pport->work_port_events &=
+			    ~WORKER_CHECK_INACTIVE_VMID;
+		}
+	}
+
 	/* Process SLI4 events */
 	if (phba->pci_dev_grp == LPFC_PCI_DEV_OC) {
 		if (phba->hba_flag & HBA_RRQ_ACTIVE)