From patchwork Tue Apr 16 15:19:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 139423 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 1260343E83; Tue, 16 Apr 2024 17:22:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4FDDD402F0; Tue, 16 Apr 2024 17:21:36 +0200 (CEST) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by mails.dpdk.org (Postfix) with ESMTP id 1C2FF402E0 for ; Tue, 16 Apr 2024 17:21:32 +0200 (CEST) Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1e36b7e7dd2so36424095ad.1 for ; Tue, 16 Apr 2024 08:21:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1713280891; x=1713885691; 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=poe1UA5TLQv/cPBViZsC1ncTG6aaoX/Gm7LOuF3bCs8=; b=hkthoLBWifqp0BhEU8nnbddIgemD/stqd4wNpSOJTlElXqBxEu3hhfFWat0O+x2WsD 8Qg9qTiFwIDR7PQKiDd7E+jIKKwEFqbIxNs3q+yH/aRQwcSN6wQbUISIeP33ZfhSqiRM ja3tEyeiMGdDPqQqHFLG/6TZ4Td6RWuI2As7Ak7PHcMwBWwS13n5QwEnSjFd2DLkvl08 KJsCjyR1vbs0oM/2W38sCtWcruVY62l66E3fzxghyzyeiCojucNd+0hcn0VpnrpOvO+t lDQrSLHmzfdBbnrjwv8yV3ellDdg1rcxznwASex6Y4nzzaOsdDLx0ogaC2+AhVn6fymH a6Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713280891; x=1713885691; 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=poe1UA5TLQv/cPBViZsC1ncTG6aaoX/Gm7LOuF3bCs8=; b=KmKlrQG6/wDe9RR0rg48ZBQdddgMZLKHBNxfJkcFnSduURYzU882oh0Tdf+WRbyxqF Aw/d8Bvc4H5cVRznFbeE2PrcyDhMC+Q8Ck+rGjqPRwHh21fE4HbOxNhVrBq/qHLw1k1a ulDlyTPfs4NFzr2LLZyLIqn+v3PmiX5X9C4+xmOlfp85j4b4zI4ElIt7kQQ43kUajKC3 YN4TMGwi2agEU8B4YVuLJuvbd6g1qJj5X+zXgQkKpISUuZiuTlk/ldqDHlsHg2EDFaY7 tHrk1sjyEqbWqnB+ehWznqMaKVOit2e3qME9BLslI29DMsauRK4mQlpWZXnbMHMxP4ZH 8C5Q== X-Gm-Message-State: AOJu0YzsDGSxaJooeulgFF7YZy8bpgrCyy6fEoJ1PIZJEhBmX/9923up LIWIr1qDobaJLGzIh1rvMop5tMqX+sflWyKpoXJ40fV92IjyQQ5b8wVol+ekue9aeysBwc6pbB8 G X-Google-Smtp-Source: AGHT+IEfvQBobVT6i8GhrvcDEtxvahQ5iwlLJaTwSbPGw/2WYyDGGZTA0d4xvI2IP7OojwiptMJmhg== X-Received: by 2002:a17:902:e5c1:b0:1df:f681:3cd8 with SMTP id u1-20020a170902e5c100b001dff6813cd8mr14143551plf.12.1713280891307; Tue, 16 Apr 2024 08:21:31 -0700 (PDT) Received: from hermes.lan (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id l17-20020a170903245100b001e80154a400sm213348pls.126.2024.04.16.08.21.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 08:21:30 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Cristian Dumitrescu Subject: [PATCH 4/5] examples _use RTE_DIM Date: Tue, 16 Apr 2024 08:19:30 -0700 Message-ID: <20240416152124.69590-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240416152124.69590-1-stephen@networkplumber.org> References: <20240416152124.69590-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 Use RTE_DIM instead of computing directly with sizeof. Patch automatically generated via cocci/rte_dim.cocci. Signed-off-by: Stephen Hemminger Acked-by: Tyler Retzlaff --- examples/l3fwd/main.c | 3 +-- examples/qos_sched/init.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 8d32ae1dd5..3960d85202 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -116,8 +116,7 @@ static struct lcore_params lcore_params_array_default[] = { }; static struct lcore_params * lcore_params = lcore_params_array_default; -static uint16_t nb_lcore_params = sizeof(lcore_params_array_default) / - sizeof(lcore_params_array_default[0]); +static uint16_t nb_lcore_params = RTE_DIM(lcore_params_array_default); static struct rte_eth_conf port_conf = { .rxmode = { diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c index d8abae635a..75629e36ea 100644 --- a/examples/qos_sched/init.c +++ b/examples/qos_sched/init.c @@ -206,8 +206,7 @@ struct rte_sched_subport_params subport_params[MAX_SCHED_SUBPORTS] = { .n_pipes_per_subport_enabled = 4096, .qsize = {64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64}, .pipe_profiles = pipe_profiles, - .n_pipe_profiles = sizeof(pipe_profiles) / - sizeof(struct rte_sched_pipe_params), + .n_pipe_profiles = RTE_DIM(pipe_profiles), .n_max_pipe_profiles = MAX_SCHED_PIPE_PROFILES, .cman_params = NULL, },