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 C031B41BAE; Thu, 2 Feb 2023 13:13:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 66A76406A2; Thu, 2 Feb 2023 13:13:53 +0100 (CET) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 8F41740689 for ; Thu, 2 Feb 2023 13:13:51 +0100 (CET) Received: from [192.168.38.17] (aros.oktetlabs.ru [192.168.38.17]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id E0A2D50; Thu, 2 Feb 2023 15:13:50 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru E0A2D50 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1675340030; bh=0xhG0UPs+Hn97jyw5nTMebYzrQaHp4pH9C3uGeT8GLU=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=qiBkQy5VIWZyqunx9wSbrykj54mll+UEFMG7spIPUx+s6ck9dK2vniKsjrMEtC0vg hwKfuCWqIL6/nYp7y44R0yA5hBwNY0RFOugtB8iIkcIfPyVoTDiNQ175hcOipvgAao 8voatnNUtC4obiCtpd9qPo+scTk/ORJDMUdXaAUw= Message-ID: <89749f8b-6e23-6c7f-edcb-5661ef86a3d6@oktetlabs.ru> Date: Thu, 2 Feb 2023 15:13:50 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH v9 1/2] ethdev: add query and update sync and async function calls Content-Language: en-US To: Gregory Etelson , dev@dpdk.org Cc: matan@nvidia.com, rasland@nvidia.com, Ori Kam , Thomas Monjalon , Ferruh Yigit References: <20221221073547.988-1-getelson@nvidia.com> <20230202115401.358-1-getelson@nvidia.com> From: Andrew Rybchenko Organization: OKTET Labs In-Reply-To: <20230202115401.358-1-getelson@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 2/2/23 14:54, Gregory Etelson wrote: > diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c > index 7d0c24366c..4554c8f021 100644 > --- a/lib/ethdev/rte_flow.c > +++ b/lib/ethdev/rte_flow.c > @@ -1883,3 +1883,85 @@ rte_flow_async_action_handle_query(uint16_t port_id, > action_handle, data, user_data, error); > return flow_err(port_id, ret, error); > } > + > +int > +rte_flow_action_handle_query_update(uint16_t port_id, > + struct rte_flow_action_handle *handle, > + const void *update, void *query, > + enum rte_flow_query_update_mode mode, > + struct rte_flow_error *error) > +{ > + int ret; > + struct rte_eth_dev *dev; > + const struct rte_flow_ops *ops; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > + if (!handle) > + return -EINVAL; > + dev = &rte_eth_devices[port_id]; > + ops = rte_flow_ops_get(port_id, error); > + if (!ops) > + return -ENOTSUP; > + if (update && query) { > + if (!ops->action_handle_query_update) > + return -ENOTSUP; > + if (mode != RTE_FLOW_QU_QUERY_FIRST && > + mode != RTE_FLOW_QU_UPDATE_FIRST) > + return -EINVAL; Shouldn't it be checked in any case? Also I'd initialize RTE_FLOW_QU_QUERY_FIRST to 1 on enum definition to ensure that just 0 is not used as a mode value. Also "Required if both *update* and *query* are not NULL." does not make sense in the description since you have no way to skip it. > + ret = ops->action_handle_query_update(dev, handle, update, > + query, mode, error); > + } else if (!update && query) { > + ret = rte_flow_action_handle_query(port_id, handle, query, > + error); > + } else if (update && !query) { > + ret = rte_flow_action_handle_update(port_id, handle, update, > + error); > + } else { > + return -EINVAL; > + } IMHO logic is wrong above since it should be sufficient to implement just one action_handle_query_update callback instead of all three. I.e. if action_handle_query_update is available, it should be used in any case. > + return flow_err(port_id, ret, error); > +} > }; > > INTERNAL { same for async API