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 DE7B145AD7; Mon, 7 Oct 2024 13:49:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B40F84278C; Mon, 7 Oct 2024 13:49:24 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by mails.dpdk.org (Postfix) with ESMTP id 9FC034278B for ; Mon, 7 Oct 2024 13:49:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1728301764; x=1759837764; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2oOsCdhhQOo1kCYWQHoHdpgyTy7HzwrrIQ8TTPbdNqA=; b=BkmeWJUdgfj7sY0H4IdVxYh/dB4BTq7/Oul1XJo5Wc11fLn1f8W9kvE+ knXdVlyyFLkW9rlfNKxo2sZIr6zlJ9g/Dam7B7QCzgZh08RoyFkDKqpGF VLm1GRHhloJd2qzhxkIxtWjbGhgtvSH8er3um0fiVdOWxQ7Y4E9aVQroM aOYuy3K15AUPiY/mYwfhwNGpIgmaG+1iYRTSzdFdOBqtPWEjht2APcwpu 3QzXpEg5Kh9m6hQDAH3MGy0xwcitezJKRh6uf4KsyKHbsIHwY4WwkxwJy nkm9g13D/pMG0qYD2BPqZfUz1TmObAO4Fa8nq1HATLAgClDvY8yVj6qC5 g==; X-CSE-ConnectionGUID: s84ZwCC5Tz6casmNCHaeyg== X-CSE-MsgGUID: 2HDZ4sdnR9uRNxxz+SdF1w== X-IronPort-AV: E=McAfee;i="6700,10204,11217"; a="31332476" X-IronPort-AV: E=Sophos;i="6.11,184,1725346800"; d="scan'208";a="31332476" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2024 04:49:22 -0700 X-CSE-ConnectionGUID: uprjq8+DR0+BAB4q+ptVHw== X-CSE-MsgGUID: LF6All4vSMid9TqYb08UCg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,184,1725346800"; d="scan'208";a="80427014" Received: from unknown (HELO silpixa00401385.ir.intel.com) ([10.237.214.25]) by orviesa004.jf.intel.com with ESMTP; 07 Oct 2024 04:49:21 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Rosen Xu , Ferruh Yigit Subject: [PATCH v2 2/3] ethdev: make parameters to TM profile add fn constant Date: Mon, 7 Oct 2024 12:49:06 +0100 Message-ID: <20241007114907.548941-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241007114907.548941-1-bruce.richardson@intel.com> References: <20240806152417.3649745-1-bruce.richardson@intel.com> <20241007114907.548941-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 Reviewed-by: Rosen Xu Acked-by: Ferruh Yigit --- 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