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 A264A460E8; Wed, 22 Jan 2025 18:36:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 95F7F40666; Wed, 22 Jan 2025 18:36:00 +0100 (CET) Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by mails.dpdk.org (Postfix) with ESMTP id F103D4064F for ; Wed, 22 Jan 2025 18:35:54 +0100 (CET) Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-2166f1e589cso174514935ad.3 for ; Wed, 22 Jan 2025 09:35:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737567354; x=1738172154; 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=4QccC+rJz6o43yyLXgz7JWWqtvb75A2XYpKBUmdlRFU=; b=wbsqAq3K81tNV8m7p/uP8GpdiRvf+gsdB3+qjI9BoVEtVQ/5dWjabk6UeMJcHreYOl Ua4l9h/5fjD5tfYCU8T6t1C/kKp4u2yDgxx4k+lkqnIjDZF7d+qnVjuYZGaWktfUXS6D O1RvD+u4/iWeGKgl8gatQ7ygXgxXnY1MdY1mOJcEJX5QeHSIdGZNlBhJ9nn5Lt9Lw1wl pAxkQ2eehStENGIyobv96/w1tdVuK0wV94FoMIu3IM5zj5UkgNPT1LM+R+qnCH+RA5AW rOevbzVm4ZHH9VY3i7akYsHi6rUtQNq7Ij1a+ewkrpkJ1xtUbOz9GBpSXns1nl04qe32 jHPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737567354; x=1738172154; 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=4QccC+rJz6o43yyLXgz7JWWqtvb75A2XYpKBUmdlRFU=; b=dl6Z7kp5GDeKtAYMMTQSeVljnbqTHi+1dMMxOZE7rvvoKG1vpiqIQE2UqAsnqZ7g4N 6l7icrRDkHBbdds0iIrSCxFKkb9bcjQS5bcU9JELXeTd6Xv8nR9CRB1/IUXLeZwuz+5J QsxW7zmcIxFabNsdiFhhPzu36YCHrpVZrjlaFtii1T9ZVyNq8QlufrgIbAwuhiiXdRol dDUWbtITMpoxglgSeBWoHjiao565NbXYMir97p/Z4p7wNMPVC3BQlSWcstXw/SU9JPug 26O4qAIhK2u3eIqH5bVpBzVOnAAj1zc84Kn5cIn1x+yD4zQImEXQdK5R5KxXCDZRU1CU B0ew== X-Gm-Message-State: AOJu0Yxu6wf9R8hVr4Nk7gv71hXKYVOJbMcojyw1kScNceoD3A8epc57 Ve6B+auM8uL9S4bbqSCB8vAfcAusK2T2fEqsOklU/7zATnbfZo5V9+Uen2Fjd40X7hgsDSd5scy z X-Gm-Gg: ASbGnctTMhDDd++JOHpPUxVkMPf0qG0IsYT4nP5Qgd7ODivpC0xCjdCI6f0F29ijcvi ri/TKogMlDWByxX5ujtSeAA4Eb9pQEtF6Y2aE+3ZXidrBt/6ectpBaq7l7d3RRXmnOkCAP7DwnS 9B43q1CS3WRVFmIDI5TavmJifJd8Qa0MsyvyySkzZGG0gbg8qkY9esD0A8Ygk/y6n50W3I1NPjK kqawenAezdLX6fBF7RrSDKTlMsejj44I/e60c+FZUR6vROfasq5wAGyhKVit9OYwVd0khMeP8f+ G1uH0CbY4K3RIloNBVj98eGEB3Bij4CuHryS4hXDWyxfixQ= X-Google-Smtp-Source: AGHT+IGwnkDNGIYM9ILFan1blIWSL86sWcfyld3/uHGSucQK159Qh2MX+J4LEKuu0fzFvIr/tye+rA== X-Received: by 2002:a17:902:ccc2:b0:216:3e86:1cb9 with SMTP id d9443c01a7336-21c357a608dmr316756545ad.50.1737567353716; Wed, 22 Jan 2025 09:35:53 -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.35.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2025 09:35:53 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Cristian Dumitrescu Subject: [PATCH v2 05/15] pipeline: add allocation function attributes Date: Wed, 22 Jan 2025 09:32:49 -0800 Message-ID: <20250122173521.305108-6-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 pipeline is allocated but not freed correctly. Signed-off-by: Stephen Hemminger --- lib/pipeline/rte_port_in_action.h | 55 ++++++++++++++++--------------- lib/pipeline/rte_table_action.h | 53 +++++++++++++++-------------- 2 files changed, 56 insertions(+), 52 deletions(-) diff --git a/lib/pipeline/rte_port_in_action.h b/lib/pipeline/rte_port_in_action.h index 9d17bae988..ee6cc59fae 100644 --- a/lib/pipeline/rte_port_in_action.h +++ b/lib/pipeline/rte_port_in_action.h @@ -164,18 +164,6 @@ struct rte_port_in_action_lb_params { */ struct rte_port_in_action_profile; -/** - * Input port action profile create. - * - * @param[in] socket_id - * CPU socket ID for the internal data structures memory allocation. - * @return - * Input port action profile handle on success, NULL otherwise. - */ -__rte_experimental -struct rte_port_in_action_profile * -rte_port_in_action_profile_create(uint32_t socket_id); - /** * Input port action profile free. * @@ -189,6 +177,19 @@ __rte_experimental int rte_port_in_action_profile_free(struct rte_port_in_action_profile *profile); +/** + * Input port action profile create. + * + * @param[in] socket_id + * CPU socket ID for the internal data structures memory allocation. + * @return + * Input port action profile handle on success, NULL otherwise. + */ +__rte_experimental +struct rte_port_in_action_profile * +rte_port_in_action_profile_create(uint32_t socket_id) + __rte_malloc __rte_dealloc(rte_port_in_action_profile_free, 1); + /** * Input port action profile action register. * @@ -236,6 +237,19 @@ rte_port_in_action_profile_freeze(struct rte_port_in_action_profile *profile); */ struct rte_port_in_action; +/** + * Input port action free. + * + * @param[in] action + * Handle to input port action object (needs to be valid). + * If action is NULL, no operation is performed. + * @return + * Always zero. + */ +__rte_experimental +int +rte_port_in_action_free(struct rte_port_in_action *action); + /** * Input port action create. * @@ -252,21 +266,8 @@ struct rte_port_in_action; */ __rte_experimental struct rte_port_in_action * -rte_port_in_action_create(struct rte_port_in_action_profile *profile, - uint32_t socket_id); - -/** - * Input port action free. - * - * @param[in] action - * Handle to input port action object (needs to be valid). - * If action is NULL, no operation is performed. - * @return - * Always zero. - */ -__rte_experimental -int -rte_port_in_action_free(struct rte_port_in_action *action); +rte_port_in_action_create(struct rte_port_in_action_profile *profile, uint32_t socket_id) + __rte_malloc __rte_dealloc(rte_port_in_action_free, 1); /** * Input port params get. diff --git a/lib/pipeline/rte_table_action.h b/lib/pipeline/rte_table_action.h index 47a7bdfc01..e8b4d8b33d 100644 --- a/lib/pipeline/rte_table_action.h +++ b/lib/pipeline/rte_table_action.h @@ -54,6 +54,7 @@ #include +#include #include #include #include @@ -812,17 +813,6 @@ struct rte_table_action_decap_params { */ struct rte_table_action_profile; -/** - * Table action profile create. - * - * @param[in] common - * Common action configuration. - * @return - * Table action profile handle on success, NULL otherwise. - */ -__rte_experimental -struct rte_table_action_profile * -rte_table_action_profile_create(struct rte_table_action_common_config *common); /** * Table action profile free. @@ -836,6 +826,19 @@ __rte_experimental int rte_table_action_profile_free(struct rte_table_action_profile *profile); +/** + * Table action profile create. + * + * @param[in] common + * Common action configuration. + * @return + * Table action profile handle on success, NULL otherwise. + */ +__rte_experimental +struct rte_table_action_profile * +rte_table_action_profile_create(struct rte_table_action_common_config *common) + __rte_malloc __rte_dealloc(rte_table_action_profile_free, 1); + /** * Table action profile action register. * @@ -881,6 +884,18 @@ rte_table_action_profile_freeze(struct rte_table_action_profile *profile); */ struct rte_table_action; +/** + * Table action free. + * + * @param[in] action + * Handle to table action object (needs to be valid). + * @return + * Zero on success, non-zero error code otherwise. + */ +__rte_experimental +int +rte_table_action_free(struct rte_table_action *action); + /** * Table action create. * @@ -898,20 +913,8 @@ struct rte_table_action; */ __rte_experimental struct rte_table_action * -rte_table_action_create(struct rte_table_action_profile *profile, - uint32_t socket_id); - -/** - * Table action free. - * - * @param[in] action - * Handle to table action object (needs to be valid). - * @return - * Zero on success, non-zero error code otherwise. - */ -__rte_experimental -int -rte_table_action_free(struct rte_table_action *action); +rte_table_action_create(struct rte_table_action_profile *profile, uint32_t socket_id) + __rte_malloc __rte_dealloc(rte_table_action_free, 1); /** * Table action table params get. -- 2.45.2