All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Hershberger <joe.hershberger@ni.com>
To: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Cc: u-boot <u-boot@lists.denx.de>,
	"openbmc@lists.ozlabs.org" <openbmc@lists.ozlabs.org>,
	Joseph Hershberger <joseph.hershberger@ni.com>
Subject: Re: [U-Boot] [PATCH v2 4/4] net: NC-SI setup and handling
Date: Tue, 9 Jul 2019 23:33:47 +0000	[thread overview]
Message-ID: <CANr=Z=YA64UbrDQV9SonmpFQwxEbEgVSDOPiE5++v1g8mCtBTQ@mail.gmail.com> (raw)
In-Reply-To: <20190618013720.2823-5-sam@mendozajonas.com>

On Mon, Jun 17, 2019 at 8:43 PM Samuel Mendoza-Jonas
<sam@mendozajonas.com> wrote:
>
> Add the handling of NC-SI ethernet frames, and add a check at the start
> of net_loop() to configure NC-SI before starting other network commands.
> This also adds an "ncsi" command to manually start NC-SI configuration.
>
> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
> ---
> v2: Update ncsi command help text
>
>  cmd/Kconfig   |  8 ++++++++
>  cmd/net.c     | 18 ++++++++++++++++++
>  include/net.h |  2 +-
>  net/net.c     | 27 ++++++++++++++++++++++++++-
>  4 files changed, 53 insertions(+), 2 deletions(-)
>
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index 0badcb3fe0..9851b04972 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -1332,6 +1332,14 @@ config CMD_LINK_LOCAL
>         help
>           Acquire a network IP address using the link-local protocol
>
> +config CMD_NCSI
> +       bool "ncsi"
> +       depends on PHY_NCSI
> +       help
> +         Manually configure the attached NIC via NC-SI.
> +         Normally this happens automatically before other network
> +         operations.
> +
>  endif
>
>  config CMD_ETHSW
> diff --git a/cmd/net.c b/cmd/net.c
> index 89721b8f8b..7d2c21ba4d 100644
> --- a/cmd/net.c
> +++ b/cmd/net.c
> @@ -457,3 +457,21 @@ U_BOOT_CMD(
>  );
>
>  #endif  /* CONFIG_CMD_LINK_LOCAL */
> +
> +#if defined(CONFIG_CMD_NCSI)
> +static int do_ncsi(cmd_tbl_t *cmdtp, int flag, int argc,
> +                  char * const argv[])
> +{
> +       if (net_loop(NCSI) < 0)
> +               return CMD_RET_FAILURE;
> +
> +       return CMD_RET_SUCCESS;
> +}
> +
> +U_BOOT_CMD(
> +       ncsi,   1,      1,      do_ncsi,
> +       "Configure attached NIC via NC-SI",
> +       ""
> +);
> +
> +#endif  /* CONFIG_CMD_NCSI */
> diff --git a/include/net.h b/include/net.h
> index 20c448ee60..9189f0fb53 100644
> --- a/include/net.h
> +++ b/include/net.h
> @@ -531,7 +531,7 @@ extern int          net_restart_wrap;       /* Tried all network devices */
>
>  enum proto_t {
>         BOOTP, RARP, ARP, TFTPGET, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP,
> -       TFTPSRV, TFTPPUT, LINKLOCAL, FASTBOOT, WOL
> +       TFTPSRV, TFTPPUT, LINKLOCAL, FASTBOOT, WOL, NCSI
>  };
>
>  extern char    net_boot_file_name[1024];/* Boot File name */
> diff --git a/net/net.c b/net/net.c
> index 58b0417cbe..a59169a032 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -95,6 +95,7 @@
>  #include <net.h>
>  #include <net/fastboot.h>
>  #include <net/tftp.h>
> +#include <net/ncsi.h>
>  #if defined(CONFIG_LED_STATUS)
>  #include <miiphy.h>
>  #include <status_led.h>
> @@ -407,6 +408,16 @@ int net_loop(enum proto_t protocol)
>         net_try_count = 1;
>         debug_cond(DEBUG_INT_STATE, "--- net_loop Entry\n");
>
> +#ifdef CONFIG_PHY_NCSI
> +       if (protocol != NCSI && !ncsi_active()) {
> +               printf("%s: configuring NCSI first\n", __func__);

NC-SI

> +               if (net_loop(NCSI) < 0)
> +                       return ret;
> +               eth_init_state_only();
> +               goto restart;
> +       }
> +#endif
> +
>         bootstage_mark_name(BOOTSTAGE_ID_ETH_START, "eth_start");
>         net_init();
>         if (eth_is_on_demand_init() || protocol != NETCONS) {
> @@ -420,6 +431,7 @@ int net_loop(enum proto_t protocol)
>         } else {
>                 eth_init_state_only();
>         }
> +
>  restart:
>  #ifdef CONFIG_USB_KEYBOARD
>         net_busy_flag = 0;
> @@ -526,6 +538,11 @@ restart:
>                 case WOL:
>                         wol_start();
>                         break;
> +#endif
> +#if defined(CONFIG_CMD_NCSI)
> +               case NCSI:
> +                       ncsi_probe_packages();
> +                       break;
>  #endif
>                 default:
>                         break;
> @@ -637,7 +654,7 @@ restart:
>                                 env_set_hex("filesize", net_boot_file_size);
>                                 env_set_hex("fileaddr", load_addr);
>                         }
> -                       if (protocol != NETCONS)
> +                       if (protocol != NETCONS && protocol != NCSI)

