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 D3AE2A0A0F; Mon, 5 Jul 2021 08:58:17 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9C12B41158; Mon, 5 Jul 2021 08:58:13 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 61F1F4003E; Sat, 3 Jul 2021 12:01:23 +0200 (CEST) Received: by shelob.oktetlabs.ru (Postfix, from userid 122) id E6D727F56B; Sat, 3 Jul 2021 13:01:22 +0300 (MSK) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shelob.oktetlabs.ru X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=ALL_TRUSTED, DKIM_ADSP_DISCARD autolearn=no autolearn_force=no version=3.4.2 Received: from oktetlabs.ru (calendar.oktetlabs.ru [192.168.34.50]) by shelob.oktetlabs.ru (Postfix) with ESMTP id 2899D7F504; Sat, 3 Jul 2021 13:01:19 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 2899D7F504 Authentication-Results: shelob.oktetlabs.ru/2899D7F504; dkim=none; dkim-atps=neutral MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 03 Jul 2021 13:01:19 +0300 From: Viacheslav Galaktionov To: "Xueming(Steven) Li" Cc: Andrew Rybchenko , Matan Azrad , Shahaf Shuler , Slava Ovsiienko , NBU-Contact-Thomas Monjalon , Ferruh Yigit , dev@dpdk.org, stable@dpdk.org In-Reply-To: References: <20210702142322.821302-1-andrew.rybchenko@oktetlabs.ru> Message-ID: <6f3f6072c2ff6b1a10214392e41c18af@oktetlabs.ru> X-Sender: Viacheslav.Galaktionov@oktetlabs.ru User-Agent: Roundcube Webmail/1.3.16 X-Mailman-Approved-At: Mon, 05 Jul 2021 08:58:10 +0200 Subject: Re: [dpdk-dev] [PATCH] ethdev: keep count of allocated and used representor ranges 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 Sender: "dev" Hello! On 2021-07-03 04:32, Xueming(Steven) Li wrote: >> + if (i == n_entries) >> + break; >> } >> out: >> + info->nb_ranges = i; > > Here info maybe NULL. Good catch, thanks for noticing! >> faf3bd901d..d2b27c351f 100644 >> --- a/lib/ethdev/rte_ethdev.h >> +++ b/lib/ethdev/rte_ethdev.h >> @@ -4856,6 +4856,8 @@ struct rte_eth_representor_range { struct >> rte_eth_representor_info { >> uint16_t controller; /**< Controller ID of caller device. */ >> uint16_t pf; /**< Physical function ID of caller device. */ >> + uint32_t nb_ranges_alloc; /**< Size of the ranges array. */ >> + uint32_t nb_ranges; /**< Number of initialized ranges. */ > > How about rte_eth_representor_info_get(info) return max ranges size if > info is NULL, > return real initialized ranges if info not NULL? I'm not sure how I feel about it. I think it'd be best if the function returned just one thing. Moreover, there are drivers that don't have a fixed structure for representor IDs, e.g. net/sfc, where every range will contain a single ID. If a new representor range is created between invocations of this function, there probably should be a way for the caller to know about this. Perhaps we should move the total number of representors to an out parameter and use the return value for the number of initialized ranges. What do you think about this?