From patchwork Thu Feb 8 15:45:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Abeni X-Patchwork-Id: 13549978 X-Patchwork-Delegate: kuba@kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F37517B3C8 for ; Thu, 8 Feb 2024 15:45:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707407151; cv=none; b=jry3cG0k+jLyWslXsGojTE29kE8Ti7PHuAzgmFtG2bqrBqHeRJKhspqWfsXYxIWgzyWZxLclFV9ex6V1QhP/nEUwYRRGHOWs371yFuQCyVnH+JF5wueL6oJKNy3gry2S4wAJjAkjhjU5SARZ4fAoEGn0QyrseA3Ufu3iQeDxPRw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707407151; c=relaxed/simple; bh=+HJYZ8oqHC3FdNT1e4ehv7w01FCjmZKJPFhODlJSz5o=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=hSTYANRS8sF2EPu/ZfSJCpkzwM8zFrepcQcHu+S+PqRsUY0Bfo1JpLfgbEmlkygiGMVynlpJNiC2PlQp2xPJZKROliC3xczsXJoqUH5ca1SmxfXL5fn5iu8jOIAiTIGqXYbfPXIwf0bbv+H8nclQ+XYlSAjmKfl2uZZVTvKRibQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=MzZSof19; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MzZSof19" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707407148; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=PkIkmm1xiMrNbNoPpK4ngd8OZ7yo/e1nfxvctzpMBYM=; b=MzZSof19w8/xkPPC/3rWKHiyuD2+7qc6qr8D+XbdL5ODNIQxkaRszxqXQAyswGLMOAzt/O 6tbG0DGz8xapzz+scEFWIoV8S5V9eZ+lgRozJvVOosAK2d+pac1L/qnps38GLyNNKo+3D8 EpzerGKXyiL/ahB2t/qNQtaR0hqr2oc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-223-rKduAvwiNq-EryYzdOdk5A-1; Thu, 08 Feb 2024 10:45:45 -0500 X-MC-Unique: rKduAvwiNq-EryYzdOdk5A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B474885A588; Thu, 8 Feb 2024 15:45:44 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.45.224.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30D6D2166B31; Thu, 8 Feb 2024 15:45:43 +0000 (UTC) From: Paolo Abeni To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Shuah Khan , Willem de Bruijn , Vinicius Costa Gomes , linux-kselftest@vger.kernel.org Subject: [PATCH net] selftests: net: wait for receiver startup in so_txtime.sh Date: Thu, 8 Feb 2024 16:45:34 +0100 Message-ID: <53a7e56424756ef35434bc15a90b256bcf724651.1707407012.git.pabeni@redhat.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Patchwork-Delegate: kuba@kernel.org The mentioned test is failing in slow environments: # SO_TXTIME ipv4 clock monotonic # ./so_txtime: recv: timeout: Resource temporarily unavailable not ok 1 selftests: net: so_txtime.sh # exit=1 The receiver is started in background and the sender could end-up transmitting the packet before the receiver is ready, so that the later recv times out. Address the issue explcitly waiting for the socket being bound to the relevant port. Fixes: af5136f95045 ("selftests/net: SO_TXTIME with ETF and FQ") Signed-off-by: Paolo Abeni Reviewed-by: Willem de Bruijn --- Note that to really cope with slow env the mentioned self-tests also need net-next commit c41dfb0dfbec ("selftests/net: ignore timing errors in so_txtime if KSFT_MACHINE_SLOW"), so this could be applied to net-next, too --- tools/testing/selftests/net/so_txtime.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/testing/selftests/net/so_txtime.sh b/tools/testing/selftests/net/so_txtime.sh index 3f06f4d286a9..ade0e5755099 100755 --- a/tools/testing/selftests/net/so_txtime.sh +++ b/tools/testing/selftests/net/so_txtime.sh @@ -5,6 +5,8 @@ set -e +source net_helper.sh + readonly DEV="veth0" readonly BIN="./so_txtime" @@ -51,13 +53,16 @@ do_test() { local readonly CLOCK="$2" local readonly TXARGS="$3" local readonly RXARGS="$4" + local PROTO if [[ "${IP}" == "4" ]]; then local readonly SADDR="${SADDR4}" local readonly DADDR="${DADDR4}" + PROTO=udp elif [[ "${IP}" == "6" ]]; then local readonly SADDR="${SADDR6}" local readonly DADDR="${DADDR6}" + PROTO=udp6 else echo "Invalid IP version ${IP}" exit 1 @@ -65,6 +70,7 @@ do_test() { local readonly START="$(date +%s%N --date="+ 0.1 seconds")" ip netns exec "${NS2}" "${BIN}" -"${IP}" -c "${CLOCK}" -t "${START}" -S "${SADDR}" -D "${DADDR}" "${RXARGS}" -r & + wait_local_port_listen "${NS2}" 8000 "${PROTO}" ip netns exec "${NS1}" "${BIN}" -"${IP}" -c "${CLOCK}" -t "${START}" -S "${SADDR}" -D "${DADDR}" "${TXARGS}" wait "$!" }