netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2-next 0/5] Implement new netlink attributes for devlink-rate in iproute2
@ 2022-11-25 12:34 Michal Wilczynski
  2022-11-25 12:34 ` [PATCH iproute2-next 1/5] devlink: Fix setting parent for 'rate add' Michal Wilczynski
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Michal Wilczynski @ 2022-11-25 12:34 UTC (permalink / raw)
  To: netdev
  Cc: alexandr.lobakin, przemyslaw.kitszel, jiri, wojciech.drewek,
	dsahern, stephen, Michal Wilczynski

Patch implementing new netlink attributes for devlink-rate got merged to
net-next.
https://lore.kernel.org/netdev/20221115104825.172668-1-michal.wilczynski@intel.com/

Now there is a need to support these new attributes in the userspace
tool. Implement tx_priority and tx_weight in devlink userspace tool. Update
documentation.

Michal Wilczynski (5):
  devlink: Fix setting parent for 'rate add'
  devlink: Add uapi changes for tx_priority and tx_weight
  devlink: Introduce new attribute 'tx_priority' to devlink-rate
  devlink: Introduce new attribute 'tx_weight' to devlink-rate
  devlink: Add documentation for tx_prority and tx_weight

 devlink/devlink.c            | 56 ++++++++++++++++++++++++++++++++++--
 include/uapi/linux/devlink.h |  3 ++
 man/man8/devlink-rate.8      | 22 ++++++++++++++
 3 files changed, 78 insertions(+), 3 deletions(-)

-- 
2.37.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH iproute2-next 1/5] devlink: Fix setting parent for 'rate add'
  2022-11-25 12:34 [PATCH iproute2-next 0/5] Implement new netlink attributes for devlink-rate in iproute2 Michal Wilczynski
@ 2022-11-25 12:34 ` Michal Wilczynski
  2022-11-28  2:38   ` David Ahern
  2022-11-25 12:34 ` [PATCH iproute2-next 2/5] devlink: Add uapi changes for tx_priority and tx_weight Michal Wilczynski
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Michal Wilczynski @ 2022-11-25 12:34 UTC (permalink / raw)
  To: netdev
  Cc: alexandr.lobakin, przemyslaw.kitszel, jiri, wojciech.drewek,
	dsahern, stephen, Michal Wilczynski

Setting a parent during creation of the node doesn't work, despite
documentation [1] clearly saying that it should.

[1] man/man8/devlink-rate.8

Example:
$ devlink port function rate add pci/0000:4b:00.0/node_custom parent node_0
  Unknown option "parent"

Fix this by passing DL_OPT_PORT_FN_RATE_PARENT as an argument to
dl_argv_parse() when it gets called from cmd_port_fn_rate_add().

