From patchwork Thu Feb 9 11:26:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrei Gherzan X-Patchwork-Id: 1739887 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.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=f1b8Plh8; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PCF5M3W4Zz23fc for ; Thu, 9 Feb 2023 22:29:43 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1pQ57Q-0000UK-FW; Thu, 09 Feb 2023 11:29:36 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pQ57N-0000TI-BU for kernel-team@lists.ubuntu.com; Thu, 09 Feb 2023 11:29:33 +0000 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (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 smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id F2DC03F126 for ; Thu, 9 Feb 2023 11:29:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1675942173; bh=Z9FlWrzXJZFZsaoVRHyqbcjBEiYxOTY/b9e1Nea0zyA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=f1b8Plh8AL/3u3MRSiV0uZtYjtMFlmssgJ0Mtjd8XhyZgY+0etCUrr65pAD5tZ2mZ KfHMNVUWodBcCb29AAWLXP2qvvWucBr/Zx6cxynrT2q/PuavaHKCdMsiJcbsRWK9nm UPG9+0CTP80uzovQH4mU6q15IoIQ1SpwxUTT74oaVclSs3wBx5a7wXLfbUXclMxu5+ NhQaYgdSd2syw1kVx5yGBTwHGmMJ5yrv92mCIVaXNx1CoH4zTH+JO6vYt8FLw1MOcn E/4lT2QHJPxc1jggDVN7YxoGAtxeAgZvEm0H+axcsveRdelh40PVGfGDVDvbR9Z5+/ EFhFp7zq7AO/w== Received: by mail-wr1-f71.google.com with SMTP id n14-20020a5d598e000000b002c3f0a93825so383347wri.15 for ; Thu, 09 Feb 2023 03:29:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z9FlWrzXJZFZsaoVRHyqbcjBEiYxOTY/b9e1Nea0zyA=; b=SfW2RkPcupCUjs4Zxq9se8Q3cbOiY+Xi6KVS9C7GnzZakEkSe9EbPJKfPfFzbEYXJw DmY2TaXWAy9wF7S1s4P+Vv2MC7qwcDZAOdAjd+oZoqhQZT7mPWwmBBH0GOh845N3cUtl vEf56nBVNIWi5Sd/Vampj2Ll3+9dP8w4bV1nr8Lot/xSRlc9P9+kKK4ZKg07DpmVS6qE hw236q2iYZpjgjmvorzjuSCH4VM/pwefFt8k77BEY6OgRfI5bxqqmcP+ikvUFJD9X4AQ Pn3kJbEIs4Q3d7jl/arNYMjSUZCMz9/PkZ6g4YjzlUilzoYg2wRWZhcvrAh4cGL0TnFR NtZA== X-Gm-Message-State: AO0yUKVehFnUQeZIvK1qSe9wD38pXLWI/NCdW7yG/WvSvRqyqn3+k6Ud QwK7AywAvUCYMmAVTPsyQPSdB0Wd58YAQm5Y/xlPchDE5YyaLi/HWVKd1bWwbXr7IOxexnumMhT 5FrGkoAjvCvnK4Pu98i2WtJ5JFw/pmZeMUYhmNTanbtoz5rs= X-Received: by 2002:adf:f783:0:b0:2bf:c741:5956 with SMTP id q3-20020adff783000000b002bfc7415956mr9698078wrp.19.1675942172403; Thu, 09 Feb 2023 03:29:32 -0800 (PST) X-Google-Smtp-Source: AK7set90wyaEgvKEhFtc42+Grp+7T8TXZBIZljC9KJh9HY5Yzf6QqOrkCAKhTVm8rt0zflUy661AeA== X-Received: by 2002:adf:f783:0:b0:2bf:c741:5956 with SMTP id q3-20020adff783000000b002bfc7415956mr9698070wrp.19.1675942172247; Thu, 09 Feb 2023 03:29:32 -0800 (PST) Received: from qwirkle.internal ([81.2.157.149]) by smtp.gmail.com with ESMTPSA id j3-20020adff003000000b002bddaea7a0bsm1015043wro.57.2023.02.09.03.29.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 03:29:31 -0800 (PST) From: Andrei Gherzan To: kernel-team@lists.ubuntu.com Subject: [SRU][Lunar][PATCH v2 1/3] selftests: net: Add cross-compilation support for BPF programs Date: Thu, 9 Feb 2023 11:26:14 +0000 Message-Id: <20230209112615.585029-2-andrei.gherzan@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230209112615.585029-1-andrei.gherzan@canonical.com> References: <20230209112615.585029-1-andrei.gherzan@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrei Gherzan Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Björn Töpel BugLink: https://bugs.launchpad.net/ubuntu/bugs/1996536 The selftests/net does not have proper cross-compilation support, and does not properly state libbpf as a dependency. Mimic/copy the BPF build from selftests/bpf, which has the nice side-effect that libbpf is built as well. Signed-off-by: Björn Töpel Reviewed-by: Anders Roxell Link: https://lore.kernel.org/r/20221119171841.2014936-1-bjorn@kernel.org Signed-off-by: Paolo Abeni (cherry-picked from 837a3d66d698516ad2330e122eba9752ec3a48ed) Signed-off-by: Andrei Gherzan --- tools/testing/selftests/net/bpf/Makefile | 45 +++++++++++++++++++++--- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/bpf/Makefile b/tools/testing/selftests/net/bpf/Makefile index 7d8eddd327b7..1d4a0059fb47 100644 --- a/tools/testing/selftests/net/bpf/Makefile +++ b/tools/testing/selftests/net/bpf/Makefile @@ -1,15 +1,52 @@ # SPDX-License-Identifier: GPL-2.0 CLANG ?= clang +SCRATCH_DIR := $(OUTPUT)/tools +BUILD_DIR := $(SCRATCH_DIR)/build +BPFDIR := $(abspath ../../../lib/bpf) +APIDIR := $(abspath ../../../include/uapi) + CCINCLUDE += -I../../bpf -CCINCLUDE += -I../../../../lib CCINCLUDE += -I../../../../../usr/include/ +CCINCLUDE += -I$(SCRATCH_DIR)/include + +BPFOBJ := $(BUILD_DIR)/libbpf/libbpf.a + +MAKE_DIRS := $(BUILD_DIR)/libbpf +$(MAKE_DIRS): + mkdir -p $@ TEST_CUSTOM_PROGS = \ # $(OUTPUT)/bpf/nat6to4.o # Disabled for Ubuntu selftests build all: $(TEST_CUSTOM_PROGS) -$(OUTPUT)/%.o: %.c - $(CLANG) -O2 -target bpf -c $< $(CCINCLUDE) -o $@ +# Get Clang's default includes on this system, as opposed to those seen by +# '-target bpf'. This fixes "missing" files on some architectures/distros, +# such as asm/byteorder.h, asm/socket.h, asm/sockios.h, sys/cdefs.h etc. +# +# Use '-idirafter': Don't interfere with include mechanics except where the +# build would have failed anyways. +define get_sys_includes +$(shell $(1) $(2) -v -E - &1 \ + | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') \ +$(shell $(1) $(2) -dM -E - X-Patchwork-Id: 1739888 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.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=LpVO3DDM; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PCF5M4rJWz23kw for ; Thu, 9 Feb 2023 22:29:43 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1pQ57R-0000VC-NO; Thu, 09 Feb 2023 11:29:37 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pQ57P-0000Tr-1l for kernel-team@lists.ubuntu.com; Thu, 09 Feb 2023 11:29:35 +0000 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (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 smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id CD9A33F0E1 for ; Thu, 9 Feb 2023 11:29:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1675942174; bh=7yQZY4wEqno5oTq4Lb5ymSmain/Vv+bof7SfI+LBmXE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=LpVO3DDMTpR9o6T1/WFR4OxSxtS3J3W5e6Ptg41BE/0dOYEvnSyXdAJAaS+zR7DKI T8W8dHdzrHuAd5XF+s/g+MIjvAe8zeiSxPeL761S6BzfqX4mmIreiaAsSxjeOCBLCg nFrJcSS66rID3rzvF/O9XAy9PRrzCPNz17N//6V1qppUAgbMrJ2iz9Ch2iEOpXkD7q LCwuuQaDcrVMJ1WLecDbs6D6l5o3zRJotDeOEIZT0z2im+mF0ug9hHD2u0qgMt0OKS tcJkIyoSuoLiTYUh8jXvlK3KrT1Y5TFMyHUxY1c+FLz1LN1htranIWMbD2Yqkdg4wL ui01DktCWSuSA== Received: by mail-wm1-f70.google.com with SMTP id o8-20020a05600c510800b003dfdf09ffc2so924751wms.5 for ; Thu, 09 Feb 2023 03:29:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7yQZY4wEqno5oTq4Lb5ymSmain/Vv+bof7SfI+LBmXE=; b=E8c2r/NsSg52EsK3m38y1orNgydRlTRX3xANlDL6w4WVOfYXqJVC8m7Loq+kj2YOnf iVtBHfJhy7BgwTpDdsNrH7V2dPSzjR6kcksbCFExwSDQi81bXH4a9ecr/77CXyaQpN4U iiDQ4/m+g0U8QlrZlbDmk+uu6keDKAQdbTdXYLmLaI/2unLBrRZa0ceui3EyLcKFL3er djoJ4JZYU4OHBRXQbXvLLYeVgaJ92IzACUy3cutk/xlmNVp7Y5Hk8OpedXGh+ywfZyRQ tGr+tWSkMFt1r3IixudKjr8gM9mFh4bpocHH3246MjAKL1qbo/Ix9s+DhwyA+VlLX4Bw 4TEA== X-Gm-Message-State: AO0yUKWZCwhSh+BTwJYsee2ltUVDgxt+ywJ3S3/O3FlVJWDtonx1ZizK 1gn7Fnd58JTvgNvGotnpPjnW+36cJtRfMPrUtxEIYsayjiNqSmXb4Lg1/wh5H8HEfi5dQvC93CU nPox2UNfdXEW6pEe6VyZqNNAst2dH/UyfQNbtU5tU5xAlxKU= X-Received: by 2002:adf:e94d:0:b0:2c5:3ccf:e998 with SMTP id m13-20020adfe94d000000b002c53ccfe998mr1214780wrn.66.1675942174351; Thu, 09 Feb 2023 03:29:34 -0800 (PST) X-Google-Smtp-Source: AK7set8WxxBMm3CpnkwSCDbaWQCf5MaDzkFsLlj1yCX6RRZ2MqweytbIhVYE+vOgD+eUSCPgxNzvBA== X-Received: by 2002:adf:e94d:0:b0:2c5:3ccf:e998 with SMTP id m13-20020adfe94d000000b002c53ccfe998mr1214772wrn.66.1675942174192; Thu, 09 Feb 2023 03:29:34 -0800 (PST) Received: from qwirkle.internal ([81.2.157.149]) by smtp.gmail.com with ESMTPSA id j3-20020adff003000000b002bddaea7a0bsm1015043wro.57.2023.02.09.03.29.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 03:29:33 -0800 (PST) From: Andrei Gherzan To: kernel-team@lists.ubuntu.com Subject: [SRU][Lunar][PATCH v2 2/3] selftests: net: Fix O=dir builds Date: Thu, 9 Feb 2023 11:26:15 +0000 Message-Id: <20230209112615.585029-3-andrei.gherzan@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230209112615.585029-1-andrei.gherzan@canonical.com> References: <20230209112615.585029-1-andrei.gherzan@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrei Gherzan Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Björn Töpel The BPF Makefile in net/bpf did incorrect path substitution for O=dir builds, e.g. make O=/tmp/kselftest headers make O=/tmp/kselftest -C tools/testing/selftests would fail in selftest builds [1] net/ with clang-16: error: no such file or directory: 'kselftest/net/bpf/nat6to4.c' clang-16: error: no input files Add a pattern prerequisite and an order-only-prerequisite (for creating the directory), to resolve the issue. [1] https://lore.kernel.org/all/202212060009.34CkQmCN-lkp@intel.com/ Reported-by: kernel test robot Fixes: 837a3d66d698 ("selftests: net: Add cross-compilation support for BPF programs") Signed-off-by: Björn Töpel Link: https://lore.kernel.org/r/20221206102838.272584-1-bjorn@kernel.org Signed-off-by: Jakub Kicinski (cherry-picked from 17961a37ce4077ae43128ba5ce0b1dfd8f02fdb9) Signed-off-by: Andrei Gherzan --- tools/testing/selftests/net/bpf/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/net/bpf/Makefile b/tools/testing/selftests/net/bpf/Makefile index 1d4a0059fb47..ef106dee8675 100644 --- a/tools/testing/selftests/net/bpf/Makefile +++ b/tools/testing/selftests/net/bpf/Makefile @@ -12,7 +12,7 @@ CCINCLUDE += -I$(SCRATCH_DIR)/include BPFOBJ := $(BUILD_DIR)/libbpf/libbpf.a -MAKE_DIRS := $(BUILD_DIR)/libbpf +MAKE_DIRS := $(BUILD_DIR)/libbpf $(OUTPUT)/bpf $(MAKE_DIRS): mkdir -p $@ @@ -38,8 +38,8 @@ endif CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH)) -$(TEST_CUSTOM_PROGS): $(BPFOBJ) - $(CLANG) -O2 -target bpf -c $(@:.o=.c) $(CCINCLUDE) $(CLANG_SYS_INCLUDES) -o $@ +$(TEST_CUSTOM_PROGS): $(OUTPUT)/%.o: %.c $(BPFOBJ) | $(MAKE_DIRS) + $(CLANG) -O2 -target bpf -c $< $(CCINCLUDE) $(CLANG_SYS_INCLUDES) -o $@ $(BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile) \ $(APIDIR)/linux/bpf.h \ From patchwork Thu Feb 9 11:26:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrei Gherzan X-Patchwork-Id: 1739889 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.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=u9L2iXOA; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PCF5d2Y5nz23fc for ; Thu, 9 Feb 2023 22:29:57 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1pQ57f-0000hb-7z; Thu, 09 Feb 2023 11:29:51 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pQ57b-0000eb-Mq for kernel-team@lists.ubuntu.com; Thu, 09 Feb 2023 11:29:47 +0000 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (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 smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 01E053F0E1 for ; Thu, 9 Feb 2023 11:29:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1675942187; bh=dLhlhNl1G07alx425D+rHTXx9JqCWVcaa/t9XJAyVQA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=u9L2iXOA6EvEG+/nfRdH+TgqrIiqIOQSBEGcc5P3i+eND2BTTOGNuPffhz3PJlI5U +c9sQgCzx3EI1wm/fN9yXyq0sXosfB/KJww2E+vdqpCsxmOgMaewD9cNwIWrMMC7h3 tSF4LhtLALh2K02LpHiSO4HUtJ9gtqcZ+gnlL9iiNdwotBECIQrkaOoQhNkRCpYe7U 14dwv9INJlyfkpCR6QSNymyejseUgJQbafV5y1FRytDiGLDm2cPr5rVxvjxBjON39C AY+jWuLTd6PVL34P3qjJiB0OfHrCiWD/UyqkIWvDZtugah/hOCr2n+rq+Gz7/c01pt cZSY6ZUt9/ojg== Received: by mail-wm1-f72.google.com with SMTP id o31-20020a05600c511f00b003dc53da325dso2680767wms.8 for ; Thu, 09 Feb 2023 03:29:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dLhlhNl1G07alx425D+rHTXx9JqCWVcaa/t9XJAyVQA=; b=o6Cemuey3IpNkVsOZd5QfVCZA5kRNhb9vMGbOdYjej4S0JSeDPp+EPYdR5F1wSpb/T pL+6zwwTQq2ouf9Cjtb56uyzBRcjhT3bvdcscYb7uu8M3iNEbmCnRrtIJ/vRi9of4oO4 T4xqqLPlMCknOS+pn22kCV4gceU1WxpVHHfOOI3G8Iu4NwQsD8ZZn5UG1pDL1f2Nj4eu 2Io4ZzYvFCVWsttR7fbV6gqs/ELpbAhMD0iBCscCj9Uc8ZdttuVrO7J6ydppPmTtpmhb t64dDC/EbSyzrOhch3m/Tnskai98BXqDk70I5jNUhHe9mo2rJAEbcZ+Hjz1oWMd2w9HP JULQ== X-Gm-Message-State: AO0yUKVoHHP/XldizIk8EPDwlhj10Z8LmVcfk+l1TdM9QYjb45iwcqZS vw4bOXQAwb1OqvVjc8U2VwOFrVXlwpqoDRdB65xH56U7C7eWbwwRgqXmklTqmnRylICoChYXNQm h4SDfT47O0N/8DZPFuGxzI2ocPQ+b55sFAM0FFub9NtS02bU= X-Received: by 2002:a05:600c:1656:b0:3db:742:cfe9 with SMTP id o22-20020a05600c165600b003db0742cfe9mr10993063wmn.34.1675942186283; Thu, 09 Feb 2023 03:29:46 -0800 (PST) X-Google-Smtp-Source: AK7set9AOWXcyeArSdm1Tpudc7qDB5nH/2ni+fsmzC4PHC1kzzyBhZ5KXuBYfITmk51HNm4G4/Vv/A== X-Received: by 2002:a05:600c:1656:b0:3db:742:cfe9 with SMTP id o22-20020a05600c165600b003db0742cfe9mr10993052wmn.34.1675942186069; Thu, 09 Feb 2023 03:29:46 -0800 (PST) Received: from qwirkle.internal ([81.2.157.149]) by smtp.gmail.com with ESMTPSA id j3-20020adff003000000b002bddaea7a0bsm1015043wro.57.2023.02.09.03.29.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 03:29:45 -0800 (PST) From: Andrei Gherzan To: kernel-team@lists.ubuntu.com Subject: [SRU][Lunar][PATCH v2 3/3] selftests/net: mv bpf/nat6to4.c to net folder Date: Thu, 9 Feb 2023 11:26:17 +0000 Message-Id: <20230209112615.585029-4-andrei.gherzan@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230209112615.585029-1-andrei.gherzan@canonical.com> References: <20230209112615.585029-1-andrei.gherzan@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrei Gherzan Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Hangbin Liu BugLink: https://bugs.launchpad.net/bugs/2000708 There are some issues with the bpf/nat6to4.c building. 1. It use TEST_CUSTOM_PROGS, which will add the nat6to4.o to kselftest-list file and run by common run_tests. 2. When building the test via `make -C tools/testing/selftests/ TARGETS="net"`, the nat6to4.o will be build in selftests/net/bpf/ folder. But in test udpgro_frglist.sh it refers to ../bpf/nat6to4.o. The correct path should be ./bpf/nat6to4.o. 3. If building the test via `make -C tools/testing/selftests/ TARGETS="net" install`. The nat6to4.o will be installed to kselftest_install/net/ folder. Then the udpgro_frglist.sh should refer to ./nat6to4.o. To fix the confusing test path, let's just move the nat6to4.c to net folder and build it as TEST_GEN_FILES. Fixes: edae34a3ed92 ("selftests net: add UDP GRO fraglist + bpf self-tests") Tested-by: Björn Töpel Signed-off-by: Hangbin Liu Link: https://lore.kernel.org/r/20230118020927.3971864-1-liuhangbin@gmail.com Signed-off-by: Paolo Abeni (backported from 3c107f36db061603bee7564fbd6388b1f1879fd3 net-next) [agherzan: This change merges the bpf Makefile into the main net Makefile where more tests were added in the meanwhile. The backport consisted only in matching the current state of these tests in the TEST_GEN_FILES and OUTPUT sections.] Signed-off-by: Andrei Gherzan --- tools/testing/selftests/net/Makefile | 50 ++++++++++++++++++- .../testing/selftests/net/{bpf => }/nat6to4.c | 0 tools/testing/selftests/net/udpgro_frglist.sh | 8 +-- 3 files changed, 52 insertions(+), 6 deletions(-) rename tools/testing/selftests/net/{bpf => }/nat6to4.c (100%) diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index 69c58362c0ed..48d1a68be1d5 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile @@ -71,14 +71,60 @@ TEST_GEN_FILES += bind_bhash TEST_GEN_PROGS += sk_bind_sendto_listen TEST_GEN_PROGS += sk_connect_zero_addr TEST_PROGS += test_ingress_egress_chaining.sh +TEST_GEN_FILES += nat6to4.o TEST_FILES := settings include ../lib.mk -include bpf/Makefile - $(OUTPUT)/reuseport_bpf_numa: LDLIBS += -lnuma $(OUTPUT)/tcp_mmap: LDLIBS += -lpthread $(OUTPUT)/tcp_inq: LDLIBS += -lpthread $(OUTPUT)/bind_bhash: LDLIBS += -lpthread + +# Rules to generate bpf obj nat6to4.o +CLANG ?= clang +SCRATCH_DIR := $(OUTPUT)/tools +BUILD_DIR := $(SCRATCH_DIR)/build +BPFDIR := $(abspath ../../../lib/bpf) +APIDIR := $(abspath ../../../include/uapi) + +CCINCLUDE += -I../bpf +CCINCLUDE += -I../../../../usr/include/ +CCINCLUDE += -I$(SCRATCH_DIR)/include + +BPFOBJ := $(BUILD_DIR)/libbpf/libbpf.a + +MAKE_DIRS := $(BUILD_DIR)/libbpf +$(MAKE_DIRS): + mkdir -p $@ + +# Get Clang's default includes on this system, as opposed to those seen by +# '-target bpf'. This fixes "missing" files on some architectures/distros, +# such as asm/byteorder.h, asm/socket.h, asm/sockios.h, sys/cdefs.h etc. +# +# Use '-idirafter': Don't interfere with include mechanics except where the +# build would have failed anyways. +define get_sys_includes +$(shell $(1) $(2) -v -E - &1 \ + | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') \ +$(shell $(1) $(2) -dM -E -