From patchwork Thu Apr 1 02:39:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiawei Wang X-Patchwork-Id: 90254 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2BFACA034F; Thu, 1 Apr 2021 04:39:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B6BF9140FAC; Thu, 1 Apr 2021 04:39:58 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by mails.dpdk.org (Postfix) with ESMTP id 21CBF40142 for ; Thu, 1 Apr 2021 04:39:57 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from jiaweiw@nvidia.com) with SMTP; 1 Apr 2021 05:39:56 +0300 Received: from nvidia.com (gen-l-vrt-281.mtl.labs.mlnx [10.237.44.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 1312du4c000483; Thu, 1 Apr 2021 05:39:56 +0300 From: Jiawei Wang To: viacheslavo@nvidia.com, xiaoyun.li@intel.com, ferruh.yigit@intel.com, thomas@monjalon.net Cc: dev@dpdk.org Date: Thu, 1 Apr 2021 05:39:56 +0300 Message-Id: <1617244796-358287-1-git-send-email-jiaweiw@nvidia.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1615295935-11197-1-git-send-email-jiaweiw@nvidia.com> References: <1615295935-11197-1-git-send-email-jiaweiw@nvidia.com> Subject: [dpdk-dev] [PATCH v3] doc: add sampling and mirroring in testpmd guide 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 Sender: "dev" Update documentation for sample action usage in testpmd and show the command line example. Signed-off-by: Jiawei Wang Acked-by: Viacheslav Ovsiienko Reviewed-by: Ferruh Yigit --- v3: * Update the description for sampling. v2: * Update the description. --- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 52 +++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index f59eb8a..2b407a3 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -2003,6 +2003,24 @@ Set fec mode for a specific port:: testpmd> set port (port_id) fec_mode auto|off|rs|baser +Config Sample actions list +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Configure the sample actions list to be used when sampling a packet by +rte_flow_action_sample:: + + set sample_actions {index} {action} [/ {action} [...]] / end + +There are multiple global buffers for ``sample_actions``, this command will set +one internal buffer index by ``{index}``. + +In order to use different sample actions list, ``index`` must be specified +during the flow rule creation:: + + testpmd> flow create 0 ingress pattern eth / ipv4 / end actions + sample ratio 2 index 2 / end + +Otherwise the default index ``0`` is used. Port Functions -------------- @@ -4841,6 +4859,40 @@ if seid is set):: testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 1 seid is 1 / end actions queue index 3 / end +Sample Sampling/Mirroring rules +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Sample/Mirroring rules can be set by the following commands + +NIC-RX Sampling rule, the matched ingress packets and sent to the queue 1, +and 50% packets are duplicated and marked with 0x1234 and sent to queue 0. + +:: + + testpmd> set sample_actions 0 mark id 0x1234 / queue index 0 / end + testpmd> flow create 0 ingress group 1 pattern eth / end actions + sample ratio 2 index 0 / queue index 1 / end + +Mirroring rule with port representors (with "transfer" attribute), the matched +ingress packets with encapsulation header are sent to port id 0, and also +mirrored the packets and sent to port id 2. + +:: + + testpmd> set sample_actions 0 port_id id 2 / end + testpmd> flow create 1 ingress transfer pattern eth / end actions + sample ratio 1 index 0 / raw_encap / port_id id 0 / end + +Mirroring rule with port representors (with "transfer" attribute), the matched +ingress packets are sent to port id 2, and also mirrored the packets with +encapsulation header and sent to port id 0. + +:: + + testpmd> set sample_actions 0 raw_encap / port_id id 0 / end + testpmd> flow create 0 ingress transfer pattern eth / end actions + sample ratio 1 index 0 / port_id id 2 / end + BPF Functions --------------