Fixes: 6c70aca76ef2 ("devlink: Add port func rate support")
Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com>
Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
---
 devlink/devlink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 8aefa101b2f8..5cff018a2471 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -5030,7 +5030,8 @@ static int cmd_port_fn_rate_add(struct dl *dl)
 	int err;
 
 	err = dl_argv_parse(dl, DL_OPT_PORT_FN_RATE_NODE_NAME,
-			    DL_OPT_PORT_FN_RATE_TX_SHARE | DL_OPT_PORT_FN_RATE_TX_MAX);
+			    DL_OPT_PORT_FN_RATE_TX_SHARE | DL_OPT_PORT_FN_RATE_TX_MAX |
+			    DL_OPT_PORT_FN_RATE_PARENT);
 	if (err)
 		return err;
 
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH iproute2-next 2/5] devlink: Add uapi changes for tx_priority and tx_weight
  2022-11-25 12:34 [PATCH iproute2-next 0/5] Implement new netlink attributes for devlink-rate in iproute2 Michal Wilczynski
  2022-11-25 12:34 ` [PATCH iproute2-next 1/5] devlink: Fix setting parent for 'rate add' Michal Wilczynski
@ 2022-11-25 12:34 ` Michal Wilczynski
  2022-11-25 12:34 ` [PATCH iproute2-next 3/5] devlink: Introduce new attribute 'tx_priority' to devlink-rate Michal Wilczynski
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Michal Wilczynski @ 2022-11-25 12:34 UTC (permalink / raw)
  To: netdev
  Cc: alexandr.lobakin, przemyslaw.kitszel, jiri, wojciech.drewek,
	dsahern, stephen, Michal Wilczynski

Per discussion [1] I'm putting the uapi changes in separate commit.
Those changes are already merged to net-next [2].

[1] https://lore.kernel.org/netdev/48df4e83-a9b8-11db-aeaf-2015666af5a5@gmail.com/
[2] https://lore.kernel.org/netdev/20221115104825.172668-1-michal.wilczynski@intel.com/

Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com>
---
 include/uapi/linux/devlink.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index 0224b8bd49b2..b6b058e4bdb2 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -607,6 +607,9 @@ enum devlink_attr {
 
 	DEVLINK_ATTR_SELFTESTS,			/* nested */
 
+	DEVLINK_ATTR_RATE_TX_PRIORITY,		/* u32 */
+	DEVLINK_ATTR_RATE_TX_WEIGHT,		/* u32 */
+
 	/* add new attributes above here, update the policy in devlink.c */
 
 	__DEVLINK_ATTR_MAX,
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH iproute2-next 3/5] devlink: Introduce new attribute 'tx_priority' to devlink-rate
  2022-11-25 12:34 [PATCH iproute2-next 0/5] Implement new netlink attributes for devlink-rate in iproute2 Michal Wilczynski
  2022-11-25 12:34 ` [PATCH iproute2-next 1/5] devlink: Fix setting parent for 'rate add' Michal Wilczynski
  2022-11-25 12:34 ` [PATCH iproute2-next 2/5] devlink: Add uapi changes for tx_priority and tx_weight Michal Wilczynski
@ 2022-11-25 12:34 ` Michal Wilczynski
  2022-11-25 12:34 ` [PATCH iproute2-next 4/5] devlink: Introduce new attribute 'tx_weight' " Michal Wilczynski
  2022-11-25 12:34 ` [PATCH iproute2-next 5/5] devlink: Add documentation for tx_prority and tx_weight Michal Wilczynski
  4 siblings, 0 replies; 8+ messages in thread
From: Michal Wilczynski @ 2022-11-25 12:34 UTC (permalink / raw)
  To: netdev
  Cc: alexandr.lobakin, przemyslaw.kitszel, jiri, wojciech.drewek,
	dsahern, stephen, Michal Wilczynski

To fully utilize hierarchical QoS algorithm new attribute 'tx_priority'
needs to be introduced. Priority attribute allows for usage of strict
priority arbiter among siblings. This arbitration scheme attempts to
schedule nodes based on their priority as long as the nodes remain within
their bandwidth limit.

Introduce ability to configure tx_priority from devlink userspace
utility. Make the new attribute optional.

Example commands:
$ devlink port function rate add pci/0000:4b:00.0/node_custom \
  tx_priority 5 parent node_0
$ devlink port function rate set pci/0000:4b:00.0/2 tx_priority 5

Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com>
Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
---
 devlink/devlink.c | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 5cff018a2471..21241cb644bb 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -295,6 +295,7 @@ static void ifname_map_free(struct ifname_map *ifname_map)
 #define DL_OPT_LINECARD		BIT(52)
 #define DL_OPT_LINECARD_TYPE	BIT(53)
 #define DL_OPT_SELFTESTS	BIT(54)
