From patchwork Wed Sep 9 00:22:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Fu X-Patchwork-Id: 76976 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 45C93A04B1; Wed, 9 Sep 2020 02:28:26 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 914BD4C99; Wed, 9 Sep 2020 02:28:25 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id F2B3AA3 for ; Wed, 9 Sep 2020 02:28:22 +0200 (CEST) IronPort-SDR: dA07BK+o7+l8zB1hILFDBjm+ULNcP9SIYUEDgZqkJ0SFHqa9v7AUqM3nC/JMTmgos6s3GL9iDS yffJjG4PSTUA== X-IronPort-AV: E=McAfee;i="6000,8403,9738"; a="155729881" X-IronPort-AV: E=Sophos;i="5.76,407,1592895600"; d="scan'208";a="155729881" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2020 17:28:21 -0700 IronPort-SDR: L2Zw7FCeuYA+JF+yzF614eaXPjusaq3AEguEEcEaJGK6do/6SHVjlkzJqDUVsiR9ypZvI/GpLR ma4PK5ZYFc+A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,407,1592895600"; d="scan'208";a="286051320" Received: from npg-dpdk-patrickfu-casc2.sh.intel.com ([10.67.119.92]) by fmsmga008.fm.intel.com with ESMTP; 08 Sep 2020 17:28:18 -0700 From: Patrick Fu To: dev@dpdk.org Cc: thomas@monjalon.net, ferruh.yigit@intel.com, maxime.coquelin@redhat.com, bruce.richardson@intel.com, mm6021@att.com, zhihong.wang@intel.com, liang-min.wang@intel.com, konstantin.ananyev@intel.com, timothy.miskell@intel.com, cunming.liang@intel.com, patrick.fu@intel.com Date: Wed, 9 Sep 2020 08:22:44 +0800 Message-Id: <20200909002247.864844-1-patrick.fu@intel.com> X-Mailer: git-send-email 2.18.4 Subject: [dpdk-dev] [PATCH v1 0/3] lib: introduce traffic mirroring lib X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Network Test Access Point (TAP) is the network monitoring service commonly adotpted in SDN-based network infrastructures. When VMs are inter-connected over virtual switches, TAP requires vSwitch to mirror out network traffics from specific workload VM ports to the TAP device/VM ports. Classical mirroring impmentations in vSwitch make an extra copy of the source packets, which results in significant degradation in the throughput levels vSwitch could normally archieve. Therefore, we propose a new set of APIs to support high-throughput packet mirroring through hardware offloading. The proposal is consisted of three major parts: - Mirror registration APIs - Mirror offload/customization callbacks - Shared mirror data path In this patch set, mirroring happens between a pair of ethdev ports (one for the source port and the other for the mirror port), which is configurable on a per-port per-direction basis. i.e. applications invoke the mirroring API to register source ports and traffic directions (tx or rx). The registration API will then attach the mirror data path to the source port as a standard ethdev tx or rx callback. If any custom mirror offload functions are specified by applications, the offload function will be executed within the mirror data path. The mirror data path intercepts the packets flowing over the registered source ports and, rather than doing extra packets copy operations, simply transmits packets to the destination (mirror) port with an incremented mbuf reference count. In this way, an identical copy of the packet data is transmitted to both the mirror port and the original traffic destination. In addition, with the proposed APIs we can implement even more complicated mirrorings scenarios. Two examples include flow based mirroring and MAC address matching, both of which have common usage within the industry. Our prior studies demonstrate that this methedology is capble of doubling the mirroring performance as compared to the default OVS port mirroring performance (refer to the paper in IEEE xplore for further details: https://ieeexplore.ieee.org/document/9110293) An OVS implementation was also suggested to the OVS community for review and comments (refer to the following OVS RFC patch: https://patchwork.ozlabs.org/project/openvswitch/patch/ 1595596858-78846-2-git-send-email-emma.finn@intel.com/) We are considering implementing the mirroring APIs as a standalone library in DPDK, but it's also reasonble to place it inside ethdev layer or within the vhost-pmd considering the potential usage scenarios. Patrick Fu (3): lib/mirror: introduce traffic mirror API lib/mirror: add port based mirroring lib/mirror: add flow based mirroring config/common_base | 5 + lib/Makefile | 2 + lib/librte_mirror/Makefile | 20 + lib/librte_mirror/meson.build | 6 + lib/librte_mirror/rte_mirror.c | 461 +++++++++++++++++++++++ lib/librte_mirror/rte_mirror.h | 111 ++++++ lib/librte_mirror/rte_mirror_version.map | 7 + lib/meson.build | 2 +- 8 files changed, 613 insertions(+), 1 deletion(-) create mode 100644 lib/librte_mirror/Makefile create mode 100644 lib/librte_mirror/meson.build create mode 100644 lib/librte_mirror/rte_mirror.c create mode 100644 lib/librte_mirror/rte_mirror.h create mode 100644 lib/librte_mirror/rte_mirror_version.map