From patchwork Tue Nov 3 07:18:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 315371 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B4E7C2D0A3 for ; Tue, 3 Nov 2020 14:12:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 19E3822243 for ; Tue, 3 Nov 2020 14:12:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="ayYzWUJi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729594AbgKCOM0 (ORCPT ); Tue, 3 Nov 2020 09:12:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729590AbgKCOM0 (ORCPT ); Tue, 3 Nov 2020 09:12:26 -0500 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C227C0613D1 for ; Tue, 3 Nov 2020 06:12:26 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id 13so14293588pfy.4 for ; Tue, 03 Nov 2020 06:12:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xUVhHko56DiKH7nnv+nrZi563MaWvoG/GXDOrL8t/cY=; b=ayYzWUJipBIBtDhx86BKthEr4UmFWbjOB9H3aN+0gihXNb/3SwbCgTAlUU+XzlDKhU mffABPQgmSpVRgF324elyEfObXNVwJKV0KbYODiLTYmuT0Wxpw/fr6gvkUxYw2oqy1WK hvrfBw6tVV1Cu2ooLNyNBxwzGsHNf1Hx9df+Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xUVhHko56DiKH7nnv+nrZi563MaWvoG/GXDOrL8t/cY=; b=gJLo3C3dE/nURTtPiOClA8yV86/Ha5gHTMaObd/MXgeyRSYLxIUhyl8IKh2o3SSphW I9UCegglGv2aOQyIjbGQAgknvEW6aauf0B3OZ4ieYKBARBZ+tE+1QLcbjLSDyvPhGDHP 0L+//JObi5BtJxiWpQ8rrR4U8v0X6is88gsxnMFP01F64OkwIT6cEDAU2T29WxCvzxI2 1hzrrZeXIU0mRx8nzUBE5OuhdANFVcmC0NBQmx4vtRN3z41C+nTdPFOHiXDFqIFSJqbK wOo9T0sS2j4d1ryJraX2sr3sX3ZUOVJHZ01i2GlSR61olx+sUQlgdJ+AKUIBhnhv1kur Zw8w== X-Gm-Message-State: AOAM530toTaNZDCF53TVRfh8Av70rAq0uUPLO2sGS+1lGIzdoiaBJjqT y1v/mIedmDlX5N8pFHfILOV8+Q== X-Google-Smtp-Source: ABdhPJxBcRy1IzeQYF7vAdLqwng0L4j6+eT2ctGGtkf3R1v+POJ5yTh/zVMARIdFjodWccmN8ylDfw== X-Received: by 2002:a17:90a:62c1:: with SMTP id k1mr4154706pjs.135.1604412745513; Tue, 03 Nov 2020 06:12:25 -0800 (PST) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t19sm3596691pgv.37.2020.11.03.06.12.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2020 06:12:24 -0800 (PST) From: Muneendra To: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, tj@kernel.org, linux-nvme@lists.infradead.org Cc: jsmart2021@gmail.com, emilne@redhat.com, mkumar@redhat.com, pbonzini@redhat.com, Gaurav Srivastava Subject: [PATCH v3 11/19] lpfc: vmid: cleanup vmid resources Date: Tue, 3 Nov 2020 12:48:15 +0530 Message-Id: <1604387903-20006-12-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1604387903-20006-1-git-send-email-muneendra.kumar@broadcom.com> References: <1604387903-20006-1-git-send-email-muneendra.kumar@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Gaurav Srivastava The patch cleans up the vmid resources and stops the timer. Signed-off-by: Gaurav Srivastava Signed-off-by: James Smart --- v3: No change v2: Ported the patch on top of 5.10/scsi-queue --- drivers/scsi/lpfc/lpfc_init.c | 4 ++++ drivers/scsi/lpfc/lpfc_scsi.c | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index e32d69515586..88777875f4b8 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -2843,6 +2843,10 @@ lpfc_cleanup(struct lpfc_vport *vport) if (phba->link_state > LPFC_LINK_DOWN) lpfc_port_link_failure(vport); + /* cleanup vmid resources */ + if (lpfc_is_vmid_enabled(phba)) + lpfc_vmid_vport_cleanup(vport); + list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { if (!NLP_CHK_NODE_ACT(ndlp)) { ndlp = lpfc_enable_node(vport, ndlp, diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 5e802c8b22a9..7bc1fd69b715 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -4711,6 +4711,27 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd) return 0; } +/* + * lpfc_vmid_vport_cleanup - cleans up the resources associated with a vports + * @vport: The virtual port for which this call is being executed. + */ +void lpfc_vmid_vport_cleanup(struct lpfc_vport *vport) +{ + /* delete the timer */ + if (vport->port_type == LPFC_PHYSICAL_PORT) + del_timer_sync(&vport->phba->inactive_vmid_poll); + + /* free the resources */ + kfree(vport->qfpa_res); + kfree(vport->vmid_priority.vmid_range); + kfree(vport->vmid); + + /* reset variables */ + vport->qfpa_res = NULL; + vport->vmid_priority.vmid_range = NULL; + vport->vmid = NULL; + vport->cur_vmid_cnt = 0; +} /** * lpfc_abort_handler - scsi_host_template eh_abort_handler entry point