From patchwork Mon Nov 9 04:23:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 321790 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 416EDC4741F for ; Mon, 9 Nov 2020 11:18:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D6B7920897 for ; Mon, 9 Nov 2020 11:18:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="HfIyR5f2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729482AbgKILSF (ORCPT ); Mon, 9 Nov 2020 06:18:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729506AbgKILSE (ORCPT ); Mon, 9 Nov 2020 06:18:04 -0500 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7089C0613CF for ; Mon, 9 Nov 2020 03:18:04 -0800 (PST) Received: by mail-pg1-x542.google.com with SMTP id h6so6888366pgk.4 for ; Mon, 09 Nov 2020 03:18:04 -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=yESZhZv2oRvUgonXzxmb2a+cf8Q8rI/kybPotwMsxtI=; b=HfIyR5f276kZ28tEJKCl3gUT8lnQ6RDYKkO1/M6k6OoZZJWWgPxNdhOu359mq0i2lK U44adw2MMyfa8xaYbb02P1lEPnyxfa+8/K1nRDQMVIoaujn282BpeqzFIYY4DMu2nKPg rcvSlWfbqlYtXWtNLM03En2Xbu9x4d7TUCvbk= 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=yESZhZv2oRvUgonXzxmb2a+cf8Q8rI/kybPotwMsxtI=; b=DMs1oq3BWyXYPJR3SeCanuHXKe42SzupV5kn5FiX03WUqpO7M/sfQoT4SX5IxqBg2q SL0GCgkCoDPdNaRgp4f/FcyQMG5iTI0Ug6ClFjD1QreUinPLaVfpLzuLF7FJTkZm/ERo OPm6Y6j7EyKbib5zzoKUQBP6jJgQEa42nFK8SVUFk2hpAnOFiweHH+Kln9xQcAV4mY4f +X16IwvEhYU5OFMofVK0T6jwoGJqZfMvszb5GQfTSI+DRP3JeXjQluz6k8wr+RlND8NF YguyzQGbFjR+x395RRd71WX5qBtpX81nSgvNNQdMo3+yi8BYCaW1G3LJQ5wgpPcyFdxG rsWA== X-Gm-Message-State: AOAM533H8PZh//DTvrACC5yrnplxGMK+6LWCqK+Le/OevDk18hjPSLmv vXVAeIfQFh+jfBZut0HfUPEzAazetXc58vQ3 X-Google-Smtp-Source: ABdhPJz67DjUk/8ykAuAAEk5/oqxdaUSRyqIdpdgdDk/EKvGe3p3VPrO4YZljw3iTPvzQx03ydiIgw== X-Received: by 2002:a65:6086:: with SMTP id t6mr12335482pgu.146.1604920684354; Mon, 09 Nov 2020 03:18:04 -0800 (PST) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id k9sm10889364pfp.68.2020.11.09.03.18.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 03:18:03 -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 v4 11/19] lpfc: vmid: cleanup vmid resources Date: Mon, 9 Nov 2020 09:53:57 +0530 Message-Id: <1604895845-2587-12-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1604895845-2587-1-git-send-email-muneendra.kumar@broadcom.com> References: <1604895845-2587-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 --- v4: No change 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