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 4340346130; Fri, 24 Jan 2025 19:18:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1FF7B42DA7; Fri, 24 Jan 2025 19:17:33 +0100 (CET) Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by mails.dpdk.org (Postfix) with ESMTP id CDD2B427D8 for ; Fri, 24 Jan 2025 19:17:25 +0100 (CET) Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-219f8263ae0so46035195ad.0 for ; Fri, 24 Jan 2025 10:17:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737742645; x=1738347445; 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=l+J5NV7B3Ijfglj0hbVDiMxthQju9Dc7j9D6hoeLJ6A=; b=z5Byj6s4PHgTk/kICb/7xgYw0M23FcD5QUeKYugpPuGwxy2kbhKLIiXaoXJ73yp9BT 8yqbo9J7hoLoxu+t7KR55d5ddg4Lm4cXbP9EkTMvZZZ7j6OFhpX31D93d+nYwYtOa67O PD1S3NRzVaw0GeZZ14vYmIxBWRTZW6NSooDUW4HTm60xYUC9aEFbh2NKft0aarZWFP6X JZFB8Hfo1oceWDfPj+0iTlJNcDowwJsgTxiq0UGMSIQbCMSW+HOHPIcbF0pPgD0Tos0D Z9hqzkJ71iQPL4SdFrEXMGpPb4ZoQxisPtoRFJ6OKzsZonpAFSOPcS+bqZ9TOzM5lqOZ qWQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737742645; x=1738347445; 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=l+J5NV7B3Ijfglj0hbVDiMxthQju9Dc7j9D6hoeLJ6A=; b=WVMBpzq9kjP/b95x2LV8WfD3xWnfwPm8skntaIh5A0fT78moUjNvXLLJ2eNEygFIgl oHM5BzDUdvasoAVFEACB/HWI8A1ue6j/E0ytbwaegs+EjlzS//UkZKoYjiPAwjCl0Bec muxu6Ggf6bqeeglvlqsvaBkyok26KcSBWCXpLZqTVe3C4j+zcMsruTT2RuwtVFEjhPkE A+hKBiC/gple0xa2mnY9ZrAy111eBuUpJ2htGI3cHcoh60B5fO/5agfWU1Et66FetbJ1 59oL3q43si/s0KGkKLU0LayGVm/dpAb0pgFJiRjcERZfJHUJ9KC8l/zzeh7U+DbPQx7E UPcA== X-Gm-Message-State: AOJu0YwaHNGzkrMlSYVlCbdAa92aSuJlLUTXrgYep/MC3M4I5hpT5MZi jdYO70kXtiWDRgz604TNJh9cMVnjsZb+uXaHxlVgKSHhYHJvO7QbOwPiesZRYsIZExNSLTBbvRh 8 X-Gm-Gg: ASbGncvCwr2A0MKdCOAnYpWNte2Rnj7DVqknTb72nxoqh356yzziyG0SKK5UqYj/Syr 1Zz5DvEZWH6DDR0a3CqUfnWA6+P2TStRJxBDBs6OlB4ltQxH2nC4PTbJ4OuXsS1Zl88MRSRpmDk kJW1A6vdgj/WlqypgrmSZ+54O7cTNdocoZNXG1svFxsfty5Nf5Uy5mqWJZt2DvjmhcVsk5tyRg1 IP/sDsX05Fgt5CfvV2dO31PDFihdhtJu7kELnmINZcrMar3R8CNVmcxSJfGRNpOefCMz9uTiqWH 3uRYHEbOqwqoAr40d9ca2tb1HrTqjIDBbt1ojZEiu7JmLpGCqakWaFWbEg== X-Google-Smtp-Source: AGHT+IFH20eXMpJy1wc+zaT0l4BdI5DCIsO2jyi9hcQDI92D/BJqnrBUVZxtgZOJ5i4GKB1zXTWsKw== X-Received: by 2002:a05:6a20:3943:b0:1e0:df27:10b5 with SMTP id adf61e73a8af0-1eb215a2469mr51643195637.29.1737742645170; Fri, 24 Jan 2025 10:17:25 -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.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 10:17:24 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Konstantin Ananyev , Honnappa Nagarahalli , Konstantin Ananyev Subject: [PATCH v4 11/16] ring: add allocation function attributes Date: Fri, 24 Jan 2025 10:15:02 -0800 Message-ID: <20250124181704.86567-12-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 ring is allocated but not freed correctly. Signed-off-by: Stephen Hemminger Acked-by: Konstantin Ananyev --- lib/ring/rte_ring.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/ring/rte_ring.h b/lib/ring/rte_ring.h index 63a71d5871..15340a1981 100644 --- a/lib/ring/rte_ring.h +++ b/lib/ring/rte_ring.h @@ -119,6 +119,16 @@ ssize_t rte_ring_get_memsize(unsigned int count); int rte_ring_init(struct rte_ring *r, const char *name, unsigned int count, unsigned int flags); + +/** + * De-allocate all memory used by the ring. + * + * @param r + * Ring to free. + * If NULL then, the function does nothing. + */ +void rte_ring_free(struct rte_ring *r); + /** * Create a new ring named *name* in memory. * @@ -183,16 +193,8 @@ int rte_ring_init(struct rte_ring *r, const char *name, unsigned int count, * - ENOMEM - no appropriate memory area found in which to create memzone */ struct rte_ring *rte_ring_create(const char *name, unsigned int count, - int socket_id, unsigned int flags); - -/** - * De-allocate all memory used by the ring. - * - * @param r - * Ring to free. - * If NULL then, the function does nothing. - */ -void rte_ring_free(struct rte_ring *r); + int socket_id, unsigned int flags) + __rte_malloc __rte_dealloc(rte_ring_free, 1); /** * Dump the status of the ring to a file. -- 2.45.2