From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3D2A4A0526; Wed, 8 Jul 2020 13:01:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0477F1DB59; Wed, 8 Jul 2020 13:01:03 +0200 (CEST) Received: from mail-il1-f193.google.com (mail-il1-f193.google.com [209.85.166.193]) by dpdk.org (Postfix) with ESMTP id 82BFC1D9A6 for ; Wed, 8 Jul 2020 13:01:01 +0200 (CEST) Received: by mail-il1-f193.google.com with SMTP id a11so30443587ilk.0 for ; Wed, 08 Jul 2020 04:01:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=LDg7mWwxBQqXMcm0I7VM06p4at2SuV7D8oUthxDC7Zk=; b=DIXfGXz52jFWAfrwJpGDzLFQVAjroX43p4ooG+hrZGd1Etf3p5IKxCLwQGDn/CiDe5 kXW+9kL45CMt8iHELztNQ+6/wl/owXqYDPx1ie6WaheN1Sc922DqeiN4pf0gwpIYFsN+ TjlxAVGW5Yb8+wapWXLB7LPO7MGMC4mhPLnyO7Aoc6M2yjZWkfOW/6qTnosmApuJ53zX 8QPfAHRPLnzPUuLPetBkMBscuuuF7nm5vrh7Qu7UTesM90xvp6eWn6WqV5sjXyHjvcaa jicOiGNhRoy/XOUW3QwoMxRV1Cut6w8XAoSl6uwOuMX69Eu9Deh5Br3KaDD12CWmAtf5 c3aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=LDg7mWwxBQqXMcm0I7VM06p4at2SuV7D8oUthxDC7Zk=; b=T87OcEvrjdyb9Ma+BUQzIzzAjIQW8EhL3omtvpXdgXkmTGjyIW4ShHxaZ8aRlFAk+5 c7XmyW0AyvXV+A0SOhqhVmNhuBlv1JI8e9eBgnU4G11bys7vcPK7eeqzMYrnQa1Mr0R5 RhsQtsLekM5sF9HKr+lHYcCUAq+MNOjgEhE0KqfurSwAEPHsoBA4t+gX8fGnARcIpMit 68BTuqPXkmLR4xWtP/D/mj8aXl7jP7jnQTED4G7lulPE4yY4FoK0v2xGl3XvrkZG3GoD GL0XcULBLOSUYiA5+evqetKRtipu2Ij1nlskGUZsRcg2x55SzRMqouYigOoaBJ48Akfo ak+A== X-Gm-Message-State: AOAM5339sms5mudf0a01ZSdsarIXFzdyyPqYqVYxS054TNc0BwQRcXWT 1STGPixgizVGnaJ0CH5Rl72mUHUQvi299ERUs4k= X-Google-Smtp-Source: ABdhPJw4xZfvWyYkDWrVe6kF2v1PKPt1w6TTVQvz4gPwZiDH2qo/EzJjVvbHgBdTFum2mRZRnXj4xxuzsC2RUR6X1io= X-Received: by 2002:a05:6e02:eb3:: with SMTP id u19mr42274041ilj.130.1594206060835; Wed, 08 Jul 2020 04:01:00 -0700 (PDT) MIME-Version: 1.0 References: <20200702120511.16315-1-andreyv@mellanox.com> In-Reply-To: From: Jerin Jacob Date: Wed, 8 Jul 2020 16:30:44 +0530 Message-ID: To: Ori Kam Cc: Andrey Vesnovaty , Andrey Vesnovaty , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , dpdk-dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH] add flow shared action API 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" On Wed, Jul 8, 2020 at 3:17 PM Ori Kam wrote: > > Hi Jerin > > > -----Original Message----- > > From: Jerin Jacob > > > > On Wed, Jul 8, 2020 at 2:33 AM Ori Kam wrote: > > > > > > Hi Jerin, > > > > Hi Ori, > > > > > > > > > -----Original Message----- > [..nip ..] > > > > > > > I think, simple API change would be to accommodate "rte_shared_= ctx > > > > > > *ctx, rte_flow_action *action" modes > > > > > > without introducing the emulation for one or other mode, will b= e. > > > > > > > > > > > > enum rte_flow_action_update_type { > > > > > > RTE_FLOW_ACTION_UPDATE_TYPE_SHARED_ACTION, > > > > > > RTE_FLOW_ACTION_UPDATE_TYPE_ACTION, > > > > > > }; > > > > > > > > > > > > struct rte_flow_action_update_type_param { > > > > > > enum rte_flow_action_update_type type; > > > > > > union { > > > > > > struct rte_flow_action_update_type_shared_= action_param > > { > > > > > > rte_shared_ctx *ctx; > > > > > > } shared_action; > > > > > > struct > > rte_flow_action_update_type_shared_action_param { > > > > > > rte_flow *flow, > > > > > > rte_flow_action *action; > > > > > > } action; > > > > > > } > > > > > > } > > > > > > > > > > > Thank you for the idea but I fall to see how your suggested API i= s simpler > > than > > > > the one suggested by me? > > > > > > > > My thought process with the below-proposed API[1] is that It is > > > > dictates "_shared_action_" in API name as > > > > well as arguments. I just thought of expressing it as either-or cas= e > > > > hence I thought [2] is better. i.e The PMD does not support > > > > shared_action, not even need to create one to use > > > > rte_flow_action_update() to avoid the confusion. Thoughts? > > > > > > > > [1] > > > > rte_flow_shared_action_update(uint16_port port, rte_shared_ctx *ctx= , > > > > rte_flow_action *action, error) > > > > > > > > [2] > > > > rte_flow_action_update(uint16_port port, struct > > > > rte_flow_action_update_type_param *param, error) > > > > > > > Let me see if I understand you correctly, your suggestion is to allow > > > the application to change one action in one flow, but instead of crea= ting > > > the context the application will just supply the rte_flow and the new= actions > > > do I understand correctly? > > > > Yes. > > > > > > > > If so this it is a nice idea, but there are some issues with it, > > > 1. The PMD must save the flow which will result in memory consumption= . > > > > struct rte_flow * driver handle any way store that information to as > > it would be needed > > for other rte_flow related APIs. > > > The driver for example in Mellanox case save only the pointer to the flow= so it can > destroy it on request. It can't remove it and add it again since it is mi= ssing critical > info. To save the info will cost memory. I assume this goes to other driv= ers. > There is no real need to save anything but the flow pointer. If driver _need_ this feature, then the driver needs to store some info in the flow object, In our case, it will be the index of the MCAM action, etc. Yes. it up to driver the how they want to support it. > > > > > > 2. Assume that two flows are using the same RSS action for example, s= o the > > PMD > > > reuse the RSS object he created for the first flow also for the secon= d. Now > > changing > > > this RSS flow may result in also changing the second flow. (this can = be solved > > by always > > > creating new action) > > > > It is not resuing the action, it more of updating the action. So the > > above said issue won't happen. > > It is removing the need for call `rte_flow_destroy()` and call > > `rte_flow_create()` if only action > > needs to update for THE given flow. That's it. > > > Again this means that the driver must save all flows so it will waste mem= ory. > also this doesn=E2=80=99t save any time, since the application can just d= o it the same way > as the PMD there is no value to do it inside the PMD. Why driver need to save all the flow, We need to save all the flow ONLY whe= n we need to emulate the shared context. We need to save only additional info like, MCAM index where the action was allocated or such, so that it can be replac= ed. > > > > > > 3. It doesn't handle the main use case that the application wants to = change > > number of > > > flows at the same time, which is the idea of this feature. > > > > We discussed this in detail and tried approach for the common code to > > make everything > > as shared action. Andrey quickly realizes that it is difficult without > > HW support. > Like everything in RTE flow this is all about HW support > If the HW doesn=E2=80=99t support it don't do it. > > > > > > > > > I also think that all PMD that support option 2 can support option 1= since > > > they can save in the ctx a list of flows and simply apply them again.= So by > > > definition if PMD supports [2] it also support [1] while the other > > > way is not correct since it forces the PMD to save flows which like I= said > > waste memory. > > > > If we use "rte_flow_shared_action_update(uint16_port port, > > rte_shared_ctx *ctx, rte_flow_action *action, error)", > > What would be ctx value for the HW does not support a shared context? > > That's is the only reason for > > my proposal. I understand, your concern about supporting two modes in > > PMD, I don't think, > > PMD needs to support RTE_FLOW_ACTION_UPDATE_TYPE_ACTION if > > RTE_FLOW_ACTION_UPDATE_TYPE_SHARED_ACTION supported. > > > This is the beauty of it ctx is opaque so the PMD can have what ever it w= ants to have. Just like > an rte_flow that each PMD have different fields and usage. > > > > > > > I suggest that we will go with option [1], and if needed in the futur= e we will > > update the code. > > > using option [2] will result in dead code since at least for the curr= ent time no > > PMD will implement this > > > API. > > > > We are planning to update our PMD to support this once API is finalized= . > > > Great very happy to hear that. > This means that we should push this feature even faster > > > > > > > I can suggest one more thing maybe to change the name from shared_ctx= to > > just ctx > > > which implicitly mean it can be shared but not a must. What do you th= ink? > > (but again > > > I think by definition if a PMD can implement number [2] it can also > > implement it to number > > > of flows using API [2]. > > > > Just void *type is fine too, but we need an argument for type to cast > > it in application and/or driver. > > > Like said above this is opaque so the PMD knows what to expect. Driver side it is OKAY but how the application can update it? The PMD does = not need or does not have a shared object. Otherway to ask is, Could you have share the API call sequence using "rte_flow_shared_action_update(uint16_port port, rte_shared_ctx *ctx, rte_flow_action *action, error)" to enable support for the following category of HW as I mentioned earlier. - The HW has "pattern" and "action" mapped to different HW objects and action can be updated any time without destroying and create.(a,k,a Does not have shared HW object) > > > enum rte_flow_action_update_type { > > RTE_FLOW_ACTION_UPDATE_TYPE_SHARED_ACTION, > > RTE_FLOW_ACTION_UPDATE_TYPE_ACTION, > > }; > > > > > > > > > > > In my suggestion the PMD simply needs to check if the new action = and > > > > change the > > > > > context and to that action, or just change parameters in the acti= on, if it is > > the > > > > same action. > > > > > > > > > > Let's go with the original patch API modified to support like you= requested > > > > also changing the action, > > > > > based on my comments. > > > > > > > > > > > rte_flow_action_update(uint16_port port, struct > > > > > > rte_flow_action_update_type_param *param, error) > > > > > > > > > > > > > > > > [..nip..] > > > > > > Best, > > > Ori