From patchwork Fri Apr 19 17:28:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 139552 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BFD5F43EB2; Fri, 19 Apr 2024 19:30:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A02CB40A80; Fri, 19 Apr 2024 19:29:49 +0200 (CEST) Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by mails.dpdk.org (Postfix) with ESMTP id 8A303406FF for ; Fri, 19 Apr 2024 19:29:42 +0200 (CEST) Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-6eddff25e4eso1949413b3a.3 for ; Fri, 19 Apr 2024 10:29:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1713547782; x=1714152582; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=muSGKLb11y4nDDcZMd/T5iJvMOH0Me1KjJrkvR0Bvuk=; b=BqAfy1Ugz+XnmQgpit/Y19ckl0VP8DGcx53ZXmWJ7hzYIP+fXFc1LU9pNCB59scM6I gwKyuILQQWDaf0U020sDG9BTYgelnDnXGVg/PW3Lzot0x8oM55aYzIFPjIJUlSTwVleC dgX1xnA8ga4cyJbYfoW4wHcFApWOvQMGezj+PL218JpESRtb10BoYwDcp8JivspzjNxm PKKMFLKqotD4Ppoy4T6zgXe4jFWgIP8F1qasTskS/8ytoXoxHVv8HCS06bSgYFU6eKPg 7pZvC+sRZBP/UIP3Q9x1HzjwSPF34M5TW90eWBIeZzw5XLBsI+K/aPucAwwZ78WhoSX4 we8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713547782; x=1714152582; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=muSGKLb11y4nDDcZMd/T5iJvMOH0Me1KjJrkvR0Bvuk=; b=P/3Y1j0BAAtK5EvQy+8HWq7l+Dn5tgjuA3IMz+beoTWk7dbfcy1mAjCBxQLHDpOqkv k3+OVL20MBJzOPiQDRk/J0XVc+iwGC8yp0Qlp9Jp142pH9XxDFvychW3HNdJ5DusI8j6 IA6PY+aJ7t7wNBdD4DeASCJAcxZ8Rn10aObwyQ8oeiX8z3TMilFo2Xc/JPfKQRI/s9Tv IjPJ7ko7Sdm8MkBLSuaMulg8x+2lc4ejFeH1SLNciUHJokI3OmSH3Z3D74fe+m1He0qd eSM2eno+nrAZROc9iZuBYLRVDkYB7LNlc9rvfrp1FUfpsKqAeIfQsTJqe3285w3DrU1f VjuQ== X-Gm-Message-State: AOJu0YwT2ySH6y7WKZKkUD1y18Z9b7w6LZKlChgmaOO45i37O9e+csGm 5qhEA/caeLoXUOfZuDANtl65SfGWPPXNKDbWwOg3CHmJavQPSwc/fd8jIbSXtnNY1oUl4ngyq9g m X-Google-Smtp-Source: AGHT+IFXVGoARxnc8sOGVi5lMe3ODeb31tY+p6uUoi7S0/kULZkby1ahkRmtV82wfIRWFnsDiJLSCA== X-Received: by 2002:a05:6a00:2e85:b0:6ed:4f2e:ef22 with SMTP id fd5-20020a056a002e8500b006ed4f2eef22mr3378121pfb.31.1713547781717; Fri, 19 Apr 2024 10:29:41 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id h16-20020a632110000000b005f3c5cf33b5sm3383074pgh.37.2024.04.19.10.29.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 10:29:41 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Reshma Pattan Subject: [PATCH v4 6/6] latencystats: fix for pedantic warnings Date: Fri, 19 Apr 2024 10:28:26 -0700 Message-ID: <20240419172926.55447-7-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240419172926.55447-1-stephen@networkplumber.org> References: <20240408195036.182545-1-stephen@networkplumber.org> <20240419172926.55447-1-stephen@networkplumber.org> MIME-Version: 1.0 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 ISO C does not allow casting function pointer to void *. Resolve by enforcing the reserved argument. The user_cb argument for rte_latencystats_init() was not implemented, and had to be NULL anyway. The log type is local to this function and RTE_LOG_REGISTER_DEFAULT alread has a semicolon. So adding one here causes a warning if compiler is set to pedantic. Signed-off-by: Stephen Hemminger --- lib/latencystats/rte_latencystats.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/latencystats/rte_latencystats.c b/lib/latencystats/rte_latencystats.c index 5db896ac7b..f60c893199 100644 --- a/lib/latencystats/rte_latencystats.c +++ b/lib/latencystats/rte_latencystats.c @@ -29,7 +29,7 @@ static double cycles_per_ns; -RTE_LOG_REGISTER_DEFAULT(latencystat_logtype, INFO); +static RTE_LOG_REGISTER_DEFAULT(latencystat_logtype, INFO) #define RTE_LOGTYPE_LATENCY_STATS latencystat_logtype #define LATENCY_STATS_LOG(level, ...) \ RTE_LOG_LINE(level, LATENCY_STATS, "" __VA_ARGS__) @@ -229,6 +229,10 @@ rte_latencystats_init(uint64_t app_samp_intvl, if (rte_memzone_lookup(MZ_RTE_LATENCY_STATS)) return -EEXIST; + /** Reserved for possible future use */ + if (user_cb != NULL) + return -ENOTSUP; + /** Allocate stats in shared memory fo multi process support */ mz = rte_memzone_reserve(MZ_RTE_LATENCY_STATS, sizeof(*glob_stats), rte_socket_id(), flags); @@ -281,7 +285,7 @@ rte_latencystats_init(uint64_t app_samp_intvl, for (qid = 0; qid < dev_info.nb_rx_queues; qid++) { cbs = &rx_cbs[pid][qid]; cbs->cb = rte_eth_add_first_rx_callback(pid, qid, - add_time_stamps, user_cb); + add_time_stamps, NULL); if (!cbs->cb) LATENCY_STATS_LOG(NOTICE, "Failed to register Rx callback for pid=%u, qid=%u", @@ -290,7 +294,7 @@ rte_latencystats_init(uint64_t app_samp_intvl, for (qid = 0; qid < dev_info.nb_tx_queues; qid++) { cbs = &tx_cbs[pid][qid]; cbs->cb = rte_eth_add_tx_callback(pid, qid, - calc_latency, user_cb); + calc_latency, NULL); if (!cbs->cb) LATENCY_STATS_LOG(NOTICE, "Failed to register Tx callback for pid=%u, qid=%u",