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 9B550C77B7F for ; Mon, 8 May 2023 17:17:00 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 821A985FD0; Mon, 8 May 2023 19:16:10 +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="rwCv+bAN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CCC108472A; Mon, 8 May 2023 19:16:06 +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 53C2285AFF for ; Mon, 8 May 2023 19:16:04 +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=3Uy5ZZAkKBj4inrtwnss3lttlqj.htrz-gttyqnxyx.ijs2.ij@flex--dimorinny.bounces.google.com Received: by mail-ed1-x54a.google.com with SMTP id 4fb4d7f45d1cf-50bc1a01cffso4357747a12.3 for ; Mon, 08 May 2023 10:16:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683566164; x=1686158164; 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=r5Tr3cdCBXDTyDSyppOpOo//wA42E3OsCAt8r///DhI=; b=rwCv+bANM3RFXio6fs/ihVOMcTibKuweIRsaogBKig9mIwHEUb5LDX3Dja4mUZZ/L4 uN24V7gVZmEzY5AkZzYzlOqxF7kh2Jv87C0MqYu9NZIR6xpLXTgcyGGp91v04OdATmE1 eCeTKltUf+ZGUNGazYcqhvYwL+cQd8eIj1AM2V5XYyWZsmva1vwYufv7xGcjgI5698rh 0qNim4bUyHODFxEOErNPLv9fMfhVkMuOPROFLenaLElQwXIj5NrgBGEJ0e48M7V0svNf cePvwWdWXkOUkZXo5O0QBII0Nk7hhHjem6/AF09Mwk/0Jult5MrzLoyUedx7xWPhImH7 jNeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683566164; x=1686158164; 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=r5Tr3cdCBXDTyDSyppOpOo//wA42E3OsCAt8r///DhI=; b=apVk4qjHNAULIrxyXKdfWWUmCoR4AoUahBoej2rAbadvDNlel/qiy8mZW4LYU2GkdC 51XqSEM47o7brXBzr/TzPi8BAlWo7ciSbYemJU2SXB5278h5VudOpCriSN7tOEVKkivH 4gMcvxBBfBRZbbv0CF/SVj47XHPGF1H0+KT0NhimrVu8itLSmSAXXhZ59bQdcdB4l0Pn wMyiUmmrf++arBp+yMPxDOLecWH2mOVjzJb0LjLaFH5AUyb7HrLeuQPqN/8sdte9eNLH pCn43Uni22HNRNih3FzVNa8aq0pGFdoPIyrCRfd//Rv055pNwRpakRXUQwTb0eNqUa4R ReGQ== X-Gm-Message-State: AC+VfDw9nUN0Bjai3CnvlG3OMTcgTyQspYer+yhFBRj/08TtXf2Dl3g8 ZyL4tCCRdpXU1nlFF6Y3mVUa4Fp1NHMNIah3fCl9JhJwEWgAl33ZyD0TN2AZiZ6YShL/S2vKYuv OOvv+UnzkhSyTHohvKlC1O8x6rhEazJzzQkKo0kBgFQYlUc1yotNWhAJLth9rz5RQ0m8= X-Google-Smtp-Source: ACHHUZ7Z19Qb9je8RjIilHfOXvDpIolvJ+NAedhcW6L7Y2euTsA5tn8AAHzb9OpPC0u+22FTMo+zlbYmdAy9bu8= X-Received: from dimorinny0.lon.corp.google.com ([2a00:79e0:d:209:f357:b9b:9cec:e681]) (user=dimorinny job=sendgmr) by 2002:a17:907:1dcf:b0:95e:d417:ee25 with SMTP id og15-20020a1709071dcf00b0095ed417ee25mr4075916ejc.11.1683566163893; Mon, 08 May 2023 10:16:03 -0700 (PDT) Date: Mon, 8 May 2023 18:15:24 +0100 In-Reply-To: <20230508171525.1082432-1-dimorinny@google.com> Mime-Version: 1.0 References: <20230508171525.1082432-1-dimorinny@google.com> X-Mailer: git-send-email 2.40.1.521.gf1e218fcd8-goog Message-ID: <20230508171525.1082432-5-dimorinny@google.com> Subject: [PATCH 5/6] net: add fastboot TCP documentation and IP6-only mode From: Dmitrii Merkurev To: u-boot@lists.denx.de Cc: rammuthiah@google.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.521.gf1e218fcd8-goog