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 52E9F460E8; Wed, 22 Jan 2025 18:37:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1B60E406BB; Wed, 22 Jan 2025 18:36:11 +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 B1D2E40663 for ; Wed, 22 Jan 2025 18:36:01 +0100 (CET) Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-21619108a6bso125012775ad.3 for ; Wed, 22 Jan 2025 09:36:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737567361; x=1738172161; 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=oe6thpbvuTwlF6av708SoGl2MyK1WhQ3TjGxc0hY8D4=; b=tBRYmsX+8WXQgCXIw2g5pg2FDhMIuZ7VkTwTK6nC1VcygTSQHLJJrxFgJcDvZv2iVO ZFJvBP8U59YeSPEKkcNuEqePVLLu43+/D95pmc40ZuvVg2A06BX7WzwdPAxl/xX+A3Rj JrltQNkCHM/1sf4oCfMYaXycGyQCgbHjN+vYLxNgWNy4ebnWzVJSk5VcsFJBfeJGRUg7 N+2zT9X/+oS5jjfnj2YrqhQvkP+apLE7WCTFIVJJBOwx64ocJp66rXxwM6djnMUjso9D qayS76HhHUIDO2pfRQ4LD8Z5v2UAn7wQz7S1oWEyn2qehRB5NzEWh+HzQ/X8eVvrzHHJ cS4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737567361; x=1738172161; 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=oe6thpbvuTwlF6av708SoGl2MyK1WhQ3TjGxc0hY8D4=; b=Fc7TENAkCpG1VW2Q1JCljCewtgIOS2X7TGo5W/esD8sBAXmWwc09j3+oCxYWoNzl6d 44u3ChckcZvDpzlGG9ngzNP02e/7wIJrldrw47OxSKpL7C6C9ZTnlvBacl1+7Y9o74L3 lrsVkcgiyQWnwwBOy+/QPWbN5SneJyun4MG8nJEJieN7BsEl2rSubyelkqprPlL2YSFx 2bYSps/bmoXgv/rKKvuBdOzWPtqgOCUs5DAkpbBCyFrWwlj1wAW4ULkbNyXG6At9Zdtv m9GM07R4WZ+NKnK9Yghf2J5y1CyWVWNxiy3Fe0g/hLs+UBgWtTV/8UBCp4WIrmtqezM1 Ca5A== X-Gm-Message-State: AOJu0YzDFxiaBhxpWAe4BqpBNDqMcVoyn7SCqNaa/w+0NFTEXzgCm/Fa +j4FDB/2DT3LZsmC5Ky70G8lCkkitJLvDiVULlbI27EGS5x2G2Co1Gp3tz+qyo3uhH0lTlPlHtF h X-Gm-Gg: ASbGnctm2+HC5usgVXL/SOVansax8iWAqb5HN6jpdYeNVS/9MUNF73sn7AU2lUUS5Pl xd97kikzxjauYIS1cDzbE/p4q8Xqv3cgI7xYQQa/kuCsJo8Sis5M+W9Y2LgMXIz9X206xLrJkfR y9ocJ8qPqTv5fbJWawJCx2Giw29EkRGQMehTySQL0LHRuvfyaX8Ojfmu8KIbgS/t6LV6vjd7uGm oRjDWzzjZReMD6i5m1g1uRyXFxUtv7Lndi0+ZEPy3iiDldrVGApRNZZqKPp84Wm8YQw5k8a3x/1 XgU6L4ktwlh3kMlRrMcPksm0DjlzJlo2gIq9IFclbrgRya0= X-Google-Smtp-Source: AGHT+IHlQsCXD1aHhHV8VswJRa6i2XQqSR07VapLtbq9a12rAYD+jb/sFD9yMJ3tE4Vv7m5HrjHf6A== X-Received: by 2002:a17:902:fc8d:b0:21c:fb6:7c3c with SMTP id d9443c01a7336-21c3540760emr311503675ad.17.1737567360946; Wed, 22 Jan 2025 09:36:00 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21c2d3bc64dsm97469285ad.122.2025.01.22.09.36.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2025 09:36:00 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Fan Zhang , Ashish Gupta Subject: [PATCH v2 13/15] compressdev: add allocation function attributes Date: Wed, 22 Jan 2025 09:32:57 -0800 Message-ID: <20250122173521.305108-14-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250122173521.305108-1-stephen@networkplumber.org> References: <20250120180550.198121-1-stephen@networkplumber.org> <20250122173521.305108-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 compressdev is allocated but not freed correctly. Signed-off-by: Stephen Hemminger --- lib/compressdev/rte_comp.h | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/compressdev/rte_comp.h b/lib/compressdev/rte_comp.h index d66a4b1cb9..f86e773b28 100644 --- a/lib/compressdev/rte_comp.h +++ b/lib/compressdev/rte_comp.h @@ -480,6 +480,19 @@ struct __rte_cache_aligned rte_comp_op { */ }; + +/** + * Free operation structure + * If operation has been allocate from a rte_mempool, then the operation will + * be returned to the mempool. + * + * @param op + * Compress operation pointer allocated from rte_comp_op_alloc() + * If op is NULL, no operation is performed. + */ +void +rte_comp_op_free(struct rte_comp_op *op); + /** * Creates an operation pool * @@ -501,7 +514,8 @@ struct __rte_cache_aligned rte_comp_op { struct rte_mempool * rte_comp_op_pool_create(const char *name, unsigned int nb_elts, unsigned int cache_size, - uint16_t user_size, int socket_id); + uint16_t user_size, int socket_id) + __rte_malloc __rte_dealloc(rte_comp_op_free, 1); /** * Allocate an operation from a mempool with default parameters set @@ -533,18 +547,6 @@ int rte_comp_op_bulk_alloc(struct rte_mempool *mempool, struct rte_comp_op **ops, uint16_t nb_ops); -/** - * Free operation structure - * If operation has been allocate from a rte_mempool, then the operation will - * be returned to the mempool. - * - * @param op - * Compress operation pointer allocated from rte_comp_op_alloc() - * If op is NULL, no operation is performed. - */ -void -rte_comp_op_free(struct rte_comp_op *op); - /** * Bulk free operation structures * If operations have been allocated from an rte_mempool, then the operations -- 2.45.2