From patchwork Fri Dec 2 09:17:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vyacheslav V. Mitrofanov" X-Patchwork-Id: 1711306 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 (1024-bit key; unprotected) header.d=yadro.com header.i=@yadro.com header.a=rsa-sha256 header.s=mta-01 header.b=FRzuFveA; 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) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NNnSN425lz23nf for ; Fri, 2 Dec 2022 20:18:58 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EAAC58534F; Fri, 2 Dec 2022 10:18:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=yadro.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=yadro.com header.i=@yadro.com header.b="FRzuFveA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 812A485221; Fri, 2 Dec 2022 10:18:46 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mta-01.yadro.com (mta-02.yadro.com [89.207.88.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 81F5285221 for ; Fri, 2 Dec 2022 10:18:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=yadro.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=v.v.mitrofanov@yadro.com Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 1C71B40311; Fri, 2 Dec 2022 09:18:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :x-mailer:message-id:date:date:subject:subject:from:from :received:received:received:received; s=mta-01; t=1669972721; x= 1671787122; bh=7Uw6hpULbVibGkvgsLpWqYYCvkbAPRMlis+z5E7FL2o=; b=F RzuFveAfMLpY/m5jcjGCrwqgus5XHfgYacxZIAQ/gGBtu3OwZfI/NSICtKfiABqI YAhflZWPezOY/HYgZTY50bhMw9loafrrzN0g949OacWFvJL3vrH2MNCOcByY8Wti tlZf6EV3cdb1sZeV6srXCfHszYxdvRilS5QrkDWQr8= Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 60jMr-QRQNnd; Fri, 2 Dec 2022 12:18:41 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (T-EXCH-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id A34CB4014D; Fri, 2 Dec 2022 12:18:40 +0300 (MSK) Received: from T-Exch-05.corp.yadro.com (172.17.10.109) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Fri, 2 Dec 2022 12:18:40 +0300 Received: from v.yadro.com (10.178.114.10) by T-Exch-05.corp.yadro.com (172.17.10.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1118.9; Fri, 2 Dec 2022 12:18:39 +0300 From: Viacheslav Mitrofanov To: CC: , , , , , , Subject: [PATCH v5 00/19] IPv6 support Date: Fri, 2 Dec 2022 12:17:57 +0300 Message-ID: <20221202091818.2382748-1-v.v.mitrofanov@yadro.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.178.114.10] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-Exch-05.corp.yadro.com (172.17.10.109) 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.6 at phobos.denx.de X-Virus-Status: Clean This patch set adds basic IPv6 support to U-boot. It is based on Chris's Packham patches (https://lists.denx.de/pipermail/u-boot/2017-January/279366.html) Chris's patches were taken as base. There were efforts to launch it on HiFive SiFive Unmatched board but the board didn't work well. The code was refactored, fixed some bugs as CRC for little-endian, some parts were implemented in our own way, something was taken from Linux. Finally we did manual tests and the board worked well. Testing was done on HiFive SiFive Unmatched board (RISC-V) Signed-off-by: Viacheslav Mitrofanov --- Changes in v2: - Split big patches into smaller - If an address in tftpboot is IPv6 than use IPv6 to boot - Add tests Changes in v3: - Added functions and structures description in whole patch-series - Removed memory allocation in on_ip6addr() - Some functions got return code from errno.h - Add to string_to_ip6() length parameter to avoid obligatory null termination - Add a lot of small decorative cnages Changes in v4: - Fixed funcs and structures style description - Added omitted tags Changes in v5: - Move patches to the latest u-boot version - Move IPV6 tests under CONFIG_IPV6 ifdef - Add CONFIG_IPV6 to sandboxes Viacheslav Mitrofanov (19): net: ipv6: Add IPv6 basic primitives net: ipv6: Add IPv6 build options net: ipv6: Add callbacks declarations to get access to IPv6 variables net: ipv6: Add Neighbor Discovery Protocol (NDP) net: ipv6: Add string_to_ip6 converter net: ipv6: Enable IPv6 typeconversion specifier net: ipv6: Add ip6addr, gatewayip6, serverip6 variables callbacks net: ipv6: Add implementation of main IPv6 functions net: ipv6: Incorporate IPv6 support into u-boot net subsystem net: tftp: Add IPv6 support for tftpboot net: ping6: Add ping6 command test: dm: eth: Add string_to_ip6 test test: dm: eth: Add csum_ipv6_magic test test: dm: eth: Add ip6_addr_in_subnet test test: dm: eth: Add ip6_make_snma test test: dm: eth: Add ip6_make_lladdr test configs: Add IPV6 config to sandbox_defconfig configs: Add IPV6 config to sandbox64_defconfig configs: Add IPV6 config to sandbox_flattree_defconfig cmd/Kconfig | 7 + cmd/net.c | 61 ++++ configs/sandbox64_defconfig | 1 + configs/sandbox_defconfig | 1 + configs/sandbox_flattree_defconfig | 1 + include/env_callback.h | 10 + include/env_flags.h | 10 + include/ndisc.h | 102 +++++++ include/net.h | 4 +- include/net6.h | 432 ++++++++++++++++++++++++++++ lib/net_utils.c | 109 +++++++ lib/vsprintf.c | 7 +- net/Kconfig | 10 + net/Makefile | 3 + net/ndisc.c | 289 +++++++++++++++++++ net/net.c | 53 +++- net/net6.c | 445 +++++++++++++++++++++++++++++ net/ping6.c | 118 ++++++++ net/tftp.c | 58 +++- test/dm/eth.c | 148 ++++++++++ 20 files changed, 1853 insertions(+), 16 deletions(-) create mode 100644 include/ndisc.h create mode 100644 include/net6.h create mode 100644 net/ndisc.c create mode 100644 net/net6.c create mode 100644 net/ping6.c