+#define DL_OPT_PORT_FN_RATE_TX_PRIORITY	BIT(55)
 
 struct dl_opts {
 	uint64_t present; /* flags of present items */
@@ -353,6 +354,7 @@ struct dl_opts {
 	uint16_t rate_type;
 	uint64_t rate_tx_share;
 	uint64_t rate_tx_max;
+	uint32_t rate_tx_priority;
 	char *rate_node_name;
 	const char *rate_parent_node;
 	uint32_t linecard_index;
@@ -2048,6 +2050,13 @@ static int dl_argv_parse(struct dl *dl, uint64_t o_required,
 			if (err)
 				return err;
 			o_found |= DL_OPT_PORT_FN_RATE_TX_MAX;
+		} else if (dl_argv_match(dl, "tx_priority") &&
+			   (o_all & DL_OPT_PORT_FN_RATE_TX_PRIORITY)) {
+			dl_arg_inc(dl);
+			err = dl_argv_uint32_t(dl, &opts->rate_tx_priority);
+			if (err)
+				return err;
+			o_found |= DL_OPT_PORT_FN_RATE_TX_PRIORITY;
 		} else if (dl_argv_match(dl, "parent") &&
 			   (o_all & DL_OPT_PORT_FN_RATE_PARENT)) {
 			dl_arg_inc(dl);
@@ -2316,6 +2325,9 @@ static void dl_opts_put(struct nlmsghdr *nlh, struct dl *dl)
 	if (opts->present & DL_OPT_PORT_FN_RATE_TX_SHARE)
 		mnl_attr_put_u64(nlh, DEVLINK_ATTR_RATE_TX_SHARE,
 				 opts->rate_tx_share);
+	if (opts->present & DL_OPT_PORT_FN_RATE_TX_PRIORITY)
+		mnl_attr_put_u32(nlh, DEVLINK_ATTR_RATE_TX_PRIORITY,
+				 opts->rate_tx_priority);
 	if (opts->present & DL_OPT_PORT_FN_RATE_TX_MAX)
 		mnl_attr_put_u64(nlh, DEVLINK_ATTR_RATE_TX_MAX,
 				 opts->rate_tx_max);
@@ -4936,6 +4948,13 @@ static void pr_out_port_fn_rate(struct dl *dl, struct nlattr **tb)
 			print_rate(dl->use_iec, PRINT_ANY, "tx_max",
 				   " tx_max %s", rate);
 	}
+	if (tb[DEVLINK_ATTR_RATE_TX_PRIORITY]) {
+		uint32_t priority =
+			mnl_attr_get_u32(tb[DEVLINK_ATTR_RATE_TX_PRIORITY]);
+		if (priority)
+			print_uint(PRINT_ANY, "tx_priority",
+				   " tx_priority %u", priority);
+	}
 	if (tb[DEVLINK_ATTR_RATE_PARENT_NODE_NAME]) {
 		const char *parent =
 			mnl_attr_get_str(tb[DEVLINK_ATTR_RATE_PARENT_NODE_NAME]);
@@ -4967,11 +4986,12 @@ static void cmd_port_fn_rate_help(void)
 	pr_err("Usage: devlink port function rate help\n");
 	pr_err("       devlink port function rate show [ DEV/{ PORT_INDEX | NODE_NAME } ]\n");
 	pr_err("       devlink port function rate add DEV/NODE_NAME\n");
-	pr_err("               [ tx_share VAL ][ tx_max VAL ][ { parent NODE_NAME | noparent } ]\n");
+	pr_err("               [ tx_share VAL ][ tx_max VAL ][ tx_priority N ][ { parent NODE_NAME | noparent } ]\n");
 	pr_err("       devlink port function rate del DEV/NODE_NAME\n");
 	pr_err("       devlink port function rate set DEV/{ PORT_INDEX | NODE_NAME }\n");
-	pr_err("               [ tx_share VAL ][ tx_max VAL ][ { parent NODE_NAME | noparent } ]\n\n");
+	pr_err("               [ tx_share VAL ][ tx_max VAL ][ tx_priority N ][ { parent NODE_NAME | noparent } ]\n\n");
 	pr_err("       VAL - float or integer value in units of bits or bytes per second (bit|bps)\n");
+	pr_err("       N - integer representing priority of the node among siblings\n");
 	pr_err("       and SI (k-, m-, g-, t-) or IEC (ki-, mi-, gi-, ti-) case-insensitive prefix.\n");
 	pr_err("       Bare number, means bits per second, is possible.\n\n");
 	pr_err("       For details refer to devlink-rate(8) man page.\n");
@@ -5031,6 +5051,7 @@ static int cmd_port_fn_rate_add(struct dl *dl)
 
 	err = dl_argv_parse(dl, DL_OPT_PORT_FN_RATE_NODE_NAME,
 			    DL_OPT_PORT_FN_RATE_TX_SHARE | DL_OPT_PORT_FN_RATE_TX_MAX |
+			    DL_OPT_PORT_FN_RATE_TX_PRIORITY |
 			    DL_OPT_PORT_FN_RATE_PARENT);
 	if (err)
 		return err;
@@ -5085,6 +5106,9 @@ static int port_fn_get_rates_cb(const struct nlmsghdr *nlh, void *data)
 	if (tb[DEVLINK_ATTR_RATE_TX_MAX])
 		opts->rate_tx_max =
 			mnl_attr_get_u64(tb[DEVLINK_ATTR_RATE_TX_MAX]);
+	if (tb[DEVLINK_ATTR_RATE_TX_PRIORITY])
+		opts->rate_tx_priority =
+			mnl_attr_get_u32(tb[DEVLINK_ATTR_RATE_TX_PRIORITY]);
 	return MNL_CB_OK;
 }
 
@@ -5098,6 +5122,7 @@ static int cmd_port_fn_rate_set(struct dl *dl)
 				DL_OPT_PORT_FN_RATE_NODE_NAME,
 				DL_OPT_PORT_FN_RATE_TX_SHARE |
 				DL_OPT_PORT_FN_RATE_TX_MAX |
+				DL_OPT_PORT_FN_RATE_TX_PRIORITY |
 				DL_OPT_PORT_FN_RATE_PARENT);
 	if (err)
 		return err;
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH iproute2-next 4/5] devlink: Introduce new attribute 'tx_weight' to devlink-rate
  2022-11-25 12:34 [PATCH iproute2-next 0/5] Implement new netlink attributes for devlink-rate in iproute2 Michal Wilczynski
                   ` (2 preceding siblings ...)
  2022-11-25 12:34 ` [PATCH iproute2-next 3/5] devlink: Introduce new attribute 'tx_priority' to devlink-rate Michal Wilczynski
