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 B5D44460FF; Thu, 23 Jan 2025 17:31:23 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A358540E13; Thu, 23 Jan 2025 17:30:35 +0100 (CET) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by mails.dpdk.org (Postfix) with ESMTP id EB7ED40DCB for ; Thu, 23 Jan 2025 17:30:26 +0100 (CET) Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2156e078563so16081045ad.2 for ; Thu, 23 Jan 2025 08:30:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737649826; x=1738254626; 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=F3bIn/d1N16rdlLN2NLsU1uSkVbqKA+eN9u/q92Mt5Y=; b=Q2PR1W5+kczHfjpObY8ht7i4DgrfA24E8NJmw9vpjBbTC5jpkmngL6O/+yW3NVwo5x biVyBvPhIHDOSi+GtGCajQV1Kn5rAqf8v7HG9BQIfCoUFV58c20XgBMWICU/x96u3Dzg xplYNluHiGxyFEIvfY8yGpNvGJVeEfT0UgXucor+xudbbHae9ZWHDYEuSp4NlQ28qoJB 2hcew/H94QIIDPiBBj1NewIpJBd4Zb4IWvbcHXlASEP+UKwpU/Sl/a3Sus4s+rBqv7kV TtrUGMyPtjsGpf+PFqJjIKbRSxoiMkCf/A2/5ff0wxnisq0ZJT8e3+wl70XGc8gWTAYp YWgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737649826; x=1738254626; 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=F3bIn/d1N16rdlLN2NLsU1uSkVbqKA+eN9u/q92Mt5Y=; b=RqpT1TFLnJMa7ZsjVIlCJKHiSpjhYY2962krF8hWm0FxMYJpaCmOLp54QuYjw3/P/x x/Ano9ZP85ujn0dsyMACk8bbUI3ymNgRrseVZvAhPLHw6eU3Vv+gq4xy6zdJGfytB2M6 0VncZ+FNcuvPUjmfV99gu2M6aroiFmTqjlXIn7zrkLuZHSxMKwjIDgxAfiN65JLpHDCO aQn/ManEd8h4+upVUGuSjqFOTCpWwngX9TZy06r3tlO/afg3W/gocIUCBqfa3vgL6WHa SfYlTYHT0T6ZsIDWsry/qp4jAUzQbGYanqHjsiLcnlyDwUo0MmeoOuSXMdZFguGFq2Uz mGzg== X-Gm-Message-State: AOJu0YzQBKrFWv5lJFOKnwCS0Ow16v3b7KuVkcNuk8Me0MOe4C95xORB DXYQn1fDO4CQCnj1CEW1Q/BqcpNkg3MqIswl/Kf/T+uZ4GoFEarBs0wUCTus0QieAGEWdlf3Qkl F X-Gm-Gg: ASbGncuK3ASCbh5bxuTUIJWBzUCVXTaw65elp+iGXzyA6JRkPrR8MYfL3ruePSOEgaE J8JGhxe4wcXsfHlaOoXPfkPZ52QEOmo7Vot0TNbXd0zoLIn4Eoe8P8VfvdWmct3BKWlfVyvqRnI hcG6lNRAZ0/hCyeSJwLlR08sVPpQofAgYnibkz9gVPKMo1b6OsmniVkIYmrjFO6T3rXcAHq3r6t eRZTy5QMkJNa9BUKpdKrqbon7mwvIYx0W+8Rf1srvAUmMZ6TWP3RKeJsNH+pOvpzi+SI2VUvJwI BZsZ/YDhCKrUZlqOCmYWJlWLwI2mKeamaNqu/2Okw+CtsAkTy8686EQ5dA== X-Google-Smtp-Source: AGHT+IEXQk5EmJ4GyNr7jZhsXkbe7H+aSLMgyI0KAqQzvCovBJtJiVSvwtNPj1qVi22rQvyjQnYWIA== X-Received: by 2002:a05:6a20:72a6:b0:1e0:f390:f2ac with SMTP id adf61e73a8af0-1eb2148e003mr39156623637.15.1737649825988; Thu, 23 Jan 2025 08:30:25 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-ac4907f076dsm64601a12.37.2025.01.23.08.30.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jan 2025 08:30:25 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Jerin Jacob Subject: [PATCH v3 10/15] eventdev: add allocation function attributes Date: Thu, 23 Jan 2025 08:28:10 -0800 Message-ID: <20250123163003.23394-11-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250123163003.23394-1-stephen@networkplumber.org> References: <20250110170603.538756-1-stephen@networkplumber.or> <20250123163003.23394-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 Use function attributes to catch cases where eventdev is allocated but not freed correctly. Signed-off-by: Stephen Hemminger --- lib/eventdev/rte_event_ring.h | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/eventdev/rte_event_ring.h b/lib/eventdev/rte_event_ring.h index 5769da269e..a8f308e4d6 100644 --- a/lib/eventdev/rte_event_ring.h +++ b/lib/eventdev/rte_event_ring.h @@ -247,7 +247,18 @@ int rte_event_ring_init(struct rte_event_ring *r, const char *name, unsigned int count, unsigned int flags); -/* + +/** + * De-allocate all memory used by the ring. + * + * @param r + * Pointer to ring to created with rte_event_ring_create(). + * If r is NULL, no operation is performed. + */ +void +rte_event_ring_free(struct rte_event_ring *r); + +/** * Create an event ring structure * * This function allocates memory and initializes an event ring inside that @@ -288,8 +299,8 @@ rte_event_ring_init(struct rte_event_ring *r, const char *name, * - ENOMEM - no appropriate memory area found in which to create memzone */ struct rte_event_ring * -rte_event_ring_create(const char *name, unsigned int count, int socket_id, - unsigned int flags); +rte_event_ring_create(const char *name, unsigned int count, int socket_id, unsigned int flags) + __rte_malloc __rte_dealloc(rte_event_ring_free, 1); /** * Search for an event ring based on its name @@ -304,16 +315,6 @@ rte_event_ring_create(const char *name, unsigned int count, int socket_id, struct rte_event_ring * rte_event_ring_lookup(const char *name); -/** - * De-allocate all memory used by the ring. - * - * @param r - * Pointer to ring to created with rte_event_ring_create(). - * If r is NULL, no operation is performed. - */ -void -rte_event_ring_free(struct rte_event_ring *r); - /** * Return the size of the event ring. * -- 2.45.2