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 17A1C43EDB; Mon, 22 Apr 2024 17:24:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 37A3240DCE; Mon, 22 Apr 2024 17:24:04 +0200 (CEST) Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by mails.dpdk.org (Postfix) with ESMTP id 0F48B406B8 for ; Mon, 22 Apr 2024 17:23:52 +0200 (CEST) Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-6eff9dc1821so4481210b3a.3 for ; Mon, 22 Apr 2024 08:23:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1713799431; x=1714404231; 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=ZAlamSzCyd37rEXw7BMa9g8WX7111M6ZNdaJ3MStE3ZZZk1EeVxSoXvwE4apsHEixs pJT+nAc5jipIdMRpe3Uup/k+g4TdQhkBetmG8pcPR6ikRMHgQOZJR8ANefhFM/4wOptJ q6zeC01wnhGiZPvnQ5UcKnOLANEmVdIuCSl3E2Sfj1qH/DYDPbia0xfBjV359qzOc4tW UpE+xdQ9V4r6ibiiL4CkWNJYLhPlzU4W5m/qIbOWvjMBsalxqJbIJxoY9OH0IOSZScWv KEqG1XlIJyMg4wmcjPo8DH36fqH2sP5y/bnO/PkPnuCQqZY6leJbbXo/NvvBWesuIiyq nFxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713799431; x=1714404231; 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=vUXaNycENxVATQKe0nFoXGQ1g+iJqh0vVBEVbGFzZpWNs42dt0/YvP+Jnxb+7M87Lj nOpK+LokhcrCjZf8pCTrgN8+v6zMxtt9RttZp8TvivHjnPwFyHrX6hycAQYJyqyuWych 1O/KE5c2Y9qV4GSCDQNBmjyHnVwvjFj1iFFF4X8Uy5A++KCprit3pnqDvcmRsDgJQaZT lnibzlkOlMm1tLloqwv3gKo+7XbZ2Z123BeBh62NVgWSHdjRZGnSlSCYe4EEd5I+Ho5H jZ0T/5QvxYykkHhQHNw5A9E7QeVBCHNUqDiZr/bsp+BN8NuTb4RZCbp6kz0QpdW59rCR 6VKg== X-Gm-Message-State: AOJu0YxR0MJlV1u3vnULfo1Vy/kRNSV2g3KNkOZySKrQNhUhRrKl/EfL 9uRbYRQ4JmIDmvw8U1oTsnfj5N05ECTqVNgndDcLHGv5S0b2IuSRpzt915aO4J9OlqGNSjki1D2 G X-Google-Smtp-Source: AGHT+IE2Q5ImzJzpzMNyB9WjKUzEYoK/mzJ2c3gWPb0CXJpu0CZ8hPkHIzArLQ59UPQq6vZSaPi+PQ== X-Received: by 2002:a05:6a21:7884:b0:1a3:c515:202c with SMTP id bf4-20020a056a21788400b001a3c515202cmr11121669pzc.62.1713799431222; Mon, 22 Apr 2024 08:23:51 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id cb17-20020a056a02071100b0060063c4be3bsm1402783pgb.14.2024.04.22.08.23.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 08:23:50 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Reshma Pattan Subject: [PATCH v5 6/9] latencystats: enforce that unused callback function is NULL Date: Mon, 22 Apr 2024 08:21:36 -0700 Message-ID: <20240422152336.147553-7-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240422152336.147553-1-stephen@networkplumber.org> References: <20240408195036.182545-1-stephen@networkplumber.org> <20240422152336.147553-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