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 1D73246104; Sat, 25 Jan 2025 03:13:46 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 715114064A; Sat, 25 Jan 2025 03:13:30 +0100 (CET) Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by mails.dpdk.org (Postfix) with ESMTP id 9CFF9402CE for ; Sat, 25 Jan 2025 03:13:20 +0100 (CET) Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-2f43d17b0e3so5074332a91.0 for ; Fri, 24 Jan 2025 18:13:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737771200; x=1738376000; 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=OAwZfSgFkaQXuerbqPMvCIp1M4hNnAG+9UJmbUj2i9k=; b=wK9JdzaRcjevpQxI4z0gF+mfv5pKbr2nm7Jgi8+iQSBF41XqQvryHqq2dNbHbg/72k Kf51O2aEknQ2tlVtKKdZ2GaPAXDZzY+osh7bJmnroa7b0ah2H2hULgoL4BJveJRBlfMk veSKBNI2NHzfaDM+zxDuJODL4ep606AVb0LFlrVziPEiuNfyi49TQGBFCawWZdzKIjE+ Tcbcv7lBJ7Enq79hgDbsvpQGt7rDXj7B3hH4FhR+YKTbuKbvC7/SWNm6AsECG7MgXJa4 0+DdlSWCpbW1fCzXS3+B78xBLx1OUR+0Yr5Hx0lglM3gr15yAqjDO5KDCLsUxtuviQU5 66MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737771200; x=1738376000; 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=OAwZfSgFkaQXuerbqPMvCIp1M4hNnAG+9UJmbUj2i9k=; b=QfoWbJdbYg9AQK6u3EakXb67iq7tjrF7FWoOe/Mo7fp5LDyC0Cv3SiTued4J2qyP4A 6va6s4pL+7CIBkXAQjSv+nSfZiu6npa12Ekwg8eLKoj0m8iTodxUcEUG9gvBWlhuAsm3 xthrWB5+uEg5iduupzXvpJmUgOJZ8jEhp8JIScVKQZTtC1BivLHmh+z4nSXJJSvmwB6P krxDpp+eAAxbozoceeS5DwpsYriHVqMjhB441JxQl49MT8D+rYEVlQku7Kb1VY+gR0ak xxItsVdWBav129XwQCV26T8uwSSRmBwlY73+tcnAhv310TM6VFUOH+DBxQ7N0B5oLg6I bMBw== X-Gm-Message-State: AOJu0Yz9o5WoWZuU3iETtqO1oHa9sRgjt4YR7U8+RB21CMgfcGP+GbZp ar6YNFvLjc+fl9dVKgcwAwjozEXmnVebnOc0pFj0fOz835+yksb2b+UEfl9mtbxG41zDM4KVt4m g X-Gm-Gg: ASbGncud0++CXePUtgAlhJVPRlj7fnmx9rBgAgT2GaEz8gtLEMCz+aBnJB5tWRK1iFX d/ez1FE5YUTs+C1OA3RjHDkAYMxkpJvfAFGb/H5AVQjufjRmHv/U7i6Cxc5429ynPMet7WTOhCY lV48so4ingsAyECvJ5K74vNvW5l6KiZTXa+0YpoQNvI7g9I4PRsuSPIdxKQjH8UjgI76N/MPNEa VMvXY892++0IVjwYIcEv0dlxOg0OrxQGfoVcSNhR7kn62lyTDF51pQIr4Th5UnTSJD87D9gEJ7d j2XNJ7WR/JYiyGhqVPaHX6vnN7KVnIxMSniLn+sJDwaGmvvjD3ppSYn0Yg== X-Google-Smtp-Source: AGHT+IEJtIHnCraDDYqVF4IyTUnS0sLgsDuxc6GhTw1r3r0SJfN3qaOaTjK57a9xOqNeaBWFcSggiQ== X-Received: by 2002:a17:90b:5241:b0:2f2:f6e0:3f6a with SMTP id 98e67ed59e1d1-2f782c94b72mr53876443a91.14.1737771199911; Fri, 24 Jan 2025 18:13:19 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 18:13:19 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Cristian Dumitrescu Subject: [PATCH v5 05/16] pipeline: add allocation function attributes Date: Fri, 24 Jan 2025 18:11:18 -0800 Message-ID: <20250125021305.76485-6-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 pipeline is allocated but not freed correctly. Signed-off-by: Stephen Hemminger --- lib/pipeline/rte_port_in_action.h | 56 ++++++++++++++++--------------- lib/pipeline/rte_table_action.h | 53 +++++++++++++++-------------- 2 files changed, 57 insertions(+), 52 deletions(-) diff --git a/lib/pipeline/rte_port_in_action.h b/lib/pipeline/rte_port_in_action.h index 9d17bae988..f497efdcbb 100644 --- a/lib/pipeline/rte_port_in_action.h +++ b/lib/pipeline/rte_port_in_action.h @@ -48,6 +48,7 @@ #include +#include #include #include @@ -164,18 +165,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 +178,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 +238,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 +267,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