@ 2022-11-25 12:34 ` Michal Wilczynski
  2022-11-25 12:34 ` [PATCH iproute2-next 5/5] devlink: Add documentation for tx_prority and tx_weight Michal Wilczynski
  4 siblings, 0 replies; 8+ messages in thread
From: Michal Wilczynski @ 2022-11-25 12:34 UTC (permalink / raw)
  To: netdev
  Cc: alexandr.lobakin, przemyslaw.kitszel, jiri, wojciech.drewek,
	dsahern, stephen, Michal Wilczynski

To fully utilize hierarchical QoS algorithm new attribute 'tx_weight'
needs to be introduced. Weight attribute allows for usage of Weighted
Fair Queuing arbitration scheme among siblings. This arbitration
scheme can be used simultaneously with the strict priority.

Introduce ability to configure tx_weight from devlink userspace
utility. Make the new attribute optional.

Example commands:
$ devlink port function rate add pci/0000:4b:00.0/node_custom \
  tx_weight 50 parent node_0

$ devlink port function rate set pci/0000:4b:00.0/2 tx_weight 20

Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com>
Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
---
 devlink/devlink.c | 30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 21241cb644bb..d420467cfe7d 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -296,6 +296,7 @@ static void ifname_map_free(struct ifname_map *ifname_map)
 #define DL_OPT_LINECARD_TYPE	BIT(53)
 #define DL_OPT_SELFTESTS	BIT(54)
 #define DL_OPT_PORT_FN_RATE_TX_PRIORITY	BIT(55)
