From patchwork Wed Oct 28 13:25:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 1389531 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Re/6/Xlr; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CM38f6cpbz9sWp for ; Thu, 29 Oct 2020 09:26:58 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733140AbgJ1W04 (ORCPT ); Wed, 28 Oct 2020 18:26:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:58993 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733124AbgJ1W0y (ORCPT ); Wed, 28 Oct 2020 18:26:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603924012; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=es+GSQz2MU3igYX62Y5g10wVw6Q1DpGz8rOsY1uqmXw=; b=Re/6/XlrZRj93MntOmALcTDwMX533hhyfUzXAs8xAC42bpe3u3fwg0nLZCTr1xFiRl/cJU 00AfMYWOm76xj3Klcdh6y5pJmlS1Hb3ALTt24wemmJJ3eXdoohaFnfO0j03v+9KrqqbiUV H0JU8p7majimyKHums3gbRs7DKdNEEc= Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-548-rVhUB77CNwiEx85Vh6C-1w-1; Wed, 28 Oct 2020 09:26:08 -0400 X-MC-Unique: rVhUB77CNwiEx85Vh6C-1w-1 Received: by mail-pg1-f200.google.com with SMTP id s4so2651171pgk.17 for ; Wed, 28 Oct 2020 06:26:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=es+GSQz2MU3igYX62Y5g10wVw6Q1DpGz8rOsY1uqmXw=; b=iaGlS6cGVVDHp6t8889Rfjg9nLWt3Tz/LyRiUvv4TdC6Uu/mImC1nysBrTCjxwWlBC 7JDK0HnxB/uw3TkW8ip5FnhTg1wrmiwKEpg76Op7j63rj76pkXrvk6w+RKTE72d3UDf4 vhLeKkz5ohtKffRdEbpPJcGbPbKLieMeaSa6CDko9/+KdYJJ0FC7SnLJkPmHStrPJFN3 FT+8ML/uk8BG21HHKm2JymXvz+vDPwPaBeQUy6nwZx3EmZYVn30BUiSIvDo+hd+S7yhJ mSwpVx0leHt2ykwT4qpQIAtG2mS4it7PQ4o2P2RuUuUPn6Z6YvAygj0QjxP2F0a8ARFi /Wug== X-Gm-Message-State: AOAM530H5qVP668qN4CThoB8DsxrwE0wUxOgjYsO2GxcOn2TzhGWhbDR Zzqa7AkB2/4p3CKSHqag8HqnZFmbIg/c1a9jppMaQmbjixyH94PpEVNN2MKoeILAyxWBum73LFI OVulWC/Vh193xZTs= X-Received: by 2002:a17:90a:9915:: with SMTP id b21mr6534161pjp.150.1603891565368; Wed, 28 Oct 2020 06:26:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUw0Pkq0DIqvJq4VFz3ut/XDSbHFEjwYOCuzD+bn6xuTCSLhTt2BMBkdSzkPHIyHvLPeS1wQ== X-Received: by 2002:a17:90a:9915:: with SMTP id b21mr6534145pjp.150.1603891565142; Wed, 28 Oct 2020 06:26:05 -0700 (PDT) Received: from localhost.localdomain.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id z20sm6055521pfk.199.2020.10.28.06.26.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 06:26:04 -0700 (PDT) From: Hangbin Liu To: Stephen Hemminger , Daniel Borkmann , David Ahern , Alexei Starovoitov Cc: Martin KaFai Lau , Song Liu , Yonghong Song , David Miller , Jesper Dangaard Brouer , netdev@vger.kernel.org, bpf@vger.kernel.org, Jiri Benc , Andrii Nakryiko , =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rge?= =?utf-8?q?nsen?= , Hangbin Liu Subject: [PATCHv2 iproute2-next 4/5] examples/bpf: move struct bpf_elf_map defined maps to legacy folder Date: Wed, 28 Oct 2020 21:25:28 +0800 Message-Id: <20201028132529.3763875-5-haliu@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20201028132529.3763875-1-haliu@redhat.com> References: <20201023033855.3894509-1-haliu@redhat.com> <20201028132529.3763875-1-haliu@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Reviewed-by: Toke Høiland-Jørgensen Signed-off-by: Hangbin Liu --- examples/bpf/README | 14 +++++++++----- examples/bpf/{ => legacy}/bpf_cyclic.c | 2 +- examples/bpf/{ => legacy}/bpf_graft.c | 2 +- examples/bpf/{ => legacy}/bpf_map_in_map.c | 2 +- examples/bpf/{ => legacy}/bpf_shared.c | 2 +- examples/bpf/{ => legacy}/bpf_tailcall.c | 2 +- 6 files changed, 14 insertions(+), 10 deletions(-) rename examples/bpf/{ => legacy}/bpf_cyclic.c (95%) rename examples/bpf/{ => legacy}/bpf_graft.c (97%) rename examples/bpf/{ => legacy}/bpf_map_in_map.c (96%) rename examples/bpf/{ => legacy}/bpf_shared.c (97%) rename examples/bpf/{ => legacy}/bpf_tailcall.c (98%) diff --git a/examples/bpf/README b/examples/bpf/README index 1bbdda3f..732bcc83 100644 --- a/examples/bpf/README +++ b/examples/bpf/README @@ -1,8 +1,12 @@ eBPF toy code examples (running in kernel) to familiarize yourself with syntax and features: - - bpf_shared.c -> Ingress/egress map sharing example - - bpf_tailcall.c -> Using tail call chains - - bpf_cyclic.c -> Simple cycle as tail calls - - bpf_graft.c -> Demo on altering runtime behaviour - - bpf_map_in_map.c -> Using map in map example + - legacy/bpf_shared.c -> Ingress/egress map sharing example + - legacy/bpf_tailcall.c -> Using tail call chains + - legacy/bpf_cyclic.c -> Simple cycle as tail calls + - legacy/bpf_graft.c -> Demo on altering runtime behaviour + - legacy/bpf_map_in_map.c -> Using map in map example + +Note: Users should use new BTF way to defined the maps, the examples +in legacy folder which is using struct bpf_elf_map defined maps is not +recommanded. diff --git a/examples/bpf/bpf_cyclic.c b/examples/bpf/legacy/bpf_cyclic.c similarity index 95% rename from examples/bpf/bpf_cyclic.c rename to examples/bpf/legacy/bpf_cyclic.c index 11d1c061..33590730 100644 --- a/examples/bpf/bpf_cyclic.c +++ b/examples/bpf/legacy/bpf_cyclic.c @@ -1,4 +1,4 @@ -#include "../../include/bpf_api.h" +#include "../../../include/bpf_api.h" /* Cyclic dependency example to test the kernel's runtime upper * bound on loops. Also demonstrates on how to use direct-actions, diff --git a/examples/bpf/bpf_graft.c b/examples/bpf/legacy/bpf_graft.c similarity index 97% rename from examples/bpf/bpf_graft.c rename to examples/bpf/legacy/bpf_graft.c index 07113d4a..f4c920cc 100644 --- a/examples/bpf/bpf_graft.c +++ b/examples/bpf/legacy/bpf_graft.c @@ -1,4 +1,4 @@ -#include "../../include/bpf_api.h" +#include "../../../include/bpf_api.h" /* This example demonstrates how classifier run-time behaviour * can be altered with tail calls. We start out with an empty diff --git a/examples/bpf/bpf_map_in_map.c b/examples/bpf/legacy/bpf_map_in_map.c similarity index 96% rename from examples/bpf/bpf_map_in_map.c rename to examples/bpf/legacy/bpf_map_in_map.c index ff0e623a..575f8812 100644 --- a/examples/bpf/bpf_map_in_map.c +++ b/examples/bpf/legacy/bpf_map_in_map.c @@ -1,4 +1,4 @@ -#include "../../include/bpf_api.h" +#include "../../../include/bpf_api.h" #define MAP_INNER_ID 42 diff --git a/examples/bpf/bpf_shared.c b/examples/bpf/legacy/bpf_shared.c similarity index 97% rename from examples/bpf/bpf_shared.c rename to examples/bpf/legacy/bpf_shared.c index 21fe6f1e..05b2b9ef 100644 --- a/examples/bpf/bpf_shared.c +++ b/examples/bpf/legacy/bpf_shared.c @@ -1,4 +1,4 @@ -#include "../../include/bpf_api.h" +#include "../../../include/bpf_api.h" /* Minimal, stand-alone toy map pinning example: * diff --git a/examples/bpf/bpf_tailcall.c b/examples/bpf/legacy/bpf_tailcall.c similarity index 98% rename from examples/bpf/bpf_tailcall.c rename to examples/bpf/legacy/bpf_tailcall.c index 161eb606..8ebc554c 100644 --- a/examples/bpf/bpf_tailcall.c +++ b/examples/bpf/legacy/bpf_tailcall.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0 */ -#include "../../include/bpf_api.h" +#include "../../../include/bpf_api.h" #define ENTRY_INIT 3 #define ENTRY_0 0