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 D874345AA0; Thu, 3 Oct 2024 14:36:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 70DDB40299; Thu, 3 Oct 2024 14:36:47 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id A77D54014F for ; Thu, 3 Oct 2024 14:36:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727959005; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9D7YTl19v2HIOr/tTEdfTEs0o/uWEqqCdKdNqJZuXJg=; b=ZEdTGyvtlM7J+JTt01mDdsYTqB8kguzI68PfPDwthYeLVIEdHR1PTjjiTDK8F3Amk6DjjJ sYL9eKZK/Pp1hrNrXWorZOIFpaGcqGJyrN7Wwt/aA8lSwg49d6+jj54+rGzj48NNTKZCxd JGQFt8wGgLmhCAEDD4mOjTOdcn2Aw3Q= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-258-ORhzKUveOs69dTj2_V9Ytg-1; Thu, 03 Oct 2024 08:36:44 -0400 X-MC-Unique: ORhzKUveOs69dTj2_V9Ytg-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-42cb89fbb8cso4750315e9.0 for ; Thu, 03 Oct 2024 05:36:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727959003; x=1728563803; h=in-reply-to:references:user-agent:to:from:cc:subject:message-id :date:content-transfer-encoding:mime-version:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=M9raJoUNa0SKLB5bYG+0snj3qdB0P7aaYRKi3YwQ1AY=; b=socKFNYZ5zxdEW1AD9iYBMkS9lFmiIoohzc9tzx/3JGZiJC9a4ca7nIacaLtghIXgI V0RRdkA20yKnreps3e3RroIGYaL9dTGcrHxPLytqExmoA9luReDOshAtUwxZLNYn+Jyr uiM+wVTVcpUDvtYNnhOXT/lj5Y6RYK/t0oHjliCqOWaivMtvrhk6j96/fQe6HG+24ql5 91WjIMHAWS3kTL4Iu5xbFZxkz8OQj7GZZdQ6vfZHiYR9IDhtoJGSZMzJFLRmrSmDKKCm nSZKjDg/dmaYRDXMLFy/Gl3frAeglQncYkQGaAIrPLaA6SQgLdUaQ/mdt3rL5ty+nm7A TNmw== X-Gm-Message-State: AOJu0YwKpcezpzjmimp7+j3S4sIWJzNxqE5xYIfsP0pYZSQi/F361fNH xZeZzmwlTb64IcLh78yLnjLNGz5R+1y3k0vEqq7haOnnkzZ/EsNXEkR5DOtv4DIxpTgC59VAfDS jj8DQ709islm8+IVZw+QZJbreCO28D/wSO9etaxJMDgTcv5o2 X-Received: by 2002:a05:600c:1c98:b0:426:6f17:531 with SMTP id 5b1f17b1804b1-42f777b72cbmr49787985e9.13.1727959002691; Thu, 03 Oct 2024 05:36:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFiRjLSqKrgqYvjmY90HmDQzV4ZPuPmOm6tOR5RHBmUcPZcb8iAvvTV70dOh5wZX+0+GE66bA== X-Received: by 2002:a05:600c:1c98:b0:426:6f17:531 with SMTP id 5b1f17b1804b1-42f777b72cbmr49787805e9.13.1727959002280; Thu, 03 Oct 2024 05:36:42 -0700 (PDT) Received: from localhost (2a01cb00025433006239e1f47a0b2371.ipv6.abo.wanadoo.fr. [2a01:cb00:254:3300:6239:e1f4:7a0b:2371]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f802b2ae8sm14583725e9.45.2024.10.03.05.36.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Oct 2024 05:36:40 -0700 (PDT) Mime-Version: 1.0 Date: Thu, 03 Oct 2024 14:36:40 +0200 Message-Id: Subject: Re: [PATCH dpdk v2 1/2] telemetry: add api to register command with private argument Cc: , , From: "Robin Jarry" To: "Bruce Richardson" User-Agent: aerc/0.18.2-74-g7e4ac1a5f54c References: <20241002155709.2522273-1-david.marchand@redhat.com> <20241003112438.902397-6-rjarry@redhat.com> In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8; format=Flowed 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 Bruce Richardson, Oct 03, 2024 at 13:39: > On Thu, Oct 03, 2024 at 01:24:41PM +0200, Robin Jarry wrote: >> Add a new rte_telemetry_register_cmd_arg public function to register >> a telemetry endpoint with a callback that takes an additional private >> argument. >>=20 >> This will be used in the next commit to protect ethdev endpoints with >> a lock. >>=20 >> Update perform_command() to take a struct callback object copied from >> the list of callbacks and invoke the correct function pointer. >>=20 >> Signed-off-by: Robin Jarry >> --- > > I like this solution, and seems a good general addition to telemetry also= . > Couple of minor comments inline below. > > Acked-by: Bruce Richardson > >> lib/telemetry/rte_telemetry.h | 46 +++++++++++++++++++++++++++++++++++ >> lib/telemetry/telemetry.c | 38 +++++++++++++++++++++++------ >> lib/telemetry/version.map | 3 +++ >> 3 files changed, 79 insertions(+), 8 deletions(-) >>=20 >> diff --git a/lib/telemetry/rte_telemetry.h b/lib/telemetry/rte_telemetry= .h >> index cab9daa6fed6..3fbfda138b16 100644 >> --- a/lib/telemetry/rte_telemetry.h >> +++ b/lib/telemetry/rte_telemetry.h >> @@ -336,6 +336,30 @@ rte_tel_data_add_dict_uint_hex(struct rte_tel_data = *d, const char *name, >> typedef int (*telemetry_cb)(const char *cmd, const char *params, >> =09=09struct rte_tel_data *info); >> =20 >> +/** >> + * This telemetry callback is used when registering a telemetry command= with >> + * rte_telemetry_register_cmd_arg(). >> + * >> + * It handles getting and formatting information to be returned to tele= metry >> + * when requested. >> + * >> + * @param cmd >> + * The cmd that was requested by the client. >> + * @param params >> + * Contains data required by the callback function. >> + * @param info >> + * The information to be returned to the caller. >> + * @param arg >> + * The opaque value that was passed to rte_telemetry_register_cmd_arg()= . >> + * > > I think we tend to slightly indent the text on the line after the @param, > as in: > > * @param arg > * The opaque value... I found this weird too but followed the style in the rest of the file.=20 I can fix that for a v3. > >> + * @return >> + * Length of buffer used on success. >> + * @return >> + * Negative integer on error. >> + */ >> +typedef int (*telemetry_arg_cb)(const char *cmd, const char *params, >> +=09=09struct rte_tel_data *info, void *arg); >> + > > Not sure about this, but I'd tend to have the arg parameter as second > parameter, to keep the "info" as the final parameter. My suggested order > would be: (cmd, arg, params, info) I don't have any objections. I'll send a v3.