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 B060644107; Thu, 30 May 2024 00:58:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3577840A7F; Thu, 30 May 2024 00:57:45 +0200 (CEST) Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by mails.dpdk.org (Postfix) with ESMTP id 51033406B7 for ; Thu, 30 May 2024 00:57:40 +0200 (CEST) Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-6bf81d0d1f3so220472a12.3 for ; Wed, 29 May 2024 15:57:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1717023459; x=1717628259; 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=Tbyh2BBDJylB3AYKzLsyjZ08dTesXypgKi0n1sS96uE=; b=BguL5cJbxnojbmZNexAAbHPZa1iizOKjHBVHdkjcw22HfJGR0XUlzVQRDLueQy3xy/ ogysmylAT8swyRpb3zkn/XDX0k6dM0vwtEClPayek4C9gqnWPqN53CI0Wp8UrWMC6noq IPa8W79IeIz/VaRkqjnXLEeilsPM0R97gKpCBfdYYMkFqVY0hcmybsUE1XtiHMYQqQnG dlkM1WdrihO5raS/ejiZCeXgAbOJyTJ9a9DP9ufWf15b+0OHUAGXAFImedzKDG5uI87B 4Sek5qIEA+scgMEK0/n3zTkANnJJcKTx6GIxOHc9oREMzxTw7QM4m5kexH5hDJe59EPB Q6iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717023459; x=1717628259; 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=Tbyh2BBDJylB3AYKzLsyjZ08dTesXypgKi0n1sS96uE=; b=l8zExc4A3gcuD7kIK15rcSEVZXp7hwPzRf65cQc3BAIo20tnydzAVRgWby2y3pMD34 bjBa2ou+mkkcjC8xoD+lrxWcEx0JSmJ+w+CdeRn3yx02Jw5TwLvcvgl/ccY2wIvN3xm+ xfvcyz7wbp57mns2UTOvIcS1TxHizW4aoHYDATS7FelwASXYsPEynzbrSQz2aT8rcSE1 5CCJ44QUNNjKifMJ2LdZ4sGsBEaTf1TPoYV12owPf9QigMlqpNz+e2Lrekzy0tLjIWwo AplCUg0fN99zU48mQIoEMQls3M7QolLvimD4pBwyyCpW0CqCSukyQPfzErJg/bV8Rrw5 Alpg== X-Gm-Message-State: AOJu0YxpZNZNAakl5kIIlyC+mH6yQSxLPkEMEmOZTdLLX8r/BrkwChUQ ODyZ7Vb5PsaQxIixq0YQIxWjS//0P6fqlEET6+9VEk+G7ElJ5L8MgRA1DXUIbtdgGuruEXGrsFx J X-Google-Smtp-Source: AGHT+IHYSVyOC/8S1uByc8Wh2ljZrYM3VWYTWgKhAwoy+E0QygXOOsPgjeRdViwcn8J3zx05ay++ag== X-Received: by 2002:a17:90a:69a3:b0:2bf:cf4f:d353 with SMTP id 98e67ed59e1d1-2c1ab9d9e2cmr609071a91.4.1717023459509; Wed, 29 May 2024 15:57:39 -0700 (PDT) Received: from hermes.lan (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c1a77baebcsm351762a91.53.2024.05.29.15.57.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 15:57:39 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Reshma Pattan Subject: [PATCH v6 6/8] latencystats: enforce that unused callback function is NULL Date: Wed, 29 May 2024 15:54:43 -0700 Message-ID: <20240529225732.442539-7-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240529225732.442539-1-stephen@networkplumber.org> References: <20240408195036.182545-1-stephen@networkplumber.org> <20240529225732.442539-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 therefore can be local to this file. 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 bd8fde2f0c..8311adb411 100644 --- a/lib/latencystats/rte_latencystats.c +++ b/lib/latencystats/rte_latencystats.c @@ -30,7 +30,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__) @@ -246,6 +246,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); @@ -298,7 +302,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", @@ -307,7 +311,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", -- 2.43.0