From patchwork Tue Jul 25 21:56:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitrii Merkurev X-Patchwork-Id: 1812897 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20221208 header.b=fs6uqc6S; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4R9W9Z3RkKz1yY5 for ; Wed, 26 Jul 2023 07:57:54 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 954528678C; Tue, 25 Jul 2023 23:57:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="fs6uqc6S"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6C4CC8678C; Tue, 25 Jul 2023 23:57:22 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6935986823 for ; Tue, 25 Jul 2023 23:57:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=3PEXAZAkKBvMYdhjmdiitbjjbgZ.Xjhp-Wjjogdnon.YZis.YZ@flex--dimorinny.bounces.google.com Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-5840614b13cso5426137b3.0 for ; Tue, 25 Jul 2023 14:57:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690322237; x=1690927037; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=l/JNTkYKKVCy3xx1jT/FsdNokTnlhLBeFRy7Y9xGKiw=; b=fs6uqc6SzQbUKdzFKS0OS95aCMxCteAuVDSNsI95/+ItrUxU0Wl2EpvqkuvTOx0CjB 90CjHx9ZyyuC2k32jZpZUB1AM7uQ+g8vb80SdusCGOyZULoWfpv++HaQ9oMfRMOYTw9e WKfIlhB9KDtJEz58pPDQSuyARXC+KwK9fErt1P57nt/D3QDBbQHXXJurWdZ7gujV7f5U YQ+bJWOKGhI3yW6e+OubvV/Wba2tv3a39f5nGXe5jSJslFYDrfaXPtw6D4NBnOA+zWBc 14zij7N0NzWazE9+m4jSxtqckOJyPDgWqPSRivQrkhM8DpyeaAn0TtH+hzVjZfl7XLd1 OeWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690322237; x=1690927037; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=l/JNTkYKKVCy3xx1jT/FsdNokTnlhLBeFRy7Y9xGKiw=; b=L5TS5fmOC31Z3GjnZ0g7e1O4PEa84pHp7bGNiB30ekPTVoIEE7sWeN0rjUU0bPMtlI qi79rR3iBpOvHAJG5B+mVaN5mpuTVouxPPh5EzTSSz7CsdhflDSUCbzDGEdBaOB/lprJ 2S75ZDByb4L9rdyAnYD2RW+2+LoCrUsOU8NLLD1nNNMDrJLSzG04Yiw2UE9XRLuhexbB PwBaHamWbnkRRsq51Y+w4WWFTtOIX3DCiYNrnZEjrQsZCaLpgSX/hDD6t+ho/G8VP1+V MfRlSEjYCY5jei37BzNdBw1mvKMzUsR44eyMyzyRyIzu4gN93SrJ7n4Ahtw5n6giMBnH N3Qw== X-Gm-Message-State: ABy/qLazshOiPAj0WLmrFMiSz9MN1tNegMWxVnuHIk7dJnrUB8ykUgFD SJY9mSi2m2xC2sfyp8DJRQnB1gkIEcR6Gq4tFWYDEZOb9KmZv2TsEWIuGM5ZVMcX8ZwVd7m9C1w tmC3WWnUpE/kqcrao22syiQIKQZOuXZoXfx6JPjeXKcI84cnjWKKJ5XRId5nBPTiRUZA= X-Google-Smtp-Source: APBJJlEYy9T9zo3fGHHk1D7a8XPQOUD2UcIUGBzUc/vhrM+3Rcsi61UKKo1tJErL74ugbmN9TDRsaeijq30WR38= X-Received: from dimorinny0.lon.corp.google.com ([2a00:79e0:d:209:3ee0:2483:5af7:8f8e]) (user=dimorinny job=sendgmr) by 2002:a81:c543:0:b0:56c:e53d:ae90 with SMTP id o3-20020a81c543000000b0056ce53dae90mr4377ywj.4.1690322236956; Tue, 25 Jul 2023 14:57:16 -0700 (PDT) Date: Tue, 25 Jul 2023 22:56:56 +0100 In-Reply-To: <20230725215658.2118831-1-dimorinny@google.com> Mime-Version: 1.0 References: <20230725215658.2118831-1-dimorinny@google.com> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog Message-ID: <20230725215658.2118831-5-dimorinny@google.com> Subject: [PATCH v3 5/6] net: add fastboot TCP documentation and IP6-only mode From: Dmitrii Merkurev To: u-boot@lists.denx.de Cc: rammuthiah@google.com, rfried.dev@gmail.com, Dmitrii Merkurev , Ying-Chun Liu , Simon Glass X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Command to start IPv6 only TCP fastboot: fastboot tcp -ipv6 Signed-off-by: Dmitrii Merkurev Cc: Ying-Chun Liu (PaulLiu) Cc: Simon Glass Сс: Joe Hershberger Сс: Ramon Fried Reviewed-by: Ying-Chun Liu (PaulLiu) Reviewed-by: Simon Glass --- cmd/fastboot.c | 29 ++++++++++++++++++++++++---- doc/android/fastboot.rst | 13 +++++++++++-- doc/usage/cmd/fastboot.rst | 39 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 doc/usage/cmd/fastboot.rst 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..52f955b3d2 100644 --- a/doc/android/fastboot.rst +++ b/doc/android/fastboot.rst @@ -177,17 +177,26 @@ configuration options: In Action --------- -Enter into fastboot by executing the fastboot command in U-Boot for either USB:: +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@4a100000 device Listening for fastboot command on 192.168.0.102 +or TCP:: + + => fastboot tcp [-ipv6] + Using ethernet@4a100000 device + Listening for fastboot command on 192.168.0.102 + Listening for fastboot command on fe80:0000:0000:0000:5054:00ff:fe12:3456 + On the client side you can fetch the bootloader version for instance:: $ fastboot getvar version-bootloader diff --git a/doc/usage/cmd/fastboot.rst b/doc/usage/cmd/fastboot.rst new file mode 100644 index 0000000000..69c7c0e912 --- /dev/null +++ b/doc/usage/cmd/fastboot.rst @@ -0,0 +1,39 @@ +.. SPDX-License-Identifier: GPL-2.0+: + +fastboot command +========== + +Synopis +------- + +:: + + fastboot [-l addr] [-s size] usb | udp [-ipv6] | tcp [-ipv6] + +Description +----------- + +The *fastboot* command allows to start fastboot usb/udp/tcp server to receive +connections from host using fastboot protocol. For more information please refer to: +`doc/android/fastboot.rst`. + +Examples +-------- + +USB:: + + => fastboot usb 0 + +UDP:: + + => fastboot udp [-ipv6] + link up on port 0, speed 100, full duplex + Using ethernet@4a100000 device + Listening for fastboot command on 192.168.0.102 + +TCP:: + + => fastboot tcp [-ipv6] + Using ethernet@4a100000 device + Listening for fastboot command on 192.168.0.102 + Listening for fastboot command on fe80:0000:0000:0000:5054:00ff:fe12:3456