From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 227FEA0547;
	Wed, 27 Oct 2021 11:46:13 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 0C66940DDA;
	Wed, 27 Oct 2021 11:46:13 +0200 (CEST)
Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com
 [66.111.4.25]) by mails.dpdk.org (Postfix) with ESMTP id 6B5FA4068C
 for <dev@dpdk.org>; Wed, 27 Oct 2021 11:46:11 +0200 (CEST)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id 912F55C02DF;
 Wed, 27 Oct 2021 05:46:08 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute1.internal (MEProxy); Wed, 27 Oct 2021 05:46:08 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding:content-type; s=fm2; bh=
 tu8F8g/SICwwaudw1ShI/NlEHOd9fv19QTcaw/QLSt0=; b=Mwr7pNfhhB2uSbYy
 v7jcHX3WKKvhmhgv2WZmMG4sVSghyIbDyGHuJTuaY/L4wASU1LYE8xzRz7dg32ba
 x0IMQVjbNC7Dh0MYHLhRY5CDlvVqryLKQ8qLYCUjkbTq8CTJ4yU3m6QWJEko5aZ/
 WZ91BaIidErnmsse5Xhclf2dPL+rmogN8ihQ9/UeM6pYvnIpA26XJbBg8NUpmmQE
 5uwtXzXf4swwjc0o1quIMEbxW8wiMOoEIHwY2bTHhxCz3VG+je6RT/szyQ03NPPh
 1vjR63PafjU+mLfZjv72ASgKgbC+W+6j4v8qOSlsYFjFn9el5lPBgQd9KvquW685
 Nd8Y/A==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :date:from:in-reply-to:message-id:mime-version:references
 :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender
 :x-sasl-enc; s=fm1; bh=tu8F8g/SICwwaudw1ShI/NlEHOd9fv19QTcaw/QLS
 t0=; b=Dku/R82uP6V2RT6ArODv8ROAYkrKh37GcOC+pAAD4NthNL4NOk0H81xOM
 9aCUlPZUKTz5run7cLPDo8DcFsrwzZtK4ibTESlNf3o6YkQqsGIC6DblNQsxayvL
 pmU0jCkXFn0dLK/g3vIRIr4ptBt9cP06hQ3S9zVO9WJ6lQeUoV8GoISyMT5K+el8
 eHODYp0h1Bhw5IpeZomN4fI/8A7BPdIBRWgu5+DJzK4JqE22QC9dJvY/ebQPx7Af
 Jj7ZWhM6QaOf0iW47jqBqlcGFwyuqZJm12BZdIoaJySFfODynoBbVsTYfnGVGm/k
 ENniJ/wIbSA8ll6vrNyhaHK4v8HNA==
X-ME-Sender: <xms:3x95YQf3hmmPRTXM5R3WIJx9vydB-L7DpzLk76EDFmt2Cj2pMPlXHQ>
 <xme:3x95YSOU0USvsGPWL7_K8bEhI3-jcWKMeWJmkstmLd1WjDjdaa_NFHR5LlHAfrw-w
 cK9saEbhzzVTzrvQg>
X-ME-Received: <xmr:3x95YRjd93lP0jXus4NWlFVob7lM55fedOp35lTJfO03Om9vhM3N3RdKH7Bl96ryNllhV0dnKhPPJ9nQAbone7Ot_A>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvdegtddgudejucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr
 shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg
 ftrfgrthhtvghrnhepudeggfdvfeduffdtfeeglefghfeukefgfffhueejtdetuedtjeeu
 ieeivdffgeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh
 homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth
X-ME-Proxy: <xmx:3x95YV8fMIbVBKOFwABqkqRbaXmptzzUK4S7CUc9m1gm89yFFvK5TQ>
 <xmx:3x95Yct5hOheOqz6dQ3n5SDoXXLuBuO3dMJ17bXw0oAV1Vrg7Fnq4w>
 <xmx:3x95YcHZ3tesqSz-tWMZDw_5FxLXOjXQEC5nhRgtNhHuDWXNAMhNkw>
 <xmx:4B95YeJAVzF1fjponM7PphK8dMeWo1j3jSYoPE42Rrc1U5oJgEq_wg>
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed,
 27 Oct 2021 05:46:06 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: Ivan Malov <ivan.malov@oktetlabs.ru>
Cc: dev@dpdk.org, David Marchand <david.marchand@redhat.com>,
 Ferruh Yigit <ferruh.yigit@intel.com>, Ori Kam <orika@nvidia.com>,
 Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Date: Wed, 27 Oct 2021 11:46:04 +0200
Message-ID: <2080007.0klm6OBeOA@thomas>
In-Reply-To: <20211027090003.14556-1-ivan.malov@oktetlabs.ru>
References: <20211027090003.14556-1-ivan.malov@oktetlabs.ru>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Subject: Re: [dpdk-dev] [PATCH] ethdev: fine tune error reporting in pick
 transfer proxy API
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

27/10/2021 11:00, Ivan Malov:
> There are PMDs which do not support flow offloads at all.
> In such cases, the API in question returns ENOTSUP. This
> is too loud. Restructure the code to avoid spamming logs.
> 
> Fixes: 1179f05cc9a0 ("ethdev: query proxy port to manage transfer flows")
> 
> Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
> ---
> --- a/lib/ethdev/rte_flow.c
> +++ b/lib/ethdev/rte_flow.c
> @@ -1335,10 +1335,7 @@ rte_flow_pick_transfer_proxy(uint16_t port_id, uint16_t *proxy_port_id,
>  	const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
>  	struct rte_eth_dev *dev;
>  
> -	if (unlikely(ops == NULL))
> -		return -rte_errno;
> -
> -	if (ops->pick_transfer_proxy == NULL) {
> +	if (ops == NULL || ops->pick_transfer_proxy == NULL) {
>  		*proxy_port_id = port_id;
>  		return 0;
>  	}

I prefer this logic.
You could add a comment to say that the current port is the default.

There is also this logic in testpmd:

    port->flow_transfer_proxy = port_id;
    if (!is_proc_primary())
        return;

Could we manage secondary process case inside the API?

One more comment, for testpmd,
we are calling rte_flow_pick_transfer_proxy even if we do not config any transfer flow.
It is called always in init_config_port_offloads().
It looks wrong. Can we call it only when needed?

Thanks