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 51EEBA0548; Fri, 9 Jul 2021 17:20:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 407A8416D7; Fri, 9 Jul 2021 17:20:14 +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 3B19D416DA for ; Fri, 9 Jul 2021 17:20:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625844012; 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=E+V42ZnKRk6bcJ0S5KVC40DjvmzhaQw/T7Tvn+yi6DM=; b=hkORYqfY+hcOfM+hEO6QNsRkr0PhZQcmZUGO/iTB+GnlMpMG8FNsF47b4Dc7CRK7OPe8i+ 6gXyXEzNZOzGoN9Sr/Tm0xdBTmmCQu70Os+vLlOcApjnAe7pERDxb3a8yDCgrhxoQKB7BT AtR89nXibzXOALtU+P6Ug4PjHNz7Ro8= 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-379-lEx5o9z_OCq3JnM17rVCIQ-1; Fri, 09 Jul 2021 11:20:11 -0400 X-MC-Unique: lEx5o9z_OCq3JnM17rVCIQ-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 6F265800D62; Fri, 9 Jul 2021 15:20:10 +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 9837A10074F8; Fri, 9 Jul 2021 15:20:08 +0000 (UTC) From: Kevin Traynor To: dev@dpdk.org Cc: mdr@ashroe.eu, Kevin Traynor Date: Fri, 9 Jul 2021 16:19:37 +0100 Message-Id: <20210709151938.701895-2-ktraynor@redhat.com> In-Reply-To: <20210709151938.701895-1-ktraynor@redhat.com> References: <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 2/3] bitrate: change calc 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_calc() API states it returns 'Negative value on error'. However, the implementation will return the error code from rte_eth_stats_get() which may be non-zero on error. Change the implementation of rte_stats_bitrate_calc() to match the API description by always returning a negative value on error. Fixes: 2ad7ba9a6567 ("bitrate: add bitrate statistics library") Signed-off-by: Kevin Traynor --- lib/bitratestats/rte_bitrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bitratestats/rte_bitrate.c b/lib/bitratestats/rte_bitrate.c index e23e38bc94..1664e4863b 100644 --- a/lib/bitratestats/rte_bitrate.c +++ b/lib/bitratestats/rte_bitrate.c @@ -81,5 +81,5 @@ rte_stats_bitrate_calc(struct rte_stats_bitrates *bitrate_data, ret_code = rte_eth_stats_get(port_id, ð_stats); if (ret_code != 0) - return ret_code; + return ret_code < 0 ? ret_code : -ret_code; port_data = &bitrate_data->port_stats[port_id]; -- 2.31.1