From nobody Mon Dec 15 21:27:26 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 432371B86D4 for ; Thu, 18 Jul 2024 14:31:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721313100; cv=none; b=odDAIlvt1s9mhFfKx6Aq4bttu+ts5ADXAiHIwpLVZHA/8zVlvM4WrfGvNEWCnOqNW77i+HSt5gjCz813g3mkF7G8h2i4X9ncOunbPPo1Ts7iV1ablqMRowCktuFxvuB87w2/C53DlT1feJmAZqq6vRh25xekdfGpC/Dz+3kl/yI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721313100; c=relaxed/simple; bh=aZC0NipmOCpnDWuRU4Lpn4yFcg9U/gTdWFivPqFpvck=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=qNN6Q+SqfbVhdogfd7NYiApx5cXx1zocTZiYJANpb1gj5LzLcpqttIWQvLApi7IuB46RD0zX93+Vfq5gZmC19XBUyhNrV92cK3zP8ZwO0vlDRT2RF0POZT60p0XaGpXxc13TO+nbNFoFzjNIhxbYuA64hGlkGn3T239sPxV8/rw= 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=VSYMeOg8; arc=none smtp.client-ip=170.10.133.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="VSYMeOg8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1721313098; 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=RQgd9VnW1B97sus5iTeLLvYo9dx1plAad5b8ctUM7g8=; b=VSYMeOg8azn3NN2yGX1Xo6rGntcdMKjmTamPh4ebVo1Afl2teCk0P5gjoKkQHWopC4pbBA OSlA2ziQv5y75LWAHhheww0I0uB/o2j/kP9NHE50iWLVKZDzIYM9mnIQW3+Pzj9dbMNq0N t0tKof8hJBgLG/dNKEcttnv1Mm3C6K4= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-572-9bsy6NdJObKfacfuKh6QJQ-1; Thu, 18 Jul 2024 10:31:29 -0400 X-MC-Unique: 9bsy6NdJObKfacfuKh6QJQ-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DB7741956080; Thu, 18 Jul 2024 14:31:27 +0000 (UTC) Received: from alecto.usersys.redhat.com (unknown [10.45.224.8]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 17B52195605A; Thu, 18 Jul 2024 14:31:24 +0000 (UTC) From: Artem Savkov To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , bpf@vger.kernel.org, netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Artem Savkov Subject: [PATCH bpf-next] selftests/bpf: fix compilation failure when CONFIG_NET_FOU!=y Date: Thu, 18 Jul 2024 16:31:22 +0200 Message-ID: <20240718143122.2230780-1-asavkov@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 Content-Type: text/plain; charset="utf-8" Without CONFIG_NET_FOU bpf selftests are unable to build because of missing definitions. Add ___local versions of struct bpf_fou_encap and enum bpf_fou_encap_type to fix the issue. Signed-off-by: Artem Savkov --- .../selftests/bpf/progs/test_tunnel_kern.c | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c b/tools/t= esting/selftests/bpf/progs/test_tunnel_kern.c index 3f5abcf3ff136..0913ec384b159 100644 --- a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c +++ b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c @@ -26,10 +26,20 @@ */ #define ASSIGNED_ADDR_VETH1 0xac1001c8 =20 +struct bpf_fou_encap___local { + __be16 sport; + __be16 dport; +}; + +enum bpf_fou_encap_type___local { + FOU_BPF_ENCAP_FOU___local, + FOU_BPF_ENCAP_GUE___local, +}; + int bpf_skb_set_fou_encap(struct __sk_buff *skb_ctx, - struct bpf_fou_encap *encap, int type) __ksym; + struct bpf_fou_encap___local *encap, int type) __ksym; int bpf_skb_get_fou_encap(struct __sk_buff *skb_ctx, - struct bpf_fou_encap *encap) __ksym; + struct bpf_fou_encap___local *encap) __ksym; struct xfrm_state * bpf_xdp_get_xfrm_state(struct xdp_md *ctx, struct bpf_xfrm_state_opts *opt= s, u32 opts__sz) __ksym; @@ -745,7 +755,7 @@ SEC("tc") int ipip_gue_set_tunnel(struct __sk_buff *skb) { struct bpf_tunnel_key key =3D {}; - struct bpf_fou_encap encap =3D {}; + struct bpf_fou_encap___local encap =3D {}; void *data =3D (void *)(long)skb->data; struct iphdr *iph =3D data; void *data_end =3D (void *)(long)skb->data_end; @@ -769,7 +779,7 @@ int ipip_gue_set_tunnel(struct __sk_buff *skb) encap.sport =3D 0; encap.dport =3D bpf_htons(5555); =20 - ret =3D bpf_skb_set_fou_encap(skb, &encap, FOU_BPF_ENCAP_GUE); + ret =3D bpf_skb_set_fou_encap(skb, &encap, FOU_BPF_ENCAP_GUE___local); if (ret < 0) { log_err(ret); return TC_ACT_SHOT; @@ -782,7 +792,7 @@ SEC("tc") int ipip_fou_set_tunnel(struct __sk_buff *skb) { struct bpf_tunnel_key key =3D {}; - struct bpf_fou_encap encap =3D {}; + struct bpf_fou_encap___local encap =3D {}; void *data =3D (void *)(long)skb->data; struct iphdr *iph =3D data; void *data_end =3D (void *)(long)skb->data_end; @@ -806,7 +816,7 @@ int ipip_fou_set_tunnel(struct __sk_buff *skb) encap.sport =3D 0; encap.dport =3D bpf_htons(5555); =20 - ret =3D bpf_skb_set_fou_encap(skb, &encap, FOU_BPF_ENCAP_FOU); + ret =3D bpf_skb_set_fou_encap(skb, &encap, FOU_BPF_ENCAP_FOU___local); if (ret < 0) { log_err(ret); return TC_ACT_SHOT; @@ -820,7 +830,7 @@ int ipip_encap_get_tunnel(struct __sk_buff *skb) { int ret; struct bpf_tunnel_key key =3D {}; - struct bpf_fou_encap encap =3D {}; + struct bpf_fou_encap___local encap =3D {}; =20 ret =3D bpf_skb_get_tunnel_key(skb, &key, sizeof(key), 0); if (ret < 0) { --=20 2.45.2