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 9E3E0A04C7; Tue, 15 Sep 2020 06:36:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DE7781BE8E; Tue, 15 Sep 2020 06:36:27 +0200 (CEST) Received: from mail-oo1-f67.google.com (mail-oo1-f67.google.com [209.85.161.67]) by dpdk.org (Postfix) with ESMTP id 5FDB3E07 for ; Tue, 15 Sep 2020 06:36:26 +0200 (CEST) Received: by mail-oo1-f67.google.com with SMTP id y25so432305oog.4 for ; Mon, 14 Sep 2020 21:36:26 -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=5hB6UzcwGA4Z8HZg1UejOzuCIeaZ3ei3BT+SNgSJDRo=; b=DiT1VEQ04PqyPV/tKF3Du5mMOkGOnz9CR1exDTsP1THCwTVng5R7zhofvZNFyamjRA ywJwaM71kuEY3mS+34lpA38CNixUr0Von4ZnahbGOtLk6h1DWgxn9AYteDNyLEAiZagF ZVu0J2CaKvtdNNxxAGqHQ20ey+zj4j3t6A458= 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=5hB6UzcwGA4Z8HZg1UejOzuCIeaZ3ei3BT+SNgSJDRo=; b=p/RzziDyW9PW2r4fxH2fMosoiH+JKbBXDJ97H3mwCCJk9caC2Y6o/QckwZXm2dCqDB clSGxBe4ASzTZVjQCTOYQ9kZOW3AwstwWo/WM3Aj3PyS+KFQRZcsa5YRU0Cwm3wyxhNQ Yy4wUKAUv8mCnbMHESyumH5dewu50Y8ENX4APmJVDh6UpGest0hdd4U27QsyXsmUYaJY j80hd6RqpvM6NTHSNLEpnVmbpyQk6IdEEYiBPTRsohdk6y4WUHEXVNYaPF7tWdkWQpx8 MbqZs19ebxmD58PAstX50db3PzuCX4WI3FSUBgi5Ep2Ajy2j0oKLBjXeSyDp1Ur6GoYa aIbg== X-Gm-Message-State: AOAM5302OKQujWyETxxTs+j4c5uRN+UyQSz2xYoRwv94EoyHB28s6GUR ZHIwnH1xyDjZk1mRy8TSuH9pssLrjYKTXEHxfITqoQ== X-Google-Smtp-Source: ABdhPJwYxeYoACIl4hjyEQ3t4ocxP7RE6L8sMSAqyqsYoBmHygEt92csDSaPUOIgekRkCp8ASS0es9Mkxw8p/9WITKA= X-Received: by 2002:a4a:e92e:: with SMTP id a14mr12541974ooe.23.1600144585505; Mon, 14 Sep 2020 21:36:25 -0700 (PDT) MIME-Version: 1.0 References: <20200625160348.26220-1-getelson@mellanox.com> <20200908201552.14423-1-getelson@nvidia.com> <20200908201552.14423-2-getelson@nvidia.com> In-Reply-To: <20200908201552.14423-2-getelson@nvidia.com> From: Ajit Khaparde Date: Mon, 14 Sep 2020 21:36:09 -0700 Message-ID: To: Gregory Etelson Cc: dpdk-dev , matan@nvidia.com, rasland@nvidia.com, orika@nvidia.com, Gregory Etelson , 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 v2 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" On Tue, Sep 8, 2020 at 1:16 PM 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. > While we are reviewing this, some quick comment/questions.. Doesn't this go against the above "PMD items & actions usually are not exposed to application and are not used to create RTE flows."? Why would an application try to use PMD specific private types? Isn't this contrary to having a standard API? > > 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. > > Signed-off-by: Gregory Etelson > Acked-by: Ori Kam > --- > v2: > * Update commit log > --- > lib/librte_ethdev/rte_flow.c | 30 ++++++++++++++++++++++++------ > 1 file changed, 24 insertions(+), 6 deletions(-) > > diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c > index f8fdd68fe9..9905426bc9 100644 > --- a/lib/librte_ethdev/rte_flow.c > +++ b/lib/librte_ethdev/rte_flow.c > @@ -564,7 +564,12 @@ 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 = (uint32_t)item->type <= INT_MAX ? > + rte_flow_desc_item[item->type].size : > + sizeof(void *); > rte_memcpy(buf, data, (size > off ? off : size)); > break; > } > @@ -667,7 +672,12 @@ 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 = (uint32_t)action->type <= INT_MAX ? > + rte_flow_desc_action[action->type].size : > + sizeof(void *); > rte_memcpy(buf, action->conf, (size > off ? off : size)); > break; > } > @@ -709,8 +719,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 (((uint32_t)src->type <= INT_MAX) && > + ((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 +812,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 (((uint32_t)src->type <= INT_MAX) && > + ((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 > >