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 187614601A; Mon, 20 Jan 2025 19:06:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E3B4F42686; Mon, 20 Jan 2025 19:06:07 +0100 (CET) Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by mails.dpdk.org (Postfix) with ESMTP id 63D314114B for ; Mon, 20 Jan 2025 19:06:04 +0100 (CET) Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-219f8263ae0so82610395ad.0 for ; Mon, 20 Jan 2025 10:06:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737396363; x=1738001163; 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=Qsm/ObazVwEecOvY6NFhMjIcecYK3nl9ZbSswe0+n3eurhR5VRLvF6Wz+RzWkLfwzh Umzl5lrMHmCgDKt7c8VMg03jPtKf9jwEY+exNEY1DzpEGKdMWz6mxYvQwEf7VVwweN5W GOs40vE+nxxlDt7v3FltlboLEbgU9vv5vsBCpQxbdlrJVNDof8PcFEdpxYW2P7B5uEO4 KFzlGvQ9bmsgM5wNQZ+OI2JENoXDsiZNM1KckVBUVeHYGRbc0/PNGIOjjGiPaiqzSloK orAT2jpTD5JyNfp4dl8q9fkeZjJpyLUgGz9Gw/Q5n0DyUjd29U1L5C0MqA+lTkgvqjvT R2dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737396363; x=1738001163; 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=MriTh0pqgoQ++EoGl8LwUxQcNk70DigsCTUgu6rZ9vE+afl1uqTJOohcxs/H6YB6b8 xdLBr87RAyfKCy6uLwvDgKfZMmgRAtgH6YdFVuJS27DwdTFya4lSTJoOZydSe3nafLY5 A/u130xrz7I3KtOMB1+E72dyUZttMx+AnxfkovyADRGkNokcLsgh+QPV9swp3/McDrYr 5aK1386bXiDMupMwvuiCSxmdebUs4Lj9YANwkE/nUagQaGCSmZP8jPdYvQgu0NtW6UmP lRWgppRUHhAfat61vHEEPdSN74ZYiFOa/AIX33S7aywpQiTU20ghMiEwWUY+fZctWBGF 2zOg== X-Gm-Message-State: AOJu0YxiJY0eRcX1HeINikr80zvh6HbeWmwKc7CdzBX27HsqGPIPUffK M+iiGWgSp1+u+qaYJvChbuMFQEDRw+jIiuZaLuhXwBlkigMSdUowMWxDubiDzmA1uLy9UZft6zg 4 X-Gm-Gg: ASbGncsUi3BLpHd/Bi43ULNkb9PkMwFKGI32xvZ1TGzz5lg8ahdxTCIXGWRWFHWeXqW Mi2lIoS6z6hGCgstwVQpwAn/bIxpkpq6ZA0Udmy2t2sHfhZCRBZMXMI78/MCzthCFXIYR8bhedV K2/p1bWhmArVf8hDBXlwkkqdSw9zB4xPngJ62q4g4Dz+BI7rm6bb5uRKzuSPW8OPwFjAZyhe0KO z/sGFYgjwXGnatNl/tmShuh1OJ+WXFvid+duyA3SGMElrTFLKnWnrlJiH6gxtqksbLFuFuZOBf8 hVCiII2PfFfFRKN1vm/mPF72skr7T5xxXRPG8b/bfkZ1sBk= X-Google-Smtp-Source: AGHT+IFe3T+XTJQMtKAZUa3laFrbaVbqg2SFALrzr7/ypEZA7j29vk7VNwx2ham2qvDwBBnQF7F/pQ== X-Received: by 2002:a05:6a21:7895:b0:1e8:a13b:3885 with SMTP id adf61e73a8af0-1eb215fb145mr23740291637.35.1737396363569; Mon, 20 Jan 2025 10:06:03 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72dab848b08sm7393982b3a.71.2025.01.20.10.06.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jan 2025 10:06:03 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Cristian Dumitrescu Subject: [PATCH 05/15] pipeline: add allocation function attributes Date: Mon, 20 Jan 2025 10:03:23 -0800 Message-ID: <20250120180550.198121-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250120180550.198121-1-stephen@networkplumber.org> References: <20250120180550.198121-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