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 315684574E; Tue, 6 Aug 2024 17:25:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D85AC40DD1; Tue, 6 Aug 2024 17:25:01 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by mails.dpdk.org (Postfix) with ESMTP id E0C7340DC9 for ; Tue, 6 Aug 2024 17:24:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1722957900; x=1754493900; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dM4N6f3Q73DqMhROK0ar0Gk5Bd8dw+WEsWa/YZJ1Y78=; b=Z+ZeaVgCSQS1N3OHJ7VHBpnRTJkqv1HomDtrRIQw0ssKLjQxpoQXdx0E R3WFAM7Wls8nm8/l094QSBoTK9iduX2jZUOz3og1oZu+gS0TSyNBxemnU bDtwZ6oFIRdQCRkvZvURCZ+Ex1M5+EEraU5J1IOdYy1o1hByZZPwQToZ2 a1IN4H7Cug6J2Lr2vv/0CZJ4Mq/1K5PowClk2gUPeFwCYRr6Cl3B+HrNP g8tJqCDIfiBTDBqQop5z5ECZS9YLqWxanHpCMWJgPbM0beh/MYoa3+rKY cU4tB71QXbP53Zkd9ZsGeyoiziyuzvvQ9bDVkA7Isf/hnyRwgM4yoXhsg A==; X-CSE-ConnectionGUID: b8JpWk7oQVu52ARAdKjBrg== X-CSE-MsgGUID: avrEyC/CQE2a/uWxuj1GFg== X-IronPort-AV: E=McAfee;i="6700,10204,11156"; a="21160486" X-IronPort-AV: E=Sophos;i="6.09,268,1716274800"; d="scan'208";a="21160486" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Aug 2024 08:24:59 -0700 X-CSE-ConnectionGUID: I8PZ6aAwRp6ejTEOeMUyOA== X-CSE-MsgGUID: eetFJE6UTXGTnItNT6753Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,268,1716274800"; d="scan'208";a="57245435" Received: from silpixa00401385.ir.intel.com ([10.237.214.25]) by orviesa008.jf.intel.com with ESMTP; 06 Aug 2024 08:24:57 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Rosen Xu , Cristian Dumitrescu , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko Subject: [PATCH 2/4] ethdev: make parameters to TM profile add fn constant Date: Tue, 6 Aug 2024 16:24:15 +0100 Message-ID: <20240806152417.3649745-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240806152417.3649745-1-bruce.richardson@intel.com> References: <20240806152417.3649745-1-bruce.richardson@intel.com> 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 The function to add a new profile in rte_tm should not (and does not) modify the profile parameters passed in via struct pointer. We should guarantee this by marking the parameter pointer as const. This allows SW to create multiple profiles using the same parameter struct without having to reset it each time. Signed-off-by: Bruce Richardson --- drivers/net/ipn3ke/ipn3ke_tm.c | 4 ++-- lib/ethdev/rte_tm.c | 2 +- lib/ethdev/rte_tm.h | 2 +- lib/ethdev/rte_tm_driver.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c b/drivers/net/ipn3ke/ipn3ke_tm.c index cffe1fdaa4..20a0ed0467 100644 --- a/drivers/net/ipn3ke/ipn3ke_tm.c +++ b/drivers/net/ipn3ke/ipn3ke_tm.c @@ -848,7 +848,7 @@ ipn3ke_tm_shaper_profile_delete(struct rte_eth_dev *dev, static int ipn3ke_tm_tdrop_profile_check(__rte_unused struct rte_eth_dev *dev, - uint32_t tdrop_profile_id, struct rte_tm_wred_params *profile, + uint32_t tdrop_profile_id, const struct rte_tm_wred_params *profile, struct rte_tm_error *error) { enum rte_color color; @@ -931,7 +931,7 @@ ipn3ke_hw_tm_tdrop_wr(struct ipn3ke_hw *hw, /* Traffic manager TDROP profile add */ static int ipn3ke_tm_tdrop_profile_add(struct rte_eth_dev *dev, - uint32_t tdrop_profile_id, struct rte_tm_wred_params *profile, + uint32_t tdrop_profile_id, const struct rte_tm_wred_params *profile, struct rte_tm_error *error) { struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev); diff --git a/lib/ethdev/rte_tm.c b/lib/ethdev/rte_tm.c index 74e6f4d610..d221b1e553 100644 --- a/lib/ethdev/rte_tm.c +++ b/lib/ethdev/rte_tm.c @@ -153,7 +153,7 @@ int rte_tm_node_capabilities_get(uint16_t port_id, /* Add WRED profile */ int rte_tm_wred_profile_add(uint16_t port_id, uint32_t wred_profile_id, - struct rte_tm_wred_params *profile, + const struct rte_tm_wred_params *profile, struct rte_tm_error *error) { struct rte_eth_dev *dev = &rte_eth_devices[port_id]; diff --git a/lib/ethdev/rte_tm.h b/lib/ethdev/rte_tm.h index c52acd1b4f..f6f3f6a8d4 100644 --- a/lib/ethdev/rte_tm.h +++ b/lib/ethdev/rte_tm.h @@ -1347,7 +1347,7 @@ rte_tm_node_capabilities_get(uint16_t port_id, int rte_tm_wred_profile_add(uint16_t port_id, uint32_t wred_profile_id, - struct rte_tm_wred_params *profile, + const struct rte_tm_wred_params *profile, struct rte_tm_error *error); /** diff --git a/lib/ethdev/rte_tm_driver.h b/lib/ethdev/rte_tm_driver.h index 25d688516b..b6ecf1bd4d 100644 --- a/lib/ethdev/rte_tm_driver.h +++ b/lib/ethdev/rte_tm_driver.h @@ -51,7 +51,7 @@ typedef int (*rte_tm_node_capabilities_get_t)(struct rte_eth_dev *dev, /** @internal Traffic manager WRED profile add */ typedef int (*rte_tm_wred_profile_add_t)(struct rte_eth_dev *dev, uint32_t wred_profile_id, - struct rte_tm_wred_params *profile, + const struct rte_tm_wred_params *profile, struct rte_tm_error *error); /** @internal Traffic manager WRED profile delete */ -- 2.43.0