Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1416480lqp; Mon, 15 Apr 2024 06:10:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXYtJfX1SpTuRYBiVhrzlYU0yI6L37WEkHxc9t/Jdjy19NMNUetVrydkURDbUlolz6uHurvgfWacInmuk5Clg6TpuQfEkrsZn0CsdQf0Q== X-Google-Smtp-Source: AGHT+IGb+8TquEjHTR9OTixkJoAVUVlSUTHV4+OSsHmygkVZGQrzHnHNQC+cu+36G85Le50Rsy/s X-Received: by 2002:a05:6a20:3cab:b0:1a9:694b:cfbd with SMTP id b43-20020a056a203cab00b001a9694bcfbdmr9205129pzj.5.1713186616468; Mon, 15 Apr 2024 06:10:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713186616; cv=pass; d=google.com; s=arc-20160816; b=qRUz22CBIfZihh1YC9zbSVXkVe3MmCgoiwE5DRTLJ39tpxdd2JH9rpaF1i0/+cUU/f ZFS2Kj2svCXyyXw4dqWLNWA0xDI5ej2wIk9DwSvygx+vmvINi+fBdoyD8fH0Q96tkxvL XXL1wgNKUBmQxqimOZ2bCkIntyhcW4tw2X08av/gUl6rM2dYJtlXDCr4C3eVW4+v8uJN ZIql8WzASlNq+GbQeau5GCLr7SAp1OPq56r/nhIsrbhZRvKEOK/2NouWlksD9K80ctcr 8oV+gC9B814BwWbJP482Iu6VWHuJkGVzuU1JKsG4N7Lj/LTL/O5rc79LBafM+B2Y/UPS cs9w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=0ZiAkni61pGt7UsZmTgp8Dq1oPO+rvrlLp0DKseZgaw=; fh=GRXjSm+jfPP1PuQ2qh5w1/fdW+ph2t6Nsz4fBb/3Pfo=; b=ESxSAQfVMzmV0jr6m0n+IQu2dzFCoKOj7gpr9yaKX0iwOa6KJhjzR23P+JjxvUwrNd 1NOqT+YzRs2Vzde1vuRkzkuzcZf7PAHCFD2A2nuqZ4zSMinfB2vyMMUC1+ILf9rO0PHl 5F6WEy2emFpozOq74jIoY8JoKgn7EZ8H7feXfJ3uOpV64hbCgQ9Q8yduNIjoblCVh1VX UTp4ybIGnQzuvEdSmvS12CUH1Cb7V0P5ga6ldE9+KJqdnv7dlzj1t85adbTtHHOv00Wg lf5LA62Oglg/fnY86BkVabl8IKlFEJikeRzkxU4XtvaXuOaYLQ1e1QZQVB+IOmlp4Duk MXTg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=XxfPMjSi; arc=pass (i=1 spf=pass spfdomain=denx.de dkim=pass dkdomain=denx.de dmarc=pass fromdomain=denx.de); spf=pass (google.com: domain of linux-kernel+bounces-145135-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145135-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=denx.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id lp22-20020a056a003d5600b006ed99ade436si7976098pfb.198.2024.04.15.06.10.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 06:10:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145135-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=XxfPMjSi; arc=pass (i=1 spf=pass spfdomain=denx.de dkim=pass dkdomain=denx.de dmarc=pass fromdomain=denx.de); spf=pass (google.com: domain of linux-kernel+bounces-145135-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145135-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=denx.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1CB952802AB for ; Mon, 15 Apr 2024 12:58:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 354DD12881E; Mon, 15 Apr 2024 12:50:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=denx.de header.i=@denx.de header.b="XxfPMjSi" 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.subspace.kernel.org (Postfix) with ESMTPS id 65AC6745FD; Mon, 15 Apr 2024 12:50:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=85.214.62.61 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713185415; cv=none; b=l3DDMLgZB+B8UlfTQEsGtJyAuPPrvbaUgPM0Bdxp/wXSTuRimRnY3uVSTuJemjDJtMLhfBJdAa2y39TkLjvsKmSFeB6zhmqw9wDTfMpUrizKqJkIEwgQk8E6/CzLF94LFa1qV5qMd0eMEpVdcVfcx3b7aGF1KxeIFbmZsaF+zL4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713185415; c=relaxed/simple; bh=Hdykt2B4i1lx8yLnP0uavaOKrQI+GIykrNOpYC+S9nU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fFKulF1FnfHFNgHrthXaHHePMkQ4qqwwsA8SntuthWBRs7gakaLgPNOcf3bU5GEz1IC9i5iqULqmYlUSHD/9cvsDKmE51GDMblv4fEIthsOHNr4kM7zWQ5I8dBNbd1Pltb8e/d8z3DSi2WH50HIRfo79d38WyGWQQ/es+LkEs8U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=denx.de; spf=pass smtp.mailfrom=denx.de; dkim=pass (2048-bit key) header.d=denx.de header.i=@denx.de header.b=XxfPMjSi; arc=none smtp.client-ip=85.214.62.61 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=denx.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=denx.de Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lukma@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 852A8881FB; Mon, 15 Apr 2024 14:50:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1713185406; bh=0ZiAkni61pGt7UsZmTgp8Dq1oPO+rvrlLp0DKseZgaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XxfPMjSi3ybaxKd7cTcMRIHDg0ud7LbbJZGhVE7GlxFprQ85vzRX8QWWCJG/qsoz/ SW8GFWdYaLCIMVZ7UIpSLEyYoXfkipEVOCEiFsSs4b8lIoZ1ddHwZgb3NoZsy9qQuG 9/yybX3hqhTJB9VAcZZR3EW97rkvwdzBPpHvLsjyATwHjf7sQ80waxnEc5D8dWIno0 tyXeMyMjLnSA6hdHF3UTjZDwZ4EZnIeYYOyPArXxClGfIk811LSfpIdhKm3wFh6Foj ujqpevYTCFM1C6wAzlpoZNAWvGBKuvjOnwWGN1rnaj4a65A7gkeguWR016zegBedgy uNKo0e32ygNEg== From: Lukasz Majewski To: netdev@vger.kernel.org, Paolo Abeni Cc: Andrew Lunn , Eric Dumazet , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Oleksij Rempel , Tristram.Ha@microchip.com, Sebastian Andrzej Siewior , Ravi Gunasekaran , Simon Horman , Nikita Zhandarovich , Murali Karicheri , Jiri Pirko , Dan Carpenter , Ziyang Xuan , Shigeru Yoshida , "Ricardo B. Marliere" , linux-kernel@vger.kernel.org, Lukasz Majewski Subject: [net-next PATCH v5 4/4] test: hsr: Add test for HSR RedBOX (HSR-SAN) mode of operation Date: Mon, 15 Apr 2024 14:49:28 +0200 Message-Id: <20240415124928.1263240-5-lukma@denx.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240415124928.1263240-1-lukma@denx.de> References: <20240415124928.1263240-1-lukma@denx.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean This patch adds hsr_redbox.sh script to test if HSR-SAN mode of operation works correctly. Signed-off-by: Lukasz Majewski --- tools/testing/selftests/net/hsr/hsr_redbox.sh | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100755 tools/testing/selftests/net/hsr/hsr_redbox.sh diff --git a/tools/testing/selftests/net/hsr/hsr_redbox.sh b/tools/testing/selftests/net/hsr/hsr_redbox.sh new file mode 100755 index 000000000000..6946a0c6eb17 --- /dev/null +++ b/tools/testing/selftests/net/hsr/hsr_redbox.sh @@ -0,0 +1,97 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +ipv6=false + +source ./hsr_common.sh + +do_complete_ping_test() +{ + echo "INFO: Initial validation ping (HSR-SAN/RedBox)." + # Each node has to be able each one. + do_ping "${ns1}" 100.64.0.2 + do_ping "${ns2}" 100.64.0.1 + # Ping from SAN to hsr1 (via hsr2) + do_ping "${ns3}" 100.64.0.1 + do_ping "${ns1}" 100.64.0.3 + stop_if_error "Initial validation failed." + + # Wait for MGNT HSR frames being received and nodes being + # merged. + sleep 5 + + echo "INFO: Longer ping test (HSR-SAN/RedBox)." + # Ping from SAN to hsr1 (via hsr2) + do_ping_long "${ns3}" 100.64.0.1 + # Ping from hsr1 (via hsr2) to SAN + do_ping_long "${ns1}" 100.64.0.3 + stop_if_error "Longer ping test failed." + + echo "INFO: All good." +} + +setup_hsr_interfaces() +{ + local HSRv="$1" + + echo "INFO: preparing interfaces for HSRv${HSRv} (HSR-SAN/RedBox)." + +# |NS1 | +# | | +# | /-- hsr1 --\ | +# | ns1eth1 ns1eth2 | +# |------------------------| +# | | +# | | +# | | +# |------------------------| |-----------| +# | ns2eth1 ns2eth2 | | | +# | \-- hsr2 --/ | | | +# | \ | | | +# | ns2eth3 |--------| ns3eth1 | +# | (interlink)| | | +# |NS2 (RedBOX) | |NS3 (SAN) | +# + # Check if iproute2 supports adding interlink port to hsrX device + ip link help hsr | grep -q INTERLINK + [ $? -ne 0 ] && { echo "iproute2: HSR interlink interface not supported!"; exit 0; } + + # Create interfaces for name spaces + ip link add ns1eth1 netns "${ns1}" type veth peer name ns2eth1 netns "${ns2}" + ip link add ns1eth2 netns "${ns1}" type veth peer name ns2eth2 netns "${ns2}" + ip link add ns3eth1 netns "${ns3}" type veth peer name ns2eth3 netns "${ns2}" + + sleep 1 + + ip -n "${ns1}" link set ns1eth1 up + ip -n "${ns1}" link set ns1eth2 up + + ip -n "${ns2}" link set ns2eth1 up + ip -n "${ns2}" link set ns2eth2 up + ip -n "${ns2}" link set ns2eth3 up + + ip -n "${ns3}" link set ns3eth1 up + + ip -net "${ns1}" link add name hsr1 type hsr slave1 ns1eth1 slave2 ns1eth2 supervision 45 version ${HSRv} proto 0 + ip -net "${ns2}" link add name hsr2 type hsr slave1 ns2eth1 slave2 ns2eth2 interlink ns2eth3 supervision 45 version ${HSRv} proto 0 + + ip -n "${ns1}" addr add 100.64.0.1/24 dev hsr1 + ip -n "${ns2}" addr add 100.64.0.2/24 dev hsr2 + ip -n "${ns3}" addr add 100.64.0.3/24 dev ns3eth1 + + ip -n "${ns1}" link set hsr1 up + ip -n "${ns2}" link set hsr2 up +} + +check_prerequisites +trap cleanup EXIT SIGKILL SIGTERM + +for i in "$ns1" "$ns2" "$ns3" ;do + ip netns add $i || exit $ksft_skip + ip -net $i link set lo up +done + +setup_hsr_interfaces 1 +do_complete_ping_test + +exit $ret -- 2.20.1