From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 737C3C433EF for ; Tue, 26 Oct 2021 16:52:22 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5B4DA60F02 for ; Tue, 26 Oct 2021 16:52:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5B4DA60F02 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E91A88327C; Tue, 26 Oct 2021 18:52:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="TGpPryOp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3BAD68343E; Tue, 26 Oct 2021 18:52:17 +0200 (CEST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7A2F782EA5 for ; Tue, 26 Oct 2021 18:52:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: by mail.kernel.org (Postfix) with ESMTPSA id 85CB260F02; Tue, 26 Oct 2021 16:52:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635267132; bh=qGhuxmFvHc/Q0h/OM7LszlfZdipHnton9kq/t6LAVGg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=TGpPryOpVYNPXXkWeE6Ib69YCasdcWEkRZIafxA6D8NywiriBM2BiKGszporrITdg RXYlyIQFj4d6+cDswDVyI9QE8LhauT7VJip0RlcS621BZejTGC7GL3LAdONiQQwTCi k65IYWMI8JSbmJi94TGbulYj6fUx6Ci3s7sEtt7/1iJ1hN5ZFMeaSgzH50sV8pWKd/ 7Dbh9ucL1dVn9dImRUlS3ti2SK1MY/kOrKw9Kq2SoNCeRE/9z387H/jnjFO8dxtcxi tyNckUBV2+qBzhWPIOSy/saW4Yqltk0kDei6z07mGNY6g3hU2g5kF05UKUJDW0w/kh R9E3TJBONrInA== Date: Tue, 26 Oct 2021 18:52:06 +0200 From: Marek =?UTF-8?B?QmVow7pu?= To: Roman Bacik Cc: Simon Glass , U-Boot Mailing List , Bharat Gooty , Aswath Govindraju , Bin Meng , Franck LENORMAND , Heinrich Schuchardt , Kory Maincent , Michal Simek , Patrick Delaunay , Peng Fan , Priyanka Jain , Rayagonda Kokatanur , Sean Anderson Subject: Re: [PATCH v3 2/2] cmd: brcm: netXtreme commands Message-ID: <20211026185206.3ba0709f@thinkpad> In-Reply-To: References: <20211025234444.1237-1-roman.bacik@broadcom.com> <20211025164424.v3.2.I1edaad77041c1300213c307eef6741499504047@changeid> <20211026151742.42b0fcfa@thinkpad> <20211026175519.418d4864@thinkpad> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On Tue, 26 Oct 2021 09:40:44 -0700 Roman Bacik wrote: > On Tue, Oct 26, 2021 at 9:02 AM Roman Bacik wr= ote: > > > > On Tue, Oct 26, 2021 at 8:55 AM Marek Beh=C3=BAn wro= te: > > > > > > On Tue, 26 Oct 2021 08:14:28 -0700 > > > Roman Bacik wrote: > > > > > > > Hi Marek, > > > > > > > > We do not want this driver to be automatically probed. It is not ne= eded > > > > all the time and also slows down the boot time. We have stripped do= wn > > > > everything else to bare minimum. > > > > Thanks, > > > > > > > > Roman > > > > > > Hi Roman, > > > > > > OK, that is reasonable, but not reasonable enough to introduce a new > > > vendor specific command. > > > > > > Still NAK. > > > > > > So you have the bnxt_drv_probe method defined in the driver, but you > > > don't set a pointer to it into the U_BOOT_DRIVER structure, and inste= ad > > > you call this method when "brcm probe" command is called. > > > > > > I think this introduction of another vendor specific command is wrong. > > > > > > If probing takes too much time and should be done only when the device > > > is needed, there are 2 things you could do: > > > > > > - you can create new driver flag saying that the device should be > > > probeb only when needed, wire necessary code and add this flag to y= our > > > driver (this could get very complicated, though) > > > - you can do minimum stuff in probe method, and move the stuff that > > > takes long time into bnxt_start(), which is called only when network > > > via this ethernet controller is requested for by U-Boot commands. > > > > So renaming bnxt probe/remove to bnxt start/stop will do, right? > > > > > > > > Also, you're still doing > > > > > > + if (env_get("ethaddr")) > > > + secondary =3D 1; > > > > Why can't we access the env variable from our "bnxt start" method? Is > > there a blacklist of env variables one must not access from a driver? >=20 > Marek, >=20 > Sometimes we can have two ethernet devices. One is 10/100/1000M rgmii and > another is chip internal 10/100G bnxt. If rgmii is there as eth0, we > are incrementing eth number for bnxt: >=20 > if (env_get("ethaddr")) > secondary =3D 1; > eth_env_get_enetaddr_by_index("eth",bp->cardnum+secondary,bp->mac_set); >=20 > This way the driver can find that rmii has already taken eth0 so it > will use eth1 instead. Do you have a suggestion to work around this? > Thanks, I just replied to your first reply: Every ethernet controller should use a specific ethNaddr, where N =3D dev_seq(dev) of that controller (and if N=3D0, it is omitted entirely). So no magical things such as bp->cardnum+secondary instead you use dev_seq(dev), which gives you the correct number, i.e. for N-th UCLASS_ETH device bound it return the number N. Marek