+#define DL_OPT_PORT_FN_RATE_TX_WEIGHT	BIT(56)
 
 struct dl_opts {
 	uint64_t present; /* flags of present items */
@@ -355,6 +356,7 @@ struct dl_opts {
 	uint64_t rate_tx_share;
 	uint64_t rate_tx_max;
 	uint32_t rate_tx_priority;
+	uint32_t rate_tx_weight;
 	char *rate_node_name;
 	const char *rate_parent_node;
 	uint32_t linecard_index;
@@ -2057,6 +2059,13 @@ static int dl_argv_parse(struct dl *dl, uint64_t o_required,
 			if (err)
 				return err;
 			o_found |= DL_OPT_PORT_FN_RATE_TX_PRIORITY;
+		} else if (dl_argv_match(dl, "tx_weight") &&
+			   (o_all & DL_OPT_PORT_FN_RATE_TX_WEIGHT)) {
+			dl_arg_inc(dl);
+			err = dl_argv_uint32_t(dl, &opts->rate_tx_weight);
+			if (err)
+				return err;
+			o_found |= DL_OPT_PORT_FN_RATE_TX_WEIGHT;
 		} else if (dl_argv_match(dl, "parent") &&
 			   (o_all & DL_OPT_PORT_FN_RATE_PARENT)) {
 			dl_arg_inc(dl);
@@ -2328,6 +2337,9 @@ static void dl_opts_put(struct nlmsghdr *nlh, struct dl *dl)
 	if (opts->present & DL_OPT_PORT_FN_RATE_TX_PRIORITY)
 		mnl_attr_put_u32(nlh, DEVLINK_ATTR_RATE_TX_PRIORITY,
 				 opts->rate_tx_priority);
+	if (opts->present & DL_OPT_PORT_FN_RATE_TX_WEIGHT)
+		mnl_attr_put_u32(nlh, DEVLINK_ATTR_RATE_TX_WEIGHT,
+				 opts->rate_tx_weight);
 	if (opts->present & DL_OPT_PORT_FN_RATE_TX_MAX)
 		mnl_attr_put_u64(nlh, DEVLINK_ATTR_RATE_TX_MAX,
 				 opts->rate_tx_max);
@@ -4955,6 +4967,13 @@ static void pr_out_port_fn_rate(struct dl *dl, struct nlattr **tb)
 			print_uint(PRINT_ANY, "tx_priority",
 				   " tx_priority %u", priority);
 	}
+	if (tb[DEVLINK_ATTR_RATE_TX_WEIGHT]) {
+		uint32_t weight =
+			mnl_attr_get_u32(tb[DEVLINK_ATTR_RATE_TX_WEIGHT]);
+		if (weight)
+			print_uint(PRINT_ANY, "tx_weight",
+				   " tx_weight %u", weight);
+	}
 	if (tb[DEVLINK_ATTR_RATE_PARENT_NODE_NAME]) {
 		const char *parent =
 			mnl_attr_get_str(tb[DEVLINK_ATTR_RATE_PARENT_NODE_NAME]);
@@ -4986,12 +5005,12 @@ static void cmd_port_fn_rate_help(void)
 	pr_err("Usage: devlink port function rate help\n");
 	pr_err("       devlink port function rate show [ DEV/{ PORT_INDEX | NODE_NAME } ]\n");
 	pr_err("       devlink port function rate add DEV/NODE_NAME\n");
-	pr_err("               [ tx_share VAL ][ tx_max VAL ][ tx_priority N ][ { parent NODE_NAME | noparent } ]\n");
+	pr_err("               [ tx_share VAL ][ tx_max VAL ][ tx_priority N ][ tx_weight N ][ { parent NODE_NAME | noparent } ]\n");
 	pr_err("       devlink port function rate del DEV/NODE_NAME\n");
 	pr_err("       devlink port function rate set DEV/{ PORT_INDEX | NODE_NAME }\n");
-	pr_err("               [ tx_share VAL ][ tx_max VAL ][ tx_priority N ][ { parent NODE_NAME | noparent } ]\n\n");
+	pr_err("               [ tx_share VAL ][ tx_max VAL ][ tx_priority N ][ tx_weight N ][ { parent NODE_NAME | noparent } ]\n\n");
 	pr_err("       VAL - float or integer value in units of bits or bytes per second (bit|bps)\n");
-	pr_err("       N - integer representing priority of the node among siblings\n");
+	pr_err("       N - integer representing priority/weight of the node among siblings\n");
 	pr_err("       and SI (k-, m-, g-, t-) or IEC (ki-, mi-, gi-, ti-) case-insensitive prefix.\n");
 	pr_err("       Bare number, means bits per second, is possible.\n\n");
 	pr_err("       For details refer to devlink-rate(8) man page.\n");
@@ -5052,6 +5071,7 @@ static int cmd_port_fn_rate_add(struct dl *dl)
 	err = dl_argv_parse(dl, DL_OPT_PORT_FN_RATE_NODE_NAME,
 			    DL_OPT_PORT_FN_RATE_TX_SHARE | DL_OPT_PORT_FN_RATE_TX_MAX |
 			    DL_OPT_PORT_FN_RATE_TX_PRIORITY |
+			    DL_OPT_PORT_FN_RATE_TX_WEIGHT |
 			    DL_OPT_PORT_FN_RATE_PARENT);
 	if (err)
 		return err;
@@ -5109,6 +5129,9 @@ static int port_fn_get_rates_cb(const struct nlmsghdr *nlh, void *data)
 	if (tb[DEVLINK_ATTR_RATE_TX_PRIORITY])
 		opts->rate_tx_priority =
 			mnl_attr_get_u32(tb[DEVLINK_ATTR_RATE_TX_PRIORITY]);
+	if (tb[DEVLINK_ATTR_RATE_TX_WEIGHT])
+		opts->rate_tx_weight =
+			mnl_attr_get_u32(tb[DEVLINK_ATTR_RATE_TX_WEIGHT]);
 	return MNL_CB_OK;
 }
 
@@ -5123,6 +5146,7 @@ static int cmd_port_fn_rate_set(struct dl *dl)
 				DL_OPT_PORT_FN_RATE_TX_SHARE |
 				DL_OPT_PORT_FN_RATE_TX_MAX |
 				DL_OPT_PORT_FN_RATE_TX_PRIORITY |
+				DL_OPT_PORT_FN_RATE_TX_WEIGHT |
 				DL_OPT_PORT_FN_RATE_PARENT);
 	if (err)
 		return err;
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH iproute2-next 5/5] devlink: Add documentation for tx_prority and tx_weight
  2022-11-25 12:34 [PATCH iproute2-next 0/5] Implement new netlink attributes for devlink-rate in iproute2 Michal Wilczynski
                   ` (3 preceding siblings ...)
  2022-11-25 12:34 ` [PATCH iproute2-next 4/5] devlink: Introduce new attribute 'tx_weight' " Michal Wilczynski
