From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 9DB88A0093;
	Tue, 10 May 2022 18:20:46 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 4B8B2410EE;
	Tue, 10 May 2022 18:20:46 +0200 (CEST)
Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com
 [66.111.4.28]) by mails.dpdk.org (Postfix) with ESMTP id 20410406B4
 for <dev@dpdk.org>; Tue, 10 May 2022 18:20:45 +0200 (CEST)
Received: from compute3.internal (compute3.nyi.internal [10.202.2.43])
 by mailout.nyi.internal (Postfix) with ESMTP id BEBDD5C01B7;
 Tue, 10 May 2022 12:20:44 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute3.internal (MEProxy); Tue, 10 May 2022 12:20:44 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 cc:cc:content-transfer-encoding:content-type:date:date:from:from
 :in-reply-to:in-reply-to:message-id:mime-version:references
 :reply-to:sender:subject:subject:to:to; s=fm1; t=1652199644; x=
 1652286044; bh=2Z4gHbe+sZpfA2MCg+Ew7k9cCKHScf9vSTskDe36xWI=; b=N
 r8ZDypAhFvtFd18S16dxjUr8qq7oAvFimUlN23VGkSWOAcGQUfm9VyBQRqICyC3y
 5Dv+9DFt0MtkEixTOiv+1Qy1EAHUmfr2azdj0YC+KqRSyQ6ggSh+SAnI6UPczP98
 a7R+++NNtGvpSCn0vrGmIjMb99u6UDjXqu1T+wvd/N81+k/zwy/95tLRLjTgM3Wc
 IXo0/c6r4gQKNcdGbg1bQYb6AwK9+BxIdcqAkZEiSViSrGmQwu7t0gKFZUfy4yZz
 7ZfCM4DSO8vdAkavQWWg5e0qPtI+dhdQIvsF+IuAVNbNU1vJgI0qgauC4OSULVl5
 IdzecEmF9I41kLmQWttug==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:date:date:from:from:in-reply-to:in-reply-to
 :message-id:mime-version:references:reply-to:sender:subject
 :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender
 :x-sasl-enc; s=fm1; t=1652199644; x=1652286044; bh=2Z4gHbe+sZpfA
 2MCg+Ew7k9cCKHScf9vSTskDe36xWI=; b=Ms7qj05s7lDvcbBcIPk/FEku+3tQz
 mll30XrodPjSLVLVS18UOrsJ0J05VoDsd8owVAjR8bwl3mc3+EpldTtwNKzsKWdD
 ISVtsItp+5shj/ZWnOXwEVovZrIhAyp01cHfqrBFPc/iDbvuXdimsDEtSS1ToyqM
 pC7cEXIZg4IYueEATk2VC4FDe5NQmwyc4Ame048HdU60Wg+ZAJM74BUMiQ4vBN1V
 crC35U/Us+veLSKB4IrVMexfdluOcXJpgR0Ahn55MG2HsQBqMfGlq8DIDppgYuDq
 Z99S3BWF/fJhCQBWqMd2oatTndjrIBW8OFSxslx/1/Jn9BTuS/Oc2srpA==
X-ME-Sender: <xms:25B6YoOcYyuDdp0kfoSAG79iotfLb97U6L1gRQKHlyQDrHji70KdIg>
 <xme:25B6Yu9xwSJQ4L_45TnJ9Ib0AXaLnQFrQEGCi3E7nQSCOXhWsySQuLejOQYkE41GT
 jZE5ZkI_KrEVYacIQ>
X-ME-Received: <xmr:25B6YvSUbtq1DCIr_P4aCtKxZjVirYIydr5HwyG8HBBzhp_eJAUK8uHm4coa008whXTmxbOI7rbxJsBgboGMd1GthQ>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrgedugdelgecutefuodetggdotefrodftvf
 curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu
 uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc
 fjughrpefhvfevufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr
 shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg
 ftrfgrthhtvghrnheptdejieeifeehtdffgfdvleetueeffeehueejgfeuteeftddtieek
 gfekudehtdfgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh
 homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth
X-ME-Proxy: <xmx:25B6YgsQvIjxj_-sUE7sfdyUORBrt8Ha6Xj7CHr-UlbZeAJtiQBKeg>
 <xmx:25B6Ygd75L5q40wqqYT2l-1uGfdZQKrnh7jvAscJJErmV3hLgIWuNQ>
 <xmx:25B6Yk1IK4vLQ35w3V7FX5YA2ZRUEIHSJNToi06dG_hJCvx9zTOk2g>
 <xmx:3JB6Yo5J8bGrSLfjnBQ3mzfxxHKJKcG39FEpfvtEhemszeNjFecBlQ>
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue,
 10 May 2022 12:20:42 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Cc: Ferruh Yigit <ferruh.yigit@xilinx.com>,
 Andrew Rybchenko <arybchenko@solarflare.com>,
 David Marchand <david.marchand@redhat.com>,
 Jerin Jacob Kollanukkaran <jerinj@marvell.com>,
 Qi Z Zhang <qi.z.zhang@intel.com>, Hemant Agrawal <hemant.agrawal@nxp.com>,
 "Min Hu (Connor)" <humin29@huawei.com>,
 Viacheslav Ovsiienko <viacheslavo@nvidia.com>, olivier.matz@6wind.com,
 dev@dpdk.org