Why is this using eth_halt_state_only()? It is not using the
eth_init_state_only().

>                                 eth_halt();
>                         else
>                                 eth_halt_state_only();
> @@ -1318,6 +1335,11 @@ void net_process_received_packet(uchar *in_packet, int len)
>         case PROT_WOL:
>                 wol_receive(ip, len);
>                 break;
> +#endif
> +#ifdef CONFIG_PHY_NCSI
> +       case PROT_NCSI:
> +               ncsi_receive(et, ip, len);
> +               break;
>  #endif
>         }
>  }
> @@ -1379,6 +1401,9 @@ common:
>
>  #ifdef CONFIG_CMD_RARP
>         case RARP:
> +#endif
> +#ifdef CONFIG_CMD_NCSI
> +       case NCSI:
>  #endif
>         case BOOTP:
>         case CDP:
> --
> 2.21.0
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot

WARNING: multiple messages have this Message-ID (diff)
From: Joe Hershberger <joe.hershberger@ni.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 4/4] net: NC-SI setup and handling
Date: Tue, 9 Jul 2019 23:33:47 +0000	[thread overview]
Message-ID: <CANr=Z=YA64UbrDQV9SonmpFQwxEbEgVSDOPiE5++v1g8mCtBTQ@mail.gmail.com> (raw)
In-Reply-To: <20190618013720.2823-5-sam@mendozajonas.com>

