From: Roman Bacik <roman.bacik@broadcom.com>
To: "Marek Behún" <kabel@kernel.org>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>,
Bharat Gooty <bharat.gooty@broadcom.com>,
Joe Hershberger <joe.hershberger@ni.com>,
Ramon Fried <rfried.dev@gmail.com>
Subject: RE: [PATCH v5 1/2] net: brcm: netXtreme driver
Date: Tue, 2 Nov 2021 11:15:27 -0700 [thread overview]
Message-ID: <8ad5c59458d41d3a26dc96cdccf1e577@mail.gmail.com> (raw)
In-Reply-To: <20211102130700.1ce19d24@thinkpad>
[-- Attachment #1: Type: text/plain, Size: 5078 bytes --]
Hi Marek,
> -----Original Message-----
> From: Marek Behún <kabel@kernel.org>
> Sent: Tuesday, November 2, 2021 5:07 AM
> To: Roman Bacik <roman.bacik@broadcom.com>
> Cc: U-Boot Mailing List <u-boot@lists.denx.de>; Bharat Gooty
> <bharat.gooty@broadcom.com>; Joe Hershberger
> <joe.hershberger@ni.com>; Ramon Fried <rfried.dev@gmail.com>
> Subject: Re: [PATCH v5 1/2] net: brcm: netXtreme driver
>
> On Mon, 1 Nov 2021 13:21:44 -0700
> Roman Bacik <roman.bacik@broadcom.com> wrote:
>
> > +static int set_phy_speed(struct bnxt *bp)
> > +{
> > + char name[20];
> > + char name1[30];
> > + u16 flag = PHY_STATUS | PHY_SPEED | DETECT_MEDIA;
> > +
> > + /* Query Link Status */
> > + if (bnxt_hwrm_port_phy_qcfg(bp, flag) != STATUS_SUCCESS)
> > + return STATUS_FAILURE;
> > +
> > + switch (bp->current_link_speed) {
> > + case PORT_PHY_QCFG_RESP_LINK_SPEED_100GB:
> > + sprintf(name, "%s %s", str_100, str_gbps);
> > + break;
> > + case PORT_PHY_QCFG_RESP_LINK_SPEED_50GB:
> > + sprintf(name, "%s %s", str_50, str_gbps);
> > + break;
> > + case PORT_PHY_QCFG_RESP_LINK_SPEED_40GB:
> > + sprintf(name, "%s %s", str_40, str_gbps);
> > + break;
> > + case PORT_PHY_QCFG_RESP_LINK_SPEED_25GB:
> > + sprintf(name, "%s %s", str_25, str_gbps);
> > + break;
> > + case PORT_PHY_QCFG_RESP_LINK_SPEED_20GB:
> > + sprintf(name, "%s %s", str_20, str_gbps);
> > + break;
> > + case PORT_PHY_QCFG_RESP_LINK_SPEED_10GB:
> > + sprintf(name, "%s %s", str_10, str_gbps);
> > + break;
> > + case PORT_PHY_QCFG_RESP_LINK_SPEED_2_5GB:
> > + sprintf(name, "%s %s", str_2_5, str_gbps);
> > + break;
> > + case PORT_PHY_QCFG_RESP_LINK_SPEED_2GB:
> > + sprintf(name, "%s %s", str_2, str_gbps);
> > + break;
> > + case PORT_PHY_QCFG_RESP_LINK_SPEED_1GB:
> > + sprintf(name, "%s %s", str_1, str_gbps);
> > + break;
> > + case PORT_PHY_QCFG_RESP_LINK_SPEED_100MB:
> > + sprintf(name, "%s %s", str_100, str_mbps);
> > + break;
> > + case PORT_PHY_QCFG_RESP_LINK_SPEED_10MB:
> > + sprintf(name, "%s %s", str_10, str_mbps);
> > + break;
> > + default:
> > + sprintf(name, "%s %x", str_unknown, bp-
> >current_link_speed);
> > + }
> > +
> > + sprintf(name1, "bnxt_eth%u_phy_speed", bp->cardnum);
> > + env_set(name1, name);
> > + dbg_phy_speed(bp, name);
> > +
> > + return STATUS_SUCCESS;
> > +}
> > +
> > +static int set_phy_link(struct bnxt *bp, u32 tmo)
> > +{
> > + char name[32];
> > + int ret;
> > +
> > + set_phy_speed(bp);
> > + dbg_link_status(bp);
> > + if (bp->link_status == STATUS_LINK_ACTIVE) {
> > + dbg_link_state(bp, tmo);
> > + sprintf(name, "bnxt_eth%u_link", bp->cardnum);
> > + env_set(name, "up");
> > + sprintf(name, "bnxt_eth%u_media", bp->cardnum);
> > + env_set(name, "connected");
> > + ret = STATUS_SUCCESS;
> > + } else {
> > + sprintf(name, "bnxt_eth%u_link", bp->cardnum);
> > + env_set(name, "down");
> > + sprintf(name, "bnxt_eth%u_media", bp->cardnum);
> > + env_set(name, "disconnected");
> > + ret = STATUS_FAILURE;
> > + }
> > +
> > + return ret;
> > +}
>
> Hi Roman,
>
> your proposal still contains non-standard and unneeded setting of
> environment variables. An ethernet driver should never do this. In fact
> no driver besides board code or sysinfo driver should do this directly.
>
> There are other mechanisms for reporting PHY connection information in
> U-Boot, please use those if you need them (e.g. implement a PHY
> driver), but remove all env_set() calls from your ethernet driver.
>
> Rationale: historically, many times things were solved with ad-hoc code
> in U-Boot, which did this kind of thing and similar. It got out of hand
> pretty fast, and it was horrible. So some people dedided to fix it,
> proposing APIs, unifying code, deduplicating code and so on. This is
> still, in fact, going on. For your driver to have it's own mechanism
> for reporting link status, by setting env variables, is going against
> this whole work.
>
> I suggest for now just to remove these calls. When the driver is
> merged, we can work on extending support for passing link information
> to U-Boot via ethernet PHY API, if you need it.
>
> Marek
We will remove env_set() calls in v6 as requested.
Thanks,
Roman
--
This electronic communication and the information and any files transmitted
with it, or attached to it, are confidential and are intended solely for
the use of the individual or entity to whom it is addressed and may contain
information that is confidential, legally privileged, protected by privacy
laws, or otherwise restricted from disclosure to anyone else. If you are
not the intended recipient or the person responsible for delivering the
e-mail to the intended recipient, you are hereby notified that any use,
copying, distributing, dissemination, forwarding, printing, or copying of
this e-mail is strictly prohibited. If you received this e-mail in error,
please return the e-mail to the sender, delete it from your computer, and
destroy any printed copy of it.
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4206 bytes --]
prev parent reply other threads:[~2021-11-02 18:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-01 20:21 [PATCH v5 1/2] net: brcm: netXtreme driver Roman Bacik
2021-11-01 20:21 ` [PATCH v5 2/2] board: brcm-ns3: Load netXtreme firmware Roman Bacik
2021-11-02 12:07 ` [PATCH v5 1/2] net: brcm: netXtreme driver Marek Behún
2021-11-02 18:15 ` Roman Bacik [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8ad5c59458d41d3a26dc96cdccf1e577@mail.gmail.com \
--to=roman.bacik@broadcom.com \
--cc=bharat.gooty@broadcom.com \
--cc=joe.hershberger@ni.com \
--cc=kabel@kernel.org \
--cc=rfried.dev@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox