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 03542A0548; Fri, 9 Jul 2021 17:20:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E590F416D0; Fri, 9 Jul 2021 17:20:08 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id F23374068A for ; Fri, 9 Jul 2021 17:20:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625844007; 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; bh=jvA34vPm5X25XcXi274CUtIs7EccLVRi9Q111AueLpQ=; b=WPM07niDl0Eubs5VgY6WmmZy/G24qLPzHUnNN/d3zZdgx187yE+iH+MNNENvBct6FK68oN 06Z9fPwEN95L5LmiurHZ7H3qvAvbsWGgjh6nzIV0Ii/hr2HGe3+4g0C8gvD0W3O1glVAx4 PDM3zqbLZTQ75LRP7VZAgmidKnT8dOo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-433-6ciYuDgtP8GXyOzecbAmYA-1; Fri, 09 Jul 2021 11:20:06 -0400 X-MC-Unique: 6ciYuDgtP8GXyOzecbAmYA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 06E82802E62; Fri, 9 Jul 2021 15:20:05 +0000 (UTC) Received: from rh.redhat.com (ovpn-114-237.ams2.redhat.com [10.36.114.237]) by smtp.corp.redhat.com (Postfix) with ESMTP id D693B10074F8; Fri, 9 Jul 2021 15:19:53 +0000 (UTC) From: Kevin Traynor To: dev@dpdk.org Cc: mdr@ashroe.eu, Kevin Traynor Date: Fri, 9 Jul 2021 16:19:36 +0100 Message-Id: <20210709151938.701895-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [dpdk-dev] [PATCH 1/3] bitrate: change reg implementation to match API description 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" rte_stats_bitrate_reg() API states it returns 'Zero on success'. However, the implementation directly returns the return of rte_metrics_reg_names() which may be zero or positive on success, with a positive value also indicating the index. The user of rte_stats_bitrate_reg() should not care about the index as it is stored in the opaque rte_stats_bitrates struct. Change the implementation of rte_stats_bitrate_reg() to match the API description by always returning zero on success. Fixes: 2ad7ba9a6567 ("bitrate: add bitrate statistics library") Signed-off-by: Kevin Traynor --- lib/bitratestats/rte_bitrate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/bitratestats/rte_bitrate.c b/lib/bitratestats/rte_bitrate.c index 8fd9f47288..e23e38bc94 100644 --- a/lib/bitratestats/rte_bitrate.c +++ b/lib/bitratestats/rte_bitrate.c @@ -56,6 +56,8 @@ rte_stats_bitrate_reg(struct rte_stats_bitrates *bitrate_data) return_value = rte_metrics_reg_names(&names[0], RTE_DIM(names)); - if (return_value >= 0) + if (return_value >= 0) { bitrate_data->id_stats_set = return_value; + return 0; + } return return_value; } -- 2.31.1