@ 2022-11-25 12:34 ` Michal Wilczynski
  4 siblings, 0 replies; 8+ messages in thread
From: Michal Wilczynski @ 2022-11-25 12:34 UTC (permalink / raw)
  To: netdev
  Cc: alexandr.lobakin, przemyslaw.kitszel, jiri, wojciech.drewek,
	dsahern, stephen, Michal Wilczynski

New netlink attributes tx_priority and tx_weight were added.
Update the man page for devlink-rate to account for new attributes.

Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com>
Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
---
 man/man8/devlink-rate.8 | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/man/man8/devlink-rate.8 b/man/man8/devlink-rate.8
index cc2f50c38619..bcec3c31673a 100644
--- a/man/man8/devlink-rate.8
+++ b/man/man8/devlink-rate.8
@@ -26,12 +26,16 @@ devlink-rate \- devlink rate management
 .RI "{ " DEV/PORT_INDEX " | " DEV/NODE_NAME " } "
 .RB [ " tx_share \fIVALUE " ]
 .RB [ " tx_max \fIVALUE " ]
+.RB [ " tx_priority \fIN " ]
+.RB [ " tx_weight \fIN " ]
 .RB "[ {" " parent \fINODE_NAME " | " noparent " "} ]"
 
 .ti -8
 .BI "devlink port function rate add " DEV/NODE_NAME
 .RB [ " tx_share \fIVALUE " ]
 .RB [ " tx_max \fIVALUE " ]
+.RB [ " tx_priority \fIN " ]
+.RB [ " tx_weight \fIN " ]
 .RB "[ {" " parent \fINODE_NAME " | " noparent " "} ]"
 
 .ti -8
@@ -83,6 +87,20 @@ rate group.
 .PP
 .BI tx_max " VALUE"
 - specifies maximum tx rate value.
+.PP
+.BI tx_priority " N"
+- allows for usage of strict priority arbiter among siblings. This arbitration
+scheme attempts to schedule nodes based on their priority as long as the nodes
+remain within their bandwidth limit. The higher the priority the higher the
+probability that the node will get selected for scheduling.
+.PP
+.BI tx_weight " N"
+- allows for usage of Weighted Fair Queuing arbitration scheme among siblings.
+This arbitration scheme can be used simultaneously with the strict priority.
+As a node is configured with a higher rate it gets more BW relative to it's
+siblings. Values are relative like a percentage points, they basically tell
+how much BW should node take relative to it's siblings.
+.PP
 .TP 8
 .I VALUE
 These parameter accept a floating point number, possibly followed by either a
@@ -123,6 +141,10 @@ To specify in IEC units, replace the SI prefix (k-, m-, g-, t-) with IEC prefix
 (ki-, mi-, gi- and ti-) respectively. Input is case-insensitive.
 .RE
 .PP
+.TP 8
+.I N
+These parameter accept integer meaning weight or priority of a node.
+.PP
 .BI parent " NODE_NAME \fR| " noparent
 - set rate object parent to existing node with name \fINODE_NAME\fR or unset
 parent. Rate limits of the parent node applied to all it's children. Actual
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH iproute2-next 1/5] devlink: Fix setting parent for 'rate add'
  2022-11-25 12:34 ` [PATCH iproute2-next 1/5] devlink: Fix setting parent for 'rate add' Michal Wilczynski
