Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp109316lqo; Tue, 7 May 2024 13:52:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUwqSn6kjE8vhWS0fCCw/sjShKAa+5jmj/zdzIgx8a6uPI0Zm716uqJQiFCPapBA4DZVAZEh9RhMD9BdEqUjCZ+3/qKm8fmReHFXi3bSg== X-Google-Smtp-Source: AGHT+IFjEZkKL8oiTvzxeW7YkZ2rBxKxzYHEnUTzpNKuMklvipN+oO0nkivsOFeEnJlm17nykfH6 X-Received: by 2002:a17:906:4a01:b0:a59:afdd:5911 with SMTP id a640c23a62f3a-a59fb9cf8ebmr36773866b.61.1715115136835; Tue, 07 May 2024 13:52:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715115136; cv=pass; d=google.com; s=arc-20160816; b=Ia4+lzU3mBWCshi6Ji971LflNCVNupdhLui89ttqw9A+dXhYVcD0J6j4APO6kf+56Y u0TNEVP6b2xcMFyOu6Dil8onXRRUeWULySs5IY263BwK9kH2/FIQOft50f11VyeHwV+O NPGLwIEZAxWgRRJwUAyXleV1FPXuVwOqXhDQdCB9Eh5/b04b2hhEinGBVZ7Qe+eoB/Fi DY0Wwk/NCeSzmr2y7j1X5Hgg6fv+/6r+DZ/59ddXnZ/XjKxPD81/++DsWdMpQN0Ayrd+ YWrNY17mjgv0qGxWhZgs6/B6GXeEb6lrrpHGixuYvUDjKB9gAAVWN6vOQyaqDJmnhKLs wv2Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=qdcR2a16esVT3UB13Wto/4zRmwQIrll7yYTlz1PQXa8=; fh=UUbk2b2ZGiNT2CCW2qV+yjoA10KRM7XzqNwcYiNC8Ps=; b=WztivVWLeHdeRa7NpoqdT4RMj7RlwUarpdOpBEaKU0HmOoFwtNTREKJrg+puaUUAFK ZS93uYthsDOyD8RdVkVzmOWXnQFE06pVUkKzvRHCO39c3CMhm1Sl/dkKI3JaCxQhR58b JatZeYuj1kukgHkf391yEao6BNy8j5NdBh4Z+/QYYwGRSuA61HU0NOrqTwxgYQbJYsma 0EDO8VONfuHVqCtf4VYS1VTyHwz/Le5sDqDbpXGToGcODGqqw400meXBGvgZaEihPUv7 nvz9QHKvQRX4RTGQElmYFo/RVsozPxbtRypRWmZmbIcOYEw5jdhfwUd9JhKeMwrXj7Zg km9Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hivFTRQ1; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-172171-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172171-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id i18-20020a1709061cd200b00a59bd8b35f1si3566839ejh.261.2024.05.07.13.52.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 13:52:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172171-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hivFTRQ1; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-172171-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172171-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 617671F233F3 for ; Tue, 7 May 2024 20:52:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 36A4571B4C; Tue, 7 May 2024 20:52:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hivFTRQ1" Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (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 CBAE6187353; Tue, 7 May 2024 20:52:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715115124; cv=none; b=T71EJlxTQ32EICOI4wQPRMrjQaV8JZOxT6Ol9INPan+PESGewiarOrQUdC95Hdi6GzYcMTxUXD4g9m4e/hxeVPLacq9giI14L2ZWnlwI+o43nDx3OF5ckvhWakuZ5FUBI1rRv7d5ShadMFlVXMRs3M7xHI0xrAA8y+xPgeVKzEA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715115124; c=relaxed/simple; bh=b8UZ2RsJ1KvRwNE/4/qun7NqMNi9/Ak7SZwXxlqtD5E=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=J9pRjKyQiNn8dZmoasPGruBMpZlKQ5l9/Y9miIO3QCpTuF0v2y/N+VxxQrNi2OfX33dKUx1uSlyPEoreW1RUKTfBKtkJA3XI3JKhfMQRTpsOfeso6kc9E5zRI70XopSmQOn8tdAiqhqy8XoIUb06L4yY6S3rpWejjbETBsGIdRM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hivFTRQ1; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-34f0e55787aso1973011f8f.2; Tue, 07 May 2024 13:52:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715115120; x=1715719920; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=qdcR2a16esVT3UB13Wto/4zRmwQIrll7yYTlz1PQXa8=; b=hivFTRQ1huyE+NCd428B/jvRiaUVey7DtoY4duh1oTE/7nFH3Ke53YiZrFXCpeDLpo xwzhgDoPhnxA5OkXtVqFRyIZ6IZPoFGuMI73TpMzHxHRpcUxdVkrsX2fhTO9TY9YHVeB UI52nlJLt4vX5jCRL45dyHtyBaTkcidP3BKqYXcz4K+OTGK+VTRkpkAjRWihvJH7UdF7 YSEeIS9m7/YG+1m+RH25SywwaCNovK+51E8IMhr0C8K+wXs9H42dp+ruDDb2zlsssr4u 6OPBN2YR7Bf+Q83/cyS5qxO0u8gHMWdNE+7KN7blntCJ1nZ9iIfEtf4y+T7KYdzFcqYD 21tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715115120; x=1715719920; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qdcR2a16esVT3UB13Wto/4zRmwQIrll7yYTlz1PQXa8=; b=J4beitXZdLy2O1OKoVaSZTWCadg+ncBVE4g0hIjbZjxDMP+jfEGGqL/oDHzCZC5AtA 5aNWWfARRs6Q8olWkh3WdhX9eRCHDDZvvtMwRSQjp4pY47Y24ox6yVjcSi3SFQB4Fe8X ppOBXs2rGxl/w4QgNwACB6frtHWAqwWhMWUV6ds+R/OB5drohJ7RCrQ83B72/bZZk3Lv 4h/npxjwDT6zPNDHhCCMBFuSrGaWMxtMjhG5jkSfYLEK9As4tKkk+BZ1rlZRxZrv1LDn HzeaSIF+w3ncufDcjP8HLs43hIqA2kS0rgaIsgEcNYWCp/ji/Gkb4anWqhhWl/6OzNMl q0dw== X-Forwarded-Encrypted: i=1; AJvYcCWEAJjE1Igtb6yVqoA4DNawhh1E7OIMBldNEcaf7DF/oH4rY5lgA0NsdLBGkyEni29QbkF2kQ5NKugXT+palOJnB5n5hjCJNcleiLlVtWbl8zj/Yodh29+WzJ0zg9D9imlJkIBl7EIfJujAnFyUEgINS9ppNr+1qWk+UG8UkTb6MwsZlBO9ULB+UuTGqMUpliQpLkP2V/E8Md/l X-Gm-Message-State: AOJu0YwomNR/mgfvLvQ3pX3Ad/R2DyWhjhsqBZ9OdGmVu93jfIhZO8la QEo6t7yPrYSV73rFwQsrnBUk6D4Dx7PSjCoEaJcI2dWgvIrKhfBMhd79WCZxM/rZLG6W0JO+6ZK FQSG1mJErpf3JCkN9GY3EHtkECJM= X-Received: by 2002:a5d:6e55:0:b0:34a:3f3d:bb14 with SMTP id ffacd0b85a97d-34fca242709mr600329f8f.27.1715115119939; Tue, 07 May 2024 13:51:59 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240507-upstream-bpf-next-20240506-mptcp-subflow-test-v1-0-e2bcbdf49857@kernel.org> <20240507-upstream-bpf-next-20240506-mptcp-subflow-test-v1-2-e2bcbdf49857@kernel.org> In-Reply-To: From: Alexei Starovoitov Date: Tue, 7 May 2024 13:51:48 -0700 Message-ID: Subject: Re: [PATCH bpf-next 2/4] selftests/bpf: Add RUN_MPTCP_TEST macro To: Matthieu Baerts Cc: MPTCP Upstream , Mat Martineau , Geliang Tang , Andrii Nakryiko , Eduard Zingerman , Mykola Lysenko , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan , LKML , Network Development , bpf , "open list:KERNEL SELFTEST FRAMEWORK" , Geliang Tang Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, May 7, 2024 at 9:02=E2=80=AFAM Matthieu Baerts = wrote: > > Hi Alexei, > > Thank you for the review! > > On 07/05/2024 16:44, Alexei Starovoitov wrote: > > On Tue, May 7, 2024 at 3:53=E2=80=AFAM Matthieu Baerts (NGI0) > > wrote: > >> > >> From: Geliang Tang > >> > >> Each MPTCP subtest tests test__start_subtest(suffix), then invokes > >> test_suffix(). It makes sense to add a new macro RUN_MPTCP_TEST to > >> simpolify the code. > >> > >> Signed-off-by: Geliang Tang > >> Reviewed-by: Mat Martineau > >> Signed-off-by: Matthieu Baerts (NGI0) > >> --- > >> tools/testing/selftests/bpf/prog_tests/mptcp.c | 12 ++++++++---- > >> 1 file changed, 8 insertions(+), 4 deletions(-) > >> > >> diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/te= sting/selftests/bpf/prog_tests/mptcp.c > >> index baf976a7a1dd..9d1b255bb654 100644 > >> --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c > >> +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c > >> @@ -347,10 +347,14 @@ static void test_mptcpify(void) > >> close(cgroup_fd); > >> } > >> > >> +#define RUN_MPTCP_TEST(suffix) \ > >> +do { \ > >> + if (test__start_subtest(#suffix)) \ > >> + test_##suffix(); \ > >> +} while (0) > > > > Please no. > > Don't hide it behind macros. > > I understand, I'm personally not a big fan of hiding code being a macro > too. This one saves only one line. Geliang added a few more tests in our > tree [1], for a total of 9, so that's only saving 9 lines. > > Related to that, if you don't mind, Geliang also added another macro -- > MPTCP_SCHED_TEST -- for tests that are currently only in our tree [2] > (not ready yet). We asked him to reduce the size of this macro to the > minimum. We accepted it because it removed quite a lot of similar code > with very small differences [3]. Do you think we should revert this > modification too? Yeah. Pls don't hide such things in macros. Refactor into helper function in normal C. But, what do you mean "in your tree" ? That's your development tree and you plan to send all that properly as patches to bpf-next someday? > > [1] > https://github.com/multipath-tcp/mptcp_net-next/blob/4369d9cbd752e166961a= c0db7f85886111606301/tools/testing/selftests/bpf/prog_tests/mptcp.c#L578-L5= 95 > > [2] > https://github.com/multipath-tcp/mptcp_net-next/blob/4369d9cbd752e166961a= c0db7f85886111606301/tools/testing/selftests/bpf/prog_tests/mptcp.c#L559-L5= 76 > > [3] > https://lore.kernel.org/mptcp/cover.1713321357.git.tanggeliang@kylinos.cn= /T/#m0b9c14f1cbae8653c6fd119f6b71d1797961d6ba > > Cheers, > Matt > -- > Sponsored by the NGI0 Core fund. >