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 EF83146F76 for ; Thu, 25 Sep 2025 21:38:06 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C40CE4065E; Thu, 25 Sep 2025 21:38:06 +0200 (CEST) Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) by mails.dpdk.org (Postfix) with ESMTP id C5B824065E for ; Thu, 25 Sep 2025 21:38:05 +0200 (CEST) Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-85b94fe19e2so115743485a.3 for ; Thu, 25 Sep 2025 12:38:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1758829085; x=1759433885; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=eOIjwqSEOBIHmd8aL9WSU/Oo0fNTDRyP42apXRhk0CU=; b=SreSIvoyV9HPjEpJ5PflZCWmezxmhNSZwKt3frEPbuR/zaqf0mc92wlnw45ip3wOLW nBMNndSjX04KlHSDJGl/4g9AuzOLj96LBlRvFzEfSa1Q4nPQOzS7ZLmKWICzmMyffD0w z0KtKZntwuk3zh92vfeAOo6ZIImJ4VHMopKWI8alE9BSxBgjThl32CQimGLmfcGsS+qE HhpmZlcO78paNgMYy5H96YsSC3LfoA+KZMIsDd/nTcRsSmw9F4Z9AWBzOWYvNKYi7Pv5 SdviwngEGLMWT9VZ9BEqgO6eN/zfrFUTNOelTvLx01Y/gd/91nbWglZeRFbdXnj6bq34 YQAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758829085; x=1759433885; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eOIjwqSEOBIHmd8aL9WSU/Oo0fNTDRyP42apXRhk0CU=; b=upzPo2mMYb6nVM3ElAMvemnPykPBgb9tcvyPsv7/ozRcJAaufDe/xsFEv7OMZrf7LU Ir9wt7BIETiVKAEdxncX0fLVcVH/a4Wa/YcYqdIfn/wE8eYoIdSn1EvAkKzLYO4CEilw rsJAAx/msNWwrp619Ui48A1aj2OZdNmHHYkCMItQt2VJIBCU64g1teBw7Tzhu4LKc8Tr hFZ/auv6o4gwiG3dyuHBq0U6Hop9SBmMwGXx/plBh0IxvC92Qc62otgEL9X8PDYYviXq omaBJjHDz6viWeZMzLjSSuteKQNa6l7/QfLfiiHdp8qB+FXcQDDNNFbDlUKJQDGo6RQA Il1Q== X-Forwarded-Encrypted: i=1; AJvYcCUao7DLxWMXDUjjoUFXf5Ljgy6j6GxUKBg6EiTn4IKGQsBtWvN84MuOzHTKO7SpOLCBDUVJ93k=@dpdk.org X-Gm-Message-State: AOJu0YyCHmvaJqriC1DX8Lz66ky8i3Amk3PolkW5ym0gUhkPxh8310nl ehXm5cdGQhoqes9ZsADryxP0YyNvpEJM48M6IKG1LR0bfYaLBmr/Zzzz5r5iyagPv7w= X-Gm-Gg: ASbGncubZI2bh7E/IASmvs/uVVxL/05mCFo95QL+tNp+04F5622aZsSzdPdUseAPZYi RSTVmYNyXOutwQVre9/Sn/DtPxXRmiJ7+OqES+ge7hGNUjLFWM/XSRDVXdyLlOfxgtCqD8IxzBy 34H2RBn0pHyhZfBtDryzkLoMN6arLb8/Towj6/Xch0OZ2ErD00d3yC+Ncngzi7yQ5S6DTh4yWC8 FqwMK9E6syxvvyECJx70POhzzGKv3sBSnQSiNl9ln/3gus0lHk5zlwGMwuFdqyjPpHVZvlmU6d/ ycG2cTQCWCvUu+GzbU3q3EkMlSESKUEFSAcA8zfaXUpV4gIYeYzMDSbPOxSoiwK8reU5pFdmD2b j/tJW198rZDNAPplDIcGX2S4+t/RIykxEuW3KwewEAT2CCTPCx1uDqe+eGDCQkPGaUvN++8jZyG Y= X-Google-Smtp-Source: AGHT+IFrbh2rBEsv68Tt6eIMV/LMGJa++mcnjIavYmG3xL9dh4sNkY16qzU7k/exOFmsghGgg8eqDA== X-Received: by 2002:a05:620a:2686:b0:82a:9b78:3db1 with SMTP id af79cd13be357-85ae97a802dmr587158985a.69.1758829084912; Thu, 25 Sep 2025 12:38:04 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id af79cd13be357-85e95e91765sm89951685a.46.2025.09.25.12.38.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Sep 2025 12:38:04 -0700 (PDT) Date: Thu, 25 Sep 2025 12:37:59 -0700 From: Stephen Hemminger To: Alexander Kozyrev Cc: , , , , Subject: Re: [PATCH] app/testpmd: use table ID for jump to matcher action Message-ID: <20250925123759.5ac936d9@hermes.local> In-Reply-To: <20250819144508.722653-1-akozyrev@nvidia.com> References: <20250819144508.722653-1-akozyrev@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On Tue, 19 Aug 2025 17:45:05 +0300 Alexander Kozyrev wrote: > Current implementation requires specifying the pointer to the table > you want to jump to in the jump to matcher action. It is inconvenient > since there is no table pointer shown anywhere in the table management. > Table creation/destruction uses the standard table ID for that purpose. > Use the table ID in the jump to matcher action as well. > > Signed-off-by: Alexander Kozyrev The cmdline code doesn't guarantee that the space in the context will be aligned. Therefore using memcpy like this (untested) would be safer. Please review this as possiblity and resubmit if needed. diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 5d9c8f04f2..04d3dbbdca 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -11221,7 +11221,7 @@ parse_jump_table_id(struct context *ctx, const struct token *token, return len; /* Get the parsed table ID from where parse_int stored it */ entry_ptr = (uint8_t *)ctx->object + arg->offset; - table_id = *(uint32_t *)entry_ptr; + memcpy(&table_id, entry_ptr, sizeof(uint32_t)); /* Look up the table using table ID */ port = &ports[ctx->port]; for (pt = port->table_list; pt != NULL; pt = pt->next) { @@ -11233,7 +11233,7 @@ parse_jump_table_id(struct context *ctx, const struct token *token, return -1; } /* Replace the table ID with the table pointer */ - *(struct rte_flow_template_table **)entry_ptr = pt->table; + memcpy(entry_ptr, &pt->table, sizeof(struct rte_flow_template_table *)); return len; }