Re: [PATCH v2 5/6] net: add fastboot TCP documentation and IP6-only mode

2023-07-25 Thread Dmitrii Merkurev
>
> Can you please add a doc/usage/cmd/fastboot.rst as well? Can be a
> separate patch.


Added in the v3 version of this patch. Since we already have detailed
`doc/android/fastboot.rst`, I created a short version here
`doc/usage/cmd/fastboot.rst` which refers to android documentation.

On Sun, Jul 23, 2023 at 4:49 AM Simon Glass  wrote:

> Hi Dmitrii,
>
> On Wed, 10 May 2023 at 11:00, Dmitrii Merkurev 
> wrote:
> >
> > Command to start IP6 only TCP fastboot:
> > fastboot tcp -ipv6
> >
> > Signed-off-by: Dmitrii Merkurev 
> > Cc: Ying-Chun Liu (PaulLiu) 
> > Cc: Simon Glass 
> > Сс: Joe Hershberger 
> > Сс: Ramon Fried 
> > ---
> >  cmd/fastboot.c   | 29 +
> >  doc/android/fastboot.rst |  8 +++-
> >  2 files changed, 32 insertions(+), 5 deletions(-)
>
> Reviewed-by: Simon Glass 
>
> Can you please add a doc/usage/cmd/fastboot.rst as well? Can be a
> separate patch.
>
> Regards,
> Simon
>


Re: [PATCH v2 5/6] net: add fastboot TCP documentation and IP6-only mode

2023-07-22 Thread Simon Glass
Hi Dmitrii,

On Wed, 10 May 2023 at 11:00, Dmitrii Merkurev  wrote:
>
> Command to start IP6 only TCP fastboot:
> fastboot tcp -ipv6
>
> Signed-off-by: Dmitrii Merkurev 
> Cc: Ying-Chun Liu (PaulLiu) 
> Cc: Simon Glass 
> Сс: Joe Hershberger 
> Сс: Ramon Fried 
> ---
>  cmd/fastboot.c   | 29 +
>  doc/android/fastboot.rst |  8 +++-
>  2 files changed, 32 insertions(+), 5 deletions(-)

Reviewed-by: Simon Glass 

Can you please add a doc/usage/cmd/fastboot.rst as well? Can be a
separate patch.

Regards,
Simon


Re: [PATCH v2 5/6] net: add fastboot TCP documentation and IP6-only mode

2023-07-14 Thread Ying-Chun Liu (PaulLiu)

Reviewed-by: Ying-Chun Liu (PaulLiu) 


On 2023/5/11 00:59, Dmitrii Merkurev wrote:

Command to start IP6 only TCP fastboot:
fastboot tcp -ipv6

Signed-off-by: Dmitrii Merkurev 
Cc: Ying-Chun Liu (PaulLiu) 
Cc: Simon Glass 
Сс: Joe Hershberger 
Сс: Ramon Fried 
---
  cmd/fastboot.c   | 29 +
  doc/android/fastboot.rst |  8 +++-
  2 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/cmd/fastboot.c b/cmd/fastboot.c
index 3d5ff951eb..36f744ae01 100644
--- a/cmd/fastboot.c
+++ b/cmd/fastboot.c
@@ -12,6 +12,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  #include 
  #include 
