Message ID | 20250127180842.97907-1-stephen@networkplumber.org (mailing list archive) |
---|---|
Headers |
Return-Path: <dev-bounces@dpdk.org> 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 8D2F64613A; Mon, 27 Jan 2025 19:08:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5FBC340698; Mon, 27 Jan 2025 19:08:54 +0100 (CET) Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by mails.dpdk.org (Postfix) with ESMTP id 45D3B4027D for <dev@dpdk.org>; Mon, 27 Jan 2025 19:08:53 +0100 (CET) Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-21669fd5c7cso84524895ad.3 for <dev@dpdk.org>; Mon, 27 Jan 2025 10:08:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1738001332; x=1738606132; darn=dpdk.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=pmVyilP9nuNp+92ycHjn6+cuR4NxwMyxksWELIWou8A=; b=Gmc7Z3Tbnln7KpG3UwtlSUlnn9rV1a5oOcP42x0NnblU2E890aOlbKsBdbR4lctk5j nVUoGERfSjAo7GWGppmSRl7IXXvhILHDUtMS8MppVfvSI6iKZXzd1btbp9dmLApCieGu FJqdtjNEPUE/doGL1qrD/PR3DLVarBQZm1OqG9UWWzzt3OQQutI2leu5ztQRTp7uEzPi yRlzN7GHIt5uQ2DJwRNorK1GFbJOZKBdb0lJCgtAh6/BXgg14g5jFsCQI1nKQ58f3E5s 4+dKJDi6NPe9nbPLD9j7iHhCdq8KQkn1sVCzUk9+H8b3mxhw7Cunqp1f6NpqRPOTM6us KmLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738001332; x=1738606132; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pmVyilP9nuNp+92ycHjn6+cuR4NxwMyxksWELIWou8A=; b=ldTiv8WnhlPo6B/N60/wByf8fT+mx4H81g3Rpb1YY2K0SdeNnBQccZbRfO8CRSliqO e+9j7tBqASi2lHA5mFiLsME81f/QrFRFEaDqQ7l1/kWheZSQyJjKtNZqQqdxShhv1IHc 5ZGleDfllkwdFikC/ZSheLc8QoODaEXach8/q2FpimP0ELcl8D4u88DKlMblMJnb6xoi ORbqV1m/TqovXsNKaiBq5cDIIjPKLPN8vaky8eG/W/eMkEoaujRcTbokS/06LufOp4QC Ioy+oxkS9zZkO6qikGnABdKI3BTkKA1oMhQTCuRDmiCyfvidkLvtDgtKFVySm1M8kMkD 6w1A== X-Gm-Message-State: AOJu0YyXXQyz+IZBGcYQEKaziMMdHh2V0BAQ+a5dIPXgdPKNaUymCAR/ XbKV/9vlPV+GmuHbibnvXmdh6Le8MLjwRNrE7R9lEIDG7ZnEzgJzr/4lntnIWjG3fpMW2/kQZF/ I X-Gm-Gg: ASbGncskrhx1MtKKbBmfBfpM5KYs5XkFhTolWAT9VqUsy7wKDmtld/o7ZzK/Xn5TzFr KhhMf9zcjtEd+qgCrx9xEGes8pIIUrLMf+9oWD/7Ef5qlJYKiNP12XtyfFqMRAGHc0szn9T98wf p37an9RzsP3Ht3Pr6KDy/SqyhSDmUDtyeW/q/WBXI8Xg6IRtGlKyxUHly5e5iYMcA0iat8XoKmi MIkziABurhhSMivTN2d535HF6jB+zp/PxsH94EOhixmZAU8rPOhuF8DVXJ+5HlPzEZbt9zQkkMj 2taFcBZ8LtAyHJIUsIMHe1JS3K0KFbFTdbSZ7GHS6z0eYFP+Ir39Q3wFMg== X-Google-Smtp-Source: AGHT+IGUIPpMB3UQoV/3p60b2VRyTswt2zvxgmxGtkvVE8EVEh6gVCgWxARfPQHXirgn2xCA+7RzTA== X-Received: by 2002:a17:902:d491:b0:216:2bd7:1c2f with SMTP id d9443c01a7336-21c355042e2mr526915125ad.18.1738001332251; Mon, 27 Jan 2025 10:08:52 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21da41413absm66166665ad.123.2025.01.27.10.08.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jan 2025 10:08:51 -0800 (PST) From: Stephen Hemminger <stephen@networkplumber.org> To: dev@dpdk.org Cc: Stephen Hemminger <stephen@networkplumber.org> Subject: [RFC 0/7] Introduce FreeBSD macros for SAFE iteration Date: Mon, 27 Jan 2025 10:03:54 -0800 Message-ID: <20250127180842.97907-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 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 <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org |
Series |
Introduce FreeBSD macros for SAFE iteration
|
|
Message
Stephen Hemminger
Jan. 27, 2025, 6:03 p.m. UTC
This series adds common macros for safe iteration over lists. It is a subset copy of the macros from FreeBSD that are missing from the Linux header sys/queue.h Chose this over several other options: - let each driver define their own as needed. One Intel driver got it wrong, others will as well. - rename all the queue macros to RTE_XXX variants. Seems like useless renaming and confusion. - Several distros have libbsd package with the correct macros. But adding yet another dependency to DPDK would be annoying for something this basic. There are more macros in FreeBSD header that could be useful, but we can add those later as needed here. Stephen Hemminger (7): eal: add queue macro extensions from FreeBSD net/qede: fix use after free bus/fslmc: fix use after free net/bnxt: fix use after free net/iavf: replace local version of TAILQ_FOREACH_SAFE vhost: replace open coded TAILQ_FOREACH_SAFE raw/ifpga: use EAL version of TAILQ_FOREACH_SAFE drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 5 +- drivers/net/bnxt/bnxt_filter.c | 8 +- drivers/net/iavf/iavf_vchnl.c | 8 +- drivers/net/qede/qede_ethdev.h | 3 +- drivers/net/qede/qede_filter.c | 13 +- drivers/raw/ifpga/base/opae_osdep.h | 1 + lib/eal/include/meson.build | 3 +- lib/eal/include/rte_queue.h | 174 +++++++++++++++++++++++ lib/vhost/socket.c | 11 +- 9 files changed, 193 insertions(+), 33 deletions(-) create mode 100644 lib/eal/include/rte_queue.h
Comments
On Mon, Jan 27, 2025 at 10:03:54AM -0800, Stephen Hemminger wrote: > This series adds common macros for safe iteration over lists. > It is a subset copy of the macros from FreeBSD that are > missing from the Linux header sys/queue.h > > Chose this over several other options: > - let each driver define their own as needed. > One Intel driver got it wrong, others will as well. > - rename all the queue macros to RTE_XXX variants. > Seems like useless renaming and confusion. > - Several distros have libbsd package with the correct macros. > But adding yet another dependency to DPDK would be annoying > for something this basic. > Actually, I wouldn't be that quick to eliminate the last option. It may give us some additional options for simplification. For example, the strlcpy and strlcat functions are in libbsd too, and if we had that as mandatory dependency, perhaps we could remove some extra code there too? /Bruce
On Mon, 27 Jan 2025 18:16:18 +0000 Bruce Richardson <bruce.richardson@intel.com> wrote: > On Mon, Jan 27, 2025 at 10:03:54AM -0800, Stephen Hemminger wrote: > > This series adds common macros for safe iteration over lists. > > It is a subset copy of the macros from FreeBSD that are > > missing from the Linux header sys/queue.h > > > > Chose this over several other options: > > - let each driver define their own as needed. > > One Intel driver got it wrong, others will as well. > > - rename all the queue macros to RTE_XXX variants. > > Seems like useless renaming and confusion. > > - Several distros have libbsd package with the correct macros. > > But adding yet another dependency to DPDK would be annoying > > for something this basic. > > > > Actually, I wouldn't be that quick to eliminate the last option. It may > give us some additional options for simplification. For example, the > strlcpy and strlcat functions are in libbsd too, and if we had that as > mandatory dependency, perhaps we could remove some extra code there too? > > /Bruce > I would be ok with using libbsd but only if we didn't have to keep a parallel copy for all the other compiler and OS variants. And would it be global or a per-driver dependency?
> From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Monday, 27 January 2025 19.44 > > On Mon, 27 Jan 2025 18:16:18 +0000 > Bruce Richardson <bruce.richardson@intel.com> wrote: > > > On Mon, Jan 27, 2025 at 10:03:54AM -0800, Stephen Hemminger wrote: > > > This series adds common macros for safe iteration over lists. > > > It is a subset copy of the macros from FreeBSD that are > > > missing from the Linux header sys/queue.h > > > > > > Chose this over several other options: > > > - let each driver define their own as needed. > > > One Intel driver got it wrong, others will as well. > > > - rename all the queue macros to RTE_XXX variants. > > > Seems like useless renaming and confusion. > > > - Several distros have libbsd package with the correct macros. > > > But adding yet another dependency to DPDK would be annoying > > > for something this basic. > > > > > > > Actually, I wouldn't be that quick to eliminate the last option. It > may > > give us some additional options for simplification. For example, the > > strlcpy and strlcat functions are in libbsd too, and if we had that > as > > mandatory dependency, perhaps we could remove some extra code there > too? > > > > /Bruce > > > > I would be ok with using libbsd but only if we didn't have to keep a > parallel > copy for all the other compiler and OS variants. And would it be global > or > a per-driver dependency? +1 to providing our own implementations of relevant libbsd features in the DPDK EAL, rather than depending on the entire libbsd (and libbsd-dev for development). Providing these features as part of a "utilities library" (which is currently integrated into the EAL) is better for non-Unix environments. Furthermore, libbsd has plenty of stuff we don't need: https://manpages.debian.org/testing/libbsd-dev/index.html
On Mon, 27 Jan 2025 20:29:55 +0100 Morten Brørup <mb@smartsharesystems.com> wrote: > > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > > Sent: Monday, 27 January 2025 19.44 > > > > On Mon, 27 Jan 2025 18:16:18 +0000 > > Bruce Richardson <bruce.richardson@intel.com> wrote: > > > > > On Mon, Jan 27, 2025 at 10:03:54AM -0800, Stephen Hemminger wrote: > > > > This series adds common macros for safe iteration over lists. > > > > It is a subset copy of the macros from FreeBSD that are > > > > missing from the Linux header sys/queue.h > > > > > > > > Chose this over several other options: > > > > - let each driver define their own as needed. > > > > One Intel driver got it wrong, others will as well. > > > > - rename all the queue macros to RTE_XXX variants. > > > > Seems like useless renaming and confusion. > > > > - Several distros have libbsd package with the correct macros. > > > > But adding yet another dependency to DPDK would be annoying > > > > for something this basic. > > > > > > > > > > Actually, I wouldn't be that quick to eliminate the last option. It > > may > > > give us some additional options for simplification. For example, the > > > strlcpy and strlcat functions are in libbsd too, and if we had that > > as > > > mandatory dependency, perhaps we could remove some extra code there > > too? > > > > > > /Bruce > > > > > > > I would be ok with using libbsd but only if we didn't have to keep a > > parallel > > copy for all the other compiler and OS variants. And would it be global > > or > > a per-driver dependency? > > +1 to providing our own implementations of relevant libbsd features in the DPDK EAL, rather than depending on the entire libbsd (and libbsd-dev for development). Providing these features as part of a "utilities library" (which is currently integrated into the EAL) is better for non-Unix environments. > > Furthermore, libbsd has plenty of stuff we don't need: > https://manpages.debian.org/testing/libbsd-dev/index.html The red-black tries in libbsd are very useful. In one product we used it as a way to manage LPM rules, since the current DPDK model is O(N^2) and works terribly in a router with 3M routes.