Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4F533C77B7D for ; Wed, 10 May 2023 17:01:45 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CA289860A6; Wed, 10 May 2023 19:00:31 +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="qsP3Zd5i"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0609786068; Wed, 10 May 2023 19:00:21 +0200 (CEST) Received: from mail-ed1-x54a.google.com (mail-ed1-x54a.google.com [IPv6:2a00:1450:4864:20::54a]) (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 F1C9085D1E for ; Wed, 10 May 2023 19:00:13 +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=3nc1bZAkKBtAz48AD499K2AA270.yA8G-xAAF74EFE.z09J.z0@flex--dimorinny.bounces.google.com Received: by mail-ed1-x54a.google.com with SMTP id 4fb4d7f45d1cf-50bcd245040so8794696a12.0 for ; Wed, 10 May 2023 10:00:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683738013; x=1686330013; 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=1YnWtjAjnpfMPLtYWnZgV9GPKfNowx6lAkaPGSHwf30=; b=qsP3Zd5idCWjQCKwZyZP9yMHMMYpzKi95hpaJ3FjLfYiVyAblL0qgewPUD5PCTTYPt bSVobb+5mivqdGHGEYCY3GzcBrdCvNz7eQc4G4V8zwjcT6/OdkyQZC3p6rdPzUH626Pk CxVhHwpRejqqpLlubhZMb3usQhHx8SZ50yXBxN1d4shWIZkmeFU6sKdELg0hAS35/gh4 AuLLUQrVt1555sgwSJOP77/BrFPc7irpopVAN579qNfDC4f9XJbD3GaqM0gGddKu7wo2 28q/oyVP42L6oc0QloTUzOdfxrPU2xTBmwh4wHNYVSP5b2BMYHM495GRKZdxKzwwsohx PWbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683738013; x=1686330013; 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=1YnWtjAjnpfMPLtYWnZgV9GPKfNowx6lAkaPGSHwf30=; b=IXdb9O0WR8Ujk6x/Md+LdKhaFLZxjJe+AMi+LzA4N0NxIvTcMBXFTztpy0i/zFo90R XGnYfbt3HiZj3BF2bSy71lcTqAuwKoblD4dch8GnCby8v/FitRxxUAk2ttBoA+TaINNA PascukXcNIZhrYoXAYX9G6WrHgmO1hnBYeZpIrIpYWGwimGYD7VYvRmUn6HXpMzVvT7b tOQzPJs4rXrmpId7rig8LPoJGGFBWiuXQJ/5skOayNvtmlUigbkXHzuc0lZMCVwkUAxY HBkUrM1DknLJyeiqqKzaRwb3h+XPTF3pa7YMnhOSUCONusavMG+amG1V6+B+a+Zmq1ER 2zMw== X-Gm-Message-State: AC+VfDzsi0IzziQU8SElwP89E9k+Yr5W53PMeGbbZcTHvxTWowz4TzEh uq4qVCnSBtx1HWhgXAwqzYjWUDMWAKaa6iktS9+8+VDubeCFNZTkhKX9AEQl6EjjllTGptAktIr PZHrQ90YhtEKOTkQbBUrQgxnez6yn4FNilrm8ncn9zC4pfaiYfZuzvyST2V5NgxOEUbI= X-Google-Smtp-Source: ACHHUZ5y4cD1SQ36wO/sHo7HNYub+jW18fD9jGs+7jYQkO3VOsPX3gRrVckfz4sLuL+od7lC1W/lmKVkZGZkoV4= X-Received: from dimorinny0.lon.corp.google.com ([2a00:79e0:d:209:8054:7d60:263c:94b9]) (user=dimorinny job=sendgmr) by 2002:a17:907:a057:b0:966:dd2c:500a with SMTP id gz23-20020a170907a05700b00966dd2c500amr4347750ejc.4.1683738013581; Wed, 10 May 2023 10:00:13 -0700 (PDT) Date: Wed, 10 May 2023 17:59:58 +0100 In-Reply-To: <20230510165959.2228978-1-dimorinny@google.com> Mime-Version: 1.0 References: <20230510165959.2228978-1-dimorinny@google.com> X-Mailer: git-send-email 2.40.1.606.ga4b1b128d6-goog Message-ID: <20230510165959.2228978-5-dimorinny@google.com> Subject: [PATCH v2 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 IP6 only TCP fastboot: fastboot tcp -ipv6 Signed-off-by: Dmitrii Merkurev Cc: Ying-Chun Liu (PaulLiu) Cc: Simon Glass =D0=A1=D1=81: Joe Hershberger =D0=A1=D1=81: 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 fla= g, int argc, { uintptr_t buf_addr =3D (uintptr_t)NULL; size_t buf_size =3D 0; + bool is_ipv6_only =3D false; + bool is_usb =3D false; + bool is_udp =3D false; + bool is_tcp =3D false; =20 if (argc < 2) return CMD_RET_USAGE; =20 + if (IS_ENABLED(CONFIG_IPV6)) { + use_ip6 =3D false; + /* IPv6 parameter has to be always *last* */ + if (!strcmp(argv[argc - 1], USE_IP6_CMD_PARAM)) { + is_ipv6_only =3D true; + --argc; + } + } + while (argc > 1 && **(argv + 1) =3D=3D '-') { char *arg =3D *++argv; =20 @@ -159,11 +173,18 @@ NXTARG: =20 fastboot_init((void *)buf_addr, buf_size); =20 - if (!strcmp(argv[1], "udp")) + is_usb =3D strcmp(argv[1], "usb") =3D=3D 0; + is_udp =3D strcmp(argv[1], "udp") =3D=3D 0; + is_tcp =3D strcmp(argv[1], "tcp") =3D=3D 0; + + if (is_ipv6_only && is_tcp) + use_ip6 =3D 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:: =20 =3D> fastboot usb 0 =20 -or UDP:: +UDP:: =20 =3D> fastboot udp link up on port 0, speed 100, full duplex Using ethernet@4a100000 device Listening for fastboot command on 192.168.0.102 =20 +or TCP:: + + =3D> fastboot tcp + Using ethernet@4a100000 device + Listening for fastboot command on 192.168.0.102 + On the client side you can fetch the bootloader version for instance:: =20 $ fastboot getvar version-bootloader --=20 2.40.1.606.ga4b1b128d6-goog