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 7EC0A45A48; Fri, 27 Sep 2024 22:50:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B72EC40BA0; Fri, 27 Sep 2024 22:48:23 +0200 (CEST) Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by mails.dpdk.org (Postfix) with ESMTP id 15EFE4065F for ; Fri, 27 Sep 2024 22:48:12 +0200 (CEST) Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-7db637d1e4eso2112632a12.2 for ; Fri, 27 Sep 2024 13:48:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1727470091; x=1728074891; 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=IvA8wrNgv4pDnEAfpJd7QjuQSmom26Y2H7+sm7h5I+k=; b=bIh6+bq8ZkGfDy+CTM8zXeT+Xr8cqFTMapH/jECs2Gd11gh7RanjGOqOsIjcDjDet7 jh5Mnp/xvY33QkZTc52FFVAf0k7BFF+/GKoSRmXcUukJm37V5YYfWxS4uYy5O1LgcDpp MhVMUvTNw7eaKX9VM3p9EalP97Yyw0HTUFwHzx3tgWcCKWLYUPAqAyWk/G2EIGoWlffb OjrXBnXewDfuNkLUOFZntobO1KnmN190mxyERLdRrYei2S+RiIwjvHnaYQqSps7d8i7a JaBqDmXcRwOLQ92OVKCUvcCpIFanf8sstx5kS1+LYlpBQ+4XbOaj/I3dx2Dm+p4m+Osz TqWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727470091; x=1728074891; 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=IvA8wrNgv4pDnEAfpJd7QjuQSmom26Y2H7+sm7h5I+k=; b=enTFxg7IsVVjGotMK9q+GIZzYZtDyXOOsBgHM0Ft54TU1xQDC34JiAadSO3PjWstQc m8CHGXQoKlpngkkm07DZFJ5FBX+TLbFaJ8xj+CQEbj6LomJdZiPm01UhUJeOroMdIlxm ufrMnvoKj2ffq3FwMSSEvqYFG4lE+aBw73eN2XM2xyRBiEqHWTztAUnhdUxcQvx2vMy3 9GLcPSUuzY2kzLZKUSVzxXTCZud66uPfOd9By/87M4Yp/vr3o5eTlJIQLXgfJcY/Z/EL 0V4v+tWuRE8wYPUzt1D2hqBkTX0QO8Hy9Z5EPst177JdrN1jGCcXzzJGUnAi4E1l7u6u nljg== X-Gm-Message-State: AOJu0YxkT1MxIw2KwE2bjcETCQUI2FcGn8q8yjKrQqgVgBled/kuST09 AVB4iTv7UcAl7lSYl2k9ibbiPI9BaoOZ9RzxOuINBxVe2Fk6rSyqCZF4432pppaU4S8HqWtDKmU b X-Google-Smtp-Source: AGHT+IE0SlFUNKNWYCXRhHBrlZu+WcEIXjgS8HH4wVQ5AGroW9f0erNbzAvV2NnlwP+eM2md9P4hKw== X-Received: by 2002:a05:6a21:114f:b0:1d2:efe7:22e with SMTP id adf61e73a8af0-1d4fa6bf67bmr6465479637.17.1727470091204; Fri, 27 Sep 2024 13:48:11 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e6db294533sm2036531a12.12.2024.09.27.13.48.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2024 13:48:10 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Andrew Rybchenko , =?UTF-8?q?Morten=20Br=C3=B8rup?= Subject: [PATCH 16/16] mempool: annotate mempool create Date: Fri, 27 Sep 2024 13:45:52 -0700 Message-ID: <20240927204742.546164-17-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240927204742.546164-1-stephen@networkplumber.org> References: <20240927204742.546164-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 rte_alloc_function annotation to catch mismatch errors on memzone handling. Signed-off-by: Stephen Hemminger --- lib/mempool/rte_mempool.h | 41 +++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h index 7bdc92b812..912500ce4c 100644 --- a/lib/mempool/rte_mempool.h +++ b/lib/mempool/rte_mempool.h @@ -1012,6 +1012,20 @@ typedef void (rte_mempool_mem_cb_t)(struct rte_mempool *mp, */ typedef void (rte_mempool_ctor_t)(struct rte_mempool *, void *); +/** + * Free a mempool + * + * Unlink the mempool from global list, free the memory chunks, and all + * memory referenced by the mempool. The objects must not be used by + * other cores as they will be freed. + * + * @param mp + * A pointer to the mempool structure. + * If NULL then, the function does nothing. + */ +void +rte_mempool_free(struct rte_mempool *mp); + /** * Create a new mempool named *name* in memory. * @@ -1091,11 +1105,12 @@ typedef void (rte_mempool_ctor_t)(struct rte_mempool *, void *); * - ENOMEM - no appropriate memory area found in which to create memzone */ struct rte_mempool * -rte_mempool_create(const char *name, unsigned n, unsigned elt_size, - unsigned cache_size, unsigned private_data_size, +rte_mempool_create(const char *name, unsigned int n, unsigned int elt_size, + unsigned int cache_size, unsigned int private_data_size, rte_mempool_ctor_t *mp_init, void *mp_init_arg, rte_mempool_obj_cb_t *obj_init, void *obj_init_arg, - int socket_id, unsigned flags); + int socket_id, unsigned int flags) + __rte_alloc_func(rte_mempool_free); /** * Create an empty mempool @@ -1132,22 +1147,10 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size, * with rte_errno set appropriately. See rte_mempool_create() for details. */ struct rte_mempool * -rte_mempool_create_empty(const char *name, unsigned n, unsigned elt_size, - unsigned cache_size, unsigned private_data_size, - int socket_id, unsigned flags); -/** - * Free a mempool - * - * Unlink the mempool from global list, free the memory chunks, and all - * memory referenced by the mempool. The objects must not be used by - * other cores as they will be freed. - * - * @param mp - * A pointer to the mempool structure. - * If NULL then, the function does nothing. - */ -void -rte_mempool_free(struct rte_mempool *mp); +rte_mempool_create_empty(const char *name, unsigned int n, unsigned int elt_size, + unsigned int cache_size, unsigned int private_data_size, + int socket_id, unsigned int flags) + __rte_alloc_func(rte_mempool_free); /** * Add physically contiguous memory for objects in the pool at init -- 2.45.2