@ 2022-11-28  2:38   ` David Ahern
  2022-11-28  9:51     ` Wilczynski, Michal
  0 siblings, 1 reply; 8+ messages in thread
From: David Ahern @ 2022-11-28  2:38 UTC (permalink / raw)
  To: Michal Wilczynski, netdev
  Cc: alexandr.lobakin, przemyslaw.kitszel, jiri, wojciech.drewek, stephen

On 11/25/22 5:34 AM, Michal Wilczynski wrote:
> Setting a parent during creation of the node doesn't work, despite
> documentation [1] clearly saying that it should.
> 
> [1] man/man8/devlink-rate.8
> 
> Example:
> $ devlink port function rate add pci/0000:4b:00.0/node_custom parent node_0
>   Unknown option "parent"
> 
> Fix this by passing DL_OPT_PORT_FN_RATE_PARENT as an argument to
> dl_argv_parse() when it gets called from cmd_port_fn_rate_add().
> 
> Fixes: 6c70aca76ef2 ("devlink: Add port func rate support")

so this is a bug fix that needs to go in main branch first?


> Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com>
> Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
> ---
>  devlink/devlink.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/devlink/devlink.c b/devlink/devlink.c
> index 8aefa101b2f8..5cff018a2471 100644
> --- a/devlink/devlink.c
> +++ b/devlink/devlink.c
> @@ -5030,7 +5030,8 @@ static int cmd_port_fn_rate_add(struct dl *dl)
>  	int err;
>  
>  	err = dl_argv_parse(dl, DL_OPT_PORT_FN_RATE_NODE_NAME,
> -			    DL_OPT_PORT_FN_RATE_TX_SHARE | DL_OPT_PORT_FN_RATE_TX_MAX);
> +			    DL_OPT_PORT_FN_RATE_TX_SHARE | DL_OPT_PORT_FN_RATE_TX_MAX |
> +			    DL_OPT_PORT_FN_RATE_PARENT);
>  	if (err)
>  		return err;
>  


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH iproute2-next 1/5] devlink: Fix setting parent for 'rate add'
  2022-11-28  2:38   ` David Ahern
@ 2022-11-28  9:51     ` Wilczynski, Michal
  0 siblings, 0 replies; 8+ messages in thread
