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 5CA9D4601A; Mon, 20 Jan 2025 19:06:16 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 581F84275B; Mon, 20 Jan 2025 19:06:05 +0100 (CET) Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by mails.dpdk.org (Postfix) with ESMTP id EFC9C410F6 for ; Mon, 20 Jan 2025 19:06:01 +0100 (CET) Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-2eed82ca5b4so8105563a91.2 for ; Mon, 20 Jan 2025 10:06:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737396361; x=1738001161; 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=F/2Td6ymN4EIDmZG5UrIJkiV/qYh6KN76vLUNkCXvLI=; b=hqcnyLCSeHNyZwBywdMm9SWJTebIaU9ewe+CWGan3OohCI9RgruMklyer8zbH7Vfvx Lmz+i1YTw8b1MqRqcnPmnHyvSAFIPa7IglCQSMKV0A6XTqUd3/HnMrMfTHVATHCXUkj7 Dclo5Qh7DOe4TCGGcJg63q2sgzGEltL6n4H7qlte4EAxZPC0Rfuj81/nBIo6369oeopp AZXj/cL/cFpJ6Pdxc95mD13bo+PGwB0xZyzpgWVym8bl12iFVH4hJ0Hm/vhHETIFsORR lxCB8G/6TVtl/LVcAh8ypL5RnhauKO3CSUWYP1CKu6ywnAnNNxmgfINCp9JgPdBxdeoR 7x2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737396361; x=1738001161; 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=F/2Td6ymN4EIDmZG5UrIJkiV/qYh6KN76vLUNkCXvLI=; b=VP21qydqfAlOBNuKd13rV/gHH8OyEgJ3omMG4Cbqd9WcTV+TI8k6owS/AzcXL8+96R qOsk+x7wxQIwA5sutZ6dz3udEPvSzU7BBdJctGRtd69yNSt3os+lxf36P58sLOa9SM3u k+tFBIAg2+hkXxUAIgh0EoFrh+ZCUWX85IvgYR87mgtDPe2MToC2b4wd7i4YQIucY1/G SYuKjySkXcNIQYnqXf4CFPZMHwWxfrsALpXO2/QgTJQjLQE5QChYxq3CFyjuP4hX8yx/ gkZ31BQ5JJn+07sUzeY6BtNBmahqDyie5C3/h/nM64ZuIQcuTjFKPUiRmt8OgmhZlfpI Td+w== X-Gm-Message-State: AOJu0YxhFpAq8EyWjTAOhVBi/NFiPLY8DpuSmUnfFtpzeLBktwIIFe0W Q+4XhLJxAlzzXBVXVgG++NuHBFHDNrZRfYJnKKu3TxaEJJcOUinpoiqNDFzLY8lZ8r5qtkXyUDb y X-Gm-Gg: ASbGncvvpzd+URGQRc2zEdkyN4lPCusDYPiTdUaosOiwXeSAko22UU6Hw2ofWs5cHhg gXfnXMJtGyuVcfNazGS48OSPUaVUCNRNFVlis+wNXQ9gjnmlDFeF0PVtsjE4GCodO8Nt44JNZPg s0IHIoriWgnTg1rV4ePd8WFBaQQbFsRP0aKs9bv45hk/3e2uwJTgkYkLUiXLbtO87zTSxHB6JIO W4cbJAcNY4f97ReeGg4pmP4S57nqZCi1AxFlok9TIF46LHrzzI58983G+IPu9T3/kpHAhvCUCc3 i4T5pJHeMAxtvIJjDK52KEYPNlvaXFRRIHPv9D9/n3+Nfb0= X-Google-Smtp-Source: AGHT+IH5BH42bUnOcMeEL/OXjAkjcDWNpuf8/Wr3bVj3C+ZBMwY05jiBbQh/l2TwVZQufEQIwueQuw== X-Received: by 2002:a05:6a00:460e:b0:726:54f1:d133 with SMTP id d2e1a72fcca58-72dafa44498mr20396202b3a.12.1737396361131; Mon, 20 Jan 2025 10:06:01 -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.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jan 2025 10:06:00 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Vladimir Medvedkin Subject: [PATCH 02/15] rib: annotate rib allocation functions Date: Mon, 20 Jan 2025 10:03:20 -0800 Message-ID: <20250120180550.198121-3-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 Add function attributes to catch cases where rib is allocated and not freed correctly. Signed-off-by: Stephen Hemminger --- lib/rib/rte_rib.h | 24 +++++++++++++----------- lib/rib/rte_rib6.h | 24 +++++++++++++----------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/lib/rib/rte_rib.h b/lib/rib/rte_rib.h index 2054d3cebd..f30b85d79a 100644 --- a/lib/rib/rte_rib.h +++ b/lib/rib/rte_rib.h @@ -230,6 +230,17 @@ rte_rib_get_nh(const struct rte_rib_node *node, uint64_t *nh); int rte_rib_set_nh(struct rte_rib_node *node, uint64_t nh); + +/** + * Free an RIB object. + * + * @param rib + * RIB object handle created with rte_rib_create(). + * If rib is NULL, no operation is performed. + */ +void +rte_rib_free(struct rte_rib *rib); + /** * Create RIB * @@ -245,7 +256,8 @@ rte_rib_set_nh(struct rte_rib_node *node, uint64_t nh); */ struct rte_rib * rte_rib_create(const char *name, int socket_id, - const struct rte_rib_conf *conf); + const struct rte_rib_conf *conf) + __rte_malloc __rte_dealloc(rte_rib_free, 1); /** * Find an existing RIB object and return a pointer to it. @@ -259,16 +271,6 @@ rte_rib_create(const char *name, int socket_id, struct rte_rib * rte_rib_find_existing(const char *name); -/** - * Free an RIB object. - * - * @param rib - * RIB object handle created with rte_rib_create(). - * If rib is NULL, no operation is performed. - */ -void -rte_rib_free(struct rte_rib *rib); - #ifdef __cplusplus } #endif diff --git a/lib/rib/rte_rib6.h b/lib/rib/rte_rib6.h index a60756f798..d9514acf82 100644 --- a/lib/rib/rte_rib6.h +++ b/lib/rib/rte_rib6.h @@ -294,6 +294,17 @@ rte_rib6_get_nh(const struct rte_rib6_node *node, uint64_t *nh); int rte_rib6_set_nh(struct rte_rib6_node *node, uint64_t nh); + +/** + * Free an RIB object. + * + * @param rib + * RIB object handle created with rte_rib6_create(). + * If rib is NULL, no operation is performed. + */ +void +rte_rib6_free(struct rte_rib6 *rib); + /** * Create RIB * @@ -309,7 +320,8 @@ rte_rib6_set_nh(struct rte_rib6_node *node, uint64_t nh); */ struct rte_rib6 * rte_rib6_create(const char *name, int socket_id, - const struct rte_rib6_conf *conf); + const struct rte_rib6_conf *conf) + __rte_malloc __rte_dealloc(rte_rib6_free, 1); /** * Find an existing RIB object and return a pointer to it. @@ -323,16 +335,6 @@ rte_rib6_create(const char *name, int socket_id, struct rte_rib6 * rte_rib6_find_existing(const char *name); -/** - * Free an RIB object. - * - * @param rib - * RIB object handle created with rte_rib6_create(). - * If rib is NULL, no operation is performed. - */ -void -rte_rib6_free(struct rte_rib6 *rib); - #ifdef __cplusplus } #endif -- 2.45.2