From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>,
Rosen Xu <rosen.xu@intel.com>,
Cristian Dumitrescu <cristian.dumitrescu@intel.com>,
Thomas Monjalon <thomas@monjalon.net>,
Ferruh Yigit <ferruh.yigit@amd.com>,
Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Subject: [PATCH 2/4] ethdev: make parameters to TM profile add fn constant
Date: Tue, 6 Aug 2024 16:24:15 +0100 [thread overview]
Message-ID: <20240806152417.3649745-3-bruce.richardson@intel.com> (raw)
In-Reply-To: <20240806152417.3649745-1-bruce.richardson@intel.com>
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 <bruce.richardson@intel.com>
---
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
next prev parent reply other threads:[~2024-08-06 15:25 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-06 15:24 [PATCH 0/4] improve rte_tm APIs Bruce Richardson
2024-08-06 15:24 ` [PATCH 1/4] ethdev: make parameters to TM node add fn constant Bruce Richardson
2024-08-07 7:27 ` Xu, Rosen
2024-09-22 16:10 ` Ferruh Yigit
2024-08-06 15:24 ` Bruce Richardson [this message]
2024-08-07 7:27 ` [PATCH 2/4] ethdev: make parameters to TM profile " Xu, Rosen
2024-09-22 16:11 ` Ferruh Yigit
2024-08-06 15:24 ` [PATCH 3/4] ethdev: make TM shaper parameters constant Bruce Richardson
2024-08-07 7:29 ` Xu, Rosen
2024-09-22 16:11 ` Ferruh Yigit
2024-08-06 15:24 ` [PATCH 4/4] ethdev: add traffic manager query function Bruce Richardson
2024-09-22 16:26 ` Ferruh Yigit
2024-10-07 11:04 ` Bruce Richardson
2024-10-08 10:56 ` Bruce Richardson
2024-10-07 11:49 ` [PATCH v2 0/3] make struct parameters constant in rte_tm APIs Bruce Richardson
2024-10-07 11:49 ` [PATCH v2 1/3] ethdev: make parameters to TM node add fn constant Bruce Richardson
2024-10-07 11:49 ` [PATCH v2 2/3] ethdev: make parameters to TM profile " Bruce Richardson
2024-10-07 11:49 ` [PATCH v2 3/3] ethdev: make TM shaper parameters constant Bruce Richardson
2024-10-07 15:22 ` [PATCH v2 0/3] make struct parameters constant in rte_tm APIs Stephen Hemminger
2024-10-08 0:38 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240806152417.3649745-3-bruce.richardson@intel.com \
--to=bruce.richardson@intel.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=cristian.dumitrescu@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=rosen.xu@intel.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).