Message ID | 20231206063549.2590305-1-srasheed@marvell.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp3918320vqy; Tue, 5 Dec 2023 22:37:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IE21+VGu5gKiANU7xdhSqLesNC7FLoPGHt3ZOcYfqN4lnqpfUVl1mmmXKa7tPR6Tmg8s0H+ X-Received: by 2002:a17:902:900c:b0:1d0:6ffd:836e with SMTP id a12-20020a170902900c00b001d06ffd836emr137025plp.121.1701844630213; Tue, 05 Dec 2023 22:37:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701844630; cv=none; d=google.com; s=arc-20160816; b=d3jhwx74V/gcldwYX86taOup7qdsmhjzkR7CKJOISQFzXlAMaIlAUf6KFbU3ArpDDU EfJ0GT2z+QZuOHVtrM7fCi10v5UwvW69KF91Nv3SIP3ZSHEwIJp08csaFATw3I3g2fi1 mCzOqyt7SzzFdtQ43lvSg8rei+bA1LWb5ajgO+eBIfsphdGXkU2mHkuWu2FL0CEpBe/K lFrKJizIevr9yqkCL9wirNSXXi3sgF/Es2ebgH1RPD/6h2PtoUhBZM0sM0V4MN3j/YMs m8ScBMmT8ZZpVqv6NOLl2tcJLWjKIDUXTlRCcZfSN4Ds+BUlY9X18C6SN5l3DcTIDWVj DEwA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=C2Vbd6JnDAfhgxbHY/teR4Hm++QYeBA9A+zn+kRvmgQ=; fh=i1DgICAwQFEjLOp0MV20/A09no61tqe7QehK1VN1Y8U=; b=YXwzRrs4hwX0FDxzzTD3KzkWtKF6wcz1y23sswrwJ65gme3WxEnuFTdraBP4p1aaAW tkoe8TmF1Wdz2JDywQ4j5jA+ursea+Hf9MQxN76YAOZezGOdcR6AJBKRumX9AtBlKGXA HWrYHu79xX4cLmNPLvvmGuft9b4CcLlBAH0ts/0xuOi4cuDXoMfRZEneGKZ1toef7eFW dkDJKIBtbtHG4dIuXL0UJTjJMY8SZ1u8Mh5xzYymJ4FHz3TeqgTmVl66Fcy/6Y15Rt5E LgjjWuzhB7F4lEHteBv+c+wfKhryRNlkYw7R4wMwOhlY3TFGIMYBuSbDZMGc3YjyQM5k txdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=fbP6on6j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id jf19-20020a170903269300b001d0626761c5si7869113plb.217.2023.12.05.22.37.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 22:37:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=fbP6on6j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 403978069F07; Tue, 5 Dec 2023 22:36:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376807AbjLFGgI (ORCPT <rfc822;chrisfriedt@gmail.com> + 99 others); Wed, 6 Dec 2023 01:36:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376802AbjLFGgC (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 6 Dec 2023 01:36:02 -0500 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADC46D46; Tue, 5 Dec 2023 22:36:07 -0800 (PST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3B65ddqp023836; Tue, 5 Dec 2023 22:35:54 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=C2Vbd6JnDAfhgxbHY/teR4Hm++QYeBA9A+zn+kRvmgQ=; b=fbP6on6jCeqDu+3KP4c3c12eBlb+wTZBUnHJeSGSBWpHSusAFauYmiNF1SCOKypgQr9D Qr3GJxqUuH3gbYqgUtiSoNgpF3RBXGTd6jqKLplvspO+90YLclIJdxDZSb8vdCaF0yH/ lYe6haOq51/RA/cF7ae19B/qwWgLuAVXlcs7RUPMcdy4Yz72oW1umVJFv47jblyYv4Bq 2Nm2tjdXzUX8BQqqZQwc4DJekaLPHVczwqgkX2bPDcWdGdwCkQgUBaR0EHafXcEcWRW3 BHykKewB4JWXSCOqhoqk9F4Qa02CZQOqjJz/EHFeO14PtpIniRC05OXm37j5EH+9tq3Q AA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3utd0p95tf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 05 Dec 2023 22:35:54 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 5 Dec 2023 22:35:52 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 5 Dec 2023 22:35:52 -0800 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id D640E3F704E; Tue, 5 Dec 2023 22:35:51 -0800 (PST) From: Shinas Rasheed <srasheed@marvell.com> To: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org> CC: <hgani@marvell.com>, <vimleshk@marvell.com>, <egallen@redhat.com>, <mschmidt@redhat.com>, <pabeni@redhat.com>, <horms@kernel.org>, <kuba@kernel.org>, <davem@davemloft.net>, <wizhao@redhat.com>, <konguyen@redhat.com>, Shinas Rasheed <srasheed@marvell.com>, "Veerasenareddy Burru" <vburru@marvell.com>, Sathesh Edara <sedara@marvell.com>, Eric Dumazet <edumazet@google.com>, Abhijit Ayarekar <aayarekar@marvell.com>, "Satananda Burla" <sburla@marvell.com> Subject: [PATCH net v1] octeon_ep: explicitly test for firmware ready value Date: Tue, 5 Dec 2023 22:35:49 -0800 Message-ID: <20231206063549.2590305-1-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: U6H81ENnbgqaAmserLKIWBlR8Vi0D_Ch X-Proofpoint-ORIG-GUID: U6H81ENnbgqaAmserLKIWBlR8Vi0D_Ch X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-06_04,2023-12-05_01,2023-05-22_02 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 05 Dec 2023 22:36:21 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784513434915678000 X-GMAIL-MSGID: 1784513434915678000 |
Series |
[net,v1] octeon_ep: explicitly test for firmware ready value
|
|
Commit Message
Shinas Rasheed
Dec. 6, 2023, 6:35 a.m. UTC
The firmware ready value is 1, and get firmware ready status
function should explicitly test for that value. The firmware
ready value read will be 2 after driver load, and on unbind
till firmware rewrites the firmware ready back to 0, the value
seen by driver will be 2, which should be regarded as not ready.
Fixes: 10c073e40469 ("octeon_ep: defer probe if firmware not ready")
Signed-off-by: Shinas Rasheed <srasheed@marvell.com>
---
drivers/net/ethernet/marvell/octeon_ep/octep_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On Wed, Dec 6, 2023 at 7:36 AM Shinas Rasheed <srasheed@marvell.com> wrote: > > The firmware ready value is 1, and get firmware ready status > function should explicitly test for that value. The firmware > ready value read will be 2 after driver load, and on unbind > till firmware rewrites the firmware ready back to 0, the value > seen by driver will be 2, which should be regarded as not ready. > > Fixes: 10c073e40469 ("octeon_ep: defer probe if firmware not ready") > Signed-off-by: Shinas Rasheed <srasheed@marvell.com> > --- > drivers/net/ethernet/marvell/octeon_ep/octep_main.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c > index 552970c7dec0..b8ae269f6f97 100644 > --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c > +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c > @@ -1258,7 +1258,8 @@ static bool get_fw_ready_status(struct pci_dev *pdev) > > pci_read_config_byte(pdev, (pos + 8), &status); > dev_info(&pdev->dev, "Firmware ready status = %u\n", status); > - return status; > +#define FW_STATUS_READY 1ULL > + return (status == FW_STATUS_READY) ? true : false; "status == FW_STATUS_READY" is already the bool value you want. You don't need to use the ternary operator here. > } > return false; > } > -- > 2.25.1 >
Hi Michal > -----Original Message----- > From: Michal Schmidt <mschmidt@redhat.com> > Sent: Wednesday, December 6, 2023 7:28 PM > To: Shinas Rasheed <srasheed@marvell.com> > > pci_read_config_byte(pdev, (pos + 8), &status); > > dev_info(&pdev->dev, "Firmware ready status = %u\n", status); > > - return status; > > +#define FW_STATUS_READY 1ULL > > + return (status == FW_STATUS_READY) ? true : false; > > "status == FW_STATUS_READY" is already the bool value you want. You > don't need to use the ternary operator here. > In some abnormal cases, the driver can read the firmware ready status as 2. Hence this need for explicitly checking if status is indeed 1 or not. If it is 2, the function should understand it as the firmware is not ready. (It has to be strictly 1 for the driver to understand it as ready)
On Wed, Dec 6, 2023 at 3:12 PM Shinas Rasheed <srasheed@marvell.com> wrote: > > Hi Michal > > > -----Original Message----- > > From: Michal Schmidt <mschmidt@redhat.com> > > Sent: Wednesday, December 6, 2023 7:28 PM > > To: Shinas Rasheed <srasheed@marvell.com> > > > pci_read_config_byte(pdev, (pos + 8), &status); > > > dev_info(&pdev->dev, "Firmware ready status = %u\n", status); > > > - return status; > > > +#define FW_STATUS_READY 1ULL > > > + return (status == FW_STATUS_READY) ? true : false; > > > > "status == FW_STATUS_READY" is already the bool value you want. You > > don't need to use the ternary operator here. > > > > In some abnormal cases, the driver can read the firmware ready status as 2. Hence this need for explicitly checking if status > is indeed 1 or not. If it is 2, the function should understand it as the firmware is not ready. (It has to be strictly 1 for the driver > to understand it as ready) I'm not disputing that. I'm saying that this: return (status == FW_STATUS_READY) ? true : false; is equivalent to: return status == FW_STATUS_READY; Michal
> I'm not disputing that. I'm saying that this: > return (status == FW_STATUS_READY) ? true : false; > is equivalent to: > return status == FW_STATUS_READY; Oh got it! Thanks for the catch, will correct and send it now. Shinas
diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c index 552970c7dec0..b8ae269f6f97 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c @@ -1258,7 +1258,8 @@ static bool get_fw_ready_status(struct pci_dev *pdev) pci_read_config_byte(pdev, (pos + 8), &status); dev_info(&pdev->dev, "Firmware ready status = %u\n", status); - return status; +#define FW_STATUS_READY 1ULL + return (status == FW_STATUS_READY) ? true : false; } return false; }