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 77E7CA04B7; Sun, 4 Oct 2020 07:40:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D3A081BDDD; Sun, 4 Oct 2020 07:40:23 +0200 (CEST) Received: from mail-oo1-f65.google.com (mail-oo1-f65.google.com [209.85.161.65]) by dpdk.org (Postfix) with ESMTP id 0E3381BC7F for ; Sun, 4 Oct 2020 07:40:22 +0200 (CEST) Received: by mail-oo1-f65.google.com with SMTP id t3so1443973ook.8 for ; Sat, 03 Oct 2020 22:40:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kJuk9DJXtE59Qe0k/xuL1yvlwukt4se27XPg7qHh+g4=; b=TOcRgOvzahpg6BAVTP7VMhHujhbzXJzz/fDgd/POkyweqWh5L/J7Ul+Wo/n0Q20+Kd 8sWoEQEshaWDGMxvT+3LJ6ntrVV1ooRFul2siXJ9kvjKp8L0fe3D1fi5xP1w4TrwnWBW x23uHsC+a6JqzcVDNf31qOmWSmopf4yFJYB84= 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; bh=kJuk9DJXtE59Qe0k/xuL1yvlwukt4se27XPg7qHh+g4=; b=LNSaxf190HtpsHwZ8kgHZKvFlezg81/sYjse9hDGNH6KRJ66oqGpaNqqH6pN2RG4Ih bdTQ73yS3Dgr/CttdjM0kWa6ldvYInAe0JziBIbA6M3XUQShp3xmtQXn2rdCMCRfU7om ghbHYlQE9jOnbELXy9ynM+43Gmni/IZ0KGduwfJfexRlJrY8MPGhErlRRw+2DVQz4MVb PnVDu3iusw5hgSaJLSZ4S66rgKBpfAyPsCL1JvNcdTbYjuvyOuq1tlEm0ehy8bCeJHAk Q9owuR601Xh2bRt4fy1qpKSOaPry5HzGfmss6QNupNtuKJ7YafYfF4LRxMJ+f2t0qytx apDQ== X-Gm-Message-State: AOAM532jSmucYejR6N6gCTsVdsY1luiYefHy2gBzk75goiukkcaAA8Nm gaeNDtBdjxKjM+TKRaoq/16IBL4cOzCdXCWmLUUPUg== X-Google-Smtp-Source: ABdhPJzZMq712X9uyULgS/NPNseHYJG9bKT9j43VbElGGsUDNZ+bG2kTLSGcdM9+0P1GP1Dlv6zjGFzPVh8YNBNjsOY= X-Received: by 2002:a4a:ea99:: with SMTP id r25mr7934338ooh.15.1601790019997; Sat, 03 Oct 2020 22:40:19 -0700 (PDT) MIME-Version: 1.0 References: <20200625160348.26220-1-getelson@mellanox.com> <20200930091854.19768-1-getelson@nvidia.com> <20200930091854.19768-2-getelson@nvidia.com> In-Reply-To: <20200930091854.19768-2-getelson@nvidia.com> From: Ajit Khaparde Date: Sat, 3 Oct 2020 22:40:04 -0700 Message-ID: To: Gregory Etelson Cc: dpdk-dev , Matan Azrad , rasland@nvidia.com, Gregory Etelson , Ori Kam , Viacheslav Ovsiienko , Ori Kam , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v3 1/4] ethdev: allow negative values in flow rule types 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" Gregory, Please see inline. On Wed, Sep 30, 2020 at 2:19 AM Gregory Etelson wrote: > > From: Gregory Etelson > > RTE flow items & actions use positive values in item & action type. > Negative values are reserved for PMD private types. PMD > items & actions usually are not exposed to application and are not > used to create RTE flows. > > The patch allows applications with access to PMD flow > items & actions ability to integrate RTE and PMD items & actions > and use them to create flow rule. > > RTE flow library functions cannot work with PMD private items and > actions (elements) because RTE flow has no API to query PMD flow > object size. In the patch, PMD flow elements use object pointer. > RTE flow library functions handle PMD element object size as > size of a pointer. PMD handles its objects internally. This is important information. Apart from the commit log, this should also be added in the rte_flow API documentation. The comment in the code/API could be elaborated with this info as well. > > Signed-off-by: Gregory Etelson > Acked-by: Ori Kam > Acked-by: Viacheslav Ovsiienko > --- > lib/librte_ethdev/rte_flow.c | 28 ++++++++++++++++++++++------ > 1 file changed, 22 insertions(+), 6 deletions(-) > > diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c > index f8fdd68fe9..c8c6d62a8b 100644 > --- a/lib/librte_ethdev/rte_flow.c > +++ b/lib/librte_ethdev/rte_flow.c > @@ -564,7 +564,11 @@ rte_flow_conv_item_spec(void *buf, const size_t size, > } > break; > default: > - off = rte_flow_desc_item[item->type].size; > + /** > + * allow PMD private flow item > + */ > + off = (int)item->type >= 0 ? > + rte_flow_desc_item[item->type].size : sizeof(void *); > rte_memcpy(buf, data, (size > off ? off : size)); > break; > } > @@ -667,7 +671,11 @@ rte_flow_conv_action_conf(void *buf, const size_t size, > } > break; > default: > - off = rte_flow_desc_action[action->type].size; > + /** > + * allow PMD private flow action > + */ > + off = (int)action->type >= 0 ? > + rte_flow_desc_action[action->type].size : sizeof(void *); > rte_memcpy(buf, action->conf, (size > off ? off : size)); > break; > } > @@ -709,8 +717,12 @@ rte_flow_conv_pattern(struct rte_flow_item *dst, > unsigned int i; > > for (i = 0, off = 0; !num || i != num; ++i, ++src, ++dst) { > - if ((size_t)src->type >= RTE_DIM(rte_flow_desc_item) || > - !rte_flow_desc_item[src->type].name) > + /** > + * allow PMD private flow item > + */ > + if (((int)src->type >= 0) && > + ((size_t)src->type >= RTE_DIM(rte_flow_desc_item) || > + !rte_flow_desc_item[src->type].name)) > return rte_flow_error_set > (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, src, > "cannot convert unknown item type"); > @@ -798,8 +810,12 @@ rte_flow_conv_actions(struct rte_flow_action *dst, > unsigned int i; > > for (i = 0, off = 0; !num || i != num; ++i, ++src, ++dst) { > - if ((size_t)src->type >= RTE_DIM(rte_flow_desc_action) || > - !rte_flow_desc_action[src->type].name) > + /** > + * allow PMD private flow action > + */ > + if (((int)src->type >= 0) && > + ((size_t)src->type >= RTE_DIM(rte_flow_desc_action) || > + !rte_flow_desc_action[src->type].name)) > return rte_flow_error_set > (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, > src, "cannot convert unknown action type"); > -- > 2.25.1 >