openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Eddie James <eajames@linux.ibm.com>
To: Joel Stanley <joel@jms.id.au>, Ivan Mikhaylov <i.mikhaylov@yadro.com>
Cc: Networking <netdev@vger.kernel.org>,
	OpenBMC Maillist <openbmc@lists.ozlabs.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Samuel Mendoza-Jonas <sam@mendozajonas.com>,
	"David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH v2 2/3] net/ncsi: add NCSI Intel OEM command to keep PHY up
Date: Mon, 12 Jul 2021 14:32:43 -0500	[thread overview]
Message-ID: <84e7fbd7e65a6ee363763d8155c47d74ed24f9e0.camel@linux.ibm.com> (raw)
In-Reply-To: <CACPK8Xff9c-_9A_tfZ4UBjucUgRmy8iOOdzcV5dg8VUCOB29AQ@mail.gmail.com>

On Mon, 2021-07-12 at 10:01 +0000, Joel Stanley wrote:
> On Thu, 8 Jul 2021 at 12:27, Ivan Mikhaylov <i.mikhaylov@yadro.com>
> wrote:
> > This allows to keep PHY link up and prevents any channel resets
> > during
> > the host load.
> > 
> > It is KEEP_PHY_LINK_UP option(Veto bit) in i210 datasheet which
> > block PHY reset and power state changes.
> 
> How about using runtime configuration over using kconfig for this, so
> the same kernel config can be used on different machines. Something
> device tree based?
> 
> Another option is to use the netlink handler to send the OEM command
> from userspace. Eddie has worked on this for an IBM machine, and I've
> asked him to post those changes. I would prefer the kernel option
> though.

For reference that is here: 
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-networkd/+/36592

Thanks,
Eddie

