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 09A5E46130; Fri, 24 Jan 2025 19:18:28 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7BB6B42E0B; Fri, 24 Jan 2025 19:17:35 +0100 (CET) Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by mails.dpdk.org (Postfix) with ESMTP id 9941B427D0 for ; Fri, 24 Jan 2025 19:17:27 +0100 (CET) Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-2165448243fso52581815ad.1 for ; Fri, 24 Jan 2025 10:17:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737742647; x=1738347447; 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=U+QbN0rux2WdEeDV0EJ/XEEPy54GbcPDjxGRm6wChSUo2QqLg9AuwSCgTYD49MhEdQ ySzLNXp+SSlR8ZOHIwui2K47B4REFlcvlMHwj1TJvaMUirUTsmczwhWW1/SQHOBdIMkW dh6CrbgHkJwTfy1NSPRzCHCT5NDwRQsGMaVIiO+QTCHvz6wc64kENZuNkluC69T9/KUD pTEetlrWs8c7paiuMN66QIUE3DASgz7VBWaj2xPi+r2NbeTs2bWaHEKOTpA0Z/uLW8br PQuB0Y+w+ZdC1U6ceSwbgdpY+O+AJITzpSEuWJcI2tE5dy+tDETZTfNZ7HA2RCmT1sI9 QArA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737742647; x=1738347447; 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=FdU/VXnMNb02EukT7e6XtjuhK1hd65LEy+54J2yhUHVgYg5Sjfsw+2VsTWsSvbA1Xr iy73lByknJEK1uV4bkvT5q7QMDOyr2uMjHsqHlY/uvXZpmwH2Hkspj6k0vaqsQRrBkWq JrG60ZKNZiUDq74hMRxo1mdEEQJt7zwBuZsnJuCHayxIhFPrXJx9Ga28kCrsE46LPMc5 /AaFIVVe5WBOp2QbsUFooI5hCaL3dnUVrdnHzeZAhdFtCfOwcvh3Q7V9LkPZirUZO7Lv p3ocI6jQbwN+kAFp+pWNeSWZD9Xk48Giofn88YXIu2nGZDkUKM3yzrHxd69m7Q+D0GuE pKoQ== X-Gm-Message-State: AOJu0YzDm0LMkDCTeX6AnHr0b9PO3svOiZCqxuoVzWoXaz1r9uVqMtAj h7cURAeYPjq/y52rKjeBVRoJeSWe/Jytb8wZ/S1sf7ilw1T9x3/urhiL1yafu7S+66QblXa92Sx u X-Gm-Gg: ASbGncutGtu39aLde0YovlOM09fh2NvZhE1dSAPtOWDe8yYktJJwU/sgra2jqZCSKnE fkurUNm6MIa1xysCvwf1JH8GH9UH11Ah00+DhsnSuTP7IVgF/fvLatd1d5inNWCrBc4wm2UKyRn F6iDpMYd/dq7NIAh10a+FRDVk7i83DfRilstyM0BOnUiubFaaULR8gLqrb9FQ/HjVTEOFy53qm0 z7+FYaAzoQc2t1Dw5LQjn3/nIPl5xibrasnqejpq+ec+/rG0ElFZJK/K1BJE/uE++oUqui7Qbhi axOAhA8lNsy4wvTzFDqmMhxw9GU5mv1I2MwlLB84YuS7dDFRUSSMV4t+KQ== X-Google-Smtp-Source: AGHT+IFoYs3BhZY/jCWSWhdjW6b6fcjMVCh9NI6NycFQtty5okkIZ19MkdyFrhE6QojOBVpbEpssHw== X-Received: by 2002:a05:6a00:21c3:b0:72a:bcc2:7748 with SMTP id d2e1a72fcca58-72daf8515f4mr46060888b3a.0.1737742646911; Fri, 24 Jan 2025 10:17:26 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72f8a6b2ed8sm2184477b3a.41.2025.01.24.10.17.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 10:17:26 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Fan Zhang , Ashish Gupta Subject: [PATCH v4 13/16] compressdev: add allocation function attributes Date: Fri, 24 Jan 2025 10:15:04 -0800 Message-ID: <20250124181704.86567-14-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250124181704.86567-1-stephen@networkplumber.org> References: <20250110170603.538756-1-stephen@networkplumber.or> <20250124181704.86567-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