RE: [PATCH v2 2/2] cmd: brcm: netXtreme commands

2021-10-25 Thread Roman Bacik
> -Original Message-
> From: Heinrich Schuchardt 
> Sent: Saturday, October 23, 2021 1:02 AM
> To: Roman Bacik ; U-Boot Mailing List  b...@lists.denx.de>
> Cc: Bharat Gooty ; Bin Meng
> ; Franck LENORMAND
> ; Kory Maincent
> ; Michal Simek ;
> Patrick Delaunay ; Peng Fan
> ; Priyanka Jain ; Rayagonda
> Kokatanur ; Sean Anderson
> ; Simon Glass 
> Subject: Re: [PATCH v2 2/2] cmd: brcm: netXtreme commands
>
>
>
> On 10/23/21 01:23, Roman Bacik wrote:
> > From: Bharat Gooty 
> >
> > Following netXtreme commands are supported:-
> > Device probe, remove, supported speeds, get/set speeds and
> > get/set MAC address.
> >
> > Signed-off-by: Bharat Gooty 
> >
> > Signed-off-by: Roman Bacik 
>
> Please, add a man-page for the new command in doc/usage/.
> Here is an example: doc/usage/loady.rst
> Add the new man-page to doc/usage/index.rst
> Test building with 'make htmldocs'.
>
> > ---
> >
> > (no changes since v1)
> >
> >   cmd/Kconfig   |   2 +
> >   cmd/broadcom/Kconfig  |  10 ++
> >   cmd/broadcom/Makefile |   3 +-
> >   cmd/broadcom/bnxt.c   | 237
> ++
> >   4 files changed, 251 insertions(+), 1 deletion(-)
> >   create mode 100644 cmd/broadcom/Kconfig
> >   create mode 100644 cmd/broadcom/bnxt.c
> >
> > diff --git a/cmd/Kconfig b/cmd/Kconfig
> > index 5b30b13e438f..e054292dbcd0 100644
> > --- a/cmd/Kconfig
> > +++ b/cmd/Kconfig
> > @@ -1953,6 +1953,8 @@ endmenu
> >
> >   source "cmd/ti/Kconfig"
> >
> > +source "cmd/broadcom/Kconfig"
> > +
> >   config CMD_BOOTSTAGE
> > bool "Enable the 'bootstage' command"
> > depends on BOOTSTAGE
> > diff --git a/cmd/broadcom/Kconfig b/cmd/broadcom/Kconfig
> > new file mode 100644
> > index ..6f16b09d1425
> > --- /dev/null
> > +++ b/cmd/broadcom/Kconfig
> > @@ -0,0 +1,10 @@
> > +menu "Broadcom specific command line interface"
> > +
> > +config BNXT_ETH_CMD
> > +   bool "BNXT commands"
> > +   depends on BNXT_ETH
> > +   help
> > + Broadcom NXS ethernet controller commands. Commands
> supported are:-
> > + Driver probe, Driver remove, Supported speeds, get/set MAC
> address and get/set Link speeds.
> > +
> > +endmenu
> > diff --git a/cmd/broadcom/Makefile b/cmd/broadcom/Makefile
> > index 62268d98d0dd..0027c1c15e5a 100644
> > --- a/cmd/broadcom/Makefile
> > +++ b/cmd/broadcom/Makefile
> > @@ -1,6 +1,7 @@
> >   # SPDX-License-Identifier: GPL-2.0+
> > -# Copyright 2020 Broadcom
> > +# Copyright 2020-2021 Broadcom
> >
> >   obj-y += chimp_boot.o
> >   obj-y += nitro_image_load.o
> >   obj-y += chimp_handshake.o
> > +obj-$(CONFIG_BNXT_ETH_CMD) += bnxt.o
> > diff --git a/cmd/broadcom/bnxt.c b/cmd/broadcom/bnxt.c
> > new file mode 100644
> > index ..b9d1e59a74fb
> > --- /dev/null
> > +++ b/cmd/broadcom/bnxt.c
> > @@ -0,0 +1,237 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Copyright 2021 Broadcom
> > + */
> > +
> > +#include 
> > +#include 
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +static int do_bnxt_set_link(struct bnxt *bp, char *link_str)
> > +{
> > +   bp->link_set = simple_strtoul(link_str, NULL, 16);
> > +
> > +   switch (bp->link_set) {
> > +   case LINK_SPEED_DRV_AUTONEG:
> > +   printf("- AutoNeg Not Supported\n");
> > +   return 0;
>
> Please, remove the leading '- '. It just increases code size.
> In case of an error, please, return CMD_RET_FAILURE.
> Please, remove captitalization of 'Not Supported'
>
> > +   case LINK_SPEED_DRV_1G:
> > +   if (!(bp->support_speeds &
> PORT_QCFG_SUPPORT_SPEEDS_1GB)) {
> > +   printf("- 1 GBPS: Link Speed is not supported\n");
>
> ditto
>
> > +   return 0;
> > +   }
> > +
> > +   break;
> > +   case LINK_SPEED_DRV_10G:
> > +   if (!(bp->support_speeds &
> PORT_QCFG_SUPPORT_SPEEDS_10GB)) {
> > +   printf("- 10 GBPS: Link Speed is not supported\n");
> > +  

RE: [PATCH v2 2/2] cmd: brcm: netXtreme commands

2021-10-25 Thread Roman Bacik
> -Original Message-
> From: Marek BehĂșn 
> Sent: Monday, October 25, 2021 7:01 AM
> To: Roman Bacik 
> Cc: U-Boot Mailing List ; Bharat Gooty
> ; Bin Meng ; Franck
> LENORMAND ; Heinrich Schuchardt
> ; Kory Maincent ;
> Michal Simek ; Patrick Delaunay
> ; Peng Fan ; Priyanka
> Jain ; Rayagonda Kokatanur
> ; Sean Anderson
> ; Simon Glass 
> Subject: Re: [PATCH v2 2/2] cmd: brcm: netXtreme commands
>
> On Fri, 22 Oct 2021 16:23:33 -0700
> Roman Bacik  wrote:
>
> > From: Bharat Gooty 
> >
> > Following netXtreme commands are supported:-
> > Device probe, remove, supported speeds, get/set speeds and
> > get/set MAC address.
>
> NAK.
>
> - "bnxt  get mac
>
>   U-Boot uses the ethaddr and ethNaddr environment variables for MAC
>   addresses. You don't need a new custom command for that when there is
>   a generic mechanism for this.
>
> - " probe" / " remove"
>
>   You also shouldn't need a command for driver probe / remove. DM should
>   probe your driver automatically. And if you need it for debugging,
>   please add such subcommand to the dm command.
>
> - "bnxt  get supported_speed"
>   "bnxt  get link_speed"
>
>   These should be available via the mdio command when you register your
>   PHY driver via appropriate API.
>
> Marek

Hi Marek,

Thank you very much for your feedback. We have two Ethernet drivers. One
is 10/100/1000 MB rmii driver, which is being used as you have described.
The second one is this 10/100 GB bnxt driver, which is probed and managed
on demand with these netXtreme commands. We will have a look and address
your comments.
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.


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [PATCH v2 2/2] cmd: brcm: netXtreme commands

2021-10-25 Thread Marek BehĂșn
On Fri, 22 Oct 2021 16:23:33 -0700
Roman Bacik  wrote:

> From: Bharat Gooty 
> 
> Following netXtreme commands are supported:-
> Device probe, remove, supported speeds, get/set speeds and
> get/set MAC address.

NAK.

- "bnxt  get mac

  U-Boot uses the ethaddr and ethNaddr environment variables for MAC
  addresses. You don't need a new custom command for that when there is
  a generic mechanism for this.

- " probe" / " remove"

  You also shouldn't need a command for driver probe / remove. DM should
  probe your driver automatically. And if you need it for debugging,
  please add such subcommand to the dm command.

- "bnxt  get supported_speed"
  "bnxt  get link_speed"

  These should be available via the mdio command when you register your
  PHY driver via appropriate API.

Marek


Re: [PATCH v2 2/2] cmd: brcm: netXtreme commands

2021-10-24 Thread Simon Glass
On Fri, 22 Oct 2021 at 17:17, Roman Bacik  wrote:
>
> From: Bharat Gooty 
>
> Following netXtreme commands are supported:-
> Device probe, remove, supported speeds, get/set speeds and
> get/set MAC address.
>
> Signed-off-by: Bharat Gooty 
>
> Signed-off-by: Roman Bacik 
> ---
>
> (no changes since v1)
>
>  cmd/Kconfig   |   2 +
>  cmd/broadcom/Kconfig  |  10 ++
>  cmd/broadcom/Makefile |   3 +-
>  cmd/broadcom/bnxt.c   | 237 ++
>  4 files changed, 251 insertions(+), 1 deletion(-)
>  create mode 100644 cmd/broadcom/Kconfig
>  create mode 100644 cmd/broadcom/bnxt.c

doc/usage?


Re: [PATCH v2 2/2] cmd: brcm: netXtreme commands

2021-10-23 Thread Heinrich Schuchardt




On 10/23/21 01:23, Roman Bacik wrote:

From: Bharat Gooty 

Following netXtreme commands are supported:-
Device probe, remove, supported speeds, get/set speeds and
get/set MAC address.

Signed-off-by: Bharat Gooty 

Signed-off-by: Roman Bacik 


Please, add a man-page for the new command in doc/usage/.
Here is an example: doc/usage/loady.rst
Add the new man-page to doc/usage/index.rst
Test building with 'make htmldocs'.


---

(no changes since v1)

  cmd/Kconfig   |   2 +
  cmd/broadcom/Kconfig  |  10 ++
  cmd/broadcom/Makefile |   3 +-
  cmd/broadcom/bnxt.c   | 237 ++
  4 files changed, 251 insertions(+), 1 deletion(-)
  create mode 100644 cmd/broadcom/Kconfig
  create mode 100644 cmd/broadcom/bnxt.c

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 5b30b13e438f..e054292dbcd0 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1953,6 +1953,8 @@ endmenu

  source "cmd/ti/Kconfig"

+source "cmd/broadcom/Kconfig"
+
  config CMD_BOOTSTAGE
bool "Enable the 'bootstage' command"
depends on BOOTSTAGE
diff --git a/cmd/broadcom/Kconfig b/cmd/broadcom/Kconfig
new file mode 100644
index ..6f16b09d1425
--- /dev/null
+++ b/cmd/broadcom/Kconfig
@@ -0,0 +1,10 @@
+menu "Broadcom specific command line interface"
+
+config BNXT_ETH_CMD
+   bool "BNXT commands"
+   depends on BNXT_ETH
+   help
+ Broadcom NXS ethernet controller commands. Commands supported are:-
+ Driver probe, Driver remove, Supported speeds, get/set MAC address 
and get/set Link speeds.
+
+endmenu
diff --git a/cmd/broadcom/Makefile b/cmd/broadcom/Makefile
index 62268d98d0dd..0027c1c15e5a 100644
--- a/cmd/broadcom/Makefile
+++ b/cmd/broadcom/Makefile
@@ -1,6 +1,7 @@
  # SPDX-License-Identifier: GPL-2.0+
-# Copyright 2020 Broadcom
+# Copyright 2020-2021 Broadcom

  obj-y += chimp_boot.o
  obj-y += nitro_image_load.o
  obj-y += chimp_handshake.o
+obj-$(CONFIG_BNXT_ETH_CMD) += bnxt.o
diff --git a/cmd/broadcom/bnxt.c b/cmd/broadcom/bnxt.c
new file mode 100644
index ..b9d1e59a74fb
--- /dev/null
+++ b/cmd/broadcom/bnxt.c
@@ -0,0 +1,237 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2021 Broadcom
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int do_bnxt_set_link(struct bnxt *bp, char *link_str)
+{
+   bp->link_set = simple_strtoul(link_str, NULL, 16);
+
+   switch (bp->link_set) {
+   case LINK_SPEED_DRV_AUTONEG:
+   printf("- AutoNeg Not Supported\n");
+   return 0;


Please, remove the leading '- '. It just increases code size.
In case of an error, please, return CMD_RET_FAILURE.
Please, remove captitalization of 'Not Supported'


+   case LINK_SPEED_DRV_1G:
+   if (!(bp->support_speeds & PORT_QCFG_SUPPORT_SPEEDS_1GB)) {
+   printf("- 1 GBPS: Link Speed is not supported\n");


ditto


+   return 0;
+   }
+
+   break;
+   case LINK_SPEED_DRV_10G:
+   if (!(bp->support_speeds & PORT_QCFG_SUPPORT_SPEEDS_10GB)) {
+   printf("- 10 GBPS: Link Speed is not supported\n");
+   return 0;


ditto



+   }
+
+   break;
+   case LINK_SPEED_DRV_25G:
+   if (!(bp->support_speeds & PORT_QCFG_SUPPORT_SPEEDS_25GB)) {
+   printf("- 25 GBPS: Link Speed is not supported\n");
+   return 0;


ditto


+   }
+
+   break;
+   case LINK_SPEED_DRV_40G:
+   printf("- 40 GBPS Not Supported\n");
+   return 0;


ditto


+   case LINK_SPEED_DRV_50G:
+   if (!(bp->support_speeds & PORT_QCFG_SUPPORT_SPEEDS_50GB)) {
+   printf("- 50 GBPS: Link Speed is not supported\n");
+   return 0;


ditto


+   }
+
+   break;
+   case LINK_SPEED_DRV_100G:
+   if (!(bp->support_speeds & PORT_QCFG_SUPPORT_SPEEDS_100GB)) {
+   printf("- 100 GBPS: Link Speed is not supported\n");
+   return 0;


ditto


+   }
+
+   break;
+   case LINK_SPEED_DRV_200G:
+   if (!(bp->support_speeds & PORT_QCFG_SUPPORT_SPEEDS_200GB)) {
+   printf("- 200 GBPS: Link Speed is not supported\n");
+   return 0;


ditto


+   }
+
+   break;
+   case LINK_SPEED_DRV_2_5G:
+   if (!(bp->support_speeds & PORT_QCFG_SUPPORT_SPEEDS_2_5GB)) {
+   printf("- 2.5 GBPS: Link Speed is not supported\n");


ditto


+   return 0;
+   }
+
+   break;
+   case LINK_SPEED_DRV_100M:
+   if (!(bp->support_speeds & PORT_QCFG_SUPPORT_SPEEDS_100MB)) {
+