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 2931C46104; Sat, 25 Jan 2025 03:14:46 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6A2F440687; Sat, 25 Jan 2025 03:14:06 +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 A869D40616 for ; Sat, 25 Jan 2025 03:13:28 +0100 (CET) Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-21a7ed0155cso47295365ad.3 for ; Fri, 24 Jan 2025 18:13:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737771208; x=1738376008; 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=e0NpprbaoGaJ5SwG/Mm1HFq1e1h+7Jb172O5KLQoKGI=; b=FNysAT/2PJpa1//R4Jk7R3DcwxGnyBE7LQ+1wNvXmJWPFxHgm/zMVyWslJMi9B3apy ThqQ/2+LHpFfkdu0N3vS3VYx0U8DL4LO/pITNTqMrG73/D46Cha6ThLzEPrjSVXrlCic 337lsQK1ZgE5ECd2ZwWJdY+sA1ucd/C+wfy7IUMvaeRrajM5IFAO0F2toUYAqYi/8/X+ kOxwlJOgH5pWbVkB0uxuGJimdfqEKaa9Y5HiydbnSAehLeK688tNMLpbvfy69xmrL9fM reJReZ9VtDKi+iNfVubmUg7z8taRcRi/zaP9nQ+UGzjZPIkwcuUMTCYGbQ2s14iHpM7g 2zaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737771208; x=1738376008; 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=e0NpprbaoGaJ5SwG/Mm1HFq1e1h+7Jb172O5KLQoKGI=; b=rUc1maiMM81aPrCQAaKxNTs0mXsTiCtWcuSTkr7TnyVPKUgKD5lzCAhNC0Ba/WSwej xzdWWlIoBuPEq2BSpEzCXSPwVef7QVn3kY6+f7HlErJFI86PedAViwILjR9ryqULdeVB DM+a/GMYdzpAicKuBiHULi1UUxUF/HlZ9gTDBA/de4ucKqBoDmPu9+WhRvgMTT9wgDSz 9WQmp3In5cmfFddpdyEbe9ILt4tf6pK2G84XqYC/xOn9jT/zPgtVckRp2vOlvjcJ0Ud9 JABIdB/Y6IdHn40P/TOm4XqmS3ZGQF1EaKasiTgBdiG3Sqh+8br8f8fxb8feh45Yj4Xo xGOA== X-Gm-Message-State: AOJu0Ywxfz12GL1CdSan5HWroG1wNVLftHKWmUnldf6GXVhXJiDGjLnR UpyxoR+n3e1AS6EVAYI9AmpaWNlz79FVphzf9UG/35IO0kA37L0pyrUuiaM8e1rI4im7+/+YYxU j X-Gm-Gg: ASbGncvyYuR9g84Dd8xQNcZiUfop7+5wr80OTy98l5f73WgCBlk6FpaVoaEvP5bc1Pv pg7jFA4cZI0dSTdYfEsFbld+bwQ+pfr2XuQkCVGKrWDN5Tu+bXofrJIY+rbmg9CKAklSj9/PUi+ wkUiqhSk4BBBsPSZ1TND1PgVnc1mIR1iZSy91pbIqrLIXAw81aWMFtZ1YOVdQSW6AP/r9N6X2Nl Sc9/8Yx/4uQ/BJCY9TOon2OW5wbJPgs6WvsX4JXZAX0CJIlQV+YB08Nxo/oH31fqE6UKx8wlRK/ iI4K0Up8QdJwsNl4McjagEbyIGoJJUOGQI8Yl6CcyhhsPFHcOh3oEp3iwQ== X-Google-Smtp-Source: AGHT+IFMuA3yBeMhkA4bOURpJFxFQ1Kv/fpFm70XrY6Y5XOiQGeWK2hdFxiNmVcgrY0IJ2tBocWrCA== X-Received: by 2002:a05:6a21:338f:b0:1e1:cdff:5f18 with SMTP id adf61e73a8af0-1eb21452a39mr45849625637.4.1737771208008; Fri, 24 Jan 2025 18:13:28 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-ac48e84e199sm2345256a12.11.2025.01.24.18.13.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 18:13:27 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Fan Zhang , Ashish Gupta Subject: [PATCH v5 13/16] compressdev: add allocation function attributes Date: Fri, 24 Jan 2025 18:11:26 -0800 Message-ID: <20250125021305.76485-14-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250125021305.76485-1-stephen@networkplumber.org> References: <20250110170603.538756-1-stephen@networkplumber.org> <20250125021305.76485-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 | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/lib/compressdev/rte_comp.h b/lib/compressdev/rte_comp.h index d66a4b1cb9..827e3d25ed 100644 --- a/lib/compressdev/rte_comp.h +++ b/lib/compressdev/rte_comp.h @@ -11,6 +11,7 @@ * RTE definitions for Data Compression Service */ +#include #include #ifdef __cplusplus @@ -480,6 +481,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 +515,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 +548,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