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 5E8C546130; Fri, 24 Jan 2025 19:17:44 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5A84342D2E; Fri, 24 Jan 2025 19:17:25 +0100 (CET) Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by mails.dpdk.org (Postfix) with ESMTP id 739B940FDE for ; Fri, 24 Jan 2025 19:17:20 +0100 (CET) Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-2166022c5caso39502745ad.2 for ; Fri, 24 Jan 2025 10:17:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737742640; x=1738347440; 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=p9ZiiA9AB32QYO+FSfq1lZHDWfn/8w2u3s6OyxDHz24V53Z6ZOwwq9dWbdSbDtn9xP 9idd6k3xXY736Kle8Q7U8myNXcgl/gvCigVKJCn2crtmNd7QUztGVHh8clA/BBaU960E xR2/dlZfHyzksFlv5JjPC0iDodyjNes2V0ml9sQIa/SUVntBX52JLLf7QuA58sLQEh3j 4PnuedZOAwKgkMAOlM/tut+wXkZBgSXg7pQam5XnsQj4YXe7BlUQNZh0bp4fZQH6hdGY d6M+36xjio4dKqzwXZeLoq1MVaZnQAlhsz/+DIIAtZdt5umXq3RWRDwdAK+pa9uNByxi 39GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737742640; x=1738347440; 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=jZr+qrk9N4jXNfvXL4qYSNCUj5h+IKvmqCeXEhCShev0sdMW2WSQr5+FXK3BK8oFM4 FERxKxVMjtDaCdKq0lpWXVRZfUtexQuDycwqVXkAoI+reCh1Sly+PHLX18j2TeqN14Hi JaHdmIEMPSEusIHfbyWld1uKXgUOsmrhRmmnTkVZ/U2Ok/NQcV+ifLQxn+9ZNYIGD/XY uLb8v184BeB7scMDCzFYdZJ8j/Jzla/b/v+KstvA2NNqVUfebhiAde3zxqbuIMW6KtkU wrOvhcpwtTiaE/ByZMPXWBdDb0d4ognHy7aD7hY51NSMXH3SOfF6rqMug2FZDIdHrpUI MsAg== X-Gm-Message-State: AOJu0YyrgWnB2Hj2+QddWX+BASjPWdCuaoVKbUF1sAvEECmmMbd9Ohjh DO/4s/mimxK1OG1aKz3UoqHzxU7JIdikJn7N02T01Muvt2CAvKT6pi14d+6mT3MgHbJUwzWFyMf y X-Gm-Gg: ASbGncvJZ6DTnQosNg3osO6L70nYI5ra99mDhocpLKz6ZCsxEFF9dEaUVov3CeQ2+wT gdwhSGYTpWl7ec2aq3R4GZmegIX0+VEPfVbytCGOaWrN6TOW5XynkwgAkmmlAyfava6k9viDTpv kQlS/EBAvEbI+jBs/LOdgxBGsEDmvEiYrMXgclsff9UA4ahI7SgrcRY7ROVftGslZJ2YNveVYKZ 6mM1cO9pWFzzQS3k6tyDWL7jUIeZdaVdcYAlh79NrLUgHuOR5IuDgAG5gbxy4vTHmbH6YoNQUNu QAXgI7WqCxmEkd7y8RUGfh7JPWeJFB5iV5VVPsb0IFr9BuqejEp0qylN/g== X-Google-Smtp-Source: AGHT+IF9eVNCSLd6L7BtpiZ6gI+IifnSqOjsuBzDakWfM51MdFzmfLFvcG3uUgCKMttMumqjvLYbJA== X-Received: by 2002:a05:6a20:734a:b0:1e1:9f57:eab4 with SMTP id adf61e73a8af0-1eb2148c309mr44437474637.16.1737742639674; Fri, 24 Jan 2025 10:17:19 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72f8a6b2ed8sm2184477b3a.41.2025.01.24.10.17.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 10:17:19 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Cristian Dumitrescu Subject: [PATCH v4 05/16] pipeline: add allocation function attributes Date: Fri, 24 Jan 2025 10:14:56 -0800 Message-ID: <20250124181704.86567-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250124181704.86567-1-stephen@networkplumber.org> References: <20250110170603.538756-1-stephen@networkplumber.or> <20250124181704.86567-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