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 7767E460FF; Thu, 23 Jan 2025 17:31:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 83C7440E2F; Thu, 23 Jan 2025 17:30:39 +0100 (CET) Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by mails.dpdk.org (Postfix) with ESMTP id A6B9B40DDE for ; Thu, 23 Jan 2025 17:30:29 +0100 (CET) Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-2ee46851b5eso1703080a91.1 for ; Thu, 23 Jan 2025 08:30:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737649829; x=1738254629; 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=0/rSeolKT3iNtm4GkrB1rmjqo71g431jyBANyWtVsd5b6CmpXUfyzuw2hpsLPCAzgd vOvwdQZjS58y8az1LKOQCPSnIgkaRFz5IMjfiNkfW8cXOc1Q9GmDbpPwo3hyeYs82IXH 8NQgtox3FzAfDDed0dakO3sHnCADzrjF79Y7bT7qbZ2sa2uazNVvK5Jkta4EcuBDn5hI 4fadZhGZeTw2Zrig5OcE3bowAcdfZnFCfCTHQNtvTAIvNszRm27ceWiQ5lMFiP7A7F/O Ps8FQwnqVJTV5JOThohUPzhmu6Uoi2NHEG8Vbc022rmjCRCpDZdUdOFQmZRwZuf/BuRv Xnzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737649829; x=1738254629; 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=tq9t2aT+bhJIhxa4pG/uZ9ylPSIpHDrRwm+Vj04yIA1nRcRJhhsRETJ1Fq6qqSpJ6+ P4JTB4L9r5I7AFIhfd/BROEYH4UzJcxEbi6iYVAOVAfsfAOT1+ljw2UE2vI5PIZsN6PI tunFheKwAepeyqcYJB0LlHCkkQ3WUY55SDuNJoCXcPOMEgK1rxY4Kfz9SkcXge3q0QwV 0dPRutaWcQCMugzd9gWfNQL7rksuaSoyyKeI0jU/iIcwPT0cnrcoWq9s91mh8cXR+Q/Y Zm0FPR5qXCO+fuu1hBpmGP1Ns4qgQ9iUxePwA4pODwQIvZBCR4yDsvo+OumeZc968Dv+ ZjZw== X-Gm-Message-State: AOJu0YzCnqSUDDRdeWkIqC3c3Ax8MnvUuUYe7uej7o8dJcgRK5JnfMWu f0IcjIRAx59Ez60gbq3FLcTIexJ4R8yDiQh424+lJ39wzeN2aP0cFHkEO6m9OKxjIejMk4HPgzG 3 X-Gm-Gg: ASbGncuI1hJbD21OMlLrXAurqkqvsfYJcfKg7PUEtHi140mOwILwFZVD+1Cm0CfP7t1 lgSmSsyqOkmZTCOic6GSYbal11HVh/9qDELOzH7twlfQAiwTHfEkQWeMPd9TkYLdbyXpWtqGCfO 3B15lA1RpLICfCsBauqs6AbYb56noaW5CbKp4cWVE8PGiwcZeXkqq+LJkFKHS/FC5ms8PYcB5Ig WkfD1XFWieZyGSEVPPhmfcaoROz2TFSec+OZ+Dqfu9v49XGff5GCm+x6XlV/YhqAoFx0ufjDsEx 445yaCTdqjCuC1lOXbC00bafsxJ8Y67qz4xUbyzrF7xIDT5/bKKruJ7YHg== X-Google-Smtp-Source: AGHT+IHChysJa+7LI80sZDirV6PadZW8RBQdXJtl5Lu5tbJ2eySVGaSpxTMCS4T14a0HFcRbgfLHIg== X-Received: by 2002:a05:6a00:400e:b0:725:ea30:ab15 with SMTP id d2e1a72fcca58-72daf930fddmr34342475b3a.1.1737649828885; Thu, 23 Jan 2025 08:30: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-ac4907f076dsm64601a12.37.2025.01.23.08.30.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jan 2025 08:30:28 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Fan Zhang , Ashish Gupta Subject: [PATCH v3 13/15] compressdev: add allocation function attributes Date: Thu, 23 Jan 2025 08:28:13 -0800 Message-ID: <20250123163003.23394-14-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 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