@@ -121,10 +122,23 @@ static int do_fastboot(struct cmd_tbl *cmdtp, int flag, 
int argc,
  {
uintptr_t buf_addr = (uintptr_t)NULL;
size_t buf_size = 0;
+   bool is_ipv6_only = false;
+   bool is_usb = false;
+   bool is_udp = false;
+   bool is_tcp = false;
  
  	if (argc < 2)

return CMD_RET_USAGE;
  
+	if (IS_ENABLED(CONFIG_IPV6)) {

+   use_ip6 = false;
+   /* IPv6 parameter has to be always *last* */
+   if (!strcmp(argv[argc - 1], USE_IP6_CMD_PARAM)) {
+   is_ipv6_only = true;
+   --argc;
+   }
+   }
+
while (argc > 1 && **(argv + 1) == '-') {
char *arg = *++argv;
  
@@ -159,11 +173,18 @@ NXTARG:
  
  	fastboot_init((void *)buf_addr, buf_size);
  
-	if (!strcmp(argv[1], "udp"))

+   is_usb = strcmp(argv[1], "usb") == 0;
+   is_udp = strcmp(argv[1], "udp") == 0;
+   is_tcp = strcmp(argv[1], "tcp") == 0;
+
+   if (is_ipv6_only && is_tcp)
+   use_ip6 = true;
+
+   if (is_udp)
return do_fastboot_udp(argc, argv, buf_addr, buf_size);
-   if (!strcmp(argv[1], "tcp"))
+   if (is_tcp)
return do_fastboot_tcp(argc, argv, buf_addr, buf_size);
-   if (!strcmp(argv[1], "usb")) {
+   if (is_usb) {
argv++;
argc--;
}
@@ -174,7 +195,7 @@ NXTARG:
  U_BOOT_CMD(
fastboot, CONFIG_SYS_MAXARGS, 1, do_fastboot,
"run as a fastboot usb or udp device",
-   "[-l addr] [-s size] usb  | udp\n"
+   "[-l addr] [-s size] usb  | udp [-ipv6] | tcp [-ipv6]\n"
"\taddr - address of buffer used during data transfers ("
__stringify(CONFIG_FASTBOOT_BUF_ADDR) ")\n"
"\tsize - size of buffer used during data transfers ("
diff --git a/doc/android/fastboot.rst b/doc/android/fastboot.rst
index 1ad8a897c8..aa6e9e5a9e 100644
--- a/doc/android/fastboot.rst
+++ b/doc/android/fastboot.rst
@@ -181,13 +181,19 @@ Enter into fastboot by executing the fastboot command in 
U-Boot for either USB::
  
 => fastboot usb 0
  
-or UDP::

+UDP::
  
 => fastboot udp

 link up on port 0, speed 100, full duplex
 Using ethernet@4a10 device
 Listening for fastboot command on 192.168.0.102
  
+or TCP::

+
+   => fastboot tcp
+   Using ethernet@4a10 device
+   Listening for fastboot command on 192.168.0.102
+
  On the client side you can fetch the bootloader version for instance::
  
 $ fastboot getvar version-bootloader


[PATCH v2 5/6] net: add fastboot TCP documentation and IP6-only mode

2023-05-10 Thread Dmitrii Merkurev
Command to start IP6 only TCP fastboot:
fastboot tcp -ipv6

Signed-off-by: Dmitrii Merkurev 
Cc: Ying-Chun Liu (PaulLiu) 
Cc: Simon Glass 
Сс: Joe Hershberger 
Сс: Ramon Fried 
---
 cmd/fastboot.c   | 29 +
 doc/android/fastboot.rst |  8 +++-
 2 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/cmd/fastboot.c b/cmd/fastboot.c
index 3d5ff951eb..36f744ae01 100644
--- a/cmd/fastboot.c
+++ b/cmd/fastboot.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -121,10 +122,23 @@ static int do_fastboot(struct cmd_tbl *cmdtp, int flag, 
int argc,
 {
uintptr_t buf_addr = (uintptr_t)NULL;
size_t buf_size = 0;
+   bool is_ipv6_only = false;
+   bool is_usb = false;
+   bool is_udp = false;
+   bool is_tcp = false;
 
if (argc < 2)
return CMD_RET_USAGE;
 
+   if (IS_ENABLED(CONFIG_IPV6)) {
+   use_ip6 = false;
+   /* IPv6 parameter has to be always *last* */
+   if (!strcmp(argv[argc - 1], USE_IP6_CMD_PARAM)) {
+   is_ipv6_only = true;
+   --argc;
+   }
+   }
+
while (argc > 1 && **(argv + 1) == '-') {
char *arg = *++argv;
 
@@ -159,11 +173,18 @@ NXTARG:
 
fastboot_init((void *)buf_addr, buf_size);
 
-   if (!strcmp(argv[1], "udp"))
+   is_usb = strcmp(argv[1], "usb") == 0;
+   is_udp = strcmp(argv[1], "udp") == 0;
+   is_tcp = strcmp(argv[1], "tcp") == 0;
+
+   if (is_ipv6_only && is_tcp)
+   use_ip6 = true;
+
+   if (is_udp)
return do_fastboot_udp(argc, argv, buf_addr, buf_size);
-   if (!strcmp(argv[1], "tcp"))
+   if (is_tcp)
return do_fastboot_tcp(argc, argv, buf_addr, buf_size);
-   if (!strcmp(argv[1], "usb")) {
+   if (is_usb) {
argv++;
argc--;
}
@@ -174,7 +195,7 @@ NXTARG:
 U_BOOT_CMD(
fastboot, CONFIG_SYS_MAXARGS, 1, do_fastboot,
"run as a fastboot usb or udp device",
-   "[-l addr] [-s size] usb  | udp\n"
+   "[-l addr] [-s size] usb  | udp [-ipv6] | tcp [-ipv6]\n"
"\taddr - address of buffer used during data transfers ("
__stringify(CONFIG_FASTBOOT_BUF_ADDR) ")\n"
"\tsize - size of buffer used during data transfers ("
diff --git a/doc/android/fastboot.rst b/doc/android/fastboot.rst
index 1ad8a897c8..aa6e9e5a9e 100644
--- a/doc/android/fastboot.rst
+++ b/doc/android/fastboot.rst
@@ -181,13 +181,19 @@ Enter into fastboot by executing the fastboot command in 
U-Boot for either USB::
 
=> fastboot usb 0
 
-or UDP::
+UDP::
 
=> fastboot udp
link up on port 0, speed 100, full duplex
Using ethernet@4a10 device
Listening for fastboot command on 192.168.0.102
 
+or TCP::
+
+   => fastboot tcp
+   Using ethernet@4a10 device
+   Listening for fastboot command on 192.168.0.102
+
 On the client side you can fetch the bootloader version for instance::
 
$ fastboot getvar version-bootloader
-- 
2.40.1.606.ga4b1b128d6-goog