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 D9135460FF; Thu, 23 Jan 2025 17:30:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1DEF440DD6; Thu, 23 Jan 2025 17:30:28 +0100 (CET) Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by mails.dpdk.org (Postfix) with ESMTP id 7E6BB40261 for ; Thu, 23 Jan 2025 17:30:22 +0100 (CET) Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-2f13acbe29bso3764692a91.1 for ; Thu, 23 Jan 2025 08:30:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737649822; x=1738254622; 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=ATKqWXjxb249EYjwsN9OTJ2Ur5ox+OG0QvWtzpaMGTsgvrSNgtVZKMdJz87tuN0wlg AeI2tVeS4UT7xjJ8jMGzrBi2gDNLrTJeb6KDWRGwFG+rGlSB5DIRjFCb1D5rTQ5xMK0D 69i1ELm/+5M4dLtZ1C+0zGuPVrnU9/RJZKVePuUY8kjp1gNVs3gO5W5OcglVzyk9legm TlYoPT8QXq/ZwX/7pbZTEFLb3fVg2jvFuBz1aF6kjnGcRlMgssI1jJfpM4m0teueXJH2 iTcZSO7vSSMiu+pTxsSqMvlytj04fgIy5aKmR7LtQb88M9dXzHZggCO/Bq3DfejETKyw eZqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737649822; x=1738254622; 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=YBVNXVIhJoUecbvTNo5kPhmPoordtyl5udMVLUphgsEU7io0j3DhUronXgEvC3M0O5 h0nQ3ZidnQUHWqdnd/ayod1KtmPWgLMAS3ruiP2hSxbYPYdn7sLbclgOL/yq00Iu/TGu Y8e6Z2szCzaUYfXBWrC775P4vSc7UE5R30AqjkLtWYged7xnMcVNbmQElxt0PWJJAa93 SbYLvmQvpVvX7Omdgmi3VNzftFb9jWZ2hv2hQDed9G5FYW3/i64Vo50WC2e/m4p9xPgg Wzu2XeesvjbR88cHTx3Fwkk+MLdZg5AC7FQ6wSxm+nQkxMkmvYaiVvGgdCcQJc+A2F7X RdGg== X-Gm-Message-State: AOJu0Yy6SjQCe8gfk8YLChm3r/v2dVBgwfs3hFzl2IDV7rsnP0YdWnvF sm98snwnrH60bKBdZ0RiDZA8IweFufvGqwWKZSDJsNlsCxADPUJYitkHbEsM9mOzNto6KZZj8jO v X-Gm-Gg: ASbGnctdGAik8ULU9QrT7/IaTHGpTFD633jVAHtIBNCe64HpWC91yzYVE0ziGn7fa5r DwOTg696qhBhwl/H3uSoWZQD2pSGydFZm9/WJ57oq7flpITrEKNRjvn4gJTvde/yBwjUBDAhTcT F3wd72xMqr8YxvyBRZ+cX3CMyEJ8oTZJYte7MyRmFgxFys1JShyEsag4P/pUpx3wZ/cttYHPK2O lpWllCcsTBUsdcoYgMxfOvCi6v0KYe3r3Ih+kbnliOQ9XbBY/ndmEqoiTUcZCKUlxHSv4COV65G soDlSKG0gmxHxxXnGoGJv9+gJP5aClFOgOHeOzG6LD8TwZtswIrOfkIEAA== X-Google-Smtp-Source: AGHT+IFnQxdRoortQ3bUuLxeMTn7y092NuYVq6yBtWUOUsuvc23e36UOSH4bMkRUV2GXbidNTkrMHA== X-Received: by 2002:a05:6a00:8115:b0:725:ebc2:c321 with SMTP id d2e1a72fcca58-72f7d1fc230mr6258026b3a.4.1737649821709; Thu, 23 Jan 2025 08:30:21 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jan 2025 08:30:21 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Cristian Dumitrescu Subject: [PATCH v3 05/15] pipeline: add allocation function attributes Date: Thu, 23 Jan 2025 08:28:05 -0800 Message-ID: <20250123163003.23394-6-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 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