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 8DB63A0C4C;
	Tue, 21 Sep 2021 14:16:23 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 5953940683;
	Tue, 21 Sep 2021 14:16:23 +0200 (CEST)
Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com
 [209.85.221.44]) by mails.dpdk.org (Postfix) with ESMTP id 21D974003C
 for <dev@dpdk.org>; Tue, 21 Sep 2021 14:16:22 +0200 (CEST)
Received: by mail-wr1-f44.google.com with SMTP id t8so31529862wri.1
 for <dev@dpdk.org>; Tue, 21 Sep 2021 05:16:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google;
 h=date:from:to:cc:subject:message-id:references:mime-version
 :content-disposition:in-reply-to;
 bh=zct9fyoybNeuzJKr8+1XMk9CJkhzpR3hZWMeIHEDjfU=;
 b=Qx1NiBQ/BfVCudARVGiq/nIBYYDjlQJAj52iFng1wVOzfB62JFM2u5NHOEzMev4aGF
 bRF2yB1ckHI+8wpugtG0sc48AdIs2eCJl3PaBnnR4J7vu/S3ABxwSzPTGRbbEQSjXdKA
 5gjDrw5oPvwmrGdwQI8F+axQEs4Ddyy+CJcPfUjV50SWXXHmlKPmd9CIMawDdxJZNHga
 X0IRxcYu4S4r8YCtb5AdsMR9yWElNMG6q+PFmfSwAVVdWHpv3LxAAdFX0yUjH06MvPv4
 AkJaCPDRSnvmXm39XuO5UhqJwaLs5ROhmY/QypYxDChPhNdenhTOfRPqhURfLZ8dVrkr
 5zzw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:references
 :mime-version:content-disposition:in-reply-to;
 bh=zct9fyoybNeuzJKr8+1XMk9CJkhzpR3hZWMeIHEDjfU=;
 b=IkQxUNSW0B42NrzjO2t+vDe0VzAsvASb8KqE8+tS0w/P5DWkp/LRuOPFNZtR3e8BZU
 sk+oMYZe05bUfk4pRuOaxC6eZSEiVsXsudJh0NrOnE1TxqQC5QSBugKn16vtWpirkmby
 IDVQWVs9+zzzt73l7QLng5sZ43DSHOHG7EaliaZEuu+FywIW/RJ4quZPFr3XpGQ4Rnrg
 FtXhiB+pRnjwPkif1JlrRRwLOBCDHWfmCsuSLeAZVry0A/mlE+59R26m3GTwjS7IoNon
 ja4zHr4207T2z8Z0qgyWdjqkZ6sPSwhhwKdaqklRhDXQa6Cuur9rYDKYIJ0z+1NoAqB3
 Wdrw==
X-Gm-Message-State: AOAM532ALJRdkDJvFPJ8Qq33am+0mHPug1ltCDGiF+Jq4MvgPL6K3Ukv
 gncUsjp4Q7mrVJU2WR5CIpyQjw==
X-Google-Smtp-Source: ABdhPJzeBIRkag2bLh/7uGOZQS61WwJgLHE4raqKBYbp6+JzMgkAM3WwvDEis0TTo4bdW3lruzW6hA==
X-Received: by 2002:a5d:64e2:: with SMTP id g2mr34239592wri.323.1632226581774; 
 Tue, 21 Sep 2021 05:16:21 -0700 (PDT)
Received: from 6wind.com ([2a01:e0a:5ac:6460:c065:401d:87eb:9b25])
 by smtp.gmail.com with ESMTPSA id j134sm3346675wmj.27.2021.09.21.05.16.20
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 21 Sep 2021 05:16:20 -0700 (PDT)
Date: Tue, 21 Sep 2021 14:16:20 +0200
From: Olivier Matz <olivier.matz@6wind.com>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: Jerin Jacob <jerinjacobk@gmail.com>,
 Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>,
 dpdk-dev <dev@dpdk.org>, Ciara Power <ciara.power@intel.com>,
 Jerin Jacob <jerinj@marvell.com>, Kiran Kumar K <kirankumark@marvell.com>,
 Nithin Dabilpuram <ndabilpuram@marvell.com>,
 Sunil Kumar Kori <skori@marvell.com>,
 Satha Koteswara Rao Kottidi <skoteshwar@marvell.com>,
 Ashwin Sekhar Thalakalath Kottilveetil <asekhar@marvell.com>,
 Pavan Nikhilesh <pbhagavatula@marvell.com>,
 Thomas Monjalon <thomas@monjalon.net>,
 Ferruh Yigit <ferruh.yigit@intel.com>,
 Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Message-ID: <YUnNFNikMSLlt7S/@platinum>
