From patchwork Mon May 8 17:15:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitrii Merkurev X-Patchwork-Id: 1778514 X-Patchwork-Delegate: rfried.dev@gmail.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=85.214.62.61; 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=rwCv+bAN; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4QFSdV1Q0Xz20fl for ; Tue, 9 May 2023 03:17:02 +1000 (AEST) 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) 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-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 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 Сс: Joe Hershberger Сс: Ramon Fried Reviewed-by: Ying-Chun Liu (PaulLiu) --- 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@4a100000 device Listening for fastboot command on 192.168.0.102 +or TCP:: + + => 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:: $ fastboot getvar version-bootloader