On Mon, Jun 17, 2019 at 8:43 PM Samuel Mendoza-Jonas
<sam@mendozajonas.com> wrote:
>
> Add the handling of NC-SI ethernet frames, and add a check at the start
> of net_loop() to configure NC-SI before starting other network commands.
> This also adds an "ncsi" command to manually start NC-SI configuration.
>
> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
> ---
> v2: Update ncsi command help text
>
>  cmd/Kconfig   |  8 ++++++++
>  cmd/net.c     | 18 ++++++++++++++++++
>  include/net.h |  2 +-
>  net/net.c     | 27 ++++++++++++++++++++++++++-
>  4 files changed, 53 insertions(+), 2 deletions(-)
>
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index 0badcb3fe0..9851b04972 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -1332,6 +1332,14 @@ config CMD_LINK_LOCAL
>         help
>           Acquire a network IP address using the link-local protocol
>
> +config CMD_NCSI
> +       bool "ncsi"
> +       depends on PHY_NCSI
> +       help
> +         Manually configure the attached NIC via NC-SI.
> +         Normally this happens automatically before other network
> +         operations.
> +
>  endif
>
>  config CMD_ETHSW
> diff --git a/cmd/net.c b/cmd/net.c
> index 89721b8f8b..7d2c21ba4d 100644
> --- a/cmd/net.c
> +++ b/cmd/net.c
> @@ -457,3 +457,21 @@ U_BOOT_CMD(
>  );
>
>  #endif  /* CONFIG_CMD_LINK_LOCAL */
> +
> +#if defined(CONFIG_CMD_NCSI)
> +static int do_ncsi(cmd_tbl_t *cmdtp, int flag, int argc,
> +                  char * const argv[])
> +{
> +       if (net_loop(NCSI) < 0)
> +               return CMD_RET_FAILURE;
> +
> +       return CMD_RET_SUCCESS;
> +}
> +
> +U_BOOT_CMD(
> +       ncsi,   1,      1,      do_ncsi,
> +       "Configure attached NIC via NC-SI",
> +       ""
> +);
> +
> +#endif  /* CONFIG_CMD_NCSI */
> diff --git a/include/net.h b/include/net.h
> index 20c448ee60..9189f0fb53 100644
> --- a/include/net.h
> +++ b/include/net.h
> @@ -531,7 +531,7 @@ extern int          net_restart_wrap;       /* Tried all network devices */
>
>  enum proto_t {
>         BOOTP, RARP, ARP, TFTPGET, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP,
> -       TFTPSRV, TFTPPUT, LINKLOCAL, FASTBOOT, WOL
> +       TFTPSRV, TFTPPUT, LINKLOCAL, FASTBOOT, WOL, NCSI
>  };
>
>  extern char    net_boot_file_name[1024];/* Boot File name */
> diff --git a/net/net.c b/net/net.c
> index 58b0417cbe..a59169a032 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -95,6 +95,7 @@
>  #include <net.h>
>  #include <net/fastboot.h>
>  #include <net/tftp.h>
> +#include <net/ncsi.h>
>  #if defined(CONFIG_LED_STATUS)
>  #include <miiphy.h>
>  #include <status_led.h>
> @@ -407,6 +408,16 @@ int net_loop(enum proto_t protocol)
>         net_try_count = 1;
>         debug_cond(DEBUG_INT_STATE, "--- net_loop Entry\n");
>
> +#ifdef CONFIG_PHY_NCSI
> +       if (protocol != NCSI && !ncsi_active()) {
> +               printf("%s: configuring NCSI first\n", __func__);

NC-SI

> +               if (net_loop(NCSI) < 0)
> +                       return ret;
> +               eth_init_state_only();
> +               goto restart;
> +       }
> +#endif
> +
>         bootstage_mark_name(BOOTSTAGE_ID_ETH_START, "eth_start");
>         net_init();
>         if (eth_is_on_demand_init() || protocol != NETCONS) {
> @@ -420,6 +431,7 @@ int net_loop(enum proto_t protocol)
>         } else {
>                 eth_init_state_only();
>         }
> +
>  restart:
>  #ifdef CONFIG_USB_KEYBOARD
>         net_busy_flag = 0;
> @@ -526,6 +538,11 @@ restart:
>                 case WOL:
>                         wol_start();
>                         break;
> +#endif
> +#if defined(CONFIG_CMD_NCSI)
> +               case NCSI:
> +                       ncsi_probe_packages();
> +                       break;
>  #endif
>                 default:
>                         break;
> @@ -637,7 +654,7 @@ restart:
>                                 env_set_hex("filesize", net_boot_file_size);
>                                 env_set_hex("fileaddr", load_addr);
>                         }
> -                       if (protocol != NETCONS)
> +                       if (protocol != NETCONS && protocol != NCSI)