> 
> 
> > Signed-off-by: Ivan Mikhaylov <i.mikhaylov@yadro.com>
> > ---
> >  net/ncsi/Kconfig       |  6 ++++++
> >  net/ncsi/internal.h    |  5 +++++
> >  net/ncsi/ncsi-manage.c | 45
> > ++++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 56 insertions(+)
> > 
> > diff --git a/net/ncsi/Kconfig b/net/ncsi/Kconfig
> > index 93309081f5a4..ea1dd32b6b1f 100644
> > --- a/net/ncsi/Kconfig
> > +++ b/net/ncsi/Kconfig
> > @@ -17,3 +17,9 @@ config NCSI_OEM_CMD_GET_MAC
> >         help
> >           This allows to get MAC address from NCSI firmware and set
> > them back to
> >                 controller.
> > +config NCSI_OEM_CMD_KEEP_PHY
> > +       bool "Keep PHY Link up"
> > +       depends on NET_NCSI
> > +       help
> > +         This allows to keep PHY link up and prevents any channel
> > resets during
> > +         the host load.
> > diff --git a/net/ncsi/internal.h b/net/ncsi/internal.h
> > index cbbb0de4750a..0b6cfd3b31e0 100644
> > --- a/net/ncsi/internal.h
> > +++ b/net/ncsi/internal.h
> > @@ -78,6 +78,9 @@ enum {
> >  /* OEM Vendor Manufacture ID */
> >  #define NCSI_OEM_MFR_MLX_ID             0x8119
> >  #define NCSI_OEM_MFR_BCM_ID             0x113d
> > +#define NCSI_OEM_MFR_INTEL_ID           0x157
> > +/* Intel specific OEM command */
> > +#define NCSI_OEM_INTEL_CMD_KEEP_PHY     0x20   /* CMD ID for Keep
> > PHY up */
> >  /* Broadcom specific OEM Command */
> >  #define NCSI_OEM_BCM_CMD_GMA            0x01   /* CMD ID for Get
> > MAC */
> >  /* Mellanox specific OEM Command */
> > @@ -86,6 +89,7 @@ enum {
> >  #define NCSI_OEM_MLX_CMD_SMAF           0x01   /* CMD ID for Set
> > MC Affinity */
> >  #define NCSI_OEM_MLX_CMD_SMAF_PARAM     0x07   /* Parameter for
> > SMAF         */
> >  /* OEM Command payload lengths*/
> > +#define NCSI_OEM_INTEL_CMD_KEEP_PHY_LEN 7
> >  #define NCSI_OEM_BCM_CMD_GMA_LEN        12
> >  #define NCSI_OEM_MLX_CMD_GMA_LEN        8
> >  #define NCSI_OEM_MLX_CMD_SMAF_LEN        60
> > @@ -271,6 +275,7 @@ enum {
> >         ncsi_dev_state_probe_mlx_gma,
> >         ncsi_dev_state_probe_mlx_smaf,
> >         ncsi_dev_state_probe_cis,
> > +       ncsi_dev_state_probe_keep_phy,
> >         ncsi_dev_state_probe_gvi,
> >         ncsi_dev_state_probe_gc,
> >         ncsi_dev_state_probe_gls,
> > diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c
> > index 42b54a3da2e6..89c7742cd72e 100644
> > --- a/net/ncsi/ncsi-manage.c
> > +++ b/net/ncsi/ncsi-manage.c
> > @@ -689,6 +689,35 @@ static int set_one_vid(struct ncsi_dev_priv
> > *ndp, struct ncsi_channel *nc,
> >         return 0;
> >  }
> > 
> > +#if IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY)
> > +
> > +static int ncsi_oem_keep_phy_intel(struct ncsi_cmd_arg *nca)
> > +{
> > +       unsigned char data[NCSI_OEM_INTEL_CMD_KEEP_PHY_LEN];
> > +       int ret = 0;
> > +
> > +       nca->payload = NCSI_OEM_INTEL_CMD_KEEP_PHY_LEN;
> > +
> > +       memset(data, 0, NCSI_OEM_INTEL_CMD_KEEP_PHY_LEN);
> > +       *(unsigned int *)data = ntohl((__force
> > __be32)NCSI_OEM_MFR_INTEL_ID);
> > +
> > +       data[4] = NCSI_OEM_INTEL_CMD_KEEP_PHY;
> > +
> > +       /* PHY Link up attribute */
> > +       data[6] = 0x1;
> > +
> > +       nca->data = data;
> > +
> > +       ret = ncsi_xmit_cmd(nca);
> > +       if (ret)
> > +               netdev_err(nca->ndp->ndev.dev,
> > +                          "NCSI: Failed to transmit cmd 0x%x
> > during configure\n",
> > +                          nca->type);
> > +       return ret;
> > +}
> > +
> > +#endif
> > +
> >  #if IS_ENABLED(CONFIG_NCSI_OEM_CMD_GET_MAC)
> > 
> >  /* NCSI OEM Command APIs */
> > @@ -1391,8 +1420,24 @@ static void ncsi_probe_channel(struct
> > ncsi_dev_priv *ndp)
> >                                 goto error;
> >                 }
> > 
> > +               nd->state = ncsi_dev_state_probe_gvi;
> > +               if (IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY))
> > +                       nd->state = ncsi_dev_state_probe_keep_phy;
> > +               break;
> > +#if IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY)
> > +       case ncsi_dev_state_probe_keep_phy:
> > +               ndp->pending_req_num = 1;
> > +
> > +               nca.type = NCSI_PKT_CMD_OEM;
> > +               nca.package = ndp->active_package->id;
> > +               nca.channel = 0;
> > +               ret = ncsi_oem_keep_phy_intel(&nca);
> > +               if (ret)
> > +                       goto error;
> > +
> >                 nd->state = ncsi_dev_state_probe_gvi;
> >                 break;
> > +#endif /* CONFIG_NCSI_OEM_CMD_KEEP_PHY */
> >         case ncsi_dev_state_probe_gvi:
> >         case ncsi_dev_state_probe_gc:
> >         case ncsi_dev_state_probe_gls:
> > --
> > 2.31.1
> > 


  reply	other threads:[~2021-07-12 19:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08 12:27 [PATCH v2 0/3] net/ncsi: Add NCSI Intel OEM command to keep PHY link up Ivan Mikhaylov
2021-07-08 12:27 ` [PATCH v2 1/3] net/ncsi: fix restricted cast warning of sparse Ivan Mikhaylov
2021-07-12  9:09   ` Joel Stanley
2021-07-13  9:08     ` Ivan Mikhaylov
2021-07-08 12:27 ` [PATCH v2 2/3] net/ncsi: add NCSI Intel OEM command to keep PHY up Ivan Mikhaylov
2021-07-12 10:01   ` Joel Stanley
2021-07-12 19:32     ` Eddie James [this message]
2021-07-13 10:16     ` Ivan Mikhaylov
2021-07-08 12:27 ` [PATCH v2 3/3] net/ncsi: add dummy response handler for Intel boards Ivan Mikhaylov
2021-07-12 10:03   ` Joel Stanley
2021-07-13  9:42     ` Ivan Mikhaylov
2021-07-20  9:41   ` Paul Fertser
2021-07-20 13:21     ` Ivan Mikhaylov
2021-07-20 13:29       ` Paul Fertser
2021-07-08 21:20 ` [PATCH v2 0/3] net/ncsi: Add NCSI Intel OEM command to keep PHY link up patchwork-bot+netdevbpf
2021-07-20  9:53 ` Paul Fertser
2021-07-20 14:00   ` Ivan Mikhaylov
2021-07-20 14:16     ` Paul Fertser

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=84e7fbd7e65a6ee363763d8155c47d74ed24f9e0.camel@linux.ibm.com \
    --to=eajames@linux.ibm.com \
    --cc=davem@davemloft.net \
    --cc=i.mikhaylov@yadro.com \
    --cc=joel@jms.id.au \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=sam@mendozajonas.com \
    /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;
as well as URLs for NNTP newsgroup(s).