From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9621243B16; Thu, 15 Feb 2024 20:26:08 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8424F402AC; Thu, 15 Feb 2024 20:26:08 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) by mails.dpdk.org (Postfix) with ESMTP id A76A140276 for ; Thu, 15 Feb 2024 20:26:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708025167; x=1739561167; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=hxm5qvAXJYL+145p0H0/11M9VFJZQAg8xdwJ2366EEk=; b=CMrO04vlIvbowyW1peZ21FFWZ4NezDLjHEDZX5uJL/IDsOwOqdvvNpTx 9lrJ0CaJBU57/vtCLFhM/qqDBfgPsnpCg/yZJuU+tOKcy6J89TJmcd2W1 awFTrNWUl+D+3UgPqXqMuZXahUB0wvR3kO5vNlLL4ifPl9TGXisj0hhRF W9lTiOyytHvZyavGcFO0lL1G64KD7BWmBUJxzKduXwNWsKtb/QARqsiaI 1Ybczdx3wmiUi2g2v0sREPvg0wYHEk9/q2+TyL5Jw1CM5z21vjyzp+IEp RW2mOo88d5HwyMFn417IGv0UTEO5HjB5AXfR11NL5Ls1lUEEXOFJxbeQX A==; X-IronPort-AV: E=McAfee;i="6600,9927,10985"; a="2045073" X-IronPort-AV: E=Sophos;i="6.06,162,1705392000"; d="scan'208";a="2045073" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2024 11:26:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,162,1705392000"; d="scan'208";a="4018110" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com) ([10.237.223.184]) by orviesa008.jf.intel.com with ESMTP; 15 Feb 2024 11:26:05 -0800 From: Cristian Dumitrescu To: dev@dpdk.org Subject: [PATCH V3] examples/pipeline: simplify the L2 forwarding examples Date: Thu, 15 Feb 2024 19:26:01 +0000 Message-Id: <20240215192601.1575859-1-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240213121337.1521711-1-cristian.dumitrescu@intel.com> References: <20240213121337.1521711-1-cristian.dumitrescu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Simplified the L2 forwarding examples by removing all tables and actions, as they are not really needed for these simple use-cases. Signed-off-by: Cristian Dumitrescu --- examples/pipeline/examples/l2fwd.spec | 34 +++++------------- examples/pipeline/examples/l2fwd_macswp.spec | 36 ++++++-------------- 2 files changed, 19 insertions(+), 51 deletions(-) diff --git a/examples/pipeline/examples/l2fwd.spec b/examples/pipeline/examples/l2fwd.spec index 0aebafd07b..1e3e1ad040 100644 --- a/examples/pipeline/examples/l2fwd.spec +++ b/examples/pipeline/examples/l2fwd.spec @@ -1,42 +1,24 @@ ; SPDX-License-Identifier: BSD-3-Clause ; Copyright(c) 2020 Intel Corporation +; The simplest pipeline processing with just packet reception and transmission. No header parsing, +; table lookup or action execution involved. Packets received on port 0 are sent out on port 1, +; those received on port 1 are sent out on port 0, etc. + // // Meta-data. // struct metadata_t { - bit<32> port_in - bit<32> port_out + bit<32> port } metadata instanceof metadata_t -// -// Actions. -// -action NoAction args none { - return -} - -// -// Tables. -// -table stub { - key { - } - - actions { - NoAction - } - - default_action NoAction args none const -} - // // Pipeline. // apply { - rx m.port_in - table stub - tx m.port_in + rx m.port + xor m.port 1 + tx m.port } diff --git a/examples/pipeline/examples/l2fwd_macswp.spec b/examples/pipeline/examples/l2fwd_macswp.spec index e81f20622e..4bd5c23c7a 100644 --- a/examples/pipeline/examples/l2fwd_macswp.spec +++ b/examples/pipeline/examples/l2fwd_macswp.spec @@ -1,6 +1,9 @@ ; SPDX-License-Identifier: BSD-3-Clause ; Copyright(c) 2020 Intel Corporation +; Layer 2 Forwarding with MACADDR swapping (i.e. within the Ethernet header of the output packet, +; the destination MAC address is swapped with the source MAC address). + // // Packet headers. // @@ -22,37 +25,20 @@ struct metadata_t { metadata instanceof metadata_t -// -// Actions. -// -action macswp args none { - mov m.addr h.ethernet.dst_addr - mov h.ethernet.dst_addr h.ethernet.src_addr - mov h.ethernet.src_addr m.addr - return -} - -// -// Tables. -// -table stub { - key { - } - - actions { - macswp - } - - default_action macswp args none const -} - // // Pipeline. // apply { rx m.port extract h.ethernet - table stub + + // + // Ethernet header: dst_addr swapped with src_addr. + // + mov m.addr h.ethernet.dst_addr + mov h.ethernet.dst_addr h.ethernet.src_addr + mov h.ethernet.src_addr m.addr + xor m.port 1 emit h.ethernet tx m.port -- 2.34.1