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 3ECC143FAA; Tue, 7 May 2024 04:54:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 03CAC42E3F; Tue, 7 May 2024 04:54:10 +0200 (CEST) Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by mails.dpdk.org (Postfix) with ESMTP id 9AC464027B for ; Tue, 7 May 2024 04:54:08 +0200 (CEST) Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-6f44a2d1e3dso2228158b3a.3 for ; Mon, 06 May 2024 19:54:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1715050447; x=1715655247; 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=odpbCbPKJbNy9lq8M2bkJamESlxScMlSEJ/CG3ThLpM=; b=gR2QI5WYInlT0BCDH+IpyKC65PFvVXxzfWD+LRlMfFGwITNOKbEEldXeKK8q99xArq mLZD1kSVI1Ajp3jJF7NH9cSAj6nIM9g1x+RbbsjqiGXLjZgujggmr+I5rR0dU+68GleG ahlgehUopjGPg+Nk8+N6kADBlosMbEurVL+J4JUikQ8FLeRHYxfHufO3nK9+py4qfqVG hMIaN29n8+YDO58+7zmrDUX3PhQd3oCVe4wmauzeIqjzQ7QN0NcuGfN6rq4QEGLsg30b EoAPTJmwDsIEYKPBq4A0RoxXx2O3mb9UBEOWUMHOk8NLtUhFObYj/SAJqikxZmCHLV+V l8VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715050447; x=1715655247; 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=odpbCbPKJbNy9lq8M2bkJamESlxScMlSEJ/CG3ThLpM=; b=CUsm/6PsWprwh6RkFR8zBTprBpslSza60ZQgBKsU3+BLPbb1zpSShFfHfhPKi2Z/xr pGShZUX8uzOzF69EaGWBxTIPpLU6iCc0oYmetPu/HHbVACaOXDX9zZ2BB8hlqwVEvbTQ 0g0FQmeHCWBIj7U3Y/wRBKsgX/VKHPJ7TI7u8fZpWMN8oI54/Utbig1a4PwVqTlrQkpY CQwP9Z6CCsKvuhnsbQshIaG3ixaWVgnXf53GffQdTo2SdPIdaIbQaccRbvPLXMzgsjMg JRO+zhYXTLr9lEfzTMRtMs7tJeduI9LIMFUSDZzpEvmhP5QVbiJX/dM2vhZ+W2hwKwK8 t9OA== X-Gm-Message-State: AOJu0Yw0rrpLKWKiuVLMbKEMx85pOwFmvaOh3MNyZ11msihMi2oXsrQ3 42ivCBL+cPX1RKmDKpg99eK3dtPml9Rk+YGq6vLcQUTYXXVVeHkOXsom2hFEC6U= X-Google-Smtp-Source: AGHT+IG21uQ9pzXhSxoxXB5ptplB1BcfXWpD5GY8FRxanrGh535IfVZ0f5Him8bzDWdozXkECRXfzQ== X-Received: by 2002:a05:6a21:8887:b0:1a7:9812:3680 with SMTP id tb7-20020a056a21888700b001a798123680mr12800588pzc.40.1715050447559; Mon, 06 May 2024 19:54:07 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id v8-20020aa78508000000b006ead792b6f2sm8466108pfn.1.2024.05.06.19.54.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 19:54:07 -0700 (PDT) From: Stephen Hemminger To: roretzla@linux.microsoft.com Cc: dev@dpdk.org, Stephen Hemminger Subject: [PATCH 1/2] lpm: remove unnecessary temporary VLA Date: Mon, 6 May 2024 19:53:54 -0700 Message-ID: <20240507025355.7145-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <1715019531-22796-1-git-send-email-roretzla@linux.microsoft.com> References: <1715019531-22796-1-git-send-email-roretzla@linux.microsoft.com> 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 Do not need to recompute all the table indices. Signed-off-by: Stephen Hemminger --- lib/lpm/rte_lpm.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/lpm/rte_lpm.h b/lib/lpm/rte_lpm.h index 2888e5f4ca..9c6df311cb 100644 --- a/lib/lpm/rte_lpm.h +++ b/lib/lpm/rte_lpm.h @@ -337,7 +337,6 @@ rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t *ips, uint32_t *next_hops, const unsigned n) { unsigned i; - unsigned tbl24_indexes[n]; const uint32_t *ptbl; /* DEBUG: Check user input arguments. */ @@ -345,12 +344,10 @@ rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t *ips, (next_hops == NULL)), -EINVAL); for (i = 0; i < n; i++) { - tbl24_indexes[i] = ips[i] >> 8; - } + unsigned int tbl24_index = ips[i] >> 8; - for (i = 0; i < n; i++) { /* Simply copy tbl24 entry to output */ - ptbl = (const uint32_t *)&lpm->tbl24[tbl24_indexes[i]]; + ptbl = (const uint32_t *)&lpm->tbl24[tbl24_index]; next_hops[i] = *ptbl; /* Overwrite output with tbl8 entry if needed */ -- 2.43.0