Subject: Re: [PATCH 5/5] net/cxgbe: read firmware configuration file from
 filesystem
Date: Tue, 10 May 2022 18:20:41 +0200
Message-ID: <3415032.V25eIC5XRa@thomas>
In-Reply-To: <Ynp/HxzSCaJ/nv9P@chelsio.com>
References: <cover.1650297776.git.rahul.lakkireddy@chelsio.com>
 <1747901.3VsfAaAtOV@thomas> <Ynp/HxzSCaJ/nv9P@chelsio.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

10/05/2022 17:05, Rahul Lakkireddy:
> On Tuesday, May 05/10/22, 2022 at 16:30:59 +0200, Thomas Monjalon wrote:
> > 10/05/2022 16:11, Rahul Lakkireddy:
> > > On Tuesday, May 05/10/22, 2022 at 11:02:05 +0200, Thomas Monjalon wrote:
> > > > 06/05/2022 13:36, Rahul Lakkireddy:
> > > > > The Chelsio FW config file contains a list of register=value pairs to
> > > > > change configuration of the NIC before firmware is initialized.
> > > > > It closely resembles the INI file format. It is mainly used to aid
> > > > > in debugging FW initialization failures and to optimally partition
> > > > > NIC hardware resources for specific requirements. Partitioning
> > > > > generally involves moving resources on unused Physical Functions
> > > > > (PFs) to the main PF, like redistributing queues, hardware TCAMs,
> > > > > etc., before firmware begins initialization. Once the configuration
> > > > > looks good, then the final FW config file is flashed onto the NIC
> > > > > using the cxgbtool. The FW config file can then be removed from the
> > > > > /lib/firmware/cxgb4/ directory and the FW will begin initializing
> > > > > with the flashed FW config file on the NIC from next time onwards.
> > > > > 
> > > > > With this patch, the FW config file is selected in following order.
> > > > > 
> > > > > 1) Check and select FW config file present in /lib/firmware/cxgb4/
> > > > >    directory.
> > > > > 
> > > > > 2) Otherwise, check and select FW config file flashed onto the
> > > > >    NIC.
> > > > > 
> > > > > 3) Otherwise, select the default FW config file embedded within the
> > > > >    FW binary on the NIC.
> > > > > 
> > > > > Since this is pretty low-level hardware configuration, the users are
> > > > > not expected to change this file without expert guidance. So,
> > > > > exporting such a low-level configuration via devargs API does not
> > > > > feel like the right fit for this specific requirement.
> > > > > 
> > > > > Once FW is up and running with the FW config file, some of the driver
> > > > > and FW runtime features can be enabled/disabled via devargs API during
> > > > > driver probe.
> > > > > 
> > > > > To summarize, the FW config file is intended to debug FW initialization
> > > > > failures and/or aid in resources partitioning before FW starts
> > > > > initialization. Once the FW is running, the whole or smaller slices
> > > > > of these partitioned resources can be further redistributed across
> > > > > the multiple physical ports controlled by the same underlying PF.
> > > > 
> > > > Sorry it is not clear to me.
> > > > The FW file is used by cxgbtool to flash it, right?
> > > > The PMD may use the same FW file for debug diagnostics?
> > > 
> > > 
> > > There are 2 FW related files in /lib/firmware/cxgb4 directory that
> > > can be written into the NIC flash (at different locations in the flash)
> > > using cxgbtool:
> > > 
> > > 1) FW config file (t6-config.txt): This file contains register=value
> > >    pairs to configure some HW registers before initializing FW
> > >    (t6fw.bin). These register=value pairs are very low level and
> > >    specific to HW. The FW config file can be used to enable/disable
> > >    some paths in HW to debug FW initialization issues. Since it
> > >    can disable some paths in HW, it can also be used to partition
> > >    and redistribute resources from other unused PFs to main PF,
> > >    before FW initialization.
> > > 
> > > 2) FW binary (t6fw.bin): This contains the actual FW. This binary also
> > >    has an embedded "default" FW config file that will be used if no
> > >    FW config file (t6-config.txt) is present in NIC "flash" or in the
> > >    "/lib/firmware/cxgb4/" directory.
> > > 
> > > > How is it used by the kernel?
> > > > 
> > > 
> > > In kernel cxgb4 driver also, we follow the same sequence when
> > > initializing FW. If any FW config file (t6-config.txt) is present
> > > in "/lib/firmware/cxgb4" directory, then it is picked up first.
> > > Otherwise, a FW config file that has been "flashed" onto the NIC
> > > using cxgbtool, is picked up next. Otherwise, FW will init with
> > > the "default" FW config file embedded inside the FW binary (t6fw.bin).
> > > 
> > > Currently, the DPDK cxgbe PMD only picks up the FW config file from
> > > NIC "flash" or the "default" one inside the FW binary. This patch adds
> > > a way to pick FW config file from "lib/firmware/cxgb4" directory when
> > > a FW config file is placed there.
> > 
> > OK, so both Linux and DPDK drivers read the FW config file
> > to provide better diagnostics. Am I right?
> > 
> 
> Yes, both use the FW config file to enable/disable specific paths in
> HW to get better diagnostics for FW init failures.

OK thanks for the explanation.
The idea looks OK.