From: Wilczynski, Michal @ 2022-11-28  9:51 UTC (permalink / raw)
  To: David Ahern, netdev
  Cc: alexandr.lobakin, przemyslaw.kitszel, jiri, wojciech.drewek, stephen



On 11/28/2022 3:38 AM, David Ahern wrote:
> On 11/25/22 5:34 AM, Michal Wilczynski wrote:
>> Setting a parent during creation of the node doesn't work, despite
>> documentation [1] clearly saying that it should.
>>
>> [1] man/man8/devlink-rate.8
>>
>> Example:
>> $ devlink port function rate add pci/0000:4b:00.0/node_custom parent node_0
>>   Unknown option "parent"
>>
>> Fix this by passing DL_OPT_PORT_FN_RATE_PARENT as an argument to
>> dl_argv_parse() when it gets called from cmd_port_fn_rate_add().
>>
>> Fixes: 6c70aca76ef2 ("devlink: Add port func rate support")
> so this is a bug fix that needs to go in main branch first?

I'm fine with this going to main branch first.
Would you like me to re-send this patch separately targeting iproute2 instead
of iproute2-next ?

Thanks,
Michał

>
>
>> Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com>
>> Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
>> ---
>>  devlink/devlink.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/devlink/devlink.c b/devlink/devlink.c
>> index 8aefa101b2f8..5cff018a2471 100644
>> --- a/devlink/devlink.c
>> +++ b/devlink/devlink.c
>> @@ -5030,7 +5030,8 @@ static int cmd_port_fn_rate_add(struct dl *dl)
>>  	int err;
>>  
>>  	err = dl_argv_parse(dl, DL_OPT_PORT_FN_RATE_NODE_NAME,
>> -			    DL_OPT_PORT_FN_RATE_TX_SHARE | DL_OPT_PORT_FN_RATE_TX_MAX);
>> +			    DL_OPT_PORT_FN_RATE_TX_SHARE | DL_OPT_PORT_FN_RATE_TX_MAX |
>> +			    DL_OPT_PORT_FN_RATE_PARENT);
>>  	if (err)
>>  		return err;
>>  


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-11-28  9:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-25 12:34 [PATCH iproute2-next 0/5] Implement new netlink attributes for devlink-rate in iproute2 Michal Wilczynski
2022-11-25 12:34 ` [PATCH iproute2-next 1/5] devlink: Fix setting parent for 'rate add' Michal Wilczynski
2022-11-28  2:38   ` David Ahern
2022-11-28  9:51     ` Wilczynski, Michal
2022-11-25 12:34 ` [PATCH iproute2-next 2/5] devlink: Add uapi changes for tx_priority and tx_weight Michal Wilczynski
2022-11-25 12:34 ` [PATCH iproute2-next 3/5] devlink: Introduce new attribute 'tx_priority' to devlink-rate Michal Wilczynski
2022-11-25 12:34 ` [PATCH iproute2-next 4/5] devlink: Introduce new attribute 'tx_weight' " Michal Wilczynski
2022-11-25 12:34 ` [PATCH iproute2-next 5/5] devlink: Add documentation for tx_prority and tx_weight Michal Wilczynski

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).