Why is this using eth_halt_state_only()? It is not using the
eth_init_state_only().

>                                 eth_halt();
>                         else
>                                 eth_halt_state_only();
> @@ -1318,6 +1335,11 @@ void net_process_received_packet(uchar *in_packet, int len)
>         case PROT_WOL:
>                 wol_receive(ip, len);
>                 break;
> +#endif
> +#ifdef CONFIG_PHY_NCSI
> +       case PROT_NCSI:
> +               ncsi_receive(et, ip, len);
> +               break;
>  #endif
>         }
>  }
> @@ -1379,6 +1401,9 @@ common:
>
>  #ifdef CONFIG_CMD_RARP
>         case RARP:
> +#endif
> +#ifdef CONFIG_CMD_NCSI
> +       case NCSI:
>  #endif
>         case BOOTP:
>         case CDP:
> --
> 2.21.0
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

  parent reply	other threads:[~2019-07-10  0:47 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-18  1:37 [PATCH v2 0/4] NC-SI PHY Support Samuel Mendoza-Jonas
2019-06-18  1:37 ` [U-Boot] " Samuel Mendoza-Jonas
2019-06-18  1:37 ` [PATCH v2 1/4] phy: Add support for the NC-SI protocol Samuel Mendoza-Jonas
2019-06-18  1:37   ` [U-Boot] " Samuel Mendoza-Jonas
2019-06-19  2:32   ` Joel Stanley
2019-06-19  2:32     ` [U-Boot] " Joel Stanley
2019-07-09 23:22   ` Joe Hershberger
2019-07-09 23:22     ` Joe Hershberger
2019-06-18  1:37 ` [PATCH v2 2/4] phy: Include NC-SI in phy setup Samuel Mendoza-Jonas
2019-06-18  1:37   ` [U-Boot] " Samuel Mendoza-Jonas
2019-06-19  2:32   ` Joel Stanley
2019-06-19  2:32     ` [U-Boot] " Joel Stanley
2019-07-09 23:24   ` Joe Hershberger
2019-07-09 23:24     ` Joe Hershberger
2019-06-18  1:37 ` [PATCH v2 3/4] net/ftgmac100: Add NC-SI mode support Samuel Mendoza-Jonas
2019-06-18  1:37   ` [U-Boot] " Samuel Mendoza-Jonas
2019-06-18  8:31   ` Cédric Le Goater
2019-06-18  8:31     ` [U-Boot] " Cédric Le Goater
2019-07-09 23:28   ` Joe Hershberger
2019-07-09 23:28     ` Joe Hershberger
2019-06-18  1:37 ` [PATCH v2 4/4] net: NC-SI setup and handling Samuel Mendoza-Jonas
2019-06-18  1:37   ` [U-Boot] " Samuel Mendoza-Jonas
2019-06-19  2:35   ` Joel Stanley
2019-06-19  2:35     ` [U-Boot] " Joel Stanley
2019-06-20  3:35     ` Samuel Mendoza-Jonas
2019-06-20  3:35       ` [U-Boot] " Samuel Mendoza-Jonas
2019-07-09 23:33   ` Joe Hershberger [this message]
2019-07-09 23:33     ` Joe Hershberger
2019-09-09  2:34     ` Samuel Mendoza-Jonas
2019-09-09  2:34       ` Samuel Mendoza-Jonas
2019-06-18  8:35 ` [PATCH v2 0/4] NC-SI PHY Support Cédric Le Goater
2019-06-18  8:35   ` [U-Boot] " Cédric Le Goater
2019-06-19  2:27   ` Joel Stanley
2019-06-19  2:27     ` [U-Boot] " Joel Stanley

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='CANr=Z=YA64UbrDQV9SonmpFQwxEbEgVSDOPiE5++v1g8mCtBTQ@mail.gmail.com' \
    --to=joe.hershberger@ni.com \
    --cc=joseph.hershberger@ni.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=sam@mendozajonas.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.