From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier Matz Subject: Re: [PATCH v2] ethdev: check number of queues less than RTE_ETHDEV_QUEUE_STAT_CNTRS Date: Thu, 24 Nov 2016 17:59:06 +0100 Message-ID: <1480006746.31853.14.camel@6wind.com> References: <1479722378-23959-1-git-send-email-alejandro.lucero@netronome.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Cc: Bert van Leeuwen , thomas.monjalon@6wind.com To: Alejandro Lucero , dev@dpdk.org Return-path: Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com [74.125.82.44]) by dpdk.org (Postfix) with ESMTP id 0840212A8 for ; Thu, 24 Nov 2016 17:59:08 +0100 (CET) Received: by mail-wm0-f44.google.com with SMTP id f82so67882557wmf.1 for ; Thu, 24 Nov 2016 08:59:08 -0800 (PST) In-Reply-To: <1479722378-23959-1-git-send-email-alejandro.lucero@netronome.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, On Mon, 2016-11-21 at 09:59 +0000, Alejandro Lucero wrote: > From: Bert van Leeuwen > > Arrays inside rte_eth_stats have size=RTE_ETHDEV_QUEUE_STAT_CNTRS. > Some devices report more queues than that and this code blindly uses > the reported number of queues by the device to fill those arrays up. > This patch fixes the problem using MIN between the reported number of > queues and RTE_ETHDEV_QUEUE_STAT_CNTRS. > > Signed-off-by: Alejandro Lucero > Reviewed-by: Olivier Matz As a next step, I'm wondering if it would be possible to remove this limitation. We could replace the tables in struct rte_eth_stats by a pointer to an array allocated dynamically at pmd setup. It would break the API, so it should be announced first. I'm thinking of something like: struct rte_eth_generic_stats {         uint64_t ipackets;         uint64_t opackets;         uint64_t ibytes;         uint64_t obytes;         uint64_t imissed;         uint64_t ierrors;         uint64_t oerrors;         uint64_t rx_nombuf }; struct rte_eth_stats { struct rte_eth_generic_stats port_stats; struct rte_eth_generic_stats *queue_stats; }; The queue_stats array would always be indexed by queue_id. The xstats would continue to report the generic stats per-port and per-queue. About the mapping API, either we keep it as-is, or it could become a driver-specific API. Thomas, what do you think? Regards, Olivier