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 36B7BA0560; Tue, 18 Oct 2022 21:48:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2955642B76; Tue, 18 Oct 2022 21:48:37 +0200 (CEST) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2084.outbound.protection.outlook.com [40.107.102.84]) by mails.dpdk.org (Postfix) with ESMTP id 688C042B7D for ; Tue, 18 Oct 2022 21:48:29 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DE80yPDGCav4XyrcgF7+CQ1S66/AMhf7KyKfSz+igTpmwcdY4zXRLXMSZ+aXN+YgY5c5ea+UHFOs73pdKEviGlfNikNwTV1chumUuc6NvlztrQC5INphfSdNu1eDzZt9Yhg7DR7vLg8am9RWeCpGD6INeb+e0pU57QcYwICgDWVhBHUhl4Rbo8fwwL9yXUTLHSLvYsdG4cx+XzB0V1xlIO6Urel6pmPQcT4AOnL92dpwbtdqk5y5nZjUN0Vzo4R2P7QlMMgZ7bDiVtTRq0dev0M2aagKInW0QtCqf3wTYBZQvpAy73n9j3sOoPzvEz9L5FFD6cZ+YUlU/UbTN587+Q== 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=V4ySZQ97TGRwubuwDJWykwiqnU8ddnnd5c4u4PknZsY=; b=nr6+GumJ3yCy4bEM0Ok22K27GsMBOHRbzwYW9YS+wgajqclVlkL4VgnQg9qUpRtvOIOodIhIim+mgHHGXohEXqYhsdwE9HkZKsmorPgEyXG+OQjp0hKrFLeyD/rlzppKOBmTD1bT2Au6hWDtvuXfalr66qz/1GCwLau3dQkE2jhknXFaiyZBf1BSiYJvKzIMCFSEDRNBwfE03qz9t/UXMsLJ3inlozPhZWBQisYsEB9ujCiHqXfSvHElNRdQuL9rI5ZRPkHvHWMCO5BIP2QUdW7/rKcXcz+9JKaEamHlmKpLi+0Z7fAYjEXLTuWSvBGorS6hkggrLj1KXo789p38Hg== 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=V4ySZQ97TGRwubuwDJWykwiqnU8ddnnd5c4u4PknZsY=; b=ik/sQ9cXzsMpcHT/ZgNFCRpSHb9GG1rG+2t39GVUSy0FWBa+WvBSL96eWEme7Jqdxk7K4KxIB4U5KsJyMJrrFcXLn3QlXfoEUoevxLa5rVgxgd334PMz7oz2SvDV9IjU7whi24SA6v7GOZpCegMyaPQVsotVIQhLpHH8cbAB/EU= Received: from DM6PR04CA0023.namprd04.prod.outlook.com (2603:10b6:5:334::28) by BL3PR12MB6379.namprd12.prod.outlook.com (2603:10b6:208:3b2::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Tue, 18 Oct 2022 19:48:27 +0000 Received: from DM6NAM11FT103.eop-nam11.prod.protection.outlook.com (2603:10b6:5:334:cafe::1e) by DM6PR04CA0023.outlook.office365.com (2603:10b6:5:334::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.34 via Frontend Transport; Tue, 18 Oct 2022 19:48:27 +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 DM6NAM11FT103.mail.protection.outlook.com (10.13.172.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5746.16 via Frontend Transport; Tue, 18 Oct 2022 19:48:27 +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.31; Tue, 18 Oct 2022 14:48:26 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 35/36] net/ionic: retry init commands up to five times Date: Tue, 18 Oct 2022 12:41:30 -0700 Message-ID: <20221018194131.23006-36-andrew.boyer@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221011005032.47584-1-andrew.boyer@amd.com> References: <20221011005032.47584-1-andrew.boyer@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT103:EE_|BL3PR12MB6379:EE_ X-MS-Office365-Filtering-Correlation-Id: 2ac91471-b971-4b01-cf09-08dab141b9b9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lNeM6OMHLD6hWN9+EomvtCn6yCJaTtopj3cc4gl/h9RbKg/HkUJSABLY50cY0xN02anWcqr2QDp+bPWzAxB26f9MzSKcFR8y9qTGfY6uImB6kvn0ej3kYZB+CTqrBMofhHTQRVaqweulWVrkV1iRk0U5u3I/OrD9kEN0nLpNT0Txio72e41W5VLhik/oO/y6Ro0ojfYFjdkzRmqQsfiY17ONgUhAY03tR2P0M03vbAzva9W2p9cK0QrFBIdfX2cI485yYU52t4xLKNyBqUOHrvPg/GrEVDfbt/zuZlDocszaz84gTlz3aQL+BjZRat0aM1hbf41MO/wHKzLfyog6lAvLbfw7p2zRc5uz2PZ6KEu/ccCWRmYr4MSZuPFD6eoza3FL+/skqFM66mBBDqpncTGJakLO6NQdsmD9uGS2HMbNWk/Ukc0bWMquHSd1fPSM3kxEBOBFcNmi5CPNTPddxNW8vQCn3J8lANTZi/LRv1X8PN1s/rxx/e1QRUIOmTrqcJ13BlxSeW0Md8bte2sYD2Fek96w2YXjwzaXHTl+5z0IRudWvGEdccTMz+jgCBrwt4JPx4R3foOYDePai2Rk+dIbXZCmug/4aZLmYykXemhgi+33CVvnylvWMcBQe/9cg8FrxKBCA1jJibQoSZlFDN1YGKMmsDj8UQJOSFNqClFZXj9Z7lsZLsVZzIkcBRuAFa+MwqM9lZ/yQVOZXBRLkRaULYm/0I6Vr0oyAkvYmaz9WMJdlUkT9hZKY02mWOAoo+N1oVmlNQcoWDOm9DCW1CcuQxQv69n0ojSdSJPkfsXn6WjfAGhzY+C9G51bbhDL 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)(39860400002)(396003)(136003)(376002)(451199015)(40470700004)(36840700001)(46966006)(36756003)(86362001)(81166007)(82740400003)(356005)(2906002)(426003)(1076003)(16526019)(186003)(47076005)(40460700003)(5660300002)(40480700001)(44832011)(2616005)(6666004)(36860700001)(26005)(478600001)(83380400001)(336012)(8676002)(82310400005)(316002)(6916009)(70586007)(70206006)(41300700001)(4326008)(8936002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:48:27.2674 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2ac91471-b971-4b01-cf09-08dab141b9b9 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: DM6NAM11FT103.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6379 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 46434f81a4..5e238e8ab7 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 1b5932db12..63635a4b19 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 05f1e90e30..26e08d06c9 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