Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3263358rwb; Mon, 15 Aug 2022 22:39:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR6pDnoqdRAYJYVG97/5lSLQVPL8cyoVumpxFp3KJxJj83EFcEmzEAnRceEfOtFqtYVHGuA8 X-Received: by 2002:a17:906:9bdd:b0:730:5b04:7298 with SMTP id de29-20020a1709069bdd00b007305b047298mr13008031ejc.180.1660628390581; Mon, 15 Aug 2022 22:39:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660628390; cv=none; d=google.com; s=arc-20160816; b=bvqCiqQ4gwWD+4noMFp+wrfDBPjob49UpDMCGBARk7+2E8njCmt/+alOJlrVL3HKZI Y0FNIy9+gtZDAva2gSdkbQa7QnAzLJt8UnN0GtIF/996uTY/XtoZ7nlsbBGK4LjU0Xud /bLbOw2R3n+Bf8QZzNTB+CKgNYeivHCKO6fZo4E/UOlwnwPJsBwp/WPTkqG5WRg5c+BJ usySCwwB5CnuDgR9BVOBKbCv/m1PdXYleIS4eHWsxNdKFQ1jccANgCojHIgifw7uPKpB NoqHsy8Z3tuyafaURNx65jFoY849mRKyYzROetEvOXb7u+ER9/e1P7q1qihm+7UCUnmN fZtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rmTGpETfUCEkEpx7qzX1mkDknbY2Ybl4MtFyyMCUXVQ=; b=lFQJ79XvGnbpxrWcbuqvh131ovpMZC0t5PXQbq1EuOBJlJZnkoXnQvnTcj6xEQ6b6Y +263Fkk85MQZ81YQKWbas+Iun9kcAe4+ZEtZ9O1mhsbz3kRLuOtM5P/V8QGKyuANgFLS 50IZCQL06If2aqijhlRPx62o9r5FbyCwvlasgeWkI96/sZVVUSCUcC4TDiQPezuLeD98 u71F+In+PybB5ietTEnz2qy91cwTAqtHu0rUOdSUWpz5zWJtZG0xY33aDSPlV4GBlhUI XXoNMtDxmvPULSEx4ke/HoPemMbWA8fQUO+VguB9XTx990A4/OJF0pKJzH8ALQZ5UndT Sw4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AWXbvGYW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y10-20020a1709060a8a00b0073096c2b51csi7477114ejf.543.2022.08.15.22.39.24; Mon, 15 Aug 2022 22:39:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AWXbvGYW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229637AbiHPEd2 (ORCPT + 99 others); Tue, 16 Aug 2022 00:33:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230042AbiHPEcv (ORCPT ); Tue, 16 Aug 2022 00:32:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CCF01665BB; Mon, 15 Aug 2022 13:22:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6429E61072; Mon, 15 Aug 2022 20:22:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65286C433D6; Mon, 15 Aug 2022 20:22:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594977; bh=VjzZqsbaWnZGIyqrjQJ4BBVHwACh7tYen7EsXIv/VEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AWXbvGYW/ioJPk2AJquv8DAo2qtv4/EFLXc/QJKZsftvVLzdDSDn8z0sxQIsF9mVn GOWumVvEdn8CVVp07gibR6EHBm36xD1uCZn4AftLM51pESkB9aosqSjhrpTihhsox7 x01p03ZuMoXSZuHJ5ssOFatmCSZFx1ooL7EGjG8o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.19 0587/1157] scsi: qla2xxx: edif: Add retry for ELS passthrough Date: Mon, 15 Aug 2022 19:59:03 +0200 Message-Id: <20220815180503.143141029@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Quinn Tran [ Upstream commit 0b3f3143d473b489a7aa0779c43bcdb344bd3014 ] Relating to EDIF, when sending IKE message, updating key or deleting key, driver can encounter IOCB queue full. Add additional retries to reduce higher level recovery. Link: https://lore.kernel.org/r/20220607044627.19563-8-njavali@marvell.com Fixes: dd30706e73b7 ("scsi: qla2xxx: edif: Add key update") Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/qla2xxx/qla_edif.c | 52 +++++++++++++++++++++++---------- drivers/scsi/qla2xxx/qla_os.c | 2 +- 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edif.c index c7198f8635c7..06c1252019e1 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -1467,6 +1467,8 @@ qla24xx_check_sadb_avail_slot(struct bsg_job *bsg_job, fc_port_t *fcport, #define QLA_SA_UPDATE_FLAGS_RX_KEY 0x0 #define QLA_SA_UPDATE_FLAGS_TX_KEY 0x2 +#define EDIF_MSLEEP_INTERVAL 100 +#define EDIF_RETRY_COUNT 50 int qla24xx_sadb_update(struct bsg_job *bsg_job) @@ -1479,7 +1481,7 @@ qla24xx_sadb_update(struct bsg_job *bsg_job) struct edif_list_entry *edif_entry = NULL; int found = 0; int rval = 0; - int result = 0; + int result = 0, cnt; struct qla_sa_update_frame sa_frame; struct srb_iocb *iocb_cmd; port_id_t portid; @@ -1720,11 +1722,23 @@ qla24xx_sadb_update(struct bsg_job *bsg_job) sp->done = qla2x00_bsg_job_done; iocb_cmd = &sp->u.iocb_cmd; iocb_cmd->u.sa_update.sa_frame = sa_frame; - + cnt = 0; +retry: rval = qla2x00_start_sp(sp); - if (rval != QLA_SUCCESS) { + switch (rval) { + case QLA_SUCCESS: + break; + case EAGAIN: + msleep(EDIF_MSLEEP_INTERVAL); + cnt++; + if (cnt < EDIF_RETRY_COUNT) + goto retry; + + fallthrough; + default: ql_log(ql_dbg_edif, vha, 0x70e3, - "qla2x00_start_sp failed=%d.\n", rval); + "%s qla2x00_start_sp failed=%d.\n", + __func__, rval); qla2x00_rel_sp(sp); rval = -EIO; @@ -2398,7 +2412,6 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, struct qla_work_evt *e) rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) { - rval = QLA_FUNCTION_FAILED; goto done_free_sp; } @@ -3530,7 +3543,7 @@ int qla_edif_process_els(scsi_qla_host_t *vha, struct bsg_job *bsg_job) fc_port_t *fcport = NULL; struct qla_hw_data *ha = vha->hw; srb_t *sp; - int rval = (DID_ERROR << 16); + int rval = (DID_ERROR << 16), cnt; port_id_t d_id; struct qla_bsg_auth_els_request *p = (struct qla_bsg_auth_els_request *)bsg_job->request; @@ -3625,17 +3638,26 @@ int qla_edif_process_els(scsi_qla_host_t *vha, struct bsg_job *bsg_job) sp->free = qla2x00_bsg_sp_free; sp->done = qla2x00_bsg_job_done; + cnt = 0; +retry: rval = qla2x00_start_sp(sp); - - ql_dbg(ql_dbg_edif, vha, 0x700a, - "%s %s %8phN xchg %x ctlflag %x hdl %x reqlen %xh bsg ptr %p\n", - __func__, sc_to_str(p->e.sub_cmd), fcport->port_name, - p->e.extra_rx_xchg_address, p->e.extra_control_flags, - sp->handle, sp->remap.req.len, bsg_job); - - if (rval != QLA_SUCCESS) { + switch (rval) { + case QLA_SUCCESS: + ql_dbg(ql_dbg_edif, vha, 0x700a, + "%s %s %8phN xchg %x ctlflag %x hdl %x reqlen %xh bsg ptr %p\n", + __func__, sc_to_str(p->e.sub_cmd), fcport->port_name, + p->e.extra_rx_xchg_address, p->e.extra_control_flags, + sp->handle, sp->remap.req.len, bsg_job); + break; + case EAGAIN: + msleep(EDIF_MSLEEP_INTERVAL); + cnt++; + if (cnt < EDIF_RETRY_COUNT) + goto retry; + fallthrough; + default: ql_log(ql_log_warn, vha, 0x700e, - "qla2x00_start_sp failed = %d\n", rval); + "%s qla2x00_start_sp failed = %d\n", __func__, rval); SET_DID_STATUS(bsg_reply->result, DID_IMM_RETRY); rval = -EIO; goto done_free_remap_rsp; diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 73073fb08369..4f3125b826c4 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -5472,7 +5472,7 @@ qla2x00_do_work(struct scsi_qla_host *vha) e->u.fcport.fcport, false); break; case QLA_EVT_SA_REPLACE: - qla24xx_issue_sa_replace_iocb(vha, e); + rc = qla24xx_issue_sa_replace_iocb(vha, e); break; } -- 2.35.1