Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2A38C636D4 for ; Wed, 15 Feb 2023 11:43:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233683AbjBOLnV (ORCPT ); Wed, 15 Feb 2023 06:43:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229927AbjBOLnT (ORCPT ); Wed, 15 Feb 2023 06:43:19 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAC623A9B; Wed, 15 Feb 2023 03:43:18 -0800 (PST) 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 44F2A61B36; Wed, 15 Feb 2023 11:43:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE0C1C433EF; Wed, 15 Feb 2023 11:43:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676461397; bh=8AhOsR6a6Fx83eFRNETvJhvMv8gizxyW0KwOLiToQVE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tc0VZmxB/W2+IEloWtDnfvJU6TjDu/+caGUPd+obdvUBFgIQR7LbfNx5t+R0Q2o2u VdotvEkQfYMoz78nuQ8dZL2ai1b3QGXgU9oErJbQeKvn0uY3kVNWjszM/L1TBkR3lg k3j00CqtpgT9q4+QRT2qTeP+k6xkOEZlpF6gYpL5dy29DtkwrlFvs62YWavTZFNb7l lZKcK+rG1QxHm6p78sdTt7+YOwReHepFNhnHyWREZbzfF0HAafLr7EuSG/pZRYNO8H h3KrrAgNE8JuGuvO+KBGHaSA+hzkkS8TOaQukxDglJcBzCoI8dDQsJ+v7hN5QJX/ke DFrYSlcvI4cbA== Date: Wed, 15 Feb 2023 13:43:13 +0200 From: Leon Romanovsky To: Maciej Fijalkowski Cc: Veerasenareddy Burru , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, aayarekar@marvell.com, sedara@marvell.com, sburla@marvell.com, linux-doc@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Subject: Re: [PATCH net-next v3 1/7] octeon_ep: defer probe if firmware not ready Message-ID: References: <20230214051422.13705-1-vburru@marvell.com> <20230214051422.13705-2-vburru@marvell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 14, 2023 at 06:32:05PM +0100, Maciej Fijalkowski wrote: > On Mon, Feb 13, 2023 at 09:14:16PM -0800, Veerasenareddy Burru wrote: > > Defer probe if firmware is not ready for device usage. > > > > Signed-off-by: Veerasenareddy Burru > > Signed-off-by: Abhijit Ayarekar > > Signed-off-by: Satananda Burla > > --- > > v2 -> v3: > > * fix review comments > > https://lore.kernel.org/all/Y4chWyR6qTlptkTE@unreal/ > > - change get_fw_ready_status() to return bool > > - fix the success oriented flow while looking for > > PCI extended capability > > > > v1 -> v2: > > * was scheduling workqueue task to wait for firmware ready, > > to probe/initialize the device. > > * now, removed the workqueue task; the probe returns EPROBE_DEFER, > > if firmware is not ready. > > * removed device status oct->status, as it is not required with the > > modified implementation. > > > > .../ethernet/marvell/octeon_ep/octep_main.c | 26 +++++++++++++++++++ > > 1 file changed, 26 insertions(+) > > > > diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c > > index 5a898fb88e37..5620df4c6d55 100644 > > --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c > > +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c > > @@ -1017,6 +1017,26 @@ static void octep_device_cleanup(struct octep_device *oct) > > oct->conf = NULL; > > } > > > > +static bool get_fw_ready_status(struct pci_dev *pdev) > > +{ > > + u32 pos = 0; > > + u16 vsec_id; > > + u8 status; > > + > > + while ((pos = pci_find_next_ext_capability(pdev, pos, > > + PCI_EXT_CAP_ID_VNDR))) { > > + pci_read_config_word(pdev, pos + 4, &vsec_id); > > +#define FW_STATUS_VSEC_ID 0xA3 > > + if (vsec_id != FW_STATUS_VSEC_ID) > > + continue; > > + > > + pci_read_config_byte(pdev, (pos + 8), &status); > > + dev_info(&pdev->dev, "Firmware ready status = %u\n", status); > > + return status ? true : false; > > nit: > > return !!status; "return status;" is enough, there is no need in "!!". Thanks