From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 64CF6A0544; Tue, 11 Oct 2022 02:54:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 950BB42BC0; Tue, 11 Oct 2022 02:53:16 +0200 (CEST) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2083.outbound.protection.outlook.com [40.107.212.83]) by mails.dpdk.org (Postfix) with ESMTP id EAD7642BD0 for ; Tue, 11 Oct 2022 02:53:14 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E4TmdP9J+GSPSbKbpPS18vPhalPyuIekiqGfxaaYO4TY65xsIeGE2vpcKUxCt89uPSJzPF6h0I/wpHYA8OWiDxgFdtcTxc7ZLwyP1aChL1UPyKbVFPuQLq3taUcb+eTEPsP1MvhsDzHGIPdIpjTvgSwvd3DonElTANb0PCHkuoSrEswdobaczB6PFQTBkCAM+xUt1T5vJEhwA4CbcVFaIdz2DyD7pw0PAFHWPfYNEFdCxoRkiyjhvg3udGCKN+SNHo/5hBi7xkhBkHOTVVx19G+3Kc9txVGIrOPMw3yc6BYkUyzrX6H/AXXPcqTxqk49PYeDBAcQiLbyyDexbLLrrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QynrXYAKqSJX6nAqGkgksxzCmA5AMFNLEBBUYxorZeQ=; b=JLBNO/CvvN3kdes0l7hmRmwcfFoNSbIiFqr1AeF16APENIFgMMW4Vm7ZNiuK874yUcBPFKg9DYwx85nuRHWCyg94rDN0XqSJIXQAeAGSvqRC7yGwLgoenrrsv1x4XIc9wjAejiyKswfY+3Hw8UWgWfr8QNuWJa7lT0APF1qbcw3NC87j9Zzvd4fstM2rNWPQhtABUpW/v6wy2Q8nORhVDIxW87Hss/WSCJyXxfTXRuKcojeBTSwBzewtL4F3uaB49tA3hXnsrlu9Kq3PfYSjhfOzqpefRm8rkQAiAt3wVqjYQwAxV0NO4jdqgweML51PK1F89fJEiQ2fgmaF4GW58A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=dpdk.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QynrXYAKqSJX6nAqGkgksxzCmA5AMFNLEBBUYxorZeQ=; b=YzKrNY+27jme06045O72za1IbrkCLrEA/nxbwzdmNhAHqlgPGv7neK8IVsFQeq4v9lJMFm+2GEFrwOv3O+90syiSx+L5221i/Bih/ywuoOsZZaQnyadQFSpVr8RjMASPZ95y+kR+W1hWEf6d/aph14dt5np1qvWvR9jp9wwS+kA= Received: from BN9PR03CA0695.namprd03.prod.outlook.com (2603:10b6:408:ef::10) by BL1PR12MB5364.namprd12.prod.outlook.com (2603:10b6:208:314::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.24; Tue, 11 Oct 2022 00:53:12 +0000 Received: from BN8NAM11FT029.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ef:cafe::6a) by BN9PR03CA0695.outlook.office365.com (2603:10b6:408:ef::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15 via Frontend Transport; Tue, 11 Oct 2022 00:53:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT029.mail.protection.outlook.com (10.13.177.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5709.10 via Frontend Transport; Tue, 11 Oct 2022 00:53:12 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Mon, 10 Oct 2022 19:53:11 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v1 34/35] net/ionic: retry init commands up to five times Date: Mon, 10 Oct 2022 17:50:31 -0700 Message-ID: <20221011005032.47584-35-andrew.boyer@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221007174336.54354-1-andrew.boyer@amd.com> References: <20221007174336.54354-1-andrew.boyer@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT029:EE_|BL1PR12MB5364:EE_ X-MS-Office365-Filtering-Correlation-Id: efbf0f46-26ce-47d0-97e5-08daab22f942 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /L1kKJ5AdpRPSx5CUq0HMl9AGLPmhfs71a4dLw20C3fKLHKiSbg5Y2JYOIWs1PcW1ge1n61Lib/TpK8w5LHP923on7ClNp0FPHp5R6rmYU7pSMJ4uP1xVCPmrQMYnQpiP51exF5+EUnFgzkyMv8pNCDM2lXGbNNmgLjMAXPKnG4qdZ38nF5VI0Gzx6fGA1ofM94rD50OooZQA07lpnnsr6eJ+K/ui0Hu7vISPw/Jq36aDLsnwbTEuNijKcGLvJyjh7OlBg5MyrLV8y7eBB5MYkBiXx9vNELnveeBKmtd1A4+J46uHB2dzrVVDY0fTWoa8QOlLGhETotXlZguK1RCHywgL7dKHlVud5L6ZG55lsiLSMA1NNAkIfol0FF16xHkU8CD2BPCEFQZPtE7cpExEMV9AtVEij6SVh0nS2ja6mE1BsTf2VmV56Fi6RVPxfA5C677FwTl/HRGrilGehDbI/Gv+Ulp0QPhlBD0azUaGb26mGpk43lR/uYDWFLuPU6UCu954VnnT7N+SpTblmTb5owWsDZRwbH5P69a5nIfLxYx8SvBYZXBXYF62U4z1wSOoQKgh7muwNl7A+l8jVWd7ZM3+TgSPXGkpwkoPfENee2VD0y7AP15UJN6wMCTxFHCFqR6Zz5sARpQmjJmz+zQM7bAhOji73rYv6C2D4eXuxz84i4M6l3Q+GtImG5ytdQ5PgseuZ8PFJDjiUr9rdDI4QRJp7kRGbFqvTZqTJZbCyln8RTrAo37kTvYZTLawhHT+P9Y2qSFObbVARspVivbfRKlD8whGrosIBShTZuxrC5iOVaJ1TXOLTWHpnt2H2pS X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(396003)(376002)(136003)(39860400002)(451199015)(40470700004)(36840700001)(46966006)(2906002)(426003)(47076005)(16526019)(40460700003)(83380400001)(336012)(186003)(1076003)(356005)(41300700001)(8936002)(82740400003)(36860700001)(26005)(316002)(2616005)(36756003)(5660300002)(40480700001)(44832011)(4326008)(82310400005)(6916009)(8676002)(478600001)(86362001)(81166007)(70586007)(6666004)(70206006)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2022 00:53:12.5006 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: efbf0f46-26ce-47d0-97e5-08daab22f942 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT029.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5364 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org In some configurations, the FW may return EAGAIN if it is not able to respond to commands immediately. Retry the init commands in this case to prevent errors from reaching the client. Fix up some return-code stuff while here, for clarity. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_dev.h | 1 + drivers/net/ionic/ionic_lif.c | 14 ++++++++++++++ drivers/net/ionic/ionic_main.c | 4 ++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index d696de45e0..4d07d9206e 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -24,6 +24,7 @@ #define IONIC_DEVCMD_TIMEOUT 5 /* devcmd_timeout */ #define IONIC_DEVCMD_CHECK_PERIOD_US 10 /* devcmd status chk period */ +#define IONIC_DEVCMD_RETRY_WAIT_US 20000 #define IONIC_ALIGN 4096 diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 0affdd9dc4..bc6de83d56 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -1423,10 +1423,17 @@ ionic_lif_adminq_init(struct ionic_lif *lif) struct ionic_admin_qcq *aqcq = lif->adminqcq; struct ionic_queue *q = &aqcq->qcq.q; struct ionic_q_init_comp comp; + uint32_t retries = 5; int err; +retry_adminq_init: ionic_dev_cmd_adminq_init(idev, &aqcq->qcq); err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT); + if (err == -EAGAIN && retries > 0) { + retries--; + rte_delay_us_block(IONIC_DEVCMD_RETRY_WAIT_US); + goto retry_adminq_init; + } if (err) return err; @@ -1713,12 +1720,19 @@ ionic_lif_init(struct ionic_lif *lif) { struct ionic_dev *idev = &lif->adapter->idev; struct ionic_lif_init_comp comp; + uint32_t retries = 5; int err; memset(&lif->stats_base, 0, sizeof(lif->stats_base)); +retry_lif_init: ionic_dev_cmd_lif_init(idev, lif->info_pa); err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT); + if (err == -EAGAIN && retries > 0) { + retries--; + rte_delay_us_block(IONIC_DEVCMD_RETRY_WAIT_US); + goto retry_lif_init; + } if (err) return err; diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c index 996af0a51f..3d8157dac3 100644 --- a/drivers/net/ionic/ionic_main.c +++ b/drivers/net/ionic/ionic_main.c @@ -313,10 +313,10 @@ ionic_dev_cmd_check_error(struct ionic_dev *idev) uint8_t status; status = ionic_dev_cmd_status(idev); - if (status == 0) + if (status == IONIC_RC_SUCCESS) return 0; - return -EIO; + return (status == IONIC_RC_EAGAIN) ? -EAGAIN : -EIO; } int -- 2.17.1