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 3218BA0558; Thu, 26 May 2022 15:21:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2503C40151; Thu, 26 May 2022 15:21:32 +0200 (CEST) Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) by mails.dpdk.org (Postfix) with ESMTP id F191340150 for ; Thu, 26 May 2022 15:21:30 +0200 (CEST) Received: by mail-qv1-f51.google.com with SMTP id cv1so1585258qvb.5 for ; Thu, 26 May 2022 06:21:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=T2T/shvGc+ImqLSb1jb18cQgjY/eFeEhlVUHR/6r5Mk=; b=eohcZOfyPPGlRQI4ImXUZtGTuUuW3EGWq6ptOSIkcJqTcbNktXgiBo8N7PbLKO/Jo0 TL5liQQFxqcD8aYiQ+cbq+8Yv4meU+S6cQ5nYy1YRomTAnMRq1le9m9T7eW9zJdJNgxZ WaEzqv6RveU9CZ7/OQX2XTikm9PxGtsOzWL2cvPGeHLmMM2dPJ4EC8i55QRRmaoDpkcQ 6Y5sfzgbo/0yNtmgxX+AY2IhAW7K3FO0EOTARoK2j1FaxwFj7ogixv/quThIoHw4m8bm ztjrXulJWBi6oRuxdDy8w8LeWmZN2A68MuPaMsI4+aCLndNRvwdoRtMojwDqZeKz+Hl4 Zzmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=T2T/shvGc+ImqLSb1jb18cQgjY/eFeEhlVUHR/6r5Mk=; b=P0BDGjP0gP9BHiFnvXok/m9QAl/FOy20marYmT2s1Za7ulinmmJGMdNfLahC0D2/yp lAXiZWD4Cv6CRjWkf3Jstlxk4z3Pa6fty7JAUlsSs7PR7jRk4fJJc6FNiOTHN/BmrXMq Ia1WCdmwhFGpEllaz2lB9Pyy7EGENOHCJBDTWrQC+Y5SKZ6qWA4buktfAl/QkFHj1+EM ddkzHNMOUby1aEmOiuOHehAOzTm8/IIlmLLD6FbC/0n7JV6rpbdayw1WZLve7OfqPpVc UqcFhjH/G9U0rF4HRrjTO2ln0ONNHsKPPbphp2rkOw6ie9wfCaT4RxhKe9Dd+DZ9vlLp Nvqw== X-Gm-Message-State: AOAM533h73HCDM9N/P6NuFwdm527B27yCpeySw5d9u4Op2mIVFjwtAW1 8fQWVkS/f2NDyCLRtXWIaOIYQKHcheiwIfUAgOY= X-Google-Smtp-Source: ABdhPJwyQsv7YLFSMMzyGi/dAKFiOD3+7vmpEdxqqaBKOSI/JbaoH4Lm7iLdZmXKx8q1ZkG+ZqB/6t+0SCD62vbVVzw= X-Received: by 2002:a0c:f8c4:0:b0:462:5faa:bc7d with SMTP id h4-20020a0cf8c4000000b004625faabc7dmr8626488qvo.95.1653571290354; Thu, 26 May 2022 06:21:30 -0700 (PDT) MIME-Version: 1.0 References: <20220518043459.1281590-1-akozyrev@nvidia.com> <20220522105102.1692526-1-akozyrev@nvidia.com> In-Reply-To: <20220522105102.1692526-1-akozyrev@nvidia.com> From: Jerin Jacob Date: Thu, 26 May 2022 18:51:04 +0530 Message-ID: Subject: Re: [PATCH v2 0/4] ethdev: separate metering and marking from policing To: Alexander Kozyrev Cc: dpdk-dev , Ori Kam , Thomas Monjalon , Ivan Malov , Andrew Rybchenko , Ferruh Yigit , "Awal, Mohammad Abdul" , Qi Zhang , Jerin Jacob , Ajit Khaparde , "Richardson, Bruce" Content-Type: text/plain; charset="UTF-8" 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 On Sun, May 22, 2022 at 4:21 PM Alexander Kozyrev wrote: > > Extend Metering and Marking support in the Flow API: > 1. Add METER_COLOR item to match Color Marker set by a Meter. > 2. Add the ability to set Color Marker via modify_field Flow API. > 3. Add Meter API to get profile/policy objects. > 4. Add METER_MARK action to perform Meter color metering and marking. > Provide greater flexibility in how Metering can be used. > > RFC: https://patchwork.dpdk.org/project/dpdk/cover/20220502200439.4100965-1-akozyrev@nvidia.com/ > > Traditional Meter Usage: > > profile_id = rte_mtr_meter_profile_add(RFC_params); > policy_id = rte_mtr_meter_policy_add(actions[RED/YELLOW/GREEN]); > meter_id = rte_mtr_create(profile_id, policy_id); > rte_flow_create(pattern=5-tuple,actions=METER(meter_id)); > > The METER action effectively translates to the following: > 1. Metering a packet stream. > 2. Marking packets with an appropriate color. > 3. Jump to a policy group. > 4. Match on a color. > 5. Execute assigned policy actions for the color. > > New Meter Usage Model: > profile_id = rte_mtr_meter_profile_add(RFC_params); > *profile_obj_ptr = rte_mtr_meter_profile_get(profile_id); > rte_flow_create(pattern=5-tuple, > actions=METER(profile_obj_ptr),JUMP); > rte_flow_create(pattern=COLOR, actions=...); > > The METER_MARK action effectively translates to the following: > 1. Metering a packet stream. > 2. Marking packets with an appropriate color. > > A user is able to match the color later with the COLOR item. > In order to do this we add the JUMP action after the METER action. > > 3. Jump to a policy group. > 4. Match on a color. > 5. Execute actions for the color. > > Here we decoupled the meter profile usage from the meter policy usage > for greater flexibility and got rid of any locks related to meter_id lookup. > > Another example of the meter creation to mimic the old model entirely: > profile_id = rte_mtr_meter_profile_add(RFC_params); > *profile_obj_ptr = rte_mtr_meter_profile_get(profile_id); > policy_id = rte_mtr_meter_policy_add(actions[RED/YELLOW/GREEN]); > *policy_obj_ptr = rte_mtr_meter_policy_get(policy_id); > rte_flow_create(pattern=5-tuple, > actions=METER(profile_obj_ptr, policy_obj_ptr)); > > In this case, we define the policy actions right away. > The main advantage is not having to lookup for profile_id/policy_id. > > To free the meter obects we need to do the following: > rte_flow_destroy(flow_handle); > rte_mtr_meter_policy_delete(policy_id); > rte_mtr_meter_profile_delete(profile_id);. > profile_obj_ptr and policy_obj_ptr are no longer valid after that. The overall approach looks good to me. Could you update doc/guides/prog_guide/traffic_metering_and_policing.rst for the new scheme. I think, we need to add "struct rte_mtr_capabilities" one more filed for the capability for the application to query to pick one way or another or both.