References: <cover.1632219073.git.gmuthukrishn@marvell.com>
 <2eaeef2ece0ff3a5a3fc9323f15a47be617a73a4.1632219073.git.gmuthukrishn@marvell.com>
 <CALBAE1Nu=mfkaXb7KC4bTnwfURRnxkSMSzNga7mnMw6EYW6M2A@mail.gmail.com>
 <YUnH0egzFpcJKHWx@bricha3-MOBL.ger.corp.intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <YUnH0egzFpcJKHWx@bricha3-MOBL.ger.corp.intel.com>
Subject: Re: [dpdk-dev] [v8, 4/4] net/cnxk: add telemetry endpoing to ethdev
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>

On Tue, Sep 21, 2021 at 12:53:53PM +0100, Bruce Richardson wrote:
> On Tue, Sep 21, 2021 at 04:57:52PM +0530, Jerin Jacob wrote:
> > On Tue, Sep 21, 2021 at 4:23 PM Gowrishankar Muthukrishnan
> > <gmuthukrishn@marvell.com> wrote:
> > >
> > > Add telemetry endpoint to ethdev.
> > >
> > > Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
> > > ---
> > >  drivers/net/cnxk/cnxk_ethdev_telemetry.c | 129 +++++++++++++++++++++++
> > >  drivers/net/cnxk/meson.build             |   1 +
> > >  2 files changed, 130 insertions(+)
> > >  create mode 100644 drivers/net/cnxk/cnxk_ethdev_telemetry.c
> > >
> > > diff --git a/drivers/net/cnxk/cnxk_ethdev_telemetry.c b/drivers/net/cnxk/cnxk_ethdev_telemetry.c
> > > new file mode 100644
> > > index 0000000000..de8c468670
> > > --- /dev/null
> > > +++ b/drivers/net/cnxk/cnxk_ethdev_telemetry.c
> > > @@ -0,0 +1,129 @@
> > > +/* SPDX-License-Identifier: BSD-3-Clause
> > > + * Copyright(C) 2021 Marvell International Ltd.
> > > + */
> > > +
> > > +#include <rte_telemetry.h>
> > > +
> > > +#include "cnxk_ethdev.h"
> > > +
> > > +/* Macro to count no of words in eth_info_s size */
> > > +#define ETH_INFO_SZ                                                            \
> > > +       (RTE_ALIGN_CEIL(sizeof(struct eth_info_s), sizeof(uint64_t)) /         \
> > > +        sizeof(uint64_t))
> > > +#define MACADDR_LEN 18
> > > +
> > > +static int
> > > +ethdev_tel_handle_info(const char *cmd __rte_unused,
> > > +                      const char *params __rte_unused, struct rte_tel_data *d)
> > > +{
> > > +       struct rte_eth_dev *eth_dev;
> > > +       struct rte_tel_data *i_data;
> > > +       struct cnxk_eth_dev *dev;
> > > +       union eth_info_u {
> > > +               struct eth_info_s {
> > > +                       /** PF/VF information */
> > > +                       uint16_t pf_func;
> > > +                       /** No of rx queues */
> > > +                       uint16_t rx_queues;
> > > +                       /** No of tx queues */
> > > +                       uint16_t tx_queues;
> > > +                       /** Port ID */
> > > +                       uint16_t port_id;
> > > +                       /** MAC entries */
> > > +                       char mac_addr[MACADDR_LEN];
> > > +                       uint8_t max_mac_entries;
> > > +                       bool dmac_filter_ena;
> > > +                       uint8_t dmac_filter_count;
> > > +                       uint16_t flags;
> > > +                       uint8_t ptype_disable;
> > > +                       bool scalar_ena;
> > > +                       bool ptp_ena;
> > > +                       /* Offload capabilities */
> > > +                       uint64_t rx_offload_capa;
> > > +                       uint64_t tx_offload_capa;
> > > +                       uint32_t speed_capa;
> > > +                       /* Configured offloads */
> > > +                       uint64_t rx_offloads;
> > > +                       uint64_t tx_offloads;
> > > +                       /* Platform specific offload flags */
> > > +                       uint16_t rx_offload_flags;
> > > +                       uint16_t tx_offload_flags;
> > > +                       /* ETHDEV RSS HF bitmask */
> > > +                       uint64_t ethdev_rss_hf;
> > 
> > + Ethdev, , mempool and telemetry maintainers
> > 
> > All of the above data except[1] is generic data that can be derived
> > from ethdev APIs or ethdev data from lib/ethdev itself,
> > IMO, We should avoid duplicating this in driver and make useful for
> > other driver/application by adding generic endpoint in ethdev.
> > Same comment for "[2/4] mempool/cnxk: add telemetry end points" for
> > mempool subsystem.
> > 
> > Thoughts from Maintainers?
> > 
> Not a maintainer of those libs, but +1 to making anything generic that can
> be, save reimplementing things multiple times in drivers.

I agree, I feel it would make more sense to have most of the job done in the
mempool library in generic. A new ops could be added to fill driver-specific
info.